rnd-19980930-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 #define ON_VIDEO_BUTTON(x,y)    ((x)>=(VX+VIDEO_CONTROL_XPOS) &&        \
81                                  (x)< (VX+VIDEO_CONTROL_XPOS +          \
82                                        VIDEO_CONTROL_XSIZE) &&          \
83                                  (y)>=(VY+VIDEO_CONTROL_YPOS) &&        \
84                                  (y)< (VY+VIDEO_CONTROL_YPOS +          \
85                                        VIDEO_CONTROL_YSIZE))
86 #define VIDEO_BUTTON(x)         (((x)-(VX+VIDEO_CONTROL_XPOS))/VIDEO_BUTTON_XSIZE)
87
88 /* values for video tape control */
89 #define VIDEO_STATE_PLAY_OFF    (1L<<0)
90 #define VIDEO_STATE_PLAY_ON     (1L<<1)
91 #define VIDEO_STATE_PLAY        (VIDEO_STATE_PLAY_OFF   | VIDEO_STATE_PLAY_ON)
92 #define VIDEO_STATE_REC_OFF     (1L<<2)
93 #define VIDEO_STATE_REC_ON      (1L<<3)
94 #define VIDEO_STATE_REC         (VIDEO_STATE_REC_OFF    | VIDEO_STATE_REC_ON)
95 #define VIDEO_STATE_PAUSE_OFF   (1L<<4)
96 #define VIDEO_STATE_PAUSE_ON    (1L<<5)
97 #define VIDEO_STATE_PAUSE       (VIDEO_STATE_PAUSE_OFF  | VIDEO_STATE_PAUSE_ON)
98 #define VIDEO_STATE_DATE_OFF    (1L<<6)
99 #define VIDEO_STATE_DATE_ON     (1L<<7)
100 #define VIDEO_STATE_DATE        (VIDEO_STATE_DATE_OFF   | VIDEO_STATE_DATE_ON)
101 #define VIDEO_STATE_TIME_OFF    (1L<<8)
102 #define VIDEO_STATE_TIME_ON     (1L<<9)
103 #define VIDEO_STATE_TIME        (VIDEO_STATE_TIME_OFF   | VIDEO_STATE_TIME_ON)
104 #define VIDEO_PRESS_PLAY_ON     (1L<<10)
105 #define VIDEO_PRESS_PLAY_OFF    (1L<<11)
106 #define VIDEO_PRESS_PLAY        (VIDEO_PRESS_PLAY_OFF   | VIDEO_PRESS_PLAY_ON)
107 #define VIDEO_PRESS_REC_ON      (1L<<12)
108 #define VIDEO_PRESS_REC_OFF     (1L<<13)
109 #define VIDEO_PRESS_REC         (VIDEO_PRESS_REC_OFF    | VIDEO_PRESS_REC_ON)
110 #define VIDEO_PRESS_PAUSE_ON    (1L<<14)
111 #define VIDEO_PRESS_PAUSE_OFF   (1L<<15)
112 #define VIDEO_PRESS_PAUSE       (VIDEO_PRESS_PAUSE_OFF  | VIDEO_PRESS_PAUSE_ON)
113 #define VIDEO_PRESS_STOP_ON     (1L<<16)
114 #define VIDEO_PRESS_STOP_OFF    (1L<<17)
115 #define VIDEO_PRESS_STOP        (VIDEO_PRESS_STOP_OFF   | VIDEO_PRESS_STOP_ON)
116 #define VIDEO_PRESS_EJECT_ON    (1L<<18)
117 #define VIDEO_PRESS_EJECT_OFF   (1L<<19)
118 #define VIDEO_PRESS_EJECT       (VIDEO_PRESS_EJECT_OFF  | VIDEO_PRESS_EJECT_ON)
119
120 /* special */
121 #define VIDEO_STATE_FFWD_OFF    ((1L<<20) | VIDEO_STATE_PAUSE_OFF)
122 #define VIDEO_STATE_FFWD_ON     (1L<<21)
123 #define VIDEO_STATE_FFWD        (VIDEO_STATE_FFWD_OFF   | VIDEO_STATE_FFWD_ON)
124
125 #define BUTTON_VIDEO_EJECT      1
126 #define BUTTON_VIDEO_STOP       2
127 #define BUTTON_VIDEO_PAUSE      3
128 #define BUTTON_VIDEO_REC        4
129 #define BUTTON_VIDEO_PLAY       5
130
131 #define VIDEO_STATE_OFF         (VIDEO_STATE_PLAY_OFF   |       \
132                                  VIDEO_STATE_REC_OFF    |       \
133                                  VIDEO_STATE_PAUSE_OFF  |       \
134                                  VIDEO_STATE_FFWD_OFF   |       \
135                                  VIDEO_STATE_DATE_OFF   |       \
136                                  VIDEO_STATE_TIME_OFF)
137 #define VIDEO_PRESS_OFF         (VIDEO_PRESS_PLAY_OFF   |       \
138                                  VIDEO_PRESS_REC_OFF    |       \
139                                  VIDEO_PRESS_PAUSE_OFF  |       \
140                                  VIDEO_PRESS_STOP_OFF   |       \
141                                  VIDEO_PRESS_EJECT_OFF)
142 #define VIDEO_ALL_OFF           (VIDEO_STATE_OFF | VIDEO_PRESS_OFF)
143
144 #define VIDEO_STATE_ON          (VIDEO_STATE_PLAY_ON    |       \
145                                  VIDEO_STATE_REC_ON     |       \
146                                  VIDEO_STATE_PAUSE_ON   |       \
147                                  VIDEO_STATE_FFWD_ON    |       \
148                                  VIDEO_STATE_DATE_ON    |       \
149                                  VIDEO_STATE_TIME_ON)
150 #define VIDEO_PRESS_ON          (VIDEO_PRESS_PLAY_ON    |       \
151                                  VIDEO_PRESS_REC_ON     |       \
152                                  VIDEO_PRESS_PAUSE_ON   |       \
153                                  VIDEO_PRESS_STOP_ON    |       \
154                                  VIDEO_PRESS_EJECT_ON)
155 #define VIDEO_ALL_ON            (VIDEO_STATE_ON | VIDEO_PRESS_ON)
156
157 #define VIDEO_STATE             (VIDEO_STATE_ON | VIDEO_STATE_OFF)
158 #define VIDEO_PRESS             (VIDEO_PRESS_ON | VIDEO_PRESS_OFF)
159 #define VIDEO_ALL               (VIDEO_ALL_ON | VIDEO_ALL_OFF)
160
161
162 /* some positions in the sound control window */
163 #define SOUND_BUTTON_XSIZE      30
164 #define SOUND_BUTTON_YSIZE      30
165 #define SOUND_CONTROL_XPOS      5
166 #define SOUND_CONTROL_YPOS      245
167 #define SOUND_CONTROL_XSIZE     90
168 #define SOUND_CONTROL_YSIZE      (SOUND_BUTTON_YSIZE)
169 #define SOUND_BUTTON_MUSIC_XPOS  (SOUND_CONTROL_XPOS + 0 * SOUND_BUTTON_XSIZE)
170 #define SOUND_BUTTON_LOOPS_XPOS  (SOUND_CONTROL_XPOS + 1 * SOUND_BUTTON_XSIZE)
171 #define SOUND_BUTTON_SIMPLE_XPOS (SOUND_CONTROL_XPOS + 2 * SOUND_BUTTON_XSIZE)
172 #define SOUND_BUTTON_ANY_YPOS    (SOUND_CONTROL_YPOS)
173
174 #define ON_SOUND_BUTTON(x,y)    ((x)>=(DX+SOUND_CONTROL_XPOS) &&        \
175                                  (x)< (DX+SOUND_CONTROL_XPOS +          \
176                                        SOUND_CONTROL_XSIZE) &&          \
177                                  (y)>=(DY+SOUND_CONTROL_YPOS) &&        \
178                                  (y)< (DY+SOUND_CONTROL_YPOS +          \
179                                        SOUND_CONTROL_YSIZE))
180 #define SOUND_BUTTON(x)         (((x)-(DX+SOUND_CONTROL_XPOS))/SOUND_BUTTON_XSIZE)
181
182 /* values for sound control */
183 #define BUTTON_SOUND_MUSIC      (1L<<0)
184 #define BUTTON_SOUND_LOOPS      (1L<<1)
185 #define BUTTON_SOUND_SIMPLE     (1L<<2)
186 #define BUTTON_RELEASED         0
187 #define BUTTON_PRESSED          (1L<<3)
188 #define BUTTON_OFF              0
189 #define BUTTON_ON               (1L<<4)
190 #define BUTTON_SOUND_MUSIC_OFF  (BUTTON_SOUND_MUSIC  | BUTTON_OFF)
191 #define BUTTON_SOUND_LOOPS_OFF  (BUTTON_SOUND_LOOPS  | BUTTON_OFF)
192 #define BUTTON_SOUND_SIMPLE_OFF (BUTTON_SOUND_SIMPLE | BUTTON_OFF)
193 #define BUTTON_SOUND_MUSIC_ON   (BUTTON_SOUND_MUSIC  | BUTTON_ON)
194 #define BUTTON_SOUND_LOOPS_ON   (BUTTON_SOUND_LOOPS  | BUTTON_ON)
195 #define BUTTON_SOUND_SIMPLE_ON  (BUTTON_SOUND_SIMPLE | BUTTON_ON)
196
197
198 /* some positions in the game control window */
199 #define GAME_BUTTON_XSIZE       30
200 #define GAME_BUTTON_YSIZE       30
201 #define GAME_CONTROL_XPOS       5
202 #define GAME_CONTROL_YPOS       215
203 #define GAME_CONTROL_XSIZE      90
204 #define GAME_CONTROL_YSIZE      (GAME_BUTTON_YSIZE)
205 #define GAME_BUTTON_STOP_XPOS   (GAME_CONTROL_XPOS + 0 * GAME_BUTTON_XSIZE)
206 #define GAME_BUTTON_PAUSE_XPOS  (GAME_CONTROL_XPOS + 1 * GAME_BUTTON_XSIZE)
207 #define GAME_BUTTON_PLAY_XPOS   (GAME_CONTROL_XPOS + 2 * GAME_BUTTON_XSIZE)
208 #define GAME_BUTTON_ANY_YPOS    (GAME_CONTROL_YPOS)
209
210 #define ON_GAME_BUTTON(x,y)     ((x)>=(DX+GAME_CONTROL_XPOS) && \
211                                  (x)< (DX+GAME_CONTROL_XPOS +           \
212                                        GAME_CONTROL_XSIZE) &&           \
213                                  (y)>=(DY+GAME_CONTROL_YPOS) && \
214                                  (y)< (DY+GAME_CONTROL_YPOS +           \
215                                        GAME_CONTROL_YSIZE))
216 #define GAME_BUTTON(x)          (((x)-(DX+GAME_CONTROL_XPOS))/GAME_BUTTON_XSIZE)
217
218 /* values for game control */
219 #define BUTTON_GAME_STOP        (1L<<0)
220 #define BUTTON_GAME_PAUSE       (1L<<1)
221 #define BUTTON_GAME_PLAY        (1L<<2)
222
223
224 /* some positions in the asking window */
225 #define OK_BUTTON_XPOS          2
226 #define OK_BUTTON_YPOS          250
227 #define OK_BUTTON_GFX_YPOS      0
228 #define OK_BUTTON_XSIZE         46
229 #define OK_BUTTON_YSIZE         28
230 #define NO_BUTTON_XPOS          52
231 #define NO_BUTTON_YPOS          OK_BUTTON_YPOS
232 #define NO_BUTTON_XSIZE         OK_BUTTON_XSIZE
233 #define NO_BUTTON_YSIZE         OK_BUTTON_YSIZE
234 #define CONFIRM_BUTTON_XPOS     2
235 #define CONFIRM_BUTTON_GFX_YPOS 30
236 #define CONFIRM_BUTTON_YPOS     OK_BUTTON_YPOS
237 #define CONFIRM_BUTTON_XSIZE    96
238 #define CONFIRM_BUTTON_YSIZE    OK_BUTTON_YSIZE
239
240 #define ON_CHOOSE_BUTTON(x,y)   (((x)>=(DX+OK_BUTTON_XPOS) &&           \
241                                   (x)< (DX+OK_BUTTON_XPOS +             \
242                                         OK_BUTTON_XSIZE) &&             \
243                                   (y)>=(DY+OK_BUTTON_YPOS) &&           \
244                                   (y)< (DY+OK_BUTTON_YPOS +             \
245                                         OK_BUTTON_YSIZE)) ||            \
246                                  ((x)>=(DX+NO_BUTTON_XPOS) &&           \
247                                   (x)< (DX+NO_BUTTON_XPOS +             \
248                                         NO_BUTTON_XSIZE) &&             \
249                                   (y)>=(DY+NO_BUTTON_YPOS) &&           \
250                                   (y)< (DY+NO_BUTTON_YPOS +             \
251                                         NO_BUTTON_YSIZE)))
252 #define ON_CONFIRM_BUTTON(x,y)  (((x)>=(DX+CONFIRM_BUTTON_XPOS) &&      \
253                                   (x)< (DX+CONFIRM_BUTTON_XPOS +        \
254                                         CONFIRM_BUTTON_XSIZE) &&        \
255                                   (y)>=(DY+CONFIRM_BUTTON_YPOS) &&      \
256                                   (y)< (DY+CONFIRM_BUTTON_YPOS +        \
257                                         CONFIRM_BUTTON_YSIZE)))
258 #define CHOOSE_BUTTON(x)        (((x)-(DX+OK_BUTTON_XPOS))/OK_BUTTON_XSIZE)
259
260 /* values for asking control */
261 #define BUTTON_OK               (1L<<0)
262 #define BUTTON_NO               (1L<<1)
263 #define BUTTON_CONFIRM          (1L<<2)
264
265
266 /* some positions in the editor control window */
267 #define ED_BUTTON_EUP_XPOS      35
268 #define ED_BUTTON_EUP_YPOS      5
269 #define ED_BUTTON_EUP_XSIZE     30
270 #define ED_BUTTON_EUP_YSIZE     25
271 #define ED_BUTTON_EDOWN_XPOS    35
272 #define ED_BUTTON_EDOWN_YPOS    250
273 #define ED_BUTTON_EDOWN_XSIZE   30
274 #define ED_BUTTON_EDOWN_YSIZE   25
275 #define ED_BUTTON_ELEM_XPOS     6
276 #define ED_BUTTON_ELEM_YPOS     30
277 #define ED_BUTTON_ELEM_XSIZE    22
278 #define ED_BUTTON_ELEM_YSIZE    22
279
280 #define ED_BUTTON_EUP_Y2POS     140
281 #define ED_BUTTON_EDOWN_Y2POS   165
282 #define ED_BUTTON_ELEM_Y2POS    190
283
284 #define ED_BUTTON_CTRL_XPOS     5
285 #define ED_BUTTON_CTRL_YPOS     5
286 #define ED_BUTTON_CTRL_XSIZE    90
287 #define ED_BUTTON_CTRL_YSIZE    30
288 #define ED_BUTTON_FILL_XPOS     5
289 #define ED_BUTTON_FILL_YPOS     35
290 #define ED_BUTTON_FILL_XSIZE    90
291 #define ED_BUTTON_FILL_YSIZE    20
292 #define ED_BUTTON_LEFT_XPOS     5
293 #define ED_BUTTON_LEFT_YPOS     65
294 #define ED_BUTTON_LEFT_XSIZE    30
295 #define ED_BUTTON_LEFT_YSIZE    20
296 #define ED_BUTTON_UP_XPOS       35
297 #define ED_BUTTON_UP_YPOS       55
298 #define ED_BUTTON_UP_XSIZE      30
299 #define ED_BUTTON_UP_YSIZE      20
300 #define ED_BUTTON_DOWN_XPOS     35
301 #define ED_BUTTON_DOWN_YPOS     75
302 #define ED_BUTTON_DOWN_XSIZE    30
303 #define ED_BUTTON_DOWN_YSIZE    20
304 #define ED_BUTTON_RIGHT_XPOS    65
305 #define ED_BUTTON_RIGHT_YPOS    65
306 #define ED_BUTTON_RIGHT_XSIZE   30
307 #define ED_BUTTON_RIGHT_YSIZE   20
308
309 #define ED_BUTTON_EDIT_XPOS     5
310 #define ED_BUTTON_EDIT_YPOS     5
311 #define ED_BUTTON_EDIT_XSIZE    90
312 #define ED_BUTTON_EDIT_YSIZE    30
313 #define ED_BUTTON_CLEAR_XPOS    5
314 #define ED_BUTTON_CLEAR_YPOS    35
315 #define ED_BUTTON_CLEAR_XSIZE   90
316 #define ED_BUTTON_CLEAR_YSIZE   20
317 #define ED_BUTTON_UNDO_XPOS     5
318 #define ED_BUTTON_UNDO_YPOS     55
319 #define ED_BUTTON_UNDO_XSIZE    90
320 #define ED_BUTTON_UNDO_YSIZE    20
321 #define ED_BUTTON_EXIT_XPOS     5
322 #define ED_BUTTON_EXIT_YPOS     75
323 #define ED_BUTTON_EXIT_XSIZE    90
324 #define ED_BUTTON_EXIT_YSIZE    20
325
326 #define ED_BUTTON_MINUS_XPOS    2
327 #define ED_BUTTON_MINUS_YPOS    60
328 #define ED_BUTTON_MINUS_XSIZE   20
329 #define ED_BUTTON_MINUS_YSIZE   20
330 #define ED_WIN_COUNT_XPOS       (ED_BUTTON_MINUS_XPOS+ED_BUTTON_MINUS_XSIZE+2)
331 #define ED_WIN_COUNT_YPOS       ED_BUTTON_MINUS_YPOS
332 #define ED_WIN_COUNT_XSIZE      52
333 #define ED_WIN_COUNT_YSIZE      ED_BUTTON_MINUS_YSIZE
334 #define ED_BUTTON_PLUS_XPOS     (ED_WIN_COUNT_XPOS+ED_WIN_COUNT_XSIZE+2)
335 #define ED_BUTTON_PLUS_YPOS     ED_BUTTON_MINUS_YPOS
336 #define ED_BUTTON_PLUS_XSIZE    ED_BUTTON_MINUS_XSIZE
337 #define ED_BUTTON_PLUS_YSIZE    ED_BUTTON_MINUS_YSIZE
338
339 #define ED_COUNT_GADGET_XPOS    16
340 #define ED_COUNT_GADGET_YPOS    (16+3*MINI_TILEY+64)
341 #define ED_COUNT_GADGET_YSIZE   (ED_BUTTON_MINUS_YSIZE+4)
342 #define ED_COUNT_TEXT_XPOS      (ED_COUNT_GADGET_XPOS+DXSIZE+10)
343 #define ED_COUNT_TEXT_YPOS      (ED_COUNT_GADGET_YPOS+3)
344 #define ED_COUNT_TEXT_YSIZE     ED_COUNT_GADGET_YSIZE
345 #define ED_COUNT_VALUE_XPOS     (ED_COUNT_GADGET_XPOS+ED_BUTTON_MINUS_XSIZE+7)
346 #define ED_COUNT_VALUE_YPOS     ED_COUNT_TEXT_YPOS
347 #define ED_SIZE_GADGET_XPOS     (SX+21*MINI_TILEX)
348 #define ED_SIZE_GADGET_YPOS     (SY+4*MINI_TILEY)
349 #define ED_SIZE_GADGET_YSIZE    (ED_BUTTON_MINUS_YSIZE+4)
350 #define ED_SIZE_TEXT_XPOS       (ED_SIZE_GADGET_XPOS+DXSIZE+10)
351 #define ED_SIZE_TEXT_YPOS       (ED_SIZE_GADGET_YPOS+3)
352 #define ED_SIZE_TEXT_YSIZE      ED_COUNT_GADGET_YSIZE
353 #define ED_SIZE_VALUE_XPOS      (ED_SIZE_GADGET_XPOS+ED_BUTTON_MINUS_XSIZE+7)
354 #define ED_SIZE_VALUE_YPOS      ED_SIZE_TEXT_YPOS
355
356 #define ON_EDIT_BUTTON(x,y)     (((x)>=(VX+ED_BUTTON_CTRL_XPOS) &&      \
357                                   (x)< (VX+ED_BUTTON_CTRL_XPOS +        \
358                                         ED_BUTTON_CTRL_XSIZE) &&        \
359                                   (y)>=(VY+ED_BUTTON_CTRL_YPOS) &&      \
360                                   (y)< (VY+ED_BUTTON_CTRL_YPOS +        \
361                                         ED_BUTTON_CTRL_YSIZE +          \
362                                         ED_BUTTON_FILL_YSIZE)) ||       \
363                                  ((x)>=(VX+ED_BUTTON_LEFT_XPOS) &&      \
364                                   (x)< (VX+ED_BUTTON_LEFT_XPOS +        \
365                                         ED_BUTTON_LEFT_XSIZE +          \
366                                         ED_BUTTON_UP_XSIZE +            \
367                                         ED_BUTTON_RIGHT_XSIZE) &&       \
368                                   (y)>=(VY+ED_BUTTON_LEFT_YPOS) &&      \
369                                   (y)< (VY+ED_BUTTON_LEFT_YPOS +        \
370                                         ED_BUTTON_LEFT_YSIZE)) ||       \
371                                  ((x)>=(VX+ED_BUTTON_UP_XPOS) &&        \
372                                   (x)< (VX+ED_BUTTON_UP_XPOS +          \
373                                         ED_BUTTON_UP_XSIZE) &&          \
374                                   (y)>=(VY+ED_BUTTON_UP_YPOS) &&        \
375                                   (y)< (VY+ED_BUTTON_UP_YPOS +          \
376                                         ED_BUTTON_UP_YSIZE +            \
377                                         ED_BUTTON_DOWN_YSIZE)))
378
379 #define ON_CTRL_BUTTON(x,y)     ((x)>=(VX+ED_BUTTON_EDIT_XPOS) &&       \
380                                  (x)< (VX+ED_BUTTON_EDIT_XPOS +         \
381                                        ED_BUTTON_EDIT_XSIZE) &&         \
382                                  (y)>=(VY+ED_BUTTON_EDIT_YPOS) &&       \
383                                  (y)< (VY+ED_BUTTON_EDIT_YPOS +         \
384                                        ED_BUTTON_EDIT_YSIZE +           \
385                                        ED_BUTTON_CLEAR_YSIZE +          \
386                                        ED_BUTTON_UNDO_YSIZE +           \
387                                        ED_BUTTON_EXIT_YSIZE))
388
389 #define ON_ELEM_BUTTON(x,y)     (((x)>=(DX+ED_BUTTON_EUP_XPOS) &&       \
390                                   (x)< (DX+ED_BUTTON_EUP_XPOS +         \
391                                         ED_BUTTON_EUP_XSIZE) &&         \
392                                   (y)>=(DY+ED_BUTTON_EUP_YPOS) &&       \
393                                   (y)< (DY+ED_BUTTON_EUP_YPOS +         \
394                                         ED_BUTTON_EUP_YSIZE)) ||        \
395                                  ((x)>=(DX+ED_BUTTON_EDOWN_XPOS) &&     \
396                                   (x)< (DX+ED_BUTTON_EDOWN_XPOS +       \
397                                         ED_BUTTON_EDOWN_XSIZE) &&       \
398                                   (y)>=(DY+ED_BUTTON_EDOWN_YPOS) &&     \
399                                   (y)< (DY+ED_BUTTON_EDOWN_YPOS +       \
400                                         ED_BUTTON_EDOWN_YSIZE)) ||      \
401                                  ((x)>=(DX+ED_BUTTON_ELEM_XPOS) &&      \
402                                   (x)< (DX+ED_BUTTON_ELEM_XPOS +        \
403                                         MAX_ELEM_X*ED_BUTTON_ELEM_XSIZE) && \
404                                   (y)>=(DY+ED_BUTTON_ELEM_YPOS) &&      \
405                                   (y)< (DY+ED_BUTTON_ELEM_YPOS +        \
406                                         MAX_ELEM_Y*ED_BUTTON_ELEM_YSIZE)))
407
408 #define ON_COUNT_BUTTON(x,y)    (((((x)>=ED_COUNT_GADGET_XPOS &&        \
409                                     (x)<(ED_COUNT_GADGET_XPOS +         \
410                                          ED_BUTTON_MINUS_XSIZE)) ||     \
411                                    ((x)>=(ED_COUNT_GADGET_XPOS +        \
412                                           (ED_BUTTON_PLUS_XPOS -        \
413                                            ED_BUTTON_MINUS_XPOS)) &&    \
414                                     (x)<(ED_COUNT_GADGET_XPOS +         \
415                                          (ED_BUTTON_PLUS_XPOS -         \
416                                           ED_BUTTON_MINUS_XPOS) +       \
417                                          ED_BUTTON_PLUS_XSIZE))) &&     \
418                                   ((y)>=ED_COUNT_GADGET_YPOS &&         \
419                                    (y)<(ED_COUNT_GADGET_YPOS +          \
420                                         16*ED_COUNT_GADGET_YSIZE)) &&   \
421                                   (((y)-ED_COUNT_GADGET_YPOS) %         \
422                                    ED_COUNT_GADGET_YSIZE) <             \
423                                   ED_BUTTON_MINUS_YSIZE) ||             \
424                                  ((((x)>=ED_SIZE_GADGET_XPOS &&         \
425                                     (x)<(ED_SIZE_GADGET_XPOS +          \
426                                          ED_BUTTON_MINUS_XSIZE)) ||     \
427                                    ((x)>=(ED_SIZE_GADGET_XPOS +         \
428                                           (ED_BUTTON_PLUS_XPOS -        \
429                                            ED_BUTTON_MINUS_XPOS)) &&    \
430                                     (x)<(ED_SIZE_GADGET_XPOS +          \
431                                          (ED_BUTTON_PLUS_XPOS -         \
432                                           ED_BUTTON_MINUS_XPOS) +       \
433                                          ED_BUTTON_PLUS_XSIZE))) &&     \
434                                   ((y)>=ED_SIZE_GADGET_YPOS &&          \
435                                    (y)<(ED_SIZE_GADGET_YPOS +           \
436                                         2*ED_SIZE_GADGET_YSIZE)) &&     \
437                                   (((y)-ED_SIZE_GADGET_YPOS) %          \
438                                    ED_SIZE_GADGET_YSIZE) <              \
439                                   ED_BUTTON_MINUS_YSIZE))
440
441 #define EDIT_BUTTON(x,y)        (((y) < (VY + ED_BUTTON_CTRL_YPOS +     \
442                                          ED_BUTTON_CTRL_YSIZE)) ? 0 :   \
443                                  ((y) < (VY + ED_BUTTON_CTRL_YPOS +     \
444                                          ED_BUTTON_CTRL_YSIZE +         \
445                                          ED_BUTTON_FILL_YSIZE)) ? 1 :   \
446                                  ((x) < (VX + ED_BUTTON_LEFT_XPOS +     \
447                                          ED_BUTTON_LEFT_XSIZE) ? 2 :    \
448                                   (x) > (VX + ED_BUTTON_LEFT_XPOS +     \
449                                          ED_BUTTON_LEFT_XSIZE +         \
450                                          ED_BUTTON_UP_XSIZE) ? 5 :      \
451                                   3+(((y)-(VY + ED_BUTTON_CTRL_YPOS +   \
452                                            ED_BUTTON_CTRL_YSIZE +       \
453                                            ED_BUTTON_FILL_YSIZE)) /     \
454                                      ED_BUTTON_UP_YSIZE)))
455
456 #define CTRL_BUTTON(x,y)        (((y) < (VY + ED_BUTTON_EDIT_YPOS +     \
457                                          ED_BUTTON_EDIT_YSIZE)) ? 0 :   \
458                                  1+(((y)-(VY + ED_BUTTON_EDIT_YPOS +    \
459                                          ED_BUTTON_EDIT_YSIZE)) /       \
460                                     ED_BUTTON_CLEAR_YSIZE))
461
462 #define ELEM_BUTTON(x,y)        (((y) < (DY + ED_BUTTON_EUP_YPOS +      \
463                                          ED_BUTTON_EUP_YSIZE)) ? 0 :    \
464                                  ((y) > (DY + ED_BUTTON_EDOWN_YPOS)) ? 1 : \
465                                  2+(((y) - (DY + ED_BUTTON_ELEM_YPOS)) /   \
466                                  ED_BUTTON_ELEM_YSIZE)*MAX_ELEM_X +     \
467                                  ((x) - (DX + ED_BUTTON_ELEM_XPOS)) /   \
468                                  ED_BUTTON_ELEM_XSIZE)
469
470 #define COUNT_BUTTON(x,y)       ((x) < ED_SIZE_GADGET_XPOS ?            \
471                                  ((((y) - ED_COUNT_GADGET_YPOS) /       \
472                                    ED_COUNT_GADGET_YSIZE)*2 +           \
473                                   ((x) < (ED_COUNT_GADGET_XPOS +        \
474                                           ED_BUTTON_MINUS_XSIZE) ? 0 : 1)) : \
475                                  32+((((y) - ED_SIZE_GADGET_YPOS) /     \
476                                       ED_SIZE_GADGET_YSIZE)*2 +         \
477                                      ((x) < (ED_SIZE_GADGET_XPOS +      \
478                                              ED_BUTTON_MINUS_XSIZE) ? 0 : 1)))
479
480 /* values for asking control */
481 #define ED_BUTTON_CTRL          (1L<<0)
482 #define ED_BUTTON_FILL          (1L<<1)
483 #define ED_BUTTON_LEFT          (1L<<2)
484 #define ED_BUTTON_UP            (1L<<3)
485 #define ED_BUTTON_DOWN          (1L<<4)
486 #define ED_BUTTON_RIGHT         (1L<<5)
487 #define ED_BUTTON_EDIT          (1L<<6)
488 #define ED_BUTTON_CLEAR         (1L<<7)
489 #define ED_BUTTON_UNDO          (1L<<8)
490 #define ED_BUTTON_EXIT          (1L<<9)
491
492 #define ED_BUTTON_PRESSED       (1L<<10)
493 #define ED_BUTTON_RELEASED      (1L<<11)
494
495 #define ED_BUTTON_EUP           0
496 #define ED_BUTTON_EDOWN         1
497 #define ED_BUTTON_ELEM          2
498
499
500 void DrawVideoDisplay(unsigned long, unsigned long);
501 void DrawCompleteVideoDisplay(void);
502 void DrawSoundDisplay(unsigned long);
503 void DrawGameButton(unsigned long);
504 void DrawChooseButton(unsigned long);
505 void DrawConfirmButton(unsigned long);
506 void DrawEditButton(unsigned long state);
507 void DrawCtrlButton(unsigned long state);
508 void DrawElemButton(int, int);
509 void DrawCountButton(int, int);
510 int CheckVideoButtons(int, int, int);
511 int CheckSoundButtons(int, int, int);
512 int CheckGameButtons(int, int, int);
513 int CheckChooseButtons(int, int, int);
514 int CheckConfirmButton(int, int, int);
515 int CheckEditButtons(int, int, int);
516 int CheckCtrlButtons(int, int, int);
517 int CheckElemButtons(int, int, int);
518 int CheckCountButtons(int, int, int);
519
520 #endif