mirror of https://github.com/AxioDL/metaforce.git
Code cleanup
This commit is contained in:
parent
e9b4cce6db
commit
128015baa6
|
@ -289,12 +289,12 @@ bool CActorLights::BuildAreaLightList(const CStateManager& mgr, const CGameArea&
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Ambient color for overflow area lights */
|
/* Ambient color for overflow area lights */
|
||||||
zeus::CColor overflowAmbColor = zeus::skClear;
|
zeus::CColor overflowAmbColor = zeus::skBlack;
|
||||||
|
|
||||||
/* Averaged light for overflow area lights */
|
/* Averaged light for overflow area lights */
|
||||||
CLight overflowLight = CLight::BuildCustom(zeus::skZero3f, zeus::skZero3f, zeus::skBlack,
|
CLight overflowLight = CLight::BuildCustom(zeus::skZero3f, zeus::skZero3f, zeus::skBlack,
|
||||||
0.f, 0.f, 0.f, 0.f, 0.f, 0.f);
|
0.f, 0.f, 0.f, 0.f, 0.f, 0.f);
|
||||||
zeus::CColor overflowLightColor = zeus::skClear;
|
zeus::CColor overflowLightColor = zeus::skBlack;
|
||||||
float overflowMag = 0.f;
|
float overflowMag = 0.f;
|
||||||
|
|
||||||
/* Max significant lights */
|
/* Max significant lights */
|
||||||
|
|
|
@ -113,8 +113,11 @@ zeus::CVector3f CCollisionActor::GetScanObjectIndicatorPosition(const CStateMana
|
||||||
scanScale = GetSphereRadius();
|
scanScale = GetSphereRadius();
|
||||||
} else {
|
} else {
|
||||||
const zeus::CVector3f v = GetBoxSize();
|
const zeus::CVector3f v = GetBoxSize();
|
||||||
float comp = (v.x() < v.y() ? v.y() : v.z());
|
float comp = v.x() >= v.y() ? v.z() : v.y();
|
||||||
comp = (comp < v.z() ? v.x() : comp);
|
|
||||||
|
if (comp < v.z()) {
|
||||||
|
comp = v.x();
|
||||||
|
}
|
||||||
|
|
||||||
scanScale = 0.5f * comp;
|
scanScale = 0.5f * comp;
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -3,7 +3,6 @@
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include "Runtime/rstl.hpp"
|
|
||||||
#include "Runtime/Character/CBoneTracking.hpp"
|
#include "Runtime/Character/CBoneTracking.hpp"
|
||||||
#include "Runtime/Character/CIkChain.hpp"
|
#include "Runtime/Character/CIkChain.hpp"
|
||||||
#include "Runtime/Character/CRagDoll.hpp"
|
#include "Runtime/Character/CRagDoll.hpp"
|
||||||
|
@ -11,6 +10,7 @@
|
||||||
#include "Runtime/Weapon/CProjectileInfo.hpp"
|
#include "Runtime/Weapon/CProjectileInfo.hpp"
|
||||||
#include "Runtime/World/CPathFindSearch.hpp"
|
#include "Runtime/World/CPathFindSearch.hpp"
|
||||||
#include "Runtime/World/CPatterned.hpp"
|
#include "Runtime/World/CPatterned.hpp"
|
||||||
|
#include "Runtime/rstl.hpp"
|
||||||
|
|
||||||
#include <zeus/CVector3f.hpp>
|
#include <zeus/CVector3f.hpp>
|
||||||
|
|
||||||
|
@ -205,14 +205,12 @@ private:
|
||||||
float x8d8_holdPositionTime = 0.f;
|
float x8d8_holdPositionTime = 0.f;
|
||||||
float x8dc_leashTimer = 0.f;
|
float x8dc_leashTimer = 0.f;
|
||||||
|
|
||||||
static std::list<TUniqueId> mChargePlayerList;
|
|
||||||
|
|
||||||
void UpdateCloak(float dt, CStateManager& mgr);
|
void UpdateCloak(float dt, CStateManager& mgr);
|
||||||
bool ShouldFrenzy(CStateManager& mgr);
|
bool ShouldFrenzy(CStateManager& mgr);
|
||||||
void SquadReset(CStateManager& mgr);
|
void SquadReset(CStateManager& mgr);
|
||||||
void SquadAdd(CStateManager& mgr);
|
void SquadAdd(CStateManager& mgr);
|
||||||
void SquadRemove(CStateManager& mgr);
|
void SquadRemove(CStateManager& mgr);
|
||||||
bool CheckTargetable(const CStateManager& mgr) const;
|
[[nodiscard]] bool CheckTargetable(const CStateManager& mgr) const;
|
||||||
bool FireProjectile(float dt, CStateManager& mgr);
|
bool FireProjectile(float dt, CStateManager& mgr);
|
||||||
void UpdateAttacks(float dt, CStateManager& mgr);
|
void UpdateAttacks(float dt, CStateManager& mgr);
|
||||||
zeus::CVector3f GetTargetPos(const CStateManager& mgr);
|
zeus::CVector3f GetTargetPos(const CStateManager& mgr);
|
||||||
|
@ -224,11 +222,11 @@ private:
|
||||||
void SetVelocityForJump();
|
void SetVelocityForJump();
|
||||||
void AvoidActors(CStateManager& mgr);
|
void AvoidActors(CStateManager& mgr);
|
||||||
void UpdateCantSeePlayer(CStateManager& mgr);
|
void UpdateCantSeePlayer(CStateManager& mgr);
|
||||||
bool LineOfSightTest(const CStateManager& mgr, const zeus::CVector3f& eyePos, const zeus::CVector3f& targetPos,
|
[[nodiscard]] bool LineOfSightTest(const CStateManager& mgr, const zeus::CVector3f& eyePos, const zeus::CVector3f& targetPos,
|
||||||
const CMaterialList& excludeList) const;
|
const CMaterialList& excludeList) const;
|
||||||
void UpdateHeldPosition(CStateManager& mgr, float dt);
|
void UpdateHeldPosition(CStateManager& mgr, float dt);
|
||||||
void CheckBlade(CStateManager& mgr);
|
void CheckBlade(CStateManager& mgr);
|
||||||
bool CantJumpBack(const CStateManager& mgr, const zeus::CVector3f& dir, float dist) const;
|
[[nodiscard]] bool CantJumpBack(const CStateManager& mgr, const zeus::CVector3f& dir, float dist) const;
|
||||||
void UpdateLeashTimer(float dt);
|
void UpdateLeashTimer(float dt);
|
||||||
pas::EStepDirection GetStrafeDir(CStateManager& mgr, float dist) const;
|
pas::EStepDirection GetStrafeDir(CStateManager& mgr, float dist) const;
|
||||||
|
|
||||||
|
@ -244,14 +242,14 @@ public:
|
||||||
|
|
||||||
void CalculateRenderBounds() override;
|
void CalculateRenderBounds() override;
|
||||||
void Touch(CActor& other, CStateManager& mgr) override;
|
void Touch(CActor& other, CStateManager& mgr) override;
|
||||||
zeus::CAABox GetSortingBounds(const CStateManager& mgr) const override;
|
[[nodiscard]] zeus::CAABox GetSortingBounds(const CStateManager& mgr) const override;
|
||||||
void DoUserAnimEvent(CStateManager& mgr, const CInt32POINode& node, EUserEventType type, float dt) override;
|
void DoUserAnimEvent(CStateManager& mgr, const CInt32POINode& node, EUserEventType type, float dt) override;
|
||||||
void Death(CStateManager& mgr, const zeus::CVector3f& direction, EScriptObjectState state) override;
|
void Death(CStateManager& mgr, const zeus::CVector3f& direction, EScriptObjectState state) override;
|
||||||
void KnockBack(const zeus::CVector3f&, CStateManager&, const CDamageInfo& info, EKnockBackType type, bool inDeferred,
|
void KnockBack(const zeus::CVector3f&, CStateManager&, const CDamageInfo& info, EKnockBackType type, bool inDeferred,
|
||||||
float magnitude) override;
|
float magnitude) override;
|
||||||
bool IsListening() const override;
|
[[nodiscard]] bool IsListening() const override;
|
||||||
bool Listen(const zeus::CVector3f&, EListenNoiseType) override;
|
bool Listen(const zeus::CVector3f&, EListenNoiseType) override;
|
||||||
zeus::CVector3f GetOrigin(const CStateManager& mgr, const CTeamAiRole& role,
|
[[nodiscard]] zeus::CVector3f GetOrigin(const CStateManager& mgr, const CTeamAiRole& role,
|
||||||
const zeus::CVector3f& aimPos) const override;
|
const zeus::CVector3f& aimPos) const override;
|
||||||
void DetachActorFromPirate() { x7b4_attachedActor = kInvalidUniqueId; }
|
void DetachActorFromPirate() { x7b4_attachedActor = kInvalidUniqueId; }
|
||||||
bool AttachActorToPirate(TUniqueId id);
|
bool AttachActorToPirate(TUniqueId id);
|
||||||
|
@ -325,12 +323,12 @@ public:
|
||||||
bool BounceFind(CStateManager& mgr, float arg) override;
|
bool BounceFind(CStateManager& mgr, float arg) override;
|
||||||
|
|
||||||
CPathFindSearch* GetSearchPath() override;
|
CPathFindSearch* GetSearchPath() override;
|
||||||
u8 GetModelAlphau8(const CStateManager& mgr) const override;
|
[[nodiscard]] u8 GetModelAlphau8(const CStateManager& mgr) const override;
|
||||||
float GetGravityConstant() const override;
|
[[nodiscard]] float GetGravityConstant() const override;
|
||||||
CProjectileInfo* GetProjectileInfo() override;
|
CProjectileInfo* GetProjectileInfo() override;
|
||||||
bool GetEnableAim() const { return x637_25_enableAim; }
|
[[nodiscard]] bool GetEnableAim() const { return x637_25_enableAim; }
|
||||||
bool AllEnergyDrained() const { return x638_30_allEnergyDrained; }
|
[[nodiscard]] bool AllEnergyDrained() const { return x638_30_allEnergyDrained; }
|
||||||
TUniqueId GetAttachedActor() const { return x7b4_attachedActor; }
|
[[nodiscard]] TUniqueId GetAttachedActor() const { return x7b4_attachedActor; }
|
||||||
bool IsTrooper() const { return x636_24_trooper; }
|
[[nodiscard]] bool IsTrooper() const { return x636_24_trooper; }
|
||||||
};
|
};
|
||||||
} // namespace metaforce::MP1
|
} // namespace metaforce::MP1
|
||||||
|
|
|
@ -358,8 +358,8 @@ void CElementGen::AccumulateBounds(const zeus::CVector3f& pos, float size) {
|
||||||
void CElementGen::UpdateAdvanceAccessParameters(u32 activeParticleCount, s32 particleFrame) {
|
void CElementGen::UpdateAdvanceAccessParameters(u32 activeParticleCount, s32 particleFrame) {
|
||||||
CGenDescription* desc = x28_loadedGenDesc;
|
CGenDescription* desc = x28_loadedGenDesc;
|
||||||
|
|
||||||
if (activeParticleCount >= x60_advValues.size()) {
|
if (activeParticleCount > x60_advValues.size()) {
|
||||||
Log.report(logvisor::Fatal, FMT_STRING("activeParticleCount ({}) >= advValues size ({})"),
|
Log.report(logvisor::Fatal, FMT_STRING("activeParticleCount ({}) > advValues size ({})"),
|
||||||
activeParticleCount, x60_advValues.size());
|
activeParticleCount, x60_advValues.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -91,10 +91,9 @@ void CPhysicsActor::AddMotionState(const CMotionState& mst) {
|
||||||
zeus::CNUQuaternion q{x34_transform.buildMatrix3f()};
|
zeus::CNUQuaternion q{x34_transform.buildMatrix3f()};
|
||||||
q += mst.xc_orientation;
|
q += mst.xc_orientation;
|
||||||
zeus::CQuaternion quat = zeus::CQuaternion::fromNUQuaternion(q);
|
zeus::CQuaternion quat = zeus::CQuaternion::fromNUQuaternion(q);
|
||||||
// if (TCastToPtr<CPlayer>(this)) {
|
// if (TCastToPtr<CPlayer>(this)) {
|
||||||
// printf("ADD %f %f %f\n", float(mst.x0_translation.x()), float(mst.x0_translation.y()),
|
// fmt::print(FMT_STRING("ADD {}\n"), mst.x0_translation);
|
||||||
// float(mst.x0_translation.z()));
|
// }
|
||||||
//}
|
|
||||||
SetTransform(zeus::CTransform(quat, x34_transform.origin));
|
SetTransform(zeus::CTransform(quat, x34_transform.origin));
|
||||||
|
|
||||||
SetTranslation(x34_transform.origin + mst.x0_translation);
|
SetTranslation(x34_transform.origin + mst.x0_translation);
|
||||||
|
|
|
@ -5,11 +5,13 @@
|
||||||
#include "Runtime/Weapon/CGameProjectile.hpp"
|
#include "Runtime/Weapon/CGameProjectile.hpp"
|
||||||
#include "Runtime/World/CActorParameters.hpp"
|
#include "Runtime/World/CActorParameters.hpp"
|
||||||
#include "Runtime/World/CPlayer.hpp"
|
#include "Runtime/World/CPlayer.hpp"
|
||||||
|
#include <logvisor/logvisor.hpp>
|
||||||
#include "TCastTo.hpp" // Generated file, do not modify include path
|
#include "TCastTo.hpp" // Generated file, do not modify include path
|
||||||
|
|
||||||
namespace metaforce {
|
namespace metaforce {
|
||||||
|
namespace {
|
||||||
|
logvisor::Module Log("CScriptTrigger");
|
||||||
|
}
|
||||||
CScriptTrigger::CScriptTrigger(TUniqueId uid, std::string_view name, const CEntityInfo& info,
|
CScriptTrigger::CScriptTrigger(TUniqueId uid, std::string_view name, const CEntityInfo& info,
|
||||||
const zeus::CVector3f& pos, const zeus::CAABox& bounds, const CDamageInfo& dInfo,
|
const zeus::CVector3f& pos, const zeus::CAABox& bounds, const CDamageInfo& dInfo,
|
||||||
const zeus::CVector3f& forceField, ETriggerFlags triggerFlags, bool active,
|
const zeus::CVector3f& forceField, ETriggerFlags triggerFlags, bool active,
|
||||||
|
@ -24,6 +26,14 @@ CScriptTrigger::CScriptTrigger(TUniqueId uid, std::string_view name, const CEnti
|
||||||
, x148_26_deactivateOnEntered(deactivateOnEntered)
|
, x148_26_deactivateOnEntered(deactivateOnEntered)
|
||||||
, x148_27_deactivateOnExited(deactivateOnExited) {
|
, x148_27_deactivateOnExited(deactivateOnExited) {
|
||||||
SetCallTouch(false);
|
SetCallTouch(false);
|
||||||
|
#ifdef NDEBUG
|
||||||
|
// FIXME: HACK This fixes the HotE softlock, definitely need to look into the morphball's collision codepath and
|
||||||
|
// FIXME: determine the proper fix
|
||||||
|
if (GetEditorId() == 0x0034004B) {
|
||||||
|
Log.report(logvisor::Warning, FMT_STRING("BUG THIS!: Overriding forceField.x() for trigger {} in area {}"), GetEditorId(), GetAreaIdAlways());
|
||||||
|
x11c_forceField.x() = 0.f;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void CScriptTrigger::Accept(IVisitor& visitor) { visitor.Visit(this); }
|
void CScriptTrigger::Accept(IVisitor& visitor) { visitor.Visit(this); }
|
||||||
|
@ -123,6 +133,9 @@ void CScriptTrigger::UpdateInhabitants(float dt, CStateManager& mgr) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const zeus::CVector3f force = forceMult * x11c_forceField;
|
const zeus::CVector3f force = forceMult * x11c_forceField;
|
||||||
|
if (TCastToPtr<CPlayer>(pact)) {
|
||||||
|
fmt::print(FMT_STRING("FORCE {}\n"), force);
|
||||||
|
}
|
||||||
if (True(x12c_flags & ETriggerFlags::UseCollisionImpulses)) {
|
if (True(x12c_flags & ETriggerFlags::UseCollisionImpulses)) {
|
||||||
pact->ApplyImpulseWR(force, zeus::CAxisAngle());
|
pact->ApplyImpulseWR(force, zeus::CAxisAngle());
|
||||||
pact->UseCollisionImpulses();
|
pact->UseCollisionImpulses();
|
||||||
|
@ -279,8 +292,7 @@ void CScriptTrigger::Touch(CActor& act, CStateManager& mgr) {
|
||||||
EScriptObjectState::Entered);
|
EScriptObjectState::Entered);
|
||||||
if (act.HealthInfo(mgr) && x100_damageInfo.GetDamage() > 0.f) {
|
if (act.HealthInfo(mgr) && x100_damageInfo.GetDamage() > 0.f) {
|
||||||
mgr.ApplyDamage(x8_uid, act.GetUniqueId(), x8_uid, x100_damageInfo,
|
mgr.ApplyDamage(x8_uid, act.GetUniqueId(), x8_uid, x100_damageInfo,
|
||||||
CMaterialFilter::MakeIncludeExclude({EMaterialTypes::Solid}, {0ull}),
|
CMaterialFilter::MakeIncludeExclude({EMaterialTypes::Solid}, {0ull}), zeus::skZero3f);
|
||||||
zeus::skZero3f);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue