author | sheepluva |
Wed, 16 Jun 2010 21:14:23 +0200 | |
changeset 3508 | a7ca07614a2d |
parent 3464 | cdb0ddeb38ba |
child 3513 | f589230fa21b |
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 |
|
3464 | 173 |
uses Math, uConsole, uStore, uIO, 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 |
3407 | 249 |
// obsolete? written in WriteLnToConsole() anyway |
250 |
// {$IFDEF DEBUGFILE}AddFileLog(Msg);{$ENDIF} |
|
53 | 251 |
WriteLnToConsole(Msg); |
4 | 252 |
if isFatalError then |
3407 | 253 |
begin |
254 |
SendIPC('E' + GetLastConsoleLine); |
|
255 |
SDL_Quit; |
|
256 |
halt(1) |
|
257 |
end |
|
4 | 258 |
end; |
259 |
||
2905 | 260 |
procedure TryDo(Assert: boolean; Msg: shortstring; isFatal: boolean); |
4 | 261 |
begin |
70 | 262 |
if not Assert then OutError(Msg, isFatal) |
4 | 263 |
end; |
264 |
||
265 |
procedure SDLTry(Assert: boolean; isFatal: boolean); |
|
266 |
begin |
|
267 |
if not Assert then OutError(SDL_GetError, isFatal) |
|
268 |
end; |
|
269 |
||
188 | 270 |
procedure AdjustColor(var Color: Longword); |
4 | 271 |
begin |
272 |
Color:= SDL_MapRGB(PixelFormat, (Color shr 16) and $FF, (Color shr 8) and $FF, Color and $FF) |
|
273 |
end; |
|
274 |
||
316 | 275 |
function IntToStr(n: LongInt): shortstring; |
4 | 276 |
begin |
351 | 277 |
str(n, IntToStr) |
4 | 278 |
end; |
279 |
||
351 | 280 |
function FloatToStr(n: hwFloat): shortstring; |
4 | 281 |
begin |
1346 | 282 |
FloatToStr:= cstr(n) + '_' + inttostr(Lo(n.QWordValue)) |
4 | 283 |
end; |
284 |
||
2447
08d623a494e6
Smaxx's updated german translation + texture gap fixes + updated room list
koda
parents:
2428
diff
changeset
|
285 |
procedure SetTextureParameters(enableClamp: Boolean); |
08d623a494e6
Smaxx's updated german translation + texture gap fixes + updated room list
koda
parents:
2428
diff
changeset
|
286 |
begin |
08d623a494e6
Smaxx's updated german translation + texture gap fixes + updated room list
koda
parents:
2428
diff
changeset
|
287 |
if enableClamp and not cReducedQuality then |
08d623a494e6
Smaxx's updated german translation + texture gap fixes + updated room list
koda
parents:
2428
diff
changeset
|
288 |
begin |
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_S, GL_CLAMP_TO_EDGE); |
08d623a494e6
Smaxx's updated german translation + texture gap fixes + updated room list
koda
parents:
2428
diff
changeset
|
290 |
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
|
291 |
end; |
08d623a494e6
Smaxx's updated german translation + texture gap fixes + updated room list
koda
parents:
2428
diff
changeset
|
292 |
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
|
293 |
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
|
294 |
end; |
08d623a494e6
Smaxx's updated german translation + texture gap fixes + updated room list
koda
parents:
2428
diff
changeset
|
295 |
|
775 | 296 |
function DxDy2Angle(const _dY, _dX: hwFloat): GLfloat; |
297 |
var dY, dX: Extended; |
|
298 |
begin |
|
299 |
dY:= _dY.QWordValue / $100000000; |
|
300 |
if _dY.isNegative then dY:= - dY; |
|
301 |
dX:= _dX.QWordValue / $100000000; |
|
302 |
if _dX.isNegative then dX:= - dX; |
|
303 |
DxDy2Angle:= arctan2(dY, dX) * 180 / pi |
|
304 |
end; |
|
305 |
||
371 | 306 |
function DxDy2Angle32(const _dY, _dX: hwFloat): LongInt; |
100 | 307 |
const _16divPI: Extended = 16/pi; |
370
c75410fe3133
- Repair bots: they can walk and use bazooka, possible cannot jump (why?)
unc0rr
parents:
351
diff
changeset
|
308 |
var dY, dX: Extended; |
100 | 309 |
begin |
370
c75410fe3133
- Repair bots: they can walk and use bazooka, possible cannot jump (why?)
unc0rr
parents:
351
diff
changeset
|
310 |
dY:= _dY.QWordValue / $100000000; |
c75410fe3133
- Repair bots: they can walk and use bazooka, possible cannot jump (why?)
unc0rr
parents:
351
diff
changeset
|
311 |
if _dY.isNegative then dY:= - dY; |
c75410fe3133
- Repair bots: they can walk and use bazooka, possible cannot jump (why?)
unc0rr
parents:
351
diff
changeset
|
312 |
dX:= _dX.QWordValue / $100000000; |
c75410fe3133
- Repair bots: they can walk and use bazooka, possible cannot jump (why?)
unc0rr
parents:
351
diff
changeset
|
313 |
if _dX.isNegative then dX:= - dX; |
c75410fe3133
- Repair bots: they can walk and use bazooka, possible cannot jump (why?)
unc0rr
parents:
351
diff
changeset
|
314 |
DxDy2Angle32:= trunc(arctan2(dY, dX) * _16divPI) and $1f |
4 | 315 |
end; |
316 |
||
371 | 317 |
function DxDy2AttackAngle(const _dY, _dX: hwFloat): LongInt; |
100 | 318 |
const MaxAngleDivPI: Extended = cMaxAngle/pi; |
370
c75410fe3133
- Repair bots: they can walk and use bazooka, possible cannot jump (why?)
unc0rr
parents:
351
diff
changeset
|
319 |
var dY, dX: Extended; |
100 | 320 |
begin |
370
c75410fe3133
- Repair bots: they can walk and use bazooka, possible cannot jump (why?)
unc0rr
parents:
351
diff
changeset
|
321 |
dY:= _dY.QWordValue / $100000000; |
c75410fe3133
- Repair bots: they can walk and use bazooka, possible cannot jump (why?)
unc0rr
parents:
351
diff
changeset
|
322 |
if _dY.isNegative then dY:= - dY; |
c75410fe3133
- Repair bots: they can walk and use bazooka, possible cannot jump (why?)
unc0rr
parents:
351
diff
changeset
|
323 |
dX:= _dX.QWordValue / $100000000; |
c75410fe3133
- Repair bots: they can walk and use bazooka, possible cannot jump (why?)
unc0rr
parents:
351
diff
changeset
|
324 |
if _dX.isNegative then dX:= - dX; |
438 | 325 |
DxDy2AttackAngle:= trunc(arctan2(dY, dX) * MaxAngleDivPI) |
100 | 326 |
end; |
4 | 327 |
|
208 | 328 |
procedure SetKB(n: Longword); |
329 |
begin |
|
330 |
KBnum:= n |
|
331 |
end; |
|
332 |
||
333 |
procedure SendKB; |
|
334 |
var s: shortstring; |
|
335 |
begin |
|
336 |
if KBnum <> 0 then |
|
2947 | 337 |
begin |
338 |
s:= 'K' + inttostr(KBnum); |
|
339 |
SendIPCRaw(@s, Length(s) + 1) |
|
340 |
end |
|
208 | 341 |
end; |
342 |
||
351 | 343 |
procedure SetLittle(var r: hwFloat); |
300 | 344 |
begin |
553
5478386d935f
- Switch to bazooka (or whatever) after use of some weapon (fixes problem with bots)
unc0rr
parents:
543
diff
changeset
|
345 |
r:= SignAs(cLittle, r) |
300 | 346 |
end; |
347 |
||
337 | 348 |
procedure SendStat(sit: TStatInfoType; s: shortstring); |
3381 | 349 |
const stc: array [TStatInfoType] of char = 'rDkKHT'; |
2382 | 350 |
var buf: shortstring; |
337 | 351 |
begin |
2382 | 352 |
buf:= 'i' + stc[sit] + s; |
353 |
SendIPCRaw(@buf[0], length(buf) + 1) |
|
337 | 354 |
end; |
355 |
||
534 | 356 |
function Str2PChar(const s: shortstring): PChar; |
351 | 357 |
const CharArray: array[byte] of Char = ''; |
358 |
begin |
|
359 |
CharArray:= s; |
|
360 |
CharArray[Length(s)]:= #0; |
|
361 |
Str2PChar:= @CharArray |
|
362 |
end; |
|
363 |
||
771 | 364 |
function isPowerOf2(i: Longword): boolean; |
365 |
begin |
|
366 |
if i = 0 then exit(true); |
|
367 |
while (i and 1) = 0 do i:= i shr 1; |
|
368 |
isPowerOf2:= (i = 1) |
|
369 |
end; |
|
370 |
||
371 |
function toPowerOf2(i: Longword): Longword; |
|
372 |
begin |
|
373 |
toPowerOf2:= 1; |
|
374 |
while (toPowerOf2 < i) do toPowerOf2:= toPowerOf2 shl 1 |
|
375 |
end; |
|
376 |
||
1912
c3d31fb59f0e
Save much CPU time by initializing vertex arrays in texture creation function
unc0rr
parents:
1911
diff
changeset
|
377 |
procedure ResetVertexArrays(texture: PTexture); |
c3d31fb59f0e
Save much CPU time by initializing vertex arrays in texture creation function
unc0rr
parents:
1911
diff
changeset
|
378 |
begin |
c3d31fb59f0e
Save much CPU time by initializing vertex arrays in texture creation function
unc0rr
parents:
1911
diff
changeset
|
379 |
with texture^ do |
2947 | 380 |
begin |
381 |
vb[0].X:= 0; |
|
382 |
vb[0].Y:= 0; |
|
383 |
vb[1].X:= w; |
|
384 |
vb[1].Y:= 0; |
|
385 |
vb[2].X:= w; |
|
386 |
vb[2].Y:= h; |
|
387 |
vb[3].X:= 0; |
|
388 |
vb[3].Y:= h; |
|
1912
c3d31fb59f0e
Save much CPU time by initializing vertex arrays in texture creation function
unc0rr
parents:
1911
diff
changeset
|
389 |
|
2947 | 390 |
tb[0].X:= 0; |
391 |
tb[0].Y:= 0; |
|
392 |
tb[1].X:= rx; |
|
393 |
tb[1].Y:= 0; |
|
394 |
tb[2].X:= rx; |
|
395 |
tb[2].Y:= ry; |
|
396 |
tb[3].X:= 0; |
|
397 |
tb[3].Y:= ry |
|
398 |
end; |
|
1912
c3d31fb59f0e
Save much CPU time by initializing vertex arrays in texture creation function
unc0rr
parents:
1911
diff
changeset
|
399 |
end; |
c3d31fb59f0e
Save much CPU time by initializing vertex arrays in texture creation function
unc0rr
parents:
1911
diff
changeset
|
400 |
|
1180
e56317fdf78d
Start implementing support for 32bit sprites concerned in map generation process.
unc0rr
parents:
1128
diff
changeset
|
401 |
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
|
402 |
begin |
e56317fdf78d
Start implementing support for 32bit sprites concerned in map generation process.
unc0rr
parents:
1128
diff
changeset
|
403 |
new(NewTexture); |
2715
0e4e0db79e2a
Free up some unfreed memory. Needed for Koda's iphone lib work
nemo
parents:
2705
diff
changeset
|
404 |
NewTexture^.PrevTexture:= nil; |
0e4e0db79e2a
Free up some unfreed memory. Needed for Koda's iphone lib work
nemo
parents:
2705
diff
changeset
|
405 |
NewTexture^.NextTexture:= nil; |
0e4e0db79e2a
Free up some unfreed memory. Needed for Koda's iphone lib work
nemo
parents:
2705
diff
changeset
|
406 |
if TextureList <> nil then |
0e4e0db79e2a
Free up some unfreed memory. Needed for Koda's iphone lib work
nemo
parents:
2705
diff
changeset
|
407 |
begin |
0e4e0db79e2a
Free up some unfreed memory. Needed for Koda's iphone lib work
nemo
parents:
2705
diff
changeset
|
408 |
TextureList^.PrevTexture:= NewTexture; |
0e4e0db79e2a
Free up some unfreed memory. Needed for Koda's iphone lib work
nemo
parents:
2705
diff
changeset
|
409 |
NewTexture^.NextTexture:= TextureList |
0e4e0db79e2a
Free up some unfreed memory. Needed for Koda's iphone lib work
nemo
parents:
2705
diff
changeset
|
410 |
end; |
0e4e0db79e2a
Free up some unfreed memory. Needed for Koda's iphone lib work
nemo
parents:
2705
diff
changeset
|
411 |
TextureList:= NewTexture; |
0e4e0db79e2a
Free up some unfreed memory. Needed for Koda's iphone lib work
nemo
parents:
2705
diff
changeset
|
412 |
|
1180
e56317fdf78d
Start implementing support for 32bit sprites concerned in map generation process.
unc0rr
parents:
1128
diff
changeset
|
413 |
NewTexture^.w:= width; |
e56317fdf78d
Start implementing support for 32bit sprites concerned in map generation process.
unc0rr
parents:
1128
diff
changeset
|
414 |
NewTexture^.h:= height; |
1896 | 415 |
NewTexture^.rx:= 1.0; |
416 |
NewTexture^.ry:= 1.0; |
|
1180
e56317fdf78d
Start implementing support for 32bit sprites concerned in map generation process.
unc0rr
parents:
1128
diff
changeset
|
417 |
|
1912
c3d31fb59f0e
Save much CPU time by initializing vertex arrays in texture creation function
unc0rr
parents:
1911
diff
changeset
|
418 |
ResetVertexArrays(NewTexture); |
c3d31fb59f0e
Save much CPU time by initializing vertex arrays in texture creation function
unc0rr
parents:
1911
diff
changeset
|
419 |
|
1180
e56317fdf78d
Start implementing support for 32bit sprites concerned in map generation process.
unc0rr
parents:
1128
diff
changeset
|
420 |
glGenTextures(1, @NewTexture^.id); |
e56317fdf78d
Start implementing support for 32bit sprites concerned in map generation process.
unc0rr
parents:
1128
diff
changeset
|
421 |
|
e56317fdf78d
Start implementing support for 32bit sprites concerned in map generation process.
unc0rr
parents:
1128
diff
changeset
|
422 |
glBindTexture(GL_TEXTURE_2D, NewTexture^.id); |
e56317fdf78d
Start implementing support for 32bit sprites concerned in map generation process.
unc0rr
parents:
1128
diff
changeset
|
423 |
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
|
424 |
|
2447
08d623a494e6
Smaxx's updated german translation + texture gap fixes + updated room list
koda
parents:
2428
diff
changeset
|
425 |
SetTextureParameters(true); |
1180
e56317fdf78d
Start implementing support for 32bit sprites concerned in map generation process.
unc0rr
parents:
1128
diff
changeset
|
426 |
end; |
e56317fdf78d
Start implementing support for 32bit sprites concerned in map generation process.
unc0rr
parents:
1128
diff
changeset
|
427 |
|
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
|
428 |
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
|
429 |
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
|
430 |
tmpp: pointer; |
2eb7ce1c1f19
code cleanup for Surface2Tex (we don't have 3 bytes surfaces any more)
koda
parents:
2575
diff
changeset
|
431 |
fromP4, toP4: PLongWordArray; |
753 | 432 |
begin |
755 | 433 |
new(Surface2Tex); |
2715
0e4e0db79e2a
Free up some unfreed memory. Needed for Koda's iphone lib work
nemo
parents:
2705
diff
changeset
|
434 |
Surface2Tex^.PrevTexture:= nil; |
0e4e0db79e2a
Free up some unfreed memory. Needed for Koda's iphone lib work
nemo
parents:
2705
diff
changeset
|
435 |
Surface2Tex^.NextTexture:= nil; |
0e4e0db79e2a
Free up some unfreed memory. Needed for Koda's iphone lib work
nemo
parents:
2705
diff
changeset
|
436 |
if TextureList <> nil then |
0e4e0db79e2a
Free up some unfreed memory. Needed for Koda's iphone lib work
nemo
parents:
2705
diff
changeset
|
437 |
begin |
0e4e0db79e2a
Free up some unfreed memory. Needed for Koda's iphone lib work
nemo
parents:
2705
diff
changeset
|
438 |
TextureList^.PrevTexture:= Surface2Tex; |
0e4e0db79e2a
Free up some unfreed memory. Needed for Koda's iphone lib work
nemo
parents:
2705
diff
changeset
|
439 |
Surface2Tex^.NextTexture:= TextureList |
0e4e0db79e2a
Free up some unfreed memory. Needed for Koda's iphone lib work
nemo
parents:
2705
diff
changeset
|
440 |
end; |
0e4e0db79e2a
Free up some unfreed memory. Needed for Koda's iphone lib work
nemo
parents:
2705
diff
changeset
|
441 |
TextureList:= Surface2Tex; |
0e4e0db79e2a
Free up some unfreed memory. Needed for Koda's iphone lib work
nemo
parents:
2705
diff
changeset
|
442 |
|
755 | 443 |
Surface2Tex^.w:= surf^.w; |
444 |
Surface2Tex^.h:= surf^.h; |
|
445 |
||
2576
2eb7ce1c1f19
code cleanup for Surface2Tex (we don't have 3 bytes surfaces any more)
koda
parents:
2575
diff
changeset
|
446 |
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
|
447 |
begin |
2947 | 448 |
TryDo(false, 'Surface2Tex failed, expecting 32 bit surface', true); |
449 |
Surface2Tex^.id:= 0; |
|
450 |
exit |
|
2576
2eb7ce1c1f19
code cleanup for Surface2Tex (we don't have 3 bytes surfaces any more)
koda
parents:
2575
diff
changeset
|
451 |
end; |
2eb7ce1c1f19
code cleanup for Surface2Tex (we don't have 3 bytes surfaces any more)
koda
parents:
2575
diff
changeset
|
452 |
|
753 | 453 |
|
755 | 454 |
glGenTextures(1, @Surface2Tex^.id); |
753 | 455 |
|
755 | 456 |
glBindTexture(GL_TEXTURE_2D, Surface2Tex^.id); |
753 | 457 |
|
771 | 458 |
if SDL_MustLock(surf) then |
2947 | 459 |
SDLTry(SDL_LockSurface(surf) >= 0, true); |
771 | 460 |
|
2428 | 461 |
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
|
462 |
begin |
2947 | 463 |
tw:= toPowerOf2(Surf^.w); |
464 |
th:= toPowerOf2(Surf^.h); |
|
1896 | 465 |
|
2947 | 466 |
Surface2Tex^.rx:= Surf^.w / tw; |
467 |
Surface2Tex^.ry:= Surf^.h / th; |
|
2376 | 468 |
|
2947 | 469 |
GetMem(tmpp, tw * th * surf^.format^.BytesPerPixel); |
1896 | 470 |
|
2947 | 471 |
fromP4:= Surf^.pixels; |
472 |
toP4:= tmpp; |
|
771 | 473 |
|
2947 | 474 |
for y:= 0 to Pred(Surf^.h) do |
475 |
begin |
|
476 |
for x:= 0 to Pred(Surf^.w) do toP4^[x]:= fromP4^[x]; |
|
477 |
for x:= Surf^.w to Pred(tw) do toP4^[x]:= 0; |
|
478 |
toP4:= @(toP4^[tw]); |
|
479 |
fromP4:= @(fromP4^[Surf^.pitch div 4]); |
|
480 |
end; |
|
1896 | 481 |
|
2947 | 482 |
for y:= Surf^.h to Pred(th) do |
483 |
begin |
|
484 |
for x:= 0 to Pred(tw) do toP4^[x]:= 0; |
|
485 |
toP4:= @(toP4^[tw]); |
|
486 |
end; |
|
771 | 487 |
|
2947 | 488 |
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, tw, th, 0, GL_RGBA, GL_UNSIGNED_BYTE, tmpp); |
2376 | 489 |
|
2947 | 490 |
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
|
491 |
end |
2eb7ce1c1f19
code cleanup for Surface2Tex (we don't have 3 bytes surfaces any more)
koda
parents:
2575
diff
changeset
|
492 |
else |
2eb7ce1c1f19
code cleanup for Surface2Tex (we don't have 3 bytes surfaces any more)
koda
parents:
2575
diff
changeset
|
493 |
begin |
2947 | 494 |
Surface2Tex^.rx:= 1.0; |
495 |
Surface2Tex^.ry:= 1.0; |
|
496 |
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
|
497 |
end; |
753 | 498 |
|
1912
c3d31fb59f0e
Save much CPU time by initializing vertex arrays in texture creation function
unc0rr
parents:
1911
diff
changeset
|
499 |
ResetVertexArrays(Surface2Tex); |
c3d31fb59f0e
Save much CPU time by initializing vertex arrays in texture creation function
unc0rr
parents:
1911
diff
changeset
|
500 |
|
754 | 501 |
if SDL_MustLock(surf) then |
2947 | 502 |
SDL_UnlockSurface(surf); |
754 | 503 |
|
2447
08d623a494e6
Smaxx's updated german translation + texture gap fixes + updated room list
koda
parents:
2428
diff
changeset
|
504 |
SetTextureParameters(enableClamp); |
753 | 505 |
end; |
506 |
||
759 | 507 |
procedure FreeTexture(tex: PTexture); |
508 |
begin |
|
2000
f9f47e681aad
Don't crash engine after round in reduced quality mode
unc0rr
parents:
1916
diff
changeset
|
509 |
if tex <> nil then |
2947 | 510 |
begin |
2715
0e4e0db79e2a
Free up some unfreed memory. Needed for Koda's iphone lib work
nemo
parents:
2705
diff
changeset
|
511 |
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
|
512 |
if tex^.PrevTexture <> nil then tex^.PrevTexture^.NextTexture:= tex^.NextTexture |
2947 | 513 |
else TextureList:= tex^.NextTexture; |
514 |
glDeleteTextures(1, @tex^.id); |
|
515 |
Dispose(tex) |
|
516 |
end |
|
759 | 517 |
end; |
337 | 518 |
|
949 | 519 |
function DecodeBase64(s: shortstring): shortstring; |
520 |
const table = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; |
|
521 |
var i, t, c: Longword; |
|
522 |
begin |
|
523 |
c:= 0; |
|
524 |
for i:= 1 to Length(s) do |
|
2947 | 525 |
begin |
526 |
t:= Pos(s[i], table); |
|
527 |
if s[i] = '=' then inc(c); |
|
528 |
if t > 0 then byte(s[i]):= t - 1 else byte(s[i]):= 0 |
|
529 |
end; |
|
949 | 530 |
|
531 |
i:= 1; |
|
532 |
t:= 1; |
|
533 |
while i <= length(s) do |
|
2947 | 534 |
begin |
535 |
DecodeBase64[t ]:= char((byte(s[i ]) shl 2) or (byte(s[i + 1]) shr 4)); |
|
536 |
DecodeBase64[t + 1]:= char((byte(s[i + 1]) shl 4) or (byte(s[i + 2]) shr 2)); |
|
537 |
DecodeBase64[t + 2]:= char((byte(s[i + 2]) shl 6) or (byte(s[i + 3]) )); |
|
538 |
inc(t, 3); |
|
539 |
inc(i, 4) |
|
540 |
end; |
|
949 | 541 |
|
542 |
if c < 3 then t:= t - c; |
|
543 |
||
544 |
byte(DecodeBase64[0]):= t - 1 |
|
545 |
end; |
|
546 |
||
2163
12730f5e79b9
koda's patch fixing some iphone port troubles (color, mouse)
unc0rr
parents:
2162
diff
changeset
|
547 |
{$IFNDEF IPHONEOS} |
2735 | 548 |
procedure MakeScreenshot(filename: shortstring); |
1080 | 549 |
var p: Pointer; |
2947 | 550 |
size: Longword; |
551 |
f: file; |
|
2735 | 552 |
{$IFNDEF WIN32} |
2947 | 553 |
// TGA Header |
554 |
head: array[0..8] of Word = (0, 2, 0, 0, 0, 0, 0, 0, 24); |
|
2735 | 555 |
{$ELSE} |
2947 | 556 |
// Windows Bitmap Header |
557 |
head: array[0..53] of Byte = ( |
|
558 |
$42, $4D, // identifier ("BM") |
|
559 |
0, 0, 0, 0, // file size |
|
560 |
0, 0, 0, 0, // reserved |
|
561 |
54, 0, 0, 0, // starting offset |
|
562 |
40, 0, 0, 0, // header size |
|
563 |
0, 0, 0, 0, // width |
|
564 |
0, 0, 0, 0, // height |
|
565 |
1, 0, // color planes |
|
566 |
24, 0, // bit depth |
|
567 |
0, 0, 0, 0, // compression method (uncompressed) |
|
568 |
0, 0, 0, 0, // image size |
|
569 |
96, 0, 0, 0, // horizontal resolution |
|
570 |
96, 0, 0, 0, // vertical resolution |
|
571 |
0, 0, 0, 0, // number of colors (all) |
|
572 |
0, 0, 0, 0 // number of important colors |
|
573 |
); |
|
2735 | 574 |
{$ENDIF} |
1080 | 575 |
begin |
2745 | 576 |
playSound(sndShutter); |
1080 | 577 |
|
3107 | 578 |
// flash |
579 |
ScreenFade:= sfFromWhite; |
|
580 |
ScreenFadeValue:= sfMax; |
|
581 |
ScreenFadeSpeed:= 5; |
|
582 |
||
1080 | 583 |
size:= cScreenWidth * cScreenHeight * 3; |
584 |
p:= GetMem(size); |
|
585 |
||
2735 | 586 |
// update header information and file name |
587 |
{$IFNDEF WIN32} |
|
3350 | 588 |
filename:= ParamStr(1) + '/Screenshots/' + filename + '.tga'; |
2735 | 589 |
|
590 |
head[6]:= cScreenWidth; |
|
591 |
head[7]:= cScreenHeight; |
|
592 |
{$ELSE} |
|
3350 | 593 |
filename:= ParamStr(1) + '/Screenshots/' + filename + '.bmp'; |
2735 | 594 |
|
595 |
head[$02]:= (size + 54) and $ff; |
|
596 |
head[$03]:= ((size + 54) shr 8) and $ff; |
|
597 |
head[$04]:= ((size + 54) shr 16) and $ff; |
|
598 |
head[$05]:= ((size + 54) shr 24) and $ff; |
|
599 |
head[$12]:= cScreenWidth and $ff; |
|
600 |
head[$13]:= (cScreenWidth shr 8) and $ff; |
|
601 |
head[$14]:= (cScreenWidth shr 16) and $ff; |
|
602 |
head[$15]:= (cScreenWidth shr 24) and $ff; |
|
603 |
head[$16]:= cScreenHeight and $ff; |
|
604 |
head[$17]:= (cScreenHeight shr 8) and $ff; |
|
605 |
head[$18]:= (cScreenHeight shr 16) and $ff; |
|
606 |
head[$19]:= (cScreenHeight shr 24) and $ff; |
|
607 |
head[$22]:= size and $ff; |
|
608 |
head[$23]:= (size shr 8) and $ff; |
|
609 |
head[$24]:= (size shr 16) and $ff; |
|
610 |
head[$25]:= (size shr 24) and $ff; |
|
611 |
{$ENDIF} |
|
2163
12730f5e79b9
koda's patch fixing some iphone port troubles (color, mouse)
unc0rr
parents:
2162
diff
changeset
|
612 |
|
12730f5e79b9
koda's patch fixing some iphone port troubles (color, mouse)
unc0rr
parents:
2162
diff
changeset
|
613 |
//remember that opengles operates on a single surface, so GL_FRONT *should* be implied |
1080 | 614 |
glReadBuffer(GL_FRONT); |
615 |
glReadPixels(0, 0, cScreenWidth, cScreenHeight, GL_BGR, GL_UNSIGNED_BYTE, p); |
|
616 |
||
617 |
{$I-} |
|
2735 | 618 |
Assign(f, filename); |
1080 | 619 |
Rewrite(f, 1); |
620 |
if IOResult = 0 then |
|
2947 | 621 |
begin |
622 |
BlockWrite(f, head, sizeof(head)); |
|
623 |
BlockWrite(f, p^, size); |
|
624 |
Close(f); |
|
625 |
end; |
|
1080 | 626 |
{$I+} |
627 |
||
628 |
FreeMem(p) |
|
629 |
end; |
|
2163
12730f5e79b9
koda's patch fixing some iphone port troubles (color, mouse)
unc0rr
parents:
2162
diff
changeset
|
630 |
{$ENDIF} |
1080 | 631 |
|
949 | 632 |
{$IFDEF DEBUGFILE} |
633 |
procedure AddFileLog(s: shortstring); |
|
634 |
begin |
|
635 |
writeln(f, GameTicks: 6, ': ', s); |
|
636 |
flush(f) |
|
637 |
end; |
|
638 |
||
639 |
function RectToStr(Rect: TSDL_Rect): shortstring; |
|
640 |
begin |
|
641 |
RectToStr:= '(x: ' + inttostr(rect.x) + '; y: ' + inttostr(rect.y) + '; w: ' + inttostr(rect.w) + '; h: ' + inttostr(rect.h) + ')' |
|
642 |
end; |
|
2242 | 643 |
{$ENDIF} |
306 | 644 |
|
2619 | 645 |
function doSurfaceConversion(tmpsurf: PSDL_Surface): PSDL_Surface; |
646 |
{* for more information http://www.idevgames.com/forum/showpost.php?p=85864&postcount=7 *} |
|
647 |
var convertedSurf: PSDL_Surface = nil; |
|
648 |
begin |
|
2947 | 649 |
if (tmpsurf^.format^.bitsperpixel = 24) or ((tmpsurf^.format^.bitsperpixel = 32) and (tmpsurf^.format^.rshift > tmpsurf^.format^.bshift)) then |
650 |
begin |
|
651 |
convertedSurf:= SDL_ConvertSurface(tmpsurf, @conversionFormat, SDL_SWSURFACE); |
|
652 |
SDL_FreeSurface(tmpsurf); |
|
653 |
exit(convertedSurf); |
|
654 |
end; |
|
2705
2b5625c4ec16
fix a nasty 196 bytes memory leak in engine, plus other stuff for iphone frontend
koda
parents:
2699
diff
changeset
|
655 |
|
2947 | 656 |
exit(tmpsurf); |
2619 | 657 |
end; |
658 |
||
2670 | 659 |
function endian(independent: LongWord): LongWord; |
660 |
begin |
|
661 |
{$IFDEF ENDIAN_LITTLE} |
|
662 |
endian:= independent; |
|
663 |
{$ELSE} |
|
664 |
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
|
665 |
((independent and $00FF0000) shr 8) or |
37ac593e9027
wow all these files only for land preview and seed generation
koda
parents:
3355
diff
changeset
|
666 |
((independent and $0000FF00) shl 8) or |
37ac593e9027
wow all these files only for land preview and seed generation
koda
parents:
3355
diff
changeset
|
667 |
((independent and $000000FF) shl 24)) |
2670 | 668 |
{$ENDIF} |
669 |
end; |
|
2630 | 670 |
|
2699
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
671 |
|
3038 | 672 |
procedure initModule; |
3305 | 673 |
{$IFDEF DEBUGFILE}{$IFNDEF IPHONEOS}var i: LongInt;{$ENDIF}{$ENDIF} |
2699
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
674 |
begin |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
675 |
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
|
676 |
cMaxWindSpeed.QWordValue:= 1073742; // 0.00025 |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
677 |
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
|
678 |
cGravity := cMaxWindSpeed * 2; |
2947 | 679 |
cDamageModifier := _1; |
680 |
TargetPoint := cTargetPointRef; |
|
681 |
TextureList := nil; |
|
682 |
||
683 |
// int, longint longword and byte |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
684 |
CursorMovementX := 0; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
685 |
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
|
686 |
GameTicks := 0; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
687 |
TrainingTimeInc := 10000; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
688 |
TrainingTimeInD := 500; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
689 |
TrainingTimeInM := 5000; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
690 |
TrainingTimeMax := 60000; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
691 |
TimeTrialStartTime := 0; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
692 |
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
|
693 |
cWaterLine := LAND_HEIGHT; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
694 |
cGearScrEdgesDist := 240; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
695 |
cHealthDecrease := 0; |
2699
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
696 |
|
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
|
697 |
GameFlags := 0; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
698 |
TrainingFlags := 0; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
699 |
TurnTimeLeft := 0; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
700 |
cSuddenDTurns := 15; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
701 |
cDamagePercent := 100; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
702 |
cMineDudPercent := 0; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
703 |
cTemplateFilter := 0; |
3133 | 704 |
cMapGen := 0;//MAPGEN_REGULAR |
705 |
cMazeSize := 0; |
|
2699
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
706 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
707 |
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
|
708 |
cMinesTime := 3000; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
709 |
cMaxAIThinkTime := 9000; |
2699
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
710 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
711 |
cCloudsNumber := 9; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
712 |
cScreenWidth := 1024; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
713 |
cScreenHeight := 768; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
714 |
cInitWidth := cScreenWidth; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
715 |
cInitHeight := cScreenHeight; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
716 |
cBits := 32; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
717 |
cTagsMask := 0; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
718 |
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
|
719 |
InitStepsFlags := 0; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
720 |
RealTicks := 0; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
721 |
AttackBar := 0; // 0 - none, 1 - just bar at the right-down corner, 2 - like in WWP |
2947 | 722 |
|
723 |
// tgametype and glfloat and string |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
724 |
GameState := Low(TGameState); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
725 |
GameType := gmtLocal; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
726 |
zoom := 2.0; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
727 |
ZoomValue := 2.0; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
728 |
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
|
729 |
WeaponTooltipTex:= nil; |
2699
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
730 |
|
2947 | 731 |
// 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
|
732 |
cLaserSighting := false; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
733 |
cVampiric := false; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
734 |
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
|
735 |
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
|
736 |
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
|
737 |
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
|
738 |
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
|
739 |
isTerminated := false; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
740 |
isInLag := false; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
741 |
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
|
742 |
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
|
743 |
isInMultiShoot := false; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
744 |
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
|
745 |
fastUntilLag := false; |
3107 | 746 |
isFirstFrame := true; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
747 |
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
|
748 |
isSoundEnabled := true; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
749 |
isSEBackup := true; |
2947 | 750 |
|
751 |
// 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
|
752 |
recordFileName := ''; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
753 |
cShowFPS := false; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
754 |
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
|
755 |
cLandAdditions := 4; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
756 |
cExplosives := 2; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
757 |
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
|
758 |
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
|
759 |
cLocaleFName := 'en.txt'; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
760 |
cSeed := ''; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
761 |
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
|
762 |
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
|
763 |
cTimerInterval := 8; |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
764 |
cHasFocus := true; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
765 |
cInactDelay := 1250; |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2947
diff
changeset
|
766 |
cAltDamage := true; |
3107 | 767 |
|
768 |
ScreenFade := sfNone; |
|
488 | 769 |
{$IFDEF DEBUGFILE} |
337 | 770 |
{$I-} |
2699
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
771 |
{$IFDEF IPHONEOS} |
3377 | 772 |
Assign(f,'../Documents/debug.txt'); |
773 |
Rewrite(f); |
|
2630 | 774 |
{$ELSE} |
2947 | 775 |
if ParamStr(1) <> '' then |
776 |
begin |
|
777 |
for i:= 0 to 7 do |
|
778 |
begin |
|
779 |
assign(f, ParamStr(1) + '/debug' + inttostr(i) + '.txt'); |
|
780 |
rewrite(f); |
|
781 |
if IOResult = 0 then break; |
|
782 |
end; |
|
783 |
if IOResult <> 0 then f:= stderr; // if everything fails, write to stderr |
|
784 |
end |
|
785 |
else |
|
786 |
f:= stderr; |
|
2699
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
787 |
{$ENDIF} |
337 | 788 |
{$I+} |
2699
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
789 |
{$ENDIF} |
17 | 790 |
|
2699
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
791 |
end; |
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
792 |
|
3038 | 793 |
procedure freeModule; |
2699
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
794 |
begin |
2947 | 795 |
//uRandom.DumpBuffer; |
796 |
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
|
797 |
|
2699
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
798 |
{$IFDEF DEBUGFILE} |
2947 | 799 |
writeln(f, 'halt at ', GameTicks, ' ticks. TurnTimeLeft = ', TurnTimeLeft); |
800 |
flush(f); |
|
801 |
close(f); |
|
4 | 802 |
{$ENDIF} |
2699
249adefa9c1c
replace initialization/finalization statements with custom init functions
koda
parents:
2698
diff
changeset
|
803 |
end; |
4 | 804 |
|
805 |
end. |