author | unc0rr |
Tue, 20 Jun 2006 21:18:49 +0000 | |
changeset 66 | 9643d75baf1e |
parent 64 | 9df467527ae5 |
child 70 | 82d93eeecebe |
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 |
||
64 | 91 |
COLOR_LAND = $00FFFFFF; |
92 |
||
55
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
53
diff
changeset
|
93 |
cifRandomize = $00000001; |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
53
diff
changeset
|
94 |
cifTheme = $00000002; |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
53
diff
changeset
|
95 |
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
|
96 |
cifAllInited = cifRandomize or |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
53
diff
changeset
|
97 |
cifTheme or |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
53
diff
changeset
|
98 |
cifMap; |
e09f7c952a40
Send run parameters by cmd line, game parameters by IPC... breaks network game
unc0rr
parents:
53
diff
changeset
|
99 |
|
4 | 100 |
cTransparentColor: Cardinal = $000000; |
101 |
||
22 | 102 |
cMaxHHIndex = 9; |
103 |
cMaxHHs = 20; |
|
53 | 104 |
cMaxSpawnPoints = 1024; |
4 | 105 |
cHHSurfaceWidth = 512; |
106 |
cHHSurfaceHeigth = 256; |
|
107 |
||
22 | 108 |
cMaxEdgePoints = 16384; |
109 |
||
53 | 110 |
cHHRadius = 9; |
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 |
cToggleConsoleKey = 39; |
|
170 |
||
171 |
NoPointX = Low(Integer); // êîíñòàíòà äëÿ TargetPoint, ïîêàçûâàåò, ÷òî öåëü íå óêàçàíà |
|
172 |
||
173 |
cLandFileName = 'Land.bmp'; |
|
174 |
cHHFileName = 'Hedgehog.png'; |
|
175 |
cCHFileName = 'Crosshair.png'; |
|
176 |
cThemeCFGFilename = 'theme.cfg'; |
|
177 |
||
178 |
Fontz: array[THWFont] of THHFont = ( |
|
179 |
(Height: 12; |
|
180 |
Name: 'UN1251N.TTF'), |
|
181 |
(Height: 24; |
|
182 |
Name: 'UN1251N.TTF') |
|
183 |
); |
|
184 |
||
185 |
Pathz: array[TPathType] of string[ 64] = ( |
|
53 | 186 |
'Data', // ptData |
187 |
'Data/Graphics', // ptGraphics |
|
188 |
'Data/Themes', // ptThemes |
|
189 |
'Data/Themes/avematan', // ptThemeCurrent |
|
190 |
'Data/Teams', // ptTeams |
|
191 |
'Data/Maps', // ptMaps |
|
192 |
'', // ptMapCurrent |
|
193 |
'Data/Demos', // ptDemos |
|
194 |
'Data/Sounds', // ptSounds |
|
195 |
'Data/Graphics/Graves', // ptGraves |
|
196 |
'Data/Fonts', // ptFonts |
|
197 |
'Data/Forts' // ptForts |
|
4 | 198 |
); |
199 |
||
200 |
StuffLoadData: array[TStuff] of record |
|
201 |
FileName: String[31]; |
|
202 |
Path : TPathType; |
|
203 |
end = ( |
|
204 |
(FileName: 'horizont.png'; Path: ptThemeCurrent ), // sHorizont |
|
205 |
(FileName: 'Sky.png'; Path: ptThemeCurrent ), // sSky |
|
206 |
(FileName: 'Console.png'; Path: ptGraphics ), // sConsoleBG |
|
207 |
(FileName: 'PowerBar.png'; Path: ptGraphics ), // sPowerBar |
|
5 | 208 |
(FileName: 'thinking.png'; Path: ptGraphics ), // sQuestion |
209 |
(FileName: 'WindBar.png'; Path: ptGraphics ), // sWindBar |
|
210 |
(FileName: 'WindL.png'; Path: ptGraphics ), // sWindL |
|
35 | 211 |
(FileName: 'WindR.png'; Path: ptGraphics ), // sWindR |
212 |
(FileName: 'RopeNode.png'; Path: ptGraphics ) // sRopeNode |
|
4 | 213 |
); |
214 |
StuffPoz: array[TStuff] of TSDL_Rect = ( |
|
215 |
(x: 0; y: 0; w: 512; h: 256), // sHorizont |
|
216 |
(x: 512; y: 0; w: 64; h:1024), // sSky |
|
217 |
(x: 256; y: 256; w: 256; h: 256), // sConsoleBG |
|
218 |
(x: 256; y: 768; w: 256; h: 32), // sPowerBar |
|
5 | 219 |
(x: 256; y: 512; w: 32; h: 32), // sQuestion |
220 |
(x: 256; y: 800; w: 151; h: 17), // sWindBar |
|
221 |
(x: 256; y: 817; w: 80; h: 13), // sWindL |
|
35 | 222 |
(x: 336; y: 817; w: 80; h: 13), // sWindR |
223 |
(x: 256; y: 544; w: 6; h: 6) // sRopeNode |
|
4 | 224 |
); |
225 |
SpritesData: array[TSprite] of record |
|
35 | 226 |
FileName: String[31]; |
227 |
Path : TPathType; |
|
228 |
Surface : PSDL_Surface; |
|
229 |
Width, Height: integer; |
|
230 |
hasAlpha: boolean; |
|
231 |
end = ( |
|
232 |
(FileName: 'BlueWater.png'; Path: ptGraphics; Width: 256; Height: 48; hasAlpha: false),// sprWater |
|
233 |
(FileName: 'Clouds.png'; Path: ptGraphics; Width: 256; Height:128; hasAlpha: false),// sprCloud |
|
234 |
(FileName: 'Bomb.png'; Path: ptGraphics; Width: 16; Height: 16; hasAlpha: false),// sprBomb |
|
235 |
(FileName: 'BigDigits.png'; Path: ptGraphics; Width: 32; Height: 32; hasAlpha: true),// sprBigDigit |
|
236 |
(FileName: 'Frame.png'; Path: ptGraphics; Width: 4; Height: 32; hasAlpha: true),// sprFrame |
|
237 |
(FileName: 'Lag.png'; Path: ptGraphics; Width: 64; Height: 64; hasAlpha: false),// sprLag |
|
238 |
(FileName: 'Arrow.png'; Path: ptGraphics; Width: 16; Height: 16; hasAlpha: false),// sprCursor |
|
239 |
(FileName: 'Grenade.png'; Path: ptGraphics; Width: 32; Height: 32; hasAlpha: false),// sprGrenade |
|
240 |
(FileName: 'Targetp.png'; Path: ptGraphics; Width: 32; Height: 32; hasAlpha: false),// sprTargetP |
|
241 |
(FileName: 'UFO.png'; Path: ptGraphics; Width: 32; Height: 32; hasAlpha: false),// sprUFO |
|
242 |
(FileName:'SmokeTrace.png'; Path: ptGraphics; Width: 32; Height: 32; hasAlpha: true),// sprSmokeTrace |
|
243 |
(FileName: 'RopeHook.png'; Path: ptGraphics; Width: 32; Height: 32; hasAlpha: false),// sprRopeHook |
|
244 |
(FileName: 'Expl50.png'; Path: ptGraphics; Width: 64; Height: 64; hasAlpha: false),// sprExplosion50 |
|
245 |
(FileName: 'MineOff.png'; Path: ptGraphics; Width: 16; Height: 16; hasAlpha: false),// sprMineOff |
|
246 |
(FileName: 'MineOn.png'; Path: ptGraphics; Width: 16; Height: 16; hasAlpha: false),// sprMineOn |
|
42 | 247 |
(FileName: 'Case.png'; Path: ptGraphics; Width: 32; Height: 32; hasAlpha: false),// sprCase |
43 | 248 |
(FileName: 'FirstAid.png'; Path: ptGraphics; Width: 32; Height: 32; hasAlpha: false),// sprFAid |
249 |
(FileName: 'dynamite.png'; Path: ptGraphics; Width: 32; Height: 32; hasAlpha: false) // sprDynamite |
|
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 |
|
354 |
||
355 |
||
356 |
||
4 | 357 |
Resolutions: array[0..3] of String = ( |
358 |
'640 480', |
|
359 |
'800 600', |
|
360 |
'1024 768', |
|
361 |
'1280 1024' |
|
362 |
); |
|
363 |
||
364 |
implementation |
|
365 |
||
366 |
end. |