0e349afbbdc61f35e582f3c00d6bf7bcaf147bae
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
133 //writeln('NEW PATH(0): ['+str+']');
135 begin
137 end
138 else
139 begin
143 begin
146 if (length(str) >= 2) and (Copy(str, length(str)-1, 2) = '/.') then begin Delete(str, length(str)-1, 2); continue; end;
147 break;
152 begin
157 begin
158 //writeln('<<<', ss, '>>> : [', str, ']');
162 //arr[High(arr)] := ExpandFileName(str);
164 //writeln('NEW PATH(1): ['+str+']');
168 begin
172 begin
173 //GetDir(0, GameDir);
177 for i := 1 to ParamCount do if (ParamStr(i) = '--cwd') then begin forceCurrentDir := true; break; end;
181 begin
184 begin
187 (* RW *)
195 (* RO *)
203 begin
206 (* RO *)
217 (* RO *)
223 (* RW *)
238 begin
241 begin
242 {$IFDEF HEADLESS}
244 {$ELSE}
246 {$ENDIF}
247 end
254 {$IFDEF ENABLE_HOLMES}
256 {$ENDIF}
258 begin
259 InitPath;
264 // e_InitLog(GameDir + '/' + LogFileName, TWriteMode.WM_NEWFILE);
269 TMsgType.Notify
270 );
273 TMsgType.Notify
274 );
281 {$IFDEF HEADLESS}
283 {$ENDIF}
286 e_InitInput;
288 sys_Init;
292 begin
294 end
295 else
296 begin
297 g_Options_SetDefault;
298 g_Options_SetDefaultVideo
303 g_Console_SysInit;
307 {$IF not DEFINED(HEADLESS) and DEFINED(ENABLE_HOLMES)}
310 begin
313 try
320 begin
323 //raise;
325 else
326 begin
328 //raise;
332 begin
333 try
337 begin
339 //raise;
342 else
343 begin
344 //raise;
352 begin
358 {$ENDIF}
360 //g_Res_CreateDatabases(true); // it will be done before connecting to the server for the first time
364 {$WARNINGS OFF}
366 {$WARNINGS ON}
368 {$IFDEF ENABLE_HOLMES}
370 {$ENDIF}
372 sys_Final;
376 var
378 begin
379 Randomize;
381 {$IFDEF HEADLESS}
382 {$IFDEF USE_SDLMIXER}
384 {$ELSE}
386 {$ENDIF}
387 {$ELSE}
389 {$ENDIF}
391 g_Touch_Init;
393 (*
394 if (e_JoysticksAvailable > 0) then
395 e_WriteLog('Input: Joysticks available.', TMsgType.Notify)
396 else
397 e_WriteLog('Input: No Joysticks.', TMsgType.Notify);
398 *)
401 begin
414 begin
422 begin
430 begin
436 begin
442 var
444 begin
447 begin
487 var
489 begin
494 result :=
499 {
500 if ct = I_GAME_CHEAT_JETPACK then
501 begin
502 e_WriteLog('ls1: ['+ls1+']', MSG_NOTIFY);
503 e_WriteLog('ls2: ['+ls2+']', MSG_NOTIFY);
504 e_WriteLog('bf0: ['+Copy(charbuff, 17-Length(ls1)-eofs, Length(ls1))+']', MSG_NOTIFY);
505 e_WriteLog('bf1: ['+Translit(Copy(charbuff, 17-Length(ls1)-eofs, Length(ls1)))+']', MSG_NOTIFY);
506 e_WriteLog('bf2: ['+Copy(charbuff, 17-Length(ls2)-eofs, Length(ls2))+']', MSG_NOTIFY);
507 e_WriteLog('bf3: ['+Translit(Copy(charbuff, 17-Length(ls2)-eofs, Length(ls2)))+']', MSG_NOTIFY);
508 end;
509 }
514 const
516 label
517 Cheated;
518 var
522 begin
523 {
524 if (not gGameOn) or (not gCheats) or ((gGameSettings.GameType <> GT_SINGLE) and
525 (gGameSettings.GameMode <> GM_COOP) and (not gDebugMode))
526 or g_Game_IsNet then Exit;
527 }
533 //
535 begin
540 // RAMBO
542 begin
547 // TANK
549 begin
554 // IDDQD
556 begin
562 //
564 begin
568 // GOODBYE
570 begin
574 begin
576 //g_Game_ExitLevel(gTriggers[a].Data.MapName);
578 Break;
582 //
584 if CheckCheat(I_GAME_CHEAT_CHANGEMAP, 2) and (s2[1] >= '0') and (s2[1] <= '9') and (s2[2] >= '0') and (s2[2] <= '9') then
585 begin
587 begin
593 //
595 begin
599 // BULLFROG
601 begin
605 // FORMULA1
607 begin
611 // CONDOM
613 begin
618 //
620 begin
625 // PURELOVE
627 begin
632 //
634 begin
639 // CASPER
641 begin
646 //
648 begin
653 // INFERNO
655 begin
661 begin
666 begin
670 Exit;
672 Cheated:
678 {$IFNDEF HEADLESS}
679 var
681 {$ENDIF}
682 begin
683 {$IFNDEF HEADLESS}
686 begin
688 begin
692 if (not g_Game_IsNet) and (g_ActiveWindow = nil) then g_Game_Pause(false); //Fn loves to do this
693 end
695 begin
697 begin
699 end
701 begin
703 begin
705 begin
707 g_Game_Free;
709 Exit;
721 begin
736 else
737 begin
740 begin
742 end
744 begin
748 end
750 begin
756 {$ENDIF}
761 var
764 begin
766 begin
768 end
770 begin
774 end
775 else
776 begin