1 #ifndef __WEAPONS_H 2 #define __WEAPONS_H 3 4 #include "Item_Types.h" 5 #include "JA2Types.h" 6 #include "Sound_Control.h" 7 8 struct CalibreModel; 9 10 11 #define MAXCHANCETOHIT (gamepolicy(chance_to_hit_maximum)) 12 #define MINCHANCETOHIT (gamepolicy(chance_to_hit_minimum)) 13 14 #define BAD_DODGE_POSITION_PENALTY 20 15 16 #define GUN_BARREL_RANGE_BONUS 100 17 18 // Special deaths can only occur within a limited distance to the target 19 #define MAX_DISTANCE_FOR_MESSY_DEATH 7 20 // If you do a lot of damage with a close-range shot, instant kill 21 #define MIN_DAMAGE_FOR_INSTANT_KILL 55 22 // If you happen to kill someone with a close-range shot doing a lot of damage to the head, head explosion 23 #define MIN_DAMAGE_FOR_HEAD_EXPLOSION 45 24 // If you happen to kill someone with a close-range shot doing a lot of damage to the chest, chest explosion 25 // This value is lower than head because of the damage bonus for shooting the head 26 #define MIN_DAMAGE_FOR_BLOWN_AWAY 30 27 // If you happen to hit someone in the legs for enough damage, REGARDLESS of distance, person falls down 28 // Leg damage is halved for these purposes 29 #define MIN_DAMAGE_FOR_AUTO_FALL_OVER 20 30 31 // short range at which being prone provides to hit penalty when shooting standing people 32 #define MIN_PRONE_RANGE 50 33 34 // can't miss at this range? 35 #define POINT_BLANK_RANGE 16 36 37 #define BODY_IMPACT_ABSORPTION 20 38 39 #define BUCKSHOT_SHOTS 9 40 41 #define MIN_MORTAR_RANGE 150 // minimum range of a mortar 42 43 // WEAPON CLASSES 44 enum 45 { 46 NOGUNCLASS, 47 HANDGUNCLASS, 48 SMGCLASS, 49 RIFLECLASS, 50 MGCLASS, 51 SHOTGUNCLASS, 52 KNIFECLASS, 53 MONSTERCLASS, 54 NUM_WEAPON_CLASSES 55 }; 56 57 // ARMOUR CLASSES 58 enum 59 { 60 ARMOURCLASS_HELMET, 61 ARMOURCLASS_VEST, 62 ARMOURCLASS_LEGGINGS, 63 ARMOURCLASS_PLATE, 64 ARMOURCLASS_MONST, 65 ARMOURCLASS_VEHICLE 66 }; 67 68 enum 69 { 70 AMMO_REGULAR = 0, 71 AMMO_HP, 72 AMMO_AP, 73 AMMO_SUPER_AP, 74 AMMO_BUCKSHOT, 75 AMMO_FLECHETTE, 76 AMMO_GRENADE, 77 AMMO_MONSTER, 78 AMMO_KNIFE, 79 AMMO_HE, 80 AMMO_HEAT, 81 AMMO_SLEEP_DART, 82 AMMO_FLAME, 83 }; 84 85 enum 86 { 87 EXPLOSV_NORMAL, 88 EXPLOSV_STUN, 89 EXPLOSV_TEARGAS, 90 EXPLOSV_MUSTGAS, 91 EXPLOSV_FLARE, 92 EXPLOSV_NOISE, 93 EXPLOSV_SMOKE, 94 EXPLOSV_CREATUREGAS, 95 }; 96 97 #define AMMO_DAMAGE_ADJUSTMENT_BUCKSHOT( x ) (x / 4) 98 #define NUM_BUCKSHOT_PELLETS 9 99 100 // hollow point bullets do lots of damage to people 101 #define AMMO_DAMAGE_ADJUSTMENT_HP( x ) ( (x * 17) / 10 ) 102 // but they SUCK at penetrating armour 103 #define AMMO_ARMOUR_ADJUSTMENT_HP( x ) ( (x * 3) / 2 ) 104 // armour piercing bullets are good at penetrating armour 105 #define AMMO_ARMOUR_ADJUSTMENT_AP( x ) ((x * 3) / 4) 106 // "super" AP bullets are great at penetrating armour 107 #define AMMO_ARMOUR_ADJUSTMENT_SAP( x ) (x / 2) 108 109 // high explosive damage value (PRIOR to armour subtraction) 110 #define AMMO_DAMAGE_ADJUSTMENT_HE( x ) ((x * 4) / 3) 111 112 // but they SUCK at penetrating armour 113 #define AMMO_STRUCTURE_ADJUSTMENT_HP( x ) (x * 2) 114 // armour piercing bullets are good at penetrating structure 115 #define AMMO_STRUCTURE_ADJUSTMENT_AP( x ) ( (x * 3 ) / 4) 116 // "super" AP bullets are great at penetrating structures 117 #define AMMO_STRUCTURE_ADJUSTMENT_SAP( x ) ( x / 2 ) 118 119 // one quarter of punching damage is "real" rather than breath damage 120 #define PUNCH_REAL_DAMAGE_PORTION 4 121 122 #define AIM_BONUS_SAME_TARGET 10 // chance-to-hit bonus (in %) 123 #define AIM_BONUS_PER_AP 10 // chance-to-hit bonus (in %) for aim 124 #define AIM_BONUS_CROUCHING 10 125 #define AIM_BONUS_PRONE 20 126 #define AIM_BONUS_TWO_HANDED_PISTOL 5 127 #define AIM_BONUS_FIRING_DOWN 15 128 #define AIM_PENALTY_ONE_HANDED_PISTOL 5 129 #define AIM_PENALTY_DUAL_PISTOLS 20 130 #define AIM_PENALTY_SMG 5 131 #define AIM_PENALTY_GASSED 50 132 #define AIM_PENALTY_GETTINGAID 20 133 #define AIM_PENALTY_PER_SHOCK 5 // 5% penalty per point of shock 134 #define AIM_BONUS_TARGET_HATED 20 135 #define AIM_BONUS_PSYCHO 15 136 #define AIM_PENALTY_TARGET_BUDDY 20 137 #define AIM_PENALTY_BURSTING 10 138 #define AIM_PENALTY_GENTLEMAN 15 139 #define AIM_PENALTY_TARGET_CROUCHED 20 140 #define AIM_PENALTY_TARGET_PRONE 40 141 #define AIM_PENALTY_BLIND 80 142 #define AIM_PENALTY_FIRING_UP 25 143 144 struct ARMOURTYPE 145 { 146 UINT8 ubArmourClass; 147 UINT8 ubProtection; 148 UINT8 ubDegradePercent; 149 }; 150 151 struct EXPLOSIVETYPE 152 { 153 UINT8 ubType; // type of explosive 154 UINT8 ubDamage; // damage value 155 UINT8 ubStunDamage; // stun amount / 100 156 UINT8 ubRadius; // radius of effect 157 UINT8 ubVolume; // sound radius of explosion 158 UINT8 ubVolatility; // maximum chance of accidental explosion 159 UINT8 ubAnimationID; // Animation enum to use 160 }; 161 162 //GLOBALS 163 164 extern ARMOURTYPE const Armour[]; 165 extern EXPLOSIVETYPE const Explosive[]; 166 167 INT8 EffectiveArmour(const OBJECTTYPE* pObj); 168 extern INT8 ArmourVersusExplosivesPercent( SOLDIERTYPE * pSoldier ); 169 extern BOOLEAN FireWeapon( SOLDIERTYPE *pSoldier , INT16 sTargetGridNo ); 170 void WeaponHit(SOLDIERTYPE* target, UINT16 usWeaponIndex, INT16 sDamage, INT16 sBreathLoss, UINT16 usDirection, INT16 sXPos, INT16 sYPos, INT16 sZPos, INT16 sRange, SOLDIERTYPE* attacker, UINT8 ubSpecial, UINT8 ubHitLocation); 171 void StructureHit(BULLET* b, INT16 sXPos, INT16 sYPos, INT16 sZPos, UINT16 usStructureID, INT32 iImpact, BOOLEAN fStopped); 172 extern void WindowHit( INT16 sGridNo, UINT16 usStructureID, BOOLEAN fBlowWindowSouth, BOOLEAN fLargeForce ); 173 extern INT32 BulletImpact( SOLDIERTYPE *pFirer, SOLDIERTYPE * pTarget, UINT8 ubHitLocation, INT32 iImpact, INT16 sHitBy, UINT8 * pubSpecial ); 174 BOOLEAN InRange(const SOLDIERTYPE* pSoldier, INT16 sGridNo); 175 void ShotMiss(const BULLET* b); 176 extern UINT32 CalcChanceToHitGun(SOLDIERTYPE *pSoldier, UINT16 sGridNo, UINT8 ubAimTime, UINT8 ubAimPos, BOOLEAN fModify); 177 extern UINT32 AICalcChanceToHitGun(SOLDIERTYPE *pSoldier, UINT16 sGridNo, UINT8 ubAimTime, UINT8 ubAimPos ); 178 extern UINT32 CalcChanceToPunch(SOLDIERTYPE *pAttacker, SOLDIERTYPE * pDefender, UINT8 ubAimTime); 179 extern UINT32 CalcChanceToStab(SOLDIERTYPE * pAttacker,SOLDIERTYPE *pDefender, UINT8 ubAimTime); 180 void ReloadWeapon(SOLDIERTYPE*, UINT8 inv_pos); 181 bool IsGunBurstCapable(SOLDIERTYPE const*, UINT8 inv_pos); 182 extern INT32 CalcBodyImpactReduction( UINT8 ubAmmoType, UINT8 ubHitLocation ); 183 INT32 TotalArmourProtection(SOLDIERTYPE&, UINT8 ubHitLocation, INT32 iImpact, UINT8 ubAmmoType); 184 INT8 ArmourPercent(const SOLDIERTYPE* pSoldier); 185 186 extern void GetTargetWorldPositions( SOLDIERTYPE *pSoldier, INT16 sTargetGridNo, FLOAT *pdXPos, FLOAT *pdYPos, FLOAT *pdZPos ); 187 188 extern BOOLEAN OKFireWeapon( SOLDIERTYPE *pSoldier ); 189 extern BOOLEAN CheckForGunJam( SOLDIERTYPE * pSoldier ); 190 191 INT32 CalcMaxTossRange(const SOLDIERTYPE* pSoldier, UINT16 usItem, BOOLEAN fArmed); 192 extern UINT32 CalcThrownChanceToHit(SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 ubAimTime, UINT8 ubAimPos ); 193 194 extern void ChangeWeaponMode( SOLDIERTYPE * pSoldier ); 195 196 void UseHandToHand(SOLDIERTYPE* pSoldier, INT16 sTargetGridNo, BOOLEAN fStealing); 197 198 void DishoutQueenSwipeDamage( SOLDIERTYPE *pQueenSoldier ); 199 200 INT32 HTHImpact(const SOLDIERTYPE* pSoldier, const SOLDIERTYPE* pTarget, INT32 iHitBy, BOOLEAN fBladeAttack); 201 202 UINT16 GunRange(OBJECTTYPE const&); 203 204 extern BOOLEAN gfNextFireJam; 205 extern BOOLEAN gfNextShotKills; 206 extern BOOLEAN gfReportHitChances; 207 208 #endif 209