Add missing prototypes
[manicminer.git] / mm-game.c
blob42727fc0b4e43aa3410b0deda025c4f2740224df
1 ///////////////////////////////////////////////////////////////
2 // Game Stuff
3 ///////////////////////////////////////////////////////////////
4 void DoGame(void)
5 {
6 switch(GAMEm)
7 {
8 case 0://SETUP
9 GameSetup();
10 break;
11 case 1://PLAYING
12 PlayGame();
13 break;
14 case 2://DEATH
15 Killed();
16 break;
17 case 3://NEW LEVEL
18 LevelDone();
19 break;
20 case 4://GAME OVER
21 GameOver();
22 break;
23 case 5://LAST EXIT
24 LastExit();
25 break;
29 // if( KeyTable[key_f12]==1 )
30 // {
31 // GAMEm=5;
32 // LASTm=0;
33 // LASTc=0;
34 // LASTp=0;
35 // TEXTm=0;
36 // TEXTink=7;
37 // TEXTfade=0;
38 // }
41 ///////////////////////////////////////////////////////////////
42 // Game Fisrt Setup
43 ///////////////////////////////////////////////////////////////
44 void GameSetup(void)
46 int count;
48 for(count=0;count<768;count++)
50 PALwhite[count]=63;
51 PALblack[count]=0;
52 PALfade[count]=PALmain[count];
53 PALover[count]=PALmain[count];
56 if(TONKS==0)
57 LEVEL=0;
58 else
59 LEVEL=20;
61 SCORE=0;
62 LIVES=3;
64 LIVESf=0;
65 LIVESp=0;
67 EXTRA=10000;
68 EXTRAdelta=10000;
69 EXTRAm=0;
70 EXTRAc=0;
72 CopyLevelInfo();
73 DrawLevel();
74 SwapPage();
75 DrawLevel();
76 PaletteSet(PALmain);
78 GAMEm=1;
79 OVERm=0;
81 CHEATp=0;
82 CHEATh=0;
84 MUSICh=0;
86 PAUSE=0;
88 if(MUSICtype==0)
90 if((LEVEL==19)||(LEVEL==39))
91 modon=MIDASplayModuleSection(mod,0x16,0x1f,0x16,TRUE);
92 else
93 modon=MIDASplayModuleSection(mod,0x00,0x08,0x00,TRUE);
95 else
97 modon=MIDASplayModuleSection(mod,0x09,0x0c,0x00,TRUE);
99 MIDASsetMusicVolume(modon,VOL);
101 ///////////////////////////////////////////////////////////////
102 // Draw Level
103 ///////////////////////////////////////////////////////////////
104 void DrawLevel(void)
106 DrawCurrentLevel();
107 DrawConv();
108 DrawKeys();
109 DrawSwitches();
110 DrawExit();
111 DrawTPlate();
112 DrawAirBG();
113 DoWilly();
114 DoHRobo();
115 DoVRobo();
116 DoSpecialRobo();
117 DrawExit();
118 DrawAir();
120 FontPrint(0,18," ");
121 FontPrint(0,19," ");
122 FontPrint(0,20," ");
123 FontPrint(0,21," ");
124 FontPrint(0,22," ");
125 FontPrint(0,23," ");
127 PrintScore();
128 PrintHighScore();
129 DrawLives();
131 NEXTBIT=0;
133 ///////////////////////////////////////////////////////////////
134 // Play Game
135 ///////////////////////////////////////////////////////////////
136 void PlayGame(void)
138 int speed;
140 CheckPause();
141 CheckMusic();
143 MIDASsetMusicVolume(modon,VOL);
145 if(PAUSE==0)
147 SwapPage2();
148 NEXTBIT=FrCt+SPEED;
150 ExtraLife();
152 RemoveSun();
153 RemoveWilly();
154 RemoveSPG();
155 RemoveSky();
156 RemoveKong();
157 RemoveVRobo();
158 RemoveHRobo();
159 RemoveEugene();
161 DrawKeys();
162 DrawConv();
164 DrawSwitches();
165 DoCrumb();
166 DoWilly();
168 DoHRobo();
169 DoVRobo();
170 DoSpecialRobo();
172 DrawExit();
173 DrawAir();
174 DoSun();
176 DrawLives();
178 PrintScore();
182 else
184 WaitVR();
187 if(KeyTable[key_esc]==1)
189 MODE=0;
190 TITLEm=0;
191 GAMEm=0;
192 MIDASstopModule(modon);
193 modon=0;
196 if(CHEAT==1)
198 DoCheat();
200 else
202 CheckCheat();
206 ///////////////////////////////////////////////////////////////
207 // Willy Killed
208 ///////////////////////////////////////////////////////////////
209 void Killed(void)
211 int i;
213 WaitVR();
215 if(DEATHm==0)
217 DEATHc++;
218 if(DEATHc==8)
220 DEATHm=1;
221 LIVES--;
222 if(LIVES==0)
224 GAMEm=4;
228 else
230 for(i=0;i<8;i++)
231 PaletteFade(PALblack,PALfade);
233 PaletteSet(PALfade);
237 else
239 CopyLevelInfo();
240 DrawLevel();
241 SwapPage();
242 PaletteSet(PALmain);
243 DrawLevel();
245 GAMEm=1;
247 if(MUSICtype==0)
249 if((LEVEL==19)||(LEVEL==39))
250 modon=MIDASplayModuleSection(mod,0x16,0x1f,0x16,TRUE);
251 else
252 modon=MIDASplayModuleSection(mod,0x00,0x08,0x00,TRUE);
254 else
256 modon=MIDASplayModuleSection(mod,0x09,0x0c,0x00,TRUE);
258 MIDASsetMusicVolume(modon,VOL);
262 ///////////////////////////////////////////////////////////////
263 // Level Done
264 ///////////////////////////////////////////////////////////////
265 void LevelDone(void)
267 int i;
269 MIDASstopModule(modon);
270 modon=0;
272 cEXITm=0;
274 LevelDoneExtra();
275 SwapPage();
276 LevelDoneExtra();
278 for(i=0;i<8;i++)
280 PaletteSet(PALwhite);
281 WaitVR();
282 PaletteSet(PALmain);
283 WaitVR();
288 SwapPage();
289 MIDASplaySample(wav,6,255,6000+(cAIR*((old+1)*100)),64,MIDAS_PAN_MIDDLE);
290 MIDASplaySample(wav,7,255,4000+(cAIR*((old+1)*100)),64,MIDAS_PAN_MIDDLE);
291 DrawAir();
292 cAIR--;
293 SCORE+=9;
294 PrintScore();
296 while(cAIR>32);
298 LEVEL++;
299 if(LEVEL==20)
301 LEVEL=0;
304 if(LEVEL==40)
306 LEVEL=20;
309 WaitVR();
310 CopyLevelInfo();
311 DrawLevel();
312 SwapPage();
313 DrawLevel();
315 GAMEm=1;
317 if(MUSICtype==0)
319 if((LEVEL==19)||(LEVEL==39))
320 modon=MIDASplayModuleSection(mod,0x16,0x1f,0x16,TRUE);
321 else
322 modon=MIDASplayModuleSection(mod,0x00,0x08,0x00,TRUE);
324 else
326 modon=MIDASplayModuleSection(mod,0x09,0x0c,0x00,TRUE);
328 MIDASsetMusicVolume(modon,VOL);
331 ///////////////////////////////////////////////////////////////
332 // Redraw Stuff for Double Buffer
333 ///////////////////////////////////////////////////////////////
334 void LevelDoneExtra(void)
336 int i,count;
337 BYTE temp;
339 RemoveWilly();
340 RemoveSPG();
341 RemoveSky();
342 RemoveKong();
343 RemoveVRobo();
344 RemoveHRobo();
345 RemoveEugene();
346 RemoveSun();
348 if(cCONVy!=0)
351 for(count=0;count<cCONVl;count++)
353 DrawConvBlock(cCONVx+(count*8),cCONVy,cCONVgfx,cCONVf);
357 for(i=0;i<4;i++)
359 if(cHROBOx[i]!=65535)
361 if( cHROBOd[i] )
363 DrawHRobo((cHROBOx[i]&248),cHROBOy[i],(cHROBOgfx[i]+((cHROBOx[i]&cHROBOanim[i])>>1))+cHROBOflip[i],cHROBOink[i]);
365 else
367 DrawHRobo((cHROBOx[i]&248),cHROBOy[i],cHROBOgfx[i]+((cHROBOx[i]&cHROBOanim[i])>>1),cHROBOink[i]);
373 for(i=0;i<4;i++)
375 if(cVROBOx[i]!=65535)
377 DrawVROBO((cVROBOx[i]&248),cVROBOy[i],cVROBOgfx[i]+((cVROBOx[i]&cVROBOanim[i])>>1),cVROBOink[i]);
382 if(LEVEL==4)
384 DrawEUGENE(EUGENEx,EUGENEy,EUGENEc);
387 if((LEVEL==7)||(LEVEL==11))
389 DrawKong(KONGx,KONGy,KONGf,KONGc);
392 if(LEVEL==13)
394 for(i=0;i<3;i++)
396 DrawSky(SKYx[i],SKYy[i],SKYf[i],SKYc[i]);
400 if(LEVEL==18)
402 for(i=0;i<64;i++)
404 if(SPGx[old][i]!=65535)
406 DrawSPGBlock(SPGx[old][i],SPGy[old][i]);
411 for(i=0;i<5;i++)
413 if(cKEYs[i]==1)
415 if((cKEYx[i]!=65535)&&(cKEYy[i]!=65535))
417 DrawKeyBlock(cKEYx[i],cKEYy[i],cKEYgfx,bright2[cKEYb[i]]);
423 PutWilly();
424 DrawExit();
425 DoSun();
427 temp=MUSICon;
428 MUSICon=0;
429 DrawLives();
430 MUSICon=temp;
432 ///////////////////////////////////////////////////////////////
433 // Game Over
434 ///////////////////////////////////////////////////////////////
435 void GameOver(void)
437 switch(OVERm)
439 case 0:
440 OverSetup();
441 break;
442 case 1:
443 DoBoot();
444 break;
445 case 2:
446 DoOverText();
447 break;
451 ///////////////////////////////////////////////////////////////
452 // Draw Game Over Screen
453 ///////////////////////////////////////////////////////////////
454 void OverSetup(void)
456 int i,x,y;
458 BOOTy=0;
460 cls(0);
462 PAPER=254;
463 for(i=0;i<16;i++)
464 FontPrint(0,i," ");
466 DrawWilly2();
468 DrawOver(120,112,0);
469 DrawOver(120,BOOTy,1);
471 DrawTPlate();
472 DrawAirBG();
474 PrintScore();
475 PrintHighScore();
477 SwapPage();
479 cls(0);
481 PAPER=254;
482 for(i=0;i<16;i++)
483 FontPrint(0,i," ");
485 DrawWilly2();
487 DrawOver(120,112,0);
488 DrawOver(120,BOOTy,1);
490 DrawTPlate();
491 DrawAirBG();
493 PrintScore();
494 PrintHighScore();
496 OVERm=1;
497 OVERp=0;
499 PAPER=0;
501 ///////////////////////////////////////////////////////////////
502 // Draw GAME OVER Gfx
503 ///////////////////////////////////////////////////////////////
504 void DrawOver(int xpos,int ypos,BYTE block)
506 int x,y,block2;
507 BYTE data;
509 block2=(WORD)block;
510 block2*=256;
512 for(y=0;y<16;y++)
514 for(x=0;x<16;x++)
516 data=GFXover[block2];
518 if(data)
520 PlotPixel(xpos+x,ypos+y,data);
522 else
524 PlotPixel(xpos+x,ypos+y,254);
526 block2++;
530 ///////////////////////////////////////////////////////////////
531 // Do Boot
532 ///////////////////////////////////////////////////////////////
533 void DoBoot(void)
535 int i;
537 DrawOver(120,BOOTy,1);
539 MIDASplaySample(wav,6,255,4000+((BOOTy*BOOTy)*(old+1)),64,MIDAS_PAN_MIDDLE);
541 BOOTy++;
542 if(BOOTy>96)
544 OVERm=2;
545 OVERink=1;
547 for(i=0;i<48;i++)
549 PALover[720+i]=0;
553 RotPal();
555 SwapPage();
556 PaletteSet(PALover);
558 if(BOOTy>96)
559 DrawOver(120,96,1);
563 ///////////////////////////////////////////////////////////////
564 // Rotate end of palette
565 ///////////////////////////////////////////////////////////////
566 void RotPal(void)
568 BYTE temp1,temp2,temp3;
569 int i;
571 temp1=PALover[720];
572 temp2=PALover[721];
573 temp3=PALover[722];
575 for(i=0;i<42;i++)
577 PALover[720+i]=PALover[723+i];
580 PALover[762]=temp1;
581 PALover[763]=temp2;
582 PALover[764]=temp3;
584 ///////////////////////////////////////////////////////////////
585 // Draw Willy
586 ///////////////////////////////////////////////////////////////
587 void DrawWilly2(void)
589 int x,y,block2;
590 BYTE data;
592 block2=2;
593 block2*=256;
595 for(y=0;y<16;y++)
597 for(x=0;x<16;x++)
599 data=GFXwilly[block2];
601 if(data)
603 PlotPixel(120+x,96+y,data);
605 else
607 PlotPixel(120+x,96+y,254);
610 block2++;
614 ///////////////////////////////////////////////////////////////
615 // Do Over Text
616 ///////////////////////////////////////////////////////////////
617 void DoOverText(void)
619 GameText1();
620 SwapPage();
622 OVERp++;
623 if(OVERp>200)
625 MODE=0;
626 TITLEm=0;
627 DEMOm=0;
628 GAMEm=0;
629 OVERm=0;
631 if(SCORE>HISCORE)
633 HISCORE=SCORE;
639 ///////////////////////////////////////////////////////////////
640 // Game Over Text
641 ///////////////////////////////////////////////////////////////
642 void GameText1(void)
645 INK=OVERink;
646 FontPrint(10,6,"G");
647 OVERink++;
648 OVERink&=7;
649 INK=OVERink;
650 FontPrint(11,6,"a");
651 OVERink++;
652 OVERink&=7;
653 INK=OVERink;
654 FontPrint(12,6,"m");
655 OVERink++;
656 OVERink&=7;
657 INK=OVERink;
658 FontPrint(13,6,"e");
660 OVERink++;
661 OVERink&=7;
662 INK=OVERink;
663 FontPrint(18,6,"O");
664 OVERink++;
665 OVERink&=7;
666 INK=OVERink;
667 FontPrint(19,6,"v");
668 OVERink++;
669 OVERink&=7;
670 INK=OVERink;
671 FontPrint(20,6,"e");
672 OVERink++;
673 OVERink&=7;
674 INK=OVERink;
675 FontPrint(21,6,"r");
678 ///////////////////////////////////////////////////////////////
679 // Draw Lives
680 ///////////////////////////////////////////////////////////////
681 void DrawLives(void)
683 int i;
684 BYTE l;
686 l=LIVES;
687 if(l>8)
688 l=8;
690 for(i=0;i<(l-1);i++)
692 DrawWilly3(i*16,168,LIVESf);
695 if(CHEAT==1)
696 DrawBoot(i*16,168);
699 if(MUSICon==1)
701 LIVESp++;
702 if(LIVESp>3)
704 LIVESp=0;
706 LIVESf++;
707 LIVESf&=3;
712 ///////////////////////////////////////////////////////////////
713 // Draw Willy
714 ///////////////////////////////////////////////////////////////
715 void DrawWilly3(int xpos,int ypos,BYTE block)
717 int x,y,block2;
718 BYTE data;
720 block2=(WORD)block;
721 block2*=256;
723 for(y=0;y<16;y++)
725 for(x=0;x<16;x++)
727 data=GFXwilly[block2];
729 if(data)
731 PlotPixel(xpos+x,ypos+y,data);
733 else
735 PlotPixel(xpos+x,ypos+y,0);
737 block2++;
741 ///////////////////////////////////////////////////////////////
742 // Draw GAME OVER Gfx
743 ///////////////////////////////////////////////////////////////
744 void DrawBoot(int xpos,int ypos)
746 int x,y,block2;
747 BYTE data;
749 block2=1;
750 block2*=256;
752 for(y=0;y<16;y++)
754 for(x=0;x<16;x++)
756 data=GFXover[block2];
758 if(data)
760 PlotPixel(xpos+x,ypos+y,data);
763 block2++;
767 ///////////////////////////////////////////////////////////////
768 // Print Score
769 ///////////////////////////////////////////////////////////////
770 void PrintScore(void)
772 INK=6;
773 PAPER=0;
774 FontPrint(20,19,"Score");
775 ShowSix(26,19,SCORE);
777 if(SCORE>EXTRA)
779 LIVES++;
780 EXTRA+=EXTRAdelta;
782 EXTRAc=0;
783 EXTRAm=1;
789 ///////////////////////////////////////////////////////////////
790 // Print High Score
791 ///////////////////////////////////////////////////////////////
792 void PrintHighScore(void)
794 INK=6;
795 PAPER=0;
796 FontPrint(0,19,"High Score");
797 ShowSix(11,19,HISCORE);
800 ///////////////////////////////////////////////////////////////
801 // Do Extra Life Gained
802 ///////////////////////////////////////////////////////////////
803 void ExtraLife(void)
805 switch(EXTRAm)
807 case 1:
808 DoExtra1();
809 break;
810 case 2:
811 DoExtra2();
812 break;
815 ///////////////////////////////////////////////////////////////
816 // Do Extra Life
817 ///////////////////////////////////////////////////////////////
818 void DoExtra1(void)
820 RotPal2();
821 PaletteSet(PALfade);
823 EXTRAc++;
824 if(EXTRAc==13)
826 EXTRAc=0;
827 EXTRAm=2;
830 ///////////////////////////////////////////////////////////////
831 // Do Extra Life
832 ///////////////////////////////////////////////////////////////
833 void DoExtra2(void)
835 int count;
837 for(count=0;count<768;count++)
839 PALfade[count]=PALmain[count];
842 EXTRAc=0;
843 EXTRAm=0;
844 PaletteSet(PALmain);
846 ///////////////////////////////////////////////////////////////
847 // Rotate end of palette
848 ///////////////////////////////////////////////////////////////
849 void RotPal2(void)
851 BYTE temp[(16*3)];
852 int i;
854 for(i=0;i<(16*3);i++)
856 temp[i]=PALfade[(16*3)+i];
859 for(i=0;i<672;i++)
861 PALfade[(16*3)+i]=PALfade[(32*3)+i];
864 for(i=0;i<(16*3);i++)
866 PALfade[672+i]=temp[i];
870 ///////////////////////////////////////////////////////////////
871 // Do Sun
872 ///////////////////////////////////////////////////////////////
873 void DoSun(void)
875 if(SUNm==1)
876 DrawSun();
878 ///////////////////////////////////////////////////////////////
879 // Draw Sun
880 ///////////////////////////////////////////////////////////////
881 void DrawSun(void)
883 WORD block;
884 int x,y;
885 BYTE data;
887 for(y=0;y<SUNh;y++)
889 for(x=0;x<24;x++)
892 SUNbuff[old][(y*24)+x]=GetPixel(60+x,SUNy+y);
894 data=GFXsun[(y*24)+x];
895 if(data!=0)
896 PlotPixel(60+x,SUNy+y,data);
900 SUNyold[old]=SUNy;
901 SUNhold[old]=SUNh;
904 ///////////////////////////////////////////////////////////////
905 // Remove Sun
906 ///////////////////////////////////////////////////////////////
907 void RemoveSun(void)
909 WORD block;
910 int x,y;
911 BYTE data;
913 if(SUNyold[old]!=65535)
915 for(y=0;y<SUNhold[old];y++)
917 for(x=0;x<24;x++)
919 data=SUNbuff[old][(y*24)+x];
920 PlotPixel(60+x,SUNyold[old]+y,data);
926 ///////////////////////////////////////////////////////////////
927 // Do Cheat Stuff
928 ///////////////////////////////////////////////////////////////
929 void DoCheat(void)
931 BYTE lev;
933 lev=0;
935 if( KeyTable[key_1]==1 )
936 lev|=1;
938 if( KeyTable[key_2]==1 )
939 lev|=2;
941 if( KeyTable[key_3]==1 )
942 lev|=4;
944 if( KeyTable[key_4]==1 )
945 lev|=8;
947 if( KeyTable[key_5]==1 )
948 lev|=16;
950 if(lev>19)
951 lev=0;
953 if(TONKS==1)
954 lev+=20;
956 if( KeyTable[key_6]==1 )
958 MIDASstopModule(modon);
959 modon=0;
961 LEVEL=lev;
962 ChangeLevelCheat();
968 ///////////////////////////////////////////////////////////////
969 // Change Level for Cheat
970 ///////////////////////////////////////////////////////////////
971 void ChangeLevelCheat(void)
973 WaitVR();
974 CopyLevelInfo();
975 DrawLevel();
976 SwapPage();
977 DrawLevel();
979 if(MUSICtype==0)
981 if((LEVEL==19)||(LEVEL==39))
982 modon=MIDASplayModuleSection(mod,0x16,0x1f,0x16,TRUE);
983 else
984 modon=MIDASplayModuleSection(mod,0x00,0x08,0x00,TRUE);
986 else
988 modon=MIDASplayModuleSection(mod,0x09,0x0c,0x00,TRUE);
990 MIDASsetMusicVolume(modon,VOL);
993 ///////////////////////////////////////////////////////////////
994 // Check for Cheat
995 ///////////////////////////////////////////////////////////////
996 void CheckCheat(void)
998 if(CHEATh==1)
1000 if(KeyTable[CHEATkey[CHEATp]]!=1)
1002 CHEATp++;
1003 if(CHEATp==6)
1004 CHEAT=1;
1005 CHEATh=0;
1009 if(KeyTable[CHEATkey[CHEATp]]==1)
1011 CHEATh=1;
1013 else
1015 if(AnyKeyx()==1)
1016 CHEATp=0;
1020 ///////////////////////////////////////////////////////////////
1021 // Check for MUSIC
1022 ///////////////////////////////////////////////////////////////
1023 void CheckMusic(void)
1025 if( (KeyTable[key_h]==1)||
1026 (KeyTable[key_j]==1)||
1027 (KeyTable[key_k]==1)||
1028 (KeyTable[key_l]==1))
1030 MUSICon++;
1031 MUSICon&=1;
1033 if(MUSICon==0)
1034 VOL=0;
1035 else
1036 VOL=64;
1041 ///////////////////////////////////////////////////////////////
1042 // Check for Pause
1043 ///////////////////////////////////////////////////////////////
1044 void CheckPause(void)
1046 if(PAUSE==0)
1048 if( (KeyTable[key_a]==1)||
1049 (KeyTable[key_s]==1)||
1050 (KeyTable[key_d]==1)||
1051 (KeyTable[key_f]==1)||
1052 (KeyTable[key_g]==1))
1054 PAUSE=1;
1057 else
1059 if( ((KeyTable[key_a]==0)&&
1060 (KeyTable[key_s]==0)&&
1061 (KeyTable[key_d]==0)&&
1062 (KeyTable[key_f]==0)&&
1063 (KeyTable[key_g]==0))&&(AnyKeyx()==1))
1065 PAUSE=0;
1070 ///////////////////////////////////////////////////////////////
1071 // Last Exit
1072 ///////////////////////////////////////////////////////////////
1073 void LastExit(void)
1075 switch(LASTm)
1077 case 0:
1078 LastFirst();
1079 break;
1080 case 1:
1081 LastFade();
1082 break;
1083 case 2:
1084 LastClear();
1085 break;
1086 case 3:
1087 LastBit();
1088 break;
1091 ///////////////////////////////////////////////////////////////
1092 // Last Air
1093 ///////////////////////////////////////////////////////////////
1094 void LastFirst(void)
1096 int i;
1098 MIDASstopModule(modon);
1099 modon=0;
1101 LevelDoneExtra();
1102 SwapPage();
1103 LevelDoneExtra();
1104 SwapPage();
1106 for(i=0;i<8;i++)
1108 PaletteSet(PALwhite);
1109 WaitVR();
1110 PaletteSet(PALmain);
1111 WaitVR();
1116 SwapPage();
1117 MIDASplaySample(wav,6,255,6000+(cAIR*((old+1)*100)),64,MIDAS_PAN_MIDDLE);
1118 MIDASplaySample(wav,7,255,4000+(cAIR*((old+1)*100)),64,MIDAS_PAN_MIDDLE);
1119 DrawAir();
1120 cAIR--;
1121 SCORE+=9;
1122 PrintScore();
1124 while(cAIR>32);
1126 if(SCORE>HISCORE)
1128 HISCORE=SCORE;
1132 modon=MIDASplayModuleSection(mod,0x20,0x3b,0x20,TRUE);
1133 LASTm=1;
1134 LASTp=0;
1136 ///////////////////////////////////////////////////////////////
1137 // Fade Down Game
1138 ///////////////////////////////////////////////////////////////
1139 void LastFade(void)
1142 LASTp++;
1143 if(LASTp==4)
1145 LASTp=0;
1147 PaletteFade(PALblack,PALfade);
1149 LASTc++;
1150 if(LASTc==4)
1152 LASTc=0;
1153 SUNy++;
1154 SUNh--;
1155 if(SUNh==0)
1156 LASTm=2;
1159 SwapPage();
1160 PaletteSet(PALfade);
1161 RemoveSun();
1162 DoSun();
1164 else
1166 SwapPage();
1167 RemoveSun();
1168 DoSun();
1169 DrawAir();
1170 PrintScore();
1173 ///////////////////////////////////////////////////////////////
1174 // Clear Last Screen
1175 ///////////////////////////////////////////////////////////////
1176 void LastClear(void)
1178 Cls(0);
1179 SwapPage();
1180 LASTc++;
1181 if(LASTc==2)
1183 LASTm=3;
1184 PaletteSet(PALmain);
1185 LASTc=0;
1186 LASTp=0;
1188 TEXTm=0;
1189 TEXTpause=0;
1190 TEXTpoint=0;
1191 TEXTink=0;
1192 TEXTfade=0;
1196 ///////////////////////////////////////////////////////////////
1197 // Draw House
1198 ///////////////////////////////////////////////////////////////
1199 void DrawHouse(void)
1201 int x,y,c;
1203 c=0;
1204 for(y=0;y<32;y++)
1206 for(x=0;x<32;x++)
1208 PlotPixel(176+x,y,GFXhouse[c]);
1209 c++;
1214 ///////////////////////////////////////////////////////////////
1215 // Draw Window
1216 ///////////////////////////////////////////////////////////////
1217 void DrawWindow(WORD block)
1219 int x,y;
1221 block*=256;
1223 for(y=0;y<16;y++)
1225 for(x=0;x<16;x++)
1227 PlotPixel(184+x,8+y,GFXwin[block]);
1228 block++;
1232 ///////////////////////////////////////////////////////////////
1233 // Do Last Bit
1234 ///////////////////////////////////////////////////////////////
1235 void LastBit(void)
1237 // MIDASplayStatus stat;
1238 // MIDASgetPlayStatus(modon,&stat);
1239 // ADM
1240 /* if(stat.pattern==14)
1242 MODE=0;
1243 TITLEm=0;
1244 GAMEm=0;
1245 MIDASstopModule(modon);
1246 modon=0;
1247 } */
1248 #ifdef USE_MIKMOD
1249 if(mod->sngpos==17)
1251 MODE=0;
1252 TITLEm=0;
1253 GAMEm=0;
1254 MIDASstopModule(modon);
1255 modon=0;
1257 #endif
1259 LASTp++;
1260 if(LASTp==6)
1262 LASTp=0;
1263 LASTc++;
1264 if(LASTc==16)
1265 LASTc=0;
1268 DrawHouse();
1269 DrawWindow(WINDOW[LASTc]);
1270 DoText();
1271 SwapPage();
1274 ///////////////////////////////////////////////////////////////
1275 // Do End Text
1276 ///////////////////////////////////////////////////////////////
1277 void DoText(void)
1279 switch(TEXTm)
1281 case 0:
1282 FadeUpText();
1283 break;
1284 case 1:
1285 PauseText();
1286 break;
1287 case 2:
1288 FadeDownText();
1289 break;
1293 ///////////////////////////////////////////////////////////////
1294 // Fade Up Text
1295 ///////////////////////////////////////////////////////////////
1296 void FadeUpText(void)
1298 TEXTink++;
1299 if(TEXTink>=63)
1301 TEXTpause=0;
1302 if(TEXTpoint<84)
1303 TEXTm=1;
1304 else
1305 TEXTink=63;
1307 INK=(127-(TEXTink>>2));
1309 FontPrint(0,11,EndText[TEXTpoint]);
1310 FontPrint(0,12,EndText[TEXTpoint+1]);
1311 FontPrint(0,13,EndText[TEXTpoint+2]);
1314 ///////////////////////////////////////////////////////////////
1315 // Fade Down Text
1316 ///////////////////////////////////////////////////////////////
1317 void FadeDownText(void)
1319 TEXTink--;
1320 if(TEXTink==0)
1322 TEXTm=0;
1323 TEXTpoint+=3;
1326 INK=(127-(TEXTink>>2));
1328 FontPrint(0,11,EndText[TEXTpoint]);
1329 FontPrint(0,12,EndText[TEXTpoint+1]);
1330 FontPrint(0,13,EndText[TEXTpoint+2]);
1332 ///////////////////////////////////////////////////////////////
1333 // Text Pause
1334 ///////////////////////////////////////////////////////////////
1335 void PauseText(void)
1337 FontPrint(0,11,EndText[TEXTpoint]);
1338 FontPrint(0,12,EndText[TEXTpoint+1]);
1339 FontPrint(0,13,EndText[TEXTpoint+2]);
1341 TEXTpause++;
1342 if(TEXTpause==EndPause[TEXTpoint])
1344 TEXTpause=0;
1345 TEXTm=2;