author | smxx |
Thu, 29 Apr 2010 17:21:10 +0000 | |
changeset 3376 | faee68a28b82 |
parent 3365 | 37ac593e9027 |
child 3377 | a3f0849f26bc |
permissions | -rw-r--r-- |
4 | 1 |
(* |
2947 | 2 |
* Hedgewars, a free turn based strategy game |
3 |
* Copyright (c) 2004-2008 Andrey Korotaev <unC0Rr@gmail.com> |
|
4 |
* |
|
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 |
|
8 |
* |
|
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. |
|
13 |
* |
|
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 |
|
17 |
*) |
|
4 | 18 |
|
2630 | 19 |
{$INCLUDE "options.inc"} |
20 |
||
4 | 21 |
unit uMisc; |
22 |
interface |
|
2630 | 23 |
|
3165
3ec07a7d8456
just some very sane stuff for the iphone port (plus some macro on pascal files)
koda
parents:
3133
diff
changeset
|
24 |
uses SDLh, uConsts, uFloat, GLunit; |
2697 | 25 |
|
1054 | 26 |
var |
2947 | 27 |
isCursorVisible : boolean; |
28 |
isTerminated : boolean; |
|
29 |
isInLag : boolean; |
|
30 |
isPaused : boolean; |
|
31 |
isSoundEnabled : boolean; |
|
32 |
isMusicEnabled : boolean; |
|
33 |
isSEBackup : boolean; |
|
34 |
isInMultiShoot : boolean; |
|
35 |
isSpeed : boolean; |
|
3107 | 36 |
isFirstFrame : boolean; |
1560
e140bc57ff68
Quick replay round to spectators until current move
unc0rr
parents:
1530
diff
changeset
|
37 |
|
2947 | 38 |
fastUntilLag : boolean; |
1888
e76274ce7365
Add an ability to run engine without IPC connection.
unc0rr
parents:
1861
diff
changeset
|
39 |
|
2947 | 40 |
GameState : TGameState; |
41 |
GameType : TGameType; |
|
42 |
GameFlags : Longword; |
|
43 |
TrainingFlags : Longword; |
|
44 |
TurnTimeLeft : Longword; |
|
45 |
cSuddenDTurns : LongInt; |
|
46 |
cDamagePercent : LongInt; |
|
47 |
cMineDudPercent : LongWord; |
|
48 |
cTemplateFilter : LongInt; |
|
3133 | 49 |
cMapGen : LongInt; |
50 |
cMazeSize : LongInt; |
|
4 | 51 |
|
2947 | 52 |
cHedgehogTurnTime: Longword; |
53 |
cMinesTime : LongInt; |
|
54 |
cMaxAIThinkTime : Longword; |
|
74 | 55 |
|
2947 | 56 |
cCloudsNumber : LongInt; |
57 |
cScreenWidth : LongInt; |
|
58 |
cScreenHeight : LongInt; |
|
59 |
cInitWidth : LongInt; |
|
60 |
cInitHeight : LongInt; |
|
61 |
cVSyncInUse : boolean; |
|
62 |
cBits : LongInt; |
|
63 |
cBitsStr : string[2]; |
|
64 |
cTagsMask : byte; |
|
65 |
zoom : GLfloat; |
|
66 |
ZoomValue : GLfloat; |
|
4 | 67 |
|
2947 | 68 |
cWaterLine : LongInt; |
69 |
cGearScrEdgesDist: LongInt; |
|
70 |
cAltDamage : boolean; |
|
1054 | 71 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
72 |
GameTicks : LongWord; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
73 |
TrainingTimeInc : Longword; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
74 |
TrainingTimeInD : Longword; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
75 |
TrainingTimeInM : Longword; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
76 |
TrainingTimeMax : Longword; |
2666 | 77 |
|
2947 | 78 |
TimeTrialStartTime: Longword; |
79 |
TimeTrialStopTime : Longword; |
|
80 |
||
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
81 |
recordFileName : shortstring; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
82 |
cShowFPS : boolean; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
83 |
cCaseFactor : Longword; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
84 |
cLandAdditions : Longword; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
85 |
cExplosives : Longword; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
86 |
cFullScreen : boolean; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
87 |
cReducedQuality : boolean; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
88 |
cLocaleFName : shortstring; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
89 |
cSeed : shortstring; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
90 |
cInitVolume : LongInt; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
91 |
cVolumeDelta : LongInt; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
92 |
cTimerInterval : Longword; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
93 |
cHasFocus : boolean; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
94 |
cInactDelay : Longword; |
4 | 95 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
96 |
bBetweenTurns : boolean; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
97 |
cHealthDecrease : LongWord; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
98 |
bWaterRising : Boolean; |
543
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
539
diff
changeset
|
99 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
100 |
ShowCrosshair : boolean; |
3169
c8c6ac44f51b
prophylactic removal of some Integer references, raise a few of the template islands up a bit so they work inverted without triggering border
nemo
parents:
3165
diff
changeset
|
101 |
CursorMovementX : LongInt; |
c8c6ac44f51b
prophylactic removal of some Integer references, raise a few of the template islands up a bit so they work inverted without triggering border
nemo
parents:
3165
diff
changeset
|
102 |
CursorMovementY : LongInt; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
103 |
cDrownSpeed : hwFloat; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
104 |
cMaxWindSpeed : hwFloat; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
105 |
cWindSpeed : hwFloat; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
106 |
cGravity : hwFloat; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
107 |
cDamageModifier : hwFloat; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
108 |
cLaserSighting : boolean; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
109 |
cVampiric : boolean; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
110 |
cArtillery : boolean; |
2947 | 111 |
WeaponTooltipTex : PTexture; |
112 |
cWeaponTooltips: boolean; |
|
4 | 113 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
114 |
flagMakeCapture : boolean; |
55
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
53
diff
changeset
|
115 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
116 |
InitStepsFlags : Longword; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
117 |
RealTicks : Longword; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
118 |
AttackBar : LongInt; |
836 | 119 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
120 |
WaterColorArray : array[0..3] of HwColor4f; |
4 | 121 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
122 |
CursorPoint : TPoint; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
123 |
TargetPoint : TPoint; |
2699
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
124 |
|
2715
0e4e0db79e2a
Free up some unfreed memory. Needed for Koda's iphone lib work
nemo
parents:
2705
diff
changeset
|
125 |
TextureList : PTexture; |
0e4e0db79e2a
Free up some unfreed memory. Needed for Koda's iphone lib work
nemo
parents:
2705
diff
changeset
|
126 |
|
3107 | 127 |
ScreenFade : TScreenFade; |
3115 | 128 |
ScreenFadeValue : LongInt; |
129 |
ScreenFadeSpeed : LongInt; |
|
3107 | 130 |
|
2630 | 131 |
|
3038 | 132 |
procedure initModule; |
133 |
procedure freeModule; |
|
2747 | 134 |
procedure SplitBySpace(var a, b: shortstring); |
2905 | 135 |
procedure SplitByChar(var a, b: ansistring; c: char); |
3337 | 136 |
function EnumToStr(const en : TGearType) : shortstring; overload; |
137 |
function EnumToStr(const en : TSound) : shortstring; overload; |
|
138 |
function EnumToStr(const en : TAmmoType) : shortstring; overload; |
|
3169
c8c6ac44f51b
prophylactic removal of some Integer references, raise a few of the template islands up a bit so they work inverted without triggering border
nemo
parents:
3165
diff
changeset
|
139 |
procedure movecursor(dx, dy: LongInt); |
2699
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
140 |
function hwSign(r: hwFloat): LongInt; |
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
141 |
function Min(a, b: LongInt): LongInt; |
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
142 |
function Max(a, b: LongInt): LongInt; |
2905 | 143 |
procedure OutError(Msg: shortstring; isFatalError: boolean); |
144 |
procedure TryDo(Assert: boolean; Msg: shortstring; isFatal: boolean); |
|
4 | 145 |
procedure SDLTry(Assert: boolean; isFatal: boolean); |
2699
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
146 |
function IntToStr(n: LongInt): shortstring; |
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
147 |
function FloatToStr(n: hwFloat): shortstring; |
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
148 |
function DxDy2Angle(const _dY, _dX: hwFloat): GLfloat; |
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
149 |
function DxDy2Angle32(const _dY, _dX: hwFloat): LongInt; |
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
150 |
function DxDy2AttackAngle(const _dY, _dX: hwFloat): LongInt; |
4 | 151 |
procedure AdjustColor(var Color: Longword); |
208 | 152 |
procedure SetKB(n: Longword); |
153 |
procedure SendKB; |
|
351 | 154 |
procedure SetLittle(var r: hwFloat); |
306 | 155 |
procedure SendStat(sit: TStatInfoType; s: shortstring); |
753 | 156 |
function Str2PChar(const s: shortstring): PChar; |
2699
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
157 |
function NewTexture(width, height: Longword; buf: Pointer): PTexture; |
2290
bf87ca44782e
Selectively enable clamping - seeing if this helps avoid weird flake problems while still fixing vertical lines in waves and sky
nemo
parents:
2279
diff
changeset
|
158 |
function Surface2Tex(surf: PSDL_Surface; enableClamp: boolean): PTexture; |
759 | 159 |
procedure FreeTexture(tex: PTexture); |
945
4ead9cde4e14
- Start chat implementation: chat strings are on the screen
unc0rr
parents:
916
diff
changeset
|
160 |
function toPowerOf2(i: Longword): Longword; |
2670 | 161 |
function DecodeBase64(s: shortstring): shortstring; |
162 |
function doSurfaceConversion(tmpsurf: PSDL_Surface): PSDL_Surface; |
|
163 |
function endian(independent: LongWord): LongWord; |
|
2699
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
164 |
{$IFDEF DEBUGFILE} |
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
165 |
procedure AddFileLog(s: shortstring); |
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
166 |
function RectToStr(Rect: TSDL_Rect): shortstring; |
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
167 |
{$ENDIF} |
2163
12730f5e79b9
koda's patch fixing some iphone port troubles (color, mouse)
unc0rr
parents:
2162
diff
changeset
|
168 |
{$IFNDEF IPHONEOS} |
2735 | 169 |
procedure MakeScreenshot(filename: shortstring); |
2163
12730f5e79b9
koda's patch fixing some iphone port troubles (color, mouse)
unc0rr
parents:
2162
diff
changeset
|
170 |
{$ENDIF} |
4 | 171 |
|
172 |
implementation |
|
3337 | 173 |
uses Math, uConsole, uStore, uIO, uRandom, uSound, typinfo; |
2699
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
174 |
|
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
175 |
var KBnum: Longword; |
4 | 176 |
{$IFDEF DEBUGFILE} |
2699
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
177 |
f: textfile; |
4 | 178 |
{$ENDIF} |
179 |
||
2747 | 180 |
// should this include "strtolower()" for the split string? |
181 |
procedure SplitBySpace(var a, b: shortstring); |
|
182 |
var i, t: LongInt; |
|
183 |
begin |
|
184 |
i:= Pos(' ', a); |
|
185 |
if i > 0 then |
|
2947 | 186 |
begin |
187 |
for t:= 1 to Pred(i) do |
|
188 |
if (a[t] >= 'A')and(a[t] <= 'Z') then Inc(a[t], 32); |
|
189 |
b:= copy(a, i + 1, Length(a) - i); |
|
190 |
byte(a[0]):= Pred(i) |
|
191 |
end else b:= ''; |
|
2747 | 192 |
end; |
193 |
||
2905 | 194 |
procedure SplitByChar(var a, b: ansistring; c: char); |
2747 | 195 |
var i: LongInt; |
196 |
begin |
|
197 |
i:= Pos(c, a); |
|
198 |
if i > 0 then |
|
2947 | 199 |
begin |
200 |
b:= copy(a, i + 1, Length(a) - i); |
|
201 |
setlength(a, Pred(i)); |
|
202 |
end else b:= ''; |
|
2747 | 203 |
end; |
204 |
||
3337 | 205 |
function EnumToStr(const en : TGearType) : shortstring; overload; |
206 |
begin |
|
207 |
EnumToStr:= GetEnumName(TypeInfo(TGearType), ord(en)) |
|
208 |
end; |
|
209 |
||
210 |
function EnumToStr(const en : TSound) : shortstring; overload; |
|
211 |
begin |
|
212 |
EnumToStr:= GetEnumName(TypeInfo(TSound), ord(en)) |
|
213 |
end; |
|
214 |
||
215 |
function EnumToStr(const en : TAmmoType) : shortstring; overload; |
|
216 |
begin |
|
217 |
EnumToStr:= GetEnumName(TypeInfo(TAmmoType), ord(en)) |
|
218 |
end; |
|
219 |
||
3169
c8c6ac44f51b
prophylactic removal of some Integer references, raise a few of the template islands up a bit so they work inverted without triggering border
nemo
parents:
3165
diff
changeset
|
220 |
procedure movecursor(dx, dy: LongInt); |
2428 | 221 |
var x, y: LongInt; |
222 |
begin |
|
223 |
if (dx = 0) and (dy = 0) then exit; |
|
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:
2670
diff
changeset
|
224 |
|
2428 | 225 |
SDL_GetMouseState(@x, @y); |
226 |
Inc(x, dx); |
|
227 |
Inc(y, dy); |
|
228 |
SDL_WarpMouse(x, y); |
|
229 |
end; |
|
230 |
||
371 | 231 |
function hwSign(r: hwFloat): LongInt; |
4 | 232 |
begin |
2389 | 233 |
// yes, we have negative zero for a reason |
234 |
if r.isNegative then hwSign:= -1 else hwSign:= 1 |
|
4 | 235 |
end; |
236 |
||
371 | 237 |
function Min(a, b: LongInt): LongInt; |
4 | 238 |
begin |
351 | 239 |
if a < b then Min:= a else Min:= b |
4 | 240 |
end; |
241 |
||
371 | 242 |
function Max(a, b: LongInt): LongInt; |
4 | 243 |
begin |
351 | 244 |
if a > b then Max:= a else Max:= b |
4 | 245 |
end; |
246 |
||
2905 | 247 |
procedure OutError(Msg: shortstring; isFatalError: boolean); |
4 | 248 |
begin |
249 |
{$IFDEF DEBUGFILE}AddFileLog(Msg);{$ENDIF} |
|
53 | 250 |
WriteLnToConsole(Msg); |
4 | 251 |
if isFatalError then |
2947 | 252 |
begin |
253 |
SendIPC('E' + GetLastConsoleLine); |
|
254 |
SDL_Quit; |
|
255 |
halt(1) |
|
256 |
end |
|
4 | 257 |
end; |
258 |
||
2905 | 259 |
procedure TryDo(Assert: boolean; Msg: shortstring; isFatal: boolean); |
4 | 260 |
begin |
70 | 261 |
if not Assert then OutError(Msg, isFatal) |
4 | 262 |
end; |
263 |
||
264 |
procedure SDLTry(Assert: boolean; isFatal: boolean); |
|
265 |
begin |
|
266 |
if not Assert then OutError(SDL_GetError, isFatal) |
|
267 |
end; |
|
268 |
||
188 | 269 |
procedure AdjustColor(var Color: Longword); |
4 | 270 |
begin |
271 |
Color:= SDL_MapRGB(PixelFormat, (Color shr 16) and $FF, (Color shr 8) and $FF, Color and $FF) |
|
272 |
end; |
|
273 |
||
316 | 274 |
function IntToStr(n: LongInt): shortstring; |
4 | 275 |
begin |
351 | 276 |
str(n, IntToStr) |
4 | 277 |
end; |
278 |
||
351 | 279 |
function FloatToStr(n: hwFloat): shortstring; |
4 | 280 |
begin |
1346 | 281 |
FloatToStr:= cstr(n) + '_' + inttostr(Lo(n.QWordValue)) |
4 | 282 |
end; |
283 |
||
2447
08d623a494e6
Smaxx's updated german translation + texture gap fixes + updated room list
koda
parents:
2428
diff
changeset
|
284 |
procedure SetTextureParameters(enableClamp: Boolean); |
08d623a494e6
Smaxx's updated german translation + texture gap fixes + updated room list
koda
parents:
2428
diff
changeset
|
285 |
begin |
08d623a494e6
Smaxx's updated german translation + texture gap fixes + updated room list
koda
parents:
2428
diff
changeset
|
286 |
if enableClamp and not cReducedQuality then |
08d623a494e6
Smaxx's updated german translation + texture gap fixes + updated room list
koda
parents:
2428
diff
changeset
|
287 |
begin |
08d623a494e6
Smaxx's updated german translation + texture gap fixes + updated room list
koda
parents:
2428
diff
changeset
|
288 |
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); |
08d623a494e6
Smaxx's updated german translation + texture gap fixes + updated room list
koda
parents:
2428
diff
changeset
|
289 |
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE) |
08d623a494e6
Smaxx's updated german translation + texture gap fixes + updated room list
koda
parents:
2428
diff
changeset
|
290 |
end; |
08d623a494e6
Smaxx's updated german translation + texture gap fixes + updated room list
koda
parents:
2428
diff
changeset
|
291 |
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); |
08d623a494e6
Smaxx's updated german translation + texture gap fixes + updated room list
koda
parents:
2428
diff
changeset
|
292 |
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR) |
08d623a494e6
Smaxx's updated german translation + texture gap fixes + updated room list
koda
parents:
2428
diff
changeset
|
293 |
end; |
08d623a494e6
Smaxx's updated german translation + texture gap fixes + updated room list
koda
parents:
2428
diff
changeset
|
294 |
|
775 | 295 |
function DxDy2Angle(const _dY, _dX: hwFloat): GLfloat; |
296 |
var dY, dX: Extended; |
|
297 |
begin |
|
298 |
dY:= _dY.QWordValue / $100000000; |
|
299 |
if _dY.isNegative then dY:= - dY; |
|
300 |
dX:= _dX.QWordValue / $100000000; |
|
301 |
if _dX.isNegative then dX:= - dX; |
|
302 |
DxDy2Angle:= arctan2(dY, dX) * 180 / pi |
|
303 |
end; |
|
304 |
||
371 | 305 |
function DxDy2Angle32(const _dY, _dX: hwFloat): LongInt; |
100 | 306 |
const _16divPI: Extended = 16/pi; |
370
c75410fe3133
- Repair bots: they can walk and use bazooka, possible cannot jump (why?)
unc0rr
parents:
351
diff
changeset
|
307 |
var dY, dX: Extended; |
100 | 308 |
begin |
370
c75410fe3133
- Repair bots: they can walk and use bazooka, possible cannot jump (why?)
unc0rr
parents:
351
diff
changeset
|
309 |
dY:= _dY.QWordValue / $100000000; |
c75410fe3133
- Repair bots: they can walk and use bazooka, possible cannot jump (why?)
unc0rr
parents:
351
diff
changeset
|
310 |
if _dY.isNegative then dY:= - dY; |
c75410fe3133
- Repair bots: they can walk and use bazooka, possible cannot jump (why?)
unc0rr
parents:
351
diff
changeset
|
311 |
dX:= _dX.QWordValue / $100000000; |
c75410fe3133
- Repair bots: they can walk and use bazooka, possible cannot jump (why?)
unc0rr
parents:
351
diff
changeset
|
312 |
if _dX.isNegative then dX:= - dX; |
c75410fe3133
- Repair bots: they can walk and use bazooka, possible cannot jump (why?)
unc0rr
parents:
351
diff
changeset
|
313 |
DxDy2Angle32:= trunc(arctan2(dY, dX) * _16divPI) and $1f |
4 | 314 |
end; |
315 |
||
371 | 316 |
function DxDy2AttackAngle(const _dY, _dX: hwFloat): LongInt; |
100 | 317 |
const MaxAngleDivPI: Extended = cMaxAngle/pi; |
370
c75410fe3133
- Repair bots: they can walk and use bazooka, possible cannot jump (why?)
unc0rr
parents:
351
diff
changeset
|
318 |
var dY, dX: Extended; |
100 | 319 |
begin |
370
c75410fe3133
- Repair bots: they can walk and use bazooka, possible cannot jump (why?)
unc0rr
parents:
351
diff
changeset
|
320 |
dY:= _dY.QWordValue / $100000000; |
c75410fe3133
- Repair bots: they can walk and use bazooka, possible cannot jump (why?)
unc0rr
parents:
351
diff
changeset
|
321 |
if _dY.isNegative then dY:= - dY; |
c75410fe3133
- Repair bots: they can walk and use bazooka, possible cannot jump (why?)
unc0rr
parents:
351
diff
changeset
|
322 |
dX:= _dX.QWordValue / $100000000; |
c75410fe3133
- Repair bots: they can walk and use bazooka, possible cannot jump (why?)
unc0rr
parents:
351
diff
changeset
|
323 |
if _dX.isNegative then dX:= - dX; |
438 | 324 |
DxDy2AttackAngle:= trunc(arctan2(dY, dX) * MaxAngleDivPI) |
100 | 325 |
end; |
4 | 326 |
|
208 | 327 |
procedure SetKB(n: Longword); |
328 |
begin |
|
329 |
KBnum:= n |
|
330 |
end; |
|
331 |
||
332 |
procedure SendKB; |
|
333 |
var s: shortstring; |
|
334 |
begin |
|
335 |
if KBnum <> 0 then |
|
2947 | 336 |
begin |
337 |
s:= 'K' + inttostr(KBnum); |
|
338 |
SendIPCRaw(@s, Length(s) + 1) |
|
339 |
end |
|
208 | 340 |
end; |
341 |
||
351 | 342 |
procedure SetLittle(var r: hwFloat); |
300 | 343 |
begin |
553
5478386d935f
- Switch to bazooka (or whatever) after use of some weapon (fixes problem with bots)
unc0rr
parents:
543
diff
changeset
|
344 |
r:= SignAs(cLittle, r) |
300 | 345 |
end; |
346 |
||
337 | 347 |
procedure SendStat(sit: TStatInfoType; s: shortstring); |
1625 | 348 |
const stc: array [TStatInfoType] of char = 'rDkKH'; |
2382 | 349 |
var buf: shortstring; |
337 | 350 |
begin |
2382 | 351 |
buf:= 'i' + stc[sit] + s; |
352 |
SendIPCRaw(@buf[0], length(buf) + 1) |
|
337 | 353 |
end; |
354 |
||
534 | 355 |
function Str2PChar(const s: shortstring): PChar; |
351 | 356 |
const CharArray: array[byte] of Char = ''; |
357 |
begin |
|
358 |
CharArray:= s; |
|
359 |
CharArray[Length(s)]:= #0; |
|
360 |
Str2PChar:= @CharArray |
|
361 |
end; |
|
362 |
||
771 | 363 |
function isPowerOf2(i: Longword): boolean; |
364 |
begin |
|
365 |
if i = 0 then exit(true); |
|
366 |
while (i and 1) = 0 do i:= i shr 1; |
|
367 |
isPowerOf2:= (i = 1) |
|
368 |
end; |
|
369 |
||
370 |
function toPowerOf2(i: Longword): Longword; |
|
371 |
begin |
|
372 |
toPowerOf2:= 1; |
|
373 |
while (toPowerOf2 < i) do toPowerOf2:= toPowerOf2 shl 1 |
|
374 |
end; |
|
375 |
||
1912
c3d31fb59f0e
Save much CPU time by initializing vertex arrays in texture creation function
unc0rr
parents:
1911
diff
changeset
|
376 |
procedure ResetVertexArrays(texture: PTexture); |
c3d31fb59f0e
Save much CPU time by initializing vertex arrays in texture creation function
unc0rr
parents:
1911
diff
changeset
|
377 |
begin |
c3d31fb59f0e
Save much CPU time by initializing vertex arrays in texture creation function
unc0rr
parents:
1911
diff
changeset
|
378 |
with texture^ do |
2947 | 379 |
begin |
380 |
vb[0].X:= 0; |
|
381 |
vb[0].Y:= 0; |
|
382 |
vb[1].X:= w; |
|
383 |
vb[1].Y:= 0; |
|
384 |
vb[2].X:= w; |
|
385 |
vb[2].Y:= h; |
|
386 |
vb[3].X:= 0; |
|
387 |
vb[3].Y:= h; |
|
1912
c3d31fb59f0e
Save much CPU time by initializing vertex arrays in texture creation function
unc0rr
parents:
1911
diff
changeset
|
388 |
|
2947 | 389 |
tb[0].X:= 0; |
390 |
tb[0].Y:= 0; |
|
391 |
tb[1].X:= rx; |
|
392 |
tb[1].Y:= 0; |
|
393 |
tb[2].X:= rx; |
|
394 |
tb[2].Y:= ry; |
|
395 |
tb[3].X:= 0; |
|
396 |
tb[3].Y:= ry |
|
397 |
end; |
|
1912
c3d31fb59f0e
Save much CPU time by initializing vertex arrays in texture creation function
unc0rr
parents:
1911
diff
changeset
|
398 |
end; |
c3d31fb59f0e
Save much CPU time by initializing vertex arrays in texture creation function
unc0rr
parents:
1911
diff
changeset
|
399 |
|
1180
e56317fdf78d
Start implementing support for 32bit sprites concerned in map generation process.
unc0rr
parents:
1128
diff
changeset
|
400 |
function NewTexture(width, height: Longword; buf: Pointer): PTexture; |
e56317fdf78d
Start implementing support for 32bit sprites concerned in map generation process.
unc0rr
parents:
1128
diff
changeset
|
401 |
begin |
e56317fdf78d
Start implementing support for 32bit sprites concerned in map generation process.
unc0rr
parents:
1128
diff
changeset
|
402 |
new(NewTexture); |
2715
0e4e0db79e2a
Free up some unfreed memory. Needed for Koda's iphone lib work
nemo
parents:
2705
diff
changeset
|
403 |
NewTexture^.PrevTexture:= nil; |
0e4e0db79e2a
Free up some unfreed memory. Needed for Koda's iphone lib work
nemo
parents:
2705
diff
changeset
|
404 |
NewTexture^.NextTexture:= nil; |
0e4e0db79e2a
Free up some unfreed memory. Needed for Koda's iphone lib work
nemo
parents:
2705
diff
changeset
|
405 |
if TextureList <> nil then |
0e4e0db79e2a
Free up some unfreed memory. Needed for Koda's iphone lib work
nemo
parents:
2705
diff
changeset
|
406 |
begin |
0e4e0db79e2a
Free up some unfreed memory. Needed for Koda's iphone lib work
nemo
parents:
2705
diff
changeset
|
407 |
TextureList^.PrevTexture:= NewTexture; |
0e4e0db79e2a
Free up some unfreed memory. Needed for Koda's iphone lib work
nemo
parents:
2705
diff
changeset
|
408 |
NewTexture^.NextTexture:= TextureList |
0e4e0db79e2a
Free up some unfreed memory. Needed for Koda's iphone lib work
nemo
parents:
2705
diff
changeset
|
409 |
end; |
0e4e0db79e2a
Free up some unfreed memory. Needed for Koda's iphone lib work
nemo
parents:
2705
diff
changeset
|
410 |
TextureList:= NewTexture; |
0e4e0db79e2a
Free up some unfreed memory. Needed for Koda's iphone lib work
nemo
parents:
2705
diff
changeset
|
411 |
|
1180
e56317fdf78d
Start implementing support for 32bit sprites concerned in map generation process.
unc0rr
parents:
1128
diff
changeset
|
412 |
NewTexture^.w:= width; |
e56317fdf78d
Start implementing support for 32bit sprites concerned in map generation process.
unc0rr
parents:
1128
diff
changeset
|
413 |
NewTexture^.h:= height; |
1896 | 414 |
NewTexture^.rx:= 1.0; |
415 |
NewTexture^.ry:= 1.0; |
|
1180
e56317fdf78d
Start implementing support for 32bit sprites concerned in map generation process.
unc0rr
parents:
1128
diff
changeset
|
416 |
|
1912
c3d31fb59f0e
Save much CPU time by initializing vertex arrays in texture creation function
unc0rr
parents:
1911
diff
changeset
|
417 |
ResetVertexArrays(NewTexture); |
c3d31fb59f0e
Save much CPU time by initializing vertex arrays in texture creation function
unc0rr
parents:
1911
diff
changeset
|
418 |
|
1180
e56317fdf78d
Start implementing support for 32bit sprites concerned in map generation process.
unc0rr
parents:
1128
diff
changeset
|
419 |
glGenTextures(1, @NewTexture^.id); |
e56317fdf78d
Start implementing support for 32bit sprites concerned in map generation process.
unc0rr
parents:
1128
diff
changeset
|
420 |
|
e56317fdf78d
Start implementing support for 32bit sprites concerned in map generation process.
unc0rr
parents:
1128
diff
changeset
|
421 |
glBindTexture(GL_TEXTURE_2D, NewTexture^.id); |
e56317fdf78d
Start implementing support for 32bit sprites concerned in map generation process.
unc0rr
parents:
1128
diff
changeset
|
422 |
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, buf); |
e56317fdf78d
Start implementing support for 32bit sprites concerned in map generation process.
unc0rr
parents:
1128
diff
changeset
|
423 |
|
2447
08d623a494e6
Smaxx's updated german translation + texture gap fixes + updated room list
koda
parents:
2428
diff
changeset
|
424 |
SetTextureParameters(true); |
1180
e56317fdf78d
Start implementing support for 32bit sprites concerned in map generation process.
unc0rr
parents:
1128
diff
changeset
|
425 |
end; |
e56317fdf78d
Start implementing support for 32bit sprites concerned in map generation process.
unc0rr
parents:
1128
diff
changeset
|
426 |
|
2290
bf87ca44782e
Selectively enable clamping - seeing if this helps avoid weird flake problems while still fixing vertical lines in waves and sky
nemo
parents:
2279
diff
changeset
|
427 |
function Surface2Tex(surf: PSDL_Surface; enableClamp: boolean): PTexture; |
2576
2eb7ce1c1f19
code cleanup for Surface2Tex (we don't have 3 bytes surfaces any more)
koda
parents:
2575
diff
changeset
|
428 |
var tw, th, x, y: Longword; |
2eb7ce1c1f19
code cleanup for Surface2Tex (we don't have 3 bytes surfaces any more)
koda
parents:
2575
diff
changeset
|
429 |
tmpp: pointer; |
2eb7ce1c1f19
code cleanup for Surface2Tex (we don't have 3 bytes surfaces any more)
koda
parents:
2575
diff
changeset
|
430 |
fromP4, toP4: PLongWordArray; |
753 | 431 |
begin |
755 | 432 |
new(Surface2Tex); |
2715
0e4e0db79e2a
Free up some unfreed memory. Needed for Koda's iphone lib work
nemo
parents:
2705
diff
changeset
|
433 |
Surface2Tex^.PrevTexture:= nil; |
0e4e0db79e2a
Free up some unfreed memory. Needed for Koda's iphone lib work
nemo
parents:
2705
diff
changeset
|
434 |
Surface2Tex^.NextTexture:= nil; |
0e4e0db79e2a
Free up some unfreed memory. Needed for Koda's iphone lib work
nemo
parents:
2705
diff
changeset
|
435 |
if TextureList <> nil then |
0e4e0db79e2a
Free up some unfreed memory. Needed for Koda's iphone lib work
nemo
parents:
2705
diff
changeset
|
436 |
begin |
0e4e0db79e2a
Free up some unfreed memory. Needed for Koda's iphone lib work
nemo
parents:
2705
diff
changeset
|
437 |
TextureList^.PrevTexture:= Surface2Tex; |
0e4e0db79e2a
Free up some unfreed memory. Needed for Koda's iphone lib work
nemo
parents:
2705
diff
changeset
|
438 |
Surface2Tex^.NextTexture:= TextureList |
0e4e0db79e2a
Free up some unfreed memory. Needed for Koda's iphone lib work
nemo
parents:
2705
diff
changeset
|
439 |
end; |
0e4e0db79e2a
Free up some unfreed memory. Needed for Koda's iphone lib work
nemo
parents:
2705
diff
changeset
|
440 |
TextureList:= Surface2Tex; |
0e4e0db79e2a
Free up some unfreed memory. Needed for Koda's iphone lib work
nemo
parents:
2705
diff
changeset
|
441 |
|
755 | 442 |
Surface2Tex^.w:= surf^.w; |
443 |
Surface2Tex^.h:= surf^.h; |
|
444 |
||
2576
2eb7ce1c1f19
code cleanup for Surface2Tex (we don't have 3 bytes surfaces any more)
koda
parents:
2575
diff
changeset
|
445 |
if (surf^.format^.BytesPerPixel <> 4) then |
2eb7ce1c1f19
code cleanup for Surface2Tex (we don't have 3 bytes surfaces any more)
koda
parents:
2575
diff
changeset
|
446 |
begin |
2947 | 447 |
TryDo(false, 'Surface2Tex failed, expecting 32 bit surface', true); |
448 |
Surface2Tex^.id:= 0; |
|
449 |
exit |
|
2576
2eb7ce1c1f19
code cleanup for Surface2Tex (we don't have 3 bytes surfaces any more)
koda
parents:
2575
diff
changeset
|
450 |
end; |
2eb7ce1c1f19
code cleanup for Surface2Tex (we don't have 3 bytes surfaces any more)
koda
parents:
2575
diff
changeset
|
451 |
|
753 | 452 |
|
755 | 453 |
glGenTextures(1, @Surface2Tex^.id); |
753 | 454 |
|
755 | 455 |
glBindTexture(GL_TEXTURE_2D, Surface2Tex^.id); |
753 | 456 |
|
771 | 457 |
if SDL_MustLock(surf) then |
2947 | 458 |
SDLTry(SDL_LockSurface(surf) >= 0, true); |
771 | 459 |
|
2428 | 460 |
if (not SupportNPOTT) and (not (isPowerOf2(Surf^.w) and isPowerOf2(Surf^.h))) then |
2576
2eb7ce1c1f19
code cleanup for Surface2Tex (we don't have 3 bytes surfaces any more)
koda
parents:
2575
diff
changeset
|
461 |
begin |
2947 | 462 |
tw:= toPowerOf2(Surf^.w); |
463 |
th:= toPowerOf2(Surf^.h); |
|
1896 | 464 |
|
2947 | 465 |
Surface2Tex^.rx:= Surf^.w / tw; |
466 |
Surface2Tex^.ry:= Surf^.h / th; |
|
2376 | 467 |
|
2947 | 468 |
GetMem(tmpp, tw * th * surf^.format^.BytesPerPixel); |
1896 | 469 |
|
2947 | 470 |
fromP4:= Surf^.pixels; |
471 |
toP4:= tmpp; |
|
771 | 472 |
|
2947 | 473 |
for y:= 0 to Pred(Surf^.h) do |
474 |
begin |
|
475 |
for x:= 0 to Pred(Surf^.w) do toP4^[x]:= fromP4^[x]; |
|
476 |
for x:= Surf^.w to Pred(tw) do toP4^[x]:= 0; |
|
477 |
toP4:= @(toP4^[tw]); |
|
478 |
fromP4:= @(fromP4^[Surf^.pitch div 4]); |
|
479 |
end; |
|
1896 | 480 |
|
2947 | 481 |
for y:= Surf^.h to Pred(th) do |
482 |
begin |
|
483 |
for x:= 0 to Pred(tw) do toP4^[x]:= 0; |
|
484 |
toP4:= @(toP4^[tw]); |
|
485 |
end; |
|
771 | 486 |
|
2947 | 487 |
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, tw, th, 0, GL_RGBA, GL_UNSIGNED_BYTE, tmpp); |
2376 | 488 |
|
2947 | 489 |
FreeMem(tmpp, tw * th * surf^.format^.BytesPerPixel) |
2576
2eb7ce1c1f19
code cleanup for Surface2Tex (we don't have 3 bytes surfaces any more)
koda
parents:
2575
diff
changeset
|
490 |
end |
2eb7ce1c1f19
code cleanup for Surface2Tex (we don't have 3 bytes surfaces any more)
koda
parents:
2575
diff
changeset
|
491 |
else |
2eb7ce1c1f19
code cleanup for Surface2Tex (we don't have 3 bytes surfaces any more)
koda
parents:
2575
diff
changeset
|
492 |
begin |
2947 | 493 |
Surface2Tex^.rx:= 1.0; |
494 |
Surface2Tex^.ry:= 1.0; |
|
495 |
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, surf^.w, surf^.h, 0, GL_RGBA, GL_UNSIGNED_BYTE, surf^.pixels); |
|
2576
2eb7ce1c1f19
code cleanup for Surface2Tex (we don't have 3 bytes surfaces any more)
koda
parents:
2575
diff
changeset
|
496 |
end; |
753 | 497 |
|
1912
c3d31fb59f0e
Save much CPU time by initializing vertex arrays in texture creation function
unc0rr
parents:
1911
diff
changeset
|
498 |
ResetVertexArrays(Surface2Tex); |
c3d31fb59f0e
Save much CPU time by initializing vertex arrays in texture creation function
unc0rr
parents:
1911
diff
changeset
|
499 |
|
754 | 500 |
if SDL_MustLock(surf) then |
2947 | 501 |
SDL_UnlockSurface(surf); |
754 | 502 |
|
2447
08d623a494e6
Smaxx's updated german translation + texture gap fixes + updated room list
koda
parents:
2428
diff
changeset
|
503 |
SetTextureParameters(enableClamp); |
753 | 504 |
end; |
505 |
||
759 | 506 |
procedure FreeTexture(tex: PTexture); |
507 |
begin |
|
2000
f9f47e681aad
Don't crash engine after round in reduced quality mode
unc0rr
parents:
1916
diff
changeset
|
508 |
if tex <> nil then |
2947 | 509 |
begin |
2715
0e4e0db79e2a
Free up some unfreed memory. Needed for Koda's iphone lib work
nemo
parents:
2705
diff
changeset
|
510 |
if tex^.NextTexture <> nil then tex^.NextTexture^.PrevTexture:= tex^.PrevTexture; |
0e4e0db79e2a
Free up some unfreed memory. Needed for Koda's iphone lib work
nemo
parents:
2705
diff
changeset
|
511 |
if tex^.PrevTexture <> nil then tex^.PrevTexture^.NextTexture:= tex^.NextTexture |
2947 | 512 |
else TextureList:= tex^.NextTexture; |
513 |
glDeleteTextures(1, @tex^.id); |
|
514 |
Dispose(tex) |
|
515 |
end |
|
759 | 516 |
end; |
337 | 517 |
|
949 | 518 |
function DecodeBase64(s: shortstring): shortstring; |
519 |
const table = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; |
|
520 |
var i, t, c: Longword; |
|
521 |
begin |
|
522 |
c:= 0; |
|
523 |
for i:= 1 to Length(s) do |
|
2947 | 524 |
begin |
525 |
t:= Pos(s[i], table); |
|
526 |
if s[i] = '=' then inc(c); |
|
527 |
if t > 0 then byte(s[i]):= t - 1 else byte(s[i]):= 0 |
|
528 |
end; |
|
949 | 529 |
|
530 |
i:= 1; |
|
531 |
t:= 1; |
|
532 |
while i <= length(s) do |
|
2947 | 533 |
begin |
534 |
DecodeBase64[t ]:= char((byte(s[i ]) shl 2) or (byte(s[i + 1]) shr 4)); |
|
535 |
DecodeBase64[t + 1]:= char((byte(s[i + 1]) shl 4) or (byte(s[i + 2]) shr 2)); |
|
536 |
DecodeBase64[t + 2]:= char((byte(s[i + 2]) shl 6) or (byte(s[i + 3]) )); |
|
537 |
inc(t, 3); |
|
538 |
inc(i, 4) |
|
539 |
end; |
|
949 | 540 |
|
541 |
if c < 3 then t:= t - c; |
|
542 |
||
543 |
byte(DecodeBase64[0]):= t - 1 |
|
544 |
end; |
|
545 |
||
2163
12730f5e79b9
koda's patch fixing some iphone port troubles (color, mouse)
unc0rr
parents:
2162
diff
changeset
|
546 |
{$IFNDEF IPHONEOS} |
2735 | 547 |
procedure MakeScreenshot(filename: shortstring); |
1080 | 548 |
var p: Pointer; |
2947 | 549 |
size: Longword; |
550 |
f: file; |
|
2735 | 551 |
{$IFNDEF WIN32} |
2947 | 552 |
// TGA Header |
553 |
head: array[0..8] of Word = (0, 2, 0, 0, 0, 0, 0, 0, 24); |
|
2735 | 554 |
{$ELSE} |
2947 | 555 |
// Windows Bitmap Header |
556 |
head: array[0..53] of Byte = ( |
|
557 |
$42, $4D, // identifier ("BM") |
|
558 |
0, 0, 0, 0, // file size |
|
559 |
0, 0, 0, 0, // reserved |
|
560 |
54, 0, 0, 0, // starting offset |
|
561 |
40, 0, 0, 0, // header size |
|
562 |
0, 0, 0, 0, // width |
|
563 |
0, 0, 0, 0, // height |
|
564 |
1, 0, // color planes |
|
565 |
24, 0, // bit depth |
|
566 |
0, 0, 0, 0, // compression method (uncompressed) |
|
567 |
0, 0, 0, 0, // image size |
|
568 |
96, 0, 0, 0, // horizontal resolution |
|
569 |
96, 0, 0, 0, // vertical resolution |
|
570 |
0, 0, 0, 0, // number of colors (all) |
|
571 |
0, 0, 0, 0 // number of important colors |
|
572 |
); |
|
2735 | 573 |
{$ENDIF} |
1080 | 574 |
begin |
2745 | 575 |
playSound(sndShutter); |
1080 | 576 |
|
3107 | 577 |
// flash |
578 |
ScreenFade:= sfFromWhite; |
|
579 |
ScreenFadeValue:= sfMax; |
|
580 |
ScreenFadeSpeed:= 5; |
|
581 |
||
1080 | 582 |
size:= cScreenWidth * cScreenHeight * 3; |
583 |
p:= GetMem(size); |
|
584 |
||
2735 | 585 |
// update header information and file name |
586 |
{$IFNDEF WIN32} |
|
3350 | 587 |
filename:= ParamStr(1) + '/Screenshots/' + filename + '.tga'; |
2735 | 588 |
|
589 |
head[6]:= cScreenWidth; |
|
590 |
head[7]:= cScreenHeight; |
|
591 |
{$ELSE} |
|
3350 | 592 |
filename:= ParamStr(1) + '/Screenshots/' + filename + '.bmp'; |
2735 | 593 |
|
594 |
head[$02]:= (size + 54) and $ff; |
|
595 |
head[$03]:= ((size + 54) shr 8) and $ff; |
|
596 |
head[$04]:= ((size + 54) shr 16) and $ff; |
|
597 |
head[$05]:= ((size + 54) shr 24) and $ff; |
|
598 |
head[$12]:= cScreenWidth and $ff; |
|
599 |
head[$13]:= (cScreenWidth shr 8) and $ff; |
|
600 |
head[$14]:= (cScreenWidth shr 16) and $ff; |
|
601 |
head[$15]:= (cScreenWidth shr 24) and $ff; |
|
602 |
head[$16]:= cScreenHeight and $ff; |
|
603 |
head[$17]:= (cScreenHeight shr 8) and $ff; |
|
604 |
head[$18]:= (cScreenHeight shr 16) and $ff; |
|
605 |
head[$19]:= (cScreenHeight shr 24) and $ff; |
|
606 |
head[$22]:= size and $ff; |
|
607 |
head[$23]:= (size shr 8) and $ff; |
|
608 |
head[$24]:= (size shr 16) and $ff; |
|
609 |
head[$25]:= (size shr 24) and $ff; |
|
610 |
{$ENDIF} |
|
2163
12730f5e79b9
koda's patch fixing some iphone port troubles (color, mouse)
unc0rr
parents:
2162
diff
changeset
|
611 |
|
12730f5e79b9
koda's patch fixing some iphone port troubles (color, mouse)
unc0rr
parents:
2162
diff
changeset
|
612 |
//remember that opengles operates on a single surface, so GL_FRONT *should* be implied |
1080 | 613 |
glReadBuffer(GL_FRONT); |
614 |
glReadPixels(0, 0, cScreenWidth, cScreenHeight, GL_BGR, GL_UNSIGNED_BYTE, p); |
|
615 |
||
616 |
{$I-} |
|
2735 | 617 |
Assign(f, filename); |
1080 | 618 |
Rewrite(f, 1); |
619 |
if IOResult = 0 then |
|
2947 | 620 |
begin |
621 |
BlockWrite(f, head, sizeof(head)); |
|
622 |
BlockWrite(f, p^, size); |
|
623 |
Close(f); |
|
624 |
end; |
|
1080 | 625 |
{$I+} |
626 |
||
627 |
FreeMem(p) |
|
628 |
end; |
|
2163
12730f5e79b9
koda's patch fixing some iphone port troubles (color, mouse)
unc0rr
parents:
2162
diff
changeset
|
629 |
{$ENDIF} |
1080 | 630 |
|
949 | 631 |
{$IFDEF DEBUGFILE} |
632 |
procedure AddFileLog(s: shortstring); |
|
633 |
begin |
|
634 |
writeln(f, GameTicks: 6, ': ', s); |
|
635 |
flush(f) |
|
636 |
end; |
|
637 |
||
638 |
function RectToStr(Rect: TSDL_Rect): shortstring; |
|
639 |
begin |
|
640 |
RectToStr:= '(x: ' + inttostr(rect.x) + '; y: ' + inttostr(rect.y) + '; w: ' + inttostr(rect.w) + '; h: ' + inttostr(rect.h) + ')' |
|
641 |
end; |
|
2242 | 642 |
{$ENDIF} |
306 | 643 |
|
2619 | 644 |
function doSurfaceConversion(tmpsurf: PSDL_Surface): PSDL_Surface; |
645 |
{* for more information http://www.idevgames.com/forum/showpost.php?p=85864&postcount=7 *} |
|
646 |
var convertedSurf: PSDL_Surface = nil; |
|
647 |
begin |
|
2947 | 648 |
if (tmpsurf^.format^.bitsperpixel = 24) or ((tmpsurf^.format^.bitsperpixel = 32) and (tmpsurf^.format^.rshift > tmpsurf^.format^.bshift)) then |
649 |
begin |
|
650 |
convertedSurf:= SDL_ConvertSurface(tmpsurf, @conversionFormat, SDL_SWSURFACE); |
|
651 |
SDL_FreeSurface(tmpsurf); |
|
652 |
exit(convertedSurf); |
|
653 |
end; |
|
2705
2b5625c4ec16
fix a nasty 196 bytes memory leak in engine, plus other stuff for iphone frontend
koda
parents:
2699
diff
changeset
|
654 |
|
2947 | 655 |
exit(tmpsurf); |
2619 | 656 |
end; |
657 |
||
2670 | 658 |
function endian(independent: LongWord): LongWord; |
659 |
begin |
|
660 |
{$IFDEF ENDIAN_LITTLE} |
|
661 |
endian:= independent; |
|
662 |
{$ELSE} |
|
663 |
endian:= (((independent and $FF000000) shr 24) or |
|
3365
37ac593e9027
wow all these files only for land preview and seed generation
koda
parents:
3355
diff
changeset
|
664 |
((independent and $00FF0000) shr 8) or |
37ac593e9027
wow all these files only for land preview and seed generation
koda
parents:
3355
diff
changeset
|
665 |
((independent and $0000FF00) shl 8) or |
37ac593e9027
wow all these files only for land preview and seed generation
koda
parents:
3355
diff
changeset
|
666 |
((independent and $000000FF) shl 24)) |
2670 | 667 |
{$ENDIF} |
668 |
end; |
|
2630 | 669 |
|
2699
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
670 |
|
3038 | 671 |
procedure initModule; |
3305 | 672 |
{$IFDEF DEBUGFILE}{$IFNDEF IPHONEOS}var i: LongInt;{$ENDIF}{$ENDIF} |
2699
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
673 |
begin |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
674 |
cDrownSpeed.QWordValue := 257698038; // 0.06 |
3355
dc9e61e67484
cWindSpeed recalculation assumed GetRandom returns a value between 0.0-1.0 while in fact is in the 0.0-0.5 range; Halve cMaxWindSpeed to compensate.
palewolf
parents:
3350
diff
changeset
|
675 |
cMaxWindSpeed.QWordValue:= 1073742; // 0.00025 |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
676 |
cWindSpeed.QWordValue := 429496; // 0.0001 |
3355
dc9e61e67484
cWindSpeed recalculation assumed GetRandom returns a value between 0.0-1.0 while in fact is in the 0.0-0.5 range; Halve cMaxWindSpeed to compensate.
palewolf
parents:
3350
diff
changeset
|
677 |
cGravity := cMaxWindSpeed * 2; |
2947 | 678 |
cDamageModifier := _1; |
679 |
TargetPoint := cTargetPointRef; |
|
680 |
TextureList := nil; |
|
681 |
||
682 |
// int, longint longword and byte |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
683 |
CursorMovementX := 0; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
684 |
CursorMovementY := 0; |
3066
5c0efa437728
Enable birdy. Has egg bombing. Eggs should possibly have a dX component. No poison yet, no egg sprite.
nemo
parents:
3038
diff
changeset
|
685 |
GameTicks := 0; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
686 |
TrainingTimeInc := 10000; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
687 |
TrainingTimeInD := 500; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
688 |
TrainingTimeInM := 5000; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
689 |
TrainingTimeMax := 60000; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
690 |
TimeTrialStartTime := 0; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
691 |
TimeTrialStopTime := 0; |
3066
5c0efa437728
Enable birdy. Has egg bombing. Eggs should possibly have a dX component. No poison yet, no egg sprite.
nemo
parents:
3038
diff
changeset
|
692 |
cWaterLine := LAND_HEIGHT; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
693 |
cGearScrEdgesDist := 240; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
694 |
cHealthDecrease := 0; |
2699
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
695 |
|
3066
5c0efa437728
Enable birdy. Has egg bombing. Eggs should possibly have a dX component. No poison yet, no egg sprite.
nemo
parents:
3038
diff
changeset
|
696 |
GameFlags := 0; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
697 |
TrainingFlags := 0; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
698 |
TurnTimeLeft := 0; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
699 |
cSuddenDTurns := 15; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
700 |
cDamagePercent := 100; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
701 |
cMineDudPercent := 0; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
702 |
cTemplateFilter := 0; |
3133 | 703 |
cMapGen := 0;//MAPGEN_REGULAR |
704 |
cMazeSize := 0; |
|
2699
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
705 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
706 |
cHedgehogTurnTime := 45000; |
3066
5c0efa437728
Enable birdy. Has egg bombing. Eggs should possibly have a dX component. No poison yet, no egg sprite.
nemo
parents:
3038
diff
changeset
|
707 |
cMinesTime := 3000; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
708 |
cMaxAIThinkTime := 9000; |
2699
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
709 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
710 |
cCloudsNumber := 9; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
711 |
cScreenWidth := 1024; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
712 |
cScreenHeight := 768; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
713 |
cInitWidth := cScreenWidth; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
714 |
cInitHeight := cScreenHeight; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
715 |
cBits := 32; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
716 |
cTagsMask := 0; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
717 |
KBnum := 0; |
3066
5c0efa437728
Enable birdy. Has egg bombing. Eggs should possibly have a dX component. No poison yet, no egg sprite.
nemo
parents:
3038
diff
changeset
|
718 |
InitStepsFlags := 0; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
719 |
RealTicks := 0; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
720 |
AttackBar := 0; // 0 - none, 1 - just bar at the right-down corner, 2 - like in WWP |
2947 | 721 |
|
722 |
// tgametype and glfloat and string |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
723 |
GameState := Low(TGameState); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
724 |
GameType := gmtLocal; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
725 |
zoom := 2.0; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
726 |
ZoomValue := 2.0; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
727 |
cBitsStr := '32'; |
3066
5c0efa437728
Enable birdy. Has egg bombing. Eggs should possibly have a dX component. No poison yet, no egg sprite.
nemo
parents:
3038
diff
changeset
|
728 |
WeaponTooltipTex:= nil; |
2699
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
729 |
|
2947 | 730 |
// booleans |
3066
5c0efa437728
Enable birdy. Has egg bombing. Eggs should possibly have a dX component. No poison yet, no egg sprite.
nemo
parents:
3038
diff
changeset
|
731 |
cLaserSighting := false; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
732 |
cVampiric := false; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
733 |
cArtillery := false; |
3066
5c0efa437728
Enable birdy. Has egg bombing. Eggs should possibly have a dX component. No poison yet, no egg sprite.
nemo
parents:
3038
diff
changeset
|
734 |
flagMakeCapture := false; |
5c0efa437728
Enable birdy. Has egg bombing. Eggs should possibly have a dX component. No poison yet, no egg sprite.
nemo
parents:
3038
diff
changeset
|
735 |
bBetweenTurns := false; |
5c0efa437728
Enable birdy. Has egg bombing. Eggs should possibly have a dX component. No poison yet, no egg sprite.
nemo
parents:
3038
diff
changeset
|
736 |
bWaterRising := false; |
5c0efa437728
Enable birdy. Has egg bombing. Eggs should possibly have a dX component. No poison yet, no egg sprite.
nemo
parents:
3038
diff
changeset
|
737 |
isCursorVisible := false; |
5c0efa437728
Enable birdy. Has egg bombing. Eggs should possibly have a dX component. No poison yet, no egg sprite.
nemo
parents:
3038
diff
changeset
|
738 |
isTerminated := false; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
739 |
isInLag := false; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
740 |
isPaused := false; |
3066
5c0efa437728
Enable birdy. Has egg bombing. Eggs should possibly have a dX component. No poison yet, no egg sprite.
nemo
parents:
3038
diff
changeset
|
741 |
isMusicEnabled := false; |
5c0efa437728
Enable birdy. Has egg bombing. Eggs should possibly have a dX component. No poison yet, no egg sprite.
nemo
parents:
3038
diff
changeset
|
742 |
isInMultiShoot := false; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
743 |
isSpeed := false; |
3066
5c0efa437728
Enable birdy. Has egg bombing. Eggs should possibly have a dX component. No poison yet, no egg sprite.
nemo
parents:
3038
diff
changeset
|
744 |
fastUntilLag := false; |
3107 | 745 |
isFirstFrame := true; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
746 |
cVSyncInUse := true; |
3066
5c0efa437728
Enable birdy. Has egg bombing. Eggs should possibly have a dX component. No poison yet, no egg sprite.
nemo
parents:
3038
diff
changeset
|
747 |
isSoundEnabled := true; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
748 |
isSEBackup := true; |
2947 | 749 |
|
750 |
// init flags |
|
3066
5c0efa437728
Enable birdy. Has egg bombing. Eggs should possibly have a dX component. No poison yet, no egg sprite.
nemo
parents:
3038
diff
changeset
|
751 |
recordFileName := ''; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
752 |
cShowFPS := false; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
753 |
cCaseFactor := 5; {0..9} |
3066
5c0efa437728
Enable birdy. Has egg bombing. Eggs should possibly have a dX component. No poison yet, no egg sprite.
nemo
parents:
3038
diff
changeset
|
754 |
cLandAdditions := 4; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
755 |
cExplosives := 2; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
756 |
cFullScreen := false; |
3066
5c0efa437728
Enable birdy. Has egg bombing. Eggs should possibly have a dX component. No poison yet, no egg sprite.
nemo
parents:
3038
diff
changeset
|
757 |
cReducedQuality := false; |
5c0efa437728
Enable birdy. Has egg bombing. Eggs should possibly have a dX component. No poison yet, no egg sprite.
nemo
parents:
3038
diff
changeset
|
758 |
cLocaleFName := 'en.txt'; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
759 |
cSeed := ''; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
760 |
cInitVolume := 50; |
3066
5c0efa437728
Enable birdy. Has egg bombing. Eggs should possibly have a dX component. No poison yet, no egg sprite.
nemo
parents:
3038
diff
changeset
|
761 |
cVolumeDelta := 0; |
5c0efa437728
Enable birdy. Has egg bombing. Eggs should possibly have a dX component. No poison yet, no egg sprite.
nemo
parents:
3038
diff
changeset
|
762 |
cTimerInterval := 8; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
763 |
cHasFocus := true; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
764 |
cInactDelay := 1250; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
765 |
cAltDamage := true; |
3107 | 766 |
|
767 |
ScreenFade := sfNone; |
|
488 | 768 |
{$IFDEF DEBUGFILE} |
337 | 769 |
{$I-} |
2699
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
770 |
{$IFDEF IPHONEOS} |
2947 | 771 |
f:= stderr; |
2630 | 772 |
{$ELSE} |
2947 | 773 |
if ParamStr(1) <> '' then |
774 |
begin |
|
775 |
for i:= 0 to 7 do |
|
776 |
begin |
|
777 |
assign(f, ParamStr(1) + '/debug' + inttostr(i) + '.txt'); |
|
778 |
rewrite(f); |
|
779 |
if IOResult = 0 then break; |
|
780 |
end; |
|
781 |
if IOResult <> 0 then f:= stderr; // if everything fails, write to stderr |
|
782 |
end |
|
783 |
else |
|
784 |
f:= stderr; |
|
2699
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
785 |
{$ENDIF} |
337 | 786 |
{$I+} |
2699
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
787 |
{$ENDIF} |
17 | 788 |
|
2699
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
789 |
end; |
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
790 |
|
3038 | 791 |
procedure freeModule; |
2699
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
792 |
begin |
2947 | 793 |
//uRandom.DumpBuffer; |
794 |
while TextureList <> nil do FreeTexture(TextureList); |
|
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
|
795 |
|
2699
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
796 |
{$IFDEF DEBUGFILE} |
2947 | 797 |
writeln(f, 'halt at ', GameTicks, ' ticks. TurnTimeLeft = ', TurnTimeLeft); |
798 |
flush(f); |
|
799 |
close(f); |
|
4 | 800 |
{$ENDIF} |
2699
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
801 |
end; |
4 | 802 |
|
803 |
end. |