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