projects
/
rocksndiamonds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
rnd-20090730-1-src
[rocksndiamonds.git]
/
src
/
game_sp
/
MainGameLoop.c
diff --git
a/src/game_sp/MainGameLoop.c
b/src/game_sp/MainGameLoop.c
index 9aa59aacf86a89ad72d1bd8b88031d5d14130494..ddf3d4e236b9317f80918bb03c2ae2645984a8d1 100644
(file)
--- a/
src/game_sp/MainGameLoop.c
+++ b/
src/game_sp/MainGameLoop.c
@@
-4,7
+4,8
@@
#include "MainGameLoop.h"
#include "MainGameLoop.h"
-static char *VB_Name = "modMainGameLoop";
+// static char *VB_Name = "modMainGameLoop";
+
// --- Option Explicit
int GameLoopRunning;
// --- Option Explicit
int GameLoopRunning;
@@
-25,18
+26,29
@@
int subMainGameLoop()
{
int subMainGameLoop;
{
int subMainGameLoop;
- int al, bx;
+ // int al, bx;
+ int bx;
+#if 0
TickCountObject Clock;
currency LastFrame;
TickCountObject Clock;
currency LastFrame;
+#endif
if (DemoFlag != 0)
{
if (DemoFlag != 0)
{
+#if 1
+ printf("::: playing demo ...\n");
+#endif
+
// EP set level success byte: demo, not game
WasDemoFlag = 1;
EP_GameDemoVar0DAA = 0; // demo
}
else // loc_g_1836:
{
// EP set level success byte: demo, not game
WasDemoFlag = 1;
EP_GameDemoVar0DAA = 0; // demo
}
else // loc_g_1836:
{
+#if 1
+ printf("::: playing game ...\n");
+#endif
+
// EP set level success byte: game, not demo
WasDemoFlag = 0;
EP_GameDemoVar0DAA = 1; // game
// EP set level success byte: game, not demo
WasDemoFlag = 0;
EP_GameDemoVar0DAA = 1; // game
@@
-61,10
+73,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.
// 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;
RedDiskReleasePhase = 0; // (re-)enable red disk release
UpdatedFlag = 0;
GameLoopRunning = 1;
LevelStatus = 0;
+
// ----------------------------------------------------------------------------
// --------------------- START OF GAME-BUSY LOOP ------------------------------
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// --------------------- START OF GAME-BUSY LOOP ------------------------------
// ----------------------------------------------------------------------------
@@
-82,10
+96,16
@@
locRepeatMainGameLoop: // start repeating game loop
{
DoEvents(); // user may klick on menus or move the window here ...
}
{
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
while (Clock.TickDiffUS(LastFrame) < DeltaT); // wait till its time for the next frame
+#endif
// never any additional code between here!
// 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();
// never any additional code between here!
if (! NoDisplayFlag) // copy the BackBuffer(=Stage) to visible screen
Stage.Blt();
@@
-112,8
+132,10
@@
locRepeatMainGameLoop: // start repeating game loop
// Call subConvertToEasySymbols ' Convert to easy symbols
// End If
// Call subConvertToEasySymbols ' Convert to easy symbols
// End If
-loc_g_186F:
+ // loc_g_186F:
+
subProcessKeyboardInput(); // Check keyboard, act on keys
subProcessKeyboardInput(); // Check keyboard, act on keys
+
// 'HACK:
// TimerVar = TimerVar + 1
// DoEvents
// 'HACK:
// TimerVar = TimerVar + 1
// DoEvents
@@
-123,23
+145,42
@@
loc_g_186F:
// ----------------------------------------------------------------------------
//
// ----------------------------------------------------------------------------
//
+
+#if 0
+ printf("::: >>>>>>>>>> MainGameLoop.c: subDoGameStuff() START\n");
+#endif
+
subDoGameStuff(); // do all game stuff
subDoGameStuff(); // do all game stuff
+
+#if 0
+ printf("::: <<<<<<<<<< MainGameLoop.c: subDoGameStuff() END\n");
+#endif
+
//
// ----------------------------------------------------------------------------
// Call subDisplayPlayingTime ' playing time on screen
//
// ----------------------------------------------------------------------------
// 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
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;
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
if ((! UserDragFlag) && AutoScrollFlag)
// 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
if ((! UserDragFlag) && AutoScrollFlag)
+ {
+#if 0
+ printf("::: MainGameLoop.c: subMainGameLoop(): %d, %d\n", ScreenScrollXPos, ScreenScrollYPos);
+#endif
+
ScrollTowards(ScreenScrollXPos, ScreenScrollYPos);
ScrollTowards(ScreenScrollXPos, ScreenScrollYPos);
+ }
if (ForcedExitFlag != 0) // Forced Exit?' yes--exit!
goto locExitMainGameLoop;
if (ForcedExitFlag != 0) // Forced Exit?' yes--exit!
goto locExitMainGameLoop;
@@
-178,7
+219,11
@@
locExitMainGameLoop:
{
DoEvents(); // user may klick on menus or move the window here ...
}
{
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
while (Clock.TickDiffUS(LastFrame) < DeltaT); // wait till its time for the next frame
+#endif
Stage.Blt(); // blit the last frame
GameLoopRunning = 0;
Stage.Blt(); // blit the last frame
GameLoopRunning = 0;
@@
-225,9
+270,21
@@
int subCalculateScreenScrollPos()
ax = MainForm.picPane.Width / 2;
Ay = MainForm.picPane.Height / 2;
}
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;
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;
}
return subCalculateScreenScrollPos;
}
-