author | koda |
Sun, 31 Jan 2010 22:43:09 +0000 | |
changeset 2734 | fb9ad1587054 |
parent 2723 | eaa6ac1e95ea |
child 2735 | f2008d0ce3f8 |
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', |
2690 | 57 |
uLandTexture in 'uLandTexture.pas' |
58 |
{$IFDEF IPHONEOS} |
|
59 |
, PascalExports in 'PascalExports.pas' |
|
60 |
{$ENDIF} |
|
61 |
; |
|
51 | 62 |
|
63 |
// also: GSHandlers.inc |
|
64 |
// CCHandlers.inc |
|
65 |
// HHHandlers.inc |
|
357 | 66 |
// SinTable.inc |
271 | 67 |
// proto.inc |
51 | 68 |
|
2698 | 69 |
{$IFDEF 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
|
70 |
type arrayofpchar = array[0..6] of PChar; |
2698 | 71 |
procedure DoTimer(Lag: LongInt); |
72 |
procedure OnDestroy; |
|
73 |
procedure MainLoop; |
|
74 |
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
|
75 |
procedure Game(gameArgs: arrayofpchar); cdecl; export; |
2699
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
76 |
procedure initEverything; |
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
77 |
procedure freeEverything; |
51 | 78 |
|
2698 | 79 |
implementation |
80 |
||
81 |
{$ELSE} |
|
51 | 82 |
procedure OnDestroy; forward; |
2699
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
83 |
procedure freeEverything; forward; |
2698 | 84 |
{$ENDIF} |
51 | 85 |
|
86 |
//////////////////////////////// |
|
371 | 87 |
procedure DoTimer(Lag: LongInt); |
2243
b4764993f833
additional touch support and nemo's reduced land array size
koda
parents:
2191
diff
changeset
|
88 |
{$IFNDEF IPHONEOS} |
1080 | 89 |
var s: string; |
2243
b4764993f833
additional touch support and nemo's reduced land array size
koda
parents:
2191
diff
changeset
|
90 |
{$ENDIF} |
51 | 91 |
begin |
2698 | 92 |
inc(RealTicks, Lag); |
564 | 93 |
|
2698 | 94 |
case GameState of |
95 |
gsLandGen: begin |
|
96 |
GenMap; |
|
97 |
GameState:= gsStart; |
|
98 |
end; |
|
99 |
gsStart: begin |
|
100 |
if HasBorder then DisableSomeWeapons; |
|
101 |
AddClouds; |
|
102 |
AssignHHCoords; |
|
103 |
AddMiscGears; |
|
104 |
StoreLoad; |
|
105 |
InitWorld; |
|
106 |
ResetKbd; |
|
107 |
SoundLoad; |
|
108 |
if GameType = gmtSave then |
|
109 |
begin |
|
110 |
isSEBackup:= isSoundEnabled; |
|
111 |
isSoundEnabled:= false |
|
112 |
end; |
|
113 |
FinishProgress; |
|
114 |
PlayMusic; |
|
115 |
SetScale(zoom); |
|
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; |
144 |
s:= 'hw_' + cSeed + '_' + inttostr(GameTicks) + '.tga'; |
|
145 |
WriteLnToConsole('Saving ' + s); |
|
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(); |
2716
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
165 |
freeEverything(); |
2698 | 166 |
exit(); |
51 | 167 |
end; |
168 |
||
169 |
/////////////////// |
|
2698 | 170 |
procedure MainLoop; |
2716
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
171 |
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
|
172 |
{$IFNDEF IPHONEOS}event: TSDL_Event;{$ENDIF} |
2698 | 173 |
begin |
174 |
PrevTime:= SDL_GetTicks; |
|
175 |
repeat |
|
176 |
{$IFNDEF IPHONEOS} |
|
177 |
// have to remove this cycle because otherwise it segfaults at exit |
|
178 |
while SDL_PollEvent(@event) <> 0 do |
|
179 |
begin |
|
180 |
case event.type_ of |
|
181 |
SDL_KEYDOWN: if GameState = gsChat then KeyPressChat(event.key.keysym.unicode); |
|
182 |
{$IFDEF SDL13} |
|
183 |
SDL_WINDOWEVENT: |
|
184 |
{$ELSE} |
|
185 |
SDL_ACTIVEEVENT: |
|
2569 | 186 |
{$ENDIF} |
2698 | 187 |
if (event.active.state and SDL_APPINPUTFOCUS) <> 0 then |
188 |
cHasFocus:= event.active.gain = 1; |
|
189 |
//SDL_VIDEORESIZE: Resize(max(event.resize.w, 600), max(event.resize.h, 450)); |
|
190 |
SDL_MOUSEBUTTONDOWN: if event.button.button = SDL_BUTTON_WHEELDOWN then uKeys.wheelDown:= true; |
|
191 |
SDL_MOUSEBUTTONUP: if event.button.button = SDL_BUTTON_WHEELUP then uKeys.wheelUp:= true; |
|
192 |
SDL_JOYAXISMOTION: ControllerAxisEvent(event.jaxis.which, event.jaxis.axis, event.jaxis.value); |
|
193 |
SDL_JOYHATMOTION: ControllerHatEvent(event.jhat.which, event.jhat.hat, event.jhat.value); |
|
194 |
SDL_JOYBUTTONDOWN: ControllerButtonEvent(event.jbutton.which, event.jbutton.button, true); |
|
195 |
SDL_JOYBUTTONUP: ControllerButtonEvent(event.jbutton.which, event.jbutton.button, false); |
|
196 |
SDL_QUITEV: isTerminated:= true |
|
197 |
end; // end case event.type_ of |
|
198 |
end; // end while SDL_PollEvent(@event) <> 0 do |
|
2390 | 199 |
{$ENDIF} |
2698 | 200 |
CurrTime:= SDL_GetTicks; |
201 |
if PrevTime + cTimerInterval <= CurrTime then |
|
202 |
begin |
|
203 |
DoTimer(CurrTime - PrevTime); |
|
204 |
PrevTime:= CurrTime |
|
205 |
end else SDL_Delay(1); |
|
206 |
if isTerminated = false then IPCCheckSock(); |
|
207 |
until isTerminated; |
|
208 |
||
209 |
exit(); |
|
210 |
end; |
|
211 |
||
212 |
///////////////////////// |
|
213 |
procedure ShowMainWindow; |
|
214 |
begin |
|
215 |
if cFullScreen then ParseCommand('fullscr 1', true) |
|
216 |
else ParseCommand('fullscr 0', true); |
|
217 |
SDL_ShowCursor(0) |
|
218 |
end; |
|
2591
c6597b65caea
other controls implementation + sdlh revisited (once again)
koda
parents:
2590
diff
changeset
|
219 |
|
2698 | 220 |
/////////////// |
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
|
221 |
{$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
|
222 |
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
|
223 |
{$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
|
224 |
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
|
225 |
{$ENDIF} |
2698 | 226 |
var p: TPathType; |
227 |
s: shortstring; |
|
228 |
begin |
|
229 |
{$IFDEF IPHONEOS} |
|
2699
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
230 |
initEverything(); |
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
231 |
Randomize(); |
2591
c6597b65caea
other controls implementation + sdlh revisited (once again)
koda
parents:
2590
diff
changeset
|
232 |
|
2723 | 233 |
val('480', cScreenWidth); |
234 |
val('320', cScreenHeight); |
|
2698 | 235 |
cInitWidth:= cScreenWidth; |
236 |
cInitHeight:= cScreenHeight; |
|
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
|
237 |
cBitsStr:= '32'; |
2698 | 238 |
val(cBitsStr, cBits); |
2716
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
239 |
cFullScreen:= false; |
2698 | 240 |
cVSyncInUse:= true; |
241 |
val('8', cTimerInterval); |
|
242 |
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
|
243 |
cReducedQuality:= false; |
2698 | 244 |
cShowFPS:= true; |
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
|
245 |
|
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
|
246 |
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
|
247 |
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
|
248 |
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
|
249 |
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
|
250 |
cLocaleFName:= gameArgs[4]; |
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 |
val(gameArgs[5], cInitVolume); |
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 |
cAltDamage:= gameArgs[6] = '1'; |
2600 | 253 |
{$ENDIF} |
2698 | 254 |
|
255 |
for p:= Succ(Low(TPathType)) to High(TPathType) do |
|
256 |
if p <> ptMapCurrent then Pathz[p]:= PathPrefix + '/' + Pathz[p]; |
|
257 |
||
258 |
WriteToConsole('Init SDL... '); |
|
2714
c85ffe57d971
update iphone frontend to the new (silly) sdl api, code cleanups for other sections
koda
parents:
2705
diff
changeset
|
259 |
SDLTry(SDL_Init(SDL_INIT_VIDEO) >= 0, true); |
2698 | 260 |
WriteLnToConsole(msgOK); |
261 |
||
262 |
SDL_EnableUNICODE(1); |
|
263 |
||
264 |
WriteToConsole('Init SDL_ttf... '); |
|
2716
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
265 |
SDLTry(TTF_Init() <> -1, true); |
2698 | 266 |
WriteLnToConsole(msgOK); |
267 |
||
2716
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
268 |
ShowMainWindow(); |
2698 | 269 |
|
2716
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
270 |
AddProgress(); |
2698 | 271 |
|
2716
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
272 |
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
|
273 |
InitKbdKeyTable(); |
2698 | 274 |
|
275 |
if recordFileName = '' then |
|
276 |
InitIPC; |
|
277 |
WriteLnToConsole(msgGettingConfig); |
|
278 |
||
2719 | 279 |
LoadLocale(Pathz[ptLocale] + '/en.txt'); // Do an initial load with english |
2698 | 280 |
if cLocaleFName <> 'en.txt' then |
2719 | 281 |
begin |
282 |
// Try two letter locale first before trying specific locale overrides |
|
2722 | 283 |
if (Length(cLocaleFName) > 6) and (Copy(cLocaleFName,1,2)+'.txt' <> 'en.txt') then |
284 |
LoadLocale(Pathz[ptLocale] + '/' + Copy(cLocaleFName,1,2)+'.txt'); |
|
2719 | 285 |
LoadLocale(Pathz[ptLocale] + '/' + cLocaleFName); |
286 |
end; |
|
2698 | 287 |
|
288 |
if recordFileName = '' then |
|
289 |
SendIPCAndWaitReply('C') // ask for game config |
|
290 |
else |
|
291 |
LoadRecordFromFile(recordFileName); |
|
292 |
||
293 |
s:= 'eproto ' + inttostr(cNetProtoVersion); |
|
294 |
SendIPCRaw(@s[0], Length(s) + 1); // send proto version |
|
295 |
||
2716
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
296 |
InitTeams(); |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
297 |
AssignStores(); |
2590 | 298 |
|
2698 | 299 |
if isSoundEnabled then |
2716
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
300 |
InitSound(); |
2698 | 301 |
|
302 |
isDeveloperMode:= false; |
|
303 |
||
304 |
TryDo(InitStepsFlags = cifAllInited, 'Some parameters not set (flags = ' + inttostr(InitStepsFlags) + ')', true); |
|
305 |
||
306 |
MainLoop(); |
|
307 |
OnDestroy(); |
|
308 |
exit(); |
|
309 |
end; |
|
2590 | 310 |
|
2699
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
311 |
procedure initEverything; |
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
312 |
begin |
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
313 |
init_uConsts(); |
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
314 |
init_uMisc(); |
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
315 |
init_uConsole(); // MUST happen after uMisc |
2716
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
316 |
|
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
317 |
init_uAI(); |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
318 |
//uAIActions does not need initialization |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
319 |
//uAIAmmoTests does not need initialization |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
320 |
init_uAIMisc(); |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
321 |
init_uAmmos(); |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
322 |
init_uChat(); |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
323 |
init_uCollisions(); |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
324 |
//uFloat does not need initialization |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
325 |
//uGame does not need initialization |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
326 |
init_uGears(); |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
327 |
init_uIO(); |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
328 |
init_uKeys(); |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
329 |
init_uLand(); |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
330 |
//uLandGraphics does not need initialization |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
331 |
//uLandObjects does not need initialization |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
332 |
//uLandTemplates does not need initialization |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
333 |
//uLandTexture does not need initialization |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
334 |
//uLocale does not need initialization |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
335 |
init_uRandom(); |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
336 |
//uSHA does not need initialization |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
337 |
init_uSound(); |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
338 |
init_uStats(); |
2699
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
339 |
init_uStore(); |
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
340 |
init_uTeams(); |
2716
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
341 |
init_uTriggers(); |
2699
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
342 |
init_uVisualGears(); |
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
343 |
init_uWorld(); |
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
344 |
end; |
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
345 |
|
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
346 |
procedure freeEverything; |
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
347 |
begin |
2716
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
348 |
free_uWorld(); |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
349 |
free_uVisualGears(); //stub |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
350 |
free_uTriggers(); //stub |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
351 |
free_uTeams(); |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
352 |
free_uStore(); |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
353 |
free_uStats(); //stub |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
354 |
free_uSound(); //stub |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
355 |
//uSHA does not need to be freed |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
356 |
free_uRandom(); //stub |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
357 |
//uLocale does not need to be freed |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
358 |
//uLandTemplates does not need to be freed |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
359 |
//uLandTexture does not need to be freed |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
360 |
//uLandObjects does not need to be freed |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
361 |
//uLandGraphics does not need to be freed |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
362 |
free_uLand(); |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
363 |
free_uKeys(); //stub |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
364 |
free_uIO(); |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
365 |
free_uGears(); |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
366 |
//uGame does not need to be freed |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
367 |
//uFloat does not need to be freed |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
368 |
free_uCollisions(); |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
369 |
free_uChat(); |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
370 |
free_uAmmos(); |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
371 |
free_uAIMisc(); //stub |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
372 |
//uAIAmmoTests does not need to be freed |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
373 |
//uAIActions does not need to be freed |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
374 |
free_uAI(); //stub |
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
375 |
|
2699
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
376 |
free_uConsole(); |
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
377 |
free_uMisc(); |
2716
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
378 |
free_uConsts(); //stub |
2699
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
379 |
|
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
380 |
end; |
2698 | 381 |
{$IFNDEF IPHONEOS} |
382 |
///////////////////////// |
|
383 |
procedure GenLandPreview; |
|
384 |
var Preview: TPreview; |
|
2699
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
385 |
h: byte; |
2698 | 386 |
begin |
387 |
InitIPC; |
|
388 |
IPCWaitPongEvent; |
|
389 |
TryDo(InitStepsFlags = cifRandomize, 'Some parameters not set (flags = ' + inttostr(InitStepsFlags) + ')', true); |
|
390 |
||
391 |
Preview:= GenPreview; |
|
392 |
WriteLnToConsole('Sending preview...'); |
|
393 |
SendIPCRaw(@Preview, sizeof(Preview)); |
|
394 |
h:= MaxHedgehogs; |
|
395 |
SendIPCRaw(@h, sizeof(h)); |
|
396 |
WriteLnToConsole('Preview sent, disconnect'); |
|
397 |
CloseIPC(); |
|
398 |
end; |
|
399 |
||
400 |
//////////////////////////////// |
|
401 |
procedure Resize(w, h: LongInt); |
|
402 |
begin |
|
403 |
cScreenWidth:= w; |
|
404 |
cScreenHeight:= h; |
|
405 |
if cFullScreen then |
|
406 |
ParseCommand('/fullscr 1', true) |
|
407 |
else |
|
408 |
ParseCommand('/fullscr 0', true); |
|
51 | 409 |
end; |
410 |
||
2008 | 411 |
///////////////////// |
412 |
procedure DisplayUsage; |
|
2691 | 413 |
var i: LongInt; |
2008 | 414 |
begin |
415 |
WriteLn('Wrong argument format: correct configurations is'); |
|
416 |
WriteLn(); |
|
417 |
WriteLn(' hwengine <path to data folder> <path to replay file> [option]'); |
|
418 |
WriteLn(); |
|
419 |
WriteLn('where [option] must be specified either as'); |
|
2264 | 420 |
WriteLn(' --set-video [screen width] [screen height] [color dept]'); |
2008 | 421 |
WriteLn(' --set-audio [volume] [enable music] [enable sounds]'); |
422 |
WriteLn(' --set-other [language file] [full screen] [show FPS]'); |
|
423 |
WriteLn(' --set-multimedia [screen height] [screen width] [color dept] [volume] [enable music] [enable sounds] [language file] [full screen]'); |
|
424 |
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]'); |
|
425 |
WriteLn(); |
|
2015 | 426 |
WriteLn('Read documentation online at http://www.hedgewars.org/node/1465 for more information'); |
2691 | 427 |
Write('parsed command: '); |
2698 | 428 |
for i:=0 to ParamCount do |
429 |
Write(ParamStr(i) + ' '); |
|
2691 | 430 |
WriteLn(); |
2015 | 431 |
halt(1); |
2008 | 432 |
end; |
433 |
||
51 | 434 |
//////////////////// |
435 |
procedure GetParams; |
|
267 | 436 |
{$IFDEF DEBUGFILE} |
2699
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
437 |
var i: LongInt; |
267 | 438 |
{$ENDIF} |
97
e7c1df9cce2c
- make the game be run from ${PREFIX}/bin with data in ${PREFIX}/share/hedgewars/Data
unc0rr
parents:
81
diff
changeset
|
439 |
begin |
267 | 440 |
|
2698 | 441 |
case ParamCount of |
442 |
17: begin |
|
443 |
val(ParamStr(2), cScreenWidth); |
|
444 |
val(ParamStr(3), cScreenHeight); |
|
2008 | 445 |
cInitWidth:= cScreenWidth; |
446 |
cInitHeight:= cScreenHeight; |
|
2698 | 447 |
cBitsStr:= ParamStr(4); |
2008 | 448 |
val(cBitsStr, cBits); |
2698 | 449 |
val(ParamStr(5), ipcPort); |
450 |
cFullScreen:= ParamStr(6) = '1'; |
|
451 |
isSoundEnabled:= ParamStr(7) = '1'; |
|
452 |
cVSyncInUse:= ParamStr(8) = '1'; |
|
453 |
cLocaleFName:= ParamStr(9); |
|
454 |
val(ParamStr(10), cInitVolume); |
|
455 |
val(ParamStr(11), cTimerInterval); |
|
456 |
PathPrefix:= ParamStr(12); |
|
457 |
cShowFPS:= ParamStr(13) = '1'; |
|
458 |
cAltDamage:= ParamStr(14) = '1'; |
|
459 |
UserNick:= DecodeBase64(ParamStr(15)); |
|
460 |
isMusicEnabled:= ParamStr(16) = '1'; |
|
461 |
cReducedQuality:= ParamStr(17) = '1'; |
|
462 |
end; |
|
463 |
3: begin |
|
464 |
val(ParamStr(2), ipcPort); |
|
465 |
GameType:= gmtLandPreview; |
|
466 |
if ParamStr(3) <> 'landpreview' then |
|
467 |
OutError(errmsgShouldntRun, true); |
|
468 |
end; |
|
469 |
2: begin |
|
470 |
PathPrefix:= ParamStr(1); |
|
471 |
recordFileName:= ParamStr(2); |
|
472 |
end; |
|
473 |
6: begin |
|
474 |
PathPrefix:= ParamStr(1); |
|
475 |
recordFileName:= ParamStr(2); |
|
476 |
||
477 |
if ParamStr(3) = '--set-video' then |
|
2008 | 478 |
begin |
2698 | 479 |
val(ParamStr(4), cScreenWidth); |
480 |
val(ParamStr(5), cScreenHeight); |
|
481 |
cInitWidth:= cScreenWidth; |
|
482 |
cInitHeight:= cScreenHeight; |
|
483 |
cBitsStr:= ParamStr(6); |
|
484 |
val(cBitsStr, cBits); |
|
2008 | 485 |
end |
486 |
else |
|
487 |
begin |
|
2698 | 488 |
if ParamStr(3) = '--set-audio' then |
489 |
begin |
|
490 |
val(ParamStr(4), cInitVolume); |
|
491 |
isMusicEnabled:= ParamStr(5) = '1'; |
|
492 |
isSoundEnabled:= ParamStr(6) = '1'; |
|
493 |
end |
|
494 |
else |
|
2008 | 495 |
begin |
2698 | 496 |
if ParamStr(3) = '--set-other' then |
497 |
begin |
|
498 |
cLocaleFName:= ParamStr(4); |
|
499 |
cFullScreen:= ParamStr(5) = '1'; |
|
500 |
cShowFPS:= ParamStr(6) = '1'; |
|
501 |
end |
|
502 |
else DisplayUsage; |
|
2008 | 503 |
end |
2698 | 504 |
end; |
2008 | 505 |
end; |
2698 | 506 |
11: begin |
507 |
PathPrefix:= ParamStr(1); |
|
508 |
recordFileName:= ParamStr(2); |
|
2376 | 509 |
|
2698 | 510 |
if ParamStr(3) = '--set-multimedia' then |
511 |
begin |
|
512 |
val(ParamStr(4), cScreenWidth); |
|
513 |
val(ParamStr(5), cScreenHeight); |
|
514 |
cInitWidth:= cScreenWidth; |
|
515 |
cInitHeight:= cScreenHeight; |
|
516 |
cBitsStr:= ParamStr(6); |
|
517 |
val(cBitsStr, cBits); |
|
518 |
val(ParamStr(7), cInitVolume); |
|
519 |
isMusicEnabled:= ParamStr(8) = '1'; |
|
520 |
isSoundEnabled:= ParamStr(9) = '1'; |
|
521 |
cLocaleFName:= ParamStr(10); |
|
522 |
cFullScreen:= ParamStr(11) = '1'; |
|
523 |
end |
|
524 |
else DisplayUsage; |
|
525 |
end; |
|
526 |
15: begin |
|
527 |
PathPrefix:= ParamStr(1); |
|
528 |
recordFileName:= ParamStr(2); |
|
529 |
if ParamStr(3) = '--set-everything' then |
|
530 |
begin |
|
531 |
val(ParamStr(4), cScreenWidth); |
|
532 |
val(ParamStr(5), cScreenHeight); |
|
533 |
cInitWidth:= cScreenWidth; |
|
534 |
cInitHeight:= cScreenHeight; |
|
535 |
cBitsStr:= ParamStr(6); |
|
536 |
val(cBitsStr, cBits); |
|
537 |
val(ParamStr(7), cInitVolume); |
|
538 |
isMusicEnabled:= ParamStr(8) = '1'; |
|
539 |
isSoundEnabled:= ParamStr(9) = '1'; |
|
540 |
cLocaleFName:= ParamStr(10); |
|
541 |
cFullScreen:= ParamStr(11) = '1'; |
|
542 |
cAltDamage:= ParamStr(12) = '1'; |
|
543 |
cShowFPS:= ParamStr(13) = '1'; |
|
544 |
val(ParamStr(14), cTimerInterval); |
|
545 |
cReducedQuality:= ParamStr(15) = '1'; |
|
546 |
end |
|
547 |
else DisplayUsage; |
|
548 |
end; |
|
2008 | 549 |
else DisplayUsage; |
550 |
end; |
|
2630 | 551 |
|
552 |
{$IFDEF DEBUGFILE} |
|
2698 | 553 |
AddFileLog('Prefix: "' + PathPrefix +'"'); |
554 |
for i:= 0 to ParamCount do |
|
555 |
AddFileLog(inttostr(i) + ': ' + ParamStr(i)); |
|
2630 | 556 |
{$IFDEF IPHONEOS} |
2690 | 557 |
WriteLnToConsole('Saving debug file at: ' + IPH_getDocumentsPath()); |
2630 | 558 |
{$ENDIF} |
559 |
{$ENDIF} |
|
51 | 560 |
end; |
155
401f4ea24715
Engine can generate land preview and send it via IPC
unc0rr
parents:
109
diff
changeset
|
561 |
//////////////////////////////////////////////////////////////////////////////// |
401f4ea24715
Engine can generate land preview and send it via IPC
unc0rr
parents:
109
diff
changeset
|
562 |
/////////////////////////////// m a i n //////////////////////////////////////// |
401f4ea24715
Engine can generate land preview and send it via IPC
unc0rr
parents:
109
diff
changeset
|
563 |
//////////////////////////////////////////////////////////////////////////////// |
401f4ea24715
Engine can generate land preview and send it via IPC
unc0rr
parents:
109
diff
changeset
|
564 |
|
401f4ea24715
Engine can generate land preview and send it via IPC
unc0rr
parents:
109
diff
changeset
|
565 |
begin |
2699
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
566 |
initEverything(); |
2692
ce9992075118
better network support + initial work for returning to frontend
koda
parents:
2691
diff
changeset
|
567 |
WriteLnToConsole('Hedgewars ' + cVersionString + ' engine (network protocol: ' + inttostr(cNetProtoVersion) + ')'); |
2699
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
568 |
|
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
569 |
GetParams(); |
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
570 |
Randomize(); |
2008 | 571 |
|
2699
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
572 |
if GameType = gmtLandPreview then GenLandPreview() |
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
573 |
else Game(); |
2716
b9ca1bfca24f
complete the replacement of init/free wrappers for every unit
koda
parents:
2715
diff
changeset
|
574 |
ExitCode:= 0; |
2698 | 575 |
{$ENDIF} |
51 | 576 |
end. |