X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fgame_sp%2FMainGameLoop.c;h=6a5e0eafcbde6474bf604a910ee3de4b656531ec;hb=1e83803d7c99eb5232eab7d48a4194de3cf6f77f;hp=2852dd0639494e48b662ddb0b8f50c4adbadb4d4;hpb=e63e92923fa0196ba7d538d4c8f5a16994e3bee8;p=rocksndiamonds.git diff --git a/src/game_sp/MainGameLoop.c b/src/game_sp/MainGameLoop.c index 2852dd06..6a5e0eaf 100644 --- a/src/game_sp/MainGameLoop.c +++ b/src/game_sp/MainGameLoop.c @@ -28,17 +28,23 @@ int subMainGameLoop() // int al, bx; int bx; +#if 0 TickCountObject Clock; currency LastFrame; +#endif if (DemoFlag != 0) { + printf("::: playing demo ...\n"); + // EP set level success byte: demo, not game WasDemoFlag = 1; EP_GameDemoVar0DAA = 0; // demo } else // loc_g_1836: { + printf("::: playing game ...\n"); + // EP set level success byte: game, not demo WasDemoFlag = 0; EP_GameDemoVar0DAA = 1; // game @@ -86,10 +92,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(); @@ -130,8 +142,12 @@ locRepeatMainGameLoop: // start repeating game loop // ---------------------------------------------------------------------------- // + printf("::: MainGameLoop.c: subDoGameStuff() START\n"); + subDoGameStuff(); // do all game stuff + printf("::: MainGameLoop.c: subDoGameStuff() END\n"); + // // ---------------------------------------------------------------------------- @@ -189,7 +205,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; @@ -236,9 +256,21 @@ int subCalculateScreenScrollPos() ax = MainForm.picPane.Width / 2; Ay = MainForm.picPane.Height / 2; } + +#if 1 + ScreenScrollXPos = Stretch * (MurphyScreenXPos + 16) - ax; + ScreenScrollYPos = Stretch * (MurphyScreenYPos + 16) - Ay; +#else ScreenScrollXPos = Stretch * (MurphyScreenXPos + 8) - ax; ScreenScrollYPos = Stretch * (MurphyScreenYPos + 8) - Ay; +#endif + +#if 0 + printf("::: MainGameLoop.c: subCalculateScreenScrollPos(): %d, %d [%d, %d] -> %d, %d\n", + MainForm.picPane.Width, MainForm.picPane.Height, + MurphyScreenXPos, MurphyScreenYPos, + ScreenScrollXPos, ScreenScrollYPos); +#endif return subCalculateScreenScrollPos; } -