X-Git-Url: https://git.artsoft.org/?p=rocksndiamonds.git;a=blobdiff_plain;f=src%2Ftools.c;h=76b40a291272a7c899ca1fba7c003f69ccfcf72b;hp=87478255cfe81a26d71ce89f7c9ea41906b22041;hb=6dd55346a5d7a35592294313893c14e0641e15ae;hpb=c34ad545e013f2ef70e98ca11663f279a77fd422 diff --git a/src/tools.c b/src/tools.c index 87478255..76b40a29 100644 --- a/src/tools.c +++ b/src/tools.c @@ -5150,11 +5150,14 @@ unsigned int MoveDoor(unsigned int door_state) { /* wait for specified door action post delay */ if (door_state & DOOR_ACTION_1 && door_state & DOOR_ACTION_2) - Delay(MAX(door_1.post_delay, door_2.post_delay)); + door_delay_value = MAX(door_1.post_delay, door_2.post_delay); else if (door_state & DOOR_ACTION_1) - Delay(door_1.post_delay); + door_delay_value = door_1.post_delay; else if (door_state & DOOR_ACTION_2) - Delay(door_2.post_delay); + door_delay_value = door_2.post_delay; + + while (!DelayReached(&door_delay, door_delay_value)) + BackToFront(); } } @@ -5309,11 +5312,49 @@ void CreateToolButtons() int gd_y = gfx->src_y; int gd_xp = gfx->src_x + gfx->pressed_xoffset; int gd_yp = gfx->src_y + gfx->pressed_yoffset; + int x = pos->x; + int y = pos->y; int id = i; if (global.use_envelope_request) + { setRequestPosition(&dx, &dy, TRUE); + // check if request buttons are outside of envelope and fix, if needed + if (x < 0 || x + gfx->width > request.width || + y < 0 || y + gfx->height > request.height) + { + // use left padding of "yes" button as default border padding + int padding = toolbutton_info[TOOL_CTRL_ID_YES].pos->x; + + if (id == TOOL_CTRL_ID_YES) + { + x = padding; + y = request.height - 2 * request.border_size - gfx->height - padding; + } + else if (id == TOOL_CTRL_ID_NO) + { + x = request.width - 2 * request.border_size - gfx->width - padding; + y = request.height - 2 * request.border_size - gfx->height - padding; + } + else if (id == TOOL_CTRL_ID_CONFIRM) + { + x = (request.width - 2 * request.border_size - gfx->width) / 2; + y = request.height - 2 * request.border_size - gfx->height - padding; + } + else if (id >= TOOL_CTRL_ID_PLAYER_1 && id <= TOOL_CTRL_ID_PLAYER_4) + { + int player_nr = id - TOOL_CTRL_ID_PLAYER_1; + + x = (request.width - 2 * request.border_size - gfx->width) / 2; + y = request.height - 2 * request.border_size - gfx->height - padding; + + x += (player_nr % 2 ? +1 : -1) * gfx->width / 2; + y += (player_nr / 2 ? 0 : -1) * gfx->height; + } + } + } + if (id >= TOOL_CTRL_ID_PLAYER_1 && id <= TOOL_CTRL_ID_PLAYER_4) { int player_nr = id - TOOL_CTRL_ID_PLAYER_1; @@ -5326,8 +5367,8 @@ void CreateToolButtons() gi = CreateGadget(GDI_CUSTOM_ID, id, GDI_INFO_TEXT, toolbutton_info[i].infotext, - GDI_X, dx + GDI_ACTIVE_POS(pos->x), - GDI_Y, dy + GDI_ACTIVE_POS(pos->y), + GDI_X, dx + x, + GDI_Y, dy + y, GDI_WIDTH, gfx->width, GDI_HEIGHT, gfx->height, GDI_TYPE, GD_TYPE_NORMAL_BUTTON,