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