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