author | unc0rr |
Wed, 26 Oct 2005 17:26:39 +0000 | |
changeset 18 | d49c23eba8ba |
parent 17 | a6bed8d31444 |
child 22 | 517be8dc5b76 |
permissions | -rw-r--r-- |
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, |
14
81f125629b25
- Mine checks whether a hedgehog is near less frequently
unc0rr
parents:
13
diff
changeset
|
47 |
sprMineOn, sprCase); |
4 | 48 |
TGearType = (gtCloud, gtAmmo_Bomb, gtHedgehog, gtAmmo_Grenade, gtHealthTag, |
49 |
gtGrave, gtUFO, gtShotgunShot, gtActionTimer, gtPickHammer, gtRope, |
|
14
81f125629b25
- Mine checks whether a hedgehog is near less frequently
unc0rr
parents:
13
diff
changeset
|
50 |
gtSmokeTrace, gtExplosion, gtMine, gtCase); |
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, |
55 |
amMine); |
|
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 |
||
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 |
|
14
81f125629b25
- Mine checks whether a hedgehog is near less frequently
unc0rr
parents:
13
diff
changeset
|
229 |
(FileName: 'MineOn.png'; Path: ptGraphics; Width: 16; Height: 16),// sprMineOn |
81f125629b25
- Mine checks whether a hedgehog is near less frequently
unc0rr
parents:
13
diff
changeset
|
230 |
(FileName: 'Case.png'; Path: ptGraphics; Width: 32; Height: 32) // sprCase |
4 | 231 |
); |
232 |
Soundz: array[TSound] of record |
|
233 |
FileName: String[31]; |
|
234 |
Path : TPathType; |
|
235 |
id : PMixChunk; |
|
236 |
end = ( |
|
237 |
(FileName: 'grenadeimpact.ogg'; Path: ptSounds ),// sndGrenadeImpact |
|
238 |
(FileName: 'explosion.ogg'; Path: ptSounds ),// sndExplosion |
|
239 |
(FileName: 'throwpowerup.ogg'; Path: ptSounds ),// sndThrowPowerUp |
|
240 |
(FileName: 'throwrelease.ogg'; Path: ptSounds ),// sndThrowRelease |
|
241 |
(FileName: 'splash.ogg'; Path: ptSounds ),// sndSplash |
|
242 |
(FileName: 'shotgunreload.ogg'; Path: ptSounds ),// sndShotgunReload |
|
243 |
(FileName: 'shotgunfire.ogg'; Path: ptSounds ),// sndShotgunFire |
|
13 | 244 |
(FileName: 'graveimpact.ogg'; Path: ptSounds ),// sndGraveImpact |
245 |
(FileName: 'minetick.ogg'; Path: ptSounds ) // sndMineTicks |
|
4 | 246 |
); |
247 |
||
248 |
Ammoz: array [TAmmoType] of record |
|
249 |
Name: string[32]; |
|
250 |
Ammo: TAmmo; |
|
251 |
Slot: Longword; |
|
252 |
TimeAfterTurn: Longword; |
|
253 |
end = ( |
|
254 |
(Name: 'Grenade'; |
|
255 |
Ammo: (Propz: ammoprop_Timerable or ammoprop_Power; |
|
256 |
Count: AMMO_INFINITE; |
|
257 |
NumPerTurn: 0; |
|
258 |
Timer: 3000; |
|
259 |
AmmoType: amGrenade); |
|
10 | 260 |
Slot: 1; |
4 | 261 |
TimeAfterTurn: 3000), |
262 |
(Name: 'Bazooka'; |
|
263 |
Ammo: (Propz: ammoprop_Power; |
|
264 |
Count: AMMO_INFINITE; |
|
265 |
NumPerTurn: 0; |
|
266 |
Timer: 0; |
|
267 |
AmmoType: amBazooka); |
|
10 | 268 |
Slot: 0; |
4 | 269 |
TimeAfterTurn: 3000), |
270 |
(Name: 'UFO'; |
|
271 |
Ammo: (Propz: ammoprop_Power or ammoprop_NeedTarget; |
|
272 |
Count: 4; |
|
273 |
NumPerTurn: 0; |
|
274 |
Timer: 0; |
|
275 |
AmmoType: amUFO); |
|
276 |
Slot: 0; |
|
277 |
TimeAfterTurn: 3000), |
|
278 |
(Name: 'Shotgun'; |
|
279 |
Ammo: (Propz: 0; |
|
280 |
Count: AMMO_INFINITE; |
|
281 |
NumPerTurn: 1; |
|
282 |
Timer: 0; |
|
283 |
AmmoType: amShotgun); |
|
284 |
Slot: 2; |
|
285 |
TimeAfterTurn: 3000), |
|
286 |
(Name: 'Pneumatic pick'; |
|
287 |
Ammo: (Propz: ammoprop_ForwMsgs or ammoprop_AttackInFall or ammoprop_AttackInJump; |
|
288 |
Count: 2; |
|
289 |
NumPerTurn: 0; |
|
290 |
Timer: 0; |
|
291 |
AmmoType: amPickHammer); |
|
10 | 292 |
Slot: 4; |
4 | 293 |
TimeAfterTurn: 0), |
294 |
(Name: 'Skip turn'; |
|
295 |
Ammo: (Propz: 0; |
|
296 |
Count: AMMO_INFINITE; |
|
297 |
NumPerTurn: 0; |
|
298 |
Timer: 0; |
|
299 |
AmmoType: amSkip); |
|
10 | 300 |
Slot: 6; |
4 | 301 |
TimeAfterTurn: 0), |
302 |
(Name: 'Rope'; |
|
303 |
Ammo: (Propz: ammoprop_ForwMsgs or ammoprop_AttackInFall or ammoprop_AttackInJump; |
|
304 |
Count: 5; |
|
305 |
NumPerTurn: 0; |
|
306 |
Timer: 0; |
|
307 |
AmmoType: amRope); |
|
10 | 308 |
Slot: 5; |
309 |
TimeAfterTurn: 0), |
|
310 |
(Name: 'Mine'; |
|
13 | 311 |
Ammo: (Propz: ammoprop_NoCrosshair; |
10 | 312 |
Count: 5; |
313 |
NumPerTurn: 0; |
|
314 |
Timer: 0; |
|
315 |
AmmoType: amMine); |
|
4 | 316 |
Slot: 3; |
10 | 317 |
TimeAfterTurn: 3000) |
4 | 318 |
); |
319 |
||
320 |
Resolutions: array[0..3] of String = ( |
|
321 |
'640 480', |
|
322 |
'800 600', |
|
323 |
'1024 768', |
|
324 |
'1280 1024' |
|
325 |
); |
|
326 |
||
327 |
implementation |
|
328 |
||
329 |
end. |