rnd-20070224-2-src
authorHolger Schemel <info@artsoft.org>
Sat, 24 Feb 2007 18:49:14 +0000 (19:49 +0100)
committerHolger Schemel <info@artsoft.org>
Sat, 30 Aug 2014 08:54:36 +0000 (10:54 +0200)
* fixed minor bug (screen redraw of player tiles) in EMC graphics engine

ChangeLog
src/conftime.h
src/engines.h
src/game_em/graphics.c
src/tools.c

index ec57d7ddab33fd46e121e52bbc3fde8c5b724656..0813cd6a4dc0278b68bb6a0eadb71ab23ea141e6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,7 @@
 2007-02-24
+       * fixed minor bug (screen redraw of player tiles) in EMC graphics engine
+
+2007-02-23
        * fixed bug in "InitMovingField()" where treating an integer array as
          boolean caused wrong resetting of animations while elements are moving
        * fixed problem with resetting animations when starting element change
index 3d5d53f5238ee94d97c88030af797f0b44fccd15..7c5381426ed0f08436b99c3d9993e8c39e157274 100644 (file)
@@ -1 +1 @@
-#define COMPILE_DATE_STRING "2007-02-24 02:52"
+#define COMPILE_DATE_STRING "2007-02-24 19:44"
index 4f894e926880cbf2646f359dc095add5367669ec..d01e5fa4102557318d040fad391ed7649e5c91fb 100644 (file)
@@ -33,4 +33,6 @@ 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 *);
+
 #endif /* ENGINES_H */
index 21ca0964ec8bfbeebc4bc190137ee2db6f07710d..c3d365407b9e53406c93e6149300c8bf5fa37ec5 100644 (file)
@@ -248,6 +248,11 @@ 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);
+#endif
+
   int src_x = g->src_x, src_y = g->src_y;
   int dst_x, dst_y;
 
@@ -452,9 +457,14 @@ static void blitplayer(struct PLAYER *ply)
       DrawLevelField_EM(new_x, new_y, new_sx, new_sy, TRUE);
     }
 
-    /* mark screen tiles as dirty */
+    /* redraw screen tiles in the next frame (player may have left the tiles) */
     screentiles[old_sy][old_sx] = -1;
     screentiles[new_sy][new_sx] = -1;
+
+    /* mark screen tiles as dirty (force screen refresh with changed content) */
+    redraw[old_sx][old_sy] = TRUE;
+    redraw[new_sx][new_sy] = TRUE;
+    redraw_tiles += 2;
   }
 }
 
index 62965af09d2df0e90ce0f15107f6e4c2d9453fe6..b0e419f6e6485c50ef051e6c5765eb687888cb69 100644 (file)
@@ -5725,10 +5725,67 @@ unsigned int InitRND(long seed)
     return InitEngineRandom_RND(seed);
 }
 
+#if 1
+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)
+{
+  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;
+
+  InitPlayerGfxAnimation(&stored_player[player_nr], action, direction);
+
+#if 0
+  printf("::: %d: %d, %d [%d]\n",
+        player_nr,
+        stored_player[player_nr].Frame,
+        stored_player[player_nr].StepFrame,
+        FrameCounter);
+#endif
+
+  sync_frame = stored_player[player_nr].Frame;
+
+  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);
+
+#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)
 {
+#if 0
   struct Mapping_EM_to_RND_object object_mapping[TILE_MAX];
   struct Mapping_EM_to_RND_player player_mapping[MAX_PLAYERS][SPR_MAX];
+#endif
   int i, j, p;
 
 #if DEBUG_EM_GFX
@@ -6275,7 +6332,7 @@ void InitGraphicInfo_EM(void)
                                      g->anim_start_frame,
                                      sync_frame);
 
-       getGraphicSourceExt(graphic, frame, &src_bitmap, &src_x,&src_y, FALSE);
+       getGraphicSourceExt(graphic, frame, &src_bitmap, &src_x, &src_y, FALSE);
 
        g_em->bitmap = src_bitmap;
        g_em->src_x = src_x;