hedgewars/uTypes.pas
changeset 10015 4feced261c68
parent 9998 736015b847e3
parent 9950 2759212a27de
child 10040 4ac87acbaed9
equal deleted inserted replaced
10014:56d2f2d5aad8 10015:4feced261c68
    41     // Game types that help determining what the engine is actually supposed to do
    41     // Game types that help determining what the engine is actually supposed to do
    42     TGameType = (gmtLocal, gmtDemo, gmtNet, gmtSave, gmtLandPreview, gmtSyntax, gmtRecord);
    42     TGameType = (gmtLocal, gmtDemo, gmtNet, gmtSave, gmtLandPreview, gmtSyntax, gmtRecord);
    43 
    43 
    44     // Different files are stored in different folders, this enumeration is used to tell which folder to use
    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, ptTeams, ptMaps,
    45     TPathType = (ptNone, ptData, ptGraphics, ptThemes, ptCurrTheme, ptTeams, ptMaps,
    46             ptMapCurrent, ptDemos, ptSounds, ptGraves, ptFonts, ptForts,
    46             ptMapCurrent, ptDemos, ptSounds, ptGraves, ptFonts, ptForts, ptLocale,
    47             ptLocale, ptAmmoMenu, ptHedgehog, ptVoices, ptHats, ptFlags, ptMissionMaps, ptSuddenDeath, ptButtons);
    47             ptAmmoMenu, ptHedgehog, ptVoices, ptHats, ptFlags, ptMissionMaps,
       
    48             ptSuddenDeath, ptButtons, ptShaders);
    48 
    49 
    49     // Available sprites for displaying stuff
    50     // Available sprites for displaying stuff
    50     TSprite = (sprWater, sprCloud, sprBomb, sprBigDigit, sprFrame,
    51     TSprite = (sprWater, sprCloud, sprBomb, sprBigDigit, sprFrame,
    51             sprLag, sprArrow, sprBazookaShell, sprTargetP, sprBee,
    52             sprLag, sprArrow, sprBazookaShell, sprTargetP, sprBee,
    52             sprSmokeTrace, sprRopeHook, sprExplosion50, sprMineOff,
    53             sprSmokeTrace, sprRopeHook, sprExplosion50, sprMineOff,
    88             sprSDFlake, sprSDWater, sprSDCloud, sprSDSplash, sprSDDroplet, sprTardis,
    89             sprSDFlake, sprSDWater, sprSDCloud, sprSDSplash, sprSDDroplet, sprTardis,
    89             sprSlider, sprBotlevels, sprHandKnife, sprKnife, sprStar, sprIceTexture, sprIceGun, sprFrozenHog, sprAmRubber, sprBoing
    90             sprSlider, sprBotlevels, sprHandKnife, sprKnife, sprStar, sprIceTexture, sprIceGun, sprFrozenHog, sprAmRubber, sprBoing
    90             );
    91             );
    91 
    92 
    92     // Gears that interact with other Gears and/or Land
    93     // Gears that interact with other Gears and/or Land
    93     TGearType = ({-->}gtFlame, gtHedgehog, gtMine, gtCase, gtExplosives, // <-- these are gears which should be avoided when searching a spawn place
    94     TGearType = (gtFlame, gtHedgehog, gtMine, gtCase, gtExplosives, // these gears should be avoided when searching a spawn place
    94             gtGrenade, gtShell, gtGrave, gtBee, // 8
    95             gtGrenade, gtShell, gtGrave, gtBee, // 8
    95             gtShotgunShot, gtPickHammer, gtRope,  // 11
    96             gtShotgunShot, gtPickHammer, gtRope,  // 11
    96             gtDEagleShot, gtDynamite, gtClusterBomb, gtCluster, gtShover, // 16
    97             gtDEagleShot, gtDynamite, gtClusterBomb, gtCluster, gtShover, // 16
    97             gtFirePunch, gtATStartGame, // 18
    98             gtFirePunch, gtATStartGame, // 18
    98             gtATFinishGame, gtParachute, gtAirAttack, gtAirBomb, gtBlowTorch, // 23
    99             gtATFinishGame, gtParachute, gtAirAttack, gtAirBomb, gtBlowTorch, // 23
   136             sndNooo, sndHello, sndRopeShot, sndRopeAttach, sndRopeRelease,
   137             sndNooo, sndHello, sndRopeShot, sndRopeAttach, sndRopeRelease,
   137             sndSwitchHog, sndVictory, sndFlawless, sndSniperReload, sndSteps, sndLowGravity,
   138             sndSwitchHog, sndVictory, sndFlawless, sndSniperReload, sndSteps, sndLowGravity,
   138             sndHellishImpact1, sndHellishImpact2, sndHellishImpact3, sndHellishImpact4,
   139             sndHellishImpact1, sndHellishImpact2, sndHellishImpact3, sndHellishImpact4,
   139             sndMelonImpact, sndDroplet1, sndDroplet2, sndDroplet3, sndEggBreak, sndDrillRocket,
   140             sndMelonImpact, sndDroplet1, sndDroplet2, sndDroplet3, sndEggBreak, sndDrillRocket,
   140             sndPoisonCough, sndPoisonMoan, sndBirdyLay, sndWhistle, sndBeeWater,
   141             sndPoisonCough, sndPoisonMoan, sndBirdyLay, sndWhistle, sndBeeWater,
   141             sndPiano0, sndPiano1, sndPiano2, sndPiano3, sndPiano4, sndPiano5, sndPiano6, sndPiano7, sndPiano8,
   142             sndPiano0, sndPiano1, sndPiano2, sndPiano3, sndPiano4, sndPiano5, sndPiano6, sndPiano7,
   142             sndSkip, sndSineGun, sndOoff1, sndOoff2, sndOoff3, sndWhack,
   143             sndPiano8, sndSkip, sndSineGun, sndOoff1, sndOoff2, sndOoff3, sndWhack,
   143             sndComeonthen, sndParachute, sndBump, sndResurrector, sndPlane, sndTardis, sndFrozenHogImpact, sndIceBeam, sndHogFreeze
   144             sndComeonthen, sndParachute, sndBump, sndResurrector, sndPlane, sndTardis, sndFrozenHogImpact,
       
   145             sndIceBeam, sndHogFreeze
   144             );
   146             );
   145 
   147 
   146     // Available ammo types to be used by hedgehogs
   148     // Available ammo types to be used by hedgehogs
   147     TAmmoType  = (amNothing, amGrenade, amClusterBomb, amBazooka, amBee, amShotgun, amPickHammer, // 6
   149     TAmmoType  = (amNothing, amGrenade, amClusterBomb, amBazooka, amBee, amShotgun, amPickHammer, // 6
   148             amSkip, amRope, amMine, amDEagle, amDynamite, amFirePunch, amWhip, // 13
   150             amSkip, amRope, amMine, amDEagle, amDynamite, amFirePunch, amWhip, // 13
   165     TStatInfoType = (siGameResult, siMaxStepDamage, siMaxStepKills, siKilledHHs,
   167     TStatInfoType = (siGameResult, siMaxStepDamage, siMaxStepKills, siKilledHHs,
   166             siClanHealth, siTeamStats, siPlayerKills, siMaxTeamDamage,
   168             siClanHealth, siTeamStats, siPlayerKills, siMaxTeamDamage,
   167             siMaxTeamKills, siMaxTurnSkips, siCustomAchievement, siGraphTitle,
   169             siMaxTeamKills, siMaxTurnSkips, siCustomAchievement, siGraphTitle,
   168             siPointType);
   170             siPointType);
   169 
   171 
   170     // Various "emote" animations a hedgehog can do
   172     // Various 'emote' animations a hedgehog can do
   171     TWave = (waveRollup, waveSad, waveWave, waveHurrah, waveLemonade, waveShrug, waveJuggle);
   173     TWave = (waveRollup, waveSad, waveWave, waveHurrah, waveLemonade, waveShrug, waveJuggle);
   172 
   174 
   173     TRenderMode = (rmDefault, rmLeftEye, rmRightEye);
   175     TRenderMode = (rmDefault, rmLeftEye, rmRightEye);
   174     TStereoMode = (smNone, smRedCyan, smCyanRed, smRedBlue, smBlueRed, smRedGreen, smGreenRed, smHorizontal, smVertical);
   176     TStereoMode = (smNone, smRedCyan, smCyanRed, smRedBlue, smBlueRed, smRedGreen, smGreenRed, smHorizontal, smVertical);
   175     TWorldEdge = (weNone, weWrap, weBounce, weSea, weSky);
   177     TWorldEdge = (weNone, weWrap, weBounce, weSea, weSky);
   184 
   186 
   185     PAmmo = ^TAmmo;
   187     PAmmo = ^TAmmo;
   186     TAmmo = record
   188     TAmmo = record
   187             Propz: LongWord;
   189             Propz: LongWord;
   188             Count: LongWord;
   190             Count: LongWord;
   189 (* Using for place hedgehogs mode, but for any other situation where the initial count would be needed I guess.
   191 // Using for place hedgehogs mode, but for any other situation where the initial count would be needed I guess.
   190 For example, say, a mode where the weaponset is reset each turn, or on sudden death *)
   192 // For example, say, a mode where the weaponset is reset each turn, or on sudden death
   191             NumPerTurn: LongWord;
   193             NumPerTurn: LongWord;
   192             Timer: LongWord;
   194             Timer: LongWord;
   193             Pos: LongWord;
   195             Pos: LongWord;
   194             AmmoType: TAmmoType;
   196             AmmoType: TAmmoType;
   195             AttackVoice: TSound;
   197             AttackVoice: TSound;
   201             end;
   203             end;
   202 
   204 
   203     TVertex2i = record
   205     TVertex2i = record
   204             X, Y: GLint;
   206             X, Y: GLint;
   205             end;
   207             end;
       
   208 
       
   209     TMatrix4x4f = array[0..3, 0..3] of GLfloat;
   206 
   210 
   207     PTexture = ^TTexture;
   211     PTexture = ^TTexture;
   208     TTexture = record
   212     TTexture = record
   209             id: GLuint;
   213             id: GLuint;
   210             w, h, scale: LongInt;
   214             w, h, scale: LongInt;
   222     PHedgehog = ^THedgehog;
   226     PHedgehog = ^THedgehog;
   223     PTeam     = ^TTeam;
   227     PTeam     = ^TTeam;
   224     PClan     = ^TClan;
   228     PClan     = ^TClan;
   225 
   229 
   226     TGearStepProcedure = procedure (Gear: PGear);
   230     TGearStepProcedure = procedure (Gear: PGear);
   227 // So, you're here looking for variables you can (ab)use to store some gear state?
   231 // So, you are here looking for variables you can (ab)use to store some gear state?
   228 // 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.
   232 // 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.
   229     TGear = record
   233     TGear = record
   230 // Don't ever override these.
   234 // Do *not* ever override these.
   231             NextGear, PrevGear: PGear;  // Linked list
   235             NextGear, PrevGear: PGear;  // Linked list
   232             Z: Longword;                // Z index. For rendering. Sets order in list
   236             Z: Longword;                // Z index. For rendering. Sets order in list
   233             Active: Boolean;            // Is gear Active (running step code)
   237             Active: Boolean;            // Is gear Active (running step code)
   234             Kind: TGearType;
   238             Kind: TGearType;
   235             doStep: TGearStepProcedure; // Code the gear is running
   239             doStep: TGearStepProcedure; // Code the gear is running
   249             State : Longword;        // See gst bitmask values in uConsts
   253             State : Longword;        // See gst bitmask values in uConsts
   250             PortalCounter: LongWord; // Necessary to interrupt portal loops.  Not possible to avoid infinite loops without it.
   254             PortalCounter: LongWord; // Necessary to interrupt portal loops.  Not possible to avoid infinite loops without it.
   251 // Don't use these if you're using generic movement like doStepFallingGear and explosion shoves. Generally recommended not to use.
   255 // Don't use these if you're using generic movement like doStepFallingGear and explosion shoves. Generally recommended not to use.
   252             Radius: LongInt;     // Radius. If not using uCollisions, is usually used to indicate area of effect
   256             Radius: LongInt;     // Radius. If not using uCollisions, is usually used to indicate area of effect
   253             CollisionMask: Word; // Masking off Land impact  FF7F for example ignores current hog and crates
   257             CollisionMask: Word; // Masking off Land impact  FF7F for example ignores current hog and crates
   254             AdvBounce: Longword; // Triggers 45° bounces. Is a counter to avoid edge cases
   258             AdvBounce: Longword; // Triggers 45 bounces. Is a counter to avoid edge cases
   255             Elasticity: hwFloat;
   259             Elasticity: hwFloat;
   256             Friction  : hwFloat;
   260             Friction  : hwFloat;
   257             Density   : hwFloat; // Density is kind of a mix of size and density. Impacts distance thrown, wind.
   261             Density   : hwFloat; // Density is kind of a mix of size and density. Impacts distance thrown, wind.
   258             ImpactSound: TSound; // first sound, others have to be after it in the sounds def.
   262             ImpactSound: TSound; // first sound, others have to be after it in the sounds def.
   259             nImpactSounds: Word; // count of ImpactSounds.
   263             nImpactSounds: Word; // count of ImpactSounds.
   260 // Don't use these if you want to take damage normally, otherwise health/damage are commonly used for other purposes
   264 // Don't use these if you want to take damage normally, otherwise health/damage are commonly used for other purposes
   261             Health, Damage, Karma: LongInt;
   265             Health, Damage, Karma: LongInt;
   262 // DirAngle is a "real" - if you don't need it for rotation of sprite in uGearsRender, you can use it for any visual-only value
   266 // 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
   263             DirAngle: real;
   267             DirAngle: real;
   264 // These are frequently overridden to serve some other purpose
   268 // These are frequently overridden to serve some other purpose
   265             Pos: Longword;           // Commonly overridden.  Example use is posCase values in uConsts.
   269             Pos: Longword;           // Commonly overridden.  Example use is posCase values in uConsts.
   266             Angle, Power : Longword; // Used for hog aiming/firing.  Angle is rarely used as an Angle otherwise.
   270             Angle, Power : Longword; // Used for hog aiming/firing.  Angle is rarely used as an Angle otherwise.
   267             Timer, WDTimer : LongWord;        // Typically used for some sort of gear timer. Time to explosion, remaining fuel...
   271             Timer, WDTimer : LongWord;        // Typically used for some sort of gear timer. Time to explosion, remaining fuel...
   268             Tag: LongInt;            // Quite generic. Variety of uses.
   272             Tag: LongInt;            // Quite generic. Variety of uses.
   269             FlightTime: Longword;    // Initially added for batting of hogs to determine homerun. Used for some firing delays
   273             FlightTime: Longword;    // Initially added for batting of hogs to determine homerun. Used for some firing delays
   270             MsgParam: LongWord;      // Initially stored a set of messages. So usually gm values like Message. Frequently overriden
   274             MsgParam: LongWord;      // Initially stored a set of messages. So usually gm values like Message. Frequently overriden
   271 // These are not used generically, but should probably be used for purpose intended. Definitely shouldn't override pointer type
   275 // These are not used generically, but should probably be used for purpose intended. Definitely should not override pointer type
   272             Tex: PTexture;          // A texture created by the gear. Shouldn't use for anything but textures
   276             Tex: PTexture;          // A texture created by the gear. Should not use for anything but textures
   273             LinkedGear: PGear;      // Used to track a related gear. Portal pairs for example.
   277             LinkedGear: PGear;      // Used to track a related gear. Portal pairs for example.
   274             Hedgehog: PHedgehog;    // set to CurrentHedgehog on gear creation
   278             Hedgehog: PHedgehog;    // set to CurrentHedgehog on gear creation
   275             SoundChannel: LongInt;  // Used to track a sound the gear started
   279             SoundChannel: LongInt;  // Used to track a sound the gear started
   276             end;
   280             end;
   277     TPGearArray = array of PGear;
   281     TPGearArray = array of PGear;
   413             Flawless: boolean;
   417             Flawless: boolean;
   414             end;
   418             end;
   415 
   419 
   416      cdeclPtr = procedure; cdecl;
   420      cdeclPtr = procedure; cdecl;
   417      cdeclIntPtr = procedure(num: LongInt); cdecl;
   421      cdeclIntPtr = procedure(num: LongInt); cdecl;
       
   422      funcDoublePtr = function: Double;
   418 
   423 
   419      TMobileRecord = record
   424      TMobileRecord = record
   420                      PerformRumble: cdeclIntPtr;
   425                      PerformRumble: cdeclIntPtr;
   421                      GameLoading: cdeclPtr;
   426                      GameLoading: cdeclPtr;
   422                      GameLoaded: cdeclPtr;
   427                      GameLoaded: cdeclPtr;
   452             gidVampiric, gidKarma, gidKing, gidPlaceHog, gidArtillery,
   457             gidVampiric, gidKarma, gidKing, gidPlaceHog, gidArtillery,
   453             gidSolidLand, gidSharedAmmo, gidMineTimer, gidNoMineTimer,
   458             gidSolidLand, gidSharedAmmo, gidMineTimer, gidNoMineTimer,
   454             gidRandomMineTimer, gidDamageModifier, gidResetHealth, gidAISurvival,
   459             gidRandomMineTimer, gidDamageModifier, gidResetHealth, gidAISurvival,
   455             gidInfAttack, gidResetWeps, gidPerHogAmmo, gidTagTeam);
   460             gidInfAttack, gidResetWeps, gidPerHogAmmo, gidTagTeam);
   456 
   461 
       
   462 
   457     TLandArray = packed array of array of LongWord;
   463     TLandArray = packed array of array of LongWord;
   458     TCollisionArray = packed array of array of Word;
   464     TCollisionArray = packed array of array of Word;
       
   465     TDirtyTag = packed array of array of byte;
       
   466 
   459     TPreview  = packed array[0..127, 0..31] of byte;
   467     TPreview  = packed array[0..127, 0..31] of byte;
   460     TDirtyTag = packed array of array of byte;
       
   461 
   468 
   462     PWidgetMovement = ^TWidgetMovement;
   469     PWidgetMovement = ^TWidgetMovement;
   463     TWidgetMovement = record
   470     TWidgetMovement = record
   464         animate   : Boolean;
   471         animate   : Boolean;
   465         source    : TPoint;
   472         source    : TPoint;