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