4359
|
1 |
{$INCLUDE options.inc}
|
|
2 |
|
|
3 |
unit uVariables;
|
|
4 |
interface
|
|
5 |
|
|
6 |
uses SDLh, uTypes, uFloat, GLunit, uConsts, Math, uMobile;
|
|
7 |
|
|
8 |
var
|
|
9 |
/////// init flags ///////
|
|
10 |
cScreenWidth : LongInt = 1024;
|
|
11 |
cScreenHeight : LongInt = 768;
|
|
12 |
cBits : LongInt = 32;
|
|
13 |
//ipcPort is in uIO
|
|
14 |
cFullScreen : boolean = false;
|
|
15 |
isSoundEnabled : boolean = true;
|
|
16 |
isMusicEnabled : boolean = false;
|
|
17 |
cLocaleFName : shortstring = 'en.txt';
|
|
18 |
cInitVolume : LongInt = 100;
|
|
19 |
cTimerInterval : LongInt = 8;
|
|
20 |
PathPrefix : shortstring = './';
|
|
21 |
cShowFPS : boolean = false;
|
|
22 |
cAltDamage : boolean = true;
|
|
23 |
cReducedQuality : LongWord = rqNone;
|
|
24 |
//userNick is in uChat
|
|
25 |
recordFileName : shortstring = '';
|
|
26 |
cReadyDelay : Longword = 0;
|
|
27 |
cLogfileBase : shortstring = 'debug';
|
|
28 |
//////////////////////////
|
|
29 |
|
|
30 |
isCursorVisible : boolean;
|
|
31 |
isTerminated : boolean;
|
|
32 |
isInLag : boolean;
|
|
33 |
isPaused : boolean;
|
|
34 |
|
|
35 |
isSEBackup : boolean;
|
|
36 |
isInMultiShoot : boolean;
|
|
37 |
isSpeed : boolean;
|
|
38 |
isFirstFrame : boolean;
|
|
39 |
|
|
40 |
fastUntilLag : boolean;
|
|
41 |
|
|
42 |
GameState : TGameState;
|
|
43 |
GameType : TGameType;
|
|
44 |
GameFlags : Longword;
|
|
45 |
TrainingFlags : Longword;
|
|
46 |
TurnTimeLeft : Longword;
|
|
47 |
ReadyTimeLeft : Longword;
|
|
48 |
cSuddenDTurns : LongInt;
|
|
49 |
cDamagePercent : LongInt;
|
|
50 |
cMineDudPercent : LongWord;
|
|
51 |
cTemplateFilter : LongInt;
|
|
52 |
cMapGen : LongInt;
|
|
53 |
cMazeSize : LongInt;
|
|
54 |
|
|
55 |
cHedgehogTurnTime: Longword;
|
|
56 |
cMinesTime : LongInt;
|
|
57 |
cMaxAIThinkTime : Longword;
|
|
58 |
|
|
59 |
cHealthCaseProb : LongInt;
|
|
60 |
cHealthCaseAmount: LongInt;
|
|
61 |
cWaterRise : LongInt;
|
|
62 |
cHealthDecrease : LongInt;
|
|
63 |
|
|
64 |
cCloudsNumber : LongInt;
|
|
65 |
|
|
66 |
cTagsMask : byte;
|
|
67 |
zoom : GLfloat;
|
|
68 |
ZoomValue : GLfloat;
|
|
69 |
|
|
70 |
cWaterLine : LongInt;
|
|
71 |
cGearScrEdgesDist: LongInt;
|
|
72 |
|
|
73 |
GameTicks : LongWord;
|
|
74 |
TrainingTimeInc : Longword;
|
|
75 |
TrainingTimeInD : Longword;
|
|
76 |
TrainingTimeInM : Longword;
|
|
77 |
TrainingTimeMax : Longword;
|
|
78 |
|
|
79 |
TimeTrialStartTime: Longword;
|
|
80 |
TimeTrialStopTime : Longword;
|
|
81 |
|
|
82 |
// originally from uConsts
|
|
83 |
Pathz: array[TPathType] of shortstring;
|
|
84 |
CountTexz: array[1..Pred(AMMO_INFINITE)] of PTexture;
|
|
85 |
LAND_WIDTH : LongInt;
|
|
86 |
LAND_HEIGHT : LongInt;
|
|
87 |
LAND_WIDTH_MASK : LongWord;
|
|
88 |
LAND_HEIGHT_MASK : LongWord;
|
|
89 |
cMaxCaptions : LongInt;
|
|
90 |
|
|
91 |
cLeftScreenBorder : LongInt;
|
|
92 |
cRightScreenBorder : LongInt;
|
|
93 |
cScreenSpace : LongInt;
|
|
94 |
|
|
95 |
cCaseFactor : Longword;
|
|
96 |
cLandMines : Longword;
|
|
97 |
cExplosives : Longword;
|
|
98 |
|
|
99 |
cSeed : shortstring;
|
|
100 |
cVolumeDelta : LongInt;
|
|
101 |
cHasFocus : boolean;
|
|
102 |
cInactDelay : Longword;
|
|
103 |
|
|
104 |
bBetweenTurns : boolean;
|
|
105 |
bWaterRising : boolean;
|
|
106 |
|
|
107 |
ShowCrosshair : boolean;
|
|
108 |
CursorMovementX : LongInt;
|
|
109 |
CursorMovementY : LongInt;
|
|
110 |
cDrownSpeed : hwFloat;
|
|
111 |
cDrownSpeedf : float;
|
|
112 |
cMaxWindSpeed : hwFloat;
|
|
113 |
cWindSpeed : hwFloat;
|
|
114 |
cWindSpeedf : float;
|
|
115 |
cGravity : hwFloat;
|
|
116 |
cGravityf : float;
|
|
117 |
cDamageModifier : hwFloat;
|
|
118 |
cLaserSighting : boolean;
|
|
119 |
cVampiric : boolean;
|
|
120 |
cArtillery : boolean;
|
|
121 |
WeaponTooltipTex : PTexture;
|
|
122 |
|
|
123 |
flagMakeCapture : boolean;
|
|
124 |
|
|
125 |
InitStepsFlags : Longword;
|
|
126 |
RealTicks : Longword;
|
|
127 |
AttackBar : LongInt;
|
|
128 |
|
|
129 |
WaterColorArray : array[0..3] of HwColor4f;
|
|
130 |
|
|
131 |
CursorPoint : TPoint;
|
|
132 |
TargetPoint : TPoint;
|
|
133 |
|
|
134 |
TextureList : PTexture;
|
|
135 |
|
|
136 |
ScreenFade : TScreenFade;
|
|
137 |
ScreenFadeValue : LongInt;
|
|
138 |
ScreenFadeSpeed : LongInt;
|
|
139 |
|
|
140 |
{$IFDEF SDL13}
|
|
141 |
SDLwindow : PSDL_Window;
|
|
142 |
{$ENDIF}
|
|
143 |
|
|
144 |
procedure initModule;
|
|
145 |
procedure freeModule;
|
|
146 |
|
|
147 |
implementation
|
|
148 |
|
|
149 |
|
|
150 |
procedure initModule;
|
|
151 |
begin
|
|
152 |
Pathz:= cPathz;
|
|
153 |
{* REFERENCE
|
|
154 |
4096 -> $FFFFF000
|
|
155 |
2048 -> $FFFFF800
|
|
156 |
1024 -> $FFFFFC00
|
|
157 |
512 -> $FFFFFE00 *}
|
|
158 |
if (cReducedQuality and rqLowRes) <> 0 then
|
|
159 |
begin
|
|
160 |
LAND_WIDTH:= 2048;
|
|
161 |
LAND_HEIGHT:= 1024;
|
|
162 |
LAND_WIDTH_MASK:= $FFFFF800;
|
|
163 |
LAND_HEIGHT_MASK:= $FFFFFC00;
|
|
164 |
end
|
|
165 |
else
|
|
166 |
begin
|
|
167 |
LAND_WIDTH:= 4096;
|
|
168 |
LAND_HEIGHT:= 2048;
|
|
169 |
LAND_WIDTH_MASK:= $FFFFF000;
|
|
170 |
LAND_HEIGHT_MASK:= $FFFFF800
|
|
171 |
end;
|
|
172 |
|
|
173 |
cDrownSpeed.QWordValue := 257698038; // 0.06
|
|
174 |
cDrownSpeedf := 0.06;
|
|
175 |
cMaxWindSpeed.QWordValue:= 1073742; // 0.00025
|
|
176 |
cWindSpeed.QWordValue := 429496; // 0.0001
|
|
177 |
cWindSpeedf := 0.0001;
|
|
178 |
cGravity := cMaxWindSpeed * 2;
|
|
179 |
cGravityf := 0.00025 * 2;
|
|
180 |
cDamageModifier := _1;
|
|
181 |
TargetPoint := cTargetPointRef;
|
|
182 |
TextureList := nil;
|
|
183 |
|
|
184 |
// int, longint longword and byte
|
|
185 |
CursorMovementX := 0;
|
|
186 |
CursorMovementY := 0;
|
|
187 |
GameTicks := 0;
|
|
188 |
TrainingTimeInc := 10000;
|
|
189 |
TrainingTimeInD := 500;
|
|
190 |
TrainingTimeInM := 5000;
|
|
191 |
TrainingTimeMax := 60000;
|
|
192 |
TimeTrialStartTime := 0;
|
|
193 |
TimeTrialStopTime := 0;
|
|
194 |
cWaterLine := LAND_HEIGHT;
|
|
195 |
cGearScrEdgesDist := 240;
|
|
196 |
|
|
197 |
GameFlags := 0;
|
|
198 |
TrainingFlags := 0;
|
|
199 |
TurnTimeLeft := 0;
|
|
200 |
cSuddenDTurns := 15;
|
|
201 |
cDamagePercent := 100;
|
|
202 |
cMineDudPercent := 0;
|
|
203 |
cTemplateFilter := 0;
|
|
204 |
cMapGen := 0; // MAPGEN_REGULAR
|
|
205 |
cMazeSize := 0;
|
|
206 |
cHedgehogTurnTime := 45000;
|
|
207 |
cMinesTime := 3;
|
|
208 |
cMaxAIThinkTime := 9000;
|
|
209 |
cCloudsNumber := 9;
|
|
210 |
cHealthCaseProb := 35;
|
|
211 |
cHealthCaseAmount := 25;
|
|
212 |
cWaterRise := 47;
|
|
213 |
cHealthDecrease := 5;
|
|
214 |
|
|
215 |
cTagsMask := 0;
|
|
216 |
InitStepsFlags := 0;
|
|
217 |
RealTicks := 0;
|
|
218 |
AttackBar := 0; // 0 - none, 1 - just bar at the right-down corner, 2 - from weapon
|
|
219 |
cCaseFactor := 5; {0..9}
|
|
220 |
cLandMines := 4;
|
|
221 |
cExplosives := 2;
|
|
222 |
|
|
223 |
GameState := Low(TGameState);
|
|
224 |
GameType := gmtLocal;
|
|
225 |
zoom := cDefaultZoomLevel;
|
|
226 |
ZoomValue := cDefaultZoomLevel;
|
|
227 |
WeaponTooltipTex:= nil;
|
|
228 |
cLaserSighting := false;
|
|
229 |
cVampiric := false;
|
|
230 |
cArtillery := false;
|
|
231 |
flagMakeCapture := false;
|
|
232 |
bBetweenTurns := false;
|
|
233 |
bWaterRising := false;
|
|
234 |
isCursorVisible := false;
|
|
235 |
isTerminated := false;
|
|
236 |
isInLag := false;
|
|
237 |
isPaused := false;
|
|
238 |
isInMultiShoot := false;
|
|
239 |
isSpeed := false;
|
|
240 |
fastUntilLag := false;
|
|
241 |
isFirstFrame := true;
|
|
242 |
isSEBackup := true;
|
|
243 |
cSeed := '';
|
|
244 |
cVolumeDelta := 0;
|
|
245 |
cHasFocus := true;
|
|
246 |
cInactDelay := 1250;
|
|
247 |
ReadyTimeLeft := 0;
|
|
248 |
|
|
249 |
ScreenFade := sfNone;
|
|
250 |
|
|
251 |
{$IFDEF SDL13}
|
|
252 |
SDLwindow := nil;
|
|
253 |
{$ENDIF}
|
|
254 |
|
|
255 |
// those values still aren't perfect
|
|
256 |
cLeftScreenBorder:= round(-cMinZoomLevel * cScreenWidth);
|
|
257 |
cRightScreenBorder:= round(cMinZoomLevel * cScreenWidth + LAND_WIDTH);
|
|
258 |
cScreenSpace:= cRightScreenBorder - cLeftScreenBorder;
|
|
259 |
|
|
260 |
if isPhone() then
|
|
261 |
cMaxCaptions:= 3
|
|
262 |
else
|
|
263 |
cMaxCaptions:= 4;
|
|
264 |
end;
|
|
265 |
|
|
266 |
procedure freeModule;
|
|
267 |
begin
|
|
268 |
// re-init flags so they will always contain safe values
|
|
269 |
cScreenWidth := 1024;
|
|
270 |
cScreenHeight := 768;
|
|
271 |
cBits := 32;
|
|
272 |
//ipcPort is in uIO
|
|
273 |
cFullScreen := false;
|
|
274 |
isSoundEnabled := true;
|
|
275 |
isMusicEnabled := false;
|
|
276 |
cLocaleFName := 'en.txt';
|
|
277 |
cInitVolume := 100;
|
|
278 |
cTimerInterval := 8;
|
|
279 |
PathPrefix := './';
|
|
280 |
cShowFPS := false;
|
|
281 |
cAltDamage := true;
|
|
282 |
cReducedQuality := rqNone;
|
|
283 |
//userNick is in uChat
|
|
284 |
recordFileName := '';
|
|
285 |
cReadyDelay := 0;
|
|
286 |
end;
|
|
287 |
|
|
288 |
end. |