+2010-03-16
+ * continued code cleanup of native Supaplex game engine
+
2010-03-15
* continued code cleanup of native Supaplex game engine
-#define COMPILE_DATE_STRING "2010-03-16 01:16"
+#define COMPILE_DATE_STRING "2010-03-17 00:53"
#include <math.h>
-long mWidth, mHeight;
long mScrollX, mScrollY;
long mScrollX_last, mScrollY_last;
-long mDestXOff, mDestYOff;
long ScreenBuffer[MAX_BUF_XSIZE][MAX_BUF_YSIZE];
boolean redraw[MAX_BUF_XSIZE][MAX_BUF_YSIZE];
scrolling_last = scrolling;
}
-void DDScrollBuffer_Blt()
-{
- BackToFront_SP();
-}
-
void DDScrollBuffer_ScrollTo(int X, int Y)
{
if (NoDisplayFlag)
return;
- X = X / Stretch;
- Y = Y / Stretch;
- mScrollX = X;
- mScrollY = Y;
- ScrollX = mScrollX;
- ScrollY = mScrollY;
+ ScrollX = mScrollX = X;
+ ScrollY = mScrollY = Y;
ScrollPlayfieldIfNeeded();
}
if (NoDisplayFlag)
return;
- X = X / Stretch;
- Y = Y / Stretch;
dx = X - mScrollX;
dY = Y - mScrollY;
else
r = 1;
- mScrollX = mScrollX + dx * r;
- mScrollY = mScrollY + dY * r;
- ScrollX = mScrollX;
- ScrollY = mScrollY;
+ ScrollX = mScrollX = mScrollX + dx * r;
+ ScrollY = mScrollY = mScrollY + dY * r;
ScrollPlayfieldIfNeeded();
}
return;
AlreadyRunning = True;
- X = X / Stretch;
- Y = Y / Stretch;
+
dx = X - mScrollX;
dY = Y - mScrollY;
maxD = (Abs(dx) < Abs(dY) ? Abs(dY) : Abs(dx));
for (T = (double)tStep; T <= (double)1; T += tStep)
{
- mScrollX = oldX + T * dx;
- mScrollY = oldY + T * dY;
- ScrollX = mScrollX;
- ScrollY = mScrollY;
+ ScrollX = mScrollX = oldX + T * dx;
+ ScrollY = mScrollY = oldY + T * dY;
}
- mScrollX = X;
- mScrollY = Y;
- ScrollX = mScrollX;
- ScrollY = mScrollY;
+ ScrollX = mScrollX = X;
+ ScrollY = mScrollY = Y;
AlreadyRunning = False;
extern void UpdatePlayfield();
extern void RestorePlayfield();
-extern void DDScrollBuffer_Blt();
extern void DDScrollBuffer_ScrollTo(int X, int Y);
extern void DDScrollBuffer_ScrollTowards(int X, int Y, double Step);
extern void DDScrollBuffer_SoftScrollTo(int X, int Y, long TimeMS, int FPS);
#include "DDSpriteBuffer.h"
-long mXSpriteCount, mYSpriteCount;
-long mSpriteWidth, mSpriteHeight;
-long mDestXOff, mDestYOff;
-
-void DDSpriteBuffer_Init()
-{
- mSpriteWidth = TILEX;
- mSpriteHeight = TILEY;
- mXSpriteCount = 16;
- mYSpriteCount = 16;
-}
-
static void Blt(int pX, int pY, Bitmap *bitmap, int SpriteX, int SpriteY)
{
int scx = (mScrollX_last < 0 ? 0 : mScrollX_last);
return;
BlitBitmap(bitmap, screenBitmap, SpriteX, SpriteY,
- mSpriteWidth, mSpriteHeight, sx, sy);
+ TILEX, TILEY, sx, sy);
}
void DDSpriteBuffer_BltImg(int pX, int pY, int graphic, int sync_frame)
#include "global.h"
-extern void DDSpriteBuffer_Init();
extern void DDSpriteBuffer_BltImg(int pX, int pY, int graphic, int sync_frame);
#endif /* DDSPRITEBUFFER_H */
+++ /dev/null
-// ----------------------------------------------------------------------------
-// Demo.c
-// ----------------------------------------------------------------------------
-
-#include "Demo.h"
-
-
+++ /dev/null
-// ----------------------------------------------------------------------------
-// Demo.h
-// ----------------------------------------------------------------------------
-
-#ifndef DEMO_H
-#define DEMO_H
-
-#include "global.h"
-
-
-
-#endif /* DEMO_H */
int ScreenScrollXPos, ScreenScrollYPos;
-int ShowPanel;
int ExplosionShake;
boolean NoDisplayFlag;
-long DisplayMinX, DisplayMaxX, DisplayWidth;
-long DisplayMinY, DisplayMaxY, DisplayHeight;
+long DisplayMinX, DisplayMaxX;
+long DisplayMinY, DisplayMaxY;
void subDisplayLevel()
Y = Max(Y, ScrollMinY);
Y = Min(Y, ScrollMaxY);
- DDScrollBuffer_ScrollTowards(X, Y, 2 * Stretch * ZoomFactor);
+ DDScrollBuffer_ScrollTowards(X, Y, 2 * ZoomFactor);
}
void SoftScrollTo(int X, int Y, long TimeMS, int FPS)
extern int ScreenScrollXPos, ScreenScrollYPos;
-extern int ShowPanel;
extern int ExplosionShake;
extern boolean NoDisplayFlag;
-extern long DisplayMinX, DisplayMaxX, DisplayWidth;
-extern long DisplayMinY, DisplayMaxY, DisplayHeight;
+extern long DisplayMinX, DisplayMaxX;
+extern long DisplayMinY, DisplayMaxY;
extern void subDisplayLevel();
extern void ScrollTo(int, int);
#include "Globals.h"
-void ReadLevel();
-
-int LevelNumber;
boolean LevelLoaded;
boolean DemoAvailable;
boolean menBorder;
-int FieldWidth; // = 60
-int FieldHeight; // = 24
-int HeaderSize; // = 96
+int FieldWidth; // standard size = 60
+int FieldHeight; // standard size = 24
+int HeaderSize; // standard size = 96
int FieldMax, LevelMax;
long FileMax;
int *PlayField16;
byte *PlayField8;
byte *DisPlayField;
-// Public DisplayMin%, DisplayMax%, DisplayWidth%, DisplayHeight%
-
int TimerVar;
#if 1
short RandomSeed;
LevelInfoType LInfo;
-float Stretch = 1; // , StretchWidth%, TwoPixels!
-
int ScrollMinX, ScrollMaxX, ScrollMinY, ScrollMaxY;
int ScrollX, ScrollY;
-// constants for Fixed Fields:
-// --- const int fiSpace = 0; // &H00 space(28 = wall space ...)
-// --- const int fiZonk = 1; // &H01 zonk
-// --- const int fiBase = 2; // &H02 base
-// --- const int fiMurphy = 3; // &H03 Murphy
-// --- const int fiInfotron = 4; // &H04 infotron
-// --- const int fiRAM = 5; // &H05 small RAM chip
-// --- const int fiHardWare = 6; // &H06 hardware (square, standard pyramid shape)
-// --- const int fiExit = 7; // &H07 exit
-// --- const int fiOrangeDisk = 8; // &H08 brown/orange utility disk
-// --- const int fiPortRight = 9; // &H09 port 1 left to right
-// --- const int fiPortDown = 10; // &H0A port 1 up to down
-// --- const int fiPortLeft = 11; // &H0B port 1 right to left
-// --- const int fiPortUp = 12; // &H0C port 1 down to up
-// --- const int fiSpPortRight = 13; // &H0D port 2 left to right (gravity change)
-// --- const int fiSpPortDown = 14; // &H0E port 2 up to down (gravity change)
-// --- const int fiSpPortLeft = 15; // &H0F port 2 right to left (gravity change)
-// --- const int fiSpPortUp = 16; // &H10 port 2 down to up (gravity change)
-// --- const int fiSnikSnak = 17; // &H11 snik snak
-// --- const int fiYellowDisk = 18; // &H12 yellow utility disk
-// --- const int fiTerminal = 19; // &H13 terminal
-// --- const int fiRedDisk = 20; // &H14 red utility disk
-// --- const int fiPortUpAndDown = 21; // &H15 vertical port
-// --- const int fiPortLeftAndRight = 22; // &H16 horizontal port
-// --- const int fiPortAllDirections = 23; // &H17 horizontal + vertical port
-// --- const int fiElectron = 24; // &H18 electron
-// --- const int fiBug = 25; // &H19 bug
-// --- const int fiRAMLeft = 26; // &H1A horizontal RAM chip, left (pin 1)
-// --- const int fiRAMRight = 27; // &H1B horizontal RAM chip, right
-// --- const int fiHWFirst = 28; // &H1C hardware (radial blue circular cap + coloured shapes)
-
-// Public Const fiHW1% = 29 ' 29 = 1D hardware (green signal lamp)
-// Public Const fiHW2% = 30 ' 30 = 1E hardware (blue signal lamp)
-// Public Const fiHW3% = 31 ' 31 = 1F hardware (red signal lamp)
-// Public Const fiHW4% = 32 ' 32 = 20 hardware (yellow/black diagonal stripes)
-// Public Const fiHW5% = 33 ' 33 = 21 hardware (yellow resistor + blue + red shapes)
-// Public Const fiHW6% = 34 ' 34 = 22 hardware (horizontal red capacitor + smd shape)
-// Public Const fiHW7% = 35 ' 35 = 23 hardware (red + yellow + blue horizontal resistors)
-// Public Const fiHW8% = 36 ' 36 = 24 hardware (3 red vertical resistors)
-// --- const int fiHWLast = 37; // 37 = 25 hardware (3 yellow horizontal resistors)
-// --- const int fiRAMTop = 38; // 38 = 26 vertical RAM chip, top (pin 1)
-// --- const int fiRAMBottom = 39; // 39 = 27 vertical RAM chip, bottom
-
-// Specials to experiment with ...
-// --- const int fiWallSpace = 40; // 40 = 28 invisible wall (can explode, zonks don't roll off)
-// --- const int fiHWTrash1 = 41; // 41 = 29 hardware trash
-// --- const int fiHWTrash2 = 42; // 42 = 2A hardware trash
-// --- const int fiHWMurphy = 43; // 43 = 2B hardware inverted Murphy ... (maybe nice for use?)
-
-// --- const int fiExplosion = 0x1F;
-
-// --- const int keyNone = 0;
-// --- const int keyUp = 1;
-// --- const int keyLeft = 2;
-// --- const int keyDown = 3;
-// --- const int keyRight = 4;
-// --- const int keySpaceUp = 5;
-// --- const int keySpaceLeft = 6;
-// --- const int keySpaceDown = 7;
-// --- const int keySpaceRight = 8;
-// --- const int keySpace = 9;
-
-#if 0
-int aniFramesBug[] = { 74, 75, 76, 77, 78, 77, 76, 77, 78, 77, 76, 75, 74, 25 };
-int aniFramesZonkRollRight[] = { 198, 197, 196, 195, 194, 193, 192, 1, -1 };
-int aniFramesZonkRollLeft[] = { 192, 193, 194, 195, 196, 197, 198, 1, -1 };
-int aniFramesInfotronRollRight[] = { 206, 205, 204, 203, 202, 201, 200, 4 };
-int aniFramesInfotronRollLeft[] = { 200, 201, 202, 203, 204, 205, 206, 4 };
-int aniFramesSnikSnak[] = { 121, 122, 123, 124, 125, 126, 127, 120, 121 };
-int aniFramesElectron[] = { 144, 145, 146, 147, 148, 149, 150, 151, 144 };
-int aniFramesExplosion[] = { 3, 103, 104, 105, 106, 107, 108, 109, 0 };
-int aniFramesTouchBase[] = { 80, 81, 82, 83, 84, 85, 86, 0, -1 };
-int aniFramesTouchInfotron[] = { 87, 88, 89, 91, 92, 93, 0, -1 }; // Only seven frames!!!!
-int aniFramesTouchRedDisk[] = { 96, 97, 98, 99, 100, 101, 102, 0, -1 };
-int aniFramesMurphyExit[] = { 46, 46, 46, 46, 47, 47, 47, 47, 48, 48, 48, 48, 49, 49, 49, 49, 50, 50, 50, 50, 51, 51, 51, 51, 52, 52, 52, 52, 53, 53, 53, 53, 54, 54, 54, 54, 0, 0, 0, 0, -1 };
-int aniFramesMurphyEatLeft[] = { 176, 177, 178, 179, 180, 181, 182, 183, -1 };
-int aniFramesMurphyEatRight[] = { 184, 185, 186, 187, 188, 189, 190, 191, -1 };
-int aniFramesMurphyEatUpLeft[] = { 183, 182, 181, 180, 179, 178, 177, 176, -1 };
-int aniFramesMurphyEatUpRight[] = { 191, 190, 189, 188, 187, 186, 185, 184, -1 };
- // aniFramesMurphyEatRightRedDisk = { 184, 184, 185, 186, 187, 188, 189, 190, 191, -1) '9 frames!
-int aniFramesEatInfotronLeft[] = { 209, 211, 213, 215, 217, 219, 221, 223, -1 };
-int aniFramesEatInfotronRight[] = { 224, 226, 228, 230, 232, 234, 236, 238, -1 };
-int aniFramesSplitUpDown[] = { 3, 3, 3, 3, 3, 3, 3, 3, -1 };
-int aniFramesYellowDisk[] = { 18, 18, 18, 18, 18, 18, 18, 18, -1 };
-int aniFramesOrangeDisk[] = { 8, 8, 8, 8, 8, 8, 8, 8, -1 };
-int aniFramesRedDisk[] = { 20, -1 };
-#endif
-
int fiGraphic[] =
{
aniSpace,
FieldMax = (FieldWidth * FieldHeight) + HeaderSize - 1;
LevelMax = (FieldWidth * FieldHeight) - 1;
bPlaying = False;
+ menBorder = False;
}
int GetSI(int X, int Y)
return StretchWidth * (si / FieldWidth);
}
-void ReadLevel()
+void PrepareLevel()
{
copyInternalEngineVars_SP();
SetScrollEdges();
#endif
- LevelNumber = level_nr;
-
LevelLoaded = True;
}
#define ZoomFactor (2)
#define BaseWidth (ZoomFactor * 16)
#define StretchWidth (ZoomFactor * 16)
+#define TileSize (ZoomFactor * 16)
#define TwoPixels (ZoomFactor * 2)
#define fiRAMTop (38)
#define fiRAMBottom (39)
#define fiWallSpace (40)
-#define fiHWTrash1 (41)
-#define fiHWTrash2 (42)
-#define fiHWMurphy (43)
#define fiExplosion (0x1F)
+#define fiFirst (0)
+#define fiLast (40)
+
// ----------------------------------------------------------------------------
// graphics and animations (used at runtime to display the elements)
#define aniMurphyYawn IMG_SP_MURPHY_BORING_1
#define aniPushLeft IMG_SP_MURPHY_PUSHING_LEFT
#define aniPushRight IMG_SP_MURPHY_PUSHING_RIGHT
-#define aniPushUpDown IMG_SP_MURPHY_PUSHING_RIGHT
#define aniBugActivating IMG_SP_BUGGY_BASE_ACTIVATING
#define aniBugDeactivating IMG_SP_BUGGY_BASE_ACTIVATING
#define imgFrameVertical IMG_SP_FRAME_VERTICAL
-extern int aniFramesBug[], aniFramesZonkRollRight[], aniFramesZonkRollLeft[];
-extern int aniFramesEatInfotronLeft[], aniFramesEatInfotronRight[];
-extern int aniFramesInfotronRollRight[], aniFramesInfotronRollLeft[];
-extern int aniFramesMurphyEatLeft[], aniFramesMurphyEatRight[];
-extern int aniFramesMurphyEatUpLeft[], aniFramesMurphyEatUpRight[], aniFramesSplitUpDown[];
-extern int aniFramesMurphyExit[];
-extern int aniFramesSnikSnak[], aniFramesElectron[], aniFramesExplosion[];
-extern int aniFramesTouchBase[], aniFramesTouchInfotron[], aniFramesTouchRedDisk[];
-extern int aniFramesYellowDisk[], aniFramesOrangeDisk[], aniFramesRedDisk[];
-
-
// ----------------------------------------------------------------------------
// input keys
// ----------------------------------------------------------------------------
extern int GetY(int si);
extern void InitGlobals();
-extern void ReadLevel();
+extern void PrepareLevel();
extern int getSequenceLength(int sequence);
extern boolean isSnappingSequence(int sequence);
extern int FieldWidth;
extern int FreezeZonks;
extern int HeaderSize;
-extern int LevelNumber;
extern int TimerVar;
extern short RandomSeed;
extern long FileMax;
extern LevelInfoType LInfo;
-extern float Stretch;
extern int ScrollMinX, ScrollMaxX, ScrollMinY, ScrollMaxY;
extern int ScrollX, ScrollY;
TimerVar = 0;
- EnterRepeatCounter = 0; // restart Enter repeat counter
SnikSnaksElectronsFrozen = 0; // Snik-Snaks and Electrons move!
SplitMoveFlag = 0; // Reset Split-through-ports
{
int si;
- for (si = 0; si <= LevelMax - 1; si++)
+ for (si = 0; si < LevelMax; si++)
if (PlayField16[si] == fiMurphy)
break;
void InitMurphyPosB(int si)
{
- MurphyYPos = GetStretchY(si) / Stretch;
- MurphyXPos = GetStretchX(si) / Stretch;
-
- MurphyScreenXPos = GetStretchX(si); // Murphy's screen x-position
- MurphyScreenYPos = GetStretchY(si); // Murphy's screen y-position
+ MurphyScreenXPos = MurphyXPos = GetStretchX(si); // Murphy's screen x-position
+ MurphyScreenYPos = MurphyYPos = GetStretchY(si); // Murphy's screen y-position
// To Do: draw Murphy in location ax
DDSpriteBuffer_BltImg(MurphyScreenXPos, MurphyScreenYPos, aniMurphy, 0);
- MurphyScreenXPos = MurphyScreenXPos / Stretch;
- MurphyScreenYPos = MurphyScreenYPos / Stretch;
-
subCalculateScreenScrollPos(); // calculate screen start addrs
if (AutoScrollFlag)
void subFetchAndInitLevelA()
{
- GameBusyFlag = 0; // restore scissors too
-
- subFetchAndInitLevel(); // Fetch and initialize a level
+ GameBusyFlag = 0; // restore scissors too
+ subFetchAndInitLevel(); // fetch and initialize a level
+ GameBusyFlag = 1; // no free screen write
- GameBusyFlag = 1; // no free screen write
-
- DemoKeyCode = 0; // delete last demo key!
+ DemoKeyCode = 0; // delete last demo key!
}
void subFetchAndInitLevel()
{
int InfoCountInLevel;
- ReadLevel(); // Read LEVELS.DAT
-
- GameBusyFlag = -GameBusyFlag; // make <>1
-
- InfoCountInLevel = subConvertToEasySymbols(); // Convert to easy symbols
+ PrepareLevel(); // initialize level data
- GameBusyFlag = -GameBusyFlag; // restore
+ GameBusyFlag = -GameBusyFlag; // make != 1
+ InfoCountInLevel = subConvertToEasySymbols(); // convert to easy symbols
+ GameBusyFlag = -GameBusyFlag; // restore
- subDisplayLevel(); // Paint (Init) game field
+ subDisplayLevel(); // paint (init) game field
- ResetInfotronsNeeded(InfoCountInLevel); // and reset Infotron count
+ ResetInfotronsNeeded(InfoCountInLevel); // and reset Infotron count
- subInitGameConditions(); // Init game conditions (vars)
+ subInitGameConditions(); // init game conditions (vars)
- InitMurphyPos(); // Locate Murphy + screen pos
+ InitMurphyPos(); // locate Murphy + screen pos
}
static void DrawFrame(int Delta);
-static void ReStretch(float NewStretch);
-static void picViewPort_Resize();
+static void ReStretch();
void DrawField(int X, int Y);
void DrawFieldAnimated(int X, int Y);
void DrawFieldNoAnimated(int X, int Y);
-boolean Loaded;
-
void DrawFrameIfNeeded()
{
DrawFrame(0);
{
int X, Y;
- if (! Loaded)
- return;
-
if (! LevelLoaded)
return;
SetDisplayRegion();
#endif
- DrawFrame(0);
-
- /* !!! CHECK THIS !!! */
-#if 1
- if (! menBorder)
- DrawFrame(1);
-#endif
+ DrawFrameIfNeeded();
if (bPlaying)
{
-#if 0
- printf("::: MainForm.c: DisplayLevel(): [%ld, %ld, %ld, %ld] [%d, %d]...\n",
- DisplayMinX, DisplayMinY, DisplayMaxX, DisplayMaxY,
- FieldWidth, FieldHeight);
-#endif
-
for (Y = DisplayMinY; Y <= DisplayMaxY; Y++)
- {
for (X = DisplayMinX; X <= DisplayMaxX; X++)
- {
DrawFieldNoAnimated(X, Y);
- }
- }
for (Y = DisplayMinY; Y <= DisplayMaxY; Y++)
- {
for (X = DisplayMinX; X <= DisplayMaxX; X++)
- {
DrawFieldAnimated(X, Y);
- }
- }
-
}
else
{
for (Y = DisplayMinY; Y <= DisplayMaxY; Y++)
- {
for (X = DisplayMinX; X <= DisplayMaxX; X++)
- {
DrawField(X, Y);
- }
- }
}
}
void Form_Load()
{
- Loaded = False;
-
InitGlobals();
- Loaded = True;
-
- ReStretch(Stretch);
+ ReStretch();
}
static void DrawFrame(int Delta)
tY = -1 + Delta;
RX = FieldWidth - Delta;
BY = FieldHeight - Delta;
+
DrawImage(LX, tY, imgFrameCorner);
DrawImage(LX, BY, imgFrameCorner);
DrawImage(RX, tY, imgFrameCorner);
DrawImage(RX, BY, imgFrameCorner);
+
for (i = LX + 1; i <= RX - 1; i++)
{
DrawImage(i, tY, imgFrameHorizontal);
if (! menBorder)
{
DisplayMinX = 1;
- DisplayMaxX = FieldWidth - 2;
- DisplayWidth = FieldWidth;
DisplayMinY = 1;
+ DisplayMaxX = FieldWidth - 2;
DisplayMaxY = FieldHeight - 2;
- DisplayHeight = FieldHeight;
if (LevelLoaded)
DrawFrame(1);
else
{
DisplayMinX = 0;
- DisplayMaxX = FieldWidth - 1;
- DisplayWidth = FieldWidth + 2;
DisplayMinY = 0;
+ DisplayMaxX = FieldWidth - 1;
DisplayMaxY = FieldHeight - 1;
- DisplayHeight = FieldHeight + 2;
if (LevelLoaded)
RestoreFrame();
subFetchAndInitLevelB();
- ReStretch(Stretch);
+ ReStretch();
subMainGameLoop_Init();
subFetchAndInitLevel();
}
-static void ReStretch(float NewStretch)
+static void ReStretch()
{
- long BW2, LW, LH;
-
- if (! Loaded)
+ if (LevelLoaded)
{
- Stretch = NewStretch;
-
- return;
- }
+ SetDisplayRegion();
- Stretch = NewStretch;
+ SetScrollEdges();
- BW2 = StretchWidth / 2;
- LW = (FieldWidth + 2) * BaseWidth; // StretchWidth
- LH = (FieldHeight + 2) * BaseWidth; // StretchWidth
+ ScrollTo(ScrollX, ScrollY);
- if (Loaded && LevelLoaded)
- {
- SetDisplayRegion();
- picViewPort_Resize();
DisplayLevel();
}
void SetScrollEdges()
{
- ScrollMinX = (int)(DisplayMinX - 0.5) * Stretch * BaseWidth;
- ScrollMinY = (int)(DisplayMinY - 0.5) * Stretch * BaseWidth;
- ScrollMaxX = (int)(DisplayMaxX + 1.5) * Stretch * BaseWidth - SXSIZE;
- ScrollMaxY = (int)(DisplayMaxY + 1.5) * Stretch * BaseWidth - SYSIZE;
+ ScrollMinX = (int)(DisplayMinX - 0.5) * BaseWidth;
+ ScrollMinY = (int)(DisplayMinY - 0.5) * BaseWidth;
+ ScrollMaxX = (int)(DisplayMaxX + 1.5) * BaseWidth - SXSIZE;
+ ScrollMaxY = (int)(DisplayMaxY + 1.5) * BaseWidth - SYSIZE;
}
void DrawField(int X, int Y)
{
- int Tmp, tsi;
+ int tsi = GetSI(X, Y);
+ int Tmp = LowByte(PlayField16[tsi]);
- tsi = GetSI(X, Y);
- Tmp = LowByte(PlayField16[tsi]);
- if (Tmp > 40)
- Tmp = 0;
+ if (Tmp < fiFirst || Tmp > fiLast)
+ Tmp = fiSpace;
- if (Tmp == fiRAM || Tmp == fiHardWare)
+ if (Tmp == fiRAM ||
+ Tmp == fiHardWare ||
+ Tmp == fiBug ||
+ Tmp == fiWallSpace)
Tmp = DisPlayField[tsi];
- if (Tmp == fiBug || Tmp == 40)
- Tmp = DisPlayField[tsi];
-
-#if 1
- if (Tmp >= 0 && Tmp <= 40)
- {
- subCopyImageToScreen(tsi, fiGraphic[Tmp]);
+ subCopyImageToScreen(tsi, fiGraphic[Tmp]);
-#if 1
- if (Tmp != fiSpace && Tmp != fiSnikSnak && Tmp != fiElectron)
- GfxGraphic[X][Y] = fiGraphic[Tmp];
-#endif
- }
-#else
- DDSpriteBuffer_BltEx(StretchWidth * X, StretchWidth * Y, Tmp);
-#endif
+ if (Tmp != fiSpace &&
+ Tmp != fiSnikSnak &&
+ Tmp != fiElectron)
+ GfxGraphic[X][Y] = fiGraphic[Tmp];
}
void DrawFieldAnimated(int X, int Y)
{
- int Tmp, tsi;
+ int tsi = GetSI(X, Y);
+ int Tmp = LowByte(PlayField16[tsi]);
- tsi = GetSI(X, Y);
- Tmp = LowByte(PlayField16[tsi]);
switch (Tmp)
{
case fiSnikSnak:
break;
default:
- // If 40 < Tmp Then Tmp = 0
- // If Tmp = fiRAM Or Tmp = fiHardWare Then Tmp = DisPlayField(tsi)
- // If Tmp = fiBug Or Tmp = 40 Then Tmp = DisPlayField(tsi)
- // If EditFlag Then
- // If fiOrangeDisk < Tmp And Tmp < fiSnikSnak Then Tmp = DisPlayField(tsi)
- // End If
- // DDSpriteBuffer_BltEx StretchWidth * X, StretchWidth * Y, Tmp
break;
}
}
void DrawFieldNoAnimated(int X, int Y)
{
- int Tmp, tsi;
+ int tsi = GetSI(X, Y);
+ int Tmp = LowByte(PlayField16[tsi]);
- tsi = GetSI(X, Y);
- Tmp = LowByte(PlayField16[tsi]);
switch (Tmp)
{
case fiSnikSnak:
break;
default:
- if (Tmp > 40)
- Tmp = 0;
-
- if (Tmp == fiRAM || Tmp == fiHardWare)
- Tmp = DisPlayField[tsi];
+#if 1
+ DrawField(X, Y);
+#else
+ if (Tmp < fiFirst || Tmp > fiLast)
+ Tmp = fiSpace;
- if (Tmp == fiBug || Tmp == 40)
- Tmp = DisPlayField[tsi];
+ if (Tmp == fiRAM ||
+ Tmp == fiHardWare ||
+ Tmp == fiBug ||
+ Tmp == fiWallSpace)
+ Tmp = DisPlayField[tsi];
-#if 1
- if (Tmp >= 0 && Tmp <= 40)
- {
- subCopyImageToScreen(tsi, fiGraphic[Tmp]);
+ subCopyImageToScreen(tsi, fiGraphic[Tmp]);
-#if 1
- if (Tmp != fiSpace && Tmp != fiSnikSnak && Tmp != fiElectron)
- GfxGraphic[X][Y] = fiGraphic[Tmp];
-#endif
- }
-#else
- DDSpriteBuffer_BltEx(StretchWidth * X, StretchWidth * Y, Tmp);
+ if (Tmp != fiSpace &&
+ Tmp != fiSnikSnak &&
+ Tmp != fiElectron)
+ GfxGraphic[X][Y] = fiGraphic[Tmp];
#endif
-
break;
}
}
{
DDSpriteBuffer_BltImg(StretchWidth * X, StretchWidth * Y, graphic, 0);
}
-
-static void picViewPort_Resize()
-{
- SetScrollEdges();
-
- ScrollTo(ScrollX, ScrollY);
-}
boolean bPlaying;
-int LeadOutCounter, EnterRepeatCounter;
+int LeadOutCounter;
int ExitToMenuFlag;
boolean AutoScrollFlag;
void subCalculateScreenScrollPos()
{
- int ax, Ay;
+ int ax, ay;
#if 1
int jump_pos = TILEX / 2;
{
ax = SXSIZE / 2;
- Ay = SYSIZE / 2;
+ ay = SYSIZE / 2;
}
- ScreenScrollXPos = Stretch * (MurphyScreenXPos + TILEX / 2) - ax;
- ScreenScrollYPos = Stretch * (MurphyScreenYPos + TILEY / 2) - Ay;
+ ScreenScrollXPos = (MurphyScreenXPos + TILEX / 2) - ax;
+ ScreenScrollYPos = (MurphyScreenYPos + TILEY / 2) - ay;
}
extern boolean AutoScrollFlag;
extern boolean bPlaying;
extern int ExitToMenuFlag;
-extern int LeadOutCounter, EnterRepeatCounter;
+extern int LeadOutCounter;
extern void subMainGameLoop_Init();
extern void subMainGameLoop_Main(byte, boolean);
int tDeltaX, tDeltaY, tPos, Tmp;
// Variables that hold information about the animation sequence
-#if 0
- static int *dx = 0; // an array of image positions in moving.mpx, finalized with -1
-#endif
- static int dx1 = 0; // same as "*dx" above, but as image/animation token
+ static int dx1 = 0; // image/animation token
static int dx2 = 0; // an additional image position of a second sprite, for instance: yellow disk if pushed
static int MurphyDX = 0, MurphyDY = 0; // murphys move steps
static int SeqPos = 0; // index into dx()
if (bl != 0) // a key was pressed!
goto locKeyPressed5FCF;
-#if 0
- printf("::: Murphy.c: !!! %d [%d]\n", DemoKeyCode, GravityFlag);
-#endif
-
RedDiskReleaseFlag = 1;
if (ScratchGravity != 0) // gravity pulls & space below?'-> force Space up to down
{
MovHighByte(&PlayField16[*si], 0x2A);
MovingPictureSequencePhase = 0x40; // init picture move sequence
-#if 0
- dx = aniFramesRedDisk;
-#else
dx1 = aniRedDisk;
-#endif
MovLowByte(&RedDiskReleasePhase, 1);
RedDiskReleaseMurphyPos = *si; // remember Murphy's location
goto loc_Split;
// ==========================================================================
loc_g_6312:
-#if 0
- dx = (MurphyVarFaceLeft == 0 ? aniFramesMurphyEatUpRight : aniFramesMurphyEatUpLeft);
-#else
dx1 = (MurphyVarFaceLeft == 0 ? aniMurphyMoveUpRight : aniMurphyMoveUpLeft);
-#endif
PlayField16[*si - FieldWidth] = 0x103;
PlayField16[*si] = 0x300;
*si = *si - FieldWidth;
// ==========================================================================
loc_g_6341:
-#if 0
- dx = aniFramesMurphyEatLeft;
-#else
dx1 = aniMurphyMoveLeft;
-#endif
PlayField16[*si - 1] = 0x203;
PlayField16[*si] = 0x300;
*si = *si - 1;
// ==========================================================================
loc_g_6364:
-#if 0
- dx = (MurphyVarFaceLeft == 0 ? aniFramesMurphyEatUpRight : aniFramesMurphyEatUpLeft);
-#else
dx1 = (MurphyVarFaceLeft == 0 ? aniMurphyMoveUpRight : aniMurphyMoveUpLeft);
-#endif
PlayField16[*si + FieldWidth] = 0x303;
PlayField16[*si] = 0x300;
*si = *si + FieldWidth;
// ==========================================================================
loc_g_6399:
-#if 0
- dx = aniFramesMurphyEatRight;
-#else
dx1 = aniMurphyMoveRight;
-#endif
PlayField16[*si + 1] = 0x403;
PlayField16[*si] = 0x300;
*si = *si + 1;
// ==========================================================================
loc_g_63D3:
-#if 1
subSoundFX(*si, fiBase, actDigging);
-#else
- subSoundFXBase();
-#endif
-#if 0
- dx = (MurphyVarFaceLeft == 0 ? aniFramesMurphyEatUpRight : aniFramesMurphyEatUpLeft);
-#else
dx1 = (MurphyVarFaceLeft == 0 ? aniMurphyDigUpRight : aniMurphyDigUpLeft);
-#endif
PlayField16[*si - FieldWidth] = 0x503;
PlayField16[*si] = 0x300;
*si = *si - FieldWidth;
// ==========================================================================
loc_g_641C:
-#if 1
subSoundFX(*si, fiBase, actDigging);
-#else
- subSoundFXBase();
-#endif
-#if 0
- dx = aniFramesMurphyEatLeft;
-#else
dx1 = aniMurphyDigLeft;
-#endif
PlayField16[*si - 1] = 0x203;
PlayField16[*si] = 0x300;
*si = *si - 1;
// ==========================================================================
loc_g_6459:
-#if 1
subSoundFX(*si, fiBase, actDigging);
-#else
- subSoundFXBase();
-#endif
-#if 0
- dx = (MurphyVarFaceLeft == 0 ? aniFramesMurphyEatUpRight : aniFramesMurphyEatUpLeft);
-#else
dx1 = (MurphyVarFaceLeft == 0 ? aniMurphyDigUpRight : aniMurphyDigUpLeft);
-#endif
PlayField16[*si + FieldWidth] = 0x703;
PlayField16[*si] = 0x300;
*si = *si + FieldWidth;
// ==========================================================================
loc_g_64A2:
-#if 1
subSoundFX(*si, fiBase, actDigging);
-#else
- subSoundFXBase();
-#endif
-#if 0
- dx = aniFramesMurphyEatRight;
-#else
dx1 = aniMurphyDigRight;
-#endif
PlayField16[*si + 1] = 0x803;
PlayField16[*si] = 0x300;
*si = *si + 1;
loc_g_64DF:
subCopyImageToScreen(*si, aniMurphyTouchUp);
-#if 1
subSoundFX(*si, fiBase, actDigging);
-#else
- subSoundFXBase();
-#endif
-#if 0
- dx = aniFramesTouchBase;
-#else
dx1 = aniTouchBase;
-#endif
dxPos = *si - FieldWidth;
MovHighByte(&PlayField16[*si], 0x10);
goto loc_StopNoSplit;
loc_g_651D:
subCopyImageToScreen(*si, aniMurphyTouchLeft);
-#if 1
subSoundFX(*si, fiBase, actDigging);
-#else
- subSoundFXBase();
-#endif
-#if 0
- dx = aniFramesTouchBase;
-#else
dx1 = aniTouchBase;
-#endif
dxPos = *si - 1;
MovHighByte(&PlayField16[*si], 0x11);
goto loc_StopNoSplit;
loc_g_655B:
subCopyImageToScreen(*si, aniMurphyTouchDown);
-#if 1
subSoundFX(*si, fiBase, actDigging);
-#else
- subSoundFXBase();
-#endif
-#if 0
- dx = aniFramesTouchBase;
-#else
dx1 = aniTouchBase;
-#endif
dxPos = *si + FieldWidth;
MovHighByte(&PlayField16[*si], 0x12);
goto loc_StopNoSplit;
loc_g_6599:
subCopyImageToScreen(*si, aniMurphyTouchRight);
-#if 1
subSoundFX(*si, fiBase, actDigging);
-#else
- subSoundFXBase();
-#endif
-#if 0
- dx = aniFramesTouchBase;
-#else
dx1 = aniTouchBase;
-#endif
dxPos = *si + 1;
MovHighByte(&PlayField16[*si], 0x13);
goto loc_StopNoSplit;
// ==========================================================================
loc_g_65C6:
-#if 1
subSoundFX(*si, fiInfotron, actCollecting);
-#else
- subSoundFXInfotron();
-#endif
-#if 0
- dx = (MurphyVarFaceLeft == 0 ? aniFramesMurphyEatUpRight : aniFramesMurphyEatUpLeft);
-#else
dx1 = (MurphyVarFaceLeft == 0 ? aniMurphyEatUpRight : aniMurphyEatUpLeft);
-#endif
PlayField16[*si - FieldWidth] = 0x903;
PlayField16[*si] = 0x300;
*si = *si - FieldWidth;
// ==========================================================================
loc_g_65FE:
-#if 1
subSoundFX(*si, fiInfotron, actCollecting);
-#else
- subSoundFXInfotron();
-#endif
-#if 0
- dx = aniFramesEatInfotronLeft;
-#else
dx1 = aniEatInfotronLeft;
-#endif
#if 0
dx2 = fiInfotron;
dx2Step = -1;
// ==========================================================================
loc_g_662A:
-#if 1
subSoundFX(*si, fiInfotron, actCollecting);
-#else
- subSoundFXInfotron();
-#endif
-#if 0
- dx = (MurphyVarFaceLeft == 0 ? aniFramesMurphyEatUpRight : aniFramesMurphyEatUpLeft);
-#else
dx1 = (MurphyVarFaceLeft == 0 ? aniMurphyEatUpRight : aniMurphyEatUpLeft);
-#endif
PlayField16[*si + FieldWidth] = 0xB03;
PlayField16[*si] = 0x300;
*si = *si + FieldWidth;
// ==========================================================================
loc_g_6662:
-#if 1
subSoundFX(*si, fiInfotron, actCollecting);
-#else
- subSoundFXInfotron();
-#endif
-#if 0
- dx = aniFramesEatInfotronRight;
-#else
dx1 = aniEatInfotronRight;
-#endif
#if 0
dx2 = fiInfotron;
dx2Step = 1;
loc_g_668E:
subCopyImageToScreen(*si, aniMurphyTouchUp);
-#if 1
subSoundFX(*si, fiInfotron, actCollecting);
-#else
- subSoundFXInfotron();
-#endif
-#if 0
- dx = aniFramesTouchInfotron;
-#else
dx1 = aniTouchInfotron;
-#endif
MovHighByte(&PlayField16[*si], 0x14);
MovHighByte(&PlayField16[*si - FieldWidth], 0xFF);
goto loc_StopNoSplit;
loc_g_66C0:
subCopyImageToScreen(*si, aniMurphyTouchLeft);
-#if 1
subSoundFX(*si, fiInfotron, actCollecting);
-#else
- subSoundFXInfotron();
-#endif
-#if 0
- dx = aniFramesTouchInfotron;
-#else
dx1 = aniTouchInfotron;
-#endif
MovHighByte(&PlayField16[*si], 0x15);
MovHighByte(&PlayField16[*si - 1], 0xFF);
goto loc_StopNoSplit;
loc_g_66F2:
subCopyImageToScreen(*si, aniMurphyTouchDown);
-#if 1
subSoundFX(*si, fiInfotron, actCollecting);
-#else
- subSoundFXInfotron();
-#endif
-#if 0
- dx = aniFramesTouchInfotron;
-#else
dx1 = aniTouchInfotron;
-#endif
MovHighByte(&PlayField16[*si], 0x16);
MovHighByte(&PlayField16[*si + FieldWidth], 0xFF);
goto loc_StopNoSplit;
loc_g_6724:
subCopyImageToScreen(*si, aniMurphyTouchRight);
-#if 1
subSoundFX(*si, fiInfotron, actCollecting);
-#else
- subSoundFXInfotron();
-#endif
-#if 0
- dx = aniFramesTouchInfotron;
-#else
dx1 = aniTouchInfotron;
-#endif
MovHighByte(&PlayField16[*si], 0x17);
MovHighByte(&PlayField16[*si + 1], 0xFF);
goto loc_StopNoSplit;
#if 1
if (!game_sp.LevelSolved)
- printf("::: Murphy.c: !!!!!!!!!! LEVEL %d SOLVED !!!!!!!!!!\n",LevelNumber);
+ printf("::: Murphy.c: !!!!!!!!!! LEVEL %d SOLVED !!!!!!!!!!\n", level_nr);
#endif
#if 1
game_sp.LevelSolved = TRUE;
#endif
-#if 1
subSoundFX(*si, fiExit, actPassing);
-#else
- subSoundFXExit();
-#endif
LeadOutCounter = 0x40; // quit: start lead-out
-#if 0
- dx = aniFramesMurphyExit;
-#else
dx1 = aniMurphyExit;
-#endif
MovHighByte(&PlayField16[*si], 0xD);
goto loc_StopNoSplit;
MovHighByte(&PlayField16[*si - 2], 1);
subCopyImageToScreen(*si, aniPushLeft); // draw pushing murphy
-#if 0
- dx = aniFramesZonkRollLeft;
-#else
dx1 = aniZonkRollLeft;
-#endif
dxPos = *si - 1;
dx2 = aniPushLeft;
dx2Step = 1;
MovHighByte(&PlayField16[*si + 2], 1);
subCopyImageToScreen(*si, aniPushRight); // draw pushing murphy
-#if 0
- dx = aniFramesZonkRollRight;
-#else
dx1 = aniZonkRollRight;
-#endif
dxPos = *si + 1;
dx2 = aniPushRight;
dx2Step = -1;
if (PlayField16[*si - 2 * FieldWidth] != 0)
return;
-#if 0
- dx = aniFramesSplitUpDown;
-#else
dx1 = aniSplitUpDown;
-#endif
dx2Step = -FieldWidth;
PlayField16[*si] = 0x1803;
PlayField16[*si - 2 * FieldWidth] = 0x300;
if (PlayField16[*si - 2] != 0)
return;
-#if 0
- dx = aniFramesMurphyEatLeft;
-#else
dx1 = aniMurphyMoveLeft;
-#endif
dx2Step = -1;
PlayField16[*si] = 0x1903;
PlayField16[*si - 2] = 0x300;
if (PlayField16[*si + 2 * FieldWidth] != 0)
return;
-#if 0
- dx = aniFramesSplitUpDown;
-#else
dx1 = aniSplitUpDown;
-#endif
dx2Step = FieldWidth;
PlayField16[*si] = 0x1A03;
PlayField16[*si + 2 * FieldWidth] = 0x300;
if (PlayField16[*si + 2] != 0)
return;
-#if 0
- dx = aniFramesMurphyEatRight;
-#else
dx1 = aniMurphyMoveRight;
-#endif
dx2Step = 1;
PlayField16[*si] = 0x1B03;
PlayField16[*si + 2] = 0x300;
// ==========================================================================
loc_g_69A6:
-#if 0
- dx = (MurphyVarFaceLeft == 0 ? aniFramesMurphyEatUpRight : aniFramesMurphyEatUpLeft);
-#else
dx1 = (MurphyVarFaceLeft == 0 ? aniMurphyEatUpRight : aniMurphyEatUpLeft);
-#endif
PlayField16[*si] = 0x1C03;
PlayField16[*si - FieldWidth] = 0x300;
goto loc_StopNoSplit;
// ==========================================================================
loc_g_69CE:
-#if 0
- dx = aniFramesMurphyEatLeft;
-#else
dx1 = aniMurphyEatLeft;
-#endif
PlayField16[*si] = 0x300; // !!!!!! this time we move murphy at sequence-start!
PlayField16[*si - 1] = 0x1D03;
*si = *si - 1;
// ==========================================================================
loc_g_69F7:
-#if 0
- dx = (MurphyVarFaceLeft == 0 ? aniFramesMurphyEatUpRight : aniFramesMurphyEatUpLeft);
-#else
dx1 = (MurphyVarFaceLeft == 0 ? aniMurphyEatUpRight : aniMurphyEatUpLeft);
-#endif
PlayField16[*si] = 0x1E03;
PlayField16[*si + FieldWidth] = 0x300;
goto loc_StopNoSplit;
// ==========================================================================
loc_g_6A1F:
-#if 0
- // dx = aniFramesMurphyEatRightRedDisk 'this sequence is 9 steps long!
- dx = aniFramesMurphyEatRight;
-#else
+ // dx = aniMurphyEatRightRedDisk 'this sequence is 9 steps long!
dx1 = aniMurphyEatRight;
-#endif
// --------------------------------------------------------------------------
// BugFix
// Table data_h_145A, pointed to by table data_h_105E, has a severe bug:
// ==========================================================================
loc_g_6A48:
-#if 0
- dx = aniFramesTouchRedDisk;
-#else
dx1 = aniTouchRedDisk;
-#endif
MovHighByte(&PlayField16[*si], 0x20);
MovHighByte(&PlayField16[*si - FieldWidth], 3);
goto loc_StopNoSplit;
// ==========================================================================
loc_g_6A64:
-#if 0
- dx = aniFramesTouchRedDisk;
-#else
dx1 = aniTouchRedDisk;
-#endif
MovHighByte(&PlayField16[*si], 0x21);
MovHighByte(&PlayField16[*si - 1], 3);
goto loc_StopNoSplit;
// ==========================================================================
loc_g_6A80:
-#if 0
- dx = aniFramesTouchRedDisk;
-#else
dx1 = aniTouchRedDisk;
-#endif
MovHighByte(&PlayField16[*si], 0x22);
MovHighByte(&PlayField16[*si + FieldWidth], 3);
goto loc_StopNoSplit;
// ==========================================================================
loc_g_6A9C:
-#if 0
- dx = aniFramesTouchRedDisk;
-#else
dx1 = aniTouchRedDisk;
-#endif
MovHighByte(&PlayField16[*si], 0x23);
MovHighByte(&PlayField16[*si + 1], 3);
return;
PlayField16[*si - 2 * FieldWidth] = 0x1200;
-#if 0
- subCopyImageToScreen(*si, aniPushRight);
-#endif
-#if 0
- dx = aniFramesYellowDisk;
-#else
dx1 = aniYellowDisk;
-#endif
dxPos = *si - FieldWidth;
-#if 1
dx2 = (MurphyVarFaceLeft == 0 ? aniPushRight : aniPushLeft);
-#else
- dx2 = aniPushUpDown;
-#endif
dx2Step = FieldWidth;
PlayField16[*si] = 0x2403;
-#if 1
subCopyImageToScreen(*si, dx2);
-#endif
goto loc_MoveNoSplit;
// ==========================================================================
PlayField16[*si - 2] = 0x1200;
subCopyImageToScreen(*si, aniPushLeft);
-#if 0
- dx = aniFramesYellowDisk;
-#else
dx1 = aniYellowDisk;
-#endif
dxPos = *si - 1;
dx2 = aniPushLeft;
dx2Step = 1;
return;
PlayField16[*si + 2 * FieldWidth] = 0x1200;
-#if 0
- subCopyImageToScreen(*si, aniPushRight);
-#endif
-#if 0
- dx = aniFramesYellowDisk;
-#else
dx1 = aniYellowDisk;
-#endif
dxPos = *si + FieldWidth;
-#if 1
dx2 = (MurphyVarFaceLeft == 0 ? aniPushRight : aniPushLeft);
-#else
- dx2 = aniPushUpDown;
-#endif
dx2Step = -FieldWidth;
PlayField16[*si] = 0x2703;
-#if 1
subCopyImageToScreen(*si, dx2);
-#endif
goto loc_MoveNoSplit;
// ==========================================================================
PlayField16[*si + 2] = 0x1200;
subCopyImageToScreen(*si, aniPushRight);
-#if 0
- dx = aniFramesYellowDisk;
-#else
dx1 = aniYellowDisk;
-#endif
dxPos = *si + 1;
dx2 = aniPushRight;
dx2Step = -1;
PlayField16[*si - 2] = 0x800;
subCopyImageToScreen(*si, aniPushLeft);
-#if 0
- dx = aniFramesOrangeDisk;
-#else
dx1 = aniOrangeDisk;
-#endif
dxPos = *si - 1;
dx2 = aniPushLeft;
dx2Step = 1;
PlayField16[*si + 2] = 0x100;
subCopyImageToScreen(*si, aniPushRight);
-#if 0
- dx = aniFramesOrangeDisk;
-#else
dx1 = aniOrangeDisk;
-#endif
dxPos = *si + 1;
dx2 = aniPushRight;
dx2Step = -1;
MovingPictureSequencePhase = ax; // store for later
if (ax == 0) // Sound effects
-#if 1
{
switch (HighByte(PlayField16[*si]))
{
break;
}
}
-#else
- subSoundFXPush();
-#endif
bl = HighByte(PlayField16[*si]);
if (bl == 0xE) // Push Zonk to left
StretchedSprites.BltEx(X, Y, dx[Tmp]);
#endif
-#if 1
if (!(dx2 < 0))
-#else
- if (! dx2 < 0)
-#endif
{
tPos = dxPos + dx2Step;
X = GetStretchX(tPos);
}
else if (MovingPictureSequencePhase == 0x20)
{
-#if 1
// anxious murphy, dropping red disk
subCopyImageToScreen(*si, aniMurphyDropping);
-#else
- subCopyFieldToScreen(*si, 43); // anxious murphy
-#endif
RedDiskReleasePhase = 1;
}
RedDiskReleasePhase = 2;
RedDiskCount = RedDiskCount - 1;
-#if 1
subSoundFX(*si, fiRedDisk, actDropping);
-#else
- subSoundFXPush(); // Sound effects
-#endif
} // subAnimateMurphy
// ==========================================================================
// The 10-port data base is at data_h_0D28, 10 entries of 6 bytes each:
// (hi),(lo),(gravity),(freeze zonks),(freeze enemies),(unused)
// ==========================================================================
-int subSpPortTest(int si)
-{
- int subSpPortTest;
-
- int i, cx, bx;
-#if 1
- cx = LInfo.SpecialPortCount; // number of special ports
+void subSpPortTest(int si)
+{
+ int i;
- for (i = 0; i < cx; i++)
+ for (i = 0; i < LInfo.SpecialPortCount; i++)
{
-#if 1
- /* this assumes that PortLocation is stored as big endian */
- bx = LInfo.SpecialPort[i].PortLocation;
-#else
- /* this assumes that PortLocation is stored as little endian */
- bx = HighByte(LInfo.SpecialPort[i].PortLocation);
- MovHighByte(&bx, LowByte(LInfo.SpecialPort[i].PortLocation));
-#endif
-
- if (bx / 2 == si)
+ if (LInfo.SpecialPort[i].PortLocation / 2 == si)
{
- GravityFlag = LInfo.SpecialPort[i].Gravity;
- FreezeZonks = LInfo.SpecialPort[i].FreezeZonks;
+ GravityFlag = LInfo.SpecialPort[i].Gravity;
+ FreezeZonks = LInfo.SpecialPort[i].FreezeZonks;
SnikSnaksElectronsFrozen = LInfo.SpecialPort[i].FreezeEnemies;
- // RandomTime = RandomTime Xor RandomSeed 'is RandomTime used at all? no!
-
break;
}
}
-
-#else
-
- cx = LInfo.SpecialPortCount; // number of special ports
- for (i = 1; i <= cx; i++)
- {
- {
- bx = HighByte(LInfo.SpecialPort[i].PortLocation);
- MovHighByte(&bx, LowByte(LInfo.SpecialPort[i].PortLocation));
- if (bx / 2 == si)
- {
- GravityFlag = LInfo.SpecialPort[i].Gravity;
- FreezeZonks = LInfo.SpecialPort[i].FreezeZonks;
- SnikSnaksElectronsFrozen = LInfo.SpecialPort[i].FreezeEnemies;
- // RandomTime = RandomTime Xor RandomSeed 'is RandomTime used at all? no!
- i = cx + 1;
- }
- }
- }
-#endif
-
- return subSpPortTest;
-} // subSpPortTest
-
-#if 0
-
-void subCopyFieldToScreen(int si, int fi)
-{
- int X, Y;
-
- // +++++++++++++++++++++++++++++++++++++++++
- X = GetStretchX(si);
- Y = GetStretchY(si);
- StretchedSprites.BltEx(X, Y, fi);
- // +++++++++++++++++++++++++++++++++++++++++
}
-#endif
-
void subCopyAnimToScreen(int si, int graphic, int sync_frame)
{
int X, Y;
MovHighByte(&PlayField16[si - FieldWidth + 1], 0x50); // make roll left
PlayField16[si - FieldWidth] = 0x8888;
}
-} // subAdjustZonksInfotronsAboveMurphy
+}
#include "global.h"
-extern void subAdjustZonksInfotronsAboveMurphy(int si);
-extern void subAnimateMurphy(int *si);
-extern void subCopyFieldToScreen(int si, int fi);
-extern void subCopyImageToScreen(int si, int graphic);
-extern void subCopyAnimToScreen(int si, int graphic, int sync_frame);
-extern void subExplodeSnikSnaksBelow(int si);
-extern int subSpPortTest(int si);
+extern void subAdjustZonksInfotronsAboveMurphy(int);
+extern void subAnimateMurphy(int *);
+extern void subCopyFieldToScreen(int, int);
+extern void subCopyImageToScreen(int, int);
+extern void subCopyAnimToScreen(int, int, int);
+extern void subExplodeSnikSnaksBelow(int);
+extern void subSpPortTest(int);
#endif /* MURPHY_H */
int count;
int i, x, y;
-#if 1
for (i = 0; preceding_playfield_memory[i] != NULL; i++)
preceding_buffer_size += 8; /* eight 16-bit integer values */
-#endif
/* needed for engine snapshots */
game_sp.preceding_buffer_size = preceding_buffer_size;
FileMax = FieldMax + native_sp_level.demo.length;
- PlayField8 = REDIM_1D(sizeof(byte), 0, FileMax + 1 - 1);
- DisPlayField = REDIM_1D(sizeof(byte), 0, FieldMax + 1 - 1);
-#if 1
+ PlayField8 = REDIM_1D(sizeof(byte), 0, FileMax);
+ DisPlayField = REDIM_1D(sizeof(byte), 0, FieldMax);
PlayField16 = REDIM_1D(sizeof(int), -preceding_buffer_size, FieldMax);
-#else
- PlayField16 = REDIM_1D(sizeof(int), -FieldWidth, FieldMax);
-#endif
-
-#if 1
-#if 0
- /* fill preceding playfield buffer zone with (indestructible) "hardware" */
- for (i = -FieldWidth; i < 0; i++)
- PlayField16[i] = 0x20;
-#endif
-
-#if 1
count = 0;
for (i = 0; preceding_playfield_memory[i] != NULL; i++)
{
s++;
}
}
-#endif
count = 0;
for (y = 0; y < native_sp_level.height; y++)
PlayField8[i] = 0;
}
-#if 0
- {
- static int x = 0;
-
- if (x == 1)
- {
- printf("++++++++");
- printf("----------\n");
- for (i = 0; i < preceding_buffer_size + FieldMax; i++)
- {
- int x = PlayField16[-preceding_buffer_size + i];
-
- printf("%c%c", x & 0xff, x >> 8);
- }
- printf("----------\n");
- exit(0);
- }
-
- x++;
- }
-#endif
-
-#else
-
- for (i = 0; y = 0; y < native_sp_level.height; y++)
- {
- for (x = 0; x < native_sp_level.width; x++)
- {
- PlayField8[i] = native_sp_level.playfield[x][y];
-
- PlayField16[i] = PlayField8[i];
- DisPlayField[i] = PlayField8[i];
- PlayField8[i] = 0;
-
- i++;
- }
- }
-
-#endif
-
if (native_sp_level.demo.is_available)
{
DemoAvailable = True;
#if 1
/* this is set by main game tape code to native random generator directly */
#else
-
-#if 1
- printf("::: file.c: copyInternalEngineVars_SP(): RandomSeed = LInfo.DemoRandomSeed\n");
-#endif
-
RandomSeed = LInfo.DemoRandomSeed;
-
#endif
LevelLoaded = True;
/* number of special ("gravity") port entries below (maximum 10 allowed) */
header->SpecialPortCount = getFile8Bit(file);
-#if 0
- printf("::: num_special_ports == %d\n", header->SpecialPortCount);
-#endif
-
/* database of properties of up to 10 special ports (6 bytes per port) */
for (i = 0; i < SP_MAX_SPECIAL_PORTS; i++)
{
which is 2 bytes per tile) */
port->PortLocation = getFile16BitBE(file); /* yes, big endian */
-#if 0
- {
- int port_x = (port->PortLocation / 2) % SP_PLAYFIELD_WIDTH;
- int port_y = (port->PortLocation / 2) / SP_PLAYFIELD_WIDTH;
-
- printf("::: %d: port_location == %d => (%d, %d)\n",
- i, port->PortLocation, port_x, port_y);
- }
-#endif
-
/* change gravity: 1 == "turn on", anything else (0) == "turn off" */
port->Gravity = getFile8Bit(file);
/* random seed used for recorded demos */
header->DemoRandomSeed = getFile16BitLE(file); /* yes, little endian */
- // header->DemoRandomSeed = getFile16BitBE(file); /* !!! TEST ONLY !!! */
-
-#if 0
- printf("::: file.c: DemoRandomSeed == %d\n", header->DemoRandomSeed);
-#endif
/* auto-determine number of infotrons if it was stored as "0" -- see above */
if (header->InfotronsNeeded == 0)
struct EngineSnapshotInfo_SP engine_snapshot_sp;
-static void init_global_values()
-{
- menBorder = False;
-}
-
void sp_open_all()
{
- init_global_values();
-
Form_Load();
screenBitmap = CreateBitmap(MAX_BUF_XSIZE * TILEX, MAX_BUF_YSIZE * TILEY,
DEFAULT_DEPTH);
-
- DDSpriteBuffer_Init();
}
void sp_close_all()
SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(DisplayMinY));
SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(DisplayMaxX));
SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(DisplayMaxY));
- SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(DisplayWidth));
- SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(DisplayHeight));
SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(InfotronsNeeded));
SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(KillMurphyFlag));