4
|
1 |
(*
|
|
2 |
* Hedgewars, a worms-like game
|
|
3 |
* Copyright (c) 2004, 2005 Andrey Korotaev <unC0Rr@gmail.com>
|
|
4 |
*
|
|
5 |
* Distributed under the terms of the BSD-modified licence:
|
|
6 |
*
|
|
7 |
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8 |
* of this software and associated documentation files (the "Software"), to deal
|
|
9 |
* with the Software without restriction, including without limitation the
|
|
10 |
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
|
11 |
* sell copies of the Software, and to permit persons to whom the Software is
|
|
12 |
* furnished to do so, subject to the following conditions:
|
|
13 |
*
|
|
14 |
* 1. Redistributions of source code must retain the above copyright notice,
|
|
15 |
* this list of conditions and the following disclaimer.
|
|
16 |
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
17 |
* this list of conditions and the following disclaimer in the documentation
|
|
18 |
* and/or other materials provided with the distribution.
|
|
19 |
* 3. The name of the author may not be used to endorse or promote products
|
|
20 |
* derived from this software without specific prior written permission.
|
|
21 |
*
|
|
22 |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
|
23 |
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|
24 |
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
|
25 |
* EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
26 |
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
27 |
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
|
28 |
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
|
29 |
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
|
30 |
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
|
31 |
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
32 |
*)
|
|
33 |
|
|
34 |
unit uConsts;
|
|
35 |
interface
|
|
36 |
uses SDLh;
|
|
37 |
{$INCLUDE options.inc}
|
5
|
38 |
type TStuff = (sHorizont, sSky, sConsoleBG, sPowerBar, sQuestion, sWindBar,
|
35
|
39 |
sWindL, sWindR, sRopeNode);
|
4
|
40 |
TGameState = (gsLandGen, gsStart, gsGame, gsConsole, gsExit);
|
|
41 |
TGameType = (gmtLocal, gmtDemo, gmtNet);
|
|
42 |
TPathType = (ptData, ptGraphics, ptThemes, ptThemeCurrent, ptTeams, ptMaps,
|
|
43 |
ptMapCurrent, ptDemos, ptSounds, ptGraves, ptFonts, ptForts);
|
|
44 |
TSprite = (sprWater, sprCloud, sprBomb, sprBigDigit, sprFrame,
|
|
45 |
sprLag, sprArrow, sprGrenade, sprTargetP, sprUFO,
|
10
|
46 |
sprSmokeTrace, sprRopeHook, sprExplosion50, sprMineOff,
|
42
|
47 |
sprMineOn, sprCase, sprFAid);
|
4
|
48 |
TGearType = (gtCloud, gtAmmo_Bomb, gtHedgehog, gtAmmo_Grenade, gtHealthTag,
|
|
49 |
gtGrave, gtUFO, gtShotgunShot, gtActionTimer, gtPickHammer, gtRope,
|
39
|
50 |
gtSmokeTrace, gtExplosion, gtMine, gtCase, gtDEagleShot, gtDynamite);
|
16
|
51 |
TGearsType = set of TGearType;
|
4
|
52 |
TSound = (sndGrenadeImpact, sndExplosion, sndThrowPowerUp, sndThrowRelease, sndSplash,
|
13
|
53 |
sndShotgunReload, sndShotgunFire, sndGraveImpact, sndMineTick);
|
10
|
54 |
TAmmoType = (amGrenade, amBazooka, amUFO, amShotgun, amPickHammer, amSkip, amRope,
|
39
|
55 |
amMine, amDEagle, amDynamite);
|
4
|
56 |
THWFont = (fnt16, fntBig);
|
|
57 |
THHFont = record
|
|
58 |
Handle: PTTF_Font;
|
|
59 |
Height: integer;
|
|
60 |
Name: string[15];
|
|
61 |
end;
|
|
62 |
TAmmo = record
|
|
63 |
Propz: LongWord;
|
|
64 |
Count: LongWord;
|
|
65 |
NumPerTurn: LongWord;
|
|
66 |
Timer: LongWord;
|
|
67 |
AmmoType: TAmmoType;
|
|
68 |
end;
|
|
69 |
|
|
70 |
|
|
71 |
resourcestring
|
|
72 |
errmsgCreateSurface = 'Error creating DirectDraw7 surface';
|
|
73 |
errmsgNoDesc = 'Unknown error';
|
|
74 |
errmsgTransparentSet = 'Error setting transparent color';
|
|
75 |
errmsgUnknownCommand = 'Unknown command';
|
|
76 |
errmsgUnknownVariable = 'Unknown variable';
|
|
77 |
errmsgIncorrectUse = 'Incorrect use';
|
|
78 |
errmsgShouldntRun = 'This program shouldn''t be run manually';
|
|
79 |
|
|
80 |
msgLoading = 'Loading ';
|
|
81 |
msgOK = 'ok';
|
|
82 |
msgFailed = 'failed';
|
|
83 |
msgGettingConfig = 'Getting game config...';
|
|
84 |
|
|
85 |
const
|
|
86 |
cAppName = 'hw';
|
|
87 |
cAppTitle = 'hw';
|
|
88 |
cNetProtoVersion = 1;
|
|
89 |
|
|
90 |
rndfillstr = 'hw';
|
|
91 |
|
|
92 |
cTransparentColor: Cardinal = $000000;
|
|
93 |
|
22
|
94 |
cMaxHHIndex = 9;
|
|
95 |
cMaxHHs = 20;
|
|
96 |
cMaxSpawnPoints = 64;
|
4
|
97 |
cHHSurfaceWidth = 512;
|
|
98 |
cHHSurfaceHeigth = 256;
|
|
99 |
|
22
|
100 |
cMaxEdgePoints = 16384;
|
|
101 |
|
4
|
102 |
cHHHalfHeight = 11;
|
|
103 |
|
|
104 |
cKeyMaxIndex = 322;
|
|
105 |
|
|
106 |
cMaxCaptions = 4;
|
|
107 |
|
|
108 |
cInactDelay = 1500;
|
|
109 |
|
|
110 |
gfForts = $00000001;
|
|
111 |
|
|
112 |
gstDrowning = $00000001;
|
|
113 |
gstHHDriven = $00000002;
|
|
114 |
gstMoving = $00000004;
|
|
115 |
gstAttacked = $00000008;
|
|
116 |
gstAttacking = $00000010;
|
|
117 |
gstCollision = $00000020;
|
|
118 |
gstHHChooseTarget = $00000040;
|
|
119 |
gstFalling = $00000080;
|
|
120 |
gstHHJumping = $00000100;
|
|
121 |
gsttmpFlag = $00000200;
|
|
122 |
gstHHThinking = $00000800;
|
|
123 |
|
|
124 |
gtsStartGame = 1;
|
6
|
125 |
gtsSmoothWindCh = 2;
|
4
|
126 |
|
|
127 |
gm_Left = $00000001;
|
|
128 |
gm_Right = $00000002;
|
|
129 |
gm_Up = $00000004;
|
|
130 |
gm_Down = $00000008;
|
|
131 |
gm_Switch = $00000010;
|
|
132 |
gm_Attack = $00000020;
|
|
133 |
gm_LJump = $00000040;
|
|
134 |
gm_HJump = $00000080;
|
|
135 |
gm_Destroy= $00000100;
|
|
136 |
|
10
|
137 |
cMaxSlotIndex = 6;
|
|
138 |
cMaxSlotAmmoIndex = 1;
|
4
|
139 |
|
|
140 |
ammoprop_Timerable = $00000001;
|
|
141 |
ammoprop_Power = $00000002;
|
|
142 |
ammoprop_NeedTarget = $00000004;
|
|
143 |
ammoprop_ForwMsgs = $00000008;
|
|
144 |
ammoprop_AttackInFall = $00000010;
|
|
145 |
ammoprop_AttackInJump = $00000020;
|
13
|
146 |
ammoprop_NoCrosshair = $00000040;
|
4
|
147 |
AMMO_INFINITE = High(LongWord);
|
|
148 |
|
|
149 |
capgrpStartGame = 0;
|
|
150 |
capgrpAmmoinfo = 1;
|
|
151 |
capgrpNetSay = 2;
|
|
152 |
|
42
|
153 |
EXPLAllDamageInRadius = $00000001;
|
|
154 |
EXPLAutoSound = $00000002;
|
|
155 |
EXPLNoDamage = $00000004;
|
|
156 |
EXPLDoNotTouchHH = $00000008;
|
|
157 |
|
|
158 |
posCaseAmmo = $00000001;
|
|
159 |
posCaseHealth = $00000002;
|
4
|
160 |
|
|
161 |
cToggleConsoleKey = 39;
|
|
162 |
|
|
163 |
NoPointX = Low(Integer); // êîíñòàíòà äëÿ TargetPoint, ïîêàçûâàåò, ÷òî öåëü íå óêàçàíà
|
|
164 |
|
|
165 |
cLandFileName = 'Land.bmp';
|
|
166 |
cHHFileName = 'Hedgehog.png';
|
|
167 |
cCHFileName = 'Crosshair.png';
|
|
168 |
cThemeCFGFilename = 'theme.cfg';
|
|
169 |
|
|
170 |
Fontz: array[THWFont] of THHFont = (
|
|
171 |
(Height: 12;
|
|
172 |
Name: 'UN1251N.TTF'),
|
|
173 |
(Height: 24;
|
|
174 |
Name: 'UN1251N.TTF')
|
|
175 |
);
|
|
176 |
|
|
177 |
Pathz: array[TPathType] of string[ 64] = (
|
|
178 |
'Data/', // ptData
|
|
179 |
'Data/Graphics/', // ptGraphics
|
|
180 |
'Data/Themes/', // ptThemes
|
|
181 |
'Data/Themes/Default/', // ptThemeCurrent
|
|
182 |
'Data/Teams/', // ptTeams
|
|
183 |
'Data/Maps/', // ptMaps
|
|
184 |
'Data/Maps/Current/', // ptMapCurrent
|
|
185 |
'Data/Demos/', // ptDemos
|
|
186 |
'Data/Sounds/', // ptSounds
|
|
187 |
'Data/Graphics/Graves/', // ptGraves
|
|
188 |
'Data/Fonts/', // ptFonts
|
|
189 |
'Data/Forts/' // ptForts
|
|
190 |
);
|
|
191 |
|
|
192 |
StuffLoadData: array[TStuff] of record
|
|
193 |
FileName: String[31];
|
|
194 |
Path : TPathType;
|
|
195 |
end = (
|
|
196 |
(FileName: 'horizont.png'; Path: ptThemeCurrent ), // sHorizont
|
|
197 |
(FileName: 'Sky.png'; Path: ptThemeCurrent ), // sSky
|
|
198 |
(FileName: 'Console.png'; Path: ptGraphics ), // sConsoleBG
|
|
199 |
(FileName: 'PowerBar.png'; Path: ptGraphics ), // sPowerBar
|
5
|
200 |
(FileName: 'thinking.png'; Path: ptGraphics ), // sQuestion
|
|
201 |
(FileName: 'WindBar.png'; Path: ptGraphics ), // sWindBar
|
|
202 |
(FileName: 'WindL.png'; Path: ptGraphics ), // sWindL
|
35
|
203 |
(FileName: 'WindR.png'; Path: ptGraphics ), // sWindR
|
|
204 |
(FileName: 'RopeNode.png'; Path: ptGraphics ) // sRopeNode
|
4
|
205 |
);
|
|
206 |
StuffPoz: array[TStuff] of TSDL_Rect = (
|
|
207 |
(x: 0; y: 0; w: 512; h: 256), // sHorizont
|
|
208 |
(x: 512; y: 0; w: 64; h:1024), // sSky
|
|
209 |
(x: 256; y: 256; w: 256; h: 256), // sConsoleBG
|
|
210 |
(x: 256; y: 768; w: 256; h: 32), // sPowerBar
|
5
|
211 |
(x: 256; y: 512; w: 32; h: 32), // sQuestion
|
|
212 |
(x: 256; y: 800; w: 151; h: 17), // sWindBar
|
|
213 |
(x: 256; y: 817; w: 80; h: 13), // sWindL
|
35
|
214 |
(x: 336; y: 817; w: 80; h: 13), // sWindR
|
|
215 |
(x: 256; y: 544; w: 6; h: 6) // sRopeNode
|
4
|
216 |
);
|
|
217 |
SpritesData: array[TSprite] of record
|
35
|
218 |
FileName: String[31];
|
|
219 |
Path : TPathType;
|
|
220 |
Surface : PSDL_Surface;
|
|
221 |
Width, Height: integer;
|
|
222 |
hasAlpha: boolean;
|
|
223 |
end = (
|
|
224 |
(FileName: 'BlueWater.png'; Path: ptGraphics; Width: 256; Height: 48; hasAlpha: false),// sprWater
|
|
225 |
(FileName: 'Clouds.png'; Path: ptGraphics; Width: 256; Height:128; hasAlpha: false),// sprCloud
|
|
226 |
(FileName: 'Bomb.png'; Path: ptGraphics; Width: 16; Height: 16; hasAlpha: false),// sprBomb
|
|
227 |
(FileName: 'BigDigits.png'; Path: ptGraphics; Width: 32; Height: 32; hasAlpha: true),// sprBigDigit
|
|
228 |
(FileName: 'Frame.png'; Path: ptGraphics; Width: 4; Height: 32; hasAlpha: true),// sprFrame
|
|
229 |
(FileName: 'Lag.png'; Path: ptGraphics; Width: 64; Height: 64; hasAlpha: false),// sprLag
|
|
230 |
(FileName: 'Arrow.png'; Path: ptGraphics; Width: 16; Height: 16; hasAlpha: false),// sprCursor
|
|
231 |
(FileName: 'Grenade.png'; Path: ptGraphics; Width: 32; Height: 32; hasAlpha: false),// sprGrenade
|
|
232 |
(FileName: 'Targetp.png'; Path: ptGraphics; Width: 32; Height: 32; hasAlpha: false),// sprTargetP
|
|
233 |
(FileName: 'UFO.png'; Path: ptGraphics; Width: 32; Height: 32; hasAlpha: false),// sprUFO
|
|
234 |
(FileName:'SmokeTrace.png'; Path: ptGraphics; Width: 32; Height: 32; hasAlpha: true),// sprSmokeTrace
|
|
235 |
(FileName: 'RopeHook.png'; Path: ptGraphics; Width: 32; Height: 32; hasAlpha: false),// sprRopeHook
|
|
236 |
(FileName: 'Expl50.png'; Path: ptGraphics; Width: 64; Height: 64; hasAlpha: false),// sprExplosion50
|
|
237 |
(FileName: 'MineOff.png'; Path: ptGraphics; Width: 16; Height: 16; hasAlpha: false),// sprMineOff
|
|
238 |
(FileName: 'MineOn.png'; Path: ptGraphics; Width: 16; Height: 16; hasAlpha: false),// sprMineOn
|
42
|
239 |
(FileName: 'Case.png'; Path: ptGraphics; Width: 32; Height: 32; hasAlpha: false),// sprCase
|
|
240 |
(FileName: 'FirstAid.png'; Path: ptGraphics; Width: 32; Height: 32; hasAlpha: false) // sprFAid
|
35
|
241 |
);
|
4
|
242 |
Soundz: array[TSound] of record
|
|
243 |
FileName: String[31];
|
|
244 |
Path : TPathType;
|
|
245 |
id : PMixChunk;
|
|
246 |
end = (
|
|
247 |
(FileName: 'grenadeimpact.ogg'; Path: ptSounds ),// sndGrenadeImpact
|
|
248 |
(FileName: 'explosion.ogg'; Path: ptSounds ),// sndExplosion
|
|
249 |
(FileName: 'throwpowerup.ogg'; Path: ptSounds ),// sndThrowPowerUp
|
|
250 |
(FileName: 'throwrelease.ogg'; Path: ptSounds ),// sndThrowRelease
|
|
251 |
(FileName: 'splash.ogg'; Path: ptSounds ),// sndSplash
|
|
252 |
(FileName: 'shotgunreload.ogg'; Path: ptSounds ),// sndShotgunReload
|
|
253 |
(FileName: 'shotgunfire.ogg'; Path: ptSounds ),// sndShotgunFire
|
13
|
254 |
(FileName: 'graveimpact.ogg'; Path: ptSounds ),// sndGraveImpact
|
|
255 |
(FileName: 'minetick.ogg'; Path: ptSounds ) // sndMineTicks
|
4
|
256 |
);
|
|
257 |
|
|
258 |
Ammoz: array [TAmmoType] of record
|
|
259 |
Name: string[32];
|
|
260 |
Ammo: TAmmo;
|
|
261 |
Slot: Longword;
|
|
262 |
TimeAfterTurn: Longword;
|
|
263 |
end = (
|
|
264 |
(Name: 'Grenade';
|
|
265 |
Ammo: (Propz: ammoprop_Timerable or ammoprop_Power;
|
|
266 |
Count: AMMO_INFINITE;
|
|
267 |
NumPerTurn: 0;
|
|
268 |
Timer: 3000;
|
|
269 |
AmmoType: amGrenade);
|
10
|
270 |
Slot: 1;
|
4
|
271 |
TimeAfterTurn: 3000),
|
|
272 |
(Name: 'Bazooka';
|
|
273 |
Ammo: (Propz: ammoprop_Power;
|
|
274 |
Count: AMMO_INFINITE;
|
|
275 |
NumPerTurn: 0;
|
|
276 |
Timer: 0;
|
|
277 |
AmmoType: amBazooka);
|
10
|
278 |
Slot: 0;
|
4
|
279 |
TimeAfterTurn: 3000),
|
|
280 |
(Name: 'UFO';
|
|
281 |
Ammo: (Propz: ammoprop_Power or ammoprop_NeedTarget;
|
|
282 |
Count: 4;
|
|
283 |
NumPerTurn: 0;
|
|
284 |
Timer: 0;
|
|
285 |
AmmoType: amUFO);
|
|
286 |
Slot: 0;
|
|
287 |
TimeAfterTurn: 3000),
|
|
288 |
(Name: 'Shotgun';
|
|
289 |
Ammo: (Propz: 0;
|
|
290 |
Count: AMMO_INFINITE;
|
|
291 |
NumPerTurn: 1;
|
|
292 |
Timer: 0;
|
|
293 |
AmmoType: amShotgun);
|
|
294 |
Slot: 2;
|
|
295 |
TimeAfterTurn: 3000),
|
|
296 |
(Name: 'Pneumatic pick';
|
|
297 |
Ammo: (Propz: ammoprop_ForwMsgs or ammoprop_AttackInFall or ammoprop_AttackInJump;
|
|
298 |
Count: 2;
|
|
299 |
NumPerTurn: 0;
|
|
300 |
Timer: 0;
|
|
301 |
AmmoType: amPickHammer);
|
10
|
302 |
Slot: 4;
|
4
|
303 |
TimeAfterTurn: 0),
|
|
304 |
(Name: 'Skip turn';
|
|
305 |
Ammo: (Propz: 0;
|
|
306 |
Count: AMMO_INFINITE;
|
|
307 |
NumPerTurn: 0;
|
|
308 |
Timer: 0;
|
|
309 |
AmmoType: amSkip);
|
10
|
310 |
Slot: 6;
|
4
|
311 |
TimeAfterTurn: 0),
|
|
312 |
(Name: 'Rope';
|
|
313 |
Ammo: (Propz: ammoprop_ForwMsgs or ammoprop_AttackInFall or ammoprop_AttackInJump;
|
|
314 |
Count: 5;
|
|
315 |
NumPerTurn: 0;
|
|
316 |
Timer: 0;
|
|
317 |
AmmoType: amRope);
|
10
|
318 |
Slot: 5;
|
|
319 |
TimeAfterTurn: 0),
|
|
320 |
(Name: 'Mine';
|
13
|
321 |
Ammo: (Propz: ammoprop_NoCrosshair;
|
10
|
322 |
Count: 5;
|
|
323 |
NumPerTurn: 0;
|
|
324 |
Timer: 0;
|
|
325 |
AmmoType: amMine);
|
4
|
326 |
Slot: 3;
|
37
|
327 |
TimeAfterTurn: 3000),
|
|
328 |
(Name: 'Desert Eagle';
|
|
329 |
Ammo: (Propz: 0;
|
|
330 |
Count: AMMO_INFINITE;
|
|
331 |
NumPerTurn: 3;
|
|
332 |
Timer: 0;
|
|
333 |
AmmoType: amDEagle);
|
|
334 |
Slot: 2;
|
39
|
335 |
TimeAfterTurn: 3000),
|
|
336 |
(Name: 'Dynamite';
|
|
337 |
Ammo: (Propz: ammoprop_NoCrosshair or ammoprop_AttackInJump or ammoprop_AttackInFall;
|
|
338 |
Count: 5;
|
|
339 |
NumPerTurn: 0;
|
|
340 |
Timer: 0;
|
|
341 |
AmmoType: amDynamite);
|
|
342 |
Slot: 3;
|
|
343 |
TimeAfterTurn: 5000));
|
37
|
344 |
|
|
345 |
|
|
346 |
|
|
347 |
|
4
|
348 |
Resolutions: array[0..3] of String = (
|
|
349 |
'640 480',
|
|
350 |
'800 600',
|
|
351 |
'1024 768',
|
|
352 |
'1280 1024'
|
|
353 |
);
|
|
354 |
|
|
355 |
implementation
|
|
356 |
|
|
357 |
end.
|