X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Ftools.c;h=d50b99dd3d23b79d09f4b142a573fc6ec869e852;hb=86b0ea5594dc5a9db7ac5d71fa2b7487a4fc1f9d;hp=d37a7b0e991b821c3979602a3689758ccdf3504d;hpb=ddaae9de458b7f07b05461101655a1da4c63b380;p=rocksndiamonds.git diff --git a/src/tools.c b/src/tools.c index d37a7b0e..d50b99dd 100644 --- a/src/tools.c +++ b/src/tools.c @@ -599,6 +599,10 @@ void DrawPlayer(struct PlayerInfo *player) player->is_moving ? ACTION_MOVING : player->snapped ? ACTION_SNAPPING : ACTION_DEFAULT); +#if 0 + printf("::: '%s'\n", element_action_info[action].suffix); +#endif + InitPlayerGfxAnimation(player, action, move_dir); /* ----------------------------------------------------------------------- */ @@ -666,14 +670,13 @@ 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])) + if (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); #endif - else /* player->is_collecting */ + else { int old_element = GfxElement[jx][jy]; int old_graphic = el_act_dir2img(old_element, action, move_dir); @@ -1323,9 +1326,7 @@ void DrawLevelFieldCrumbledSandDigging(int x, int y, int direction, int sx = SCREENX(x), sy = SCREENY(y); DrawGraphic(sx, sy, graphic1, frame1); - - if (graphic1 != IMG_EMPTY_SPACE) - DrawLevelFieldCrumbledSandExt(x, y, graphic2, frame2); + DrawLevelFieldCrumbledSandExt(x, y, graphic2, frame2); } void DrawLevelFieldCrumbledSandNeighbours(int x, int y) @@ -1370,12 +1371,12 @@ static int getBorderElement(int x, int y) { EL_STEELWALL, EL_INVISIBLE_STEELWALL } }; int steel_type = (BorderElement == EL_STEELWALL ? 0 : 1); - int steel_position = (x == -1 && y == -1 ? 0 : - x == lev_fieldx && y == -1 ? 1 : - x == -1 && y == lev_fieldy ? 2 : - x == lev_fieldx && y == lev_fieldy ? 3 : - x == -1 || x == lev_fieldx ? 4 : - y == -1 || y == lev_fieldy ? 5 : 6); + int steel_position = (x == -1 && y == -1 ? 0 : + x == lev_fieldx && y == -1 ? 1 : + x == -1 && y == lev_fieldy ? 2 : + x == lev_fieldx && y == lev_fieldy ? 3 : + x == -1 || x == lev_fieldx ? 4 : + y == -1 || y == lev_fieldy ? 5 : 6); return border[steel_position][steel_type]; } @@ -1524,6 +1525,31 @@ void DrawMiniElementOrWall(int sx, int sy, int scroll_x, int scroll_y) DrawMiniGraphic(sx, sy, el2edimg(getBorderElement(x, y))); } +void DrawEnvelopeBorder(int sx, int sy, int ex, int ey) +{ + int border[8][2] = + { + { EL_STEELWALL_TOPLEFT, EL_INVISIBLE_STEELWALL_TOPLEFT }, + { EL_STEELWALL_TOPRIGHT, EL_INVISIBLE_STEELWALL_TOPRIGHT }, + { EL_STEELWALL_BOTTOMLEFT, EL_INVISIBLE_STEELWALL_BOTTOMLEFT }, + { EL_STEELWALL_BOTTOMRIGHT, EL_INVISIBLE_STEELWALL_BOTTOMRIGHT }, + { EL_STEELWALL_VERTICAL, EL_INVISIBLE_STEELWALL_VERTICAL }, + { EL_STEELWALL_HORIZONTAL, EL_INVISIBLE_STEELWALL_HORIZONTAL }, + { EL_STEELWALL, EL_INVISIBLE_STEELWALL }, + { EL_EMPTY, EL_EMPTY } + }; + int steel_type = (BorderElement == EL_STEELWALL ? 0 : 1); + int steel_position = (ex == -1 && ey == -1 ? 0 : + ex == +1 && ey == -1 ? 1 : + ex == -1 && ey == +1 ? 2 : + ex == +1 && ey == +1 ? 3 : + ex == -1 || ex == +1 ? 4 : + ey == -1 || ey == +1 ? 5 : 7); + int element = border[steel_position][steel_type]; + + DrawMiniGraphic(sx, sy, el2edimg(element)); +} + void getMicroGraphicSource(int graphic, Bitmap **bitmap, int *x, int *y) { Bitmap *src_bitmap = graphic_info[graphic].bitmap; @@ -1637,8 +1663,7 @@ static void DrawMicroLevelLabelExt(int mode) if (strlen(label_text) > 0) { - int text_width = strlen(label_text) * getFontWidth(font_nr); - int lxpos = SX + (SXSIZE - text_width) / 2; + int lxpos = SX + (SXSIZE - getTextWidth(label_text, font_nr)) / 2; int lypos = MICROLABEL_YPOS; DrawText(lxpos, lypos, label_text, font_nr); @@ -1674,8 +1699,8 @@ void DrawMicroLevel(int xpos, int ypos, boolean restart) if (leveldir_current->name) { - int len = strlen(leveldir_current->name); - int lxpos = SX + (SXSIZE - len * getFontWidth(FONT_TEXT_1)) / 2; + int text_width = getTextWidth(leveldir_current->name, FONT_TEXT_1); + int lxpos = SX + (SXSIZE - text_width) / 2; int lypos = SY + 352; DrawText(lxpos, lypos, leveldir_current->name, FONT_TEXT_1); @@ -1776,6 +1801,10 @@ boolean Request(char *text, unsigned int req_state) unsigned int old_door_state; int last_game_status = game_status; /* save current game status */ +#if 1 + SetMouseCursor(CURSOR_DEFAULT); +#endif + #if defined(PLATFORM_UNIX) /* pause network game while waiting for request to answer */ if (options.network && @@ -1886,6 +1915,10 @@ boolean Request(char *text, unsigned int req_state) SetDrawBackgroundMask(REDRAW_FIELD | REDRAW_DOOR_1); +#if 0 + SetMouseCursor(CURSOR_DEFAULT); +#endif + while(result < 0) { if (PendingEvent())