author | koda |
Thu, 07 Jan 2010 05:23:23 +0000 | |
changeset 2678 | 334016e8d895 |
parent 2677 | 83ad68ceef72 |
child 2682 | d4c395f25db2 |
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 |
|
51 | 21 |
program hwengine; |
2678
334016e8d895
injection of custom code in SDL for iPhone in order to implement our frontend
koda
parents:
2677
diff
changeset
|
22 |
uses |
334016e8d895
injection of custom code in SDL for iPhone in order to implement our frontend
koda
parents:
2677
diff
changeset
|
23 |
SDLh in 'SDLh.pas', |
2152 | 24 |
{$IFDEF GLES11} |
1906 | 25 |
gles11, |
26 |
{$ELSE} |
|
1524
5a652a465559
Draw world before processing gears, as this should improve performance by introducing cpu-gpu parallelizm
unc0rr
parents:
1128
diff
changeset
|
27 |
GL, |
1906 | 28 |
{$ENDIF} |
1524
5a652a465559
Draw world before processing gears, as this should improve performance by introducing cpu-gpu parallelizm
unc0rr
parents:
1128
diff
changeset
|
29 |
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
|
30 |
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
|
31 |
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
|
32 |
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
|
33 |
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
|
34 |
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
|
35 |
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
|
36 |
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
|
37 |
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
|
38 |
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
|
39 |
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
|
40 |
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
|
41 |
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
|
42 |
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
|
43 |
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
|
44 |
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
|
45 |
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
|
46 |
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
|
47 |
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
|
48 |
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
|
49 |
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
|
50 |
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
|
51 |
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
|
52 |
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
|
53 |
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
|
54 |
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
|
55 |
uStats in 'uStats.pas', |
1807 | 56 |
uChat in 'uChat.pas', |
2008 | 57 |
uLandTexture in 'uLandTexture.pas'; |
51 | 58 |
|
59 |
// also: GSHandlers.inc |
|
60 |
// CCHandlers.inc |
|
61 |
// HHHandlers.inc |
|
357 | 62 |
// SinTable.inc |
271 | 63 |
// proto.inc |
51 | 64 |
|
1888
e76274ce7365
Add an ability to run engine without IPC connection.
unc0rr
parents:
1825
diff
changeset
|
65 |
var recordFileName : shortstring = ''; |
51 | 66 |
|
67 |
procedure OnDestroy; forward; |
|
68 |
||
69 |
//////////////////////////////// |
|
371 | 70 |
procedure DoTimer(Lag: LongInt); |
2243
b4764993f833
additional touch support and nemo's reduced land array size
koda
parents:
2191
diff
changeset
|
71 |
{$IFNDEF IPHONEOS} |
1080 | 72 |
var s: string; |
2243
b4764993f833
additional touch support and nemo's reduced land array size
koda
parents:
2191
diff
changeset
|
73 |
{$ENDIF} |
51 | 74 |
begin |
564 | 75 |
inc(RealTicks, Lag); |
76 |
||
51 | 77 |
case GameState of |
1524
5a652a465559
Draw world before processing gears, as this should improve performance by introducing cpu-gpu parallelizm
unc0rr
parents:
1128
diff
changeset
|
78 |
gsLandGen: begin |
5a652a465559
Draw world before processing gears, as this should improve performance by introducing cpu-gpu parallelizm
unc0rr
parents:
1128
diff
changeset
|
79 |
GenMap; |
5a652a465559
Draw world before processing gears, as this should improve performance by introducing cpu-gpu parallelizm
unc0rr
parents:
1128
diff
changeset
|
80 |
GameState:= gsStart; |
5a652a465559
Draw world before processing gears, as this should improve performance by introducing cpu-gpu parallelizm
unc0rr
parents:
1128
diff
changeset
|
81 |
end; |
5a652a465559
Draw world before processing gears, as this should improve performance by introducing cpu-gpu parallelizm
unc0rr
parents:
1128
diff
changeset
|
82 |
gsStart: begin |
1784 | 83 |
if HasBorder then DisableSomeWeapons; |
1524
5a652a465559
Draw world before processing gears, as this should improve performance by introducing cpu-gpu parallelizm
unc0rr
parents:
1128
diff
changeset
|
84 |
AddClouds; |
5a652a465559
Draw world before processing gears, as this should improve performance by introducing cpu-gpu parallelizm
unc0rr
parents:
1128
diff
changeset
|
85 |
AssignHHCoords; |
5a652a465559
Draw world before processing gears, as this should improve performance by introducing cpu-gpu parallelizm
unc0rr
parents:
1128
diff
changeset
|
86 |
AddMiscGears; |
5a652a465559
Draw world before processing gears, as this should improve performance by introducing cpu-gpu parallelizm
unc0rr
parents:
1128
diff
changeset
|
87 |
StoreLoad; |
2428 | 88 |
InitWorld; |
1524
5a652a465559
Draw world before processing gears, as this should improve performance by introducing cpu-gpu parallelizm
unc0rr
parents:
1128
diff
changeset
|
89 |
ResetKbd; |
5a652a465559
Draw world before processing gears, as this should improve performance by introducing cpu-gpu parallelizm
unc0rr
parents:
1128
diff
changeset
|
90 |
SoundLoad; |
5a652a465559
Draw world before processing gears, as this should improve performance by introducing cpu-gpu parallelizm
unc0rr
parents:
1128
diff
changeset
|
91 |
if GameType = gmtSave then |
5a652a465559
Draw world before processing gears, as this should improve performance by introducing cpu-gpu parallelizm
unc0rr
parents:
1128
diff
changeset
|
92 |
begin |
5a652a465559
Draw world before processing gears, as this should improve performance by introducing cpu-gpu parallelizm
unc0rr
parents:
1128
diff
changeset
|
93 |
isSEBackup:= isSoundEnabled; |
5a652a465559
Draw world before processing gears, as this should improve performance by introducing cpu-gpu parallelizm
unc0rr
parents:
1128
diff
changeset
|
94 |
isSoundEnabled:= false |
5a652a465559
Draw world before processing gears, as this should improve performance by introducing cpu-gpu parallelizm
unc0rr
parents:
1128
diff
changeset
|
95 |
end; |
5a652a465559
Draw world before processing gears, as this should improve performance by introducing cpu-gpu parallelizm
unc0rr
parents:
1128
diff
changeset
|
96 |
FinishProgress; |
5a652a465559
Draw world before processing gears, as this should improve performance by introducing cpu-gpu parallelizm
unc0rr
parents:
1128
diff
changeset
|
97 |
PlayMusic; |
2162 | 98 |
SetScale(zoom); |
1524
5a652a465559
Draw world before processing gears, as this should improve performance by introducing cpu-gpu parallelizm
unc0rr
parents:
1128
diff
changeset
|
99 |
GameState:= gsGame |
5a652a465559
Draw world before processing gears, as this should improve performance by introducing cpu-gpu parallelizm
unc0rr
parents:
1128
diff
changeset
|
100 |
end; |
5a652a465559
Draw world before processing gears, as this should improve performance by introducing cpu-gpu parallelizm
unc0rr
parents:
1128
diff
changeset
|
101 |
gsConfirm, |
5a652a465559
Draw world before processing gears, as this should improve performance by introducing cpu-gpu parallelizm
unc0rr
parents:
1128
diff
changeset
|
102 |
gsGame: begin |
1645 | 103 |
DrawWorld(Lag); // never place between ProcessKbd and DoGameTick - bugs due to /put cmd and isCursorVisible |
1524
5a652a465559
Draw world before processing gears, as this should improve performance by introducing cpu-gpu parallelizm
unc0rr
parents:
1128
diff
changeset
|
104 |
ProcessKbd; |
5a652a465559
Draw world before processing gears, as this should improve performance by introducing cpu-gpu parallelizm
unc0rr
parents:
1128
diff
changeset
|
105 |
DoGameTick(Lag); |
5a652a465559
Draw world before processing gears, as this should improve performance by introducing cpu-gpu parallelizm
unc0rr
parents:
1128
diff
changeset
|
106 |
ProcessVisualGears(Lag); |
5a652a465559
Draw world before processing gears, as this should improve performance by introducing cpu-gpu parallelizm
unc0rr
parents:
1128
diff
changeset
|
107 |
end; |
5a652a465559
Draw world before processing gears, as this should improve performance by introducing cpu-gpu parallelizm
unc0rr
parents:
1128
diff
changeset
|
108 |
gsChat: begin |
5a652a465559
Draw world before processing gears, as this should improve performance by introducing cpu-gpu parallelizm
unc0rr
parents:
1128
diff
changeset
|
109 |
DrawWorld(Lag); |
5a652a465559
Draw world before processing gears, as this should improve performance by introducing cpu-gpu parallelizm
unc0rr
parents:
1128
diff
changeset
|
110 |
DoGameTick(Lag); |
5a652a465559
Draw world before processing gears, as this should improve performance by introducing cpu-gpu parallelizm
unc0rr
parents:
1128
diff
changeset
|
111 |
ProcessVisualGears(Lag); |
5a652a465559
Draw world before processing gears, as this should improve performance by introducing cpu-gpu parallelizm
unc0rr
parents:
1128
diff
changeset
|
112 |
end; |
5a652a465559
Draw world before processing gears, as this should improve performance by introducing cpu-gpu parallelizm
unc0rr
parents:
1128
diff
changeset
|
113 |
gsExit: begin |
5a652a465559
Draw world before processing gears, as this should improve performance by introducing cpu-gpu parallelizm
unc0rr
parents:
1128
diff
changeset
|
114 |
OnDestroy; |
5a652a465559
Draw world before processing gears, as this should improve performance by introducing cpu-gpu parallelizm
unc0rr
parents:
1128
diff
changeset
|
115 |
end; |
5a652a465559
Draw world before processing gears, as this should improve performance by introducing cpu-gpu parallelizm
unc0rr
parents:
1128
diff
changeset
|
116 |
end; |
564 | 117 |
|
753 | 118 |
SDL_GL_SwapBuffers(); |
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
|
119 |
{$IFNDEF IPHONEOS} |
2678
334016e8d895
injection of custom code in SDL for iPhone in order to implement our frontend
koda
parents:
2677
diff
changeset
|
120 |
// not going to make captures on the iPhone (nor resizing) |
51 | 121 |
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
|
122 |
begin |
5a652a465559
Draw world before processing gears, as this should improve performance by introducing cpu-gpu parallelizm
unc0rr
parents:
1128
diff
changeset
|
123 |
flagMakeCapture:= false; |
5a652a465559
Draw world before processing gears, as this should improve performance by introducing cpu-gpu parallelizm
unc0rr
parents:
1128
diff
changeset
|
124 |
s:= 'hw_' + cSeed + '_' + inttostr(GameTicks) + '.tga'; |
5a652a465559
Draw world before processing gears, as this should improve performance by introducing cpu-gpu parallelizm
unc0rr
parents:
1128
diff
changeset
|
125 |
WriteLnToConsole('Saving ' + s); |
5a652a465559
Draw world before processing gears, as this should improve performance by introducing cpu-gpu parallelizm
unc0rr
parents:
1128
diff
changeset
|
126 |
MakeScreenshot(s); |
5a652a465559
Draw world before processing gears, as this should improve performance by introducing cpu-gpu parallelizm
unc0rr
parents:
1128
diff
changeset
|
127 |
// SDL_SaveBMP_RW(SDLPrimSurface, SDL_RWFromFile(Str2PChar(s), 'wb'), 1) |
5a652a465559
Draw world before processing gears, as this should improve performance by introducing cpu-gpu parallelizm
unc0rr
parents:
1128
diff
changeset
|
128 |
end; |
2678
334016e8d895
injection of custom code in SDL for iPhone in order to implement our frontend
koda
parents:
2677
diff
changeset
|
129 |
end; |
334016e8d895
injection of custom code in SDL for iPhone in order to implement our frontend
koda
parents:
2677
diff
changeset
|
130 |
|
334016e8d895
injection of custom code in SDL for iPhone in order to implement our frontend
koda
parents:
2677
diff
changeset
|
131 |
//////////////////////////////// |
334016e8d895
injection of custom code in SDL for iPhone in order to implement our frontend
koda
parents:
2677
diff
changeset
|
132 |
procedure Resize(w, h: LongInt); |
334016e8d895
injection of custom code in SDL for iPhone in order to implement our frontend
koda
parents:
2677
diff
changeset
|
133 |
begin |
334016e8d895
injection of custom code in SDL for iPhone in order to implement our frontend
koda
parents:
2677
diff
changeset
|
134 |
cScreenWidth:= w; |
334016e8d895
injection of custom code in SDL for iPhone in order to implement our frontend
koda
parents:
2677
diff
changeset
|
135 |
cScreenHeight:= h; |
334016e8d895
injection of custom code in SDL for iPhone in order to implement our frontend
koda
parents:
2677
diff
changeset
|
136 |
if cFullScreen then |
334016e8d895
injection of custom code in SDL for iPhone in order to implement our frontend
koda
parents:
2677
diff
changeset
|
137 |
ParseCommand('/fullscr 1', true) |
334016e8d895
injection of custom code in SDL for iPhone in order to implement our frontend
koda
parents:
2677
diff
changeset
|
138 |
else |
334016e8d895
injection of custom code in SDL for iPhone in order to implement our frontend
koda
parents:
2677
diff
changeset
|
139 |
ParseCommand('/fullscr 0', true); |
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
|
140 |
{$ENDIF} |
51 | 141 |
end; |
142 |
||
143 |
//////////////////// |
|
79 | 144 |
procedure OnDestroy; |
51 | 145 |
begin |
146 |
{$IFDEF DEBUGFILE}AddFileLog('Freeing resources...');{$ENDIF} |
|
147 |
if isSoundEnabled then ReleaseSound; |
|
619 | 148 |
StoreRelease; |
1807 | 149 |
FreeLand; |
619 | 150 |
SendKB; |
51 | 151 |
CloseIPC; |
152 |
TTF_Quit; |
|
153 |
SDL_Quit; |
|
154 |
halt |
|
155 |
end; |
|
156 |
||
157 |
/////////////////// |
|
158 |
procedure MainLoop; |
|
159 |
var PrevTime, |
|
188 | 160 |
CurrTime: Longword; |
51 | 161 |
event: TSDL_Event; |
2591
c6597b65caea
other controls implementation + sdlh revisited (once again)
koda
parents:
2590
diff
changeset
|
162 |
{$IFDEF TOUCHINPUT} |
2579 | 163 |
type TDirection = (nodir, left, right); |
2678
334016e8d895
injection of custom code in SDL for iPhone in order to implement our frontend
koda
parents:
2677
diff
changeset
|
164 |
var tiltValue: LongInt; |
2590 | 165 |
direction: TDirection = nodir; |
2591
c6597b65caea
other controls implementation + sdlh revisited (once again)
koda
parents:
2590
diff
changeset
|
166 |
movedbybuttons: boolean = false; |
2569 | 167 |
{$ENDIF} |
51 | 168 |
begin |
169 |
PrevTime:= SDL_GetTicks; |
|
170 |
repeat |
|
171 |
while SDL_PollEvent(@event) <> 0 do |
|
2590 | 172 |
{$IFDEF TOUCHINPUT} |
2591
c6597b65caea
other controls implementation + sdlh revisited (once again)
koda
parents:
2590
diff
changeset
|
173 |
if (direction <> nodir) and (movedbybuttons = true) then |
2590 | 174 |
begin |
2600 | 175 |
WriteLnToConsole('* Hedgehog moving *'); |
2590 | 176 |
uKeys.isWalking:= true; |
177 |
if direction = left then uKeys.leftKey:= true |
|
178 |
else if direction = right then uKeys.rightKey:= true; |
|
179 |
end |
|
180 |
else uKeys.isWalking:= false; |
|
181 |
{$ENDIF} |
|
1120 | 182 |
case event.type_ of |
2586
204e6b2885bc
added little/big endian checks, added symbol for touch input, simplified iphoneos definitions
koda
parents:
2581
diff
changeset
|
183 |
{$IFDEF SDL13} |
2678
334016e8d895
injection of custom code in SDL for iPhone in order to implement our frontend
koda
parents:
2677
diff
changeset
|
184 |
SDL_WINDOWEVENT: |
2390 | 185 |
{$ELSE} |
1120 | 186 |
SDL_KEYDOWN: if GameState = gsChat then KeyPressChat(event.key.keysym.unicode); |
2678
334016e8d895
injection of custom code in SDL for iPhone in order to implement our frontend
koda
parents:
2677
diff
changeset
|
187 |
SDL_ACTIVEEVENT: |
2390 | 188 |
{$ENDIF} |
2678
334016e8d895
injection of custom code in SDL for iPhone in order to implement our frontend
koda
parents:
2677
diff
changeset
|
189 |
if (event.active.state and SDL_APPINPUTFOCUS) <> 0 then |
1120 | 190 |
cHasFocus:= event.active.gain = 1; |
1127 | 191 |
//SDL_VIDEORESIZE: Resize(max(event.resize.w, 600), max(event.resize.h, 450)); |
2586
204e6b2885bc
added little/big endian checks, added symbol for touch input, simplified iphoneos definitions
koda
parents:
2581
diff
changeset
|
192 |
{$IFDEF IPHONEOS} |
2630 | 193 |
(* SDL_JOYAXISMOTION: begin |
2580
aeccc8f51d3f
completes touch input/control (problems with moving camera)
koda
parents:
2579
diff
changeset
|
194 |
{* axis 0 = left and right; |
aeccc8f51d3f
completes touch input/control (problems with moving camera)
koda
parents:
2579
diff
changeset
|
195 |
axis 1 = up and down; |
aeccc8f51d3f
completes touch input/control (problems with moving camera)
koda
parents:
2579
diff
changeset
|
196 |
axis 2 = back and forth; *} |
2591
c6597b65caea
other controls implementation + sdlh revisited (once again)
koda
parents:
2590
diff
changeset
|
197 |
|
2678
334016e8d895
injection of custom code in SDL for iPhone in order to implement our frontend
koda
parents:
2677
diff
changeset
|
198 |
WriteLnToConsole('********************************************* accelerometer'); |
2591
c6597b65caea
other controls implementation + sdlh revisited (once again)
koda
parents:
2590
diff
changeset
|
199 |
|
2633 | 200 |
tiltValue:= SDL_JoystickGetAxis(uKeys.theJoystick, 0); |
2591
c6597b65caea
other controls implementation + sdlh revisited (once again)
koda
parents:
2590
diff
changeset
|
201 |
|
2678
334016e8d895
injection of custom code in SDL for iPhone in order to implement our frontend
koda
parents:
2677
diff
changeset
|
202 |
if (CurrentTeam <> nil) then |
334016e8d895
injection of custom code in SDL for iPhone in order to implement our frontend
koda
parents:
2677
diff
changeset
|
203 |
begin |
2600 | 204 |
{$IFDEF DEBUGFILE} |
2591
c6597b65caea
other controls implementation + sdlh revisited (once again)
koda
parents:
2590
diff
changeset
|
205 |
AddFileLog('Joystick: 0; Axis: 0; Value: ' + inttostr(tiltValue)); |
2600 | 206 |
{$ENDIF} |
2678
334016e8d895
injection of custom code in SDL for iPhone in order to implement our frontend
koda
parents:
2677
diff
changeset
|
207 |
if tiltValue > 1500 then |
334016e8d895
injection of custom code in SDL for iPhone in order to implement our frontend
koda
parents:
2677
diff
changeset
|
208 |
begin |
334016e8d895
injection of custom code in SDL for iPhone in order to implement our frontend
koda
parents:
2677
diff
changeset
|
209 |
uKeys.rightKey:= true; |
2591
c6597b65caea
other controls implementation + sdlh revisited (once again)
koda
parents:
2590
diff
changeset
|
210 |
uKeys.isWalking:= true; |
2678
334016e8d895
injection of custom code in SDL for iPhone in order to implement our frontend
koda
parents:
2677
diff
changeset
|
211 |
end |
334016e8d895
injection of custom code in SDL for iPhone in order to implement our frontend
koda
parents:
2677
diff
changeset
|
212 |
else |
334016e8d895
injection of custom code in SDL for iPhone in order to implement our frontend
koda
parents:
2677
diff
changeset
|
213 |
if tiltValue <= -1500 then |
334016e8d895
injection of custom code in SDL for iPhone in order to implement our frontend
koda
parents:
2677
diff
changeset
|
214 |
begin |
334016e8d895
injection of custom code in SDL for iPhone in order to implement our frontend
koda
parents:
2677
diff
changeset
|
215 |
uKeys.leftKey:= true; |
334016e8d895
injection of custom code in SDL for iPhone in order to implement our frontend
koda
parents:
2677
diff
changeset
|
216 |
uKeys.isWalking:= true; |
334016e8d895
injection of custom code in SDL for iPhone in order to implement our frontend
koda
parents:
2677
diff
changeset
|
217 |
end |
334016e8d895
injection of custom code in SDL for iPhone in order to implement our frontend
koda
parents:
2677
diff
changeset
|
218 |
else |
334016e8d895
injection of custom code in SDL for iPhone in order to implement our frontend
koda
parents:
2677
diff
changeset
|
219 |
if (tiltValue > -1500) and (tiltValue <= 1500) and (movedbybuttons = false) then uKeys.isWalking:= false; |
2577 | 220 |
end; |
2678
334016e8d895
injection of custom code in SDL for iPhone in order to implement our frontend
koda
parents:
2677
diff
changeset
|
221 |
end;*) |
2567 | 222 |
{$ELSE} |
2379 | 223 |
SDL_MOUSEBUTTONDOWN: if event.button.button = SDL_BUTTON_WHEELDOWN then uKeys.wheelDown:= true; |
2667 | 224 |
SDL_MOUSEBUTTONUP: if event.button.button = SDL_BUTTON_WHEELUP then uKeys.wheelUp:= true; |
2591
c6597b65caea
other controls implementation + sdlh revisited (once again)
koda
parents:
2590
diff
changeset
|
225 |
SDL_JOYAXISMOTION: ControllerAxisEvent(event.jaxis.which, event.jaxis.axis, event.jaxis.value); |
c6597b65caea
other controls implementation + sdlh revisited (once again)
koda
parents:
2590
diff
changeset
|
226 |
SDL_JOYHATMOTION: ControllerHatEvent(event.jhat.which, event.jhat.hat, event.jhat.value); |
2428 | 227 |
SDL_JOYBUTTONDOWN: ControllerButtonEvent(event.jbutton.which, event.jbutton.button, true); |
228 |
SDL_JOYBUTTONUP: ControllerButtonEvent(event.jbutton.which, event.jbutton.button, false); |
|
2577 | 229 |
{$ENDIF} |
1120 | 230 |
SDL_QUITEV: isTerminated:= true |
2590 | 231 |
end; |
232 |
||
51 | 233 |
CurrTime:= SDL_GetTicks; |
234 |
if PrevTime + cTimerInterval <= CurrTime then |
|
235 |
begin |
|
236 |
DoTimer(CurrTime - PrevTime); |
|
237 |
PrevTime:= CurrTime |
|
434 | 238 |
end else SDL_Delay(1); |
51 | 239 |
IPCCheckSock |
240 |
until isTerminated |
|
2590 | 241 |
|
51 | 242 |
end; |
243 |
||
2008 | 244 |
///////////////////// |
245 |
procedure DisplayUsage; |
|
246 |
begin |
|
247 |
WriteLn('Wrong argument format: correct configurations is'); |
|
248 |
WriteLn(); |
|
249 |
WriteLn(' hwengine <path to data folder> <path to replay file> [option]'); |
|
250 |
WriteLn(); |
|
251 |
WriteLn('where [option] must be specified either as'); |
|
2264 | 252 |
WriteLn(' --set-video [screen width] [screen height] [color dept]'); |
2008 | 253 |
WriteLn(' --set-audio [volume] [enable music] [enable sounds]'); |
254 |
WriteLn(' --set-other [language file] [full screen] [show FPS]'); |
|
255 |
WriteLn(' --set-multimedia [screen height] [screen width] [color dept] [volume] [enable music] [enable sounds] [language file] [full screen]'); |
|
256 |
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]'); |
|
257 |
WriteLn(); |
|
2015 | 258 |
WriteLn('Read documentation online at http://www.hedgewars.org/node/1465 for more information'); |
259 |
halt(1); |
|
2008 | 260 |
end; |
261 |
||
51 | 262 |
//////////////////// |
263 |
procedure GetParams; |
|
889 | 264 |
var |
267 | 265 |
{$IFDEF DEBUGFILE} |
371 | 266 |
i: LongInt; |
267 | 267 |
{$ENDIF} |
97
e7c1df9cce2c
- make the game be run from ${PREFIX}/bin with data in ${PREFIX}/share/hedgewars/Data
unc0rr
parents:
81
diff
changeset
|
268 |
p: TPathType; |
e7c1df9cce2c
- make the game be run from ${PREFIX}/bin with data in ${PREFIX}/share/hedgewars/Data
unc0rr
parents:
81
diff
changeset
|
269 |
begin |
267 | 270 |
|
155
401f4ea24715
Engine can generate land preview and send it via IPC
unc0rr
parents:
109
diff
changeset
|
271 |
case ParamCount of |
2392
a55dbef5cf31
Smaxx's patch fixing openal sound issues with poor card drivers
koda
parents:
2390
diff
changeset
|
272 |
17: begin |
498 | 273 |
val(ParamStr(2), cScreenWidth); |
274 |
val(ParamStr(3), cScreenHeight); |
|
1121
d595dc56b4f3
Remember initial resolution settings to use when switching to fullscreen mode
unc0rr
parents:
1120
diff
changeset
|
275 |
cInitWidth:= cScreenWidth; |
d595dc56b4f3
Remember initial resolution settings to use when switching to fullscreen mode
unc0rr
parents:
1120
diff
changeset
|
276 |
cInitHeight:= cScreenHeight; |
497 | 277 |
cBitsStr:= ParamStr(4); |
498 | 278 |
val(cBitsStr, cBits); |
279 |
val(ParamStr(5), ipcPort); |
|
497 | 280 |
cFullScreen:= ParamStr(6) = '1'; |
281 |
isSoundEnabled:= ParamStr(7) = '1'; |
|
2671
7e0f88013fe8
smaller patches, one missing Sky-lowres, IMG_Init and Mix_Init (might require newer libraries), updates to SDL bindings, code cleanup, new compile flags
koda
parents:
2669
diff
changeset
|
282 |
cVSyncInUse:= ParamStr(8) = '1'; |
2392
a55dbef5cf31
Smaxx's patch fixing openal sound issues with poor card drivers
koda
parents:
2390
diff
changeset
|
283 |
cLocaleFName:= ParamStr(9); |
a55dbef5cf31
Smaxx's patch fixing openal sound issues with poor card drivers
koda
parents:
2390
diff
changeset
|
284 |
val(ParamStr(10), cInitVolume); |
a55dbef5cf31
Smaxx's patch fixing openal sound issues with poor card drivers
koda
parents:
2390
diff
changeset
|
285 |
val(ParamStr(11), cTimerInterval); |
a55dbef5cf31
Smaxx's patch fixing openal sound issues with poor card drivers
koda
parents:
2390
diff
changeset
|
286 |
PathPrefix:= ParamStr(12); |
a55dbef5cf31
Smaxx's patch fixing openal sound issues with poor card drivers
koda
parents:
2390
diff
changeset
|
287 |
cShowFPS:= ParamStr(13) = '1'; |
a55dbef5cf31
Smaxx's patch fixing openal sound issues with poor card drivers
koda
parents:
2390
diff
changeset
|
288 |
cAltDamage:= ParamStr(14) = '1'; |
a55dbef5cf31
Smaxx's patch fixing openal sound issues with poor card drivers
koda
parents:
2390
diff
changeset
|
289 |
UserNick:= DecodeBase64(ParamStr(15)); |
a55dbef5cf31
Smaxx's patch fixing openal sound issues with poor card drivers
koda
parents:
2390
diff
changeset
|
290 |
isMusicEnabled:= ParamStr(16) = '1'; |
a55dbef5cf31
Smaxx's patch fixing openal sound issues with poor card drivers
koda
parents:
2390
diff
changeset
|
291 |
cReducedQuality:= ParamStr(17) = '1'; |
267 | 292 |
for p:= Succ(Low(TPathType)) to High(TPathType) do |
949 | 293 |
if p <> ptMapCurrent then Pathz[p]:= PathPrefix + '/' + Pathz[p] |
155
401f4ea24715
Engine can generate land preview and send it via IPC
unc0rr
parents:
109
diff
changeset
|
294 |
end; |
2390 | 295 |
{$IFDEF IPHONEOS} |
2252 | 296 |
0: begin |
2663 | 297 |
PathPrefix:= 'Data'; |
298 |
recordFileName:= 'save.hws'; |
|
2630 | 299 |
val('320', cScreenWidth); |
300 |
val('480', cScreenHeight); |
|
301 |
cInitWidth:= cScreenWidth; |
|
302 |
cInitHeight:= cScreenHeight; |
|
303 |
cBitsStr:= '32'; |
|
304 |
val(cBitsStr, cBits); |
|
305 |
val('100', cInitVolume); |
|
306 |
isMusicEnabled:= false; |
|
307 |
isSoundEnabled:= false; |
|
308 |
cLocaleFName:= 'en.txt'; |
|
309 |
cFullScreen:= true; //T or F is is the same here |
|
310 |
cAltDamage:= false; |
|
311 |
cShowFPS:= true; |
|
312 |
val('8', cTimerInterval); |
|
313 |
cReducedQuality:= false; |
|
2252 | 314 |
|
315 |
for p:= Succ(Low(TPathType)) to High(TPathType) do |
|
2630 | 316 |
if p <> ptMapCurrent then Pathz[p]:= PathPrefix + '/' + Pathz[p] |
2252 | 317 |
end; |
2390 | 318 |
{$ENDIF} |
497 | 319 |
3: begin |
498 | 320 |
val(ParamStr(2), ipcPort); |
155
401f4ea24715
Engine can generate land preview and send it via IPC
unc0rr
parents:
109
diff
changeset
|
321 |
GameType:= gmtLandPreview; |
497 | 322 |
if ParamStr(3) <> 'landpreview' then OutError(errmsgShouldntRun, true); |
1888
e76274ce7365
Add an ability to run engine without IPC connection.
unc0rr
parents:
1825
diff
changeset
|
323 |
end; |
2008 | 324 |
2: begin |
325 |
PathPrefix:= ParamStr(1); |
|
326 |
recordFileName:= ParamStr(2); |
|
2376 | 327 |
|
2008 | 328 |
for p:= Succ(Low(TPathType)) to High(TPathType) do |
329 |
if p <> ptMapCurrent then Pathz[p]:= PathPrefix + '/' + Pathz[p] |
|
2630 | 330 |
end; |
2008 | 331 |
6: begin |
332 |
PathPrefix:= ParamStr(1); |
|
333 |
recordFileName:= ParamStr(2); |
|
2376 | 334 |
|
2008 | 335 |
if ParamStr(3) = '--set-video' then |
336 |
begin |
|
337 |
val(ParamStr(4), cScreenWidth); |
|
338 |
val(ParamStr(5), cScreenHeight); |
|
339 |
cInitWidth:= cScreenWidth; |
|
340 |
cInitHeight:= cScreenHeight; |
|
341 |
cBitsStr:= ParamStr(6); |
|
342 |
val(cBitsStr, cBits); |
|
343 |
end |
|
344 |
else |
|
345 |
begin |
|
346 |
if ParamStr(3) = '--set-audio' then |
|
347 |
begin |
|
348 |
val(ParamStr(4), cInitVolume); |
|
349 |
isMusicEnabled:= ParamStr(5) = '1'; |
|
350 |
isSoundEnabled:= ParamStr(6) = '1'; |
|
351 |
end |
|
352 |
else |
|
353 |
begin |
|
354 |
if ParamStr(3) = '--set-other' then |
|
355 |
begin |
|
356 |
cLocaleFName:= ParamStr(4); |
|
357 |
cFullScreen:= ParamStr(5) = '1'; |
|
358 |
cShowFPS:= ParamStr(6) = '1'; |
|
359 |
end |
|
360 |
else DisplayUsage; |
|
361 |
end |
|
362 |
end; |
|
2376 | 363 |
|
2008 | 364 |
for p:= Succ(Low(TPathType)) to High(TPathType) do |
365 |
if p <> ptMapCurrent then Pathz[p]:= PathPrefix + '/' + Pathz[p] |
|
366 |
end; |
|
367 |
11: begin |
|
368 |
PathPrefix:= ParamStr(1); |
|
369 |
recordFileName:= ParamStr(2); |
|
2376 | 370 |
|
2008 | 371 |
if ParamStr(3) = '--set-multimedia' then |
372 |
begin |
|
373 |
val(ParamStr(4), cScreenWidth); |
|
374 |
val(ParamStr(5), cScreenHeight); |
|
375 |
cInitWidth:= cScreenWidth; |
|
376 |
cInitHeight:= cScreenHeight; |
|
377 |
cBitsStr:= ParamStr(6); |
|
378 |
val(cBitsStr, cBits); |
|
379 |
val(ParamStr(7), cInitVolume); |
|
380 |
isMusicEnabled:= ParamStr(8) = '1'; |
|
381 |
isSoundEnabled:= ParamStr(9) = '1'; |
|
382 |
cLocaleFName:= ParamStr(10); |
|
383 |
cFullScreen:= ParamStr(11) = '1'; |
|
384 |
end |
|
385 |
else DisplayUsage; |
|
2376 | 386 |
|
2008 | 387 |
for p:= Succ(Low(TPathType)) to High(TPathType) do |
388 |
if p <> ptMapCurrent then Pathz[p]:= PathPrefix + '/' + Pathz[p] |
|
389 |
end; |
|
390 |
15: begin |
|
2154
3d2917be12c3
Change default output to stderr since /tmp doesn't exist under windows and is useless under iphoneos, add a couple of extra parameters
nemo
parents:
2152
diff
changeset
|
391 |
PathPrefix:= ParamStr(1); |
3d2917be12c3
Change default output to stderr since /tmp doesn't exist under windows and is useless under iphoneos, add a couple of extra parameters
nemo
parents:
2152
diff
changeset
|
392 |
recordFileName:= ParamStr(2); |
2008 | 393 |
if ParamStr(3) = '--set-everything' then |
394 |
begin |
|
395 |
val(ParamStr(4), cScreenWidth); |
|
396 |
val(ParamStr(5), cScreenHeight); |
|
397 |
cInitWidth:= cScreenWidth; |
|
398 |
cInitHeight:= cScreenHeight; |
|
399 |
cBitsStr:= ParamStr(6); |
|
400 |
val(cBitsStr, cBits); |
|
401 |
val(ParamStr(7), cInitVolume); |
|
402 |
isMusicEnabled:= ParamStr(8) = '1'; |
|
403 |
isSoundEnabled:= ParamStr(9) = '1'; |
|
404 |
cLocaleFName:= ParamStr(10); |
|
405 |
cFullScreen:= ParamStr(11) = '1'; |
|
406 |
cAltDamage:= ParamStr(12) = '1'; |
|
407 |
cShowFPS:= ParamStr(13) = '1'; |
|
408 |
val(ParamStr(14), cTimerInterval); |
|
409 |
cReducedQuality:= ParamStr(15) = '1'; |
|
410 |
end |
|
411 |
else DisplayUsage; |
|
2376 | 412 |
|
2008 | 413 |
for p:= Succ(Low(TPathType)) to High(TPathType) do |
414 |
if p <> ptMapCurrent then Pathz[p]:= PathPrefix + '/' + Pathz[p] |
|
415 |
end; |
|
416 |
else DisplayUsage; |
|
417 |
end; |
|
2630 | 418 |
|
419 |
{$IFDEF DEBUGFILE} |
|
420 |
AddFileLog('Prefix: "' + PathPrefix +'"'); |
|
421 |
for i:= 0 to ParamCount do |
|
422 |
AddFileLog(inttostr(i) + ': ' + ParamStr(i)); |
|
423 |
{$IFDEF IPHONEOS} |
|
2633 | 424 |
WriteLnToConsole('Saving debug file at: ' + get_documents_path()); |
2630 | 425 |
{$ENDIF} |
426 |
{$ENDIF} |
|
51 | 427 |
end; |
428 |
||
2016 | 429 |
///////////////////////// |
51 | 430 |
procedure ShowMainWindow; |
431 |
begin |
|
2633 | 432 |
if cFullScreen then ParseCommand('fullscr 1', true) |
433 |
else ParseCommand('fullscr 0', true); |
|
434 |
SDL_ShowCursor(0) |
|
51 | 435 |
end; |
155
401f4ea24715
Engine can generate land preview and send it via IPC
unc0rr
parents:
109
diff
changeset
|
436 |
|
160 | 437 |
/////////////// |
155
401f4ea24715
Engine can generate land preview and send it via IPC
unc0rr
parents:
109
diff
changeset
|
438 |
procedure Game; |
205 | 439 |
var s: shortstring; |
51 | 440 |
begin |
441 |
WriteToConsole('Init SDL... '); |
|
2674
2fce032f2f95
lupdate + Palewolf's updated spanish translation + other patches of mine
koda
parents:
2671
diff
changeset
|
442 |
SDLTry(SDL_Init(SDL_INIT_VIDEO) >= 0, true); |
51 | 443 |
WriteLnToConsole(msgOK); |
753 | 444 |
|
377 | 445 |
SDL_EnableUNICODE(1); |
51 | 446 |
|
447 |
WriteToConsole('Init SDL_ttf... '); |
|
200 | 448 |
SDLTry(TTF_Init <> -1, true); |
51 | 449 |
WriteLnToConsole(msgOK); |
450 |
||
451 |
ShowMainWindow; |
|
452 |
||
2671
7e0f88013fe8
smaller patches, one missing Sky-lowres, IMG_Init and Mix_Init (might require newer libraries), updates to SDL bindings, code cleanup, new compile flags
koda
parents:
2669
diff
changeset
|
453 |
AddProgress; |
7e0f88013fe8
smaller patches, one missing Sky-lowres, IMG_Init and Mix_Init (might require newer libraries), updates to SDL bindings, code cleanup, new compile flags
koda
parents:
2669
diff
changeset
|
454 |
|
2428 | 455 |
ControllerInit; // has to happen before InitKbdKeyTable to map keys |
51 | 456 |
InitKbdKeyTable; |
1888
e76274ce7365
Add an ability to run engine without IPC connection.
unc0rr
parents:
1825
diff
changeset
|
457 |
|
e76274ce7365
Add an ability to run engine without IPC connection.
unc0rr
parents:
1825
diff
changeset
|
458 |
if recordFileName = '' then InitIPC; |
51 | 459 |
WriteLnToConsole(msgGettingConfig); |
80 | 460 |
|
2039 | 461 |
if cLocaleFName <> 'en.txt' then |
462 |
LoadLocale(Pathz[ptLocale] + '/en.txt'); |
|
80 | 463 |
LoadLocale(Pathz[ptLocale] + '/' + cLocaleFName); |
464 |
||
1888
e76274ce7365
Add an ability to run engine without IPC connection.
unc0rr
parents:
1825
diff
changeset
|
465 |
if recordFileName = '' then |
e76274ce7365
Add an ability to run engine without IPC connection.
unc0rr
parents:
1825
diff
changeset
|
466 |
SendIPCAndWaitReply('C') // ask for game config |
e76274ce7365
Add an ability to run engine without IPC connection.
unc0rr
parents:
1825
diff
changeset
|
467 |
else |
2600 | 468 |
LoadRecordFromFile(recordFileName); |
205 | 469 |
|
470 |
s:= 'eproto ' + inttostr(cNetProtoVersion); |
|
471 |
SendIPCRaw(@s[0], Length(s) + 1); // send proto version |
|
472 |
||
51 | 473 |
InitTeams; |
288 | 474 |
AssignStores; |
51 | 475 |
|
2600 | 476 |
if isSoundEnabled then |
477 |
InitSound; |
|
51 | 478 |
|
479 |
isDeveloperMode:= false; |
|
480 |
||
2600 | 481 |
TryDo(InitStepsFlags = cifAllInited, 'Some parameters not set (flags = ' + inttostr(InitStepsFlags) + ')', true); |
55
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
54
diff
changeset
|
482 |
|
2428 | 483 |
MainLoop; |
484 |
ControllerClose |
|
155
401f4ea24715
Engine can generate land preview and send it via IPC
unc0rr
parents:
109
diff
changeset
|
485 |
end; |
51 | 486 |
|
160 | 487 |
///////////////////////// |
155
401f4ea24715
Engine can generate land preview and send it via IPC
unc0rr
parents:
109
diff
changeset
|
488 |
procedure GenLandPreview; |
566 | 489 |
var Preview: TPreview; |
1791
7c9d645d2591
Fix passing hedgehogs number from engine to frontend
unc0rr
parents:
1784
diff
changeset
|
490 |
h: byte; |
155
401f4ea24715
Engine can generate land preview and send it via IPC
unc0rr
parents:
109
diff
changeset
|
491 |
begin |
401f4ea24715
Engine can generate land preview and send it via IPC
unc0rr
parents:
109
diff
changeset
|
492 |
InitIPC; |
159 | 493 |
IPCWaitPongEvent; |
2600 | 494 |
TryDo(InitStepsFlags = cifRandomize, 'Some parameters not set (flags = ' + inttostr(InitStepsFlags) + ')', true); |
160 | 495 |
|
566 | 496 |
Preview:= GenPreview; |
159 | 497 |
WriteLnToConsole('Sending preview...'); |
155
401f4ea24715
Engine can generate land preview and send it via IPC
unc0rr
parents:
109
diff
changeset
|
498 |
SendIPCRaw(@Preview, sizeof(Preview)); |
1791
7c9d645d2591
Fix passing hedgehogs number from engine to frontend
unc0rr
parents:
1784
diff
changeset
|
499 |
h:= MaxHedgehogs; |
7c9d645d2591
Fix passing hedgehogs number from engine to frontend
unc0rr
parents:
1784
diff
changeset
|
500 |
SendIPCRaw(@h, sizeof(h)); |
159 | 501 |
WriteLnToConsole('Preview sent, disconnect'); |
158 | 502 |
CloseIPC |
155
401f4ea24715
Engine can generate land preview and send it via IPC
unc0rr
parents:
109
diff
changeset
|
503 |
end; |
401f4ea24715
Engine can generate land preview and send it via IPC
unc0rr
parents:
109
diff
changeset
|
504 |
|
401f4ea24715
Engine can generate land preview and send it via IPC
unc0rr
parents:
109
diff
changeset
|
505 |
//////////////////////////////////////////////////////////////////////////////// |
401f4ea24715
Engine can generate land preview and send it via IPC
unc0rr
parents:
109
diff
changeset
|
506 |
/////////////////////////////// m a i n //////////////////////////////////////// |
401f4ea24715
Engine can generate land preview and send it via IPC
unc0rr
parents:
109
diff
changeset
|
507 |
//////////////////////////////////////////////////////////////////////////////// |
401f4ea24715
Engine can generate land preview and send it via IPC
unc0rr
parents:
109
diff
changeset
|
508 |
|
401f4ea24715
Engine can generate land preview and send it via IPC
unc0rr
parents:
109
diff
changeset
|
509 |
begin |
2667 | 510 |
WriteLnToConsole('Hedgewars ' + cVersionString + ' engine (network protocol: ' + inttostr(cNetProtoVersion) + ')'); |
155
401f4ea24715
Engine can generate land preview and send it via IPC
unc0rr
parents:
109
diff
changeset
|
511 |
GetParams; |
2105 | 512 |
|
155
401f4ea24715
Engine can generate land preview and send it via IPC
unc0rr
parents:
109
diff
changeset
|
513 |
Randomize; |
2008 | 514 |
|
155
401f4ea24715
Engine can generate land preview and send it via IPC
unc0rr
parents:
109
diff
changeset
|
515 |
if GameType = gmtLandPreview then GenLandPreview |
401f4ea24715
Engine can generate land preview and send it via IPC
unc0rr
parents:
109
diff
changeset
|
516 |
else Game |
51 | 517 |
end. |
2008 | 518 |