Various bug fixes

This commit is contained in:
Jack Andersen 2018-11-18 15:19:44 -10:00
parent 57c1196599
commit 35a3923cdf
21 changed files with 68 additions and 53 deletions

View File

@ -1957,9 +1957,9 @@ float CBSLocomotion::GetStartVelocityMagnitude(CBodyController& bc)
return 0.f; return 0.f;
} }
void CBSLocomotion::ReStartBodyState(CBodyController& bc, bool b) void CBSLocomotion::ReStartBodyState(CBodyController& bc, bool maintainVel)
{ {
UpdateLocomotionAnimation(0.f, b ? GetStartVelocityMagnitude(bc) : 0.f, bc, true); UpdateLocomotionAnimation(0.f, maintainVel ? GetStartVelocityMagnitude(bc) : 0.f, bc, true);
} }
float CBSLocomotion::ComputeWeightPercentage(const std::pair<s32, float>& a, float CBSLocomotion::ComputeWeightPercentage(const std::pair<s32, float>& a,
@ -1974,7 +1974,7 @@ float CBSLocomotion::ComputeWeightPercentage(const std::pair<s32, float>& a,
void CBSLocomotion::Start(CBodyController& bc, CStateManager& mgr) void CBSLocomotion::Start(CBodyController& bc, CStateManager& mgr)
{ {
x4_locomotionType = bc.GetLocomotionType(); x4_locomotionType = bc.GetLocomotionType();
if (bc.GetCommandMgr().GetCmd(EBodyStateCmd::Thirteen)) if (bc.GetCommandMgr().GetCmd(EBodyStateCmd::MaintainVelocity))
ReStartBodyState(bc, true); ReStartBodyState(bc, true);
else else
ReStartBodyState(bc, false); ReStartBodyState(bc, false);

View File

@ -347,7 +347,7 @@ class CBSLocomotion : public CBodyState
protected: protected:
pas::ELocomotionType x4_locomotionType = pas::ELocomotionType::Invalid; pas::ELocomotionType x4_locomotionType = pas::ELocomotionType::Invalid;
float GetStartVelocityMagnitude(CBodyController& bc); float GetStartVelocityMagnitude(CBodyController& bc);
void ReStartBodyState(CBodyController& bc, bool); void ReStartBodyState(CBodyController& bc, bool maintainVel);
float ComputeWeightPercentage(const std::pair<s32, float>& a, float ComputeWeightPercentage(const std::pair<s32, float>& a,
const std::pair<s32, float>& b, float f) const; const std::pair<s32, float>& b, float f) const;
public: public:

View File

@ -323,7 +323,7 @@ class CBodyStateCmdMgr
CBodyStateCmd x16c_ = {EBodyStateCmd::ExitState}; CBodyStateCmd x16c_ = {EBodyStateCmd::ExitState};
CBodyStateCmd x174_ = {EBodyStateCmd::LeanFromCover}; CBodyStateCmd x174_ = {EBodyStateCmd::LeanFromCover};
CBodyStateCmd x17c_ = {EBodyStateCmd::NextState}; CBodyStateCmd x17c_ = {EBodyStateCmd::NextState};
CBodyStateCmd x184_ = {EBodyStateCmd::Thirteen}; CBodyStateCmd x184_ = {EBodyStateCmd::MaintainVelocity};
CBCGenerateCmd x18c_generate; CBCGenerateCmd x18c_generate;
CBCHurledCmd x1ac_hurled; CBCHurledCmd x1ac_hurled;
CBCJumpCmd x1d0_jump; CBCJumpCmd x1d0_jump;

View File

@ -250,7 +250,7 @@ enum class EBodyStateCmd
ExitState, ExitState,
LeanFromCover, LeanFromCover,
NextState, NextState,
Thirteen, MaintainVelocity,
Generate, Generate,
Hurled, Hurled,
Jump, Jump,

View File

@ -92,6 +92,7 @@ CRayCastResult CCollidableOBBTreeGroup::CastRayInternal(const CInternalRayCastSt
} }
} }
ret.Transform(rayCast.GetTransform());
return ret; return ret;
} }

View File

@ -132,6 +132,12 @@ const CCollisionPrimitive* CCollisionActor::GetCollisionPrimitive() const
return x284_spherePrimitive.get(); return x284_spherePrimitive.get();
} }
EWeaponCollisionResponseTypes CCollisionActor::GetCollisionResponseType(const zeus::CVector3f&, const zeus::CVector3f&,
const CWeaponMode&, EProjectileAttrib) const
{
return x300_responseType;
}
zeus::CTransform CCollisionActor::GetPrimitiveTransform() const zeus::CTransform CCollisionActor::GetPrimitiveTransform() const
{ {
zeus::CTransform xf = x34_transform; zeus::CTransform xf = x34_transform;

View File

@ -47,6 +47,8 @@ public:
void Touch(CActor &, CStateManager &); void Touch(CActor &, CStateManager &);
zeus::CVector3f GetOrbitPosition(const CStateManager &) const; zeus::CVector3f GetOrbitPosition(const CStateManager &) const;
const CCollisionPrimitive* GetCollisionPrimitive() const; const CCollisionPrimitive* GetCollisionPrimitive() const;
EWeaponCollisionResponseTypes GetCollisionResponseType(const zeus::CVector3f&, const zeus::CVector3f&,
const CWeaponMode&, EProjectileAttrib) const;
zeus::CTransform GetPrimitiveTransform() const; zeus::CTransform GetPrimitiveTransform() const;
std::experimental::optional<zeus::CAABox> GetTouchBounds() const; std::experimental::optional<zeus::CAABox> GetTouchBounds() const;
void SetDamageVulnerability(const CDamageVulnerability& vuln); void SetDamageVulnerability(const CDamageVulnerability& vuln);

View File

@ -93,7 +93,7 @@ CGameArchitectureSupport::CGameArchitectureSupport(CMain& parent,
CStreamAudioManager::SetMusicVolume(0x7f); CStreamAudioManager::SetMusicVolume(0x7f);
m->ResetGameState(); m->ResetGameState();
if (!g_tweakGame->GetSplashScreensDisabled()) if (false && !g_tweakGame->GetSplashScreensDisabled())
{ {
std::shared_ptr<CIOWin> splash = std::make_shared<CSplashScreen>(CSplashScreen::ESplashScreen::Nintendo); std::shared_ptr<CIOWin> splash = std::make_shared<CSplashScreen>(CSplashScreen::ESplashScreen::Nintendo);
x58_ioWinManager.AddIOWin(splash, 1000, 10000); x58_ioWinManager.AddIOWin(splash, 1000, 10000);

View File

@ -271,7 +271,7 @@ void CParasite::Think(float dt, CStateManager& mgr)
return; return;
} }
xf8_24_movable = !xf8_24_movable; xf8_24_movable = !x5d6_24_alignToFloor;
if (!x5d6_27_disableMove) if (!x5d6_27_disableMove)
{ {

View File

@ -134,13 +134,13 @@ void CEnergyProjectile::ResolveCollisionWithWorld(const CRayCastResult& res, CSt
if (Explode(res.GetPoint(), res.GetPlane().normal(), crType, mgr, if (Explode(res.GetPoint(), res.GetPlane().normal(), crType, mgr,
CDamageVulnerability::NormalVulnerabilty(), kInvalidUniqueId)) CDamageVulnerability::NormalVulnerabilty(), kInvalidUniqueId))
mgr.ApplyDamageToWorld(xec_ownerId, *this, res.GetPoint(), x12c_curDamageInfo, xf8_filter); mgr.ApplyDamageToWorld(xec_ownerId, *this, res.GetPoint(), x12c_curDamageInfo, xf8_filter);
x2c2_ = kInvalidUniqueId; x2c2_lastResolvedObj = kInvalidUniqueId;
} }
} }
void CEnergyProjectile::ResolveCollisionWithActor(const CRayCastResult& res, CActor& act, CStateManager& mgr) void CEnergyProjectile::ResolveCollisionWithActor(const CRayCastResult& res, CActor& act, CStateManager& mgr)
{ {
x2c2_ = act.GetUniqueId(); x2c2_lastResolvedObj = act.GetUniqueId();
EWeaponCollisionResponseTypes crType = EWeaponCollisionResponseTypes crType =
act.GetCollisionResponseType(res.GetPoint(), x34_transform.basis[1].normalized(), act.GetCollisionResponseType(res.GetPoint(), x34_transform.basis[1].normalized(),
x12c_curDamageInfo.GetWeaponMode(), xe8_projectileAttribs); x12c_curDamageInfo.GetWeaponMode(), xe8_projectileAttribs);
@ -283,7 +283,7 @@ bool CEnergyProjectile::Explode(const zeus::CVector3f& pos, const zeus::CVector3
EVulnerability deflectType = dVuln.GetDeflectionType(x12c_curDamageInfo.GetWeaponMode()); EVulnerability deflectType = dVuln.GetDeflectionType(x12c_curDamageInfo.GetWeaponMode());
switch (deflectType) switch (deflectType)
{ {
case EVulnerability::DoubleDamage: case EVulnerability::Weak:
deflect = false; deflect = false;
break; break;
case EVulnerability::Deflect: case EVulnerability::Deflect:

View File

@ -245,16 +245,16 @@ CGameProjectile::DoCollisionCheck(TUniqueId& idOut, CStateManager& mgr)
void CGameProjectile::ApplyDamageToActors(CStateManager& mgr, const CDamageInfo& dInfo) void CGameProjectile::ApplyDamageToActors(CStateManager& mgr, const CDamageInfo& dInfo)
{ {
if (x2c6_ != kInvalidUniqueId) if (x2c6_pendingDamagee != kInvalidUniqueId)
{ {
if (TCastToPtr<CActor> act = mgr.ObjectById(x2c6_)) if (TCastToPtr<CActor> act = mgr.ObjectById(x2c6_pendingDamagee))
{ {
mgr.ApplyDamage(GetUniqueId(), act->GetUniqueId(), xec_ownerId, dInfo, xf8_filter, x34_transform.basis[1]); mgr.ApplyDamage(GetUniqueId(), act->GetUniqueId(), xec_ownerId, dInfo, xf8_filter, x34_transform.basis[1]);
if ((xe8_projectileAttribs & EProjectileAttrib::PlayerUnFreeze) == EProjectileAttrib::PlayerUnFreeze && if ((xe8_projectileAttribs & EProjectileAttrib::PlayerUnFreeze) == EProjectileAttrib::PlayerUnFreeze &&
mgr.GetPlayer().GetUniqueId() == act->GetUniqueId() && mgr.GetPlayer().GetFrozenState()) mgr.GetPlayer().GetUniqueId() == act->GetUniqueId() && mgr.GetPlayer().GetFrozenState())
mgr.GetPlayer().UnFreeze(mgr); mgr.GetPlayer().UnFreeze(mgr);
} }
x2c6_ = kInvalidUniqueId; x2c6_pendingDamagee = kInvalidUniqueId;
} }
for (CProjectileTouchResult& res : x2d0_touchResults) for (CProjectileTouchResult& res : x2d0_touchResults)
@ -285,7 +285,7 @@ CGameProjectile::RayCollisionCheckWithWorld(TUniqueId& idOut, const zeus::CVecto
{ {
x2d0_touchResults.clear(); x2d0_touchResults.clear();
idOut = kInvalidUniqueId; idOut = kInvalidUniqueId;
x2c6_ = kInvalidUniqueId; x2c6_pendingDamagee = kInvalidUniqueId;
CRayCastResult res; CRayCastResult res;
zeus::CVector3f delta = end - start; zeus::CVector3f delta = end - start;
if (!delta.canBeNormalized()) if (!delta.canBeNormalized())
@ -314,7 +314,7 @@ CGameProjectile::RayCollisionCheckWithWorld(TUniqueId& idOut, const zeus::CVecto
ent->Touch(*this, mgr); ent->Touch(*this, mgr);
bestMag = tRes.GetRayCastResult().GetT(); bestMag = tRes.GetRayCastResult().GetT();
res = tRes.GetRayCastResult(); res = tRes.GetRayCastResult();
x2c6_ = idOut = tRes.GetActorId(); x2c6_pendingDamagee = idOut = tRes.GetActorId();
} }
} }
else else
@ -343,12 +343,12 @@ CGameProjectile::RayCollisionCheckWithWorld(TUniqueId& idOut, const zeus::CVecto
{ {
bestMag = res3.GetT(); bestMag = res3.GetT();
res = res3; res = res3;
x2c6_ = idOut = tRes.GetActorId(); x2c6_pendingDamagee = idOut = tRes.GetActorId();
} }
} }
else if (tb->pointInside(start) || (projObj && projObj->GetProjectileBounds().intersects(*tb))) else if (tb->pointInside(start) || (projObj && projObj->GetProjectileBounds().intersects(*tb)))
{ {
x2c6_ = idOut = ent->GetUniqueId(); x2c6_pendingDamagee = idOut = ent->GetUniqueId();
zeus::CUnitVector3f norm(-dir); zeus::CUnitVector3f norm(-dir);
res = CRayCastResult(0.f, start, {norm, norm.dot(start)}, ent->GetMaterialList()); res = CRayCastResult(0.f, start, {norm, norm.dot(start)}, ent->GetMaterialList());
break; break;
@ -475,7 +475,7 @@ CProjectileTouchResult CGameProjectile::CanCollideWithGameObject(CActor& act, CS
{ {
return {kInvalidUniqueId, {}}; return {kInvalidUniqueId, {}};
} }
else if (act.GetUniqueId() == x2c2_) else if (act.GetUniqueId() == x2c2_lastResolvedObj)
{ {
return {kInvalidUniqueId, {}}; return {kInvalidUniqueId, {}};
} }

View File

@ -38,9 +38,9 @@ protected:
double x2b0_targetHomingTime = 0.0; double x2b0_targetHomingTime = 0.0;
double x2b8_curHomingTime = x2a8_homingDt; double x2b8_curHomingTime = x2a8_homingDt;
TUniqueId x2c0_homingTargetId; TUniqueId x2c0_homingTargetId;
TUniqueId x2c2_ = kInvalidUniqueId; TUniqueId x2c2_lastResolvedObj = kInvalidUniqueId;
TUniqueId x2c4_ = kInvalidUniqueId; TUniqueId x2c4_ = kInvalidUniqueId;
TUniqueId x2c6_ = kInvalidUniqueId; TUniqueId x2c6_pendingDamagee = kInvalidUniqueId;
TUniqueId x2c8_projectileLight = kInvalidUniqueId; TUniqueId x2c8_projectileLight = kInvalidUniqueId;
CAssetId x2cc_wpscId; CAssetId x2cc_wpscId;
std::vector<CProjectileTouchResult> x2d0_touchResults; std::vector<CProjectileTouchResult> x2d0_touchResults;

View File

@ -8,8 +8,6 @@ CWeaponMode::CWeaponMode(EWeaponType type, bool charged, bool comboed, bool inst
{ {
} }
EWeaponType CWeaponMode::GetType() const { return x0_weaponType; }
CWeaponMode CWeaponMode::Invalid() { return CWeaponMode(EWeaponType::None); } CWeaponMode CWeaponMode::Invalid() { return CWeaponMode(EWeaponType::None); }
CWeaponMode CWeaponMode::Phazon() { return CWeaponMode(EWeaponType::Phazon); } CWeaponMode CWeaponMode::Phazon() { return CWeaponMode(EWeaponType::Phazon); }

View File

@ -14,7 +14,7 @@ class CWeaponMode
public: public:
CWeaponMode() { x4_24_charged = false; x4_25_comboed = false; x4_26_instantKill = false; } CWeaponMode() { x4_24_charged = false; x4_25_comboed = false; x4_26_instantKill = false; }
CWeaponMode(EWeaponType, bool charged = false, bool comboed = false, bool instaKill = false); CWeaponMode(EWeaponType, bool charged = false, bool comboed = false, bool instaKill = false);
EWeaponType GetType() const; EWeaponType GetType() const { return x0_weaponType; }
bool IsCharged() const { return x4_24_charged; } bool IsCharged() const { return x4_24_charged; }
bool IsComboed() const { return x4_25_comboed; } bool IsComboed() const { return x4_25_comboed; }

View File

@ -31,7 +31,7 @@ float CDamageInfo::GetDamage(const CDamageVulnerability& dVuln) const
EVulnerability vuln = dVuln.GetVulnerability(x0_weaponMode, false); EVulnerability vuln = dVuln.GetVulnerability(x0_weaponMode, false);
if (vuln == EVulnerability::Deflect) if (vuln == EVulnerability::Deflect)
return 0.f; return 0.f;
else if (vuln == EVulnerability::DoubleDamage) else if (vuln == EVulnerability::Weak)
return 2.f * x8_damage; return 2.f * x8_damage;
return x8_damage; return x8_damage;
@ -42,7 +42,7 @@ float CDamageInfo::GetRadiusDamage(const CDamageVulnerability& dVuln) const
EVulnerability vuln = dVuln.GetVulnerability(x0_weaponMode, false); EVulnerability vuln = dVuln.GetVulnerability(x0_weaponMode, false);
if (vuln == EVulnerability::Deflect) if (vuln == EVulnerability::Deflect)
return 0.f; return 0.f;
else if (vuln == EVulnerability::DoubleDamage) else if (vuln == EVulnerability::Weak)
return 2.f * xc_radiusDamage; return 2.f * xc_radiusDamage;
return xc_radiusDamage; return xc_radiusDamage;

View File

@ -9,7 +9,7 @@ const CDamageVulnerability CDamageVulnerability::sNormalVulnerability(
EVulnerability::Normal, EVulnerability::Normal, EVulnerability::Normal, EVulnerability::Normal, EVulnerability::Normal, EVulnerability::Normal, EVulnerability::Normal, EVulnerability::Normal,
EVulnerability::Normal, EVulnerability::Normal, EVulnerability::Normal, EVulnerability::Normal, EVulnerability::Normal, EVulnerability::Normal, EVulnerability::Normal, EVulnerability::Normal,
EVulnerability::Normal, EVulnerability::Normal, EVulnerability::Normal, EVulnerability::Normal, EVulnerability::Normal, EVulnerability::Normal, EVulnerability::Normal, EVulnerability::Normal,
EVulnerability::Normal, EVulnerability::Normal, EVulnerability::Normal, EVulnerability::DoubleDamage); EVulnerability::Normal, EVulnerability::Normal, EVulnerability::Normal, EVulnerability::Weak);
const CDamageVulnerability CDamageVulnerability::sImmuneVulnerability( const CDamageVulnerability CDamageVulnerability::sImmuneVulnerability(
EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect,
@ -17,7 +17,7 @@ const CDamageVulnerability CDamageVulnerability::sImmuneVulnerability(
EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect,
EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect,
EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect,
EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::DoubleDamage); EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Weak);
/* LOL, thanks retro */ /* LOL, thanks retro */
const CDamageVulnerability CDamageVulnerability::sReflectVulnerability( const CDamageVulnerability CDamageVulnerability::sReflectVulnerability(
EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect,
@ -25,7 +25,7 @@ const CDamageVulnerability CDamageVulnerability::sReflectVulnerability(
EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect,
EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect,
EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect,
EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::DoubleDamage); EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Deflect, EVulnerability::Weak);
const CDamageVulnerability CDamageVulnerability::sPassThroughVulnerability( const CDamageVulnerability CDamageVulnerability::sPassThroughVulnerability(
EVulnerability::PassThrough, EVulnerability::PassThrough, EVulnerability::PassThrough, EVulnerability::PassThrough, EVulnerability::PassThrough, EVulnerability::PassThrough, EVulnerability::PassThrough, EVulnerability::PassThrough,
@ -33,13 +33,18 @@ const CDamageVulnerability CDamageVulnerability::sPassThroughVulnerability(
EVulnerability::PassThrough, EVulnerability::PassThrough, EVulnerability::PassThrough, EVulnerability::PassThrough, EVulnerability::PassThrough, EVulnerability::PassThrough, EVulnerability::PassThrough, EVulnerability::PassThrough,
EVulnerability::PassThrough, EVulnerability::PassThrough, EVulnerability::PassThrough, EVulnerability::PassThrough, EVulnerability::PassThrough, EVulnerability::PassThrough, EVulnerability::PassThrough, EVulnerability::PassThrough,
EVulnerability::PassThrough, EVulnerability::PassThrough, EVulnerability::PassThrough, EVulnerability::PassThrough, EVulnerability::PassThrough, EVulnerability::PassThrough, EVulnerability::PassThrough, EVulnerability::PassThrough,
EVulnerability::PassThrough, EVulnerability::PassThrough, EVulnerability::PassThrough, EVulnerability::DoubleDamage); EVulnerability::PassThrough, EVulnerability::PassThrough, EVulnerability::PassThrough, EVulnerability::Weak);
static inline bool is_not_immune(EVulnerability vuln) static inline bool is_not_immune(EVulnerability vuln)
{ {
return vuln != EVulnerability::Immune && vuln != EVulnerability::DirectImmune; return vuln != EVulnerability::Immune && vuln != EVulnerability::DirectImmune;
} }
static inline bool is_normal_or_weak(EVulnerability vuln)
{
return vuln == EVulnerability::Normal || vuln == EVulnerability::Weak;
}
void CDamageVulnerability::ConstructNew(CInputStream& in, int propCount) void CDamageVulnerability::ConstructNew(CInputStream& in, int propCount)
{ {
propCount -= 3; propCount -= 3;
@ -81,7 +86,7 @@ CDamageVulnerability::CDamageVulnerability(CInputStream& in)
vulns[i] = EVulnerability(in.readUint32Big()); vulns[i] = EVulnerability(in.readUint32Big());
if (propCount == 15) if (propCount == 15)
x5c_deflected = EVulnerability::DoubleDamage; x5c_deflected = EVulnerability::Weak;
else else
x5c_deflected = EVulnerability(in.readUint32Big()); x5c_deflected = EVulnerability(in.readUint32Big());
@ -154,11 +159,13 @@ bool CDamageVulnerability::WeaponHurts(const CWeaponMode& mode, bool ignoreDirec
EVulnerability normalVuln = (&x0_power)[u32(mode.GetType())]; EVulnerability normalVuln = (&x0_power)[u32(mode.GetType())];
bool normalHurts = true; bool normalHurts = true;
if (ignoreDirect) if (ignoreDirect)
normalHurts = is_not_immune(normalVuln); {
normalHurts = is_normal_or_weak(normalVuln);
}
else else
{ {
if (!is_not_immune(normalVuln) && if (!is_normal_or_weak(normalVuln) &&
(normalVuln != EVulnerability::DirectDouble && normalVuln != EVulnerability::DirectNormal)) (normalVuln != EVulnerability::DirectWeak && normalVuln != EVulnerability::DirectNormal))
normalHurts = false; normalHurts = false;
} }
@ -170,16 +177,16 @@ bool CDamageVulnerability::WeaponHurts(const CWeaponMode& mode, bool ignoreDirec
EVulnerability comboedVuln = (&x4c_superMissile)[u32(mode.GetType())]; EVulnerability comboedVuln = (&x4c_superMissile)[u32(mode.GetType())];
if (ignoreDirect) if (ignoreDirect)
{ {
chargedHurts = is_not_immune(chargedVuln); chargedHurts = is_normal_or_weak(chargedVuln);
comboedHurts = is_not_immune(comboedVuln); comboedHurts = is_normal_or_weak(comboedVuln);
} }
else else
{ {
if (!is_not_immune(chargedVuln) && if (!is_normal_or_weak(chargedVuln) &&
(chargedVuln != EVulnerability::DirectDouble && chargedVuln != EVulnerability::DirectNormal)) (chargedVuln != EVulnerability::DirectWeak && chargedVuln != EVulnerability::DirectNormal))
chargedHurts = false; chargedHurts = false;
if (!is_not_immune(comboedVuln) && if (!is_normal_or_weak(comboedVuln) &&
(comboedVuln != EVulnerability::DirectDouble && comboedVuln != EVulnerability::DirectNormal)) (comboedVuln != EVulnerability::DirectWeak && comboedVuln != EVulnerability::DirectNormal))
comboedHurts = false; comboedHurts = false;
} }
} }
@ -258,8 +265,8 @@ EVulnerability CDamageVulnerability::GetVulnerability(const CWeaponMode& mode, b
if (ignoreDirect) if (ignoreDirect)
return vuln; return vuln;
if (vuln == EVulnerability::DirectDouble) if (vuln == EVulnerability::DirectWeak)
return EVulnerability::DoubleDamage; return EVulnerability::Weak;
else if (vuln == EVulnerability::DirectNormal) else if (vuln == EVulnerability::DirectNormal)
return EVulnerability::Normal; return EVulnerability::Normal;
else if (vuln == EVulnerability::DirectImmune) else if (vuln == EVulnerability::DirectImmune)

View File

@ -8,12 +8,12 @@ namespace urde
enum class EVulnerability enum class EVulnerability
{ {
DoubleDamage, Weak,
Normal, Normal,
Deflect, Deflect,
Immune, Immune,
PassThrough, PassThrough,
DirectDouble, DirectWeak,
DirectNormal, DirectNormal,
DirectImmune DirectImmune
}; };

View File

@ -1099,7 +1099,7 @@ void CPatterned::Burn(float duration, float damage)
{ {
switch (GetDamageVulnerability()->GetVulnerability(CWeaponMode(EWeaponType::Plasma), false)) switch (GetDamageVulnerability()->GetVulnerability(CWeaponMode(EWeaponType::Plasma), false))
{ {
case EVulnerability::DoubleDamage: case EVulnerability::Weak:
x450_bodyController->SetOnFire(1.5f * duration); x450_bodyController->SetOnFire(1.5f * duration);
x3ec_pendingFireDamage = 1.5f * damage; x3ec_pendingFireDamage = 1.5f * damage;
break; break;
@ -1116,7 +1116,7 @@ void CPatterned::Shock(float duration, float damage)
{ {
switch (GetDamageVulnerability()->GetVulnerability(CWeaponMode(EWeaponType::Wave), false)) switch (GetDamageVulnerability()->GetVulnerability(CWeaponMode(EWeaponType::Wave), false))
{ {
case EVulnerability::DoubleDamage: case EVulnerability::Weak:
x450_bodyController->SetElectrocuting(1.5f * duration); x450_bodyController->SetElectrocuting(1.5f * duration);
x3f0_pendingShockDamage = 1.5f * damage; x3f0_pendingShockDamage = 1.5f * damage;
break; break;

View File

@ -29,6 +29,7 @@ const float CPlayerCameraBob::kCameraDamping = 6.f * std::sqrt(80.f);
CPlayerCameraBob::CPlayerCameraBob(ECameraBobType type, const zeus::CVector2f& vec, float bobPeriod) CPlayerCameraBob::CPlayerCameraBob(ECameraBobType type, const zeus::CVector2f& vec, float bobPeriod)
: x0_type(type), x4_vec(vec), xc_bobPeriod(bobPeriod) : x0_type(type), x4_vec(vec), xc_bobPeriod(bobPeriod)
{ {
std::fill(std::begin(x7c_wanderPoints), std::end(x7c_wanderPoints), zeus::CVector3f::skForward);
} }
zeus::CTransform CPlayerCameraBob::GetViewWanderTransform() const { return xd0_viewWanderXf; } zeus::CTransform CPlayerCameraBob::GetViewWanderTransform() const { return xd0_viewWanderXf; }
@ -107,19 +108,19 @@ void CPlayerCameraBob::UpdateViewWander(float dt, CStateManager& mgr)
{ {
zeus::CVector3f pt = zeus::getCatmullRomSplinePoint( zeus::CVector3f pt = zeus::getCatmullRomSplinePoint(
x7c_wanderPoints[xcc_wanderIndex], x7c_wanderPoints[(xcc_wanderIndex + 1) & 3], x7c_wanderPoints[xcc_wanderIndex], x7c_wanderPoints[(xcc_wanderIndex + 1) & 3],
x7c_wanderPoints[(xcc_wanderIndex + 2) & 3], x7c_wanderPoints[(xcc_wanderIndex + 3) & 3], dt); x7c_wanderPoints[(xcc_wanderIndex + 2) & 3], x7c_wanderPoints[(xcc_wanderIndex + 3) & 3], xc4_wanderTime);
pt.x *= x100_wanderMagnitude; pt.x *= x100_wanderMagnitude;
pt.z *= x100_wanderMagnitude; pt.z *= x100_wanderMagnitude;
zeus::CTransform orient = zeus::CTransform::RotateY(( zeus::CTransform orient = zeus::CTransform::RotateY((
zeus::getCatmullRomSplinePoint(xb0_wanderPitches[xcc_wanderIndex], xb0_wanderPitches[(xcc_wanderIndex + 1) & 3], zeus::getCatmullRomSplinePoint(xb0_wanderPitches[xcc_wanderIndex], xb0_wanderPitches[(xcc_wanderIndex + 1) & 3],
xb0_wanderPitches[(xcc_wanderIndex + 2) & 3], xb0_wanderPitches[(xcc_wanderIndex + 2) & 3],
xb0_wanderPitches[(xcc_wanderIndex + 3) & 3], dt) * xb0_wanderPitches[(xcc_wanderIndex + 3) & 3], xc4_wanderTime) *
x100_wanderMagnitude)); x100_wanderMagnitude));
xd0_viewWanderXf = zeus::lookAt(zeus::CVector3f::skZero, pt, zeus::CVector3f::skUp) * orient; xd0_viewWanderXf = zeus::lookAt(zeus::CVector3f::skZero, pt, zeus::CVector3f::skUp) * orient;
xc4_wanderTime = (xc8_viewWanderSpeed * xc4_wanderTime) + dt; xc4_wanderTime += xc8_viewWanderSpeed * dt;
if (xc4_wanderTime > 1.f) if (xc4_wanderTime >= 1.f)
{ {
x7c_wanderPoints[xcc_wanderIndex] = CalculateRandomViewWanderPosition(mgr); x7c_wanderPoints[xcc_wanderIndex] = CalculateRandomViewWanderPosition(mgr);
xb0_wanderPitches[xcc_wanderIndex] = CalculateRandomViewWanderPitch(mgr); xb0_wanderPitches[xcc_wanderIndex] = CalculateRandomViewWanderPitch(mgr);

View File

@ -69,8 +69,8 @@ private:
float x70_landingTranslation = 0.f; float x70_landingTranslation = 0.f;
float x74_camVelocity = 0.f; float x74_camVelocity = 0.f;
float x78_camTranslation = 0.f; float x78_camTranslation = 0.f;
zeus::CVector3f x7c_wanderPoints[4] = {zeus::CVector3f{0.f, 1.f, 0.f}}; zeus::CVector3f x7c_wanderPoints[4];
float xb0_wanderPitches[4] = {0.f}; float xb0_wanderPitches[4] = {};
float xc4_wanderTime = 0.f; float xc4_wanderTime = 0.f;
float xc8_viewWanderSpeed = kViewWanderSpeedMin; float xc8_viewWanderSpeed = kViewWanderSpeedMin;
u32 xcc_wanderIndex = 0; u32 xcc_wanderIndex = 0;

@ -1 +1 @@
Subproject commit 91cdaddfd976307c6d97982831c39c1b5110c47b Subproject commit b5b8de3aa8a5ca846b90b653496d33fbd2f5dbab