+2010-02-16
+ * fixed bug in native Supaplex engine that broke several demo solutions
+
2010-02-14
* done integrating R'n'D graphics engine into file "Murphy.c"
* done integrating R'n'D graphics engine into file "BugsTerminals.c"
-#define COMPILE_DATE_STRING "2010-02-14 23:30"
+#define COMPILE_DATE_STRING "2010-02-16 15:40"
// int ax, bx, cx, dx, di;
// int ah, bh, ch, dh, al, bl, cl, dl;
// int cx;
+#if 0
int graphic, sync_frame;
+#endif
int bl;
if (fiBug != LowByte(PlayField16[si]))
#if 1
+#if 0
graphic = (bl == 0 ? aniBugActivating :
bl == 12 ? aniBugDeactivating :
bl == 13 ? aniBug : aniBugActive);
sync_frame = (bl >= 1 && bl <= 11 ? (bl - 1) * 4 : 0) + (TimerVar & 3);
+#endif
// printf("::: %d [%d]\n", sync_frame, gfx.anim_random_frame);
+#if 0
/* a general random frame treatment would be needed for _all_ animations */
+ /* (DONE) */
if (isRandomAnimation_SP(graphic) &&
!isNextAnimationFrame_SP(graphic, sync_frame))
return subAnimateBugs;
+#endif
+
+#if 1
+
+ GfxGraphic[GetX(si)][GetY(si)] = (bl == 0 ? aniBugActivating :
+ bl == 12 ? aniBugDeactivating :
+ bl == 13 ? aniBug : aniBugActive);
+#else
subCopyAnimToScreen(si, graphic, sync_frame);
+#endif
#else
subCopyFieldToScreen(si, aniFramesBug[bl]);
GfxFrame[lx][ly] += getGraphicInfo_Delay(graphic);
#if 1
+
+#if 1
+
+ GfxGraphic[GetX(si)][GetY(si)] = (bl < 8 ? aniTerminal : aniTerminalActive);
+
+#else
subCopyAnimToScreen(si, graphic, GfxFrame[lx][ly]);
+#endif
+
#else
X = GetStretchX(si);
Y = GetStretchY(si);
int subGetRandomNumber;
long Tmp, RSeed;
+#if 0
+ long Tst;
+#endif
RSeed = (long)(0x7FFF & RandomSeed);
if (0x8000 == (RandomSeed & 0x8000))
#else
Tmp = 0xFFFF & (((0x5E5 * RandomSeed) & 0xFFFF) + 0x31);
#endif
+
+#if 0
+ Tst = 0xFFFF & (((0x5E5 * RSeed) & 0xFFFF) + 0x31);
+ printf("::: BugsTerminals.c: subGetRandomNumber(): %d [%ld] [%ld, %ld]\n",
+ RandomSeed, RSeed, Tmp, Tst);
+ if (Tmp != Tst)
+ printf("::: !!!!!!!!!!\n");
+#endif
+
RandomSeed = 0x7FFF & Tmp;
if ((Tmp & 0x8000) != 0)
RandomSeed = RandomSeed | 0x8000;
subGetRandomNumber);
#endif
+#if 0
+ printf("::: BugsTerminals.c: subGetRandomNumber(): %d [%ld, %d]\n",
+ subGetRandomNumber, Tmp, RandomSeed);
+#endif
+
return subGetRandomNumber;
} // subGetRandomNumber
}
void UpdatePlayfield()
+{
+ int x, y;
+#if 1
+ int num_redrawn = 0;
+#endif
+
+ for (y = DisplayMinY; y <= DisplayMaxY; y++)
+ {
+ for (x = DisplayMinX; x <= DisplayMaxX; x++)
+ {
+ int element = LowByte(PlayField16[GetSI(x, y)]);
+ int graphic = GfxGraphic[x][y];
+ int sync_frame = GfxFrame[x][y];
+#if 1
+ boolean redraw = FALSE;
+#else
+ boolean redraw = TRUE; // !!! TEST ONLY -- ALWAYS REDRAW !!!
+#endif
+
+ if (graphic < 0)
+ continue;
+
+ if (element != GfxElementLast[x][y] &&
+ graphic == GfxGraphicLast[x][y])
+ {
+ /* element changed, but not graphic => disable updating graphic */
+
+ GfxElementLast[x][y] = element;
+ GfxGraphicLast[x][y] = GfxGraphic[x][y] = -1;
+
+ continue;
+ }
+
+ if (graphic != GfxGraphicLast[x][y]) // new graphic
+ {
+ redraw = TRUE;
+
+ GfxElementLast[x][y] = element;
+ GfxGraphicLast[x][y] = GfxGraphic[x][y];
+ sync_frame = GfxFrame[x][y] = 0;
+ }
+ else if (isNextAnimationFrame_SP(graphic, sync_frame)) // new frame
+ {
+ redraw = TRUE;
+ }
+
+ if (redraw)
+ {
+ int sx = x * StretchWidth;
+ int sy = y * StretchWidth;
+
+#if 0
+ printf("::: REDRAW (%d, %d): %d, %d\n", x, y, graphic, sync_frame);
+#endif
+
+ StretchedSprites.BltImg(sx, sy, graphic, sync_frame);
+
+#if 1
+ num_redrawn++;
+#endif
+ }
+ }
+ }
+
+#if 0
+ printf("::: FRAME %d: %d redrawn\n", FrameCounter, num_redrawn);
+#endif
+}
+
+void UpdatePlayfield_TMP()
{
int x1 = mScrollX_last / TILEX - 2;
int y1 = mScrollY_last / TILEY - 2;
return subAnimateExplosion;
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;
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:
PlayField16[tsi] = cx;
break;
}
+
+ GfxGraphic[GetX(tsi)][GetY(tsi)] = -1;
}
static int subExplodeZonk(int tsi, int cx)
#if 1
+int fiGraphic[] =
+{
+ aniSpace,
+ aniZonk,
+ aniBase,
+ aniMurphy,
+ aniInfotron,
+ aniRAM,
+ aniHardWare,
+ aniExit,
+ aniOrangeDisk,
+ aniPortRight,
+ aniPortDown,
+ aniPortLeft,
+ aniPortUp,
+ aniSpPortRight,
+ aniSpPortDown,
+ aniSpPortLeft,
+ aniSpPortUp,
+ aniSnikSnak,
+ aniYellowDisk,
+ aniTerminal,
+ aniRedDisk,
+ aniPortUpAndDown,
+ aniPortLeftAndRight,
+ aniPortAllDirections,
+ aniElectron,
+ aniBug,
+ aniRAMLeft,
+ aniRAMRight,
+ aniHW0,
+ aniHW1,
+ aniHW2,
+ aniHW3,
+ aniHW4,
+ aniHW5,
+ aniHW6,
+ aniHW7,
+ aniHW8,
+ aniHW9,
+ aniRAMTop,
+ aniRAMBottom,
+ aniWallSpace
+};
+
int getSequenceLength(int sequence)
{
switch (sequence)
#define ZoomFactor (2)
-#define BaseWidth (ZoomFactor * 16)
-#define StretchWidth (ZoomFactor * 16)
-#define StretchWidth2 (StretchWidth / 2)
-#define TwoPixels (ZoomFactor * 2)
+#define BaseWidth (ZoomFactor * 16)
+#define StretchWidth (ZoomFactor * 16)
+#define StretchWidth2 (StretchWidth / 2)
+#define TwoPixels (ZoomFactor * 2)
#else
-#define BaseWidth (16)
-#define StretchWidth (16)
-#define StretchWidth2 (StretchWidth / 2)
-#define TwoPixels (2)
+#define BaseWidth (16)
+#define StretchWidth (16)
+#define StretchWidth2 (StretchWidth / 2)
+#define TwoPixels (2)
#endif
#if 1
-#define fiSpace (0)
-#define fiZonk (1)
-#define fiBase (2)
-#define fiMurphy (3)
-#define fiInfotron (4)
-#define fiRAM (5)
-#define fiHardWare (6)
-#define fiExit (7)
-#define fiOrangeDisk (8)
-#define fiPortRight (9)
-#define fiPortDown (10)
-#define fiPortLeft (11)
-#define fiPortUp (12)
-#define fiSpPortRight (13)
-#define fiSpPortDown (14)
-#define fiSpPortLeft (15)
-#define fiSpPortUp (16)
-#define fiSnikSnak (17)
-#define fiYellowDisk (18)
-#define fiTerminal (19)
-#define fiRedDisk (20)
-#define fiPortUpAndDown (21)
-#define fiPortLeftAndRight (22)
-#define fiPortAllDirections (23)
-#define fiElectron (24)
-#define fiBug (25)
-#define fiRAMLeft (26)
-#define fiRAMRight (27)
-#define fiHWFirst (28)
+#define fiSpace (0)
+#define fiZonk (1)
+#define fiBase (2)
+#define fiMurphy (3)
+#define fiInfotron (4)
+#define fiRAM (5)
+#define fiHardWare (6)
+#define fiExit (7)
+#define fiOrangeDisk (8)
+#define fiPortRight (9)
+#define fiPortDown (10)
+#define fiPortLeft (11)
+#define fiPortUp (12)
+#define fiSpPortRight (13)
+#define fiSpPortDown (14)
+#define fiSpPortLeft (15)
+#define fiSpPortUp (16)
+#define fiSnikSnak (17)
+#define fiYellowDisk (18)
+#define fiTerminal (19)
+#define fiRedDisk (20)
+#define fiPortUpAndDown (21)
+#define fiPortLeftAndRight (22)
+#define fiPortAllDirections (23)
+#define fiElectron (24)
+#define fiBug (25)
+#define fiRAMLeft (26)
+#define fiRAMRight (27)
+#define fiHWFirst (28)
#define fiHW0 (fiHWFirst + 0) // fiHWFirst
#define fiHW1 (fiHWFirst + 1)
#define fiHW2 (fiHWFirst + 2)
#define fiHW7 (fiHWFirst + 7)
#define fiHW8 (fiHWFirst + 8)
#define fiHW9 (fiHWFirst + 9) // fiHWLast
-#define fiHWLast (37)
-#define fiRAMTop (38)
-#define fiRAMBottom (39)
-#define fiWallSpace (40)
-#define fiHWTrash1 (41)
-#define fiHWTrash2 (42)
-#define fiHWMurphy (43)
+#define fiHWLast (37)
+#define fiRAMTop (38)
+#define fiRAMBottom (39)
+#define fiWallSpace (40)
+#define fiHWTrash1 (41)
+#define fiHWTrash2 (42)
+#define fiHWMurphy (43)
-#define fiExplosion (0x1F)
+#define fiExplosion (0x1F)
#else
-#define fiBase (2)
-#define fiBug (25)
-#define fiElectron (24)
-#define fiExit (7)
-#define fiExplosion (0x1F)
-#define fiHWFirst (28)
-#define fiHWLast (37)
-#define fiHWMurphy (43)
-#define fiHWTrash1 (41)
-#define fiHWTrash2 (42)
-#define fiHardWare (6)
-#define fiInfotron (4)
-#define fiMurphy (3)
-#define fiOrangeDisk (8)
-#define fiPortAllDirections (23)
-#define fiPortDown (10)
-#define fiPortLeft (11)
-#define fiPortLeftAndRight (22)
-#define fiPortRight (9)
-#define fiPortUp (12)
-#define fiPortUpAndDown (21)
-#define fiRAM (5)
-#define fiRAMBottom (39)
-#define fiRAMLeft (26)
-#define fiRAMRight (27)
-#define fiRAMTop (38)
-#define fiRedDisk (20)
-#define fiSnikSnak (17)
-#define fiSpPortDown (14)
-#define fiSpPortLeft (15)
-#define fiSpPortRight (13)
-#define fiSpPortUp (16)
-#define fiSpace (0)
-#define fiTerminal (19)
-#define fiWallSpace (40)
-#define fiYellowDisk (18)
-#define fiZonk (1)
+#define fiBase (2)
+#define fiBug (25)
+#define fiElectron (24)
+#define fiExit (7)
+#define fiExplosion (0x1F)
+#define fiHWFirst (28)
+#define fiHWLast (37)
+#define fiHWMurphy (43)
+#define fiHWTrash1 (41)
+#define fiHWTrash2 (42)
+#define fiHardWare (6)
+#define fiInfotron (4)
+#define fiMurphy (3)
+#define fiOrangeDisk (8)
+#define fiPortAllDirections (23)
+#define fiPortDown (10)
+#define fiPortLeft (11)
+#define fiPortLeftAndRight (22)
+#define fiPortRight (9)
+#define fiPortUp (12)
+#define fiPortUpAndDown (21)
+#define fiRAM (5)
+#define fiRAMBottom (39)
+#define fiRAMLeft (26)
+#define fiRAMRight (27)
+#define fiRAMTop (38)
+#define fiRedDisk (20)
+#define fiSnikSnak (17)
+#define fiSpPortDown (14)
+#define fiSpPortLeft (15)
+#define fiSpPortRight (13)
+#define fiSpPortUp (16)
+#define fiSpace (0)
+#define fiTerminal (19)
+#define fiWallSpace (40)
+#define fiYellowDisk (18)
+#define fiZonk (1)
#endif
// graphics and animations directly related to file elements
-#define aniSpace IMG_EMPTY_SPACE
-#define aniZonk IMG_SP_ZONK
-#define aniBase IMG_SP_BASE
-#define aniMurphy IMG_SP_MURPHY
-#define aniInfotron IMG_SP_INFOTRON
-#define aniRAM IMG_SP_CHIP_SINGLE
-#define aniHardWare IMG_SP_HARDWARE_GRAY
-#define aniExit IMG_SP_EXIT_CLOSED
-#define aniOrangeDisk IMG_SP_DISK_ORANGE
-#define aniPortRight IMG_SP_PORT_RIGHT
-#define aniPortDown IMG_SP_PORT_DOWN
-#define aniPortLeft IMG_SP_PORT_LEFT
-#define aniPortUp IMG_SP_PORT_UP
-#define aniSpPortRight IMG_SP_GRAVITY_PORT_RIGHT
-#define aniSpPortDown IMG_SP_GRAVITY_PORT_DOWN
-#define aniSpPortLeft IMG_SP_GRAVITY_PORT_LEFT
-#define aniSpPortUp IMG_SP_GRAVITY_PORT_UP
-#define aniSnikSnak IMG_SP_SNIKSNAK
-#define aniYellowDisk IMG_SP_DISK_YELLOW
-#define aniTerminal IMG_SP_TERMINAL
-#define aniRedDisk IMG_SP_DISK_RED
-#define aniPortUpAndDown IMG_SP_PORT_VERTICAL
-#define aniPortLeftAndRight IMG_SP_PORT_HORIZONTAL
-#define aniPortAllDirections IMG_SP_PORT_ANY
-#define aniElectron IMG_SP_ELECTRON
-#define aniBug IMG_SP_BUGGY_BASE
-#define aniRAMLeft IMG_SP_CHIP_LEFT
-#define aniRAMRight IMG_SP_CHIP_RIGHT
-#define aniHWFirst IMG_SP_HARDWARE_BASE_1
+#define aniSpace IMG_EMPTY_SPACE
+#define aniZonk IMG_SP_ZONK
+#define aniBase IMG_SP_BASE
+#define aniMurphy IMG_SP_MURPHY
+#define aniInfotron IMG_SP_INFOTRON
+#define aniRAM IMG_SP_CHIP_SINGLE
+#define aniHardWare IMG_SP_HARDWARE_GRAY
+#define aniExit IMG_SP_EXIT_CLOSED
+#define aniOrangeDisk IMG_SP_DISK_ORANGE
+#define aniPortRight IMG_SP_PORT_RIGHT
+#define aniPortDown IMG_SP_PORT_DOWN
+#define aniPortLeft IMG_SP_PORT_LEFT
+#define aniPortUp IMG_SP_PORT_UP
+#define aniSpPortRight IMG_SP_GRAVITY_PORT_RIGHT
+#define aniSpPortDown IMG_SP_GRAVITY_PORT_DOWN
+#define aniSpPortLeft IMG_SP_GRAVITY_PORT_LEFT
+#define aniSpPortUp IMG_SP_GRAVITY_PORT_UP
+#define aniSnikSnak IMG_SP_SNIKSNAK
+#define aniYellowDisk IMG_SP_DISK_YELLOW
+#define aniTerminal IMG_SP_TERMINAL
+#define aniRedDisk IMG_SP_DISK_RED
+#define aniPortUpAndDown IMG_SP_PORT_VERTICAL
+#define aniPortLeftAndRight IMG_SP_PORT_HORIZONTAL
+#define aniPortAllDirections IMG_SP_PORT_ANY
+#define aniElectron IMG_SP_ELECTRON
+#define aniBug IMG_SP_BUGGY_BASE
+#define aniRAMLeft IMG_SP_CHIP_LEFT
+#define aniRAMRight IMG_SP_CHIP_RIGHT
+#define aniHWFirst IMG_SP_HARDWARE_BASE_1
#define aniHW0 IMG_SP_HARDWARE_BASE_1
#define aniHW1 IMG_SP_HARDWARE_GREEN
#define aniHW2 IMG_SP_HARDWARE_BLUE
#define aniHW7 IMG_SP_HARDWARE_BASE_4
#define aniHW8 IMG_SP_HARDWARE_BASE_5
#define aniHW9 IMG_SP_HARDWARE_BASE_6
-#define aniHWLast IMG_SP_HARDWARE_BASE_6
-#define aniRAMTop IMG_SP_CHIP_TOP
-#define aniRAMBottom IMG_SP_CHIP_BOTTOM
-#define aniWallSpace IMG_INVISIBLE_WALL
-#define aniHWTrash1
-#define aniHWTrash2
-#define aniHWMurphy
+#define aniHWLast IMG_SP_HARDWARE_BASE_6
+#define aniRAMTop IMG_SP_CHIP_TOP
+#define aniRAMBottom IMG_SP_CHIP_BOTTOM
+#define aniWallSpace IMG_INVISIBLE_WALL
+#define aniHWTrash1
+#define aniHWTrash2
+#define aniHWMurphy
// graphics and animations related to in-game animations for element actions
#define aniMurphyDropping IMG_SP_MURPHY_DROPPING
-#define aniMurphySleepLeft IMG_SP_MURPHY_SLEEPING_LEFT
-#define aniMurphySleepRight IMG_SP_MURPHY_SLEEPING_RIGHT
-#define aniMurphyTouchLeft IMG_SP_MURPHY_SNAPPING_LEFT
-#define aniMurphyTouchRight IMG_SP_MURPHY_SNAPPING_RIGHT
-#define aniMurphyTouchUp IMG_SP_MURPHY_SNAPPING_UP
-#define aniMurphyTouchDown IMG_SP_MURPHY_SNAPPING_DOWN
-#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 aniMurphySleepLeft IMG_SP_MURPHY_SLEEPING_LEFT
+#define aniMurphySleepRight IMG_SP_MURPHY_SLEEPING_RIGHT
+#define aniMurphyTouchLeft IMG_SP_MURPHY_SNAPPING_LEFT
+#define aniMurphyTouchRight IMG_SP_MURPHY_SNAPPING_RIGHT
+#define aniMurphyTouchUp IMG_SP_MURPHY_SNAPPING_UP
+#define aniMurphyTouchDown IMG_SP_MURPHY_SNAPPING_DOWN
+#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 aniOrangeDisk IMG_SP_DISK_ORANGE
#define aniRedDisk IMG_SP_DISK_RED
-#define aniSnikSnakDown 167
-#define aniSnikSnakLeft 239
-#define aniSnikSnakRight 247
-#define aniSnikSnakUp 159
+#define aniSnikSnakDown IMG_SP_SNIKSNAK_DOWN
+#define aniSnikSnakLeft IMG_SP_SNIKSNAK_LEFT
+#define aniSnikSnakRight IMG_SP_SNIKSNAK_RIGHT
+#define aniSnikSnakUp IMG_SP_SNIKSNAK_UP
#define aniTerminalActive IMG_SP_TERMINAL_ACTIVE
-#define aniExplosionInfo (111)
+#define aniExplosionInfo (111)
#else
-#define aniMurphySleepLeft (71)
-#define aniMurphySleepRight (68)
-#define aniMurphyTouchDown (47)
-#define aniMurphyTouchLeft (95)
-#define aniMurphyTouchRight (94)
-#define aniMurphyTouchUp (46)
-#define aniMurphyYawn (56)
-#define aniPushLeft (45)
-#define aniPushRight (44)
-#define aniPushUpDown (79)
-
-#define aniSnikSnakDown (167)
-#define aniSnikSnakLeft (239)
-#define aniSnikSnakRight (247)
-#define aniSnikSnakUp (159)
+#define aniMurphySleepLeft (71)
+#define aniMurphySleepRight (68)
+#define aniMurphyTouchDown (47)
+#define aniMurphyTouchLeft (95)
+#define aniMurphyTouchRight (94)
+#define aniMurphyTouchUp (46)
+#define aniMurphyYawn (56)
+#define aniPushLeft (45)
+#define aniPushRight (44)
+#define aniPushUpDown (79)
+
+#define aniSnikSnakDown (167)
+#define aniSnikSnakLeft (239)
+#define aniSnikSnakRight (247)
+#define aniSnikSnakUp (159)
#define aniTerminal (0x80)
#define aniTerminalActive (0x88)
-#define aniExplosionInfo (111)
+#define aniExplosionInfo (111)
#endif
-#define posFrameCorner (55)
-#define posFrameHorizontal (111)
-#define posFrameVertical (110)
+#define posFrameCorner (55)
+#define posFrameHorizontal (111)
+#define posFrameVertical (110)
#if 1
#if 1
-#define keyNone (0)
-#define keyUp (1)
-#define keyLeft (2)
-#define keyDown (3)
-#define keyRight (4)
-#define keySpaceUp (5)
-#define keySpaceLeft (6)
-#define keySpaceDown (7)
-#define keySpaceRight (8)
-#define keySpace (9)
+#define keyNone (0)
+#define keyUp (1)
+#define keyLeft (2)
+#define keyDown (3)
+#define keyRight (4)
+#define keySpaceUp (5)
+#define keySpaceLeft (6)
+#define keySpaceDown (7)
+#define keySpaceRight (8)
+#define keySpace (9)
#else
-#define keyDown (3)
-#define keyLeft (2)
-#define keyNone (0)
-#define keyRight (4)
-#define keySpace (9)
-#define keySpaceDown (7)
-#define keySpaceLeft (6)
-#define keySpaceRight (8)
-#define keySpaceUp (5)
-#define keyUp (1)
+#define keyDown (3)
+#define keyLeft (2)
+#define keyNone (0)
+#define keyRight (4)
+#define keySpace (9)
+#define keySpaceDown (7)
+#define keySpaceLeft (6)
+#define keySpaceRight (8)
+#define keySpaceUp (5)
+#define keyUp (1)
#endif
extern int getSequenceLength(int sequence);
extern boolean isSnappingSequence(int sequence);
+extern int fiGraphic[];
+
extern boolean Alignments;
extern boolean BlockingSpeed;
extern boolean Cracked;
tsi = GetSI(X, Y);
Tmp = LowByte(PlayField16[tsi]);
- if (40 < Tmp)
+ if (Tmp > 40)
Tmp = 0;
if (Tmp == fiRAM || Tmp == fiHardWare)
if (EditFlag)
{
- if (fiOrangeDisk < Tmp && Tmp < fiSnikSnak)
+ if (Tmp > fiOrangeDisk && Tmp < fiSnikSnak)
Tmp = DisPlayField[tsi];
}
+#if 1
+ if (Tmp >= 0 && Tmp <= 40)
+ {
+ subCopyImageToScreen(tsi, fiGraphic[Tmp]);
+
+#if 1
+ if (Tmp != fiSpace && Tmp != fiSnikSnak && Tmp != fiElectron)
+ GfxGraphic[X][Y] = fiGraphic[Tmp];
+#endif
+ }
+#else
StretchedSprites.BltEx(StretchWidth * X, StretchWidth * Y, Tmp);
+#endif
}
void DrawFieldAnimated(int X, int Y)
switch (Tmp)
{
case fiSnikSnak:
+#if 1
+ subCopyImageToScreen(tsi, aniSpace);
+#else
StretchedSprites.BltEx(StretchWidth * X, StretchWidth * Y, fiSpace);
+#endif
break;
case fiElectron:
+#if 1
+ subCopyImageToScreen(tsi, aniSpace);
+#else
StretchedSprites.BltEx(StretchWidth * X, StretchWidth * Y, fiSpace);
+#endif
break;
default:
- if (40 < Tmp)
+ if (Tmp > 40)
Tmp = 0;
if (Tmp == fiRAM || Tmp == fiHardWare)
if (EditFlag)
{
- if (fiOrangeDisk < Tmp && Tmp < fiSnikSnak)
+ if (Tmp > fiOrangeDisk && Tmp < fiSnikSnak)
Tmp = DisPlayField[tsi];
}
X, Y, Tmp);
#endif
+#if 1
+ if (Tmp >= 0 && Tmp <= 40)
+ {
+ subCopyImageToScreen(tsi, fiGraphic[Tmp]);
+
+#if 1
+ if (Tmp != fiSpace && Tmp != fiSnikSnak && Tmp != fiElectron)
+ GfxGraphic[X][Y] = fiGraphic[Tmp];
+#endif
+ }
+#else
StretchedSprites.BltEx(StretchWidth * X, StretchWidth * Y, Tmp);
+#endif
+
break;
}
}
if (ExplosionShake != 0)
{
subGetRandomNumber();
+
+ // printf("::: ExplosionShake [%d]\n", FrameCounter);
}
{
#if 1
// draw new terminal type
+#if 1
+ GfxGraphic[GetX(*si - FieldWidth)][GetY(*si - FieldWidth)] = aniTerminalActive;
+#else
subCopyImageToScreen(*si - FieldWidth, aniTerminalActive);
+#endif
#else
subCopyFieldToScreen(*si - FieldWidth, 0x88); // draw new terminal type
#endif
#if 1
// draw new terminal type
+#if 1
+ GfxGraphic[GetX(*si - 1)][GetY(*si - 1)] = aniTerminalActive;
+#else
subCopyImageToScreen(*si - 1, aniTerminalActive);
+#endif
#else
subCopyFieldToScreen(*si - 1, 0x88); // draw new terminal type
#endif
#if 1
// draw new terminal type
+#if 1
+ GfxGraphic[GetX(*si + FieldWidth)][GetY(*si + FieldWidth)] = aniTerminalActive;
+#else
subCopyImageToScreen(*si + FieldWidth, aniTerminalActive);
+#endif
#else
subCopyFieldToScreen(*si + FieldWidth, 0x88); // draw new terminal type
#endif
#if 1
// draw new terminal type
+#if 1
+ GfxGraphic[GetX(*si + 1)][GetY(*si + 1)] = aniTerminalActive;
+#else
subCopyImageToScreen(*si + 1, aniTerminalActive);
+#endif
#else
subCopyFieldToScreen(*si + 1, 0x88); // draw new terminal type
#endif
#if 1
StretchedSprites.BltImg(X, Y, dx1, Tmp);
+ GfxGraphic[GetX(*si)][GetY(*si)] = -1; // (Murphy's position)
+ GfxGraphic[GetX(dxPos)][GetY(dxPos)] = -1; // (snapping position)
// printf("::: Tmp: %d\n", Tmp);
#else
StretchedSprites.BltEx(X, Y, dx[Tmp]);
if (SnikSnaksElectronsFrozen == 1)
return subAnimateSnikSnaks;
+#if 1
+ /* (not sure why this was removed -- this broke several level solutions) */
+ if (LowByte(PlayField16[si]) != fiSnikSnak)
+ return subAnimateSnikSnaks;
+#endif
+
// If LowByte(PlayField16(si)) <> fiSnikSnak Then Exit Function
// Debug.Assert (LowByte(PlayField16[si]) == fiSnikSnak);
bx = HighByte(PlayField16[si]);
static int subSnikSnakTurnLeft;
// int ax, ah, bl, dx, X, Y;
- int ax, ah, bl, X, Y;
+ int ax, ah, bl;
ax = (TimerVar & 3);
if (ax != 0)
return subSnikSnakTurnLeft;
} // loc_g_75E0:
+#if 1
+ subDrawSnikSnakTurnLeft(si, bx);
+#else
// +++++++++++++++++++++++++++++++++++++++++++++++++++++
X = GetStretchX(si);
Y = GetStretchY(si);
StretchedSprites.BltEx(X, Y, aniFramesSnikSnak[bx]);
// +++++++++++++++++++++++++++++++++++++++++++++++++++++
+#endif
+
bx = (bx + 1) & 0x7;
MovHighByte(&PlayField16[si], bx);
return subSnikSnakTurnLeft;
static int subSnikSnakTurnRight;
// int ax, ah, bl, dx, X, Y;
- int ax, ah, bl, X, Y;
+ int ax, ah, bl;
ax = (TimerVar & 3);
if (ax != 0)
return subSnikSnakTurnRight;
} // loc_g_76DB:
+#if 1
+ subDrawSnikSnakTurnRight(si, bx);
+#else
// +++++++++++++++++++++++++++++++++++++++++++++++++++++
X = GetStretchX(si);
Y = GetStretchY(si);
StretchedSprites.BltEx(X, Y, aniFramesSnikSnak[0x10 - bx]);
// +++++++++++++++++++++++++++++++++++++++++++++++++++++
+#endif
+
bx = ((bx + 1) & 0x7) | 8;
MovHighByte(&PlayField16[si], bx);
return subSnikSnakTurnRight;
static int subSnikSnakFromBelow;
// int ax, ah, bl, dx, X, Y;
- int ax, bl, X, Y;
+ int ax, bl;
+#if 1
+ subDrawSnikSnakFromBelow(si, bx);
+ bx = bx - 0xF; // get and increment sequence#
+#else
bx = bx - 0xF; // get and increment sequence#
// +++++++++++++++++++++++++++++++++++++++++++++++++++++
X = GetStretchX(si);
StretchedSprites.BltEx(X, Y, 0);
StretchedSprites.BltEx(X, Y - bx * TwoPixels, aniSnikSnakUp + bx);
// +++++++++++++++++++++++++++++++++++++++++++++++++++++
+#endif
+
bl = LowByte(bx);
if (bl == 7 && LowByte(PlayField16[si + FieldWidth]) != fiExplosion)
{
static int subSnikSnakFromRight;
// int ax, ah, bl, dx, X, Y;
- int ax, bl, X, Y;
+ int ax, bl;
+#if 1
+ subDrawSnikSnakFromRight(si, bx);
+ bx = bx - 0x17; // get and increment sequence#
+#else
bx = bx - 0x17; // get and increment sequence#
// +++++++++++++++++++++++++++++++++++++++++++++++++++++
X = GetStretchX(si + 1);
StretchedSprites.BltEx(X, Y, 0);
StretchedSprites.BltEx(X - bx * TwoPixels, Y, aniSnikSnakLeft + bx);
// +++++++++++++++++++++++++++++++++++++++++++++++++++++
+#endif
+
bl = LowByte(bx);
if (bl == 7 && LowByte(PlayField16[si + 1]) != fiExplosion)
{
static int subSnikSnakFromAbove;
// int ax, ah, bl, dx, X, Y;
- int ax, bl, X, Y;
+ int ax, bl;
+#if 1
+ subDrawSnikSnakFromAbove(si, bx);
+ bx = bx - 0x1F; // get and increment sequence#
+#else
bx = bx - 0x1F; // get and increment sequence#
// +++++++++++++++++++++++++++++++++++++++++++++++++++++
X = GetStretchX(si);
StretchedSprites.BltEx(X, Y, 0);
StretchedSprites.BltEx(X, Y + bx * TwoPixels, aniSnikSnakDown + bx);
// +++++++++++++++++++++++++++++++++++++++++++++++++++++
+#endif
+
bl = LowByte(bx);
if (bl == 7 && LowByte(PlayField16[si - FieldWidth]) != fiExplosion)
{
static int subSnikSnakFromLeft;
// int ax, ah, bl, dx, X, Y;
- int ax, bl, X, Y;
+ int ax, bl;
+#if 1
+ subDrawSnikSnakFromLeft(si, bx);
+ bx = bx - 0x27; // get and increment sequence#
+#else
bx = bx - 0x27; // get and increment sequence#
// +++++++++++++++++++++++++++++++++++++++++++++++++++++
X = GetStretchX(si - 1);
StretchedSprites.BltEx(X, Y, 0);
StretchedSprites.BltEx(X + bx * TwoPixels, Y, aniSnikSnakRight + bx);
// +++++++++++++++++++++++++++++++++++++++++++++++++++++
+#endif
+
bl = LowByte(bx);
if (bl == 7 && LowByte(PlayField16[si - 1]) != fiExplosion)
{
// +++++++++++++++++++++++++++++++++++++++++++++++++++++
X = GetStretchX(si);
Y = GetStretchY(si + FieldWidth);
+#if 1
+ StretchedSprites.BltImg(X, Y, aniSpace, 0);
+ StretchedSprites.BltImg(X, Y - bx * TwoPixels, aniSnikSnakUp, bx);
+#else
StretchedSprites.BltEx(X, Y, 0);
StretchedSprites.BltEx(X, Y - bx * TwoPixels, aniSnikSnakUp + bx);
+#endif
// +++++++++++++++++++++++++++++++++++++++++++++++++++++
return subDrawSnikSnakFromBelow;
// +++++++++++++++++++++++++++++++++++++++++++++++++++++
X = GetStretchX(si + 1);
Y = GetStretchY(si);
+#if 1
+ StretchedSprites.BltImg(X, Y, aniSpace, 0);
+ StretchedSprites.BltImg(X - bx * TwoPixels, Y, aniSnikSnakLeft, bx);
+#else
StretchedSprites.BltEx(X, Y, 0);
StretchedSprites.BltEx(X - bx * TwoPixels, Y, aniSnikSnakLeft + bx);
+#endif
// +++++++++++++++++++++++++++++++++++++++++++++++++++++
return subDrawSnikSnakFromRight;
// +++++++++++++++++++++++++++++++++++++++++++++++++++++
X = GetStretchX(si);
Y = GetStretchY(si - FieldWidth);
+#if 1
+ StretchedSprites.BltImg(X, Y, aniSpace, 0);
+ StretchedSprites.BltImg(X, Y + bx * TwoPixels, aniSnikSnakDown, bx);
+#else
StretchedSprites.BltEx(X, Y, 0);
StretchedSprites.BltEx(X, Y + bx * TwoPixels, aniSnikSnakDown + bx);
+#endif
// +++++++++++++++++++++++++++++++++++++++++++++++++++++
return subDrawSnikSnakFromAbove;
// +++++++++++++++++++++++++++++++++++++++++++++++++++++
X = GetStretchX(si - 1);
Y = GetStretchY(si);
+#if 1
+ StretchedSprites.BltImg(X, Y, aniSpace, 0);
+ StretchedSprites.BltImg(X + bx * TwoPixels, Y, aniSnikSnakRight, bx);
+#else
StretchedSprites.BltEx(X, Y, 0);
StretchedSprites.BltEx(X + bx * TwoPixels, Y, aniSnikSnakRight + bx);
+#endif
// +++++++++++++++++++++++++++++++++++++++++++++++++++++
return subDrawSnikSnakFromLeft;
PlayField8 = REDIM_1D(sizeof(byte), 0, FileMax + 1 - 1);
DisPlayField = REDIM_1D(sizeof(byte), 0, FieldMax + 1 - 1);
+#if 0
PlayField16 = REDIM_1D(sizeof(int), -FieldWidth, FieldMax);
+#else
+ PlayField16 = REDIM_1D(sizeof(int), -FieldWidth * 2, FieldMax);
+#endif
+
+#if 1
#if 1
+ /* fill preceding playfield buffer zone with (indestructible) "hardware" */
+ for (i = -FieldWidth * 2; i < -FieldWidth; i++)
+ PlayField16[i] = 0x20;
+#endif
#if 0
/* fill preceding playfield buffer zone with (indestructible) "hardware" */
struct GameInfo_SP game_sp_info;
struct LevelInfo_SP native_sp_level;
+
+int GfxElementLast[SP_MAX_PLAYFIELD_WIDTH][SP_MAX_PLAYFIELD_HEIGHT];
+int GfxGraphicLast[SP_MAX_PLAYFIELD_WIDTH][SP_MAX_PLAYFIELD_HEIGHT];
+int GfxGraphic[SP_MAX_PLAYFIELD_WIDTH][SP_MAX_PLAYFIELD_HEIGHT];
int GfxFrame[SP_MAX_PLAYFIELD_WIDTH][SP_MAX_PLAYFIELD_HEIGHT];
menBorder.Checked = setup.sp_show_border_elements;
for (x = 0; x < SP_MAX_PLAYFIELD_WIDTH; x++)
+ {
for (y = 0; y < SP_MAX_PLAYFIELD_HEIGHT; y++)
+ {
+ GfxElementLast[x][y] = -1;
+ GfxGraphicLast[x][y] = -1;
+ GfxGraphic[x][y] = -1;
GfxFrame[x][y] = 0;
+ }
+ }
InitScrollPlayfield();
RedrawPlayfield_SP(FALSE);
- for (x = 0; x < SP_MAX_PLAYFIELD_WIDTH; x++)
- for (y = 0; y < SP_MAX_PLAYFIELD_HEIGHT; y++)
+ for (x = DisplayMinX; x <= DisplayMaxX; x++)
+ for (y = DisplayMinY; y <= DisplayMaxY; y++)
GfxFrame[x][y]++;
}
extern Bitmap *sp_objects;
+extern int GfxElementLast[SP_MAX_PLAYFIELD_WIDTH][SP_MAX_PLAYFIELD_HEIGHT];
+extern int GfxGraphicLast[SP_MAX_PLAYFIELD_WIDTH][SP_MAX_PLAYFIELD_HEIGHT];
+extern int GfxGraphic[SP_MAX_PLAYFIELD_WIDTH][SP_MAX_PLAYFIELD_HEIGHT];
extern int GfxFrame[SP_MAX_PLAYFIELD_WIDTH][SP_MAX_PLAYFIELD_HEIGHT];