From: Holger Schemel Date: Sat, 24 Feb 2007 18:49:14 +0000 (+0100) Subject: rnd-20070224-2-src X-Git-Tag: 3.2.4^2~83 X-Git-Url: https://git.artsoft.org/?p=rocksndiamonds.git;a=commitdiff_plain;h=96e81193abbb278dd3b79d109ff99d061fe43973 rnd-20070224-2-src * fixed minor bug (screen redraw of player tiles) in EMC graphics engine --- diff --git a/ChangeLog b/ChangeLog index ec57d7dd..0813cd6a 100644 --- 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 diff --git a/src/conftime.h b/src/conftime.h index 3d5d53f5..7c538142 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "2007-02-24 02:52" +#define COMPILE_DATE_STRING "2007-02-24 19:44" diff --git a/src/engines.h b/src/engines.h index 4f894e92..d01e5fa4 100644 --- a/src/engines.h +++ b/src/engines.h @@ -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 */ diff --git a/src/game_em/graphics.c b/src/game_em/graphics.c index 21ca0964..c3d36540 100644 --- a/src/game_em/graphics.c +++ b/src/game_em/graphics.c @@ -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; } } diff --git a/src/tools.c b/src/tools.c index 62965af0..b0e419f6 100644 --- a/src/tools.c +++ b/src/tools.c @@ -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;