From: Holger Schemel Date: Sat, 11 Jan 2025 19:50:21 +0000 (+0100) Subject: added support for BD player graphic with bomb or rocket turning back X-Git-Tag: 4.4.0.1~21 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=73b24e852e1dc0fe71cf3b8065049b80de2a31ef;p=rocksndiamonds.git added support for BD player graphic with bomb or rocket turning back This adds an optional animation for one BD engine iteration cycle between moving player and waiting player, carrying a bomb or a rocket launcher (using ".turning" action definition for "player is turning back to the default waiting position after moving in any direction"). --- diff --git a/src/conf_gfx.c b/src/conf_gfx.c index a1f56f9b..60f8969e 100644 --- a/src/conf_gfx.c +++ b/src/conf_gfx.c @@ -396,11 +396,15 @@ struct ConfigInfo image_config[] = { "bdx_player_with_bomb.xpos", "8" }, { "bdx_player_with_bomb.ypos", "7" }, { "bdx_player_with_bomb.frames", "1" }, + { "bdx_player_with_bomb.turning", UNDEFINED_FILENAME }, + { "bdx_player_with_bomb.turning.clone_from", "bdx_player_with_bomb" }, { "bdx_player_with_rocket_launcher", "RocksBD.png" }, { "bdx_player_with_rocket_launcher.xpos", "10" }, { "bdx_player_with_rocket_launcher.ypos", "7" }, { "bdx_player_with_rocket_launcher.frames", "1" }, + { "bdx_player_with_rocket_launcher.turning", UNDEFINED_FILENAME }, + { "bdx_player_with_rocket_launcher.turning.clone_from", "bdx_player_with_rocket_launcher" }, { "bdx_player_stirring", "RocksBD.png" }, { "bdx_player_stirring.xpos", "8" }, diff --git a/src/game_bd/bd_cave.c b/src/game_bd/bd_cave.c index 2f7a9d80..6fec4dd6 100644 --- a/src/game_bd/bd_cave.c +++ b/src/game_bd/bd_cave.c @@ -1620,6 +1620,16 @@ void gd_drawcave_game(const GdCave *cave, elemmapping[O_PLAYER_ROCKET_LAUNCHER] = map; elemdrawing[O_PLAYER_ROCKET_LAUNCHER] = draw; } + else if (cave->last_direction_2nd != GD_MV_STILL) + { + // player with bomb/rocketlauncher which just stopped moving may have separate graphics + + elemmapping[O_PLAYER_BOMB] = O_PLAYER_BOMB_TURNING; + elemdrawing[O_PLAYER_BOMB] = gd_element_properties[O_PLAYER_BOMB_TURNING].image_game; + + elemmapping[O_PLAYER_ROCKET_LAUNCHER] = O_PLAYER_ROCKET_LAUNCHER_TURNING; + elemdrawing[O_PLAYER_ROCKET_LAUNCHER] = gd_element_properties[O_PLAYER_ROCKET_LAUNCHER_TURNING].image_game; + } elemmapping[O_INBOX] = (cave->inbox_flash_toggle ? O_INBOX_OPEN : diff --git a/src/game_bd/bd_cavedb.c b/src/game_bd/bd_cavedb.c index 8ee0eddf..7adf35f6 100644 --- a/src/game_bd/bd_cavedb.c +++ b/src/game_bd/bd_cavedb.c @@ -1969,6 +1969,16 @@ GdElementProperty gd_element_properties[] = P_PLAYER | P_PLAYER_PUSHING, NULL, 0, 400, -400, -400 }, + { + O_PLAYER_BOMB_TURNING, O_PLAYER_BOMB_TURNING, N_("Player with bomb (turning)"), + P_PLAYER, + NULL, 0, 42, 42, 42, + }, + { + O_PLAYER_ROCKET_LAUNCHER_TURNING, O_PLAYER_ROCKET_LAUNCHER_TURNING, N_("Player with rocket launcher (turning)"), + P_PLAYER, + NULL, 0, 369, 369, 369, + }, { O_CREATURE_SWITCH_ON, O_CREATURE_SWITCH_ON, NULL, 0, diff --git a/src/game_bd/bd_elements.h b/src/game_bd/bd_elements.h index 13cb0a4a..e6dee3b2 100644 --- a/src/game_bd/bd_elements.h +++ b/src/game_bd/bd_elements.h @@ -414,6 +414,8 @@ typedef enum _element O_PLAYER_TAP_BLINK, O_PLAYER_PUSH_LEFT, O_PLAYER_PUSH_RIGHT, + O_PLAYER_BOMB_TURNING, + O_PLAYER_ROCKET_LAUNCHER_TURNING, O_CREATURE_SWITCH_ON, O_EXPANDING_WALL_SWITCH_HORIZ, O_EXPANDING_WALL_SWITCH_VERT, diff --git a/src/game_bd/bd_graphics.c b/src/game_bd/bd_graphics.c index 342ee986..bb45331e 100644 --- a/src/game_bd/bd_graphics.c +++ b/src/game_bd/bd_graphics.c @@ -849,6 +849,11 @@ static void gd_drawcave_tile(Bitmap *dest, GdGame *game, int x, int y, boolean d if (!is_moving || !use_smooth_movements) { struct GraphicInfo_BD *g = &graphic_info_bd_object[draw][frame]; + int itercycle_capped = MIN(game->itercycle * 8 / game->itermax, 7); + + if (draw == O_PLAYER_BOMB_TURNING || + draw == O_PLAYER_ROCKET_LAUNCHER_TURNING) + g = &graphic_info_bd_object[draw][itercycle_capped]; if (el_is_crumbled(draw)) gd_drawcave_crumbled(dest, game, x, y, draw_masked); diff --git a/src/tools.c b/src/tools.c index abefd61c..771923df 100644 --- a/src/tools.c +++ b/src/tools.c @@ -8007,6 +8007,14 @@ bd_object_mapping_list[] = O_PLAYER_PUSH_RIGHT, FALSE, EL_BDX_PLAYER, ACTION_PUSHING, MV_BIT_RIGHT }, + { + O_PLAYER_BOMB_TURNING, FALSE, + EL_BDX_PLAYER_WITH_BOMB, ACTION_TURNING, -1 + }, + { + O_PLAYER_ROCKET_LAUNCHER_TURNING, FALSE, + EL_BDX_PLAYER_WITH_ROCKET_LAUNCHER, ACTION_TURNING, -1 + }, { O_CREATURE_SWITCH_ON, FALSE, EL_BDX_CREATURE_SWITCH_ACTIVE, -1, -1 @@ -11365,7 +11373,9 @@ void InitGraphicInfo_BD(void) e == O_DIRT2_DIGGING_LEFT_CRUMBLED || e == O_DIRT2_DIGGING_RIGHT_CRUMBLED || e == O_DIRT2_DIGGING_UP_CRUMBLED || - e == O_DIRT2_DIGGING_DOWN_CRUMBLED ? j : + e == O_DIRT2_DIGGING_DOWN_CRUMBLED || + e == O_PLAYER_BOMB_TURNING || + e == O_PLAYER_ROCKET_LAUNCHER_TURNING ? j : j * 2); int frame = getAnimationFrame(g->anim_frames, g->anim_delay,