]> 4ch.mooo.com Git - 16.git/blob - src/core/_demowl.c
added a simpler mmtest.c
[16.git] / src / core / _demowl.c
1 /*\r
2 =====================\r
3 =\r
4 = DemoLoop\r
5 =\r
6 =====================\r
7 */\r
8 \r
9 static  char *ParmStrings[] = {"baby","easy","normal","hard",""};\r
10 \r
11 void    DemoLoop (void)\r
12 {\r
13         static int LastDemo;\r
14         int     i,level;\r
15         long nsize;\r
16         memptr  nullblock;\r
17 \r
18 //\r
19 // check for launch from ted\r
20 //\r
21         if (tedlevel)\r
22         {\r
23                 NoWait = true;\r
24                 NewGame(1,0);\r
25 \r
26                 for (i = 1;i < _argc;i++)\r
27                 {\r
28                         if ( (level = US_CheckParm(_argv[i],ParmStrings)) != -1)\r
29                         {\r
30                          gamestate.difficulty=level;\r
31                          break;\r
32                         }\r
33                 }\r
34 \r
35 #ifndef SPEAR\r
36                 gamestate.episode = tedlevelnum/10;\r
37                 gamestate.mapon = tedlevelnum%10;\r
38 #else\r
39                 gamestate.episode = 0;\r
40                 gamestate.mapon = tedlevelnum;\r
41 #endif\r
42                 GameLoop();\r
43                 Quit (NULL);\r
44         }\r
45 \r
46 \r
47 //\r
48 // main game cycle\r
49 //\r
50 \r
51 \r
52 //      nsize = (long)40*1024;\r
53 //      MM_GetPtr(&nullblock,nsize);\r
54 \r
55 #ifndef DEMOTEST\r
56 \r
57         #ifndef UPLOAD\r
58 \r
59                 #ifndef GOODTIMES\r
60                 #ifndef SPEAR\r
61                 #ifndef JAPAN\r
62                 if (!NoWait)\r
63                         NonShareware();\r
64                 #endif\r
65                 #else\r
66 \r
67                         #ifndef GOODTIMES\r
68                         #ifndef SPEARDEMO\r
69                         CopyProtection();\r
70                         #endif\r
71                         #endif\r
72 \r
73                 #endif\r
74                 #endif\r
75         #endif\r
76 \r
77         StartCPMusic(INTROSONG);\r
78 \r
79 #ifndef JAPAN\r
80         if (!NoWait)\r
81                 PG13 ();\r
82 #endif\r
83 \r
84 #endif\r
85 \r
86         while (1)\r
87         {\r
88                 while (!NoWait)\r
89                 {\r
90 //\r
91 // title page\r
92 //\r
93                         MM_SortMem ();\r
94 #ifndef DEMOTEST\r
95 \r
96 #ifdef SPEAR\r
97                         CA_CacheGrChunk (TITLEPALETTE);\r
98 \r
99                         CA_CacheGrChunk (TITLE1PIC);\r
100                         VWB_DrawPic (0,0,TITLE1PIC);\r
101                         UNCACHEGRCHUNK (TITLE1PIC);\r
102 \r
103                         CA_CacheGrChunk (TITLE2PIC);\r
104                         VWB_DrawPic (0,80,TITLE2PIC);\r
105                         UNCACHEGRCHUNK (TITLE2PIC);\r
106                         VW_UpdateScreen ();\r
107                         VL_FadeIn(0,255,grsegs[TITLEPALETTE],30);\r
108 \r
109                         UNCACHEGRCHUNK (TITLEPALETTE);\r
110 #else\r
111                         CA_CacheScreen (TITLEPIC);\r
112                         VW_UpdateScreen ();\r
113                         VW_FadeIn();\r
114 #endif\r
115                         if (IN_UserInput(TickBase*15))\r
116                                 break;\r
117                         VW_FadeOut();\r
118 //\r
119 // credits page\r
120 //\r
121                         CA_CacheScreen (CREDITSPIC);\r
122                         VW_UpdateScreen();\r
123                         VW_FadeIn ();\r
124                         if (IN_UserInput(TickBase*10))\r
125                                 break;\r
126                         VW_FadeOut ();\r
127 //\r
128 // high scores\r
129 //\r
130                         DrawHighScores ();\r
131                         VW_UpdateScreen ();\r
132                         VW_FadeIn ();\r
133 \r
134                         if (IN_UserInput(TickBase*10))\r
135                                 break;\r
136 #endif\r
137 //\r
138 // demo\r
139 //\r
140 \r
141                         #ifndef SPEARDEMO\r
142                         PlayDemo (LastDemo++%4);\r
143                         #else\r
144                         PlayDemo (0);\r
145                         #endif\r
146 \r
147                         if (playstate == ex_abort)\r
148                                 break;\r
149                         StartCPMusic(INTROSONG);\r
150                 }\r
151 \r
152                 VW_FadeOut ();\r
153 \r
154 #ifndef SPEAR\r
155                 if (Keyboard[sc_Tab] && MS_CheckParm("goobers"))\r
156 #else\r
157                 if (Keyboard[sc_Tab] && MS_CheckParm("debugmode"))\r
158 #endif\r
159                         RecordDemo ();\r
160                 else\r
161                         US_ControlPanel (0);\r
162 \r
163                 if (startgame || loadedgame)\r
164                 {\r
165                         GameLoop ();\r
166                         VW_FadeOut();\r
167                         StartCPMusic(INTROSONG);\r
168                 }\r
169         }\r
170 }\r