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"
2010-02-07
* started integrating R'n'D graphics engine into Supaplex game engine
{ "sp_buggy_base.active.xpos", "8" },
{ "sp_buggy_base.active.ypos", "6" },
{ "sp_buggy_base.active.frames", "4" },
- { "sp_buggy_base.active.anim_mode", "random" },
+ { "sp_buggy_base.active.delay", "4" },
+ { "sp_buggy_base.active.anim_mode", "pingpong" },
{ "sp_hardware_base_1", "RocksSP.pcx" },
{ "sp_hardware_base_1.xpos", "4" },
-#define COMPILE_DATE_STRING "2010-02-14 00:55"
+#define COMPILE_DATE_STRING "2010-02-14 23:30"
void getGraphicSource_SP(struct GraphicInfo_SP *, int, int, int, int);
int getGraphicInfo_Delay(int);
+boolean isRandomAnimation_SP(int);
+boolean isNextAnimationFrame_SP(int, int);
#endif /* ENGINES_H */
// int ax, bx, cx, dx, di;
// int ah, bh, ch, dh, al, bl, cl, dl;
- int cx;
+ // int cx;
+ int graphic, sync_frame;
int bl;
if (fiBug != LowByte(PlayField16[si]))
return subAnimateBugs;
+#if 0
if (0 != (TimerVar & 3))
return subAnimateBugs;
+#endif
bl = SgnHighByte(PlayField16[si]); // get and increment sequence#
+
+#if 1
+ if ((TimerVar & 3) == 0)
+ {
+ bl = bl + 1;
+ if (bl >= 0xE)
+ {
+ bl = subGetRandomNumber(); // generate new random number
+ bl = -((bl & 0x3F) + 0x20);
+ }
+
+ MovHighByte(&PlayField16[si], bl); // save sequence#
+ }
+#else
bl = bl + 1;
if (bl >= 0xE)
{
}
MovHighByte(&PlayField16[si], bl); // save sequence#
+#endif
if (bl < 0) // bug sleeps / is inactive
return subAnimateBugs;
+#if 1
+ if ((TimerVar & 3) != 0)
+ goto markDisplay;
+#endif
+
// now the bug is active! Beware Murphy!
if ((ByteMask && PlayField16[si - FieldWidth - 1]) == fiMurphy)
goto markPlaySound;
markDisplay:
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+#if 1
+
+#if 1
+
+ graphic = (bl == 0 ? aniBugActivating :
+ bl == 12 ? aniBugDeactivating :
+ bl == 13 ? aniBug : aniBugActive);
+ sync_frame = (bl >= 1 && bl <= 11 ? (bl - 1) * 4 : 0) + (TimerVar & 3);
+
+ // printf("::: %d [%d]\n", sync_frame, gfx.anim_random_frame);
+
+ /* a general random frame treatment would be needed for _all_ animations */
+ if (isRandomAnimation_SP(graphic) &&
+ !isNextAnimationFrame_SP(graphic, sync_frame))
+ return subAnimateBugs;
+
+ subCopyAnimToScreen(si, graphic, sync_frame);
+
+#else
+ subCopyFieldToScreen(si, aniFramesBug[bl]);
+#endif
+
+#else
cx = aniFramesBug[bl];
StretchedSprites.BltEx(GetStretchX(si), GetStretchY(si), cx);
+#endif
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
return subAnimateBugs;
#if 1
-#define aniSpace IMG_EMPTY_SPACE
+// 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 aniHW0 IMG_SP_HARDWARE_BASE_1
+#define aniHW1 IMG_SP_HARDWARE_GREEN
+#define aniHW2 IMG_SP_HARDWARE_BLUE
+#define aniHW3 IMG_SP_HARDWARE_RED
+#define aniHW4 IMG_SP_HARDWARE_YELLOW
+#define aniHW5 IMG_SP_HARDWARE_BASE_2
+#define aniHW6 IMG_SP_HARDWARE_BASE_3
+#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
+
+
+// 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 aniPushRight IMG_SP_MURPHY_PUSHING_RIGHT
#define aniPushUpDown IMG_SP_MURPHY_PUSHING_RIGHT
-#define aniBug IMG_SP_BUGGY_BASE
+#define aniBugActivating IMG_SP_BUGGY_BASE_ACTIVATING
+#define aniBugDeactivating IMG_SP_BUGGY_BASE_ACTIVATING
#define aniBugActive IMG_SP_BUGGY_BASE_ACTIVE
#define aniZonkRollLeft IMG_SP_ZONK_MOVING_LEFT
#define aniZonkRollRight IMG_SP_ZONK_MOVING_RIGHT
#define aniSnikSnakRight 247
#define aniSnikSnakUp 159
-#define aniTerminal IMG_SP_TERMINAL
#define aniTerminalActive IMG_SP_TERMINAL_ACTIVE
#define aniExplosionInfo (111)
{
int x, y;
+ gfx.anim_random_frame = -1; // (use simple, ad-hoc random numbers)
+
game_sp_info.LevelSolved = FALSE;
game_sp_info.GameOver = FALSE;
void getGraphicSource_SP(struct GraphicInfo_SP *g_sp,
int graphic, int sync_frame, int x, int y)
{
-#if 0
- /* currently we get the actual graphic animation frame */
- int frame = sync_frame;
-#else
- /* (future implementations may provide a synchronization frame instead) */
int frame = getGraphicAnimationFrame(graphic, sync_frame);
-#endif
getGraphicSource(graphic, frame, &g_sp->bitmap, &g_sp->src_x, &g_sp->src_y);
}
+boolean isRandomAnimation_SP(int graphic)
+{
+ return (ANIM_MODE(graphic) == ANIM_RANDOM);
+}
+
+boolean isNextAnimationFrame_SP(int graphic, int sync_frame)
+{
+ return (IS_NEXT_FRAME(sync_frame, graphic));
+}
+
int getGraphicInfo_Delay(int graphic)
{
return graphic_info[graphic].anim_delay;