rnd-20100207-2-src
authorHolger Schemel <info@artsoft.org>
Sun, 7 Feb 2010 15:12:37 +0000 (16:12 +0100)
committerHolger Schemel <info@artsoft.org>
Sat, 30 Aug 2014 08:58:25 +0000 (10:58 +0200)
src/conf_gfx.c
src/conf_var.c
src/conftime.h
src/engines.h
src/game.h
src/game_sp/BugsTerminals.c
src/game_sp/main.c
src/game_sp/main_sp.h
src/tools.c

index 8720cb69080394ba488a742a8fbb3a8aa0b2c8e9..b5d32eabfc06162d75afdd5509f95490a0e19c2f 100644 (file)
@@ -6362,6 +6362,7 @@ struct ConfigInfo image_config[] =
 
   { "game.forced_scroll_delay_value",          "-1"                    },
   { "game.use_native_emc_graphics_engine",     "false"                 },
+  { "game.use_native_sp_graphics_engine",      "true"                  },
   { "game.use_masked_pushing",                 "false"                 },
 
   { "[player].boring_delay_fixed",             "1000"                  },
index dc35009ec0e72ac8a3b31451e653b54c7e8292d2..a965464da41776354647305495ce7375a6db11cb 100644 (file)
@@ -5012,6 +5012,10 @@ struct TokenIntPtrInfo image_config_vars[] =
     "game.use_native_emc_graphics_engine",
     &game.use_native_emc_graphics_engine
   },
+  {
+    "game.use_native_sp_graphics_engine",
+    &game.use_native_sp_graphics_engine
+  },
   {
     "game.use_masked_pushing",
     &game.use_masked_pushing
index dd9f022d0a05b125538e16a4310872dc8b3444cd..22c49103e61c1670998d39cf4981cd6848c4b5b2 100644 (file)
@@ -1 +1 @@
-#define COMPILE_DATE_STRING "2010-02-07 00:45"
+#define COMPILE_DATE_STRING "2010-02-07 16:03"
index c844d300335fbcb798ad60f1ddc4d99cb02c6a7f..02d6119f65e82938aa4a7121a21c507242e96fdd 100644 (file)
@@ -47,6 +47,7 @@ void getGraphicSourcePlayerExt_EM(struct GraphicInfo_EM *, int, int, int);
 extern void SetBitmaps_SP(Bitmap **);
 
 void getGraphicSource_SP(struct GraphicInfo_SP *, int, int, int, int);
+int getGraphicInfo_Delay(int);
 
 
 #endif /* ENGINES_H */
index e6b3f396a293aa124a4518cf0012489a18664799..f6c93315ceefb04b9b371d8527cfd4f325f19774 100644 (file)
@@ -117,6 +117,7 @@ struct GameInfo
 
   /* values for graphics engine customization */
   boolean use_native_emc_graphics_engine;
+  boolean use_native_sp_graphics_engine;
   boolean use_masked_pushing;
   int forced_scroll_delay_value;
   int scroll_delay_value;
index 91b60de2a6279bc6fed8b8748f9520c41ecb5668..191ce52e25207f19f44d837e52f92e55ad8e3d0b 100644 (file)
@@ -100,9 +100,19 @@ int subAnimateTerminals(int si)
   int bl, al, X, Y;
 #endif
 
+#if 1
+  int lx = GetX(si);
+  int ly = GetY(si);
+  int graphic;
+#endif
+
   if (LowByte(PlayField16[si]) != fiTerminal)
     return subAnimateTerminals;
 
+  /* use native frame handling (undo frame incrementation in main loop) */
+  if (game.use_native_sp_graphics_engine)
+    GfxFrame[lx][ly]--;
+
   bl = HighByte(PlayField16[si]);
   if ((bl & 0x80) == 0x80)
     bl = (bl | 0xFF00);
@@ -111,7 +121,13 @@ int subAnimateTerminals(int si)
   if (bl <= 0)
   {
     MovHighByte(&PlayField16[si], bl);
+
+#if 1
+    if (game.use_native_sp_graphics_engine)
+      return subAnimateTerminals;
+#else
     return subAnimateTerminals;
+#endif
   }
 
   bl = -(subGetRandomNumber() & TerminalMaxCycles); // generate new random number
@@ -126,15 +142,20 @@ int subAnimateTerminals(int si)
     bl = 8;
   }
 
+#if 1
+  graphic = (bl < 8 ? IMG_SP_TERMINAL : IMG_SP_TERMINAL_ACTIVE);
+
+  if (game.use_native_sp_graphics_engine)
+    GfxFrame[lx][ly] += getGraphicInfo_Delay(graphic);
+#endif
+
   TerminalState[si] = bl;
   // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
   al = aniTerminal + bl;
   X = GetStretchX(si);
   Y = GetStretchY(si);
 #if 1
-  StretchedSprites.BltImg(X, Y,
-                         bl < 8 ? IMG_SP_TERMINAL : IMG_SP_TERMINAL_ACTIVE,
-                         FrameCounter);
+  StretchedSprites.BltImg(X, Y, graphic, GfxFrame[lx][ly]);
 #else
   StretchedSprites.BltEx(X, Y, al);
 #endif
index fb46ec87fc4b7d8e3a7a66dda268f96780273396..6282d507ddd31a7cf2dccbf3a098316b104f0317 100644 (file)
@@ -6,13 +6,22 @@
 struct GameInfo_SP game_sp_info;
 struct LevelInfo_SP native_sp_level;
 
+int GfxFrame[SP_MAX_PLAYFIELD_WIDTH][SP_MAX_PLAYFIELD_HEIGHT];
+
+
 void InitGameEngine_SP()
 {
+  int x, y;
+
   game_sp_info.LevelSolved = FALSE;
   game_sp_info.GameOver = FALSE;
 
   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++)
+      GfxFrame[x][y] = 0;
+
   InitScrollPlayfield();
 
 #if 0
@@ -51,8 +60,13 @@ void RedrawPlayfield_SP(boolean force_redraw)
 void GameActions_SP(byte action[MAX_PLAYERS], boolean warp_mode)
 {
   byte single_player_action = action[0];
+  int x, y;
 
   subMainGameLoop_Main(single_player_action, warp_mode);
 
   RedrawPlayfield_SP(FALSE);
+
+  for (x = 0; x < SP_MAX_PLAYFIELD_WIDTH; x++)
+    for (y = 0; y < SP_MAX_PLAYFIELD_HEIGHT; y++)
+      GfxFrame[x][y]++;
 }
index a83734cb2fba6c46e429d6cddea1c359c5a69ed6..8aa3f7fc705ffa018db01a24c2e4f81b894bdb66 100644 (file)
@@ -70,6 +70,8 @@ extern Bitmap *screenBitmap;
 
 extern Bitmap *sp_objects;
 
+extern int GfxFrame[SP_MAX_PLAYFIELD_WIDTH][SP_MAX_PLAYFIELD_HEIGHT];
+
 
 /* ------------------------------------------------------------------------- */
 /* exported functions                                                        */
index 18c5ca28f8c439934f25542eabae836d2ae96b7b..b4f9fc4a4670d13192768205a74f66971fa3b28c 100644 (file)
@@ -7749,6 +7749,11 @@ void getGraphicSource_SP(struct GraphicInfo_SP *g_sp,
   getGraphicSource(graphic, frame, &g_sp->bitmap, &g_sp->src_x, &g_sp->src_y);
 }
 
+int getGraphicInfo_Delay(int graphic)
+{
+  return graphic_info[graphic].anim_delay;
+}
+
 void PlayMenuSoundExt(int sound)
 {
   if (sound == SND_UNDEFINED)