X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fgame_sp%2FMainGameLoop.c;h=6bc494ff9fe867f11a7d042da8d642cd92bb2139;hb=ac592f78bbedc4808c5e35fb22bc8fc9f0398c8d;hp=a57bdd7959b5a09a42019b2421c6640d7d294253;hpb=8d3d7d213a9691455a49544624bf380e85f43461;p=rocksndiamonds.git diff --git a/src/game_sp/MainGameLoop.c b/src/game_sp/MainGameLoop.c index a57bdd79..6bc494ff 100644 --- a/src/game_sp/MainGameLoop.c +++ b/src/game_sp/MainGameLoop.c @@ -28,8 +28,10 @@ int subMainGameLoop() // int al, bx; int bx; +#if 0 TickCountObject Clock; currency LastFrame; +#endif if (DemoFlag != 0) { @@ -63,10 +65,12 @@ int subMainGameLoop() // 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; + // ---------------------------------------------------------------------------- // --------------------- START OF GAME-BUSY LOOP ------------------------------ // ---------------------------------------------------------------------------- @@ -84,10 +88,16 @@ locRepeatMainGameLoop: // start repeating game loop { DoEvents(); // user may klick on menus or move the window here ... } +#if 1 + while (0); +#else while (Clock.TickDiffUS(LastFrame) < DeltaT); // wait till its time for the next frame +#endif // never any additional code between here! - LastFrame = Clock.TickNow; // store the frame time +#if 0 + LastFrame = Clock.TickNow(); // store the frame time +#endif // never any additional code between here! if (! NoDisplayFlag) // copy the BackBuffer(=Stage) to visible screen Stage.Blt(); @@ -117,6 +127,7 @@ locRepeatMainGameLoop: // start repeating game loop // loc_g_186F: subProcessKeyboardInput(); // Check keyboard, act on keys + // 'HACK: // TimerVar = TimerVar + 1 // DoEvents @@ -126,18 +137,23 @@ locRepeatMainGameLoop: // start repeating game loop // ---------------------------------------------------------------------------- // + subDoGameStuff(); // do all game stuff + // // ---------------------------------------------------------------------------- // Call subDisplayPlayingTime ' playing time on screen + subCheckRestoreRedDiskCountDisplay(); // Restore panel: red-disk hole subRedDiskReleaseExplosion(); // Red Disk release and explode subFollowUpExplosions(); // every explosion may cause up to 8 following explosions bx = subCalculateScreenScrollPos(); // calculate screen start addrs + ScreenPosition = bx; + // Now new X and new Y are calculated, and bx = screen position = ScreenPosition data_h_Ytmp = ScreenScrollYPos; // copy Y for next soft scroll data_h_Xtmp = ScreenScrollXPos; // copy X for next soft scroll @@ -181,7 +197,11 @@ locExitMainGameLoop: { DoEvents(); // user may klick on menus or move the window here ... } +#if 1 + while (0); +#else while (Clock.TickDiffUS(LastFrame) < DeltaT); // wait till its time for the next frame +#endif Stage.Blt(); // blit the last frame GameLoopRunning = 0;