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