diff --git a/Tactical/LOS.cpp b/Tactical/LOS.cpp index ab3467c5..2dc32c79 100644 --- a/Tactical/LOS.cpp +++ b/Tactical/LOS.cpp @@ -7352,7 +7352,7 @@ void CalcTargetMovementOffset( SOLDIERTYPE *pShooter, SOLDIERTYPE *pTarget, OBJE // Again, if the shooter is skilled, this will occur after fewer tiles have been moved. // If the target moves *more* tiles than this, the movement penalty will begin to diminish. That's our shooter // beginning to compensate for the target's speed, pointing the gun ahead of the target ("Leading the target"). - UINT8 uiTilesForMaxPenalty = (100-uiCombinedSkill) / (100 / gGameCTHConstants.MOVEMENT_TRACKING_DIFFICULTY); + INT16 uiTilesForMaxPenalty = (INT16)((100-uiCombinedSkill) / (100 / gGameCTHConstants.MOVEMENT_TRACKING_DIFFICULTY)); UINT8 stance = gAnimControl[ pShooter->usAnimState ].ubEndHeight; @@ -7365,7 +7365,7 @@ void CalcTargetMovementOffset( SOLDIERTYPE *pShooter, SOLDIERTYPE *pTarget, OBJE // after the target moves a smaller number of tiles. INT32 moda = (INT32)(uiTilesForMaxPenalty * GetTargetTrackingModifier( pWeapon, stance )) / 100; INT32 modb = (INT32)(uiTilesForMaxPenalty * GetTargetTrackingModifier( pWeapon, gAnimControl[ pShooter->usAnimState ].ubEndHeight )) / 100; - uiTilesForMaxPenalty += (UINT8)((gGameExternalOptions.ubProneModifierPercentage * moda + (100 - gGameExternalOptions.ubProneModifierPercentage) * modb)/100); + uiTilesForMaxPenalty += (INT16)((gGameExternalOptions.ubProneModifierPercentage * moda + (100 - gGameExternalOptions.ubProneModifierPercentage) * modb)/100); if (uiTilesForMaxPenalty == 0) { diff --git a/Tactical/Weapons.cpp b/Tactical/Weapons.cpp index b92300a1..e9752bbb 100644 --- a/Tactical/Weapons.cpp +++ b/Tactical/Weapons.cpp @@ -5529,11 +5529,11 @@ UINT32 CalcNewChanceToHitGun(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT16 ubAimTi iCombinedSkill /= (gGameCTHConstants.AIM_EXP + gGameCTHConstants.AIM_MARKS + gGameCTHConstants.AIM_WIS + gGameCTHConstants.AIM_DEX); - UINT32 uiCap = (UINT32)iCombinedSkill; + INT32 uiCap = (INT32)iCombinedSkill; // Add percent-based modifier from the gun and its attachments - UINT32 uimoda = (UINT32)(uiCap * GetPercentCapModifier( pInHand, stance )) / 100; - UINT32 uimodb = (UINT32)(uiCap * GetPercentCapModifier( pInHand, gAnimControl[ pSoldier->usAnimState ].ubEndHeight )) / 100; - uiCap += (UINT32)((gGameExternalOptions.ubProneModifierPercentage * uimoda + (100 - gGameExternalOptions.ubProneModifierPercentage) * uimodb)/100); + INT32 uimoda = (INT32)(uiCap * GetPercentCapModifier( pInHand, stance )) / 100; + INT32 uimodb = (INT32)(uiCap * GetPercentCapModifier( pInHand, gAnimControl[ pSoldier->usAnimState ].ubEndHeight )) / 100; + uiCap += (INT32)((gGameExternalOptions.ubProneModifierPercentage * uimoda + (100 - gGameExternalOptions.ubProneModifierPercentage) * uimodb)/100); // Add bonuses from Sniper Skill. Applies only when using a scope at or above its "best" range. INT16 sDifference = 99 - uiCap; @@ -5578,7 +5578,7 @@ UINT32 CalcNewChanceToHitGun(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT16 ubAimTi // cover when applying the maximum number of aiming clicks for this gun. INT32 iMaxAimBonus = uiCap - iChance; - iMaxAimBonus = (UINT32)((iMaxAimBonus * (100+iAimModifier)) / 100); + iMaxAimBonus = (INT32)((iMaxAimBonus * (100+iAimModifier)) / 100); iMaxAimBonus = __max(0, iMaxAimBonus); // can't get less than 0 points for aiming... // factor in scopes under their range