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 */
|
||||
zeus::CColor overflowAmbColor = zeus::skClear;
|
||||
zeus::CColor overflowAmbColor = zeus::skBlack;
|
||||
|
||||
/* Averaged light for overflow area lights */
|
||||
CLight overflowLight = CLight::BuildCustom(zeus::skZero3f, zeus::skZero3f, zeus::skBlack,
|
||||
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;
|
||||
|
||||
/* Max significant lights */
|
||||
|
|
|
@ -113,8 +113,11 @@ zeus::CVector3f CCollisionActor::GetScanObjectIndicatorPosition(const CStateMana
|
|||
scanScale = GetSphereRadius();
|
||||
} else {
|
||||
const zeus::CVector3f v = GetBoxSize();
|
||||
float comp = (v.x() < v.y() ? v.y() : v.z());
|
||||
comp = (comp < v.z() ? v.x() : comp);
|
||||
float comp = v.x() >= v.y() ? v.z() : v.y();
|
||||
|
||||
if (comp < v.z()) {
|
||||
comp = v.x();
|
||||
}
|
||||
|
||||
scanScale = 0.5f * comp;
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -3,7 +3,6 @@
|
|||
#include <list>
|
||||
#include <memory>
|
||||
|
||||
#include "Runtime/rstl.hpp"
|
||||
#include "Runtime/Character/CBoneTracking.hpp"
|
||||
#include "Runtime/Character/CIkChain.hpp"
|
||||
#include "Runtime/Character/CRagDoll.hpp"
|
||||
|
@ -11,6 +10,7 @@
|
|||
#include "Runtime/Weapon/CProjectileInfo.hpp"
|
||||
#include "Runtime/World/CPathFindSearch.hpp"
|
||||
#include "Runtime/World/CPatterned.hpp"
|
||||
#include "Runtime/rstl.hpp"
|
||||
|
||||
#include <zeus/CVector3f.hpp>
|
||||
|
||||
|
@ -205,14 +205,12 @@ private:
|
|||
float x8d8_holdPositionTime = 0.f;
|
||||
float x8dc_leashTimer = 0.f;
|
||||
|
||||
static std::list<TUniqueId> mChargePlayerList;
|
||||
|
||||
void UpdateCloak(float dt, CStateManager& mgr);
|
||||
bool ShouldFrenzy(CStateManager& mgr);
|
||||
void SquadReset(CStateManager& mgr);
|
||||
void SquadAdd(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);
|
||||
void UpdateAttacks(float dt, CStateManager& mgr);
|
||||
zeus::CVector3f GetTargetPos(const CStateManager& mgr);
|
||||
|
@ -224,11 +222,11 @@ private:
|
|||
void SetVelocityForJump();
|
||||
void AvoidActors(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;
|
||||
void UpdateHeldPosition(CStateManager& mgr, float dt);
|
||||
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);
|
||||
pas::EStepDirection GetStrafeDir(CStateManager& mgr, float dist) const;
|
||||
|
||||
|
@ -244,14 +242,14 @@ public:
|
|||
|
||||
void CalculateRenderBounds() 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 Death(CStateManager& mgr, const zeus::CVector3f& direction, EScriptObjectState state) override;
|
||||
void KnockBack(const zeus::CVector3f&, CStateManager&, const CDamageInfo& info, EKnockBackType type, bool inDeferred,
|
||||
float magnitude) override;
|
||||
bool IsListening() const override;
|
||||
[[nodiscard]] bool IsListening() const 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;
|
||||
void DetachActorFromPirate() { x7b4_attachedActor = kInvalidUniqueId; }
|
||||
bool AttachActorToPirate(TUniqueId id);
|
||||
|
@ -325,12 +323,12 @@ public:
|
|||
bool BounceFind(CStateManager& mgr, float arg) override;
|
||||
|
||||
CPathFindSearch* GetSearchPath() override;
|
||||
u8 GetModelAlphau8(const CStateManager& mgr) const override;
|
||||
float GetGravityConstant() const override;
|
||||
[[nodiscard]] u8 GetModelAlphau8(const CStateManager& mgr) const override;
|
||||
[[nodiscard]] float GetGravityConstant() const override;
|
||||
CProjectileInfo* GetProjectileInfo() override;
|
||||
bool GetEnableAim() const { return x637_25_enableAim; }
|
||||
bool AllEnergyDrained() const { return x638_30_allEnergyDrained; }
|
||||
TUniqueId GetAttachedActor() const { return x7b4_attachedActor; }
|
||||
bool IsTrooper() const { return x636_24_trooper; }
|
||||
[[nodiscard]] bool GetEnableAim() const { return x637_25_enableAim; }
|
||||
[[nodiscard]] bool AllEnergyDrained() const { return x638_30_allEnergyDrained; }
|
||||
[[nodiscard]] TUniqueId GetAttachedActor() const { return x7b4_attachedActor; }
|
||||
[[nodiscard]] bool IsTrooper() const { return x636_24_trooper; }
|
||||
};
|
||||
} // namespace metaforce::MP1
|
||||
|
|
|
@ -358,8 +358,8 @@ void CElementGen::AccumulateBounds(const zeus::CVector3f& pos, float size) {
|
|||
void CElementGen::UpdateAdvanceAccessParameters(u32 activeParticleCount, s32 particleFrame) {
|
||||
CGenDescription* desc = x28_loadedGenDesc;
|
||||
|
||||
if (activeParticleCount >= x60_advValues.size()) {
|
||||
Log.report(logvisor::Fatal, FMT_STRING("activeParticleCount ({}) >= advValues size ({})"),
|
||||
if (activeParticleCount > x60_advValues.size()) {
|
||||
Log.report(logvisor::Fatal, FMT_STRING("activeParticleCount ({}) > advValues size ({})"),
|
||||
activeParticleCount, x60_advValues.size());
|
||||
}
|
||||
|
||||
|
|
|
@ -92,8 +92,7 @@ void CPhysicsActor::AddMotionState(const CMotionState& mst) {
|
|||
q += mst.xc_orientation;
|
||||
zeus::CQuaternion quat = zeus::CQuaternion::fromNUQuaternion(q);
|
||||
// if (TCastToPtr<CPlayer>(this)) {
|
||||
// printf("ADD %f %f %f\n", float(mst.x0_translation.x()), float(mst.x0_translation.y()),
|
||||
// float(mst.x0_translation.z()));
|
||||
// fmt::print(FMT_STRING("ADD {}\n"), mst.x0_translation);
|
||||
// }
|
||||
SetTransform(zeus::CTransform(quat, x34_transform.origin));
|
||||
|
||||
|
|
|
@ -5,11 +5,13 @@
|
|||
#include "Runtime/Weapon/CGameProjectile.hpp"
|
||||
#include "Runtime/World/CActorParameters.hpp"
|
||||
#include "Runtime/World/CPlayer.hpp"
|
||||
|
||||
#include <logvisor/logvisor.hpp>
|
||||
#include "TCastTo.hpp" // Generated file, do not modify include path
|
||||
|
||||
namespace metaforce {
|
||||
|
||||
namespace {
|
||||
logvisor::Module Log("CScriptTrigger");
|
||||
}
|
||||
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& forceField, ETriggerFlags triggerFlags, bool active,
|
||||
|
@ -24,6 +26,14 @@ CScriptTrigger::CScriptTrigger(TUniqueId uid, std::string_view name, const CEnti
|
|||
, x148_26_deactivateOnEntered(deactivateOnEntered)
|
||||
, x148_27_deactivateOnExited(deactivateOnExited) {
|
||||
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); }
|
||||
|
@ -123,6 +133,9 @@ void CScriptTrigger::UpdateInhabitants(float dt, CStateManager& mgr) {
|
|||
}
|
||||
|
||||
const zeus::CVector3f force = forceMult * x11c_forceField;
|
||||
if (TCastToPtr<CPlayer>(pact)) {
|
||||
fmt::print(FMT_STRING("FORCE {}\n"), force);
|
||||
}
|
||||
if (True(x12c_flags & ETriggerFlags::UseCollisionImpulses)) {
|
||||
pact->ApplyImpulseWR(force, zeus::CAxisAngle());
|
||||
pact->UseCollisionImpulses();
|
||||
|
@ -279,8 +292,7 @@ void CScriptTrigger::Touch(CActor& act, CStateManager& mgr) {
|
|||
EScriptObjectState::Entered);
|
||||
if (act.HealthInfo(mgr) && x100_damageInfo.GetDamage() > 0.f) {
|
||||
mgr.ApplyDamage(x8_uid, act.GetUniqueId(), x8_uid, x100_damageInfo,
|
||||
CMaterialFilter::MakeIncludeExclude({EMaterialTypes::Solid}, {0ull}),
|
||||
zeus::skZero3f);
|
||||
CMaterialFilter::MakeIncludeExclude({EMaterialTypes::Solid}, {0ull}), zeus::skZero3f);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue