rnd-19981112-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      (3*SOUND_BUTTON_XSIZE)
168 #define SOUND_CONTROL_YSIZE      (1*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      (3*GAME_BUTTON_XSIZE)
204 #define GAME_CONTROL_YSIZE      (1*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 /* some positions in the asking window */
224 #define OK_BUTTON_XPOS          2
225 #define OK_BUTTON_YPOS          250
226 #define OK_BUTTON_GFX_YPOS      0
227 #define OK_BUTTON_XSIZE         46
228 #define OK_BUTTON_YSIZE         28
229 #define NO_BUTTON_XPOS          52
230 #define NO_BUTTON_YPOS          OK_BUTTON_YPOS
231 #define NO_BUTTON_XSIZE         OK_BUTTON_XSIZE
232 #define NO_BUTTON_YSIZE         OK_BUTTON_YSIZE
233 #define CONFIRM_BUTTON_XPOS     2
234 #define CONFIRM_BUTTON_GFX_YPOS 30
235 #define CONFIRM_BUTTON_YPOS     OK_BUTTON_YPOS
236 #define CONFIRM_BUTTON_XSIZE    96
237 #define CONFIRM_BUTTON_YSIZE    OK_BUTTON_YSIZE
238
239 #define ON_YESNO_BUTTON(x,y)    (((x)>=(DX+OK_BUTTON_XPOS) &&           \
240                                   (x)< (DX+OK_BUTTON_XPOS +             \
241                                         OK_BUTTON_XSIZE) &&             \
242                                   (y)>=(DY+OK_BUTTON_YPOS) &&           \
243                                   (y)< (DY+OK_BUTTON_YPOS +             \
244                                         OK_BUTTON_YSIZE)) ||            \
245                                  ((x)>=(DX+NO_BUTTON_XPOS) &&           \
246                                   (x)< (DX+NO_BUTTON_XPOS +             \
247                                         NO_BUTTON_XSIZE) &&             \
248                                   (y)>=(DY+NO_BUTTON_YPOS) &&           \
249                                   (y)< (DY+NO_BUTTON_YPOS +             \
250                                         NO_BUTTON_YSIZE)))
251 #define ON_CONFIRM_BUTTON(x,y)  (((x)>=(DX+CONFIRM_BUTTON_XPOS) &&      \
252                                   (x)< (DX+CONFIRM_BUTTON_XPOS +        \
253                                         CONFIRM_BUTTON_XSIZE) &&        \
254                                   (y)>=(DY+CONFIRM_BUTTON_YPOS) &&      \
255                                   (y)< (DY+CONFIRM_BUTTON_YPOS +        \
256                                         CONFIRM_BUTTON_YSIZE)))
257 #define YESNO_BUTTON(x)         (((x)-(DX+OK_BUTTON_XPOS))/OK_BUTTON_XSIZE)
258
259 /* values for asking control */
260 #define BUTTON_OK               (1L<<0)
261 #define BUTTON_NO               (1L<<1)
262 #define BUTTON_CONFIRM          (1L<<2)
263
264 /* some positions in the choose player window */
265
266 #define PLAYER_BUTTON_XSIZE     30
267 #define PLAYER_BUTTON_YSIZE     30
268 #define PLAYER_BUTTON_GFX_XPOS  5
269 #define PLAYER_BUTTON_GFX_YPOS  (215-30)
270 #define PLAYER_CONTROL_XPOS     (5 + PLAYER_BUTTON_XSIZE/2)
271 #define PLAYER_CONTROL_YPOS     (215 - PLAYER_BUTTON_YSIZE/2)
272 #define PLAYER_CONTROL_XSIZE    (2*PLAYER_BUTTON_XSIZE)
273 #define PLAYER_CONTROL_YSIZE    (2*PLAYER_BUTTON_YSIZE)
274 #define PLAYER_BUTTON_1_XPOS    (PLAYER_CONTROL_XPOS + 0 * PLAYER_BUTTON_XSIZE)
275 #define PLAYER_BUTTON_2_XPOS    (PLAYER_CONTROL_XPOS + 1 * PLAYER_BUTTON_XSIZE)
276 #define PLAYER_BUTTON_3_XPOS    (PLAYER_CONTROL_XPOS + 0 * PLAYER_BUTTON_XSIZE)
277 #define PLAYER_BUTTON_4_XPOS    (PLAYER_CONTROL_XPOS + 1 * PLAYER_BUTTON_XSIZE)
278 #define PLAYER_BUTTON_1_YPOS    (PLAYER_CONTROL_YPOS + 0 * PLAYER_BUTTON_YSIZE)
279 #define PLAYER_BUTTON_2_YPOS    (PLAYER_CONTROL_YPOS + 0 * PLAYER_BUTTON_YSIZE)
280 #define PLAYER_BUTTON_3_YPOS    (PLAYER_CONTROL_YPOS + 1 * PLAYER_BUTTON_YSIZE)
281 #define PLAYER_BUTTON_4_YPOS    (PLAYER_CONTROL_YPOS + 1 * PLAYER_BUTTON_YSIZE)
282
283 #define ON_PLAYER_BUTTON(x,y)   ((x)>=(DX+PLAYER_CONTROL_XPOS) &&       \
284                                  (x)< (DX+PLAYER_CONTROL_XPOS +         \
285                                        PLAYER_CONTROL_XSIZE) &&         \
286                                  (y)>=(DY+PLAYER_CONTROL_YPOS) &&       \
287                                  (y)< (DY+PLAYER_CONTROL_YPOS +         \
288                                        PLAYER_CONTROL_YSIZE))
289 #define PLAYER_BUTTON(x,y)      ((((x)-(DX+PLAYER_CONTROL_XPOS)) /      \
290                                   PLAYER_BUTTON_XSIZE) + 2 *            \
291                                  (((y)-(DY+PLAYER_CONTROL_YPOS)) /      \
292                                   PLAYER_BUTTON_YSIZE))
293
294 /* values for choose player control */
295 #define BUTTON_PLAYER_1         (1L<<10)
296 #define BUTTON_PLAYER_2         (1L<<11)
297 #define BUTTON_PLAYER_3         (1L<<12)
298 #define BUTTON_PLAYER_4         (1L<<13)
299
300
301 /* some positions in the editor control window */
302 #define ED_BUTTON_EUP_XPOS      35
303 #define ED_BUTTON_EUP_YPOS      5
304 #define ED_BUTTON_EUP_XSIZE     30
305 #define ED_BUTTON_EUP_YSIZE     25
306 #define ED_BUTTON_EDOWN_XPOS    35
307 #define ED_BUTTON_EDOWN_YPOS    250
308 #define ED_BUTTON_EDOWN_XSIZE   30
309 #define ED_BUTTON_EDOWN_YSIZE   25
310 #define ED_BUTTON_ELEM_XPOS     6
311 #define ED_BUTTON_ELEM_YPOS     30
312 #define ED_BUTTON_ELEM_XSIZE    22
313 #define ED_BUTTON_ELEM_YSIZE    22
314
315 #define ED_BUTTON_EUP_Y2POS     140
316 #define ED_BUTTON_EDOWN_Y2POS   165
317 #define ED_BUTTON_ELEM_Y2POS    190
318
319 #define ED_BUTTON_CTRL_XPOS     5
320 #define ED_BUTTON_CTRL_YPOS     5
321 #define ED_BUTTON_CTRL_XSIZE    90
322 #define ED_BUTTON_CTRL_YSIZE    30
323 #define ED_BUTTON_FILL_XPOS     5
324 #define ED_BUTTON_FILL_YPOS     35
325 #define ED_BUTTON_FILL_XSIZE    90
326 #define ED_BUTTON_FILL_YSIZE    20
327 #define ED_BUTTON_LEFT_XPOS     5
328 #define ED_BUTTON_LEFT_YPOS     65
329 #define ED_BUTTON_LEFT_XSIZE    30
330 #define ED_BUTTON_LEFT_YSIZE    20
331 #define ED_BUTTON_UP_XPOS       35
332 #define ED_BUTTON_UP_YPOS       55
333 #define ED_BUTTON_UP_XSIZE      30
334 #define ED_BUTTON_UP_YSIZE      20
335 #define ED_BUTTON_DOWN_XPOS     35
336 #define ED_BUTTON_DOWN_YPOS     75
337 #define ED_BUTTON_DOWN_XSIZE    30
338 #define ED_BUTTON_DOWN_YSIZE    20
339 #define ED_BUTTON_RIGHT_XPOS    65
340 #define ED_BUTTON_RIGHT_YPOS    65
341 #define ED_BUTTON_RIGHT_XSIZE   30
342 #define ED_BUTTON_RIGHT_YSIZE   20
343
344 #define ED_BUTTON_EDIT_XPOS     5
345 #define ED_BUTTON_EDIT_YPOS     5
346 #define ED_BUTTON_EDIT_XSIZE    90
347 #define ED_BUTTON_EDIT_YSIZE    30
348 #define ED_BUTTON_CLEAR_XPOS    5
349 #define ED_BUTTON_CLEAR_YPOS    35
350 #define ED_BUTTON_CLEAR_XSIZE   90
351 #define ED_BUTTON_CLEAR_YSIZE   20
352 #define ED_BUTTON_UNDO_XPOS     5
353 #define ED_BUTTON_UNDO_YPOS     55
354 #define ED_BUTTON_UNDO_XSIZE    90
355 #define ED_BUTTON_UNDO_YSIZE    20
356 #define ED_BUTTON_EXIT_XPOS     5
357 #define ED_BUTTON_EXIT_YPOS     75
358 #define ED_BUTTON_EXIT_XSIZE    90
359 #define ED_BUTTON_EXIT_YSIZE    20
360
361 #define ED_BUTTON_MINUS_XPOS    2
362 #define ED_BUTTON_MINUS_YPOS    60
363 #define ED_BUTTON_MINUS_XSIZE   20
364 #define ED_BUTTON_MINUS_YSIZE   20
365 #define ED_WIN_COUNT_XPOS       (ED_BUTTON_MINUS_XPOS+ED_BUTTON_MINUS_XSIZE+2)
366 #define ED_WIN_COUNT_YPOS       ED_BUTTON_MINUS_YPOS
367 #define ED_WIN_COUNT_XSIZE      52
368 #define ED_WIN_COUNT_YSIZE      ED_BUTTON_MINUS_YSIZE
369 #define ED_BUTTON_PLUS_XPOS     (ED_WIN_COUNT_XPOS+ED_WIN_COUNT_XSIZE+2)
370 #define ED_BUTTON_PLUS_YPOS     ED_BUTTON_MINUS_YPOS
371 #define ED_BUTTON_PLUS_XSIZE    ED_BUTTON_MINUS_XSIZE
372 #define ED_BUTTON_PLUS_YSIZE    ED_BUTTON_MINUS_YSIZE
373
374 #define ED_COUNT_GADGET_XPOS    16
375 #define ED_COUNT_GADGET_YPOS    (16+3*MINI_TILEY+64)
376 #define ED_COUNT_GADGET_YSIZE   (ED_BUTTON_MINUS_YSIZE+4)
377 #define ED_COUNT_TEXT_XPOS      (ED_COUNT_GADGET_XPOS+DXSIZE+10)
378 #define ED_COUNT_TEXT_YPOS      (ED_COUNT_GADGET_YPOS+3)
379 #define ED_COUNT_TEXT_YSIZE     ED_COUNT_GADGET_YSIZE
380 #define ED_COUNT_VALUE_XPOS     (ED_COUNT_GADGET_XPOS+ED_BUTTON_MINUS_XSIZE+7)
381 #define ED_COUNT_VALUE_YPOS     ED_COUNT_TEXT_YPOS
382 #define ED_SIZE_GADGET_XPOS     (SX+21*MINI_TILEX)
383 #define ED_SIZE_GADGET_YPOS     (SY+4*MINI_TILEY)
384 #define ED_SIZE_GADGET_YSIZE    (ED_BUTTON_MINUS_YSIZE+4)
385 #define ED_SIZE_TEXT_XPOS       (ED_SIZE_GADGET_XPOS+DXSIZE+10)
386 #define ED_SIZE_TEXT_YPOS       (ED_SIZE_GADGET_YPOS+3)
387 #define ED_SIZE_TEXT_YSIZE      ED_COUNT_GADGET_YSIZE
388 #define ED_SIZE_VALUE_XPOS      (ED_SIZE_GADGET_XPOS+ED_BUTTON_MINUS_XSIZE+7)
389 #define ED_SIZE_VALUE_YPOS      ED_SIZE_TEXT_YPOS
390
391 #define ON_EDIT_BUTTON(x,y)     (((x)>=(VX+ED_BUTTON_CTRL_XPOS) &&      \
392                                   (x)< (VX+ED_BUTTON_CTRL_XPOS +        \
393                                         ED_BUTTON_CTRL_XSIZE) &&        \
394                                   (y)>=(VY+ED_BUTTON_CTRL_YPOS) &&      \
395                                   (y)< (VY+ED_BUTTON_CTRL_YPOS +        \
396                                         ED_BUTTON_CTRL_YSIZE +          \
397                                         ED_BUTTON_FILL_YSIZE)) ||       \
398                                  ((x)>=(VX+ED_BUTTON_LEFT_XPOS) &&      \
399                                   (x)< (VX+ED_BUTTON_LEFT_XPOS +        \
400                                         ED_BUTTON_LEFT_XSIZE +          \
401                                         ED_BUTTON_UP_XSIZE +            \
402                                         ED_BUTTON_RIGHT_XSIZE) &&       \
403                                   (y)>=(VY+ED_BUTTON_LEFT_YPOS) &&      \
404                                   (y)< (VY+ED_BUTTON_LEFT_YPOS +        \
405                                         ED_BUTTON_LEFT_YSIZE)) ||       \
406                                  ((x)>=(VX+ED_BUTTON_UP_XPOS) &&        \
407                                   (x)< (VX+ED_BUTTON_UP_XPOS +          \
408                                         ED_BUTTON_UP_XSIZE) &&          \
409                                   (y)>=(VY+ED_BUTTON_UP_YPOS) &&        \
410                                   (y)< (VY+ED_BUTTON_UP_YPOS +          \
411                                         ED_BUTTON_UP_YSIZE +            \
412                                         ED_BUTTON_DOWN_YSIZE)))
413
414 #define ON_CTRL_BUTTON(x,y)     ((x)>=(VX+ED_BUTTON_EDIT_XPOS) &&       \
415                                  (x)< (VX+ED_BUTTON_EDIT_XPOS +         \
416                                        ED_BUTTON_EDIT_XSIZE) &&         \
417                                  (y)>=(VY+ED_BUTTON_EDIT_YPOS) &&       \
418                                  (y)< (VY+ED_BUTTON_EDIT_YPOS +         \
419                                        ED_BUTTON_EDIT_YSIZE +           \
420                                        ED_BUTTON_CLEAR_YSIZE +          \
421                                        ED_BUTTON_UNDO_YSIZE +           \
422                                        ED_BUTTON_EXIT_YSIZE))
423
424 #define ON_ELEM_BUTTON(x,y)     (((x)>=(DX+ED_BUTTON_EUP_XPOS) &&       \
425                                   (x)< (DX+ED_BUTTON_EUP_XPOS +         \
426                                         ED_BUTTON_EUP_XSIZE) &&         \
427                                   (y)>=(DY+ED_BUTTON_EUP_YPOS) &&       \
428                                   (y)< (DY+ED_BUTTON_EUP_YPOS +         \
429                                         ED_BUTTON_EUP_YSIZE)) ||        \
430                                  ((x)>=(DX+ED_BUTTON_EDOWN_XPOS) &&     \
431                                   (x)< (DX+ED_BUTTON_EDOWN_XPOS +       \
432                                         ED_BUTTON_EDOWN_XSIZE) &&       \
433                                   (y)>=(DY+ED_BUTTON_EDOWN_YPOS) &&     \
434                                   (y)< (DY+ED_BUTTON_EDOWN_YPOS +       \
435                                         ED_BUTTON_EDOWN_YSIZE)) ||      \
436                                  ((x)>=(DX+ED_BUTTON_ELEM_XPOS) &&      \
437                                   (x)< (DX+ED_BUTTON_ELEM_XPOS +        \
438                                         MAX_ELEM_X*ED_BUTTON_ELEM_XSIZE) && \
439                                   (y)>=(DY+ED_BUTTON_ELEM_YPOS) &&      \
440                                   (y)< (DY+ED_BUTTON_ELEM_YPOS +        \
441                                         MAX_ELEM_Y*ED_BUTTON_ELEM_YSIZE)))
442
443 #define ON_COUNT_BUTTON(x,y)    (((((x)>=ED_COUNT_GADGET_XPOS &&        \
444                                     (x)<(ED_COUNT_GADGET_XPOS +         \
445                                          ED_BUTTON_MINUS_XSIZE)) ||     \
446                                    ((x)>=(ED_COUNT_GADGET_XPOS +        \
447                                           (ED_BUTTON_PLUS_XPOS -        \
448                                            ED_BUTTON_MINUS_XPOS)) &&    \
449                                     (x)<(ED_COUNT_GADGET_XPOS +         \
450                                          (ED_BUTTON_PLUS_XPOS -         \
451                                           ED_BUTTON_MINUS_XPOS) +       \
452                                          ED_BUTTON_PLUS_XSIZE))) &&     \
453                                   ((y)>=ED_COUNT_GADGET_YPOS &&         \
454                                    (y)<(ED_COUNT_GADGET_YPOS +          \
455                                         16*ED_COUNT_GADGET_YSIZE)) &&   \
456                                   (((y)-ED_COUNT_GADGET_YPOS) %         \
457                                    ED_COUNT_GADGET_YSIZE) <             \
458                                   ED_BUTTON_MINUS_YSIZE) ||             \
459                                  ((((x)>=ED_SIZE_GADGET_XPOS &&         \
460                                     (x)<(ED_SIZE_GADGET_XPOS +          \
461                                          ED_BUTTON_MINUS_XSIZE)) ||     \
462                                    ((x)>=(ED_SIZE_GADGET_XPOS +         \
463                                           (ED_BUTTON_PLUS_XPOS -        \
464                                            ED_BUTTON_MINUS_XPOS)) &&    \
465                                     (x)<(ED_SIZE_GADGET_XPOS +          \
466                                          (ED_BUTTON_PLUS_XPOS -         \
467                                           ED_BUTTON_MINUS_XPOS) +       \
468                                          ED_BUTTON_PLUS_XSIZE))) &&     \
469                                   ((y)>=ED_SIZE_GADGET_YPOS &&          \
470                                    (y)<(ED_SIZE_GADGET_YPOS +           \
471                                         2*ED_SIZE_GADGET_YSIZE)) &&     \
472                                   (((y)-ED_SIZE_GADGET_YPOS) %          \
473                                    ED_SIZE_GADGET_YSIZE) <              \
474                                   ED_BUTTON_MINUS_YSIZE))
475
476 #define EDIT_BUTTON(x,y)        (((y) < (VY + ED_BUTTON_CTRL_YPOS +     \
477                                          ED_BUTTON_CTRL_YSIZE)) ? 0 :   \
478                                  ((y) < (VY + ED_BUTTON_CTRL_YPOS +     \
479                                          ED_BUTTON_CTRL_YSIZE +         \
480                                          ED_BUTTON_FILL_YSIZE)) ? 1 :   \
481                                  ((x) < (VX + ED_BUTTON_LEFT_XPOS +     \
482                                          ED_BUTTON_LEFT_XSIZE) ? 2 :    \
483                                   (x) > (VX + ED_BUTTON_LEFT_XPOS +     \
484                                          ED_BUTTON_LEFT_XSIZE +         \
485                                          ED_BUTTON_UP_XSIZE) ? 5 :      \
486                                   3+(((y)-(VY + ED_BUTTON_CTRL_YPOS +   \
487                                            ED_BUTTON_CTRL_YSIZE +       \
488                                            ED_BUTTON_FILL_YSIZE)) /     \
489                                      ED_BUTTON_UP_YSIZE)))
490
491 #define CTRL_BUTTON(x,y)        (((y) < (VY + ED_BUTTON_EDIT_YPOS +     \
492                                          ED_BUTTON_EDIT_YSIZE)) ? 0 :   \
493                                  1+(((y)-(VY + ED_BUTTON_EDIT_YPOS +    \
494                                          ED_BUTTON_EDIT_YSIZE)) /       \
495                                     ED_BUTTON_CLEAR_YSIZE))
496
497 #define ELEM_BUTTON(x,y)        (((y) < (DY + ED_BUTTON_EUP_YPOS +      \
498                                          ED_BUTTON_EUP_YSIZE)) ? 0 :    \
499                                  ((y) > (DY + ED_BUTTON_EDOWN_YPOS)) ? 1 : \
500                                  2+(((y) - (DY + ED_BUTTON_ELEM_YPOS)) /   \
501                                  ED_BUTTON_ELEM_YSIZE)*MAX_ELEM_X +     \
502                                  ((x) - (DX + ED_BUTTON_ELEM_XPOS)) /   \
503                                  ED_BUTTON_ELEM_XSIZE)
504
505 #define COUNT_BUTTON(x,y)       ((x) < ED_SIZE_GADGET_XPOS ?            \
506                                  ((((y) - ED_COUNT_GADGET_YPOS) /       \
507                                    ED_COUNT_GADGET_YSIZE)*2 +           \
508                                   ((x) < (ED_COUNT_GADGET_XPOS +        \
509                                           ED_BUTTON_MINUS_XSIZE) ? 0 : 1)) : \
510                                  32+((((y) - ED_SIZE_GADGET_YPOS) /     \
511                                       ED_SIZE_GADGET_YSIZE)*2 +         \
512                                      ((x) < (ED_SIZE_GADGET_XPOS +      \
513                                              ED_BUTTON_MINUS_XSIZE) ? 0 : 1)))
514
515 /* values for asking control */
516 #define ED_BUTTON_CTRL          (1L<<0)
517 #define ED_BUTTON_FILL          (1L<<1)
518 #define ED_BUTTON_LEFT          (1L<<2)
519 #define ED_BUTTON_UP            (1L<<3)
520 #define ED_BUTTON_DOWN          (1L<<4)
521 #define ED_BUTTON_RIGHT         (1L<<5)
522 #define ED_BUTTON_EDIT          (1L<<6)
523 #define ED_BUTTON_CLEAR         (1L<<7)
524 #define ED_BUTTON_UNDO          (1L<<8)
525 #define ED_BUTTON_EXIT          (1L<<9)
526
527 #define ED_BUTTON_PRESSED       (1L<<10)
528 #define ED_BUTTON_RELEASED      (1L<<11)
529
530 #define ED_BUTTON_EUP           0
531 #define ED_BUTTON_EDOWN         1
532 #define ED_BUTTON_ELEM          2
533
534
535 /* for DrawPlayerButton() */
536
537 #define DB_INIT                 0
538 #define DB_NORMAL               1
539
540 void DrawVideoDisplay(unsigned long, unsigned long);
541 void DrawCompleteVideoDisplay(void);
542 void DrawSoundDisplay(unsigned long);
543 void DrawGameButton(unsigned long);
544 void DrawYesNoButton(unsigned long, int);
545 void DrawConfirmButton(unsigned long, int);
546 void DrawPlayerButton(unsigned long, int);
547 void DrawEditButton(unsigned long state);
548 void DrawCtrlButton(unsigned long state);
549 void DrawElemButton(int, int);
550 void DrawCountButton(int, int);
551 int CheckVideoButtons(int, int, int);
552 int CheckSoundButtons(int, int, int);
553 int CheckGameButtons(int, int, int);
554 int CheckYesNoButtons(int, int, int);
555 int CheckConfirmButton(int, int, int);
556 int CheckPlayerButtons(int, int, int);
557 int CheckEditButtons(int, int, int);
558 int CheckCtrlButtons(int, int, int);
559 int CheckElemButtons(int, int, int);
560 int CheckCountButtons(int, int, int);
561
562 #endif