-#define COMPILE_DATE_STRING "2010-03-15 11:01"
+#define COMPILE_DATE_STRING "2010-03-15 19:50"
int ScreenScrollXPos, ScreenScrollYPos;
-int ScreenPosition;
int ShowPanel;
int ExplosionShake;
extern int ScreenScrollXPos, ScreenScrollYPos;
-extern int ScreenPosition;
extern int ShowPanel;
extern int ExplosionShake;
+++ /dev/null
-// ----------------------------------------------------------------------------
-// ErrorReporting.c
-// ----------------------------------------------------------------------------
-
-#include "ErrorReporting.h"
-
-
-
-static char * GetErrLogPath();
-static char * GetTraceLogPath();
-
-// static char *VB_Name = "modErrorReporting";
-
-// --- Option Explicit
-
-static char *GetErrLogPath()
-{
- static char *GetErrLogPath;
-
- // GetErrLogPath = GET_PATH(WithSlash(App.Path), "Error.log");
- GetErrLogPath = "Error.log";
-
- return GetErrLogPath;
-}
-
-static char *GetTraceLogPath()
-{
- static char *GetTraceLogPath;
-
- // GetTraceLogPath = GET_PATH(WithSlash(App.Path), "Trace.log");
- GetTraceLogPath = "Trace.log";
-
- return GetTraceLogPath;
-}
+++ /dev/null
-// ----------------------------------------------------------------------------
-// ErrorReporting.h
-// ----------------------------------------------------------------------------
-
-#ifndef ERRORREPORTING_H
-#define ERRORREPORTING_H
-
-#include "vb_types.h"
-#include "vb_defs.h"
-#include "vb_vars.h"
-#include "vb_lib.h"
-
-#include "global.h"
-
-extern void InitErrorReporting();
-
-#endif /* ERRORREPORTING_H */
int MurphyExplodePos, SplitMoveFlag, RedDiskReleaseMurphyPos;
int KillMurphyFlag, MurphyMoveCounter;
long YawnSleepCounter;
-int MurphyVar0DAC;
-int MurphyVar0DAE;
int MurphyVarFaceLeft;
int ScratchGravity, GravityFlag;
int RedDiskReleaseFlag, MovingPictureSequencePhase;
int UpdatedFlag;
int DebugVersionFlag, D_ModeFlag;
-int Data_SubRest, Data_SubRstFlg;
int keyEnter;
int UpdateTimeFlag;
extern int MurphyExplodePos, SplitMoveFlag, RedDiskReleaseMurphyPos;
extern int MurphyPosIndex, MurphyXPos, MurphyYPos;
extern int MurphyScreenXPos, MurphyScreenYPos;
-extern int MurphyVar0DAC;
-extern int MurphyVar0DAE;
extern int MurphyVarFaceLeft;
extern int RecordDemoFlag;
extern int RedDiskCount;
{
bCapturePane = False;
- MurphyVar0DAC = MurphyYPos;
- MurphyVar0DAE = MurphyXPos;
MurphyVarFaceLeft = 0;
- KillMurphyFlag = 0; // no "kill Murphy"
+ KillMurphyFlag = 0; // no "kill Murphy"
ExitToMenuFlag = 0;
- LeadOutCounter = 0; // quit flag: lead-out counter
- RedDiskCount = 0; // Red disk counter
+ LeadOutCounter = 0; // quit flag: lead-out counter
+ RedDiskCount = 0; // Red disk counter
- // ShowRedDiskCounter = 0; // show-red-disk time-out
+ YawnSleepCounter = 0; // Wake up sleeping Murphy
- YawnSleepCounter = 0; // Wake up sleeping Murphy
-
- ExplosionShake = 0; // Force explosion flag off
+ ExplosionShake = 0; // Force explosion flag off
TerminalMaxCycles = 0x7F;
YellowDisksExploded = 0;
TimerVar = 0;
- // ShowPanel = 1 ' Force Panel on
- // MainForm.PanelVisible = True;
-
- EnterRepeatCounter = 0; // restart Enter repeat counter
- SnikSnaksElectronsFrozen = 0; // Snik-Snaks and Electr. move!
+ EnterRepeatCounter = 0; // restart Enter repeat counter
+ SnikSnaksElectronsFrozen = 0; // Snik-Snaks and Electrons move!
- SplitMoveFlag = 0; // Reset Split-through-ports
- RedDiskReleasePhase = 0; // (re-)enable red disk release
- RedDiskReleaseMurphyPos = 0; // Red disk was released here
+ SplitMoveFlag = 0; // Reset Split-through-ports
+ RedDiskReleasePhase = 0; // (re-)enable red disk release
+ RedDiskReleaseMurphyPos = 0; // Red disk was released here
}
void ResetInfotronsNeeded(int dx)
{
- if (LInfo.InfotronsNeeded != 0) // Jump If equal (autodetect)
- {
+ if (LInfo.InfotronsNeeded != 0) // Jump If equal (autodetect)
dx = LInfo.InfotronsNeeded;
- } // loc_g_278D:
- InfotronsNeeded = LowByte(dx); // Remaining Infotrons needed
- TotalInfotronsNeeded = InfotronsNeeded; // Number of Infotrons needed
+ InfotronsNeeded = LowByte(dx); // Remaining Infotrons needed
+ TotalInfotronsNeeded = InfotronsNeeded; // Number of Infotrons needed
}
void subFetchAndInitLevelA(boolean UpdatePlayTime)
{
- if (UpdatePlayTime && (0 == demo_stopped))
- {
- subUpdatePlayingTime(); // update playing time
- }
-
D_ModeFlag = 0; // 1=debug D pressed (CPU use)
if (0 != demo_stopped) // 1=demo, 0=game
DemoFlag = 1;
{
int InfoCountInLevel;
- Trace("modInitGameConditions", "--> subFetchAndInitLevel");
- Trace("modInitGameConditions", "Call ReadLevel");
-
ReadLevel(); // Read LEVELS.DAT
- Trace("modInitGameConditions", "ReadLevel return subFetchAndInitLeveled");
-
if (RecordDemoFlag == 1)
RecDemoRandomSeed = RandomSeed;
GameBusyFlag = -GameBusyFlag; // make <>1
- Trace("modInitGameConditions", "subConvertToEasySymbols");
-
InfoCountInLevel = subConvertToEasySymbols(); // Convert to easy symbols
GameBusyFlag = -GameBusyFlag; // restore
- Trace("modInitGameConditions", "subDisplayLevel");
-
subDisplayLevel(); // Paint (Init) game field
ResetInfotronsNeeded(InfoCountInLevel); // and reset Infotron count
- Data_SubRstFlg = 1;
-
- Trace("modInitGameConditions", "subInitGameConditions");
-
subInitGameConditions(); // Init game conditions (vars)
InitMurphyPos(); // Locate Murphy + screen pos
-
- Trace("modInitGameConditions", "<-- subFetchAndInitLevel");
}
+++ /dev/null
-// ----------------------------------------------------------------------------
-// LevelSetPreviewForm.c
-// ----------------------------------------------------------------------------
-
-#include "LevelSetPreviewForm.h"
-
-// --- VERSION 5.00
-// --- Begin VB.Form LevelSetPreviewForm
-// --- BorderStyle = 4 'Fixed ToolWindow // Fixed ToolWindow
-// --- Caption = "Level Set Preview"
-// --- ClientHeight = 10860
-// --- ClientLeft = 4890
-// --- ClientTop = 2760
-// --- ClientWidth = 6585
-// --- LinkTopic = "Form1"
-// --- MaxButton = 0 'False // False
-// --- MinButton = 0 'False // False
-// --- ScaleHeight = 724
-// --- ScaleMode = 3 'Pixel // Pixel
-// --- ScaleWidth = 439
-// --- ShowInTaskbar = 0 'False // False
-// --- Begin VB.PictureBox pic
-// --- BackColor = &H00000000&
-// --- Height = 2475
-// --- Left = 480
-// --- ScaleHeight = 161
-// --- ScaleMode = 3 'Pixel // Pixel
-// --- ScaleWidth = 349
-// --- TabIndex = 0
-// --- Top = 360
-// --- Width = 5295
-// --- End
-// --- End
-
-// static char *VB_Name = "LevelSetPreviewForm";
-// static boolean VB_GlobalNameSpace = False;
-// static boolean VB_Creatable = False;
-// static boolean VB_PredeclaredId = True;
-// static boolean VB_Exposed = False;
-
-// --- Option Explicit
-
+++ /dev/null
-// ----------------------------------------------------------------------------
-// LevelSetPreviewForm.h
-// ----------------------------------------------------------------------------
-
-#ifndef LEVELSETPREVIEWFORM_H
-#define LEVELSETPREVIEWFORM_H
-
-#include "vb_types.h"
-#include "vb_defs.h"
-#include "vb_vars.h"
-#include "vb_lib.h"
-
-#include "global.h"
-
-#endif /* LEVELSETPREVIEWFORM_H */
#include "MainGameLoop.h"
-// static char *VB_Name = "modMainGameLoop";
-
-// --- Option Explicit
int GameLoopRunning;
boolean bPlaying;
boolean UserDragFlag;
boolean AutoScrollFlag;
+
// ==========================================================================
// SUBROUTINE
// Play a game/demo
// ==========================================================================
-int subMainGameLoop_Init()
+void subMainGameLoop_Init()
{
- int subMainGameLoop;
-
- // int al, bx;
- // int bx;
-#if 0
- TickCountObject Clock;
- currency LastFrame;
-#endif
-
if (DemoFlag != 0)
{
-#if 0
- printf("::: playing demo ...\n");
-#endif
-
// EP set level success byte: demo, not game
WasDemoFlag = 1;
EP_GameDemoVar0DAA = 0; // demo
}
else // loc_g_1836:
{
-#if 0
- printf("::: playing game ...\n");
-#endif
-
// EP set level success byte: game, not demo
WasDemoFlag = 0;
EP_GameDemoVar0DAA = 1; // game
}
- // RestartGameLoop:
- // If RecordDemoFlag = 1 Then
- // RecordDemoFlag = 0 ' clear Demo Recording flag
- // Call subDisplayPlayingTime ' playing time on screen
- // ' Record key still pressed?' >= (Ctrl-)F1 and <= (Ctrl-)F10
- // While &H3B <= KeyScanCode7 And KeyScanCode7 <= &H44
- // ' yes -> wait until released
- // ' should we DoEvents here???? ... depends on how ... but yes!
- // ' ...or we can rather poll the keyboardstate inside this loop???
- // Wend
- // Call subInitGameConditions ' Init game conditions (vars)
- // If MusicOnFlag = 0 Then Call subMusicInit
- // WasDemoFlag = 0 ' no demo anymore
- // EP_GameDemoVar0DAA = 1 ' force game
- // End If
-
// 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
+ // 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;
-
- return subMainGameLoop;
}
-int subMainGameLoop_Main(byte action, boolean warp_mode)
+void subMainGameLoop_Main(byte action, boolean warp_mode)
{
- int subMainGameLoop;
- int bx;
+ // ---------------------------------------------------------------------------
+ // --------------------- START OF GAME-BUSY LOOP -----------------------------
+ // ---------------------------------------------------------------------------
- // ----------------------------------------------------------------------------
- // --------------------- START OF GAME-BUSY LOOP ------------------------------
- // ----------------------------------------------------------------------------
-
-#if 0
-locRepeatMainGameLoop: // start repeating game loop
-#endif
-
- // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- // FS synchronization
- while (PauseMode != 0)
- {
- DoEvents();
- }
-
- do
- {
- 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!
-#if 0
- LastFrame = Clock.TickNow(); // store the frame time
-#endif
- // never any additional code between here!
-
-
-
-#if 0
- if (! NoDisplayFlag) // copy the BackBuffer(=Stage) to visible screen
- Stage.Blt();
-#endif
-
-
-
- // FS end of synchronization
- // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-#if 1
if (EndFlag)
{
// (should never happen)
goto locExitMainGameLoop;
}
-#else
- if (EndFlag)
- goto locExitMainGameLoop;
-#endif
- // If DemoFlag = 0 Then Call subCheckJoystick ' check joystick
- // bx = subCheckRightMouseButton() ' check (right) mouse button
- // If bx = 2 And LeadOutCounter < 1 Then KillMurphyFlag = 1 ' lead-out busy after quit? -> kill Murphy!
-
- // If DebugVersionFlag <> 0 Then ' debug mode on?
- // If Data_SubRest <> 0 Then Data_SubRest = Data_SubRest - 1
- // If keyEnter <> 0 Then GoTo loc_g_186F ' Was it the Enter key? -> yes--skip! No mouse!
- // ' fixes ENTER bug If no mouse driver!
- // If bx <> 1 Then GoTo loc_g_186F ' Left button=Init game field
- // ' Also Enter If no mouse!
- // If Data_SubRest <> 0 Then GoTo loc_g_186F
- // Data_SubRest = 10
- // Call subRestoreFancy
- // Call subDisplayLevel ' Paint (Init) game field
- // Call subConvertToEasySymbols ' Convert to easy symbols
- // End If
-
- // loc_g_186F:
-
- subProcessKeyboardInput(action); // Check keyboard, act on keys
-
- // 'HACK:
- // TimerVar = TimerVar + 1
- // DoEvents
- // GoTo loc_g_186F
- // 'END HACK
- // If RecordDemoFlag = 1 Then GoTo RestartGameLoop
-
- // ----------------------------------------------------------------------------
- //
-
-#if 0
- printf("::: >>>>>>>>>> MainGameLoop.c: subDoGameStuff() START\n");
-#endif
-
- subDoGameStuff(); // do all game stuff
-
-#if 0
- printf("::: <<<<<<<<<< MainGameLoop.c: subDoGameStuff() END\n");
-#endif
+ subProcessKeyboardInput(action); // check keyboard, act on keys
+ // ---------------------------------------------------------------------------
//
- // ----------------------------------------------------------------------------
-
- // Call subDisplayPlayingTime ' playing time on screen
- // subCheckRestoreRedDiskCountDisplay(); // Restore panel: red-disk hole
+ subDoGameStuff(); // do all game stuff
- subRedDiskReleaseExplosion(); // Red Disk release and explode
- subFollowUpExplosions(); // every explosion may cause up to 8 following explosions
+ //
+ // ---------------------------------------------------------------------------
- bx = subCalculateScreenScrollPos(); // calculate screen start addrs
+ subRedDiskReleaseExplosion(); // Red Disk release and explode
+ subFollowUpExplosions(); // every explosion may cause up to 8 following explosions
- ScreenPosition = bx;
+ subCalculateScreenScrollPos(); // calculate screen start addrs
- // 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);
- }
-#if 1
- if (ForcedExitFlag != 0) // Forced Exit?' yes--exit!
+ if (ForcedExitFlag != 0) // Forced Exit?' yes--exit!
{
// (should never happen)
goto locExitMainGameLoop;
}
-#else
- if (ForcedExitFlag != 0) // Forced Exit?' yes--exit!
- goto locExitMainGameLoop;
-#endif
TimerVar = TimerVar + 1;
-#if 0
- if (bCapturePane)
- MainForm.SaveSnapshot(TimerVar);
-#endif
-
- // If Not NoDisplayFlag Then
- // With MainForm.lblFrameCount
- // .Caption = TimerVar
- // .Refresh
- // End With
- // End If
-
#if 1
if (ExitToMenuFlag == 1)
{
// happens when demo ends or when Murphy enters exit (to be checked)
-#if 0
- printf("::: ExitToMenuFlag == True\n");
-#endif
-
#if 0
goto locExitMainGameLoop;
#endif
goto locExitMainGameLoop;
#endif
-#if 1
if (LeadOutCounter == 0) // no lead-out: game busy
- return subMainGameLoop;
-#else
- if (LeadOutCounter == 0) // no lead-out: game busy
- goto locRepeatMainGameLoop;
-#endif
+ return;
- // ----------------------------------------------------------------------------
- // ---------------------- END OF GAME-BUSY LOOP -------------------------------
- // ----------------------------------------------------------------------------
- LeadOutCounter = LeadOutCounter - 1; // do more lead-out after quit
+ // ---------------------------------------------------------------------------
+ // ---------------------- END OF GAME-BUSY LOOP ------------------------------
+ // ---------------------------------------------------------------------------
-#if 0
- printf("::: LeadOutCounter == %d\n", LeadOutCounter);
-#endif
+ 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
+ if (LeadOutCounter != 0) // lead-out not ready: more
+ return;
// lead-out done: exit now
- // ---------------------- END OF GAME-BUSY LOOP (including lead-out) ----------
+ // ---------------------- END OF GAME-BUSY LOOP (including lead-out) ---------
locExitMainGameLoop:
if (!game_sp.LevelSolved)
game_sp.GameOver = TRUE;
#endif
-
-#if 1
- return subMainGameLoop;
-#endif
-
-
-
- do
- {
- 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;
-
-#if 0
- MainForm.menStop_Click();
- MainForm.PanelVisible = True;
-#endif
-
- // If DemoRecordingFlag <> 0 Then Call subCloseDemoRecordingFile ' Demo recording on? -> close opened demo file (w)
- if (SavedGameFlag != 0) // after savegame: no update!
- {
- SavedGameFlag = 0;
- return subMainGameLoop;
- }
-
- SavedGameFlag = 0;
- if (UpdateTimeFlag == 0) // update time?
- return subMainGameLoop;
-
- if (UpdatedFlag == 0) // update playing time
- subUpdatePlayingTime();
-
- return subMainGameLoop;
-} // subMainGameLoop
-
-#if 0
-
-int subMainGameLoop()
-{
- int subMainGameLoop;
-
- // int al, bx;
- int bx;
-#if 0
- TickCountObject Clock;
- currency LastFrame;
-#endif
-
- 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:
- {
-#if 1
- printf("::: playing game ...\n");
-#endif
-
- // EP set level success byte: game, not demo
- WasDemoFlag = 0;
- EP_GameDemoVar0DAA = 1; // game
- }
-
- // RestartGameLoop:
- // If RecordDemoFlag = 1 Then
- // RecordDemoFlag = 0 ' clear Demo Recording flag
- // Call subDisplayPlayingTime ' playing time on screen
- // ' Record key still pressed?' >= (Ctrl-)F1 and <= (Ctrl-)F10
- // While &H3B <= KeyScanCode7 And KeyScanCode7 <= &H44
- // ' yes -> wait until released
- // ' should we DoEvents here???? ... depends on how ... but yes!
- // ' ...or we can rather poll the keyboardstate inside this loop???
- // Wend
- // Call subInitGameConditions ' Init game conditions (vars)
- // If MusicOnFlag = 0 Then Call subMusicInit
- // WasDemoFlag = 0 ' no demo anymore
- // EP_GameDemoVar0DAA = 1 ' force game
- // End If
-
- // 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 ------------------------------
- // ----------------------------------------------------------------------------
-
-locRepeatMainGameLoop: // start repeating game loop
-
- // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- // FS synchronization
- while (PauseMode != 0)
- {
- DoEvents();
- }
-
- do
- {
- 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!
-#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();
-
- // FS end of synchronization
- // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- if (EndFlag)
- goto locExitMainGameLoop;
-
- // If DemoFlag = 0 Then Call subCheckJoystick ' check joystick
- // bx = subCheckRightMouseButton() ' check (right) mouse button
- // If bx = 2 And LeadOutCounter < 1 Then KillMurphyFlag = 1 ' lead-out busy after quit? -> kill Murphy!
-
- // If DebugVersionFlag <> 0 Then ' debug mode on?
- // If Data_SubRest <> 0 Then Data_SubRest = Data_SubRest - 1
- // If keyEnter <> 0 Then GoTo loc_g_186F ' Was it the Enter key? -> yes--skip! No mouse!
- // ' fixes ENTER bug If no mouse driver!
- // If bx <> 1 Then GoTo loc_g_186F ' Left button=Init game field
- // ' Also Enter If no mouse!
- // If Data_SubRest <> 0 Then GoTo loc_g_186F
- // Data_SubRest = 10
- // Call subRestoreFancy
- // Call subDisplayLevel ' Paint (Init) game field
- // Call subConvertToEasySymbols ' Convert to easy symbols
- // End If
-
- // loc_g_186F:
-
- subProcessKeyboardInput(); // Check keyboard, act on keys
-
- // 'HACK:
- // TimerVar = TimerVar + 1
- // DoEvents
- // GoTo loc_g_186F
- // 'END HACK
- // If RecordDemoFlag = 1 Then GoTo RestartGameLoop
-
- // ----------------------------------------------------------------------------
- //
-
-#if 0
- printf("::: >>>>>>>>>> MainGameLoop.c: subDoGameStuff() START\n");
-#endif
-
- subDoGameStuff(); // do all game stuff
-
-#if 0
- printf("::: <<<<<<<<<< MainGameLoop.c: subDoGameStuff() END\n");
-#endif
-
- //
- // ----------------------------------------------------------------------------
-
- // 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
- if ((! UserDragFlag) && AutoScrollFlag)
- {
-#if 0
- printf("::: MainGameLoop.c: subMainGameLoop(): %d, %d\n", ScreenScrollXPos, ScreenScrollYPos);
-#endif
-
- ScrollTowards(ScreenScrollXPos, ScreenScrollYPos);
- }
-
- if (ForcedExitFlag != 0) // Forced Exit?' yes--exit!
- goto locExitMainGameLoop;
-
- TimerVar = TimerVar + 1;
-
-#if 0
- if (bCapturePane)
- MainForm.SaveSnapshot(TimerVar);
-#endif
-
- // If Not NoDisplayFlag Then
- // With MainForm.lblFrameCount
- // .Caption = TimerVar
- // .Refresh
- // End With
- // End If
- if (ExitToMenuFlag == 1)
- goto locExitMainGameLoop;
-
- if (LeadOutCounter == 0) // no lead-out: game busy
- goto locRepeatMainGameLoop;
-
- // ----------------------------------------------------------------------------
- // ---------------------- END OF GAME-BUSY LOOP -------------------------------
- // ----------------------------------------------------------------------------
- LeadOutCounter = LeadOutCounter - 1; // do more lead-out after quit
- if (LeadOutCounter != 0) // lead-out not ready: more
- goto locRepeatMainGameLoop;
-
- // lead-out done: exit now
- // ---------------------- END OF GAME-BUSY LOOP (including lead-out) ----------
-
-locExitMainGameLoop:
- do
- {
- 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;
-
-#if 0
- MainForm.menStop_Click();
- MainForm.PanelVisible = True;
-#endif
-
- // If DemoRecordingFlag <> 0 Then Call subCloseDemoRecordingFile ' Demo recording on? -> close opened demo file (w)
- if (SavedGameFlag != 0) // after savegame: no update!
- {
- SavedGameFlag = 0;
- return subMainGameLoop;
- }
-
- SavedGameFlag = 0;
- if (UpdateTimeFlag == 0) // update time?
- return subMainGameLoop;
-
- if (UpdatedFlag == 0) // update playing time
- subUpdatePlayingTime();
-
-
- return subMainGameLoop;
-} // subMainGameLoop
-
-#endif
-
-void subUpdatePlayingTime()
-{
}
-int subCalculateScreenScrollPos()
+void subCalculateScreenScrollPos()
{
- int subCalculateScreenScrollPos;
-
int ax, Ay;
#if 1
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;
+ ScreenScrollXPos = Stretch * (MurphyScreenXPos + TILEX / 2) - ax;
+ ScreenScrollYPos = Stretch * (MurphyScreenYPos + TILEY / 2) - Ay;
}
#include "global.h"
-extern int subCalculateScreenScrollPos();
-extern int subMainGameLoop();
-extern int subMainGameLoop_Init();
-extern int subMainGameLoop_Main(byte, boolean);
-extern void subUpdatePlayingTime();
extern boolean AutoScrollFlag;
extern boolean UserDragFlag;
extern int LeadOutCounter, EnterRepeatCounter;
extern int SavedGameFlag;
+extern void subMainGameLoop_Init();
+extern void subMainGameLoop_Main(byte, boolean);
+extern void subCalculateScreenScrollPos();
+
#endif /* MAINGAMELOOP_H */
Infotrons.c \
InitGameConditions.c \
Input.c \
- LevelSetPreviewForm.c \
MainForm.c \
MainGameLoop.c \
- Marker.c \
Murphy.c \
OrangeDisk.c \
PathTools.c \
Infotrons.o \
InitGameConditions.o \
Input.o \
- LevelSetPreviewForm.o \
MainForm.o \
MainGameLoop.o \
- Marker.o \
Murphy.o \
OrangeDisk.o \
PathTools.o \
+++ /dev/null
-// ----------------------------------------------------------------------------
-// Marker.c
-// ----------------------------------------------------------------------------
-
-#include "Marker.h"
-
-// static boolean IsPort(long i);
-static void LimitXY(int *X, int *Y);
-static void SortData();
-
-// --- VERSION 1.0 CLASS
-// --- BEGIN
-// --- MultiUse = -1 'True // True
-// --- Persistable = 0 'NotPersistable // NotPersistable
-// --- DataBindingBehavior = 0 'vbNone // vbNone
-// --- DataSourceBehavior = 0 'vbNone // vbNone
-// --- MTSTransactionMode = 0 'NotAnMTSObject // NotAnMTSObject
-// --- END
-
-// static char *VB_Name = "MarkerObject";
-// static boolean VB_GlobalNameSpace = False;
-// static boolean VB_Creatable = True;
-// static boolean VB_PredeclaredId = False;
-// static boolean VB_Exposed = False;
-
-// --- Option Explicit
-
-long mIndex1, mIndex2;
-int X1, X2, Y1, Y2;
-int XMin, YMin;
-boolean mVisible;
-
-byte *SelectionData;
-
-int Marker_Get_Width()
-{
- int Width;
-
- Width = Abs(X2 - X1) + 1;
-
- return Width;
-}
-
-int Marker_Get_Height()
-{
- int Height;
-
- Height = Abs(Y2 - Y1) + 1;
-
- return Height;
-}
-
-int Marker_Get_Left()
-{
- int Left;
-
- SortData();
- Left = XMin;
-
- return Left;
-}
-
-int Marker_Get_Top()
-{
- int Top;
-
- SortData();
- Top = YMin;
-
- return Top;
-}
-
-static void LimitXY(int *X, int *Y)
-{
- if (*X < DisplayMinX)
- *X = DisplayMinX;
-
- if (DisplayMaxX < *X)
- *X = DisplayMaxX;
-
- if (*Y < DisplayMinY)
- *Y = DisplayMinY;
-
- if (DisplayMaxY < *Y)
- *Y = DisplayMaxY;
-}
-
-void Marker_SetPoint1(int X, int Y)
-{
- LimitXY(&X, &Y);
- X1 = X;
- Y1 = Y;
- X2 = X;
- Y2 = Y;
-}
-
-void Marker_SetPoint2(int X, int Y)
-{
- char *T;
-
- LimitXY(&X, &Y);
- X2 = X;
- Y2 = Y;
- T = CAT("(", Marker_Get_Width(), " x ", Marker_Get_Height(), ")");
- MainForm.lblFrameCount = T;
-}
-
-static void SortData()
-{
- // int Tmp;
-
- XMin = (X2 < X1 ? X2 : X1);
- YMin = (Y2 < Y1 ? Y2 : Y1);
-}
-
-#if 0
-
-void Marker_ShowMarker(boolean ShowFlag)
-{
- mVisible = ShowFlag;
- Marker_MoveMarker();
-}
-
-void Marker_RefreshMarker()
-{
- int L, T, R, B;
- long Tmp;
-
- if (! mVisible)
- return;
-
- LimitXY(&X1, &Y1);
- LimitXY(&X2, &Y2);
- SortData();
- L = DigitXPos(XMin) - 1;
- T = DigitYPos(YMin) - 1;
- R = L + StretchWidth * Marker_Get_Width() + 1;
- B = T + StretchWidth * Marker_Get_Height() + 1;
- MainForm.picPane.Line(L, T, R, B, 0xFFFFFF, B);
-}
-
-void Marker_MoveMarker()
-{
- int L, T, R, B;
- long Tmp;
-
- if (! mVisible)
- return;
-
- LimitXY(&X1, &Y1);
- LimitXY(&X2, &Y2);
- SortData();
- Stage.Blt();
- Tmp = GetSI(XMin, YMin);
- if (Marker_Get_Width() == 1 && Marker_Get_Height() == 1 && IsPort(Tmp))
- {
- SpLoadMenu();
- MainForm.menSP.Enabled = True;
- }
- else
- {
- MainForm.menSP.Enabled = False;
- }
-}
-
-static boolean IsPort(long i)
-{
- static boolean IsPort;
-
- int ax;
-
- IsPort = False;
- ax = DisPlayField[i];
- if (fiOrangeDisk < ax && ax < fiSnikSnak)
- IsPort = True;
-
- return IsPort;
-}
-
-void Marker_Copy()
-{
- int X, Y, MaxX, MaxY;
- long Tmp;
- char *TPath;
- int FNum;
-
- SortData();
- MaxX = Marker_Get_Width() - 1;
- MaxY = Marker_Get_Height() - 1;
- SelectionData = REDIM_2D(sizeof(byte), 0, MaxX + 1 - 1, 0, MaxY + 1 - 1);
- for (Y = 0; Y <= MaxY; Y++)
- {
- for (X = 0; X <= MaxX; X++)
- {
- Tmp = FieldWidth * (YMin + Y) + XMin + X;
-
- // --- On Error GoTo CopyEH
- SelectionData[X, Y] = DisPlayField[Tmp];
- // --- On Error GoTo 0
-
- }
- }
-
- TPath = CAT(App.Path, "/Mpx.clp");
- if (FileExists(TPath))
- MayKill(TPath);
-
- FNum = FreeFile();
-
- // --- On Error GoTo CopyEH
- FNum = fopen(TPath, "wb");
- FILE_PUT(FNum, -1, &MaxX, sizeof(MaxX));
- FILE_PUT(FNum, -1, &MaxY, sizeof(MaxY));
- FILE_PUT(FNum, -1, &SelectionData, sizeof(SelectionData));
- fclose(FNum);
- SelectionData = REDIM_1D(sizeof(byte), 0, 1 - 1);
- return;
-
- // CopyEH:
- Beep();
-}
-
-void Marker_Paste()
-{
- int X, Y, MaxX, MaxY;
- long Tmp;
- char *TPath;
- int FNum;
-
- TPath = CAT(App.Path, "/Mpx.clp");
- if (! FileExists(TPath))
- {
- Beep();
- return;
- }
-
- FNum = FreeFile();
-
- // --- On Error GoTo PasteEH
- FNum = fopen(TPath, "rb");
- FILE_GET(FNum, -1, &MaxX, sizeof(MaxX));
- FILE_GET(FNum, -1, &MaxY, sizeof(MaxY));
- SelectionData = REDIM_2D(sizeof(byte), 0, MaxX + 1 - 1, 0, MaxY + 1 - 1);
- FILE_GET(FNum, -1, &SelectionData, sizeof(SelectionData));
- fclose(FNum);
- // --- On Error GoTo 0
-
- SortData();
- if (Marker_Get_Width() <= MaxX)
- MaxX = Marker_Get_Width() - 1;
-
- if (Marker_Get_Height() <= MaxY)
- MaxY = Marker_Get_Height() - 1;
-
- for (Y = 0; Y <= MaxY; Y++)
- {
- for (X = 0; X <= MaxX; X++)
- {
- Tmp = FieldWidth * (YMin + Y) + XMin + X;
-
- // --- On Error GoTo PasteEH
- DisPlayField[Tmp] = SelectionData[X][Y];
- PlayField16[Tmp] = UnEdSprite(SelectionData[X][Y]);
- // --- On Error GoTo 0
-
- }
- }
-
- Let_ModifiedFlag(True);
- // PasteEH:
- Beep();
-}
-
-static void Class_Initialize()
-{
- mVisible = False;
-}
-
-#endif
+++ /dev/null
-// ----------------------------------------------------------------------------
-// Marker.h
-// ----------------------------------------------------------------------------
-
-#ifndef MARKER_H
-#define MARKER_H
-
-#include "vb_types.h"
-#include "vb_defs.h"
-#include "vb_vars.h"
-#include "vb_lib.h"
-
-#include "global.h"
-
-extern void Marker_Copy();
-extern int Marker_Get_Height();
-extern int Marker_Get_Left();
-extern int Marker_Get_Top();
-extern int Marker_Get_Width();
-extern void Marker_MoveMarker();
-extern void Marker_Paste();
-extern void Marker_RefreshMarker();
-extern void Marker_SetPoint1(int X, int Y);
-extern void Marker_SetPoint2(int X, int Y);
-extern void Marker_ShowMarker(boolean ShowFlag);
-
-#endif /* MARKER_H */
#include "Murphy.h"
+
static void subEatRedDisk(int si);
static boolean subMoveKillsMurphy(int si, int ax, int bl);
-// static char *VB_Name = "modMurphy";
-
-// --- Option Explicit
-
#if 1
#define LocalStretch (2)
void subAnimateMurphy(int *si)
{
- // int ax, al, ah, bx, bl, i, X, Y;
- // int tX, tY, tDeltaX, tDeltaY, tPos, Tmp;
-#if 1
int ax, al, bl, i, X, Y;
int time1, time2;
-#else
- int ax, al, bx, bl, i, X, Y;
-#endif
int tDeltaX, tDeltaY, tPos, Tmp;
// Variables that hold information about the animation sequence
ax = PlayField16[*si];
al = LowByte(ax);
-#if 0
- printf("::: Murphy.c: subAnimateMurphy(): %d [%d, %d] %d, %d [%d]\n",
- *si, *si % 60, *si / 60, ax, al, (al == fiMurphy));
-#endif
-
-#if 0
- printf("::: Murphy.c: subAnimateMurphy(): %d [%d] [%d]\n",
- YawnSleepCounter, FrameCounter, TimerVar);
-#endif
-
if (al != fiMurphy)
{
MurphyMoveCounter = 0; // We have no Murphy! Exit!
dx2 = -1;
SeqPos = 0;
// end of FS
+
ScratchGravity = 0; // scratch gravity off
if (GravityFlag != 0) // Gravity? (1=gravity on)
{
bl = LowByte(PlayField16[*si - FieldWidth]); // check above
- if (! (bl == fiPortUp || bl == fiPortUpAndDown || bl == fiPortAllDirections))
+ if (! (bl == fiPortUp ||
+ bl == fiPortUpAndDown ||
+ bl == fiPortAllDirections))
{
if (PlayField16[*si + FieldWidth] == 0) // gravity on and space below!
ScratchGravity = 1;
if (UpdateTimeFlag != 0) // update time?
{
UpdatedFlag = 1; // prevent double update
- subUpdatePlayingTime(); // update playing time
}
}
#include "OrangeDisk.h"
-// static char *VB_Name = "modOrangeDisk";
-// --- Option Explicit
// ==========================================================================
// SUBROUTINE
// Animate/move orange disks (falling)
// ==========================================================================
-int subAnimateOrangeDisks(int si)
+void subAnimateOrangeDisks(int si)
{
- int subAnimateOrangeDisks;
-
int ax, bl, dx, X, Y;
ax = PlayField16[si];
if (LowByte(ax) != fiOrangeDisk)
- return subAnimateOrangeDisks;
+ return;
if (ax >= 0x3008) // disk is falling
goto loc_g_2804;
if (PlayField16[si + FieldWidth] == 0)
goto loc_g_27CF;
- return subAnimateOrangeDisks;
+ return;
loc_g_27CF: // below is empty -> disk may start to fall
MovHighByte(&PlayField16[si], 0x20);
MovHighByte(&PlayField16[si + FieldWidth], fiOrangeDisk);
- return subAnimateOrangeDisks;
+
+ return;
loc_g_27DA:
if (PlayField16[si + FieldWidth] == 0)
{
PlayField16[si] = fiOrangeDisk;
- return subAnimateOrangeDisks;
+
+ return;
} // loc_g_27E8:
bl = HighByte(PlayField16[si]) + 1;
bl = 0x30;
MovHighByte(&PlayField16[si], bl);
- return subAnimateOrangeDisks;
+
+ return;
loc_g_2804: // disk is falling
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
dx = HighByte(PlayField16[si]) & 0x7;
X = GetStretchX(si);
Y = GetStretchY(si);
-#if 1
StretchedSprites.BltImg(X, Y, aniSpace, 0);
StretchedSprites.BltImg(X, Y + TwoPixels * (dx + 1), aniOrangeDisk, dx);
-#else
- StretchedSprites.BltEx(X, Y, 0);
- StretchedSprites.BltEx(X, Y + TwoPixels * (dx + 1), fiOrangeDisk);
-#endif
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
bl = HighByte(PlayField16[si]) + 1;
if ((bl & 0x7) != 0)
{
MovHighByte(&PlayField16[si], bl);
- return subAnimateOrangeDisks;
+
+ return;
}
PlayField16[si] = 0;
{
MovHighByte(&PlayField16[si], 0x30); // go on falling down
MovHighByte(&PlayField16[si + FieldWidth], fiOrangeDisk);
- return subAnimateOrangeDisks;
+
+ return;
} // loc_g_2867:
if (LowByte(PlayField16[si + FieldWidth]) == fiExplosion)
- return subAnimateOrangeDisks;
+ return;
ExplodeFieldSP(si); // Explode
-
- return subAnimateOrangeDisks;
-} // subAnimateOrangeDisks
-
+}
#include "global.h"
-extern int subAnimateOrangeDisks(int si);
+
+extern void subAnimateOrangeDisks(int);
#endif /* ORANGEDISK_H */
MPause = NewVal;
}
-void TickCountObject_DelayMS(long MSInterval, boolean DoEventsFlag) // in ms
-{
- currency Start;
-
- Start = TickCountObject_Get_TickNow();
- DelayLoopActive = True;
- do
- {
- if (DoEventsFlag)
- DoEvents();
-
- if (MSInterval <= TickCountObject_TickDiffMS(Start) && ! MPause)
- break;
- }
- while (1);
-
- DelayLoopActive = False;
-}
-
-// for compatibility with old code:
-void TickCountObject_DelayS(long SInterval, boolean DoEventsFlag) // in s
-{
- // check if SInterval is less than 25 days ...
- if ((int)(LongMax / 1000) <= SInterval)
- {
- Err.Raise(513, "Delay()", "Value Overflow");
- }
- else
- {
- TickCountObject_DelayMS((long)1000 * SInterval, DoEventsFlag);
- }
-}
-
currency TickCountObject_Get_TickNow()
{
currency TickNow;
#include "global.h"
-extern void TickCountObject_DelayMS(long MSInterval, boolean DoEventsFlag);
-extern void TickCountObject_DelayS(long SInterval, boolean DoEventsFlag);
extern boolean TickCountObject_Get_Active();
extern boolean TickCountObject_Get_Pause();
extern currency TickCountObject_Get_TickNow();
#include "Infotrons.h"
#include "InitGameConditions.h"
#include "Input.h"
-#include "LevelSetPreviewForm.h"
#include "MainForm.h"
#include "MainGameLoop.h"
-#include "Marker.h"
#include "Murphy.h"
#include "OrangeDisk.h"
#include "PathTools.h"
return 0;
}
-void DoEvents()
-{
- return;
-}
-
void SaveSetting(const char * a, const char *b, char *c, int d)
{
return;
extern int GetAttr(char *);
-extern void DoEvents();
-
extern void SaveSetting(const char *, const char *, char *, int);
#if 0