From: Holger Schemel Date: Mon, 26 Feb 2007 01:32:57 +0000 (+0100) Subject: rnd-20070226-1-src X-Git-Tag: 3.2.4^2~82 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=8758e1099fab693460be47636e56c779fceec08b;p=rocksndiamonds.git rnd-20070226-1-src --- diff --git a/src/conftime.h b/src/conftime.h index 7c538142..59a6e932 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "2007-02-24 19:44" +#define COMPILE_DATE_STRING "2007-02-26 02:31" diff --git a/src/engines.h b/src/engines.h index d01e5fa4..02061f79 100644 --- a/src/engines.h +++ b/src/engines.h @@ -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 */ diff --git a/src/game_em/graphics.c b/src/game_em/graphics.c index c3d36540..2d8188f1 100644 --- a/src/game_em/graphics.c +++ b/src/game_em/graphics.c @@ -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); diff --git a/src/tools.c b/src/tools.c index b0e419f6..f7305299 100644 --- a/src/tools.c +++ b/src/tools.c @@ -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)