|
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} |
|
38 type TStuff = (sHorizont, sSky, sConsoleBG, sPowerBar, sQuestion); |
|
39 TGameState = (gsLandGen, gsStart, gsGame, gsConsole, gsExit); |
|
40 TGameType = (gmtLocal, gmtDemo, gmtNet); |
|
41 TPathType = (ptData, ptGraphics, ptThemes, ptThemeCurrent, ptTeams, ptMaps, |
|
42 ptMapCurrent, ptDemos, ptSounds, ptGraves, ptFonts, ptForts); |
|
43 TSprite = (sprWater, sprCloud, sprBomb, sprBigDigit, sprFrame, |
|
44 sprLag, sprArrow, sprGrenade, sprTargetP, sprUFO, |
|
45 sprSmokeTrace, sprRopeHook); |
|
46 TGearType = (gtCloud, gtAmmo_Bomb, gtHedgehog, gtAmmo_Grenade, gtHealthTag, |
|
47 gtGrave, gtUFO, gtShotgunShot, gtActionTimer, gtPickHammer, gtRope, |
|
48 gtSmokeTrace); |
|
49 TSound = (sndGrenadeImpact, sndExplosion, sndThrowPowerUp, sndThrowRelease, sndSplash, |
|
50 sndShotgunReload, sndShotgunFire, sndGraveImpact); |
|
51 TAmmoType = (amGrenade, amBazooka, amUFO, amShotgun, amPickHammer, amSkip, amRope); |
|
52 THWFont = (fnt16, fntBig); |
|
53 THHFont = record |
|
54 Handle: PTTF_Font; |
|
55 Height: integer; |
|
56 Name: string[15]; |
|
57 end; |
|
58 TAmmo = record |
|
59 Propz: LongWord; |
|
60 Count: LongWord; |
|
61 NumPerTurn: LongWord; |
|
62 Timer: LongWord; |
|
63 AmmoType: TAmmoType; |
|
64 end; |
|
65 |
|
66 |
|
67 resourcestring |
|
68 errmsgCreateSurface = 'Error creating DirectDraw7 surface'; |
|
69 errmsgNoDesc = 'Unknown error'; |
|
70 errmsgTransparentSet = 'Error setting transparent color'; |
|
71 errmsgDynamicVar = 'Error working with dynamic memory'; |
|
72 errmsgUnknownCommand = 'Unknown command'; |
|
73 errmsgUnknownVariable = 'Unknown variable'; |
|
74 errmsgIncorrectUse = 'Incorrect use'; |
|
75 errmsgShouldntRun = 'This program shouldn''t be run manually'; |
|
76 |
|
77 msgLoading = 'Loading '; |
|
78 msgOK = 'ok'; |
|
79 msgFailed = 'failed'; |
|
80 msgGettingConfig = 'Getting game config...'; |
|
81 |
|
82 const |
|
83 cAppName = 'hw'; |
|
84 cAppTitle = 'hw'; |
|
85 cNetProtoVersion = 1; |
|
86 |
|
87 rndfillstr = 'hw'; |
|
88 |
|
89 cTransparentColor: Cardinal = $000000; |
|
90 |
|
91 cMaxHHIndex = 9; |
|
92 cMaxHHs = 20; |
|
93 cHHSurfaceWidth = 512; |
|
94 cHHSurfaceHeigth = 256; |
|
95 |
|
96 cHHHalfHeight = 11; |
|
97 |
|
98 cKeyMaxIndex = 322; |
|
99 |
|
100 cMaxCaptions = 4; |
|
101 |
|
102 cInactDelay = 1500; |
|
103 |
|
104 gstDrowning = $00000001; |
|
105 gstHHDriven = $00000002; |
|
106 gstMoving = $00000004; |
|
107 gstAttacked = $00000008; |
|
108 gstAttacking = $00000010; |
|
109 gstCollision = $00000020; |
|
110 gstHHChooseTarget = $00000040; |
|
111 gstFalling = $00000080; |
|
112 gstHHJumping = $00000100; |
|
113 gsttmpFlag = $00000200; |
|
114 gstOutOfHH = $00000400; |
|
115 gstHHThinking = $00000800; |
|
116 |
|
117 gtsStartGame = 1; |
|
118 |
|
119 gm_Left = $00000001; |
|
120 gm_Right = $00000002; |
|
121 gm_Up = $00000004; |
|
122 gm_Down = $00000008; |
|
123 gm_Switch = $00000010; |
|
124 gm_Attack = $00000020; |
|
125 gm_LJump = $00000040; |
|
126 gm_HJump = $00000080; |
|
127 gm_Destroy= $00000100; |
|
128 |
|
129 cMaxSlot = 4; |
|
130 cMaxSlotAmmo = 1; |
|
131 |
|
132 ammoprop_Timerable = $00000001; |
|
133 ammoprop_Power = $00000002; |
|
134 ammoprop_NeedTarget = $00000004; |
|
135 ammoprop_ForwMsgs = $00000008; |
|
136 ammoprop_AttackInFall = $00000010; |
|
137 ammoprop_AttackInJump = $00000020; |
|
138 AMMO_INFINITE = High(LongWord); |
|
139 |
|
140 capgrpStartGame = 0; |
|
141 capgrpAmmoinfo = 1; |
|
142 capgrpNetSay = 2; |
|
143 |
|
144 EXPLAllDamageInRadius = 1; |
|
145 EXPLAutoSound = 2; |
|
146 EXPLNoDamage = 4; |
|
147 |
|
148 cToggleConsoleKey = 39; |
|
149 |
|
150 NoPointX = Low(Integer); // константа для TargetPoint, показывает, что цель не указана |
|
151 |
|
152 cLandFileName = 'Land.bmp'; |
|
153 cHHFileName = 'Hedgehog.png'; |
|
154 cCHFileName = 'Crosshair.png'; |
|
155 cThemeCFGFilename = 'theme.cfg'; |
|
156 |
|
157 Fontz: array[THWFont] of THHFont = ( |
|
158 (Height: 12; |
|
159 Name: 'UN1251N.TTF'), |
|
160 (Height: 24; |
|
161 Name: 'UN1251N.TTF') |
|
162 ); |
|
163 |
|
164 Pathz: array[TPathType] of string[ 64] = ( |
|
165 'Data/', // ptData |
|
166 'Data/Graphics/', // ptGraphics |
|
167 'Data/Themes/', // ptThemes |
|
168 'Data/Themes/Default/', // ptThemeCurrent |
|
169 'Data/Teams/', // ptTeams |
|
170 'Data/Maps/', // ptMaps |
|
171 'Data/Maps/Current/', // ptMapCurrent |
|
172 'Data/Demos/', // ptDemos |
|
173 'Data/Sounds/', // ptSounds |
|
174 'Data/Graphics/Graves/', // ptGraves |
|
175 'Data/Fonts/', // ptFonts |
|
176 'Data/Forts/' // ptForts |
|
177 ); |
|
178 |
|
179 StuffLoadData: array[TStuff] of record |
|
180 FileName: String[31]; |
|
181 Path : TPathType; |
|
182 end = ( |
|
183 (FileName: 'horizont.png'; Path: ptThemeCurrent ), // sHorizont |
|
184 (FileName: 'Sky.png'; Path: ptThemeCurrent ), // sSky |
|
185 (FileName: 'Console.png'; Path: ptGraphics ), // sConsoleBG |
|
186 (FileName: 'PowerBar.png'; Path: ptGraphics ), // sPowerBar |
|
187 (FileName: 'thinking.png'; Path: ptGraphics ) // sQuestion |
|
188 ); |
|
189 StuffPoz: array[TStuff] of TSDL_Rect = ( |
|
190 (x: 0; y: 0; w: 512; h: 256), // sHorizont |
|
191 (x: 512; y: 0; w: 64; h:1024), // sSky |
|
192 (x: 256; y: 256; w: 256; h: 256), // sConsoleBG |
|
193 (x: 256; y: 768; w: 256; h: 32), // sPowerBar |
|
194 (x: 256; y: 512; w: 32; h: 32) // sQuestion |
|
195 ); |
|
196 SpritesData: array[TSprite] of record |
|
197 FileName: String[31]; |
|
198 Path : TPathType; |
|
199 Surface : PSDL_Surface; |
|
200 Width, Height: integer; |
|
201 end = ( |
|
202 (FileName: 'BlueWater.png'; Path: ptGraphics; Width: 256; Height: 48),// sprWater |
|
203 (FileName: 'Clouds.png'; Path: ptGraphics; Width: 256; Height:128),// sprCloud |
|
204 (FileName: 'Bomb.png'; Path: ptGraphics; Width: 16; Height: 16),// sprBomb |
|
205 (FileName: 'BigDigits.png'; Path: ptGraphics; Width: 32; Height: 32),// sprBigDigit |
|
206 (FileName: 'Frame.png'; Path: ptGraphics; Width: 4; Height: 32),// sprFrame |
|
207 (FileName: 'Lag.png'; Path: ptGraphics; Width: 64; Height: 64),// sprLag |
|
208 (FileName: 'Arrow.png'; Path: ptGraphics; Width: 16; Height: 16),// sprCursor |
|
209 (FileName: 'Grenade.png'; Path: ptGraphics; Width: 32; Height: 32),// sprGrenade |
|
210 (FileName: 'Targetp.png'; Path: ptGraphics; Width: 32; Height: 32),// sprTargetP |
|
211 (FileName: 'UFO.png'; Path: ptGraphics; Width: 32; Height: 32),// sprUFO |
|
212 (FileName:'SmokeTrace.png'; Path: ptGraphics; Width: 32; Height: 32),// sprSmokeTrace |
|
213 (FileName: 'RopeHook.png'; Path: ptGraphics; Width: 32; Height: 32) // sprRopeHook |
|
214 ); |
|
215 Soundz: array[TSound] of record |
|
216 FileName: String[31]; |
|
217 Path : TPathType; |
|
218 id : PMixChunk; |
|
219 end = ( |
|
220 (FileName: 'grenadeimpact.ogg'; Path: ptSounds ),// sndGrenadeImpact |
|
221 (FileName: 'explosion.ogg'; Path: ptSounds ),// sndExplosion |
|
222 (FileName: 'throwpowerup.ogg'; Path: ptSounds ),// sndThrowPowerUp |
|
223 (FileName: 'throwrelease.ogg'; Path: ptSounds ),// sndThrowRelease |
|
224 (FileName: 'splash.ogg'; Path: ptSounds ),// sndSplash |
|
225 (FileName: 'shotgunreload.ogg'; Path: ptSounds ),// sndShotgunReload |
|
226 (FileName: 'shotgunfire.ogg'; Path: ptSounds ),// sndShotgunFire |
|
227 (FileName: 'graveimpact.ogg'; Path: ptSounds ) // sndGraveImpact |
|
228 ); |
|
229 |
|
230 Ammoz: array [TAmmoType] of record |
|
231 Name: string[32]; |
|
232 Ammo: TAmmo; |
|
233 Slot: Longword; |
|
234 TimeAfterTurn: Longword; |
|
235 end = ( |
|
236 (Name: 'Grenade'; |
|
237 Ammo: (Propz: ammoprop_Timerable or ammoprop_Power; |
|
238 Count: AMMO_INFINITE; |
|
239 NumPerTurn: 0; |
|
240 Timer: 3000; |
|
241 AmmoType: amGrenade); |
|
242 Slot: 0; |
|
243 TimeAfterTurn: 3000), |
|
244 (Name: 'Bazooka'; |
|
245 Ammo: (Propz: ammoprop_Power; |
|
246 Count: AMMO_INFINITE; |
|
247 NumPerTurn: 0; |
|
248 Timer: 0; |
|
249 AmmoType: amBazooka); |
|
250 Slot: 1; |
|
251 TimeAfterTurn: 3000), |
|
252 (Name: 'UFO'; |
|
253 Ammo: (Propz: ammoprop_Power or ammoprop_NeedTarget; |
|
254 Count: 4; |
|
255 NumPerTurn: 0; |
|
256 Timer: 0; |
|
257 AmmoType: amUFO); |
|
258 Slot: 0; |
|
259 TimeAfterTurn: 3000), |
|
260 (Name: 'Shotgun'; |
|
261 Ammo: (Propz: 0; |
|
262 Count: AMMO_INFINITE; |
|
263 NumPerTurn: 1; |
|
264 Timer: 0; |
|
265 AmmoType: amShotgun); |
|
266 Slot: 2; |
|
267 TimeAfterTurn: 3000), |
|
268 (Name: 'Pneumatic pick'; |
|
269 Ammo: (Propz: ammoprop_ForwMsgs or ammoprop_AttackInFall or ammoprop_AttackInJump; |
|
270 Count: 2; |
|
271 NumPerTurn: 0; |
|
272 Timer: 0; |
|
273 AmmoType: amPickHammer); |
|
274 Slot: 3; |
|
275 TimeAfterTurn: 0), |
|
276 (Name: 'Skip turn'; |
|
277 Ammo: (Propz: 0; |
|
278 Count: AMMO_INFINITE; |
|
279 NumPerTurn: 0; |
|
280 Timer: 0; |
|
281 AmmoType: amSkip); |
|
282 Slot: 4; |
|
283 TimeAfterTurn: 0), |
|
284 (Name: 'Rope'; |
|
285 Ammo: (Propz: ammoprop_ForwMsgs or ammoprop_AttackInFall or ammoprop_AttackInJump; |
|
286 Count: 5; |
|
287 NumPerTurn: 0; |
|
288 Timer: 0; |
|
289 AmmoType: amRope); |
|
290 Slot: 3; |
|
291 TimeAfterTurn: 0) |
|
292 ); |
|
293 |
|
294 Resolutions: array[0..3] of String = ( |
|
295 '640 480', |
|
296 '800 600', |
|
297 '1024 768', |
|
298 '1280 1024' |
|
299 ); |
|
300 |
|
301 implementation |
|
302 |
|
303 end. |