author | unc0rr |
Thu, 29 Jun 2006 18:27:53 +0000 | |
changeset 72 | aeb2ac1878dc |
parent 70 | 82d93eeecebe |
child 74 | 42257fee61ae |
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, |
35 | 39 |
sWindL, sWindR, sRopeNode); |
4 | 40 |
TGameState = (gsLandGen, gsStart, gsGame, gsConsole, gsExit); |
72 | 41 |
TGameType = (gmtLocal, gmtDemo, gmtNet, gmtSave); |
4 | 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, |
43 | 47 |
sprMineOn, sprCase, sprFAid, sprDynamite); |
4 | 48 |
TGearType = (gtCloud, gtAmmo_Bomb, gtHedgehog, gtAmmo_Grenade, gtHealthTag, |
49 |
gtGrave, gtUFO, gtShotgunShot, gtActionTimer, gtPickHammer, gtRope, |
|
49 | 50 |
gtSmokeTrace, gtExplosion, gtMine, gtCase, gtDEagleShot, gtDynamite, |
51 |
gtTeamHealthSorter); |
|
16 | 52 |
TGearsType = set of TGearType; |
4 | 53 |
TSound = (sndGrenadeImpact, sndExplosion, sndThrowPowerUp, sndThrowRelease, sndSplash, |
13 | 54 |
sndShotgunReload, sndShotgunFire, sndGraveImpact, sndMineTick); |
10 | 55 |
TAmmoType = (amGrenade, amBazooka, amUFO, amShotgun, amPickHammer, amSkip, amRope, |
39 | 56 |
amMine, amDEagle, amDynamite); |
4 | 57 |
THWFont = (fnt16, fntBig); |
58 |
THHFont = record |
|
59 |
Handle: PTTF_Font; |
|
60 |
Height: integer; |
|
61 |
Name: string[15]; |
|
62 |
end; |
|
63 |
TAmmo = record |
|
64 |
Propz: LongWord; |
|
65 |
Count: LongWord; |
|
66 |
NumPerTurn: LongWord; |
|
67 |
Timer: LongWord; |
|
68 |
AmmoType: TAmmoType; |
|
69 |
end; |
|
70 |
||
71 |
||
72 |
resourcestring |
|
43 | 73 |
errmsgCreateSurface = 'Error creating SDL surface'; |
4 | 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 |
cNetProtoVersion = 1; |
|
87 |
||
88 |
rndfillstr = 'hw'; |
|
89 |
||
64 | 90 |
COLOR_LAND = $00FFFFFF; |
91 |
||
55
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
53
diff
changeset
|
92 |
cifRandomize = $00000001; |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
53
diff
changeset
|
93 |
cifTheme = $00000002; |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
53
diff
changeset
|
94 |
cifMap = $00000002; // either theme or map (or map+theme) |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
53
diff
changeset
|
95 |
cifAllInited = cifRandomize or |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
53
diff
changeset
|
96 |
cifTheme or |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
53
diff
changeset
|
97 |
cifMap; |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
53
diff
changeset
|
98 |
|
4 | 99 |
cTransparentColor: Cardinal = $000000; |
100 |
||
22 | 101 |
cMaxHHIndex = 9; |
102 |
cMaxHHs = 20; |
|
53 | 103 |
cMaxSpawnPoints = 1024; |
4 | 104 |
cHHSurfaceWidth = 512; |
70 | 105 |
// cHHSurfaceHeigth = 256; |
4 | 106 |
|
22 | 107 |
cMaxEdgePoints = 16384; |
108 |
||
53 | 109 |
cHHRadius = 9; |
70 | 110 |
cHHStepTicks = 38; |
4 | 111 |
|
112 |
cKeyMaxIndex = 322; |
|
113 |
||
53 | 114 |
cMaxCaptions = 4; |
4 | 115 |
|
116 |
cInactDelay = 1500; |
|
117 |
||
118 |
gfForts = $00000001; |
|
119 |
||
120 |
gstDrowning = $00000001; |
|
121 |
gstHHDriven = $00000002; |
|
122 |
gstMoving = $00000004; |
|
123 |
gstAttacked = $00000008; |
|
124 |
gstAttacking = $00000010; |
|
125 |
gstCollision = $00000020; |
|
126 |
gstHHChooseTarget = $00000040; |
|
127 |
gstFalling = $00000080; |
|
128 |
gstHHJumping = $00000100; |
|
129 |
gsttmpFlag = $00000200; |
|
130 |
gstHHThinking = $00000800; |
|
131 |
||
132 |
gtsStartGame = 1; |
|
6 | 133 |
gtsSmoothWindCh = 2; |
4 | 134 |
|
135 |
gm_Left = $00000001; |
|
136 |
gm_Right = $00000002; |
|
137 |
gm_Up = $00000004; |
|
138 |
gm_Down = $00000008; |
|
139 |
gm_Switch = $00000010; |
|
140 |
gm_Attack = $00000020; |
|
141 |
gm_LJump = $00000040; |
|
142 |
gm_HJump = $00000080; |
|
143 |
gm_Destroy= $00000100; |
|
144 |
||
10 | 145 |
cMaxSlotIndex = 6; |
146 |
cMaxSlotAmmoIndex = 1; |
|
4 | 147 |
|
148 |
ammoprop_Timerable = $00000001; |
|
149 |
ammoprop_Power = $00000002; |
|
150 |
ammoprop_NeedTarget = $00000004; |
|
151 |
ammoprop_ForwMsgs = $00000008; |
|
152 |
ammoprop_AttackInFall = $00000010; |
|
153 |
ammoprop_AttackInJump = $00000020; |
|
13 | 154 |
ammoprop_NoCrosshair = $00000040; |
4 | 155 |
AMMO_INFINITE = High(LongWord); |
156 |
||
157 |
capgrpStartGame = 0; |
|
158 |
capgrpAmmoinfo = 1; |
|
159 |
capgrpNetSay = 2; |
|
160 |
||
42 | 161 |
EXPLAllDamageInRadius = $00000001; |
162 |
EXPLAutoSound = $00000002; |
|
163 |
EXPLNoDamage = $00000004; |
|
164 |
EXPLDoNotTouchHH = $00000008; |
|
165 |
||
166 |
posCaseAmmo = $00000001; |
|
167 |
posCaseHealth = $00000002; |
|
4 | 168 |
|
169 |
NoPointX = Low(Integer); // êîíñòàíòà äëÿ TargetPoint, ïîêàçûâàåò, ÷òî öåëü íå óêàçàíà |
|
170 |
||
171 |
cHHFileName = 'Hedgehog.png'; |
|
172 |
cCHFileName = 'Crosshair.png'; |
|
173 |
cThemeCFGFilename = 'theme.cfg'; |
|
174 |
||
175 |
Fontz: array[THWFont] of THHFont = ( |
|
176 |
(Height: 12; |
|
177 |
Name: 'UN1251N.TTF'), |
|
178 |
(Height: 24; |
|
179 |
Name: 'UN1251N.TTF') |
|
180 |
); |
|
181 |
||
182 |
Pathz: array[TPathType] of string[ 64] = ( |
|
53 | 183 |
'Data', // ptData |
184 |
'Data/Graphics', // ptGraphics |
|
185 |
'Data/Themes', // ptThemes |
|
186 |
'Data/Themes/avematan', // ptThemeCurrent |
|
187 |
'Data/Teams', // ptTeams |
|
188 |
'Data/Maps', // ptMaps |
|
189 |
'', // ptMapCurrent |
|
190 |
'Data/Demos', // ptDemos |
|
191 |
'Data/Sounds', // ptSounds |
|
192 |
'Data/Graphics/Graves', // ptGraves |
|
193 |
'Data/Fonts', // ptFonts |
|
194 |
'Data/Forts' // ptForts |
|
4 | 195 |
); |
196 |
||
197 |
StuffLoadData: array[TStuff] of record |
|
198 |
FileName: String[31]; |
|
199 |
Path : TPathType; |
|
200 |
end = ( |
|
201 |
(FileName: 'horizont.png'; Path: ptThemeCurrent ), // sHorizont |
|
202 |
(FileName: 'Sky.png'; Path: ptThemeCurrent ), // sSky |
|
203 |
(FileName: 'Console.png'; Path: ptGraphics ), // sConsoleBG |
|
204 |
(FileName: 'PowerBar.png'; Path: ptGraphics ), // sPowerBar |
|
5 | 205 |
(FileName: 'thinking.png'; Path: ptGraphics ), // sQuestion |
206 |
(FileName: 'WindBar.png'; Path: ptGraphics ), // sWindBar |
|
207 |
(FileName: 'WindL.png'; Path: ptGraphics ), // sWindL |
|
35 | 208 |
(FileName: 'WindR.png'; Path: ptGraphics ), // sWindR |
209 |
(FileName: 'RopeNode.png'; Path: ptGraphics ) // sRopeNode |
|
4 | 210 |
); |
211 |
StuffPoz: array[TStuff] of TSDL_Rect = ( |
|
212 |
(x: 0; y: 0; w: 512; h: 256), // sHorizont |
|
213 |
(x: 512; y: 0; w: 64; h:1024), // sSky |
|
214 |
(x: 256; y: 256; w: 256; h: 256), // sConsoleBG |
|
215 |
(x: 256; y: 768; w: 256; h: 32), // sPowerBar |
|
5 | 216 |
(x: 256; y: 512; w: 32; h: 32), // sQuestion |
217 |
(x: 256; y: 800; w: 151; h: 17), // sWindBar |
|
218 |
(x: 256; y: 817; w: 80; h: 13), // sWindL |
|
35 | 219 |
(x: 336; y: 817; w: 80; h: 13), // sWindR |
220 |
(x: 256; y: 544; w: 6; h: 6) // sRopeNode |
|
4 | 221 |
); |
222 |
SpritesData: array[TSprite] of record |
|
35 | 223 |
FileName: String[31]; |
224 |
Path : TPathType; |
|
225 |
Surface : PSDL_Surface; |
|
226 |
Width, Height: integer; |
|
227 |
hasAlpha: boolean; |
|
228 |
end = ( |
|
229 |
(FileName: 'BlueWater.png'; Path: ptGraphics; Width: 256; Height: 48; hasAlpha: false),// sprWater |
|
230 |
(FileName: 'Clouds.png'; Path: ptGraphics; Width: 256; Height:128; hasAlpha: false),// sprCloud |
|
231 |
(FileName: 'Bomb.png'; Path: ptGraphics; Width: 16; Height: 16; hasAlpha: false),// sprBomb |
|
232 |
(FileName: 'BigDigits.png'; Path: ptGraphics; Width: 32; Height: 32; hasAlpha: true),// sprBigDigit |
|
233 |
(FileName: 'Frame.png'; Path: ptGraphics; Width: 4; Height: 32; hasAlpha: true),// sprFrame |
|
234 |
(FileName: 'Lag.png'; Path: ptGraphics; Width: 64; Height: 64; hasAlpha: false),// sprLag |
|
235 |
(FileName: 'Arrow.png'; Path: ptGraphics; Width: 16; Height: 16; hasAlpha: false),// sprCursor |
|
236 |
(FileName: 'Grenade.png'; Path: ptGraphics; Width: 32; Height: 32; hasAlpha: false),// sprGrenade |
|
237 |
(FileName: 'Targetp.png'; Path: ptGraphics; Width: 32; Height: 32; hasAlpha: false),// sprTargetP |
|
238 |
(FileName: 'UFO.png'; Path: ptGraphics; Width: 32; Height: 32; hasAlpha: false),// sprUFO |
|
239 |
(FileName:'SmokeTrace.png'; Path: ptGraphics; Width: 32; Height: 32; hasAlpha: true),// sprSmokeTrace |
|
240 |
(FileName: 'RopeHook.png'; Path: ptGraphics; Width: 32; Height: 32; hasAlpha: false),// sprRopeHook |
|
241 |
(FileName: 'Expl50.png'; Path: ptGraphics; Width: 64; Height: 64; hasAlpha: false),// sprExplosion50 |
|
242 |
(FileName: 'MineOff.png'; Path: ptGraphics; Width: 16; Height: 16; hasAlpha: false),// sprMineOff |
|
243 |
(FileName: 'MineOn.png'; Path: ptGraphics; Width: 16; Height: 16; hasAlpha: false),// sprMineOn |
|
42 | 244 |
(FileName: 'Case.png'; Path: ptGraphics; Width: 32; Height: 32; hasAlpha: false),// sprCase |
43 | 245 |
(FileName: 'FirstAid.png'; Path: ptGraphics; Width: 32; Height: 32; hasAlpha: false),// sprFAid |
246 |
(FileName: 'dynamite.png'; Path: ptGraphics; Width: 32; Height: 32; hasAlpha: false) // sprDynamite |
|
35 | 247 |
); |
4 | 248 |
Soundz: array[TSound] of record |
249 |
FileName: String[31]; |
|
250 |
Path : TPathType; |
|
251 |
id : PMixChunk; |
|
252 |
end = ( |
|
253 |
(FileName: 'grenadeimpact.ogg'; Path: ptSounds ),// sndGrenadeImpact |
|
254 |
(FileName: 'explosion.ogg'; Path: ptSounds ),// sndExplosion |
|
255 |
(FileName: 'throwpowerup.ogg'; Path: ptSounds ),// sndThrowPowerUp |
|
256 |
(FileName: 'throwrelease.ogg'; Path: ptSounds ),// sndThrowRelease |
|
257 |
(FileName: 'splash.ogg'; Path: ptSounds ),// sndSplash |
|
258 |
(FileName: 'shotgunreload.ogg'; Path: ptSounds ),// sndShotgunReload |
|
259 |
(FileName: 'shotgunfire.ogg'; Path: ptSounds ),// sndShotgunFire |
|
13 | 260 |
(FileName: 'graveimpact.ogg'; Path: ptSounds ),// sndGraveImpact |
261 |
(FileName: 'minetick.ogg'; Path: ptSounds ) // sndMineTicks |
|
4 | 262 |
); |
263 |
||
264 |
Ammoz: array [TAmmoType] of record |
|
265 |
Name: string[32]; |
|
266 |
Ammo: TAmmo; |
|
267 |
Slot: Longword; |
|
268 |
TimeAfterTurn: Longword; |
|
269 |
end = ( |
|
270 |
(Name: 'Grenade'; |
|
271 |
Ammo: (Propz: ammoprop_Timerable or ammoprop_Power; |
|
272 |
Count: AMMO_INFINITE; |
|
273 |
NumPerTurn: 0; |
|
274 |
Timer: 3000; |
|
275 |
AmmoType: amGrenade); |
|
10 | 276 |
Slot: 1; |
4 | 277 |
TimeAfterTurn: 3000), |
278 |
(Name: 'Bazooka'; |
|
279 |
Ammo: (Propz: ammoprop_Power; |
|
280 |
Count: AMMO_INFINITE; |
|
281 |
NumPerTurn: 0; |
|
282 |
Timer: 0; |
|
283 |
AmmoType: amBazooka); |
|
10 | 284 |
Slot: 0; |
4 | 285 |
TimeAfterTurn: 3000), |
286 |
(Name: 'UFO'; |
|
287 |
Ammo: (Propz: ammoprop_Power or ammoprop_NeedTarget; |
|
56 | 288 |
Count: 2; |
4 | 289 |
NumPerTurn: 0; |
290 |
Timer: 0; |
|
291 |
AmmoType: amUFO); |
|
292 |
Slot: 0; |
|
293 |
TimeAfterTurn: 3000), |
|
294 |
(Name: 'Shotgun'; |
|
295 |
Ammo: (Propz: 0; |
|
296 |
Count: AMMO_INFINITE; |
|
297 |
NumPerTurn: 1; |
|
298 |
Timer: 0; |
|
299 |
AmmoType: amShotgun); |
|
300 |
Slot: 2; |
|
301 |
TimeAfterTurn: 3000), |
|
302 |
(Name: 'Pneumatic pick'; |
|
303 |
Ammo: (Propz: ammoprop_ForwMsgs or ammoprop_AttackInFall or ammoprop_AttackInJump; |
|
304 |
Count: 2; |
|
305 |
NumPerTurn: 0; |
|
306 |
Timer: 0; |
|
307 |
AmmoType: amPickHammer); |
|
10 | 308 |
Slot: 4; |
4 | 309 |
TimeAfterTurn: 0), |
310 |
(Name: 'Skip turn'; |
|
311 |
Ammo: (Propz: 0; |
|
312 |
Count: AMMO_INFINITE; |
|
313 |
NumPerTurn: 0; |
|
314 |
Timer: 0; |
|
315 |
AmmoType: amSkip); |
|
10 | 316 |
Slot: 6; |
4 | 317 |
TimeAfterTurn: 0), |
318 |
(Name: 'Rope'; |
|
319 |
Ammo: (Propz: ammoprop_ForwMsgs or ammoprop_AttackInFall or ammoprop_AttackInJump; |
|
320 |
Count: 5; |
|
321 |
NumPerTurn: 0; |
|
322 |
Timer: 0; |
|
323 |
AmmoType: amRope); |
|
10 | 324 |
Slot: 5; |
325 |
TimeAfterTurn: 0), |
|
326 |
(Name: 'Mine'; |
|
13 | 327 |
Ammo: (Propz: ammoprop_NoCrosshair; |
56 | 328 |
Count: 2; |
10 | 329 |
NumPerTurn: 0; |
330 |
Timer: 0; |
|
331 |
AmmoType: amMine); |
|
4 | 332 |
Slot: 3; |
37 | 333 |
TimeAfterTurn: 3000), |
334 |
(Name: 'Desert Eagle'; |
|
335 |
Ammo: (Propz: 0; |
|
336 |
Count: AMMO_INFINITE; |
|
337 |
NumPerTurn: 3; |
|
338 |
Timer: 0; |
|
339 |
AmmoType: amDEagle); |
|
340 |
Slot: 2; |
|
39 | 341 |
TimeAfterTurn: 3000), |
342 |
(Name: 'Dynamite'; |
|
343 |
Ammo: (Propz: ammoprop_NoCrosshair or ammoprop_AttackInJump or ammoprop_AttackInFall; |
|
56 | 344 |
Count: 1; |
39 | 345 |
NumPerTurn: 0; |
346 |
Timer: 0; |
|
347 |
AmmoType: amDynamite); |
|
348 |
Slot: 3; |
|
349 |
TimeAfterTurn: 5000)); |
|
37 | 350 |
|
4 | 351 |
implementation |
352 |
||
353 |
end. |