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