rnd-20100214-2-src
authorHolger Schemel <info@artsoft.org>
Sun, 14 Feb 2010 22:42:28 +0000 (23:42 +0100)
committerHolger Schemel <info@artsoft.org>
Sat, 30 Aug 2014 08:58:30 +0000 (10:58 +0200)
* done integrating R'n'D graphics engine into file "BugsTerminals.c"

ChangeLog
src/conf_gfx.c
src/conftime.h
src/engines.h
src/game_sp/BugsTerminals.c
src/game_sp/Globals.h
src/game_sp/main.c
src/tools.c

index cb5ed1cdfc6af311ae167cd143ebb1c14acdaf86..b7f3fff323b9addfcef3204928ca72a6b85ab88e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,6 @@
 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
index 22cfe2ce7fc920bccdb92e193064d0941ef89c32..70a30912420ec2ca4b5fa4c2b152f1801fd651dd 100644 (file)
@@ -785,7 +785,8 @@ struct ConfigInfo image_config[] =
   { "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"                     },
index 4116b8f8acd700a986864a7775739a35530edc47..3b6fdb1824d35abab15e7f0d5cb5a9fb8392b7bd 100644 (file)
@@ -1 +1 @@
-#define COMPILE_DATE_STRING "2010-02-14 00:55"
+#define COMPILE_DATE_STRING "2010-02-14 23:30"
index 02d6119f65e82938aa4a7121a21c507242e96fdd..83368f0092131b2e123d2030582742a3b3e65960 100644 (file)
@@ -48,6 +48,8 @@ extern void SetBitmaps_SP(Bitmap **);
 
 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 */
index 374a6f48fd3050adf3ad657ab1c44b7b49d02c11..f12a1a0b64ce5da8fa6633afc9216235045f0e10 100644 (file)
@@ -28,16 +28,33 @@ int subAnimateBugs(int si)
 
   // 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)
   {
@@ -46,9 +63,15 @@ int subAnimateBugs(int si)
   }
 
   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;
@@ -81,8 +104,32 @@ 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;
index 54d7aaaa9c651fe1ef2b916bfbba13cc24e8d5b4..8762565c07b4579740c5be578e488c11d9e9a234 100644 (file)
 
 #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)
index 6282d507ddd31a7cf2dccbf3a098316b104f0317..1e874354a0e870e6fd2c96eb2db814cd557b2bb6 100644 (file)
@@ -13,6 +13,8 @@ void InitGameEngine_SP()
 {
   int x, y;
 
+  gfx.anim_random_frame = -1;  // (use simple, ad-hoc random numbers)
+
   game_sp_info.LevelSolved = FALSE;
   game_sp_info.GameOver = FALSE;
 
index b4f9fc4a4670d13192768205a74f66971fa3b28c..773a59db1efd0efbe2a2ab69b5d6cf566ff7c37a 100644 (file)
@@ -7738,17 +7738,21 @@ void InitGraphicInfo_EM(void)
 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;