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 ***********************************************************/
20 /****************************************************************/
21 /********** drawing buttons and corresponding displays **********/
22 /****************************************************************/
24 void DrawVideoDisplay(unsigned long state, unsigned long value)
27 int part1 = 0, part2 = 1;
28 int xpos = 0, ypos = 1, xsize = 2, ysize = 3;
29 static char *monatsname[12] =
31 "JAN", "FEB", "MAR", "APR", "MAY", "JUN",
32 "JUL", "AUG", "SEP", "OCT", "NOV", "DEC"
34 static int video_pos[10][2][4] =
36 VIDEO_PLAY_LABEL_XPOS, VIDEO_PLAY_LABEL_YPOS,
37 VIDEO_PLAY_LABEL_XSIZE,VIDEO_PLAY_LABEL_YSIZE,
38 VIDEO_PLAY_SYMBOL_XPOS, VIDEO_PLAY_SYMBOL_YPOS,
39 VIDEO_PLAY_SYMBOL_XSIZE,VIDEO_PLAY_SYMBOL_YSIZE,
41 VIDEO_REC_LABEL_XPOS, VIDEO_REC_LABEL_YPOS,
42 VIDEO_REC_LABEL_XSIZE,VIDEO_REC_LABEL_YSIZE,
43 VIDEO_REC_SYMBOL_XPOS, VIDEO_REC_SYMBOL_YPOS,
44 VIDEO_REC_SYMBOL_XSIZE,VIDEO_REC_SYMBOL_YSIZE,
46 VIDEO_PAUSE_LABEL_XPOS, VIDEO_PAUSE_LABEL_YPOS,
47 VIDEO_PAUSE_LABEL_XSIZE,VIDEO_PAUSE_LABEL_YSIZE,
48 VIDEO_PAUSE_SYMBOL_XPOS, VIDEO_PAUSE_SYMBOL_YPOS,
49 VIDEO_PAUSE_SYMBOL_XSIZE,VIDEO_PAUSE_SYMBOL_YSIZE,
51 VIDEO_DATE_LABEL_XPOS, VIDEO_DATE_LABEL_YPOS,
52 VIDEO_DATE_LABEL_XSIZE,VIDEO_DATE_LABEL_YSIZE,
53 VIDEO_DATE_XPOS, VIDEO_DATE_YPOS,
54 VIDEO_DATE_XSIZE,VIDEO_DATE_YSIZE,
58 VIDEO_TIME_XPOS, VIDEO_TIME_YPOS,
59 VIDEO_TIME_XSIZE,VIDEO_TIME_YSIZE,
61 VIDEO_BUTTON_PLAY_XPOS, VIDEO_BUTTON_ANY_YPOS,
62 VIDEO_BUTTON_XSIZE,VIDEO_BUTTON_YSIZE,
66 VIDEO_BUTTON_REC_XPOS, VIDEO_BUTTON_ANY_YPOS,
67 VIDEO_BUTTON_XSIZE,VIDEO_BUTTON_YSIZE,
71 VIDEO_BUTTON_PAUSE_XPOS, VIDEO_BUTTON_ANY_YPOS,
72 VIDEO_BUTTON_XSIZE,VIDEO_BUTTON_YSIZE,
76 VIDEO_BUTTON_STOP_XPOS, VIDEO_BUTTON_ANY_YPOS,
77 VIDEO_BUTTON_XSIZE,VIDEO_BUTTON_YSIZE,
81 VIDEO_BUTTON_EJECT_XPOS, VIDEO_BUTTON_ANY_YPOS,
82 VIDEO_BUTTON_XSIZE,VIDEO_BUTTON_YSIZE,
91 int pos = i/2, cx, cy = DOOR_GFX_PAGEY2;
93 if (i%2) /* i ungerade => STATE_ON / PRESS_OFF */
96 cx = DOOR_GFX_PAGEX3; /* i gerade => STATE_OFF / PRESS_ON */
98 if (video_pos[pos][part1][0])
99 XCopyArea(display,pix[PIX_DOOR],drawto,gc,
100 cx + video_pos[pos][part1][xpos],
101 cy + video_pos[pos][part1][ypos],
102 video_pos[pos][part1][xsize],
103 video_pos[pos][part1][ysize],
104 VX + video_pos[pos][part1][xpos],
105 VY + video_pos[pos][part1][ypos]);
106 if (video_pos[pos][part2][0])
107 XCopyArea(display,pix[PIX_DOOR],drawto,gc,
108 cx + video_pos[pos][part2][xpos],
109 cy + video_pos[pos][part2][ypos],
110 video_pos[pos][part2][xsize],
111 video_pos[pos][part2][ysize],
112 VX + video_pos[pos][part2][xpos],
113 VY + video_pos[pos][part2][ypos]);
117 if (state & VIDEO_STATE_DATE_ON)
119 int tag = value % 100;
120 int monat = (value/100) % 100;
121 int jahr = (value/10000);
123 DrawText(VX+VIDEO_DATE_XPOS,VY+VIDEO_DATE_YPOS,
124 int2str(tag,2),FS_SMALL,FC_SPECIAL1);
125 DrawText(VX+VIDEO_DATE_XPOS+27,VY+VIDEO_DATE_YPOS,
126 monatsname[monat],FS_SMALL,FC_SPECIAL1);
127 DrawText(VX+VIDEO_DATE_XPOS+64,VY+VIDEO_DATE_YPOS,
128 int2str(jahr,2),FS_SMALL,FC_SPECIAL1);
131 if (state & VIDEO_STATE_TIME_ON)
133 int min = value / 60;
134 int sec = value % 60;
136 DrawText(VX+VIDEO_TIME_XPOS,VY+VIDEO_TIME_YPOS,
137 int2str(min,2),FS_SMALL,FC_SPECIAL1);
138 DrawText(VX+VIDEO_TIME_XPOS+27,VY+VIDEO_TIME_YPOS,
139 int2str(sec,2),FS_SMALL,FC_SPECIAL1);
142 if (state & VIDEO_STATE_DATE)
143 redraw_mask |= REDRAW_VIDEO_1;
144 if ((state & ~VIDEO_STATE_DATE) & VIDEO_STATE)
145 redraw_mask |= REDRAW_VIDEO_2;
146 if (state & VIDEO_PRESS)
147 redraw_mask |= REDRAW_VIDEO_3;
150 void DrawCompleteVideoDisplay()
152 XCopyArea(display,pix[PIX_DOOR],drawto,gc,
153 DOOR_GFX_PAGEX3,DOOR_GFX_PAGEY2, VXSIZE,VYSIZE, VX,VY);
154 XCopyArea(display,pix[PIX_DOOR],drawto,gc,
155 DOOR_GFX_PAGEX4+VIDEO_CONTROL_XPOS,
156 DOOR_GFX_PAGEY2+VIDEO_CONTROL_YPOS,
157 VIDEO_CONTROL_XSIZE,VIDEO_CONTROL_YSIZE,
158 VX+VIDEO_CONTROL_XPOS,VY+VIDEO_CONTROL_YPOS);
160 DrawVideoDisplay(VIDEO_ALL_OFF,0);
161 if (tape.date && tape.length)
163 DrawVideoDisplay(VIDEO_STATE_DATE_ON,tape.date);
164 DrawVideoDisplay(VIDEO_STATE_TIME_ON,0);
167 XCopyArea(display,drawto,pix[PIX_DB_DOOR],gc,
168 VX,VY, VXSIZE,VYSIZE, DOOR_GFX_PAGEX1,DOOR_GFX_PAGEY2);
171 void DrawSoundDisplay(unsigned long state)
173 int pos, cx = DOOR_GFX_PAGEX4, cy = 0;
175 pos = (state & BUTTON_SOUND_MUSIC ? SOUND_BUTTON_MUSIC_XPOS :
176 state & BUTTON_SOUND_LOOPS ? SOUND_BUTTON_LOOPS_XPOS :
177 SOUND_BUTTON_SOUND_XPOS);
179 if (state & BUTTON_ON)
180 cy -= SOUND_BUTTON_YSIZE;
182 if (state & BUTTON_PRESSED)
183 cx = DOOR_GFX_PAGEX3;
185 XCopyArea(display,pix[PIX_DOOR],drawto,gc,
186 cx + pos,cy + SOUND_BUTTON_ANY_YPOS,
187 SOUND_BUTTON_XSIZE,SOUND_BUTTON_YSIZE,
188 DX + pos,DY + SOUND_BUTTON_ANY_YPOS);
190 redraw_mask |= REDRAW_DOOR_1;
193 void DrawGameButton(unsigned long state)
195 int pos, cx = DOOR_GFX_PAGEX4, cy = -GAME_BUTTON_YSIZE;
197 pos = (state & BUTTON_GAME_STOP ? GAME_BUTTON_STOP_XPOS :
198 state & BUTTON_GAME_PAUSE ? GAME_BUTTON_PAUSE_XPOS :
199 GAME_BUTTON_PLAY_XPOS);
201 if (state & BUTTON_PRESSED)
202 cx = DOOR_GFX_PAGEX3;
204 XCopyArea(display,pix[PIX_DOOR],drawto,gc,
205 cx + pos,cy + GAME_BUTTON_ANY_YPOS,
206 GAME_BUTTON_XSIZE,GAME_BUTTON_YSIZE,
207 DX + pos,DY + GAME_BUTTON_ANY_YPOS);
209 redraw_mask |= REDRAW_DOOR_1;
212 void DrawChooseButton(unsigned long state)
214 int pos, cx = DOOR_GFX_PAGEX4, cy = 0;
216 pos = (state & BUTTON_OK ? OK_BUTTON_XPOS : NO_BUTTON_XPOS);
218 if (state & BUTTON_PRESSED)
219 cx = DOOR_GFX_PAGEX3;
221 XCopyArea(display,pix[PIX_DOOR],drawto,gc,
222 cx + pos,cy + OK_BUTTON_GFX_YPOS,
223 OK_BUTTON_XSIZE,OK_BUTTON_YSIZE,
224 DX + pos,DY + OK_BUTTON_YPOS);
226 redraw_mask |= REDRAW_DOOR_1;
229 void DrawConfirmButton(unsigned long state)
231 int cx = DOOR_GFX_PAGEX4, cy = 0;
233 if (state & BUTTON_PRESSED)
234 cx = DOOR_GFX_PAGEX3;
236 XCopyArea(display,pix[PIX_DOOR],drawto,gc,
237 cx + CONFIRM_BUTTON_XPOS,cy + CONFIRM_BUTTON_GFX_YPOS,
238 CONFIRM_BUTTON_XSIZE,CONFIRM_BUTTON_YSIZE,
239 DX + CONFIRM_BUTTON_XPOS,DY + CONFIRM_BUTTON_YPOS);
241 redraw_mask |= REDRAW_DOOR_1;
244 /* several buttons in the level editor */
246 void DrawEditButton(unsigned long state)
249 int xpos = 0, ypos = 1, xsize = 2, ysize = 3;
250 int cx = DOOR_GFX_PAGEX6, cy = DOOR_GFX_PAGEY2;
251 static int edit_pos[6][4] =
253 ED_BUTTON_CTRL_XPOS,ED_BUTTON_CTRL_YPOS,
254 ED_BUTTON_CTRL_XSIZE,ED_BUTTON_CTRL_YSIZE,
256 ED_BUTTON_FILL_XPOS,ED_BUTTON_FILL_YPOS,
257 ED_BUTTON_FILL_XSIZE,ED_BUTTON_FILL_YSIZE,
259 ED_BUTTON_LEFT_XPOS,ED_BUTTON_LEFT_YPOS,
260 ED_BUTTON_LEFT_XSIZE,ED_BUTTON_LEFT_YSIZE,
262 ED_BUTTON_UP_XPOS,ED_BUTTON_UP_YPOS,
263 ED_BUTTON_UP_XSIZE,ED_BUTTON_UP_YSIZE,
265 ED_BUTTON_DOWN_XPOS,ED_BUTTON_DOWN_YPOS,
266 ED_BUTTON_DOWN_XSIZE,ED_BUTTON_DOWN_YSIZE,
268 ED_BUTTON_RIGHT_XPOS,ED_BUTTON_RIGHT_YPOS,
269 ED_BUTTON_RIGHT_XSIZE,ED_BUTTON_RIGHT_YSIZE
272 if (state & ED_BUTTON_PRESSED)
273 cx = DOOR_GFX_PAGEX5;
278 XCopyArea(display,pix[PIX_DOOR],drawto,gc,
279 cx + edit_pos[i][xpos],
280 cy + edit_pos[i][ypos],
283 VX + edit_pos[i][xpos],
284 VY + edit_pos[i][ypos]);
287 redraw_mask |= REDRAW_DOOR_2;
290 void DrawCtrlButton(unsigned long state)
293 int xpos = 0, ypos = 1, xsize = 2, ysize = 3;
294 int cx = DOOR_GFX_PAGEX4, cy = DOOR_GFX_PAGEY1+80;
295 static int edit_pos[4][4] =
297 ED_BUTTON_EDIT_XPOS,ED_BUTTON_EDIT_YPOS,
298 ED_BUTTON_EDIT_XSIZE,ED_BUTTON_EDIT_YSIZE,
300 ED_BUTTON_CLEAR_XPOS,ED_BUTTON_CLEAR_YPOS,
301 ED_BUTTON_CLEAR_XSIZE,ED_BUTTON_CLEAR_YSIZE,
303 ED_BUTTON_UNDO_XPOS,ED_BUTTON_UNDO_YPOS,
304 ED_BUTTON_UNDO_XSIZE,ED_BUTTON_UNDO_YSIZE,
306 ED_BUTTON_EXIT_XPOS,ED_BUTTON_EXIT_YPOS,
307 ED_BUTTON_EXIT_XSIZE,ED_BUTTON_EXIT_YSIZE
310 if (state & ED_BUTTON_PRESSED)
311 cx = DOOR_GFX_PAGEX3;
315 if (state & (1<<(i+6)))
316 XCopyArea(display,pix[PIX_DOOR],drawto,gc,
317 cx + edit_pos[i][xpos],
318 cy + edit_pos[i][ypos],
321 VX + edit_pos[i][xpos],
322 VY + edit_pos[i][ypos]);
325 redraw_mask |= REDRAW_DOOR_2;
328 void DrawElemButton(int button_nr, int button_state)
330 int xpos = 0, ypos = 1, xsize = 2, ysize = 3;
331 int cx = DOOR_GFX_PAGEX6, cy = DOOR_GFX_PAGEY1;
332 int from_x, from_y, to_x,to_y, size_x, size_y;
333 static int edit_pos[3][4] =
335 ED_BUTTON_EUP_XPOS,ED_BUTTON_EUP_YPOS,
336 ED_BUTTON_EUP_XSIZE,ED_BUTTON_EUP_YSIZE,
338 ED_BUTTON_EDOWN_XPOS,ED_BUTTON_EDOWN_YPOS,
339 ED_BUTTON_EDOWN_XSIZE,ED_BUTTON_EDOWN_YSIZE,
341 ED_BUTTON_ELEM_XPOS,ED_BUTTON_ELEM_YPOS,
342 ED_BUTTON_ELEM_XSIZE,ED_BUTTON_ELEM_YSIZE
345 if (button_nr<ED_BUTTON_ELEM)
349 from_x = cx + edit_pos[pos][xpos];
350 from_y = cy + edit_pos[pos][ypos];
351 size_x = edit_pos[pos][xsize];
352 size_y = edit_pos[pos][ysize];
353 to_x = DX + edit_pos[pos][xpos];
354 to_y = DY + edit_pos[pos][ypos];
356 if (button_state & ED_BUTTON_PRESSED)
358 if (button_nr==ED_BUTTON_EUP)
359 from_y = cy + ED_BUTTON_EUP_Y2POS;
361 from_y = cy + ED_BUTTON_EDOWN_Y2POS;
364 XCopyArea(display,pix[PIX_DOOR],drawto,gc,
365 from_x,from_y, size_x,size_y, to_x,to_y);
369 int pos = ED_BUTTON_ELEM;
370 int elem_pos = button_nr-ED_BUTTON_ELEM;
371 int x = elem_pos % MAX_ELEM_X;
372 int y = elem_pos / MAX_ELEM_X;
376 if (elem_pos+element_shift < elements_in_list)
377 graphic = el2gfx(editor_element[elem_pos+element_shift]);
379 graphic = GFX_LEERRAUM;
381 from_x = cx + edit_pos[pos][xpos];
382 from_y = cy + edit_pos[pos][ypos];
383 size_x = edit_pos[pos][xsize];
384 size_y = edit_pos[pos][ysize];
385 to_x = DX + edit_pos[pos][xpos] + x * ED_BUTTON_ELEM_XSIZE;
386 to_y = DY + edit_pos[pos][ypos] + y * ED_BUTTON_ELEM_YSIZE;
388 if (button_state & ED_BUTTON_PRESSED)
390 from_y = ED_BUTTON_ELEM_Y2POS;
394 XCopyArea(display,pix[PIX_DOOR],drawto,gc,
395 from_x,from_y, size_x,size_y, to_x,to_y);
397 DrawMiniGraphicExtHiRes(drawto,gc,
398 DX+ED_BUTTON_ELEM_XPOS+3+shift +
399 (elem_pos % MAX_ELEM_X)*ED_BUTTON_ELEM_XSIZE,
400 DY+ED_BUTTON_ELEM_YPOS+3-shift +
401 (elem_pos / MAX_ELEM_X)*ED_BUTTON_ELEM_YSIZE,
405 redraw_mask |= REDRAW_DOOR_1;
408 void DrawCountButton(int button_nr, int button_state)
410 int from_x, from_y, to_x,to_y, size_x, size_y;
413 DOOR_GFX_PAGEX4+(button_nr%2 ? ED_BUTTON_PLUS_XPOS : ED_BUTTON_MINUS_XPOS);
414 from_y = DOOR_GFX_PAGEY1 + ED_BUTTON_MINUS_YPOS;
415 size_x = ED_BUTTON_MINUS_XSIZE;
416 size_y = ED_BUTTON_MINUS_YSIZE;
417 to_x = (button_nr<32 ? ED_COUNT_GADGET_XPOS : ED_SIZE_GADGET_XPOS);
419 to_x += (ED_BUTTON_PLUS_XPOS - ED_BUTTON_MINUS_XPOS);
420 to_y = (button_nr<32 ? ED_COUNT_GADGET_YPOS : ED_SIZE_GADGET_YPOS) +
421 ((button_nr<32 ? button_nr : button_nr-32)/2)*ED_COUNT_GADGET_YSIZE;
423 if (button_state & ED_BUTTON_PRESSED)
426 XCopyArea(display,pix[PIX_DOOR],drawto,gc,
427 from_x,from_y, size_x,size_y, to_x,to_y);
428 XCopyArea(display,pix[PIX_DOOR],window,gc,
429 from_x,from_y, size_x,size_y, to_x,to_y);
432 /**********************************************************************/
433 /********** checking buttons (and redrawing them, if needed) **********/
434 /**********************************************************************/
436 int CheckVideoButtons(int mx, int my, int button)
439 static int choice = -1;
440 static BOOL pressed = FALSE;
441 static int video_button[5] =
443 VIDEO_PRESS_EJECT_ON,
445 VIDEO_PRESS_PAUSE_ON,
452 if (!motion_status) /* Maustaste neu gedrückt */
454 if (ON_VIDEO_BUTTON(mx,my))
456 choice = VIDEO_BUTTON(mx);
458 DrawVideoDisplay(video_button[choice],0);
461 else /* Mausbewegung bei gedrückter Maustaste */
463 if ((!ON_VIDEO_BUTTON(mx,my) || VIDEO_BUTTON(mx)!=choice) &&
464 choice>=0 && pressed)
467 DrawVideoDisplay(video_button[choice]<<1,0);
469 else if (ON_VIDEO_BUTTON(mx,my) && VIDEO_BUTTON(mx)==choice && !pressed)
472 DrawVideoDisplay(video_button[choice],0);
476 else /* Maustaste wieder losgelassen */
478 if (ON_VIDEO_BUTTON(mx,my) && VIDEO_BUTTON(mx)==choice && pressed)
480 DrawVideoDisplay(video_button[choice]<<1,0);
481 return_code = choice+1;
496 int CheckSoundButtons(int mx, int my, int button)
499 static int choice = -1;
500 static BOOL pressed = FALSE;
503 sound_state[0] = BUTTON_SOUND_MUSIC | (BUTTON_ON * sound_music_on);
504 sound_state[1] = BUTTON_SOUND_LOOPS | (BUTTON_ON * sound_loops_on);
505 sound_state[2] = BUTTON_SOUND_SOUND | (BUTTON_ON * sound_on);
509 if (!motion_status) /* Maustaste neu gedrückt */
511 if (ON_SOUND_BUTTON(mx,my))
513 choice = SOUND_BUTTON(mx);
515 DrawSoundDisplay(sound_state[choice] | BUTTON_PRESSED);
518 else /* Mausbewegung bei gedrückter Maustaste */
520 if ((!ON_SOUND_BUTTON(mx,my) || SOUND_BUTTON(mx)!=choice) &&
521 choice>=0 && pressed)
524 DrawSoundDisplay(sound_state[choice] | BUTTON_RELEASED);
526 else if (ON_SOUND_BUTTON(mx,my) && SOUND_BUTTON(mx)==choice && !pressed)
529 DrawSoundDisplay(sound_state[choice] | BUTTON_PRESSED);
533 else /* Maustaste wieder losgelassen */
535 if (ON_SOUND_BUTTON(mx,my) && SOUND_BUTTON(mx)==choice && pressed)
537 DrawSoundDisplay(sound_state[choice] | BUTTON_RELEASED);
538 return_code = 1<<choice;
553 int CheckGameButtons(int mx, int my, int button)
556 static int choice = -1;
557 static BOOL pressed = FALSE;
567 if (!motion_status) /* Maustaste neu gedrückt */
569 if (ON_GAME_BUTTON(mx,my))
571 choice = GAME_BUTTON(mx);
573 DrawGameButton(game_state[choice] | BUTTON_PRESSED);
576 else /* Mausbewegung bei gedrückter Maustaste */
578 if ((!ON_GAME_BUTTON(mx,my) || GAME_BUTTON(mx)!=choice) &&
579 choice>=0 && pressed)
582 DrawGameButton(game_state[choice] | BUTTON_RELEASED);
584 else if (ON_GAME_BUTTON(mx,my) && GAME_BUTTON(mx)==choice && !pressed)
587 DrawGameButton(game_state[choice] | BUTTON_PRESSED);
591 else /* Maustaste wieder losgelassen */
593 if (ON_GAME_BUTTON(mx,my) && GAME_BUTTON(mx)==choice && pressed)
595 DrawGameButton(game_state[choice] | BUTTON_RELEASED);
596 return_code = 1<<choice;
611 int CheckChooseButtons(int mx, int my, int button)
614 static int choice = -1;
615 static BOOL pressed = FALSE;
616 static int choose_button[5] =
624 if (!motion_status) /* Maustaste neu gedrückt */
626 if (ON_CHOOSE_BUTTON(mx,my))
628 choice = CHOOSE_BUTTON(mx);
630 DrawChooseButton(choose_button[choice] | BUTTON_PRESSED);
633 else /* Mausbewegung bei gedrückter Maustaste */
635 if ((!ON_CHOOSE_BUTTON(mx,my) || CHOOSE_BUTTON(mx)!=choice) &&
636 choice>=0 && pressed)
639 DrawChooseButton(choose_button[choice] | BUTTON_RELEASED);
641 else if (ON_CHOOSE_BUTTON(mx,my) &&CHOOSE_BUTTON(mx)==choice && !pressed)
644 DrawChooseButton(choose_button[choice] | BUTTON_PRESSED);
648 else /* Maustaste wieder losgelassen */
650 if (ON_CHOOSE_BUTTON(mx,my) && CHOOSE_BUTTON(mx)==choice && pressed)
652 DrawChooseButton(choose_button[choice] | BUTTON_RELEASED);
653 return_code = choice+1;
668 int CheckConfirmButton(int mx, int my, int button)
671 static int choice = -1;
672 static BOOL pressed = FALSE;
676 if (!motion_status) /* Maustaste neu gedrückt */
678 if (ON_CONFIRM_BUTTON(mx,my))
682 DrawConfirmButton(BUTTON_PRESSED);
685 else /* Mausbewegung bei gedrückter Maustaste */
687 if (!ON_CONFIRM_BUTTON(mx,my) && choice>=0 && pressed)
690 DrawConfirmButton(BUTTON_RELEASED);
692 else if (ON_CONFIRM_BUTTON(mx,my) && !pressed)
695 DrawConfirmButton(BUTTON_PRESSED);
699 else /* Maustaste wieder losgelassen */
701 if (ON_CONFIRM_BUTTON(mx,my) && pressed)
703 DrawConfirmButton(BUTTON_RELEASED);
704 return_code = BUTTON_CONFIRM;
719 /* several buttons in the level editor */
721 int CheckEditButtons(int mx, int my, int button)
724 static int choice = -1;
725 static BOOL pressed = FALSE;
726 static int edit_button[6] =
738 if (!motion_status) /* Maustaste neu gedrückt */
740 if (ON_EDIT_BUTTON(mx,my))
742 choice = EDIT_BUTTON(mx,my);
744 DrawEditButton(edit_button[choice] | ED_BUTTON_PRESSED);
745 if (edit_button[choice]!=ED_BUTTON_CTRL &&
746 edit_button[choice]!=ED_BUTTON_FILL)
747 return_code = 1<<choice;
750 else /* Mausbewegung bei gedrückter Maustaste */
752 if ((!ON_EDIT_BUTTON(mx,my) || EDIT_BUTTON(mx,my)!=choice) &&
753 choice>=0 && pressed)
756 DrawEditButton(edit_button[choice] | ED_BUTTON_RELEASED);
758 else if (ON_EDIT_BUTTON(mx,my) && EDIT_BUTTON(mx,my)==choice)
761 DrawEditButton(edit_button[choice] | ED_BUTTON_PRESSED);
763 if (edit_button[choice]!=ED_BUTTON_CTRL &&
764 edit_button[choice]!=ED_BUTTON_FILL)
765 return_code = 1<<choice;
769 else /* Maustaste wieder losgelassen */
771 if (ON_EDIT_BUTTON(mx,my) && EDIT_BUTTON(mx,my)==choice && pressed)
773 DrawEditButton(edit_button[choice] | ED_BUTTON_RELEASED);
774 if (edit_button[choice]==ED_BUTTON_CTRL ||
775 edit_button[choice]==ED_BUTTON_FILL)
776 return_code = 1<<choice;
791 int CheckCtrlButtons(int mx, int my, int button)
794 static int choice = -1;
795 static BOOL pressed = FALSE;
796 static int ctrl_button[4] =
806 if (!motion_status) /* Maustaste neu gedrückt */
808 if (ON_CTRL_BUTTON(mx,my))
810 choice = CTRL_BUTTON(mx,my);
812 DrawCtrlButton(ctrl_button[choice] | ED_BUTTON_PRESSED);
815 else /* Mausbewegung bei gedrückter Maustaste */
817 if ((!ON_CTRL_BUTTON(mx,my) || CTRL_BUTTON(mx,my)!=choice) &&
818 choice>=0 && pressed)
821 DrawCtrlButton(ctrl_button[choice] | ED_BUTTON_RELEASED);
823 else if (ON_CTRL_BUTTON(mx,my) && CTRL_BUTTON(mx,my)==choice && !pressed)
826 DrawCtrlButton(ctrl_button[choice] | ED_BUTTON_PRESSED);
830 else /* Maustaste wieder losgelassen */
832 if (ON_CTRL_BUTTON(mx,my) && CTRL_BUTTON(mx,my)==choice && pressed)
834 DrawCtrlButton(ctrl_button[choice] | ED_BUTTON_RELEASED);
835 return_code = 1<<(choice+6);
850 int CheckElemButtons(int mx, int my, int button)
852 int return_code = -1;
853 static int choice = -1;
854 static BOOL pressed = FALSE;
858 if (!motion_status) /* Maustaste neu gedrückt */
860 if (ON_ELEM_BUTTON(mx,my))
862 choice = ELEM_BUTTON(mx,my);
864 DrawElemButton(choice,ED_BUTTON_PRESSED);
865 if (choice==ED_BUTTON_EUP ||
866 choice==ED_BUTTON_EDOWN)
867 return_code = choice;
870 else /* Mausbewegung bei gedrückter Maustaste */
872 if ((!ON_ELEM_BUTTON(mx,my) || ELEM_BUTTON(mx,my)!=choice) &&
873 choice>=0 && pressed)
876 DrawElemButton(choice,ED_BUTTON_RELEASED);
878 else if (ON_ELEM_BUTTON(mx,my) && ELEM_BUTTON(mx,my)==choice)
881 DrawElemButton(choice,ED_BUTTON_PRESSED);
883 if (choice==ED_BUTTON_EUP ||
884 choice==ED_BUTTON_EDOWN)
885 return_code = choice;
889 else /* Maustaste wieder losgelassen */
891 if (ON_ELEM_BUTTON(mx,my) && ELEM_BUTTON(mx,my)==choice && pressed)
893 DrawElemButton(choice,ED_BUTTON_RELEASED);
894 if (choice!=ED_BUTTON_EUP &&
895 choice!=ED_BUTTON_EDOWN)
896 return_code = choice;
911 int CheckCountButtons(int mx, int my, int button)
913 int return_code = -1;
914 static int choice = -1;
915 static BOOL pressed = FALSE;
919 if (!motion_status) /* Maustaste neu gedrückt */
921 if (ON_COUNT_BUTTON(mx,my))
923 choice = COUNT_BUTTON(mx,my);
925 DrawCountButton(choice,ED_BUTTON_PRESSED);
926 return_code = choice;
929 else /* Mausbewegung bei gedrückter Maustaste */
931 if ((!ON_COUNT_BUTTON(mx,my) || COUNT_BUTTON(mx,my)!=choice) &&
932 choice>=0 && pressed)
935 DrawCountButton(choice,ED_BUTTON_RELEASED);
937 else if (ON_COUNT_BUTTON(mx,my) && COUNT_BUTTON(mx,my)==choice)
940 DrawCountButton(choice,ED_BUTTON_PRESSED);
942 return_code = choice;
946 else /* Maustaste wieder losgelassen */
948 if (ON_COUNT_BUTTON(mx,my) && COUNT_BUTTON(mx,my)==choice && pressed)
950 DrawCountButton(choice,ED_BUTTON_RELEASED);