9a4e345d0206945099bdecbdbdb02275177283d9
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
30 var
31 {--- TO REMOVE ---}
32 //GameDir: string;
33 {-----------------}
35 {--- Read-only dirs ---}
44 {--- Read-Write dirs ---}
54 implementation
56 uses
57 {$INCLUDE ../nogl/noGLuses.inc}
58 {$IFDEF ENABLE_HOLMES}
60 {$ENDIF}
61 {$IFDEF LINUX}
62 BaseUnix,
63 {$ENDIF}
70 xparser;
73 var
80 {$IFDEF LINUX}
81 var
82 //cd: AnsiString;
84 {$ENDIF}
85 begin
87 {$IFDEF LINUX}
88 // it may be a symlink; do some guesswork here
91 begin
92 // use current directory, as we don't have anything better
93 //result := '.';
96 {$ENDIF}
104 //first: Boolean = true;
107 {
108 var
109 f: TextFile;
110 begin
111 AssignFile(f, 'zzz.log');
112 if (first) then
113 begin
114 Rewrite(f);
115 first := false;
116 end
117 else
118 begin
119 Append(f);
120 end;
121 writeln(f, s);
122 CloseFile(f);
123 end;
124 }
125 begin
129 var
131 begin
134 begin
136 end
137 else
138 begin
142 begin
145 if (length(str) >= 2) and (Copy(str, length(str)-1, 2) = '/.') then begin Delete(str, length(str)-1, 2); continue; end;
146 break;
151 begin
156 begin
157 //writeln('<<<', ss, '>>> : [', str, ']');
161 //arr[High(arr)] := ExpandFileName(str);
167 begin
171 begin
172 //GetDir(0, GameDir);
176 for i := 1 to ParamCount do if (ParamStr(i) = '--cwd') then begin forceCurrentDir := true; break; end;
180 begin
183 begin
186 (* RW *)
194 (* RO *)
202 begin
205 (* RO *)
216 (* RO *)
222 (* RW *)
237 begin
240 begin
241 {$IFDEF HEADLESS}
243 {$ELSE}
245 {$ENDIF}
246 end
253 {$IFDEF ENABLE_HOLMES}
255 {$ENDIF}
257 begin
258 InitPath;
263 // e_InitLog(GameDir + '/' + LogFileName, TWriteMode.WM_NEWFILE);
268 TMsgType.Notify
269 );
272 TMsgType.Notify
273 );
280 {$IFDEF HEADLESS}
282 {$ENDIF}
285 e_InitInput;
287 sys_Init;
291 begin
293 end
294 else
295 begin
296 g_Options_SetDefault;
297 g_Options_SetDefaultVideo
302 g_Console_SysInit;
306 {$IF not DEFINED(HEADLESS) and DEFINED(ENABLE_HOLMES)}
309 begin
312 try
319 begin
322 //raise;
324 else
325 begin
327 //raise;
331 begin
332 try
336 begin
338 //raise;
341 else
342 begin
343 //raise;
351 begin
357 {$ENDIF}
359 //g_Res_CreateDatabases(true); // it will be done before connecting to the server for the first time
363 {$WARNINGS OFF}
365 {$WARNINGS ON}
367 {$IFDEF ENABLE_HOLMES}
369 {$ENDIF}
371 sys_Final;
375 var
377 begin
378 Randomize;
380 {$IFDEF HEADLESS}
381 {$IFDEF USE_SDLMIXER}
383 {$ELSE}
385 {$ENDIF}
386 {$ELSE}
388 {$ENDIF}
390 g_Touch_Init;
392 (*
393 if (e_JoysticksAvailable > 0) then
394 e_WriteLog('Input: Joysticks available.', TMsgType.Notify)
395 else
396 e_WriteLog('Input: No Joysticks.', TMsgType.Notify);
397 *)
400 begin
413 begin
421 begin
429 begin
435 begin
441 var
443 begin
446 begin
486 var
488 begin
493 result :=
498 {
499 if ct = I_GAME_CHEAT_JETPACK then
500 begin
501 e_WriteLog('ls1: ['+ls1+']', MSG_NOTIFY);
502 e_WriteLog('ls2: ['+ls2+']', MSG_NOTIFY);
503 e_WriteLog('bf0: ['+Copy(charbuff, 17-Length(ls1)-eofs, Length(ls1))+']', MSG_NOTIFY);
504 e_WriteLog('bf1: ['+Translit(Copy(charbuff, 17-Length(ls1)-eofs, Length(ls1)))+']', MSG_NOTIFY);
505 e_WriteLog('bf2: ['+Copy(charbuff, 17-Length(ls2)-eofs, Length(ls2))+']', MSG_NOTIFY);
506 e_WriteLog('bf3: ['+Translit(Copy(charbuff, 17-Length(ls2)-eofs, Length(ls2)))+']', MSG_NOTIFY);
507 end;
508 }
513 const
515 label
516 Cheated;
517 var
521 begin
522 {
523 if (not gGameOn) or (not gCheats) or ((gGameSettings.GameType <> GT_SINGLE) and
524 (gGameSettings.GameMode <> GM_COOP) and (not gDebugMode))
525 or g_Game_IsNet then Exit;
526 }
532 //
534 begin
539 // RAMBO
541 begin
546 // TANK
548 begin
553 // IDDQD
555 begin
561 //
563 begin
567 // GOODBYE
569 begin
573 begin
575 //g_Game_ExitLevel(gTriggers[a].Data.MapName);
577 Break;
581 //
583 if CheckCheat(I_GAME_CHEAT_CHANGEMAP, 2) and (s2[1] >= '0') and (s2[1] <= '9') and (s2[2] >= '0') and (s2[2] <= '9') then
584 begin
586 begin
592 //
594 begin
598 // BULLFROG
600 begin
604 // FORMULA1
606 begin
610 // CONDOM
612 begin
617 //
619 begin
624 // PURELOVE
626 begin
631 //
633 begin
638 // CASPER
640 begin
645 //
647 begin
652 // INFERNO
654 begin
660 begin
665 begin
669 Exit;
671 Cheated:
677 {$IFNDEF HEADLESS}
678 var
680 {$ENDIF}
681 begin
682 {$IFNDEF HEADLESS}
685 begin
687 begin
691 if (not g_Game_IsNet) and (g_ActiveWindow = nil) then g_Game_Pause(false); //Fn loves to do this
692 end
694 begin
696 begin
698 end
700 begin
702 begin
704 begin
706 g_Game_Free;
708 Exit;
720 begin
735 else
736 begin
739 begin
741 end
743 begin
747 end
749 begin
755 {$ENDIF}
760 var
763 begin
765 begin
767 end
769 begin
773 end
774 else
775 begin