From 524cb50afe3b330d72c8d0487f3db251f8ffd7e8 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Sat, 22 Jan 2005 18:21:42 +0100 Subject: [PATCH] rnd-20050122-2-src --- src/conftime.h | 2 +- src/game_em/graphics.c | 2 +- src/game_em/main_em.h | 4 +- src/game_em/tab_generate.c | 4 +- src/tools.c | 106 ++++++++++++++++++++++++++++++++++++- 5 files changed, 113 insertions(+), 5 deletions(-) diff --git a/src/conftime.h b/src/conftime.h index 95a65b29..ab86a087 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "[2005-01-22 17:10]" +#define COMPILE_DATE_STRING "[2005-01-22 18:19]" diff --git a/src/game_em/graphics.c b/src/game_em/graphics.c index 93100cb3..bd933175 100644 --- a/src/game_em/graphics.c +++ b/src/game_em/graphics.c @@ -96,7 +96,7 @@ static void DrawLevelField_EM(int x, int y, int sx, int sy, } else { - if (width != TILEX || height != TILEY) + if ((width != TILEX || height != TILEY) && !g->preserve_background) ClearRectangle(screenBitmap, sx * TILEX, sy * TILEY, TILEX, TILEY); if (width > 0 && height > 0) diff --git a/src/game_em/main_em.h b/src/game_em/main_em.h index a34f10fd..1cc7a5b5 100644 --- a/src/game_em/main_em.h +++ b/src/game_em/main_em.h @@ -655,11 +655,13 @@ struct GraphicInfo_EM int dst_offset_x, dst_offset_y; int width, height; - boolean has_crumbled_graphics; Bitmap *crumbled_bitmap; int crumbled_src_x, crumbled_src_y; int crumbled_border_size; + boolean has_crumbled_graphics; + boolean preserve_background; + int unique_identifier; /* used to identify needed screen updates */ }; diff --git a/src/game_em/tab_generate.c b/src/game_em/tab_generate.c index 7ed460c0..75c47b37 100644 --- a/src/game_em/tab_generate.c +++ b/src/game_em/tab_generate.c @@ -4602,12 +4602,14 @@ void create_obj_graphics_info_em() g->width = TILEX; g->height = TILEY; - g->has_crumbled_graphics = FALSE; g->crumbled_bitmap = NULL; g->crumbled_src_x = 0; g->crumbled_src_y = 0; g->crumbled_border_size = 0; + g->has_crumbled_graphics = FALSE; + g->preserve_background = FALSE; + /* create unique graphic identifier to decide if tile must be redrawn */ g->unique_identifier = obj; } diff --git a/src/tools.c b/src/tools.c index 33158a48..05a1293b 100644 --- a/src/tools.c +++ b/src/tools.c @@ -5947,11 +5947,13 @@ void InitGraphicInfo_EM(void) g_em->width = TILEX; g_em->height = TILEY; - g_em->has_crumbled_graphics = FALSE; g_em->crumbled_bitmap = NULL; g_em->crumbled_src_x = 0; g_em->crumbled_src_y = 0; g_em->crumbled_border_size = 0; + + g_em->has_crumbled_graphics = FALSE; + g_em->preserve_background = FALSE; #endif #if 0 @@ -6030,6 +6032,76 @@ void InitGraphicInfo_EM(void) g_em->width = TILEX - cx * step; g_em->height = TILEY - cy * step; } + +#if 0 + if (effective_action == ACTION_SMASHED_BY_ROCK && + element_info[effective_element].graphic[effective_action] == + element_info[effective_element].graphic[ACTION_DEFAULT]) + { + int move_dir = MV_DOWN; + int dx = (move_dir == MV_LEFT ? -1 : move_dir == MV_RIGHT ? 1 : 0); + int dy = (move_dir == MV_UP ? -1 : move_dir == MV_DOWN ? 1 : 0); + int num_steps = 8; + int cx = ABS(dx) * (TILEX / num_steps); + int cy = ABS(dy) * (TILEY / num_steps); + int step_frame = j + 1; + int step = (is_backside ? step_frame : num_steps - step_frame); + + graphic = (el_act_dir2img(EL_ROCK, ACTION_FALLING, MV_DOWN)); + g = &graphic_info[graphic]; + sync_frame = j; + 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, + g->double_movement && is_backside); + + 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; + + if (is_backside) /* tile where movement starts */ + { + if (dx < 0 || dy < 0) + { + g_em->src_offset_x = cx * step; + g_em->src_offset_y = cy * step; + } + else + { + g_em->dst_offset_x = cx * step; + g_em->dst_offset_y = cy * step; + } + } + else /* tile where movement ends */ + { + if (dx < 0 || dy < 0) + { + g_em->dst_offset_x = cx * step; + g_em->dst_offset_y = cy * step; + } + else + { + g_em->src_offset_x = cx * step; + g_em->src_offset_y = cy * step; + } + } + + g_em->width = TILEX - cx * step; + g_em->height = TILEY - cy * step; + +#if 0 + printf("::: -> '%s'\n", element_info[effective_element].token_name); +#endif + } +#endif + #endif /* create unique graphic identifier to decide if tile must be redrawn */ @@ -6103,6 +6175,38 @@ void InitGraphicInfo_EM(void) } } +#if 1 + for (i = 0; i < TILE_MAX; i++) + { + for (j = 0; j < 8; j++) + { + int element = object_mapping[i].element_rnd; + int action = object_mapping[i].action; + + if (action == ACTION_SMASHED_BY_ROCK && + element_info[element].graphic[action] == + element_info[element].graphic[ACTION_DEFAULT]) + { + /* no separate animation for "smashed by rock" -- use rock instead */ + struct GraphicInfo_EM *g_em = &graphic_info_em_object[i][7 - j]; + struct GraphicInfo_EM *g_xx = &graphic_info_em_object[Ystone_s][7 - j]; + + g_em->bitmap = g_xx->bitmap; + g_em->src_x = g_xx->src_x; + g_em->src_y = g_xx->src_y; + g_em->src_offset_x = g_xx->src_offset_x; + g_em->src_offset_y = g_xx->src_offset_y; + g_em->dst_offset_x = g_xx->dst_offset_x; + g_em->dst_offset_y = g_xx->dst_offset_y; + g_em->width = g_xx->width; + g_em->height = g_xx->height; + + g_em->preserve_background = TRUE; + } + } + } +#endif + for (p = 0; p < 2; p++) { for (i = 0; i < SPR_MAX; i++) -- 2.34.1