1 (* Copyright (C) Doom 2D: Forever Developers
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, version 3 of the License ONLY.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program. If not, see <http://www.gnu.org/licenses/>.
14 *)
15 {$INCLUDE ../shared/a_modes.inc}
18 interface
28 var
36 implementation
38 uses
39 {$INCLUDE ../nogl/noGLuses.inc}
40 {$IFDEF ENABLE_HOLMES}
42 {$ENDIF}
43 {$IFDEF USE_SDL2}
44 SDL2,
45 {$ENDIF}
52 xparser;
55 var
59 var
61 {$IF not DEFINED(HEADLESS) and DEFINED(ENABLE_HOLMES)}
63 {$ENDIF}
64 begin
78 TMsgType.Notify
79 );
82 TMsgType.Notify
83 );
85 {$IFDEF HEADLESS}
87 {$ENDIF}
90 {$IFDEF USE_SDL2}
91 {$IFDEF HEADLESS}
92 {$IFDEF USE_SDLMIXER}
94 // HACK: shit this into env and hope for the best
96 {$ELSE}
98 {$ENDIF}
99 {$ELSE}
100 {$IFDEF USE_SDLMIXER}
101 {*sdlflags := SDL_INIT_EVERYTHING;*}
103 {$ELSE}
105 {$ENDIF}
106 {$ENDIF}
112 {$ENDIF}
115 e_InitInput;
119 g_Console_SysInit;
121 //GetSystemDefaultLCID()
123 //e_WriteLog('Read language file', MSG_NOTIFY);
124 //g_Language_Load(DataDir + gLanguage + '.txt');
128 {$IFNDEF USE_SDL2}
129 sys_Init;
130 {$ENDIF}
132 {$IF not DEFINED(HEADLESS) and DEFINED(ENABLE_HOLMES)}
135 begin
138 try
145 begin
148 //raise;
150 else
151 begin
153 //raise;
157 begin
158 try
162 begin
164 //raise;
167 else
168 begin
169 //raise;
175 {$ENDIF}
177 //g_Res_CreateDatabases(); // it will be done before connecting to the server for the first time
181 {$WARNINGS OFF}
183 {$WARNINGS ON}
185 {$IFDEF USE_SDL2}
188 {$ELSE}
189 sys_Final;
190 {$ENDIF}
194 var
196 begin
197 Randomize;
199 {$IFDEF HEADLESS}
200 {$IFDEF USE_SDLMIXER}
202 {$ELSE}
204 {$ENDIF}
205 {$ELSE}
207 {$ENDIF}
209 g_Touch_Init;
211 (*
212 if (e_JoysticksAvailable > 0) then
213 e_WriteLog('Input: Joysticks available.', TMsgType.Notify)
214 else
215 e_WriteLog('Input: No Joysticks.', TMsgType.Notify);
216 *)
219 begin
232 begin
240 begin
248 begin
254 begin
260 var
262 begin
265 begin
305 var
307 begin
312 result :=
317 {
318 if ct = I_GAME_CHEAT_JETPACK then
319 begin
320 e_WriteLog('ls1: ['+ls1+']', MSG_NOTIFY);
321 e_WriteLog('ls2: ['+ls2+']', MSG_NOTIFY);
322 e_WriteLog('bf0: ['+Copy(charbuff, 17-Length(ls1)-eofs, Length(ls1))+']', MSG_NOTIFY);
323 e_WriteLog('bf1: ['+Translit(Copy(charbuff, 17-Length(ls1)-eofs, Length(ls1)))+']', MSG_NOTIFY);
324 e_WriteLog('bf2: ['+Copy(charbuff, 17-Length(ls2)-eofs, Length(ls2))+']', MSG_NOTIFY);
325 e_WriteLog('bf3: ['+Translit(Copy(charbuff, 17-Length(ls2)-eofs, Length(ls2)))+']', MSG_NOTIFY);
326 end;
327 }
332 const
334 label
335 Cheated;
336 var
340 begin
341 {
342 if (not gGameOn) or (not gCheats) or ((gGameSettings.GameType <> GT_SINGLE) and
343 (gGameSettings.GameMode <> GM_COOP) and (not gDebugMode))
344 or g_Game_IsNet then Exit;
345 }
351 //
353 begin
358 // RAMBO
360 begin
365 // TANK
367 begin
372 // IDDQD
374 begin
380 //
382 begin
386 // GOODBYE
388 begin
392 begin
394 //g_Game_ExitLevel(gTriggers[a].Data.MapName);
396 Break;
400 //
402 if CheckCheat(I_GAME_CHEAT_CHANGEMAP, 2) and (s2[1] >= '0') and (s2[1] <= '9') and (s2[2] >= '0') and (s2[2] <= '9') then
403 begin
405 begin
411 //
413 begin
417 // BULLFROG
419 begin
423 // FORMULA1
425 begin
429 // CONDOM
431 begin
436 //
438 begin
443 // PURELOVE
445 begin
450 //
452 begin
457 // CASPER
459 begin
464 //
466 begin
471 // INFERNO
473 begin
479 begin
484 begin
488 Exit;
490 Cheated:
496 {$IFNDEF HEADLESS}
497 var
499 {$ENDIF}
500 begin
501 {$IFNDEF HEADLESS}
504 begin
506 begin
510 if (not g_Game_IsNet) and (g_ActiveWindow = nil) then g_Game_Pause(false); //Fn loves to do this
511 end
513 begin
515 begin
517 end
519 begin
521 begin
523 begin
525 g_Game_Free;
527 Exit;
539 begin
554 else
555 begin
558 begin
560 end
562 begin
566 end
568 begin
574 {$ENDIF}
579 var
582 begin
584 begin
586 end
588 begin
592 end
593 else
594 begin