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 ***********************************************************/
34 DrawText(SX+16, SY+8, "ROCKS'N'DIAMONDS",FS_BIG,FC_YELLOW);
35 DrawText(SX+25+16, SY+46, "Copyright ^1995 by Holger Schemel",
37 DrawText(SX+32, SY+64, "Name:",FS_BIG,FC_GREEN);
38 DrawText(SX+192,SY+64, player.alias_name,FS_BIG,FC_RED);
39 DrawText(SX+32, SY+96, "Level:",FS_BIG,FC_GREEN);
40 DrawText(SX+352,SY+96, int2str(level_nr,3),FS_BIG,
41 (level_nr<leveldir[leveldir_nr].num_ready ? FC_RED : FC_YELLOW));
42 DrawText(SX+32, SY+128,"Hall Of Fame",FS_BIG,FC_GREEN);
43 DrawText(SX+32, SY+160,"Level Creator",FS_BIG,FC_GREEN);
44 DrawText(SY+32, SY+192,"Info Screen",FS_BIG,FC_GREEN);
45 DrawText(SX+32, SY+224,"Start Game",FS_BIG,FC_GREEN);
46 DrawText(SX+32, SY+256,"Setup",FS_BIG,FC_GREEN);
47 DrawText(SX+32, SY+288,"Quit",FS_BIG,FC_GREEN);
49 DrawMicroLevel(MICROLEV_XPOS,MICROLEV_YPOS);
52 DrawGraphic(0,i,GFX_KUGEL_BLAU);
53 DrawGraphic(10,3,GFX_KUGEL_BLAU);
54 DrawGraphic(14,3,GFX_KUGEL_BLAU);
56 DrawText(SX+54+16,SY+326,"A Game by Artsoft Development",FS_SMALL,FC_BLUE);
57 DrawText(SX+40+16,SY+344,"Graphics: Deluxe Paint IV Amiga",
59 DrawText(SX+60+16,SY+362,"Sounds: AudioMaster IV Amiga",
64 HandleMainMenu(0,0,0,0,MB_MENU_MARK);
67 if (TAPE_IS_EMPTY(tape))
68 LoadLevelTape(level_nr);
69 DrawCompleteVideoDisplay();
71 OpenDoor(DOOR_CLOSE_1 | DOOR_OPEN_2);
73 XAutoRepeatOn(display);
76 void HandleMainMenu(int mx, int my, int dx, int dy, int button)
78 static int choice = 3;
79 static int redraw = TRUE;
80 int x = (mx+32-SX)/32, y = (my+32-SY)/32;
84 DrawGraphic(0,choice-1,GFX_KUGEL_ROT);
109 if (!mx && !my && !dx && !dy)
115 if (y==4 && ((x==11 && level_nr>0) ||
116 (x==15 && level_nr<LEVELDIR_SIZE(leveldir[leveldir_nr]))) &&
119 static long level_delay = 0;
120 int step = (button==1 ? 1 : button==2 ? 5 : 10);
122 if (!DelayReached(&level_delay,20))
125 level_nr += (x==11 ? -step : +step);
128 if (level_nr>LEVELDIR_SIZE(leveldir[leveldir_nr])-1)
129 level_nr = LEVELDIR_SIZE(leveldir[leveldir_nr])-1;
131 if (level_nr>player.handicap && level_nr<leveldir[leveldir_nr].num_ready)
133 if (x==11 || leveldir[leveldir_nr].num_free==0)
134 level_nr = player.handicap;
136 level_nr = leveldir[leveldir_nr].num_ready;
139 DrawTextExt(drawto,gc,SX+352,SY+96, int2str(level_nr,3),FS_BIG,
140 (level_nr<leveldir[leveldir_nr].num_ready ?FC_RED :FC_YELLOW));
141 DrawTextExt(window,gc,SX+352,SY+96, int2str(level_nr,3),FS_BIG,
142 (level_nr<leveldir[leveldir_nr].num_ready ?FC_RED :FC_YELLOW));
145 DrawMicroLevel(MICROLEV_XPOS,MICROLEV_YPOS);
148 LoadLevelTape(level_nr);
149 DrawCompleteVideoDisplay();
151 else if (x==1 && y>=3 && y<=10)
157 DrawGraphic(0,y-1,GFX_KUGEL_ROT);
158 DrawGraphic(0,choice-1,GFX_KUGEL_BLAU);
166 game_status = TYPENAME;
167 HandleTypeName(strlen(player.alias_name),0);
173 game_status = CHOOSELEVEL;
180 game_status = HALLOFFAME;
186 game_status = LEVELED;
192 game_status = HELPSCREEN;
198 if (autorecord_on && !tape.playing)
201 game_status = PLAYING;
213 if (AreYouSure("Do you really want to quit ?",AYS_ASK|AYS_STAY_CLOSED))
214 game_status = EXITGAME;
222 if (game_status==MAINMENU)
226 #define MAX_HELPSCREEN_ELS 10
230 static long helpscreen_state;
231 static int helpscreen_step[MAX_HELPSCREEN_ELS];
232 static int helpscreen_frame[MAX_HELPSCREEN_ELS];
233 static int helpscreen_delay[MAX_HELPSCREEN_ELS];
234 static int helpscreen_action[] =
236 GFX_ERDREICH,1,100, HA_NEXT,
237 GFX_LEERRAUM,1,100, HA_NEXT,
238 GFX_MORAST_LEER,1,100, HA_NEXT,
239 GFX_BETON,1,100, HA_NEXT,
240 GFX_MAUERWERK,1,100, HA_NEXT,
241 GFX_FELSBODEN,1,100, HA_NEXT,
242 GFX_EDELSTEIN,2,5, HA_NEXT,
243 GFX_DIAMANT,2,5, HA_NEXT,
244 GFX_FELSBROCKEN,4,5, HA_NEXT,
245 GFX_BOMBE,1,50, GFX_EXPLOSION,8,1, GFX_LEERRAUM,1,10, HA_NEXT,
246 GFX_KOKOSNUSS,1,50, GFX_CRACKINGNUT,3,1, GFX_EDELSTEIN,1,10, HA_NEXT,
247 GFX_ERZ_EDEL,1,50, GFX_EXPLOSION,8,1, GFX_EDELSTEIN,1,10, HA_NEXT,
248 GFX_ERZ_DIAM,1,50, GFX_EXPLOSION,8,1, GFX_DIAMANT,1,10, HA_NEXT,
249 GFX_GEBLUBBER,4,4, HA_NEXT,
250 GFX_SCHLUESSEL1,4,33, HA_NEXT,
251 GFX_PFORTE1,4,33, HA_NEXT,
252 GFX_PFORTE1X,4,33, HA_NEXT,
253 GFX_DYNAMIT_AUS,1,100, HA_NEXT,
254 GFX_DYNAMIT,7,6, GFX_EXPLOSION,8,1, GFX_LEERRAUM,1,10, HA_NEXT,
255 GFX_FLIEGER+4,1,3, GFX_FLIEGER+0,1,3, GFX_FLIEGER+4,1,3,
256 GFX_FLIEGER+5,1,3, GFX_FLIEGER+1,1,3, GFX_FLIEGER+5,1,3,
257 GFX_FLIEGER+6,1,3, GFX_FLIEGER+2,1,3, GFX_FLIEGER+6,1,3,
258 GFX_FLIEGER+7,1,3, GFX_FLIEGER+3,1,3, GFX_FLIEGER+7,1,3, HA_NEXT,
259 GFX_KAEFER+4,1,1, GFX_KAEFER+0,1,1, GFX_KAEFER+4,1,1,
260 GFX_KAEFER+5,1,1, GFX_KAEFER+1,1,1, GFX_KAEFER+5,1,1,
261 GFX_KAEFER+6,1,1, GFX_KAEFER+2,1,1, GFX_KAEFER+6,1,1,
262 GFX_KAEFER+7,1,1, GFX_KAEFER+3,1,1, GFX_KAEFER+7,1,1, HA_NEXT,
263 GFX_PACMAN+0,1,3, GFX_PACMAN+4,1,2, GFX_PACMAN+0,1,3,
264 GFX_PACMAN+1,1,3, GFX_PACMAN+5,1,2, GFX_PACMAN+1,1,3,
265 GFX_PACMAN+2,1,3, GFX_PACMAN+6,1,2, GFX_PACMAN+2,1,3,
266 GFX_PACMAN+3,1,3, GFX_PACMAN+7,1,2, GFX_PACMAN+3,1,3, HA_NEXT,
267 GFX_MAMPFER+0,4,0, GFX_MAMPFER+3,1,0, GFX_MAMPFER+2,1,0,
268 GFX_MAMPFER+1,1,0, HA_NEXT,
269 GFX_ZOMBIE+0,4,0, GFX_ZOMBIE+3,1,0, GFX_ZOMBIE+2,1,0,
270 GFX_ZOMBIE+1,1,0, HA_NEXT,
271 GFX_ABLENK,4,1, HA_NEXT,
272 GFX_AMOEBE_LEBT,4,40, HA_NEXT,
273 GFX_AMOEBE_TOT+2,2,50, GFX_AMOEBE_TOT,2,50, HA_NEXT,
274 GFX_SIEB_LEER,4,2, HA_NEXT,
277 static char *helpscreen_eltext[][2] =
279 "Normal sand:", "You can dig through it",
280 "Empty field:", "You can walk through it",
281 "Quicksand: You cannot pass it,", "but rocks can fall though it",
282 "Massive Wall:", "Nothing can go through it",
283 "Normal Wall: You can't go through", "it, but you can bomb it away",
284 "Old Wall: Like normal wall, but", "some things can fall down from it",
285 "Emerald: You must collect enough of", "them to finish a level",
286 "Diamond: Counts as 3 emeralds;", "Can be destroyed by rocks",
287 "Rock: Smashes several things;", "Can be moved by the player",
288 "Bomb: You can move it, but be", "careful when dropping it",
289 "Nut: Throw a rock on it to open it;", "Each nut contains an emerald",
290 "Wall with an Emerald inside:", "Bomb the wall away to get it",
291 "Wall with a Diamond inside:", "Bomb the wall away to get it",
292 "Acid: Destroys everything that", "falls or walks into it",
293 "Key: Opens the door that has the", "same color (red/yellow/green/blue)",
294 "Door: Can be opened by the key", "with the same color",
295 "Door: You have to find out the", "right color of the key for it",
296 "Dynamite: Collect it and use it to", "destroy walls or kill enemies",
297 "Dynamite: This one explodes after", "a few seconds",
298 "Spaceship: Moves at the left side", "of walls; don't touch it!",
299 "Bug: Moves at the right side of", "walls; don't touch it!",
300 "Pacman: Eats the amoeba and you,", "if you're not careful",
301 "Cruncher: Eats diamonds and you,", "if you're not careful",
302 "Robot: Tries to kill the player", "",
303 "Magic Wheel: Touch it to get rid of", "the robots for some seconds",
304 "Living Amoeba: Grows through empty", "fields, sand and quicksand",
305 "Dead Amoeba: Does not grow, but", "can still kill bugs and spaceships",
306 "Magic Wall: Changes rocks, emeralds", "and diamonds when they pass it",
308 static int num_helpscreen_els = sizeof(helpscreen_eltext)/(2*sizeof(char *));
310 static char *helpscreen_music[][3] =
312 "Alchemy", "Ian Boddy", "Drive",
313 "The Chase", "Propaganda", "A Secret Wish",
314 "Network 23", "Tangerine Dream", "Exit",
315 "Czardasz", "Robert Pieculewicz", "Czardasz",
316 "21st Century Common Man", "Tangerine Dream", "Tyger",
317 "Voyager", "The Alan Parsons Project","Pyramid",
318 "Twilight Painter", "Tangerine Dream", "Heartbreakers"
320 static int helpscreen_musicpos;
322 void DrawHelpScreenElAction(int start)
325 int frame, delay, graphic;
326 int xstart = SX+16, ystart = SY+64+2*32, ystep = TILEY+4;
328 while(helpscreen_action[j] != HA_END)
330 if (i>=start+MAX_HELPSCREEN_ELS || i>=num_helpscreen_els)
332 else if (i<start || helpscreen_delay[i-start])
334 if (i>=start && helpscreen_delay[i-start])
335 helpscreen_delay[i-start]--;
337 while(helpscreen_action[j] != HA_NEXT)
344 j += 3*helpscreen_step[i-start];
345 graphic = helpscreen_action[j++];
347 if (helpscreen_frame[i-start])
349 frame = helpscreen_action[j++] - helpscreen_frame[i-start];
350 helpscreen_frame[i-start]--;
355 helpscreen_frame[i-start] = helpscreen_action[j++]-1;
358 delay = helpscreen_action[j++];
359 helpscreen_delay[i-start] = delay;
361 if (helpscreen_action[j] == HA_NEXT)
363 if (!helpscreen_frame[i-start])
364 helpscreen_step[i-start] = 0;
368 if (!helpscreen_frame[i-start])
369 helpscreen_step[i-start]++;
370 while(helpscreen_action[j] != HA_NEXT)
375 DrawGraphicExtHiRes(drawto,gc,xstart,ystart+(i-start)*ystep,
382 redraw[0][i] = redraw[1][i] = TRUE;
383 redraw_mask |= REDRAW_TILES;
386 void DrawHelpScreenElText(int start)
389 int xstart = SX+56, ystart = SY+65+2*32, ystep = TILEY+4;
390 char text[FULL_SXSIZE/FONT2_XSIZE+10];
393 DrawText(SX+16, SY+8, "ROCKS'N'DIAMONDS",FS_BIG,FC_YELLOW);
394 DrawText(SX+25+16, SY+46, "Copyright ^1995 by Holger Schemel",
397 sprintf(text,"The game elements:");
398 DrawText(SX+(SXSIZE-strlen(text)*FONT2_XSIZE)/2,SY+100,
399 text,FS_SMALL,FC_GREEN);
401 for(i=start;i<start+MAX_HELPSCREEN_ELS && i<num_helpscreen_els;i++)
403 DrawText(xstart,ystart+(i-start)*ystep+(*helpscreen_eltext[i][1] ? 0 : 8),
404 helpscreen_eltext[i][0],FS_SMALL,FC_YELLOW);
405 DrawText(xstart,ystart+(i-start)*ystep+16,
406 helpscreen_eltext[i][1],FS_SMALL,FC_YELLOW);
409 sprintf(text,"Press any key or button for next page");
410 DrawText(SX+(SXSIZE-strlen(text)*FONT2_XSIZE)/2,SY+SYSIZE-20,
411 text,FS_SMALL,FC_BLUE);
414 void DrawHelpScreenMusicText(int num)
416 int ystart = 150, ystep = 30;
417 char text[FULL_SXSIZE/FONT2_XSIZE+10];
421 DrawText(SX+16, SY+8, "ROCKS'N'DIAMONDS",FS_BIG,FC_YELLOW);
422 DrawText(SX+25+16, SY+46, "Copyright ^1995 by Holger Schemel",
425 sprintf(text,"The game background music loops:");
426 DrawText(SX+(SXSIZE-strlen(text)*FONT2_XSIZE)/2,SY+100,
427 text,FS_SMALL,FC_GREEN);
429 sprintf(text,"Excerpt from");
430 DrawText(SX+(SXSIZE-strlen(text)*FONT2_XSIZE)/2,SY+ystart+0*ystep,
431 text,FS_SMALL,FC_YELLOW);
432 sprintf(text,"%c%s%c",'\"',helpscreen_music[num][0],'\"');
433 DrawText(SX+(SXSIZE-strlen(text)*FONT2_XSIZE)/2,SY+ystart+1*ystep,
434 text,FS_SMALL,FC_RED);
436 DrawText(SX+(SXSIZE-strlen(text)*FONT2_XSIZE)/2,SY+ystart+2*ystep,
437 text,FS_SMALL,FC_YELLOW);
438 sprintf(text,"%s",helpscreen_music[num][1]);
439 DrawText(SX+(SXSIZE-strlen(text)*FONT2_XSIZE)/2,SY+ystart+3*ystep,
440 text,FS_SMALL,FC_RED);
441 sprintf(text,"from the album");
442 DrawText(SX+(SXSIZE-strlen(text)*FONT2_XSIZE)/2,SY+ystart+4*ystep,
443 text,FS_SMALL,FC_YELLOW);
444 sprintf(text,"%c%s%c",'\"',helpscreen_music[num][2],'\"');
445 DrawText(SX+(SXSIZE-strlen(text)*FONT2_XSIZE)/2,SY+ystart+5*ystep,
446 text,FS_SMALL,FC_RED);
448 sprintf(text,"Press any key or button for next page");
449 DrawText(SX+(SXSIZE-strlen(text)*FONT2_XSIZE)/2,SY+SYSIZE-20,
450 text,FS_SMALL,FC_BLUE);
452 PlaySoundLoop(background_loop[num]);
455 void DrawHelpScreenCreditsText()
457 int ystart = 150, ystep = 30;
458 char text[FULL_SXSIZE/FONT2_XSIZE+10];
462 DrawText(SX+16, SY+8, "ROCKS'N'DIAMONDS",FS_BIG,FC_YELLOW);
463 DrawText(SX+25+16, SY+46, "Copyright ^1995 by Holger Schemel",
466 sprintf(text,"Program information:");
467 DrawText(SX+(SXSIZE-strlen(text)*FONT2_XSIZE)/2,SY+100,
468 text,FS_SMALL,FC_GREEN);
470 sprintf(text,"This game is Freeware!");
471 DrawText(SX+(SXSIZE-strlen(text)*FONT2_XSIZE)/2,SY+ystart+0*ystep,
472 text,FS_SMALL,FC_YELLOW);
473 sprintf(text,"If you like it, send e-mail to:");
474 DrawText(SX+(SXSIZE-strlen(text)*FONT2_XSIZE)/2,SY+ystart+1*ystep,
475 text,FS_SMALL,FC_YELLOW);
476 sprintf(text,"aeglos@valinor.owl.de");
477 DrawText(SX+(SXSIZE-strlen(text)*FONT2_XSIZE)/2,SY+ystart+2*ystep,
478 text,FS_SMALL,FC_RED);
479 sprintf(text,"or SnailMail to:");
480 DrawText(SX+(SXSIZE-strlen(text)*FONT2_XSIZE)/2,SY+ystart+3*ystep,
481 text,FS_SMALL,FC_YELLOW);
482 sprintf(text,"Holger Schemel");
483 DrawText(SX+(SXSIZE-strlen(text)*FONT2_XSIZE)/2,SY+ystart+4*ystep,
484 text,FS_SMALL,FC_RED);
485 sprintf(text,"Sennehof 28");
486 DrawText(SX+(SXSIZE-strlen(text)*FONT2_XSIZE)/2,SY+ystart+4*ystep+20,
487 text,FS_SMALL,FC_RED);
488 sprintf(text,"33659 Bielefeld");
489 DrawText(SX+(SXSIZE-strlen(text)*FONT2_XSIZE)/2,SY+ystart+4*ystep+40,
490 text,FS_SMALL,FC_RED);
491 sprintf(text,"Germany");
492 DrawText(SX+(SXSIZE-strlen(text)*FONT2_XSIZE)/2,SY+ystart+4*ystep+60,
493 text,FS_SMALL,FC_RED);
495 sprintf(text,"Press any key or button for main menu");
496 DrawText(SX+(SXSIZE-strlen(text)*FONT2_XSIZE)/2,SY+SYSIZE-20,
497 text,FS_SMALL,FC_BLUE);
500 void DrawHelpScreen()
504 CloseDoor(DOOR_CLOSE_2);
506 for(i=0;i<MAX_HELPSCREEN_ELS;i++)
507 helpscreen_step[i] = helpscreen_frame[i] = helpscreen_delay[i] = 0;
508 helpscreen_musicpos = 0;
509 helpscreen_state = 0;
510 DrawHelpScreenElText(0);
511 DrawHelpScreenElAction(0);
515 PlaySoundLoop(SND_RHYTHMLOOP);
518 void HandleHelpScreen(int button)
520 static long hs_delay = 0;
521 int num_helpscreen_els_pages =
522 (num_helpscreen_els + MAX_HELPSCREEN_ELS-1) / MAX_HELPSCREEN_ELS;
523 int button_released = !button;
528 if (helpscreen_state<num_helpscreen_els_pages-1)
530 for(i=0;i<MAX_HELPSCREEN_ELS;i++)
531 helpscreen_step[i] = helpscreen_frame[i] = helpscreen_delay[i] = 0;
533 DrawHelpScreenElText(helpscreen_state*MAX_HELPSCREEN_ELS);
534 DrawHelpScreenElAction(helpscreen_state*MAX_HELPSCREEN_ELS);
536 else if (helpscreen_state<num_helpscreen_els_pages+num_bg_loops-1)
539 DrawHelpScreenMusicText(helpscreen_state-num_helpscreen_els_pages);
541 else if (helpscreen_state==num_helpscreen_els_pages+num_bg_loops-1)
544 DrawHelpScreenCreditsText();
550 game_status = MAINMENU;
555 if (DelayReached(&hs_delay,3))
557 if (helpscreen_state<num_helpscreen_els_pages)
558 DrawHelpScreenElAction(helpscreen_state*MAX_HELPSCREEN_ELS);
568 int old_handicap = player.handicap;
570 if (!strcmp(player.alias_name,"Artsoft"))
571 player.handicap = MAX(0,leveldir[leveldir_nr].num_ready-1);
573 if (player.handicap != old_handicap)
575 SavePlayerInfo(PLAYER_LEVEL);
576 level_nr = player.handicap;
580 void HandleTypeName(int newxpos, KeySym key)
582 static int xpos = 0, ypos = 2;
588 DrawText(SX+6*32,SY+ypos*32,player.alias_name,FS_BIG,FC_YELLOW);
589 DrawGraphic(xpos+6,ypos,GFX_KUGEL_ROT);
593 if ((key>=XK_A && key<=XK_Z) || (key>=XK_a && key<=XK_z &&
596 if (key>=XK_A && key<=XK_Z)
597 ascii = 'A'+(char)(key-XK_A);
598 if (key>=XK_a && key<=XK_z)
599 ascii = 'a'+(char)(key-XK_a);
600 player.alias_name[xpos] = ascii;
601 player.alias_name[xpos+1] = 0;
603 DrawTextExt(drawto,gc,SX+6*32,SY+ypos*32,
604 player.alias_name,FS_BIG,FC_YELLOW);
605 DrawTextExt(window,gc,SX+6*32,SY+ypos*32,
606 player.alias_name,FS_BIG,FC_YELLOW);
607 DrawGraphic(xpos+6,ypos,GFX_KUGEL_ROT);
609 else if (key==XK_Delete && xpos>0)
611 player.alias_name[xpos] = 0;
613 DrawGraphic(xpos+6,ypos,GFX_KUGEL_ROT);
614 DrawGraphic(xpos+7,ypos,GFX_LEERRAUM);
616 else if (key==XK_Return && xpos>0)
618 DrawText(SX+6*32,SY+ypos*32,player.alias_name,FS_BIG,FC_RED);
619 DrawGraphic(xpos+6,ypos,GFX_LEERRAUM);
620 SavePlayerInfo(PLAYER_SETUP);
623 game_status = MAINMENU;
629 void DrawChooseLevel()
633 CloseDoor(DOOR_CLOSE_2);
636 DrawText(SX,SY,"Level Directories",FS_BIG,FC_GREEN);
637 for(i=0;i<num_leveldirs;i++)
639 DrawText(SX+32,SY+(i+2)*32,leveldir[i].name,FS_BIG,FC_YELLOW);
640 DrawGraphic(0,i+2,GFX_KUGEL_BLAU);
645 HandleChooseLevel(0,0,0,0,MB_MENU_MARK);
648 void HandleChooseLevel(int mx, int my, int dx, int dy, int button)
650 static int choice = 3;
651 static int redraw = TRUE;
652 int x = (mx+32-SX)/32, y = (my+32-SY)/32;
656 DrawGraphic(0,choice-1,GFX_KUGEL_ROT);
672 else if (y>num_leveldirs+2)
676 if (!mx && !my && !dx && !dy)
682 if (x==1 && y>=3 && y<=num_leveldirs+2)
688 DrawGraphic(0,y-1,GFX_KUGEL_ROT);
689 DrawGraphic(0,choice-1,GFX_KUGEL_BLAU);
695 player.leveldir_nr = leveldir_nr = y-3;
696 LoadPlayerInfo(PLAYER_LEVEL);
697 SavePlayerInfo(PLAYER_SETUP);
700 game_status = MAINMENU;
707 if (game_status==CHOOSELEVEL)
711 void DrawHallOfFame(int pos)
716 CloseDoor(DOOR_CLOSE_2);
721 DrawText(SX+64,SY+10,"Hall Of Fame",FS_BIG,FC_YELLOW);
722 sprintf(txt,"HighScores of Level %d",level_nr);
723 DrawText(SX+256-strlen(txt)*7,SY+48,txt,FS_SMALL,FC_RED);
724 for(y=0;y<MAX_SCORE_ENTRIES;y++)
726 DrawText(SX,SY+64+y*32,".................",FS_BIG,
727 (y==pos ? FC_RED : FC_GREEN));
728 DrawText(SX,SY+64+y*32,highscore[y].Name,FS_BIG,
729 (y==pos ? FC_RED : FC_GREEN));
730 DrawText(SX+12*32,SY+64+y*32,
731 int2str(highscore[y].Score,5),FS_BIG,
732 (y==pos ? FC_RED : FC_GREEN));
737 PlaySound(SND_HALLOFFAME);
740 void HandleHallOfFame(int button)
742 int button_released = !button;
746 FadeSound(SND_HALLOFFAME);
747 game_status = MAINMENU;
755 void DrawSetupScreen()
759 CloseDoor(DOOR_CLOSE_2);
762 DrawText(SX+16, SY+16, "SETUP",FS_BIG,FC_YELLOW);
763 DrawText(SX+32, SY+2*32,"Sound:",FS_BIG,FC_GREEN);
764 DrawText(SX+32, SY+3*32,"Sound loops:",FS_BIG,FC_GREEN);
765 DrawText(SX+32, SY+4*32,"Game music:",FS_BIG,FC_GREEN);
766 DrawText(SX+32, SY+5*32,"Toons:",FS_BIG,FC_GREEN);
767 DrawText(SX+32, SY+6*32,"Buffered gfx:",FS_BIG,FC_GREEN);
768 DrawText(SX+32, SY+7*32,"Fading:",FS_BIG,FC_GREEN);
769 DrawText(SX+32, SY+8*32,"Quick Doors:",FS_BIG,FC_GREEN);
770 DrawText(SX+32, SY+9*32,"Auto-Record:",FS_BIG,FC_GREEN);
771 DrawText(SX+32, SY+10*32,"Joystick:",FS_BIG,FC_GREEN);
772 DrawText(SX+32, SY+11*32,"Cal. Joystick",FS_BIG,FC_GREEN);
774 DrawText(SX+32, SY+13*32,"Exit",FS_BIG,FC_GREEN);
775 DrawText(SX+32, SY+14*32,"Save and exit",FS_BIG,FC_GREEN);
777 if (SETUP_SOUND_ON(player.setup))
778 DrawText(SX+14*32, SY+2*32,"on",FS_BIG,FC_YELLOW);
780 DrawText(SX+14*32, SY+2*32,"off",FS_BIG,FC_BLUE);
782 if (SETUP_SOUND_LOOPS_ON(player.setup))
783 DrawText(SX+14*32, SY+3*32,"on",FS_BIG,FC_YELLOW);
785 DrawText(SX+14*32, SY+3*32,"off",FS_BIG,FC_BLUE);
787 if (SETUP_SOUND_MUSIC_ON(player.setup))
788 DrawText(SX+14*32, SY+4*32,"on",FS_BIG,FC_YELLOW);
790 DrawText(SX+14*32, SY+4*32,"off",FS_BIG,FC_BLUE);
792 if (SETUP_TOONS_ON(player.setup))
793 DrawText(SX+14*32, SY+5*32,"on",FS_BIG,FC_YELLOW);
795 DrawText(SX+14*32, SY+5*32,"off",FS_BIG,FC_BLUE);
797 if (!SETUP_DIRECT_DRAW_ON(player.setup))
798 DrawText(SX+14*32, SY+6*32,"on",FS_BIG,FC_YELLOW);
800 DrawText(SX+14*32, SY+6*32,"off",FS_BIG,FC_BLUE);
802 if (SETUP_FADING_ON(player.setup))
803 DrawText(SX+14*32, SY+7*32,"on",FS_BIG,FC_YELLOW);
805 DrawText(SX+14*32, SY+7*32,"off",FS_BIG,FC_BLUE);
807 if (SETUP_QUICK_DOORS_ON(player.setup))
808 DrawText(SX+14*32, SY+8*32,"on",FS_BIG,FC_YELLOW);
810 DrawText(SX+14*32, SY+8*32,"off",FS_BIG,FC_BLUE);
812 if (SETUP_RECORD_EACH_GAME_ON(player.setup))
813 DrawText(SX+14*32, SY+9*32,"on",FS_BIG,FC_YELLOW);
815 DrawText(SX+14*32, SY+9*32,"off",FS_BIG,FC_BLUE);
817 if (SETUP_2ND_JOYSTICK_ON(player.setup))
818 DrawText(SX+14*32, SY+10*32,"2nd",FS_BIG,FC_YELLOW);
820 DrawText(SX+14*32, SY+10*32,"1st",FS_BIG,FC_YELLOW);
824 DrawGraphic(0,i,GFX_KUGEL_BLAU);
828 HandleSetupScreen(0,0,0,0,MB_MENU_MARK);
831 void HandleSetupScreen(int mx, int my, int dx, int dy, int button)
833 static int choice = 3;
834 static int redraw = TRUE;
835 int x = (mx+32-SX)/32, y = (my+32-SY)/32;
839 DrawGraphic(0,choice-1,GFX_KUGEL_ROT);
854 y = (dy>0 ? 14 : 12);
862 if (!mx && !my && !dx && !dy)
868 if (x==1 && y>=3 && y<=15 && y!=13)
874 DrawGraphic(0,y-1,GFX_KUGEL_ROT);
875 DrawGraphic(0,choice-1,GFX_KUGEL_BLAU);
883 if (y==3 && sound_status==SOUND_AVAILABLE)
885 if (SETUP_SOUND_ON(player.setup))
886 DrawText(SX+14*32, SY+yy*32,"off",FS_BIG,FC_BLUE);
888 DrawText(SX+14*32, SY+yy*32,"on ",FS_BIG,FC_YELLOW);
889 player.setup ^= SETUP_SOUND;
891 else if (y==4 && sound_loops_allowed)
893 if (SETUP_SOUND_LOOPS_ON(player.setup))
894 DrawText(SX+14*32, SY+yy*32,"off",FS_BIG,FC_BLUE);
896 DrawText(SX+14*32, SY+yy*32,"on ",FS_BIG,FC_YELLOW);
897 player.setup ^= SETUP_SOUND_LOOPS;
899 else if (y==5 && sound_loops_allowed)
901 if (SETUP_SOUND_MUSIC_ON(player.setup))
902 DrawText(SX+14*32, SY+yy*32,"off",FS_BIG,FC_BLUE);
904 DrawText(SX+14*32, SY+yy*32,"on ",FS_BIG,FC_YELLOW);
905 player.setup ^= SETUP_SOUND_MUSIC;
909 if (SETUP_TOONS_ON(player.setup))
910 DrawText(SX+14*32, SY+yy*32,"off",FS_BIG,FC_BLUE);
912 DrawText(SX+14*32, SY+yy*32,"on ",FS_BIG,FC_YELLOW);
913 player.setup ^= SETUP_TOONS;
917 if (!SETUP_DIRECT_DRAW_ON(player.setup))
918 DrawText(SX+14*32, SY+yy*32,"off",FS_BIG,FC_BLUE);
920 DrawText(SX+14*32, SY+yy*32,"on ",FS_BIG,FC_YELLOW);
921 player.setup ^= SETUP_DIRECT_DRAW;
925 if (SETUP_FADING_ON(player.setup))
926 DrawText(SX+14*32, SY+yy*32,"off",FS_BIG,FC_BLUE);
928 DrawText(SX+14*32, SY+yy*32,"on ",FS_BIG,FC_YELLOW);
929 player.setup ^= SETUP_FADING;
933 if (SETUP_QUICK_DOORS_ON(player.setup))
934 DrawText(SX+14*32, SY+yy*32,"off",FS_BIG,FC_BLUE);
936 DrawText(SX+14*32, SY+yy*32,"on ",FS_BIG,FC_YELLOW);
937 player.setup ^= SETUP_QUICK_DOORS;
941 if (SETUP_RECORD_EACH_GAME_ON(player.setup))
942 DrawText(SX+14*32, SY+yy*32,"off",FS_BIG,FC_BLUE);
944 DrawText(SX+14*32, SY+yy*32,"on ",FS_BIG,FC_YELLOW);
945 player.setup ^= SETUP_RECORD_EACH_GAME;
949 if (SETUP_2ND_JOYSTICK_ON(player.setup))
950 DrawText(SX+14*32, SY+yy*32,"1st",FS_BIG,FC_YELLOW);
952 DrawText(SX+14*32, SY+yy*32,"2nd",FS_BIG,FC_YELLOW);
953 player.setup ^= SETUP_2ND_JOYSTICK;
960 else if (y==14 || y==15)
964 SavePlayerInfo(PLAYER_SETUP);
968 game_status = MAINMENU;
976 if (game_status==SETUP)
980 void CalibrateJoystick()
983 struct joystick joy_ctrl;
985 struct joystick_control
993 int new_joystick_xleft, new_joystick_xright, new_joystick_xmiddle;
994 int new_joystick_yupper, new_joystick_ylower, new_joystick_ymiddle;
996 if (joystick_status==JOYSTICK_OFF)
1000 DrawText(SX+16, SY+7*32, "MOVE JOYSTICK TO",FS_BIG,FC_YELLOW);
1001 DrawText(SX+16, SY+8*32, " THE UPPER LEFT ",FS_BIG,FC_YELLOW);
1002 DrawText(SX+16, SY+9*32, "AND PRESS BUTTON",FS_BIG,FC_YELLOW);
1006 joy_ctrl.b1 = joy_ctrl.b2 = 0;
1008 joy_ctrl.buttons = 0;
1010 while(Joystick() & JOY_BUTTON);
1012 while(!(joy_ctrl.b1||joy_ctrl.b2))
1014 while(!joy_ctrl.buttons)
1017 if (read(joystick_device, &joy_ctrl, sizeof(joy_ctrl)) != sizeof(joy_ctrl))
1019 joystick_status=JOYSTICK_OFF;
1025 new_joystick_xleft = joy_ctrl.x;
1026 new_joystick_yupper = joy_ctrl.y;
1029 DrawText(SX+16, SY+7*32, "MOVE JOYSTICK TO",FS_BIG,FC_YELLOW);
1030 DrawText(SX+32, SY+8*32, "THE LOWER RIGHT",FS_BIG,FC_YELLOW);
1031 DrawText(SX+16, SY+9*32, "AND PRESS BUTTON",FS_BIG,FC_YELLOW);
1035 joy_ctrl.b1 = joy_ctrl.b2 = 0;
1037 joy_ctrl.buttons = 0;
1039 while(Joystick() & JOY_BUTTON);
1041 while(!(joy_ctrl.b1||joy_ctrl.b2))
1043 while(!joy_ctrl.buttons)
1046 if (read(joystick_device, &joy_ctrl, sizeof(joy_ctrl)) != sizeof(joy_ctrl))
1048 joystick_status=JOYSTICK_OFF;
1054 new_joystick_xright = joy_ctrl.x;
1055 new_joystick_ylower = joy_ctrl.y;
1058 DrawText(SX+32, SY+16+7*32, "CENTER JOYSTICK",FS_BIG,FC_YELLOW);
1059 DrawText(SX+16, SY+16+8*32, "AND PRESS BUTTON",FS_BIG,FC_YELLOW);
1063 joy_ctrl.b1 = joy_ctrl.b2 = 0;
1065 joy_ctrl.buttons = 0;
1067 while(Joystick() & JOY_BUTTON);
1069 while(!(joy_ctrl.b1||joy_ctrl.b2))
1071 while(!joy_ctrl.buttons)
1074 if (read(joystick_device, &joy_ctrl, sizeof(joy_ctrl)) != sizeof(joy_ctrl))
1076 joystick_status=JOYSTICK_OFF;
1082 new_joystick_xmiddle = joy_ctrl.x;
1083 new_joystick_ymiddle = joy_ctrl.y;
1085 joystick[joystick_nr].xleft = new_joystick_xleft;
1086 joystick[joystick_nr].yupper = new_joystick_yupper;
1087 joystick[joystick_nr].xright = new_joystick_xright;
1088 joystick[joystick_nr].ylower = new_joystick_ylower;
1089 joystick[joystick_nr].xmiddle = new_joystick_xmiddle;
1090 joystick[joystick_nr].ymiddle = new_joystick_ymiddle;
1092 CheckJoystickData();
1095 while(Joystick() & JOY_BUTTON);
1101 DrawText(SX+16, SY+16, "NO JOYSTICK",FS_BIG,FC_YELLOW);
1102 DrawText(SX+16, SY+48, " AVAILABLE ",FS_BIG,FC_YELLOW);
1107 void HandleVideoButtons(int mx, int my, int button)
1109 if (game_status!=MAINMENU && game_status!=PLAYING)
1112 switch(CheckVideoButtons(mx,my,button))
1114 case BUTTON_VIDEO_EJECT:
1116 if (!TAPE_IS_EMPTY(tape))
1117 SaveLevelTape(tape.level_nr);
1119 AreYouSure("Tape is empty !",AYS_CONFIRM);
1120 DrawCompleteVideoDisplay();
1122 case BUTTON_VIDEO_STOP:
1125 case BUTTON_VIDEO_PAUSE:
1128 case BUTTON_VIDEO_REC:
1131 else if (game_status==MAINMENU)
1132 TapeInitRecording();
1134 case BUTTON_VIDEO_PLAY:
1137 else if (game_status==MAINMENU)
1145 void HandleSoundButtons(int mx, int my, int button)
1147 if (game_status!=PLAYING)
1150 switch(CheckSoundButtons(mx,my,button))
1152 case BUTTON_SOUND_MUSIC:
1155 sound_music_on = FALSE;
1156 player.setup &= ~SETUP_SOUND_MUSIC;
1157 FadeSound(background_loop[level_nr % num_bg_loops]);
1158 DrawSoundDisplay(BUTTON_SOUND_MUSIC_OFF);
1160 else if (sound_loops_allowed)
1162 sound_music_on = TRUE;
1163 player.setup |= SETUP_SOUND_MUSIC;
1164 PlaySoundLoop(background_loop[level_nr % num_bg_loops]);
1165 DrawSoundDisplay(BUTTON_SOUND_MUSIC_ON);
1168 DrawSoundDisplay(BUTTON_SOUND_MUSIC_OFF);
1170 case BUTTON_SOUND_LOOPS:
1173 sound_loops_on = FALSE;
1174 player.setup &= ~SETUP_SOUND_LOOPS;
1175 DrawSoundDisplay(BUTTON_SOUND_LOOPS_OFF);
1177 else if (sound_loops_allowed)
1179 sound_loops_on = TRUE;
1180 player.setup |= SETUP_SOUND_LOOPS;
1181 DrawSoundDisplay(BUTTON_SOUND_LOOPS_ON);
1184 DrawSoundDisplay(BUTTON_SOUND_LOOPS_OFF);
1186 case BUTTON_SOUND_SOUND:
1190 player.setup &= ~SETUP_SOUND;
1191 DrawSoundDisplay(BUTTON_SOUND_SOUND_OFF);
1193 else if (sound_status==SOUND_AVAILABLE)
1196 player.setup |= SETUP_SOUND;
1197 DrawSoundDisplay(BUTTON_SOUND_SOUND_ON);
1200 DrawSoundDisplay(BUTTON_SOUND_SOUND_OFF);
1207 void HandleGameButtons(int mx, int my, int button)
1209 if (game_status!=PLAYING)
1212 switch(CheckGameButtons(mx,my,button))
1214 case BUTTON_GAME_STOP:
1215 if (AreYouSure("Do you really want to quit the game ?",
1216 AYS_ASK | AYS_STAY_CLOSED))
1218 game_status = MAINMENU;
1222 OpenDoor(DOOR_OPEN_1 | DOOR_COPY_BACK);
1224 case BUTTON_GAME_PAUSE:
1227 tape.pausing = FALSE;
1228 DrawVideoDisplay(VIDEO_STATE_PAUSE_OFF,0);
1232 tape.pausing = TRUE;
1233 DrawVideoDisplay(VIDEO_STATE_PAUSE_ON,0);
1236 case BUTTON_GAME_PLAY:
1239 tape.pausing = FALSE;
1240 DrawVideoDisplay(VIDEO_STATE_PAUSE_OFF,0);