mirror of https://github.com/AxioDL/metaforce.git
Remove rstl::optional_object, various cleanups, implement CExplosion and CScriptDoor
This commit is contained in:
parent
6d60ccfd04
commit
711c3e0d2c
|
@ -118,6 +118,8 @@ struct Application : boo::IApplicationCallback
|
|||
}
|
||||
}
|
||||
|
||||
m_cvarManager.parseCommandLine(app->getArgs());
|
||||
|
||||
const zeus::CPUInfo& cpuInf = zeus::cpuFeatures();
|
||||
Log.report(logvisor::Info, "CPU Name: %s", cpuInf.cpuBrand);
|
||||
Log.report(logvisor::Info, "CPU Vendor: %s", cpuInf.cpuVendor);
|
||||
|
|
|
@ -49,6 +49,7 @@
|
|||
#include "World/CScriptDoor.hpp"
|
||||
#include "Input/ControlMapper.hpp"
|
||||
#include "MP1/MP1.hpp"
|
||||
#include "GameGlobalObjects.hpp"
|
||||
|
||||
#include <cmath>
|
||||
|
||||
|
@ -209,6 +210,12 @@ CStateManager::CStateManager(const std::weak_ptr<CRelayTracker>& relayTracker,
|
|||
CGameCollision::InitCollision();
|
||||
ControlMapper::ResetCommandFilters();
|
||||
x8f0_shadowTex = g_SimplePool->GetObj("DefaultShadow");
|
||||
g_StateManager = this;
|
||||
}
|
||||
|
||||
CStateManager::~CStateManager()
|
||||
{
|
||||
g_StateManager = nullptr;
|
||||
}
|
||||
|
||||
void CStateManager::UpdateThermalVisor()
|
||||
|
@ -1460,7 +1467,7 @@ void CStateManager::ApplyRadiusDamage(const CActor& a1, const zeus::CVector3f& p
|
|||
zeus::CVector3f delta = a2.GetTranslation() - pos;
|
||||
if (delta.magSquared() >= info.GetRadius() * info.GetRadius())
|
||||
{
|
||||
rstl::optional_object<zeus::CAABox> bounds = a2.GetTouchBounds();
|
||||
std::experimental::optional<zeus::CAABox> bounds = a2.GetTouchBounds();
|
||||
if (!bounds)
|
||||
return;
|
||||
if (CCollidableSphere::Sphere_AABox_Bool(zeus::CSphere{pos, info.GetRadius()}, *bounds))
|
||||
|
@ -1518,7 +1525,7 @@ bool CStateManager::TestRayDamage(const zeus::CVector3f& pos, const CActor& dama
|
|||
EMaterialTypes::Character);
|
||||
static const CMaterialFilter filter(incList, exList, CMaterialFilter::EFilterType::IncludeExclude);
|
||||
|
||||
rstl::optional_object<zeus::CAABox> bounds = damagee.GetTouchBounds();
|
||||
std::experimental::optional<zeus::CAABox> bounds = damagee.GetTouchBounds();
|
||||
if (!bounds)
|
||||
return false;
|
||||
|
||||
|
@ -2098,7 +2105,7 @@ void CStateManager::CrossTouchActors()
|
|||
CActor& actor = static_cast<CActor&>(*ent);
|
||||
if (!actor.GetActive() || !actor.GetCallTouch())
|
||||
continue;
|
||||
rstl::optional_object<zeus::CAABox> touchAABB = actor.GetTouchBounds();
|
||||
std::experimental::optional<zeus::CAABox> touchAABB = actor.GetTouchBounds();
|
||||
if (!touchAABB)
|
||||
continue;
|
||||
|
||||
|
@ -2115,7 +2122,7 @@ void CStateManager::CrossTouchActors()
|
|||
if (!ent2)
|
||||
continue;
|
||||
|
||||
rstl::optional_object<zeus::CAABox> touchAABB2 = ent2->GetTouchBounds();
|
||||
std::experimental::optional<zeus::CAABox> touchAABB2 = ent2->GetTouchBounds();
|
||||
if (!ent2->GetActive() || !touchAABB2)
|
||||
continue;
|
||||
|
||||
|
@ -2465,7 +2472,7 @@ void CStateManager::UpdateSortedLists()
|
|||
|
||||
std::experimental::optional<zeus::CAABox> CStateManager::CalculateObjectBounds(const CActor& actor)
|
||||
{
|
||||
rstl::optional_object<zeus::CAABox> bounds = actor.GetTouchBounds();
|
||||
std::experimental::optional<zeus::CAABox> bounds = actor.GetTouchBounds();
|
||||
if (bounds)
|
||||
{
|
||||
zeus::CAABox aabb;
|
||||
|
|
|
@ -245,6 +245,7 @@ public:
|
|||
const std::weak_ptr<CPlayerState>&,
|
||||
const std::weak_ptr<CWorldTransManager>&,
|
||||
const std::weak_ptr<CWorldLayerState>&);
|
||||
~CStateManager();
|
||||
|
||||
u32 GetInputFrameIdx() const { return x8d4_inputFrameIdx; }
|
||||
bool RenderLast(TUniqueId);
|
||||
|
|
|
@ -45,7 +45,7 @@ CAnimData::CAnimData(CAssetId id,
|
|||
int defaultAnim, int charIdx, bool loop,
|
||||
const TLockedToken<CCharLayoutInfo>& layout,
|
||||
const TToken<CSkinnedModel>& model,
|
||||
const rstl::optional_object<TToken<CMorphableSkinnedModel>>& iceModel,
|
||||
const std::experimental::optional<TToken<CMorphableSkinnedModel>>& iceModel,
|
||||
const std::weak_ptr<CAnimSysContext>& ctx,
|
||||
const std::shared_ptr<CAnimationManager>& animMgr,
|
||||
const std::shared_ptr<CTransitionManager>& transMgr,
|
||||
|
@ -651,7 +651,7 @@ void CAnimData::RenderAuxiliary(const zeus::CFrustum& frustum) const
|
|||
}
|
||||
|
||||
void CAnimData::Render(CSkinnedModel& model, const CModelFlags& drawFlags,
|
||||
const rstl::optional_object<CVertexMorphEffect>& morphEffect,
|
||||
const std::experimental::optional<CVertexMorphEffect>& morphEffect,
|
||||
const float* morphMagnitudes)
|
||||
{
|
||||
SetupRender(model, drawFlags, morphEffect, morphMagnitudes);
|
||||
|
@ -660,7 +660,7 @@ void CAnimData::Render(CSkinnedModel& model, const CModelFlags& drawFlags,
|
|||
|
||||
void CAnimData::SetupRender(CSkinnedModel& model,
|
||||
const CModelFlags& drawFlags,
|
||||
const rstl::optional_object<CVertexMorphEffect>& morphEffect,
|
||||
const std::experimental::optional<CVertexMorphEffect>& morphEffect,
|
||||
const float* morphMagnitudes)
|
||||
{
|
||||
if (!x220_30_poseBuilt)
|
||||
|
@ -949,7 +949,7 @@ void CAnimData::SetInfraModel(const TLockedToken<CModel>& model, const TLockedTo
|
|||
|
||||
void CAnimData::PoseSkinnedModel(CSkinnedModel& model, const CPoseAsTransforms& pose,
|
||||
const CModelFlags& drawFlags,
|
||||
const rstl::optional_object<CVertexMorphEffect>& morphEffect,
|
||||
const std::experimental::optional<CVertexMorphEffect>& morphEffect,
|
||||
const float* morphMagnitudes)
|
||||
{
|
||||
model.Calculate(pose, drawFlags, morphEffect, morphMagnitudes);
|
||||
|
|
|
@ -124,7 +124,7 @@ CCharacterFactory::CreateCharacter(int charIdx, bool loop,
|
|||
const_cast<CCharacterFactory*>(this)->x70_cacheResPool.GetObj
|
||||
({FourCC(drawInsts << 16), charInfo.GetModelId()}, charParm);
|
||||
|
||||
rstl::optional_object<TToken<CMorphableSkinnedModel>> iceModel;
|
||||
std::experimental::optional<TToken<CMorphableSkinnedModel>> iceModel;
|
||||
if (charInfo.GetIceModelId().IsValid() &&
|
||||
charInfo.GetIceSkinRulesId().IsValid())
|
||||
iceModel.emplace(const_cast<CCharacterFactory*>(this)->x70_cacheResPool.GetObj
|
||||
|
|
|
@ -263,7 +263,8 @@ void CParticleDatabase::AddToRendererClippedParticleGenMap(const std::map<std::s
|
|||
{
|
||||
for (auto& e : map)
|
||||
{
|
||||
if (frustum.aabbFrustumTest(*e.second->GetBounds()))
|
||||
auto bounds = e.second->GetBounds();
|
||||
if (bounds && frustum.aabbFrustumTest(*bounds))
|
||||
e.second->AddToRenderer();
|
||||
}
|
||||
}
|
||||
|
@ -274,8 +275,11 @@ void CParticleDatabase::AddToRendererClippedParticleGenMapMasked(const std::map<
|
|||
for (auto& e : map)
|
||||
{
|
||||
if ((e.second->GetFlags() & mask) == target)
|
||||
if (frustum.aabbFrustumTest(*e.second->GetBounds()))
|
||||
{
|
||||
auto bounds = e.second->GetBounds();
|
||||
if (bounds && frustum.aabbFrustumTest(*bounds))
|
||||
e.second->AddToRenderer();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -130,7 +130,7 @@ void CParticleGenInfoGeneric::SetParticleEmission(bool emission, CStateManager&
|
|||
|
||||
bool CParticleGenInfoGeneric::IsSystemDeletable() const { return x84_system->IsSystemDeletable(); }
|
||||
|
||||
rstl::optional_object<zeus::CAABox> CParticleGenInfoGeneric::GetBounds() const { return x84_system->GetBounds(); }
|
||||
std::experimental::optional<zeus::CAABox> CParticleGenInfoGeneric::GetBounds() const { return x84_system->GetBounds(); }
|
||||
|
||||
bool CParticleGenInfoGeneric::HasActiveParticles() const { return x84_system->GetParticleCount() != 0; }
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ public:
|
|||
virtual void SetGlobalScale(const zeus::CVector3f& scale) = 0;
|
||||
virtual void SetParticleEmission(bool, CStateManager& stateMgr) = 0;
|
||||
virtual bool IsSystemDeletable() const = 0;
|
||||
virtual rstl::optional_object<zeus::CAABox> GetBounds() const = 0;
|
||||
virtual std::experimental::optional<zeus::CAABox> GetBounds() const = 0;
|
||||
virtual bool HasActiveParticles() const = 0;
|
||||
virtual void DestroyParticles() = 0;
|
||||
virtual bool HasLight() const = 0;
|
||||
|
@ -105,7 +105,7 @@ public:
|
|||
void SetGlobalScale(const zeus::CVector3f& scale);
|
||||
void SetParticleEmission(bool, CStateManager& stateMgr);
|
||||
bool IsSystemDeletable() const;
|
||||
rstl::optional_object<zeus::CAABox> GetBounds() const;
|
||||
std::experimental::optional<zeus::CAABox> GetBounds() const;
|
||||
bool HasActiveParticles() const;
|
||||
void DestroyParticles();
|
||||
bool HasLight() const;
|
||||
|
|
|
@ -17,7 +17,7 @@ public:
|
|||
struct SRayResult
|
||||
{
|
||||
zeus::CPlane x0_plane;
|
||||
rstl::optional_object<CCollisionSurface> x10_surface;
|
||||
std::experimental::optional<CCollisionSurface> x10_surface;
|
||||
float x3c_t;
|
||||
};
|
||||
|
||||
|
|
|
@ -138,9 +138,9 @@ zeus::CTransform CCollisionActor::GetPrimitiveTransform() const
|
|||
return xf;
|
||||
}
|
||||
|
||||
rstl::optional_object<zeus::CAABox> CCollisionActor::GetTouchBounds() const
|
||||
std::experimental::optional<zeus::CAABox> CCollisionActor::GetTouchBounds() const
|
||||
{
|
||||
rstl::optional_object<zeus::CAABox> aabox;
|
||||
std::experimental::optional<zeus::CAABox> aabox;
|
||||
if (x258_primitiveType == EPrimitiveType::OBBTreeGroup)
|
||||
aabox = {x27c_obbTreeGroupPrimitive->CalculateAABox(x34_transform)};
|
||||
else if (x258_primitiveType == EPrimitiveType::AABox)
|
||||
|
|
|
@ -49,7 +49,7 @@ public:
|
|||
zeus::CVector3f GetOrbitPosition(const CStateManager &) const;
|
||||
const CCollisionPrimitive* GetCollisionPrimitive() const;
|
||||
zeus::CTransform GetPrimitiveTransform() const;
|
||||
rstl::optional_object<zeus::CAABox> GetTouchBounds() const;
|
||||
std::experimental::optional<zeus::CAABox> GetTouchBounds() const;
|
||||
void SetDamageVulnerability(const CDamageVulnerability& vuln);
|
||||
const zeus::CVector3f& GetBoxSize() const { return x260_boxSize; }
|
||||
TUniqueId GetOwnerId() const { return x25c_owner; }
|
||||
|
|
|
@ -179,7 +179,7 @@ CCollisionResponseData::CCollisionResponseData(CInputStream& in, CSimplePool* re
|
|||
}
|
||||
}
|
||||
|
||||
const rstl::optional_object<TLockedToken<CGenDescription>>&
|
||||
const std::experimental::optional<TLockedToken<CGenDescription>>&
|
||||
CCollisionResponseData::GetParticleDescription(EWeaponCollisionResponseTypes type) const
|
||||
{
|
||||
if (x0_generators[u32(type)])
|
||||
|
@ -211,7 +211,7 @@ CCollisionResponseData::GetParticleDescription(EWeaponCollisionResponseTypes typ
|
|||
return x0_generators[u32(type)];
|
||||
}
|
||||
|
||||
const rstl::optional_object<TLockedToken<CDecalDescription>>&
|
||||
const std::experimental::optional<TLockedToken<CDecalDescription>>&
|
||||
CCollisionResponseData::GetDecalDescription(EWeaponCollisionResponseTypes type) const
|
||||
{
|
||||
return x20_decals[u32(type)];
|
||||
|
|
|
@ -46,9 +46,9 @@ class CCollisionResponseData
|
|||
{
|
||||
static const EWeaponCollisionResponseTypes skWorldMaterialTable[32];
|
||||
static const s32 kInvalidSFX;
|
||||
std::vector<rstl::optional_object<TLockedToken<CGenDescription>>> x0_generators;
|
||||
std::vector<std::experimental::optional<TLockedToken<CGenDescription>>> x0_generators;
|
||||
std::vector<s32> x10_sfx;
|
||||
std::vector<rstl::optional_object<TLockedToken<CDecalDescription>>> x20_decals;
|
||||
std::vector<std::experimental::optional<TLockedToken<CDecalDescription>>> x20_decals;
|
||||
float x30_RNGE;
|
||||
float x34_FOFF;
|
||||
|
||||
|
@ -59,8 +59,8 @@ class CCollisionResponseData
|
|||
bool CheckAndAddResourceToResponse(FourCC clsId, CInputStream& in, CSimplePool* resPool);
|
||||
public:
|
||||
CCollisionResponseData(CInputStream& in, CSimplePool* resPool);
|
||||
const rstl::optional_object<TLockedToken<CGenDescription>>& GetParticleDescription(EWeaponCollisionResponseTypes) const;
|
||||
const rstl::optional_object<TLockedToken<CDecalDescription>>& GetDecalDescription(EWeaponCollisionResponseTypes type) const;
|
||||
const std::experimental::optional<TLockedToken<CGenDescription>>& GetParticleDescription(EWeaponCollisionResponseTypes) const;
|
||||
const std::experimental::optional<TLockedToken<CDecalDescription>>& GetDecalDescription(EWeaponCollisionResponseTypes type) const;
|
||||
s32 GetSoundEffectId(EWeaponCollisionResponseTypes) const;
|
||||
static EWeaponCollisionResponseTypes GetWorldCollisionResponseType(s32);
|
||||
static bool ResponseTypeIsEnemyShielded(EWeaponCollisionResponseTypes);
|
||||
|
|
|
@ -18,6 +18,7 @@ class CInGameTweakManagerBase* g_TweakManager = nullptr;
|
|||
class CBooRenderer* g_Renderer = nullptr;
|
||||
class CStringTable* g_MainStringTable = nullptr;
|
||||
class CInputGenerator* g_InputGenerator = nullptr;
|
||||
class CStateManager* g_StateManager = nullptr;
|
||||
|
||||
ITweakGame* g_tweakGame = nullptr;
|
||||
ITweakPlayer* g_tweakPlayer = nullptr;
|
||||
|
|
|
@ -52,6 +52,7 @@ extern class CInGameTweakManagerBase* g_TweakManager;
|
|||
extern class CBooRenderer* g_Renderer;
|
||||
extern class CStringTable* g_MainStringTable;
|
||||
extern class CInputGenerator* g_InputGenerator;
|
||||
extern class CStateManager* g_StateManager;
|
||||
|
||||
#if USE_DOWNCAST_TWEAKS
|
||||
using ITweakGame = DataSpec::DNAMP1::CTweakGame;
|
||||
|
|
|
@ -33,7 +33,7 @@ CSkinnedModel::CSkinnedModel(IObjectStore& store, CAssetId model,
|
|||
|
||||
void CSkinnedModel::Calculate(const CPoseAsTransforms& pose,
|
||||
const CModelFlags& drawFlags,
|
||||
const rstl::optional_object<CVertexMorphEffect>& morphEffect,
|
||||
const std::experimental::optional<CVertexMorphEffect>& morphEffect,
|
||||
const float* morphMagnitudes)
|
||||
{
|
||||
if (morphEffect || g_PointGenFunc)
|
||||
|
|
|
@ -577,7 +577,7 @@ void CSamusHud::UpdateThreatAssessment(float dt, const CStateManager& mgr)
|
|||
|
||||
CPlayer& player = mgr.GetPlayer();
|
||||
zeus::CAABox playerAABB = zeus::CAABox::skNullBox;
|
||||
if (rstl::optional_object<zeus::CAABox> aabb = player.GetTouchBounds())
|
||||
if (std::experimental::optional<zeus::CAABox> aabb = player.GetTouchBounds())
|
||||
playerAABB = *aabb;
|
||||
|
||||
zeus::CAABox aabb;
|
||||
|
@ -596,7 +596,7 @@ void CSamusHud::UpdateThreatAssessment(float dt, const CStateManager& mgr)
|
|||
continue;
|
||||
if (trigger->GetDamageInfo().GetDamage() == 0.f)
|
||||
continue;
|
||||
if (rstl::optional_object<zeus::CAABox> aabb = trigger->GetTouchBounds())
|
||||
if (std::experimental::optional<zeus::CAABox> aabb = trigger->GetTouchBounds())
|
||||
{
|
||||
float dist = playerAABB.distanceBetween(*aabb);
|
||||
if (dist < threatDist)
|
||||
|
|
|
@ -54,7 +54,8 @@
|
|||
#include "Audio/CMidiManager.hpp"
|
||||
#include "CDependencyGroup.hpp"
|
||||
#include "MP1OriginalIDs.hpp"
|
||||
|
||||
#include "CStateManager.hpp"
|
||||
#include "World/CPlayer.hpp"
|
||||
#include <discord-rpc.h>
|
||||
|
||||
namespace hecl
|
||||
|
@ -449,18 +450,6 @@ void CMain::EnsureWorldPakReady(CAssetId mlvl)
|
|||
|
||||
void CMain::Give(hecl::Console* console, const std::vector<std::string>& args)
|
||||
{
|
||||
if (!hecl::com_developer->toBoolean())
|
||||
{
|
||||
console->report(hecl::Console::Level::Info, "Cheats are only available in developer mode");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!hecl::com_enableCheats->toBoolean())
|
||||
{
|
||||
console->report(hecl::Console::Level::Info, "Cheats are not enabled");
|
||||
return;
|
||||
}
|
||||
|
||||
if (args.size() < 1 || (!g_GameState || !g_GameState->GetPlayerState()))
|
||||
return;
|
||||
|
||||
|
@ -501,6 +490,28 @@ void CMain::Give(hecl::Console* console, const std::vector<std::string>& args)
|
|||
}
|
||||
}
|
||||
|
||||
void CMain::Teleport(hecl::Console *, const std::vector<std::string>& args)
|
||||
{
|
||||
if (!g_StateManager || args.size() < 3)
|
||||
return;
|
||||
|
||||
zeus::CVector3f loc;
|
||||
for (u32 i = 0; i < 3; ++i)
|
||||
loc[i] = strtof(args[i].c_str(), nullptr);
|
||||
|
||||
zeus::CTransform xf = g_StateManager->Player()->GetTransform();
|
||||
xf.origin = loc;
|
||||
|
||||
if (args.size() == 6)
|
||||
{
|
||||
zeus::CVector3f angle;
|
||||
for (u32 i = 0; i < 3; ++i)
|
||||
angle[i] = zeus::degToRad(strtof(args[i + 3].c_str(), nullptr));
|
||||
xf.setRotation(zeus::CMatrix3f(zeus::CQuaternion(angle)));
|
||||
}
|
||||
g_StateManager->Player()->Teleport(xf, *g_StateManager, false);
|
||||
}
|
||||
|
||||
void CMain::StreamNewGameState(CBitStreamReader& r, u32 idx)
|
||||
{
|
||||
bool fusionBackup = g_GameState->SystemOptions().GetPlayerFusionSuitActive();
|
||||
|
@ -603,7 +614,8 @@ void CMain::Init(const hecl::Runtime::FileStoreManager& storeMgr,
|
|||
m_cvarMgr = cvarMgr;
|
||||
m_console = std::make_unique<hecl::Console>(m_cvarMgr);
|
||||
m_console->registerCommand("quit"sv, "Quits the game immediately"sv, ""sv, std::bind(&CMain::quit, this, std::placeholders::_1, std::placeholders::_2));
|
||||
m_console->registerCommand("Give"sv, "Gives the player the specified item, maxing it out"sv, ""sv, std::bind(&CMain::Give, this, std::placeholders::_1, std::placeholders::_2));
|
||||
m_console->registerCommand("Give"sv, "Gives the player the specified item, maxing it out"sv, ""sv, std::bind(&CMain::Give, this, std::placeholders::_1, std::placeholders::_2), hecl::SConsoleCommand::ECommandFlags::Cheat);
|
||||
m_console->registerCommand("Teleport"sv, "Teleports the player to the specified coordinates in worldspace"sv, "x y z [dX dY dZ]"sv, std::bind(&CMain::Teleport, this, std::placeholders::_1, std::placeholders::_2), (hecl::SConsoleCommand::ECommandFlags::Cheat | hecl::SConsoleCommand::ECommandFlags::Developer));
|
||||
|
||||
|
||||
InitializeSubsystems(storeMgr);
|
||||
|
|
|
@ -329,6 +329,7 @@ public:
|
|||
m_doQuit = true;
|
||||
}
|
||||
void Give(hecl::Console*, const std::vector<std::string>&);
|
||||
void Teleport(hecl::Console*, const std::vector<std::string>&);
|
||||
hecl::Console* Console() const { return m_console.get(); }
|
||||
};
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ namespace urde::MP1
|
|||
CBeetle::CBeetle(TUniqueId uid, std::string_view name, const CEntityInfo& info, const zeus::CTransform& xf, CModelData&& mData,
|
||||
const CPatternedInfo& pInfo, CPatterned::EFlavorType flavor, CBeetle::EEntranceType, const CDamageInfo&,
|
||||
const CDamageVulnerability&, const zeus::CVector3f&, float, float, float, const CDamageVulnerability&,
|
||||
const CActorParameters& aParams, const rstl::optional_object<CStaticRes>)
|
||||
const CActorParameters& aParams, const std::experimental::optional<CStaticRes>)
|
||||
: CPatterned(ECharacter::Beetle, uid, name, flavor, info, xf, std::move(mData), pInfo, EMovementType::Ground,
|
||||
EColliderType::One, EBodyType::BiPedal, aParams, bool(flavor))
|
||||
{
|
||||
|
|
|
@ -22,7 +22,7 @@ public:
|
|||
CBeetle(TUniqueId, std::string_view, const CEntityInfo&, const zeus::CTransform&, CModelData&&,
|
||||
const CPatternedInfo&, CPatterned::EFlavorType,EEntranceType, const CDamageInfo &, const CDamageVulnerability&,
|
||||
const zeus::CVector3f&, float, float, float, const CDamageVulnerability&, const CActorParameters&,
|
||||
const rstl::optional_object<CStaticRes>);
|
||||
const std::experimental::optional<CStaticRes>);
|
||||
|
||||
void Accept(IVisitor &visitor);
|
||||
};
|
||||
|
|
|
@ -25,7 +25,7 @@ CMetroidPrimeProjectile::CMetroidPrimeProjectile(
|
|||
const zeus::CTransform& xf, EMaterialTypes materials, const CDamageInfo& damage,
|
||||
TUniqueId uid, TAreaId aid, TUniqueId owner, const SPrimeProjectileInfo& auxData,
|
||||
TUniqueId homingTarget, EProjectileAttrib attribs, const zeus::CVector3f& scale,
|
||||
const rstl::optional_object<TLockedToken<CGenDescription>>& visorParticle,
|
||||
const std::experimental::optional<TLockedToken<CGenDescription>>& visorParticle,
|
||||
u16 visorSfx, bool sendCollideMsg)
|
||||
: CEnergyProjectile(active, desc, type, xf, materials, damage, uid, aid, owner, homingTarget, attribs, false,
|
||||
scale, visorParticle, visorSfx, sendCollideMsg), x3d8_auxData(auxData)
|
||||
|
|
|
@ -30,7 +30,7 @@ public:
|
|||
const zeus::CTransform& xf, EMaterialTypes materials, const CDamageInfo& damage,
|
||||
TUniqueId uid, TAreaId aid, TUniqueId owner, const SPrimeProjectileInfo& auxData,
|
||||
TUniqueId homingTarget, EProjectileAttrib attribs, const zeus::CVector3f& scale,
|
||||
const rstl::optional_object<TLockedToken<CGenDescription>>& visorParticle,
|
||||
const std::experimental::optional<TLockedToken<CGenDescription>>& visorParticle,
|
||||
u16 visorSfx, bool sendCollideMsg);
|
||||
};
|
||||
|
||||
|
|
|
@ -1035,6 +1035,7 @@ void CElementGen::RenderModels()
|
|||
CParticleGlobals::SetParticleLifetime(particle.x0_endFrame - particle.x28_startFrame);
|
||||
int partFrame = x74_curFrame - particle.x28_startFrame - 1;
|
||||
CParticleGlobals::UpdateParticleLifetimeTweenValues(partFrame);
|
||||
CParticleGlobals::g_particleAccessParameters = &x60_advValues[i];
|
||||
CVectorElement* pmop = desc->x6c_x58_PMOP.get();
|
||||
if (pmop)
|
||||
pmop->GetValue(partFrame, pmopVec);
|
||||
|
@ -1936,10 +1937,10 @@ bool CElementGen::IsSystemDeletable() const
|
|||
return false;
|
||||
}
|
||||
|
||||
rstl::optional_object<zeus::CAABox> CElementGen::GetBounds() const
|
||||
std::experimental::optional<zeus::CAABox> CElementGen::GetBounds() const
|
||||
{
|
||||
if (GetParticleCountAll() == 0)
|
||||
return {};
|
||||
return std::experimental::nullopt;
|
||||
else
|
||||
return {x2f0_systemBounds};
|
||||
}
|
||||
|
|
|
@ -228,7 +228,7 @@ public:
|
|||
const zeus::CColor& GetModulationColor() const;
|
||||
float GetGeneratorRate() const { return x98_generatorRate; }
|
||||
bool IsSystemDeletable() const;
|
||||
rstl::optional_object<zeus::CAABox> GetBounds() const;
|
||||
std::experimental::optional<zeus::CAABox> GetBounds() const;
|
||||
u32 GetParticleCount() const;
|
||||
bool SystemHasLight() const;
|
||||
CLight GetLight() const;
|
||||
|
|
|
@ -815,7 +815,7 @@ bool CParticleElectric::IsSystemDeletable() const
|
|||
return true;
|
||||
}
|
||||
|
||||
rstl::optional_object<zeus::CAABox> CParticleElectric::GetBounds() const
|
||||
std::experimental::optional<zeus::CAABox> CParticleElectric::GetBounds() const
|
||||
{
|
||||
if (GetParticleCount() <= 0)
|
||||
return {};
|
||||
|
|
|
@ -127,7 +127,7 @@ public:
|
|||
const zeus::CVector3f& GetGlobalScale() const;
|
||||
const zeus::CColor& GetModulationColor() const;
|
||||
bool IsSystemDeletable() const;
|
||||
rstl::optional_object<zeus::CAABox> GetBounds() const;
|
||||
std::experimental::optional<zeus::CAABox> GetBounds() const;
|
||||
u32 GetParticleCount() const;
|
||||
bool SystemHasLight() const;
|
||||
CLight GetLight() const;
|
||||
|
|
|
@ -51,7 +51,7 @@ public:
|
|||
virtual const zeus::CColor& GetModulationColor() const=0;
|
||||
virtual float GetGeneratorRate() const { return 1.f; }
|
||||
virtual bool IsSystemDeletable() const=0;
|
||||
virtual rstl::optional_object<zeus::CAABox> GetBounds() const=0;
|
||||
virtual std::experimental::optional<zeus::CAABox> GetBounds() const=0;
|
||||
virtual u32 GetParticleCount() const=0;
|
||||
virtual bool SystemHasLight() const=0;
|
||||
virtual CLight GetLight() const=0;
|
||||
|
|
|
@ -1150,7 +1150,7 @@ bool CParticleSwoosh::IsSystemDeletable() const
|
|||
return true;
|
||||
}
|
||||
|
||||
rstl::optional_object<zeus::CAABox> CParticleSwoosh::GetBounds() const
|
||||
std::experimental::optional<zeus::CAABox> CParticleSwoosh::GetBounds() const
|
||||
{
|
||||
if (GetParticleCount() <= 1)
|
||||
{
|
||||
|
|
|
@ -150,7 +150,7 @@ public:
|
|||
const zeus::CVector3f& GetGlobalScale() const;
|
||||
const zeus::CColor& GetModulationColor() const;
|
||||
bool IsSystemDeletable() const;
|
||||
rstl::optional_object<zeus::CAABox> GetBounds() const;
|
||||
std::experimental::optional<zeus::CAABox> GetBounds() const;
|
||||
u32 GetParticleCount() const;
|
||||
bool SystemHasLight() const;
|
||||
CLight GetLight() const;
|
||||
|
|
|
@ -146,7 +146,7 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
rstl::optional_object<T> GetAverage() const
|
||||
std::experimental::optional<T> GetAverage() const
|
||||
{
|
||||
if (this->empty())
|
||||
return {};
|
||||
|
@ -154,7 +154,7 @@ public:
|
|||
return {urde::GetAverage<T>(this->data(), this->size())};
|
||||
}
|
||||
|
||||
rstl::optional_object<T> GetEntry(int i) const
|
||||
std::experimental::optional<T> GetEntry(int i) const
|
||||
{
|
||||
if (i >= this->size())
|
||||
return {};
|
||||
|
|
|
@ -15,7 +15,7 @@ struct CBeamInfo
|
|||
CAssetId xc_;
|
||||
CAssetId x10_;
|
||||
CAssetId x14_;
|
||||
u32 x18_;
|
||||
s32 x18_;
|
||||
float x1c_;
|
||||
float x20_;
|
||||
float x24_;
|
||||
|
|
|
@ -5,37 +5,46 @@ namespace urde
|
|||
{
|
||||
|
||||
CBeamProjectile::CBeamProjectile(const TToken<CWeaponDescription>& wDesc, std::string_view name, EWeaponType wType,
|
||||
const zeus::CTransform& xf, int flags, float f1, float f2, EMaterialTypes matType,
|
||||
const zeus::CTransform& xf, s32 flags, float f1, float f2, EMaterialTypes matType,
|
||||
const CDamageInfo& dInfo, TUniqueId uid, TAreaId aid, TUniqueId owner,
|
||||
EProjectileAttrib attribs, bool b1)
|
||||
: CGameProjectile(false, wDesc, name, wType, xf, matType, dInfo, uid, aid, owner, kInvalidUniqueId, attribs, false,
|
||||
zeus::CVector3f::skOne, {}, -1, false)
|
||||
, x2e8_(std::abs(flags))
|
||||
, x2ec_(x2e8_)
|
||||
, x2f0_(1.f / x2ec_)
|
||||
, x2f4_(f1)
|
||||
, x300_(b1 == false ? x2ec_ : 0.f)
|
||||
, x464_24_(b1)
|
||||
, x464_25_(false)
|
||||
{
|
||||
}
|
||||
|
||||
void CBeamProjectile::Think(float, CStateManager &)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
rstl::optional_object<zeus::CAABox> CBeamProjectile::GetTouchBounds() const
|
||||
std::experimental::optional<zeus::CAABox> CBeamProjectile::GetTouchBounds() const
|
||||
{
|
||||
if (!GetActive())
|
||||
return {};
|
||||
if (!x464_25_)
|
||||
{
|
||||
zeus::CVector3f pos = GetTranslation();
|
||||
return {{pos - 1.f, pos + 1.f}};
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
void CBeamProjectile::Touch(CActor &, CStateManager &)
|
||||
void CBeamProjectile::CalculateRenderBounds()
|
||||
{
|
||||
|
||||
x9c_renderBounds = x354_.getTransformedAABox(x324_);
|
||||
}
|
||||
|
||||
void CBeamProjectile::ResetBeam(CStateManager &, bool)
|
||||
{
|
||||
|
||||
if (x464_24_)
|
||||
x300_ = 0.f;
|
||||
}
|
||||
|
||||
void CBeamProjectile::UpdateFX(const zeus::CTransform &, float, CStateManager &)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void CBeamProjectile::Accept(urde::IVisitor& visitor)
|
||||
|
|
|
@ -6,9 +6,26 @@ namespace urde
|
|||
{
|
||||
class CBeamProjectile : public CGameProjectile
|
||||
{
|
||||
u32 x2e8_;
|
||||
float x2ec_;
|
||||
float x2f0_;
|
||||
float x2f4_;
|
||||
u32 x2f8_ = 0;
|
||||
TUniqueId x2fc_ = kInvalidUniqueId;
|
||||
TUniqueId x2fe_ = kInvalidUniqueId;
|
||||
float x300_;
|
||||
float x304_;
|
||||
float x308_;
|
||||
zeus::CVector3f x30c_ = zeus::CVector3f::skUp;
|
||||
zeus::CTransform x324_;
|
||||
zeus::CAABox x354_ = zeus::CAABox::skNullBox;
|
||||
rstl::reserved_vector<zeus::CVector3f, 10> x384_;
|
||||
rstl::reserved_vector<zeus::CVector3f, 8> x400_;
|
||||
bool x464_24_ : 1;
|
||||
bool x464_25_ : 1;
|
||||
public:
|
||||
CBeamProjectile(const TToken<CWeaponDescription>& wDesc, std::string_view name, EWeaponType wType,
|
||||
const zeus::CTransform& xf, int flags, float f1, float f2, EMaterialTypes matType,
|
||||
const zeus::CTransform& xf, s32 flags, float f1, float f2, EMaterialTypes matType,
|
||||
const CDamageInfo& dInfo, TUniqueId uid, TAreaId aid, TUniqueId owner,
|
||||
EProjectileAttrib attribs, bool b1);
|
||||
|
||||
|
@ -26,9 +43,8 @@ public:
|
|||
void GetMaxLength();
|
||||
s32 GetIntMaxLength();
|
||||
|
||||
void Think(float, CStateManager&);
|
||||
rstl::optional_object<zeus::CAABox> GetTouchBounds() const;
|
||||
void Touch(CActor&, CStateManager&);
|
||||
std::experimental::optional<zeus::CAABox> GetTouchBounds() const;
|
||||
void CalculateRenderBounds();
|
||||
virtual void ResetBeam(CStateManager&, bool);
|
||||
virtual void UpdateFX(const zeus::CTransform&, float, CStateManager&);
|
||||
};
|
||||
|
|
|
@ -19,7 +19,7 @@ CEnergyProjectile::CEnergyProjectile(bool active, const TToken<CWeaponDescriptio
|
|||
const zeus::CTransform& xf, EMaterialTypes excludeMat, const CDamageInfo& damage,
|
||||
TUniqueId uid, TAreaId aid, TUniqueId owner, TUniqueId homingTarget,
|
||||
EProjectileAttrib attribs, bool underwater, const zeus::CVector3f& scale,
|
||||
const rstl::optional_object<TLockedToken<CGenDescription>>& visorParticle,
|
||||
const std::experimental::optional<TLockedToken<CGenDescription>>& visorParticle,
|
||||
u16 visorSfx, bool sendCollideMsg)
|
||||
: CGameProjectile(active, desc, "GameProjectile", type, xf, excludeMat, damage, uid, aid,
|
||||
owner, homingTarget, attribs, underwater, scale, visorParticle, visorSfx, sendCollideMsg),
|
||||
|
|
|
@ -31,7 +31,7 @@ public:
|
|||
const zeus::CTransform& xf, EMaterialTypes excludeMat, const CDamageInfo& damage,
|
||||
TUniqueId uid, TAreaId aid, TUniqueId owner, TUniqueId homingTarget,
|
||||
EProjectileAttrib attribs, bool underwater, const zeus::CVector3f& scale,
|
||||
const rstl::optional_object<TLockedToken<CGenDescription>>& visorParticle,
|
||||
const std::experimental::optional<TLockedToken<CGenDescription>>& visorParticle,
|
||||
u16 visorSfx, bool sendCollideMsg);
|
||||
void SetCameraShake(const CCameraShakeData& data) { x2fc_camShake = data; x3d0_27_camShakeDirty = true; }
|
||||
void PlayImpactSound(const zeus::CVector3f& pos, EWeaponCollisionResponseTypes type);
|
||||
|
|
|
@ -18,7 +18,7 @@ CGameProjectile::CGameProjectile(bool active, const TToken<CWeaponDescription>&
|
|||
const CDamageInfo& dInfo, TUniqueId uid, TAreaId aid, TUniqueId owner,
|
||||
TUniqueId homingTarget, EProjectileAttrib attribs, bool underwater,
|
||||
const zeus::CVector3f& scale,
|
||||
const rstl::optional_object<TLockedToken<CGenDescription>>& visorParticle,
|
||||
const std::experimental::optional<TLockedToken<CGenDescription>>& visorParticle,
|
||||
u16 visorSfx, bool sendCollideMsg)
|
||||
: CWeapon(uid, aid, active, owner, wType, name, xf,
|
||||
CMaterialFilter::MakeIncludeExclude(
|
||||
|
|
|
@ -18,9 +18,9 @@ class CWeaponDescription;
|
|||
class CProjectileTouchResult
|
||||
{
|
||||
TUniqueId x0_id;
|
||||
rstl::optional_object<CRayCastResult> x4_result;
|
||||
std::experimental::optional<CRayCastResult> x4_result;
|
||||
public:
|
||||
CProjectileTouchResult(TUniqueId id, const rstl::optional_object<CRayCastResult>& result)
|
||||
CProjectileTouchResult(TUniqueId id, const std::experimental::optional<CRayCastResult>& result)
|
||||
: x0_id(id), x4_result(result) {}
|
||||
TUniqueId GetActorId() const { return x0_id; }
|
||||
bool HasRayCastResult() const { return x4_result.operator bool(); }
|
||||
|
@ -30,7 +30,7 @@ public:
|
|||
class CGameProjectile : public CWeapon
|
||||
{
|
||||
protected:
|
||||
rstl::optional_object<TLockedToken<CGenDescription>> x158_visorParticle;
|
||||
std::experimental::optional<TLockedToken<CGenDescription>> x158_visorParticle;
|
||||
u16 x168_visorSfx;
|
||||
CProjectileWeapon x170_projectile;
|
||||
zeus::CVector3f x298_lastOrigin;
|
||||
|
@ -62,7 +62,7 @@ public:
|
|||
EWeaponType wType, const zeus::CTransform& xf, EMaterialTypes excludeMat,
|
||||
const CDamageInfo& dInfo, TUniqueId uid, TAreaId aid, TUniqueId owner,
|
||||
TUniqueId homingTarget, EProjectileAttrib attribs, bool underwater, const zeus::CVector3f& scale,
|
||||
const rstl::optional_object<TLockedToken<CGenDescription>>& visorParticle,
|
||||
const std::experimental::optional<TLockedToken<CGenDescription>>& visorParticle,
|
||||
u16 visorSfx, bool sendCollideMsg);
|
||||
|
||||
virtual void Accept(IVisitor &visitor);
|
||||
|
|
|
@ -91,7 +91,7 @@ zeus::CVector3f CProjectileWeapon::GetTranslation() const
|
|||
return x14_localToWorldXf * (x44_localXf * x8c_projOffset + x80_localOffset) + x74_worldOffset;
|
||||
}
|
||||
|
||||
rstl::optional_object<zeus::CAABox> CProjectileWeapon::GetBounds() const
|
||||
std::experimental::optional<zeus::CAABox> CProjectileWeapon::GetBounds() const
|
||||
{
|
||||
zeus::CAABox aabb;
|
||||
bool ret = false;
|
||||
|
@ -160,7 +160,7 @@ float CProjectileWeapon::GetAudibleRange() const
|
|||
return x4_weaponDesc->x94_COLR.m_res->GetAudibleRange();
|
||||
}
|
||||
|
||||
rstl::optional_object<TLockedToken<CDecalDescription>>
|
||||
std::experimental::optional<TLockedToken<CDecalDescription>>
|
||||
CProjectileWeapon::GetDecalForCollision(EWeaponCollisionResponseTypes type) const
|
||||
{
|
||||
if (!x4_weaponDesc->x94_COLR)
|
||||
|
@ -175,7 +175,7 @@ u16 CProjectileWeapon::GetSoundIdForCollision(EWeaponCollisionResponseTypes type
|
|||
return u16(x4_weaponDesc->x94_COLR.m_res->GetSoundEffectId(type));
|
||||
}
|
||||
|
||||
rstl::optional_object<TLockedToken<CGenDescription>>
|
||||
std::experimental::optional<TLockedToken<CGenDescription>>
|
||||
CProjectileWeapon::CollisionOccured(EWeaponCollisionResponseTypes type, bool deflected, bool useTarget,
|
||||
const zeus::CVector3f& pos, const zeus::CVector3f& normal,
|
||||
const zeus::CVector3f& target)
|
||||
|
|
|
@ -45,7 +45,7 @@ class CProjectileWeapon
|
|||
std::unique_ptr<CElementGen> xfc_APSMGen;
|
||||
std::unique_ptr<CElementGen> x100_APS2Gen;
|
||||
std::unique_ptr<CElementGen> x104_;
|
||||
rstl::optional_object<TLockedToken<CModel>> x108_model;
|
||||
std::experimental::optional<TLockedToken<CModel>> x108_model;
|
||||
std::unique_ptr<CParticleSwoosh> x118_swoosh1;
|
||||
std::unique_ptr<CParticleSwoosh> x11c_swoosh2;
|
||||
std::unique_ptr<CParticleSwoosh> x120_swoosh3;
|
||||
|
@ -70,16 +70,16 @@ public:
|
|||
const zeus::CTransform& orient, const zeus::CVector3f& scale, s32);
|
||||
virtual ~CProjectileWeapon() = default;
|
||||
bool IsProjectileActive() const { return x124_24_active; }
|
||||
rstl::optional_object<zeus::CAABox> GetBounds() const;
|
||||
std::experimental::optional<zeus::CAABox> GetBounds() const;
|
||||
const zeus::CVector3f& GetVelocity() const { return xb0_velocity; }
|
||||
void SetVelocity(const zeus::CVector3f& vel) { xb0_velocity = vel; }
|
||||
float GetMaxTurnRate() const { return xe0_maxTurnRate; }
|
||||
float GetAudibleFallOff() const;
|
||||
float GetAudibleRange() const;
|
||||
rstl::optional_object<TLockedToken<CDecalDescription>>
|
||||
std::experimental::optional<TLockedToken<CDecalDescription>>
|
||||
GetDecalForCollision(EWeaponCollisionResponseTypes type) const;
|
||||
u16 GetSoundIdForCollision(EWeaponCollisionResponseTypes type) const;
|
||||
rstl::optional_object<TLockedToken<CGenDescription>>
|
||||
std::experimental::optional<TLockedToken<CGenDescription>>
|
||||
CollisionOccured(EWeaponCollisionResponseTypes type, bool deflected, bool useTarget, const zeus::CVector3f& pos,
|
||||
const zeus::CVector3f& normal, const zeus::CVector3f& target);
|
||||
TLockedToken<CWeaponDescription> GetWeaponDescription() const { return x4_weaponDesc; }
|
||||
|
|
|
@ -8,7 +8,7 @@ CTargetableProjectile::CTargetableProjectile(
|
|||
const zeus::CTransform& xf, EMaterialTypes materials, const CDamageInfo& damage,
|
||||
const CDamageInfo& damage2, TUniqueId uid, TAreaId aid, TUniqueId owner,
|
||||
TUniqueId homingTarget, EProjectileAttrib attribs,
|
||||
const rstl::optional_object<TLockedToken<CGenDescription>>& visorParticle,
|
||||
const std::experimental::optional<TLockedToken<CGenDescription>>& visorParticle,
|
||||
u16 visorSfx, bool sendCollideMsg)
|
||||
: CEnergyProjectile(true, desc, type, xf, materials, damage, uid, aid, owner, homingTarget,
|
||||
attribs | EProjectileAttrib::BigProjectile | EProjectileAttrib::PartialCharge |
|
||||
|
|
|
@ -14,7 +14,7 @@ public:
|
|||
const zeus::CTransform& xf, EMaterialTypes materials, const CDamageInfo& damage,
|
||||
const CDamageInfo& damage2, TUniqueId uid, TAreaId aid, TUniqueId owner,
|
||||
TUniqueId homingTarget, EProjectileAttrib attribs,
|
||||
const rstl::optional_object<TLockedToken<CGenDescription>>& visorParticle,
|
||||
const std::experimental::optional<TLockedToken<CGenDescription>>& visorParticle,
|
||||
u16 visorSfx, bool sendCollideMsg);
|
||||
};
|
||||
|
||||
|
|
|
@ -349,7 +349,7 @@ const CDamageVulnerability* CActor::GetDamageVulnerability(const zeus::CVector3f
|
|||
return GetDamageVulnerability();
|
||||
}
|
||||
|
||||
rstl::optional_object<zeus::CAABox> CActor::GetTouchBounds() const { return {}; }
|
||||
std::experimental::optional<zeus::CAABox> CActor::GetTouchBounds() const { return {}; }
|
||||
|
||||
void CActor::Touch(CActor&, CStateManager&) {}
|
||||
|
||||
|
|
|
@ -122,7 +122,7 @@ public:
|
|||
virtual const CDamageVulnerability* GetDamageVulnerability() const;
|
||||
virtual const CDamageVulnerability* GetDamageVulnerability(const zeus::CVector3f&, const zeus::CVector3f&,
|
||||
const CDamageInfo&) const;
|
||||
virtual rstl::optional_object<zeus::CAABox> GetTouchBounds() const;
|
||||
virtual std::experimental::optional<zeus::CAABox> GetTouchBounds() const;
|
||||
virtual void Touch(CActor&, CStateManager&);
|
||||
virtual zeus::CVector3f GetOrbitPosition(const CStateManager&) const;
|
||||
virtual zeus::CVector3f GetAimPosition(const CStateManager&, float) const;
|
||||
|
|
|
@ -501,6 +501,14 @@ CGameArea::~CGameArea()
|
|||
while (!Invalidate(nullptr)) {}
|
||||
}
|
||||
|
||||
bool CGameArea::IsFinishedOccluding() const
|
||||
{
|
||||
if (x12c_postConstructed->x10dc_occlusionState != EOcclusionState::Occluded)
|
||||
return true;
|
||||
|
||||
return x12c_postConstructed->x1108_27_;
|
||||
}
|
||||
|
||||
std::pair<std::unique_ptr<u8[]>, s32> CGameArea::IGetScriptingMemoryAlways() const
|
||||
{
|
||||
return GetScriptingMemoryAlways(*this);
|
||||
|
|
|
@ -1058,7 +1058,7 @@ bool CPlayer::IsUnderBetaMetroidAttack(CStateManager& mgr) const
|
|||
return false;
|
||||
}
|
||||
|
||||
rstl::optional_object<zeus::CAABox> CPlayer::GetTouchBounds() const
|
||||
std::experimental::optional<zeus::CAABox> CPlayer::GetTouchBounds() const
|
||||
{
|
||||
if (x2f8_morphBallState == EPlayerMorphBallState::Morphed)
|
||||
{
|
||||
|
|
|
@ -461,7 +461,7 @@ public:
|
|||
void Accept(IVisitor& visitor);
|
||||
CHealthInfo* HealthInfo(CStateManager& mgr);
|
||||
bool IsUnderBetaMetroidAttack(CStateManager& mgr) const;
|
||||
rstl::optional_object<zeus::CAABox> GetTouchBounds() const;
|
||||
std::experimental::optional<zeus::CAABox> GetTouchBounds() const;
|
||||
void Touch(CActor& actor, CStateManager& mgr);
|
||||
void DoPreThink(float dt, CStateManager& mgr);
|
||||
void DoThink(float dt, CStateManager& mgr);
|
||||
|
|
|
@ -193,7 +193,7 @@ CScriptActor::GetCollisionResponseType(const zeus::CVector3f& v1, const zeus::CV
|
|||
return CActor::GetCollisionResponseType(v1, v2, wMode, w);
|
||||
}
|
||||
|
||||
rstl::optional_object<zeus::CAABox> CScriptActor::GetTouchBounds() const
|
||||
std::experimental::optional<zeus::CAABox> CScriptActor::GetTouchBounds() const
|
||||
{
|
||||
if (GetActive() && x68_material.HasMaterial(EMaterialTypes::Solid))
|
||||
return {CPhysicsActor::GetBoundingBox()};
|
||||
|
|
|
@ -42,7 +42,7 @@ public:
|
|||
zeus::CAABox GetSortingBounds(const CStateManager&) const;
|
||||
EWeaponCollisionResponseTypes GetCollisionResponseType(const zeus::CVector3f&, const zeus::CVector3f&,
|
||||
const CWeaponMode&, EProjectileAttrib) const;
|
||||
rstl::optional_object<zeus::CAABox> GetTouchBounds() const;
|
||||
std::experimental::optional<zeus::CAABox> GetTouchBounds() const;
|
||||
void Touch(CActor&, CStateManager&);
|
||||
const CDamageVulnerability* GetDamageVulnerability() const { return &x268_damageVulnerability; }
|
||||
CHealthInfo* HealthInfo(CStateManager&) { return &x260_currentHealth; }
|
||||
|
|
|
@ -50,7 +50,7 @@ void CScriptAiJumpPoint::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId oth
|
|||
}
|
||||
}
|
||||
|
||||
rstl::optional_object<zeus::CAABox> CScriptAiJumpPoint::GetTouchBounds() const { return xec_; }
|
||||
std::experimental::optional<zeus::CAABox> CScriptAiJumpPoint::GetTouchBounds() const { return xec_; }
|
||||
|
||||
bool CScriptAiJumpPoint::GetInUse(TUniqueId uid) const
|
||||
{
|
||||
|
|
|
@ -30,7 +30,7 @@ public:
|
|||
void AcceptScriptMsg(EScriptObjectMessage, TUniqueId, CStateManager&);
|
||||
void AddToRenderer(const zeus::CFrustum&, const CStateManager&) const {}
|
||||
void Render(const CStateManager&) const {}
|
||||
rstl::optional_object<zeus::CAABox> GetTouchBounds() const;
|
||||
std::experimental::optional<zeus::CAABox> GetTouchBounds() const;
|
||||
bool GetInUse(TUniqueId uid) const;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ void CScriptCameraPitchVolume::Think(float, CStateManager& mgr)
|
|||
x13c_24_entered = false;
|
||||
}
|
||||
|
||||
rstl::optional_object<zeus::CAABox> CScriptCameraPitchVolume::GetTouchBounds() const
|
||||
std::experimental::optional<zeus::CAABox> CScriptCameraPitchVolume::GetTouchBounds() const
|
||||
{
|
||||
return {xe8_obbox.calculateAABox(zeus::CTransform::Identity())};
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ public:
|
|||
|
||||
void Accept(IVisitor& visitor);
|
||||
void Think(float, CStateManager&);
|
||||
rstl::optional_object<zeus::CAABox> GetTouchBounds() const;
|
||||
std::experimental::optional<zeus::CAABox> GetTouchBounds() const;
|
||||
void Touch(CActor&, CStateManager&);
|
||||
float GetUpPitch() const { return x124_upPitch; }
|
||||
float GetDownPitch() const { return x128_downPitch; }
|
||||
|
|
|
@ -30,7 +30,7 @@ void CScriptCoverPoint::Think(float delta, CStateManager&)
|
|||
x11c_timeLeft -= delta;
|
||||
}
|
||||
|
||||
rstl::optional_object<zeus::CAABox> CScriptCoverPoint::GetTouchBounds() const
|
||||
std::experimental::optional<zeus::CAABox> CScriptCoverPoint::GetTouchBounds() const
|
||||
{
|
||||
if (x100_touchBounds)
|
||||
return x100_touchBounds;
|
||||
|
|
|
@ -227,7 +227,7 @@ void CScriptDamageableTrigger::Think(float dt, CStateManager& mgr)
|
|||
}
|
||||
}
|
||||
|
||||
rstl::optional_object<zeus::CAABox> CScriptDamageableTrigger::GetTouchBounds() const
|
||||
std::experimental::optional<zeus::CAABox> CScriptDamageableTrigger::GetTouchBounds() const
|
||||
{
|
||||
if (!x30_24_active || !x300_24_notOccluded)
|
||||
return {};
|
||||
|
|
|
@ -62,7 +62,7 @@ public:
|
|||
const CDamageVulnerability* GetDamageVulnerability() const { return &x174_dVuln; }
|
||||
CHealthInfo* HealthInfo(CStateManager&) { return &x16c_hInfo; }
|
||||
void Think(float, CStateManager&);
|
||||
rstl::optional_object<zeus::CAABox> GetTouchBounds() const;
|
||||
std::experimental::optional<zeus::CAABox> GetTouchBounds() const;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ void CScriptDebris::Accept(IVisitor& visitor)
|
|||
visitor.Visit(this);
|
||||
}
|
||||
|
||||
rstl::optional_object<zeus::CAABox> CScriptDebris::GetTouchBounds() const
|
||||
std::experimental::optional<zeus::CAABox> CScriptDebris::GetTouchBounds() const
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ public:
|
|||
bool, bool, bool, bool);
|
||||
|
||||
void Accept(IVisitor& visitor);
|
||||
rstl::optional_object<zeus::CAABox> GetTouchBounds() const;
|
||||
std::experimental::optional<zeus::CAABox> GetTouchBounds() const;
|
||||
|
||||
void CollidedWith(TUniqueId uid, const CCollisionInfoList&, CStateManager&);
|
||||
};
|
||||
|
|
|
@ -167,7 +167,7 @@ void CScriptDock::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStat
|
|||
}
|
||||
}
|
||||
|
||||
rstl::optional_object<zeus::CAABox> CScriptDock::GetTouchBounds() const
|
||||
std::experimental::optional<zeus::CAABox> CScriptDock::GetTouchBounds() const
|
||||
{
|
||||
if (x264_dockState == EDockState::Three)
|
||||
return {};
|
||||
|
@ -196,7 +196,7 @@ void CScriptDock::SetDockReference(CStateManager& mgr, s32 ref)
|
|||
x268_24_dockReferenced = true;
|
||||
}
|
||||
|
||||
s32 CScriptDock::GetDockReference(CStateManager& mgr) const
|
||||
s32 CScriptDock::GetDockReference(const CStateManager& mgr) const
|
||||
{
|
||||
return mgr.GetWorld()->GetAreaAlways(x260_area)->GetDock(x25c_dock)->GetReferenceCount();
|
||||
}
|
||||
|
|
|
@ -39,14 +39,14 @@ public:
|
|||
void Accept(IVisitor& visitor);
|
||||
void Think(float, CStateManager&);
|
||||
void AcceptScriptMsg(EScriptObjectMessage, TUniqueId, CStateManager&);
|
||||
rstl::optional_object<zeus::CAABox> GetTouchBounds() const;
|
||||
std::experimental::optional<zeus::CAABox> GetTouchBounds() const;
|
||||
void Touch(CActor&, CStateManager&);
|
||||
void CleanUp() {}
|
||||
zeus::CPlane GetPlane(const CStateManager&) const;
|
||||
TAreaId GetDestinationAreaId() const { return x260_area; }
|
||||
s32 GetDockId() const { return x25c_dock; }
|
||||
void SetDockReference(CStateManager& mgr, s32);
|
||||
s32 GetDockReference(CStateManager& mgr) const;
|
||||
s32 GetDockReference(const CStateManager& mgr) const;
|
||||
TAreaId GetCurrentConnectedAreaId(const CStateManager&) const;
|
||||
void UpdateAreaActivateFlags(CStateManager&);
|
||||
bool HasPointCrossedDock(const CStateManager&, const zeus::CVector3f&) const;
|
||||
|
|
|
@ -28,10 +28,11 @@ static CMaterialList MakeDoorMaterialList(bool open)
|
|||
CScriptDoor::CScriptDoor(TUniqueId uid, std::string_view name, const CEntityInfo& info,
|
||||
const zeus::CTransform& xf, CModelData&& mData, const CActorParameters& actParms,
|
||||
const zeus::CVector3f&, const zeus::CAABox& aabb, bool active,
|
||||
bool open, bool b2, float, bool ballDoor)
|
||||
bool open, bool b2, float f1, bool ballDoor)
|
||||
: CPhysicsActor(uid, active, name, info, xf, std::move(mData), MakeDoorMaterialList(open),
|
||||
aabb, SMoverData(1.f), actParms, 0.3f, 0.1f)
|
||||
{
|
||||
x258_ = f1;
|
||||
x2a8_29_ballDoor = ballDoor;
|
||||
x2a8_25_ = open;
|
||||
x2a8_26_useConservativeCameraDistance = open;
|
||||
|
@ -60,11 +61,112 @@ zeus::CVector3f CScriptDoor::GetOrbitPosition(const CStateManager& /*mgr*/) cons
|
|||
/* ORIGINAL 0-00 OFFSET: 8007E550 */
|
||||
void CScriptDoor::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager &mgr)
|
||||
{
|
||||
(void)mgr;
|
||||
(void)uid;
|
||||
(void)msg;
|
||||
switch(msg)
|
||||
{
|
||||
case EScriptObjectMessage::Close:
|
||||
{
|
||||
if (!GetActive())
|
||||
return;
|
||||
|
||||
if (x27c_partner1 == kInvalidUniqueId || uid != x27c_partner1)
|
||||
return;
|
||||
|
||||
if (x2a8_26_useConservativeCameraDistance)
|
||||
{
|
||||
if (x27e_partner2 != kInvalidUniqueId)
|
||||
{
|
||||
if (CEntity* ent = mgr.ObjectById(x27e_partner2))
|
||||
mgr.SendScriptMsg(ent, GetUniqueId(), EScriptObjectMessage::Close);
|
||||
}
|
||||
x2a8_26_useConservativeCameraDistance = false;
|
||||
SetDoorAnimation(EDoorAnimType::Close);
|
||||
mgr.GetCameraManager()->GetBallCamera()->DoorClosing(GetUniqueId());
|
||||
}
|
||||
else if (x2a8_27_)
|
||||
{
|
||||
x2a8_27_ = false;
|
||||
SendScriptMsgs(EScriptObjectState::Closed, mgr, EScriptObjectMessage::None);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case EScriptObjectMessage::Action:
|
||||
{
|
||||
if (x27c_partner1 != kInvalidUniqueId)
|
||||
{
|
||||
if (TCastToPtr<CScriptDoor> door = mgr.ObjectById(x27c_partner1))
|
||||
{
|
||||
if (x2a8_26_useConservativeCameraDistance)
|
||||
return;
|
||||
x2a8_30_ = true;
|
||||
mgr.SendScriptMsg(door, GetUniqueId(), EScriptObjectMessage::Close);
|
||||
}
|
||||
}
|
||||
else if (x2a8_26_useConservativeCameraDistance)
|
||||
{
|
||||
x2a8_30_ = true;
|
||||
if (TCastToPtr<CScriptDoor> door = mgr.ObjectById(x27e_partner2))
|
||||
{
|
||||
mgr.SendScriptMsg(door, GetUniqueId(), EScriptObjectMessage::Close);
|
||||
x2a8_30_ = true;
|
||||
}
|
||||
x2a8_26_useConservativeCameraDistance = false;
|
||||
SetDoorAnimation(EDoorAnimType::Close);
|
||||
mgr.GetCameraManager()->GetBallCamera()->DoorClosing(GetUniqueId());
|
||||
}
|
||||
break;
|
||||
}
|
||||
case EScriptObjectMessage::Open:
|
||||
{
|
||||
if (!GetActive() || x2a8_26_useConservativeCameraDistance)
|
||||
return;
|
||||
|
||||
u32 doorCond = TCastToConstPtr<CScriptDoor>(mgr.GetObjectById(uid)) ? 2 : GetDoorOpenCondition(mgr);
|
||||
switch(doorCond)
|
||||
{
|
||||
case 1:
|
||||
x2a8_27_ = true;
|
||||
x280_ = uid;
|
||||
break;
|
||||
case 2:
|
||||
OpenDoor(uid, mgr);
|
||||
break;
|
||||
default:
|
||||
x2a8_25_= false;
|
||||
x2a8_24_ = true;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case EScriptObjectMessage::InitializedInArea:
|
||||
{
|
||||
for (const SConnection& conn : x20_conns)
|
||||
{
|
||||
if (conn.x4_msg == EScriptObjectMessage::Increment)
|
||||
{
|
||||
TUniqueId dock = mgr.GetIdForScript(conn.x8_objId);
|
||||
if (TCastToConstPtr<CScriptDock>(mgr.GetObjectById(dock)))
|
||||
x282_dockId = dock;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case EScriptObjectMessage::SetToZero:
|
||||
{
|
||||
x2a8_28_ = true;
|
||||
mgr.MapWorldInfo()->SetDoorVisited(mgr.GetEditorIdForUniqueId(GetUniqueId()), true);
|
||||
break;
|
||||
}
|
||||
case EScriptObjectMessage::SetToMax:
|
||||
{
|
||||
x2a8_28_ = false;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
CActor::AcceptScriptMsg(msg, uid, mgr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CScriptDoor::Think(float dt, CStateManager& mgr)
|
||||
{
|
||||
if (!GetActive())
|
||||
|
@ -75,6 +177,44 @@ void CScriptDoor::Think(float dt, CStateManager& mgr)
|
|||
if (x25c_ < 0.5f)
|
||||
x25c_ += dt;
|
||||
}
|
||||
|
||||
if (x2a8_27_ && GetDoorOpenCondition(mgr) == 2)
|
||||
{
|
||||
x2a8_27_ = false;
|
||||
OpenDoor(x280_, mgr);
|
||||
}
|
||||
|
||||
if (x2a8_24_)
|
||||
{
|
||||
x2a8_25_ = false;
|
||||
mgr.GetCameraManager()->GetBallCamera()->DoorClosed(GetUniqueId());
|
||||
x2a8_28_ = false;
|
||||
x2a8_24_ = false;
|
||||
SendScriptMsgs(EScriptObjectState::Closed, mgr, EScriptObjectMessage::Decrement);
|
||||
x2a8_30_ = false;
|
||||
x25c_ = 0.f;
|
||||
}
|
||||
|
||||
if (x2a8_26_useConservativeCameraDistance && x64_modelData->IsAnimating())
|
||||
RemoveMaterial(EMaterialTypes::Solid, EMaterialTypes::Occluder, EMaterialTypes::Orbit, EMaterialTypes::Scannable, mgr);
|
||||
else if (x2a8_25_ && x64_modelData->IsAnimating())
|
||||
{
|
||||
x2a8_25_ = false;
|
||||
mgr.GetCameraManager()->GetBallCamera()->DoorClosed(GetUniqueId());
|
||||
x2a8_28_ = false;
|
||||
x2a8_27_ = false;
|
||||
SendScriptMsgs(EScriptObjectState::Closed, mgr, EScriptObjectMessage::None);
|
||||
}
|
||||
|
||||
if (GetScannableObjectInfo())
|
||||
AddMaterial(EMaterialTypes::Solid, EMaterialTypes::Metal, EMaterialTypes::Occluder, EMaterialTypes::Orbit, EMaterialTypes::Scannable, mgr);
|
||||
else
|
||||
AddMaterial(EMaterialTypes::Solid, EMaterialTypes::Metal, EMaterialTypes::Occluder, EMaterialTypes::Orbit, mgr);
|
||||
|
||||
if (x64_modelData->IsAnimating())
|
||||
UpdateAnimation((x64_modelData->GetAnimationDuration(s32(x260_doorState)) / x258_) * dt, mgr, true);
|
||||
|
||||
xe7_31_targetable = mgr.GetPlayerState()->GetCurrentVisor() == CPlayerState::EPlayerVisor::Scan;
|
||||
}
|
||||
|
||||
void CScriptDoor::AddToRenderer(const zeus::CFrustum& /*frustum*/, CStateManager &mgr)
|
||||
|
@ -110,17 +250,17 @@ void CScriptDoor::ForceClosed(CStateManager & mgr)
|
|||
}
|
||||
|
||||
/* ORIGINAL 0-00 OFFSET: 8007E1C4 */
|
||||
bool CScriptDoor::IsConnectedToArea(const CStateManager& mgr, TAreaId area)
|
||||
bool CScriptDoor::IsConnectedToArea(const CStateManager& mgr, TAreaId areaId)
|
||||
{
|
||||
const CScriptDock* dock = TCastToConstPtr<CScriptDock>(mgr.GetObjectById(x282_dockId));
|
||||
if (dock)
|
||||
{
|
||||
if (dock->GetDestinationAreaId() == area)
|
||||
if (dock->GetDestinationAreaId() == areaId)
|
||||
return true;
|
||||
|
||||
const CGameArea* area = mgr.GetWorld()->GetAreaAlways(areaId);
|
||||
if (area->GetDock(dock->GetDockId())->GetConnectedAreaId(dock->GetDockReference(mgr)) == areaId)
|
||||
return true;
|
||||
/*
|
||||
* TODO: Determine what's going on here
|
||||
* CWorld* world = mgr.GetWorld();
|
||||
*/
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -130,36 +270,117 @@ void CScriptDoor::OpenDoor(TUniqueId uid, CStateManager& mgr)
|
|||
{
|
||||
TEditorId eid = mgr.GetEditorIdForUniqueId(uid);
|
||||
mgr.MapWorldInfo()->SetDoorVisited(eid, true);
|
||||
x2a8_26_useConservativeCameraDistance = true;
|
||||
x2a8_25_ = true;
|
||||
x2a8_27_ = false;
|
||||
|
||||
const CScriptDoor* door = TCastToConstPtr<CScriptDoor>(mgr.GetObjectById(uid));
|
||||
|
||||
if (door)
|
||||
x27c_partner = door->GetUniqueId();
|
||||
x27c_partner1 = door->GetUniqueId();
|
||||
|
||||
SetDoorAnimation(EDoorAnimType::Open);
|
||||
if (x27c_partner != kInvalidUniqueId)
|
||||
SendScriptMsgs(EScriptObjectState::MaxReached, mgr, EScriptObjectMessage::None);
|
||||
else
|
||||
{
|
||||
if (x27c_partner1 == kInvalidUniqueId)
|
||||
SendScriptMsgs(EScriptObjectState::Open, mgr, EScriptObjectMessage::None);
|
||||
else
|
||||
SendScriptMsgs(EScriptObjectState::MaxReached, mgr, EScriptObjectMessage::None);
|
||||
|
||||
/* TODO: Finish this */
|
||||
if (TCastToConstPtr<CScriptDock> dock1 = mgr.GetObjectById(x282_dockId))
|
||||
{
|
||||
for (CEntity* ent : mgr.GetPlatformAndDoorObjectList())
|
||||
{
|
||||
TCastToConstPtr<CScriptDoor> door = ent;
|
||||
if (!door || door->GetUniqueId() == GetUniqueId())
|
||||
continue;
|
||||
|
||||
if(TCastToConstPtr<CScriptDock> dock2 = mgr.GetObjectById(door->x282_dockId))
|
||||
{
|
||||
if (dock1->GetCurrentConnectedAreaId(mgr) == dock2->GetDestinationAreaId() && dock2->GetCurrentConnectedAreaId(mgr) == dock1->GetDestinationAreaId())
|
||||
{
|
||||
x27e_partner2 = door->GetUniqueId();
|
||||
mgr.SendScriptMsg(ent, GetUniqueId(), EScriptObjectMessage::Open);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (x27c_partner1 == kInvalidUniqueId && x27e_partner2 == kInvalidUniqueId)
|
||||
{
|
||||
for (const SConnection& conn : x20_conns)
|
||||
{
|
||||
if (conn.x4_msg != EScriptObjectMessage::Open)
|
||||
continue;
|
||||
if (TCastToConstPtr<CScriptDoor> door = mgr.GetObjectById(mgr.GetIdForScript(conn.x8_objId)))
|
||||
x27e_partner2 = door->GetUniqueId();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* ORIGINAL 0-00 OFFSET: 8007ED4C */
|
||||
u32 CScriptDoor::GetDoorOpenCondition(CStateManager& mgr)
|
||||
{
|
||||
const CScriptDock* dock = TCastToConstPtr<CScriptDock>(mgr.GetObjectById(x282_dockId));
|
||||
|
||||
const TCastToPtr<CScriptDock> dock = mgr.ObjectById(x282_dockId);
|
||||
if (!dock)
|
||||
return 2;
|
||||
|
||||
if (x25c_ < 0.05f)
|
||||
if (x25c_ < 0.05f || x2a8_30_)
|
||||
return 1;
|
||||
|
||||
/* TODO: Finish this */
|
||||
return 0;
|
||||
TAreaId destArea = dock->GetDestinationAreaId();
|
||||
if (destArea < 0 || destArea > mgr.GetWorld()->GetNumAreas())
|
||||
return 0;
|
||||
|
||||
if (!mgr.GetWorld()->AreSkyNeedsMet())
|
||||
return 1;
|
||||
|
||||
TAreaId connArea = mgr.GetWorld()->GetAreaAlways(
|
||||
dock->GetDestinationAreaId())->GetDock(
|
||||
dock->GetDockId())->GetConnectedAreaId(dock->GetDockReference(mgr));
|
||||
|
||||
if (connArea == kInvalidAreaId)
|
||||
return 0;
|
||||
|
||||
const CWorld* world = mgr.GetWorld();
|
||||
const CGameArea* area = world->GetAreaAlways(connArea);
|
||||
|
||||
if (!area->IsPostConstructed())
|
||||
{
|
||||
mgr.SendScriptMsg(dock, GetUniqueId(), EScriptObjectMessage::SetToMax);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (area->GetPostConstructed()->x113c_ != 0)
|
||||
return 1;
|
||||
|
||||
for (CEntity* ent : mgr.GetPlatformAndDoorObjectList())
|
||||
{
|
||||
TCastToPtr<CScriptDoor> door(ent);
|
||||
if (!door || door->GetUniqueId() == GetUniqueId())
|
||||
continue;
|
||||
|
||||
if (door->GetAreaIdAlways() == GetAreaIdAlways() && door->x2a8_25_)
|
||||
{
|
||||
if (door->x282_dockId != kInvalidUniqueId)
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
for (CGameArea::CConstChainIterator aliveArea = world->GetChainHead(EChain::Alive); aliveArea != CWorld::GetAliveAreasEnd(); ++aliveArea)
|
||||
{
|
||||
if (aliveArea->GetAreaId() == area->GetAreaId())
|
||||
continue;
|
||||
|
||||
if (aliveArea->IsFinishedOccluding())
|
||||
return 1;
|
||||
}
|
||||
|
||||
//if (area->TryTakingOutOfARAM())
|
||||
{
|
||||
if (world->GetMapWorld()->IsMapAreasStreaming())
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 2;
|
||||
}
|
||||
|
||||
/* ORIGINAL 0-00 OFFSET: 8007E9D0 */
|
||||
|
@ -171,7 +392,7 @@ void CScriptDoor::SetDoorAnimation(CScriptDoor::EDoorAnimType type)
|
|||
modelData->AnimationData()->SetAnimation(CAnimPlaybackParms(s32(type), -1, 1.f, true), false);
|
||||
}
|
||||
|
||||
rstl::optional_object<zeus::CAABox> CScriptDoor::GetProjectileBounds() const
|
||||
std::experimental::optional<zeus::CAABox> CScriptDoor::GetProjectileBounds() const
|
||||
{
|
||||
if (x2a8_28_)
|
||||
return {{x284_modelBounds.min + GetTranslation(), x284_modelBounds.max + GetTranslation()}};
|
||||
|
|
|
@ -17,10 +17,12 @@ public:
|
|||
Ready,
|
||||
};
|
||||
|
||||
float x258_;
|
||||
float x25c_;
|
||||
EDoorAnimType x260_doorState = EDoorAnimType::Open;
|
||||
zeus::CAABox x264_;
|
||||
TUniqueId x27c_partner = kInvalidUniqueId;
|
||||
TUniqueId x27c_partner1 = kInvalidUniqueId;
|
||||
TUniqueId x27e_partner2 = kInvalidUniqueId;
|
||||
TUniqueId x280_ = kInvalidUniqueId;
|
||||
TUniqueId x282_dockId = kInvalidUniqueId;
|
||||
zeus::CAABox x284_modelBounds;
|
||||
|
@ -67,7 +69,7 @@ public:
|
|||
void OpenDoor(TUniqueId, CStateManager&);
|
||||
u32 GetDoorOpenCondition(CStateManager& mgr);
|
||||
void SetDoorAnimation(EDoorAnimType);
|
||||
rstl::optional_object<zeus::CAABox> GetProjectileBounds() const;
|
||||
std::experimental::optional<zeus::CAABox> GetProjectileBounds() const;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ CScriptPlatform::CScriptPlatform(TUniqueId uid, std::string_view name, const CEn
|
|||
const zeus::CTransform& xf, CModelData&& mData, const CActorParameters& actParms,
|
||||
const zeus::CAABox& aabb, float f1, bool, float f2, bool active,
|
||||
const CHealthInfo& hInfo, const CDamageVulnerability& dVuln,
|
||||
const rstl::optional_object<TLockedToken<CCollidableOBBTreeGroupContainer>>& dcln,
|
||||
const std::experimental::optional<TLockedToken<CCollidableOBBTreeGroupContainer>>& dcln,
|
||||
bool, u32, u32)
|
||||
: CPhysicsActor(uid, active, name, info, xf, std::move(mData), MakePlatformMaterialList(), aabb, SMoverData(15000.f),
|
||||
actParms, 0.3f, 0.1f)
|
||||
|
@ -38,7 +38,7 @@ CScriptPlatform::CScriptPlatform(TUniqueId uid, std::string_view name, const CEn
|
|||
|
||||
void CScriptPlatform::Accept(IVisitor& visitor) { visitor.Visit(this); }
|
||||
|
||||
rstl::optional_object<zeus::CAABox> CScriptPlatform::GetTouchBounds() const
|
||||
std::experimental::optional<zeus::CAABox> CScriptPlatform::GetTouchBounds() const
|
||||
{
|
||||
if (x314_treeGroup)
|
||||
return {x314_treeGroup->CalculateAABox(GetTransform())};
|
||||
|
|
|
@ -34,7 +34,7 @@ class CScriptPlatform : public CPhysicsActor
|
|||
CHealthInfo x28c_;
|
||||
CHealthInfo x294_;
|
||||
CDamageVulnerability x29c_;
|
||||
rstl::optional_object<TLockedToken<CCollidableOBBTreeGroupContainer>> x304_treeGroupContainer;
|
||||
std::experimental::optional<TLockedToken<CCollidableOBBTreeGroupContainer>> x304_treeGroupContainer;
|
||||
std::unique_ptr<CCollidableOBBTreeGroup> x314_treeGroup;
|
||||
std::vector<SRiders> x318_riders;
|
||||
std::vector<SRiders> x328_slaves1;
|
||||
|
@ -63,10 +63,10 @@ public:
|
|||
CScriptPlatform(TUniqueId, std::string_view name, const CEntityInfo& info, const zeus::CTransform& xf,
|
||||
CModelData&& mData, const CActorParameters& actParms, const zeus::CAABox& aabb, float, bool, float,
|
||||
bool, const CHealthInfo& hInfo, const CDamageVulnerability& dInfo,
|
||||
const rstl::optional_object<TLockedToken<CCollidableOBBTreeGroupContainer>>& dcln, bool, u32, u32);
|
||||
const std::experimental::optional<TLockedToken<CCollidableOBBTreeGroupContainer>>& dcln, bool, u32, u32);
|
||||
|
||||
void Accept(IVisitor& visitor);
|
||||
rstl::optional_object<zeus::CAABox> GetTouchBounds() const;
|
||||
std::experimental::optional<zeus::CAABox> GetTouchBounds() const;
|
||||
bool IsRider(TUniqueId id) const;
|
||||
bool IsSlave(TUniqueId id) const;
|
||||
std::vector<SRiders>& GetX328() { return x328_slaves1; }
|
||||
|
|
|
@ -48,7 +48,7 @@ void CScriptPointOfInterest::CalculateRenderBounds()
|
|||
x9c_renderBounds = zeus::CAABox(x34_transform.origin - xe8_pointSize, x34_transform.origin + xe8_pointSize);
|
||||
}
|
||||
|
||||
rstl::optional_object<zeus::CAABox> CScriptPointOfInterest::GetTouchBounds() const
|
||||
std::experimental::optional<zeus::CAABox> CScriptPointOfInterest::GetTouchBounds() const
|
||||
{
|
||||
return {zeus::CAABox{x34_transform.origin, x34_transform.origin}};
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ public:
|
|||
void AddToRenderer(const zeus::CFrustum &, const CStateManager &) const;
|
||||
void Render(const CStateManager &) const;
|
||||
void CalculateRenderBounds();
|
||||
rstl::optional_object<zeus::CAABox> GetTouchBounds() const;
|
||||
std::experimental::optional<zeus::CAABox> GetTouchBounds() const;
|
||||
};
|
||||
}
|
||||
#endif // __URDE_CSCRIPTPOINTOFINTEREST_HPP__
|
||||
|
|
|
@ -91,7 +91,7 @@ private:
|
|||
CAssetId x1bc_;
|
||||
CAssetId x1c0_;
|
||||
CAssetId x1c4_;
|
||||
rstl::optional_object<zeus::CAABox> x1c8_;
|
||||
std::experimental::optional<zeus::CAABox> x1c8_;
|
||||
union
|
||||
{
|
||||
struct
|
||||
|
|
|
@ -29,7 +29,7 @@ void CScriptSpiderBallAttractionSurface::AcceptScriptMsg(EScriptObjectMessage ms
|
|||
CActor::AcceptScriptMsg(msg, sender, mgr);
|
||||
}
|
||||
|
||||
rstl::optional_object<zeus::CAABox> CScriptSpiderBallAttractionSurface::GetTouchBounds() const
|
||||
std::experimental::optional<zeus::CAABox> CScriptSpiderBallAttractionSurface::GetTouchBounds() const
|
||||
{
|
||||
if (GetActive())
|
||||
return {zeus::CAABox(xf4_aabb.min + GetTranslation(), xf4_aabb.max + GetTranslation())};
|
||||
|
|
|
@ -16,7 +16,7 @@ public:
|
|||
void Accept(IVisitor& visitor);
|
||||
void Think(float dt, CStateManager& mgr);
|
||||
void AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId sender, CStateManager& mgr);
|
||||
rstl::optional_object<zeus::CAABox> GetTouchBounds() const;
|
||||
std::experimental::optional<zeus::CAABox> GetTouchBounds() const;
|
||||
void Touch(CActor& actor, CStateManager& mgr);
|
||||
const zeus::CVector3f& GetScale() const { return xe8_scale; }
|
||||
};
|
||||
|
|
|
@ -218,7 +218,7 @@ void CScriptTrigger::UpdateInhabitants(float dt, CStateManager& mgr)
|
|||
if ((x12c_flags & ETriggerFlags::DetectCamera) != ETriggerFlags::None)
|
||||
{
|
||||
InhabitantAdded(*cam, mgr);
|
||||
//SendScriptMsgs(EScriptObjectState::Entered, mgr, EScriptObjectMessage::Activate);
|
||||
SendScriptMsgs(EScriptObjectState::Entered, mgr, EScriptObjectMessage::Activate);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -226,12 +226,12 @@ void CScriptTrigger::UpdateInhabitants(float dt, CStateManager& mgr)
|
|||
|
||||
if (sendInside)
|
||||
{
|
||||
//SendScriptMsgs(EScriptObjectState::Inside, mgr, EScriptObjectMessage::Activate);
|
||||
SendScriptMsgs(EScriptObjectState::Inside, mgr, EScriptObjectMessage::Activate);
|
||||
}
|
||||
|
||||
if (sendExited)
|
||||
{
|
||||
//SendScriptMsgs(EScriptObjectState::Exited, mgr, EScriptObjectMessage::Activate);
|
||||
SendScriptMsgs(EScriptObjectState::Exited, mgr, EScriptObjectMessage::Activate);
|
||||
if (x148_27_deactivateOnExited)
|
||||
{
|
||||
mgr.SendScriptMsg(GetUniqueId(), mgr.GetEditorIdForUniqueId(GetUniqueId()),
|
||||
|
@ -242,7 +242,7 @@ void CScriptTrigger::UpdateInhabitants(float dt, CStateManager& mgr)
|
|||
|
||||
std::list<CScriptTrigger::CObjectTracker>& CScriptTrigger::GetInhabitants() { return xe8_inhabitants; }
|
||||
|
||||
rstl::optional_object<zeus::CAABox> CScriptTrigger::GetTouchBounds() const
|
||||
std::experimental::optional<zeus::CAABox> CScriptTrigger::GetTouchBounds() const
|
||||
{
|
||||
if (x30_24_active)
|
||||
return {GetTriggerBoundsWR()};
|
||||
|
@ -319,7 +319,7 @@ void CScriptTrigger::Touch(CActor& act, CStateManager& mgr)
|
|||
}
|
||||
}
|
||||
|
||||
//SendScriptMsgs(EScriptObjectState::Entered, mgr, EScriptObjectMessage::None);
|
||||
SendScriptMsgs(EScriptObjectState::Entered, mgr, EScriptObjectMessage::None);
|
||||
|
||||
if (x148_26_deactivateOnEntered)
|
||||
{
|
||||
|
|
|
@ -82,7 +82,7 @@ public:
|
|||
CObjectTracker* FindObject(TUniqueId);
|
||||
void UpdateInhabitants(float, CStateManager&);
|
||||
std::list<CObjectTracker>& GetInhabitants();
|
||||
rstl::optional_object<zeus::CAABox> GetTouchBounds() const;
|
||||
std::experimental::optional<zeus::CAABox> GetTouchBounds() const;
|
||||
void Touch(CActor &, CStateManager &);
|
||||
const zeus::CAABox& GetTriggerBoundsOR() const { return x130_bounds; }
|
||||
zeus::CAABox GetTriggerBoundsWR() const;
|
||||
|
|
|
@ -129,7 +129,7 @@ void CScriptVisorGoo::Render(const CStateManager& mgr) const
|
|||
// Empty
|
||||
}
|
||||
|
||||
rstl::optional_object<zeus::CAABox> CScriptVisorGoo::GetTouchBounds() const
|
||||
std::experimental::optional<zeus::CAABox> CScriptVisorGoo::GetTouchBounds() const
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ public:
|
|||
void AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId objId, CStateManager& stateMgr);
|
||||
void AddToRenderer(const zeus::CFrustum&, const CStateManager&) const;
|
||||
void Render(const CStateManager&) const;
|
||||
rstl::optional_object<zeus::CAABox> GetTouchBounds() const;
|
||||
std::experimental::optional<zeus::CAABox> GetTouchBounds() const;
|
||||
void Touch(CActor&, CStateManager&);
|
||||
};
|
||||
|
||||
|
|
|
@ -741,4 +741,17 @@ void CWorld::AddGlobalSound(const CSfxHandle& hnd)
|
|||
return;
|
||||
xc8_globalSfxHandles.push_back(hnd);
|
||||
}
|
||||
|
||||
bool CWorld::AreSkyNeedsMet() const
|
||||
{
|
||||
if (!x70_26_skyboxActive)
|
||||
return true;
|
||||
if (xb4_skyboxOverride && xb4_skyboxOverride->IsLoaded(0))
|
||||
return true;
|
||||
if (xa4_skyboxWorldLoaded && xa4_skyboxWorldLoaded->IsLoaded(0))
|
||||
return true;
|
||||
if (x94_skyboxWorld && x94_skyboxWorld->IsLoaded(0))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -207,6 +207,7 @@ public:
|
|||
bool HasGlobalSound(u16 id) const;
|
||||
void AddGlobalSound(const CSfxHandle& hnd);
|
||||
EEnvFxType GetNeededEnvFx() const { return xc4_neededFx; }
|
||||
bool AreSkyNeedsMet() const;
|
||||
};
|
||||
|
||||
struct CWorldLayers
|
||||
|
|
|
@ -639,7 +639,7 @@ CEntity* ScriptLoader::LoadPlatform(CStateManager& mgr, CInputStream& in, int pr
|
|||
zeus::CAABox aabb = GetCollisionBox(mgr, info.GetAreaId(), extent, centroid);
|
||||
|
||||
FourCC dclnType = g_ResFactory->GetResourceTypeById(dclnId);
|
||||
rstl::optional_object<TLockedToken<CCollidableOBBTreeGroupContainer>> dclnToken;
|
||||
std::experimental::optional<TLockedToken<CCollidableOBBTreeGroupContainer>> dclnToken;
|
||||
if (dclnType)
|
||||
{
|
||||
dclnToken.emplace(g_SimplePool->GetObj({SBIG('DCLN'), dclnId}));
|
||||
|
@ -1000,7 +1000,7 @@ CEntity* ScriptLoader::LoadBeetle(CStateManager& mgr, CInputStream& in, int prop
|
|||
if (animType != SBIG('ANCS'))
|
||||
return nullptr;
|
||||
|
||||
rstl::optional_object<CStaticRes> abdomenRes;
|
||||
std::experimental::optional<CStaticRes> abdomenRes;
|
||||
if (flavor == CPatterned::EFlavorType::One)
|
||||
abdomenRes.emplace(CStaticRes(abdomen, scale));
|
||||
|
||||
|
|
|
@ -140,40 +140,40 @@ enum class EScriptObjectType
|
|||
|
||||
enum class EScriptObjectState
|
||||
{
|
||||
Any = -1,
|
||||
Active,
|
||||
Arrived,
|
||||
Closed,
|
||||
Entered,
|
||||
Exited,
|
||||
Inactive,
|
||||
Inside,
|
||||
MaxReached,
|
||||
Open,
|
||||
Zero,
|
||||
Attack,
|
||||
UNKS1,
|
||||
Retreat,
|
||||
Patrol,
|
||||
Dead,
|
||||
CameraPath,
|
||||
CameraTarget,
|
||||
UNKS2,
|
||||
Play,
|
||||
UNKS3,
|
||||
DeathRattle,
|
||||
UNKS4,
|
||||
Damage,
|
||||
InvulnDamage,
|
||||
UNKS5,
|
||||
Modify,
|
||||
ScanStart,
|
||||
ScanProcessing,
|
||||
ScanDone,
|
||||
UnFrozen,
|
||||
Default,
|
||||
ReflectedDamage,
|
||||
InheritBounds
|
||||
Any = -1,
|
||||
Active = 0,
|
||||
Arrived = 1,
|
||||
Closed = 2,
|
||||
Entered = 3,
|
||||
Exited = 4,
|
||||
Inactive = 5,
|
||||
Inside = 6,
|
||||
MaxReached = 7,
|
||||
Open = 8,
|
||||
Zero = 9,
|
||||
Attack = 10,
|
||||
UNKS1 = 11,
|
||||
Retreat = 12,
|
||||
Patrol = 13,
|
||||
Dead = 14,
|
||||
CameraPath = 15,
|
||||
CameraTarget = 16,
|
||||
UNKS2 = 17,
|
||||
Play = 18,
|
||||
UNKS3 = 19,
|
||||
DeathRattle = 20,
|
||||
UNKS4 = 21,
|
||||
Damage = 22,
|
||||
InvulnDamage = 23,
|
||||
UNKS5 = 24,
|
||||
Modify = 25,
|
||||
ScanStart = 26,
|
||||
ScanProcessing = 27,
|
||||
ScanDone = 28,
|
||||
UnFrozen = 29,
|
||||
Default = 30,
|
||||
ReflectedDamage = 31,
|
||||
InheritBounds = 32
|
||||
};
|
||||
|
||||
enum class EScriptObjectMessage
|
||||
|
|
|
@ -15,9 +15,6 @@ namespace rstl
|
|||
static logvisor::Module Log("rstl");
|
||||
#endif
|
||||
|
||||
template <typename T>
|
||||
using optional_object = std::experimental::optional<T>;
|
||||
|
||||
/**
|
||||
* @brief Base vector backed by statically-allocated array
|
||||
*/
|
||||
|
|
2
hecl
2
hecl
|
@ -1 +1 @@
|
|||
Subproject commit 2461e787a92af6400b15ef110dc837918c39b4ce
|
||||
Subproject commit 71e620386d46b4208968e0bb61d9687775359880
|
Loading…
Reference in New Issue