WeaponHits/Hurts fixes

Former-commit-id: d7b2bd3479
This commit is contained in:
Phillip Stephens 2022-10-01 15:13:35 -07:00
parent 72e31ef65b
commit eedecae300
1 changed files with 31 additions and 34 deletions

View File

@ -95,33 +95,33 @@ CDamageVulnerability::CDamageVulnerability(EVulnerability power, EVulnerability
EVulnerability enemyWp2, EVulnerability enemyWp3, EVulnerability enemyWp2, EVulnerability enemyWp3,
EVulnerability enemyWp4, EVulnerability v1, EVulnerability enemyWp4, EVulnerability v1,
EVulnerability v2, EDeflectionType deflectType) { EVulnerability v2, EDeflectionType deflectType) {
this->x0_normal[0] = power; x0_normal[0] = power;
this->x0_normal[1] = ice; x0_normal[1] = ice;
this->x0_normal[2] = wave; x0_normal[2] = wave;
this->x0_normal[3] = plasma; x0_normal[3] = plasma;
this->x0_normal[4] = bomb; x0_normal[4] = bomb;
this->x0_normal[5] = powerBomb; x0_normal[5] = powerBomb;
this->x0_normal[6] = missile; x0_normal[6] = missile;
this->x0_normal[7] = boostBall; x0_normal[7] = boostBall;
this->x0_normal[8] = phazon; x0_normal[8] = phazon;
this->x0_normal[9] = enemyWp1; x0_normal[9] = enemyWp1;
this->x0_normal[10] = enemyWp2; x0_normal[10] = enemyWp2;
this->x0_normal[0xb] = enemyWp3; x0_normal[11] = enemyWp3;
this->x0_normal[0xc] = enemyWp4; x0_normal[12] = enemyWp4;
this->x0_normal[0xd] = v1; x0_normal[13] = v1;
this->x0_normal[0xe] = v2; x0_normal[14] = v2;
this->x3c_charged[0] = this->x0_normal[0]; x3c_charged[0] = x0_normal[0];
this->x4c_combo[0] = this->x0_normal[0]; x4c_combo[0] = x0_normal[0];
this->x3c_charged[1] = this->x0_normal[1]; x3c_charged[1] = x0_normal[1];
this->x4c_combo[1] = this->x0_normal[1]; x4c_combo[1] = x0_normal[1];
this->x3c_charged[2] = this->x0_normal[2]; x3c_charged[2] = x0_normal[2];
this->x4c_combo[2] = this->x0_normal[2]; x4c_combo[2] = x0_normal[2];
this->x3c_charged[3] = this->x0_normal[3]; x3c_charged[3] = x0_normal[3];
this->x4c_combo[3] = this->x0_normal[3]; x4c_combo[3] = x0_normal[3];
x5c_deflect = deflectType; x5c_deflect = deflectType;
} }
static inline bool check_hurts(EVulnerability vuln, bool direct) { static inline bool check_hurts(EVulnerability vuln, int direct) {
return direct == 0 return direct == 0
? (is_normal_or_weak(vuln) || vuln == kVN_DirectWeak || vuln == kVN_DirectNormal) ? (is_normal_or_weak(vuln) || vuln == kVN_DirectWeak || vuln == kVN_DirectNormal)
: is_normal_or_weak(vuln); : is_normal_or_weak(vuln);
@ -149,16 +149,13 @@ bool CDamageVulnerability::WeaponHurts(const CWeaponMode& mode, int ignoreDirect
} }
static inline bool check_hits(EVulnerability vuln, int direct) { static inline bool check_hits(EVulnerability vuln, int direct) {
if (!direct) { if (!direct) {
return is_not_deflect(vuln); return is_not_deflect(vuln);
} }
if (vuln == kVN_Deflect || if (vuln == kVN_Deflect || ((u32)vuln - kVN_DirectWeak <= kVN_Normal) || vuln == kVN_DirectImmune) {
(static_cast< EVulnerability >(static_cast< u32 >(vuln) - return false;
static_cast< u32 >(kVN_DirectWeak)) <= kVN_Normal) || }
vuln == kVN_DirectImmune) { return true;
return false;
}
return true;
} }
bool CDamageVulnerability::WeaponHits(const CWeaponMode& mode, int checkDirect) const { bool CDamageVulnerability::WeaponHits(const CWeaponMode& mode, int checkDirect) const {