From: Holger Schemel Date: Mon, 15 Mar 2010 12:25:49 +0000 (+0100) Subject: rnd-20100315-2-src X-Git-Tag: 3.3.0.0^2~22 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=ce0bba1a070e5e64939491eb68087f68ef8fe870;p=rocksndiamonds.git rnd-20100315-2-src * continued code cleanup of native Supaplex game engine --- diff --git a/ChangeLog b/ChangeLog index 8967bdd7..7b43d771 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +2010-03-15 + * continued code cleanup of native Supaplex game engine + 2010-03-14 * started code cleanup of native Supaplex game engine diff --git a/src/conftime.h b/src/conftime.h index e58f87ed..b13acd91 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "2010-03-15 01:21" +#define COMPILE_DATE_STRING "2010-03-15 11:01" diff --git a/src/game_sp/BugsTerminals.c b/src/game_sp/BugsTerminals.c index ec4be1ea..9dc2c557 100644 --- a/src/game_sp/BugsTerminals.c +++ b/src/game_sp/BugsTerminals.c @@ -26,7 +26,7 @@ void subAnimateBugs(int si) if ((TimerVar & 3) == 0) { bl = bl + 1; - if (bl >= 0xE) + if (bl >= 14) // bugs animation has 14 frames { bl = subGetRandomNumber(); // generate new random number bl = -((bl & 0x3F) + 0x20); @@ -65,7 +65,7 @@ void subAnimateBugs(int si) void subAnimateTerminals(int si) { - short bl; + int bl; int lx = GetX(si); int ly = GetY(si); @@ -79,9 +79,7 @@ void subAnimateTerminals(int si) GfxFrame[lx][ly]--; /* get last random animation delay */ - bl = HighByte(PlayField16[si]); - if ((bl & 0x80) == 0x80) - bl = (bl | 0xFF00); + bl = SgnHighByte(PlayField16[si]); bl = bl + 1; if (bl <= 0) /* return if random animation delay not yet reached */ diff --git a/src/game_sp/DDScrollBuffer.c b/src/game_sp/DDScrollBuffer.c index 0f1191ce..e74e4a7e 100644 --- a/src/game_sp/DDScrollBuffer.c +++ b/src/game_sp/DDScrollBuffer.c @@ -62,9 +62,7 @@ static void ScrollPlayfield(int dx, int dy) redraw[x][y] = FALSE; redraw_tiles = 0; -#if 1 DrawFrameIfNeeded(); -#endif for (y = DisplayMinY; y <= DisplayMaxY; y++) { @@ -300,9 +298,7 @@ void DDScrollBuffer_ScrollTo(int X, int Y) ScrollX = mScrollX; ScrollY = mScrollY; -#if 1 ScrollPlayfieldIfNeeded(); -#endif } void DDScrollBuffer_ScrollTowards(int X, int Y, double Step) @@ -316,8 +312,9 @@ void DDScrollBuffer_ScrollTowards(int X, int Y, double Step) Y = Y / Stretch; dx = X - mScrollX; dY = Y - mScrollY; + r = Sqr(dx * dx + dY * dY); - if (r == 0) // we are there already + if (r == 0) // we are there already return; if (Step < r) @@ -330,9 +327,7 @@ void DDScrollBuffer_ScrollTowards(int X, int Y, double Step) ScrollX = mScrollX; ScrollY = mScrollY; -#if 1 ScrollPlayfieldIfNeeded(); -#endif } void DDScrollBuffer_SoftScrollTo(int X, int Y, long TimeMS, int FPS) @@ -347,9 +342,7 @@ void DDScrollBuffer_SoftScrollTo(int X, int Y, long TimeMS, int FPS) return; if (AlreadyRunning) - { return; - } AlreadyRunning = True; X = X / Stretch; @@ -357,6 +350,7 @@ void DDScrollBuffer_SoftScrollTo(int X, int Y, long TimeMS, int FPS) dx = X - mScrollX; dY = Y - mScrollY; maxD = (Abs(dx) < Abs(dY) ? Abs(dY) : Abs(dx)); + StepCount = FPS * (TimeMS / (double)1000); if (StepCount > maxD) StepCount = maxD; @@ -368,8 +362,7 @@ void DDScrollBuffer_SoftScrollTo(int X, int Y, long TimeMS, int FPS) tStep = (double)1 / StepCount; oldX = mScrollX; oldY = mScrollY; - // R = Sqr(dX * dX + dY * dY) - // If R = 0 Then Exit Sub 'we are there already + for (T = (double)tStep; T <= (double)1; T += tStep) { if (UserDragFlag) @@ -392,7 +385,5 @@ void DDScrollBuffer_SoftScrollTo(int X, int Y, long TimeMS, int FPS) SoftScrollEH: AlreadyRunning = False; -#if 1 ScrollPlayfieldIfNeeded(); -#endif } diff --git a/src/game_sp/DDSpriteBuffer.c b/src/game_sp/DDSpriteBuffer.c index 39f04e76..ac5287db 100644 --- a/src/game_sp/DDSpriteBuffer.c +++ b/src/game_sp/DDSpriteBuffer.c @@ -19,8 +19,6 @@ void DDSpriteBuffer_Init() static void Blt(int pX, int pY, Bitmap *bitmap, int SpriteX, int SpriteY) { - MyRECT DR, SR; - int scx = (mScrollX_last < 0 ? 0 : mScrollX_last); int scy = (mScrollY_last < 0 ? 0 : mScrollY_last); int sx1 = scx - 2 * TILEX; @@ -38,20 +36,8 @@ static void Blt(int pX, int pY, Bitmap *bitmap, int SpriteX, int SpriteY) if (pX < sx1 || pX > sx2 || pY < sy1 || pY > sy2) return; - DR.left = pX + mDestXOff; - DR.top = pY + mDestYOff; - DR.right = pX + mSpriteWidth + mDestXOff; - DR.bottom = pY + mSpriteHeight + mDestYOff; - - SR.left = SpriteX; - SR.top = SpriteY; - SR.right = SR.left + mSpriteWidth; - SR.bottom = SR.top + mSpriteHeight; - - BlitBitmap(bitmap, screenBitmap, - SR.left, SR.top, - mSpriteWidth, mSpriteHeight, - sx, sy); + BlitBitmap(bitmap, screenBitmap, SpriteX, SpriteY, + mSpriteWidth, mSpriteHeight, sx, sy); } void DDSpriteBuffer_BltImg(int pX, int pY, int graphic, int sync_frame) diff --git a/src/game_sp/Demo.c b/src/game_sp/Demo.c index 373a8364..7189f5c0 100644 --- a/src/game_sp/Demo.c +++ b/src/game_sp/Demo.c @@ -4,13 +4,7 @@ #include "Demo.h" -// static char *VB_Name = "modDemo"; -// --- Option Explicit -// -// Public Function subCloseDemoRecordingFile() -// -// End Function int RecDemoRandomSeed; byte FirstDemoByte; char *MySignature; @@ -95,8 +89,6 @@ currency GetTotalFramesOfDemo() GetTotalFramesOfDemo = nFrames; return GetTotalFramesOfDemo; - // GetTotalFramesOfDemoEH: - // ReportError "GetTotalFramesOfDemo()", "invalid data detected in file " & OrigPath GetTotalFramesOfDemo = 0; DemoAvailable = False; diff --git a/src/game_sp/DemoBufferObject.c b/src/game_sp/DemoBufferObject.c deleted file mode 100644 index 3a074126..00000000 --- a/src/game_sp/DemoBufferObject.c +++ /dev/null @@ -1,249 +0,0 @@ -// ---------------------------------------------------------------------------- -// DemoBufferObject.c -// ---------------------------------------------------------------------------- - -#include "DemoBufferObject.h" - -// static void Class_Terminate(); -// static int RemoveLastDemoKey(); - -// --- 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 = "DemoBufferObject"; -// static boolean VB_GlobalNameSpace = False; -// static boolean VB_Creatable = True; -// static boolean VB_PredeclaredId = False; -// static boolean VB_Exposed = False; - -// --- Option Explicit - -#define MaxPos ((long)1024) - -// Private Const MaxPos& = 20& 'debug only -byte DemoByte[MaxPos + 1]; -DemoBufferObject SubBuffer; - -byte nFirstByte; - -char *mSignature; -boolean bSignatureAvailable; - -long WritePos; -int LastKey; -int CheckSum; -long nSize; - -#if 0 - -static void Class_Initialize() -{ - int lSize; - - Trace("DemoBufferObject", "Construction"); - DemoBufferObject_Reset(); - if (! IS_NOTHING(&DemoBuffer, sizeof(DemoBuffer))) - { - lSize = DemoBuffer_Size(); - Trace("DemoBufferObject", "Size == ..."); - Trace("DemoBufferObject", "BufferCount == ..."); - Trace("DemoBufferObject", "TimerVar == ..."); - } -} - -static void Class_Terminate() -{ - SET_TO_NOTHING(&SubBuffer, sizeof(SubBuffer)); -} - -#endif - -void DemoBufferObject_Reset() -{ - nSize = 0; - nFirstByte = 0x81; - WritePos = 0; - LastKey = -1; - CheckSum = 0; - bSignatureAvailable = False; - mSignature = ""; - SET_TO_NOTHING(&SubBuffer, sizeof(SubBuffer)); -} - -long DemoBufferObject_Get_Size() -{ - long Size; - - Size = (nSize < 1 ? 0 : nSize); - if (! IS_NOTHING(&SubBuffer, sizeof(SubBuffer))) - Size = Size + SubBuffer.Size; - - return Size; -} - -byte DemoBufferObject_Get_CheckSumByte() -{ - byte CheckSumByte; - - CheckSumByte = CheckSum & 0xFF; - - return CheckSumByte; -} - -byte DemoBufferObject_Get_FirstByte() -{ - byte FirstByte; - - FirstByte = nFirstByte; - - return FirstByte; -} - -void DemoBufferObject_Let_FirstByte(byte NewVal) -{ - nFirstByte = NewVal; -} - -// -// Public Property Get DemoAvailable() As Boolean -// DemoAvailable = (0 < nSize) -// End Property -// -// Public Property Get Signature() As String -// If SubBuffer Is Nothing Then -// Signature = mSignature -// Else -// Signature = SubBuffer.Signature -// End If -// End Property - -// Public Property Let Signature(NewSig$) -// If SubBuffer Is Nothing Then -// Signature = NewSig -// Else -// SubBuffer.Signature = NewSig -// End If -// End Property -// -// Public Property Get SignatureAvailable() As Boolean -// If SubBuffer Is Nothing Then -// SignatureAvailable = (mSignature <> "") -// Else -// SignatureAvailable = SubBuffer -// End If -// End Property - -boolean DemoBufferObject_Serialize(FILE *FNum) -{ - boolean Serialize; - - int i; // , LKey% - - Serialize = True; - if (! IS_NOTHING(&SubBuffer, sizeof(SubBuffer))) - Serialize = SubBuffer.Serialize(FNum); - - if (nSize == 0) - return Serialize; - - // LKey = RemoveLastDemoKey() - if (! nSize < MaxPos) // this buffer is full - { - - // --- On Error GoTo SerializeEH - FILE_PUT(FNum, -1, &DemoByte, sizeof(DemoByte)); - // --- On Error GoTo 0 - - } - else // this is the last buffer in the recursive chain - { - - // --- On Error GoTo SerializeEH - for (i = 1; i <= WritePos; i++) - { - FILE_PUT(FNum, -1, &DemoByte[i], sizeof(DemoByte[i])); - } - - // --- On Error GoTo 0 - - } - - // AddDemoKey LKey - return Serialize; - - // SerializeEH: - Serialize = False; - - return Serialize; -} - -void DemoBufferObject_AddDemoKey(int KeyCode) -{ - CheckSum = (CheckSum + 1) & 0xFF; // increment checksum - // If Not SubBuffer Is Nothing Then 'delegate - // Debug.Assert False - // 'SubBuffer.AddDemoKey KeyCode - // Exit Sub - // End If - if (LastKey == KeyCode) - { - DemoByte[WritePos] = DemoByte[WritePos] + 0x10; - if (0xEF < DemoByte[WritePos]) - LastKey = -1; - - } - else // LastKey <> KeyCode - { - WritePos = WritePos + 1; - - if (MaxPos < WritePos) // if overflow then create new buffer, hang myself in list - { - DemoBufferObject Tmp; - - // Tmp = New DemoBufferObject; // (handle this later, if needed) - Tmp.SetSubBuffer(&VB_OBJECT_SELF); - Tmp.AddDemoKey(KeyCode); // and delegate - DemoBuffer = Tmp; - } - else - { - nSize = nSize + 1; // increment size - DemoByte[WritePos] = KeyCode; - LastKey = KeyCode; - } - } -} - -void DemoBufferObject_SetSubBuffer(DemoBufferObject SBuf) -{ - SubBuffer = SBuf; -} - -#if 0 - -static int RemoveLastDemoKey() -{ - static int RemoveLastDemoKey; - - RemoveLastDemoKey = (DemoByte[WritePos] & 0xF); - if (DemoByte[WritePos] < 0x10) - { - WritePos = WritePos - 1; - nSize = nSize - 1; - LastKey = -1; - } - else - { - DemoByte[WritePos] = DemoByte[WritePos] - 0x10; - } - - return RemoveLastDemoKey; -} - -#endif diff --git a/src/game_sp/DemoBufferObject.h b/src/game_sp/DemoBufferObject.h deleted file mode 100644 index f22e24b4..00000000 --- a/src/game_sp/DemoBufferObject.h +++ /dev/null @@ -1,24 +0,0 @@ -// ---------------------------------------------------------------------------- -// DemoBufferObject.h -// ---------------------------------------------------------------------------- - -#ifndef DEMOBUFFEROBJECT_H -#define DEMOBUFFEROBJECT_H - -#include "vb_types.h" -#include "vb_defs.h" -#include "vb_vars.h" -#include "vb_lib.h" - -#include "global.h" - -extern void DemoBufferObject_AddDemoKey(int KeyCode); -extern byte DemoBufferObject_Get_CheckSumByte(); -extern byte DemoBufferObject_Get_FirstByte(); -extern long DemoBufferObject_Get_Size(); -extern void DemoBufferObject_Let_FirstByte(byte NewVal); -extern void DemoBufferObject_Reset(); -extern boolean DemoBufferObject_Serialize(FILE *FNum); -extern void DemoBufferObject_SetSubBuffer(DemoBufferObject SBuf); - -#endif /* DEMOBUFFEROBJECT_H */ diff --git a/src/game_sp/DirectDrawGlobals.c b/src/game_sp/DirectDrawGlobals.c deleted file mode 100644 index 9ea35bcd..00000000 --- a/src/game_sp/DirectDrawGlobals.c +++ /dev/null @@ -1,52 +0,0 @@ -// ---------------------------------------------------------------------------- -// DirectDrawGlobals.c -// ---------------------------------------------------------------------------- - -#include "DirectDrawGlobals.h" - -// static char *VB_Name = "DirectDrawGlobals"; - -// --- Option Explicit - -#if 0 - -DirectX7 DirectX; -DirectDraw7 DirectDraw; -DirectDrawSurface7 PrimarySurface; - -void InitDirectDraw(long hWndClip) -{ - DDSURFACEDESC2 SD; - - // DirectX = New DirectX7; // (handle this later, if needed) - DirectDraw = DirectX.DirectDrawCreate(""); - DirectDraw.SetCooperativeLevel(0, DDSCL_NORMAL); - // Create PrimarySurface: - { - SD.lFlags = DDSD_CAPS; - SD.ddsCaps.lCaps = DDSCAPS_PRIMARYSURFACE; - } - PrimarySurface = DirectDraw.CreateSurface(SD); - if (hWndClip != 0) - ClipToWindow(hWndClip); -} - -void ReleaseDirectDraw() -{ - SET_TO_NOTHING(&PrimarySurface, sizeof(PrimarySurface)); - SET_TO_NOTHING(&DirectDraw, sizeof(DirectDraw)); - SET_TO_NOTHING(&DirectX, sizeof(DirectX)); -} - -void ClipToWindow(long hWnd) -{ - DirectDrawClipper Clipper; - - // create clipper - Clipper = DirectDraw.CreateClipper(0); - Clipper.SetHWnd(hWnd); - PrimarySurface.SetClipper(Clipper); - SET_TO_NOTHING(&Clipper, sizeof(Clipper)); -} - -#endif diff --git a/src/game_sp/DirectDrawGlobals.h b/src/game_sp/DirectDrawGlobals.h deleted file mode 100644 index 9acca161..00000000 --- a/src/game_sp/DirectDrawGlobals.h +++ /dev/null @@ -1,27 +0,0 @@ -// ---------------------------------------------------------------------------- -// DirectDrawGlobals.h -// ---------------------------------------------------------------------------- - -#ifndef DIRECTDRAWGLOBALS_H -#define DIRECTDRAWGLOBALS_H - -#include "vb_types.h" -#include "vb_defs.h" -#include "vb_vars.h" -#include "vb_lib.h" - -#include "global.h" - -#if 0 - -extern void ClipToWindow(long hWnd); -extern void InitDirectDraw(long hWndClip); -extern void ReleaseDirectDraw(); - -extern DirectDraw7 DirectDraw; -extern DirectDrawSurface7 PrimarySurface; -extern DirectX7 DirectX; - -#endif - -#endif /* DIRECTDRAWGLOBALS_H */ diff --git a/src/game_sp/DirectXGlobals.c b/src/game_sp/DirectXGlobals.c deleted file mode 100644 index 378903d2..00000000 --- a/src/game_sp/DirectXGlobals.c +++ /dev/null @@ -1,102 +0,0 @@ -// ---------------------------------------------------------------------------- -// DirectXGlobals.c -// ---------------------------------------------------------------------------- - -#include "DirectXGlobals.h" - -// static char *VB_Name = "DirectXGlobals"; - -// --- Option Explicit - -#if 0 - -DirectX7 DirectX; -DirectX7 DirectXS; -DirectDraw7 DDraw; -DirectSound DSound; - -// Public DInput As DirectInput -// Public DKeyboard As DirectInputDevice -DirectDrawSurface7 PrimarySurface; - -#endif - -#if 0 - -void InitDirectX(long hWndForm, long hWndClip) -{ - // DirectX = New DirectX7; // (handle this later, if needed) - // DirectXS = New DirectX7; // (handle this later, if needed) - - // DirectSound: - - // --- On Error Resume Next - DSound = DirectXS.DirectSoundCreate(""); - if (Err.Number != 0) - { - ReportError("InitDirectX()", "Unable to start DirectSound."); - } - else - { - DSound.SetCooperativeLevel(hWndForm, DSSCL_PRIORITY); - LoadSoundFX(); - } - - // DirectDraw: - DDraw = DirectX.DirectDrawCreate(""); - DDraw.SetCooperativeLevel(0, DDSCL_NORMAL); - RestorePrimarySurface(); - if (hWndClip != 0) - ClipToWindow(hWndClip); - - // 'DirectInput: - // Set DInput = DirectX.DirectInputCreate() - // Set DKeyboard = DInput.CreateDevice("GUID_SysKeyboard") - // Call DKeyboard.SetCommonDataFormat(DIFORMAT_KEYBOARD) - // Call DKeyboard.SetCooperativeLevel(hWndForm, DISCL_NONEXCLUSIVE Or DISCL_BACKGROUND) - // Call DKeyboard.Acquire -} - -void RestorePrimarySurface() -{ - DDSURFACEDESC2 SD; - - // Create PrimarySurface: - { - SD.lFlags = DDSD_CAPS; - SD.ddsCaps.lCaps = DDSCAPS_PRIMARYSURFACE; - } - - // --- On Error Resume Next - SET_TO_NOTHING(&PrimarySurface, sizeof(PrimarySurface)); - PrimarySurface = DDraw.CreateSurface(SD); -} - -void ReleaseDirectDraw() -{ - SET_TO_NOTHING(&PrimarySurface, sizeof(PrimarySurface)); - SET_TO_NOTHING(&DDraw, sizeof(DDraw)); - SET_TO_NOTHING(&DirectX, sizeof(DirectX)); -} - -void ClipToWindow(long hWnd) -{ - DirectDrawClipper Clipper; - long shWnd; - - if (hWnd != 0) - shWnd = hWnd; - - // create clipper - Clipper = DDraw.CreateClipper(0); - Clipper.SetHWnd(shWnd); - PrimarySurface.SetClipper(Clipper); - SET_TO_NOTHING(&Clipper, sizeof(Clipper)); -} - -// Public Sub DimPrimary(Brightness&) -// Dim Pal As DirectDrawPalette -// Set Pal = PrimarySurface.GetPalette() -// End Sub - -#endif diff --git a/src/game_sp/DirectXGlobals.h b/src/game_sp/DirectXGlobals.h deleted file mode 100644 index d00a5a9a..00000000 --- a/src/game_sp/DirectXGlobals.h +++ /dev/null @@ -1,30 +0,0 @@ -// ---------------------------------------------------------------------------- -// DirectXGlobals.h -// ---------------------------------------------------------------------------- - -#ifndef DIRECTXGLOBALS_H -#define DIRECTXGLOBALS_H - -#include "vb_types.h" -#include "vb_defs.h" -#include "vb_vars.h" -#include "vb_lib.h" - -#include "global.h" - -#if 0 - -extern void ClipToWindow(long hWnd); -extern void InitDirectX(long hWndForm, long hWndClip); -extern void ReleaseDirectDraw(); -extern void RestorePrimarySurface(); - -extern DirectDraw7 DDraw; -extern DirectDrawSurface7 PrimarySurface; -extern DirectSound DSound; -extern DirectX7 DirectX; -extern DirectX7 DirectXS; - -#endif - -#endif /* DIRECTXGLOBALS_H */ diff --git a/src/game_sp/Display.c b/src/game_sp/Display.c index 94c846ed..ceaf6442 100644 --- a/src/game_sp/Display.c +++ b/src/game_sp/Display.c @@ -4,14 +4,11 @@ #include "Display.h" -// static char *VB_Name = "modDisplay"; - -// --- Option Explicit int ScreenScrollXPos, ScreenScrollYPos; -int ScreenPosition, data_h_Xtmp, data_h_Ytmp; +int ScreenPosition; -int ShowRedDiskCounter, ShowPanel; +int ShowPanel; int ExplosionShake; boolean NoDisplayFlag; @@ -19,87 +16,12 @@ long DisplayMinX, DisplayMaxX, DisplayWidth; long DisplayMinY, DisplayMaxY, DisplayHeight; -int subDisplayInfotronsNeeded() -{ - int subDisplayInfotronsNeeded; - - if (NoDisplayFlag) - return subDisplayInfotronsNeeded; - - { -#if 0 - MainForm.lblInfoCount.Caption = InfotronsNeeded; - MainForm.lblInfoCount.Refresh; -#endif - } - - return subDisplayInfotronsNeeded; -} - -int subDisplayPlayingTime() +void subDisplayLevel() { - int subDisplayPlayingTime; - - - return subDisplayPlayingTime; -} - -int subDisplayLevel() -{ - int subDisplayLevel; - if (NoDisplayFlag || ! LevelLoaded) - return subDisplayLevel; - -#if 1 - DisplayLevel(); -#else - MainForm.DisplayLevel(); -#endif - - return subDisplayLevel; -} - -void subDisplayPanel() -{ -} - -int subCheckRestoreRedDiskCountDisplay() -{ - int subCheckRestoreRedDiskCountDisplay; - - if (NoDisplayFlag) - return subCheckRestoreRedDiskCountDisplay; - - if (ShowRedDiskCounter == 0) - return subCheckRestoreRedDiskCountDisplay; - - ShowRedDiskCounter = ShowRedDiskCounter - 1; - if (ShowRedDiskCounter == 0) - { - { -#if 0 - MainForm.lblRedDiskCount.Caption = 0; - MainForm.lblRedDiskCount.Refresh; -#endif - } - } - - return subCheckRestoreRedDiskCountDisplay; -} - -void subDisplayRedDiskCount() -{ - if (NoDisplayFlag) return; - { -#if 0 - MainForm.lblRedDiskCount.Caption = RedDiskCount; - MainForm.lblRedDiskCount.Refresh; -#endif - } - ShowRedDiskCounter = 0x46; + DisplayLevel(); } void ScrollTo(int X, int Y) @@ -134,10 +56,6 @@ void ScrollTowards(int X, int Y) if (NoDisplayFlag) return; -#if 0 - printf("::: 1 ---> %d, %d\n", X, Y); -#endif - oldX = ScrollX; oldY = ScrollY; X = ScrollDelta * (X / ScrollDelta); @@ -149,15 +67,7 @@ void ScrollTowards(int X, int Y) // ScrollX = X // ScrollY = Y -#if 0 - printf("::: 2 ---> %d, %d\n", X, Y); -#endif - -#if 1 Stage.ScrollTowards(X, Y, 2 * Stretch * ZoomFactor); -#else - Stage.ScrollTowards(X, Y, 2 * Stretch); -#endif } void SoftScrollTo(int X, int Y, long TimeMS, int FPS) @@ -167,12 +77,6 @@ void SoftScrollTo(int X, int Y, long TimeMS, int FPS) if (NoDisplayFlag) return; -#if 0 - printf(":(: %d, %d [%d, %d - %d, %d] [%d]\n", - X, Y, ScrollMinX, ScrollMinY, ScrollMaxX, ScrollMaxY, - ScrollDelta); -#endif - oldX = ScrollX; oldY = ScrollY; X = ScrollDelta * (X / ScrollDelta); @@ -184,11 +88,5 @@ void SoftScrollTo(int X, int Y, long TimeMS, int FPS) // ScrollX = X // ScrollY = Y -#if 0 - printf(":): %d, %d [%d, %d - %d, %d] [%d]\n", - X, Y, ScrollMinX, ScrollMinY, ScrollMaxX, ScrollMaxY, - ScrollDelta); -#endif - Stage.SoftScrollTo(X, Y, TimeMS, FPS); } diff --git a/src/game_sp/Display.h b/src/game_sp/Display.h index e1dec9e7..bdd16a07 100644 --- a/src/game_sp/Display.h +++ b/src/game_sp/Display.h @@ -12,22 +12,20 @@ #include "global.h" -extern void ScrollTo(int X, int Y); -extern void ScrollTowards(int X, int Y); -extern void SoftScrollTo(int X, int Y, long TimeMS, int FPS); -extern int subCheckRestoreRedDiskCountDisplay(); -extern int subDisplayInfotronsNeeded(); -extern int subDisplayLevel(); -extern void subDisplayPanel(); -extern int subDisplayPlayingTime(); -extern void subDisplayRedDiskCount(); -extern boolean NoDisplayFlag; -extern int ExplosionShake; -extern int ScreenPosition, data_h_Xtmp, data_h_Ytmp; extern int ScreenScrollXPos, ScreenScrollYPos; -extern int ShowRedDiskCounter, ShowPanel; +extern int ScreenPosition; + +extern int ShowPanel; +extern int ExplosionShake; +extern boolean NoDisplayFlag; + extern long DisplayMinX, DisplayMaxX, DisplayWidth; extern long DisplayMinY, DisplayMaxY, DisplayHeight; +extern void subDisplayLevel(); +extern void ScrollTo(int, int); +extern void ScrollTowards(int, int); +extern void SoftScrollTo(int, int, long, int); + #endif /* DISPLAY_H */ diff --git a/src/game_sp/DoGameStuff.c b/src/game_sp/DoGameStuff.c index 81f4a954..3bef3684 100644 --- a/src/game_sp/DoGameStuff.c +++ b/src/game_sp/DoGameStuff.c @@ -4,30 +4,26 @@ #include "DoGameStuff.h" + static void CallAnimation(int si, byte bl); static boolean IsToBeAnimated(int bl); -// static char *VB_Name = "modDoGameStuff"; - -// --- Option Explicit - int *AnimationPosTable; byte *AnimationSubTable; + // ========================================================================== // SUBROUTINE // Do game stuff // ========================================================================== -int subDoGameStuff() +void subDoGameStuff() { - int subDoGameStuff; - int si, cx, dx, bl; subAnimateMurphy(&MurphyPosIndex); // move Murphy in any direction - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // Build a database of locations and subs-to-call of animatable fields only: // Make a snapshot from the field before the animation cycle starts. // first and last line are not animated. @@ -52,7 +48,7 @@ int subDoGameStuff() } while (0 < cx); // locloop_g_2282' until all lines scanned(not top- and bottom edge) - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // Now use the database to animate all animatables the fastest way. // All the other fields are not checked anymore: those have no database entry. // The field from before animation is frozen in the database in order not to @@ -66,72 +62,31 @@ int subDoGameStuff() } // loop locloop_g_22B8 ' until all animatables done } -#if 0 - printf("::: DoGameStuff.c: KillMurphyFlag == %d [%d]\n", - KillMurphyFlag, MurphyMoveCounter); -#endif - // All animations are done now - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - if (KillMurphyFlag == 1 || MurphyMoveCounter == 0) { -#if 1 if (LeadOutCounter == 0 && !game_sp.LevelSolved && !game_sp.GameOver) -#else - if (LeadOutCounter == 0) -#endif { #if 1 printf("::: DoGameStuff.c: killing murphy [%d] ...\n", KillMurphyFlag); #endif - KillMurphyFlag = 0; // no more "kill Murphy" - ExplodeFieldSP(MurphyExplodePos); // Explode - LeadOutCounter = 0x40; // quit: start lead-out - -#if 1 + KillMurphyFlag = 0; // no more "kill Murphy" + ExplodeFieldSP(MurphyExplodePos); // Explode + LeadOutCounter = 0x40; // quit: start lead-out #if 1 printf("::: DoGameStuff.c: !!!!!!!!!! GAME OVER !!!!!!!!!!\n"); printf("::: [KillMurphyFlag == %d]\n", KillMurphyFlag); #endif -#if 1 /* give Murphy some more time (LeadOutCounter) to reach the exit */ -#else - game_sp.GameOver = TRUE; -#endif - -#endif } - -#if 1 -#if 0 - printf("::: *** %d, %d, %d\n", KillMurphyFlag, - game_sp.LevelSolved, game_sp.GameOver); -#endif - -#if 0 - if (KillMurphyFlag == 1 && - !game_sp.LevelSolved && - !game_sp.GameOver) - { -#if 1 - printf("::: DoGameStuff.c: !!!!!!!!!! GAME OVER !!!!!!!!!!\n"); -#endif - - game_sp.GameOver = TRUE; - } -#endif -#endif - } // loc_g_22FB: - - - return subDoGameStuff; -} // subDoGameStuff +} static boolean IsToBeAnimated(int bl) { diff --git a/src/game_sp/DoGameStuff.h b/src/game_sp/DoGameStuff.h index 5d97153c..ac822b1a 100644 --- a/src/game_sp/DoGameStuff.h +++ b/src/game_sp/DoGameStuff.h @@ -12,9 +12,10 @@ #include "global.h" -extern int subDoGameStuff(); extern byte *AnimationSubTable; extern int *AnimationPosTable; +extern void subDoGameStuff(); + #endif /* DOGAMESTUFF_H */ diff --git a/src/game_sp/Electrons.c b/src/game_sp/Electrons.c index a910138d..e618994a 100644 --- a/src/game_sp/Electrons.c +++ b/src/game_sp/Electrons.c @@ -4,27 +4,24 @@ #include "Electrons.h" -// static char *VB_Name = "modElectron"; -// --- Option Explicit // ========================================================================== // SUBROUTINE // Animate/move Electrons // ========================================================================== -int subAnimateElectrons(int si) +void subAnimateElectrons(int si) { - int subAnimateElectrons; - int bx, Tmp; if (SnikSnaksElectronsFrozen == 1) - return subAnimateElectrons; + return; if (LowByte(PlayField16[si]) != fiElectron) - return subAnimateElectrons; + return; bx = HighByte(PlayField16[si]); + Tmp = bx / 8; switch (Tmp) { @@ -52,21 +49,18 @@ int subAnimateElectrons(int si) subElectronFromLeft(si, bx); // access si from left break; } +} - return subAnimateElectrons; -} // subAnimateElectrons - -int subDrawAnimatedElectrons(int si) +void subDrawAnimatedElectrons(int si) { - int subDrawAnimatedElectrons; - int bx, Tmp; // If SnikSnaksElectronsFrozen = 1 Then Exit Function if (LowByte(PlayField16[si]) != fiElectron) - return subDrawAnimatedElectrons; + return; bx = HighByte(PlayField16[si]); + Tmp = bx / 8; switch (Tmp) { @@ -94,15 +88,10 @@ int subDrawAnimatedElectrons(int si) subDrawElectronFromLeft(si, bx); // access si from left break; } +} - return subDrawAnimatedElectrons; -} // subDrawAnimatedElectrons - -int subElectronTurnLeft(int si, int bx) +void subElectronTurnLeft(int si, int bx) { - int subElectronTurnLeft; - - // int ax, ah, bl, dx, X, Y; int ax, bl; ax = (TimerVar & 3); @@ -111,22 +100,17 @@ int subElectronTurnLeft(int si, int bx) if (ax == 3) goto loc_g_7ACD; - return subElectronTurnLeft; + return; } // loc_g_7A9F: -#if 1 - subDrawElectronTurnLeft(si, bx); -#else // +++++++++++++++++++++++++++++++++++++++++++++++++++++ - X = GetStretchX(si); - Y = GetStretchY(si); - StretchedSprites.BltEx(X, Y, aniFramesElectron[bx]); + subDrawElectronTurnLeft(si, bx); // +++++++++++++++++++++++++++++++++++++++++++++++++++++ -#endif bx = (bx + 1) & 0x7; MovHighByte(&PlayField16[si], bx); - return subElectronTurnLeft; + + return; loc_g_7ACD: bl = HighByte(PlayField16[si]); @@ -142,7 +126,7 @@ loc_g_7ACD: if (bl == 6) goto loc_g_7B43; - return subElectronTurnLeft; + return; loc_g_7AE6: // pointing up ax = PlayField16[si - FieldWidth]; @@ -152,13 +136,14 @@ loc_g_7AE6: // pointing up if (LowByte(ax) == fiMurphy) // above is murphy -> explode ExplodeFieldSP(si); - return subElectronTurnLeft; + return; loc_g_7AF5: // above is empty -> go up PlayField16[si] = 0x1BB; si = si - FieldWidth; // 1 field up PlayField16[si] = 0x1018; - return subElectronTurnLeft; + + return; loc_g_7B05: // pointing left ax = PlayField16[si - 1]; @@ -168,13 +153,14 @@ loc_g_7B05: // pointing left if (LowByte(ax) == fiMurphy) // left is murphy -> explode ExplodeFieldSP(si); - return subElectronTurnLeft; + return; loc_g_7B14: // left is empty -> go there PlayField16[si] = 0x2BB; si = si - 1; // 1 field left PlayField16[si] = 0x1818; - return subElectronTurnLeft; + + return; loc_g_7B24: // pointing down ax = PlayField16[si + FieldWidth]; @@ -184,13 +170,14 @@ loc_g_7B24: // pointing down if (LowByte(ax) == fiMurphy) // below is murphy -> explode ExplodeFieldSP(si); - return subElectronTurnLeft; + return; loc_g_7B33: // below is empty -> go down PlayField16[si] = 0x3BB; si = si + FieldWidth; // 1 field down PlayField16[si] = 0x2018; - return subElectronTurnLeft; + + return; loc_g_7B43: // pointing Right ax = PlayField16[si + 1]; @@ -200,21 +187,16 @@ loc_g_7B43: // pointing Right if (LowByte(ax) == fiMurphy) // right is murphy -> explode ExplodeFieldSP(si); - return subElectronTurnLeft; + return; loc_g_7B55: // right is empty -> go there PlayField16[si] = 0x4BB; si = si + 1; // 1 field right PlayField16[si] = 0x2818; +} - return subElectronTurnLeft; -} // subElectronTurnLeft - -int subElectronTurnRight(int si, int bx) +void subElectronTurnRight(int si, int bx) { - int subElectronTurnRight; - - // int ax, ah, bl, dx, X, Y; int ax, bl; ax = (TimerVar & 3); @@ -223,22 +205,17 @@ int subElectronTurnRight(int si, int bx) if (ax == 3) goto loc_g_7BA3; - return subElectronTurnRight; + return; } // loc_g_7B73: -#if 1 - subDrawElectronTurnRight(si, bx); -#else // +++++++++++++++++++++++++++++++++++++++++++++++++++++ - X = GetStretchX(si); - Y = GetStretchY(si); - StretchedSprites.BltEx(X, Y, aniFramesElectron[0x10 - bx]); + subDrawElectronTurnRight(si, bx); // +++++++++++++++++++++++++++++++++++++++++++++++++++++ -#endif bx = ((bx + 1) & 0x7) | 8; MovHighByte(&PlayField16[si], bx); - return subElectronTurnRight; + + return; loc_g_7BA3: bl = HighByte(PlayField16[si]); @@ -254,7 +231,7 @@ loc_g_7BA3: if (bl == 0xE) goto loc_g_7BDB; - return subElectronTurnRight; + return; loc_g_7BBC: // pointing up ax = PlayField16[si - FieldWidth]; @@ -264,13 +241,14 @@ loc_g_7BBC: // pointing up if (LowByte(ax) == fiMurphy) // above is murphy -> explode ExplodeFieldSP(si); - return subElectronTurnRight; + return; loc_g_7BCB: // above is empty -> go up PlayField16[si] = 0x1BB; si = si - FieldWidth; // 1 field up PlayField16[si] = 0x1018; - return subElectronTurnRight; + + return; loc_g_7BDB: // pointing left ax = PlayField16[si - 1]; @@ -280,13 +258,14 @@ loc_g_7BDB: // pointing left if (LowByte(ax) == fiMurphy) // left is murphy -> explode ExplodeFieldSP(si); - return subElectronTurnRight; + return; loc_g_7BEA: // left is empty -> go there PlayField16[si] = 0x2BB; si = si - 1; // 1 field left PlayField16[si] = 0x1818; - return subElectronTurnRight; + + return; loc_g_7BFA: // pointing down ax = PlayField16[si + FieldWidth]; @@ -296,13 +275,14 @@ loc_g_7BFA: // pointing down if (LowByte(ax) == fiMurphy) // below is murphy -> explode ExplodeFieldSP(si); - return subElectronTurnRight; + return; loc_g_7C09: // below is empty -> go down PlayField16[si] = 0x3BB; si = si + FieldWidth; // 1 field down PlayField16[si] = 0x2018; - return subElectronTurnRight; + + return; loc_g_7C19: // pointing Right ax = PlayField16[si + 1]; @@ -312,35 +292,22 @@ loc_g_7C19: // pointing Right if (LowByte(ax) == fiMurphy) // right is murphy -> explode ExplodeFieldSP(si); - return subElectronTurnRight; + return; loc_g_7C2B: // right is empty -> go there PlayField16[si] = 0x4BB; si = si + 1; // 1 field right PlayField16[si] = 0x2818; +} - return subElectronTurnRight; -} // subElectronTurnRight - -int subElectronFromBelow(int si, int bx) +void subElectronFromBelow(int si, int bx) { - int subElectronFromBelow; - - // int ax, ah, bl, dx, X, Y; int ax, bl; -#if 1 - subDrawElectronFromBelow(si, bx); - bx = bx - 0xF; // get and increment sequence# -#else - bx = bx - 0xF; // get and increment sequence# // +++++++++++++++++++++++++++++++++++++++++++++++++++++ - X = GetStretchX(si); - Y = GetStretchY(si + FieldWidth); - StretchedSprites.BltEx(X, Y, 0); - StretchedSprites.BltEx(X, Y - bx * TwoPixels, aniFramesElectron[bx]); + subDrawElectronFromBelow(si, bx); // +++++++++++++++++++++++++++++++++++++++++++++++++++++ -#endif + bx = bx - 0xF; // get and increment sequence# bl = LowByte(bx); if (bl == 7 && LowByte(PlayField16[si + FieldWidth]) != fiExplosion) @@ -352,7 +319,8 @@ int subElectronFromBelow(int si, int bx) { bl = bl + 0x10; MovHighByte(&PlayField16[si], bl); - return subElectronFromBelow; + + return; } // loc_g_7C84 PlayField16[si] = 0x18; // sequence#=8 -> arrived at the new field @@ -360,7 +328,8 @@ int subElectronFromBelow(int si, int bx) if (ax == 0 || LowByte(ax) == fiMurphy) // check for empty or murphy { MovHighByte(&PlayField16[si], 1); // start to turn left - return subElectronFromBelow; + + return; } // loc_g_7CA4: ax = PlayField16[si - FieldWidth]; // cannot turn left -> check above @@ -369,47 +338,37 @@ int subElectronFromBelow(int si, int bx) PlayField16[si] = 0x1BB; // mark as "electron leaving" si = si - FieldWidth; // go up! PlayField16[si] = 0x1018; - return subElectronFromBelow; + + return; } if (LowByte(ax) == fiMurphy) // check for murphy above { ExplodeFieldSP(si); // Explode - return subElectronFromBelow; + + return; } // loc_g_7CC6: ax = PlayField16[si + 1]; // check right field if (ax == 0 || LowByte(ax) == fiMurphy) // check for empty or murphy { MovHighByte(&PlayField16[si], 9); // start to turn right - return subElectronFromBelow; + + return; } // loc_g_7CE0: // else: no way to go, start turning around MovHighByte(&PlayField16[si], 1); +} - return subElectronFromBelow; -} // subElectronFromBelow - -int subElectronFromRight(int si, int bx) +void subElectronFromRight(int si, int bx) { - int subElectronFromRight; - - // int ax, ah, bl, dx, X, Y; int ax, bl; -#if 1 - subDrawElectronFromRight(si, bx); - bx = bx - 0x17; // get and increment sequence# -#else - bx = bx - 0x17; // get and increment sequence# // +++++++++++++++++++++++++++++++++++++++++++++++++++++ - X = GetStretchX(si + 1); - Y = GetStretchY(si); - StretchedSprites.BltEx(X, Y, 0); - StretchedSprites.BltEx(X - bx * TwoPixels, Y, aniFramesElectron[bx]); + subDrawElectronFromRight(si, bx); // +++++++++++++++++++++++++++++++++++++++++++++++++++++ -#endif + bx = bx - 0x17; // get and increment sequence# bl = LowByte(bx); if (bl == 7 && LowByte(PlayField16[si + 1]) != fiExplosion) @@ -421,7 +380,8 @@ int subElectronFromRight(int si, int bx) { bl = bl + 0x18; MovHighByte(&PlayField16[si], bl); - return subElectronFromRight; + + return; } // loc_g_7D2A: PlayField16[si] = 0x18; // sequence#=8 -> arrived at the new field @@ -429,7 +389,8 @@ int subElectronFromRight(int si, int bx) if (ax == 0 || LowByte(ax) == fiMurphy) // empty or murphy? { MovHighByte(&PlayField16[si], 3); // yes -> turn left down - return subElectronFromRight; + + return; } // loc_g_7D4A: ax = PlayField16[si - 1]; // check left, etc ... see the comments on subElectronFromBelow() @@ -438,46 +399,36 @@ int subElectronFromRight(int si, int bx) PlayField16[si] = 0x2BB; si = si - 1; // 1 field left PlayField16[si] = 0x1818; - return subElectronFromRight; + + return; } // loc_g_7D61: if (LowByte(ax) == fiMurphy) { ExplodeFieldSP(si); // Explode - return subElectronFromRight; + + return; } // loc_g_7D6C: ax = PlayField16[si - FieldWidth]; // check above if (ax == 0 || LowByte(ax) == fiMurphy) { MovHighByte(&PlayField16[si], 0xF); - return subElectronFromRight; + + return; } // loc_g_7D86: MovHighByte(&PlayField16[si], 3); +} - return subElectronFromRight; -} // subElectronFromRight - -int subElectronFromAbove(int si, int bx) +void subElectronFromAbove(int si, int bx) { - int subElectronFromAbove; - - // int ax, ah, bl, dx, X, Y; int ax, bl; -#if 1 - subDrawElectronFromAbove(si, bx); - bx = bx - 0x1F; // get and increment sequence# -#else - bx = bx - 0x1F; // get and increment sequence# // +++++++++++++++++++++++++++++++++++++++++++++++++++++ - X = GetStretchX(si); - Y = GetStretchY(si - FieldWidth); - StretchedSprites.BltEx(X, Y, 0); - StretchedSprites.BltEx(X, Y + bx * TwoPixels, aniFramesElectron[bx]); + subDrawElectronFromAbove(si, bx); // +++++++++++++++++++++++++++++++++++++++++++++++++++++ -#endif + bx = bx - 0x1F; // get and increment sequence# bl = LowByte(bx); if (bl == 7 && LowByte(PlayField16[si - FieldWidth]) != fiExplosion) @@ -489,7 +440,8 @@ int subElectronFromAbove(int si, int bx) { bl = bl + 0x20; MovHighByte(&PlayField16[si], bl); - return subElectronFromAbove; + + return; } // loc_g_7DD7 PlayField16[si] = 0x18; // sequence#=8 -> arrived at the new field @@ -497,7 +449,8 @@ int subElectronFromAbove(int si, int bx) if (ax == 0 || LowByte(ax) == fiMurphy) { MovHighByte(&PlayField16[si], 5); - return subElectronFromAbove; + + return; } // loc_g_7DF7: ax = PlayField16[si + FieldWidth]; // check below @@ -506,46 +459,36 @@ int subElectronFromAbove(int si, int bx) PlayField16[si] = 0x3BB; si = si + FieldWidth; // 1 field down PlayField16[si] = 0x2018; - return subElectronFromAbove; + + return; } // loc_g_7E0E: if (LowByte(ax) == fiMurphy) { ExplodeFieldSP(si); // Explode - return subElectronFromAbove; + + return; } // loc_g_7E19: ax = PlayField16[si - 1]; // check left if (ax == 0 || LowByte(ax) == fiMurphy) { MovHighByte(&PlayField16[si], 0xD); - return subElectronFromAbove; + + return; } // loc_g_7E33: MovHighByte(&PlayField16[si], 5); +} - return subElectronFromAbove; -} // subElectronFromAbove - -int subElectronFromLeft(int si, int bx) +void subElectronFromLeft(int si, int bx) { - int subElectronFromLeft; - - // int ax, ah, bl, dx, X, Y; int ax, bl; -#if 1 - subDrawElectronFromLeft(si, bx); - bx = bx - 0x27; // get and increment sequence# -#else - bx = bx - 0x27; // get and increment sequence# // +++++++++++++++++++++++++++++++++++++++++++++++++++++ - X = GetStretchX(si - 1); - Y = GetStretchY(si); - StretchedSprites.BltEx(X, Y, 0); - StretchedSprites.BltEx(X + bx * TwoPixels, Y, aniFramesElectron[bx]); + subDrawElectronFromLeft(si, bx); // +++++++++++++++++++++++++++++++++++++++++++++++++++++ -#endif + bx = bx - 0x27; // get and increment sequence# bl = LowByte(bx); if (bl == 7 && LowByte(PlayField16[si - 1]) != fiExplosion) @@ -557,7 +500,8 @@ int subElectronFromLeft(int si, int bx) { bl = bl + 0x28; MovHighByte(&PlayField16[si], bl); - return subElectronFromLeft; + + return; } // loc_g_7E7E: PlayField16[si] = 0x18; // sequence#=8 -> arrived at the new field @@ -565,7 +509,8 @@ int subElectronFromLeft(int si, int bx) if (ax == 0 || LowByte(ax) == fiMurphy) { MovHighByte(&PlayField16[si], 7); - return subElectronFromLeft; + + return; } // loc_g_7E9E: ax = PlayField16[si + 1]; // check right(straight on) @@ -574,149 +519,102 @@ int subElectronFromLeft(int si, int bx) PlayField16[si] = 0x4BB; si = si + 1; // 1 field right PlayField16[si] = 0x2818; - return subElectronFromLeft; + + return; } // loc_g_7EB5: if (LowByte(ax) == fiMurphy) { ExplodeFieldSP(si); // Explode - return subElectronFromLeft; + + return; } // loc_g_7EC0: ax = PlayField16[si + FieldWidth]; // check below if (ax == 0 || LowByte(ax) == fiMurphy) { MovHighByte(&PlayField16[si], 0xB); - return subElectronFromLeft; + + return; } // loc_g_7A69: MovHighByte(&PlayField16[si], 7); +} - return subElectronFromLeft; -} // subElectronFromLeft - -int subDrawElectronTurnLeft(int si, int bx) +void subDrawElectronTurnLeft(int si, int bx) { - int subDrawElectronTurnLeft; - int X, Y; // +++++++++++++++++++++++++++++++++++++++++++++++++++++ X = GetStretchX(si); Y = GetStretchY(si); -#if 1 StretchedSprites.BltImg(X, Y, aniElectron, bx); -#else - StretchedSprites.BltEx(X, Y, aniFramesElectron[bx]); -#endif // +++++++++++++++++++++++++++++++++++++++++++++++++++++ - - return subDrawElectronTurnLeft; } -int subDrawElectronTurnRight(int si, int bx) +void subDrawElectronTurnRight(int si, int bx) { - int subDrawElectronTurnRight; - int X, Y; // +++++++++++++++++++++++++++++++++++++++++++++++++++++ X = GetStretchX(si); Y = GetStretchY(si); -#if 1 StretchedSprites.BltImg(X, Y, aniElectron, 0x10 - bx); -#else - StretchedSprites.BltEx(X, Y, aniFramesElectron[0x10 - bx]); -#endif // +++++++++++++++++++++++++++++++++++++++++++++++++++++ - - return subDrawElectronTurnRight; } -int subDrawElectronFromBelow(int si, int bx) +void subDrawElectronFromBelow(int si, int bx) { - int subDrawElectronFromBelow; - int X, Y; bx = bx - 0xF; // get and increment sequence# + // +++++++++++++++++++++++++++++++++++++++++++++++++++++ X = GetStretchX(si); Y = GetStretchY(si + FieldWidth); -#if 1 StretchedSprites.BltImg(X, Y, aniSpace, 0); StretchedSprites.BltImg(X, Y - bx * TwoPixels, aniElectron, bx); -#else - StretchedSprites.BltEx(X, Y, 0); - StretchedSprites.BltEx(X, Y - bx * TwoPixels, aniFramesElectron[bx]); -#endif // +++++++++++++++++++++++++++++++++++++++++++++++++++++ - - return subDrawElectronFromBelow; } -int subDrawElectronFromRight(int si, int bx) +void subDrawElectronFromRight(int si, int bx) { - int subDrawElectronFromRight; - int X, Y; bx = bx - 0x17; // get and increment sequence# + // +++++++++++++++++++++++++++++++++++++++++++++++++++++ X = GetStretchX(si + 1); Y = GetStretchY(si); -#if 1 StretchedSprites.BltImg(X, Y, aniSpace, 0); StretchedSprites.BltImg(X - bx * TwoPixels, Y, aniElectron, bx); -#else - StretchedSprites.BltEx(X, Y, 0); - StretchedSprites.BltEx(X - bx * TwoPixels, Y, aniFramesElectron[bx]); -#endif // +++++++++++++++++++++++++++++++++++++++++++++++++++++ - - return subDrawElectronFromRight; } -int subDrawElectronFromAbove(int si, int bx) +void subDrawElectronFromAbove(int si, int bx) { - int subDrawElectronFromAbove; - int X, Y; bx = bx - 0x1F; // get and increment sequence# + // +++++++++++++++++++++++++++++++++++++++++++++++++++++ X = GetStretchX(si); Y = GetStretchY(si - FieldWidth); -#if 1 StretchedSprites.BltImg(X, Y, aniSpace, 0); StretchedSprites.BltImg(X, Y + bx * TwoPixels, aniElectron, bx); -#else - StretchedSprites.BltEx(X, Y, 0); - StretchedSprites.BltEx(X, Y + bx * TwoPixels, aniFramesElectron[bx]); -#endif // +++++++++++++++++++++++++++++++++++++++++++++++++++++ - - return subDrawElectronFromAbove; } -int subDrawElectronFromLeft(int si, int bx) +void subDrawElectronFromLeft(int si, int bx) { - int subDrawElectronFromLeft; - int X, Y; bx = bx - 0x27; // get and increment sequence# + // +++++++++++++++++++++++++++++++++++++++++++++++++++++ X = GetStretchX(si - 1); Y = GetStretchY(si); -#if 1 StretchedSprites.BltImg(X, Y, aniSpace, 0); StretchedSprites.BltImg(X + bx * TwoPixels, Y, aniElectron, bx); -#else - StretchedSprites.BltEx(X, Y, 0); - StretchedSprites.BltEx(X + bx * TwoPixels, Y, aniFramesElectron[bx]); -#endif // +++++++++++++++++++++++++++++++++++++++++++++++++++++ - - return subDrawElectronFromLeft; } diff --git a/src/game_sp/Electrons.h b/src/game_sp/Electrons.h index 5eaf289c..7dec2429 100644 --- a/src/game_sp/Electrons.h +++ b/src/game_sp/Electrons.h @@ -12,19 +12,20 @@ #include "global.h" -extern int subAnimateElectrons(int si); -extern int subDrawAnimatedElectrons(int si); -extern int subDrawElectronFromAbove(int si, int bx); -extern int subDrawElectronFromBelow(int si, int bx); -extern int subDrawElectronFromLeft(int si, int bx); -extern int subDrawElectronFromRight(int si, int bx); -extern int subDrawElectronTurnLeft(int si, int bx); -extern int subDrawElectronTurnRight(int si, int bx); -extern int subElectronFromAbove(int si, int bx); -extern int subElectronFromBelow(int si, int bx); -extern int subElectronFromLeft(int si, int bx); -extern int subElectronFromRight(int si, int bx); -extern int subElectronTurnLeft(int si, int bx); -extern int subElectronTurnRight(int si, int bx); + +extern void subAnimateElectrons(int); +extern void subDrawAnimatedElectrons(int); +extern void subDrawElectronFromAbove(int, int); +extern void subDrawElectronFromBelow(int, int); +extern void subDrawElectronFromLeft(int, int); +extern void subDrawElectronFromRight(int, int); +extern void subDrawElectronTurnLeft(int, int); +extern void subDrawElectronTurnRight(int, int); +extern void subElectronFromAbove(int, int); +extern void subElectronFromBelow(int, int); +extern void subElectronFromLeft(int, int); +extern void subElectronFromRight(int, int); +extern void subElectronTurnLeft(int, int); +extern void subElectronTurnRight(int, int); #endif /* ELECTRONS_H */ diff --git a/src/game_sp/ErrorReporting.c b/src/game_sp/ErrorReporting.c index b795d57e..05487a9d 100644 --- a/src/game_sp/ErrorReporting.c +++ b/src/game_sp/ErrorReporting.c @@ -4,6 +4,8 @@ #include "ErrorReporting.h" + + static char * GetErrLogPath(); static char * GetTraceLogPath(); @@ -30,50 +32,3 @@ static char *GetTraceLogPath() return GetTraceLogPath; } - -void Trace(char *Source, char *Message) -{ - // Dim Path$, FNum%, bIsOpen As Boolean - // Path = GetTraceLogPath() - // FNum = FreeFile - // bIsOpen = False - // On Error GoTo TraceEH - // Open Path For Append Access Write As FNum - // bIsOpen = True - // ' --- Print #FNum, Now & " " & Source & " : " & Message - // On Error GoTo 0 - // TraceEH: - // If bIsOpen Then Close FNum -} - -void ReportError(char *Source, char *Message) -{ - char *Path; - FILE *FNum; - boolean bIsOpen; - - Path = GetErrLogPath(); - // FNum = FreeFile(); - bIsOpen = False; - - // --- On Error GoTo ReportErrorEH - FNum = fopen(Path, "ab"); - bIsOpen = True; - // --- Print #FNum, Now & " SOURCE = " & Source & " ErrMessage = " & Message - // --- On Error GoTo 0 - - - // ReportErrorEH: - if (bIsOpen) - fclose(FNum); -} - -void InitErrorReporting() -{ - char *Path; - - Path = GetErrLogPath(); - MayKill(Path); - Path = GetTraceLogPath(); - MayKill(Path); -} diff --git a/src/game_sp/ErrorReporting.h b/src/game_sp/ErrorReporting.h index b5c0f512..b6600afd 100644 --- a/src/game_sp/ErrorReporting.h +++ b/src/game_sp/ErrorReporting.h @@ -13,7 +13,5 @@ #include "global.h" extern void InitErrorReporting(); -extern void ReportError(char *Source, char *Message); -extern void Trace(char *Source, char *Message); #endif /* ERRORREPORTING_H */ diff --git a/src/game_sp/Explosions.c b/src/game_sp/Explosions.c index 0d2ec1a0..ea9368c5 100644 --- a/src/game_sp/Explosions.c +++ b/src/game_sp/Explosions.c @@ -4,69 +4,53 @@ #include "Explosions.h" + static void LetExplodeFieldSP(int tsi, int cx, int dh); -static int subExplodeInfotron(int tsi, int cx); -static int subExplodeZonk(int tsi, int cx); +static void subExplodeInfotron(int tsi, int cx); +static void subExplodeZonk(int tsi, int cx); -// static char *VB_Name = "modExplosions"; -// --- Option Explicit // ========================================================================== // SUBROUTINE // Animate explosion // ========================================================================== -int subAnimateExplosion(int si) -{ - int subAnimateExplosion; - // int ax, bx, bl, X, Y; +void subAnimateExplosion(int si) +{ int ax, bl, X, Y; if (LowByte(PlayField16[si]) != fiExplosion) - return subAnimateExplosion; + return; ax = (TimerVar & 3); if (ax != 0) - return subAnimateExplosion; + return; bl = HighByte(PlayField16[si]); -#if 0 - printf("::: subAnimateExplosion: %d [%d, %d] [%d]\n", - bl, PlayField16[si], si, FrameCounter); -#endif + if ((bl & 0x80) != 0) // infotron explosion! goto loc_g_28D0; bl = bl + 1; MovHighByte(&PlayField16[si], bl); + // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ X = GetStretchX(si); Y = GetStretchY(si); -#if 1 - -#if 1 GfxGraphic[GetX(si)][GetY(si)] = aniDefaultExplosion; -#else - StretchedSprites.BltImg(X, Y, aniDefaultExplosion, bl); -#endif - -#else - StretchedSprites.BltEx(X, Y, aniFramesExplosion[bl]); -#endif // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + if (bl == 8) { PlayField16[si] = 0; ExplosionShake = 0; // nothing explodes -#if 1 + // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ GfxGraphic[GetX(si)][GetY(si)] = aniSpace; -#else - StretchedSprites.BltImg(X, Y, aniSpace, 0); -#endif + // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ } // loc_ret_g_28CF: - return subAnimateExplosion; + return; loc_g_28D0: // explosion produces infotron bl = bl + 1; @@ -75,36 +59,21 @@ loc_g_28D0: // explosion produces infotron PlayField16[si] = fiInfotron; MovLowByte(&ExplosionShake, 0); // nothing explodes -#if 1 + // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ GfxGraphic[GetX(si)][GetY(si)] = aniInfotron; -#else - X = GetStretchX(si); - Y = GetStretchY(si); - StretchedSprites.BltImg(X, Y, aniInfotron, 0); -#endif + // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - return subAnimateExplosion; + return; } // loc_g_28E3: MovHighByte(&PlayField16[si], bl); + // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ X = GetStretchX(si); Y = GetStretchY(si); -#if 1 - -#if 1 GfxGraphic[GetX(si)][GetY(si)] = aniElectronExplosion; -#else - StretchedSprites.BltImg(X, Y, aniElectronExplosion, bl - 0x80); -#endif - -#else - StretchedSprites.BltEx(X, Y, aniExplosionInfo + bl - 0x80); -#endif // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - - return subAnimateExplosion; -} // subAnimateExplosion +} // ========================================================================== // SUBROUTINE @@ -113,7 +82,6 @@ loc_g_28D0: // explosion produces infotron void ExplodeFieldSP(int si) { - // int ax, al, cx, dl, dh; int ax, cx, dl; ax = LowByte(PlayField16[si]); @@ -154,12 +122,8 @@ void ExplodeFieldSP(int si) GfxGraphic[GetX(si)][GetY(si)] = -1; // restart for chain-explosions // loc_g_2C3B: -#if 1 subSoundFX(si, ax, actExploding); -#else - subSoundFXExplosion(); -#endif -} // ExplodeFieldSP +} static void LetExplodeFieldSP(int tsi, int cx, int dh) { @@ -169,10 +133,6 @@ static void LetExplodeFieldSP(int tsi, int cx, int dh) return; al = LowByte(PlayField16[tsi]); -#if 0 - printf("::: LetExplodeFieldSP: got %d [%d, %d] [%d]\n", - al, PlayField16[tsi], tsi, FrameCounter); -#endif switch (al) { case fiHardWare: @@ -219,10 +179,8 @@ static void LetExplodeFieldSP(int tsi, int cx, int dh) GfxGraphic[GetX(tsi)][GetY(tsi)] = -1; // restart for chain-explosions } -static int subExplodeZonk(int tsi, int cx) +static void subExplodeZonk(int tsi, int cx) { - static int subExplodeZonk; - int ah; ah = HighByte(PlayField16[tsi]) & 0xF0; @@ -260,14 +218,10 @@ static int subExplodeZonk(int tsi, int cx) subClearFieldDueToExplosion(tsi + FieldWidth); break; } +} - return subExplodeZonk; -} // subExplodeZonk - -static int subExplodeInfotron(int tsi, int cx) +static void subExplodeInfotron(int tsi, int cx) { - static int subExplodeInfotron; - int ah; ah = HighByte(PlayField16[tsi]) & 0xF0; @@ -311,48 +265,30 @@ static int subExplodeInfotron(int tsi, int cx) subClearFieldDueToExplosion(tsi + FieldWidth); break; } +} - return subExplodeInfotron; -} // subExplodeInfotron - -int subClearFieldDueToExplosion(int si) +void subClearFieldDueToExplosion(int si) { - int subClearFieldDueToExplosion; - int X, Y; if (LowByte(PlayField16[si]) == fiExplosion) - return subClearFieldDueToExplosion; + return; PlayField16[si] = 0; // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ X = GetStretchX(si); Y = GetStretchY(si); -#if 1 - -#if 1 GfxGraphic[GetX(si)][GetY(si)] = aniSpace; -#else - StretchedSprites.BltImg(X, Y, aniSpace, 0); -#endif - -#else - StretchedSprites.BltEx(X, Y, fiSpace); -#endif // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +} - return subClearFieldDueToExplosion; -} // subClearFieldDueToExplosion - -int subRedDiskReleaseExplosion() +void subRedDiskReleaseExplosion() { - int subRedDiskReleaseExplosion; - int al, X, Y, si; al = RedDiskReleasePhase; // Red disk release phase if (al <= 1) - return subRedDiskReleaseExplosion; + return; si = RedDiskReleaseMurphyPos; if (PlayField16[si] == 0) // Release red disk @@ -361,19 +297,14 @@ int subRedDiskReleaseExplosion() // +++++++++++++++++++++++++++++++++++++++++ X = GetStretchX(si); Y = GetStretchY(si); -#if 1 - #if 0 // !!! causes flicker -- fix in Murphy.c !!! GfxGraphic[GetX(si)][GetY(si)] = aniRedDisk; #else StretchedSprites.BltImg(X, Y, aniRedDisk, 0); #endif - -#else - StretchedSprites.BltEx(X, Y, fiRedDisk); -#endif // +++++++++++++++++++++++++++++++++++++++++ + RedDiskReleasePhase = RedDiskReleasePhase + 1; if (RedDiskReleasePhase >= 0x28) { @@ -381,14 +312,10 @@ int subRedDiskReleaseExplosion() ExplodeFieldSP(si); // Explode RedDiskReleasePhase = 0; } - - return subRedDiskReleaseExplosion; } -int subFollowUpExplosions() +void subFollowUpExplosions() { - int subFollowUpExplosions; - int ax, si; // locloop_g_2919: @@ -406,7 +333,6 @@ int subFollowUpExplosions() PlayField16[si] = 0xFF18; ExplodeFieldSP(si); // Explode } - } else { @@ -417,6 +343,4 @@ int subFollowUpExplosions() } } } - - return subFollowUpExplosions; -} // subFollowUpExplosions +} diff --git a/src/game_sp/Explosions.h b/src/game_sp/Explosions.h index 16e41d5e..8cd98ba8 100644 --- a/src/game_sp/Explosions.h +++ b/src/game_sp/Explosions.h @@ -12,10 +12,11 @@ #include "global.h" -extern void ExplodeFieldSP(int si); -extern int subAnimateExplosion(int si); -extern int subClearFieldDueToExplosion(int si); -extern int subFollowUpExplosions(); -extern int subRedDiskReleaseExplosion(); + +extern void ExplodeFieldSP(int); +extern void subAnimateExplosion(int); +extern void subClearFieldDueToExplosion(int); +extern void subFollowUpExplosions(); +extern void subRedDiskReleaseExplosion(); #endif /* EXPLOSIONS_H */ diff --git a/src/game_sp/FakeDeclares.c b/src/game_sp/FakeDeclares.c index 98fa900c..b93410a3 100644 --- a/src/game_sp/FakeDeclares.c +++ b/src/game_sp/FakeDeclares.c @@ -4,12 +4,6 @@ #include "FakeDeclares.h" -// static void subUpdateHallOfFame(); - -// static char *VB_Name = "FakeDeclares"; - -// --- Option Explicit -// --- Option Compare Binary int MurphyPosIndex, MurphyXPos, MurphyYPos; int MurphyScreenXPos, MurphyScreenYPos; @@ -23,18 +17,6 @@ int ScratchGravity, GravityFlag; int RedDiskReleaseFlag, MovingPictureSequencePhase; int data_h_DemoDone, LevelStatus; -int data_h_0DA7; -int data_h_0DA8; -int data_h_0DA9; -int data_h_0D9E; -int data_h_0D9F; -int data_h_0DA0; -int data_h_0DA1; -int data_h_0DA2; -int data_h_0DA4; -int data_h_0DA5; -int data_h_0DA6; - int data_h_165A; int YellowDisksExploded; int AllowRedDiskCheat, AllowEatRightRedDiskBug; @@ -46,7 +28,6 @@ int SnikSnaksElectronsFrozen; boolean EditFlag; int EditMode; -// --- const int edDraw = 1; int edSelect = 2; int edMove = 3; @@ -65,55 +46,11 @@ int DebugVersionFlag, D_ModeFlag; int Data_SubRest, Data_SubRstFlg; int keyEnter; -int data_SPtorunavail; // ??????? - int UpdateTimeFlag; -// boolean bModified; boolean ModifiedFlag; -#if 0 - -static void subUpdateHallOfFame() -{ -} - -#endif - -boolean Get_ModifiedFlag() -{ - // boolean ModifiedFlag; - - // Let_ModifiedFlag(bModified); - Let_ModifiedFlag(ModifiedFlag); - - return ModifiedFlag; -} void Let_ModifiedFlag(boolean NewVal) { - // If bModified = NewVal Then Exit Property - char *Cap; - - // bModified = NewVal; - ModifiedFlag = NewVal; - if (! LevelLoaded) - return; - - if (NewVal) - { - Cap = ""; // !!! Cap = "MegaPlex - " & StripFileName(OrigPath) & "*" - gSignature = ""; - bSignatureAvailable = False; - } - else - { - Cap = ""; // !!! Cap = "MegaPlex - " & StripFileName(OrigPath) - } - -#if 0 - if (MainForm.Caption != Cap) - MainForm.Caption = Cap; -#endif } - diff --git a/src/game_sp/FakeDeclares.h b/src/game_sp/FakeDeclares.h index 327587f5..7a12c488 100644 --- a/src/game_sp/FakeDeclares.h +++ b/src/game_sp/FakeDeclares.h @@ -12,10 +12,10 @@ #include "global.h" + #define edDraw (1) extern boolean ModifiedFlag; -extern boolean Get_ModifiedFlag(); extern void Let_ModifiedFlag(boolean NewVal); extern boolean EditFlag; @@ -46,19 +46,6 @@ extern int UpdateTimeFlag; extern int UpdatedFlag; extern int WasDemoFlag; extern int YellowDisksExploded; -extern int data_SPtorunavail; -extern int data_h_0D9E; -extern int data_h_0D9F; -extern int data_h_0DA0; -extern int data_h_0DA1; -extern int data_h_0DA2; -extern int data_h_0DA4; -extern int data_h_0DA5; -extern int data_h_0DA6; -extern int data_h_0DA7; -extern int data_h_0DA8; -extern int data_h_0DA9; -extern int data_h_165A; extern int data_h_DemoDone, LevelStatus; extern int edMove; extern int edSelect; diff --git a/src/game_sp/FancyRestore.c b/src/game_sp/FancyRestore.c deleted file mode 100644 index f1347027..00000000 --- a/src/game_sp/FancyRestore.c +++ /dev/null @@ -1,23 +0,0 @@ -// ---------------------------------------------------------------------------- -// FancyRestore.c -// ---------------------------------------------------------------------------- - -#include "FancyRestore.h" - -// static char *VB_Name = "modFancy"; - -// --- Option Explicit - -// ========================================================================== -// SUBROUTINE -// Restore fancy stuff from sparelevel (and destroy registers ...) -// ========================================================================== - - -int subRestoreFancy() -{ - int subRestoreFancy; - - - return subRestoreFancy; -} diff --git a/src/game_sp/FancyRestore.h b/src/game_sp/FancyRestore.h deleted file mode 100644 index 3edb6d7f..00000000 --- a/src/game_sp/FancyRestore.h +++ /dev/null @@ -1,17 +0,0 @@ -// ---------------------------------------------------------------------------- -// FancyRestore.h -// ---------------------------------------------------------------------------- - -#ifndef FANCYRESTORE_H -#define FANCYRESTORE_H - -#include "vb_types.h" -#include "vb_defs.h" -#include "vb_vars.h" -#include "vb_lib.h" - -#include "global.h" - -extern int subRestoreFancy(); - -#endif /* FANCYRESTORE_H */ diff --git a/src/game_sp/GeneralTricks.c b/src/game_sp/GeneralTricks.c deleted file mode 100644 index 4caed2f0..00000000 --- a/src/game_sp/GeneralTricks.c +++ /dev/null @@ -1,157 +0,0 @@ -// ---------------------------------------------------------------------------- -// GeneralTricks.c -// ---------------------------------------------------------------------------- - -#include "GeneralTricks.h" - -// static char *VB_Name = "GeneralTricks_Module"; - -// --- Option Explicit -// --- Option Compare Text - -double ValEx(char *TS) -{ - double ValEx; - - // Extends the Val() function for - // german-style number-representing strings - int i; - char *LS, *RS; - - i = InStr(1, TS, ","); - if (i != 0) - { - LS = Left(TS, i - 1); - RS = Right(TS, strlen(TS) - i); - ValEx = Val(CAT(LS, ".", RS)); - } - else - { - ValEx = Val(TS); - } - - return ValEx; -} - -void INC(int *VAR, int Delta) -{ - *VAR = *VAR + Delta; -} - -void DEC(int *VAR, int Delta) -{ - *VAR = *VAR - Delta; -} - -#if 0 - -char *MySplit(char *TS, char *Sep, long SCount) -{ - char *MySplit; - - char *T; - long i, J, k, q, L, SL; - char *RA; - - T = TS; - L = strlen(TS); - SL = strlen(Sep); - J = SCount; - if (J < 1) - { - J = 0; - i = 1; - while (i <= L) - { - k = InStr(i, T, Sep); - if (k < i) - break; - - if (i < k) - J = J + 1; - - i = k + SL; - } - - if (i <= L) - J = J + 1; - } - - if (0 < J) - RA = REDIM_1D(sizeof(char), 0, J + 1 - 1); - else - return MySplit; - - i = 1; - q = 0; - while (i <= L) - { - k = InStr(i, T, Sep); - if (k < i) - break; - - if (i < k) - { - if (J <= q + 1) - break; - - q = q + 1; -#if 0 - /* !!! CHECK IF THIS IS REALLY NEEDED !!! */ - RA[q] = Mid(T, i, k - i); -#endif - } - - i = k + SL; - } - - if (i <= L) - { - q = q + 1; - T = Right(T, L - i + 1); - do - { - if (Len(T) <= SL) - break; - - if (Right(T, SL) == Sep) - { - T = Left(T, Len(T) - SL); - } - else - { - break; - } - } - while (1); - - strcpy(&RA[q], T); // RA(q) = T - } - - MySplit = RA; - - return MySplit; -} - -#endif - -void MyReplace(char *TS, char *Pat1, char *Pat2) -{ - long k, SL1, SL2, TL; - - TL = strlen(TS); - SL1 = strlen(Pat1); - SL2 = strlen(Pat2); - k = InStr(1, TS, Pat1); - if (k == 0) - return; - - do - { - TS = CAT(Left(TS, k - 1), Pat2, Right(TS, TL - k - SL1 + 1)); - TL = TL + SL2 - SL1; - k = InStr(k + SL2, TS, Pat1); - } - while (!(k == 0)); -} - diff --git a/src/game_sp/GeneralTricks.h b/src/game_sp/GeneralTricks.h deleted file mode 100644 index e0ad48f7..00000000 --- a/src/game_sp/GeneralTricks.h +++ /dev/null @@ -1,21 +0,0 @@ -// ---------------------------------------------------------------------------- -// GeneralTricks.h -// ---------------------------------------------------------------------------- - -#ifndef GENERALTRICKS_H -#define GENERALTRICKS_H - -#include "vb_types.h" -#include "vb_defs.h" -#include "vb_vars.h" -#include "vb_lib.h" - -#include "global.h" - -extern void DEC(int *VAR, int Delta); -extern void INC(int *VAR, int Delta); -extern void MyReplace(char *TS, char *Pat1, char *Pat2); -extern char *MySplit(char *TS, char *Sep, long SCount); -extern double ValEx(char *TS); - -#endif /* GENERALTRICKS_H */ diff --git a/src/game_sp/Globals.c b/src/game_sp/Globals.c index 8f4ff9dc..cca754aa 100644 --- a/src/game_sp/Globals.c +++ b/src/game_sp/Globals.c @@ -52,6 +52,7 @@ int LevelNumber; char *CurPath, *OrigPath, *TmpPath; boolean LevelLoaded; long SignatureDelay; +boolean bSignatureAvailable; boolean bCapturePane; @@ -347,7 +348,6 @@ void InitGlobals() bSignatureAvailable = False; FirstDemoByte = 0x81; MySignature = ""; - InitErrorReporting(); } void InitPseudoCompileFlags() @@ -749,3 +749,37 @@ void ReadLevel() LevelLoaded = True; } + +void Trace(char *Source, char *Message) +{ + printf("::: Trace: Source == '%s', Message == '%s'\n", Source, Message); +} + +void ReportError(char *Source, char *Message) +{ + printf("::: ReportError: Source == '%s', Message == '%s'\n", Source, Message); +} + +int Min(int A, int B) +{ + int Min; + + if (A < B) + Min = A; + else + Min = B; + + return Min; +} + +int Max(int A, int B) +{ + int Max; + + if (A < B) + Max = B; + else + Max = A; + + return Max; +} diff --git a/src/game_sp/Globals.h b/src/game_sp/Globals.h index b8c77496..7e127054 100644 --- a/src/game_sp/Globals.h +++ b/src/game_sp/Globals.h @@ -358,6 +358,12 @@ extern void ReadLevel(); extern int getSequenceLength(int sequence); extern boolean isSnappingSequence(int sequence); +extern void Trace(char *Source, char *Message); +extern void ReportError(char *Source, char *Message); + +extern int Min(int A, int B); +extern int Max(int A, int B); + extern int fiGraphic[]; extern int aniSnikSnakTurningLeft[]; extern int aniSnikSnakTurningRight[]; diff --git a/src/game_sp/Infotrons.c b/src/game_sp/Infotrons.c index c804191f..08a16662 100644 --- a/src/game_sp/Infotrons.c +++ b/src/game_sp/Infotrons.c @@ -4,30 +4,22 @@ #include "Infotrons.h" -// static char *VB_Name = "modInfotron"; - -// --- Option Explicit // ========================================================================== // SUBROUTINE // Animate Infotrons (falling) // ========================================================================== -int subAnimateInfotrons(int si) +void subAnimateInfotrons(int si) { - int subAnimateInfotrons; - int tFld; - // PseudoRegisters: - // int ax, bx, cx, dx, di, X, Y; - // int ah, bh, ch, dh, al, bl, cl, dl; int ax, bx, dx, X, Y; int al, bl; tFld = PlayField16[si]; if ((tFld & 0xFF) != fiInfotron) - return subAnimateInfotrons; + return; if (tFld == fiInfotron) { @@ -44,7 +36,7 @@ int subAnimateInfotrons(int si) if (ax == fiRAM) goto loc_g_11A6; - return subAnimateInfotrons; + return; loc_g_11A6: // Case fiZonk, fiInfotron, fiRAM ax = PlayField16[si + FieldWidth - 1]; @@ -56,7 +48,7 @@ loc_g_11BD: if (ax == 0 || ax == 0x8888 || ax == 0xAAAA) goto loc_g_11F2; - return subAnimateInfotrons; + return; loc_g_11D5: // Case fiSpace MovHighByte(&PlayField16[si], 0x40); @@ -77,7 +69,7 @@ loc_g_11F2: // roll right? if (PlayField16[si + 1] == 0) goto loc_g_11FA; - return subAnimateInfotrons; + return; loc_g_11FA: MovHighByte(&PlayField16[si], 0x60); @@ -91,6 +83,7 @@ loc_g_1207: bl = HighByte(PlayField16[si]); bx = 0; MovLowByte(&bx, bl); + al = bl & 0xF0; if (al == 0x10) // infotron comes falling from above goto loc_g_1242; @@ -113,7 +106,7 @@ loc_g_1207: if (al == 0x70) // intermediate state goto loc_g_154E; - return subAnimateInfotrons; + return; loc_g_1242: // infotron comes falling from above // To Do: draw infotron falling from above @@ -122,26 +115,24 @@ loc_g_1242: // infotron comes falling from above X = GetStretchX(si); Y = GetStretchY(si - FieldWidth); dx = bl & 0x7; -#if 1 StretchedSprites.BltImg(X, Y, aniSpace, 0); StretchedSprites.BltImg(X, Y + TwoPixels * (dx + 1), aniInfotron, dx); -#else - StretchedSprites.BltEx(X, Y, 0); - StretchedSprites.BltEx(X, Y + TwoPixels * (dx + 1), fiInfotron); -#endif // +++++++++++++++++++++++++++++++++++++++++++++++++++++ + bl = HighByte(PlayField16[si]) + 1; if (bl == 0x16) { MovHighByte(&PlayField16[si], bl); subCleanUpForInfotronsAbove(si - FieldWidth); - return subAnimateInfotrons; + + return; } // loc_g_1285: if (bl < 0x18) { MovHighByte(&PlayField16[si], bl); - return subAnimateInfotrons; + + return; } // loc_g_128F: MovHighByte(&PlayField16[si], 0); // infotron arrived at the field @@ -188,7 +179,7 @@ loc_g_1242: // infotron comes falling from above #endif if (! (ax == fiZonk || ax == fiInfotron || ax == fiRAM)) - return subAnimateInfotrons; + return; // infotron rolls somewhere ax = PlayField16[si + FieldWidth - 1]; @@ -199,12 +190,13 @@ loc_g_1242: // infotron comes falling from above if (ax == 0 || ax == 0x8888 || ax == 0xAAAA) // may roll right goto loc_g_1350; - return subAnimateInfotrons; + return; loc_g_132D: // go on falling down? PlayField16[si] = 0x7004; // go into intermediate waitstate PlayField16[si + FieldWidth] = 0x9999; // mark as "zonk waiting to access" - return subAnimateInfotrons; + + return; loc_g_133A: // test if infotron may roll left // This if(if true) jumps up far above @@ -215,29 +207,30 @@ loc_g_133A: // test if infotron may roll left MovHighByte(&PlayField16[si], 0x50); // infotron rolls left PlayField16[si - 1] = 0x8888; - return subAnimateInfotrons; + return; loc_g_1350: // test if infotron may roll right if (PlayField16[si + 1] != 0) - return subAnimateInfotrons; + return; MovHighByte(&PlayField16[si], 0x60); // infotron rolls right PlayField16[si + 1] = 0x8888; - return subAnimateInfotrons; + return; loc_g_1364: // Murphy dies, but not in any case bl = HighByte(PlayField16[si + FieldWidth]); if (bl == 0xE || bl == 0xF || bl == 0x28) - return subAnimateInfotrons; + return; if (bl == 0x29 || bl == 0x25 || bl == 0x26) - return subAnimateInfotrons; + return; loc_g_1386: // someone dies/explodes immediately si = si + FieldWidth; // 1 field down ExplodeFieldSP(si); // Explode - return subAnimateInfotrons; + + return; loc_g_138D: // infotron comes rolling from right to left // To Do: draw infotron rolling from right @@ -246,14 +239,10 @@ loc_g_138D: // infotron comes rolling from right to left X = GetStretchX(si + 1); Y = GetStretchY(si); dx = (bl & 0x7) + 1; -#if 1 StretchedSprites.BltImg(X, Y, aniSpace, 0); StretchedSprites.BltImg(X - (TwoPixels * dx), Y, aniInfotronRollLeft, dx - 1); -#else - StretchedSprites.BltEx(X, Y, 0); - StretchedSprites.BltEx(X - (TwoPixels * dx), Y, aniFramesInfotronRollLeft[dx - 1]); -#endif // +++++++++++++++++++++++++++++++++++++++++++++++++++++ + bl = HighByte(PlayField16[si]) + 1; // get and increment sequence# if (bl == 0x24) PlayField16[si + 1] = 0xAAAA; @@ -272,7 +261,7 @@ loc_g_138D: // infotron comes rolling from right to left PlayField16[si] = 0x7004; // go into intermediate state } - return subAnimateInfotrons; + return; loc_g_13E9: // infotron comes rolling from left to right // To Do: draw infotron rolling from left @@ -281,14 +270,10 @@ loc_g_13E9: // infotron comes rolling from left to right X = GetStretchX(si - 1); Y = GetStretchY(si); dx = (bl & 0x7) + 1; -#if 1 StretchedSprites.BltImg(X, Y, aniSpace, 0); StretchedSprites.BltImg(X + (TwoPixels * dx), Y, aniInfotronRollRight, dx - 1); -#else - StretchedSprites.BltEx(X, Y, 0); - StretchedSprites.BltEx(X + (TwoPixels * dx), Y, aniFramesInfotronRollRight[dx - 1]); -#endif // +++++++++++++++++++++++++++++++++++++++++++++++++++++ + bl = HighByte(PlayField16[si]) + 1; if (bl == 0x34) PlayField16[si - 1] = 0xAAAA; @@ -307,7 +292,7 @@ loc_g_13E9: // infotron comes rolling from left to right PlayField16[si] = 0x7004; // go into intermediate state } - return subAnimateInfotrons; + return; loc_g_1444: // infotron falls straight down bl = bl + 1; @@ -327,7 +312,7 @@ loc_g_1444: // infotron falls straight down PlayField16[si] = 0x1004; // go falling } - return subAnimateInfotrons; + return; loc_g_1472: // infotron rolls left // To Do: draw infotron rolling to left @@ -336,19 +321,16 @@ loc_g_1472: // infotron rolls left X = GetStretchX(si); Y = GetStretchY(si); dx = (bl & 0xF) + 1; -#if 1 StretchedSprites.BltImg(X, Y, aniSpace, 0); StretchedSprites.BltImg(X - (TwoPixels * dx), Y, aniInfotronRollLeft, dx - 1); -#else - StretchedSprites.BltEx(X, Y, 0); - StretchedSprites.BltEx(X - (TwoPixels * dx), Y, aniFramesInfotronRollLeft[dx - 1]); -#endif // +++++++++++++++++++++++++++++++++++++++++++++++++++++ + bl = HighByte(PlayField16[si]) + 1; // retrieve and increment sequence# if (bl < 0x52) { MovHighByte(&PlayField16[si], bl); - return subAnimateInfotrons; + + return; } if (PlayField16[si + FieldWidth - 1] != 0) @@ -364,12 +346,14 @@ loc_g_1472: // infotron rolls left si = si - 1; // 1 field left PlayField16[si] = 0x2204; PlayField16[si + FieldWidth] = 0x9999; - return subAnimateInfotrons; + + return; loc_g_14D9: // stay waiting bl = bl - 1; MovHighByte(&PlayField16[si], bl); - return subAnimateInfotrons; + + return; loc_g_14E0: // infotron rolls right // To Do: draw infotron rolling to right @@ -378,19 +362,16 @@ loc_g_14E0: // infotron rolls right X = GetStretchX(si); Y = GetStretchY(si); dx = (bl & 0x7) + 1; -#if 1 StretchedSprites.BltImg(X, Y, aniSpace, 0); StretchedSprites.BltImg(X + (TwoPixels * dx), Y, aniInfotronRollRight, dx - 1); -#else - StretchedSprites.BltEx(X, Y, 0); - StretchedSprites.BltEx(X + (TwoPixels * dx), Y, aniFramesInfotronRollRight[dx - 1]); -#endif // +++++++++++++++++++++++++++++++++++++++++++++++++++++ + bl = HighByte(PlayField16[si]) + 1; if (bl < 0x62) { MovHighByte(&PlayField16[si], bl); - return subAnimateInfotrons; + + return; } if (PlayField16[si + FieldWidth + 1] != 0) @@ -406,12 +387,14 @@ loc_g_14E0: // infotron rolls right si = si + 1; PlayField16[si] = 0x3204; PlayField16[si + FieldWidth] = 0x9999; - return subAnimateInfotrons; + + return; loc_g_1547: // stay waiting bl = bl - 1; MovHighByte(&PlayField16[si], bl); - return subAnimateInfotrons; + + return; loc_g_154E: // intermediate state ax = PlayField16[si + FieldWidth]; @@ -422,14 +405,10 @@ loc_g_154E: // intermediate state PlayField16[si] = 0x1004; // start falling down goto loc_g_1242; } +} - return subAnimateInfotrons; -} // subAnimateInfotrons - -int subCleanUpForInfotronsAbove(int si) +void subCleanUpForInfotronsAbove(int si) { - int subCleanUpForInfotronsAbove; - int ax; if (LowByte(PlayField16[si]) != fiExplosion) @@ -438,10 +417,10 @@ int subCleanUpForInfotronsAbove(int si) if (PlayField16[si - FieldWidth] != 0) { if (PlayField16[si - FieldWidth] != 0x9999) - return subCleanUpForInfotronsAbove; + return; if (LowByte(PlayField16[si - 2 * FieldWidth]) != fiZonk) - return subCleanUpForInfotronsAbove; + return; } if (PlayField16[si - FieldWidth - 1] == fiInfotron) @@ -451,7 +430,7 @@ loc_g_16F6: if (PlayField16[si - FieldWidth + 1] == fiInfotron) goto loc_g_1722; - return subCleanUpForInfotronsAbove; + return; loc_g_16FE: ax = PlayField16[si - 1]; @@ -459,7 +438,8 @@ loc_g_16FE: { PlayField16[si - FieldWidth - 1] = 0x6004; PlayField16[si - FieldWidth] = 0x8888; - return subCleanUpForInfotronsAbove; + + return; } goto loc_g_16F6; @@ -471,6 +451,4 @@ loc_g_1722: PlayField16[si - FieldWidth + 1] = 0x5004; PlayField16[si - FieldWidth] = 0x8888; } - - return subCleanUpForInfotronsAbove; -} // subCleanUpForInfotronsAbove +} diff --git a/src/game_sp/Infotrons.h b/src/game_sp/Infotrons.h index 7bce7599..485f868c 100644 --- a/src/game_sp/Infotrons.h +++ b/src/game_sp/Infotrons.h @@ -12,7 +12,8 @@ #include "global.h" -extern int subAnimateInfotrons(int si); -extern int subCleanUpForInfotronsAbove(int si); + +extern void subAnimateInfotrons(int); +extern void subCleanUpForInfotronsAbove(int); #endif /* INFOTRONS_H */ diff --git a/src/game_sp/InitGameConditions.c b/src/game_sp/InitGameConditions.c index 0afc9fa3..937d4dc5 100644 --- a/src/game_sp/InitGameConditions.c +++ b/src/game_sp/InitGameConditions.c @@ -4,19 +4,14 @@ #include "InitGameConditions.h" -// static char *VB_Name = "modInitGameConditions"; - -// --- Option Explicit // ========================================================================== // SUBROUTINE // Init game conditions (variables) // ========================================================================== -int subInitGameConditions() +void subInitGameConditions() { - int subInitGameConditions; - bCapturePane = False; MurphyVar0DAC = MurphyYPos; @@ -26,21 +21,10 @@ int subInitGameConditions() ExitToMenuFlag = 0; 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 + // ShowRedDiskCounter = 0; // show-red-disk time-out - data_h_0DA7 = 0xFF; - data_h_0DA8 = 0xFF; - data_h_0DA9 = 0xFF; - data_h_0D9E = 1; - data_h_0D9F = 0; - data_h_0DA0 = 0; - data_h_0DA1 = 0; - data_h_0DA2 = 0; - data_h_0DA4 = 0; - data_h_0DA5 = 0; - data_h_0DA6 = 0; + YawnSleepCounter = 0; // Wake up sleeping Murphy ExplosionShake = 0; // Force explosion flag off @@ -48,18 +32,17 @@ int subInitGameConditions() 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! SplitMoveFlag = 0; // Reset Split-through-ports RedDiskReleasePhase = 0; // (re-)enable red disk release RedDiskReleaseMurphyPos = 0; // Red disk was released here - - - return subInitGameConditions; -} // subInitGameConditions +} // ========================================================================== @@ -67,28 +50,21 @@ int subInitGameConditions() // Locate Murphy and init location. // ========================================================================== -int InitMurphyPos() +void InitMurphyPos() { - int InitMurphyPos; - int si; for (si = 0; si <= LevelMax - 1; si++) - { if (PlayField16[si] == fiMurphy) break; - } InitMurphyPosB(si); - MurphyPosIndex = si; - return InitMurphyPos; -} // InitMurphyPos + MurphyPosIndex = si; +} -int InitMurphyPosB(int si) +void InitMurphyPosB(int si) { - int InitMurphyPosB; - MurphyYPos = GetStretchY(si) / Stretch; MurphyXPos = GetStretchX(si) / Stretch; @@ -96,47 +72,22 @@ int InitMurphyPosB(int si) MurphyScreenYPos = GetStretchY(si); // Murphy's screen y-position // To Do: draw Murphy in location ax -#if 1 StretchedSprites.BltImg(MurphyScreenXPos, MurphyScreenYPos, aniMurphy, 0); -#else - StretchedSprites.BltEx(MurphyScreenXPos, MurphyScreenYPos, fiMurphy); -#endif MurphyScreenXPos = MurphyScreenXPos / Stretch; MurphyScreenYPos = MurphyScreenYPos / Stretch; subCalculateScreenScrollPos(); // calculate screen start addrs -#if 0 - printf(":1: %d, %d [%d, %d] [%d, %d] [%d, %d]\n", - mScrollX, mScrollY, - mScrollX_last, mScrollY_last, - ScreenScrollXPos, ScreenScrollYPos, - ScrollX, ScrollY); -#endif - if (AutoScrollFlag) { if (bPlaying) - { SoftScrollTo(ScreenScrollXPos, ScreenScrollYPos, 1000, 25); - } else - { ScrollTo(ScreenScrollXPos, ScreenScrollYPos); - } } +} -#if 0 - printf(":2: %d, %d [%d, %d] [%d, %d] [%d, %d]\n", - mScrollX, mScrollY, - mScrollX_last, mScrollY_last, - ScreenScrollXPos, ScreenScrollYPos, - ScrollX, ScrollY); -#endif - - return InitMurphyPosB; -} // InitMurphyPosB // ========================================================================== // SUBROUTINE @@ -145,10 +96,6 @@ int InitMurphyPosB(int si) int subConvertToEasySymbols() { - int subConvertToEasySymbols; - - // int ax, bx, cx, dx, di, X, Y, i; - // int ah, bh, ch, dh, al, bl, cl, dl, ZF; int ax, bx, cx, dx, i; int al; @@ -269,20 +216,17 @@ loc_g_2778: if (0 < cx) // Until all done 'loc_g_2782: goto loc_g_26C9; - subConvertToEasySymbols = dx; // return InfotronCount + return dx; // return InfotronCount +} - return subConvertToEasySymbols; -} // subConvertToEasySymbols // ========================================================================== // SUBROUTINE // Reset Infotron count. Call immediately after subConvertToEasySymbols // ========================================================================== -int ResetInfotronsNeeded(int dx) +void ResetInfotronsNeeded(int dx) { - int ResetInfotronsNeeded; - if (LInfo.InfotronsNeeded != 0) // Jump If equal (autodetect) { dx = LInfo.InfotronsNeeded; @@ -290,10 +234,7 @@ int ResetInfotronsNeeded(int dx) InfotronsNeeded = LowByte(dx); // Remaining Infotrons needed TotalInfotronsNeeded = InfotronsNeeded; // Number of Infotrons needed - subDisplayInfotronsNeeded(); - - return ResetInfotronsNeeded; -} // ResetInfotronsNeeded +} // ========================================================================== @@ -301,25 +242,19 @@ int ResetInfotronsNeeded(int dx) // Fetch and initialize a level // ========================================================================== -int subFetchAndInitLevelB() +void subFetchAndInitLevelB() { - int subFetchAndInitLevelB; - boolean UpdatePlayTime; - MovLowByte(&data_SPtorunavail, 0); // no SP file data_scr_demo = 0; UpdatePlayTime = (0 == demo_stopped ? True : False); demo_stopped = 0; - subFetchAndInitLevelA(UpdatePlayTime); - return subFetchAndInitLevelB; -} // subFetchAndInitLevelb + subFetchAndInitLevelA(UpdatePlayTime); +} -int subFetchAndInitLevelA(boolean UpdatePlayTime) +void subFetchAndInitLevelA(boolean UpdatePlayTime) { - int subFetchAndInitLevelA; - if (UpdatePlayTime && (0 == demo_stopped)) { subUpdatePlayingTime(); // update playing time @@ -355,14 +290,10 @@ int subFetchAndInitLevelA(boolean UpdatePlayTime) DemoKeyRepeatCounter = 1; subGetNextDemoKey(); // get next demo byte } +} - return subFetchAndInitLevelA; -} // subFetchAndInitLevela - -int subFetchAndInitLevel() +void subFetchAndInitLevel() { - int subFetchAndInitLevel; - int InfoCountInLevel; Trace("modInitGameConditions", "--> subFetchAndInitLevel"); @@ -373,14 +304,8 @@ int subFetchAndInitLevel() Trace("modInitGameConditions", "ReadLevel return subFetchAndInitLeveled"); if (RecordDemoFlag == 1) - { RecDemoRandomSeed = RandomSeed; - // Debug.Print "FetchRec: " & Hex(RandomSeed) - } - // If DemoFlag = 1 Then - // Debug.Print "FetchPlay: " & Hex(RandomSeed) - // End If GameBusyFlag = -GameBusyFlag; // make <>1 Trace("modInitGameConditions", "subConvertToEasySymbols"); @@ -391,7 +316,6 @@ int subFetchAndInitLevel() Trace("modInitGameConditions", "subDisplayLevel"); subDisplayLevel(); // Paint (Init) game field - subDisplayPanel(); // Paint (Init) Panel ResetInfotronsNeeded(InfoCountInLevel); // and reset Infotron count @@ -404,6 +328,4 @@ int subFetchAndInitLevel() InitMurphyPos(); // Locate Murphy + screen pos Trace("modInitGameConditions", "<-- subFetchAndInitLevel"); - - return subFetchAndInitLevel; -} // subFetchAndInitLevel +} diff --git a/src/game_sp/InitGameConditions.h b/src/game_sp/InitGameConditions.h index 6c3de557..c78da128 100644 --- a/src/game_sp/InitGameConditions.h +++ b/src/game_sp/InitGameConditions.h @@ -12,13 +12,15 @@ #include "global.h" -extern int InitMurphyPos(); -extern int InitMurphyPosB(int si); -extern int ResetInfotronsNeeded(int dx); + extern int subConvertToEasySymbols(); -extern int subFetchAndInitLevel(); -extern int subFetchAndInitLevelA(boolean UpdatePlayTime); -extern int subFetchAndInitLevelB(); -extern int subInitGameConditions(); + +extern void InitMurphyPos(); +extern void InitMurphyPosB(int); +extern void ResetInfotronsNeeded(int); +extern void subFetchAndInitLevel(); +extern void subFetchAndInitLevelA(boolean); +extern void subFetchAndInitLevelB(); +extern void subInitGameConditions(); #endif /* INITGAMECONDITIONS_H */ diff --git a/src/game_sp/Input.c b/src/game_sp/Input.c index 5271795c..3abfb289 100644 --- a/src/game_sp/Input.c +++ b/src/game_sp/Input.c @@ -4,25 +4,9 @@ #include "Input.h" -// static char *VB_Name = "modInput"; -// --- Option Explicit - -boolean KeyState[255 + 1]; DemoBufferObject DemoBuffer; - -// -// Public KeyFlagSpace As Boolean -// Public KeyFlagUp As Boolean -// Public KeyFlagLeft As Boolean -// Public KeyFlagDown As Boolean -// Public KeyFlagRight As Boolean -// Public KeyFlagEnter As Boolean -// Public KeyFlagESC As Boolean -// Public KeyFlagR As Boolean -// Public KeyFlagRShift As Boolean - -int KeyScanCode7; +boolean KeyState[255 + 1]; int map_key_RND_to_SP(int key) { @@ -55,155 +39,7 @@ int map_key_SP_to_RND(int key) key == keySpace ? KEY_BUTTON : MV_NONE); } -void subCheckJoystick() -{ -} - -int subCheckRightMouseButton() +void subProcessKeyboardInput(byte action) { - int subCheckRightMouseButton; - - // return button state - - return subCheckRightMouseButton; -} - -int subProcessKeyboardInput(byte action) -{ - int subProcessKeyboardInput; - - static int LastKey = 0; - -#if 1 - DemoKeyCode = map_key_RND_to_SP(action); - -#if 0 - printf("::: DemoKeyCode == %d\n", DemoKeyCode); -#endif - - return subProcessKeyboardInput; - -#else - - // On Error GoTo NoKeyboardAccessEH - // Call DKeyboard.Acquire - // On Error GoTo 0 - // Call DKeyboard.GetDeviceStateKeyboard(KeyState) - // With KeyState - if (DemoFlag != 0) - { - subGetNextDemoKey(); - -#if 0 - printf("::: DemoKeyCode == %d\n", DemoKeyCode); -#endif - - if (ExitToMenuFlag != 0) - return subProcessKeyboardInput; - } - else - { - if (KeyState[vbKeySpace]) - { - if (KeyState[vbKeyUp]) - { - DemoKeyCode = keySpaceUp; - } - else if (KeyState[vbKeyLeft]) - { - DemoKeyCode = keySpaceLeft; - } - else if (KeyState[vbKeyDown]) - { - DemoKeyCode = keySpaceDown; - } - else if (KeyState[vbKeyRight]) - { - DemoKeyCode = keySpaceRight; - } - else - { - DemoKeyCode = keySpace; - } - - } - else - { - if (KeyState[vbKeyUp]) - { - DemoKeyCode = keyUp; - } - else if (KeyState[vbKeyLeft]) - { - DemoKeyCode = keyLeft; - } - else if (KeyState[vbKeyDown]) - { - DemoKeyCode = keyDown; - } - else if (KeyState[vbKeyRight]) - { - DemoKeyCode = keyRight; - } - else - { - DemoKeyCode = keyNone; - } - } - } - -#endif - - // demo recording - if (RecordDemoFlag == 1) - DemoBuffer.AddDemoKey(DemoKeyCode); - - if (DemoKeyCode != LastKey && ! NoDisplayFlag) - { -#if 0 - MainForm.ShowKey(DemoKeyCode); -#endif - LastKey = DemoKeyCode; - } - - if (KeyState[vbKeyEscape]) - { - if (BlockingSpeed) - { - // Call MainForm.menSpeed_Click(4) - } - else - { -#if 1 - printf("::: Input.c: subProcessKeyboardInput(): kill murphy\n"); -#endif - - KillMurphyFlag = 1; - // ExplodeFieldSP MurphyPosIndex - // LeadOutCounter = &H20 - } - } - - if (KeyState[vbKeyR]) - { - subFetchAndInitLevelB(); - } - - if (KeyState[vbKeyShift]) - subDisplayRedDiskCount(); - -#if 0 - if (KeyState[vbKeyReturn]) - MainForm.PanelVisible = (ShowPanel == 0); -#endif - - // End With - // Call DKeyboard.Unacquire - return subProcessKeyboardInput; - - // NoKeyboardAccessEH: - Debug.Print("! Keyboard access"); - - return subProcessKeyboardInput; } diff --git a/src/game_sp/Input.h b/src/game_sp/Input.h index 93b9f72d..0183b702 100644 --- a/src/game_sp/Input.h +++ b/src/game_sp/Input.h @@ -12,12 +12,10 @@ #include "global.h" -extern void subCheckJoystick(); -extern int subCheckRightMouseButton(); -extern int subProcessKeyboardInput(byte); extern DemoBufferObject DemoBuffer; extern boolean KeyState[255 + 1]; -extern int KeyScanCode7; + +extern void subProcessKeyboardInput(byte); #endif /* INPUT_H */ diff --git a/src/game_sp/MainGameLoop.c b/src/game_sp/MainGameLoop.c index 028c861e..6c8d5d18 100644 --- a/src/game_sp/MainGameLoop.c +++ b/src/game_sp/MainGameLoop.c @@ -189,7 +189,7 @@ locRepeatMainGameLoop: // start repeating game loop // Call subDisplayPlayingTime ' playing time on screen - subCheckRestoreRedDiskCountDisplay(); // Restore panel: red-disk hole + // subCheckRestoreRedDiskCountDisplay(); // Restore panel: red-disk hole subRedDiskReleaseExplosion(); // Red Disk release and explode subFollowUpExplosions(); // every explosion may cause up to 8 following explosions @@ -199,8 +199,8 @@ locRepeatMainGameLoop: // start repeating game loop 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 + // 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 @@ -479,7 +479,7 @@ locRepeatMainGameLoop: // start repeating game loop // Call subDisplayPlayingTime ' playing time on screen - subCheckRestoreRedDiskCountDisplay(); // Restore panel: red-disk hole + // subCheckRestoreRedDiskCountDisplay(); // Restore panel: red-disk hole subRedDiskReleaseExplosion(); // Red Disk release and explode subFollowUpExplosions(); // every explosion may cause up to 8 following explosions @@ -489,8 +489,8 @@ locRepeatMainGameLoop: // start repeating game loop 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 + // 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 diff --git a/src/game_sp/Makefile b/src/game_sp/Makefile index 03424b38..34617385 100644 --- a/src/game_sp/Makefile +++ b/src/game_sp/Makefile @@ -23,17 +23,11 @@ SRCS = init.c \ DDScrollBuffer.c \ DDSpriteBuffer.c \ Demo.c \ - DemoBufferObject.c \ - DirectDrawGlobals.c \ - DirectXGlobals.c \ Display.c \ DoGameStuff.c \ Electrons.c \ - ErrorReporting.c \ Explosions.c \ FakeDeclares.c \ - FancyRestore.c \ - GeneralTricks.c \ Globals.c \ Infotrons.c \ InitGameConditions.c \ @@ -52,7 +46,6 @@ SRCS = init.c \ TopMost.c \ Zonk.c \ modAnimations.c \ - modGeneralTricks.c \ modMPX.c OBJS = init.o \ @@ -66,17 +59,11 @@ OBJS = init.o \ DDScrollBuffer.o \ DDSpriteBuffer.o \ Demo.o \ - DemoBufferObject.o \ - DirectDrawGlobals.o \ - DirectXGlobals.o \ Display.o \ DoGameStuff.o \ Electrons.o \ - ErrorReporting.o \ Explosions.o \ FakeDeclares.o \ - FancyRestore.o \ - GeneralTricks.o \ Globals.o \ Infotrons.o \ InitGameConditions.o \ @@ -95,7 +82,6 @@ OBJS = init.o \ TopMost.o \ Zonk.o \ modAnimations.o \ - modGeneralTricks.o \ modMPX.o GAME_SP = game_sp.a diff --git a/src/game_sp/Murphy.c b/src/game_sp/Murphy.c index 33421783..990276f0 100644 --- a/src/game_sp/Murphy.c +++ b/src/game_sp/Murphy.c @@ -2055,7 +2055,6 @@ loc_g_6EBA: if (0 < LowByte(InfotronsNeeded)) InfotronsNeeded = InfotronsNeeded - 1; - subDisplayInfotronsNeeded(); loc_g_6EC8: // space, base PlayField16[*si] = fiMurphy; subAdjustZonksInfotronsAboveMurphy(*si + FieldWidth); @@ -2070,7 +2069,6 @@ loc_g_6ED8: if (0 < LowByte(InfotronsNeeded)) InfotronsNeeded = InfotronsNeeded - 1; - subDisplayInfotronsNeeded(); loc_g_6EE6: // space, base PlayField16[*si] = fiMurphy; subAdjustZonksInfotronsAboveMurphy(*si + 1); @@ -2085,7 +2083,6 @@ loc_g_6EF6: if (0 < LowByte(InfotronsNeeded)) InfotronsNeeded = InfotronsNeeded - 1; - subDisplayInfotronsNeeded(); loc_g_6F04: // space, base if (LowByte(PlayField16[*si - FieldWidth]) != fiExplosion) PlayField16[*si - FieldWidth] = 0; @@ -2102,7 +2099,6 @@ loc_g_71B6: if (0 < LowByte(InfotronsNeeded)) InfotronsNeeded = InfotronsNeeded - 1; - subDisplayInfotronsNeeded(); loc_g_71C4: // space, base subAdjustZonksInfotronsAboveMurphy(*si - 1); PlayField16[*si] = fiMurphy; @@ -2117,7 +2113,6 @@ loc_g_71D4: if (0 < LowByte(InfotronsNeeded)) InfotronsNeeded = InfotronsNeeded - 1; - subDisplayInfotronsNeeded(); loc_g_71E2: // base if (LowByte(PlayField16[*si - FieldWidth]) != fiExplosion) PlayField16[*si - FieldWidth] = 0; @@ -2132,7 +2127,6 @@ loc_g_71F0: if (0 < LowByte(InfotronsNeeded)) InfotronsNeeded = InfotronsNeeded - 1; - subDisplayInfotronsNeeded(); loc_g_71FE: // base if (LowByte(PlayField16[*si - 1]) != fiExplosion) PlayField16[*si - 1] = 0; @@ -2147,7 +2141,6 @@ loc_g_720C: if (0 < LowByte(InfotronsNeeded)) InfotronsNeeded = InfotronsNeeded - 1; - subDisplayInfotronsNeeded(); loc_g_721A: // base if (LowByte(PlayField16[*si + FieldWidth]) != fiExplosion) PlayField16[*si + FieldWidth] = 0; @@ -2162,7 +2155,6 @@ loc_g_7228: if (0 < LowByte(InfotronsNeeded)) InfotronsNeeded = InfotronsNeeded - 1; - subDisplayInfotronsNeeded(); loc_g_7236: // base if (LowByte(PlayField16[*si + 1]) != fiExplosion) PlayField16[*si + 1] = 0; @@ -2643,7 +2635,6 @@ loc_g_747F: PlayField16[*si] = fiMurphy; RedDiskReleasePhase = 2; RedDiskCount = RedDiskCount - 1; - subDisplayRedDiskCount(); #if 1 subSoundFX(*si, fiRedDisk, actDropping); @@ -2844,7 +2835,6 @@ static void subEatRedDisk(int si) } RedDiskCount = (RedDiskCount + 1) % 256; - subDisplayRedDiskCount(); } void subAdjustZonksInfotronsAboveMurphy(int si) diff --git a/src/game_sp/global.h b/src/game_sp/global.h index 4829b2f0..a458fcef 100644 --- a/src/game_sp/global.h +++ b/src/game_sp/global.h @@ -12,17 +12,11 @@ #include "DDScrollBuffer.h" #include "DDSpriteBuffer.h" #include "Demo.h" -#include "DemoBufferObject.h" -#include "DirectDrawGlobals.h" -#include "DirectXGlobals.h" #include "Display.h" #include "DoGameStuff.h" #include "Electrons.h" -#include "ErrorReporting.h" #include "Explosions.h" #include "FakeDeclares.h" -#include "FancyRestore.h" -#include "GeneralTricks.h" #include "Globals.h" #include "Infotrons.h" #include "InitGameConditions.h" @@ -41,7 +35,6 @@ #include "TopMost.h" #include "Zonk.h" #include "modAnimations.h" -#include "modGeneralTricks.h" #include "modMPX.h" #endif /* GAME_SP_GLOBAL_H */ diff --git a/src/game_sp/modGeneralTricks.c b/src/game_sp/modGeneralTricks.c deleted file mode 100644 index 712ff1b1..00000000 --- a/src/game_sp/modGeneralTricks.c +++ /dev/null @@ -1,69 +0,0 @@ -// ---------------------------------------------------------------------------- -// modGeneralTricks.c -// ---------------------------------------------------------------------------- - -#include "modGeneralTricks.h" - -// static char *VB_Name = "modGeneralTricks"; -// --- Option Explicit - -void Inc(int *i) -{ - *i = *i + 1; -} - -void Dec(int *i) -{ - *i = *i - 1; -} - -/* -double ValEx(char *TS) -{ - double ValEx; - - // Extends the Val() function for - // german-style number-representing strings - int i; - char *LS, *RS; - - i = InStr(1, TS, ","); - if (i != 0) - { - LS = Left(TS, i - 1); - RS = Right(TS, Len(TS) - i); - ValEx = ValCAT(LS, ".", RS); - } - else - { - ValEx = Val(TS); - } - - return ValEx; -} -*/ - -int Min(int A, int B) -{ - int Min; - - if (A < B) - Min = A; - else - Min = B; - - return Min; -} - -int Max(int A, int B) -{ - int Max; - - if (A < B) - Max = B; - else - Max = A; - - return Max; -} - diff --git a/src/game_sp/modGeneralTricks.h b/src/game_sp/modGeneralTricks.h deleted file mode 100644 index 23bb8683..00000000 --- a/src/game_sp/modGeneralTricks.h +++ /dev/null @@ -1,21 +0,0 @@ -// ---------------------------------------------------------------------------- -// modGeneralTricks.h -// ---------------------------------------------------------------------------- - -#ifndef MODGENERALTRICKS_H -#define MODGENERALTRICKS_H - -#include "vb_types.h" -#include "vb_defs.h" -#include "vb_vars.h" -#include "vb_lib.h" - -#include "global.h" - -extern void Dec(int *i); -extern void Inc(int *i); -extern int Max(int A, int B); -extern int Min(int A, int B); -extern double ValEx(char *TS); - -#endif /* MODGENERALTRICKS_H */