|
1 {$INCLUDE "options.inc"} |
|
2 |
|
3 unit uTypes; |
|
4 interface |
|
5 |
|
6 uses SDLh, uFloat, GLunit, uConsts, Math; |
|
7 |
|
8 // NOTE: typed const is a variable despite const qualifier |
|
9 // in freepascal you may actually use var for the same purpose |
|
10 |
|
11 type |
|
12 HwColor4f = record |
|
13 r, g, b, a: byte |
|
14 end; |
|
15 |
|
16 TGameState = (gsLandGen, gsStart, gsGame, gsChat, gsConfirm, gsExit, gsSuspend); |
|
17 |
|
18 TGameType = (gmtLocal, gmtDemo, gmtNet, gmtSave, gmtLandPreview, gmtSyntax); |
|
19 |
|
20 TPathType = (ptNone, ptData, ptGraphics, ptThemes, ptCurrTheme, ptTeams, ptMaps, |
|
21 ptMapCurrent, ptDemos, ptSounds, ptGraves, ptFonts, ptForts, |
|
22 ptLocale, ptAmmoMenu, ptHedgehog, ptVoices, ptHats, ptFlags, ptMissionMaps, ptSuddenDeath); |
|
23 |
|
24 TSprite = (sprWater, sprCloud, sprBomb, sprBigDigit, sprFrame, |
|
25 sprLag, sprArrow, sprBazookaShell, sprTargetP, sprBee, |
|
26 sprSmokeTrace, sprRopeHook, sprExplosion50, sprMineOff, |
|
27 sprMineOn, sprMineDead, sprCase, sprFAid, sprDynamite, sprPower, |
|
28 sprClusterBomb, sprClusterParticle, sprFlame, sprHorizont, |
|
29 sprHorizontL, sprHorizontR, sprSky, sprSkyL, |
|
30 sprSkyR, sprAMBorderHorizontal, sprAMBorderVertical, sprAMSlot, sprAMAmmos, |
|
31 sprAMSlotKeys, sprAMCorners, sprFinger, sprAirBomb, |
|
32 sprAirplane, sprAmAirplane, sprAmGirder, sprHHTelepMask, |
|
33 sprSwitch, sprParachute, sprTarget, sprRopeNode, |
|
34 sprQuestion, sprPowerBar, sprWindBar, sprWindL, sprWindR, |
|
35 sprFlake, sprHandRope, sprHandBazooka, sprHandShotgun, |
|
36 sprHandDEagle, sprHandAirAttack, sprHandBaseball, sprPHammer, |
|
37 sprHandBlowTorch, sprBlowTorch, sprTeleport, sprHHDeath, |
|
38 sprShotgun, sprDEagle, sprHHIdle, sprMortar, sprTurnsLeft, |
|
39 sprKamikaze, sprWhip, sprKowtow, sprSad, sprWave, |
|
40 sprHurrah, sprLemonade, sprShrug, sprJuggle, sprExplPart, sprExplPart2, |
|
41 sprCakeWalk, sprCakeDown, sprAMAmmosBW, sprWatermelon, |
|
42 sprEvilTrace, sprHellishBomb, sprSeduction, sprDress, |
|
43 sprCensored, sprDrill, sprHandDrill, sprHandBallgun, sprBalls, |
|
44 sprPlane, sprHandPlane, sprUtility, sprInvulnerable, sprVampiric, sprGirder, |
|
45 sprSpeechCorner, sprSpeechEdge, sprSpeechTail, |
|
46 sprThoughtCorner, sprThoughtEdge, sprThoughtTail, |
|
47 sprShoutCorner, sprShoutEdge, sprShoutTail, |
|
48 sprSniperRifle, sprBubbles, sprJetpack, sprHealth, sprHandMolotov, sprMolotov, |
|
49 sprSmoke, sprSmokeWhite, sprShell, sprDust, sprExplosives, sprExplosivesRoll, |
|
50 sprAmTeleport, sprSplash, sprDroplet, sprBirdy, sprHandCake, sprHandConstruction, |
|
51 sprHandGrenade, sprHandMelon, sprHandMortar, sprHandSkip, sprHandCluster, |
|
52 sprHandDynamite, sprHandHellish, sprHandMine, sprHandSeduction, sprHandVamp, |
|
53 sprBigExplosion, sprSmokeRing, sprBeeTrace, sprEgg, sprTargetBee, sprHandBee, |
|
54 sprFeather, sprPiano, sprHandSineGun, sprPortalGun, sprPortal, |
|
55 sprCheese, sprHandCheese, sprHandFlamethrower, sprChunk, sprNote, |
|
56 sprSMineOff, sprSMineOn, sprHandSMine, sprHammer, |
|
57 sprHandResurrector, sprCross, sprAirDrill, sprNapalmBomb, |
|
58 sprBulletHit, sprSnowball, sprHandSnowball, sprSnow, |
|
59 sprSDFlake, sprSDWater, sprSDCloud, sprSDSplash, sprSDDroplet |
|
60 ); |
|
61 |
|
62 // Gears that interact with other Gears and/or Land |
|
63 TGearType = (gtBomb, gtHedgehog, gtShell, gtGrave, gtBee, // 4 |
|
64 gtShotgunShot, gtPickHammer, gtRope, gtMine, gtCase, // 9 |
|
65 gtDEagleShot, gtDynamite, gtClusterBomb, gtCluster, gtShover, // 14 |
|
66 gtFlame, gtFirePunch, gtATStartGame, gtATSmoothWindCh, // 18 |
|
67 gtATFinishGame, gtParachute, gtAirAttack, gtAirBomb, gtBlowTorch, // 23 |
|
68 gtGirder, gtTeleport, gtSwitcher, gtTarget, gtMortar, // 28 |
|
69 gtWhip, gtKamikaze, gtCake, gtSeduction, gtWatermelon, gtMelonPiece, // 34 |
|
70 gtHellishBomb, gtWaterUp, gtDrill, gtBallGun, gtBall, gtRCPlane, // 40 |
|
71 gtSniperRifleShot, gtJetpack, gtMolotov, gtExplosives, gtBirdy, // 45 |
|
72 gtEgg, gtPortal, gtPiano, gtGasBomb, gtSineGunShot, gtFlamethrower, // 51 |
|
73 gtSMine, gtPoisonCloud, gtHammer, gtHammerHit, gtResurrector, // 56 |
|
74 gtNapalmBomb, gtSnowball, gtFlake); // 58 |
|
75 |
|
76 // Gears that are _only_ of visual nature (e.g. background stuff, visual effects, speechbubbles, etc.) |
|
77 TVisualGearType = (vgtFlake, vgtCloud, vgtExplPart, vgtExplPart2, vgtFire, |
|
78 vgtSmallDamageTag, vgtTeamHealthSorter, vgtSpeechBubble, vgtBubble, |
|
79 vgtSteam, vgtAmmo, vgtSmoke, vgtSmokeWhite, vgtHealth, vgtShell, |
|
80 vgtDust, vgtSplash, vgtDroplet, vgtSmokeRing, vgtBeeTrace, vgtEgg, |
|
81 vgtFeather, vgtHealthTag, vgtSmokeTrace, vgtEvilTrace, vgtExplosion, |
|
82 vgtBigExplosion, vgtChunk, vgtNote, vgtLineTrail, vgtBulletHit, vgtCircle); |
|
83 |
|
84 TGearsType = set of TGearType; |
|
85 |
|
86 TDamageSource = (dsUnknown, dsFall, dsBullet, dsExplosion, dsShove, dsPoison); |
|
87 |
|
88 TSound = (sndNone, |
|
89 sndGrenadeImpact, sndExplosion, sndThrowPowerUp, sndThrowRelease, |
|
90 sndSplash, sndShotgunReload, sndShotgunFire, sndGraveImpact, |
|
91 sndMineTick, sndPickhammer, sndGun, sndBee, sndJump1, sndJump2, |
|
92 sndJump3, sndYesSir, sndLaugh, sndIllGetYou, sndIncoming, |
|
93 sndMissed, sndStupid, sndFirstBlood, sndBoring, sndByeBye, |
|
94 sndSameTeam, sndNutter, sndReinforce, sndTraitor, sndRegret, |
|
95 sndEnemyDown, sndCoward, sndHurry, sndWatchIt, sndKamikaze, |
|
96 sndCake, sndOw1, sndOw2, sndOw3, sndOw4, sndFirePunch1, sndFirePunch2, |
|
97 sndFirePunch3, sndFirePunch4, sndFirePunch5, sndFirePunch6, |
|
98 sndMelon, sndHellish, sndYoohoo, sndRCPlane, sndWhipCrack, |
|
99 sndRideOfTheValkyries, sndDenied, sndPlaced, sndBaseballBat, |
|
100 sndVaporize, sndWarp, sndSuddenDeath, sndMortar, sndShutter, |
|
101 sndHomerun, sndMolotov, sndCover, sndUhOh, sndOops, |
|
102 sndNooo, sndHello, sndRopeShot, sndRopeAttach, sndRopeRelease, |
|
103 sndSwitchHog, sndVictory, sndSniperReload, sndSteps, sndLowGravity, |
|
104 sndHellishImpact1, sndHellishImpact2, sndHellishImpact3, sndHellishImpact4, |
|
105 sndMelonImpact, sndDroplet1, sndDroplet2, sndDroplet3, sndEggBreak, sndDrillRocket, |
|
106 sndPoisonCough, sndPoisonMoan, sndBirdyLay, sndWhistle, sndBeeWater, |
|
107 sndPiano0, sndPiano1, sndPiano2, sndPiano3, sndPiano4, sndPiano5, sndPiano6, sndPiano7, sndPiano8, |
|
108 sndSkip, sndSineGun, sndOoff1, sndOoff2, sndOoff3, sndWhack, |
|
109 sndComeonthen, sndParachute, sndBump, sndResurrector); |
|
110 |
|
111 TAmmoType = (amNothing, amGrenade, amClusterBomb, amBazooka, amBee, amShotgun, amPickHammer, // 6 |
|
112 amSkip, amRope, amMine, amDEagle, amDynamite, amFirePunch, amWhip, // 13 |
|
113 amBaseballBat, amParachute, amAirAttack, amMineStrike, amBlowTorch, // 18 |
|
114 amGirder, amTeleport, amSwitch, amMortar, amKamikaze, amCake, // 24 |
|
115 amSeduction, amWatermelon, amHellishBomb, amNapalm, amDrill, amBallgun, // 30 |
|
116 amRCPlane, amLowGravity, amExtraDamage, amInvulnerable, amExtraTime, // 35 |
|
117 amLaserSight, amVampiric, amSniperRifle, amJetpack, amMolotov, amBirdy, amPortalGun, // 42 |
|
118 amPiano, amGasBomb, amSineGun, amFlamethrower, amSMine, amHammer, // 48 |
|
119 amResurrector, amDrillStrike, amSnowball); |
|
120 |
|
121 TCrateType = (HealthCrate, AmmoCrate, UtilityCrate); |
|
122 |
|
123 THWFont = (fnt16, fntBig, fntSmall {$IFNDEF IPHONEOS}, CJKfnt16, CJKfntBig, CJKfntSmall{$ENDIF}); |
|
124 |
|
125 TCapGroup = (capgrpGameState, capgrpAmmoinfo, capgrpVolume, |
|
126 capgrpMessage, capgrpAmmostate); |
|
127 |
|
128 TStatInfoType = (siGameResult, siMaxStepDamage, siMaxStepKills, siKilledHHs, |
|
129 siClanHealth, siTeamStats, siPlayerKills, siMaxTeamDamage, |
|
130 siMaxTeamKills, siMaxTurnSkips ); |
|
131 |
|
132 TWave = (waveRollup, waveSad, waveWave, waveHurrah, waveLemonade, waveShrug, waveJuggle); |
|
133 |
|
134 TRenderMode = (rmDefault, rmLeftEye, rmRightEye); |
|
135 TStereoMode = (smNone, smRedCyan, smCyanRed, smRedBlue, smBlueRed, smRedGreen, smGreenRed, smHorizontal, smVertical, smAFR); |
|
136 |
|
137 THHFont = record |
|
138 Handle: PTTF_Font; |
|
139 Height: LongInt; |
|
140 style: LongInt; |
|
141 Name: string[21]; |
|
142 end; |
|
143 |
|
144 PAmmo = ^TAmmo; |
|
145 TAmmo = record |
|
146 Propz: LongWord; |
|
147 Count: LongWord; |
|
148 (* Using for place hedgehogs mode, but for any other situation where the initial count would be needed I guess. |
|
149 For example, say, a mode where the weaponset is reset each turn, or on sudden death *) |
|
150 NumPerTurn: LongWord; |
|
151 Timer: LongWord; |
|
152 Pos: LongWord; |
|
153 AmmoType: TAmmoType; |
|
154 AttackVoice: TSound; |
|
155 end; |
|
156 |
|
157 TVertex2f = record |
|
158 X, Y: GLfloat; |
|
159 end; |
|
160 |
|
161 TVertex2i = record |
|
162 X, Y: GLint; |
|
163 end; |
|
164 |
|
165 PTexture = ^TTexture; |
|
166 TTexture = record |
|
167 id: GLuint; |
|
168 w, h, scale: LongInt; |
|
169 rx, ry: GLfloat; |
|
170 priority: GLfloat; |
|
171 vb, tb: array [0..3] of TVertex2f; |
|
172 PrevTexture, NextTexture: PTexture; |
|
173 end; |
|
174 |
|
175 THogEffect = (heInvulnerable, heResurrectable, hePoisoned, heResurrected); |
|
176 |
|
177 TScreenFade = (sfNone, sfInit, sfToBlack, sfFromBlack, sfToWhite, sfFromWhite); |
|
178 |
|
179 PGear = ^TGear; |
|
180 PHedgehog = ^THedgehog; |
|
181 PTeam = ^TTeam; |
|
182 PClan = ^TClan; |
|
183 |
|
184 TGearStepProcedure = procedure (Gear: PGear); |
|
185 TGear = record |
|
186 NextGear, PrevGear: PGear; |
|
187 Active: Boolean; |
|
188 AdvBounce: Longword; |
|
189 Invulnerable: Boolean; |
|
190 RenderTimer: Boolean; |
|
191 AmmoType : TAmmoType; |
|
192 State : Longword; |
|
193 X : hwFloat; |
|
194 Y : hwFloat; |
|
195 dX: hwFloat; |
|
196 dY: hwFloat; |
|
197 Kind: TGearType; |
|
198 Pos: Longword; |
|
199 doStep: TGearStepProcedure; |
|
200 Radius: LongInt; |
|
201 Angle, Power : Longword; |
|
202 DirAngle: real; |
|
203 Timer : LongWord; |
|
204 Elasticity: hwFloat; |
|
205 Friction : hwFloat; |
|
206 Density : hwFloat; |
|
207 Message, MsgParam : Longword; |
|
208 Hedgehog: PHedgehog; |
|
209 Health, Damage, Karma: LongInt; |
|
210 CollisionIndex: LongInt; |
|
211 Tag: LongInt; |
|
212 Tex: PTexture; |
|
213 Z: Longword; |
|
214 IntersectGear: PGear; |
|
215 FlightTime: Longword; |
|
216 uid: Longword; |
|
217 ImpactSound: TSound; // first sound, others have to be after it in the sounds def. |
|
218 nImpactSounds: Word; // count of ImpactSounds |
|
219 SoundChannel: LongInt; |
|
220 PortalCounter: LongWord // Hopefully temporary, but avoids infinite portal loops in a guaranteed fashion. |
|
221 end; |
|
222 TPGearArray = Array of PGear; |
|
223 |
|
224 PVisualGear = ^TVisualGear; |
|
225 TVGearStepProcedure = procedure (Gear: PVisualGear; Steps: Longword); |
|
226 TVisualGear = record |
|
227 NextGear, PrevGear: PVisualGear; |
|
228 Frame, |
|
229 FrameTicks: Longword; |
|
230 X : real; |
|
231 Y : real; |
|
232 dX: real; |
|
233 dY: real; |
|
234 tdX: real; |
|
235 tdY: real; |
|
236 State : Longword; |
|
237 Timer: Longword; |
|
238 Angle, dAngle: real; |
|
239 Kind: TVisualGearType; |
|
240 doStep: TVGearStepProcedure; |
|
241 Tex: PTexture; |
|
242 alpha, scale: GLfloat; |
|
243 Hedgehog: PHedgehog; |
|
244 Text: shortstring; |
|
245 Tint: Longword; |
|
246 uid: Longword; |
|
247 end; |
|
248 |
|
249 TStatistics = record |
|
250 DamageRecv, |
|
251 DamageGiven: Longword; |
|
252 StepDamageRecv, |
|
253 StepDamageGiven, |
|
254 StepKills: Longword; |
|
255 MaxStepDamageRecv, |
|
256 MaxStepDamageGiven, |
|
257 MaxStepKills: Longword; |
|
258 FinishedTurns: Longword; |
|
259 end; |
|
260 |
|
261 TTeamStats = record |
|
262 Kills : Longword; |
|
263 AIKills : Longword; |
|
264 TeamKills : Longword; |
|
265 TurnSkips : Longword; |
|
266 TeamDamage : Longword; |
|
267 end; |
|
268 |
|
269 TBinds = array[0..cKeyMaxIndex] of shortstring; |
|
270 TKeyboardState = array[0..cKeyMaxIndex] of Byte; |
|
271 |
|
272 PVoicepack = ^TVoicepack; |
|
273 TVoicepack = record |
|
274 name: shortstring; |
|
275 chunks: array [TSound] of PMixChunk; |
|
276 end; |
|
277 |
|
278 PHHAmmo = ^THHAmmo; |
|
279 THHAmmo = array[0..cMaxSlotIndex, 0..cMaxSlotAmmoIndex] of TAmmo; |
|
280 |
|
281 THedgehog = record |
|
282 Name: string[MAXNAMELEN]; |
|
283 Gear: PGear; |
|
284 SpeechGear: PVisualGear; |
|
285 NameTagTex, |
|
286 HealthTagTex, |
|
287 HatTex: PTexture; |
|
288 Ammo: PHHAmmo; |
|
289 CurAmmoType: TAmmoType; |
|
290 AmmoStore: Longword; |
|
291 Team: PTeam; |
|
292 MultiShootAttacks: Longword; |
|
293 visStepPos: LongWord; |
|
294 BotLevel : Byte; // 0 - Human player |
|
295 HatVisibility: GLfloat; |
|
296 stats: TStatistics; |
|
297 Hat: shortstring; |
|
298 InitialHealth: LongInt; // used for gfResetHealth |
|
299 King: boolean; // Flag for a bunch of hedgehog attributes |
|
300 Unplaced: boolean; // Flag for hog placing mode |
|
301 Timer: Longword; |
|
302 Effects: Array[THogEffect] of boolean; |
|
303 end; |
|
304 |
|
305 TTeam = record |
|
306 Clan: PClan; |
|
307 TeamName: string[MAXNAMELEN]; |
|
308 ExtDriven: boolean; |
|
309 Binds: TBinds; |
|
310 Hedgehogs: array[0..cMaxHHIndex] of THedgehog; |
|
311 CurrHedgehog: LongWord; |
|
312 NameTagTex: PTexture; |
|
313 CrosshairTex, |
|
314 GraveTex, |
|
315 HealthTex, |
|
316 AIKillsTex, |
|
317 FlagTex: PTexture; |
|
318 Flag: shortstring; |
|
319 GraveName: shortstring; |
|
320 FortName: shortstring; |
|
321 TeamHealth: LongInt; |
|
322 TeamHealthBarWidth, |
|
323 NewTeamHealthBarWidth: LongInt; |
|
324 DrawHealthY: LongInt; |
|
325 AttackBar: LongWord; |
|
326 HedgehogsNumber: Longword; |
|
327 hasGone: boolean; |
|
328 voicepack: PVoicepack; |
|
329 PlayerHash: shortstring; // md5 hash of player name. For temporary enabling of hats as thank you. Hashed for privacy of players |
|
330 stats: TTeamStats; |
|
331 end; |
|
332 |
|
333 TClan = record |
|
334 Color: Longword; |
|
335 Teams: array[0..Pred(cMaxTeams)] of PTeam; |
|
336 TeamsNumber: Longword; |
|
337 CurrTeam: LongWord; |
|
338 ClanHealth: LongInt; |
|
339 ClanIndex: LongInt; |
|
340 TurnNumber: LongWord; |
|
341 end; |
|
342 |
|
343 TAmmoStrId = (sidGrenade, sidClusterBomb, sidBazooka, sidBee, sidShotgun, |
|
344 sidPickHammer, sidSkip, sidRope, sidMine, sidDEagle, |
|
345 sidDynamite, sidBaseballBat, sidFirePunch, sidSeconds, |
|
346 sidParachute, sidAirAttack, sidMineStrike, sidBlowTorch, |
|
347 sidGirder, sidTeleport, sidSwitch, sidMortar, sidWhip, |
|
348 sidKamikaze, sidCake, sidSeduction, sidWatermelon, |
|
349 sidHellishBomb, sidDrill, sidBallgun, sidNapalm, sidRCPlane, |
|
350 sidLowGravity, sidExtraDamage, sidInvulnerable, sidExtraTime, |
|
351 sidLaserSight, sidVampiric, sidSniperRifle, sidJetpack, |
|
352 sidMolotov, sidBirdy, sidPortalGun, sidPiano, sidGasBomb, sidSineGun, sidFlamethrower, |
|
353 sidSMine, sidHammer, sidResurrector, sidDrillStrike, sidSnowball, sidNothing); |
|
354 |
|
355 TMsgStrId = (sidStartFight, sidDraw, sidWinner, sidVolume, sidPaused, |
|
356 sidConfirm, sidSuddenDeath, sidRemaining, sidFuel, sidSync, |
|
357 sidNoEndTurn, sidNotYetAvailable, sidRoundSD, sidRoundsSD, sidReady); |
|
358 |
|
359 TEventId = (eidDied, eidDrowned, eidRoundStart, eidRoundWin, eidRoundDraw, |
|
360 eidNewHealthPack, eidNewAmmoPack, eidNewUtilityPack, eidTurnSkipped, eidHurtSelf, |
|
361 eidHomerun, eidGone); |
|
362 |
|
363 TGoalStrId = (gidCaption, gidSubCaption, gidForts, gidLowGravity, gidInvulnerable, |
|
364 gidVampiric, gidKarma, gidKing, gidPlaceHog, gidArtillery, |
|
365 gidSolidLand, gidSharedAmmo, gidMineTimer, gidNoMineTimer, gidRandomMineTimer, |
|
366 gidDamageModifier, gidResetHealth, gidAISurvival, gidInfAttack, gidResetWeps, gidPerHogAmmo); |
|
367 |
|
368 TLandArray = packed array of array of LongWord; |
|
369 TCollisionArray = packed array of array of Word; |
|
370 TPreview = packed array[0..127, 0..31] of byte; |
|
371 TDirtyTag = packed array of array of byte; |
|
372 |
|
373 |
|
374 implementation |
|
375 |
|
376 end. |