X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Ftools.c;h=e104066caaca3e41b39c0b45628c5facda42dceb;hb=871f79585ed487482fe670383d0020c04a5e8f74;hp=9d48e4b3ba1e7f6ee8a1747dd8cea42f56494645;hpb=44297fe468c13bcf4f8facc718a325d60531afc5;p=rocksndiamonds.git diff --git a/src/tools.c b/src/tools.c index 9d48e4b3..e104066c 100644 --- a/src/tools.c +++ b/src/tools.c @@ -1371,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]; } @@ -1525,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; @@ -1755,16 +1780,50 @@ void DrawMicroLevel(int xpos, int ypos, boolean restart) game_status = last_game_status; /* restore current game status */ } -int REQ_in_range(int x, int y) +void WaitForEventToContinue() { - if (y > DY+249 && y < DY+278) + boolean still_wait = TRUE; + + /* simulate releasing mouse button over last gadget, if still pressed */ + if (button_status) + HandleGadgets(-1, -1, 0); + + button_status = MB_RELEASED; + + while (still_wait) { - if (x > DX+1 && x < DX+48) - return 1; - else if (x > DX+51 && x < DX+98) - return 2; + if (PendingEvent()) + { + Event event; + + NextEvent(&event); + + switch (event.type) + { + case EVENT_BUTTONPRESS: + case EVENT_KEYPRESS: + still_wait = FALSE; + break; + + case EVENT_KEYRELEASE: + ClearPlayerAction(); + break; + + default: + HandleOtherEvents(&event); + break; + } + } + else if (AnyJoystickButton() == JOY_BUTTON_NEW_PRESSED) + { + still_wait = FALSE; + } + + DoAnimation(); + + /* don't eat all CPU time */ + Delay(10); } - return 0; } #define MAX_REQUEST_LINES 13 @@ -1776,6 +1835,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,7 +1949,9 @@ boolean Request(char *text, unsigned int req_state) SetDrawBackgroundMask(REDRAW_FIELD | REDRAW_DOOR_1); +#if 0 SetMouseCursor(CURSOR_DEFAULT); +#endif while(result < 0) {