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