ACTOR.H 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. #ifndef __ACTOR_H
  2. #define __ACTOR_H
  3. #include "globals.h"
  4. #include "qav.h"
  5. #include "db.h"
  6. #include "misc.h"
  7. #define kGroundFriction 20
  8. // Player movement types
  9. enum {
  10. kMoveDead = 0,
  11. kMoveStill,
  12. kMoveWalk,
  13. kMoveFall,
  14. kMoveLand,
  15. kMoveStand,
  16. kMoveSwim,
  17. kMoveFly,
  18. kMoveHang,
  19. };
  20. // Damage types
  21. enum DAMAGE_TYPE
  22. {
  23. kDamagePummel = 0, // punching/pummel/impact/crush
  24. kDamageFall, // damage from falling (landing, actually)
  25. kDamageBurn, // burning/heat/fire
  26. kDamageBullet, // bullets or other piercing projectiles
  27. kDamageStab, // stabbing, impaling, slicing, dicing
  28. kDamageExplode, // explosion damage from concussive effect
  29. kDamageGas, // damage from inhaling poison gas
  30. kDamageDrown, // been underwater too long, eh?
  31. kDamageSpirit, // ectoplasm or spirit damage
  32. kDamageVoodoo, // hoodoo voodoo damage
  33. kDamageMax
  34. };
  35. #define kNoDamage 31 // no damage constant for damage shift table
  36. enum VECTOR_TYPE
  37. {
  38. kVectorNone = -1,
  39. kVectorTine = 0,
  40. kVectorShell,
  41. kVectorBullet,
  42. kVectorBulletAP,
  43. kVectorAxe,
  44. kVectorCleaver,
  45. kVectorClaw,
  46. kVectorHoundBite,
  47. kVectorRatBite,
  48. kVectorSpiderBite,
  49. kVectorMax,
  50. };
  51. #define kMaxBurnTime (30 * kTimerRate) // 30 seconds
  52. /* effect types */
  53. enum {
  54. ET_Splash1, // splash from dude landing in water
  55. ET_Splash2, // splash from bullet hitting water
  56. ET_Ricochet1, // bullet ricochet off stone/metal
  57. ET_Ricochet2, // bullet ricochet off wood
  58. ET_Squib1, // bloody squib
  59. ET_SmokeTrail, // smoke trail for fireball
  60. };
  61. struct SPRITEHIT
  62. {
  63. int moveHit;
  64. int ceilHit;
  65. int floorHit;
  66. };
  67. extern SPRITEHIT gSpriteHit[ kMaxXSprites ];
  68. struct ITEMDATA
  69. {
  70. ushort cstat;
  71. sshort picnum;
  72. schar shade;
  73. uchar pal;
  74. uchar xrepeat, yrepeat;
  75. short statnum;
  76. short type;
  77. ushort flags;
  78. };
  79. struct AMMOITEMDATA
  80. {
  81. ushort cstat;
  82. sshort picnum;
  83. schar shade;
  84. uchar pal;
  85. uchar xrepeat, yrepeat;
  86. ushort flags;
  87. short count;
  88. uchar ammoType;
  89. uchar weaponType;
  90. };
  91. struct WEAPONITEMDATA
  92. {
  93. ushort cstat;
  94. sshort picnum;
  95. schar shade;
  96. uchar pal;
  97. uchar xrepeat, yrepeat;
  98. ushort flags;
  99. short weaponType;
  100. short ammoType;
  101. short count;
  102. };
  103. // ammo and power up constants
  104. #define kMaxItemTypes (kItemMax - kItemBase)
  105. #define kMaxPowerUps (kItemMax - kItemBase)
  106. extern ITEMDATA gItemData[ kMaxItemTypes ];
  107. extern AMMOITEMDATA gAmmoItemData[ kAmmoItemMax - kAmmoItemBase ];
  108. extern WEAPONITEMDATA gWeaponItemData[ kWeaponItemMax - kWeaponItemBase ];
  109. /***********************************************************************
  110. * Function Prototypes
  111. **********************************************************************/
  112. void actInit( void );
  113. void actAllocateSpares( void );
  114. BOOL actHealDude(XSPRITE *pXSprite, int healValue, int maxHealthClip = 100);
  115. void actDamageSprite( int nSource, int nSprite, DAMAGE_TYPE damageType, int damageValue );
  116. void actProcessSprites( void );
  117. int actSpawnSprite( short nSector, int x, int y, int z, short nStatus, BOOL bAddXSprite );
  118. int actCloneSprite( SPRITE *pSprite );
  119. SPRITE *actSpawnEffect( short nSector, int x, int y, int z, int nEffect );
  120. void actExplodeSprite( int nSprite );
  121. BOOL actCheckRespawn( int nSprite );
  122. void actRespawnSprite( int nSprite ); // respawn dude or item
  123. int actSpawnThing( short nSector, int x, int y, int z, int nThing );
  124. int actFireThing( int nActor, int z, int nSlope, int thingType, int velocity );
  125. void actFireMissile( int nActor, int z, int dx, int dy, int dz, int missileType );
  126. void actFireVector( int nActor, int z, int dx, int dy, int dz, VECTOR_TYPE vectorType );
  127. void actPostSprite( int nSprite, int nStatus );
  128. void actPostProcess( void );
  129. /***********************************************************************
  130. * Inline Functions
  131. **********************************************************************/
  132. inline BOOL IsPlayerSprite( SPRITE *pSprite )
  133. {
  134. return (pSprite->type >= kDudePlayer1 && pSprite->type <= kDudePlayer8) ? TRUE : FALSE;
  135. }
  136. inline BOOL IsPlayerSprite( int nSprite )
  137. {
  138. return IsPlayerSprite(&sprite[nSprite]);
  139. }
  140. inline BOOL IsDudeSprite( SPRITE *pSprite )
  141. {
  142. return (pSprite->type >= kDudeBase && pSprite->type < kDudeMax) ? TRUE : FALSE;
  143. }
  144. inline BOOL IsDudeSprite( int nSprite )
  145. {
  146. return IsDudeSprite(&sprite[nSprite]);
  147. }
  148. inline void actAddBurnTime( int nBurnSource, XSPRITE *pXActor, int nBurnTime )
  149. {
  150. pXActor->burnTime = ClipHigh(pXActor->burnTime + nBurnTime, kMaxBurnTime );
  151. pXActor->burnSource = (short)nBurnSource;
  152. }
  153. inline int actGetBurnTime( XSPRITE *pXActor )
  154. {
  155. return pXActor->burnTime;
  156. }
  157. #endif //__ACTOR_H