From: Holger Schemel Date: Mon, 15 Mar 2010 19:45:34 +0000 (+0100) Subject: rnd-20100315-3-src X-Git-Tag: 3.3.0.0^2~21 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=34e8c8894f9aa655a87577c946c31a3f9b6134c5;p=rocksndiamonds.git rnd-20100315-3-src --- diff --git a/src/conftime.h b/src/conftime.h index b13acd91..9fca65af 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "2010-03-15 11:01" +#define COMPILE_DATE_STRING "2010-03-15 19:50" diff --git a/src/game_sp/Display.c b/src/game_sp/Display.c index ceaf6442..32923d63 100644 --- a/src/game_sp/Display.c +++ b/src/game_sp/Display.c @@ -6,7 +6,6 @@ int ScreenScrollXPos, ScreenScrollYPos; -int ScreenPosition; int ShowPanel; int ExplosionShake; diff --git a/src/game_sp/Display.h b/src/game_sp/Display.h index bdd16a07..d80a07d9 100644 --- a/src/game_sp/Display.h +++ b/src/game_sp/Display.h @@ -14,7 +14,6 @@ extern int ScreenScrollXPos, ScreenScrollYPos; -extern int ScreenPosition; extern int ShowPanel; extern int ExplosionShake; diff --git a/src/game_sp/ErrorReporting.c b/src/game_sp/ErrorReporting.c deleted file mode 100644 index 05487a9d..00000000 --- a/src/game_sp/ErrorReporting.c +++ /dev/null @@ -1,34 +0,0 @@ -// ---------------------------------------------------------------------------- -// 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; -} diff --git a/src/game_sp/ErrorReporting.h b/src/game_sp/ErrorReporting.h deleted file mode 100644 index b6600afd..00000000 --- a/src/game_sp/ErrorReporting.h +++ /dev/null @@ -1,17 +0,0 @@ -// ---------------------------------------------------------------------------- -// 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 */ diff --git a/src/game_sp/FakeDeclares.c b/src/game_sp/FakeDeclares.c index b93410a3..b9e584b4 100644 --- a/src/game_sp/FakeDeclares.c +++ b/src/game_sp/FakeDeclares.c @@ -10,8 +10,6 @@ int MurphyScreenXPos, MurphyScreenYPos; int MurphyExplodePos, SplitMoveFlag, RedDiskReleaseMurphyPos; int KillMurphyFlag, MurphyMoveCounter; long YawnSleepCounter; -int MurphyVar0DAC; -int MurphyVar0DAE; int MurphyVarFaceLeft; int ScratchGravity, GravityFlag; int RedDiskReleaseFlag, MovingPictureSequencePhase; @@ -43,7 +41,6 @@ int RedDiskReleasePhase; int UpdatedFlag; int DebugVersionFlag, D_ModeFlag; -int Data_SubRest, Data_SubRstFlg; int keyEnter; int UpdateTimeFlag; diff --git a/src/game_sp/FakeDeclares.h b/src/game_sp/FakeDeclares.h index 7a12c488..0ccf44d9 100644 --- a/src/game_sp/FakeDeclares.h +++ b/src/game_sp/FakeDeclares.h @@ -33,8 +33,6 @@ extern int KillMurphyFlag, MurphyMoveCounter; 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; diff --git a/src/game_sp/InitGameConditions.c b/src/game_sp/InitGameConditions.c index 937d4dc5..ef5ce12c 100644 --- a/src/game_sp/InitGameConditions.c +++ b/src/game_sp/InitGameConditions.c @@ -14,34 +14,27 @@ void subInitGameConditions() { 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 } @@ -227,13 +220,11 @@ loc_g_2778: 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 } @@ -255,11 +246,6 @@ void subFetchAndInitLevelB() 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; @@ -296,36 +282,21 @@ void subFetchAndInitLevel() { 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"); } diff --git a/src/game_sp/LevelSetPreviewForm.c b/src/game_sp/LevelSetPreviewForm.c deleted file mode 100644 index 0482f864..00000000 --- a/src/game_sp/LevelSetPreviewForm.c +++ /dev/null @@ -1,42 +0,0 @@ -// ---------------------------------------------------------------------------- -// 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 - diff --git a/src/game_sp/LevelSetPreviewForm.h b/src/game_sp/LevelSetPreviewForm.h deleted file mode 100644 index 0cc8bc75..00000000 --- a/src/game_sp/LevelSetPreviewForm.h +++ /dev/null @@ -1,15 +0,0 @@ -// ---------------------------------------------------------------------------- -// 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 */ diff --git a/src/game_sp/MainGameLoop.c b/src/game_sp/MainGameLoop.c index 6c8d5d18..ee955cb6 100644 --- a/src/game_sp/MainGameLoop.c +++ b/src/game_sp/MainGameLoop.c @@ -4,9 +4,6 @@ #include "MainGameLoop.h" -// static char *VB_Name = "modMainGameLoop"; - -// --- Option Explicit int GameLoopRunning; boolean bPlaying; @@ -17,119 +14,43 @@ int SavedGameFlag; 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) @@ -138,80 +59,26 @@ locRepeatMainGameLoop: // start repeating game loop 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) @@ -219,34 +86,14 @@ locRepeatMainGameLoop: // start repeating game loop 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 @@ -256,33 +103,20 @@ locRepeatMainGameLoop: // start repeating game loop 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: @@ -296,289 +130,10 @@ 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 @@ -608,20 +163,6 @@ int subCalculateScreenScrollPos() 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; } diff --git a/src/game_sp/MainGameLoop.h b/src/game_sp/MainGameLoop.h index a13900d1..a0d7e5d1 100644 --- a/src/game_sp/MainGameLoop.h +++ b/src/game_sp/MainGameLoop.h @@ -12,11 +12,6 @@ #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; @@ -27,4 +22,8 @@ extern int GameLoopRunning; extern int LeadOutCounter, EnterRepeatCounter; extern int SavedGameFlag; +extern void subMainGameLoop_Init(); +extern void subMainGameLoop_Main(byte, boolean); +extern void subCalculateScreenScrollPos(); + #endif /* MAINGAMELOOP_H */ diff --git a/src/game_sp/Makefile b/src/game_sp/Makefile index 34617385..75e97e9f 100644 --- a/src/game_sp/Makefile +++ b/src/game_sp/Makefile @@ -32,10 +32,8 @@ SRCS = init.c \ Infotrons.c \ InitGameConditions.c \ Input.c \ - LevelSetPreviewForm.c \ MainForm.c \ MainGameLoop.c \ - Marker.c \ Murphy.c \ OrangeDisk.c \ PathTools.c \ @@ -68,10 +66,8 @@ OBJS = init.o \ Infotrons.o \ InitGameConditions.o \ Input.o \ - LevelSetPreviewForm.o \ MainForm.o \ MainGameLoop.o \ - Marker.o \ Murphy.o \ OrangeDisk.o \ PathTools.o \ diff --git a/src/game_sp/Marker.c b/src/game_sp/Marker.c deleted file mode 100644 index 7053fb1d..00000000 --- a/src/game_sp/Marker.c +++ /dev/null @@ -1,279 +0,0 @@ -// ---------------------------------------------------------------------------- -// 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 diff --git a/src/game_sp/Marker.h b/src/game_sp/Marker.h deleted file mode 100644 index 48fa3a19..00000000 --- a/src/game_sp/Marker.h +++ /dev/null @@ -1,27 +0,0 @@ -// ---------------------------------------------------------------------------- -// 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 */ diff --git a/src/game_sp/Murphy.c b/src/game_sp/Murphy.c index 990276f0..0bc114ff 100644 --- a/src/game_sp/Murphy.c +++ b/src/game_sp/Murphy.c @@ -4,13 +4,10 @@ #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) @@ -30,14 +27,8 @@ static boolean subMoveKillsMurphy(int si, int ax, int bl); 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 @@ -54,16 +45,6 @@ void subAnimateMurphy(int *si) 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! @@ -87,11 +68,14 @@ void subAnimateMurphy(int *si) 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; @@ -1175,7 +1159,6 @@ loc_g_6756: if (UpdateTimeFlag != 0) // update time? { UpdatedFlag = 1; // prevent double update - subUpdatePlayingTime(); // update playing time } } diff --git a/src/game_sp/OrangeDisk.c b/src/game_sp/OrangeDisk.c index acb5a5dc..0e741395 100644 --- a/src/game_sp/OrangeDisk.c +++ b/src/game_sp/OrangeDisk.c @@ -4,23 +4,19 @@ #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; @@ -31,18 +27,20 @@ int subAnimateOrangeDisks(int si) 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; @@ -50,26 +48,24 @@ loc_g_27DA: 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; @@ -79,14 +75,12 @@ loc_g_2804: // disk is falling { 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 - +} diff --git a/src/game_sp/OrangeDisk.h b/src/game_sp/OrangeDisk.h index 2910b1db..cc1e1f26 100644 --- a/src/game_sp/OrangeDisk.h +++ b/src/game_sp/OrangeDisk.h @@ -12,6 +12,7 @@ #include "global.h" -extern int subAnimateOrangeDisks(int si); + +extern void subAnimateOrangeDisks(int); #endif /* ORANGEDISK_H */ diff --git a/src/game_sp/TickCountObject.c b/src/game_sp/TickCountObject.c index c3c4443e..fae698ce 100644 --- a/src/game_sp/TickCountObject.c +++ b/src/game_sp/TickCountObject.c @@ -62,39 +62,6 @@ void TickCountObject_Let_Pause(boolean NewVal) 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; diff --git a/src/game_sp/TickCountObject.h b/src/game_sp/TickCountObject.h index 50a34545..fc88b88b 100644 --- a/src/game_sp/TickCountObject.h +++ b/src/game_sp/TickCountObject.h @@ -12,8 +12,6 @@ #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(); diff --git a/src/game_sp/global.h b/src/game_sp/global.h index a458fcef..027f2863 100644 --- a/src/game_sp/global.h +++ b/src/game_sp/global.h @@ -21,10 +21,8 @@ #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" diff --git a/src/game_sp/vb_lib.c b/src/game_sp/vb_lib.c index 9381b660..f9372a1a 100644 --- a/src/game_sp/vb_lib.c +++ b/src/game_sp/vb_lib.c @@ -207,11 +207,6 @@ int GetAttr(char *a) return 0; } -void DoEvents() -{ - return; -} - void SaveSetting(const char * a, const char *b, char *c, int d) { return; diff --git a/src/game_sp/vb_lib.h b/src/game_sp/vb_lib.h index 1c2c2ba7..51af0f02 100644 --- a/src/game_sp/vb_lib.h +++ b/src/game_sp/vb_lib.h @@ -54,8 +54,6 @@ extern long MyGetTickCount(); extern int GetAttr(char *); -extern void DoEvents(); - extern void SaveSetting(const char *, const char *, char *, int); #if 0