From: Holger Schemel Date: Thu, 19 Sep 2019 17:58:38 +0000 (+0200) Subject: added overlay touch buttons for door request dialog X-Git-Tag: 4.1.4.0~10 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=65bfe5289ae5bcb4c1ea9bee97ebc619e1ecfc16;p=rocksndiamonds.git added overlay touch buttons for door request dialog --- diff --git a/graphics/gfx_classic/Makefile b/graphics/gfx_classic/Makefile index 558a63cd..d38d1b00 100644 --- a/graphics/gfx_classic/Makefile +++ b/graphics/gfx_classic/Makefile @@ -40,6 +40,7 @@ FILES = RocksBusy.$(EXT) \ RocksSP.$(EXT) \ RocksScreen.$(EXT) \ RocksToons.$(EXT) \ + RocksTouch.$(EXT) \ \ RocksCE.$(EXT) # dynamically generated from template diff --git a/graphics/gfx_classic/RocksTouch.ilbm b/graphics/gfx_classic/RocksTouch.ilbm new file mode 100644 index 00000000..07d04a45 Binary files /dev/null and b/graphics/gfx_classic/RocksTouch.ilbm differ diff --git a/src/conf_gfx.c b/src/conf_gfx.c index 6c1a6ba2..5bb2817f 100644 --- a/src/conf_gfx.c +++ b/src/conf_gfx.c @@ -6336,6 +6336,25 @@ struct ConfigInfo image_config[] = { "gfx.request.button.player_4", UNDEFINED_FILENAME }, { "gfx.request.button.player_4.clone_from", "gfx.request.button.player_1" }, + { "gfx.request.button.touch_yes", "RocksTouch.png" }, + { "gfx.request.button.touch_yes.x", "204" }, + { "gfx.request.button.touch_yes.y", "0" }, + { "gfx.request.button.touch_yes.width", "92" }, + { "gfx.request.button.touch_yes.height", "56" }, + { "gfx.request.button.touch_yes.pressed_xoffset", "-200" }, + { "gfx.request.button.touch_no", "RocksTouch.png" }, + { "gfx.request.button.touch_no.x", "304" }, + { "gfx.request.button.touch_no.y", "0" }, + { "gfx.request.button.touch_no.width", "92" }, + { "gfx.request.button.touch_no.height", "56" }, + { "gfx.request.button.touch_no.pressed_xoffset", "-200" }, + { "gfx.request.button.touch_confirm", "RocksTouch.png" }, + { "gfx.request.button.touch_confirm.x", "204" }, + { "gfx.request.button.touch_confirm.y", "60" }, + { "gfx.request.button.touch_confirm.width", "192" }, + { "gfx.request.button.touch_confirm.height", "56" }, + { "gfx.request.button.touch_confirm.pressed_xoffset", "-200" }, + { "font.initial_1", "RocksFontSmall.png" }, { "font.initial_1.x", "0" }, { "font.initial_1.y", "0" }, @@ -9414,6 +9433,13 @@ struct ConfigInfo image_config[] = { "request.button.player_4.draw_player", "true" }, { "request.button.player_4.tile_size", "16" }, + { "request.button.touch_yes.x", "0" }, + { "request.button.touch_yes.y", "-56" }, + { "request.button.touch_no.x", "-92" }, + { "request.button.touch_no.y", "-56" }, + { "request.button.touch_confirm.x", "0" }, + { "request.button.touch_confirm.y", "-56" }, + { "request.x", "-1" }, { "request.y", "-1" }, { "request.width", "120" }, diff --git a/src/init.c b/src/init.c index 409858ca..1e77ca47 100644 --- a/src/init.c +++ b/src/init.c @@ -277,6 +277,9 @@ void InitImageTextures(void) { static int texture_graphics[] = { + IMG_GFX_REQUEST_BUTTON_TOUCH_YES, + IMG_GFX_REQUEST_BUTTON_TOUCH_NO, + IMG_GFX_REQUEST_BUTTON_TOUCH_CONFIRM, -1 }; int i, j, k; diff --git a/src/main.h b/src/main.h index 88577ac2..00740b42 100644 --- a/src/main.h +++ b/src/main.h @@ -2649,10 +2649,15 @@ struct RequestButtonInfo struct TextPosInfo yes; struct TextPosInfo no; struct TextPosInfo confirm; + struct TextPosInfo player_1; struct TextPosInfo player_2; struct TextPosInfo player_3; struct TextPosInfo player_4; + + struct TextPosInfo touch_yes; + struct TextPosInfo touch_no; + struct TextPosInfo touch_confirm; }; struct MenuMainButtonInfo diff --git a/src/tools.c b/src/tools.c index 0817e3d8..1095dd52 100644 --- a/src/tools.c +++ b/src/tools.c @@ -35,8 +35,11 @@ #define TOOL_CTRL_ID_PLAYER_2 4 #define TOOL_CTRL_ID_PLAYER_3 5 #define TOOL_CTRL_ID_PLAYER_4 6 +#define TOOL_CTRL_ID_TOUCH_YES 7 +#define TOOL_CTRL_ID_TOUCH_NO 8 +#define TOOL_CTRL_ID_TOUCH_CONFIRM 9 -#define NUM_TOOL_BUTTONS 7 +#define NUM_TOOL_BUTTONS 10 // constants for number of doors and door parts #define NUM_DOORS 2 @@ -3133,10 +3136,13 @@ static void ShowEnvelopeRequest(char *text, unsigned int req_state, int action) { MapGadget(tool_gadget[TOOL_CTRL_ID_YES]); MapGadget(tool_gadget[TOOL_CTRL_ID_NO]); + MapGadget(tool_gadget[TOOL_CTRL_ID_TOUCH_YES]); + MapGadget(tool_gadget[TOOL_CTRL_ID_TOUCH_NO]); } else if (req_state & REQ_CONFIRM) { MapGadget(tool_gadget[TOOL_CTRL_ID_CONFIRM]); + MapGadget(tool_gadget[TOOL_CTRL_ID_TOUCH_CONFIRM]); } else if (req_state & REQ_PLAYER) { @@ -4339,12 +4345,15 @@ static int RequestHandleEvents(unsigned int req_state) switch (request_gadget_id) { case TOOL_CTRL_ID_YES: + case TOOL_CTRL_ID_TOUCH_YES: result = TRUE; break; case TOOL_CTRL_ID_NO: + case TOOL_CTRL_ID_TOUCH_NO: result = FALSE; break; case TOOL_CTRL_ID_CONFIRM: + case TOOL_CTRL_ID_TOUCH_CONFIRM: result = TRUE | FALSE; break; @@ -4676,10 +4685,13 @@ static boolean RequestDoor(char *text, unsigned int req_state) { MapGadget(tool_gadget[TOOL_CTRL_ID_YES]); MapGadget(tool_gadget[TOOL_CTRL_ID_NO]); + MapGadget(tool_gadget[TOOL_CTRL_ID_TOUCH_YES]); + MapGadget(tool_gadget[TOOL_CTRL_ID_TOUCH_NO]); } else if (req_state & REQ_CONFIRM) { MapGadget(tool_gadget[TOOL_CTRL_ID_CONFIRM]); + MapGadget(tool_gadget[TOOL_CTRL_ID_TOUCH_CONFIRM]); } else if (req_state & REQ_PLAYER) { @@ -5551,36 +5563,49 @@ static struct int graphic; struct TextPosInfo *pos; int gadget_id; + boolean is_touch_button; char *infotext; } toolbutton_info[NUM_TOOL_BUTTONS] = { { IMG_GFX_REQUEST_BUTTON_YES, &request.button.yes, - TOOL_CTRL_ID_YES, "yes" + TOOL_CTRL_ID_YES, FALSE, "yes" }, { IMG_GFX_REQUEST_BUTTON_NO, &request.button.no, - TOOL_CTRL_ID_NO, "no" + TOOL_CTRL_ID_NO, FALSE, "no" }, { IMG_GFX_REQUEST_BUTTON_CONFIRM, &request.button.confirm, - TOOL_CTRL_ID_CONFIRM, "confirm" + TOOL_CTRL_ID_CONFIRM, FALSE, "confirm" }, { IMG_GFX_REQUEST_BUTTON_PLAYER_1, &request.button.player_1, - TOOL_CTRL_ID_PLAYER_1, "player 1" + TOOL_CTRL_ID_PLAYER_1, FALSE, "player 1" }, { IMG_GFX_REQUEST_BUTTON_PLAYER_2, &request.button.player_2, - TOOL_CTRL_ID_PLAYER_2, "player 2" + TOOL_CTRL_ID_PLAYER_2, FALSE, "player 2" }, { IMG_GFX_REQUEST_BUTTON_PLAYER_3, &request.button.player_3, - TOOL_CTRL_ID_PLAYER_3, "player 3" + TOOL_CTRL_ID_PLAYER_3, FALSE, "player 3" }, { IMG_GFX_REQUEST_BUTTON_PLAYER_4, &request.button.player_4, - TOOL_CTRL_ID_PLAYER_4, "player 4" + TOOL_CTRL_ID_PLAYER_4, FALSE, "player 4" + }, + { + IMG_GFX_REQUEST_BUTTON_TOUCH_YES, &request.button.touch_yes, + TOOL_CTRL_ID_TOUCH_YES, TRUE, "yes" + }, + { + IMG_GFX_REQUEST_BUTTON_TOUCH_NO, &request.button.touch_no, + TOOL_CTRL_ID_TOUCH_NO, TRUE, "no" + }, + { + IMG_GFX_REQUEST_BUTTON_TOUCH_CONFIRM, &request.button.touch_confirm, + TOOL_CTRL_ID_TOUCH_CONFIRM, TRUE, "confirm" } }; @@ -5597,8 +5622,9 @@ void CreateToolButtons(void) Bitmap *deco_bitmap = None; int deco_x = 0, deco_y = 0, deco_xpos = 0, deco_ypos = 0; unsigned int event_mask = GD_EVENT_RELEASED; - int dx = DX; - int dy = DY; + boolean is_touch_button = toolbutton_info[i].is_touch_button; + int base_x = (is_touch_button ? 0 : DX); + int base_y = (is_touch_button ? 0 : DY); int gd_x = gfx->src_x; int gd_y = gfx->src_y; int gd_xp = gfx->src_x + gfx->pressed_xoffset; @@ -5607,9 +5633,9 @@ void CreateToolButtons(void) int y = pos->y; int id = i; - if (global.use_envelope_request) + if (global.use_envelope_request && !is_touch_button) { - setRequestPosition(&dx, &dy, TRUE); + setRequestPosition(&base_x, &base_y, TRUE); // check if request buttons are outside of envelope and fix, if needed if (x < 0 || x + gfx->width > request.width || @@ -5656,8 +5682,8 @@ void CreateToolButtons(void) gi = CreateGadget(GDI_CUSTOM_ID, id, GDI_IMAGE_ID, graphic, GDI_INFO_TEXT, toolbutton_info[i].infotext, - GDI_X, dx + x, - GDI_Y, dy + y, + GDI_X, base_x + x, + GDI_Y, base_y + y, GDI_WIDTH, gfx->width, GDI_HEIGHT, gfx->height, GDI_TYPE, GD_TYPE_NORMAL_BUTTON, @@ -5669,6 +5695,7 @@ void CreateToolButtons(void) GDI_DECORATION_SIZE, pos->size, pos->size, GDI_DECORATION_SHIFTING, 1, 1, GDI_DIRECT_DRAW, FALSE, + GDI_OVERLAY_TOUCH_BUTTON, is_touch_button, GDI_EVENT_MASK, event_mask, GDI_CALLBACK_ACTION, HandleToolButtons, GDI_END);