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,
|
|
39 |
sWindL, sWindR);
|
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,
|
|
47 |
sprMineOn);
|
4
|
48 |
TGearType = (gtCloud, gtAmmo_Bomb, gtHedgehog, gtAmmo_Grenade, gtHealthTag,
|
|
49 |
gtGrave, gtUFO, gtShotgunShot, gtActionTimer, gtPickHammer, gtRope,
|
10
|
50 |
gtSmokeTrace, gtExplosion, gtMine);
|
4
|
51 |
TSound = (sndGrenadeImpact, sndExplosion, sndThrowPowerUp, sndThrowRelease, sndSplash,
|
13
|
52 |
sndShotgunReload, sndShotgunFire, sndGraveImpact, sndMineTick);
|
10
|
53 |
TAmmoType = (amGrenade, amBazooka, amUFO, amShotgun, amPickHammer, amSkip, amRope,
|
|
54 |
amMine);
|
4
|
55 |
THWFont = (fnt16, fntBig);
|
|
56 |
THHFont = record
|
|
57 |
Handle: PTTF_Font;
|
|
58 |
Height: integer;
|
|
59 |
Name: string[15];
|
|
60 |
end;
|
|
61 |
TAmmo = record
|
|
62 |
Propz: LongWord;
|
|
63 |
Count: LongWord;
|
|
64 |
NumPerTurn: LongWord;
|
|
65 |
Timer: LongWord;
|
|
66 |
AmmoType: TAmmoType;
|
|
67 |
end;
|
|
68 |
|
|
69 |
|
|
70 |
resourcestring
|
|
71 |
errmsgCreateSurface = 'Error creating DirectDraw7 surface';
|
|
72 |
errmsgNoDesc = 'Unknown error';
|
|
73 |
errmsgTransparentSet = 'Error setting transparent color';
|
|
74 |
errmsgDynamicVar = 'Error working with dynamic memory';
|
|
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 |
|
|
94 |
cMaxHHIndex = 9;
|
|
95 |
cMaxHHs = 20;
|
|
96 |
cHHSurfaceWidth = 512;
|
|
97 |
cHHSurfaceHeigth = 256;
|
|
98 |
|
|
99 |
cHHHalfHeight = 11;
|
|
100 |
|
|
101 |
cKeyMaxIndex = 322;
|
|
102 |
|
|
103 |
cMaxCaptions = 4;
|
|
104 |
|
|
105 |
cInactDelay = 1500;
|
|
106 |
|
|
107 |
gfForts = $00000001;
|
|
108 |
|
|
109 |
gstDrowning = $00000001;
|
|
110 |
gstHHDriven = $00000002;
|
|
111 |
gstMoving = $00000004;
|
|
112 |
gstAttacked = $00000008;
|
|
113 |
gstAttacking = $00000010;
|
|
114 |
gstCollision = $00000020;
|
|
115 |
gstHHChooseTarget = $00000040;
|
|
116 |
gstFalling = $00000080;
|
|
117 |
gstHHJumping = $00000100;
|
|
118 |
gsttmpFlag = $00000200;
|
|
119 |
gstOutOfHH = $00000400;
|
|
120 |
gstHHThinking = $00000800;
|
|
121 |
|
|
122 |
gtsStartGame = 1;
|
6
|
123 |
gtsSmoothWindCh = 2;
|
4
|
124 |
|
|
125 |
gm_Left = $00000001;
|
|
126 |
gm_Right = $00000002;
|
|
127 |
gm_Up = $00000004;
|
|
128 |
gm_Down = $00000008;
|
|
129 |
gm_Switch = $00000010;
|
|
130 |
gm_Attack = $00000020;
|
|
131 |
gm_LJump = $00000040;
|
|
132 |
gm_HJump = $00000080;
|
|
133 |
gm_Destroy= $00000100;
|
|
134 |
|
10
|
135 |
cMaxSlotIndex = 6;
|
|
136 |
cMaxSlotAmmoIndex = 1;
|
4
|
137 |
|
|
138 |
ammoprop_Timerable = $00000001;
|
|
139 |
ammoprop_Power = $00000002;
|
|
140 |
ammoprop_NeedTarget = $00000004;
|
|
141 |
ammoprop_ForwMsgs = $00000008;
|
|
142 |
ammoprop_AttackInFall = $00000010;
|
|
143 |
ammoprop_AttackInJump = $00000020;
|
13
|
144 |
ammoprop_NoCrosshair = $00000040;
|
4
|
145 |
AMMO_INFINITE = High(LongWord);
|
|
146 |
|
|
147 |
capgrpStartGame = 0;
|
|
148 |
capgrpAmmoinfo = 1;
|
|
149 |
capgrpNetSay = 2;
|
|
150 |
|
|
151 |
EXPLAllDamageInRadius = 1;
|
|
152 |
EXPLAutoSound = 2;
|
|
153 |
EXPLNoDamage = 4;
|
|
154 |
|
|
155 |
cToggleConsoleKey = 39;
|
|
156 |
|
|
157 |
NoPointX = Low(Integer); // êîíñòàíòà äëÿ TargetPoint, ïîêàçûâàåò, ÷òî öåëü íå óêàçàíà
|
|
158 |
|
|
159 |
cLandFileName = 'Land.bmp';
|
|
160 |
cHHFileName = 'Hedgehog.png';
|
|
161 |
cCHFileName = 'Crosshair.png';
|
|
162 |
cThemeCFGFilename = 'theme.cfg';
|
|
163 |
|
|
164 |
Fontz: array[THWFont] of THHFont = (
|
|
165 |
(Height: 12;
|
|
166 |
Name: 'UN1251N.TTF'),
|
|
167 |
(Height: 24;
|
|
168 |
Name: 'UN1251N.TTF')
|
|
169 |
);
|
|
170 |
|
|
171 |
Pathz: array[TPathType] of string[ 64] = (
|
|
172 |
'Data/', // ptData
|
|
173 |
'Data/Graphics/', // ptGraphics
|
|
174 |
'Data/Themes/', // ptThemes
|
|
175 |
'Data/Themes/Default/', // ptThemeCurrent
|
|
176 |
'Data/Teams/', // ptTeams
|
|
177 |
'Data/Maps/', // ptMaps
|
|
178 |
'Data/Maps/Current/', // ptMapCurrent
|
|
179 |
'Data/Demos/', // ptDemos
|
|
180 |
'Data/Sounds/', // ptSounds
|
|
181 |
'Data/Graphics/Graves/', // ptGraves
|
|
182 |
'Data/Fonts/', // ptFonts
|
|
183 |
'Data/Forts/' // ptForts
|
|
184 |
);
|
|
185 |
|
|
186 |
StuffLoadData: array[TStuff] of record
|
|
187 |
FileName: String[31];
|
|
188 |
Path : TPathType;
|
|
189 |
end = (
|
|
190 |
(FileName: 'horizont.png'; Path: ptThemeCurrent ), // sHorizont
|
|
191 |
(FileName: 'Sky.png'; Path: ptThemeCurrent ), // sSky
|
|
192 |
(FileName: 'Console.png'; Path: ptGraphics ), // sConsoleBG
|
|
193 |
(FileName: 'PowerBar.png'; Path: ptGraphics ), // sPowerBar
|
5
|
194 |
(FileName: 'thinking.png'; Path: ptGraphics ), // sQuestion
|
|
195 |
(FileName: 'WindBar.png'; Path: ptGraphics ), // sWindBar
|
|
196 |
(FileName: 'WindL.png'; Path: ptGraphics ), // sWindL
|
|
197 |
(FileName: 'WindR.png'; Path: ptGraphics ) // sWindR
|
4
|
198 |
);
|
|
199 |
StuffPoz: array[TStuff] of TSDL_Rect = (
|
|
200 |
(x: 0; y: 0; w: 512; h: 256), // sHorizont
|
|
201 |
(x: 512; y: 0; w: 64; h:1024), // sSky
|
|
202 |
(x: 256; y: 256; w: 256; h: 256), // sConsoleBG
|
|
203 |
(x: 256; y: 768; w: 256; h: 32), // sPowerBar
|
5
|
204 |
(x: 256; y: 512; w: 32; h: 32), // sQuestion
|
|
205 |
(x: 256; y: 800; w: 151; h: 17), // sWindBar
|
|
206 |
(x: 256; y: 817; w: 80; h: 13), // sWindL
|
|
207 |
(x: 336; y: 817; w: 80; h: 13) // sWindR
|
4
|
208 |
);
|
|
209 |
SpritesData: array[TSprite] of record
|
|
210 |
FileName: String[31];
|
|
211 |
Path : TPathType;
|
|
212 |
Surface : PSDL_Surface;
|
|
213 |
Width, Height: integer;
|
|
214 |
end = (
|
|
215 |
(FileName: 'BlueWater.png'; Path: ptGraphics; Width: 256; Height: 48),// sprWater
|
|
216 |
(FileName: 'Clouds.png'; Path: ptGraphics; Width: 256; Height:128),// sprCloud
|
|
217 |
(FileName: 'Bomb.png'; Path: ptGraphics; Width: 16; Height: 16),// sprBomb
|
|
218 |
(FileName: 'BigDigits.png'; Path: ptGraphics; Width: 32; Height: 32),// sprBigDigit
|
|
219 |
(FileName: 'Frame.png'; Path: ptGraphics; Width: 4; Height: 32),// sprFrame
|
|
220 |
(FileName: 'Lag.png'; Path: ptGraphics; Width: 64; Height: 64),// sprLag
|
|
221 |
(FileName: 'Arrow.png'; Path: ptGraphics; Width: 16; Height: 16),// sprCursor
|
|
222 |
(FileName: 'Grenade.png'; Path: ptGraphics; Width: 32; Height: 32),// sprGrenade
|
|
223 |
(FileName: 'Targetp.png'; Path: ptGraphics; Width: 32; Height: 32),// sprTargetP
|
|
224 |
(FileName: 'UFO.png'; Path: ptGraphics; Width: 32; Height: 32),// sprUFO
|
|
225 |
(FileName:'SmokeTrace.png'; Path: ptGraphics; Width: 32; Height: 32),// sprSmokeTrace
|
9
|
226 |
(FileName: 'RopeHook.png'; Path: ptGraphics; Width: 32; Height: 32),// sprRopeHook
|
10
|
227 |
(FileName: 'Expl50.png'; Path: ptGraphics; Width: 64; Height: 64),// sprExplosion50
|
|
228 |
(FileName: 'MineOff.png'; Path: ptGraphics; Width: 16; Height: 16),// sprMineOff
|
|
229 |
(FileName: 'MineOn.png'; Path: ptGraphics; Width: 16; Height: 16) // sprMineOn
|
4
|
230 |
);
|
|
231 |
Soundz: array[TSound] of record
|
|
232 |
FileName: String[31];
|
|
233 |
Path : TPathType;
|
|
234 |
id : PMixChunk;
|
|
235 |
end = (
|
|
236 |
(FileName: 'grenadeimpact.ogg'; Path: ptSounds ),// sndGrenadeImpact
|
|
237 |
(FileName: 'explosion.ogg'; Path: ptSounds ),// sndExplosion
|
|
238 |
(FileName: 'throwpowerup.ogg'; Path: ptSounds ),// sndThrowPowerUp
|
|
239 |
(FileName: 'throwrelease.ogg'; Path: ptSounds ),// sndThrowRelease
|
|
240 |
(FileName: 'splash.ogg'; Path: ptSounds ),// sndSplash
|
|
241 |
(FileName: 'shotgunreload.ogg'; Path: ptSounds ),// sndShotgunReload
|
|
242 |
(FileName: 'shotgunfire.ogg'; Path: ptSounds ),// sndShotgunFire
|
13
|
243 |
(FileName: 'graveimpact.ogg'; Path: ptSounds ),// sndGraveImpact
|
|
244 |
(FileName: 'minetick.ogg'; Path: ptSounds ) // sndMineTicks
|
4
|
245 |
);
|
|
246 |
|
|
247 |
Ammoz: array [TAmmoType] of record
|
|
248 |
Name: string[32];
|
|
249 |
Ammo: TAmmo;
|
|
250 |
Slot: Longword;
|
|
251 |
TimeAfterTurn: Longword;
|
|
252 |
end = (
|
|
253 |
(Name: 'Grenade';
|
|
254 |
Ammo: (Propz: ammoprop_Timerable or ammoprop_Power;
|
|
255 |
Count: AMMO_INFINITE;
|
|
256 |
NumPerTurn: 0;
|
|
257 |
Timer: 3000;
|
|
258 |
AmmoType: amGrenade);
|
10
|
259 |
Slot: 1;
|
4
|
260 |
TimeAfterTurn: 3000),
|
|
261 |
(Name: 'Bazooka';
|
|
262 |
Ammo: (Propz: ammoprop_Power;
|
|
263 |
Count: AMMO_INFINITE;
|
|
264 |
NumPerTurn: 0;
|
|
265 |
Timer: 0;
|
|
266 |
AmmoType: amBazooka);
|
10
|
267 |
Slot: 0;
|
4
|
268 |
TimeAfterTurn: 3000),
|
|
269 |
(Name: 'UFO';
|
|
270 |
Ammo: (Propz: ammoprop_Power or ammoprop_NeedTarget;
|
|
271 |
Count: 4;
|
|
272 |
NumPerTurn: 0;
|
|
273 |
Timer: 0;
|
|
274 |
AmmoType: amUFO);
|
|
275 |
Slot: 0;
|
|
276 |
TimeAfterTurn: 3000),
|
|
277 |
(Name: 'Shotgun';
|
|
278 |
Ammo: (Propz: 0;
|
|
279 |
Count: AMMO_INFINITE;
|
|
280 |
NumPerTurn: 1;
|
|
281 |
Timer: 0;
|
|
282 |
AmmoType: amShotgun);
|
|
283 |
Slot: 2;
|
|
284 |
TimeAfterTurn: 3000),
|
|
285 |
(Name: 'Pneumatic pick';
|
|
286 |
Ammo: (Propz: ammoprop_ForwMsgs or ammoprop_AttackInFall or ammoprop_AttackInJump;
|
|
287 |
Count: 2;
|
|
288 |
NumPerTurn: 0;
|
|
289 |
Timer: 0;
|
|
290 |
AmmoType: amPickHammer);
|
10
|
291 |
Slot: 4;
|
4
|
292 |
TimeAfterTurn: 0),
|
|
293 |
(Name: 'Skip turn';
|
|
294 |
Ammo: (Propz: 0;
|
|
295 |
Count: AMMO_INFINITE;
|
|
296 |
NumPerTurn: 0;
|
|
297 |
Timer: 0;
|
|
298 |
AmmoType: amSkip);
|
10
|
299 |
Slot: 6;
|
4
|
300 |
TimeAfterTurn: 0),
|
|
301 |
(Name: 'Rope';
|
|
302 |
Ammo: (Propz: ammoprop_ForwMsgs or ammoprop_AttackInFall or ammoprop_AttackInJump;
|
|
303 |
Count: 5;
|
|
304 |
NumPerTurn: 0;
|
|
305 |
Timer: 0;
|
|
306 |
AmmoType: amRope);
|
10
|
307 |
Slot: 5;
|
|
308 |
TimeAfterTurn: 0),
|
|
309 |
(Name: 'Mine';
|
13
|
310 |
Ammo: (Propz: ammoprop_NoCrosshair;
|
10
|
311 |
Count: 5;
|
|
312 |
NumPerTurn: 0;
|
|
313 |
Timer: 0;
|
|
314 |
AmmoType: amMine);
|
4
|
315 |
Slot: 3;
|
10
|
316 |
TimeAfterTurn: 3000)
|
4
|
317 |
);
|
|
318 |
|
|
319 |
Resolutions: array[0..3] of String = (
|
|
320 |
'640 480',
|
|
321 |
'800 600',
|
|
322 |
'1024 768',
|
|
323 |
'1280 1024'
|
|
324 |
);
|
|
325 |
|
|
326 |
implementation
|
|
327 |
|
|
328 |
end.
|