1 (* 2 * Hedgewars, a free turn based strategy game 3 * Copyright (c) 2004-2015 Andrey Korotaev <unC0Rr@gmail.com> 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; version 2 of the License 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with this program; if not, write to the Free Software 16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 *) 18 19 {$INCLUDE "options.inc"} 20 21 unit uTypes; 22 (* 23 * This unit defines various types and enumerations for usage in different 24 * places in the engine code. 25 *) 26 interface 27 28 uses SDLh, uFloat, GLunit, uConsts, Math; 29 30 // NOTE: typed const is a variable despite const qualifier 31 // in freepascal you may actually use var for the same purpose 32 33 type 34 HwColor4f = record 35 r, g, b, a: byte; 36 end; 37 38 // Possible states of the game 39 TGameState = (gsLandGen, gsStart, gsGame, gsConfirm, gsExit, gsSuspend); 40 41 // Game types that help determining what the engine is actually supposed to do 42 TGameType = (gmtLocal, gmtDemo, gmtNet, gmtSave, gmtLandPreview, gmtBadSyntax, gmtRecord, gmtSyntaxHelp); 43 44 // Different files are stored in different folders, this enumeration is used to tell which folder to use 45 TPathType = (ptNone, ptData, ptGraphics, ptThemes, ptCurrTheme, ptConfig, ptTeams, ptMaps, 46 ptMapCurrent, ptDemos, ptSounds, ptGraves, ptFonts, ptForts, ptLocale, 47 ptAmmoMenu, ptHedgehog, ptVoices, ptHats, ptFlags, ptMissionMaps, 48 ptSuddenDeath, ptButtons, ptShaders, ptDefaultVoice, ptMisc); 49 50 // Available sprites for displaying stuff 51 TSprite = (sprWater, sprCloud, sprBomb, sprBigDigit, sprBigDigitGray, sprBigDigitGreen, 52 sprBigDigitRed, sprFrame, sprLag, sprArrow, sprBazookaShell, sprTargetP, sprBee, 53 sprSmokeTrace, sprRopeHook, sprExplosion50, sprMineOff, 54 sprMineOn, sprMineDead, sprCase, sprFAid, sprDynamite, sprPower, 55 sprClusterBomb, sprClusterParticle, sprFlame, 56 sprHorizont, sprHorizontL, sprHorizontR, sprSky, sprSkyL, sprSkyR, 57 sprAMSlot, sprAMAmmos, sprAMAmmosBW, sprAMSlotKeys, sprAMCorners, 58 sprFinger, sprAirBomb, sprAirplane, sprAmAirplane, sprAmGirder, 59 sprHHTelepMask, sprSwitch, sprParachute, sprTarget, sprRopeNode, 60 sprQuestion, sprPowerBar, sprWindBar, sprWindL, sprWindR, 61 {$IFDEF USE_TOUCH_INTERFACE} 62 sprFireButton, sprArrowUp, sprArrowDown, sprArrowLeft, sprArrowRight, 63 sprJumpWidget, sprAMWidget, sprPauseButton, sprTimerButton, sprTargetButton, 64 sprSwitchButton, sprBounceButton, 65 {$ENDIF} 66 sprFlake, sprHandRope, sprHandBazooka, sprHandShotgun, 67 sprHandDEagle, sprHandAirAttack, sprHandBaseball, sprPHammer, 68 sprHandBlowTorch, sprBlowTorch, sprTeleport, sprHHDeath, 69 sprShotgun, sprDEagle, sprHHIdle, sprMortar, sprTurnsLeft, 70 sprKamikaze, sprWhip, sprKowtow, sprSad, sprWave, 71 sprHurrah, sprLemonade, sprShrug, sprJuggle, sprExplPart, sprExplPart2, 72 sprCakeWalk, sprCakeDown, sprWatermelon, 73 sprEvilTrace, sprHellishBomb, sprSeduction, sprDress, 74 sprCensored, sprDrill, sprHandDrill, sprHandBallgun, sprBalls, 75 sprPlane, sprHandPlane, sprUtility, sprInvulnerable, sprVampiric, sprGirder, 76 sprSpeechCorner, sprSpeechEdge, sprSpeechTail, 77 sprThoughtCorner, sprThoughtEdge, sprThoughtTail, 78 sprShoutCorner, sprShoutEdge, sprShoutTail, 79 sprSniperRifle, sprBubbles, sprJetpack, sprHealth, sprHandMolotov, sprMolotov, 80 sprSmoke, sprSmokeWhite, sprShell, sprDust, sprSnowDust, sprExplosives, sprExplosivesRoll, 81 sprAmTeleport, sprSplash, sprDroplet, sprBirdy, sprHandCake, sprHandConstruction, 82 sprHandGrenade, sprHandMelon, sprHandMortar, sprHandSkip, sprHandCluster, 83 sprHandDynamite, sprHandHellish, sprHandMine, sprHandSeduction, sprHandVamp, 84 sprBigExplosion, sprSmokeRing, sprBeeTrace, sprEgg, sprTargetBee, sprHandBee, 85 sprFeather, sprPiano, sprHandSineGun, sprPortalGun, sprPortal, 86 sprCheese, sprHandCheese, sprHandFlamethrower, sprChunk, sprNote, 87 sprSMineOff, sprSMineOn, sprHandSMine, sprHammer, 88 sprHandResurrector, sprCross, sprAirDrill, sprNapalmBomb, 89 sprBulletHit, sprSnowball, sprHandSnowball, sprSnow, 90 sprSDFlake, sprSDWater, sprSDCloud, sprSDSplash, sprSDDroplet, sprTardis, 91 sprSlider, sprBotlevels, sprHandKnife, sprKnife, sprStar, sprIceTexture, sprIceGun, 92 sprFrozenHog, sprAmRubber, sprBoing, sprCustom1, sprCustom2, sprCustom3, sprCustom4, 93 sprCustom5, sprCustom6, sprCustom7, sprCustom8, sprFrozenAirMine, sprAirMine, sprHandAirMine, 94 sprFlakeL, sprSDFlakeL, sprCloudL, sprSDCloudL, sprCreeper, sprHandCreeper, sprMinigun, 95 sprSliderInverted, sprFingerBack, sprFingerBackInv, sprTargetPBack, sprTargetPBackInv, 96 sprHealthHud, sprHealthPoisonHud, sprVampHud, sprKarmaHud, sprMedicHud, sprMedicPoisonHud, 97 sprHaloHud, sprInvulnHUD, sprAmPiano, sprHandLandGun, sprFirePunch, sprThroughWrap 98 ); 99 100 // Gears that interact with other Gears and/or Land 101 // first row of gears (<gtExplosives) should be avoided when searching a spawn place 102 TGearType = (gtFlame, gtHedgehog, gtMine, gtCase, gtAirMine, gtExplosives, 103 gtGrenade, gtShell, gtGrave, gtBee, // 9 104 gtShotgunShot, gtPickHammer, gtRope, // 12 105 gtDEagleShot, gtDynamite, gtClusterBomb, gtCluster, gtShover, // 17 106 gtFirePunch, gtATStartGame, // 19 107 gtATFinishGame, gtParachute, gtAirAttack, gtAirBomb, gtBlowTorch, // 24 108 gtGirder, gtTeleport, gtSwitcher, gtTarget, gtMortar, // 29 109 gtWhip, gtKamikaze, gtCake, gtSeduction, gtWatermelon, gtMelonPiece, // 35 110 gtHellishBomb, gtWaterUp, gtDrill, gtBallGun, gtBall, gtRCPlane, // 41 111 gtSniperRifleShot, gtJetpack, gtMolotov, gtBirdy, // 45 112 gtEgg, gtPortal, gtPiano, gtGasBomb, gtSineGunShot, gtFlamethrower, // 51 113 gtSMine, gtPoisonCloud, gtHammer, gtHammerHit, gtResurrector, // 56 114 gtNapalmBomb, gtSnowball, gtFlake, gtLandGun, gtTardis, // 61 115 gtIceGun, gtAddAmmo, gtGenericFaller, gtKnife, gtCreeper, gtMinigun, gtMinigunBullet); // 68 116 117 // Gears that are _only_ of visual nature (e.g. background stuff, visual effects, speechbubbles, etc.) 118 TVisualGearType = (vgtFlake, vgtCloud, vgtExplPart, vgtExplPart2, vgtFire, 119 vgtSmallDamageTag, vgtTeamHealthSorter, vgtSpeechBubble, vgtBubble, 120 vgtSteam, vgtAmmo, vgtSmoke, vgtSmokeWhite, vgtShell, 121 vgtDust, vgtSplash, vgtDroplet, vgtSmokeRing, vgtBeeTrace, vgtEgg, 122 vgtFeather, vgtHealthTag, vgtSmokeTrace, vgtEvilTrace, vgtExplosion, 123 vgtBigExplosion, vgtChunk, vgtNote, vgtLineTrail, vgtBulletHit, vgtCircle, 124 vgtSmoothWindBar, vgtStraightShot, vgtNoPlaceWarn); 125 126 // Damage can be caused by different sources 127 TDamageSource = (dsUnknown, dsFall, dsBullet, dsExplosion, dsShove, dsPoison, dsHammer); 128 129 // Available sounds 130 TSound = (sndNone, 131 sndGrenadeImpact, sndExplosion, sndThrowPowerUp, sndThrowRelease, 132 sndSplash, sndShotgunReload, sndShotgunFire, sndGraveImpact, 133 sndMineImpact, sndMineTick, sndMudballImpact, 134 sndPickhammer, sndGun, sndBee, sndJump1, sndJump2, 135 sndJump3, sndYesSir, sndLaugh, sndIllGetYou, sndJustYouWait, sndIncoming, 136 sndMissed, sndStupid, sndFirstBlood, sndBoring, sndByeBye, 137 sndSameTeam, sndNutter, sndReinforce, sndTraitor, sndRegret, 138 sndEnemyDown, sndCoward, sndHurry, sndWatchIt, sndKamikaze, 139 sndCake, sndOw1, sndOw2, sndOw3, sndOw4, sndFirePunch1, sndFirePunch2, 140 sndFirePunch3, sndFirePunch4, sndFirePunch5, sndFirePunch6, 141 sndMelon, sndHellish, sndYoohoo, sndRCPlane, sndWhipCrack, 142 sndRideOfTheValkyries, sndDenied, sndPlaced, sndBaseballBat, 143 sndVaporize, sndWarp, sndSuddenDeath, sndMortar, sndShutter, 144 sndHomerun, sndMolotov, sndCover, sndUhOh, sndOops, 145 sndNooo, sndHello, sndRopeShot, sndRopeAttach, sndRopeRelease, 146 sndSwitchHog, sndVictory, sndFlawless, sndSniperReload, sndSteps, sndLowGravity, 147 sndHellishImpact1, sndHellishImpact2, sndHellishImpact3, sndHellishImpact4, 148 sndMelonImpact, sndDroplet1, sndDroplet2, sndDroplet3, sndEggBreak, sndDrillRocket, 149 sndPoisonCough, sndPoisonMoan, sndBirdyLay, sndWhistle, sndBeeWater, 150 sndPiano0, sndPiano1, sndPiano2, sndPiano3, sndPiano4, sndPiano5, sndPiano6, sndPiano7, 151 sndPiano8, sndSkip, sndSineGun, sndOoff1, sndOoff2, sndOoff3, sndWhack, 152 sndComeonthen, sndParachute, sndBump, sndResurrector, sndPlane, sndTardis, sndFrozenHogImpact, 153 sndIceBeam, sndHogFreeze, sndAirMineImpact, sndKnifeImpact, sndExtraTime, sndLaserSight, 154 sndInvulnerable, sndJetpackLaunch, sndJetpackBoost, sndPortalShot, sndPortalSwitch, 155 sndPortalOpen, sndBlowTorch, sndCountdown1, sndCountdown2, sndCountdown3, sndCountdown4, 156 sndCreeperDrop, sndCreeperWater, sndCreeperDie, sndCustom1, sndCustom2, sndCustom3, sndCustom4, 157 sndCustom5, sndCustom6, sndCustom7, sndCustom8, sndMinigun, sndFlamethrower, sndIceBeamIdle, 158 sndLandGun, sndCaseImpact, sndExtraDamage, sndFirePunchHit, sndGrenade, sndThisOneIsMine, 159 sndWhatThe, sndSoLong, sndOhDear, sndGonnaGetYou, sndDrat, sndBugger, sndAmazing, 160 sndBrilliant, sndExcellent, sndFire, sndWatchThis, sndRunAway, sndRevenge, sndCutItOut, 161 sndLeaveMeAlone, sndOuch, sndHmm, sndKiss, sndFlyAway, sndPlaneWater); 162 163 // Available ammo types to be used by hedgehogs 164 TAmmoType = (amNothing, amGrenade, amClusterBomb, amBazooka, amBee, amShotgun, amPickHammer, // 6 165 amSkip, amRope, amMine, amDEagle, amDynamite, amFirePunch, amWhip, // 13 166 amBaseballBat, amParachute, amAirAttack, amMineStrike, amBlowTorch, // 18 167 amGirder, amTeleport, amSwitch, amMortar, amKamikaze, amCake, // 24 168 amSeduction, amWatermelon, amHellishBomb, amNapalm, amDrill, amBallgun, // 30 169 amRCPlane, amLowGravity, amExtraDamage, amInvulnerable, amExtraTime, // 35 170 amLaserSight, amVampiric, amSniperRifle, amJetpack, amMolotov, amBirdy, amPortalGun, // 42 171 amPiano, amGasBomb, amSineGun, amFlamethrower, amSMine, amHammer, // 48 172 amResurrector, amDrillStrike, amSnowball, amTardis, amLandGun, // 53 173 amIceGun, amKnife, amRubber, amAirMine, amCreeper, amMinigun); // 59 174 // NOTE: If we ever reach 126 ammo types, make sure to skip ammo type number 126 because it's 175 // reserved as synonym for amNothing. See also chSetWeapon. 176 177 // Different kind of crates that e.g. hedgehogs can pick up 178 TCrateType = (HealthCrate, AmmoCrate, UtilityCrate); 179 180 THWFont = (fnt16, fntBig, fntSmall {$IFNDEF MOBILE}, CJKfnt16, CJKfntBig, CJKfntSmall{$ENDIF}); 181 182 TCapGroup = (capgrpGameState, capgrpAmmoinfo, capgrpVolume, 183 capgrpMessage, capgrpMessage2, capgrpAmmostate); 184 185 TStatInfoType = (siGameResult, siMaxStepDamage, siMaxStepKills, siKilledHHs, 186 siClanHealth, siTeamStats, siPlayerKills, siMaxTeamDamage, 187 siMaxTeamKills, siMaxTurnSkips, siCustomAchievement, siGraphTitle, 188 siPointType, siTeamRank, siEverAfter); 189 190 // Various 'emote' animations a hedgehog can do 191 TWave = (waveRollup, waveSad, waveWave, waveHurrah, waveLemonade, waveShrug, waveJuggle); 192 193 TRenderMode = (rmDefault, rmLeftEye, rmRightEye); 194 TStereoMode = (smNone, smRedCyan, smCyanRed, smRedBlue, smBlueRed, smRedGreen, smGreenRed, smHorizontal, smVertical); 195 TWorldEdge = (weNone, weWrap, weBounce, weSea, weSky); 196 TUIDisplay = (uiAll, uiNoTeams, uiNone); 197 TMapGen = (mgRandom, mgMaze, mgPerlin, mgDrawn, mgForts); 198 199 200 THHFont = record 201 Handle: PTTF_Font; 202 Height: LongInt; 203 style: LongInt; 204 Name: string[31]; 205 end; 206 207 PAmmo = ^TAmmo; 208 TAmmo = record 209 Propz: LongWord; 210 Count: LongWord; 211 // Using for place hedgehogs mode, but for any other situation where the initial count would be needed I guess. 212 // For example, say, a mode where the weaponset is reset each turn, or on sudden death 213 NumPerTurn: LongWord; 214 Timer: LongWord; 215 Pos: LongWord; 216 AmmoType: TAmmoType; 217 AttackVoice: TSound; 218 Bounciness: LongWord; 219 end; 220 221 TVertex2f = record 222 X, Y: GLfloat; 223 end; 224 225 TVertex2i = record 226 X, Y: GLint; 227 end; 228 229 TMatrix4x4f = array[0..3, 0..3] of GLfloat; 230 231 PTexture = ^TTexture; 232 TTexture = record 233 id: GLuint; 234 w, h, scale: LongInt; 235 rx, ry: GLfloat; 236 priority: GLfloat; 237 vb, tb: array [0..3] of TVertex2f; 238 PrevTexture, NextTexture: PTexture; 239 end; 240 241 THogEffect = (heInvulnerable, heResurrectable, hePoisoned, heResurrected, heFrozen, heArtillery); 242 243 TScreenFade = (sfNone, sfInit, sfToBlack, sfFromBlack, sfToWhite, sfFromWhite); 244 245 PGear = ^TGear; 246 PHedgehog = ^THedgehog; 247 PTeam = ^TTeam; 248 PClan = ^TClan; 249 250 TGearStepProcedure = procedure (Gear: PGear); 251 // So, you are here looking for variables you can (ab)use to store some gear state? 252 // Not all members of this structure are created equal. Comments below are my take on what can be used for what in the gear structure. 253 TGear = record 254 // Do *not* ever override these. 255 NextGear, PrevGear: PGear; // Linked list 256 Z: Longword; // Z index. For rendering. Sets order in list 257 Active: Boolean; // Is gear Active (running step code) 258 Kind: TGearType; 259 doStep: TGearStepProcedure; // Code the gear is running 260 AmmoType : TAmmoType; // Ammo type associated with this kind of gear 261 RenderTimer: Boolean; // Will visually display Timer if true 262 RenderHealth: Boolean; // Will visually display Health if true 263 Target : TPoint; // Gear target. Will render in uGearsRender unless a special case is added 264 AIHints: LongWord; // hints for ai. 265 LastDamage: PHedgehog; // Used to track damage source for stats 266 CollisionIndex: LongInt; // Position in collision array 267 Message: LongWord; // Game messages are stored here. See gm bitmasks in uConsts 268 uid: Longword; // Lua use this to reference gears 269 Hedgehog: PHedgehog; // set to CurrentHedgehog on gear creation. uStats damage code appears to assume it will never be nil and never be changed. If you override it, make sure it is set to a non-nil PHedgehog before dealing damage. 270 // Strongly recommended not to override these. Will mess up generic operations like portaling 271 X : hwFloat; // X/Y/dX/dY are position/velocity. People count on these having semi-normal values 272 Y : hwFloat; 273 dX: hwFloat; 274 dY: hwFloat; 275 State : Longword; // See gst bitmask values in uConsts 276 PortalCounter: LongWord; // Necessary to interrupt portal loops. Not possible to avoid infinite loops without it. 277 // Don't use these if you're using generic movement like doStepFallingGear and explosion shoves. Generally recommended not to use. 278 Radius: LongInt; // Radius. If not using uCollisions, is usually used to indicate area of effect 279 CollisionMask: Word; // Masking off Land impact FF7F for example ignores current hog and crates 280 AdvBounce: Longword; // Triggers 45 bounces. Is a counter to avoid edge cases 281 Sticky: Boolean; // True if gear is *normally* able to stick to landscape on impact 282 Elasticity: hwFloat; 283 Friction : hwFloat; 284 Density : hwFloat; // Density is kind of a mix of size and density. Impacts distance thrown, wind. 285 ImpactSound: TSound; // first sound, others have to be after it in the sounds def. 286 nImpactSounds: Word; // count of ImpactSounds. 287 // Don't use these if you want to take damage normally, otherwise health/damage are commonly used for other purposes 288 Health, Damage, Karma: LongInt; 289 // DirAngle is a 'real' - if you do not need it for rotation of sprite in uGearsRender, you can use it for any visual-only value 290 DirAngle: real; 291 // These are frequently overridden to serve some other purpose 292 Boom: Longword; // amount of damage caused by the gear 293 Pos: Longword; // Commonly overridden. Example use is posCase values in uConsts. 294 Angle, Power : Longword; // Used for hog aiming/firing. Angle is rarely used as an Angle otherwise. 295 Timer, WDTimer : LongWord; // Typically used for some sort of gear timer. Time to explosion, remaining fuel... 296 Tag: LongInt; // Quite generic. Variety of uses. 297 FlightTime: Longword; // Initially added for batting of hogs to determine homerun. Used for some firing delays 298 MsgParam: LongWord; // Initially stored a set of messages. So usually gm values like Message. Frequently overriden 299 // These are not used generically, but should probably be used for purpose intended. Definitely shouldn't override pointer type 300 Tex: PTexture; // A texture created by the gear. Shouldn't use for anything but textures 301 Tint: LongWord; // Used to colour a texture 302 LinkedGear: PGear; // Used to track a related gear. Portal pairs for example. 303 SoundChannel: LongInt; // Used to track a sound the gear started 304 Data: Pointer; // pointer to gear type specific data structure (if any) 305 end; 306 TPGearArray = array of PGear; 307 PGearArrayS = record 308 size: LongWord; 309 ar: ^TPGearArray; 310 end; 311 312 PVisualGear = ^TVisualGear; 313 TVGearStepProcedure = procedure (Gear: PVisualGear; Steps: Longword); 314 TVisualGear = record 315 NextGear, PrevGear: PVisualGear; 316 Frame, 317 FrameTicks: Longword; 318 X : real; 319 Y : real; 320 dX: real; 321 dY: real; 322 tdX: real; 323 tdY: real; 324 State : Longword; 325 Timer: Longword; 326 Angle, dAngle: real; 327 Kind: TVisualGearType; 328 doStep: TVGearStepProcedure; 329 Tex: PTexture; 330 alpha, scale: GLfloat; 331 Hedgehog: PHedgehog; 332 Tag: LongInt; 333 Text: shortstring; 334 Tint: Longword; 335 uid: Longword; 336 Layer: byte; 337 end; 338 339 TStatistics = record 340 DamageRecv, // total damage received 341 DamageGiven: Longword; // total damage dealt 342 StepDamageRecvInRow, // number of enemy turns in row this hog received any damage 343 StepDamageRecv, // damage received in this turn 344 StepDamageGiven, // damage dealt in this turn 345 StepKills: Longword; // kills in this turn 346 StepPoisoned, // whether hog got poisoned this turn 347 StepDied, // whether hog died this turn 348 Sacrificed, // whether hog was sacrificed in suicide attack (kamikaze, piano) 349 GotRevenge: boolean; // whether hog got revenge in this turn 350 StepRevenge: boolean; // whether hog's revenge mode was activated in this turn 351 MaxStepDamageRecv, // most damage received in one turn 352 MaxStepDamageGiven, // most damage dealt in one turn 353 MaxStepKills: Longword; // most kills in one turn 354 FinishedTurns: Longword; 355 end; 356 357 TTeamStats = record 358 Kills : Longword; 359 Suicides: Longword; 360 AIKills : Longword; 361 TeamKills : Longword; 362 TurnSkips : Longword; 363 TeamDamage : Longword; 364 end; 365 366 PClanDeathLogEntry = ^TClanDeathLogEntry; 367 368 TClanDeathLogEntry = record 369 Turn : Longword; // turn in which the clans were killed 370 KilledClans : array[0..Pred(cMaxTeams)] of PClan; // array of clans that have died 371 KilledClansCount: Longword; // number of clans that died 372 NextEntry : PClanDeathLogEntry; // linked list 373 end; 374 375 376 TBinds = record 377 indices: array[0..cKbdMaxIndex] of byte; 378 // zeroth element is reserved, indices[i] == 0 means no binding 379 binds: array[0..255] of shortstring; 380 lastIndex: byte; 381 end; 382 383 TKeyboardState = array[0..cKeyMaxIndex] of Byte; 384 385 PVoicepack = ^TVoicepack; 386 TVoicepack = record 387 name: shortstring; 388 chunks: array [TSound] of PMixChunk; 389 end; 390 391 TVoice = record 392 snd: TSound; 393 voicepack: PVoicePack; 394 isFallback: boolean; 395 end; 396 397 THHAmmo = array[0..cMaxSlotIndex, 0..cMaxSlotAmmoIndex] of TAmmo; 398 PHHAmmo = ^THHAmmo; 399 400 THedgehog = record 401 Name: shortstring; 402 Gear: PGear; 403 GearHidden: PGear; 404 SpeechGear: PVisualGear; 405 NameTagTex, 406 HealthTagTex, 407 HatTex: PTexture; 408 Ammo: PHHAmmo; 409 CurAmmoType: TAmmoType; 410 PickUpType: LongWord; 411 PickUpDelay: LongInt; 412 AmmoStore: Longword; 413 Team: PTeam; 414 MultiShootAttacks: Longword; 415 visStepPos: LongWord; 416 BotLevel : Byte; // 0 - Human player 417 HatVisibility: GLfloat; 418 stats: TStatistics; 419 Hat: shortstring; 420 InitialHealth: LongInt; // used for gfResetHealth 421 King: boolean; // Flag for a bunch of hedgehog attributes 422 Unplaced: boolean; // Flag for hog placing mode 423 UnplacedKing: boolean; // Flag for king placing phase in King Mode 424 Timer: Longword; 425 HealthBarHealth: LongInt; 426 Effects: array[THogEffect] of LongInt; 427 RevengeHog: PHedgehog; // For which hog this hog wants revenge most. For sndRevenge taunt 428 FlownOffMap: boolean; // When hedgehog has flown far away off the map left or right 429 end; 430 431 TTeam = record 432 Clan: PClan; 433 TeamName: shortstring; 434 ExtDriven: boolean; 435 Binds: TBinds; 436 Hedgehogs: array[0..cMaxHHIndex] of THedgehog; 437 CurrHedgehog: LongWord; 438 NameTagTex, 439 OwnerTex, 440 GraveTex, 441 AIKillsTex, 442 LuaTeamValueTex, 443 FlagTex: PTexture; 444 Flag: shortstring; 445 GraveName: shortstring; 446 FortName: shortstring; 447 Owner: shortstring; 448 TeamHealth: LongInt; 449 TeamHealthBarHealth: LongInt; 450 DrawHealthY: LongInt; 451 AttackBar: LongWord; 452 HedgehogsNumber: Longword; 453 voicepack: PVoicepack; 454 PlayerHash: shortstring; // md5 hash of player name. For temporary enabling of hats as thank you. Hashed for privacy of players 455 stats: TTeamStats; 456 Passive: boolean; // if true, team will not participate in game. It is treated as if all its hedgehogs are frozen. 457 // updating this value requires updating Passive in TClan as well! 458 hasKing: boolean; // true if team has a living king 459 hasGone: boolean; 460 skippedTurns: Longword; 461 isGoneFlagPendingToBeSet, isGoneFlagPendingToBeUnset: boolean; 462 luaTeamValue: ansistring; 463 hasLuaTeamValue: boolean; 464 end; 465 466 TClan = record 467 Color: Longword; 468 Teams: array[0..Pred(cMaxTeams)] of PTeam; 469 HealthTex: PTexture; 470 TeamsNumber: Longword; 471 TagTeamIndex: Longword; 472 CurrTeam: LongWord; 473 ClanHealth: LongInt; 474 ClanIndex: LongInt; 475 TurnNumber: LongWord; 476 DeathLogged: boolean; // true if clan is dead and its latest death has been logged in the clan death log 477 StatsHandled : boolean; // true if clan's rank has been handled for stats screen 478 Flawless: boolean; 479 Passive: boolean; // informational. Must be set to true if all of the teams are passive 480 LocalOrAlly: boolean; // true if at least 1 team in the clan is a local team. A local team is a non-extdriven team controlled by a human 481 end; 482 483 cdeclPtr = procedure; cdecl; 484 cdeclIntPtr = procedure(num: LongInt); cdecl; Doublenull485 funcDoublePtr = function: Double; 486 487 TMobileRecord = record 488 PerformRumble: cdeclIntPtr; 489 GameLoading: cdeclPtr; 490 GameLoaded: cdeclPtr; 491 SaveLoadingEnded: cdeclPtr; 492 end; 493 494 TAmmoStrId = (sidGrenade, sidClusterBomb, sidBazooka, sidBee, sidShotgun, 495 sidPickHammer, sidSkip, sidRope, sidMine, sidDEagle, 496 sidDynamite, sidBaseballBat, sidFirePunch, sidSeconds, 497 sidParachute, sidAirAttack, sidMineStrike, sidBlowTorch, 498 sidGirder, sidTeleport, sidSwitch, sidMortar, sidWhip, 499 sidKamikaze, sidCake, sidSeduction, sidWatermelon, 500 sidHellishBomb, sidDrill, sidBallgun, sidNapalm, sidRCPlane, 501 sidLowGravity, sidExtraDamage, sidInvulnerable, sidExtraTime, 502 sidLaserSight, sidVampiric, sidSniperRifle, sidJetpack, 503 sidMolotov, sidBirdy, sidPortalGun, sidPiano, sidGasBomb, 504 sidSineGun, sidFlamethrower,sidSMine, sidHammer, sidResurrector, 505 sidDrillStrike, sidSnowball, sidNothing, sidTardis, 506 sidLandGun, sidIceGun, sidKnife, sidRubber, sidAirMine, 507 sidCreeper, sidMinigun); 508 509 TMsgStrId = (sidLoading, sidDraw, sidWinner, sidVolume, sidPaused, 510 sidConfirm, sidSuddenDeath, sidRemaining, sidFuel, sidSync, 511 sidNoEndTurn, sidNotYetAvailable, sidRoundSD, sidRoundsSD, sidReady, 512 sidBounce1, sidBounce2, sidBounce3, sidBounce4, sidBounce5, sidBounce, 513 sidMute, sidAFK, sidAutoCameraOff, sidAutoCameraOn, sidPressTarget, 514 sidNotAvailableInSD, sidHealthGain, sidEmptyCrate, sidUnknownKey, 515 sidWinner2, sidWinner3, sidWinner4, sidWinner5, sidWinner6, 516 sidWinner7, sidWinnerAll, sidTeamGone, sidTeamBack, sidAutoSkip, 517 sidFPS, sidLuaParsingOff, sidLuaParsingOn, sidLuaParsingDenied, 518 sidAmmoCount, sidChat, sidChatTeam, sidChatHog, sidUnknownGearValue); 519 520 TCmdHelpStrId = ( 521 sidCmdHeaderBasic, sidCmdTogglechat, sidCmdTeam, sidCmdMe, 522 sidCmdPause, sidCmdPauseNet, sidCmdFullscreen, sidCmdQuit, 523 sidCmdHelp, sidCmdHelpTaunts, sidCmdHistory, sidLua, 524 525 sidCmdHeaderTaunts, sidCmdSpeech, sidCmdThink, sidCmdYell, 526 sidCmdSpeechNumberHint, sidCmdHsa, sidCmdHta, sidCmdHya, 527 sidCmdHurrah, sidCmdIlovelotsoflemonade, sidCmdJuggle, 528 sidCmdRollup, sidCmdShrug, sidCmdWave, sidCmdUnknown, 529 sidCmdHelpRoom, sidCmdHelpRoomFail); 530 531 // Events that are important for the course of the game or at least interesting for other reasons 532 TEventId = (eidDied, eidDrowned, eidRoundStart, eidRoundWin, eidRoundDraw, 533 eidNewHealthPack, eidNewAmmoPack, eidNewUtilityPack, eidTurnSkipped, 534 eidHurtSelf, eidHomerun, eidGone, eidPoisoned, eidResurrected, 535 eidKamikaze, eidTimeTravelEnd, eidTimeout, eidKingDied); 536 537 TGoalStrId = (gidCaption, gidSubCaption, gidPlaceKing, gidLowGravity, gidInvulnerable, 538 gidVampiric, gidKarma, gidKing, gidPlaceHog, gidArtillery, 539 gidSolidLand, gidSharedAmmo, gidMineTimer, gidNoMineTimer, 540 gidRandomMineTimer, gidDamageModifier, gidResetHealth, gidAISurvival, 541 gidInfAttack, gidResetWeps, gidPerHogAmmo, gidTagTeam, gidMoreWind); 542 543 544 TLandArray = packed array of array of LongWord; 545 TCollisionArray = packed array of array of Word; 546 TDirtyTag = packed array of array of byte; 547 548 TPreview = packed array[0..127, 0..31] of byte; 549 TPreviewAlpha = packed array[0..127, 0..255] of byte; 550 551 PWidgetMovement = ^TWidgetMovement; 552 TWidgetMovement = record 553 animate : Boolean; 554 source : TPoint; 555 target : TPoint; 556 startTime : Longword; 557 end; 558 559 POnScreenWidget = ^TOnScreenWidget; 560 TOnScreenWidget = record 561 show : boolean; // if false widget will not be drawn 562 sprite : TSprite; // a convenience type 563 frame : TSDL_Rect; // graphical coordinates 564 active : TSDL_Rect; // active touch region 565 fadeAnimStart : Longword; // time the fade started 566 // (0 means do not fade) 567 moveAnim : TWidgetMovement; // animation associated to widget 568 end; 569 570 PTouch_Data = ^TTouch_Data; 571 TTouch_Data = record 572 id : TSDL_FingerId; 573 x,y : LongInt; 574 dx,dy : LongInt; 575 historicalX, historicalY : LongInt; 576 timeSinceDown : Longword; 577 pressedWidget : POnScreenWidget; 578 end; 579 580 PSpriteData = ^TSpriteData; 581 TSpriteData = record 582 FileName: string[15]; 583 Path, AltPath: TPathType; 584 Texture: PTexture; 585 Surface: PSDL_Surface; 586 Width, Height, imageWidth, imageHeight: LongInt; 587 saveSurf: boolean; 588 critical: boolean; 589 checkSum: boolean; // use for images where if they are missing a desync can occur. 590 priority: GLfloat; 591 getDimensions, getImageDimensions: boolean; 592 end; 593 594 // gear data types 595 596 const cakeh = 27; 597 598 type TCakeData = record 599 CakeI: integer; 600 CakePoints: array[0..Pred(cakeh)] of record 601 x, y: hwFloat; 602 end; 603 end; 604 605 PCakeData = ^TCakeData; 606 607 TClansArray = array[0..Pred(cMaxTeams)] of PClan; 608 609 implementation 610 611 end. 612