hedgewars/uTypes.pas
branchwebgl
changeset 9244 bb95e351270c
parent 9197 e4e366013e9a
child 9248 3e8558dc285a
equal deleted inserted replaced
9242:c07f341adad9 9244:bb95e351270c
    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             ptShaders);
    48             ptSuddenDeath, ptButtons, ptShaders);
    49 
    49 
    50     // Available sprites for displaying stuff
    50     // Available sprites for displaying stuff
    51     TSprite = (sprWater, sprCloud, sprBomb, sprBigDigit, sprFrame,
    51     TSprite = (sprWater, sprCloud, sprBomb, sprBigDigit, sprFrame,
    52             sprLag, sprArrow, sprBazookaShell, sprTargetP, sprBee,
    52             sprLag, sprArrow, sprBazookaShell, sprTargetP, sprBee,
    53             sprSmokeTrace, sprRopeHook, sprExplosion50, sprMineOff,
    53             sprSmokeTrace, sprRopeHook, sprExplosion50, sprMineOff,
    85             sprCheese, sprHandCheese, sprHandFlamethrower, sprChunk, sprNote,
    85             sprCheese, sprHandCheese, sprHandFlamethrower, sprChunk, sprNote,
    86             sprSMineOff, sprSMineOn, sprHandSMine, sprHammer,
    86             sprSMineOff, sprSMineOn, sprHandSMine, sprHammer,
    87             sprHandResurrector, sprCross, sprAirDrill, sprNapalmBomb,
    87             sprHandResurrector, sprCross, sprAirDrill, sprNapalmBomb,
    88             sprBulletHit, sprSnowball, sprHandSnowball, sprSnow,
    88             sprBulletHit, sprSnowball, sprHandSnowball, sprSnow,
    89             sprSDFlake, sprSDWater, sprSDCloud, sprSDSplash, sprSDDroplet, sprTardis,
    89             sprSDFlake, sprSDWater, sprSDCloud, sprSDSplash, sprSDDroplet, sprTardis,
    90             sprSlider, sprBotlevels, sprHandKnife, sprKnife, sprStar, sprIceTexture, sprIceGun, sprFrozenHog
    90             sprSlider, sprBotlevels, sprHandKnife, sprKnife, sprStar, sprIceTexture, sprIceGun,
       
    91             sprFrozenHog
    91             );
    92             );
    92 
    93 
    93     // Gears that interact with other Gears and/or Land
    94     // Gears that interact with other Gears and/or Land
    94     TGearType = ({-->}gtFlame, gtHedgehog, gtMine, gtCase, gtExplosives, // <-- these are gears which should be avoided when searching a spawn place
    95     TGearType = (gtFlame, gtHedgehog, gtMine, gtCase, gtExplosives, // these gears should be avoided when searching a spawn place
    95             gtGrenade, gtShell, gtGrave, gtBee, // 8
    96             gtGrenade, gtShell, gtGrave, gtBee, // 8
    96             gtShotgunShot, gtPickHammer, gtRope,  // 11
    97             gtShotgunShot, gtPickHammer, gtRope,  // 11
    97             gtDEagleShot, gtDynamite, gtClusterBomb, gtCluster, gtShover, // 16
    98             gtDEagleShot, gtDynamite, gtClusterBomb, gtCluster, gtShover, // 16
    98             gtFirePunch, gtATStartGame, // 18
    99             gtFirePunch, gtATStartGame, // 18
    99             gtATFinishGame, gtParachute, gtAirAttack, gtAirBomb, gtBlowTorch, // 23
   100             gtATFinishGame, gtParachute, gtAirAttack, gtAirBomb, gtBlowTorch, // 23
   137             sndNooo, sndHello, sndRopeShot, sndRopeAttach, sndRopeRelease,
   138             sndNooo, sndHello, sndRopeShot, sndRopeAttach, sndRopeRelease,
   138             sndSwitchHog, sndVictory, sndFlawless, sndSniperReload, sndSteps, sndLowGravity,
   139             sndSwitchHog, sndVictory, sndFlawless, sndSniperReload, sndSteps, sndLowGravity,
   139             sndHellishImpact1, sndHellishImpact2, sndHellishImpact3, sndHellishImpact4,
   140             sndHellishImpact1, sndHellishImpact2, sndHellishImpact3, sndHellishImpact4,
   140             sndMelonImpact, sndDroplet1, sndDroplet2, sndDroplet3, sndEggBreak, sndDrillRocket,
   141             sndMelonImpact, sndDroplet1, sndDroplet2, sndDroplet3, sndEggBreak, sndDrillRocket,
   141             sndPoisonCough, sndPoisonMoan, sndBirdyLay, sndWhistle, sndBeeWater,
   142             sndPoisonCough, sndPoisonMoan, sndBirdyLay, sndWhistle, sndBeeWater,
   142             sndPiano0, sndPiano1, sndPiano2, sndPiano3, sndPiano4, sndPiano5, sndPiano6, sndPiano7, sndPiano8,
   143             sndPiano0, sndPiano1, sndPiano2, sndPiano3, sndPiano4, sndPiano5, sndPiano6, sndPiano7,
   143             sndSkip, sndSineGun, sndOoff1, sndOoff2, sndOoff3, sndWhack,
   144             sndPiano8, sndSkip, sndSineGun, sndOoff1, sndOoff2, sndOoff3, sndWhack,
   144             sndComeonthen, sndParachute, sndBump, sndResurrector, sndPlane, sndTardis, sndFrozenHogImpact, sndIceBeam, sndHogFreeze
   145             sndComeonthen, sndParachute, sndBump, sndResurrector, sndPlane, sndTardis, sndFrozenHogImpact,
       
   146             sndIceBeam, sndHogFreeze
   145             );
   147             );
   146 
   148 
   147     // Available ammo types to be used by hedgehogs
   149     // Available ammo types to be used by hedgehogs
   148     TAmmoType  = (amNothing, amGrenade, amClusterBomb, amBazooka, amBee, amShotgun, amPickHammer, // 6
   150     TAmmoType  = (amNothing, amGrenade, amClusterBomb, amBazooka, amBee, amShotgun, amPickHammer, // 6
   149             amSkip, amRope, amMine, amDEagle, amDynamite, amFirePunch, amWhip, // 13
   151             amSkip, amRope, amMine, amDEagle, amDynamite, amFirePunch, amWhip, // 13
   151             amGirder, amTeleport, amSwitch, amMortar, amKamikaze, amCake, // 24
   153             amGirder, amTeleport, amSwitch, amMortar, amKamikaze, amCake, // 24
   152             amSeduction, amWatermelon, amHellishBomb, amNapalm, amDrill, amBallgun, // 30
   154             amSeduction, amWatermelon, amHellishBomb, amNapalm, amDrill, amBallgun, // 30
   153             amRCPlane, amLowGravity, amExtraDamage, amInvulnerable, amExtraTime, // 35
   155             amRCPlane, amLowGravity, amExtraDamage, amInvulnerable, amExtraTime, // 35
   154             amLaserSight, amVampiric, amSniperRifle, amJetpack, amMolotov, amBirdy, amPortalGun, // 42
   156             amLaserSight, amVampiric, amSniperRifle, amJetpack, amMolotov, amBirdy, amPortalGun, // 42
   155             amPiano, amGasBomb, amSineGun, amFlamethrower, amSMine, amHammer, // 48
   157             amPiano, amGasBomb, amSineGun, amFlamethrower, amSMine, amHammer, // 48
   156             amResurrector, amDrillStrike, amSnowball, amTardis, {amStructure,} amLandGun, amIceGun, amKnife); // 54
   158             amResurrector, amDrillStrike, amSnowball, amTardis, {amStructure,} amLandGun, amIceGun,
       
   159             amKnife // 54
       
   160             );
   157 
   161 
   158     // Different kind of crates that e.g. hedgehogs can pick up
   162     // Different kind of crates that e.g. hedgehogs can pick up
   159     TCrateType = (HealthCrate, AmmoCrate, UtilityCrate);
   163     TCrateType = (HealthCrate, AmmoCrate, UtilityCrate);
   160 
   164 
   161     THWFont = (fnt16, fntBig, fntSmall {$IFNDEF MOBILE}, CJKfnt16, CJKfntBig, CJKfntSmall{$ENDIF});
   165     THWFont = (fnt16, fntBig, fntSmall {$IFNDEF MOBILE}, CJKfnt16, CJKfntBig, CJKfntSmall{$ENDIF});
   166     TStatInfoType = (siGameResult, siMaxStepDamage, siMaxStepKills, siKilledHHs,
   170     TStatInfoType = (siGameResult, siMaxStepDamage, siMaxStepKills, siKilledHHs,
   167             siClanHealth, siTeamStats, siPlayerKills, siMaxTeamDamage,
   171             siClanHealth, siTeamStats, siPlayerKills, siMaxTeamDamage,
   168             siMaxTeamKills, siMaxTurnSkips, siCustomAchievement, siGraphTitle,
   172             siMaxTeamKills, siMaxTurnSkips, siCustomAchievement, siGraphTitle,
   169             siPointType);
   173             siPointType);
   170 
   174 
   171     // Various "emote" animations a hedgehog can do
   175     // Various 'emote' animations a hedgehog can do
   172     TWave = (waveRollup, waveSad, waveWave, waveHurrah, waveLemonade, waveShrug, waveJuggle);
   176     TWave = (waveRollup, waveSad, waveWave, waveHurrah, waveLemonade, waveShrug, waveJuggle);
   173 
   177 
   174     TRenderMode = (rmDefault, rmLeftEye, rmRightEye);
   178     TRenderMode = (rmDefault, rmLeftEye, rmRightEye);
   175     TStereoMode = (smNone, smRedCyan, smCyanRed, smRedBlue, smBlueRed, smRedGreen, smGreenRed, smHorizontal, smVertical);
   179     TStereoMode = (smNone, smRedCyan, smCyanRed, smRedBlue, smBlueRed, smRedGreen, smGreenRed,
       
   180                    smHorizontal, smVertical);
   176 
   181 
   177     THHFont = record
   182     THHFont = record
   178             Handle: PTTF_Font;
   183             Handle: PTTF_Font;
   179             Height: LongInt;
   184             Height: LongInt;
   180             style: LongInt;
   185             style: LongInt;
   183 
   188 
   184     PAmmo = ^TAmmo;
   189     PAmmo = ^TAmmo;
   185     TAmmo = record
   190     TAmmo = record
   186             Propz: LongWord;
   191             Propz: LongWord;
   187             Count: LongWord;
   192             Count: LongWord;
   188 (* Using for place hedgehogs mode, but for any other situation where the initial count would be needed I guess.
   193 // Using for place hedgehogs mode, but for any other situation where the initial count would be needed I guess.
   189 For example, say, a mode where the weaponset is reset each turn, or on sudden death *)
   194 // For example, say, a mode where the weaponset is reset each turn, or on sudden death
   190             NumPerTurn: LongWord;
   195             NumPerTurn: LongWord;
   191             Timer: LongWord;
   196             Timer: LongWord;
   192             Pos: LongWord;
   197             Pos: LongWord;
   193             AmmoType: TAmmoType;
   198             AmmoType: TAmmoType;
   194             AttackVoice: TSound;
   199             AttackVoice: TSound;
   223     PHedgehog = ^THedgehog;
   228     PHedgehog = ^THedgehog;
   224     PTeam     = ^TTeam;
   229     PTeam     = ^TTeam;
   225     PClan     = ^TClan;
   230     PClan     = ^TClan;
   226 
   231 
   227     TGearStepProcedure = procedure (Gear: PGear);
   232     TGearStepProcedure = procedure (Gear: PGear);
   228 // So, you're here looking for variables you can (ab)use to store some gear state?
   233 // So, you are here looking for variables you can (ab)use to store some gear state?
   229 // 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.
   234 // 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.
   230     TGear = record
   235     TGear = record
   231 // Don't ever override these.
   236 // Do *not* ever override these.
   232             NextGear, PrevGear: PGear;  // Linked list
   237             NextGear, PrevGear: PGear;  // Linked list
   233             Z: Longword;                // Z index. For rendering. Sets order in list
   238             Z: Longword;                // Z index. For rendering. Sets order in list
   234             Active: Boolean;            // Is gear Active (running step code)
   239             Active: Boolean;            // Is gear Active (running step code)
   235             Kind: TGearType;
   240             Kind: TGearType;
   236             doStep: TGearStepProcedure; // Code the gear is running
   241             doStep: TGearStepProcedure; // Code the gear is running
   256             Elasticity: hwFloat;
   261             Elasticity: hwFloat;
   257             Friction  : hwFloat;
   262             Friction  : hwFloat;
   258             Density   : hwFloat; // Density is kind of a mix of size and density. Impacts distance thrown, wind.
   263             Density   : hwFloat; // Density is kind of a mix of size and density. Impacts distance thrown, wind.
   259             ImpactSound: TSound; // first sound, others have to be after it in the sounds def.
   264             ImpactSound: TSound; // first sound, others have to be after it in the sounds def.
   260             nImpactSounds: Word; // count of ImpactSounds.
   265             nImpactSounds: Word; // count of ImpactSounds.
   261 // Don't use these if you want to take damage normally, otherwise health/damage are commonly used for other purposes
   266 // Do not use these if you want to take damage normally, otherwise health/damage are commonly used for other purposes
   262             Invulnerable: Boolean;
   267             Invulnerable: Boolean;
   263             Health, Damage, Karma: LongInt;
   268             Health, Damage, Karma: LongInt;
   264 // 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
   269 // 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
   265             DirAngle: real;
   270             DirAngle: real;
   266 // These are frequently overridden to serve some other purpose
   271 // These are frequently overridden to serve some other purpose
   267             Pos: Longword;           // Commonly overridden.  Example use is posCase values in uConsts.
   272             Pos: Longword;           // Commonly overridden.  Example use is posCase values in uConsts.
   268             Angle, Power : Longword; // Used for hog aiming/firing.  Angle is rarely used as an Angle otherwise.
   273             Angle, Power : Longword; // Used for hog aiming/firing.  Angle is rarely used as an Angle otherwise.
   269             Timer : LongWord;        // Typically used for some sort of gear timer. Time to explosion, remaining fuel...
   274             Timer : LongWord;        // Typically used for some sort of gear timer. Time to explosion, remaining fuel...
   270             Tag: LongInt;            // Quite generic. Variety of uses.
   275             Tag: LongInt;            // Quite generic. Variety of uses.
   271             FlightTime: Longword;    // Initially added for batting of hogs to determine homerun. Used for some firing delays
   276             FlightTime: Longword;    // Initially added for batting of hogs to determine homerun. Used for some firing delays
   272             MsgParam: LongWord;      // Initially stored a set of messages. So usually gm values like Message. Frequently overriden
   277             MsgParam: LongWord;      // Initially stored a set of messages. So usually gm values like Message. Frequently overriden
   273 // These are not used generically, but should probably be used for purpose intended. Definitely shouldn't override pointer type
   278 // These are not used generically, but should probably be used for purpose intended. Definitely should not override pointer type
   274             Tex: PTexture;          // A texture created by the gear. Shouldn't use for anything but textures
   279             Tex: PTexture;          // A texture created by the gear. Should not use for anything but textures
   275             LinkedGear: PGear;      // Used to track a related gear. Portal pairs for example.
   280             LinkedGear: PGear;      // Used to track a related gear. Portal pairs for example.
   276             Hedgehog: PHedgehog;    // set to CurrentHedgehog on gear creation
   281             Hedgehog: PHedgehog;    // set to CurrentHedgehog on gear creation
   277             SoundChannel: LongInt;  // Used to track a sound the gear started
   282             SoundChannel: LongInt;  // Used to track a sound the gear started
   278             end;
   283             end;
   279     TPGearArray = array of PGear;
   284     TPGearArray = array of PGear;
   403             end;
   408             end;
   404 
   409 
   405     TClan = record
   410     TClan = record
   406             Color: Longword;
   411             Color: Longword;
   407             Teams: array[0..Pred(cMaxTeams)] of PTeam;
   412             Teams: array[0..Pred(cMaxTeams)] of PTeam;
   408         TeamsNumber: LongInt;{xymeng, org:LongWord}
   413             TeamsNumber: LongInt;{xymeng, org:LongWord}
   409             TagTeamIndex: Longword;
   414             TagTeamIndex: Longword;
   410             CurrTeam: LongWord;
   415             CurrTeam: LongWord;
   411             ClanHealth: LongInt;
   416             ClanHealth: LongInt;
   412             ClanIndex: LongInt;
   417             ClanIndex: LongInt;
   413         TurnNumber: LongInt;{xymeng, org:LongWord}
   418             TurnNumber: LongInt;{xymeng, org:LongWord}
   414             Flawless: boolean;
   419             Flawless: boolean;
   415             end;
   420             end;
   416 
   421 
   417      cdeclPtr = procedure; cdecl;
   422      cdeclPtr = procedure; cdecl;
   418      cdeclIntPtr = procedure(num: LongInt); cdecl;
   423      cdeclIntPtr = procedure(num: LongInt); cdecl;
   472         startTime : Longword;
   477         startTime : Longword;
   473         end;
   478         end;
   474 
   479 
   475     POnScreenWidget = ^TOnScreenWidget;
   480     POnScreenWidget = ^TOnScreenWidget;
   476     TOnScreenWidget = record
   481     TOnScreenWidget = record
   477         show          : boolean;                      // if false widget will not be drawn
   482         show          : boolean;             // if false widget will not be drawn
   478         sprite        : TSprite;                    // a convenience type
   483         sprite        : TSprite;             // a convenience type
   479         frame         : TSDL_Rect;                   // graphical coordinates
   484         frame         : TSDL_Rect;           // graphical coordinates
   480         active        : TSDL_Rect;                  // active touch region
   485         active        : TSDL_Rect;           // active touch region
   481         fadeAnimStart : Longword;            // time the fade started, 0 means don't fade
   486         fadeAnimStart : Longword;            // time the fade started, 0 means do not fade
   482         moveAnim      : TWidgetMovement;          // the animation associated to the widget
   487         moveAnim      : TWidgetMovement;     // the animation associated to the widget
   483         end;
   488         end;
   484 
   489 
   485 {$IFDEF SDL13}
   490 {$IFDEF SDL13}
   486     PTouch_Data = ^TTouch_Data;
   491     PTouch_Data = ^TTouch_Data;
   487     TTouch_Data = record
   492     TTouch_Data = record