From 44d6e096d683713036fa858eb935b89dab412576 Mon Sep 17 00:00:00 2001 From: zicodxx <> Date: Sun, 4 Jul 2010 13:12:08 +0000 Subject: [PATCH] Since time is not suspended between levels in Multiplayer, call reset_time after level change. Apply this in Singleplayer, too since it should always be safe - and appropriate - to reset timer_value soon as a new level begins --- CHANGELOG.txt | 1 + main/game.c | 6 +++--- main/gameseq.c | 3 ++- main/multi.c | 11 +---------- 4 files changed, 7 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index f10fd92a7..d8d67c5ab 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -4,6 +4,7 @@ D1X-Rebirth Changelog -------- main/net_udp.c: Fixed Compiler-warning on Windows main/net_ipx.c, main/net_udp.c: Implemented Winsock functions for UDP which I totally forgot about; Now when leaving game in any way, close sockets and Winsock stuff +main/gameseq.c, main/multi.c: Since time is not suspended between levels in Multiplayer, call reset_time after level change. Apply this in Singleplayer, too since it should always be safe - and appropriate - to reset timer_value soon as a new level begins 20100701 -------- diff --git a/main/game.c b/main/game.c index 081a83b80..3f00ffba1 100644 --- a/main/game.c +++ b/main/game.c @@ -389,7 +389,7 @@ static int time_paused=0; void stop_time() { if (time_paused==0) { - fix time; + fix time;printf("STOP\n"); time = timer_get_fixed_seconds(); last_timer_value = time - last_timer_value; if (last_timer_value < 0) { @@ -404,7 +404,7 @@ void start_time() time_paused--; Assert(time_paused >= 0); if (time_paused==0) { - fix time; + fix time;printf("START\n"); time = timer_get_fixed_seconds(); last_timer_value = time - last_timer_value; } @@ -453,7 +453,7 @@ void FixedStepCalc() } void reset_time() -{ +{printf("RESET\n"); last_timer_value = timer_get_fixed_seconds(); } diff --git a/main/gameseq.c b/main/gameseq.c index 9ddf850e0..f4740c0ba 100644 --- a/main/gameseq.c +++ b/main/gameseq.c @@ -947,6 +947,7 @@ void PlayerFinishedLevel(int secret_flag) if (Game_wind) window_set_visible(Game_wind, 1); + reset_time(); } @@ -1139,6 +1140,7 @@ void DoPlayerDead() if (Game_wind) window_set_visible(Game_wind, 1); + reset_time(); } //called when the player is starting a new level for normal game mode and restore state @@ -1397,7 +1399,6 @@ void StartLevel(int random) ai_reset_all_paths(); ai_init_boss_for_ship(); - // reset_time(); Time is stopped and should be resumed soon. You shall be obsolete! reset_rear_view(); Auto_fire_fusion_cannon_time = 0; diff --git a/main/multi.c b/main/multi.c index 444445f07..013603ac9 100644 --- a/main/multi.c +++ b/main/multi.c @@ -361,7 +361,7 @@ int multi_objnum_is_past(int objnum) void multi_endlevel_score(void) { - int i, old_connect=0, old_vis = 1; + int i, old_connect=0; // Show a score list to end of net players @@ -379,12 +379,6 @@ multi_endlevel_score(void) Network_status = NETSTAT_ENDLEVEL; #endif - if (Game_wind) - { - old_vis = window_is_visible(Game_wind); - window_set_visible(Game_wind, 0); - } - if (multi_protocol == MULTI_PROTO_IPX) { if (Game_mode & GM_MULTI_COOP && multi_protocol == MULTI_PROTO_IPX) @@ -395,9 +389,6 @@ multi_endlevel_score(void) else kmatrix_view(Game_mode & GM_NETWORK); - if (Game_wind) - window_set_visible(Game_wind, old_vis); - // Restore connect state if (Game_mode & GM_NETWORK) {