[Super-tux-commit] supertux/src gameloop.cpp,1.159,1.160 title.cpp,1.112,1.113 worldmap.cpp,1.101,1.
Brought to you by:
wkendrick
From: Tobias G. <to...@us...> - 2004-07-27 13:25:15
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25595/src Modified Files: gameloop.cpp title.cpp worldmap.cpp Log Message: C++ifyied SuperTux ticks. Index: title.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/title.cpp,v retrieving revision 1.112 retrieving revision 1.113 diff -u -d -r1.112 -r1.113 --- title.cpp 26 Jul 2004 18:09:14 -0000 1.112 +++ title.cpp 27 Jul 2004 13:25:05 -0000 1.113 @@ -262,7 +262,7 @@ walking = true; - st_pause_ticks_init(); + Ticks::pause_init(); titlesession = new GameSession(datadir + "/levels/misc/menu.stl", ST_GL_DEMO_GAME); @@ -280,7 +280,7 @@ /* --- Main title loop: --- */ frame = 0; - update_time = st_get_ticks(); + update_time = Ticks::get(); random_timer.start(rand() % 2000 + 2000); Menu::set_current(main_menu); @@ -289,7 +289,7 @@ { // if we spent to much time on a menu entry if( (update_time - last_update_time) > 1000) - update_time = last_update_time = st_get_ticks(); + update_time = last_update_time = Ticks::get(); // Calculate the movement-factor double frame_ratio = ((double)(update_time-last_update_time))/((double)FRAME_RATE); @@ -349,7 +349,7 @@ leveleditor->run(); delete leveleditor; Menu::set_current(main_menu); - update_time = st_get_ticks(); + update_time = Ticks::get(); break; case MNID_CREDITS: display_text_file("CREDITS", SCROLL_SPEED_CREDITS, white_big_text , white_text, white_small_text, blue_text ); @@ -381,7 +381,7 @@ update_load_save_game_menu(load_game_menu); Menu::set_current(main_menu); - update_time = st_get_ticks(); + update_time = Ticks::get(); } else if (process_load_game_menu()) { @@ -389,7 +389,7 @@ titlesession->get_current_sector()->activate(); titlesession->set_current(); //titletux.level_begin(); - update_time = st_get_ticks(); + update_time = Ticks::get(); } } else if(menu == contrib_menu) @@ -408,7 +408,7 @@ /* Set the time of the last update and the time of the current update */ last_update_time = update_time; - update_time = st_get_ticks(); + update_time = Ticks::get(); /* Pause: */ frame++; Index: worldmap.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/worldmap.cpp,v retrieving revision 1.101 retrieving revision 1.102 diff -u -d -r1.101 -r1.102 --- worldmap.cpp 26 Jul 2004 15:48:38 -0000 1.101 +++ worldmap.cpp 27 Jul 2004 13:25:05 -0000 1.102 @@ -960,7 +960,7 @@ unsigned int last_update_time; unsigned int update_time; - last_update_time = update_time = st_get_ticks(); + last_update_time = update_time = Ticks::get(); DrawingContext context; while(!quit) @@ -973,7 +973,7 @@ delta = .3f; last_update_time = update_time; - update_time = st_get_ticks(); + update_time = Ticks::get(); Vector tux_pos = tux->get_pos(); if (1) Index: gameloop.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/gameloop.cpp,v retrieving revision 1.159 retrieving revision 1.160 diff -u -d -r1.159 -r1.160 --- gameloop.cpp 26 Jul 2004 18:09:13 -0000 1.159 +++ gameloop.cpp 27 Jul 2004 13:25:05 -0000 1.160 @@ -189,8 +189,8 @@ GameSession::start_timers() { time_left.start(level->time_left*1000); - st_pause_ticks_init(); - update_time = st_get_ticks(); + Ticks::pause_init(); + update_time = Ticks::get(); } void @@ -219,7 +219,7 @@ tux.key_event((SDLKey)keymap.fire, UP); Menu::set_current(game_menu); - st_pause_ticks_start(); + Ticks::pause_start(); } } @@ -250,7 +250,7 @@ { Menu::current()->event(event); if(!Menu::current()) - st_pause_ticks_stop(); + Ticks::pause_stop(); } switch(event.type) @@ -283,7 +283,7 @@ else // normal mode { if(!Menu::current() && !game_pause) - st_pause_ticks_stop(); + Ticks::pause_stop(); SDL_Event event; while (SDL_PollEvent(&event)) @@ -293,7 +293,7 @@ { Menu::current()->event(event); if(!Menu::current()) - st_pause_ticks_stop(); + Ticks::pause_stop(); } else { @@ -350,12 +350,12 @@ if(game_pause) { game_pause = false; - st_pause_ticks_stop(); + Ticks::pause_stop(); } else { game_pause = true; - st_pause_ticks_start(); + Ticks::pause_start(); } } break; @@ -573,10 +573,10 @@ switch (game_menu->check()) { case MNID_CONTINUE: - st_pause_ticks_stop(); + Ticks::pause_stop(); break; case MNID_ABORTLEVEL: - st_pause_ticks_stop(); + Ticks::pause_stop(); exit_status = ES_LEVEL_ABORT; break; } @@ -600,7 +600,7 @@ int fps_cnt = 0; - update_time = last_update_time = st_get_ticks(); + update_time = last_update_time = Ticks::get(); // Eat unneeded events SDL_Event event; @@ -654,7 +654,7 @@ /* Set the time of the last update and the time of the current update */ last_update_time = update_time; - update_time = st_get_ticks(); + update_time = Ticks::get(); /* Pause till next frame, if the machine running the game is too fast: */ /* FIXME: Works great for in OpenGl mode, where the CPU doesn't have to do that much. But @@ -662,7 +662,7 @@ if(last_update_time >= update_time - 12) { SDL_Delay(10); - update_time = st_get_ticks(); + update_time = Ticks::get(); } /* Handle time: */ @@ -866,7 +866,7 @@ Menu::set_current(main_menu); - st_pause_ticks_stop(); + Ticks::pause_stop(); return true; } else |