1 /***********************************************************
2 * Rocks'n'Diamonds -- McDuffin Strikes Back! *
3 *----------------------------------------------------------*
4 * ©1995 Artsoft Development *
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 *----------------------------------------------------------*
13 ***********************************************************/
21 /****************************************************************/
22 /********** drawing buttons and corresponding displays **********/
23 /****************************************************************/
25 void DrawVideoDisplay(unsigned long state, unsigned long value)
28 int part_label = 0, part_symbol = 1;
29 int xpos = 0, ypos = 1, xsize = 2, ysize = 3;
30 static char *monatsname[12] =
32 "JAN", "FEB", "MAR", "APR", "MAY", "JUN",
33 "JUL", "AUG", "SEP", "OCT", "NOV", "DEC"
35 static int video_pos[10][2][4] =
37 {{ VIDEO_PLAY_LABEL_XPOS, VIDEO_PLAY_LABEL_YPOS,
38 VIDEO_PLAY_LABEL_XSIZE,VIDEO_PLAY_LABEL_YSIZE },
39 { VIDEO_PLAY_SYMBOL_XPOS, VIDEO_PLAY_SYMBOL_YPOS,
40 VIDEO_PLAY_SYMBOL_XSIZE,VIDEO_PLAY_SYMBOL_YSIZE }},
42 {{ VIDEO_REC_LABEL_XPOS, VIDEO_REC_LABEL_YPOS,
43 VIDEO_REC_LABEL_XSIZE,VIDEO_REC_LABEL_YSIZE },
44 { VIDEO_REC_SYMBOL_XPOS, VIDEO_REC_SYMBOL_YPOS,
45 VIDEO_REC_SYMBOL_XSIZE,VIDEO_REC_SYMBOL_YSIZE }},
47 {{ VIDEO_PAUSE_LABEL_XPOS, VIDEO_PAUSE_LABEL_YPOS,
48 VIDEO_PAUSE_LABEL_XSIZE,VIDEO_PAUSE_LABEL_YSIZE },
49 { VIDEO_PAUSE_SYMBOL_XPOS, VIDEO_PAUSE_SYMBOL_YPOS,
50 VIDEO_PAUSE_SYMBOL_XSIZE,VIDEO_PAUSE_SYMBOL_YSIZE }},
52 {{ VIDEO_DATE_LABEL_XPOS, VIDEO_DATE_LABEL_YPOS,
53 VIDEO_DATE_LABEL_XSIZE,VIDEO_DATE_LABEL_YSIZE },
54 { VIDEO_DATE_XPOS, VIDEO_DATE_YPOS,
55 VIDEO_DATE_XSIZE,VIDEO_DATE_YSIZE }},
59 { VIDEO_TIME_XPOS, VIDEO_TIME_YPOS,
60 VIDEO_TIME_XSIZE,VIDEO_TIME_YSIZE }},
62 {{ VIDEO_BUTTON_PLAY_XPOS, VIDEO_BUTTON_ANY_YPOS,
63 VIDEO_BUTTON_XSIZE,VIDEO_BUTTON_YSIZE },
67 {{ VIDEO_BUTTON_REC_XPOS, VIDEO_BUTTON_ANY_YPOS,
68 VIDEO_BUTTON_XSIZE,VIDEO_BUTTON_YSIZE },
72 {{ VIDEO_BUTTON_PAUSE_XPOS, VIDEO_BUTTON_ANY_YPOS,
73 VIDEO_BUTTON_XSIZE,VIDEO_BUTTON_YSIZE },
77 {{ VIDEO_BUTTON_STOP_XPOS, VIDEO_BUTTON_ANY_YPOS,
78 VIDEO_BUTTON_XSIZE,VIDEO_BUTTON_YSIZE },
82 {{ VIDEO_BUTTON_EJECT_XPOS, VIDEO_BUTTON_ANY_YPOS,
83 VIDEO_BUTTON_XSIZE,VIDEO_BUTTON_YSIZE },
92 int pos = i/2, cx, cy = DOOR_GFX_PAGEY2;
94 if (i%2) /* i ungerade => STATE_ON / PRESS_OFF */
97 cx = DOOR_GFX_PAGEX3; /* i gerade => STATE_OFF / PRESS_ON */
99 if (video_pos[pos][part_label][0] && value != VIDEO_DISPLAY_SYMBOL_ONLY)
100 XCopyArea(display,pix[PIX_DOOR],drawto,gc,
101 cx + video_pos[pos][part_label][xpos],
102 cy + video_pos[pos][part_label][ypos],
103 video_pos[pos][part_label][xsize],
104 video_pos[pos][part_label][ysize],
105 VX + video_pos[pos][part_label][xpos],
106 VY + video_pos[pos][part_label][ypos]);
107 if (video_pos[pos][part_symbol][0] && value != VIDEO_DISPLAY_LABEL_ONLY)
108 XCopyArea(display,pix[PIX_DOOR],drawto,gc,
109 cx + video_pos[pos][part_symbol][xpos],
110 cy + video_pos[pos][part_symbol][ypos],
111 video_pos[pos][part_symbol][xsize],
112 video_pos[pos][part_symbol][ysize],
113 VX + video_pos[pos][part_symbol][xpos],
114 VY + video_pos[pos][part_symbol][ypos]);
118 if (state & VIDEO_STATE_FFWD_ON)
120 int cx = DOOR_GFX_PAGEX4, cy = DOOR_GFX_PAGEY2;
122 XCopyArea(display,pix[PIX_DOOR],drawto,gc,
123 cx + VIDEO_PLAY_SYMBOL_XPOS,
124 cy + VIDEO_PLAY_SYMBOL_YPOS,
125 VIDEO_PLAY_SYMBOL_XSIZE - 2,
126 VIDEO_PLAY_SYMBOL_YSIZE,
127 VX + VIDEO_PLAY_SYMBOL_XPOS - 9,
128 VY + VIDEO_PLAY_SYMBOL_YPOS);
131 if (state & VIDEO_STATE_DATE_ON)
133 int tag = value % 100;
134 int monat = (value/100) % 100;
135 int jahr = (value/10000);
137 DrawText(VX+VIDEO_DATE_XPOS,VY+VIDEO_DATE_YPOS,
138 int2str(tag,2),FS_SMALL,FC_SPECIAL1);
139 DrawText(VX+VIDEO_DATE_XPOS+27,VY+VIDEO_DATE_YPOS,
140 monatsname[monat],FS_SMALL,FC_SPECIAL1);
141 DrawText(VX+VIDEO_DATE_XPOS+64,VY+VIDEO_DATE_YPOS,
142 int2str(jahr,2),FS_SMALL,FC_SPECIAL1);
145 if (state & VIDEO_STATE_TIME_ON)
147 int min = value / 60;
148 int sec = value % 60;
150 DrawText(VX+VIDEO_TIME_XPOS,VY+VIDEO_TIME_YPOS,
151 int2str(min,2),FS_SMALL,FC_SPECIAL1);
152 DrawText(VX+VIDEO_TIME_XPOS+27,VY+VIDEO_TIME_YPOS,
153 int2str(sec,2),FS_SMALL,FC_SPECIAL1);
156 if (state & VIDEO_STATE_DATE)
157 redraw_mask |= REDRAW_VIDEO_1;
158 if ((state & ~VIDEO_STATE_DATE) & VIDEO_STATE)
159 redraw_mask |= REDRAW_VIDEO_2;
160 if (state & VIDEO_PRESS)
161 redraw_mask |= REDRAW_VIDEO_3;
164 void DrawCompleteVideoDisplay()
166 XCopyArea(display,pix[PIX_DOOR],drawto,gc,
167 DOOR_GFX_PAGEX3,DOOR_GFX_PAGEY2, VXSIZE,VYSIZE, VX,VY);
168 XCopyArea(display,pix[PIX_DOOR],drawto,gc,
169 DOOR_GFX_PAGEX4+VIDEO_CONTROL_XPOS,
170 DOOR_GFX_PAGEY2+VIDEO_CONTROL_YPOS,
171 VIDEO_CONTROL_XSIZE,VIDEO_CONTROL_YSIZE,
172 VX+VIDEO_CONTROL_XPOS,VY+VIDEO_CONTROL_YPOS);
174 DrawVideoDisplay(VIDEO_ALL_OFF,0);
175 if (tape.date && tape.length)
177 DrawVideoDisplay(VIDEO_STATE_DATE_ON,tape.date);
178 DrawVideoDisplay(VIDEO_STATE_TIME_ON,tape.length_seconds);
181 XCopyArea(display,drawto,pix[PIX_DB_DOOR],gc,
182 VX,VY, VXSIZE,VYSIZE, DOOR_GFX_PAGEX1,DOOR_GFX_PAGEY2);
185 void DrawSoundDisplay(unsigned long state)
187 int pos, cx = DOOR_GFX_PAGEX4, cy = 0;
189 pos = (state & BUTTON_SOUND_MUSIC ? SOUND_BUTTON_MUSIC_XPOS :
190 state & BUTTON_SOUND_LOOPS ? SOUND_BUTTON_LOOPS_XPOS :
191 SOUND_BUTTON_SIMPLE_XPOS);
193 if (state & BUTTON_ON)
194 cy -= SOUND_BUTTON_YSIZE;
196 if (state & BUTTON_PRESSED)
197 cx = DOOR_GFX_PAGEX3;
199 XCopyArea(display,pix[PIX_DOOR],drawto,gc,
200 cx + pos,cy + SOUND_BUTTON_ANY_YPOS,
201 SOUND_BUTTON_XSIZE,SOUND_BUTTON_YSIZE,
202 DX + pos,DY + SOUND_BUTTON_ANY_YPOS);
204 redraw_mask |= REDRAW_DOOR_1;
207 void DrawGameButton(unsigned long state)
209 int pos, cx = DOOR_GFX_PAGEX4, cy = -GAME_BUTTON_YSIZE;
211 pos = (state & BUTTON_GAME_STOP ? GAME_BUTTON_STOP_XPOS :
212 state & BUTTON_GAME_PAUSE ? GAME_BUTTON_PAUSE_XPOS :
213 GAME_BUTTON_PLAY_XPOS);
215 if (state & BUTTON_PRESSED)
216 cx = DOOR_GFX_PAGEX3;
218 XCopyArea(display,pix[PIX_DOOR],drawto,gc,
219 cx + pos,cy + GAME_BUTTON_ANY_YPOS,
220 GAME_BUTTON_XSIZE,GAME_BUTTON_YSIZE,
221 DX + pos,DY + GAME_BUTTON_ANY_YPOS);
223 redraw_mask |= REDRAW_DOOR_1;
226 void DrawChooseButton(unsigned long state)
228 int pos, cx = DOOR_GFX_PAGEX4, cy = 0;
230 pos = (state & BUTTON_OK ? OK_BUTTON_XPOS : NO_BUTTON_XPOS);
232 if (state & BUTTON_PRESSED)
233 cx = DOOR_GFX_PAGEX3;
235 XCopyArea(display,pix[PIX_DOOR],drawto,gc,
236 cx + pos,cy + OK_BUTTON_GFX_YPOS,
237 OK_BUTTON_XSIZE,OK_BUTTON_YSIZE,
238 DX + pos,DY + OK_BUTTON_YPOS);
240 redraw_mask |= REDRAW_DOOR_1;
243 void DrawConfirmButton(unsigned long state)
245 int cx = DOOR_GFX_PAGEX4, cy = 0;
247 if (state & BUTTON_PRESSED)
248 cx = DOOR_GFX_PAGEX3;
250 XCopyArea(display,pix[PIX_DOOR],drawto,gc,
251 cx + CONFIRM_BUTTON_XPOS,cy + CONFIRM_BUTTON_GFX_YPOS,
252 CONFIRM_BUTTON_XSIZE,CONFIRM_BUTTON_YSIZE,
253 DX + CONFIRM_BUTTON_XPOS,DY + CONFIRM_BUTTON_YPOS);
255 redraw_mask |= REDRAW_DOOR_1;
258 /* several buttons in the level editor */
260 void DrawEditButton(unsigned long state)
263 int xpos = 0, ypos = 1, xsize = 2, ysize = 3;
264 int cx = DOOR_GFX_PAGEX6, cy = DOOR_GFX_PAGEY2;
265 static int edit_pos[6][4] =
267 {ED_BUTTON_CTRL_XPOS,ED_BUTTON_CTRL_YPOS,
268 ED_BUTTON_CTRL_XSIZE,ED_BUTTON_CTRL_YSIZE},
270 {ED_BUTTON_FILL_XPOS,ED_BUTTON_FILL_YPOS,
271 ED_BUTTON_FILL_XSIZE,ED_BUTTON_FILL_YSIZE},
273 {ED_BUTTON_LEFT_XPOS,ED_BUTTON_LEFT_YPOS,
274 ED_BUTTON_LEFT_XSIZE,ED_BUTTON_LEFT_YSIZE},
276 {ED_BUTTON_UP_XPOS,ED_BUTTON_UP_YPOS,
277 ED_BUTTON_UP_XSIZE,ED_BUTTON_UP_YSIZE},
279 {ED_BUTTON_DOWN_XPOS,ED_BUTTON_DOWN_YPOS,
280 ED_BUTTON_DOWN_XSIZE,ED_BUTTON_DOWN_YSIZE},
282 {ED_BUTTON_RIGHT_XPOS,ED_BUTTON_RIGHT_YPOS,
283 ED_BUTTON_RIGHT_XSIZE,ED_BUTTON_RIGHT_YSIZE}
286 if (state & ED_BUTTON_PRESSED)
287 cx = DOOR_GFX_PAGEX5;
292 XCopyArea(display,pix[PIX_DOOR],drawto,gc,
293 cx + edit_pos[i][xpos],
294 cy + edit_pos[i][ypos],
297 VX + edit_pos[i][xpos],
298 VY + edit_pos[i][ypos]);
301 redraw_mask |= REDRAW_DOOR_2;
304 void DrawCtrlButton(unsigned long state)
307 int xpos = 0, ypos = 1, xsize = 2, ysize = 3;
308 int cx = DOOR_GFX_PAGEX4, cy = DOOR_GFX_PAGEY1+80;
309 static int edit_pos[4][4] =
311 {ED_BUTTON_EDIT_XPOS,ED_BUTTON_EDIT_YPOS,
312 ED_BUTTON_EDIT_XSIZE,ED_BUTTON_EDIT_YSIZE},
314 {ED_BUTTON_CLEAR_XPOS,ED_BUTTON_CLEAR_YPOS,
315 ED_BUTTON_CLEAR_XSIZE,ED_BUTTON_CLEAR_YSIZE},
317 {ED_BUTTON_UNDO_XPOS,ED_BUTTON_UNDO_YPOS,
318 ED_BUTTON_UNDO_XSIZE,ED_BUTTON_UNDO_YSIZE},
320 {ED_BUTTON_EXIT_XPOS,ED_BUTTON_EXIT_YPOS,
321 ED_BUTTON_EXIT_XSIZE,ED_BUTTON_EXIT_YSIZE}
324 if (state & ED_BUTTON_PRESSED)
325 cx = DOOR_GFX_PAGEX3;
329 if (state & (1<<(i+6)))
330 XCopyArea(display,pix[PIX_DOOR],drawto,gc,
331 cx + edit_pos[i][xpos],
332 cy + edit_pos[i][ypos],
335 VX + edit_pos[i][xpos],
336 VY + edit_pos[i][ypos]);
339 redraw_mask |= REDRAW_DOOR_2;
342 void DrawElemButton(int button_nr, int button_state)
344 int xpos = 0, ypos = 1, xsize = 2, ysize = 3;
345 int cx = DOOR_GFX_PAGEX6, cy = DOOR_GFX_PAGEY1;
346 int from_x, from_y, to_x,to_y, size_x, size_y;
347 static int edit_pos[3][4] =
349 {ED_BUTTON_EUP_XPOS,ED_BUTTON_EUP_YPOS,
350 ED_BUTTON_EUP_XSIZE,ED_BUTTON_EUP_YSIZE},
352 {ED_BUTTON_EDOWN_XPOS,ED_BUTTON_EDOWN_YPOS,
353 ED_BUTTON_EDOWN_XSIZE,ED_BUTTON_EDOWN_YSIZE},
355 {ED_BUTTON_ELEM_XPOS,ED_BUTTON_ELEM_YPOS,
356 ED_BUTTON_ELEM_XSIZE,ED_BUTTON_ELEM_YSIZE}
359 if (button_nr<ED_BUTTON_ELEM)
363 from_x = cx + edit_pos[pos][xpos];
364 from_y = cy + edit_pos[pos][ypos];
365 size_x = edit_pos[pos][xsize];
366 size_y = edit_pos[pos][ysize];
367 to_x = DX + edit_pos[pos][xpos];
368 to_y = DY + edit_pos[pos][ypos];
370 if (button_state & ED_BUTTON_PRESSED)
372 if (button_nr==ED_BUTTON_EUP)
373 from_y = cy + ED_BUTTON_EUP_Y2POS;
375 from_y = cy + ED_BUTTON_EDOWN_Y2POS;
378 XCopyArea(display,pix[PIX_DOOR],drawto,gc,
379 from_x,from_y, size_x,size_y, to_x,to_y);
383 int pos = ED_BUTTON_ELEM;
384 int elem_pos = button_nr-ED_BUTTON_ELEM;
385 int x = elem_pos % MAX_ELEM_X;
386 int y = elem_pos / MAX_ELEM_X;
390 if (elem_pos+element_shift < elements_in_list)
391 graphic = el2gfx(editor_element[elem_pos+element_shift]);
393 graphic = GFX_LEERRAUM;
395 from_x = cx + edit_pos[pos][xpos];
396 from_y = cy + edit_pos[pos][ypos];
397 size_x = edit_pos[pos][xsize];
398 size_y = edit_pos[pos][ysize];
399 to_x = DX + edit_pos[pos][xpos] + x * ED_BUTTON_ELEM_XSIZE;
400 to_y = DY + edit_pos[pos][ypos] + y * ED_BUTTON_ELEM_YSIZE;
402 if (button_state & ED_BUTTON_PRESSED)
404 from_y = ED_BUTTON_ELEM_Y2POS;
408 XCopyArea(display,pix[PIX_DOOR],drawto,gc,
409 from_x,from_y, size_x,size_y, to_x,to_y);
411 DrawMiniGraphicExtHiRes(drawto,gc,
412 DX+ED_BUTTON_ELEM_XPOS+3+shift +
413 (elem_pos % MAX_ELEM_X)*ED_BUTTON_ELEM_XSIZE,
414 DY+ED_BUTTON_ELEM_YPOS+3-shift +
415 (elem_pos / MAX_ELEM_X)*ED_BUTTON_ELEM_YSIZE,
419 redraw_mask |= REDRAW_DOOR_1;
422 void DrawCountButton(int button_nr, int button_state)
424 int from_x, from_y, to_x,to_y, size_x, size_y;
427 DOOR_GFX_PAGEX4+(button_nr%2 ? ED_BUTTON_PLUS_XPOS : ED_BUTTON_MINUS_XPOS);
428 from_y = DOOR_GFX_PAGEY1 + ED_BUTTON_MINUS_YPOS;
429 size_x = ED_BUTTON_MINUS_XSIZE;
430 size_y = ED_BUTTON_MINUS_YSIZE;
431 to_x = (button_nr<32 ? ED_COUNT_GADGET_XPOS : ED_SIZE_GADGET_XPOS);
433 to_x += (ED_BUTTON_PLUS_XPOS - ED_BUTTON_MINUS_XPOS);
434 to_y = (button_nr<32 ? ED_COUNT_GADGET_YPOS : ED_SIZE_GADGET_YPOS) +
435 ((button_nr<32 ? button_nr : button_nr-32)/2)*ED_COUNT_GADGET_YSIZE;
437 if (button_state & ED_BUTTON_PRESSED)
440 XCopyArea(display,pix[PIX_DOOR],drawto,gc,
441 from_x,from_y, size_x,size_y, to_x,to_y);
442 XCopyArea(display,pix[PIX_DOOR],window,gc,
443 from_x,from_y, size_x,size_y, to_x,to_y);
446 /**********************************************************************/
447 /********** checking buttons (and redrawing them, if needed) **********/
448 /**********************************************************************/
450 int CheckVideoButtons(int mx, int my, int button)
453 static int choice = -1;
454 static BOOL pressed = FALSE;
455 static int video_button[5] =
457 VIDEO_PRESS_EJECT_ON,
459 VIDEO_PRESS_PAUSE_ON,
466 if (!motion_status) /* Maustaste neu gedrückt */
468 if (ON_VIDEO_BUTTON(mx,my))
470 choice = VIDEO_BUTTON(mx);
472 DrawVideoDisplay(video_button[choice],0);
475 else /* Mausbewegung bei gedrückter Maustaste */
477 if ((!ON_VIDEO_BUTTON(mx,my) || VIDEO_BUTTON(mx)!=choice) &&
478 choice>=0 && pressed)
481 DrawVideoDisplay(video_button[choice]<<1,0);
483 else if (ON_VIDEO_BUTTON(mx,my) && VIDEO_BUTTON(mx)==choice && !pressed)
486 DrawVideoDisplay(video_button[choice],0);
490 else /* Maustaste wieder losgelassen */
492 if (ON_VIDEO_BUTTON(mx,my) && VIDEO_BUTTON(mx)==choice && pressed)
494 DrawVideoDisplay(video_button[choice]<<1,0);
495 return_code = choice+1;
510 int CheckSoundButtons(int mx, int my, int button)
513 static int choice = -1;
514 static BOOL pressed = FALSE;
517 sound_state[0] = BUTTON_SOUND_MUSIC | (BUTTON_ON * sound_music_on);
518 sound_state[1] = BUTTON_SOUND_LOOPS | (BUTTON_ON * sound_loops_on);
519 sound_state[2] = BUTTON_SOUND_SIMPLE | (BUTTON_ON * sound_simple_on);
523 if (!motion_status) /* Maustaste neu gedrückt */
525 if (ON_SOUND_BUTTON(mx,my))
527 choice = SOUND_BUTTON(mx);
529 DrawSoundDisplay(sound_state[choice] | BUTTON_PRESSED);
532 else /* Mausbewegung bei gedrückter Maustaste */
534 if ((!ON_SOUND_BUTTON(mx,my) || SOUND_BUTTON(mx)!=choice) &&
535 choice>=0 && pressed)
538 DrawSoundDisplay(sound_state[choice] | BUTTON_RELEASED);
540 else if (ON_SOUND_BUTTON(mx,my) && SOUND_BUTTON(mx)==choice && !pressed)
543 DrawSoundDisplay(sound_state[choice] | BUTTON_PRESSED);
547 else /* Maustaste wieder losgelassen */
549 if (ON_SOUND_BUTTON(mx,my) && SOUND_BUTTON(mx)==choice && pressed)
551 DrawSoundDisplay(sound_state[choice] | BUTTON_RELEASED);
552 return_code = 1<<choice;
567 int CheckGameButtons(int mx, int my, int button)
570 static int choice = -1;
571 static BOOL pressed = FALSE;
581 if (!motion_status) /* Maustaste neu gedrückt */
583 if (ON_GAME_BUTTON(mx,my))
585 choice = GAME_BUTTON(mx);
587 DrawGameButton(game_state[choice] | BUTTON_PRESSED);
590 else /* Mausbewegung bei gedrückter Maustaste */
592 if ((!ON_GAME_BUTTON(mx,my) || GAME_BUTTON(mx)!=choice) &&
593 choice>=0 && pressed)
596 DrawGameButton(game_state[choice] | BUTTON_RELEASED);
598 else if (ON_GAME_BUTTON(mx,my) && GAME_BUTTON(mx)==choice && !pressed)
601 DrawGameButton(game_state[choice] | BUTTON_PRESSED);
605 else /* Maustaste wieder losgelassen */
607 if (ON_GAME_BUTTON(mx,my) && GAME_BUTTON(mx)==choice && pressed)
609 DrawGameButton(game_state[choice] | BUTTON_RELEASED);
610 return_code = 1<<choice;
625 int CheckChooseButtons(int mx, int my, int button)
628 static int choice = -1;
629 static BOOL pressed = FALSE;
630 static int choose_button[5] =
638 if (!motion_status) /* Maustaste neu gedrückt */
640 if (ON_CHOOSE_BUTTON(mx,my))
642 choice = CHOOSE_BUTTON(mx);
644 DrawChooseButton(choose_button[choice] | BUTTON_PRESSED);
647 else /* Mausbewegung bei gedrückter Maustaste */
649 if ((!ON_CHOOSE_BUTTON(mx,my) || CHOOSE_BUTTON(mx)!=choice) &&
650 choice>=0 && pressed)
653 DrawChooseButton(choose_button[choice] | BUTTON_RELEASED);
655 else if (ON_CHOOSE_BUTTON(mx,my) &&CHOOSE_BUTTON(mx)==choice && !pressed)
658 DrawChooseButton(choose_button[choice] | BUTTON_PRESSED);
662 else /* Maustaste wieder losgelassen */
664 if (ON_CHOOSE_BUTTON(mx,my) && CHOOSE_BUTTON(mx)==choice && pressed)
666 DrawChooseButton(choose_button[choice] | BUTTON_RELEASED);
667 return_code = choice+1;
682 int CheckConfirmButton(int mx, int my, int button)
685 static int choice = -1;
686 static BOOL pressed = FALSE;
690 if (!motion_status) /* Maustaste neu gedrückt */
692 if (ON_CONFIRM_BUTTON(mx,my))
696 DrawConfirmButton(BUTTON_PRESSED);
699 else /* Mausbewegung bei gedrückter Maustaste */
701 if (!ON_CONFIRM_BUTTON(mx,my) && choice>=0 && pressed)
704 DrawConfirmButton(BUTTON_RELEASED);
706 else if (ON_CONFIRM_BUTTON(mx,my) && !pressed)
709 DrawConfirmButton(BUTTON_PRESSED);
713 else /* Maustaste wieder losgelassen */
715 if (ON_CONFIRM_BUTTON(mx,my) && pressed)
717 DrawConfirmButton(BUTTON_RELEASED);
718 return_code = BUTTON_CONFIRM;
733 /* several buttons in the level editor */
735 int CheckEditButtons(int mx, int my, int button)
738 static int choice = -1;
739 static BOOL pressed = FALSE;
740 static int edit_button[6] =
752 if (!motion_status) /* Maustaste neu gedrückt */
754 if (ON_EDIT_BUTTON(mx,my))
756 choice = EDIT_BUTTON(mx,my);
758 DrawEditButton(edit_button[choice] | ED_BUTTON_PRESSED);
759 if (edit_button[choice]!=ED_BUTTON_CTRL &&
760 edit_button[choice]!=ED_BUTTON_FILL)
761 return_code = 1<<choice;
764 else /* Mausbewegung bei gedrückter Maustaste */
766 if ((!ON_EDIT_BUTTON(mx,my) || EDIT_BUTTON(mx,my)!=choice) &&
767 choice>=0 && pressed)
770 DrawEditButton(edit_button[choice] | ED_BUTTON_RELEASED);
772 else if (ON_EDIT_BUTTON(mx,my) && EDIT_BUTTON(mx,my)==choice)
775 DrawEditButton(edit_button[choice] | ED_BUTTON_PRESSED);
777 if (edit_button[choice]!=ED_BUTTON_CTRL &&
778 edit_button[choice]!=ED_BUTTON_FILL)
779 return_code = 1<<choice;
783 else /* Maustaste wieder losgelassen */
785 if (ON_EDIT_BUTTON(mx,my) && EDIT_BUTTON(mx,my)==choice && pressed)
787 DrawEditButton(edit_button[choice] | ED_BUTTON_RELEASED);
788 if (edit_button[choice]==ED_BUTTON_CTRL ||
789 edit_button[choice]==ED_BUTTON_FILL)
790 return_code = 1<<choice;
805 int CheckCtrlButtons(int mx, int my, int button)
808 static int choice = -1;
809 static BOOL pressed = FALSE;
810 static int ctrl_button[4] =
820 if (!motion_status) /* Maustaste neu gedrückt */
822 if (ON_CTRL_BUTTON(mx,my))
824 choice = CTRL_BUTTON(mx,my);
826 DrawCtrlButton(ctrl_button[choice] | ED_BUTTON_PRESSED);
829 else /* Mausbewegung bei gedrückter Maustaste */
831 if ((!ON_CTRL_BUTTON(mx,my) || CTRL_BUTTON(mx,my)!=choice) &&
832 choice>=0 && pressed)
835 DrawCtrlButton(ctrl_button[choice] | ED_BUTTON_RELEASED);
837 else if (ON_CTRL_BUTTON(mx,my) && CTRL_BUTTON(mx,my)==choice && !pressed)
840 DrawCtrlButton(ctrl_button[choice] | ED_BUTTON_PRESSED);
844 else /* Maustaste wieder losgelassen */
846 if (ON_CTRL_BUTTON(mx,my) && CTRL_BUTTON(mx,my)==choice && pressed)
848 DrawCtrlButton(ctrl_button[choice] | ED_BUTTON_RELEASED);
849 return_code = 1<<(choice+6);
864 int CheckElemButtons(int mx, int my, int button)
866 int return_code = -1;
867 static int choice = -1;
868 static BOOL pressed = FALSE;
872 if (!motion_status) /* Maustaste neu gedrückt */
874 if (ON_ELEM_BUTTON(mx,my))
876 choice = ELEM_BUTTON(mx,my);
878 DrawElemButton(choice,ED_BUTTON_PRESSED);
879 if (choice==ED_BUTTON_EUP ||
880 choice==ED_BUTTON_EDOWN)
881 return_code = choice;
884 else /* Mausbewegung bei gedrückter Maustaste */
886 if ((!ON_ELEM_BUTTON(mx,my) || ELEM_BUTTON(mx,my)!=choice) &&
887 choice>=0 && pressed)
890 DrawElemButton(choice,ED_BUTTON_RELEASED);
892 else if (ON_ELEM_BUTTON(mx,my) && ELEM_BUTTON(mx,my)==choice)
895 DrawElemButton(choice,ED_BUTTON_PRESSED);
897 if (choice==ED_BUTTON_EUP ||
898 choice==ED_BUTTON_EDOWN)
899 return_code = choice;
903 else /* Maustaste wieder losgelassen */
905 if (ON_ELEM_BUTTON(mx,my) && ELEM_BUTTON(mx,my)==choice && pressed)
907 DrawElemButton(choice,ED_BUTTON_RELEASED);
908 if (choice!=ED_BUTTON_EUP &&
909 choice!=ED_BUTTON_EDOWN)
910 return_code = choice;
925 int CheckCountButtons(int mx, int my, int button)
927 int return_code = -1;
928 static int choice = -1;
929 static BOOL pressed = FALSE;
933 if (!motion_status) /* Maustaste neu gedrückt */
935 if (ON_COUNT_BUTTON(mx,my))
937 choice = COUNT_BUTTON(mx,my);
939 DrawCountButton(choice,ED_BUTTON_PRESSED);
940 return_code = choice;
943 else /* Mausbewegung bei gedrückter Maustaste */
945 if ((!ON_COUNT_BUTTON(mx,my) || COUNT_BUTTON(mx,my)!=choice) &&
946 choice>=0 && pressed)
949 DrawCountButton(choice,ED_BUTTON_RELEASED);
951 else if (ON_COUNT_BUTTON(mx,my) && COUNT_BUTTON(mx,my)==choice)
954 DrawCountButton(choice,ED_BUTTON_PRESSED);
956 return_code = choice;
960 else /* Maustaste wieder losgelassen */
962 if (ON_COUNT_BUTTON(mx,my) && COUNT_BUTTON(mx,my)==choice && pressed)
964 DrawCountButton(choice,ED_BUTTON_RELEASED);