switched to GPLv3 ONLY, because i don't trust FSF anymore
[knightmare.git] / data / mes / phases / gameover.mes
blob7c60832285898afcaa11dfc76e1ae2fd90e8e746
1 /* coded by Ketmar // Invisible Vector <ketmar@ketmar.no-ip.org>
2  * Understanding is not required. Only obedience.
3  *
4  * Based on the DOS Knightmare source code by Andrew Zabolotny
5  *
6  * This program is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, version 3 of the License ONLY.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 // ////////////////////////////////////////////////////////////////////////// //
19 // game over phase
20 int[] gStateGameOver_P = [0,75,76,77,78,0,79,80,78,81];
21 int[] gStateGameOver_Q = [5,14,15,14];
23 int gStateGameOver_GOverPos;
24 bool gStateGameOver_waitingMusicEnd;
27 void phaseGameOver_Enter () {
28   gStateGameOver_GOverPos = 0;
29   musicNew("gameover", false);
30   gStateGameOver_waitingMusicEnd = false;
34 void phaseGameOver_Leave () {
38 void phaseGameOver_Render () {
39   int j = gStateGameOver_GOverPos/5;
40   if (j > 9) j = 9;
41   for (int i = 0; i <= j; ++i) {
42     if (gStateGameOver_P[i] != 0) putSprite("spr16x16_", gStateGameOver_P[i], 72+i*16, 84);
43   }
44   if (gStateGameOver_GOverPos < 45) {
45     if (gStateGameOver_GOverPos%5 != 4) {
46       putSprite("spr16x16_", gStateGameOver_Q[gStateGameOver_GOverPos%5], 88+(gStateGameOver_GOverPos/5)*16, 84);
47     }
48   }
52 void phaseGameOver_Tick () {
53   //if LaughOff and PlayingSound then Exit;
54   //LaughOff:=Off;
56   drawMap(mapy);
57   drawEnemies();
58   drawStatus();
60   TimeStop = 40;
61   processEnemies();
62   FrameCount = FrameCount+1;
64   int j = gStateGameOver_GOverPos/5;
65   if (gStateGameOver_GOverPos < 45) {
66     if (gStateGameOver_GOverPos%5 == 4 && j != 4) Sound(2, 88+(gStateGameOver_GOverPos/5)*16);
67   }
69   ++gStateGameOver_GOverPos;
71   if (gStateGameOver_waitingMusicEnd) {
72     if (musicLoopCount > 0 || isAudioFucked) gotoPhase(GamePhase.Title);
73     return;
74   }
76   /*
77   if ((not Strig(1)) and (not Strig(2)) and (gStateGameOver_GOverPos<85)) or (gStateGameOver_GOverPos<47)
78    then ShowGameOver:=Off
79    else begin
80          ShowGameOver:=On;Silence:=False;LoopAgain:=False;Loop:=False;
81          if (MachineSpeed>=MinSpeed) and EnaSounds then
82              begin PlayModule(36);Silence:=True;end;
83          repeat until (Strig(1)) or (Strig(2)) or ((not PlayingSound) and Silence);
84          TimerDone;RunTitles;Silence:=False;
85         end;
86   */
90 void phaseGameOver_KeyEvent () {
91   if (!eventKeyPressed) return;
92   if (eventKeyKey == Key.Escape || eventKeyKey == Key.Space) { concmd("abort_game"); return; }