hedgewars/uTypes.pas
author unC0Rr
Wed, 15 May 2024 10:05:13 +0200
changeset 16042 2e529b1a9d5b
parent 15687 63e2b7b2ec47
child 15908 014f4edd0421
child 15929 128ace913837
child 16049 9be943326d9c
permissions -rw-r--r--
Wonder if anyone is trying to build this game anymore

(*
 * Hedgewars, a free turn based strategy game
 * Copyright (c) 2004-2015 Andrey Korotaev <unC0Rr@gmail.com>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; version 2 of the License
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 *)

{$INCLUDE "options.inc"}

unit uTypes;
(*
 * This unit defines various types and enumerations for usage in different
 * places in the engine code.
 *)
interface

uses SDLh, uFloat, GLunit, uConsts, Math;

// NOTE: typed const is a variable despite const qualifier
// in freepascal you may actually use var for the same purpose

type
    HwColor4f = record
        r, g, b, a: byte;
        end;

    // Possible states of the game
    TGameState = (gsLandGen, gsStart, gsGame, gsConfirm, gsExit, gsSuspend);

    // Game types that help determining what the engine is actually supposed to do
    TGameType = (gmtLocal, gmtDemo, gmtNet, gmtSave, gmtLandPreview, gmtBadSyntax, gmtRecord, gmtSyntaxHelp);

    // Different files are stored in different folders, this enumeration is used to tell which folder to use
    TPathType = (ptNone, ptData, ptGraphics, ptThemes, ptCurrTheme, ptConfig, ptTeams, ptMaps,
            ptMapCurrent, ptDemos, ptSounds, ptGraves, ptFonts, ptForts, ptLocale,
            ptAmmoMenu, ptHedgehog, ptVoices, ptHats, ptFlags, ptMissionMaps,
            ptSuddenDeath, ptButtons, ptShaders, ptDefaultVoice, ptMisc);

    // Available sprites for displaying stuff
    TSprite = (sprWater, sprCloud, sprBomb, sprBigDigit, sprBigDigitGray, sprBigDigitGreen,
            sprBigDigitRed, sprFrame, sprLag, sprArrow, sprBazookaShell, sprTargetP, sprBee,
            sprSmokeTrace, sprRopeHook, sprExplosion50, sprMineOff,
            sprMineOn, sprMineDead, sprCase, sprFAid, sprDynamite, sprPower,
            sprClusterBomb, sprClusterParticle, sprFlame,
            sprHorizont, sprHorizontL, sprHorizontR, sprSky, sprSkyL, sprSkyR,
            sprAMSlot, sprAMAmmos, sprAMAmmosBW, sprAMSlotKeys, sprAMCorners,
            sprFinger, sprAirBomb, sprAirplane, sprAmAirplane, sprAmGirder,
            sprHHTelepMask, sprSwitch, sprParachute, sprTarget, sprRopeNode,
            sprQuestion, sprPowerBar, sprWindBar, sprWindL, sprWindR,
{$IFDEF USE_TOUCH_INTERFACE}
            sprFireButton, sprArrowUp, sprArrowDown, sprArrowLeft, sprArrowRight,
            sprJumpWidget, sprAMWidget, sprPauseButton, sprTimerButton, sprTargetButton,
            sprSwitchButton, sprBounceButton,
{$ENDIF}
            sprFlake, sprHandRope, sprHandBazooka, sprHandShotgun,
            sprHandDEagle, sprHandAirAttack, sprHandBaseball, sprPHammer,
            sprHandBlowTorch, sprBlowTorch, sprTeleport, sprHHDeath,
            sprShotgun, sprDEagle, sprHHIdle, sprMortar, sprTurnsLeft,
            sprKamikaze, sprWhip, sprKowtow, sprSad, sprWave,
            sprHurrah, sprLemonade, sprShrug, sprJuggle, sprExplPart, sprExplPart2,
            sprCakeWalk, sprCakeDown, sprWatermelon,
            sprEvilTrace, sprHellishBomb, sprSeduction, sprDress,
            sprCensored, sprDrill, sprHandDrill, sprHandBallgun, sprBalls,
            sprPlane, sprHandPlane, sprUtility, sprInvulnerable, sprVampiric, sprGirder,
            sprSpeechCorner, sprSpeechEdge, sprSpeechTail,
            sprThoughtCorner, sprThoughtEdge, sprThoughtTail,
            sprShoutCorner, sprShoutEdge, sprShoutTail,
            sprSniperRifle, sprBubbles, sprJetpack, sprHealth, sprHandMolotov, sprMolotov,
            sprSmoke, sprSmokeWhite, sprShell, sprDust, sprSnowDust, sprExplosives, sprExplosivesRoll,
            sprAmTeleport, sprSplash, sprDroplet, sprBirdy, sprHandCake, sprHandConstruction,
            sprHandGrenade, sprHandMelon, sprHandMortar, sprHandSkip, sprHandCluster,
            sprHandDynamite, sprHandHellish, sprHandMine, sprHandSeduction, sprHandVamp,
            sprBigExplosion, sprSmokeRing, sprBeeTrace, sprEgg, sprTargetBee, sprHandBee,
            sprFeather, sprPiano, sprHandSineGun, sprPortalGun, sprPortal,
            sprCheese, sprHandCheese, sprHandFlamethrower, sprChunk, sprNote,
            sprSMineOff, sprSMineOn, sprHandSMine, sprHammer,
            sprHandResurrector, sprCross, sprAirDrill, sprNapalmBomb,
            sprBulletHit, sprSnowball, sprHandSnowball, sprSnow,
            sprSDFlake, sprSDWater, sprSDCloud, sprSDSplash, sprSDDroplet, sprTardis,
            sprSlider, sprBotlevels, sprHandKnife, sprKnife, sprStar, sprIceTexture, sprIceGun,
            sprFrozenHog, sprAmRubber, sprBoing, sprCustom1, sprCustom2, sprCustom3, sprCustom4,
            sprCustom5, sprCustom6, sprCustom7, sprCustom8, sprFrozenAirMine, sprAirMine, sprHandAirMine,
            sprFlakeL, sprSDFlakeL, sprCloudL, sprSDCloudL, sprCreeper, sprHandCreeper, sprMinigun,
            sprSliderInverted, sprFingerBack, sprFingerBackInv, sprTargetPBack, sprTargetPBackInv,
            sprHealthHud, sprHealthPoisonHud, sprVampHud, sprKarmaHud, sprMedicHud, sprMedicPoisonHud,
            sprHaloHud, sprInvulnHUD, sprAmPiano, sprHandLandGun, sprFirePunch, sprThroughWrap,
            sprDynamiteDefused, sprHogBubble, sprHappy, sprSentry, sprHandSentry);

    // Gears that interact with other Gears and/or Land
    // first row of gears (<gtExplosives) should be avoided when searching a spawn place
    TGearType = (gtFlame, gtHedgehog, gtMine, gtCase, gtAirMine, gtExplosives, 
            gtGrenade, gtShell, gtGrave, gtBee, // 9
            gtShotgunShot, gtPickHammer, gtRope,  // 12
            gtDEagleShot, gtDynamite, gtClusterBomb, gtCluster, gtShover, // 17
            gtFirePunch, gtATStartGame, // 19
            gtATFinishGame, gtParachute, gtAirAttack, gtAirBomb, gtBlowTorch, // 24
            gtGirder, gtTeleport, gtSwitcher, gtTarget, gtMortar, // 29
            gtWhip, gtKamikaze, gtCake, gtSeduction, gtWatermelon, gtMelonPiece, // 35
            gtHellishBomb, gtWaterUp, gtDrill, gtBallGun, gtBall, gtRCPlane, // 41
            gtSniperRifleShot, gtJetpack, gtMolotov, gtBirdy, // 45
            gtEgg, gtPortal, gtPiano, gtGasBomb, gtSineGunShot, gtFlamethrower, // 51
            gtSMine, gtPoisonCloud, gtHammer, gtHammerHit, gtResurrector, // 56
            gtNapalmBomb, gtSnowball, gtFlake, gtLandGun, gtTardis, // 61
            gtIceGun, gtAddAmmo, gtGenericFaller, gtKnife, gtCreeper, gtMinigun, gtMinigunBullet, gtSentry); // 69

    // Gears that are _only_ of visual nature (e.g. background stuff, visual effects, speechbubbles, etc.)
    TVisualGearType = (vgtFlake, vgtCloud, vgtExplPart, vgtExplPart2, vgtFire,
            vgtSmallDamageTag, vgtTeamHealthSorter, vgtSpeechBubble, vgtBubble,
            vgtSteam, vgtAmmo, vgtSmoke, vgtSmokeWhite, vgtShell,
            vgtDust, vgtSplash, vgtDroplet, vgtSmokeRing, vgtBeeTrace, vgtEgg,
            vgtFeather, vgtHealthTag, vgtSmokeTrace, vgtEvilTrace, vgtExplosion,
            vgtBigExplosion, vgtChunk, vgtNote, vgtLineTrail, vgtBulletHit, vgtCircle,
            vgtSmoothWindBar, vgtStraightShot, vgtNoPlaceWarn);

    // Damage can be caused by different sources
    TDamageSource = (dsUnknown, dsFall, dsBullet, dsExplosion, dsShove, dsPoison, dsHammer);

    // Available sounds
    TSound = (sndNone,
            sndGrenadeImpact, sndExplosion, sndThrowPowerUp, sndThrowRelease,
            sndSplash, sndShotgunReload, sndShotgunFire, sndGraveImpact,
            sndMineImpact, sndMineTick, sndMudballImpact,
            sndPickhammer, sndGun, sndBee, sndJump1, sndJump2,
            sndJump3, sndYesSir, sndLaugh, sndIllGetYou, sndJustYouWait, sndIncoming,
            sndMissed, sndStupid, sndFirstBlood, sndBoring, sndByeBye,
            sndSameTeam, sndNutter, sndReinforce, sndTraitor, sndRegret,
            sndEnemyDown, sndCoward, sndHurry, sndWatchIt, sndKamikaze,
            sndCake, sndOw1, sndOw2, sndOw3, sndOw4, sndFirePunch1, sndFirePunch2,
            sndFirePunch3, sndFirePunch4, sndFirePunch5, sndFirePunch6,
            sndMelon, sndHellish, sndYoohoo, sndRCPlane, sndWhipCrack,
            sndRideOfTheValkyries, sndDenied, sndPlaced, sndBaseballBat,
            sndVaporize, sndWarp, sndSuddenDeath, sndMortar, sndShutter,
            sndHomerun, sndMolotov, sndCover, sndUhOh, sndOops,
            sndNooo, sndHello, sndRopeShot, sndRopeAttach, sndRopeRelease,
            sndSwitchHog, sndVictory, sndFlawless, sndSniperReload, sndSteps, sndLowGravity,
            sndHellishImpact1, sndHellishImpact2, sndHellishImpact3, sndHellishImpact4,
            sndMelonImpact, sndDroplet1, sndDroplet2, sndDroplet3, sndEggBreak, sndDrillRocket,
            sndPoisonCough, sndPoisonMoan, sndBirdyLay, sndWhistle, sndBeeWater,
            sndPiano0, sndPiano1, sndPiano2, sndPiano3, sndPiano4, sndPiano5, sndPiano6, sndPiano7,
            sndPiano8, sndSkip, sndSineGun, sndOoff1, sndOoff2, sndOoff3, sndWhack,
            sndComeonthen, sndParachute, sndBump, sndResurrector, sndPlane, sndTardis, sndFrozenHogImpact,
            sndIceBeam, sndHogFreeze, sndAirMineImpact, sndKnifeImpact, sndExtraTime, sndLaserSight,
            sndInvulnerable, sndJetpackLaunch, sndJetpackBoost, sndPortalShot, sndPortalSwitch,
            sndPortalOpen, sndBlowTorch, sndCountdown1, sndCountdown2, sndCountdown3, sndCountdown4,
            sndCreeperDrop, sndCreeperWater, sndCreeperDie, sndCustom1, sndCustom2, sndCustom3, sndCustom4,
            sndCustom5, sndCustom6, sndCustom7, sndCustom8, sndMinigun, sndFlamethrower, sndIceBeamIdle,
            sndLandGun, sndCaseImpact, sndExtraDamage, sndFirePunchHit, sndGrenade, sndThisOneIsMine,
            sndWhatThe, sndSoLong, sndOhDear, sndGonnaGetYou, sndDrat, sndBugger, sndAmazing,
            sndBrilliant, sndExcellent, sndFire, sndWatchThis, sndRunAway, sndRevenge, sndCutItOut,
            sndLeaveMeAlone, sndOuch, sndHmm, sndKiss, sndFlyAway, sndPlaneWater, sndDynamiteFuse,
            sndDynamiteImpact);

    // Available ammo types to be used by hedgehogs
    TAmmoType  = (amNothing, amGrenade, amClusterBomb, amBazooka, amBee, amShotgun, amPickHammer, // 6
            amSkip, amRope, amMine, amDEagle, amDynamite, amFirePunch, amWhip, // 13
            amBaseballBat, amParachute, amAirAttack, amMineStrike, amBlowTorch, // 18
            amGirder, amTeleport, amSwitch, amMortar, amKamikaze, amCake, // 24
            amSeduction, amWatermelon, amHellishBomb, amNapalm, amDrill, amBallgun, // 30
            amRCPlane, amLowGravity, amExtraDamage, amInvulnerable, amExtraTime, // 35
            amLaserSight, amVampiric, amSniperRifle, amJetpack, amMolotov, amBirdy, amPortalGun, // 42
            amPiano, amGasBomb, amSineGun, amFlamethrower, amSMine, amHammer, // 48
            amResurrector, amDrillStrike, amSnowball, amTardis, amLandGun, // 53
            amIceGun, amKnife, amRubber, amAirMine, amCreeper, amMinigun, amSentry); // 60
    // NOTE: If we ever reach 126 ammo types, make sure to skip ammo type number 126 because it's
    // reserved as synonym for amNothing. See also chSetWeapon.

    // Different kind of crates that e.g. hedgehogs can pick up
    TCrateType = (HealthCrate, AmmoCrate, UtilityCrate);

    THWFont = (fnt16, fntBig, fntSmall, fntChat {$IFNDEF MOBILE}, CJKfnt16, CJKfntBig, CJKfntSmall, CJKfntChat{$ENDIF});

    TCapGroup = (capgrpGameState, capgrpAmmoinfo, capgrpVolume,
            capgrpMessage, capgrpMessage2, capgrpAmmostate);

    TStatInfoType = (siGameResult, siMaxStepDamage, siMaxStepKills, siKilledHHs,
            siClanHealth, siTeamStats, siPlayerKills, siMaxTeamDamage,
            siMaxTeamKills, siMaxTurnSkips, siCustomAchievement, siGraphTitle,
            siPointType, siTeamRank, siEverAfter);

    // Various 'emote' animations a hedgehog can do
    TWave = (waveRollup, waveSad, waveWave, waveHurrah, waveLemonade, waveShrug, waveJuggle, waveBubble,
             waveHappy);

    TRenderMode = (rmDefault, rmLeftEye, rmRightEye);
    TStereoMode = (smNone, smRedCyan, smCyanRed, smRedBlue, smBlueRed, smRedGreen, smGreenRed, smHorizontal, smVertical);
    TWorldEdge = (weNone, weWrap, weBounce, weSea, weSky);
    TUIDisplay = (uiAll, uiNoTeams, uiNone);
    TMapGen = (mgRandom, mgMaze, mgPerlin, mgDrawn, mgForts);


    THHFont = record
            Handle: PTTF_Font;
            Height: LongInt;
            style: LongInt;
            Name: string[31];
            end;

    PAmmo = ^TAmmo;
    TAmmo = record
            Propz: LongWord;
            Count: LongWord;
// Using for place hedgehogs mode, but for any other situation where the initial count would be needed I guess.
// For example, say, a mode where the weaponset is reset each turn, or on sudden death
            NumPerTurn: LongWord;
            Timer: LongWord;
            Pos: LongWord;
            AmmoType: TAmmoType;
            AttackVoice: TSound;
            Bounciness: LongWord;
            end;

    TVertex2f = record
            X, Y: GLfloat;
            end;

    TVertex2i = record
            X, Y: GLint;
            end;

    TMatrix4x4f = array[0..3, 0..3] of GLfloat;

    PTexture = ^TTexture;
    TTexture = record
            id: GLuint;
            w, h, scale: LongInt;
            rx, ry: GLfloat;
            priority: GLfloat;
            vb, tb: array [0..3] of TVertex2f;
            PrevTexture, NextTexture: PTexture;
            end;

    THogEffect = (heInvulnerable, heResurrectable, hePoisoned, heResurrected, heFrozen, heArtillery);

    TScreenFade = (sfNone, sfInit, sfToBlack, sfFromBlack, sfToWhite, sfFromWhite);

    PGear = ^TGear;
    PHedgehog = ^THedgehog;
    PTeam     = ^TTeam;
    PClan     = ^TClan;

    TGearStepProcedure = procedure (Gear: PGear);
// So, you are here looking for variables you can (ab)use to store some gear state?
// 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.
    TGear = record
// Do *not* ever override these.
            NextGear, PrevGear: PGear;  // Linked list
            Z: Longword;                // Z index. For rendering. Sets order in list
            Active: Boolean;            // Is gear Active (running step code)
            Kind: TGearType;
            doStep: TGearStepProcedure; // Code the gear is running
            AmmoType : TAmmoType;       // Ammo type associated with this kind of gear
            RenderTimer: Boolean;       // Will visually display Timer if true
            RenderHealth: Boolean;      // Will visually display Health if true
            Target : TPoint;            // Gear target. Will render in uGearsRender unless a special case is added
            AIHints: LongWord;          // hints for ai.
            LastDamage: PHedgehog;      // Used to track damage source for stats
            CollisionIndex: LongInt;    // Position in collision array
            Message: LongWord;          // Game messages are stored here. See gm bitmasks in uConsts
            uid: Longword;              // Lua use this to reference gears
            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.
// Strongly recommended not to override these.  Will mess up generic operations like portaling
            X : hwFloat;              // X/Y/dX/dY are position/velocity. People count on these having semi-normal values
            Y : hwFloat;
            dX: hwFloat;
            dY: hwFloat;
            State : Longword;        // See gst bitmask values in uConsts
            PortalCounter: LongWord; // Necessary to interrupt portal loops.  Not possible to avoid infinite loops without it.
// Don't use these if you're using generic movement like doStepFallingGear and explosion shoves. Generally recommended not to use.
            Radius: LongInt;     // Radius. If not using uCollisions, is usually used to indicate area of effect
            CollisionMask: Word; // Masking off Land impact  FF7F for example ignores current hog and crates
            AdvBounce: Longword; // Triggers 45 bounces. Is a counter to avoid edge cases
            Sticky: Boolean;     // True if gear is *normally* able to stick to landscape on impact
            Elasticity: hwFloat;
            Friction  : hwFloat;
            Density   : hwFloat; // Density is kind of a mix of size and density. Impacts distance thrown, wind.
            ImpactSound: TSound; // first sound, others have to be after it in the sounds def.
            nImpactSounds: Word; // count of ImpactSounds.
// Don't use these if you want to take damage normally, otherwise health/damage are commonly used for other purposes
            Health, Damage, Karma: LongInt;
// 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
            DirAngle: real;
// These are frequently overridden to serve some other purpose
            Boom: Longword;          // amount of damage caused by the gear
            Pos: Longword;           // Commonly overridden.  Example use is posCase values in uConsts.
            Angle, Power : Longword; // Used for hog aiming/firing.  Angle is rarely used as an Angle otherwise.
            Timer, WDTimer : LongWord;        // Typically used for some sort of gear timer. Time to explosion, remaining fuel...
            Tag: LongInt;            // Quite generic. Variety of uses.
            FlightTime: Longword;    // Initially added for batting of hogs to determine homerun. Used for some firing delays
            MsgParam: LongWord;      // Initially stored a set of messages. So usually gm values like Message. Frequently overriden
// These are not used generically, but should probably be used for purpose intended. Definitely shouldn't override pointer type
            Tex: PTexture;          // A texture created by the gear. Shouldn't use for anything but textures
            Tint: LongWord;         // Used to colour a texture
            LinkedGear: PGear;      // Used to track a related gear. Portal pairs for example.
            SoundChannel: LongInt;  // Used to track a sound the gear started
            Data: Pointer; // pointer to gear type specific data structure (if any)
            end;
    TPGearArray = array of PGear;
    PGearArrayS = record
        size: LongWord;
        ar: ^TPGearArray;
        end;

    PVisualGear = ^TVisualGear;
    TVGearStepProcedure = procedure (Gear: PVisualGear; Steps: Longword);
    TVisualGear = record
        NextGear, PrevGear: PVisualGear;
        Frame,
        FrameTicks: Longword;
        X : real;
        Y : real;
        dX: real;
        dY: real;
        tdX: real;
        tdY: real;
        State : Longword;
        Timer: Longword;
        Angle, dAngle: real;
        Kind: TVisualGearType;
        doStep: TVGearStepProcedure;
        Tex: PTexture;
        alpha, scale: GLfloat;
        Hedgehog: PHedgehog;
        Tag: LongInt;
        Text: shortstring;
        Tint: Longword;
        uid: Longword;
        Layer: byte;
        end;

    TStatistics = record
        DamageRecv,              // total damage received
        DamageGiven: Longword;   // total damage dealt
        StepDamageRecvInRow,     // number of enemy turns in row this hog received any damage
        StepDamageRecv,          // damage received in this turn
        StepDamageGiven,         // damage dealt in this turn
        StepKills: Longword;     // kills in this turn
        StepPoisoned,            // whether hog got poisoned this turn
        StepDied,                // whether hog died this turn
        Sacrificed,              // whether hog was sacrificed in suicide attack (kamikaze, piano)
        GotRevenge: boolean;     // whether hog got revenge in this turn
        StepRevenge: boolean;    // whether hog's revenge mode was activated in this turn
        MaxStepDamageRecv,       // most damage received in one turn
        MaxStepDamageGiven,      // most damage dealt in one turn
        MaxStepKills: Longword;  // most kills in one turn
        FinishedTurns: Longword;
        end;

    TTeamStats = record
        Kills : Longword;
        Suicides: Longword;
        AIKills : Longword;
        TeamKills : Longword;
        TurnSkips : Longword;
        TeamDamage : Longword;
        end;

    PClanDeathLogEntry = ^TClanDeathLogEntry;

    TClanDeathLogEntry = record
        Turn : Longword; // turn in which the clans were killed
        KilledClans : array[0..Pred(cMaxTeams)] of PClan; // array of clans that have died
        KilledClansCount: Longword; // number of clans that died
        NextEntry : PClanDeathLogEntry; // linked list
        end;


    TBinds = record
                 indices: array[0..cKbdMaxIndex] of byte;
                 // zeroth element is reserved, indices[i] == 0 means no binding
                 binds: array[0..255] of shortstring;
                 lastIndex: byte;
             end;

    TKeyboardState = array[0..cKeyMaxIndex] of Byte;

    PVoicepack = ^TVoicepack;
    TVoicepack = record
        name: shortstring;
        chunks: array [TSound] of PMixChunk;
        end;

    TVoice = record
        snd: TSound;
        voicepack: PVoicePack;
        isFallback: boolean;
        end;

    THHAmmo = array[0..cMaxSlotIndex, 0..cMaxSlotAmmoIndex] of TAmmo;
    PHHAmmo = ^THHAmmo;

    THedgehog = record
            Name: shortstring;
            Gear: PGear;
            GearHidden: PGear;
            SpeechGear: PVisualGear;
            NameTagTex,
            HealthTagTex,
            HatTex: PTexture;
            Ammo: PHHAmmo;
            CurAmmoType: TAmmoType;
            PickUpType: LongWord;
            PickUpDelay: LongInt;
            AmmoStore: Longword;
            Team: PTeam;
            MultiShootAttacks: Longword;
            visStepPos: LongWord;
            BotLevel  : Byte; // 0 - Human player
            HatVisibility: GLfloat;
            stats: TStatistics;
            Hat: shortstring;
            InitialHealth: LongInt; // used for gfResetHealth
            King: boolean;  // Flag for a bunch of hedgehog attributes
            Unplaced: boolean;  // Flag for hog placing mode
            UnplacedKing: boolean;  // Flag for king placing phase in King Mode
            Timer: Longword;
            HealthBarHealth: LongInt;
            Effects: array[THogEffect] of LongInt;
            RevengeHog: PHedgehog;   // For which hog this hog wants revenge most. For sndRevenge taunt
            FlownOffMap: boolean; // When hedgehog has flown far away off the map left or right
            end;

    TTeam = record
            Clan: PClan;
            TeamName: shortstring;
            ExtDriven: boolean;
            Binds: TBinds;
            Hedgehogs: array[0..cMaxHHIndex] of THedgehog;
            CurrHedgehog: LongWord;
            NameTagTex,
            OwnerTex,
            GraveTex,
            AIKillsTex,
            LuaTeamValueTex,
            FlagTex: PTexture;
            Flag: shortstring;
            GraveName: shortstring;
            FortName: shortstring;
            Owner: shortstring;
            TeamHealth: LongInt;
            TeamHealthBarHealth: LongInt;
            DrawHealthY: LongInt;
            AttackBar: LongWord;
            HedgehogsNumber: Longword;
            voicepack: PVoicepack;
            PlayerHash: shortstring;   // md5 hash of player name. For temporary enabling of hats as thank you. Hashed for privacy of players
            stats: TTeamStats;
            Passive: boolean; // if true, team will not participate in game. It is treated as if all its hedgehogs are frozen.
                              // updating this value requires updating Passive in TClan as well!
            hasKing: boolean; // true if team has a living king
            hasGone: boolean;
            skippedTurns: Longword;
            isGoneFlagPendingToBeSet, isGoneFlagPendingToBeUnset: boolean;
            luaTeamValue: ansistring;
            hasLuaTeamValue: boolean;
            end;

    TClan = record
            Color: Longword;
            Teams: array[0..Pred(cMaxTeams)] of PTeam;
            HealthTex: PTexture;
            TeamsNumber: Longword;
            TagTeamIndex: Longword;
            CurrTeam: LongWord;
            ClanHealth: LongInt;
            ClanIndex: LongInt;
            TurnNumber: LongWord;
            DeathLogged: boolean; // true if clan is dead and its latest death has been logged in the clan death log
            StatsHandled : boolean; // true if clan's rank has been handled for stats screen
            Flawless: boolean;
            Passive: boolean; // informational. Must be set to true if all of the teams are passive
            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
            end;

     cdeclPtr = procedure; cdecl;
     cdeclIntPtr = procedure(num: LongInt); cdecl;
     funcDoublePtr = function: Double;

     TMobileRecord = record
                     PerformRumble: cdeclIntPtr;
                     GameLoading: cdeclPtr;
                     GameLoaded: cdeclPtr;
                     SaveLoadingEnded: cdeclPtr;
                     end;

     TAmmoStrId = (sidGrenade, sidClusterBomb, sidBazooka, sidBee, sidShotgun,
            sidPickHammer, sidSkip, sidRope, sidMine, sidDEagle,
            sidDynamite, sidBaseballBat, sidFirePunch, sidSeconds,
            sidParachute, sidAirAttack, sidMineStrike, sidBlowTorch,
            sidGirder, sidTeleport, sidSwitch, sidMortar, sidWhip,
            sidKamikaze, sidCake, sidSeduction, sidWatermelon,
            sidHellishBomb, sidDrill, sidBallgun, sidNapalm, sidRCPlane,
            sidLowGravity, sidExtraDamage, sidInvulnerable, sidExtraTime,
            sidLaserSight, sidVampiric, sidSniperRifle, sidJetpack,
            sidMolotov, sidBirdy, sidPortalGun, sidPiano, sidGasBomb,
            sidSineGun, sidFlamethrower,sidSMine, sidHammer, sidResurrector,
            sidDrillStrike, sidSnowball, sidNothing, sidTardis,
            sidLandGun, sidIceGun, sidKnife, sidRubber, sidAirMine,
            sidCreeper, sidMinigun, sidSentry);

    TMsgStrId = (sidLoading, sidDraw, sidWinner, sidVolume, sidPaused,
            sidConfirm, sidSuddenDeath, sidRemaining, sidFuel, sidSync,
            sidNoEndTurn, sidNotYetAvailable, sidRoundSD, sidRoundsSD, sidReady,
            sidBounce1, sidBounce2, sidBounce3, sidBounce4, sidBounce5, sidBounce,
            sidMute, sidAFK, sidAutoCameraOff, sidAutoCameraOn, sidPressTarget,
            sidNotAvailableInSD, sidHealthGain, sidEmptyCrate, sidUnknownKey,
            sidWinner2, sidWinner3, sidWinner4, sidWinner5, sidWinner6,
            sidWinner7, sidWinnerAll, sidTeamGone, sidTeamBack, sidAutoSkip,
            sidFPS, sidLuaParsingOff, sidLuaParsingOn, sidLuaParsingDenied,
            sidAmmoCount, sidChat, sidChatTeam, sidChatHog, sidUnknownGearValue,
            sidVideoRecLuaFail);

    TCmdHelpStrId = (
            sidCmdHeaderBasic, sidCmdTogglechat, sidCmdTeam, sidCmdMe,
            sidCmdPause, sidCmdPauseNet, sidCmdFullscreen, sidCmdQuit,
            sidCmdHelp, sidCmdHelpTaunts, sidCmdHistory, sidLua,

            sidCmdHeaderTaunts, sidCmdSpeech, sidCmdThink, sidCmdYell,
            sidCmdSpeechNumberHint, sidCmdHsa, sidCmdHta, sidCmdHya,
            sidCmdHurrah, sidCmdIlovelotsoflemonade, sidCmdJuggle,
            sidCmdRollup, sidCmdShrug, sidCmdWave, sidCmdUnknown,
            sidCmdHelpRoom, sidCmdHelpRoomFail, sidCmdBubble, sidCmdHappy,
            sidCmdSad);

    // Events that are important for the course of the game or at least interesting for other reasons
    TEventId = (eidDied, eidDrowned, eidRoundStart, eidRoundWin, eidRoundDraw,
            eidNewHealthPack, eidNewAmmoPack, eidNewUtilityPack, eidTurnSkipped,
            eidHurtSelf, eidHomerun, eidGone, eidPoisoned, eidResurrected,
            eidKamikaze, eidTimeTravelEnd, eidTimeout, eidKingDied);

    TGoalStrId = (gidCaption, gidSubCaption, gidPlaceKing, gidLowGravity, gidInvulnerable,
            gidVampiric, gidKarma, gidKing, gidPlaceHog, gidArtillery,
            gidSolidLand, gidSharedAmmo, gidMineTimer, gidNoMineTimer,
            gidRandomMineTimer, gidDamageModifier, gidResetHealth, gidAISurvival,
            gidInfAttack, gidResetWeps, gidPerHogAmmo, gidTagTeam, gidMoreWind);


    TLandArray = packed array of array of LongWord;
    TCollisionArray = packed array of array of Word;
    TDirtyTag = packed array of array of byte;

    TPreview  = packed array[0..127, 0..31] of byte;
    TPreviewAlpha  = packed array[0..127, 0..255] of byte;

    PWidgetMovement = ^TWidgetMovement;
    TWidgetMovement = record
        animate   : Boolean;
        source    : TPoint;
        target    : TPoint;
        startTime : Longword;
        end;

    POnScreenWidget = ^TOnScreenWidget;
    TOnScreenWidget = record
        show          : boolean;            // if false widget will not be drawn
        sprite        : TSprite;            // a convenience type
        frame         : TSDL_Rect;          // graphical coordinates
        active        : TSDL_Rect;          // active touch region
        fadeAnimStart : Longword;           // time the fade started
                                            //     (0 means do not fade)
        moveAnim      : TWidgetMovement;    // animation associated to widget
        end;

    PTouch_Data = ^TTouch_Data;
    TTouch_Data = record
        id                       : TSDL_FingerId;
        x,y                      : LongInt;
        dx,dy                    : LongInt;
        historicalX, historicalY : LongInt;
        timeSinceDown            : Longword;
        pressedWidget            : POnScreenWidget;
        end;

    PSpriteData = ^TSpriteData;
    TSpriteData = record
            FileName: string[15];
            Path, AltPath: TPathType;
            Texture: PTexture;
            Surface: PSDL_Surface;
            Width, Height, imageWidth, imageHeight: LongInt;
            saveSurf: boolean;
            critical: boolean;
            checkSum: boolean; // use for images where if they are missing a desync can occur.
            priority: GLfloat;
            getDimensions, getImageDimensions: boolean;
            end;

    // gear data types

    const cakeh =   27;

    type TCakeData = record
        CakeI: integer;
        CakePoints: array[0..Pred(cakeh)] of record
            x, y: hwFloat;
        end;
    end;

    PCakeData = ^TCakeData;

    TClansArray = array[0..Pred(cMaxTeams)] of PClan;

implementation

end.