{
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;
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;
}
/* 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);
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,
FrameCounter);
#endif
- sync_frame = stored_player[player_nr].Frame;
-
int frame = getAnimationFrame(g->anim_frames,
g->anim_delay,
g->anim_mode,
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)