-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmalfunction.lpr
93 lines (75 loc) · 3.04 KB
/
malfunction.lpr
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
{
Copyright 2002-2023 Michalis Kamburelis.
This file is part of "malfunction".
"malfunction" is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
"malfunction" is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with "malfunction"; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
----------------------------------------------------------------------------
}
program malfunction;
{
klawisze do wlaczania "CHEATING MODES", przydatne do testowania programu :
Shift+Ctrl+C wlacz/wylacz sprawdzanie kolizji playerShip z enemyShips i levelem
Shift+Ctrl+I wlacz/wylacz tryb "Immune to rockets"
}
{ TODO:
- Simplify all the mess with so-called "modes" in this unit:
thanks to CastleWindowModes unit I can now code this in much more
clear way (using normal sequential code, like in kambi_lines
or castle, instead of only event-driven). To be done if I ever
will want to do anything larger with malfunction.
}
{$apptype GUI}
uses CastleWindow, GameGeneral, SysUtils, CastleUtils, ModeMenuUnit, ModeGameUnit,
CastleParameters, CastleClassUtils, CastleFilesUtils, CastleKeysMouse,
CastleURIUtils, CastleLog, CastleApplicationProperties;
{ params ------------------------------------------------------------ }
const
Options: array[0..1]of TOption = (
(Short: 'h'; Long: 'help'; Argument: oaNone),
(Short: 'v'; Long: 'version'; Argument: oaNone)
);
procedure OptionProc(OptionNum: Integer; HasArgument: boolean;
const Argument: string; const SeparateArgs: TSeparateArgs; Data: Pointer);
begin
case OptionNum of
0: begin
InfoWrite(
'malfunction: small 3d game in OpenGL.' +nl+
'Accepted command-line options:' +nl+
OptionDescription('-h / --help', 'Print this help message and exit.') + NL +
OptionDescription('-v / --version', 'Print the version number and exit.') + NL +
TCastleWindow.ParseParametersHelp +nl+
nl+
ApplicationProperties.Description);
Halt;
end;
1: begin
WritelnStr(Version);
Halt;
end;
else raise EInternalError.Create('OptionProc');
end;
end;
{ main program ------------------------------------------------------- }
begin
ApplicationProperties.ApplicationName := DisplayApplicationName;
ApplicationProperties.Version := Version;
Window.FullScreen := true;
{ parse params }
Window.ParseParameters;
Parameters.Parse(Options, @OptionProc, nil);
if Parameters.High > 0 then
raise EInvalidParams.Create('Unrecognized parameter : ' + Parameters[1]);
InitializeLog;
SetGameMode(modeMenu);
Window.OpenAndRun;
end.