X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Ftools.c;h=d37a7b0e991b821c3979602a3689758ccdf3504d;hb=ddaae9de458b7f07b05461101655a1da4c63b380;hp=a20e117759a785dd77bd709c53c3a49b6e998692;hpb=2bcba5d4d363ba2f58c9d3f22aba6a455522f499;p=rocksndiamonds.git diff --git a/src/tools.c b/src/tools.c index a20e1177..d37a7b0e 100644 --- a/src/tools.c +++ b/src/tools.c @@ -34,6 +34,7 @@ /* forward declaration for internal use */ static void UnmapToolButtons(); static void HandleToolButtons(struct GadgetInfo *); +static int el_act_dir2crm(int, int, int); static struct GadgetInfo *tool_gadget[NUM_TOOL_BUTTONS]; static int request_gadget_id = -1; @@ -503,6 +504,9 @@ inline void DrawLevelGraphicAnimationIfNeeded(int x, int y, int graphic) return; DrawGraphicAnimation(sx, sy, graphic); + + if (CAN_BE_CRUMBLED(Feld[x][y])) + DrawLevelFieldCrumbledSand(x, y); } void DrawLevelElementAnimationIfNeeded(int x, int y, int element) @@ -519,6 +523,9 @@ void DrawLevelElementAnimationIfNeeded(int x, int y, int element) return; DrawGraphicAnimation(sx, sy, graphic); + + if (CAN_BE_CRUMBLED(element)) + DrawLevelFieldCrumbledSand(x, y); } void DrawAllPlayers() @@ -658,9 +665,15 @@ void DrawPlayer(struct PlayerInfo *player) { if (player_is_moving && GfxElement[jx][jy] != EL_UNDEFINED) { +#if 1 + /* !!! insert DrawLevelFieldCrumbledSandDigging code here !!! */ + if (player->is_digging && CAN_BE_CRUMBLED(GfxElement[jx][jy])) + DrawLevelFieldCrumbledSandDigging(jx, jy, move_dir, player->StepFrame); +#else if (GfxElement[jx][jy] == EL_SAND) DrawLevelFieldCrumbledSandDigging(jx, jy, move_dir, player->StepFrame); - else +#endif + else /* player->is_collecting */ { int old_element = GfxElement[jx][jy]; int old_graphic = el_act_dir2img(old_element, action, move_dir); @@ -1298,14 +1311,21 @@ void DrawLevelFieldCrumbledSand(int x, int y) void DrawLevelFieldCrumbledSandDigging(int x, int y, int direction, int step_frame) { +#if 1 + int graphic1 = el_act_dir2img(GfxElement[x][y], ACTION_DIGGING, direction); + int graphic2 = el_act_dir2crm(GfxElement[x][y], ACTION_DIGGING, direction); +#else int graphic1 = el_act_dir2img(EL_SAND, ACTION_DIGGING, direction); int graphic2 = el_act_dir2img(EL_SAND_CRUMBLED, ACTION_DIGGING, direction); +#endif int frame1 = getGraphicAnimationFrame(graphic1, step_frame); int frame2 = getGraphicAnimationFrame(graphic2, step_frame); int sx = SCREENX(x), sy = SCREENY(y); DrawGraphic(sx, sy, graphic1, frame1); - DrawLevelFieldCrumbledSandExt(x, y, graphic2, frame2); + + if (graphic1 != IMG_EMPTY_SPACE) + DrawLevelFieldCrumbledSandExt(x, y, graphic2, frame2); } void DrawLevelFieldCrumbledSandNeighbours(int x, int y) @@ -2446,6 +2466,14 @@ int el_act_dir2img(int element, int action, int direction) return element_info[element].direction_graphic[action][direction]; } +static int el_act_dir2crm(int element, int action, int direction) +{ + element = GFX_ELEMENT(element); + direction = MV_DIR_BIT(direction); + + return element_info[element].direction_crumbled[action][direction]; +} + int el_act2img(int element, int action) { element = GFX_ELEMENT(element);