mirror of https://github.com/AxioDL/metaforce.git
Implement remaining CStateManager stubs
This commit is contained in:
parent
2530163a8c
commit
1731cae418
|
@ -33,6 +33,9 @@ struct ITweakPlayer : ITweak
|
|||
virtual float GetX14C() const=0; // x14c
|
||||
virtual float GetLeftLogicalThreshold() const=0;
|
||||
virtual float GetRightLogicalThreshold() const=0;
|
||||
virtual float GetVariaDamageReduction() const=0;
|
||||
virtual float GetGravityDamageReduction() const=0;
|
||||
virtual float GetPhazonDamageReduction() const=0;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -438,11 +438,11 @@ void CTweakPlayer::read(athena::io::IStreamReader& __dna_reader)
|
|||
/* x2fc_ */
|
||||
x2fc_ = __dna_reader.readUint32Big();
|
||||
/* x300_ */
|
||||
x300_ = __dna_reader.readFloatBig();
|
||||
x300_variaDamageReduction = __dna_reader.readFloatBig();
|
||||
/* x304_ */
|
||||
x304_ = __dna_reader.readFloatBig();
|
||||
x304_gravityDamageReduction = __dna_reader.readFloatBig();
|
||||
/* x308_ */
|
||||
x308_ = __dna_reader.readFloatBig();
|
||||
x308_phazonDamageReduction = __dna_reader.readFloatBig();
|
||||
}
|
||||
|
||||
void CTweakPlayer::write(athena::io::IStreamWriter& __dna_writer) const
|
||||
|
@ -878,11 +878,11 @@ void CTweakPlayer::write(athena::io::IStreamWriter& __dna_writer) const
|
|||
/* x2fc_ */
|
||||
__dna_writer.writeUint32Big(x2fc_);
|
||||
/* x300_ */
|
||||
__dna_writer.writeFloatBig(x300_);
|
||||
__dna_writer.writeFloatBig(x300_variaDamageReduction);
|
||||
/* x304_ */
|
||||
__dna_writer.writeFloatBig(x304_);
|
||||
__dna_writer.writeFloatBig(x304_gravityDamageReduction);
|
||||
/* x308_ */
|
||||
__dna_writer.writeFloatBig(x308_);
|
||||
__dna_writer.writeFloatBig(x308_phazonDamageReduction);
|
||||
}
|
||||
|
||||
void CTweakPlayer::read(athena::io::YAMLDocReader& __dna_docin)
|
||||
|
@ -1393,11 +1393,11 @@ void CTweakPlayer::read(athena::io::YAMLDocReader& __dna_docin)
|
|||
/* x2fc_ */
|
||||
x2fc_ = __dna_docin.readUint32("x2fc_");
|
||||
/* x300_ */
|
||||
x300_ = __dna_docin.readFloat("x300_");
|
||||
x300_variaDamageReduction = __dna_docin.readFloat("x300_");
|
||||
/* x304_ */
|
||||
x304_ = __dna_docin.readFloat("x304_");
|
||||
x304_gravityDamageReduction = __dna_docin.readFloat("x304_");
|
||||
/* x308_ */
|
||||
x308_ = __dna_docin.readFloat("x308_");
|
||||
x308_phazonDamageReduction = __dna_docin.readFloat("x308_");
|
||||
}
|
||||
|
||||
void CTweakPlayer::CTweakPlayer::write(athena::io::YAMLDocWriter& __dna_docout) const
|
||||
|
@ -1893,11 +1893,11 @@ void CTweakPlayer::CTweakPlayer::write(athena::io::YAMLDocWriter& __dna_docout)
|
|||
/* x2fc_ */
|
||||
__dna_docout.writeUint32("x2fc_", x2fc_);
|
||||
/* x300_ */
|
||||
__dna_docout.writeFloat("x300_", x300_);
|
||||
__dna_docout.writeFloat("x300_", x300_variaDamageReduction);
|
||||
/* x304_ */
|
||||
__dna_docout.writeFloat("x304_", x304_);
|
||||
__dna_docout.writeFloat("x304_", x304_gravityDamageReduction);
|
||||
/* x308_ */
|
||||
__dna_docout.writeFloat("x308_", x308_);
|
||||
__dna_docout.writeFloat("x308_", x308_phazonDamageReduction);
|
||||
}
|
||||
|
||||
void CTweakPlayer::FixupValues()
|
||||
|
|
|
@ -172,9 +172,9 @@ struct CTweakPlayer : ITweakPlayer
|
|||
Value<bool> x2f4_;
|
||||
Value<float> x2f8_;
|
||||
Value<atUint32> x2fc_;
|
||||
Value<float> x300_;
|
||||
Value<float> x304_;
|
||||
Value<float> x308_;
|
||||
Value<float> x300_variaDamageReduction;
|
||||
Value<float> x304_gravityDamageReduction;
|
||||
Value<float> x308_phazonDamageReduction;
|
||||
float GetX50() const { return x44_[3]; }
|
||||
float GetX54() const { return x44_[4]; }
|
||||
float GetX58() const { return x44_[5]; }
|
||||
|
@ -197,8 +197,11 @@ struct CTweakPlayer : ITweakPlayer
|
|||
float GetX2B0() const { return x2b0_; }
|
||||
float GetX138() const { return x138_; }
|
||||
float GetX14C() const { return x14c_; }
|
||||
float GetLeftLogicalThreshold() const {return x150_leftDiv;}
|
||||
float GetRightLogicalThreshold() const {return x154_rightDiv;}
|
||||
float GetLeftLogicalThreshold() const { return x150_leftDiv; }
|
||||
float GetRightLogicalThreshold() const { return x154_rightDiv; }
|
||||
float GetVariaDamageReduction() const { return x300_variaDamageReduction; }
|
||||
float GetGravityDamageReduction() const { return x304_gravityDamageReduction; }
|
||||
float GetPhazonDamageReduction() const { return x308_phazonDamageReduction; }
|
||||
CTweakPlayer() = default;
|
||||
CTweakPlayer(athena::io::IStreamReader& reader)
|
||||
{
|
||||
|
|
|
@ -495,6 +495,34 @@ void CSfxManager::DisableAuxProcessing()
|
|||
m_auxProcessingEnabled = false;
|
||||
}
|
||||
|
||||
void CSfxManager::SetActiveAreas(const rstl::reserved_vector<TAreaId, 10>& areas)
|
||||
{
|
||||
CSfxChannel& chanObj = m_channels[int(m_currentChannel)];
|
||||
|
||||
for (const CSfxHandle& hnd : chanObj.x48_handles)
|
||||
{
|
||||
TAreaId sndArea = hnd->GetArea();
|
||||
if (sndArea == kInvalidAreaId)
|
||||
{
|
||||
hnd->SetInArea(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
bool inArea = false;
|
||||
for (TAreaId id : areas)
|
||||
{
|
||||
if (sndArea == id)
|
||||
{
|
||||
inArea = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
m_doUpdate = true;
|
||||
hnd->SetInArea(inArea);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CSfxManager::Update(float dt)
|
||||
{
|
||||
CSfxChannel& chanObj = m_channels[int(m_currentChannel)];
|
||||
|
|
|
@ -213,6 +213,8 @@ public:
|
|||
static void PrepareReverbHiCallback(const amuse::EffectReverbHiInfo& info);
|
||||
static void DisableAuxProcessing();
|
||||
|
||||
static void SetActiveAreas(const rstl::reserved_vector<TAreaId, 10>& areas);
|
||||
|
||||
static void Update(float dt);
|
||||
static void Shutdown();
|
||||
};
|
||||
|
|
|
@ -109,6 +109,7 @@ public:
|
|||
CWorldState& CurrentWorldState() { return StateForWorld(x84_mlvlId); }
|
||||
ResId CurrentWorldAssetId() const { return x84_mlvlId; }
|
||||
void SetHardMode(bool v) { x228_24_hardMode = v; }
|
||||
bool GetHardMode() const { return x228_24_hardMode; }
|
||||
void ReadPersistentOptions(CBitStreamReader& r);
|
||||
void SetPersistentOptions(const CPersistentOptions& opts) { xa8_systemOptions = opts; }
|
||||
void ImportPersistentOptions(const CPersistentOptions& opts);
|
||||
|
|
|
@ -46,6 +46,7 @@
|
|||
#include "zeus/CMRay.hpp"
|
||||
#include "Collision/CollisionUtil.hpp"
|
||||
#include "World/CScriptWater.hpp"
|
||||
#include "World/CScriptDoor.hpp"
|
||||
|
||||
#include <cmath>
|
||||
|
||||
|
@ -234,7 +235,7 @@ void CStateManager::UpdateThermalVisor()
|
|||
if (connArea->IsPostConstructed())
|
||||
{
|
||||
CGameArea::EOcclusionState occState = connArea->GetPostConstructed()->x10dc_occlusionState;
|
||||
if (occState == CGameArea::EOcclusionState::Occluded)
|
||||
if (occState == CGameArea::EOcclusionState::Visible)
|
||||
{
|
||||
closestDist = dist;
|
||||
lastArea = connArea.get();
|
||||
|
@ -648,10 +649,10 @@ void CStateManager::DrawWorld() const
|
|||
{
|
||||
if (areaCount == 10)
|
||||
break;
|
||||
CGameArea::EOcclusionState occState = CGameArea::EOcclusionState::NotOccluded;
|
||||
CGameArea::EOcclusionState occState = CGameArea::EOcclusionState::Occluded;
|
||||
if (area.IsPostConstructed())
|
||||
occState = area.GetOcclusionState();
|
||||
if (occState == CGameArea::EOcclusionState::Occluded)
|
||||
if (occState == CGameArea::EOcclusionState::Visible)
|
||||
areaArr[areaCount++] = &area;
|
||||
}
|
||||
|
||||
|
@ -942,10 +943,10 @@ void CStateManager::PreRender()
|
|||
frustum.updatePlanes(x870_cameraManager->GetCurrentCameraTransform(*this), proj);
|
||||
for (const CGameArea& area : *x850_world)
|
||||
{
|
||||
CGameArea::EOcclusionState occState = CGameArea::EOcclusionState::NotOccluded;
|
||||
CGameArea::EOcclusionState occState = CGameArea::EOcclusionState::Occluded;
|
||||
if (area.IsPostConstructed())
|
||||
occState = area.GetOcclusionState();
|
||||
if (occState == CGameArea::EOcclusionState::Occluded)
|
||||
if (occState == CGameArea::EOcclusionState::Visible)
|
||||
{
|
||||
for (CEntity* ent : *area.GetPostConstructed()->x10c0_areaObjs)
|
||||
{
|
||||
|
@ -1265,10 +1266,10 @@ void CStateManager::InformListeners(const zeus::CVector3f& pos, EListenNoiseType
|
|||
if (!ai->GetActive())
|
||||
continue;
|
||||
CGameArea* area = x850_world->GetArea(ai->GetAreaIdAlways());
|
||||
CGameArea::EOcclusionState occState = CGameArea::EOcclusionState::NotOccluded;
|
||||
CGameArea::EOcclusionState occState = CGameArea::EOcclusionState::Occluded;
|
||||
if (area->IsPostConstructed())
|
||||
occState = area->GetPostConstructed()->x10dc_occlusionState;
|
||||
if (occState != CGameArea::EOcclusionState::NotOccluded)
|
||||
if (occState != CGameArea::EOcclusionState::Occluded)
|
||||
ai->Listen(pos, type);
|
||||
}
|
||||
}
|
||||
|
@ -1648,41 +1649,141 @@ void CStateManager::TestBombHittingWater(const CActor& damager, const zeus::CVec
|
|||
}
|
||||
}
|
||||
|
||||
bool CStateManager::ApplyLocalDamage(const zeus::CVector3f& vec1, const zeus::CVector3f& vec2, CActor& actor, float dt,
|
||||
bool CStateManager::ApplyLocalDamage(const zeus::CVector3f& vec1, const zeus::CVector3f& vec2, CActor& damagee, float dam,
|
||||
const CWeaponMode& weapMode)
|
||||
{
|
||||
CHealthInfo* hInfo = actor.HealthInfo();
|
||||
if (!hInfo || dt < 0.f)
|
||||
CHealthInfo* hInfo = damagee.HealthInfo();
|
||||
if (!hInfo || dam < 0.f)
|
||||
return false;
|
||||
|
||||
if (hInfo->GetHP() <= 0.f)
|
||||
return true;
|
||||
|
||||
float f30 = dt;
|
||||
float mulDam = dam;
|
||||
|
||||
CPlayer* player = TCastToPtr<CPlayer>(actor);
|
||||
CAi* ai = TCastToPtr<CAi>(actor);
|
||||
TCastToPtr<CPlayer> player = damagee;
|
||||
TCastToPtr<CAi> ai = damagee;
|
||||
#if 0
|
||||
CDestroyableRock* dRock = nullptr;
|
||||
if (!ai)
|
||||
TCastToPtr<CDestroyableRock>(actor);
|
||||
if (TCastToPtr<CDestroyableRock>(damagee))
|
||||
ai = damagee;
|
||||
#endif
|
||||
|
||||
if (player)
|
||||
{
|
||||
if (x870_cameraManager->IsInCinematicCamera())
|
||||
if (x870_cameraManager->IsInCinematicCamera() ||
|
||||
(weapMode.GetType() == EWeaponType::Phazon &&
|
||||
x8b8_playerState->HasPowerUp(CPlayerState::EItemType::PhazonSuit)))
|
||||
return false;
|
||||
|
||||
if (g_GameState->GetHardMode())
|
||||
mulDam *= g_GameState->GetHardModeDamageMultiplier();
|
||||
|
||||
float damReduction = 0.f;
|
||||
if (x8b8_playerState->HasPowerUp(CPlayerState::EItemType::VariaSuit))
|
||||
damReduction = g_tweakPlayer->GetVariaDamageReduction();
|
||||
if (x8b8_playerState->HasPowerUp(CPlayerState::EItemType::GravitySuit))
|
||||
damReduction = std::max(g_tweakPlayer->GetGravityDamageReduction(), damReduction);
|
||||
if (x8b8_playerState->HasPowerUp(CPlayerState::EItemType::PhazonSuit))
|
||||
damReduction = std::max(g_tweakPlayer->GetPhazonDamageReduction(), damReduction);
|
||||
|
||||
mulDam = -(damReduction * mulDam - mulDam);
|
||||
}
|
||||
|
||||
float newHp = hInfo->GetHP() - mulDam;
|
||||
bool significant = std::fabs(newHp - hInfo->GetHP()) >= 0.00001;
|
||||
|
||||
if (player)
|
||||
{
|
||||
player->TakeDamage(significant, vec1, mulDam, weapMode.GetType(), *this);
|
||||
if (newHp <= 0.f)
|
||||
x8b8_playerState->SetPlayerAlive(false);
|
||||
}
|
||||
|
||||
if (ai)
|
||||
{
|
||||
if (significant)
|
||||
ai->TakeDamage(vec2, mulDam);
|
||||
if (newHp <= 0.f)
|
||||
ai->Death(*this, vec2, EStateMsg::Twenty);
|
||||
}
|
||||
return false;
|
||||
|
||||
return significant;
|
||||
}
|
||||
|
||||
bool CStateManager::ApplyDamage(TUniqueId, TUniqueId, TUniqueId, const CDamageInfo& info, const CMaterialFilter&)
|
||||
bool CStateManager::ApplyDamage(TUniqueId id0, TUniqueId id1, TUniqueId id2,
|
||||
const CDamageInfo& info, const CMaterialFilter& filter,
|
||||
const zeus::CVector3f& vec)
|
||||
{
|
||||
CEntity* ent0 = ObjectById(id0);
|
||||
CEntity* ent1 = ObjectById(id1);
|
||||
TCastToPtr<CActor> act0 = ent0;
|
||||
TCastToPtr<CActor> act1 = ent1;
|
||||
bool isPlayer = TCastToPtr<CPlayer>(ent1);
|
||||
|
||||
if (act1)
|
||||
{
|
||||
if (CHealthInfo* hInfo = act1->HealthInfo())
|
||||
{
|
||||
zeus::CVector3f position;
|
||||
zeus::CVector3f direction = zeus::CVector3f::skRight;
|
||||
bool alive = hInfo->GetHP() > 0.f;
|
||||
if (act0)
|
||||
{
|
||||
position = act0->GetTranslation();
|
||||
direction = act0->GetTransform().basis[1];
|
||||
}
|
||||
|
||||
const CDamageVulnerability* dVuln;
|
||||
if (act0 || isPlayer)
|
||||
dVuln = act1->GetDamageVulnerability(position, direction, info);
|
||||
else
|
||||
dVuln = act1->GetDamageVulnerability();
|
||||
|
||||
if (info.GetWeaponMode().GetType() == EWeaponType::None ||
|
||||
dVuln->WeaponHurts(info.GetWeaponMode(), false))
|
||||
{
|
||||
if (info.GetDamage() > 0.f)
|
||||
ApplyLocalDamage(position, direction, *act1, info.GetDamage(), info.GetWeaponMode());
|
||||
act1->SendScriptMsgs(EScriptObjectState::Damage, *this, EScriptObjectMessage::None);
|
||||
SendScriptMsg(act1.GetPtr(), id0, EScriptObjectMessage::InternalMessage19);
|
||||
}
|
||||
else
|
||||
{
|
||||
act1->SendScriptMsgs(EScriptObjectState::UNKS6, *this, EScriptObjectMessage::None);
|
||||
SendScriptMsg(act1.GetPtr(), id0, EScriptObjectMessage::InternalMessage20);
|
||||
}
|
||||
|
||||
if (alive && act0 && info.GetKnockBackPower() > 0.f)
|
||||
{
|
||||
zeus::CVector3f delta = vec.isZero() ? (act1->GetTranslation() - act0->GetTranslation()) : vec;
|
||||
ApplyKnockBack(*act1, info, *dVuln, delta.normalized(), 0.f);
|
||||
}
|
||||
}
|
||||
|
||||
if (act0 && info.GetRadius() > 0.f)
|
||||
ProcessRadiusDamage(*act0, *act1, id2, info, filter);
|
||||
|
||||
if (TCastToPtr<CWallCrawlerSwarm> swarm = ent1)
|
||||
if (act0)
|
||||
swarm->ApplyRadiusDamage(act0->GetTranslation(), info, *this);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void CStateManager::UpdateAreaSounds() {}
|
||||
void CStateManager::UpdateAreaSounds()
|
||||
{
|
||||
rstl::reserved_vector<TAreaId, 10> areas;
|
||||
for (CGameArea& area : *x850_world)
|
||||
{
|
||||
CGameArea::EOcclusionState occState = CGameArea::EOcclusionState::Occluded;
|
||||
if (area.IsPostConstructed())
|
||||
occState = area.GetOcclusionState();
|
||||
if (occState == CGameArea::EOcclusionState::Visible)
|
||||
areas.push_back(area.GetAreaId());
|
||||
}
|
||||
CSfxManager::SetActiveAreas(areas);
|
||||
}
|
||||
|
||||
void CStateManager::FrameEnd()
|
||||
{
|
||||
|
@ -2269,11 +2370,27 @@ void CStateManager::DeleteObjectRequest(TUniqueId id)
|
|||
CEntity* CStateManager::ObjectById(TUniqueId uid) { return GetAllObjectList().GetObjectById(uid); }
|
||||
const CEntity* CStateManager::GetObjectById(TUniqueId uid) const { return GetAllObjectList().GetObjectById(uid); }
|
||||
|
||||
void CStateManager::AreaUnloaded(TAreaId) {}
|
||||
void CStateManager::AreaUnloaded(TAreaId)
|
||||
{
|
||||
// Intentionally empty
|
||||
}
|
||||
|
||||
void CStateManager::PrepareAreaUnload(TAreaId) {}
|
||||
void CStateManager::PrepareAreaUnload(TAreaId aid)
|
||||
{
|
||||
for (CEntity* ent : GetAllObjectList())
|
||||
{
|
||||
if (TCastToPtr<CScriptDoor> door = ent)
|
||||
if (door->IsConnectedToArea(*this, aid))
|
||||
door->ForceClosed(*this);
|
||||
}
|
||||
FreeScriptObjects(aid);
|
||||
}
|
||||
|
||||
void CStateManager::AreaLoaded(TAreaId) {}
|
||||
void CStateManager::AreaLoaded(TAreaId aid)
|
||||
{
|
||||
x8bc_relayTracker->SendMsgs(aid, *this);
|
||||
x880_envFxManager->AreaLoaded();
|
||||
}
|
||||
|
||||
void CStateManager::BuildNearList(rstl::reserved_vector<TUniqueId, 1024>& listOut, const zeus::CVector3f& v1,
|
||||
const zeus::CVector3f& v2, float f1, const CMaterialFilter& filter,
|
||||
|
@ -2403,7 +2520,17 @@ CRayCastResult CStateManager::RayWorldIntersection(TUniqueId& idOut, const zeus:
|
|||
return CGameCollision::RayWorldIntersection(*this, idOut, pos, dir, length, filter, list);
|
||||
}
|
||||
|
||||
void CStateManager::UpdateObjectInLists(CEntity&) {}
|
||||
void CStateManager::UpdateObjectInLists(CEntity& ent)
|
||||
{
|
||||
for (auto& list : x808_objLists)
|
||||
{
|
||||
if (list->GetValidObjectById(ent.GetUniqueId()))
|
||||
if (!list->IsQualified(ent))
|
||||
list->RemoveObject(ent.GetUniqueId());
|
||||
if (!list->GetValidObjectById(ent.GetUniqueId()))
|
||||
list->AddObject(ent);
|
||||
}
|
||||
}
|
||||
|
||||
TUniqueId CStateManager::AllocateUniqueId()
|
||||
{
|
||||
|
@ -2471,12 +2598,6 @@ std::pair<u32, u32> CStateManager::CalculateScanCompletionRate() const
|
|||
return {num, denom};
|
||||
}
|
||||
|
||||
bool CStateManager::ApplyDamage(TUniqueId, TUniqueId, TUniqueId, const CDamageInfo& info, const CMaterialFilter&,
|
||||
const zeus::CVector3f&)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
float CStateManager::g_EscapeShakeCountdown;
|
||||
bool CStateManager::g_EscapeShakeCountdownInit = false;
|
||||
}
|
||||
|
|
|
@ -337,8 +337,6 @@ public:
|
|||
void TestBombHittingWater(const CActor& damager, const zeus::CVector3f& pos, CActor& damagee);
|
||||
bool ApplyLocalDamage(const zeus::CVector3f&, const zeus::CVector3f&, CActor&, float,
|
||||
const CWeaponMode&);
|
||||
bool ApplyDamage(TUniqueId, TUniqueId, TUniqueId, const CDamageInfo& info,
|
||||
const CMaterialFilter&);
|
||||
bool ApplyDamage(TUniqueId, TUniqueId, TUniqueId, const CDamageInfo& info,
|
||||
const CMaterialFilter&, const zeus::CVector3f&);
|
||||
void UpdateAreaSounds();
|
||||
|
|
|
@ -118,7 +118,7 @@ void CActorModelParticles::AddStragglersToRenderer(const CStateManager& mgr)
|
|||
if (!area->IsPostConstructed())
|
||||
continue;
|
||||
CGameArea::EOcclusionState occState = area->GetPostConstructed()->x10dc_occlusionState;
|
||||
if (occState == CGameArea::EOcclusionState::NotOccluded)
|
||||
if (occState == CGameArea::EOcclusionState::Occluded)
|
||||
continue;
|
||||
}
|
||||
if (mgr.GetObjectById(item.x0_id) &&
|
||||
|
|
|
@ -16,7 +16,7 @@ static CMaterialList MakeAiMaterialList(const CMaterialList& in)
|
|||
|
||||
CAi::CAi(TUniqueId uid, bool active, const std::string& name, const CEntityInfo& info, const zeus::CTransform& xf,
|
||||
CModelData&& mData, const zeus::CAABox& box, float mass, const CHealthInfo& hInfo,
|
||||
const CDamageVulnerability& dmgVuln, const CMaterialList& list, ResId, const CActorParameters& actorParams,
|
||||
const CDamageVulnerability& dmgVuln, const CMaterialList& list, ResId fsm, const CActorParameters& actorParams,
|
||||
float stepUp, float stepDown)
|
||||
: CPhysicsActor(uid, active, name, info, xf, std::move(mData), MakeAiMaterialList(list), box, SMoverData(mass),
|
||||
actorParams, stepUp, stepDown)
|
||||
|
|
|
@ -37,7 +37,7 @@ public:
|
|||
|
||||
CAi(TUniqueId uid, bool active, const std::string& name, const CEntityInfo& info, const zeus::CTransform& xf,
|
||||
CModelData&& mData, const zeus::CAABox& box, float mass, const CHealthInfo& hInfo, const CDamageVulnerability&,
|
||||
const CMaterialList& list, ResId, const CActorParameters&, float f1, float f2);
|
||||
const CMaterialList& list, ResId fsm, const CActorParameters&, float f1, float f2);
|
||||
|
||||
static void CreateFuncLookup(CAiFuncMap* funcMap);
|
||||
static CAiStateFunc GetStateFunc(const char* func);
|
||||
|
@ -47,7 +47,7 @@ public:
|
|||
|
||||
virtual void AcceptScriptMsg(EScriptObjectMessage, TUniqueId, CStateManager&) {}
|
||||
virtual CHealthInfo* HealthInfo() { return &x258_healthInfo; }
|
||||
virtual void Death(const zeus::CVector3f&, CStateManager&)=0;
|
||||
virtual void Death(CStateManager&, const zeus::CVector3f&, EStateMsg)=0;
|
||||
virtual void KnockBack(const zeus::CVector3f&, CStateManager&, const CDamageInfo& info, EKnockBackType, bool, float)=0;
|
||||
virtual CDamageVulnerability GetDamageVulnerability() { return x260_damageVulnerability; }
|
||||
virtual void TakeDamage(const zeus::CVector3f&, float) {}
|
||||
|
|
|
@ -7,7 +7,8 @@ namespace urde
|
|||
{
|
||||
enum class EStateMsg
|
||||
{
|
||||
One,
|
||||
One = 1,
|
||||
Twenty = 20
|
||||
};
|
||||
|
||||
class CStateManager;
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
#include "CDestroyableRock.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
||||
CDestroyableRock::CDestroyableRock(TUniqueId id, bool active, const std::string& name, const CEntityInfo& info,
|
||||
const zeus::CTransform& xf, CModelData&& modelData, float mass, const CHealthInfo& health,
|
||||
const CDamageVulnerability& vulnerability, const CMaterialList& matList, ResId fsm,
|
||||
const CActorParameters& actParams, const CModelData& modelData2)
|
||||
: CAi(id, active, name, info, xf, std::move(modelData), modelData.GetBounds(),
|
||||
mass, health, vulnerability, matList, fsm, actParams, 0.3f, 0.8f)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
#ifndef __URDE_CDESTROYABLEROCK_HPP__
|
||||
#define __URDE_CDESTROYABLEROCK_HPP__
|
||||
|
||||
#include "CAi.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
||||
class CDestroyableRock : public CAi
|
||||
{
|
||||
public:
|
||||
CDestroyableRock(TUniqueId id, bool active, const std::string& name, const CEntityInfo& info,
|
||||
const zeus::CTransform& xf, CModelData&& modelData, float mass, const CHealthInfo& health,
|
||||
const CDamageVulnerability& vulnerability, const CMaterialList& matList, ResId fsm,
|
||||
const CActorParameters& actParams, const CModelData& modelData2);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __URDE_CDESTROYABLEROCK_HPP__
|
|
@ -29,4 +29,10 @@ void CEnvFxManager::SetFxDensity(s32 val, float density)
|
|||
x38_ = val;
|
||||
}
|
||||
|
||||
void CEnvFxManager::AreaLoaded()
|
||||
{
|
||||
for (CEnvFxManagerGrid& grid : x50_grids)
|
||||
grid.x0_24_ = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include "RetroTypes.hpp"
|
||||
#include "CToken.hpp"
|
||||
#include "zeus/CAABox.hpp"
|
||||
#include "Particle/CGenDescription.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
@ -24,6 +25,28 @@ enum class EPhazonType
|
|||
Orange
|
||||
};
|
||||
|
||||
class CVectorFixed8_8
|
||||
{
|
||||
u16 x0_[3];
|
||||
};
|
||||
|
||||
class CEnvFxManagerGrid
|
||||
{
|
||||
friend class CEnvFxManager;
|
||||
bool x0_24_ = true;
|
||||
zeus::CVector2i x4_;
|
||||
zeus::CVector2i xc_;
|
||||
std::pair<bool, float> x14_ = {false, FLT_MAX};
|
||||
std::vector<CVectorFixed8_8> x1c_;
|
||||
public:
|
||||
CEnvFxManagerGrid(const zeus::CVector2i& a, const zeus::CVector2i& b,
|
||||
const std::vector<CVectorFixed8_8>& vec, int reserve)
|
||||
: x4_(a), xc_(b), x1c_(vec)
|
||||
{
|
||||
x1c_.reserve(reserve);
|
||||
}
|
||||
};
|
||||
|
||||
class CEnvFxManager
|
||||
{
|
||||
zeus::CAABox x0_ = zeus::CAABox(-63.5, 63.5);
|
||||
|
@ -36,6 +59,11 @@ class CEnvFxManager
|
|||
float x38_ = 0.f;
|
||||
u8 x3c = 0;
|
||||
|
||||
rstl::reserved_vector<CEnvFxManagerGrid, 64> x50_grids;
|
||||
|
||||
TLockedToken<CGenDescription> xb58_envRainSplash;
|
||||
bool xb64_ = true;
|
||||
|
||||
void SetupSnowTevs();
|
||||
void SetupRainTevs();
|
||||
public:
|
||||
|
@ -47,7 +75,7 @@ public:
|
|||
void SetFxDensity(s32, float);
|
||||
void MoveWrapCells(s32, s32);
|
||||
void GetParticleBoundsToWorldScale() const;
|
||||
|
||||
void AreaLoaded();
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -523,7 +523,7 @@ void CGameArea::UpdateThermalVisor(float dt)
|
|||
|
||||
void CGameArea::AliveUpdate(float dt)
|
||||
{
|
||||
if (x12c_postConstructed->x10dc_occlusionState == EOcclusionState::NotOccluded)
|
||||
if (x12c_postConstructed->x10dc_occlusionState == EOcclusionState::Occluded)
|
||||
x12c_postConstructed->x10e4_ += dt;
|
||||
else
|
||||
x12c_postConstructed->x10e4_ = 0.f;
|
||||
|
@ -537,7 +537,7 @@ void CGameArea::SetOcclusionState(EOcclusionState state)
|
|||
if (!xf0_24_postConstructed || x12c_postConstructed->x10dc_occlusionState == state)
|
||||
return;
|
||||
|
||||
if (state == EOcclusionState::NotOccluded)
|
||||
if (state == EOcclusionState::Occluded)
|
||||
{
|
||||
ReloadAllUnloadedTextures();
|
||||
AddStaticGeometry();
|
||||
|
@ -553,19 +553,19 @@ void CGameArea::SetOcclusionState(EOcclusionState state)
|
|||
void CGameArea::RemoveStaticGeometry()
|
||||
{
|
||||
if (!xf0_24_postConstructed || !x12c_postConstructed ||
|
||||
x12c_postConstructed->x10dc_occlusionState == EOcclusionState::NotOccluded)
|
||||
x12c_postConstructed->x10dc_occlusionState == EOcclusionState::Occluded)
|
||||
return;
|
||||
x12c_postConstructed->x10e0_ = 0;
|
||||
x12c_postConstructed->x10dc_occlusionState = EOcclusionState::NotOccluded;
|
||||
x12c_postConstructed->x10dc_occlusionState = EOcclusionState::Occluded;
|
||||
g_Renderer->RemoveStaticGeometry(&x12c_postConstructed->x4c_insts);
|
||||
}
|
||||
|
||||
void CGameArea::AddStaticGeometry()
|
||||
{
|
||||
if (x12c_postConstructed->x10dc_occlusionState != EOcclusionState::Occluded)
|
||||
if (x12c_postConstructed->x10dc_occlusionState != EOcclusionState::Visible)
|
||||
{
|
||||
x12c_postConstructed->x10e0_ = 0;
|
||||
x12c_postConstructed->x10dc_occlusionState = EOcclusionState::Occluded;
|
||||
x12c_postConstructed->x10dc_occlusionState = EOcclusionState::Visible;
|
||||
if (!x12c_postConstructed->x1108_25_)
|
||||
FillInStaticGeometry();
|
||||
g_Renderer->AddStaticGeometry(&x12c_postConstructed->x4c_insts,
|
||||
|
|
|
@ -165,8 +165,8 @@ public:
|
|||
|
||||
enum class EOcclusionState
|
||||
{
|
||||
NotOccluded,
|
||||
Occluded
|
||||
Occluded,
|
||||
Visible
|
||||
};
|
||||
|
||||
class CAreaFog
|
||||
|
@ -217,7 +217,7 @@ public:
|
|||
u32 x10d0_sclySize = 0;
|
||||
u32 x10d4_ = 0;
|
||||
const CScriptAreaAttributes* x10d8_areaAttributes = nullptr;
|
||||
EOcclusionState x10dc_occlusionState = EOcclusionState::NotOccluded;
|
||||
EOcclusionState x10dc_occlusionState = EOcclusionState::Occluded;
|
||||
u32 x10e0_ = 0;
|
||||
float x10e4_ = 5.f;
|
||||
u32 x10e8_ = -1;
|
||||
|
|
|
@ -14,10 +14,10 @@ void CMorphBallShadow::GatherAreas(const CStateManager& mgr)
|
|||
x18_areas.clear();
|
||||
for (const CGameArea& area : *mgr.GetWorld())
|
||||
{
|
||||
CGameArea::EOcclusionState occState = CGameArea::EOcclusionState::NotOccluded;
|
||||
CGameArea::EOcclusionState occState = CGameArea::EOcclusionState::Occluded;
|
||||
if (area.IsPostConstructed())
|
||||
occState = area.GetPostConstructed()->x10dc_occlusionState;
|
||||
if (occState == CGameArea::EOcclusionState::Occluded)
|
||||
if (occState == CGameArea::EOcclusionState::Visible)
|
||||
x18_areas.push_back(area.GetAreaId());
|
||||
}
|
||||
}
|
||||
|
@ -104,10 +104,10 @@ bool CMorphBallShadow::AreasValid(const CStateManager& mgr) const
|
|||
auto it = x18_areas.begin();
|
||||
for (const CGameArea& area : *mgr.GetWorld())
|
||||
{
|
||||
CGameArea::EOcclusionState occState = CGameArea::EOcclusionState::NotOccluded;
|
||||
CGameArea::EOcclusionState occState = CGameArea::EOcclusionState::Occluded;
|
||||
if (area.IsPostConstructed())
|
||||
occState = area.GetPostConstructed()->x10dc_occlusionState;
|
||||
if (occState != CGameArea::EOcclusionState::Occluded)
|
||||
if (occState != CGameArea::EOcclusionState::Visible)
|
||||
continue;
|
||||
if (it == x18_areas.end())
|
||||
return false;
|
||||
|
|
|
@ -41,7 +41,7 @@ public:
|
|||
CPatterned::EMovementType movement, EColliderType collider, EBodyType body,
|
||||
const CActorParameters& params, bool b1);
|
||||
|
||||
virtual void Death(const zeus::CVector3f&, CStateManager&) {}
|
||||
virtual void Death(CStateManager&, const zeus::CVector3f&, EStateMsg) {}
|
||||
virtual void KnockBack(const zeus::CVector3f&, CStateManager&, const CDamageInfo& info, EKnockBackType, bool, float) {}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -26,10 +26,10 @@ void CScriptCameraShaker::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId ob
|
|||
if (GetActive() && aid != kInvalidAreaId)
|
||||
{
|
||||
const CGameArea* area = stateMgr.GetWorld()->GetAreaAlways(aid);
|
||||
CGameArea::EOcclusionState occState = CGameArea::EOcclusionState::NotOccluded;
|
||||
CGameArea::EOcclusionState occState = CGameArea::EOcclusionState::Occluded;
|
||||
if (area->IsPostConstructed())
|
||||
occState = area->GetPostConstructed()->x10dc_occlusionState;
|
||||
if (occState == CGameArea::EOcclusionState::Occluded)
|
||||
if (occState == CGameArea::EOcclusionState::Visible)
|
||||
x34_shakeData.SetShakerId(stateMgr.GetCameraManager()->AddCameraShaker(x34_shakeData, false));
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -46,10 +46,10 @@ void CScriptSpawnPoint::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId objI
|
|||
if (x4_areaId != stateMgr.GetNextAreaId())
|
||||
{
|
||||
CGameArea* area = stateMgr.WorldNC()->GetArea(x4_areaId);
|
||||
if (area->IsPostConstructed() && area->GetOcclusionState() == CGameArea::EOcclusionState::NotOccluded)
|
||||
if (area->IsPostConstructed() && area->GetOcclusionState() == CGameArea::EOcclusionState::Occluded)
|
||||
{
|
||||
/* while (!area->TryTakingOutOfARAM()) {} */
|
||||
CWorld::PropogateAreaChain(CGameArea::EOcclusionState::Occluded, area, stateMgr.WorldNC());
|
||||
CWorld::PropogateAreaChain(CGameArea::EOcclusionState::Visible, area, stateMgr.WorldNC());
|
||||
}
|
||||
|
||||
stateMgr.SetCurrentAreaId(x4_areaId);
|
||||
|
@ -57,8 +57,8 @@ void CScriptSpawnPoint::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId objI
|
|||
player->Teleport(GetTransform(), stateMgr, true);
|
||||
player->SetSpawnedMorphBallState(CPlayer::EPlayerMorphBallState(x10c_25_morphed), stateMgr);
|
||||
|
||||
if (area->IsPostConstructed() && area->GetOcclusionState() == CGameArea::EOcclusionState::Occluded)
|
||||
CWorld::PropogateAreaChain(CGameArea::EOcclusionState::NotOccluded,
|
||||
if (area->IsPostConstructed() && area->GetOcclusionState() == CGameArea::EOcclusionState::Visible)
|
||||
CWorld::PropogateAreaChain(CGameArea::EOcclusionState::Occluded,
|
||||
stateMgr.WorldNC()->GetArea(stateMgr.GetNextAreaId()),
|
||||
stateMgr.WorldNC());
|
||||
}
|
||||
|
|
|
@ -466,7 +466,7 @@ void CWorld::TravelToArea(TAreaId aid, CStateManager& mgr, bool skipLoadOther)
|
|||
x70_24_ = true;
|
||||
area->Validate(mgr);
|
||||
MoveToChain(area, EChain::Alive);
|
||||
area->SetOcclusionState(CGameArea::EOcclusionState::Occluded);
|
||||
area->SetOcclusionState(CGameArea::EOcclusionState::Visible);
|
||||
|
||||
CGameArea* otherLoadArea = nullptr;
|
||||
if (!skipLoadOther)
|
||||
|
@ -538,8 +538,16 @@ void CWorld::PropogateAreaChain(CGameArea::EOcclusionState occlusionState, CGame
|
|||
if (!area->GetPostConstructed() || occlusionState == area->GetOcclusionState())
|
||||
return;
|
||||
|
||||
if (occlusionState == CGameArea::EOcclusionState::Occluded)
|
||||
area->SetOcclusionState(CGameArea::EOcclusionState::Occluded);
|
||||
if (occlusionState == CGameArea::EOcclusionState::Visible)
|
||||
area->SetOcclusionState(CGameArea::EOcclusionState::Visible);
|
||||
|
||||
for (CGameArea& areaItr : *world)
|
||||
{
|
||||
if (&areaItr == area)
|
||||
continue;
|
||||
if (areaItr.IsPostConstructed() && areaItr.GetOcclusionState() == CGameArea::EOcclusionState::Visible)
|
||||
areaItr.PrepTokens();
|
||||
}
|
||||
|
||||
for (CGameArea& areaItr : *world)
|
||||
{
|
||||
|
@ -549,16 +557,8 @@ void CWorld::PropogateAreaChain(CGameArea::EOcclusionState occlusionState, CGame
|
|||
areaItr.PrepTokens();
|
||||
}
|
||||
|
||||
for (CGameArea& areaItr : *world)
|
||||
{
|
||||
if (&areaItr == area)
|
||||
continue;
|
||||
if (areaItr.IsPostConstructed() && areaItr.GetOcclusionState() == CGameArea::EOcclusionState::NotOccluded)
|
||||
areaItr.PrepTokens();
|
||||
}
|
||||
|
||||
if (occlusionState == CGameArea::EOcclusionState::NotOccluded)
|
||||
area->SetOcclusionState(CGameArea::EOcclusionState::NotOccluded);
|
||||
if (occlusionState == CGameArea::EOcclusionState::Occluded)
|
||||
area->SetOcclusionState(CGameArea::EOcclusionState::Occluded);
|
||||
}
|
||||
|
||||
void CWorld::Update(float dt)
|
||||
|
|
Loading…
Reference in New Issue