added overlay touch buttons for door request dialog
authorHolger Schemel <info@artsoft.org>
Thu, 19 Sep 2019 17:58:38 +0000 (19:58 +0200)
committerHolger Schemel <info@artsoft.org>
Thu, 19 Sep 2019 18:13:46 +0000 (20:13 +0200)
graphics/gfx_classic/Makefile
graphics/gfx_classic/RocksTouch.ilbm [new file with mode: 0644]
src/conf_gfx.c
src/init.c
src/main.h
src/tools.c

index 558a63cdb2c0a558ef34fcb6dd148e3cb61f5230..d38d1b001788807c4bfe3f9cf92db7a9dc22d795 100644 (file)
@@ -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 (file)
index 0000000..07d04a4
Binary files /dev/null and b/graphics/gfx_classic/RocksTouch.ilbm differ
index 6c1a6ba2ef9e35bb469daca99bb93e4ae8bc06c5..5bb2817fc5a6b9c4b9fa76aa8dddf415e5ecf4e6 100644 (file)
@@ -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"                   },
index 409858ca45e0c4e670534c8ecaa01076e719009a..1e77ca470bac29a2fb1da646ca27480fc3ef0540 100644 (file)
@@ -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;
index 88577ac27add45a3315bb7ee3e06e5d825640b5b..00740b421d665357c292c083506c199d68ede530 100644 (file)
@@ -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
index 0817e3d864e656b081d0a6658a5ed4774402dd47..1095dd52e18f3f1d9aacc563c53f9fcb0b7885ad 100644 (file)
 #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);