[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] r3593 - in trunk/pingus: . src
From: |
grumbel at BerliOS |
Subject: |
[Pingus-CVS] r3593 - in trunk/pingus: . src |
Date: |
Mon, 30 Jun 2008 06:21:04 +0200 |
Author: grumbel
Date: 2008-06-30 06:21:02 +0200 (Mon, 30 Jun 2008)
New Revision: 3593
Added:
trunk/pingus/src/pingus_demo.cpp
trunk/pingus/src/pingus_demo.hpp
Modified:
trunk/pingus/SConstruct
trunk/pingus/src/client.cpp
trunk/pingus/src/client.hpp
trunk/pingus/src/demo_player.cpp
trunk/pingus/src/demo_player.hpp
trunk/pingus/src/demo_session.cpp
trunk/pingus/src/demo_session.hpp
trunk/pingus/src/server.cpp
trunk/pingus/src/server_event.cpp
Log:
Some more messing around with demo recording
Modified: trunk/pingus/SConstruct
===================================================================
--- trunk/pingus/SConstruct 2008-06-30 03:13:32 UTC (rev 3592)
+++ trunk/pingus/SConstruct 2008-06-30 04:21:02 UTC (rev 3593)
@@ -78,7 +78,6 @@
'src/debug.cpp',
'src/debug_stream.cpp',
# 'demo_player.cpp',
-'src/demo_recorder.cpp',
# 'demo_session.cpp',
'src/direction.cpp',
'src/display/drawing_context.cpp',
@@ -204,6 +203,7 @@
'src/pingu_holder.cpp',
'src/pingus_error.cpp',
'src/pingus_level.cpp',
+'src/pingus_demo.cpp',
'src/pingus_main.cpp',
'src/pingus_menu.cpp',
'src/pingus_menu_manager.cpp',
@@ -242,7 +242,6 @@
'src/tinygettext/dictionary_manager.cpp',
'src/tinygettext/dictionary.cpp',
'src/tinygettext/language_def.cpp',
-'src/true_server.cpp',
'src/math/vector2f.cpp',
'src/math/vector2i.cpp',
'src/math/vector3f.cpp',
@@ -512,7 +511,7 @@
print "\nError are being ignored, the build continues"
config_h = open('config.h', 'w')
- config_h.write('#define VERSION "0.7.2"\n')
+ config_h.write('#define VERSION "0.7.3"\n')
config_h.write('#define ENABLE_BINRELOC 1\n')
config_h.write('#define ICONV_CONST %s\n' % iconv_const)
for (v,k) in config_h_defines:
Modified: trunk/pingus/src/client.cpp
===================================================================
--- trunk/pingus/src/client.cpp 2008-06-30 03:13:32 UTC (rev 3592)
+++ trunk/pingus/src/client.cpp 2008-06-30 04:21:02 UTC (rev 3593)
@@ -85,22 +85,23 @@
Client::draw_background (DrawingContext& gc)
{
Rect rect = playfield->get_rect();
+
if (rect != Rect(Vector2i(0,0), Size(Display::get_width(),
Display::get_height())))
- {
- Color border_color(50, 65, 75);
- // top
- gc.draw_fillrect(0, 0, Display::get_width(), rect.top,
- border_color);
- // bottom
- gc.draw_fillrect(0, rect.bottom, Display::get_width(),
Display::get_height(),
- border_color);
- // left
- gc.draw_fillrect(0, rect.top, rect.left, rect.bottom,
- border_color);
- // right
- gc.draw_fillrect(rect.right, rect.top, Display::get_width(), rect.bottom,
- border_color);
- }
+ { // Draw a black border around the playfield when the playfield is
smaller then the screen
+ Color border_color(0, 0, 0);
+ // top
+ gc.draw_fillrect(0, 0, Display::get_width(), rect.top,
+ border_color);
+ // bottom
+ gc.draw_fillrect(0, rect.bottom, Display::get_width(),
Display::get_height(),
+ border_color);
+ // left
+ gc.draw_fillrect(0, rect.top, rect.left, rect.bottom,
+ border_color);
+ // right
+ gc.draw_fillrect(rect.right, rect.top, Display::get_width(), rect.bottom,
+ border_color);
+ }
}
void
@@ -113,10 +114,10 @@
void
Client::process_events (const GameDelta& delta)
{
- const Input::EventLst& events = delta.get_events ();
+ const Input::EventLst& events = delta.get_events();
- for (Input::EventLst::const_iterator i = events.begin ();
- i != events.end ();
+ for (Input::EventLst::const_iterator i = events.begin();
+ i != events.end();
++i)
{
//std::cout << "Events: " << (*i)->get_type () << std::endl;
Modified: trunk/pingus/src/client.hpp
===================================================================
--- trunk/pingus/src/client.hpp 2008-06-30 03:13:32 UTC (rev 3592)
+++ trunk/pingus/src/client.hpp 2008-06-30 04:21:02 UTC (rev 3593)
@@ -76,7 +76,6 @@
/** Update all parts of the world */
void update (const GameDelta&);
void draw_background (DrawingContext& gc);
- //void process_events ();
ButtonPanel* get_button_panel () { return button_panel; }
Modified: trunk/pingus/src/demo_player.cpp
===================================================================
--- trunk/pingus/src/demo_player.cpp 2008-06-30 03:13:32 UTC (rev 3592)
+++ trunk/pingus/src/demo_player.cpp 2008-06-30 04:21:02 UTC (rev 3593)
@@ -21,8 +21,7 @@
#include "server.hpp"
#include "demo_player.hpp"
#include "xml_pdf.hpp"
-
-
+
DemoPlayer::DemoPlayer(Server* s, XMLPDF* pdf)
: server(s),
events(pdf->get_events())
@@ -53,6 +52,5 @@
std::cout << "DemoPlayer Bug: We missed a timestamp: " <<
events.back().time_stamp << std::endl;
}
}
-
-
+
/* EOF */
Modified: trunk/pingus/src/demo_player.hpp
===================================================================
--- trunk/pingus/src/demo_player.hpp 2008-06-30 03:13:32 UTC (rev 3592)
+++ trunk/pingus/src/demo_player.hpp 2008-06-30 04:21:02 UTC (rev 3593)
@@ -23,10 +23,9 @@
#include <vector>
#include "server_event.hpp"
-
class Server;
class XMLPDF;
-
+
class DemoPlayer
{
private:
@@ -43,8 +42,7 @@
DemoPlayer (const DemoPlayer&);
DemoPlayer& operator= (const DemoPlayer&);
};
-
-
+
#endif
/* EOF */
Modified: trunk/pingus/src/demo_session.cpp
===================================================================
--- trunk/pingus/src/demo_session.cpp 2008-06-30 03:13:32 UTC (rev 3592)
+++ trunk/pingus/src/demo_session.cpp 2008-06-30 04:21:02 UTC (rev 3593)
@@ -28,8 +28,7 @@
#include "gui/gui_manager.hpp"
#include "display/scene_context.hpp"
#include "demo_session.hpp"
-
-
+
DemoSession::DemoSession(const std::string& filename)
{
// Load Demo file
@@ -111,6 +110,5 @@
demo_player->update();
}
}
-
-
+
/* EOF */
Modified: trunk/pingus/src/demo_session.hpp
===================================================================
--- trunk/pingus/src/demo_session.hpp 2008-06-30 03:13:32 UTC (rev 3592)
+++ trunk/pingus/src/demo_session.hpp 2008-06-30 04:21:02 UTC (rev 3593)
@@ -40,6 +40,7 @@
// GUI stuff
PingusCounter* pcounter;
+
public:
/** @param filename the complete filename of the demo file */
DemoSession(const std::string& filename);
Added: trunk/pingus/src/pingus_demo.cpp
===================================================================
--- trunk/pingus/src/pingus_demo.cpp 2008-06-30 03:13:32 UTC (rev 3592)
+++ trunk/pingus/src/pingus_demo.cpp 2008-06-30 04:21:02 UTC (rev 3593)
@@ -0,0 +1,57 @@
+// $Id$
+//
+// Pingus - A free Lemmings clone
+// Copyright (C) 2008 Ingo Ruhnke <address@hidden>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+#include <stdexcept>
+#include <fstream>
+#include "pathname.hpp"
+#include "server_event.hpp"
+#include "pingu_enums.hpp"
+#include "pingus_demo.hpp"
+
+PingusDemo::PingusDemo(const Pathname& pathname)
+{
+ std::ifstream in(pathname.get_sys_path().c_str());
+ std::string line;
+
+ while(std::getline(in, line))
+ {
+ char action[256];
+ int time;
+ int id;
+
+ if (sscanf(line.c_str(), "(pingu-action (time %d) (id %d) (action
\"%s\"))", &time, &id, action) == 3)
+ {
+ ServerEvent::make_pingu_action_event(time, id,
Actions::action_from_string(action));
+ }
+ else if (sscanf(line.c_str(), "(armageddon (time %d))", &time) == 1)
+ {
+ ServerEvent::make_armageddon_event(time);
+ }
+ else if (sscanf(line.c_str(), "(finish (time %d))", &time) == 1)
+ {
+ ServerEvent::make_finish_event(time);
+ }
+ else
+ {
+ throw std::runtime_error("Couldn't open " + pathname.str());
+ }
+ }
+}
+
+/* EOF */
Property changes on: trunk/pingus/src/pingus_demo.cpp
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Added: trunk/pingus/src/pingus_demo.hpp
===================================================================
--- trunk/pingus/src/pingus_demo.hpp 2008-06-30 03:13:32 UTC (rev 3592)
+++ trunk/pingus/src/pingus_demo.hpp 2008-06-30 04:21:02 UTC (rev 3593)
@@ -0,0 +1,40 @@
+// $Id$
+//
+// Pingus - A free Lemmings clone
+// Copyright (C) 2008 Ingo Ruhnke <address@hidden>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+#ifndef HEADER_PINGUS_DEMO_HPP
+#define HEADER_PINGUS_DEMO_HPP
+
+class Pathname;
+
+/** */
+class PingusDemo
+{
+private:
+public:
+ PingusDemo(const Pathname& pathname);
+
+
+private:
+ PingusDemo (const PingusDemo&);
+ PingusDemo& operator= (const PingusDemo&);
+};
+
+#endif
+
+/* EOF */
Property changes on: trunk/pingus/src/pingus_demo.hpp
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Modified: trunk/pingus/src/server.cpp
===================================================================
--- trunk/pingus/src/server.cpp 2008-06-30 03:13:32 UTC (rev 3592)
+++ trunk/pingus/src/server.cpp 2008-06-30 04:21:02 UTC (rev 3593)
@@ -164,10 +164,6 @@
}
#if 0
-
-DemoRecorder::DemoRecorder (Server* server)
- : record_demo (true)
-{
std::string levelname = server->get_plf().get_resname();
std::string flat_levelname = levelname;
@@ -178,7 +174,7 @@
if (!levelname.empty())
{
- std::string filename = System::get_userdir() + "demos/" + flat_levelname
+ "-" + get_date() + ".xml";
+ std::string filename = System::get_userdir() + "demos/" + flat_levelname
+ "-" + get_date_string() + ".pingus-demo";
out.open(filename.c_str());
if (!out)
@@ -201,14 +197,9 @@
else
{
record_demo = false;
- // This point should only be reachable if we have a bug
- // somewhere or provide a way to get a PLF without using XMLPLF,
- // since we don't do that, a bug must be somewhere when we reach
- // this.
- assert(!"ERROR: DemoRecorder: Couldn't get levelname, please report this
as a bug!");
+
}
-}
-
#endif
+
/* EOF */
Modified: trunk/pingus/src/server_event.cpp
===================================================================
--- trunk/pingus/src/server_event.cpp 2008-06-30 03:13:32 UTC (rev 3592)
+++ trunk/pingus/src/server_event.cpp 2008-06-30 04:21:02 UTC (rev 3593)
@@ -60,15 +60,15 @@
switch(type)
{
case ARMAGEDDON_EVENT:
- out << " (armageddon (time " << time_stamp << "))" << std::endl;
+ out << "(armageddon (time " << time_stamp << "))" << std::endl;
break;
case FINISH_EVENT:
- out << " (finish (time " << time_stamp << "))" << std::endl;
+ out << "(finish (time " << time_stamp << "))" << std::endl;
break;
case PINGU_ACTION_EVENT:
- out << " (pingu-action "
+ out << "(pingu-action "
<< "(time " << time_stamp << ") "
<< "(id " << pingu_id << ") "
<< "(action \"" << Actions::action_to_string(pingu_action) << "\"))"
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] r3593 - in trunk/pingus: . src,
grumbel at BerliOS <=