rnd-20070226-1-src
authorHolger Schemel <info@artsoft.org>
Mon, 26 Feb 2007 01:32:57 +0000 (02:32 +0100)
committerHolger Schemel <info@artsoft.org>
Sat, 30 Aug 2014 08:54:38 +0000 (10:54 +0200)
src/conftime.h
src/engines.h
src/game_em/graphics.c
src/tools.c

index 7c5381426ed0f08436b99c3d9993e8c39e157274..59a6e932c3ff3f836f87a4a86a9d2838db6de45b 100644 (file)
@@ -1 +1 @@
-#define COMPILE_DATE_STRING "2007-02-24 19:44"
+#define COMPILE_DATE_STRING "2007-02-26 02:31"
index d01e5fa4102557318d040fad391ed7649e5c91fb..02061f7950bbd12259a483205895b3e1f99065e4 100644 (file)
@@ -33,6 +33,7 @@ extern int getGameFrameDelay_EM(int);
 extern void PlayLevelSound_EM(int, int, int, int);
 extern void InitGraphicInfo_EM(void);
 
-void getGraphicSourceExt_EM(int, int, int, Bitmap **, int *, int *);
+void getGraphicSourceObjectExt_EM(int, int, Bitmap **, int *, int *);
+void getGraphicSourcePlayerExt_EM(int, int, int, Bitmap **, int *, int *);
 
 #endif /* ENGINES_H */
index c3d365407b9e53406c93e6149300c8bf5fa37ec5..2d8188f188320850fb6b63bd19972445ee841de8 100644 (file)
@@ -148,6 +148,11 @@ static void DrawLevelField_EM(int x, int y, int sx, int sy,
 {
   int tile = Draw[y][x];
   struct GraphicInfo_EM *g = &graphic_info_em_object[tile][frame];
+
+#if 1
+  getGraphicSourceObjectExt_EM(tile, frame, &g->bitmap, &g->src_x, &g->src_y);
+#endif
+
   int src_x = g->src_x + g->src_offset_x;
   int src_y = g->src_y + g->src_offset_y;
   int dst_x = sx * TILEX + g->dst_offset_x;
@@ -249,8 +254,8 @@ static void DrawLevelPlayer_EM(int x1, int y1, int player_nr, int anim,
   struct GraphicInfo_EM *g = &graphic_info_em_player[player_nr][anim][frame];
 
 #if 1
-  getGraphicSourceExt_EM(player_nr, anim, frame,
-                        &g->bitmap, &g->src_x, &g->src_y);
+  getGraphicSourcePlayerExt_EM(player_nr, anim, frame,
+                              &g->bitmap, &g->src_x, &g->src_y);
 #endif
 
   int src_x = g->src_x, src_y = g->src_y;
@@ -362,7 +367,7 @@ static void animscreen(void)
       }
 
       /* only redraw screen tiles if they (or their crumbled state) changed */
-      if (screentiles[sy][sx] != obj || crumbled_state[sy][sx] != crm)
+      // if (screentiles[sy][sx] != obj || crumbled_state[sy][sx] != crm)
       {
        DrawLevelField_EM(x, y, sx, sy, FALSE);
        DrawLevelFieldCrumbled_EM(x, y, sx, sy, crm, FALSE);
index b0e419f6e6485c50ef051e6c5765eb687888cb69..f730529956853b6397486378f7b5f956c80017d3 100644 (file)
@@ -5730,25 +5730,63 @@ static struct Mapping_EM_to_RND_object object_mapping[TILE_MAX];
 static struct Mapping_EM_to_RND_player player_mapping[MAX_PLAYERS][SPR_MAX];
 #endif
 
-void getGraphicSourceExt_EM(int player_nr, int anim, int frame_em,
-                           Bitmap **src_bitmap, int *src_x, int *src_y)
+void ResetGfxAnimation_EM(int x, int y, int tile)
 {
-  int element = player_mapping[player_nr][anim].element_rnd;
-  int action = player_mapping[player_nr][anim].action;
-  int direction = player_mapping[player_nr][anim].direction;
+  GfxFrame[x][y] = 0;
+}
+
+void getGraphicSourceObjectExt_EM(int tile, int frame_em,
+                                 Bitmap **src_bitmap, int *src_x, int *src_y)
+{
+  int element         = object_mapping[tile].element_rnd;
+  int action          = object_mapping[tile].action;
+  int direction       = object_mapping[tile].direction;
+  boolean is_backside = object_mapping[tile].is_backside;
+  boolean action_removing = (action == ACTION_DIGGING ||
+                            action == ACTION_SNAPPING ||
+                            action == ACTION_COLLECTING);
+  int effective_element = (frame_em > 0 ? element :
+                          is_backside ? EL_EMPTY :
+                          action_removing ? EL_EMPTY :
+                          element);
+  int graphic = (direction == MV_NONE ?
+                el_act2img(effective_element, action) :
+                el_act_dir2img(effective_element, action, direction));
+  struct GraphicInfo *g = &graphic_info[graphic];
+  int sync_frame;
+
+  if (graphic_info[graphic].anim_global_sync)
+    sync_frame = FrameCounter;
+  else
+    sync_frame = 7 - frame_em;
+
+  int frame = getAnimationFrame(g->anim_frames,
+                               g->anim_delay,
+                               g->anim_mode,
+                               g->anim_start_frame,
+                               sync_frame);
+
+  getGraphicSourceExt(graphic, frame, src_bitmap, src_x, src_y, FALSE);
+}
 
+void getGraphicSourcePlayerExt_EM(int player_nr, int anim, int frame_em,
+                                 Bitmap **src_bitmap, int *src_x, int *src_y)
+{
+  int element   = player_mapping[player_nr][anim].element_rnd;
+  int action    = player_mapping[player_nr][anim].action;
+  int direction = player_mapping[player_nr][anim].direction;
   int graphic = (direction == MV_NONE ?
                 el_act2img(element, action) :
                 el_act_dir2img(element, action, direction));
   struct GraphicInfo *g = &graphic_info[graphic];
-  // struct GraphicInfo_EM *g_em = &graphic_info_em_player[p][i][7 - j];
-  // Bitmap *src_bitmap;
-  // int src_x, src_y;
-  // int sync_frame = j;
-  int sync_frame = 7 - frame_em;
+  int sync_frame;
 
   InitPlayerGfxAnimation(&stored_player[player_nr], action, direction);
 
+  stored_player[player_nr].StepFrame = 7 - frame_em;
+
+  sync_frame = stored_player[player_nr].Frame;
+
 #if 0
   printf("::: %d: %d, %d [%d]\n",
         player_nr,
@@ -5757,8 +5795,6 @@ void getGraphicSourceExt_EM(int player_nr, int anim, int frame_em,
         FrameCounter);
 #endif
 
-  sync_frame = stored_player[player_nr].Frame;
-
   int frame = getAnimationFrame(g->anim_frames,
                                g->anim_delay,
                                g->anim_mode,
@@ -5766,18 +5802,6 @@ void getGraphicSourceExt_EM(int player_nr, int anim, int frame_em,
                                sync_frame);
 
   getGraphicSourceExt(graphic, frame, src_bitmap, src_x, src_y, FALSE);
-
-#if 0
-  g_em->bitmap = src_bitmap;
-  g_em->src_x = src_x;
-  g_em->src_y = src_y;
-  g_em->src_offset_x = 0;
-  g_em->src_offset_y = 0;
-  g_em->dst_offset_x = 0;
-  g_em->dst_offset_y = 0;
-  g_em->width  = TILEX;
-  g_em->height = TILEY;
-#endif
 }
 
 void InitGraphicInfo_EM(void)