From 055b582fdcaeddfa6dbb240eb591ec61f37e21d3 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Mon, 19 Oct 2009 00:26:20 +0200 Subject: [PATCH] rnd-20091019-1-src --- src/conftime.h | 2 +- src/game.c | 22 ++++++++++++++++++- src/game_sp/MainGameLoop.c | 45 ++++++++++++++++++++++++++++++++++++++ src/game_sp/Makefile | 5 +++-- src/game_sp/Murphy.c | 2 ++ 5 files changed, 72 insertions(+), 4 deletions(-) diff --git a/src/conftime.h b/src/conftime.h index b228a4cc..abf61b70 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "2009-10-12 00:32" +#define COMPILE_DATE_STRING "2009-10-19 00:25" diff --git a/src/game.c b/src/game.c index eb115cb3..80f15701 100644 --- a/src/game.c +++ b/src/game.c @@ -12020,6 +12020,7 @@ static void CheckLevelTime() { int i; + /* !!! SAME CODE AS IN "GameActions()" -- FIX THIS !!! */ if (level.game_engine_type == GAME_ENGINE_TYPE_EM) { if (level.native_em_level->lev->home == 0) /* all players at home */ @@ -12039,10 +12040,13 @@ static void CheckLevelTime() } else if (level.game_engine_type == GAME_ENGINE_TYPE_SP) { - if (game_sp_info.LevelSolved) /* game won */ + if (game_sp_info.LevelSolved && + !game_sp_info.GameOver) /* game won */ { PlayerWins(local_player); + game_sp_info.GameOver = TRUE; + AllPlayersGone = TRUE; } @@ -12226,6 +12230,7 @@ void GameActions() if (game.restart_level) StartGameActions(options.network, setup.autorecord, level.random_seed); + /* !!! SAME CODE AS IN "CheckLevelTime()" -- FIX THIS !!! */ if (level.game_engine_type == GAME_ENGINE_TYPE_EM) { if (level.native_em_level->lev->home == 0) /* all players at home */ @@ -12243,6 +12248,21 @@ void GameActions() level.native_em_level->ply[3]->alive == 0) /* all dead */ AllPlayersGone = TRUE; } + else if (level.game_engine_type == GAME_ENGINE_TYPE_SP) + { + if (game_sp_info.LevelSolved && + !game_sp_info.GameOver) /* game won */ + { + PlayerWins(local_player); + + game_sp_info.GameOver = TRUE; + + AllPlayersGone = TRUE; + } + + if (game_sp_info.GameOver) /* game lost */ + AllPlayersGone = TRUE; + } if (local_player->LevelSolved && !local_player->LevelSolved_GameEnd) GameWon(); diff --git a/src/game_sp/MainGameLoop.c b/src/game_sp/MainGameLoop.c index fd3fa859..79f1ec9c 100644 --- a/src/game_sp/MainGameLoop.c +++ b/src/game_sp/MainGameLoop.c @@ -91,7 +91,9 @@ int subMainGameLoop_Main() // --------------------- START OF GAME-BUSY LOOP ------------------------------ // ---------------------------------------------------------------------------- +#if 0 locRepeatMainGameLoop: // start repeating game loop +#endif // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // FS synchronization @@ -120,8 +122,19 @@ locRepeatMainGameLoop: // start repeating game loop // FS end of synchronization // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +#if 1 + if (EndFlag) + { + // (should never happen) + + // printf("::: EndFlag == True\n"); + + goto locExitMainGameLoop; + } +#else if (EndFlag) goto locExitMainGameLoop; +#endif // If DemoFlag = 0 Then Call subCheckJoystick ' check joystick // bx = subCheckRightMouseButton() ' check (right) mouse button @@ -190,8 +203,19 @@ locRepeatMainGameLoop: // start repeating game loop ScrollTowards(ScreenScrollXPos, ScreenScrollYPos); } +#if 1 + if (ForcedExitFlag != 0) // Forced Exit?' yes--exit! + { + // (should never happen) + + // printf("::: ForcedExitFlag == True\n"); + + goto locExitMainGameLoop; + } +#else if (ForcedExitFlag != 0) // Forced Exit?' yes--exit! goto locExitMainGameLoop; +#endif TimerVar = TimerVar + 1; @@ -207,8 +231,19 @@ locRepeatMainGameLoop: // start repeating game loop // End With // End If +#if 1 + if (ExitToMenuFlag == 1) + { + // happens when demo ends or when Murphy enters exit (to be checked) + + printf("::: ExitToMenuFlag == True\n"); + + goto locExitMainGameLoop; + } +#else if (ExitToMenuFlag == 1) goto locExitMainGameLoop; +#endif #if 1 if (LeadOutCounter == 0) // no lead-out: game busy @@ -222,13 +257,23 @@ locRepeatMainGameLoop: // start repeating game loop // ---------------------- END OF GAME-BUSY LOOP ------------------------------- // ---------------------------------------------------------------------------- LeadOutCounter = LeadOutCounter - 1; // do more lead-out after quit +#if 1 + if (LeadOutCounter != 0) // lead-out not ready: more + return subMainGameLoop; +#else if (LeadOutCounter != 0) // lead-out not ready: more goto locRepeatMainGameLoop; +#endif // lead-out done: exit now // ---------------------- END OF GAME-BUSY LOOP (including lead-out) ---------- locExitMainGameLoop: + +#if 0 + printf("::: locExitMainGameLoop reached [%d]\n", LeadOutCounter); +#endif + do { DoEvents(); // user may klick on menus or move the window here ... diff --git a/src/game_sp/Makefile b/src/game_sp/Makefile index 13a7a917..13ed56e4 100644 --- a/src/game_sp/Makefile +++ b/src/game_sp/Makefile @@ -1,11 +1,12 @@ # ============================================================================= -# Rocks'n'Diamonds Makefile (game_sp) +# Makefile for Rocks'n'Diamonds native Supaplex engine (game_sp) # ----------------------------------------------------------------------------- # (c) 1995-2009 Holger Schemel # ----------------------------------------------------------------------------- # MegaPlex version 0.5 beta release xmas 2001 by Frank Schindler, # based on the Speed Fix 6.3+ by Herman Perk, -# based on original Supaplex by Michael Stopp & Philip Jespersen. +# based on original Supaplex by Michael Stopp & Philip Jespersen +# (code automatically converted from VisualBasic to C by vb2c.pl). # ============================================================================= # ----------------------------------------------------------------------------- diff --git a/src/game_sp/Murphy.c b/src/game_sp/Murphy.c index bab25f71..886cd80b 100644 --- a/src/game_sp/Murphy.c +++ b/src/game_sp/Murphy.c @@ -936,7 +936,9 @@ loc_g_6756: printf("::: Murphy.c: !!!!!!!!!! LEVEL %d SOLVED !!!!!!!!!!\n",LevelNumber); #endif +#if 0 game_sp_info.LevelSolved = TRUE; +#endif subSoundFXExit(); data_h_DemoDone = 1; // EP set level success bytes -- 2.34.1