author | koda |
Wed, 10 Feb 2010 22:00:49 +0000 | |
changeset 2799 | 558b29bf00c5 |
parent 2796 | 7f86e7ad378b |
child 2800 | f286d91157b8 |
permissions | -rw-r--r-- |
498 | 1 |
(* |
1066 | 2 |
* Hedgewars, a free turn based strategy game |
393 | 3 |
* Copyright (c) 2004-2007 Andrey Korotaev <unC0Rr@gmail.com> |
51 | 4 |
* |
183 | 5 |
* This program is free software; you can redistribute it and/or modify |
6 |
* it under the terms of the GNU General Public License as published by |
|
7 |
* the Free Software Foundation; version 2 of the License |
|
51 | 8 |
* |
183 | 9 |
* This program is distributed in the hope that it will be useful, |
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 |
* GNU General Public License for more details. |
|
51 | 13 |
* |
183 | 14 |
* You should have received a copy of the GNU General Public License |
15 |
* along with this program; if not, write to the Free Software |
|
16 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
|
51 | 17 |
*) |
18 |
||
2599 | 19 |
{$INCLUDE "options.inc"} |
2587
0dfa56a8513c
fix a segfault in the iphone simulator by moving options.inc at the beginning of the file
koda
parents:
2586
diff
changeset
|
20 |
|
2698 | 21 |
{$IFDEF IPHONEOS} |
22 |
unit hwengine; |
|
23 |
interface |
|
24 |
{$ELSE} |
|
51 | 25 |
program hwengine; |
2698 | 26 |
{$ENDIF} |
2690 | 27 |
uses SDLh in 'SDLh.pas', |
1524
5a652a465559
Draw world before processing gears, as this should improve performance by introducing cpu-gpu parallelizm
unc0rr
parents:
1128
diff
changeset
|
28 |
uConsts in 'uConsts.pas', |
5a652a465559
Draw world before processing gears, as this should improve performance by introducing cpu-gpu parallelizm
unc0rr
parents:
1128
diff
changeset
|
29 |
uGame in 'uGame.pas', |
5a652a465559
Draw world before processing gears, as this should improve performance by introducing cpu-gpu parallelizm
unc0rr
parents:
1128
diff
changeset
|
30 |
uMisc in 'uMisc.pas', |
5a652a465559
Draw world before processing gears, as this should improve performance by introducing cpu-gpu parallelizm
unc0rr
parents:
1128
diff
changeset
|
31 |
uStore in 'uStore.pas', |
5a652a465559
Draw world before processing gears, as this should improve performance by introducing cpu-gpu parallelizm
unc0rr
parents:
1128
diff
changeset
|
32 |
uWorld in 'uWorld.pas', |
5a652a465559
Draw world before processing gears, as this should improve performance by introducing cpu-gpu parallelizm
unc0rr
parents:
1128
diff
changeset
|
33 |
uIO in 'uIO.pas', |
5a652a465559
Draw world before processing gears, as this should improve performance by introducing cpu-gpu parallelizm
unc0rr
parents:
1128
diff
changeset
|
34 |
uGears in 'uGears.pas', |
5a652a465559
Draw world before processing gears, as this should improve performance by introducing cpu-gpu parallelizm
unc0rr
parents:
1128
diff
changeset
|
35 |
uVisualGears in 'uVisualGears.pas', |
5a652a465559
Draw world before processing gears, as this should improve performance by introducing cpu-gpu parallelizm
unc0rr
parents:
1128
diff
changeset
|
36 |
uConsole in 'uConsole.pas', |
5a652a465559
Draw world before processing gears, as this should improve performance by introducing cpu-gpu parallelizm
unc0rr
parents:
1128
diff
changeset
|
37 |
uKeys in 'uKeys.pas', |
5a652a465559
Draw world before processing gears, as this should improve performance by introducing cpu-gpu parallelizm
unc0rr
parents:
1128
diff
changeset
|
38 |
uTeams in 'uTeams.pas', |
5a652a465559
Draw world before processing gears, as this should improve performance by introducing cpu-gpu parallelizm
unc0rr
parents:
1128
diff
changeset
|
39 |
uSound in 'uSound.pas', |
5a652a465559
Draw world before processing gears, as this should improve performance by introducing cpu-gpu parallelizm
unc0rr
parents:
1128
diff
changeset
|
40 |
uRandom in 'uRandom.pas', |
5a652a465559
Draw world before processing gears, as this should improve performance by introducing cpu-gpu parallelizm
unc0rr
parents:
1128
diff
changeset
|
41 |
uAI in 'uAI.pas', |
5a652a465559
Draw world before processing gears, as this should improve performance by introducing cpu-gpu parallelizm
unc0rr
parents:
1128
diff
changeset
|
42 |
uAIMisc in 'uAIMisc.pas', |
5a652a465559
Draw world before processing gears, as this should improve performance by introducing cpu-gpu parallelizm
unc0rr
parents:
1128
diff
changeset
|
43 |
uAIAmmoTests in 'uAIAmmoTests.pas', |
5a652a465559
Draw world before processing gears, as this should improve performance by introducing cpu-gpu parallelizm
unc0rr
parents:
1128
diff
changeset
|
44 |
uAIActions in 'uAIActions.pas', |
5a652a465559
Draw world before processing gears, as this should improve performance by introducing cpu-gpu parallelizm
unc0rr
parents:
1128
diff
changeset
|
45 |
uCollisions in 'uCollisions.pas', |
5a652a465559
Draw world before processing gears, as this should improve performance by introducing cpu-gpu parallelizm
unc0rr
parents:
1128
diff
changeset
|
46 |
uLand in 'uLand.pas', |
5a652a465559
Draw world before processing gears, as this should improve performance by introducing cpu-gpu parallelizm
unc0rr
parents:
1128
diff
changeset
|
47 |
uLandTemplates in 'uLandTemplates.pas', |
5a652a465559
Draw world before processing gears, as this should improve performance by introducing cpu-gpu parallelizm
unc0rr
parents:
1128
diff
changeset
|
48 |
uLandObjects in 'uLandObjects.pas', |
5a652a465559
Draw world before processing gears, as this should improve performance by introducing cpu-gpu parallelizm
unc0rr
parents:
1128
diff
changeset
|
49 |
uLandGraphics in 'uLandGraphics.pas', |
5a652a465559
Draw world before processing gears, as this should improve performance by introducing cpu-gpu parallelizm
unc0rr
parents:
1128
diff
changeset
|
50 |
uLocale in 'uLocale.pas', |
5a652a465559
Draw world before processing gears, as this should improve performance by introducing cpu-gpu parallelizm
unc0rr
parents:
1128
diff
changeset
|
51 |
uAmmos in 'uAmmos.pas', |
5a652a465559
Draw world before processing gears, as this should improve performance by introducing cpu-gpu parallelizm
unc0rr
parents:
1128
diff
changeset
|
52 |
uSHA in 'uSHA.pas', |
5a652a465559
Draw world before processing gears, as this should improve performance by introducing cpu-gpu parallelizm
unc0rr
parents:
1128
diff
changeset
|
53 |
uFloat in 'uFloat.pas', |
5a652a465559
Draw world before processing gears, as this should improve performance by introducing cpu-gpu parallelizm
unc0rr
parents:
1128
diff
changeset
|
54 |
uStats in 'uStats.pas', |
1807 | 55 |
uChat in 'uChat.pas', |
2699
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
56 |
uTriggers in 'uTriggers.pas', |
2786 | 57 |
uLandTexture in 'uLandTexture.pas', |
58 |
uScript in 'uScript.pas', |
|
2799 | 59 |
{$IFDEF IPHONEOS}PascalExports in 'PascalExports.pas',{$ENDIF} |
60 |
sysutils; |
|
51 | 61 |
|
62 |
// also: GSHandlers.inc |
|
63 |
// CCHandlers.inc |
|
64 |
// HHHandlers.inc |
|
357 | 65 |
// SinTable.inc |
271 | 66 |
// proto.inc |
51 | 67 |
|
2698 | 68 |
{$IFDEF IPHONEOS} |
2743 | 69 |
type arrayofpchar = array[0..5] of PChar; |
2698 | 70 |
procedure DoTimer(Lag: LongInt); |
71 |
procedure OnDestroy; |
|
72 |
procedure MainLoop; |
|
73 |
procedure ShowMainWindow; |
|
2702
48fc46a922fd
rewrite gamesetup to use less memory, rename effects to sound plus some nice actions, settings work in game again
koda
parents:
2699
diff
changeset
|
74 |
procedure Game(gameArgs: arrayofpchar); cdecl; export; |
2699
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
75 |
procedure initEverything; |
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
76 |
procedure freeEverything; |
51 | 77 |
|
2698 | 78 |
implementation |
79 |
||
80 |
{$ELSE} |
|
51 | 81 |
procedure OnDestroy; forward; |
2699
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
82 |
procedure freeEverything; forward; |
2698 | 83 |
{$ENDIF} |
51 | 84 |
|
85 |
//////////////////////////////// |
|
371 | 86 |
procedure DoTimer(Lag: LongInt); |
2243
b4764993f833
additional touch support and nemo's reduced land array size
koda
parents:
2191
diff
changeset
|
87 |
{$IFNDEF IPHONEOS} |
1080 | 88 |
var s: string; |
2243
b4764993f833
additional touch support and nemo's reduced land array size
koda
parents:
2191
diff
changeset
|
89 |
{$ENDIF} |
51 | 90 |
begin |
2698 | 91 |
inc(RealTicks, Lag); |
564 | 92 |
|
2698 | 93 |
case GameState of |
94 |
gsLandGen: begin |
|
95 |
GenMap; |
|
96 |
GameState:= gsStart; |
|
97 |
end; |
|
98 |
gsStart: begin |
|
99 |
if HasBorder then DisableSomeWeapons; |
|
100 |
AddClouds; |
|
101 |
AssignHHCoords; |
|
102 |
AddMiscGears; |
|
103 |
StoreLoad; |
|
104 |
InitWorld; |
|
105 |
ResetKbd; |
|
106 |
SoundLoad; |
|
107 |
if GameType = gmtSave then |
|
108 |
begin |
|
109 |
isSEBackup:= isSoundEnabled; |
|
110 |
isSoundEnabled:= false |
|
111 |
end; |
|
112 |
FinishProgress; |
|
113 |
PlayMusic; |
|
114 |
SetScale(zoom); |
|
2786 | 115 |
ScriptCall('onGameStart'); |
2698 | 116 |
GameState:= gsGame; |
1524
5a652a465559
Draw world before processing gears, as this should improve performance by introducing cpu-gpu parallelizm
unc0rr
parents:
1128
diff
changeset
|
117 |
end; |
2698 | 118 |
gsConfirm, |
119 |
gsGame: begin |
|
120 |
DrawWorld(Lag); // never place between ProcessKbd and DoGameTick - bugs due to /put cmd and isCursorVisible |
|
121 |
ProcessKbd; |
|
122 |
DoGameTick(Lag); |
|
123 |
ProcessVisualGears(Lag); |
|
124 |
end; |
|
125 |
gsChat: begin |
|
126 |
DrawWorld(Lag); |
|
127 |
DoGameTick(Lag); |
|
128 |
ProcessVisualGears(Lag); |
|
129 |
end; |
|
130 |
gsExit: begin |
|
131 |
isTerminated:= true; |
|
132 |
end; |
|
133 |
end; |
|
564 | 134 |
|
2698 | 135 |
SDL_GL_SwapBuffers(); |
2716
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
136 |
{$IFDEF SDL13} |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
137 |
SDL_RenderPresent(); |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
138 |
{$ENDIF} |
2171
8208946331ba
Smaxx refactor of LoadImage to use flags, iphone changes by koda (mostly use of rgba instead of rgb)
nemo
parents:
2162
diff
changeset
|
139 |
{$IFNDEF IPHONEOS} |
2702
48fc46a922fd
rewrite gamesetup to use less memory, rename effects to sound plus some nice actions, settings work in game again
koda
parents:
2699
diff
changeset
|
140 |
// not going to make captures on the iPhone |
2698 | 141 |
if flagMakeCapture then |
1524
5a652a465559
Draw world before processing gears, as this should improve performance by introducing cpu-gpu parallelizm
unc0rr
parents:
1128
diff
changeset
|
142 |
begin |
2698 | 143 |
flagMakeCapture:= false; |
2735 | 144 |
s:= 'hw_' + FormatDateTime('YYYY-MM-DD_HH-mm-ss', Now()) + inttostr(GameTicks); |
145 |
WriteLnToConsole('Saving ' + s + '...'); |
|
2698 | 146 |
MakeScreenshot(s); |
147 |
//SDL_SaveBMP_RW(SDLPrimSurface, SDL_RWFromFile(Str2PChar(s), 'wb'), 1) |
|
1524
5a652a465559
Draw world before processing gears, as this should improve performance by introducing cpu-gpu parallelizm
unc0rr
parents:
1128
diff
changeset
|
148 |
end; |
2171
8208946331ba
Smaxx refactor of LoadImage to use flags, iphone changes by koda (mostly use of rgba instead of rgb)
nemo
parents:
2162
diff
changeset
|
149 |
{$ENDIF} |
51 | 150 |
end; |
151 |
||
152 |
//////////////////// |
|
79 | 153 |
procedure OnDestroy; |
51 | 154 |
begin |
2692
ce9992075118
better network support + initial work for returning to frontend
koda
parents:
2691
diff
changeset
|
155 |
WriteLnToConsole('Freeing resources...'); |
2688 | 156 |
if isSoundEnabled then ReleaseSound(); |
157 |
StoreRelease(); |
|
158 |
FreeLand(); |
|
2692
ce9992075118
better network support + initial work for returning to frontend
koda
parents:
2691
diff
changeset
|
159 |
ControllerClose(); |
2688 | 160 |
SendKB(); |
161 |
CloseIPC(); |
|
162 |
TTF_Quit(); |
|
2699
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
163 |
{$IFDEF SDL13}SDL_VideoQuit();{$ENDIF} |
2688 | 164 |
SDL_Quit(); |
2796 | 165 |
{$IFDEF IPHONEOS} |
2716
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
166 |
freeEverything(); |
2796 | 167 |
{$ENDIF} |
2698 | 168 |
exit(); |
51 | 169 |
end; |
170 |
||
171 |
/////////////////// |
|
2698 | 172 |
procedure MainLoop; |
2716
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
173 |
var PrevTime, CurrTime: Longword; |
2702
48fc46a922fd
rewrite gamesetup to use less memory, rename effects to sound plus some nice actions, settings work in game again
koda
parents:
2699
diff
changeset
|
174 |
{$IFNDEF IPHONEOS}event: TSDL_Event;{$ENDIF} |
2698 | 175 |
begin |
176 |
PrevTime:= SDL_GetTicks; |
|
177 |
repeat |
|
178 |
{$IFNDEF IPHONEOS} |
|
179 |
// have to remove this cycle because otherwise it segfaults at exit |
|
180 |
while SDL_PollEvent(@event) <> 0 do |
|
181 |
begin |
|
182 |
case event.type_ of |
|
183 |
SDL_KEYDOWN: if GameState = gsChat then KeyPressChat(event.key.keysym.unicode); |
|
184 |
{$IFDEF SDL13} |
|
185 |
SDL_WINDOWEVENT: |
|
186 |
{$ELSE} |
|
187 |
SDL_ACTIVEEVENT: |
|
2569 | 188 |
{$ENDIF} |
2698 | 189 |
if (event.active.state and SDL_APPINPUTFOCUS) <> 0 then |
190 |
cHasFocus:= event.active.gain = 1; |
|
191 |
//SDL_VIDEORESIZE: Resize(max(event.resize.w, 600), max(event.resize.h, 450)); |
|
192 |
SDL_MOUSEBUTTONDOWN: if event.button.button = SDL_BUTTON_WHEELDOWN then uKeys.wheelDown:= true; |
|
193 |
SDL_MOUSEBUTTONUP: if event.button.button = SDL_BUTTON_WHEELUP then uKeys.wheelUp:= true; |
|
194 |
SDL_JOYAXISMOTION: ControllerAxisEvent(event.jaxis.which, event.jaxis.axis, event.jaxis.value); |
|
195 |
SDL_JOYHATMOTION: ControllerHatEvent(event.jhat.which, event.jhat.hat, event.jhat.value); |
|
196 |
SDL_JOYBUTTONDOWN: ControllerButtonEvent(event.jbutton.which, event.jbutton.button, true); |
|
197 |
SDL_JOYBUTTONUP: ControllerButtonEvent(event.jbutton.which, event.jbutton.button, false); |
|
198 |
SDL_QUITEV: isTerminated:= true |
|
199 |
end; // end case event.type_ of |
|
200 |
end; // end while SDL_PollEvent(@event) <> 0 do |
|
2390 | 201 |
{$ENDIF} |
2698 | 202 |
CurrTime:= SDL_GetTicks; |
203 |
if PrevTime + cTimerInterval <= CurrTime then |
|
204 |
begin |
|
205 |
DoTimer(CurrTime - PrevTime); |
|
206 |
PrevTime:= CurrTime |
|
207 |
end else SDL_Delay(1); |
|
208 |
if isTerminated = false then IPCCheckSock(); |
|
209 |
until isTerminated; |
|
210 |
||
211 |
exit(); |
|
212 |
end; |
|
213 |
||
214 |
///////////////////////// |
|
215 |
procedure ShowMainWindow; |
|
216 |
begin |
|
217 |
if cFullScreen then ParseCommand('fullscr 1', true) |
|
218 |
else ParseCommand('fullscr 0', true); |
|
219 |
SDL_ShowCursor(0) |
|
220 |
end; |
|
2591
c6597b65caea
other controls implementation + sdlh revisited (once again)
koda
parents:
2590
diff
changeset
|
221 |
|
2698 | 222 |
/////////////// |
2702
48fc46a922fd
rewrite gamesetup to use less memory, rename effects to sound plus some nice actions, settings work in game again
koda
parents:
2699
diff
changeset
|
223 |
{$IFDEF IPHONEOS} |
48fc46a922fd
rewrite gamesetup to use less memory, rename effects to sound plus some nice actions, settings work in game again
koda
parents:
2699
diff
changeset
|
224 |
procedure Game(gameArgs: arrayofpchar); cdecl; export; |
48fc46a922fd
rewrite gamesetup to use less memory, rename effects to sound plus some nice actions, settings work in game again
koda
parents:
2699
diff
changeset
|
225 |
{$ELSE} |
48fc46a922fd
rewrite gamesetup to use less memory, rename effects to sound plus some nice actions, settings work in game again
koda
parents:
2699
diff
changeset
|
226 |
procedure Game;cdecl; export; |
48fc46a922fd
rewrite gamesetup to use less memory, rename effects to sound plus some nice actions, settings work in game again
koda
parents:
2699
diff
changeset
|
227 |
{$ENDIF} |
2698 | 228 |
var p: TPathType; |
229 |
s: shortstring; |
|
230 |
begin |
|
231 |
{$IFDEF IPHONEOS} |
|
2699
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
232 |
initEverything(); |
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
233 |
Randomize(); |
2591
c6597b65caea
other controls implementation + sdlh revisited (once again)
koda
parents:
2590
diff
changeset
|
234 |
|
2743 | 235 |
cScreenWidth:= 480; |
236 |
cScreenHeight:= 320; |
|
2698 | 237 |
cInitWidth:= cScreenWidth; |
238 |
cInitHeight:= cScreenHeight; |
|
2743 | 239 |
cBits:= 32; |
2716
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
240 |
cFullScreen:= false; |
2698 | 241 |
cVSyncInUse:= true; |
2743 | 242 |
cTimerInterval:= 8; |
2698 | 243 |
PathPrefix:= 'Data'; |
2702
48fc46a922fd
rewrite gamesetup to use less memory, rename effects to sound plus some nice actions, settings work in game again
koda
parents:
2699
diff
changeset
|
244 |
cReducedQuality:= false; |
2698 | 245 |
cShowFPS:= true; |
2743 | 246 |
cInitVolume:= 100; |
2702
48fc46a922fd
rewrite gamesetup to use less memory, rename effects to sound plus some nice actions, settings work in game again
koda
parents:
2699
diff
changeset
|
247 |
|
48fc46a922fd
rewrite gamesetup to use less memory, rename effects to sound plus some nice actions, settings work in game again
koda
parents:
2699
diff
changeset
|
248 |
UserNick:= gameArgs[0]; |
48fc46a922fd
rewrite gamesetup to use less memory, rename effects to sound plus some nice actions, settings work in game again
koda
parents:
2699
diff
changeset
|
249 |
val(gameArgs[1], ipcPort); |
48fc46a922fd
rewrite gamesetup to use less memory, rename effects to sound plus some nice actions, settings work in game again
koda
parents:
2699
diff
changeset
|
250 |
isSoundEnabled:= gameArgs[2] = '1'; |
48fc46a922fd
rewrite gamesetup to use less memory, rename effects to sound plus some nice actions, settings work in game again
koda
parents:
2699
diff
changeset
|
251 |
isMusicEnabled:= gameArgs[3] = '1'; |
48fc46a922fd
rewrite gamesetup to use less memory, rename effects to sound plus some nice actions, settings work in game again
koda
parents:
2699
diff
changeset
|
252 |
cLocaleFName:= gameArgs[4]; |
2743 | 253 |
cAltDamage:= gameArgs[5] = '1'; |
2600 | 254 |
{$ENDIF} |
2698 | 255 |
|
256 |
for p:= Succ(Low(TPathType)) to High(TPathType) do |
|
257 |
if p <> ptMapCurrent then Pathz[p]:= PathPrefix + '/' + Pathz[p]; |
|
258 |
||
259 |
WriteToConsole('Init SDL... '); |
|
2714
c85ffe57d971
update iphone frontend to the new (silly) sdl api, code cleanups for other sections
koda
parents:
2705
diff
changeset
|
260 |
SDLTry(SDL_Init(SDL_INIT_VIDEO) >= 0, true); |
2698 | 261 |
WriteLnToConsole(msgOK); |
262 |
||
263 |
SDL_EnableUNICODE(1); |
|
264 |
||
265 |
WriteToConsole('Init SDL_ttf... '); |
|
2716
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
266 |
SDLTry(TTF_Init() <> -1, true); |
2698 | 267 |
WriteLnToConsole(msgOK); |
268 |
||
2716
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
269 |
ShowMainWindow(); |
2698 | 270 |
|
2716
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
271 |
AddProgress(); |
2698 | 272 |
|
2716
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
273 |
ControllerInit(); // has to happen before InitKbdKeyTable to map keys |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
274 |
InitKbdKeyTable(); |
2698 | 275 |
|
276 |
if recordFileName = '' then |
|
277 |
InitIPC; |
|
278 |
WriteLnToConsole(msgGettingConfig); |
|
279 |
||
2719 | 280 |
LoadLocale(Pathz[ptLocale] + '/en.txt'); // Do an initial load with english |
2698 | 281 |
if cLocaleFName <> 'en.txt' then |
2719 | 282 |
begin |
283 |
// Try two letter locale first before trying specific locale overrides |
|
2722 | 284 |
if (Length(cLocaleFName) > 6) and (Copy(cLocaleFName,1,2)+'.txt' <> 'en.txt') then |
285 |
LoadLocale(Pathz[ptLocale] + '/' + Copy(cLocaleFName,1,2)+'.txt'); |
|
2719 | 286 |
LoadLocale(Pathz[ptLocale] + '/' + cLocaleFName); |
287 |
end; |
|
2698 | 288 |
|
289 |
if recordFileName = '' then |
|
290 |
SendIPCAndWaitReply('C') // ask for game config |
|
291 |
else |
|
292 |
LoadRecordFromFile(recordFileName); |
|
293 |
||
2786 | 294 |
ScriptOnGameInit; |
295 |
||
2698 | 296 |
s:= 'eproto ' + inttostr(cNetProtoVersion); |
297 |
SendIPCRaw(@s[0], Length(s) + 1); // send proto version |
|
298 |
||
2716
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
299 |
InitTeams(); |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
300 |
AssignStores(); |
2590 | 301 |
|
2698 | 302 |
if isSoundEnabled then |
2716
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
303 |
InitSound(); |
2698 | 304 |
|
305 |
isDeveloperMode:= false; |
|
306 |
||
307 |
TryDo(InitStepsFlags = cifAllInited, 'Some parameters not set (flags = ' + inttostr(InitStepsFlags) + ')', true); |
|
308 |
||
309 |
MainLoop(); |
|
310 |
OnDestroy(); |
|
311 |
exit(); |
|
312 |
end; |
|
2590 | 313 |
|
2699
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
314 |
procedure initEverything; |
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
315 |
begin |
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
316 |
init_uConsts(); |
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
317 |
init_uMisc(); |
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
318 |
init_uConsole(); // MUST happen after uMisc |
2716
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
319 |
|
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
320 |
init_uAI(); |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
321 |
//uAIActions does not need initialization |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
322 |
//uAIAmmoTests does not need initialization |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
323 |
init_uAIMisc(); |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
324 |
init_uAmmos(); |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
325 |
init_uChat(); |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
326 |
init_uCollisions(); |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
327 |
//uFloat does not need initialization |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
328 |
//uGame does not need initialization |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
329 |
init_uGears(); |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
330 |
init_uIO(); |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
331 |
init_uKeys(); |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
332 |
init_uLand(); |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
333 |
//uLandGraphics does not need initialization |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
334 |
//uLandObjects does not need initialization |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
335 |
//uLandTemplates does not need initialization |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
336 |
//uLandTexture does not need initialization |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
337 |
//uLocale does not need initialization |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
338 |
init_uRandom(); |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
339 |
//uSHA does not need initialization |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
340 |
init_uSound(); |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
341 |
init_uStats(); |
2699
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
342 |
init_uStore(); |
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
343 |
init_uTeams(); |
2716
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
344 |
init_uTriggers(); |
2699
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
345 |
init_uVisualGears(); |
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
346 |
init_uWorld(); |
2786 | 347 |
init_uScript(); |
2699
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
348 |
end; |
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
349 |
|
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
350 |
procedure freeEverything; |
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
351 |
begin |
2716
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
352 |
free_uWorld(); |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
353 |
free_uVisualGears(); //stub |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
354 |
free_uTriggers(); //stub |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
355 |
free_uTeams(); |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
356 |
free_uStore(); |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
357 |
free_uStats(); //stub |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
358 |
free_uSound(); //stub |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
359 |
//uSHA does not need to be freed |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
360 |
free_uRandom(); //stub |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
361 |
//uLocale does not need to be freed |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
362 |
//uLandTemplates does not need to be freed |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
363 |
//uLandTexture does not need to be freed |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
364 |
//uLandObjects does not need to be freed |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
365 |
//uLandGraphics does not need to be freed |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
366 |
free_uLand(); |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
367 |
free_uKeys(); //stub |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
368 |
free_uIO(); |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
369 |
free_uGears(); |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
370 |
//uGame does not need to be freed |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
371 |
//uFloat does not need to be freed |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
372 |
free_uCollisions(); |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
373 |
free_uChat(); |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
374 |
free_uAmmos(); |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
375 |
free_uAIMisc(); //stub |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
376 |
//uAIAmmoTests does not need to be freed |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
377 |
//uAIActions does not need to be freed |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
378 |
free_uAI(); //stub |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
379 |
|
2699
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
380 |
free_uConsole(); |
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
381 |
free_uMisc(); |
2716
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
382 |
free_uConsts(); //stub |
2786 | 383 |
free_uScript(); |
2699
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
384 |
end; |
2698 | 385 |
{$IFNDEF IPHONEOS} |
386 |
///////////////////////// |
|
387 |
procedure GenLandPreview; |
|
388 |
var Preview: TPreview; |
|
2699
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
389 |
h: byte; |
2698 | 390 |
begin |
391 |
InitIPC; |
|
392 |
IPCWaitPongEvent; |
|
393 |
TryDo(InitStepsFlags = cifRandomize, 'Some parameters not set (flags = ' + inttostr(InitStepsFlags) + ')', true); |
|
394 |
||
395 |
Preview:= GenPreview; |
|
396 |
WriteLnToConsole('Sending preview...'); |
|
397 |
SendIPCRaw(@Preview, sizeof(Preview)); |
|
398 |
h:= MaxHedgehogs; |
|
399 |
SendIPCRaw(@h, sizeof(h)); |
|
400 |
WriteLnToConsole('Preview sent, disconnect'); |
|
401 |
CloseIPC(); |
|
402 |
end; |
|
403 |
||
404 |
//////////////////////////////// |
|
405 |
procedure Resize(w, h: LongInt); |
|
406 |
begin |
|
407 |
cScreenWidth:= w; |
|
408 |
cScreenHeight:= h; |
|
409 |
if cFullScreen then |
|
410 |
ParseCommand('/fullscr 1', true) |
|
411 |
else |
|
412 |
ParseCommand('/fullscr 0', true); |
|
51 | 413 |
end; |
414 |
||
2008 | 415 |
///////////////////// |
416 |
procedure DisplayUsage; |
|
2691 | 417 |
var i: LongInt; |
2008 | 418 |
begin |
419 |
WriteLn('Wrong argument format: correct configurations is'); |
|
420 |
WriteLn(); |
|
421 |
WriteLn(' hwengine <path to data folder> <path to replay file> [option]'); |
|
422 |
WriteLn(); |
|
423 |
WriteLn('where [option] must be specified either as'); |
|
2264 | 424 |
WriteLn(' --set-video [screen width] [screen height] [color dept]'); |
2008 | 425 |
WriteLn(' --set-audio [volume] [enable music] [enable sounds]'); |
426 |
WriteLn(' --set-other [language file] [full screen] [show FPS]'); |
|
427 |
WriteLn(' --set-multimedia [screen height] [screen width] [color dept] [volume] [enable music] [enable sounds] [language file] [full screen]'); |
|
428 |
WriteLn(' --set-everything [screen height] [screen width] [color dept] [volume] [enable music] [enable sounds] [language file] [full screen] [show FPS] [alternate damage] [timer value] [reduced quality]'); |
|
429 |
WriteLn(); |
|
2015 | 430 |
WriteLn('Read documentation online at http://www.hedgewars.org/node/1465 for more information'); |
2691 | 431 |
Write('parsed command: '); |
2698 | 432 |
for i:=0 to ParamCount do |
433 |
Write(ParamStr(i) + ' '); |
|
2691 | 434 |
WriteLn(); |
2015 | 435 |
halt(1); |
2008 | 436 |
end; |
437 |
||
51 | 438 |
//////////////////// |
439 |
procedure GetParams; |
|
267 | 440 |
{$IFDEF DEBUGFILE} |
2699
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
441 |
var i: LongInt; |
267 | 442 |
{$ENDIF} |
97
e7c1df9cce2c
- make the game be run from ${PREFIX}/bin with data in ${PREFIX}/share/hedgewars/Data
unc0rr
parents:
81
diff
changeset
|
443 |
begin |
267 | 444 |
|
2698 | 445 |
case ParamCount of |
2747 | 446 |
18: begin |
2698 | 447 |
val(ParamStr(2), cScreenWidth); |
448 |
val(ParamStr(3), cScreenHeight); |
|
2008 | 449 |
cInitWidth:= cScreenWidth; |
450 |
cInitHeight:= cScreenHeight; |
|
2698 | 451 |
cBitsStr:= ParamStr(4); |
2008 | 452 |
val(cBitsStr, cBits); |
2698 | 453 |
val(ParamStr(5), ipcPort); |
454 |
cFullScreen:= ParamStr(6) = '1'; |
|
455 |
isSoundEnabled:= ParamStr(7) = '1'; |
|
456 |
cVSyncInUse:= ParamStr(8) = '1'; |
|
2747 | 457 |
cWeaponTooltips:= ParamStr(9) = '1'; |
458 |
cLocaleFName:= ParamStr(10); |
|
459 |
val(ParamStr(11), cInitVolume); |
|
460 |
val(ParamStr(12), cTimerInterval); |
|
461 |
PathPrefix:= ParamStr(13); |
|
462 |
cShowFPS:= ParamStr(14) = '1'; |
|
463 |
cAltDamage:= ParamStr(15) = '1'; |
|
464 |
UserNick:= DecodeBase64(ParamStr(16)); |
|
465 |
isMusicEnabled:= ParamStr(17) = '1'; |
|
466 |
cReducedQuality:= ParamStr(18) = '1'; |
|
2698 | 467 |
end; |
468 |
3: begin |
|
469 |
val(ParamStr(2), ipcPort); |
|
470 |
GameType:= gmtLandPreview; |
|
471 |
if ParamStr(3) <> 'landpreview' then |
|
472 |
OutError(errmsgShouldntRun, true); |
|
473 |
end; |
|
474 |
2: begin |
|
475 |
PathPrefix:= ParamStr(1); |
|
476 |
recordFileName:= ParamStr(2); |
|
477 |
end; |
|
478 |
6: begin |
|
479 |
PathPrefix:= ParamStr(1); |
|
480 |
recordFileName:= ParamStr(2); |
|
481 |
||
482 |
if ParamStr(3) = '--set-video' then |
|
2008 | 483 |
begin |
2698 | 484 |
val(ParamStr(4), cScreenWidth); |
485 |
val(ParamStr(5), cScreenHeight); |
|
486 |
cInitWidth:= cScreenWidth; |
|
487 |
cInitHeight:= cScreenHeight; |
|
488 |
cBitsStr:= ParamStr(6); |
|
489 |
val(cBitsStr, cBits); |
|
2008 | 490 |
end |
491 |
else |
|
492 |
begin |
|
2698 | 493 |
if ParamStr(3) = '--set-audio' then |
494 |
begin |
|
495 |
val(ParamStr(4), cInitVolume); |
|
496 |
isMusicEnabled:= ParamStr(5) = '1'; |
|
497 |
isSoundEnabled:= ParamStr(6) = '1'; |
|
498 |
end |
|
499 |
else |
|
2008 | 500 |
begin |
2698 | 501 |
if ParamStr(3) = '--set-other' then |
502 |
begin |
|
503 |
cLocaleFName:= ParamStr(4); |
|
504 |
cFullScreen:= ParamStr(5) = '1'; |
|
505 |
cShowFPS:= ParamStr(6) = '1'; |
|
506 |
end |
|
507 |
else DisplayUsage; |
|
2008 | 508 |
end |
2698 | 509 |
end; |
2008 | 510 |
end; |
2698 | 511 |
11: begin |
512 |
PathPrefix:= ParamStr(1); |
|
513 |
recordFileName:= ParamStr(2); |
|
2376 | 514 |
|
2698 | 515 |
if ParamStr(3) = '--set-multimedia' then |
516 |
begin |
|
517 |
val(ParamStr(4), cScreenWidth); |
|
518 |
val(ParamStr(5), cScreenHeight); |
|
519 |
cInitWidth:= cScreenWidth; |
|
520 |
cInitHeight:= cScreenHeight; |
|
521 |
cBitsStr:= ParamStr(6); |
|
522 |
val(cBitsStr, cBits); |
|
523 |
val(ParamStr(7), cInitVolume); |
|
524 |
isMusicEnabled:= ParamStr(8) = '1'; |
|
525 |
isSoundEnabled:= ParamStr(9) = '1'; |
|
526 |
cLocaleFName:= ParamStr(10); |
|
527 |
cFullScreen:= ParamStr(11) = '1'; |
|
528 |
end |
|
529 |
else DisplayUsage; |
|
530 |
end; |
|
531 |
15: begin |
|
532 |
PathPrefix:= ParamStr(1); |
|
533 |
recordFileName:= ParamStr(2); |
|
534 |
if ParamStr(3) = '--set-everything' then |
|
535 |
begin |
|
536 |
val(ParamStr(4), cScreenWidth); |
|
537 |
val(ParamStr(5), cScreenHeight); |
|
538 |
cInitWidth:= cScreenWidth; |
|
539 |
cInitHeight:= cScreenHeight; |
|
540 |
cBitsStr:= ParamStr(6); |
|
541 |
val(cBitsStr, cBits); |
|
542 |
val(ParamStr(7), cInitVolume); |
|
543 |
isMusicEnabled:= ParamStr(8) = '1'; |
|
544 |
isSoundEnabled:= ParamStr(9) = '1'; |
|
545 |
cLocaleFName:= ParamStr(10); |
|
546 |
cFullScreen:= ParamStr(11) = '1'; |
|
547 |
cAltDamage:= ParamStr(12) = '1'; |
|
548 |
cShowFPS:= ParamStr(13) = '1'; |
|
549 |
val(ParamStr(14), cTimerInterval); |
|
550 |
cReducedQuality:= ParamStr(15) = '1'; |
|
551 |
end |
|
552 |
else DisplayUsage; |
|
553 |
end; |
|
2008 | 554 |
else DisplayUsage; |
555 |
end; |
|
2630 | 556 |
|
557 |
{$IFDEF DEBUGFILE} |
|
2698 | 558 |
AddFileLog('Prefix: "' + PathPrefix +'"'); |
559 |
for i:= 0 to ParamCount do |
|
560 |
AddFileLog(inttostr(i) + ': ' + ParamStr(i)); |
|
2630 | 561 |
{$IFDEF IPHONEOS} |
2690 | 562 |
WriteLnToConsole('Saving debug file at: ' + IPH_getDocumentsPath()); |
2630 | 563 |
{$ENDIF} |
564 |
{$ENDIF} |
|
51 | 565 |
end; |
155
401f4ea24715
Engine can generate land preview and send it via IPC
unc0rr
parents:
109
diff
changeset
|
566 |
//////////////////////////////////////////////////////////////////////////////// |
401f4ea24715
Engine can generate land preview and send it via IPC
unc0rr
parents:
109
diff
changeset
|
567 |
/////////////////////////////// m a i n //////////////////////////////////////// |
401f4ea24715
Engine can generate land preview and send it via IPC
unc0rr
parents:
109
diff
changeset
|
568 |
//////////////////////////////////////////////////////////////////////////////// |
401f4ea24715
Engine can generate land preview and send it via IPC
unc0rr
parents:
109
diff
changeset
|
569 |
|
401f4ea24715
Engine can generate land preview and send it via IPC
unc0rr
parents:
109
diff
changeset
|
570 |
begin |
2699
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
571 |
initEverything(); |
2692
ce9992075118
better network support + initial work for returning to frontend
koda
parents:
2691
diff
changeset
|
572 |
WriteLnToConsole('Hedgewars ' + cVersionString + ' engine (network protocol: ' + inttostr(cNetProtoVersion) + ')'); |
2699
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
573 |
|
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
574 |
GetParams(); |
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
575 |
Randomize(); |
2008 | 576 |
|
2699
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
577 |
if GameType = gmtLandPreview then GenLandPreview() |
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
578 |
else Game(); |
2796 | 579 |
freeEverything(); |
2716
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
580 |
ExitCode:= 0; |
2698 | 581 |
{$ENDIF} |
51 | 582 |
end. |