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