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 },
87 if (state & VIDEO_STATE_PBEND_OFF)
89 int cx = DOOR_GFX_PAGEX3, cy = DOOR_GFX_PAGEY2;
91 XCopyArea(display,pix[PIX_DOOR],drawto,gc,
92 cx + VIDEO_REC_LABEL_XPOS,
93 cy + VIDEO_REC_LABEL_YPOS,
94 VIDEO_PBEND_LABEL_XSIZE,
95 VIDEO_PBEND_LABEL_YSIZE,
96 VX + VIDEO_REC_LABEL_XPOS,
97 VY + VIDEO_REC_LABEL_YPOS);
104 int pos = i/2, cx, cy = DOOR_GFX_PAGEY2;
106 if (i%2) /* i ungerade => STATE_ON / PRESS_OFF */
107 cx = DOOR_GFX_PAGEX4;
109 cx = DOOR_GFX_PAGEX3; /* i gerade => STATE_OFF / PRESS_ON */
111 if (video_pos[pos][part_label][0] && value != VIDEO_DISPLAY_SYMBOL_ONLY)
112 XCopyArea(display,pix[PIX_DOOR],drawto,gc,
113 cx + video_pos[pos][part_label][xpos],
114 cy + video_pos[pos][part_label][ypos],
115 video_pos[pos][part_label][xsize],
116 video_pos[pos][part_label][ysize],
117 VX + video_pos[pos][part_label][xpos],
118 VY + video_pos[pos][part_label][ypos]);
119 if (video_pos[pos][part_symbol][0] && value != VIDEO_DISPLAY_LABEL_ONLY)
120 XCopyArea(display,pix[PIX_DOOR],drawto,gc,
121 cx + video_pos[pos][part_symbol][xpos],
122 cy + video_pos[pos][part_symbol][ypos],
123 video_pos[pos][part_symbol][xsize],
124 video_pos[pos][part_symbol][ysize],
125 VX + video_pos[pos][part_symbol][xpos],
126 VY + video_pos[pos][part_symbol][ypos]);
130 if (state & VIDEO_STATE_FFWD_ON)
132 int cx = DOOR_GFX_PAGEX4, cy = DOOR_GFX_PAGEY2;
134 XCopyArea(display,pix[PIX_DOOR],drawto,gc,
135 cx + VIDEO_PLAY_SYMBOL_XPOS,
136 cy + VIDEO_PLAY_SYMBOL_YPOS,
137 VIDEO_PLAY_SYMBOL_XSIZE - 2,
138 VIDEO_PLAY_SYMBOL_YSIZE,
139 VX + VIDEO_PLAY_SYMBOL_XPOS - 9,
140 VY + VIDEO_PLAY_SYMBOL_YPOS);
143 if (state & VIDEO_STATE_PBEND_ON)
145 int cx = DOOR_GFX_PAGEX6, cy = DOOR_GFX_PAGEY1;
147 XCopyArea(display,pix[PIX_DOOR],drawto,gc,
148 cx + VIDEO_PBEND_LABEL_XPOS,
149 cy + VIDEO_PBEND_LABEL_YPOS,
150 VIDEO_PBEND_LABEL_XSIZE,
151 VIDEO_PBEND_LABEL_YSIZE,
152 VX + VIDEO_REC_LABEL_XPOS,
153 VY + VIDEO_REC_LABEL_YPOS);
156 if (state & VIDEO_STATE_DATE_ON)
158 int tag = value % 100;
159 int monat = (value/100) % 100;
160 int jahr = (value/10000);
162 DrawText(VX+VIDEO_DATE_XPOS,VY+VIDEO_DATE_YPOS,
163 int2str(tag,2),FS_SMALL,FC_SPECIAL1);
164 DrawText(VX+VIDEO_DATE_XPOS+27,VY+VIDEO_DATE_YPOS,
165 monatsname[monat],FS_SMALL,FC_SPECIAL1);
166 DrawText(VX+VIDEO_DATE_XPOS+64,VY+VIDEO_DATE_YPOS,
167 int2str(jahr,2),FS_SMALL,FC_SPECIAL1);
170 if (state & VIDEO_STATE_TIME_ON)
172 int min = value / 60;
173 int sec = value % 60;
175 DrawText(VX+VIDEO_TIME_XPOS,VY+VIDEO_TIME_YPOS,
176 int2str(min,2),FS_SMALL,FC_SPECIAL1);
177 DrawText(VX+VIDEO_TIME_XPOS+27,VY+VIDEO_TIME_YPOS,
178 int2str(sec,2),FS_SMALL,FC_SPECIAL1);
181 if (state & VIDEO_STATE_DATE)
182 redraw_mask |= REDRAW_VIDEO_1;
183 if ((state & ~VIDEO_STATE_DATE) & VIDEO_STATE)
184 redraw_mask |= REDRAW_VIDEO_2;
185 if (state & VIDEO_PRESS)
186 redraw_mask |= REDRAW_VIDEO_3;
189 void DrawCompleteVideoDisplay()
191 XCopyArea(display,pix[PIX_DOOR],drawto,gc,
192 DOOR_GFX_PAGEX3,DOOR_GFX_PAGEY2, VXSIZE,VYSIZE, VX,VY);
193 XCopyArea(display,pix[PIX_DOOR],drawto,gc,
194 DOOR_GFX_PAGEX4+VIDEO_CONTROL_XPOS,
195 DOOR_GFX_PAGEY2+VIDEO_CONTROL_YPOS,
196 VIDEO_CONTROL_XSIZE,VIDEO_CONTROL_YSIZE,
197 VX+VIDEO_CONTROL_XPOS,VY+VIDEO_CONTROL_YPOS);
199 DrawVideoDisplay(VIDEO_ALL_OFF,0);
200 if (tape.date && tape.length)
202 DrawVideoDisplay(VIDEO_STATE_DATE_ON,tape.date);
203 DrawVideoDisplay(VIDEO_STATE_TIME_ON,tape.length_seconds);
206 XCopyArea(display,drawto,pix[PIX_DB_DOOR],gc,
207 VX,VY, VXSIZE,VYSIZE, DOOR_GFX_PAGEX1,DOOR_GFX_PAGEY2);
210 void DrawSoundDisplay(unsigned long state)
212 int pos, cx = DOOR_GFX_PAGEX4, cy = 0;
214 pos = (state & BUTTON_SOUND_MUSIC ? SOUND_BUTTON_MUSIC_XPOS :
215 state & BUTTON_SOUND_LOOPS ? SOUND_BUTTON_LOOPS_XPOS :
216 SOUND_BUTTON_SIMPLE_XPOS);
218 if (state & BUTTON_ON)
219 cy -= SOUND_BUTTON_YSIZE;
221 if (state & BUTTON_PRESSED)
222 cx = DOOR_GFX_PAGEX3;
224 XCopyArea(display,pix[PIX_DOOR],drawto,gc,
225 cx + pos,cy + SOUND_BUTTON_ANY_YPOS,
226 SOUND_BUTTON_XSIZE,SOUND_BUTTON_YSIZE,
227 DX + pos,DY + SOUND_BUTTON_ANY_YPOS);
229 redraw_mask |= REDRAW_DOOR_1;
232 void DrawGameButton(unsigned long state)
234 int pos, cx = DOOR_GFX_PAGEX4, cy = -GAME_BUTTON_YSIZE;
236 pos = (state & BUTTON_GAME_STOP ? GAME_BUTTON_STOP_XPOS :
237 state & BUTTON_GAME_PAUSE ? GAME_BUTTON_PAUSE_XPOS :
238 GAME_BUTTON_PLAY_XPOS);
240 if (state & BUTTON_PRESSED)
241 cx = DOOR_GFX_PAGEX3;
243 XCopyArea(display,pix[PIX_DOOR],drawto,gc,
244 cx + pos,cy + GAME_BUTTON_ANY_YPOS,
245 GAME_BUTTON_XSIZE,GAME_BUTTON_YSIZE,
246 DX + pos,DY + GAME_BUTTON_ANY_YPOS);
248 redraw_mask |= REDRAW_DOOR_1;
251 void DrawYesNoButton(unsigned long state, int mode)
253 Drawable dest_drawto;
254 int dest_xoffset, dest_yoffset;
255 int xpos, cx = DOOR_GFX_PAGEX4;
259 dest_drawto = pix[PIX_DB_DOOR];
260 dest_xoffset = DOOR_GFX_PAGEX1;
265 dest_drawto = drawto;
270 xpos = (state & BUTTON_OK ? OK_BUTTON_XPOS : NO_BUTTON_XPOS);
272 if (state & BUTTON_PRESSED)
273 cx = DOOR_GFX_PAGEX3;
275 XCopyArea(display, pix[PIX_DOOR], dest_drawto, gc,
276 cx + xpos, OK_BUTTON_GFX_YPOS,
277 OK_BUTTON_XSIZE, OK_BUTTON_YSIZE,
278 dest_xoffset + xpos, dest_yoffset + OK_BUTTON_YPOS);
280 redraw_mask |= REDRAW_DOOR_1;
283 void DrawConfirmButton(unsigned long state, int mode)
285 Drawable dest_drawto;
286 int dest_xoffset, dest_yoffset;
287 int cx = DOOR_GFX_PAGEX4;
291 dest_drawto = pix[PIX_DB_DOOR];
292 dest_xoffset = DOOR_GFX_PAGEX1;
297 dest_drawto = drawto;
302 if (state & BUTTON_PRESSED)
303 cx = DOOR_GFX_PAGEX3;
305 XCopyArea(display, pix[PIX_DOOR], dest_drawto, gc,
306 cx + CONFIRM_BUTTON_XPOS, CONFIRM_BUTTON_GFX_YPOS,
307 CONFIRM_BUTTON_XSIZE, CONFIRM_BUTTON_YSIZE,
308 dest_xoffset + CONFIRM_BUTTON_XPOS,
309 dest_yoffset + CONFIRM_BUTTON_YPOS);
311 redraw_mask |= REDRAW_DOOR_1;
314 void DrawPlayerButton(unsigned long state, int mode)
316 Drawable dest_drawto;
317 int dest_xoffset, dest_yoffset;
319 int graphic_offset = (PLAYER_BUTTON_XSIZE - TILEX/2)/2;
321 int cx = DOOR_GFX_PAGEX4, cy = 0;
325 dest_drawto = pix[PIX_DB_DOOR];
326 dest_xoffset = DOOR_GFX_PAGEX1;
331 dest_drawto = drawto;
336 if (state & BUTTON_PLAYER_1)
337 graphic = GFX_SPIELER1;
338 else if (state & BUTTON_PLAYER_2)
339 graphic = GFX_SPIELER2;
340 else if (state & BUTTON_PLAYER_3)
341 graphic = GFX_SPIELER3;
342 else if (state & BUTTON_PLAYER_4)
343 graphic = GFX_SPIELER4;
345 xpos = (state & BUTTON_PLAYER_1 || state & BUTTON_PLAYER_3 ?
346 PLAYER_BUTTON_1_XPOS : PLAYER_BUTTON_2_XPOS);
347 ypos = (state & BUTTON_PLAYER_1 || state & BUTTON_PLAYER_2 ?
348 PLAYER_BUTTON_1_YPOS : PLAYER_BUTTON_3_YPOS);
350 if (state & BUTTON_PRESSED)
352 cx = DOOR_GFX_PAGEX3;
356 XCopyArea(display, pix[PIX_DOOR], dest_drawto, gc,
357 cx + PLAYER_BUTTON_GFX_XPOS, cy + PLAYER_BUTTON_GFX_YPOS,
358 PLAYER_BUTTON_XSIZE, PLAYER_BUTTON_YSIZE,
359 dest_xoffset + xpos, dest_yoffset + ypos);
360 DrawMiniGraphicExt(dest_drawto,gc,
361 dest_xoffset + xpos + graphic_offset,
362 dest_yoffset + ypos + graphic_offset,
365 redraw_mask |= REDRAW_DOOR_1;
368 /* several buttons in the level editor */
370 void DrawEditButton(unsigned long state)
373 int xpos = 0, ypos = 1, xsize = 2, ysize = 3;
374 int cx = DOOR_GFX_PAGEX6, cy = DOOR_GFX_PAGEY2;
375 static int edit_pos[6][4] =
377 {ED_BUTTON_CTRL_XPOS,ED_BUTTON_CTRL_YPOS,
378 ED_BUTTON_CTRL_XSIZE,ED_BUTTON_CTRL_YSIZE},
380 {ED_BUTTON_FILL_XPOS,ED_BUTTON_FILL_YPOS,
381 ED_BUTTON_FILL_XSIZE,ED_BUTTON_FILL_YSIZE},
383 {ED_BUTTON_LEFT_XPOS,ED_BUTTON_LEFT_YPOS,
384 ED_BUTTON_LEFT_XSIZE,ED_BUTTON_LEFT_YSIZE},
386 {ED_BUTTON_UP_XPOS,ED_BUTTON_UP_YPOS,
387 ED_BUTTON_UP_XSIZE,ED_BUTTON_UP_YSIZE},
389 {ED_BUTTON_DOWN_XPOS,ED_BUTTON_DOWN_YPOS,
390 ED_BUTTON_DOWN_XSIZE,ED_BUTTON_DOWN_YSIZE},
392 {ED_BUTTON_RIGHT_XPOS,ED_BUTTON_RIGHT_YPOS,
393 ED_BUTTON_RIGHT_XSIZE,ED_BUTTON_RIGHT_YSIZE}
396 if (state & ED_BUTTON_PRESSED)
397 cx = DOOR_GFX_PAGEX5;
402 XCopyArea(display,pix[PIX_DOOR],drawto,gc,
403 cx + edit_pos[i][xpos],
404 cy + edit_pos[i][ypos],
407 VX + edit_pos[i][xpos],
408 VY + edit_pos[i][ypos]);
411 redraw_mask |= REDRAW_DOOR_2;
414 void DrawCtrlButton(unsigned long state)
417 int xpos = 0, ypos = 1, xsize = 2, ysize = 3;
418 int cx = DOOR_GFX_PAGEX4, cy = DOOR_GFX_PAGEY1+80;
419 static int edit_pos[4][4] =
421 {ED_BUTTON_EDIT_XPOS,ED_BUTTON_EDIT_YPOS,
422 ED_BUTTON_EDIT_XSIZE,ED_BUTTON_EDIT_YSIZE},
424 {ED_BUTTON_CLEAR_XPOS,ED_BUTTON_CLEAR_YPOS,
425 ED_BUTTON_CLEAR_XSIZE,ED_BUTTON_CLEAR_YSIZE},
427 {ED_BUTTON_UNDO_XPOS,ED_BUTTON_UNDO_YPOS,
428 ED_BUTTON_UNDO_XSIZE,ED_BUTTON_UNDO_YSIZE},
430 {ED_BUTTON_EXIT_XPOS,ED_BUTTON_EXIT_YPOS,
431 ED_BUTTON_EXIT_XSIZE,ED_BUTTON_EXIT_YSIZE}
434 if (state & ED_BUTTON_PRESSED)
435 cx = DOOR_GFX_PAGEX3;
439 if (state & (1<<(i+6)))
440 XCopyArea(display,pix[PIX_DOOR],drawto,gc,
441 cx + edit_pos[i][xpos],
442 cy + edit_pos[i][ypos],
445 VX + edit_pos[i][xpos],
446 VY + edit_pos[i][ypos]);
449 redraw_mask |= REDRAW_DOOR_2;
452 void DrawElemButton(int button_nr, int button_state)
454 int xpos = 0, ypos = 1, xsize = 2, ysize = 3;
455 int cx = DOOR_GFX_PAGEX6, cy = DOOR_GFX_PAGEY1;
456 int from_x, from_y, to_x,to_y, size_x, size_y;
457 static int edit_pos[3][4] =
459 {ED_BUTTON_EUP_XPOS,ED_BUTTON_EUP_YPOS,
460 ED_BUTTON_EUP_XSIZE,ED_BUTTON_EUP_YSIZE},
462 {ED_BUTTON_EDOWN_XPOS,ED_BUTTON_EDOWN_YPOS,
463 ED_BUTTON_EDOWN_XSIZE,ED_BUTTON_EDOWN_YSIZE},
465 {ED_BUTTON_ELEM_XPOS,ED_BUTTON_ELEM_YPOS,
466 ED_BUTTON_ELEM_XSIZE,ED_BUTTON_ELEM_YSIZE}
469 if (button_nr<ED_BUTTON_ELEM)
473 from_x = cx + edit_pos[pos][xpos];
474 from_y = cy + edit_pos[pos][ypos];
475 size_x = edit_pos[pos][xsize];
476 size_y = edit_pos[pos][ysize];
477 to_x = DX + edit_pos[pos][xpos];
478 to_y = DY + edit_pos[pos][ypos];
480 if (button_state & ED_BUTTON_PRESSED)
482 if (button_nr==ED_BUTTON_EUP)
483 from_y = cy + ED_BUTTON_EUP_Y2POS;
485 from_y = cy + ED_BUTTON_EDOWN_Y2POS;
488 XCopyArea(display,pix[PIX_DOOR],drawto,gc,
489 from_x,from_y, size_x,size_y, to_x,to_y);
493 int pos = ED_BUTTON_ELEM;
494 int elem_pos = button_nr-ED_BUTTON_ELEM;
495 int x = elem_pos % MAX_ELEM_X;
496 int y = elem_pos / MAX_ELEM_X;
500 if (elem_pos+element_shift < elements_in_list)
501 graphic = el2gfx(editor_element[elem_pos+element_shift]);
503 graphic = GFX_LEERRAUM;
505 from_x = cx + edit_pos[pos][xpos];
506 from_y = cy + edit_pos[pos][ypos];
507 size_x = edit_pos[pos][xsize];
508 size_y = edit_pos[pos][ysize];
509 to_x = DX + edit_pos[pos][xpos] + x * ED_BUTTON_ELEM_XSIZE;
510 to_y = DY + edit_pos[pos][ypos] + y * ED_BUTTON_ELEM_YSIZE;
512 if (button_state & ED_BUTTON_PRESSED)
514 from_y = ED_BUTTON_ELEM_Y2POS;
518 XCopyArea(display,pix[PIX_DOOR],drawto,gc,
519 from_x,from_y, size_x,size_y, to_x,to_y);
521 DrawMiniGraphicExt(drawto,gc,
522 DX+ED_BUTTON_ELEM_XPOS+3+shift +
523 (elem_pos % MAX_ELEM_X)*ED_BUTTON_ELEM_XSIZE,
524 DY+ED_BUTTON_ELEM_YPOS+3-shift +
525 (elem_pos / MAX_ELEM_X)*ED_BUTTON_ELEM_YSIZE,
529 redraw_mask |= REDRAW_DOOR_1;
532 void DrawCountButton(int button_nr, int button_state)
534 int from_x, from_y, to_x,to_y, size_x, size_y;
537 DOOR_GFX_PAGEX4+(button_nr%2 ? ED_BUTTON_PLUS_XPOS : ED_BUTTON_MINUS_XPOS);
538 from_y = DOOR_GFX_PAGEY1 + ED_BUTTON_MINUS_YPOS;
539 size_x = ED_BUTTON_MINUS_XSIZE;
540 size_y = ED_BUTTON_MINUS_YSIZE;
541 to_x = (button_nr<32 ? ED_COUNT_GADGET_XPOS : ED_SIZE_GADGET_XPOS);
543 to_x += (ED_BUTTON_PLUS_XPOS - ED_BUTTON_MINUS_XPOS);
544 to_y = (button_nr<32 ? ED_COUNT_GADGET_YPOS : ED_SIZE_GADGET_YPOS) +
545 ((button_nr<32 ? button_nr : button_nr-32)/2)*ED_COUNT_GADGET_YSIZE;
547 if (button_state & ED_BUTTON_PRESSED)
550 XCopyArea(display,pix[PIX_DOOR],drawto,gc,
551 from_x,from_y, size_x,size_y, to_x,to_y);
552 XCopyArea(display,pix[PIX_DOOR],window,gc,
553 from_x,from_y, size_x,size_y, to_x,to_y);
556 /**********************************************************************/
557 /********** checking buttons (and redrawing them, if needed) **********/
558 /**********************************************************************/
560 int CheckVideoButtons(int mx, int my, int button)
563 static int choice = -1;
564 static boolean pressed = FALSE;
565 static int video_button[5] =
567 VIDEO_PRESS_EJECT_ON,
569 VIDEO_PRESS_PAUSE_ON,
576 if (!motion_status) /* Maustaste neu gedrückt */
578 if (ON_VIDEO_BUTTON(mx,my))
580 choice = VIDEO_BUTTON(mx);
582 DrawVideoDisplay(video_button[choice],0);
585 else /* Mausbewegung bei gedrückter Maustaste */
587 if ((!ON_VIDEO_BUTTON(mx,my) || VIDEO_BUTTON(mx)!=choice) &&
588 choice>=0 && pressed)
591 DrawVideoDisplay(video_button[choice]<<1,0);
593 else if (ON_VIDEO_BUTTON(mx,my) && VIDEO_BUTTON(mx)==choice && !pressed)
596 DrawVideoDisplay(video_button[choice],0);
600 else /* Maustaste wieder losgelassen */
602 if (ON_VIDEO_BUTTON(mx,my) && VIDEO_BUTTON(mx)==choice && pressed)
604 DrawVideoDisplay(video_button[choice]<<1,0);
605 return_code = choice+1;
620 int CheckSoundButtons(int mx, int my, int button)
623 static int choice = -1;
624 static boolean pressed = FALSE;
627 sound_state[0] = BUTTON_SOUND_MUSIC | (BUTTON_ON * setup.sound_music);
628 sound_state[1] = BUTTON_SOUND_LOOPS | (BUTTON_ON * setup.sound_loops);
629 sound_state[2] = BUTTON_SOUND_SIMPLE | (BUTTON_ON * setup.sound_simple);
633 if (!motion_status) /* Maustaste neu gedrückt */
635 if (ON_SOUND_BUTTON(mx,my))
637 choice = SOUND_BUTTON(mx);
639 DrawSoundDisplay(sound_state[choice] | BUTTON_PRESSED);
642 else /* Mausbewegung bei gedrückter Maustaste */
644 if ((!ON_SOUND_BUTTON(mx,my) || SOUND_BUTTON(mx)!=choice) &&
645 choice>=0 && pressed)
648 DrawSoundDisplay(sound_state[choice] | BUTTON_RELEASED);
650 else if (ON_SOUND_BUTTON(mx,my) && SOUND_BUTTON(mx)==choice && !pressed)
653 DrawSoundDisplay(sound_state[choice] | BUTTON_PRESSED);
657 else /* Maustaste wieder losgelassen */
659 if (ON_SOUND_BUTTON(mx,my) && SOUND_BUTTON(mx)==choice && pressed)
661 DrawSoundDisplay(sound_state[choice] | BUTTON_RELEASED);
662 return_code = 1<<choice;
677 int CheckGameButtons(int mx, int my, int button)
680 static int choice = -1;
681 static boolean pressed = FALSE;
691 if (!motion_status) /* Maustaste neu gedrückt */
693 if (ON_GAME_BUTTON(mx,my))
695 choice = GAME_BUTTON(mx);
697 DrawGameButton(game_state[choice] | BUTTON_PRESSED);
700 else /* Mausbewegung bei gedrückter Maustaste */
702 if ((!ON_GAME_BUTTON(mx,my) || GAME_BUTTON(mx)!=choice) &&
703 choice>=0 && pressed)
706 DrawGameButton(game_state[choice] | BUTTON_RELEASED);
708 else if (ON_GAME_BUTTON(mx,my) && GAME_BUTTON(mx)==choice && !pressed)
711 DrawGameButton(game_state[choice] | BUTTON_PRESSED);
715 else /* Maustaste wieder losgelassen */
717 if (ON_GAME_BUTTON(mx,my) && GAME_BUTTON(mx)==choice && pressed)
719 DrawGameButton(game_state[choice] | BUTTON_RELEASED);
720 return_code = 1<<choice;
735 int CheckYesNoButtons(int mx, int my, int button)
738 static int choice = -1;
739 static boolean pressed = FALSE;
740 static int yesno_button[5] =
748 if (!motion_status) /* Maustaste neu gedrückt */
750 if (ON_YESNO_BUTTON(mx,my))
752 choice = YESNO_BUTTON(mx);
754 DrawYesNoButton(yesno_button[choice] | BUTTON_PRESSED, DB_NORMAL);
757 else /* Mausbewegung bei gedrückter Maustaste */
759 if ((!ON_YESNO_BUTTON(mx,my) || YESNO_BUTTON(mx)!=choice) &&
760 choice>=0 && pressed)
763 DrawYesNoButton(yesno_button[choice] | BUTTON_RELEASED, DB_NORMAL);
765 else if (ON_YESNO_BUTTON(mx,my) && YESNO_BUTTON(mx)==choice && !pressed)
768 DrawYesNoButton(yesno_button[choice] | BUTTON_PRESSED, DB_NORMAL);
772 else /* Maustaste wieder losgelassen */
774 if (ON_YESNO_BUTTON(mx,my) && YESNO_BUTTON(mx)==choice && pressed)
776 DrawYesNoButton(yesno_button[choice] | BUTTON_RELEASED, DB_NORMAL);
777 return_code = choice+1;
792 int CheckConfirmButton(int mx, int my, int button)
795 static int choice = -1;
796 static boolean pressed = FALSE;
800 if (!motion_status) /* Maustaste neu gedrückt */
802 if (ON_CONFIRM_BUTTON(mx,my))
806 DrawConfirmButton(BUTTON_PRESSED, DB_NORMAL);
809 else /* Mausbewegung bei gedrückter Maustaste */
811 if (!ON_CONFIRM_BUTTON(mx,my) && choice>=0 && pressed)
814 DrawConfirmButton(BUTTON_RELEASED, DB_NORMAL);
816 else if (ON_CONFIRM_BUTTON(mx,my) && !pressed)
819 DrawConfirmButton(BUTTON_PRESSED, DB_NORMAL);
823 else /* Maustaste wieder losgelassen */
825 if (ON_CONFIRM_BUTTON(mx,my) && pressed)
827 DrawConfirmButton(BUTTON_RELEASED, DB_NORMAL);
828 return_code = BUTTON_CONFIRM;
843 int CheckPlayerButtons(int mx, int my, int button)
846 static int choice = -1;
847 static boolean pressed = FALSE;
848 int player_state[4] =
858 if (!motion_status) /* Maustaste neu gedrückt */
860 if (ON_PLAYER_BUTTON(mx,my))
862 choice = PLAYER_BUTTON(mx,my);
864 DrawPlayerButton(player_state[choice] | BUTTON_PRESSED, DB_NORMAL);
867 else /* Mausbewegung bei gedrückter Maustaste */
869 if ((!ON_PLAYER_BUTTON(mx,my) || PLAYER_BUTTON(mx,my)!=choice) &&
870 choice>=0 && pressed)
873 DrawPlayerButton(player_state[choice] | BUTTON_RELEASED, DB_NORMAL);
875 else if (ON_PLAYER_BUTTON(mx,my) && PLAYER_BUTTON(mx,my)==choice && !pressed)
878 DrawPlayerButton(player_state[choice] | BUTTON_PRESSED, DB_NORMAL);
882 else /* Maustaste wieder losgelassen */
884 if (ON_PLAYER_BUTTON(mx,my) && PLAYER_BUTTON(mx,my)==choice && pressed)
886 DrawPlayerButton(player_state[choice] | BUTTON_RELEASED, DB_NORMAL);
887 return_code = player_state[choice];
902 /* several buttons in the level editor */
904 int CheckEditButtons(int mx, int my, int button)
907 static int choice = -1;
908 static boolean pressed = FALSE;
909 static int edit_button[6] =
921 if (!motion_status) /* Maustaste neu gedrückt */
923 if (ON_EDIT_BUTTON(mx,my))
925 choice = EDIT_BUTTON(mx,my);
927 DrawEditButton(edit_button[choice] | ED_BUTTON_PRESSED);
928 if (edit_button[choice]!=ED_BUTTON_CTRL &&
929 edit_button[choice]!=ED_BUTTON_FILL)
930 return_code = 1<<choice;
933 else /* Mausbewegung bei gedrückter Maustaste */
935 if ((!ON_EDIT_BUTTON(mx,my) || EDIT_BUTTON(mx,my)!=choice) &&
936 choice>=0 && pressed)
939 DrawEditButton(edit_button[choice] | ED_BUTTON_RELEASED);
941 else if (ON_EDIT_BUTTON(mx,my) && EDIT_BUTTON(mx,my)==choice)
944 DrawEditButton(edit_button[choice] | ED_BUTTON_PRESSED);
946 if (edit_button[choice]!=ED_BUTTON_CTRL &&
947 edit_button[choice]!=ED_BUTTON_FILL)
948 return_code = 1<<choice;
952 else /* Maustaste wieder losgelassen */
954 if (ON_EDIT_BUTTON(mx,my) && EDIT_BUTTON(mx,my)==choice && pressed)
956 DrawEditButton(edit_button[choice] | ED_BUTTON_RELEASED);
957 if (edit_button[choice]==ED_BUTTON_CTRL ||
958 edit_button[choice]==ED_BUTTON_FILL)
959 return_code = 1<<choice;
974 int CheckCtrlButtons(int mx, int my, int button)
977 static int choice = -1;
978 static boolean pressed = FALSE;
979 static int ctrl_button[4] =
989 if (!motion_status) /* Maustaste neu gedrückt */
991 if (ON_CTRL_BUTTON(mx,my))
993 choice = CTRL_BUTTON(mx,my);
995 DrawCtrlButton(ctrl_button[choice] | ED_BUTTON_PRESSED);
998 else /* Mausbewegung bei gedrückter Maustaste */
1000 if ((!ON_CTRL_BUTTON(mx,my) || CTRL_BUTTON(mx,my)!=choice) &&
1001 choice>=0 && pressed)
1004 DrawCtrlButton(ctrl_button[choice] | ED_BUTTON_RELEASED);
1006 else if (ON_CTRL_BUTTON(mx,my) && CTRL_BUTTON(mx,my)==choice && !pressed)
1009 DrawCtrlButton(ctrl_button[choice] | ED_BUTTON_PRESSED);
1013 else /* Maustaste wieder losgelassen */
1015 if (ON_CTRL_BUTTON(mx,my) && CTRL_BUTTON(mx,my)==choice && pressed)
1017 DrawCtrlButton(ctrl_button[choice] | ED_BUTTON_RELEASED);
1018 return_code = 1<<(choice+6);
1030 return(return_code);
1033 int CheckElemButtons(int mx, int my, int button)
1035 int return_code = -1;
1036 static int choice = -1;
1037 static boolean pressed = FALSE;
1041 if (!motion_status) /* Maustaste neu gedrückt */
1043 if (ON_ELEM_BUTTON(mx,my))
1045 choice = ELEM_BUTTON(mx,my);
1047 DrawElemButton(choice,ED_BUTTON_PRESSED);
1048 if (choice==ED_BUTTON_EUP ||
1049 choice==ED_BUTTON_EDOWN)
1050 return_code = choice;
1053 else /* Mausbewegung bei gedrückter Maustaste */
1055 if ((!ON_ELEM_BUTTON(mx,my) || ELEM_BUTTON(mx,my)!=choice) &&
1056 choice>=0 && pressed)
1059 DrawElemButton(choice,ED_BUTTON_RELEASED);
1061 else if (ON_ELEM_BUTTON(mx,my) && ELEM_BUTTON(mx,my)==choice)
1064 DrawElemButton(choice,ED_BUTTON_PRESSED);
1066 if (choice==ED_BUTTON_EUP ||
1067 choice==ED_BUTTON_EDOWN)
1068 return_code = choice;
1072 else /* Maustaste wieder losgelassen */
1074 if (ON_ELEM_BUTTON(mx,my) && ELEM_BUTTON(mx,my)==choice && pressed)
1076 DrawElemButton(choice,ED_BUTTON_RELEASED);
1077 if (choice!=ED_BUTTON_EUP &&
1078 choice!=ED_BUTTON_EDOWN)
1079 return_code = choice;
1091 return(return_code);
1094 int CheckCountButtons(int mx, int my, int button)
1096 int return_code = -1;
1097 static int choice = -1;
1098 static boolean pressed = FALSE;
1102 if (!motion_status) /* Maustaste neu gedrückt */
1104 if (ON_COUNT_BUTTON(mx,my))
1106 choice = COUNT_BUTTON(mx,my);
1108 DrawCountButton(choice,ED_BUTTON_PRESSED);
1109 return_code = choice;
1112 else /* Mausbewegung bei gedrückter Maustaste */
1114 if ((!ON_COUNT_BUTTON(mx,my) || COUNT_BUTTON(mx,my)!=choice) &&
1115 choice>=0 && pressed)
1118 DrawCountButton(choice,ED_BUTTON_RELEASED);
1120 else if (ON_COUNT_BUTTON(mx,my) && COUNT_BUTTON(mx,my)==choice)
1123 DrawCountButton(choice,ED_BUTTON_PRESSED);
1125 return_code = choice;
1129 else /* Maustaste wieder losgelassen */
1131 if (ON_COUNT_BUTTON(mx,my) && COUNT_BUTTON(mx,my)==choice && pressed)
1133 DrawCountButton(choice,ED_BUTTON_RELEASED);
1145 return(return_code);