mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-06-06 01:53:27 +00:00
Various level streaming fixes, remove support for uncooked rep
This commit is contained in:
parent
9d25d44fe8
commit
f5ea144b47
@ -132,42 +132,12 @@ makeProj:
|
|||||||
else
|
else
|
||||||
m_vm.SetupEditorView();
|
m_vm.SetupEditorView();
|
||||||
|
|
||||||
bool runFromPaks = hecl::StringUtils::BeginsWith(subPath, _S("out"));
|
bool doRun = hecl::StringUtils::BeginsWith(subPath, _S("out"));
|
||||||
if (runFromPaks)
|
if (doRun)
|
||||||
{
|
{
|
||||||
m_mainMP1.emplace(nullptr, nullptr, m_vm.m_mainBooFactory,
|
m_mainMP1.emplace(nullptr, nullptr, m_vm.m_mainBooFactory,
|
||||||
m_vm.m_mainCommandQueue, m_vm.m_renderTex);
|
m_vm.m_mainCommandQueue, m_vm.m_renderTex);
|
||||||
}
|
m_vm.InitMP1(*m_mainMP1);
|
||||||
else
|
|
||||||
{
|
|
||||||
m_factoryMP1.IndexMP1Resources(*m_proj, m_objStore);
|
|
||||||
m_mainMP1.emplace(&m_factoryMP1, &m_objStore, m_vm.m_mainBooFactory,
|
|
||||||
m_vm.m_mainCommandQueue, m_vm.m_renderTex);
|
|
||||||
}
|
|
||||||
|
|
||||||
m_vm.InitMP1(*m_mainMP1);
|
|
||||||
|
|
||||||
// precook
|
|
||||||
if (!runFromPaks)
|
|
||||||
{
|
|
||||||
m_precooking = true;
|
|
||||||
std::vector<SObjectTag> nonMlvls;
|
|
||||||
std::vector<SObjectTag> mlvls;
|
|
||||||
mlvls.reserve(8);
|
|
||||||
m_factoryMP1.EnumerateResources([this, &nonMlvls, &mlvls](const SObjectTag& tag)
|
|
||||||
{
|
|
||||||
if (tag.type == FOURCC('CMDL') || tag.type == FOURCC('MREA'))
|
|
||||||
m_factoryMP1.CookResourceAsync(tag);
|
|
||||||
else if (tag.type != FOURCC('MLVL'))
|
|
||||||
nonMlvls.push_back(tag);
|
|
||||||
else // (tag.type == FOURCC('MLVL'))
|
|
||||||
mlvls.push_back(tag);
|
|
||||||
return true;
|
|
||||||
});
|
|
||||||
for (const SObjectTag& tag : nonMlvls)
|
|
||||||
m_factoryMP1.CookResourceAsync(tag);
|
|
||||||
for (const SObjectTag& tag : mlvls)
|
|
||||||
m_factoryMP1.CookResourceAsync(tag);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (needsSave)
|
if (needsSave)
|
||||||
|
@ -299,7 +299,8 @@ bool ViewManager::proc()
|
|||||||
gfxQ->execute();
|
gfxQ->execute();
|
||||||
if (g_ResFactory)
|
if (g_ResFactory)
|
||||||
g_ResFactory->AsyncIdle();
|
g_ResFactory->AsyncIdle();
|
||||||
m_mainWindow->waitForRetrace(m_voiceEngine.get());
|
if (!m_skipWait && hecl::com_developer->toBoolean())
|
||||||
|
m_mainWindow->waitForRetrace(m_voiceEngine.get());
|
||||||
CBooModel::ClearModelUniformCounters();
|
CBooModel::ClearModelUniformCounters();
|
||||||
CGraphics::TickRenderTimings();
|
CGraphics::TickRenderTimings();
|
||||||
++logvisor::FrameIndex;
|
++logvisor::FrameIndex;
|
||||||
|
@ -50,6 +50,7 @@ class ViewManager : public specter::IViewManager
|
|||||||
std::unique_ptr<SplashScreen> m_splash;
|
std::unique_ptr<SplashScreen> m_splash;
|
||||||
std::unique_ptr<RootSpace> m_rootSpace;
|
std::unique_ptr<RootSpace> m_rootSpace;
|
||||||
specter::View* m_rootSpaceView = nullptr;
|
specter::View* m_rootSpaceView = nullptr;
|
||||||
|
bool m_skipWait = false;
|
||||||
|
|
||||||
class TestGameView : public specter::View
|
class TestGameView : public specter::View
|
||||||
{
|
{
|
||||||
@ -93,6 +94,9 @@ class ViewManager : public specter::IViewManager
|
|||||||
if (MP1::CMain* m = m_vm.m_projManager.gameMain())
|
if (MP1::CMain* m = m_vm.m_projManager.gameMain())
|
||||||
if (MP1::CGameArchitectureSupport* as = m->GetArchSupport())
|
if (MP1::CGameArchitectureSupport* as = m->GetArchSupport())
|
||||||
as->charKeyDown(cc, mkey, repeat);
|
as->charKeyDown(cc, mkey, repeat);
|
||||||
|
|
||||||
|
if (cc == '\t')
|
||||||
|
m_vm.m_skipWait = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void charKeyUp(unsigned long cc, boo::EModifierKey mkey)
|
void charKeyUp(unsigned long cc, boo::EModifierKey mkey)
|
||||||
@ -100,6 +104,9 @@ class ViewManager : public specter::IViewManager
|
|||||||
if (MP1::CMain* m = m_vm.m_projManager.gameMain())
|
if (MP1::CMain* m = m_vm.m_projManager.gameMain())
|
||||||
if (MP1::CGameArchitectureSupport* as = m->GetArchSupport())
|
if (MP1::CGameArchitectureSupport* as = m->GetArchSupport())
|
||||||
as->charKeyUp(cc, mkey);
|
as->charKeyUp(cc, mkey);
|
||||||
|
|
||||||
|
if (cc == '\t')
|
||||||
|
m_vm.m_skipWait = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void specialKeyDown(boo::ESpecialKey skey, boo::EModifierKey mkey, bool repeat)
|
void specialKeyDown(boo::ESpecialKey skey, boo::EModifierKey mkey, bool repeat)
|
||||||
|
@ -74,12 +74,20 @@ void CMapWorld::SetWhichMapAreasLoaded(const IWorld& wld, int start, int count)
|
|||||||
bool CMapWorld::IsMapAreasStreaming() const
|
bool CMapWorld::IsMapAreasStreaming() const
|
||||||
{
|
{
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
for (CMapAreaData* data = x10_listHeads[1] ; data ; data = data->NextMapAreaData())
|
CMapAreaData* data = x10_listHeads[1];
|
||||||
|
while (data != nullptr)
|
||||||
{
|
{
|
||||||
if (data->IsLoaded())
|
if (data->IsLoaded())
|
||||||
|
{
|
||||||
|
CMapAreaData* next = data->NextMapAreaData();
|
||||||
const_cast<CMapWorld*>(this)->MoveMapAreaToList(data, EMapAreaList::Loaded);
|
const_cast<CMapWorld*>(this)->MoveMapAreaToList(data, EMapAreaList::Loaded);
|
||||||
|
data = next;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
data = data->NextMapAreaData();
|
||||||
ret = true;
|
ret = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -72,7 +72,7 @@ public:
|
|||||||
{
|
{
|
||||||
TCachedToken<CMapArea> x0_area;
|
TCachedToken<CMapArea> x0_area;
|
||||||
EMapAreaList x10_list;
|
EMapAreaList x10_list;
|
||||||
CMapAreaData* x14_next;
|
CMapAreaData* x14_next = nullptr;
|
||||||
public:
|
public:
|
||||||
CMapAreaData(CAssetId areaRes, EMapAreaList list, CMapAreaData* next);
|
CMapAreaData(CAssetId areaRes, EMapAreaList list, CMapAreaData* next);
|
||||||
void Lock() { x0_area.Lock(); }
|
void Lock() { x0_area.Lock(); }
|
||||||
|
@ -50,7 +50,8 @@
|
|||||||
#include "Input/ControlMapper.hpp"
|
#include "Input/ControlMapper.hpp"
|
||||||
#include "MP1/MP1.hpp"
|
#include "MP1/MP1.hpp"
|
||||||
#include "GameGlobalObjects.hpp"
|
#include "GameGlobalObjects.hpp"
|
||||||
|
#include "World/CScriptDoor.hpp"
|
||||||
|
#include "World/CScriptDamageableTrigger.hpp"
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
namespace urde
|
namespace urde
|
||||||
@ -1070,8 +1071,8 @@ void CStateManager::SendScriptMsg(CEntity* dest, TUniqueId src, EScriptObjectMes
|
|||||||
if (dest && !dest->x30_26_scriptingBlocked)
|
if (dest && !dest->x30_26_scriptingBlocked)
|
||||||
{
|
{
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
LogModule.report(logvisor::Info, "Sending '%s' to '%s'",
|
LogModule.report(logvisor::Info, "Sending '%s' to '%s' id= 0x%.4X\n",
|
||||||
ScriptObjectMessageToStr(msg).data(), dest->GetName().data());
|
ScriptObjectMessageToStr(msg).data(), dest->GetName().data(), dest->GetUniqueId().id);
|
||||||
#endif
|
#endif
|
||||||
dest->AcceptScriptMsg(msg, src, *this);
|
dest->AcceptScriptMsg(msg, src, *this);
|
||||||
}
|
}
|
||||||
@ -1089,8 +1090,8 @@ void CStateManager::SendScriptMsgAlways(TUniqueId dest, TUniqueId src, EScriptOb
|
|||||||
if (dst)
|
if (dst)
|
||||||
{
|
{
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
LogModule.report(logvisor::Info, "Sending '%s' to '%s'",
|
LogModule.report(logvisor::Info, "Sending '%s' to '%s' id= 0x%.4X\n",
|
||||||
ScriptObjectMessageToStr(msg).data(), dst->GetName().data());
|
ScriptObjectMessageToStr(msg).data(), dst->GetName().data(), dst->GetUniqueId().id);
|
||||||
#endif
|
#endif
|
||||||
dst->AcceptScriptMsg(msg, src, *this);
|
dst->AcceptScriptMsg(msg, src, *this);
|
||||||
}
|
}
|
||||||
@ -1704,6 +1705,7 @@ bool CStateManager::ApplyLocalDamage(const zeus::CVector3f& vec1, const zeus::CV
|
|||||||
}
|
}
|
||||||
|
|
||||||
float newHp = hInfo->GetHP() - mulDam;
|
float newHp = hInfo->GetHP() - mulDam;
|
||||||
|
hInfo->SetHP(newHp);
|
||||||
bool significant = std::fabs(newHp - hInfo->GetHP()) >= 0.00001;
|
bool significant = std::fabs(newHp - hInfo->GetHP()) >= 0.00001;
|
||||||
|
|
||||||
if (player)
|
if (player)
|
||||||
|
@ -104,7 +104,7 @@ public:
|
|||||||
|
|
||||||
static s32 BitPosition(u64 flag)
|
static s32 BitPosition(u64 flag)
|
||||||
{
|
{
|
||||||
for (u32 i = 0; i < 63; ++i)
|
for (u32 i = 0; i < 64; ++i)
|
||||||
if ((flag & (1ull << i)) != 0)
|
if ((flag & (1ull << i)) != 0)
|
||||||
return i;
|
return i;
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -20,6 +20,7 @@ public:
|
|||||||
CLineRenderer& renderer,
|
CLineRenderer& renderer,
|
||||||
const boo::ObjToken<boo::IShaderPipeline>& pipeline,
|
const boo::ObjToken<boo::IShaderPipeline>& pipeline,
|
||||||
const boo::ObjToken<boo::ITexture>& texture)=0;
|
const boo::ObjToken<boo::ITexture>& texture)=0;
|
||||||
|
virtual ~IDataBindingFactory() = default;
|
||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -2006,7 +2006,6 @@ CFrontEndUI::CFrontEndUI()
|
|||||||
|
|
||||||
m->ResetGameState();
|
m->ResetGameState();
|
||||||
g_GameState->SetCurrentWorldId(g_ResFactory->TranslateOriginalToNew(g_DefaultWorldTag.id));
|
g_GameState->SetCurrentWorldId(g_ResFactory->TranslateOriginalToNew(g_DefaultWorldTag.id));
|
||||||
g_GameState->CurrentWorldState().SetAreaId(2);
|
|
||||||
g_GameState->GameOptions().ResetToDefaults();
|
g_GameState->GameOptions().ResetToDefaults();
|
||||||
g_GameState->WriteBackupBuf();
|
g_GameState->WriteBackupBuf();
|
||||||
|
|
||||||
|
@ -1,19 +1,19 @@
|
|||||||
#include "CParasite.hpp"
|
#include "CParasite.hpp"
|
||||||
#include "World/CActorParameters.hpp"
|
|
||||||
#include "Character/CModelData.hpp"
|
#include "Character/CModelData.hpp"
|
||||||
#include "World/CPatternedInfo.hpp"
|
|
||||||
#include "TCastTo.hpp"
|
#include "TCastTo.hpp"
|
||||||
|
#include "World/CActorParameters.hpp"
|
||||||
|
#include "World/CPatternedInfo.hpp"
|
||||||
|
|
||||||
namespace urde::MP1
|
namespace urde::MP1 {
|
||||||
{
|
|
||||||
CParasite::CParasite(TUniqueId uid, std::string_view name, EFlavorType flavor, const CEntityInfo& info, const zeus::CTransform& xf, CModelData&& mData, const CPatternedInfo& pInfo)
|
|
||||||
: CWallWalker(ECharacter::Parasite, uid, name, flavor, info, xf, std::move(mData), pInfo, EMovementType::Ground, EColliderType::One, EBodyType::WallWalker, CActorParameters::None(), -1, false)
|
|
||||||
{
|
|
||||||
|
|
||||||
|
CParasite::CParasite(TUniqueId uid, std::string_view name, EFlavorType flavor, const CEntityInfo &info, const zeus::CTransform &xf,
|
||||||
|
CModelData &&mData, const CPatternedInfo &pInfo, u32, float, float, float, float, float, float, float, float,
|
||||||
|
float, float, float, float, float, float, float, float, float, float, bool, u32, const CDamageVulnerability &,
|
||||||
|
const CParasiteInfo &, u16, u16, u16, u32, u32, float, const CActorParameters &aParams)
|
||||||
|
: CWallWalker(ECharacter::Parasite, uid, name, flavor, info, xf, std::move(mData), pInfo, EMovementType::Ground, EColliderType::One, EBodyType::WallWalker,
|
||||||
|
aParams, -1, false)
|
||||||
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void CParasite::Accept(IVisitor& visitor)
|
void CParasite::Accept(IVisitor &visitor) { visitor.Visit(this); }
|
||||||
{
|
} // namespace urde::MP1
|
||||||
visitor.Visit(this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -10,10 +10,38 @@ class CModelData;
|
|||||||
|
|
||||||
namespace urde::MP1
|
namespace urde::MP1
|
||||||
{
|
{
|
||||||
|
struct CParasiteInfo
|
||||||
|
{
|
||||||
|
u32 x0_ = 0;
|
||||||
|
union
|
||||||
|
{
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
bool x4_24_ : 1; bool x4_26_ : 1;
|
||||||
|
};
|
||||||
|
u32 x4_dummy = 0;
|
||||||
|
};
|
||||||
|
float x8_ = 0.f;
|
||||||
|
float xc_ = 0.f;
|
||||||
|
float x10_ = 0.f;
|
||||||
|
float x14_ = 0.f;
|
||||||
|
union
|
||||||
|
{
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
bool x18_24_ : 1;
|
||||||
|
};
|
||||||
|
u32 x18_dummy = 0;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
class CParasite : public CWallWalker
|
class CParasite : public CWallWalker
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CParasite(TUniqueId, std::string_view, EFlavorType, const CEntityInfo&, const zeus::CTransform&, CModelData&&, const CPatternedInfo&);
|
CParasite(TUniqueId uid, std::string_view name, EFlavorType flavor, const CEntityInfo& info, const zeus::CTransform& xf,
|
||||||
|
CModelData&& mData, const CPatternedInfo&, u32, float, float, float, float, float, float, float, float, float,
|
||||||
|
float, float, float, float, float, float, float, float, float, bool, u32, const CDamageVulnerability&, const CParasiteInfo&, u16, u16,
|
||||||
|
u16, u32, u32, float, const CActorParameters&);
|
||||||
|
|
||||||
void Accept(IVisitor&);
|
void Accept(IVisitor&);
|
||||||
};
|
};
|
||||||
|
@ -532,7 +532,14 @@ zeus::CAABox CGameProjectile::GetProjectileBounds() const
|
|||||||
std::min(x298_lastOrigin.z, GetTranslation().z) - x2a4_projExtent},
|
std::min(x298_lastOrigin.z, GetTranslation().z) - x2a4_projExtent},
|
||||||
{std::max(x298_lastOrigin.x, GetTranslation().x) + x2a4_projExtent,
|
{std::max(x298_lastOrigin.x, GetTranslation().x) + x2a4_projExtent,
|
||||||
std::max(x298_lastOrigin.y, GetTranslation().y) + x2a4_projExtent,
|
std::max(x298_lastOrigin.y, GetTranslation().y) + x2a4_projExtent,
|
||||||
std::max(x298_lastOrigin.z, GetTranslation().z) + x2a4_projExtent}};
|
std::max(x298_lastOrigin.z, GetTranslation().z) + x2a4_projExtent}};
|
||||||
|
}
|
||||||
|
|
||||||
|
std::experimental::optional<zeus::CAABox> CGameProjectile::GetTouchBounds() const
|
||||||
|
{
|
||||||
|
if (x2e4_24_active)
|
||||||
|
return {GetProjectileBounds()};
|
||||||
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -86,6 +86,7 @@ public:
|
|||||||
CProjectileTouchResult CanCollideWithGameObject(CActor& act, CStateManager& mgr);
|
CProjectileTouchResult CanCollideWithGameObject(CActor& act, CStateManager& mgr);
|
||||||
CProjectileTouchResult CanCollideWithTrigger(CActor& act, CStateManager& mgr);
|
CProjectileTouchResult CanCollideWithTrigger(CActor& act, CStateManager& mgr);
|
||||||
zeus::CAABox GetProjectileBounds() const;
|
zeus::CAABox GetProjectileBounds() const;
|
||||||
|
std::experimental::optional<zeus::CAABox> GetTouchBounds() const;
|
||||||
TUniqueId GetHomingTargetId() const { return x2c0_homingTargetId; }
|
TUniqueId GetHomingTargetId() const { return x2c0_homingTargetId; }
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#include "CFishCloud.hpp"
|
#include "CFishCloud.hpp"
|
||||||
#include "CActorParameters.hpp"
|
#include "CActorParameters.hpp"
|
||||||
|
#include "TCastTo.hpp"
|
||||||
|
|
||||||
namespace urde
|
namespace urde
|
||||||
{
|
{
|
||||||
@ -16,5 +17,30 @@ CFishCloud::CFishCloud(TUniqueId uid, bool active, std::string_view name, const
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CFishCloud::Accept(IVisitor& visitor)
|
||||||
|
{
|
||||||
|
visitor.Visit(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFishCloud::RemoveRepulsor(TUniqueId)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFishCloud::RemoveAttractor(TUniqueId)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFishCloud::AddRepulsor(TUniqueId, float, float)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFishCloud::AddAttractor(TUniqueId, float, float)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,6 +8,25 @@ namespace urde
|
|||||||
|
|
||||||
class CFishCloud : public CActor
|
class CFishCloud : public CActor
|
||||||
{
|
{
|
||||||
|
class CModifierSource
|
||||||
|
{
|
||||||
|
TUniqueId x0_source;
|
||||||
|
float x4_;
|
||||||
|
float x8_;
|
||||||
|
bool xc_;
|
||||||
|
bool xd_;
|
||||||
|
public:
|
||||||
|
CModifierSource(TUniqueId, bool, float, float);
|
||||||
|
void SetAffectPriority(float);
|
||||||
|
void SetAffectRadius(float);
|
||||||
|
float GetAffectPriority() const;
|
||||||
|
float GetAffectRadius() const;
|
||||||
|
bool IsRepulsor();
|
||||||
|
TUniqueId GetSource() const;
|
||||||
|
|
||||||
|
bool operator<(const CModifierSource& other) const { return x0_source < other.x0_source; }
|
||||||
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CFishCloud(TUniqueId uid, bool active, std::string_view name, const CEntityInfo& info,
|
CFishCloud(TUniqueId uid, bool active, std::string_view name, const CEntityInfo& info,
|
||||||
const zeus::CVector3f& scale, const zeus::CTransform& xf, CModelData&& mData,
|
const zeus::CVector3f& scale, const zeus::CTransform& xf, CModelData&& mData,
|
||||||
@ -15,6 +34,12 @@ public:
|
|||||||
float f7, float f8, float f9, float f10, float f11, float f12, float f13, u32 w2,
|
float f7, float f8, float f9, float f10, float f11, float f12, float f13, u32 w2,
|
||||||
const zeus::CColor& color, bool b1, float f14, CAssetId part1, u32 w3, CAssetId part2, u32 w4,
|
const zeus::CColor& color, bool b1, float f14, CAssetId part1, u32 w3, CAssetId part2, u32 w4,
|
||||||
CAssetId part3, u32 w5, CAssetId part4, u32 w6, u32 w7, bool b2, bool b3);
|
CAssetId part3, u32 w5, CAssetId part4, u32 w6, u32 w7, bool b2, bool b3);
|
||||||
|
|
||||||
|
void Accept(IVisitor& visitor);
|
||||||
|
void RemoveRepulsor(TUniqueId);
|
||||||
|
void RemoveAttractor(TUniqueId);
|
||||||
|
void AddRepulsor(TUniqueId, float, float);
|
||||||
|
void AddAttractor(TUniqueId, float, float);
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -614,17 +614,11 @@ void CGameArea::UpdateFog(float dt)
|
|||||||
|
|
||||||
void CGameArea::OtherAreaOcclusionChanged()
|
void CGameArea::OtherAreaOcclusionChanged()
|
||||||
{
|
{
|
||||||
if (GetPostConstructed()->x10e0_ == 3 && GetPostConstructed()->x10dc_occlusionState != EOcclusionState::Occluded)
|
if (GetPostConstructed()->x10e0_ == 3 && GetPostConstructed()->x10dc_occlusionState == EOcclusionState::Visible)
|
||||||
{
|
{
|
||||||
bool unloaded = true;
|
x12c_postConstructed->x1108_27_ = false;
|
||||||
bool transferred = true;
|
|
||||||
#if 0
|
|
||||||
bool unloaded = UnloadAllloadedTextures();
|
|
||||||
bool transferred = TransferTokensToARAM();
|
|
||||||
#endif
|
|
||||||
x12c_postConstructed->x1108_27_ = (unloaded && transferred);
|
|
||||||
}
|
}
|
||||||
else
|
else if (GetPostConstructed()->x10dc_occlusionState == EOcclusionState::Visible)
|
||||||
{
|
{
|
||||||
ReloadAllUnloadedTextures();
|
ReloadAllUnloadedTextures();
|
||||||
}
|
}
|
||||||
@ -647,10 +641,10 @@ void CGameArea::PingOcclusionState()
|
|||||||
unloaded = UnloadAllloadedTextures();
|
unloaded = UnloadAllloadedTextures();
|
||||||
transferred = TransferTokens();
|
transferred = TransferTokens();
|
||||||
#endif
|
#endif
|
||||||
x12c_postConstructed->x1108_27_ = (unloaded && transferred);
|
if (unloaded && transferred)
|
||||||
|
x12c_postConstructed->x1108_27_ = true;
|
||||||
x12c_postConstructed->x1108_26_ = true;
|
|
||||||
}
|
}
|
||||||
|
x12c_postConstructed->x1108_26_ = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGameArea::PreRender()
|
void CGameArea::PreRender()
|
||||||
|
@ -48,7 +48,6 @@ set(WORLD_SOURCES
|
|||||||
CScriptPickupGenerator.hpp CScriptPickupGenerator.cpp
|
CScriptPickupGenerator.hpp CScriptPickupGenerator.cpp
|
||||||
CScriptPointOfInterest.hpp CScriptPointOfInterest.cpp
|
CScriptPointOfInterest.hpp CScriptPointOfInterest.cpp
|
||||||
CScriptAreaAttributes.hpp CScriptAreaAttributes.cpp
|
CScriptAreaAttributes.hpp CScriptAreaAttributes.cpp
|
||||||
CFishCloud.hpp CFishCloud.cpp
|
|
||||||
CScriptVisorFlare.hpp CScriptVisorFlare.cpp
|
CScriptVisorFlare.hpp CScriptVisorFlare.cpp
|
||||||
CScriptWorldTeleporter.hpp CScriptWorldTeleporter.cpp
|
CScriptWorldTeleporter.hpp CScriptWorldTeleporter.cpp
|
||||||
CScriptCameraWaypoint.hpp CScriptCameraWaypoint.cpp
|
CScriptCameraWaypoint.hpp CScriptCameraWaypoint.cpp
|
||||||
@ -74,6 +73,8 @@ set(WORLD_SOURCES
|
|||||||
CScriptPlayerStateChange.hpp CScriptPlayerStateChange.cpp
|
CScriptPlayerStateChange.hpp CScriptPlayerStateChange.cpp
|
||||||
CScriptTargetingPoint.hpp CScriptTargetingPoint.cpp
|
CScriptTargetingPoint.hpp CScriptTargetingPoint.cpp
|
||||||
CScriptPlayerActor.hpp CScriptPlayerActor.cpp
|
CScriptPlayerActor.hpp CScriptPlayerActor.cpp
|
||||||
|
CFishCloud.hpp CFishCloud.cpp
|
||||||
|
CFishCloudModifier.hpp CFishCloudModifier.cpp
|
||||||
CScriptSwitch.hpp CScriptSwitch.cpp
|
CScriptSwitch.hpp CScriptSwitch.cpp
|
||||||
CWallWalker.hpp CWallWalker.cpp
|
CWallWalker.hpp CWallWalker.cpp
|
||||||
CWallCrawlerSwarm.hpp CWallCrawlerSwarm.cpp
|
CWallCrawlerSwarm.hpp CWallCrawlerSwarm.cpp
|
||||||
|
@ -14,7 +14,7 @@ namespace urde
|
|||||||
CScriptActor::CScriptActor(TUniqueId uid, std::string_view name, const CEntityInfo& info, const zeus::CTransform& xf,
|
CScriptActor::CScriptActor(TUniqueId uid, std::string_view name, const CEntityInfo& info, const zeus::CTransform& xf,
|
||||||
CModelData&& mData, const zeus::CAABox& aabb, float mass, float zMomentum,
|
CModelData&& mData, const zeus::CAABox& aabb, float mass, float zMomentum,
|
||||||
const CMaterialList& matList, const CHealthInfo& hInfo, const CDamageVulnerability& dVuln,
|
const CMaterialList& matList, const CHealthInfo& hInfo, const CDamageVulnerability& dVuln,
|
||||||
const CActorParameters& actParms, bool looping, bool active, u32 shaderIdx, float xrayAlpha,
|
const CActorParameters& actParms, bool looping, bool active, s32 shaderIdx, float xrayAlpha,
|
||||||
bool noThermalHotZ, bool castsShadow, bool scaleAdvancementDelta, bool materialFlag54)
|
bool noThermalHotZ, bool castsShadow, bool scaleAdvancementDelta, bool materialFlag54)
|
||||||
: CPhysicsActor(uid, active, name, info, xf, std::move(mData), matList, aabb, SMoverData(mass), actParms, 0.3f, 0.1f)
|
: CPhysicsActor(uid, active, name, info, xf, std::move(mData), matList, aabb, SMoverData(mass), actParms, 0.3f, 0.1f)
|
||||||
, x258_initialHealth(hInfo)
|
, x258_initialHealth(hInfo)
|
||||||
|
@ -33,7 +33,7 @@ public:
|
|||||||
CScriptActor(TUniqueId uid, std::string_view name, const CEntityInfo& info, const zeus::CTransform& xf,
|
CScriptActor(TUniqueId uid, std::string_view name, const CEntityInfo& info, const zeus::CTransform& xf,
|
||||||
CModelData&& mData, const zeus::CAABox& aabb, float mass, float zMomentum,
|
CModelData&& mData, const zeus::CAABox& aabb, float mass, float zMomentum,
|
||||||
const CMaterialList& matList, const CHealthInfo& hInfo, const CDamageVulnerability& dVuln,
|
const CMaterialList& matList, const CHealthInfo& hInfo, const CDamageVulnerability& dVuln,
|
||||||
const CActorParameters& actParms, bool looping, bool active, u32 shaderIdx, float xrayAlpha,
|
const CActorParameters& actParms, bool looping, bool active, s32 shaderIdx, float xrayAlpha,
|
||||||
bool noThermalHotZ, bool castsShadow, bool scaleAdvancementDelta, bool materialFlag54);
|
bool noThermalHotZ, bool castsShadow, bool scaleAdvancementDelta, bool materialFlag54);
|
||||||
void Accept(IVisitor& visitor);
|
void Accept(IVisitor& visitor);
|
||||||
void AcceptScriptMsg(EScriptObjectMessage, TUniqueId, CStateManager&);
|
void AcceptScriptMsg(EScriptObjectMessage, TUniqueId, CStateManager&);
|
||||||
|
@ -18,9 +18,13 @@ CScriptColorModulate::CScriptColorModulate(TUniqueId uid, std::string_view name,
|
|||||||
{
|
{
|
||||||
x54_24_ = b1;
|
x54_24_ = b1;
|
||||||
x54_25_ = b2;
|
x54_25_ = b2;
|
||||||
x54_26_ = b3;
|
x54_26_depthEqual = b3;
|
||||||
x54_27_ = b4;
|
x54_27_depthUpdate = b4;
|
||||||
x54_28_ = b5;
|
x54_28_ = b5;
|
||||||
|
x54_29_ = false;
|
||||||
|
x54_30_ = false;
|
||||||
|
x54_31_ = false;
|
||||||
|
x55_24_ = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CScriptColorModulate::Accept(IVisitor& visitor)
|
void CScriptColorModulate::Accept(IVisitor& visitor)
|
||||||
@ -31,7 +35,7 @@ void CScriptColorModulate::Accept(IVisitor& visitor)
|
|||||||
void CScriptColorModulate::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId objId, CStateManager& mgr)
|
void CScriptColorModulate::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId objId, CStateManager& mgr)
|
||||||
{
|
{
|
||||||
CEntity::AcceptScriptMsg(msg, objId, mgr);
|
CEntity::AcceptScriptMsg(msg, objId, mgr);
|
||||||
return;
|
|
||||||
if (!GetActive())
|
if (!GetActive())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -81,7 +85,6 @@ void CScriptColorModulate::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId o
|
|||||||
|
|
||||||
void CScriptColorModulate::Think(float dt, CStateManager& mgr)
|
void CScriptColorModulate::Think(float dt, CStateManager& mgr)
|
||||||
{
|
{
|
||||||
return;
|
|
||||||
if (!GetActive() || !x54_30_)
|
if (!GetActive() || !x54_30_)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -134,9 +137,121 @@ void CScriptColorModulate::Think(float dt, CStateManager& mgr)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CModelFlags CScriptColorModulate::CalculateFlags(const zeus::CColor &) const
|
CModelFlags CScriptColorModulate::CalculateFlags(const zeus::CColor& col) const
|
||||||
{
|
{
|
||||||
return {};
|
CModelFlags ret;
|
||||||
|
if (x54_28_)
|
||||||
|
{
|
||||||
|
if (x48_blendMode == EBlendMode::Zero)
|
||||||
|
{
|
||||||
|
CModelFlags ret;
|
||||||
|
ret.x0_blendMode = 5;
|
||||||
|
ret.x1_matSetIdx = 0;
|
||||||
|
ret.x2_flags = (x54_29_ << 1) | (x54_27_depthUpdate << 0) | 3 | 8;
|
||||||
|
ret.x4_color = col;
|
||||||
|
}
|
||||||
|
else if (x48_blendMode == EBlendMode::One)
|
||||||
|
{
|
||||||
|
CModelFlags ret;
|
||||||
|
ret.x0_blendMode = 7;
|
||||||
|
ret.x1_matSetIdx = 0;
|
||||||
|
ret.x2_flags = x54_26_depthEqual << 0 | x54_27_depthUpdate << 1 | 0x8;
|
||||||
|
ret.x4_color = col;
|
||||||
|
}
|
||||||
|
else if (x48_blendMode == EBlendMode::Two)
|
||||||
|
{
|
||||||
|
CModelFlags ret;
|
||||||
|
ret.x0_blendMode = 8;
|
||||||
|
ret.x1_matSetIdx = 0;
|
||||||
|
ret.x2_flags = x54_26_depthEqual << 0 | x54_27_depthUpdate << 1 | 0x8;
|
||||||
|
ret.x4_color = col;
|
||||||
|
}
|
||||||
|
else if (x48_blendMode == EBlendMode::Three)
|
||||||
|
{
|
||||||
|
CModelFlags ret;
|
||||||
|
ret.x0_blendMode = 1;
|
||||||
|
ret.x1_matSetIdx = 0;
|
||||||
|
ret.x2_flags = x54_26_depthEqual << 0 | x54_27_depthUpdate << 1 | 0x8;
|
||||||
|
ret.x4_color = col;
|
||||||
|
}
|
||||||
|
else if (x48_blendMode == EBlendMode::Four)
|
||||||
|
{
|
||||||
|
CModelFlags ret;
|
||||||
|
ret.x0_blendMode = 2;
|
||||||
|
ret.x1_matSetIdx = 0;
|
||||||
|
ret.x2_flags = x54_26_depthEqual << 0 | x54_27_depthUpdate << 1 | 0x8;
|
||||||
|
ret.x4_color = col;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ret.x2_flags = 3;
|
||||||
|
ret.x4_color = zeus::CColor::skWhite;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (x48_blendMode == EBlendMode::Zero)
|
||||||
|
{
|
||||||
|
if (col == zeus::CColor::skWhite)
|
||||||
|
{
|
||||||
|
ret.x0_blendMode = 3;
|
||||||
|
ret.x1_matSetIdx = 0;
|
||||||
|
ret.x2_flags = x54_26_depthEqual << 0 | x54_27_depthUpdate << 1;
|
||||||
|
ret.x4_color = zeus::CColor::skWhite;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ret.x0_blendMode = 5;
|
||||||
|
ret.x1_matSetIdx = 0;
|
||||||
|
ret.x2_flags = x54_26_depthEqual << 0 | x54_27_depthUpdate << 1;
|
||||||
|
ret.x4_color = col;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (x48_blendMode == EBlendMode::One)
|
||||||
|
{
|
||||||
|
ret.x0_blendMode = 7;
|
||||||
|
ret.x1_matSetIdx = 0;
|
||||||
|
ret.x2_flags = x54_26_depthEqual << 0 | x54_27_depthUpdate << 1;
|
||||||
|
ret.x4_color = col;
|
||||||
|
}
|
||||||
|
else if (x48_blendMode == EBlendMode::Two)
|
||||||
|
{
|
||||||
|
ret.x0_blendMode = 8;
|
||||||
|
ret.x1_matSetIdx = 0;
|
||||||
|
ret.x2_flags = x54_26_depthEqual << 0 | x54_27_depthUpdate << 1;
|
||||||
|
ret.x4_color = col;
|
||||||
|
}
|
||||||
|
else if (x48_blendMode == EBlendMode::Three)
|
||||||
|
{
|
||||||
|
if (col == zeus::CColor::skWhite)
|
||||||
|
{
|
||||||
|
ret.x0_blendMode = 3;
|
||||||
|
ret.x1_matSetIdx = 0;
|
||||||
|
ret.x2_flags = x54_26_depthEqual << 0 | x54_27_depthUpdate << 1;
|
||||||
|
ret.x4_color = zeus::CColor::skWhite;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ret.x0_blendMode = 1;
|
||||||
|
ret.x1_matSetIdx = 0;
|
||||||
|
ret.x2_flags = x54_26_depthEqual << 0 | x54_27_depthUpdate << 1;
|
||||||
|
ret.x4_color = col;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (x48_blendMode == EBlendMode::Four)
|
||||||
|
{
|
||||||
|
ret.x0_blendMode = 2;
|
||||||
|
ret.x1_matSetIdx = 0;
|
||||||
|
ret.x2_flags = x54_26_depthEqual << 0 | x54_27_depthUpdate << 1;
|
||||||
|
ret.x4_color = col;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ret.x2_flags = 3;
|
||||||
|
ret.x4_color = zeus::CColor::skWhite;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CScriptColorModulate::SetTargetFlags(CStateManager& stateMgr, const CModelFlags& flags)
|
void CScriptColorModulate::SetTargetFlags(CStateManager& stateMgr, const CModelFlags& flags)
|
||||||
@ -155,21 +270,47 @@ void CScriptColorModulate::SetTargetFlags(CStateManager& stateMgr, const CModelF
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (x34_ != kInvalidUniqueId)
|
if (x34_parent != kInvalidUniqueId)
|
||||||
{
|
{
|
||||||
CEntity* ent = stateMgr.ObjectById(x34_);
|
CEntity* ent = stateMgr.ObjectById(x34_parent);
|
||||||
if (CActor* act = TCastToPtr<CActor>(ent))
|
if (CActor* act = TCastToPtr<CActor>(ent))
|
||||||
act->SetDrawFlags(flags);
|
act->SetDrawFlags(flags);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CScriptColorModulate::FadeOutHelper(CStateManager &, TUniqueId, float)
|
TUniqueId CScriptColorModulate::FadeOutHelper(CStateManager& mgr, TUniqueId parent, float dt)
|
||||||
{
|
{
|
||||||
|
TAreaId aId = mgr.GetNextAreaId();
|
||||||
|
if (const CEntity* ent = mgr.GetObjectById(parent))
|
||||||
|
aId = ent->GetAreaIdAlways();
|
||||||
|
|
||||||
|
TUniqueId ret = mgr.AllocateUniqueId();
|
||||||
|
CScriptColorModulate* colMod = new CScriptColorModulate(ret, "", CEntityInfo(aId, CEntity::NullConnectionList), zeus::CColor(1.f, 1.f, 1.f, 0.f), zeus::CColor(1.f, 1.f, 1.f, 1.f), EBlendMode::Zero, dt, 0.f, false, false, true, true, false, true);
|
||||||
|
mgr.AddObject(colMod);
|
||||||
|
colMod->x34_parent = parent;
|
||||||
|
colMod->x54_30_ = true;
|
||||||
|
colMod->x54_31_ = true;
|
||||||
|
colMod->x55_24_ = true;
|
||||||
|
|
||||||
|
colMod->Think(0.f, mgr);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CScriptColorModulate::FadeInHelper(CStateManager& mgr, TUniqueId uid, float f1)
|
TUniqueId CScriptColorModulate::FadeInHelper(CStateManager& mgr, TUniqueId parent, float dt)
|
||||||
{
|
{
|
||||||
|
TAreaId aId = mgr.GetNextAreaId();
|
||||||
|
if (const CEntity* ent = mgr.GetObjectById(parent))
|
||||||
|
aId = ent->GetAreaIdAlways();
|
||||||
|
|
||||||
|
TUniqueId ret = mgr.AllocateUniqueId();
|
||||||
|
CScriptColorModulate* colMod = new CScriptColorModulate(ret, "", CEntityInfo(aId, CEntity::NullConnectionList), zeus::CColor(1.f, 1.f, 1.f, 1.f), zeus::CColor(1.f, 1.f, 1.f, 0.f), EBlendMode::Zero, dt, 0.f, false, false, true, true, false, true);
|
||||||
|
mgr.AddObject(colMod);
|
||||||
|
colMod->x34_parent = parent;
|
||||||
|
colMod->x54_30_ = true;
|
||||||
|
colMod->x54_31_ = true;
|
||||||
|
|
||||||
|
colMod->Think(0.f, mgr);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CScriptColorModulate::End(CStateManager& stateMgr)
|
void CScriptColorModulate::End(CStateManager& stateMgr)
|
||||||
@ -188,7 +329,7 @@ void CScriptColorModulate::End(CStateManager& stateMgr)
|
|||||||
SetTargetFlags(stateMgr, CModelFlags(0, 0, 3, zeus::CColor::skWhite));
|
SetTargetFlags(stateMgr, CModelFlags(0, 0, 3, zeus::CColor::skWhite));
|
||||||
|
|
||||||
if (x55_24_)
|
if (x55_24_)
|
||||||
stateMgr.SendScriptMsgAlways(x34_, x8_uid, EScriptObjectMessage::Deactivate);
|
stateMgr.SendScriptMsgAlways(x34_parent, x8_uid, EScriptObjectMessage::Deactivate);
|
||||||
|
|
||||||
CEntity::SendScriptMsgs(EScriptObjectState::MaxReached, stateMgr, EScriptObjectMessage::None);
|
CEntity::SendScriptMsgs(EScriptObjectState::MaxReached, stateMgr, EScriptObjectMessage::None);
|
||||||
|
|
||||||
|
@ -12,10 +12,15 @@ class CScriptColorModulate : public CEntity
|
|||||||
public:
|
public:
|
||||||
enum class EBlendMode
|
enum class EBlendMode
|
||||||
{
|
{
|
||||||
|
Zero,
|
||||||
|
One,
|
||||||
|
Two,
|
||||||
|
Three,
|
||||||
|
Four,
|
||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
TUniqueId x34_ = kInvalidUniqueId;
|
TUniqueId x34_parent = kInvalidUniqueId;
|
||||||
u32 x38_ = 0;
|
u32 x38_ = 0;
|
||||||
float x3c_;
|
float x3c_;
|
||||||
zeus::CColor x40_;
|
zeus::CColor x40_;
|
||||||
@ -29,8 +34,8 @@ private:
|
|||||||
{
|
{
|
||||||
bool x54_24_ : 1;
|
bool x54_24_ : 1;
|
||||||
bool x54_25_ : 1;
|
bool x54_25_ : 1;
|
||||||
bool x54_26_ : 1;
|
bool x54_26_depthEqual : 1;
|
||||||
bool x54_27_ : 1;
|
bool x54_27_depthUpdate : 1;
|
||||||
bool x54_28_ : 1;
|
bool x54_28_ : 1;
|
||||||
bool x54_29_ : 1;
|
bool x54_29_ : 1;
|
||||||
bool x54_30_ : 1;
|
bool x54_30_ : 1;
|
||||||
@ -49,8 +54,8 @@ public:
|
|||||||
void Think(float, CStateManager &);
|
void Think(float, CStateManager &);
|
||||||
CModelFlags CalculateFlags(const zeus::CColor&) const;
|
CModelFlags CalculateFlags(const zeus::CColor&) const;
|
||||||
void SetTargetFlags(CStateManager&, const CModelFlags&);
|
void SetTargetFlags(CStateManager&, const CModelFlags&);
|
||||||
static void FadeOutHelper(CStateManager&, TUniqueId, float);
|
static TUniqueId FadeOutHelper(CStateManager&, TUniqueId, float);
|
||||||
static void FadeInHelper(CStateManager&, TUniqueId, float);
|
static TUniqueId FadeInHelper(CStateManager&, TUniqueId, float);
|
||||||
void End(CStateManager&);
|
void End(CStateManager&);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -85,6 +85,7 @@ void CScriptDamageableTrigger::AcceptScriptMsg(EScriptObjectMessage msg, TUnique
|
|||||||
case EScriptObjectMessage::Deactivate:
|
case EScriptObjectMessage::Deactivate:
|
||||||
if (x30_24_active && x300_25_alphaOut)
|
if (x30_24_active && x300_25_alphaOut)
|
||||||
return;
|
return;
|
||||||
|
[[fallthrough]];
|
||||||
case EScriptObjectMessage::Activate:
|
case EScriptObjectMessage::Activate:
|
||||||
if (!x30_24_active || x300_25_alphaOut)
|
if (!x30_24_active || x300_25_alphaOut)
|
||||||
{
|
{
|
||||||
@ -135,7 +136,7 @@ void CScriptDamageableTrigger::Render(const CStateManager& mgr) const
|
|||||||
CActor::Render(mgr);
|
CActor::Render(mgr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CScriptDamageableTrigger::AddToRenderer(const zeus::CFrustum& frustum, const CStateManager& mgr) const
|
void CScriptDamageableTrigger::AddToRenderer(const zeus::CFrustum& /*frustum*/, const CStateManager& mgr) const
|
||||||
{
|
{
|
||||||
if (x300_26_outOfFrustum)
|
if (x300_26_outOfFrustum)
|
||||||
return;
|
return;
|
||||||
@ -184,10 +185,10 @@ float CScriptDamageableTrigger::GetPuddleAlphaScale() const
|
|||||||
|
|
||||||
void CScriptDamageableTrigger::Think(float dt, CStateManager& mgr)
|
void CScriptDamageableTrigger::Think(float dt, CStateManager& mgr)
|
||||||
{
|
{
|
||||||
if (!x30_24_active)
|
if (!GetActive())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const CGameArea* area = mgr.GetWorld()->GetAreaAlways(x4_areaId);
|
const CGameArea* area = mgr.GetWorld()->GetAreaAlways(GetAreaIdAlways());
|
||||||
CGameArea::EOcclusionState occState =
|
CGameArea::EOcclusionState occState =
|
||||||
area->IsPostConstructed() ? area->GetOcclusionState() : CGameArea::EOcclusionState::Occluded;
|
area->IsPostConstructed() ? area->GetOcclusionState() : CGameArea::EOcclusionState::Occluded;
|
||||||
x300_24_notOccluded = occState == CGameArea::EOcclusionState::Visible;
|
x300_24_notOccluded = occState == CGameArea::EOcclusionState::Visible;
|
||||||
@ -208,6 +209,7 @@ void CScriptDamageableTrigger::Think(float dt, CStateManager& mgr)
|
|||||||
|
|
||||||
SetLinkedObjectAlpha(0.f, mgr);
|
SetLinkedObjectAlpha(0.f, mgr);
|
||||||
x300_25_alphaOut = false;
|
x300_25_alphaOut = false;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -221,17 +223,17 @@ void CScriptDamageableTrigger::Think(float dt, CStateManager& mgr)
|
|||||||
}
|
}
|
||||||
if (x250_alphaTimer <= 0.75f)
|
if (x250_alphaTimer <= 0.75f)
|
||||||
x250_alphaTimer += dt;
|
x250_alphaTimer += dt;
|
||||||
float objAlpha = GetPuddleAlphaScale();
|
|
||||||
x1e0_alpha = 0.2f * objAlpha;
|
|
||||||
SetLinkedObjectAlpha(objAlpha, mgr);
|
|
||||||
}
|
}
|
||||||
|
float objAlpha = GetPuddleAlphaScale();
|
||||||
|
x1e0_alpha = 0.2f * objAlpha;
|
||||||
|
SetLinkedObjectAlpha(objAlpha, mgr);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::experimental::optional<zeus::CAABox> CScriptDamageableTrigger::GetTouchBounds() const
|
std::experimental::optional<zeus::CAABox> CScriptDamageableTrigger::GetTouchBounds() const
|
||||||
{
|
{
|
||||||
if (!x30_24_active || !x300_24_notOccluded)
|
if (x30_24_active && x300_24_notOccluded)
|
||||||
return {};
|
return {zeus::CAABox(x14c_bounds.min + GetTranslation(), x14c_bounds.max + GetTranslation())};
|
||||||
return {zeus::CAABox(x14c_bounds.min + GetTranslation(), x14c_bounds.max + GetTranslation())};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ CMaterialList MakeDockMaterialList()
|
|||||||
CScriptDock::CScriptDock(TUniqueId uid, std::string_view name, const CEntityInfo& info,
|
CScriptDock::CScriptDock(TUniqueId uid, std::string_view name, const CEntityInfo& info,
|
||||||
const zeus::CVector3f position, const zeus::CVector3f& extents, s32 dock, TAreaId area,
|
const zeus::CVector3f position, const zeus::CVector3f& extents, s32 dock, TAreaId area,
|
||||||
bool active, s32 dockReferenceCount, bool loadConnected)
|
bool active, s32 dockReferenceCount, bool loadConnected)
|
||||||
: CPhysicsActor(uid, true/*active*/, name, info, zeus::CTransform(zeus::CMatrix3f::skIdentityMatrix3f, position),
|
: CPhysicsActor(uid, active, name, info, zeus::CTransform(zeus::CMatrix3f::skIdentityMatrix3f, position),
|
||||||
CModelData::CModelDataNull(), MakeDockMaterialList(), zeus::CAABox(-extents * 0.5f, extents * 0.5f),
|
CModelData::CModelDataNull(), MakeDockMaterialList(), zeus::CAABox(-extents * 0.5f, extents * 0.5f),
|
||||||
SMoverData(1.f), CActorParameters::None(), 0.3f, 0.1f)
|
SMoverData(1.f), CActorParameters::None(), 0.3f, 0.1f)
|
||||||
, x258_dockReferenceCount(dockReferenceCount)
|
, x258_dockReferenceCount(dockReferenceCount)
|
||||||
@ -40,7 +40,6 @@ void CScriptDock::Accept(IVisitor& visitor)
|
|||||||
|
|
||||||
void CScriptDock::Think(float dt, CStateManager& mgr)
|
void CScriptDock::Think(float dt, CStateManager& mgr)
|
||||||
{
|
{
|
||||||
x30_24_active = true;
|
|
||||||
if (!GetActive())
|
if (!GetActive())
|
||||||
{
|
{
|
||||||
UpdateAreaActivateFlags(mgr);
|
UpdateAreaActivateFlags(mgr);
|
||||||
@ -135,7 +134,7 @@ void CScriptDock::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStat
|
|||||||
for (CEntity* ent : lst)
|
for (CEntity* ent : lst)
|
||||||
{
|
{
|
||||||
TCastToPtr<CScriptDoor> door(ent);
|
TCastToPtr<CScriptDoor> door(ent);
|
||||||
if (door && !door->IsConnectedToArea(mgr, aid))
|
if (door && door->IsConnectedToArea(mgr, aid))
|
||||||
door->ForceClosed(mgr);
|
door->ForceClosed(mgr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -157,10 +156,10 @@ void CScriptDock::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStat
|
|||||||
IGameArea::Dock* dock = mgr.WorldNC()->GetArea(x260_area)->DockNC(x25c_dock);
|
IGameArea::Dock* dock = mgr.WorldNC()->GetArea(x260_area)->DockNC(x25c_dock);
|
||||||
aid = dock->GetConnectedAreaId(dock->GetReferenceCount());
|
aid = dock->GetConnectedAreaId(dock->GetReferenceCount());
|
||||||
}
|
}
|
||||||
else if (aid == 0 || (aid >= mgr.GetWorld()->GetNumAreas() || !mgr.WorldNC()->GetArea(aid)->GetActive()))
|
|
||||||
return;
|
if (aid >= 0 && aid < mgr.GetWorld()->GetNumAreas() && mgr.WorldNC()->GetArea(aid)->GetActive())
|
||||||
CWorld::PropogateAreaChain(CGameArea::EOcclusionState(msg == EScriptObjectMessage::Increment),
|
CWorld::PropogateAreaChain(CGameArea::EOcclusionState(msg == EScriptObjectMessage::Increment),
|
||||||
mgr.WorldNC()->GetArea(aid), mgr.WorldNC());
|
mgr.WorldNC()->GetArea(aid), mgr.WorldNC());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -7,7 +7,7 @@ namespace urde
|
|||||||
{
|
{
|
||||||
CScriptDockAreaChange::CScriptDockAreaChange(TUniqueId uid, std::string_view name, const CEntityInfo& info, s32 w1,
|
CScriptDockAreaChange::CScriptDockAreaChange(TUniqueId uid, std::string_view name, const CEntityInfo& info, s32 w1,
|
||||||
bool active)
|
bool active)
|
||||||
: CEntity(uid, info, true/*active*/, name), x34_dockReference(w1)
|
: CEntity(uid, info, active, name), x34_dockReference(w1)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,7 +11,6 @@ class CScriptDockAreaChange : public CEntity
|
|||||||
public:
|
public:
|
||||||
CScriptDockAreaChange(TUniqueId, std::string_view, const CEntityInfo&, s32, bool);
|
CScriptDockAreaChange(TUniqueId, std::string_view, const CEntityInfo&, s32, bool);
|
||||||
|
|
||||||
void Think(float dt, CStateManager& mgr) { x30_24_active = true; CEntity::Think(dt, mgr); }
|
|
||||||
void Accept(IVisitor& visitor);
|
void Accept(IVisitor& visitor);
|
||||||
void AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId objId, CStateManager &stateMgr);
|
void AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId objId, CStateManager &stateMgr);
|
||||||
};
|
};
|
||||||
|
@ -16,7 +16,7 @@ namespace urde
|
|||||||
static CMaterialList MakeDoorMaterialList(bool open)
|
static CMaterialList MakeDoorMaterialList(bool open)
|
||||||
{
|
{
|
||||||
CMaterialList ret;
|
CMaterialList ret;
|
||||||
//ret.Add(EMaterialTypes::Solid);
|
ret.Add(EMaterialTypes::Solid);
|
||||||
ret.Add(EMaterialTypes::Immovable);
|
ret.Add(EMaterialTypes::Immovable);
|
||||||
ret.Add(EMaterialTypes::Orbit);
|
ret.Add(EMaterialTypes::Orbit);
|
||||||
if (!open)
|
if (!open)
|
||||||
@ -28,18 +28,18 @@ static CMaterialList MakeDoorMaterialList(bool open)
|
|||||||
CScriptDoor::CScriptDoor(TUniqueId uid, std::string_view name, const CEntityInfo& info,
|
CScriptDoor::CScriptDoor(TUniqueId uid, std::string_view name, const CEntityInfo& info,
|
||||||
const zeus::CTransform& xf, CModelData&& mData, const CActorParameters& actParms,
|
const zeus::CTransform& xf, CModelData&& mData, const CActorParameters& actParms,
|
||||||
const zeus::CVector3f& vec, const zeus::CAABox& aabb, bool active,
|
const zeus::CVector3f& vec, const zeus::CAABox& aabb, bool active,
|
||||||
bool open, bool b2, float animLen, bool ballDoor)
|
bool open, bool projectilesCollide, float animLen, bool ballDoor)
|
||||||
: CPhysicsActor(uid, active, name, info, xf, std::move(mData), MakeDoorMaterialList(open),
|
: CPhysicsActor(uid, active, name, info, xf, std::move(mData), MakeDoorMaterialList(open),
|
||||||
aabb, SMoverData(1.f), actParms, 0.3f, 0.1f)
|
aabb, SMoverData(1.f), actParms, 0.3f, 0.1f)
|
||||||
{
|
{
|
||||||
x258_animLen = animLen;
|
x258_animLen = animLen;
|
||||||
x2a8_24_ = false;
|
x2a8_24_closing = false;
|
||||||
x2a8_25_ = open;
|
x2a8_25_wasOpen = open;
|
||||||
x2a8_26_isOpen = open;
|
x2a8_26_isOpen = open;
|
||||||
x2a8_27_ = false;
|
x2a8_27_conditionsMet = false;
|
||||||
x2a8_28_ = b2;
|
x2a8_28_projectilesCollide = projectilesCollide;
|
||||||
x2a8_29_ballDoor = ballDoor;
|
x2a8_29_ballDoor = ballDoor;
|
||||||
x2a8_30_ = false;
|
x2a8_30_doClose = false;
|
||||||
x264_ = GetBoundingBox();
|
x264_ = GetBoundingBox();
|
||||||
x284_modelBounds = x64_modelData->GetBounds(xf.getRotation());
|
x284_modelBounds = x64_modelData->GetBounds(xf.getRotation());
|
||||||
x29c_ = vec;
|
x29c_ = vec;
|
||||||
@ -77,18 +77,18 @@ void CScriptDoor::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStat
|
|||||||
|
|
||||||
if (x2a8_26_isOpen)
|
if (x2a8_26_isOpen)
|
||||||
{
|
{
|
||||||
if (x27e_partner2 != kInvalidUniqueId)
|
// if (x27e_partner2 != kInvalidUniqueId)
|
||||||
{
|
// {
|
||||||
if (CEntity* ent = mgr.ObjectById(x27e_partner2))
|
// if (CEntity* ent = mgr.ObjectById(x27e_partner2))
|
||||||
mgr.SendScriptMsg(ent, GetUniqueId(), EScriptObjectMessage::Close);
|
// mgr.SendScriptMsg(ent, GetUniqueId(), EScriptObjectMessage::Close);
|
||||||
}
|
// }
|
||||||
x2a8_26_isOpen = false;
|
x2a8_26_isOpen = false;
|
||||||
SetDoorAnimation(EDoorAnimType::Close);
|
SetDoorAnimation(EDoorAnimType::Close);
|
||||||
mgr.GetCameraManager()->GetBallCamera()->DoorClosing(GetUniqueId());
|
mgr.GetCameraManager()->GetBallCamera()->DoorClosing(GetUniqueId());
|
||||||
}
|
}
|
||||||
else if (x2a8_27_)
|
else if (x2a8_27_conditionsMet)
|
||||||
{
|
{
|
||||||
x2a8_27_ = false;
|
x2a8_27_conditionsMet = false;
|
||||||
SendScriptMsgs(EScriptObjectState::Closed, mgr, EScriptObjectMessage::None);
|
SendScriptMsgs(EScriptObjectState::Closed, mgr, EScriptObjectMessage::None);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -101,17 +101,17 @@ void CScriptDoor::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStat
|
|||||||
{
|
{
|
||||||
if (x2a8_26_isOpen)
|
if (x2a8_26_isOpen)
|
||||||
return;
|
return;
|
||||||
x2a8_30_ = true;
|
x2a8_30_doClose = true;
|
||||||
mgr.SendScriptMsg(door, GetUniqueId(), EScriptObjectMessage::Close);
|
mgr.SendScriptMsg(door, GetUniqueId(), EScriptObjectMessage::Close);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (x2a8_26_isOpen)
|
else if (x2a8_26_isOpen)
|
||||||
{
|
{
|
||||||
x2a8_30_ = true;
|
x2a8_30_doClose = true;
|
||||||
if (TCastToPtr<CScriptDoor> door = mgr.ObjectById(x27e_partner2))
|
if (TCastToPtr<CScriptDoor> door = mgr.ObjectById(x27e_partner2))
|
||||||
{
|
{
|
||||||
mgr.SendScriptMsg(door, GetUniqueId(), EScriptObjectMessage::Close);
|
mgr.SendScriptMsg(door, GetUniqueId(), EScriptObjectMessage::Close);
|
||||||
x2a8_30_ = true;
|
x2a8_30_doClose = true;
|
||||||
}
|
}
|
||||||
x2a8_26_isOpen = false;
|
x2a8_26_isOpen = false;
|
||||||
SetDoorAnimation(EDoorAnimType::Close);
|
SetDoorAnimation(EDoorAnimType::Close);
|
||||||
@ -128,15 +128,15 @@ void CScriptDoor::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStat
|
|||||||
switch(doorCond)
|
switch(doorCond)
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
x2a8_27_ = true;
|
x2a8_27_conditionsMet = true;
|
||||||
x280_ = uid;
|
x280_prevDoor = uid;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
OpenDoor(uid, mgr);
|
OpenDoor(uid, mgr);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
x2a8_25_= false;
|
x2a8_25_wasOpen= false;
|
||||||
x2a8_24_ = true;
|
x2a8_24_closing = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -148,21 +148,21 @@ void CScriptDoor::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStat
|
|||||||
if (conn.x4_msg == EScriptObjectMessage::Increment)
|
if (conn.x4_msg == EScriptObjectMessage::Increment)
|
||||||
{
|
{
|
||||||
TUniqueId dock = mgr.GetIdForScript(conn.x8_objId);
|
TUniqueId dock = mgr.GetIdForScript(conn.x8_objId);
|
||||||
if (TCastToConstPtr<CScriptDock>(mgr.GetObjectById(dock)))
|
if (TCastToConstPtr<CScriptDock> d = mgr.GetObjectById(dock))
|
||||||
x282_dockId = dock;
|
x282_dockId = d->GetUniqueId();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case EScriptObjectMessage::SetToZero:
|
case EScriptObjectMessage::SetToZero:
|
||||||
{
|
{
|
||||||
x2a8_28_ = true;
|
x2a8_28_projectilesCollide = true;
|
||||||
mgr.MapWorldInfo()->SetDoorVisited(mgr.GetEditorIdForUniqueId(GetUniqueId()), true);
|
mgr.MapWorldInfo()->SetDoorVisited(mgr.GetEditorIdForUniqueId(GetUniqueId()), true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case EScriptObjectMessage::SetToMax:
|
case EScriptObjectMessage::SetToMax:
|
||||||
{
|
{
|
||||||
x2a8_28_ = false;
|
x2a8_28_projectilesCollide = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@ -179,50 +179,44 @@ void CScriptDoor::Think(float dt, CStateManager& mgr)
|
|||||||
if (!x2a8_26_isOpen && x25c_animTime < 0.5f)
|
if (!x2a8_26_isOpen && x25c_animTime < 0.5f)
|
||||||
x25c_animTime += dt;
|
x25c_animTime += dt;
|
||||||
|
|
||||||
if (x2a8_27_ && GetDoorOpenCondition(mgr) == 2)
|
if (x2a8_27_conditionsMet && GetDoorOpenCondition(mgr) == 2)
|
||||||
{
|
{
|
||||||
x2a8_27_ = false;
|
x2a8_27_conditionsMet = false;
|
||||||
OpenDoor(x280_, mgr);
|
OpenDoor(x280_prevDoor, mgr);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (x2a8_24_)
|
if (x2a8_24_closing)
|
||||||
{
|
{
|
||||||
x2a8_25_ = false;
|
x2a8_25_wasOpen = false;
|
||||||
mgr.GetCameraManager()->GetBallCamera()->DoorClosed(GetUniqueId());
|
mgr.GetCameraManager()->GetBallCamera()->DoorClosed(GetUniqueId());
|
||||||
x2a8_28_ = false;
|
x2a8_28_projectilesCollide = false;
|
||||||
x2a8_24_ = false;
|
x2a8_24_closing = false;
|
||||||
SendScriptMsgs(EScriptObjectState::Closed, mgr, EScriptObjectMessage::Decrement);
|
SendScriptMsgs(EScriptObjectState::Closed, mgr, EScriptObjectMessage::Decrement);
|
||||||
x25c_animTime = 0.f;
|
x25c_animTime = 0.f;
|
||||||
x2a8_30_ = false;
|
x2a8_30_doClose = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (x2a8_26_isOpen && !x64_modelData->IsAnimating())
|
if (x2a8_26_isOpen && !x64_modelData->IsAnimating())
|
||||||
RemoveMaterial(EMaterialTypes::Solid, EMaterialTypes::Occluder, EMaterialTypes::Orbit, EMaterialTypes::Scannable, mgr);
|
RemoveMaterial(EMaterialTypes::Solid, EMaterialTypes::Occluder, EMaterialTypes::Orbit, EMaterialTypes::Scannable, mgr);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (x2a8_25_ && !x64_modelData->IsAnimating())
|
if (x2a8_25_wasOpen && !x64_modelData->IsAnimating())
|
||||||
{
|
{
|
||||||
x2a8_25_ = false;
|
x2a8_25_wasOpen = false;
|
||||||
mgr.GetCameraManager()->GetBallCamera()->DoorClosed(GetUniqueId());
|
mgr.GetCameraManager()->GetBallCamera()->DoorClosed(GetUniqueId());
|
||||||
x2a8_28_ = false;
|
x2a8_28_projectilesCollide = false;
|
||||||
x2a8_27_ = false;
|
x2a8_27_conditionsMet = false;
|
||||||
SendScriptMsgs(EScriptObjectState::Closed, mgr, EScriptObjectMessage::None);
|
SendScriptMsgs(EScriptObjectState::Closed, mgr, EScriptObjectMessage::None);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GetScannableObjectInfo())
|
if (GetScannableObjectInfo())
|
||||||
AddMaterial(/*EMaterialTypes::Solid, */EMaterialTypes::Metal, EMaterialTypes::Occluder, EMaterialTypes::Orbit, EMaterialTypes::Scannable, mgr);
|
AddMaterial(EMaterialTypes::Solid, EMaterialTypes::Metal, EMaterialTypes::Occluder, EMaterialTypes::Orbit, EMaterialTypes::Scannable, mgr);
|
||||||
else
|
else
|
||||||
AddMaterial(/*EMaterialTypes::Solid, */EMaterialTypes::Metal, EMaterialTypes::Occluder, EMaterialTypes::Orbit, mgr);
|
AddMaterial(EMaterialTypes::Solid, EMaterialTypes::Metal, EMaterialTypes::Occluder, EMaterialTypes::Orbit, mgr);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (x64_modelData->IsAnimating())
|
if (x64_modelData->IsAnimating())
|
||||||
{
|
UpdateAnimation((x64_modelData->GetAnimationDuration(s32(x260_doorState)) / x258_animLen) * dt, mgr, true);
|
||||||
float f1 = x64_modelData->GetAnimationDuration(s32(x260_doorState));
|
|
||||||
float f0 = x258_animLen;
|
|
||||||
f0 = f1 / f0;
|
|
||||||
f1 = f0 * dt;
|
|
||||||
UpdateAnimation(f1, mgr, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
xe7_31_targetable = mgr.GetPlayerState()->GetCurrentVisor() == CPlayerState::EPlayerVisor::Scan;
|
xe7_31_targetable = mgr.GetPlayerState()->GetCurrentVisor() == CPlayerState::EPlayerVisor::Scan;
|
||||||
}
|
}
|
||||||
@ -239,7 +233,7 @@ void CScriptDoor::ForceClosed(CStateManager & mgr)
|
|||||||
if (x2a8_26_isOpen)
|
if (x2a8_26_isOpen)
|
||||||
{
|
{
|
||||||
x2a8_26_isOpen = false;
|
x2a8_26_isOpen = false;
|
||||||
x2a8_25_ = false;
|
x2a8_25_wasOpen = false;
|
||||||
|
|
||||||
mgr.GetCameraManager()->GetBallCamera()->DoorClosing(x8_uid);
|
mgr.GetCameraManager()->GetBallCamera()->DoorClosing(x8_uid);
|
||||||
mgr.GetCameraManager()->GetBallCamera()->DoorClosed(x8_uid);
|
mgr.GetCameraManager()->GetBallCamera()->DoorClosed(x8_uid);
|
||||||
@ -248,13 +242,13 @@ void CScriptDoor::ForceClosed(CStateManager & mgr)
|
|||||||
SendScriptMsgs(EScriptObjectState::Closed, mgr, EScriptObjectMessage::None);
|
SendScriptMsgs(EScriptObjectState::Closed, mgr, EScriptObjectMessage::None);
|
||||||
|
|
||||||
x25c_animTime = 0.f;
|
x25c_animTime = 0.f;
|
||||||
x2a8_27_ = false;
|
x2a8_27_conditionsMet = false;
|
||||||
x2a8_30_ = false;
|
x2a8_30_doClose = false;
|
||||||
}
|
}
|
||||||
else if (x2a8_27_)
|
else if (x2a8_27_conditionsMet)
|
||||||
{
|
{
|
||||||
x2a8_27_ = false;
|
x2a8_27_conditionsMet = false;
|
||||||
x2a8_30_ = false;
|
x2a8_30_doClose = false;
|
||||||
SendScriptMsgs(EScriptObjectState::Closed, mgr, EScriptObjectMessage::None);
|
SendScriptMsgs(EScriptObjectState::Closed, mgr, EScriptObjectMessage::None);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -283,8 +277,8 @@ void CScriptDoor::OpenDoor(TUniqueId uid, CStateManager& mgr)
|
|||||||
TEditorId eid = mgr.GetEditorIdForUniqueId(uid);
|
TEditorId eid = mgr.GetEditorIdForUniqueId(uid);
|
||||||
mgr.MapWorldInfo()->SetDoorVisited(eid, true);
|
mgr.MapWorldInfo()->SetDoorVisited(eid, true);
|
||||||
x2a8_26_isOpen = true;
|
x2a8_26_isOpen = true;
|
||||||
x2a8_25_ = true;
|
x2a8_25_wasOpen = true;
|
||||||
x2a8_27_ = false;
|
x2a8_27_conditionsMet = false;
|
||||||
|
|
||||||
if (const CScriptDoor* door = TCastToConstPtr<CScriptDoor>(mgr.GetObjectById(uid)))
|
if (const CScriptDoor* door = TCastToConstPtr<CScriptDoor>(mgr.GetObjectById(uid)))
|
||||||
x27c_partner1 = door->GetUniqueId();
|
x27c_partner1 = door->GetUniqueId();
|
||||||
@ -321,7 +315,10 @@ void CScriptDoor::OpenDoor(TUniqueId uid, CStateManager& mgr)
|
|||||||
if (conn.x4_msg != EScriptObjectMessage::Open)
|
if (conn.x4_msg != EScriptObjectMessage::Open)
|
||||||
continue;
|
continue;
|
||||||
if (TCastToConstPtr<CScriptDoor> door = mgr.GetObjectById(mgr.GetIdForScript(conn.x8_objId)))
|
if (TCastToConstPtr<CScriptDoor> door = mgr.GetObjectById(mgr.GetIdForScript(conn.x8_objId)))
|
||||||
|
{
|
||||||
x27e_partner2 = door->GetUniqueId();
|
x27e_partner2 = door->GetUniqueId();
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -333,7 +330,7 @@ u32 CScriptDoor::GetDoorOpenCondition(CStateManager& mgr)
|
|||||||
if (!dock)
|
if (!dock)
|
||||||
return 2;
|
return 2;
|
||||||
|
|
||||||
if (x25c_animTime < 0.05f || x2a8_30_)
|
if (x25c_animTime < 0.05f || x2a8_30_doClose)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
TAreaId destArea = dock->GetAreaId();
|
TAreaId destArea = dock->GetAreaId();
|
||||||
@ -368,19 +365,19 @@ u32 CScriptDoor::GetDoorOpenCondition(CStateManager& mgr)
|
|||||||
if (!door || door->GetUniqueId() == GetUniqueId())
|
if (!door || door->GetUniqueId() == GetUniqueId())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (door->GetAreaIdAlways() == GetAreaIdAlways() && door->x2a8_25_)
|
if (door->GetAreaIdAlways() == GetAreaIdAlways() && door->x2a8_25_wasOpen)
|
||||||
{
|
{
|
||||||
if (door->x282_dockId != kInvalidUniqueId)
|
if (door->x282_dockId != kInvalidUniqueId)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (CGameArea::CConstChainIterator aliveArea = world->GetChainHead(EChain::Alive); aliveArea != CWorld::GetAliveAreasEnd(); ++aliveArea)
|
for (const CGameArea& aliveArea : *world)
|
||||||
{
|
{
|
||||||
if (aliveArea->GetAreaId() == area->GetAreaId())
|
if (aliveArea.GetAreaId() == area->GetAreaId())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!aliveArea->IsFinishedOccluding())
|
if (!aliveArea.IsFinishedOccluding())
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -404,7 +401,7 @@ void CScriptDoor::SetDoorAnimation(CScriptDoor::EDoorAnimType type)
|
|||||||
|
|
||||||
std::experimental::optional<zeus::CAABox> CScriptDoor::GetProjectileBounds() const
|
std::experimental::optional<zeus::CAABox> CScriptDoor::GetProjectileBounds() const
|
||||||
{
|
{
|
||||||
if (x2a8_28_)
|
if (x2a8_28_projectilesCollide)
|
||||||
return {{x284_modelBounds.min + GetTranslation(), x284_modelBounds.max + GetTranslation()}};
|
return {{x284_modelBounds.min + GetTranslation(), x284_modelBounds.max + GetTranslation()}};
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
@ -22,18 +22,18 @@ public:
|
|||||||
zeus::CAABox x264_;
|
zeus::CAABox x264_;
|
||||||
TUniqueId x27c_partner1 = kInvalidUniqueId;
|
TUniqueId x27c_partner1 = kInvalidUniqueId;
|
||||||
TUniqueId x27e_partner2 = kInvalidUniqueId;
|
TUniqueId x27e_partner2 = kInvalidUniqueId;
|
||||||
TUniqueId x280_ = kInvalidUniqueId;
|
TUniqueId x280_prevDoor = kInvalidUniqueId;
|
||||||
TUniqueId x282_dockId = kInvalidUniqueId;
|
TUniqueId x282_dockId = kInvalidUniqueId;
|
||||||
zeus::CAABox x284_modelBounds;
|
zeus::CAABox x284_modelBounds;
|
||||||
zeus::CVector3f x29c_;
|
zeus::CVector3f x29c_;
|
||||||
|
|
||||||
bool x2a8_24_ : 1;
|
bool x2a8_24_closing : 1;
|
||||||
bool x2a8_25_ : 1;
|
bool x2a8_25_wasOpen : 1;
|
||||||
bool x2a8_26_isOpen : 1;
|
bool x2a8_26_isOpen : 1;
|
||||||
bool x2a8_27_ : 1;
|
bool x2a8_27_conditionsMet : 1;
|
||||||
bool x2a8_28_ : 1;
|
bool x2a8_28_projectilesCollide : 1;
|
||||||
bool x2a8_29_ballDoor : 1;
|
bool x2a8_29_ballDoor : 1;
|
||||||
bool x2a8_30_ : 1;
|
bool x2a8_30_doClose : 1;
|
||||||
public:
|
public:
|
||||||
CScriptDoor(TUniqueId, std::string_view name, const CEntityInfo& info,
|
CScriptDoor(TUniqueId, std::string_view name, const CEntityInfo& info,
|
||||||
const zeus::CTransform&, CModelData&&, const CActorParameters&,
|
const zeus::CTransform&, CModelData&&, const CActorParameters&,
|
||||||
|
@ -21,8 +21,12 @@ CScriptTrigger::CScriptTrigger(TUniqueId uid, std::string_view name, const CEnti
|
|||||||
, x12c_flags(triggerFlags)
|
, x12c_flags(triggerFlags)
|
||||||
, x130_bounds(bounds)
|
, x130_bounds(bounds)
|
||||||
{
|
{
|
||||||
|
x148_24_detectCamera = false;
|
||||||
|
x148_25_camSubmerged = false;
|
||||||
x148_26_deactivateOnEntered = deactivateOnEntered;
|
x148_26_deactivateOnEntered = deactivateOnEntered;
|
||||||
x148_27_deactivateOnExited = deactivateOnExited;
|
x148_27_deactivateOnExited = deactivateOnExited;
|
||||||
|
x148_28_playerTriggerProc = false;
|
||||||
|
x148_29_didPhazonDamage = false;
|
||||||
SetCallTouch(false);
|
SetCallTouch(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -488,14 +488,16 @@ void CWorld::TravelToArea(TAreaId aid, CStateManager& mgr, bool skipLoadOther)
|
|||||||
CGameArea* aliveAreas = x4c_chainHeads[3];
|
CGameArea* aliveAreas = x4c_chainHeads[3];
|
||||||
while (aliveAreas)
|
while (aliveAreas)
|
||||||
{
|
{
|
||||||
MoveToChain(aliveAreas, EChain::AliveJudgement);
|
CGameArea* aliveArea = aliveAreas;
|
||||||
aliveAreas = aliveAreas->x130_next;
|
aliveAreas = aliveAreas->x130_next;
|
||||||
|
MoveToChain(aliveArea, EChain::AliveJudgement);
|
||||||
}
|
}
|
||||||
CGameArea* loadingAreas = x4c_chainHeads[2];
|
CGameArea* loadingAreas = x4c_chainHeads[2];
|
||||||
while (loadingAreas)
|
while (loadingAreas)
|
||||||
{
|
{
|
||||||
MoveToChain(loadingAreas, EChain::ToDeallocate);
|
CGameArea* loadingArea = loadingAreas;
|
||||||
loadingAreas = loadingAreas->x130_next;
|
loadingAreas = loadingAreas->x130_next;
|
||||||
|
MoveToChain(loadingArea, EChain::ToDeallocate);
|
||||||
}
|
}
|
||||||
|
|
||||||
CGameArea* area = x18_areas[aid].get();
|
CGameArea* area = x18_areas[aid].get();
|
||||||
@ -532,11 +534,12 @@ void CWorld::TravelToArea(TAreaId aid, CStateManager& mgr, bool skipLoadOther)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CGameArea* judgementArea = x4c_chainHeads[4];
|
CGameArea* judgementAreas = x4c_chainHeads[4];
|
||||||
while (judgementArea)
|
while (judgementAreas)
|
||||||
{
|
{
|
||||||
|
CGameArea* judgementArea = judgementAreas;
|
||||||
|
judgementAreas = judgementArea->x130_next;
|
||||||
MoveToChain(judgementArea, EChain::ToDeallocate);
|
MoveToChain(judgementArea, EChain::ToDeallocate);
|
||||||
judgementArea = judgementArea->x130_next;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t toStreamCount = 0;
|
size_t toStreamCount = 0;
|
||||||
|
@ -40,6 +40,8 @@
|
|||||||
#include "CScriptPickupGenerator.hpp"
|
#include "CScriptPickupGenerator.hpp"
|
||||||
#include "CScriptPlatform.hpp"
|
#include "CScriptPlatform.hpp"
|
||||||
#include "CScriptPlayerActor.hpp"
|
#include "CScriptPlayerActor.hpp"
|
||||||
|
#include "CFishCloud.hpp"
|
||||||
|
#include "CFishCloudModifier.hpp"
|
||||||
#include "CScriptPlayerHint.hpp"
|
#include "CScriptPlayerHint.hpp"
|
||||||
#include "CScriptPlayerStateChange.hpp"
|
#include "CScriptPlayerStateChange.hpp"
|
||||||
#include "CScriptPointOfInterest.hpp"
|
#include "CScriptPointOfInterest.hpp"
|
||||||
@ -1629,7 +1631,8 @@ CEntity* ScriptLoader::LoadParasite(CStateManager& mgr, CInputStream& in, int pr
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
const CAnimationParameters& animParms = pInfo.GetAnimationParameters();
|
const CAnimationParameters& animParms = pInfo.GetAnimationParameters();
|
||||||
CModelData mData(CAnimRes(animParms.GetACSFile(), animParms.GetCharacter(), scale, animParms.GetInitialAnimation(), true));
|
CModelData mData(CAnimRes(animParms.GetACSFile(), animParms.GetCharacter(), scale, animParms.GetInitialAnimation(), true));
|
||||||
return new MP1::CParasite(mgr.AllocateUniqueId(), name, flavor, info, xf, std::move(mData), pInfo /*TODO: Finish */);
|
return new MP1::CParasite(mgr.AllocateUniqueId(), name, flavor, info, xf, std::move(mData), pInfo, 6, f1, f2, f3, f4, f5, f6, f7,
|
||||||
|
f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, 0.f, b1, 0, CDamageVulnerability::NormalVulnerabilty(), MP1::CParasiteInfo(), -1, -1, -1, -1, -1, 0.f, aParms);
|
||||||
}
|
}
|
||||||
|
|
||||||
CEntity* ScriptLoader::LoadPlayerHint(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
CEntity* ScriptLoader::LoadPlayerHint(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
||||||
@ -1882,13 +1885,67 @@ CEntity* ScriptLoader::LoadAreaAttributes(CStateManager& mgr, CInputStream& in,
|
|||||||
|
|
||||||
CEntity* ScriptLoader::LoadFishCloud(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
CEntity* ScriptLoader::LoadFishCloud(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
||||||
{
|
{
|
||||||
return nullptr;
|
if (!EnsurePropertyCount(propCount, 36, "FishCloud"))
|
||||||
|
return nullptr;
|
||||||
|
SScaledActorHead aHead = LoadScaledActorHead(in, mgr);
|
||||||
|
bool b1 = in.readBool();
|
||||||
|
CAssetId w1(in);
|
||||||
|
CAnimationParameters animParms(in);
|
||||||
|
u32 w5 = u32(in.readFloatBig());
|
||||||
|
float f1 = in.readFloatBig();
|
||||||
|
float f2 = in.readFloatBig();
|
||||||
|
float f3 = in.readFloatBig();
|
||||||
|
float f4 = in.readFloatBig();
|
||||||
|
float f5 = in.readFloatBig();
|
||||||
|
float f6 = in.readFloatBig();
|
||||||
|
float f7 = in.readFloatBig();
|
||||||
|
float f8 = in.readFloatBig();
|
||||||
|
float f9 = in.readFloatBig();
|
||||||
|
float f10 = in.readFloatBig();
|
||||||
|
float f11 = in.readFloatBig();
|
||||||
|
float f12 = in.readFloatBig();
|
||||||
|
float f13 = in.readFloatBig();
|
||||||
|
u32 w6 = in.readUint32Big();
|
||||||
|
|
||||||
|
|
||||||
|
if (!g_ResFactory->GetResourceTypeById(w1))
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
|
zeus::CColor col = zeus::CColor::ReadRGBABig(in);
|
||||||
|
bool b2 = in.readBool();
|
||||||
|
float f14 = in.readFloatBig();
|
||||||
|
CAssetId w7 = in.readUint32Big();
|
||||||
|
u32 w8 = in.readUint32Big();
|
||||||
|
CAssetId w9 = in.readUint32Big();
|
||||||
|
u32 w10 = in.readUint32Big();
|
||||||
|
CAssetId w11 = in.readUint32Big();
|
||||||
|
u32 w12 = in.readUint32Big();
|
||||||
|
CAssetId w13 = in.readUint32Big();
|
||||||
|
u32 w14 = in.readUint32Big();
|
||||||
|
u32 w15 = in.readUint32Big();
|
||||||
|
bool b3 = in.readBool();
|
||||||
|
bool b4 = in.readBool();
|
||||||
|
|
||||||
|
CModelData mData(CStaticRes(w1, zeus::CVector3f::skOne));
|
||||||
|
CAnimRes animRes(animParms.GetACSFile(), animParms.GetCharacter(), zeus::CVector3f::skOne, animParms.GetInitialAnimation(), true);
|
||||||
|
return new CFishCloud(mgr.AllocateUniqueId(), b1, aHead.x0_name, info, aHead.x40_scale, aHead.x10_transform, std::move(mData), animRes, w5,
|
||||||
|
f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, w6, col, b2, f14, w7, w8, w9, w10, w11, w12, w13, w14, w15, b3, b4);
|
||||||
}
|
}
|
||||||
|
|
||||||
CEntity* ScriptLoader::LoadFishCloudModifier(CStateManager& mgr, CInputStream& in, int propCount,
|
CEntity* ScriptLoader::LoadFishCloudModifier(CStateManager& mgr, CInputStream& in, int propCount,
|
||||||
const CEntityInfo& info)
|
const CEntityInfo& info)
|
||||||
{
|
{
|
||||||
return nullptr;
|
if (propCount < 6 || !EnsurePropertyCount(propCount, 7, "FishCloudModifier"))
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
|
std::string name = mgr.HashInstanceName(in);
|
||||||
|
zeus::CVector3f vec = zeus::CVector3f::ReadBig(in);
|
||||||
|
bool b1 = in.readBool();
|
||||||
|
bool b2 = in.readBool();
|
||||||
|
bool b3 = propCount > 6 ? in.readBool() : false;
|
||||||
|
float f1 = in.readFloatBig();
|
||||||
|
float f2 = in.readFloatBig();
|
||||||
|
return new CFishCloudModifier(mgr.AllocateUniqueId(), b1, name, info, vec, b2, b3, f1, f2);
|
||||||
}
|
}
|
||||||
|
|
||||||
CEntity* ScriptLoader::LoadVisorFlare(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
CEntity* ScriptLoader::LoadVisorFlare(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
||||||
@ -1977,7 +2034,7 @@ CEntity* ScriptLoader::LoadVisorGoo(CStateManager& mgr, CInputStream& in, int pr
|
|||||||
float farProb = in.readFloatBig();
|
float farProb = in.readFloatBig();
|
||||||
zeus::CColor color;
|
zeus::CColor color;
|
||||||
color.readRGBABig(in);
|
color.readRGBABig(in);
|
||||||
u32 sfx = in.readUint32Big();
|
s32 sfx = in.readInt32Big();
|
||||||
bool forceShow = in.readBool();
|
bool forceShow = in.readBool();
|
||||||
|
|
||||||
if (particle.IsValid() || electric.IsValid())
|
if (particle.IsValid() || electric.IsValid())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user