X-Git-Url: https://git.artsoft.org/?p=rocksndiamonds.git;a=blobdiff_plain;f=src%2Fgame_sp%2FMainGameLoop.c;h=48a1ac480480d7f726566432518004d3db5b7061;hp=ee955cb68218c1902780abfd89904424c0d3f42d;hb=e51177796149f37de339bda83558c3c49758be93;hpb=34e8c8894f9aa655a87577c946c31a3f9b6134c5 diff --git a/src/game_sp/MainGameLoop.c b/src/game_sp/MainGameLoop.c index ee955cb6..48a1ac48 100644 --- a/src/game_sp/MainGameLoop.c +++ b/src/game_sp/MainGameLoop.c @@ -5,13 +5,9 @@ #include "MainGameLoop.h" -int GameLoopRunning; boolean bPlaying; -int LeadOutCounter, EnterRepeatCounter; -int ForcedExitFlag; +int LeadOutCounter; int ExitToMenuFlag; -int SavedGameFlag; -boolean UserDragFlag; boolean AutoScrollFlag; @@ -22,27 +18,11 @@ boolean AutoScrollFlag; void subMainGameLoop_Init() { - if (DemoFlag != 0) - { - // EP set level success byte: demo, not game - WasDemoFlag = 1; - EP_GameDemoVar0DAA = 0; // demo - } - else // loc_g_1836: - { - // EP set level success byte: game, not demo - WasDemoFlag = 0; - EP_GameDemoVar0DAA = 1; // game - } - // This was a bug in the original Supaplex: sometimes red disks could not // be released. This happened if Murphy was killed DURING a red disk release // and the next try started. RedDiskReleasePhase = 0; // (re-)enable red disk release - UpdatedFlag = 0; - GameLoopRunning = 1; - LevelStatus = 0; } void subMainGameLoop_Main(byte action, boolean warp_mode) @@ -51,15 +31,6 @@ void subMainGameLoop_Main(byte action, boolean warp_mode) // --------------------- START OF GAME-BUSY LOOP ----------------------------- // --------------------------------------------------------------------------- - if (EndFlag) - { - // (should never happen) - - // printf("::: EndFlag == True\n"); - - goto locExitMainGameLoop; - } - subProcessKeyboardInput(action); // check keyboard, act on keys // --------------------------------------------------------------------------- @@ -75,20 +46,16 @@ void subMainGameLoop_Main(byte action, boolean warp_mode) subCalculateScreenScrollPos(); // calculate screen start addrs - if ((! UserDragFlag) && AutoScrollFlag) + if (AutoScrollFlag) ScrollTowards(ScreenScrollXPos, ScreenScrollYPos); - if (ForcedExitFlag != 0) // Forced Exit?' yes--exit! - { - // (should never happen) - - // printf("::: ForcedExitFlag == True\n"); - - goto locExitMainGameLoop; - } - TimerVar = TimerVar + 1; +#if 1 + if (ExplosionShakeMurphy > 0) + ExplosionShakeMurphy--; +#endif + #if 1 if (ExitToMenuFlag == 1) { @@ -118,9 +85,11 @@ void subMainGameLoop_Main(byte action, boolean warp_mode) // lead-out done: exit now // ---------------------- END OF GAME-BUSY LOOP (including lead-out) --------- +#if 0 locExitMainGameLoop: +#endif -#if 1 +#if 0 printf("::: locExitMainGameLoop reached [%d]\n", LeadOutCounter); printf("::: [KillMurphyFlag == %d]\n", KillMurphyFlag); #endif @@ -134,11 +103,10 @@ locExitMainGameLoop: void subCalculateScreenScrollPos() { - int ax, Ay; - #if 1 int jump_pos = TILEX / 2; + /* handle wrap-around */ if (MurphyScreenXPos < -jump_pos) { MurphyScreenXPos = FieldWidth * TILEX + MurphyScreenXPos; @@ -158,11 +126,6 @@ void subCalculateScreenScrollPos() // printf("::: ExplosionShake [%d]\n", FrameCounter); } - { - ax = MainForm.picPane.Width / 2; - Ay = MainForm.picPane.Height / 2; - } - - ScreenScrollXPos = Stretch * (MurphyScreenXPos + TILEX / 2) - ax; - ScreenScrollYPos = Stretch * (MurphyScreenYPos + TILEY / 2) - Ay; + ScreenScrollXPos = MurphyScreenXPos - (SCR_FIELDX / 2) * TILESIZE; + ScreenScrollYPos = MurphyScreenYPos - (SCR_FIELDY / 2) * TILESIZE; }