[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] CVS: Games/Pingus/src entrance.cxx,1.2,1.3 game_time.cxx,1.
From: |
grumbel |
Subject: |
[Pingus-CVS] CVS: Games/Pingus/src entrance.cxx,1.2,1.3 game_time.cxx,1.2,1.3 game_time.hxx,1.2,1.3 global_event.cxx,1.5,1.6 server.cxx,1.5,1.6 world.cxx,1.10,1.11 |
Date: |
28 Jun 2002 08:32:23 -0000 |
Update of /usr/local/cvsroot/Games/Pingus/src
In directory dark:/tmp/cvs-serv28920
Modified Files:
entrance.cxx game_time.cxx game_time.hxx global_event.cxx
server.cxx world.cxx
Log Message:
- some cleanup to the GameTime class
- disabled some parts of the console
Index: entrance.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/entrance.cxx,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- entrance.cxx 13 Jun 2002 14:25:12 -0000 1.2
+++ entrance.cxx 28 Jun 2002 08:32:20 -0000 1.3
@@ -38,8 +38,8 @@
bool
Entrance::pingu_ready()
{
- if (last_release < (GameTime::get_time() - release_rate)) {
- last_release = GameTime::get_time();
+ if (last_release < (GameTime::get_ticks() - release_rate)) {
+ last_release = GameTime::get_ticks();
return true;
} else {
return false;
Index: game_time.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/game_time.cxx,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- game_time.cxx 13 Jun 2002 14:25:12 -0000 1.2
+++ game_time.cxx 28 Jun 2002 08:32:20 -0000 1.3
@@ -17,14 +17,27 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#include "globals.hxx"
#include "game_time.hxx"
int GameTime::count;
+int
+GameTime::get_time ()
+{
+ return count * game_speed;
+}
+
int
-GameTime::get_time(void)
+GameTime::get_ticks(void)
{
return count;
+}
+
+int
+GameTime::get_tick_time ()
+{
+ return game_speed;
}
void
Index: game_time.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/game_time.hxx,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- game_time.hxx 24 Jun 2002 22:52:54 -0000 1.2
+++ game_time.hxx 28 Jun 2002 08:32:20 -0000 1.3
@@ -20,22 +20,35 @@
#ifndef HEADER_PINGUS_GAME_TIME_HXX
#define HEADER_PINGUS_GAME_TIME_HXX
-///
+/** The GameTime represents the time which passes in the Pingus World.
+ Its behaviour is analogue to CL_System::get_time (), but with the
+ difference that it only increases if the game runs, if the game is
+ in pause mode, the time will not continue.
+
+ FIXME: This should not be a static singletone class */
class GameTime
{
private:
- ///
+ /** Tick counter */
static int count;
public:
- ///
- static int get_time(void);
- ///
+ /** Number of ticks since the time starts, a tick is one basically
+ update call to the world */
+ static int get_ticks(void);
+
+ /** Return the passed time in miliseconds (1000msec = 1sec) */
+ static int get_time ();
+
+ /** Return in realtime (milisecondons ) how long a tick normally takes */
+ static int get_tick_time ();
+
+ /** Increase the tick count */
static void increase(void);
- ///
+
+ /** Start from zero */
static void reset(void);
-}///
-;
+};
#endif
Index: global_event.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/global_event.cxx,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- global_event.cxx 26 Jun 2002 16:49:33 -0000 1.5
+++ global_event.cxx 28 Jun 2002 08:32:20 -0000 1.6
@@ -43,23 +43,23 @@
{
// F1 is the general console modifer key...
case CL_KEY_PAGEUP:
- if (CL_Keyboard::get_keycode(PINGUS_CL_KEY_HELP))
- console.increase_lines();
+ //if (CL_Keyboard::get_keycode(PINGUS_CL_KEY_HELP))
+ //console.increase_lines();
break;
case CL_KEY_PAGEDOWN:
- if (CL_Keyboard::get_keycode(PINGUS_CL_KEY_HELP))
- console.decrease_lines();
+ //if (CL_Keyboard::get_keycode(PINGUS_CL_KEY_HELP))
+ // console.decrease_lines();
break;
case CL_KEY_UP:
- if (CL_Keyboard::get_keycode(PINGUS_CL_KEY_HELP))
- console.scroll_up();
+ //if (CL_Keyboard::get_keycode(PINGUS_CL_KEY_HELP))
+ // console.scroll_up();
break;
case CL_KEY_DOWN:
- if (CL_Keyboard::get_keycode(PINGUS_CL_KEY_HELP))
- console.scroll_down();
+ //if (CL_Keyboard::get_keycode(PINGUS_CL_KEY_HELP))
+ // console.scroll_down();
break;
case PINGUS_CL_KEY_HELP:
Index: server.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/server.cxx,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- server.cxx 26 Jun 2002 17:43:18 -0000 1.5
+++ server.cxx 28 Jun 2002 08:32:20 -0000 1.6
@@ -104,7 +104,7 @@
void
Server::send_event(std::string event)
{
- recorder.queue_event(to_string(GameTime::get_time()) + ":" + event);
+ recorder.queue_event(to_string(GameTime::get_ticks()) + ":" + event);
process_event(event);
}
Index: world.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/world.cxx,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- world.cxx 26 Jun 2002 19:13:13 -0000 1.10
+++ world.cxx 28 Jun 2002 08:32:20 -0000 1.11
@@ -125,7 +125,7 @@
{
if (verbose) std::cout << "World: world finished, going down in the next
seconds..." << endl;
exit_world = true;
- shutdown_time = GameTime::get_time() + 75;
+ shutdown_time = GameTime::get_ticks() + 75;
}
if (do_armageddon && armageddon_count != pingus->end())
@@ -257,7 +257,7 @@
{
if (exit_time != -1) // There is a time limit
{
- return exit_time - GameTime::get_time();
+ return exit_time - GameTime::get_ticks();
}
else // No timelimit given
{
@@ -268,7 +268,7 @@
int
World::get_time_passed()
{
- return GameTime::get_time();
+ return GameTime::get_ticks();
}
unsigned int
@@ -294,11 +294,11 @@
World::is_finished(void)
{
// Return true if the world is finished and some time has passed
- if (((exit_time != -1) && (exit_time < (GameTime::get_time())))
- || ((shutdown_time != -1) && shutdown_time < GameTime::get_time()))
+ if (((exit_time != -1) && (exit_time < (GameTime::get_ticks())))
+ || ((shutdown_time != -1) && shutdown_time < GameTime::get_ticks()))
{
std::cout << "ExitTime: " << exit_time << std::endl
- << "GameTime: " << GameTime::get_time() << std::endl
+ << "GameTime: " << GameTime::get_ticks() << std::endl
<< "ShutDown: " << shutdown_time << std::endl;
return true;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] CVS: Games/Pingus/src entrance.cxx,1.2,1.3 game_time.cxx,1.2,1.3 game_time.hxx,1.2,1.3 global_event.cxx,1.5,1.6 server.cxx,1.5,1.6 world.cxx,1.10,1.11,
grumbel <=