rnd-19981121-1
[rocksndiamonds.git] / src / buttons.h
1 /***********************************************************
2 *  Rocks'n'Diamonds -- McDuffin Strikes Back!              *
3 *----------------------------------------------------------*
4 *  (c) 1995-98 Artsoft Entertainment                       *
5 *              Holger Schemel                              *
6 *              Oststrasse 11a                              *
7 *              33604 Bielefeld                             *
8 *              phone: ++49 +521 290471                     *
9 *              email: aeglos@valinor.owl.de                *
10 *----------------------------------------------------------*
11 *  buttons.h                                               *
12 ***********************************************************/
13
14 #ifndef BUTTONS_H
15 #define BUTTONS_H
16
17 #include "main.h"
18
19 /* tags to draw video display labels or symbols only */
20 #define VIDEO_DISPLAY_DEFAULT           0
21 #define VIDEO_DISPLAY_LABEL_ONLY        1
22 #define VIDEO_DISPLAY_SYMBOL_ONLY       2
23
24 /* some positions in the video tape control window */
25 #define VIDEO_DISPLAY1_XPOS     5
26 #define VIDEO_DISPLAY1_YPOS     5
27 #define VIDEO_DISPLAY2_XPOS     5
28 #define VIDEO_DISPLAY2_YPOS     41
29 #define VIDEO_DISPLAY_XSIZE     90
30 #define VIDEO_DISPLAY_YSIZE     31
31 #define VIDEO_BUTTON_XSIZE      18
32 #define VIDEO_BUTTON_YSIZE      18
33 #define VIDEO_CONTROL_XPOS      5
34 #define VIDEO_CONTROL_YPOS      77
35 #define VIDEO_CONTROL_XSIZE     (VIDEO_DISPLAY_XSIZE)
36 #define VIDEO_CONTROL_YSIZE     (VIDEO_BUTTON_YSIZE)
37 #define VIDEO_BUTTON_EJECT_XPOS (VIDEO_CONTROL_XPOS + 0 * VIDEO_BUTTON_XSIZE)
38 #define VIDEO_BUTTON_STOP_XPOS  (VIDEO_CONTROL_XPOS + 1 * VIDEO_BUTTON_XSIZE)
39 #define VIDEO_BUTTON_PAUSE_XPOS (VIDEO_CONTROL_XPOS + 2 * VIDEO_BUTTON_XSIZE)
40 #define VIDEO_BUTTON_REC_XPOS   (VIDEO_CONTROL_XPOS + 3 * VIDEO_BUTTON_XSIZE)
41 #define VIDEO_BUTTON_PLAY_XPOS  (VIDEO_CONTROL_XPOS + 4 * VIDEO_BUTTON_XSIZE)
42 #define VIDEO_BUTTON_ANY_YPOS   (VIDEO_CONTROL_YPOS)
43 #define VIDEO_DATE_LABEL_XPOS   (VIDEO_DISPLAY1_XPOS)
44 #define VIDEO_DATE_LABEL_YPOS   (VIDEO_DISPLAY1_YPOS)
45 #define VIDEO_DATE_LABEL_XSIZE  (VIDEO_DISPLAY_XSIZE)
46 #define VIDEO_DATE_LABEL_YSIZE  (VIDEO_DISPLAY_YSIZE)
47 #define VIDEO_DATE_XPOS         (VIDEO_DISPLAY1_XPOS+1)
48 #define VIDEO_DATE_YPOS         (VIDEO_DISPLAY1_YPOS+14)
49 #define VIDEO_DATE_XSIZE        (VIDEO_DISPLAY_XSIZE)
50 #define VIDEO_DATE_YSIZE        16
51 #define VIDEO_REC_LABEL_XPOS    (VIDEO_DISPLAY2_XPOS)
52 #define VIDEO_REC_LABEL_YPOS    (VIDEO_DISPLAY2_YPOS)
53 #define VIDEO_REC_LABEL_XSIZE   20
54 #define VIDEO_REC_LABEL_YSIZE   12
55 #define VIDEO_REC_SYMBOL_XPOS   (VIDEO_DISPLAY2_XPOS+20)
56 #define VIDEO_REC_SYMBOL_YPOS   (VIDEO_DISPLAY2_YPOS)
57 #define VIDEO_REC_SYMBOL_XSIZE  16
58 #define VIDEO_REC_SYMBOL_YSIZE  16
59 #define VIDEO_PLAY_LABEL_XPOS   (VIDEO_DISPLAY2_XPOS+65)
60 #define VIDEO_PLAY_LABEL_YPOS   (VIDEO_DISPLAY2_YPOS)
61 #define VIDEO_PLAY_LABEL_XSIZE  22
62 #define VIDEO_PLAY_LABEL_YSIZE  12
63 #define VIDEO_PLAY_SYMBOL_XPOS  (VIDEO_DISPLAY2_XPOS+52)
64 #define VIDEO_PLAY_SYMBOL_YPOS  (VIDEO_DISPLAY2_YPOS)
65 #define VIDEO_PLAY_SYMBOL_XSIZE 11
66 #define VIDEO_PLAY_SYMBOL_YSIZE 13
67 #define VIDEO_PAUSE_LABEL_XPOS  (VIDEO_DISPLAY2_XPOS)
68 #define VIDEO_PAUSE_LABEL_YPOS  (VIDEO_DISPLAY2_YPOS+20)
69 #define VIDEO_PAUSE_LABEL_XSIZE 35
70 #define VIDEO_PAUSE_LABEL_YSIZE 8
71 #define VIDEO_PAUSE_SYMBOL_XPOS (VIDEO_DISPLAY2_XPOS+35)
72 #define VIDEO_PAUSE_SYMBOL_YPOS (VIDEO_DISPLAY2_YPOS)
73 #define VIDEO_PAUSE_SYMBOL_XSIZE 17
74 #define VIDEO_PAUSE_SYMBOL_YSIZE 13
75 #define VIDEO_TIME_XPOS         (VIDEO_DISPLAY2_XPOS+38)
76 #define VIDEO_TIME_YPOS         (VIDEO_DISPLAY2_YPOS+14)
77 #define VIDEO_TIME_XSIZE        50
78 #define VIDEO_TIME_YSIZE        16
79
80 /* special */
81 #define VIDEO_PBEND_LABEL_XPOS  6
82 #define VIDEO_PBEND_LABEL_YPOS  220
83 #define VIDEO_PBEND_LABEL_XSIZE 35
84 #define VIDEO_PBEND_LABEL_YSIZE 30
85
86 #define ON_VIDEO_BUTTON(x,y)    ((x)>=(VX+VIDEO_CONTROL_XPOS) &&        \
87                                  (x)< (VX+VIDEO_CONTROL_XPOS +          \
88                                        VIDEO_CONTROL_XSIZE) &&          \
89                                  (y)>=(VY+VIDEO_CONTROL_YPOS) &&        \
90                                  (y)< (VY+VIDEO_CONTROL_YPOS +          \
91                                        VIDEO_CONTROL_YSIZE))
92 #define VIDEO_BUTTON(x)         (((x)-(VX+VIDEO_CONTROL_XPOS))/VIDEO_BUTTON_XSIZE)
93
94 /* values for video tape control */
95 #define VIDEO_STATE_PLAY_OFF    (1L<<0)
96 #define VIDEO_STATE_PLAY_ON     (1L<<1)
97 #define VIDEO_STATE_PLAY        (VIDEO_STATE_PLAY_OFF   | VIDEO_STATE_PLAY_ON)
98 #define VIDEO_STATE_REC_OFF     (1L<<2)
99 #define VIDEO_STATE_REC_ON      (1L<<3)
100 #define VIDEO_STATE_REC         (VIDEO_STATE_REC_OFF    | VIDEO_STATE_REC_ON)
101 #define VIDEO_STATE_PAUSE_OFF   (1L<<4)
102 #define VIDEO_STATE_PAUSE_ON    (1L<<5)
103 #define VIDEO_STATE_PAUSE       (VIDEO_STATE_PAUSE_OFF  | VIDEO_STATE_PAUSE_ON)
104 #define VIDEO_STATE_DATE_OFF    (1L<<6)
105 #define VIDEO_STATE_DATE_ON     (1L<<7)
106 #define VIDEO_STATE_DATE        (VIDEO_STATE_DATE_OFF   | VIDEO_STATE_DATE_ON)
107 #define VIDEO_STATE_TIME_OFF    (1L<<8)
108 #define VIDEO_STATE_TIME_ON     (1L<<9)
109 #define VIDEO_STATE_TIME        (VIDEO_STATE_TIME_OFF   | VIDEO_STATE_TIME_ON)
110 #define VIDEO_PRESS_PLAY_ON     (1L<<10)
111 #define VIDEO_PRESS_PLAY_OFF    (1L<<11)
112 #define VIDEO_PRESS_PLAY        (VIDEO_PRESS_PLAY_OFF   | VIDEO_PRESS_PLAY_ON)
113 #define VIDEO_PRESS_REC_ON      (1L<<12)
114 #define VIDEO_PRESS_REC_OFF     (1L<<13)
115 #define VIDEO_PRESS_REC         (VIDEO_PRESS_REC_OFF    | VIDEO_PRESS_REC_ON)
116 #define VIDEO_PRESS_PAUSE_ON    (1L<<14)
117 #define VIDEO_PRESS_PAUSE_OFF   (1L<<15)
118 #define VIDEO_PRESS_PAUSE       (VIDEO_PRESS_PAUSE_OFF  | VIDEO_PRESS_PAUSE_ON)
119 #define VIDEO_PRESS_STOP_ON     (1L<<16)
120 #define VIDEO_PRESS_STOP_OFF    (1L<<17)
121 #define VIDEO_PRESS_STOP        (VIDEO_PRESS_STOP_OFF   | VIDEO_PRESS_STOP_ON)
122 #define VIDEO_PRESS_EJECT_ON    (1L<<18)
123 #define VIDEO_PRESS_EJECT_OFF   (1L<<19)
124 #define VIDEO_PRESS_EJECT       (VIDEO_PRESS_EJECT_OFF  | VIDEO_PRESS_EJECT_ON)
125
126 /* special */
127 #define VIDEO_STATE_FFWD_OFF    ((1L<<20) | VIDEO_STATE_PAUSE_OFF)
128 #define VIDEO_STATE_FFWD_ON     (1L<<21)
129 #define VIDEO_STATE_FFWD        (VIDEO_STATE_FFWD_OFF   | VIDEO_STATE_FFWD_ON)
130 #define VIDEO_STATE_PBEND_OFF   (1L<<22)
131 #define VIDEO_STATE_PBEND_ON    (1L<<23)
132 #define VIDEO_STATE_PBEND       (VIDEO_STATE_PBEND_OFF  | VIDEO_STATE_PBEND_ON)
133
134 #define BUTTON_VIDEO_EJECT      1
135 #define BUTTON_VIDEO_STOP       2
136 #define BUTTON_VIDEO_PAUSE      3
137 #define BUTTON_VIDEO_REC        4
138 #define BUTTON_VIDEO_PLAY       5
139
140 #define VIDEO_STATE_OFF         (VIDEO_STATE_PLAY_OFF   |       \
141                                  VIDEO_STATE_REC_OFF    |       \
142                                  VIDEO_STATE_PAUSE_OFF  |       \
143                                  VIDEO_STATE_FFWD_OFF   |       \
144                                  VIDEO_STATE_PBEND_OFF  |       \
145                                  VIDEO_STATE_DATE_OFF   |       \
146                                  VIDEO_STATE_TIME_OFF)
147 #define VIDEO_PRESS_OFF         (VIDEO_PRESS_PLAY_OFF   |       \
148                                  VIDEO_PRESS_REC_OFF    |       \
149                                  VIDEO_PRESS_PAUSE_OFF  |       \
150                                  VIDEO_PRESS_STOP_OFF   |       \
151                                  VIDEO_PRESS_EJECT_OFF)
152 #define VIDEO_ALL_OFF           (VIDEO_STATE_OFF | VIDEO_PRESS_OFF)
153
154 #define VIDEO_STATE_ON          (VIDEO_STATE_PLAY_ON    |       \
155                                  VIDEO_STATE_REC_ON     |       \
156                                  VIDEO_STATE_PAUSE_ON   |       \
157                                  VIDEO_STATE_FFWD_ON    |       \
158                                  VIDEO_STATE_PBEND_ON   |       \
159                                  VIDEO_STATE_DATE_ON    |       \
160                                  VIDEO_STATE_TIME_ON)
161 #define VIDEO_PRESS_ON          (VIDEO_PRESS_PLAY_ON    |       \
162                                  VIDEO_PRESS_REC_ON     |       \
163                                  VIDEO_PRESS_PAUSE_ON   |       \
164                                  VIDEO_PRESS_STOP_ON    |       \
165                                  VIDEO_PRESS_EJECT_ON)
166 #define VIDEO_ALL_ON            (VIDEO_STATE_ON | VIDEO_PRESS_ON)
167
168 #define VIDEO_STATE             (VIDEO_STATE_ON | VIDEO_STATE_OFF)
169 #define VIDEO_PRESS             (VIDEO_PRESS_ON | VIDEO_PRESS_OFF)
170 #define VIDEO_ALL               (VIDEO_ALL_ON | VIDEO_ALL_OFF)
171
172
173 /* some positions in the sound control window */
174 #define SOUND_BUTTON_XSIZE      30
175 #define SOUND_BUTTON_YSIZE      30
176 #define SOUND_CONTROL_XPOS      5
177 #define SOUND_CONTROL_YPOS      245
178 #define SOUND_CONTROL_XSIZE      (3*SOUND_BUTTON_XSIZE)
179 #define SOUND_CONTROL_YSIZE      (1*SOUND_BUTTON_YSIZE)
180 #define SOUND_BUTTON_MUSIC_XPOS  (SOUND_CONTROL_XPOS + 0 * SOUND_BUTTON_XSIZE)
181 #define SOUND_BUTTON_LOOPS_XPOS  (SOUND_CONTROL_XPOS + 1 * SOUND_BUTTON_XSIZE)
182 #define SOUND_BUTTON_SIMPLE_XPOS (SOUND_CONTROL_XPOS + 2 * SOUND_BUTTON_XSIZE)
183 #define SOUND_BUTTON_ANY_YPOS    (SOUND_CONTROL_YPOS)
184
185 #define ON_SOUND_BUTTON(x,y)    ((x)>=(DX+SOUND_CONTROL_XPOS) &&        \
186                                  (x)< (DX+SOUND_CONTROL_XPOS +          \
187                                        SOUND_CONTROL_XSIZE) &&          \
188                                  (y)>=(DY+SOUND_CONTROL_YPOS) &&        \
189                                  (y)< (DY+SOUND_CONTROL_YPOS +          \
190                                        SOUND_CONTROL_YSIZE))
191 #define SOUND_BUTTON(x)         (((x)-(DX+SOUND_CONTROL_XPOS))/SOUND_BUTTON_XSIZE)
192
193 /* values for sound control */
194 #define BUTTON_SOUND_MUSIC      (1L<<0)
195 #define BUTTON_SOUND_LOOPS      (1L<<1)
196 #define BUTTON_SOUND_SIMPLE     (1L<<2)
197 #define BUTTON_RELEASED         0
198 #define BUTTON_PRESSED          (1L<<3)
199 #define BUTTON_OFF              0
200 #define BUTTON_ON               (1L<<4)
201 #define BUTTON_SOUND_MUSIC_OFF  (BUTTON_SOUND_MUSIC  | BUTTON_OFF)
202 #define BUTTON_SOUND_LOOPS_OFF  (BUTTON_SOUND_LOOPS  | BUTTON_OFF)
203 #define BUTTON_SOUND_SIMPLE_OFF (BUTTON_SOUND_SIMPLE | BUTTON_OFF)
204 #define BUTTON_SOUND_MUSIC_ON   (BUTTON_SOUND_MUSIC  | BUTTON_ON)
205 #define BUTTON_SOUND_LOOPS_ON   (BUTTON_SOUND_LOOPS  | BUTTON_ON)
206 #define BUTTON_SOUND_SIMPLE_ON  (BUTTON_SOUND_SIMPLE | BUTTON_ON)
207
208
209 /* some positions in the game control window */
210 #define GAME_BUTTON_XSIZE       30
211 #define GAME_BUTTON_YSIZE       30
212 #define GAME_CONTROL_XPOS       5
213 #define GAME_CONTROL_YPOS       215
214 #define GAME_CONTROL_XSIZE      (3*GAME_BUTTON_XSIZE)
215 #define GAME_CONTROL_YSIZE      (1*GAME_BUTTON_YSIZE)
216 #define GAME_BUTTON_STOP_XPOS   (GAME_CONTROL_XPOS + 0 * GAME_BUTTON_XSIZE)
217 #define GAME_BUTTON_PAUSE_XPOS  (GAME_CONTROL_XPOS + 1 * GAME_BUTTON_XSIZE)
218 #define GAME_BUTTON_PLAY_XPOS   (GAME_CONTROL_XPOS + 2 * GAME_BUTTON_XSIZE)
219 #define GAME_BUTTON_ANY_YPOS    (GAME_CONTROL_YPOS)
220
221 #define ON_GAME_BUTTON(x,y)     ((x)>=(DX+GAME_CONTROL_XPOS) && \
222                                  (x)< (DX+GAME_CONTROL_XPOS +           \
223                                        GAME_CONTROL_XSIZE) &&           \
224                                  (y)>=(DY+GAME_CONTROL_YPOS) && \
225                                  (y)< (DY+GAME_CONTROL_YPOS +           \
226                                        GAME_CONTROL_YSIZE))
227 #define GAME_BUTTON(x)          (((x)-(DX+GAME_CONTROL_XPOS))/GAME_BUTTON_XSIZE)
228
229 /* values for game control */
230 #define BUTTON_GAME_STOP        (1L<<0)
231 #define BUTTON_GAME_PAUSE       (1L<<1)
232 #define BUTTON_GAME_PLAY        (1L<<2)
233
234 /* some positions in the asking window */
235 #define OK_BUTTON_XPOS          2
236 #define OK_BUTTON_YPOS          250
237 #define OK_BUTTON_GFX_YPOS      0
238 #define OK_BUTTON_XSIZE         46
239 #define OK_BUTTON_YSIZE         28
240 #define NO_BUTTON_XPOS          52
241 #define NO_BUTTON_YPOS          OK_BUTTON_YPOS
242 #define NO_BUTTON_XSIZE         OK_BUTTON_XSIZE
243 #define NO_BUTTON_YSIZE         OK_BUTTON_YSIZE
244 #define CONFIRM_BUTTON_XPOS     2
245 #define CONFIRM_BUTTON_GFX_YPOS 30
246 #define CONFIRM_BUTTON_YPOS     OK_BUTTON_YPOS
247 #define CONFIRM_BUTTON_XSIZE    96
248 #define CONFIRM_BUTTON_YSIZE    OK_BUTTON_YSIZE
249
250 #define ON_YESNO_BUTTON(x,y)    (((x)>=(DX+OK_BUTTON_XPOS) &&           \
251                                   (x)< (DX+OK_BUTTON_XPOS +             \
252                                         OK_BUTTON_XSIZE) &&             \
253                                   (y)>=(DY+OK_BUTTON_YPOS) &&           \
254                                   (y)< (DY+OK_BUTTON_YPOS +             \
255                                         OK_BUTTON_YSIZE)) ||            \
256                                  ((x)>=(DX+NO_BUTTON_XPOS) &&           \
257                                   (x)< (DX+NO_BUTTON_XPOS +             \
258                                         NO_BUTTON_XSIZE) &&             \
259                                   (y)>=(DY+NO_BUTTON_YPOS) &&           \
260                                   (y)< (DY+NO_BUTTON_YPOS +             \
261                                         NO_BUTTON_YSIZE)))
262 #define ON_CONFIRM_BUTTON(x,y)  (((x)>=(DX+CONFIRM_BUTTON_XPOS) &&      \
263                                   (x)< (DX+CONFIRM_BUTTON_XPOS +        \
264                                         CONFIRM_BUTTON_XSIZE) &&        \
265                                   (y)>=(DY+CONFIRM_BUTTON_YPOS) &&      \
266                                   (y)< (DY+CONFIRM_BUTTON_YPOS +        \
267                                         CONFIRM_BUTTON_YSIZE)))
268 #define YESNO_BUTTON(x)         (((x)-(DX+OK_BUTTON_XPOS))/OK_BUTTON_XSIZE)
269
270 /* values for asking control */
271 #define BUTTON_OK               (1L<<0)
272 #define BUTTON_NO               (1L<<1)
273 #define BUTTON_CONFIRM          (1L<<2)
274
275 /* some positions in the choose player window */
276
277 #define PLAYER_BUTTON_XSIZE     30
278 #define PLAYER_BUTTON_YSIZE     30
279 #define PLAYER_BUTTON_GFX_XPOS  5
280 #define PLAYER_BUTTON_GFX_YPOS  (215-30)
281 #define PLAYER_CONTROL_XPOS     (5 + PLAYER_BUTTON_XSIZE/2)
282 #define PLAYER_CONTROL_YPOS     (215 - PLAYER_BUTTON_YSIZE/2)
283 #define PLAYER_CONTROL_XSIZE    (2*PLAYER_BUTTON_XSIZE)
284 #define PLAYER_CONTROL_YSIZE    (2*PLAYER_BUTTON_YSIZE)
285 #define PLAYER_BUTTON_1_XPOS    (PLAYER_CONTROL_XPOS + 0 * PLAYER_BUTTON_XSIZE)
286 #define PLAYER_BUTTON_2_XPOS    (PLAYER_CONTROL_XPOS + 1 * PLAYER_BUTTON_XSIZE)
287 #define PLAYER_BUTTON_3_XPOS    (PLAYER_CONTROL_XPOS + 0 * PLAYER_BUTTON_XSIZE)
288 #define PLAYER_BUTTON_4_XPOS    (PLAYER_CONTROL_XPOS + 1 * PLAYER_BUTTON_XSIZE)
289 #define PLAYER_BUTTON_1_YPOS    (PLAYER_CONTROL_YPOS + 0 * PLAYER_BUTTON_YSIZE)
290 #define PLAYER_BUTTON_2_YPOS    (PLAYER_CONTROL_YPOS + 0 * PLAYER_BUTTON_YSIZE)
291 #define PLAYER_BUTTON_3_YPOS    (PLAYER_CONTROL_YPOS + 1 * PLAYER_BUTTON_YSIZE)
292 #define PLAYER_BUTTON_4_YPOS    (PLAYER_CONTROL_YPOS + 1 * PLAYER_BUTTON_YSIZE)
293
294 #define ON_PLAYER_BUTTON(x,y)   ((x)>=(DX+PLAYER_CONTROL_XPOS) &&       \
295                                  (x)< (DX+PLAYER_CONTROL_XPOS +         \
296                                        PLAYER_CONTROL_XSIZE) &&         \
297                                  (y)>=(DY+PLAYER_CONTROL_YPOS) &&       \
298                                  (y)< (DY+PLAYER_CONTROL_YPOS +         \
299                                        PLAYER_CONTROL_YSIZE))
300 #define PLAYER_BUTTON(x,y)      ((((x)-(DX+PLAYER_CONTROL_XPOS)) /      \
301                                   PLAYER_BUTTON_XSIZE) + 2 *            \
302                                  (((y)-(DY+PLAYER_CONTROL_YPOS)) /      \
303                                   PLAYER_BUTTON_YSIZE))
304
305 /* values for choose player control */
306 #define BUTTON_PLAYER_1         (1L<<10)
307 #define BUTTON_PLAYER_2         (1L<<11)
308 #define BUTTON_PLAYER_3         (1L<<12)
309 #define BUTTON_PLAYER_4         (1L<<13)
310
311
312 /* some positions in the editor control window */
313 #define ED_BUTTON_EUP_XPOS      35
314 #define ED_BUTTON_EUP_YPOS      5
315 #define ED_BUTTON_EUP_XSIZE     30
316 #define ED_BUTTON_EUP_YSIZE     25
317 #define ED_BUTTON_EDOWN_XPOS    35
318 #define ED_BUTTON_EDOWN_YPOS    250
319 #define ED_BUTTON_EDOWN_XSIZE   30
320 #define ED_BUTTON_EDOWN_YSIZE   25
321 #define ED_BUTTON_ELEM_XPOS     6
322 #define ED_BUTTON_ELEM_YPOS     30
323 #define ED_BUTTON_ELEM_XSIZE    22
324 #define ED_BUTTON_ELEM_YSIZE    22
325
326 #define ED_BUTTON_EUP_Y2POS     140
327 #define ED_BUTTON_EDOWN_Y2POS   165
328 #define ED_BUTTON_ELEM_Y2POS    190
329
330 #define ED_BUTTON_CTRL_XPOS     5
331 #define ED_BUTTON_CTRL_YPOS     5
332 #define ED_BUTTON_CTRL_XSIZE    90
333 #define ED_BUTTON_CTRL_YSIZE    30
334 #define ED_BUTTON_FILL_XPOS     5
335 #define ED_BUTTON_FILL_YPOS     35
336 #define ED_BUTTON_FILL_XSIZE    90
337 #define ED_BUTTON_FILL_YSIZE    20
338 #define ED_BUTTON_LEFT_XPOS     5
339 #define ED_BUTTON_LEFT_YPOS     65
340 #define ED_BUTTON_LEFT_XSIZE    30
341 #define ED_BUTTON_LEFT_YSIZE    20
342 #define ED_BUTTON_UP_XPOS       35
343 #define ED_BUTTON_UP_YPOS       55
344 #define ED_BUTTON_UP_XSIZE      30
345 #define ED_BUTTON_UP_YSIZE      20
346 #define ED_BUTTON_DOWN_XPOS     35
347 #define ED_BUTTON_DOWN_YPOS     75
348 #define ED_BUTTON_DOWN_XSIZE    30
349 #define ED_BUTTON_DOWN_YSIZE    20
350 #define ED_BUTTON_RIGHT_XPOS    65
351 #define ED_BUTTON_RIGHT_YPOS    65
352 #define ED_BUTTON_RIGHT_XSIZE   30
353 #define ED_BUTTON_RIGHT_YSIZE   20
354
355 #define ED_BUTTON_EDIT_XPOS     5
356 #define ED_BUTTON_EDIT_YPOS     5
357 #define ED_BUTTON_EDIT_XSIZE    90
358 #define ED_BUTTON_EDIT_YSIZE    30
359 #define ED_BUTTON_CLEAR_XPOS    5
360 #define ED_BUTTON_CLEAR_YPOS    35
361 #define ED_BUTTON_CLEAR_XSIZE   90
362 #define ED_BUTTON_CLEAR_YSIZE   20
363 #define ED_BUTTON_UNDO_XPOS     5
364 #define ED_BUTTON_UNDO_YPOS     55
365 #define ED_BUTTON_UNDO_XSIZE    90
366 #define ED_BUTTON_UNDO_YSIZE    20
367 #define ED_BUTTON_EXIT_XPOS     5
368 #define ED_BUTTON_EXIT_YPOS     75
369 #define ED_BUTTON_EXIT_XSIZE    90
370 #define ED_BUTTON_EXIT_YSIZE    20
371
372 #define ED_BUTTON_MINUS_XPOS    2
373 #define ED_BUTTON_MINUS_YPOS    60
374 #define ED_BUTTON_MINUS_XSIZE   20
375 #define ED_BUTTON_MINUS_YSIZE   20
376 #define ED_WIN_COUNT_XPOS       (ED_BUTTON_MINUS_XPOS+ED_BUTTON_MINUS_XSIZE+2)
377 #define ED_WIN_COUNT_YPOS       ED_BUTTON_MINUS_YPOS
378 #define ED_WIN_COUNT_XSIZE      52
379 #define ED_WIN_COUNT_YSIZE      ED_BUTTON_MINUS_YSIZE
380 #define ED_BUTTON_PLUS_XPOS     (ED_WIN_COUNT_XPOS+ED_WIN_COUNT_XSIZE+2)
381 #define ED_BUTTON_PLUS_YPOS     ED_BUTTON_MINUS_YPOS
382 #define ED_BUTTON_PLUS_XSIZE    ED_BUTTON_MINUS_XSIZE
383 #define ED_BUTTON_PLUS_YSIZE    ED_BUTTON_MINUS_YSIZE
384
385 #define ED_COUNT_GADGET_XPOS    16
386 #define ED_COUNT_GADGET_YPOS    (16+3*MINI_TILEY+64)
387 #define ED_COUNT_GADGET_YSIZE   (ED_BUTTON_MINUS_YSIZE+4)
388 #define ED_COUNT_TEXT_XPOS      (ED_COUNT_GADGET_XPOS+DXSIZE+10)
389 #define ED_COUNT_TEXT_YPOS      (ED_COUNT_GADGET_YPOS+3)
390 #define ED_COUNT_TEXT_YSIZE     ED_COUNT_GADGET_YSIZE
391 #define ED_COUNT_VALUE_XPOS     (ED_COUNT_GADGET_XPOS+ED_BUTTON_MINUS_XSIZE+7)
392 #define ED_COUNT_VALUE_YPOS     ED_COUNT_TEXT_YPOS
393 #define ED_SIZE_GADGET_XPOS     (SX+21*MINI_TILEX)
394 #define ED_SIZE_GADGET_YPOS     (SY+4*MINI_TILEY)
395 #define ED_SIZE_GADGET_YSIZE    (ED_BUTTON_MINUS_YSIZE+4)
396 #define ED_SIZE_TEXT_XPOS       (ED_SIZE_GADGET_XPOS+DXSIZE+10)
397 #define ED_SIZE_TEXT_YPOS       (ED_SIZE_GADGET_YPOS+3)
398 #define ED_SIZE_TEXT_YSIZE      ED_COUNT_GADGET_YSIZE
399 #define ED_SIZE_VALUE_XPOS      (ED_SIZE_GADGET_XPOS+ED_BUTTON_MINUS_XSIZE+7)
400 #define ED_SIZE_VALUE_YPOS      ED_SIZE_TEXT_YPOS
401
402 #define ON_EDIT_BUTTON(x,y)     (((x)>=(VX+ED_BUTTON_CTRL_XPOS) &&      \
403                                   (x)< (VX+ED_BUTTON_CTRL_XPOS +        \
404                                         ED_BUTTON_CTRL_XSIZE) &&        \
405                                   (y)>=(VY+ED_BUTTON_CTRL_YPOS) &&      \
406                                   (y)< (VY+ED_BUTTON_CTRL_YPOS +        \
407                                         ED_BUTTON_CTRL_YSIZE +          \
408                                         ED_BUTTON_FILL_YSIZE)) ||       \
409                                  ((x)>=(VX+ED_BUTTON_LEFT_XPOS) &&      \
410                                   (x)< (VX+ED_BUTTON_LEFT_XPOS +        \
411                                         ED_BUTTON_LEFT_XSIZE +          \
412                                         ED_BUTTON_UP_XSIZE +            \
413                                         ED_BUTTON_RIGHT_XSIZE) &&       \
414                                   (y)>=(VY+ED_BUTTON_LEFT_YPOS) &&      \
415                                   (y)< (VY+ED_BUTTON_LEFT_YPOS +        \
416                                         ED_BUTTON_LEFT_YSIZE)) ||       \
417                                  ((x)>=(VX+ED_BUTTON_UP_XPOS) &&        \
418                                   (x)< (VX+ED_BUTTON_UP_XPOS +          \
419                                         ED_BUTTON_UP_XSIZE) &&          \
420                                   (y)>=(VY+ED_BUTTON_UP_YPOS) &&        \
421                                   (y)< (VY+ED_BUTTON_UP_YPOS +          \
422                                         ED_BUTTON_UP_YSIZE +            \
423                                         ED_BUTTON_DOWN_YSIZE)))
424
425 #define ON_CTRL_BUTTON(x,y)     ((x)>=(VX+ED_BUTTON_EDIT_XPOS) &&       \
426                                  (x)< (VX+ED_BUTTON_EDIT_XPOS +         \
427                                        ED_BUTTON_EDIT_XSIZE) &&         \
428                                  (y)>=(VY+ED_BUTTON_EDIT_YPOS) &&       \
429                                  (y)< (VY+ED_BUTTON_EDIT_YPOS +         \
430                                        ED_BUTTON_EDIT_YSIZE +           \
431                                        ED_BUTTON_CLEAR_YSIZE +          \
432                                        ED_BUTTON_UNDO_YSIZE +           \
433                                        ED_BUTTON_EXIT_YSIZE))
434
435 #define ON_ELEM_BUTTON(x,y)     (((x)>=(DX+ED_BUTTON_EUP_XPOS) &&       \
436                                   (x)< (DX+ED_BUTTON_EUP_XPOS +         \
437                                         ED_BUTTON_EUP_XSIZE) &&         \
438                                   (y)>=(DY+ED_BUTTON_EUP_YPOS) &&       \
439                                   (y)< (DY+ED_BUTTON_EUP_YPOS +         \
440                                         ED_BUTTON_EUP_YSIZE)) ||        \
441                                  ((x)>=(DX+ED_BUTTON_EDOWN_XPOS) &&     \
442                                   (x)< (DX+ED_BUTTON_EDOWN_XPOS +       \
443                                         ED_BUTTON_EDOWN_XSIZE) &&       \
444                                   (y)>=(DY+ED_BUTTON_EDOWN_YPOS) &&     \
445                                   (y)< (DY+ED_BUTTON_EDOWN_YPOS +       \
446                                         ED_BUTTON_EDOWN_YSIZE)) ||      \
447                                  ((x)>=(DX+ED_BUTTON_ELEM_XPOS) &&      \
448                                   (x)< (DX+ED_BUTTON_ELEM_XPOS +        \
449                                         MAX_ELEM_X*ED_BUTTON_ELEM_XSIZE) && \
450                                   (y)>=(DY+ED_BUTTON_ELEM_YPOS) &&      \
451                                   (y)< (DY+ED_BUTTON_ELEM_YPOS +        \
452                                         MAX_ELEM_Y*ED_BUTTON_ELEM_YSIZE)))
453
454 #define ON_COUNT_BUTTON(x,y)    (((((x)>=ED_COUNT_GADGET_XPOS &&        \
455                                     (x)<(ED_COUNT_GADGET_XPOS +         \
456                                          ED_BUTTON_MINUS_XSIZE)) ||     \
457                                    ((x)>=(ED_COUNT_GADGET_XPOS +        \
458                                           (ED_BUTTON_PLUS_XPOS -        \
459                                            ED_BUTTON_MINUS_XPOS)) &&    \
460                                     (x)<(ED_COUNT_GADGET_XPOS +         \
461                                          (ED_BUTTON_PLUS_XPOS -         \
462                                           ED_BUTTON_MINUS_XPOS) +       \
463                                          ED_BUTTON_PLUS_XSIZE))) &&     \
464                                   ((y)>=ED_COUNT_GADGET_YPOS &&         \
465                                    (y)<(ED_COUNT_GADGET_YPOS +          \
466                                         16*ED_COUNT_GADGET_YSIZE)) &&   \
467                                   (((y)-ED_COUNT_GADGET_YPOS) %         \
468                                    ED_COUNT_GADGET_YSIZE) <             \
469                                   ED_BUTTON_MINUS_YSIZE) ||             \
470                                  ((((x)>=ED_SIZE_GADGET_XPOS &&         \
471                                     (x)<(ED_SIZE_GADGET_XPOS +          \
472                                          ED_BUTTON_MINUS_XSIZE)) ||     \
473                                    ((x)>=(ED_SIZE_GADGET_XPOS +         \
474                                           (ED_BUTTON_PLUS_XPOS -        \
475                                            ED_BUTTON_MINUS_XPOS)) &&    \
476                                     (x)<(ED_SIZE_GADGET_XPOS +          \
477                                          (ED_BUTTON_PLUS_XPOS -         \
478                                           ED_BUTTON_MINUS_XPOS) +       \
479                                          ED_BUTTON_PLUS_XSIZE))) &&     \
480                                   ((y)>=ED_SIZE_GADGET_YPOS &&          \
481                                    (y)<(ED_SIZE_GADGET_YPOS +           \
482                                         2*ED_SIZE_GADGET_YSIZE)) &&     \
483                                   (((y)-ED_SIZE_GADGET_YPOS) %          \
484                                    ED_SIZE_GADGET_YSIZE) <              \
485                                   ED_BUTTON_MINUS_YSIZE))
486
487 #define EDIT_BUTTON(x,y)        (((y) < (VY + ED_BUTTON_CTRL_YPOS +     \
488                                          ED_BUTTON_CTRL_YSIZE)) ? 0 :   \
489                                  ((y) < (VY + ED_BUTTON_CTRL_YPOS +     \
490                                          ED_BUTTON_CTRL_YSIZE +         \
491                                          ED_BUTTON_FILL_YSIZE)) ? 1 :   \
492                                  ((x) < (VX + ED_BUTTON_LEFT_XPOS +     \
493                                          ED_BUTTON_LEFT_XSIZE) ? 2 :    \
494                                   (x) > (VX + ED_BUTTON_LEFT_XPOS +     \
495                                          ED_BUTTON_LEFT_XSIZE +         \
496                                          ED_BUTTON_UP_XSIZE) ? 5 :      \
497                                   3+(((y)-(VY + ED_BUTTON_CTRL_YPOS +   \
498                                            ED_BUTTON_CTRL_YSIZE +       \
499                                            ED_BUTTON_FILL_YSIZE)) /     \
500                                      ED_BUTTON_UP_YSIZE)))
501
502 #define CTRL_BUTTON(x,y)        (((y) < (VY + ED_BUTTON_EDIT_YPOS +     \
503                                          ED_BUTTON_EDIT_YSIZE)) ? 0 :   \
504                                  1+(((y)-(VY + ED_BUTTON_EDIT_YPOS +    \
505                                          ED_BUTTON_EDIT_YSIZE)) /       \
506                                     ED_BUTTON_CLEAR_YSIZE))
507
508 #define ELEM_BUTTON(x,y)        (((y) < (DY + ED_BUTTON_EUP_YPOS +      \
509                                          ED_BUTTON_EUP_YSIZE)) ? 0 :    \
510                                  ((y) > (DY + ED_BUTTON_EDOWN_YPOS)) ? 1 : \
511                                  2+(((y) - (DY + ED_BUTTON_ELEM_YPOS)) /   \
512                                  ED_BUTTON_ELEM_YSIZE)*MAX_ELEM_X +     \
513                                  ((x) - (DX + ED_BUTTON_ELEM_XPOS)) /   \
514                                  ED_BUTTON_ELEM_XSIZE)
515
516 #define COUNT_BUTTON(x,y)       ((x) < ED_SIZE_GADGET_XPOS ?            \
517                                  ((((y) - ED_COUNT_GADGET_YPOS) /       \
518                                    ED_COUNT_GADGET_YSIZE)*2 +           \
519                                   ((x) < (ED_COUNT_GADGET_XPOS +        \
520                                           ED_BUTTON_MINUS_XSIZE) ? 0 : 1)) : \
521                                  32+((((y) - ED_SIZE_GADGET_YPOS) /     \
522                                       ED_SIZE_GADGET_YSIZE)*2 +         \
523                                      ((x) < (ED_SIZE_GADGET_XPOS +      \
524                                              ED_BUTTON_MINUS_XSIZE) ? 0 : 1)))
525
526 /* values for asking control */
527 #define ED_BUTTON_CTRL          (1L<<0)
528 #define ED_BUTTON_FILL          (1L<<1)
529 #define ED_BUTTON_LEFT          (1L<<2)
530 #define ED_BUTTON_UP            (1L<<3)
531 #define ED_BUTTON_DOWN          (1L<<4)
532 #define ED_BUTTON_RIGHT         (1L<<5)
533 #define ED_BUTTON_EDIT          (1L<<6)
534 #define ED_BUTTON_CLEAR         (1L<<7)
535 #define ED_BUTTON_UNDO          (1L<<8)
536 #define ED_BUTTON_EXIT          (1L<<9)
537
538 #define ED_BUTTON_PRESSED       (1L<<10)
539 #define ED_BUTTON_RELEASED      (1L<<11)
540
541 #define ED_BUTTON_EUP           0
542 #define ED_BUTTON_EDOWN         1
543 #define ED_BUTTON_ELEM          2
544
545
546 /* for DrawPlayerButton() */
547
548 #define DB_INIT                 0
549 #define DB_NORMAL               1
550
551 void DrawVideoDisplay(unsigned long, unsigned long);
552 void DrawCompleteVideoDisplay(void);
553 void DrawSoundDisplay(unsigned long);
554 void DrawGameButton(unsigned long);
555 void DrawYesNoButton(unsigned long, int);
556 void DrawConfirmButton(unsigned long, int);
557 void DrawPlayerButton(unsigned long, int);
558 void DrawEditButton(unsigned long state);
559 void DrawCtrlButton(unsigned long state);
560 void DrawElemButton(int, int);
561 void DrawCountButton(int, int);
562 int CheckVideoButtons(int, int, int);
563 int CheckSoundButtons(int, int, int);
564 int CheckGameButtons(int, int, int);
565 int CheckYesNoButtons(int, int, int);
566 int CheckConfirmButton(int, int, int);
567 int CheckPlayerButtons(int, int, int);
568 int CheckEditButtons(int, int, int);
569 int CheckCtrlButtons(int, int, int);
570 int CheckElemButtons(int, int, int);
571 int CheckCountButtons(int, int, int);
572
573 #endif