1 /***********************************************************
2 * Rocks'n'Diamonds -- McDuffin Strikes Back! *
3 *----------------------------------------------------------*
4 * (c) 1995-98 Artsoft Entertainment *
8 * phone: ++49 +521 290471 *
9 * email: aeglos@valinor.owl.de *
10 *----------------------------------------------------------*
12 ***********************************************************/
20 /****************************************************************/
21 /********** drawing buttons and corresponding displays **********/
22 /****************************************************************/
24 void DrawVideoDisplay(unsigned long state, unsigned long value)
27 int part_label = 0, part_symbol = 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][part_label][0] && value != VIDEO_DISPLAY_SYMBOL_ONLY)
99 XCopyArea(display,pix[PIX_DOOR],drawto,gc,
100 cx + video_pos[pos][part_label][xpos],
101 cy + video_pos[pos][part_label][ypos],
102 video_pos[pos][part_label][xsize],
103 video_pos[pos][part_label][ysize],
104 VX + video_pos[pos][part_label][xpos],
105 VY + video_pos[pos][part_label][ypos]);
106 if (video_pos[pos][part_symbol][0] && value != VIDEO_DISPLAY_LABEL_ONLY)
107 XCopyArea(display,pix[PIX_DOOR],drawto,gc,
108 cx + video_pos[pos][part_symbol][xpos],
109 cy + video_pos[pos][part_symbol][ypos],
110 video_pos[pos][part_symbol][xsize],
111 video_pos[pos][part_symbol][ysize],
112 VX + video_pos[pos][part_symbol][xpos],
113 VY + video_pos[pos][part_symbol][ypos]);
117 if (state & VIDEO_STATE_FFWD_ON)
119 int cx = DOOR_GFX_PAGEX4, cy = DOOR_GFX_PAGEY2;
121 XCopyArea(display,pix[PIX_DOOR],drawto,gc,
122 cx + VIDEO_PLAY_SYMBOL_XPOS,
123 cy + VIDEO_PLAY_SYMBOL_YPOS,
124 VIDEO_PLAY_SYMBOL_XSIZE - 2,
125 VIDEO_PLAY_SYMBOL_YSIZE,
126 VX + VIDEO_PLAY_SYMBOL_XPOS - 9,
127 VY + VIDEO_PLAY_SYMBOL_YPOS);
130 if (state & VIDEO_STATE_DATE_ON)
132 int tag = value % 100;
133 int monat = (value/100) % 100;
134 int jahr = (value/10000);
136 DrawText(VX+VIDEO_DATE_XPOS,VY+VIDEO_DATE_YPOS,
137 int2str(tag,2),FS_SMALL,FC_SPECIAL1);
138 DrawText(VX+VIDEO_DATE_XPOS+27,VY+VIDEO_DATE_YPOS,
139 monatsname[monat],FS_SMALL,FC_SPECIAL1);
140 DrawText(VX+VIDEO_DATE_XPOS+64,VY+VIDEO_DATE_YPOS,
141 int2str(jahr,2),FS_SMALL,FC_SPECIAL1);
144 if (state & VIDEO_STATE_TIME_ON)
146 int min = value / 60;
147 int sec = value % 60;
149 DrawText(VX+VIDEO_TIME_XPOS,VY+VIDEO_TIME_YPOS,
150 int2str(min,2),FS_SMALL,FC_SPECIAL1);
151 DrawText(VX+VIDEO_TIME_XPOS+27,VY+VIDEO_TIME_YPOS,
152 int2str(sec,2),FS_SMALL,FC_SPECIAL1);
155 if (state & VIDEO_STATE_DATE)
156 redraw_mask |= REDRAW_VIDEO_1;
157 if ((state & ~VIDEO_STATE_DATE) & VIDEO_STATE)
158 redraw_mask |= REDRAW_VIDEO_2;
159 if (state & VIDEO_PRESS)
160 redraw_mask |= REDRAW_VIDEO_3;
163 void DrawCompleteVideoDisplay()
165 XCopyArea(display,pix[PIX_DOOR],drawto,gc,
166 DOOR_GFX_PAGEX3,DOOR_GFX_PAGEY2, VXSIZE,VYSIZE, VX,VY);
167 XCopyArea(display,pix[PIX_DOOR],drawto,gc,
168 DOOR_GFX_PAGEX4+VIDEO_CONTROL_XPOS,
169 DOOR_GFX_PAGEY2+VIDEO_CONTROL_YPOS,
170 VIDEO_CONTROL_XSIZE,VIDEO_CONTROL_YSIZE,
171 VX+VIDEO_CONTROL_XPOS,VY+VIDEO_CONTROL_YPOS);
173 DrawVideoDisplay(VIDEO_ALL_OFF,0);
174 if (tape.date && tape.length)
176 DrawVideoDisplay(VIDEO_STATE_DATE_ON,tape.date);
177 DrawVideoDisplay(VIDEO_STATE_TIME_ON,tape.length_seconds);
180 XCopyArea(display,drawto,pix[PIX_DB_DOOR],gc,
181 VX,VY, VXSIZE,VYSIZE, DOOR_GFX_PAGEX1,DOOR_GFX_PAGEY2);
184 void DrawSoundDisplay(unsigned long state)
186 int pos, cx = DOOR_GFX_PAGEX4, cy = 0;
188 pos = (state & BUTTON_SOUND_MUSIC ? SOUND_BUTTON_MUSIC_XPOS :
189 state & BUTTON_SOUND_LOOPS ? SOUND_BUTTON_LOOPS_XPOS :
190 SOUND_BUTTON_SIMPLE_XPOS);
192 if (state & BUTTON_ON)
193 cy -= SOUND_BUTTON_YSIZE;
195 if (state & BUTTON_PRESSED)
196 cx = DOOR_GFX_PAGEX3;
198 XCopyArea(display,pix[PIX_DOOR],drawto,gc,
199 cx + pos,cy + SOUND_BUTTON_ANY_YPOS,
200 SOUND_BUTTON_XSIZE,SOUND_BUTTON_YSIZE,
201 DX + pos,DY + SOUND_BUTTON_ANY_YPOS);
203 redraw_mask |= REDRAW_DOOR_1;
206 void DrawGameButton(unsigned long state)
208 int pos, cx = DOOR_GFX_PAGEX4, cy = -GAME_BUTTON_YSIZE;
210 pos = (state & BUTTON_GAME_STOP ? GAME_BUTTON_STOP_XPOS :
211 state & BUTTON_GAME_PAUSE ? GAME_BUTTON_PAUSE_XPOS :
212 GAME_BUTTON_PLAY_XPOS);
214 if (state & BUTTON_PRESSED)
215 cx = DOOR_GFX_PAGEX3;
217 XCopyArea(display,pix[PIX_DOOR],drawto,gc,
218 cx + pos,cy + GAME_BUTTON_ANY_YPOS,
219 GAME_BUTTON_XSIZE,GAME_BUTTON_YSIZE,
220 DX + pos,DY + GAME_BUTTON_ANY_YPOS);
222 redraw_mask |= REDRAW_DOOR_1;
225 void DrawChooseButton(unsigned long state)
227 int pos, cx = DOOR_GFX_PAGEX4, cy = 0;
229 pos = (state & BUTTON_OK ? OK_BUTTON_XPOS : NO_BUTTON_XPOS);
231 if (state & BUTTON_PRESSED)
232 cx = DOOR_GFX_PAGEX3;
234 XCopyArea(display,pix[PIX_DOOR],drawto,gc,
235 cx + pos,cy + OK_BUTTON_GFX_YPOS,
236 OK_BUTTON_XSIZE,OK_BUTTON_YSIZE,
237 DX + pos,DY + OK_BUTTON_YPOS);
239 redraw_mask |= REDRAW_DOOR_1;
242 void DrawConfirmButton(unsigned long state)
244 int cx = DOOR_GFX_PAGEX4, cy = 0;
246 if (state & BUTTON_PRESSED)
247 cx = DOOR_GFX_PAGEX3;
249 XCopyArea(display,pix[PIX_DOOR],drawto,gc,
250 cx + CONFIRM_BUTTON_XPOS,cy + CONFIRM_BUTTON_GFX_YPOS,
251 CONFIRM_BUTTON_XSIZE,CONFIRM_BUTTON_YSIZE,
252 DX + CONFIRM_BUTTON_XPOS,DY + CONFIRM_BUTTON_YPOS);
254 redraw_mask |= REDRAW_DOOR_1;
257 /* several buttons in the level editor */
259 void DrawEditButton(unsigned long state)
262 int xpos = 0, ypos = 1, xsize = 2, ysize = 3;
263 int cx = DOOR_GFX_PAGEX6, cy = DOOR_GFX_PAGEY2;
264 static int edit_pos[6][4] =
266 {ED_BUTTON_CTRL_XPOS,ED_BUTTON_CTRL_YPOS,
267 ED_BUTTON_CTRL_XSIZE,ED_BUTTON_CTRL_YSIZE},
269 {ED_BUTTON_FILL_XPOS,ED_BUTTON_FILL_YPOS,
270 ED_BUTTON_FILL_XSIZE,ED_BUTTON_FILL_YSIZE},
272 {ED_BUTTON_LEFT_XPOS,ED_BUTTON_LEFT_YPOS,
273 ED_BUTTON_LEFT_XSIZE,ED_BUTTON_LEFT_YSIZE},
275 {ED_BUTTON_UP_XPOS,ED_BUTTON_UP_YPOS,
276 ED_BUTTON_UP_XSIZE,ED_BUTTON_UP_YSIZE},
278 {ED_BUTTON_DOWN_XPOS,ED_BUTTON_DOWN_YPOS,
279 ED_BUTTON_DOWN_XSIZE,ED_BUTTON_DOWN_YSIZE},
281 {ED_BUTTON_RIGHT_XPOS,ED_BUTTON_RIGHT_YPOS,
282 ED_BUTTON_RIGHT_XSIZE,ED_BUTTON_RIGHT_YSIZE}
285 if (state & ED_BUTTON_PRESSED)
286 cx = DOOR_GFX_PAGEX5;
291 XCopyArea(display,pix[PIX_DOOR],drawto,gc,
292 cx + edit_pos[i][xpos],
293 cy + edit_pos[i][ypos],
296 VX + edit_pos[i][xpos],
297 VY + edit_pos[i][ypos]);
300 redraw_mask |= REDRAW_DOOR_2;
303 void DrawCtrlButton(unsigned long state)
306 int xpos = 0, ypos = 1, xsize = 2, ysize = 3;
307 int cx = DOOR_GFX_PAGEX4, cy = DOOR_GFX_PAGEY1+80;
308 static int edit_pos[4][4] =
310 {ED_BUTTON_EDIT_XPOS,ED_BUTTON_EDIT_YPOS,
311 ED_BUTTON_EDIT_XSIZE,ED_BUTTON_EDIT_YSIZE},
313 {ED_BUTTON_CLEAR_XPOS,ED_BUTTON_CLEAR_YPOS,
314 ED_BUTTON_CLEAR_XSIZE,ED_BUTTON_CLEAR_YSIZE},
316 {ED_BUTTON_UNDO_XPOS,ED_BUTTON_UNDO_YPOS,
317 ED_BUTTON_UNDO_XSIZE,ED_BUTTON_UNDO_YSIZE},
319 {ED_BUTTON_EXIT_XPOS,ED_BUTTON_EXIT_YPOS,
320 ED_BUTTON_EXIT_XSIZE,ED_BUTTON_EXIT_YSIZE}
323 if (state & ED_BUTTON_PRESSED)
324 cx = DOOR_GFX_PAGEX3;
328 if (state & (1<<(i+6)))
329 XCopyArea(display,pix[PIX_DOOR],drawto,gc,
330 cx + edit_pos[i][xpos],
331 cy + edit_pos[i][ypos],
334 VX + edit_pos[i][xpos],
335 VY + edit_pos[i][ypos]);
338 redraw_mask |= REDRAW_DOOR_2;
341 void DrawElemButton(int button_nr, int button_state)
343 int xpos = 0, ypos = 1, xsize = 2, ysize = 3;
344 int cx = DOOR_GFX_PAGEX6, cy = DOOR_GFX_PAGEY1;
345 int from_x, from_y, to_x,to_y, size_x, size_y;
346 static int edit_pos[3][4] =
348 {ED_BUTTON_EUP_XPOS,ED_BUTTON_EUP_YPOS,
349 ED_BUTTON_EUP_XSIZE,ED_BUTTON_EUP_YSIZE},
351 {ED_BUTTON_EDOWN_XPOS,ED_BUTTON_EDOWN_YPOS,
352 ED_BUTTON_EDOWN_XSIZE,ED_BUTTON_EDOWN_YSIZE},
354 {ED_BUTTON_ELEM_XPOS,ED_BUTTON_ELEM_YPOS,
355 ED_BUTTON_ELEM_XSIZE,ED_BUTTON_ELEM_YSIZE}
358 if (button_nr<ED_BUTTON_ELEM)
362 from_x = cx + edit_pos[pos][xpos];
363 from_y = cy + edit_pos[pos][ypos];
364 size_x = edit_pos[pos][xsize];
365 size_y = edit_pos[pos][ysize];
366 to_x = DX + edit_pos[pos][xpos];
367 to_y = DY + edit_pos[pos][ypos];
369 if (button_state & ED_BUTTON_PRESSED)
371 if (button_nr==ED_BUTTON_EUP)
372 from_y = cy + ED_BUTTON_EUP_Y2POS;
374 from_y = cy + ED_BUTTON_EDOWN_Y2POS;
377 XCopyArea(display,pix[PIX_DOOR],drawto,gc,
378 from_x,from_y, size_x,size_y, to_x,to_y);
382 int pos = ED_BUTTON_ELEM;
383 int elem_pos = button_nr-ED_BUTTON_ELEM;
384 int x = elem_pos % MAX_ELEM_X;
385 int y = elem_pos / MAX_ELEM_X;
389 if (elem_pos+element_shift < elements_in_list)
390 graphic = el2gfx(editor_element[elem_pos+element_shift]);
392 graphic = GFX_LEERRAUM;
394 from_x = cx + edit_pos[pos][xpos];
395 from_y = cy + edit_pos[pos][ypos];
396 size_x = edit_pos[pos][xsize];
397 size_y = edit_pos[pos][ysize];
398 to_x = DX + edit_pos[pos][xpos] + x * ED_BUTTON_ELEM_XSIZE;
399 to_y = DY + edit_pos[pos][ypos] + y * ED_BUTTON_ELEM_YSIZE;
401 if (button_state & ED_BUTTON_PRESSED)
403 from_y = ED_BUTTON_ELEM_Y2POS;
407 XCopyArea(display,pix[PIX_DOOR],drawto,gc,
408 from_x,from_y, size_x,size_y, to_x,to_y);
410 DrawMiniGraphicExt(drawto,gc,
411 DX+ED_BUTTON_ELEM_XPOS+3+shift +
412 (elem_pos % MAX_ELEM_X)*ED_BUTTON_ELEM_XSIZE,
413 DY+ED_BUTTON_ELEM_YPOS+3-shift +
414 (elem_pos / MAX_ELEM_X)*ED_BUTTON_ELEM_YSIZE,
418 redraw_mask |= REDRAW_DOOR_1;
421 void DrawCountButton(int button_nr, int button_state)
423 int from_x, from_y, to_x,to_y, size_x, size_y;
426 DOOR_GFX_PAGEX4+(button_nr%2 ? ED_BUTTON_PLUS_XPOS : ED_BUTTON_MINUS_XPOS);
427 from_y = DOOR_GFX_PAGEY1 + ED_BUTTON_MINUS_YPOS;
428 size_x = ED_BUTTON_MINUS_XSIZE;
429 size_y = ED_BUTTON_MINUS_YSIZE;
430 to_x = (button_nr<32 ? ED_COUNT_GADGET_XPOS : ED_SIZE_GADGET_XPOS);
432 to_x += (ED_BUTTON_PLUS_XPOS - ED_BUTTON_MINUS_XPOS);
433 to_y = (button_nr<32 ? ED_COUNT_GADGET_YPOS : ED_SIZE_GADGET_YPOS) +
434 ((button_nr<32 ? button_nr : button_nr-32)/2)*ED_COUNT_GADGET_YSIZE;
436 if (button_state & ED_BUTTON_PRESSED)
439 XCopyArea(display,pix[PIX_DOOR],drawto,gc,
440 from_x,from_y, size_x,size_y, to_x,to_y);
441 XCopyArea(display,pix[PIX_DOOR],window,gc,
442 from_x,from_y, size_x,size_y, to_x,to_y);
445 /**********************************************************************/
446 /********** checking buttons (and redrawing them, if needed) **********/
447 /**********************************************************************/
449 int CheckVideoButtons(int mx, int my, int button)
452 static int choice = -1;
453 static BOOL pressed = FALSE;
454 static int video_button[5] =
456 VIDEO_PRESS_EJECT_ON,
458 VIDEO_PRESS_PAUSE_ON,
465 if (!motion_status) /* Maustaste neu gedrückt */
467 if (ON_VIDEO_BUTTON(mx,my))
469 choice = VIDEO_BUTTON(mx);
471 DrawVideoDisplay(video_button[choice],0);
474 else /* Mausbewegung bei gedrückter Maustaste */
476 if ((!ON_VIDEO_BUTTON(mx,my) || VIDEO_BUTTON(mx)!=choice) &&
477 choice>=0 && pressed)
480 DrawVideoDisplay(video_button[choice]<<1,0);
482 else if (ON_VIDEO_BUTTON(mx,my) && VIDEO_BUTTON(mx)==choice && !pressed)
485 DrawVideoDisplay(video_button[choice],0);
489 else /* Maustaste wieder losgelassen */
491 if (ON_VIDEO_BUTTON(mx,my) && VIDEO_BUTTON(mx)==choice && pressed)
493 DrawVideoDisplay(video_button[choice]<<1,0);
494 return_code = choice+1;
509 int CheckSoundButtons(int mx, int my, int button)
512 static int choice = -1;
513 static BOOL pressed = FALSE;
516 sound_state[0] = BUTTON_SOUND_MUSIC | (BUTTON_ON * sound_music_on);
517 sound_state[1] = BUTTON_SOUND_LOOPS | (BUTTON_ON * sound_loops_on);
518 sound_state[2] = BUTTON_SOUND_SIMPLE | (BUTTON_ON * sound_simple_on);
522 if (!motion_status) /* Maustaste neu gedrückt */
524 if (ON_SOUND_BUTTON(mx,my))
526 choice = SOUND_BUTTON(mx);
528 DrawSoundDisplay(sound_state[choice] | BUTTON_PRESSED);
531 else /* Mausbewegung bei gedrückter Maustaste */
533 if ((!ON_SOUND_BUTTON(mx,my) || SOUND_BUTTON(mx)!=choice) &&
534 choice>=0 && pressed)
537 DrawSoundDisplay(sound_state[choice] | BUTTON_RELEASED);
539 else if (ON_SOUND_BUTTON(mx,my) && SOUND_BUTTON(mx)==choice && !pressed)
542 DrawSoundDisplay(sound_state[choice] | BUTTON_PRESSED);
546 else /* Maustaste wieder losgelassen */
548 if (ON_SOUND_BUTTON(mx,my) && SOUND_BUTTON(mx)==choice && pressed)
550 DrawSoundDisplay(sound_state[choice] | BUTTON_RELEASED);
551 return_code = 1<<choice;
566 int CheckGameButtons(int mx, int my, int button)
569 static int choice = -1;
570 static BOOL pressed = FALSE;
580 if (!motion_status) /* Maustaste neu gedrückt */
582 if (ON_GAME_BUTTON(mx,my))
584 choice = GAME_BUTTON(mx);
586 DrawGameButton(game_state[choice] | BUTTON_PRESSED);
589 else /* Mausbewegung bei gedrückter Maustaste */
591 if ((!ON_GAME_BUTTON(mx,my) || GAME_BUTTON(mx)!=choice) &&
592 choice>=0 && pressed)
595 DrawGameButton(game_state[choice] | BUTTON_RELEASED);
597 else if (ON_GAME_BUTTON(mx,my) && GAME_BUTTON(mx)==choice && !pressed)
600 DrawGameButton(game_state[choice] | BUTTON_PRESSED);
604 else /* Maustaste wieder losgelassen */
606 if (ON_GAME_BUTTON(mx,my) && GAME_BUTTON(mx)==choice && pressed)
608 DrawGameButton(game_state[choice] | BUTTON_RELEASED);
609 return_code = 1<<choice;
624 int CheckChooseButtons(int mx, int my, int button)
627 static int choice = -1;
628 static BOOL pressed = FALSE;
629 static int choose_button[5] =
637 if (!motion_status) /* Maustaste neu gedrückt */
639 if (ON_CHOOSE_BUTTON(mx,my))
641 choice = CHOOSE_BUTTON(mx);
643 DrawChooseButton(choose_button[choice] | BUTTON_PRESSED);
646 else /* Mausbewegung bei gedrückter Maustaste */
648 if ((!ON_CHOOSE_BUTTON(mx,my) || CHOOSE_BUTTON(mx)!=choice) &&
649 choice>=0 && pressed)
652 DrawChooseButton(choose_button[choice] | BUTTON_RELEASED);
654 else if (ON_CHOOSE_BUTTON(mx,my) &&CHOOSE_BUTTON(mx)==choice && !pressed)
657 DrawChooseButton(choose_button[choice] | BUTTON_PRESSED);
661 else /* Maustaste wieder losgelassen */
663 if (ON_CHOOSE_BUTTON(mx,my) && CHOOSE_BUTTON(mx)==choice && pressed)
665 DrawChooseButton(choose_button[choice] | BUTTON_RELEASED);
666 return_code = choice+1;
681 int CheckConfirmButton(int mx, int my, int button)
684 static int choice = -1;
685 static BOOL pressed = FALSE;
689 if (!motion_status) /* Maustaste neu gedrückt */
691 if (ON_CONFIRM_BUTTON(mx,my))
695 DrawConfirmButton(BUTTON_PRESSED);
698 else /* Mausbewegung bei gedrückter Maustaste */
700 if (!ON_CONFIRM_BUTTON(mx,my) && choice>=0 && pressed)
703 DrawConfirmButton(BUTTON_RELEASED);
705 else if (ON_CONFIRM_BUTTON(mx,my) && !pressed)
708 DrawConfirmButton(BUTTON_PRESSED);
712 else /* Maustaste wieder losgelassen */
714 if (ON_CONFIRM_BUTTON(mx,my) && pressed)
716 DrawConfirmButton(BUTTON_RELEASED);
717 return_code = BUTTON_CONFIRM;
732 /* several buttons in the level editor */
734 int CheckEditButtons(int mx, int my, int button)
737 static int choice = -1;
738 static BOOL pressed = FALSE;
739 static int edit_button[6] =
751 if (!motion_status) /* Maustaste neu gedrückt */
753 if (ON_EDIT_BUTTON(mx,my))
755 choice = EDIT_BUTTON(mx,my);
757 DrawEditButton(edit_button[choice] | ED_BUTTON_PRESSED);
758 if (edit_button[choice]!=ED_BUTTON_CTRL &&
759 edit_button[choice]!=ED_BUTTON_FILL)
760 return_code = 1<<choice;
763 else /* Mausbewegung bei gedrückter Maustaste */
765 if ((!ON_EDIT_BUTTON(mx,my) || EDIT_BUTTON(mx,my)!=choice) &&
766 choice>=0 && pressed)
769 DrawEditButton(edit_button[choice] | ED_BUTTON_RELEASED);
771 else if (ON_EDIT_BUTTON(mx,my) && EDIT_BUTTON(mx,my)==choice)
774 DrawEditButton(edit_button[choice] | ED_BUTTON_PRESSED);
776 if (edit_button[choice]!=ED_BUTTON_CTRL &&
777 edit_button[choice]!=ED_BUTTON_FILL)
778 return_code = 1<<choice;
782 else /* Maustaste wieder losgelassen */
784 if (ON_EDIT_BUTTON(mx,my) && EDIT_BUTTON(mx,my)==choice && pressed)
786 DrawEditButton(edit_button[choice] | ED_BUTTON_RELEASED);
787 if (edit_button[choice]==ED_BUTTON_CTRL ||
788 edit_button[choice]==ED_BUTTON_FILL)
789 return_code = 1<<choice;
804 int CheckCtrlButtons(int mx, int my, int button)
807 static int choice = -1;
808 static BOOL pressed = FALSE;
809 static int ctrl_button[4] =
819 if (!motion_status) /* Maustaste neu gedrückt */
821 if (ON_CTRL_BUTTON(mx,my))
823 choice = CTRL_BUTTON(mx,my);
825 DrawCtrlButton(ctrl_button[choice] | ED_BUTTON_PRESSED);
828 else /* Mausbewegung bei gedrückter Maustaste */
830 if ((!ON_CTRL_BUTTON(mx,my) || CTRL_BUTTON(mx,my)!=choice) &&
831 choice>=0 && pressed)
834 DrawCtrlButton(ctrl_button[choice] | ED_BUTTON_RELEASED);
836 else if (ON_CTRL_BUTTON(mx,my) && CTRL_BUTTON(mx,my)==choice && !pressed)
839 DrawCtrlButton(ctrl_button[choice] | ED_BUTTON_PRESSED);
843 else /* Maustaste wieder losgelassen */
845 if (ON_CTRL_BUTTON(mx,my) && CTRL_BUTTON(mx,my)==choice && pressed)
847 DrawCtrlButton(ctrl_button[choice] | ED_BUTTON_RELEASED);
848 return_code = 1<<(choice+6);
863 int CheckElemButtons(int mx, int my, int button)
865 int return_code = -1;
866 static int choice = -1;
867 static BOOL pressed = FALSE;
871 if (!motion_status) /* Maustaste neu gedrückt */
873 if (ON_ELEM_BUTTON(mx,my))
875 choice = ELEM_BUTTON(mx,my);
877 DrawElemButton(choice,ED_BUTTON_PRESSED);
878 if (choice==ED_BUTTON_EUP ||
879 choice==ED_BUTTON_EDOWN)
880 return_code = choice;
883 else /* Mausbewegung bei gedrückter Maustaste */
885 if ((!ON_ELEM_BUTTON(mx,my) || ELEM_BUTTON(mx,my)!=choice) &&
886 choice>=0 && pressed)
889 DrawElemButton(choice,ED_BUTTON_RELEASED);
891 else if (ON_ELEM_BUTTON(mx,my) && ELEM_BUTTON(mx,my)==choice)
894 DrawElemButton(choice,ED_BUTTON_PRESSED);
896 if (choice==ED_BUTTON_EUP ||
897 choice==ED_BUTTON_EDOWN)
898 return_code = choice;
902 else /* Maustaste wieder losgelassen */
904 if (ON_ELEM_BUTTON(mx,my) && ELEM_BUTTON(mx,my)==choice && pressed)
906 DrawElemButton(choice,ED_BUTTON_RELEASED);
907 if (choice!=ED_BUTTON_EUP &&
908 choice!=ED_BUTTON_EDOWN)
909 return_code = choice;
924 int CheckCountButtons(int mx, int my, int button)
926 int return_code = -1;
927 static int choice = -1;
928 static BOOL pressed = FALSE;
932 if (!motion_status) /* Maustaste neu gedrückt */
934 if (ON_COUNT_BUTTON(mx,my))
936 choice = COUNT_BUTTON(mx,my);
938 DrawCountButton(choice,ED_BUTTON_PRESSED);
939 return_code = choice;
942 else /* Mausbewegung bei gedrückter Maustaste */
944 if ((!ON_COUNT_BUTTON(mx,my) || COUNT_BUTTON(mx,my)!=choice) &&
945 choice>=0 && pressed)
948 DrawCountButton(choice,ED_BUTTON_RELEASED);
950 else if (ON_COUNT_BUTTON(mx,my) && COUNT_BUTTON(mx,my)==choice)
953 DrawCountButton(choice,ED_BUTTON_PRESSED);
955 return_code = choice;
959 else /* Maustaste wieder losgelassen */
961 if (ON_COUNT_BUTTON(mx,my) && COUNT_BUTTON(mx,my)==choice && pressed)
963 DrawCountButton(choice,ED_BUTTON_RELEASED);