mirror of https://github.com/AxioDL/metaforce.git
Merge branch 'master' of ssh://git.axiodl.com:6431/AxioDL/urde
This commit is contained in:
commit
81d2276458
|
@ -132,42 +132,12 @@ makeProj:
|
|||
else
|
||||
m_vm.SetupEditorView();
|
||||
|
||||
bool runFromPaks = hecl::StringUtils::BeginsWith(subPath, _S("out"));
|
||||
if (runFromPaks)
|
||||
bool doRun = hecl::StringUtils::BeginsWith(subPath, _S("out"));
|
||||
if (doRun)
|
||||
{
|
||||
m_mainMP1.emplace(nullptr, nullptr, m_vm.m_mainBooFactory,
|
||||
m_vm.m_mainCommandQueue, m_vm.m_renderTex);
|
||||
}
|
||||
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);
|
||||
m_vm.InitMP1(*m_mainMP1);
|
||||
}
|
||||
|
||||
if (needsSave)
|
||||
|
|
|
@ -299,7 +299,8 @@ bool ViewManager::proc()
|
|||
gfxQ->execute();
|
||||
if (g_ResFactory)
|
||||
g_ResFactory->AsyncIdle();
|
||||
m_mainWindow->waitForRetrace(m_voiceEngine.get());
|
||||
if (!m_skipWait && hecl::com_developer->toBoolean())
|
||||
m_mainWindow->waitForRetrace(m_voiceEngine.get());
|
||||
CBooModel::ClearModelUniformCounters();
|
||||
CGraphics::TickRenderTimings();
|
||||
++logvisor::FrameIndex;
|
||||
|
|
|
@ -50,6 +50,7 @@ class ViewManager : public specter::IViewManager
|
|||
std::unique_ptr<SplashScreen> m_splash;
|
||||
std::unique_ptr<RootSpace> m_rootSpace;
|
||||
specter::View* m_rootSpaceView = nullptr;
|
||||
bool m_skipWait = false;
|
||||
|
||||
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::CGameArchitectureSupport* as = m->GetArchSupport())
|
||||
as->charKeyDown(cc, mkey, repeat);
|
||||
|
||||
if (cc == '\t')
|
||||
m_vm.m_skipWait = true;
|
||||
}
|
||||
|
||||
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::CGameArchitectureSupport* as = m->GetArchSupport())
|
||||
as->charKeyUp(cc, mkey);
|
||||
|
||||
if (cc == '\t')
|
||||
m_vm.m_skipWait = false;
|
||||
}
|
||||
|
||||
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 ret = false;
|
||||
for (CMapAreaData* data = x10_listHeads[1] ; data ; data = data->NextMapAreaData())
|
||||
CMapAreaData* data = x10_listHeads[1];
|
||||
while (data != nullptr)
|
||||
{
|
||||
if (data->IsLoaded())
|
||||
{
|
||||
CMapAreaData* next = data->NextMapAreaData();
|
||||
const_cast<CMapWorld*>(this)->MoveMapAreaToList(data, EMapAreaList::Loaded);
|
||||
data = next;
|
||||
}
|
||||
else
|
||||
{
|
||||
data = data->NextMapAreaData();
|
||||
ret = true;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -72,7 +72,7 @@ public:
|
|||
{
|
||||
TCachedToken<CMapArea> x0_area;
|
||||
EMapAreaList x10_list;
|
||||
CMapAreaData* x14_next;
|
||||
CMapAreaData* x14_next = nullptr;
|
||||
public:
|
||||
CMapAreaData(CAssetId areaRes, EMapAreaList list, CMapAreaData* next);
|
||||
void Lock() { x0_area.Lock(); }
|
||||
|
|
|
@ -50,7 +50,8 @@
|
|||
#include "Input/ControlMapper.hpp"
|
||||
#include "MP1/MP1.hpp"
|
||||
#include "GameGlobalObjects.hpp"
|
||||
|
||||
#include "World/CScriptDoor.hpp"
|
||||
#include "World/CScriptDamageableTrigger.hpp"
|
||||
#include <cmath>
|
||||
|
||||
namespace urde
|
||||
|
@ -1070,8 +1071,8 @@ void CStateManager::SendScriptMsg(CEntity* dest, TUniqueId src, EScriptObjectMes
|
|||
if (dest && !dest->x30_26_scriptingBlocked)
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
LogModule.report(logvisor::Info, "Sending '%s' to '%s'",
|
||||
ScriptObjectMessageToStr(msg).data(), dest->GetName().data());
|
||||
LogModule.report(logvisor::Info, "Sending '%s' to '%s' id= 0x%.4X\n",
|
||||
ScriptObjectMessageToStr(msg).data(), dest->GetName().data(), dest->GetUniqueId().id);
|
||||
#endif
|
||||
dest->AcceptScriptMsg(msg, src, *this);
|
||||
}
|
||||
|
@ -1089,8 +1090,8 @@ void CStateManager::SendScriptMsgAlways(TUniqueId dest, TUniqueId src, EScriptOb
|
|||
if (dst)
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
LogModule.report(logvisor::Info, "Sending '%s' to '%s'",
|
||||
ScriptObjectMessageToStr(msg).data(), dst->GetName().data());
|
||||
LogModule.report(logvisor::Info, "Sending '%s' to '%s' id= 0x%.4X\n",
|
||||
ScriptObjectMessageToStr(msg).data(), dst->GetName().data(), dst->GetUniqueId().id);
|
||||
#endif
|
||||
dst->AcceptScriptMsg(msg, src, *this);
|
||||
}
|
||||
|
@ -1704,6 +1705,7 @@ bool CStateManager::ApplyLocalDamage(const zeus::CVector3f& vec1, const zeus::CV
|
|||
}
|
||||
|
||||
float newHp = hInfo->GetHP() - mulDam;
|
||||
hInfo->SetHP(newHp);
|
||||
bool significant = std::fabs(newHp - hInfo->GetHP()) >= 0.00001;
|
||||
|
||||
if (player)
|
||||
|
|
|
@ -104,7 +104,7 @@ public:
|
|||
|
||||
static s32 BitPosition(u64 flag)
|
||||
{
|
||||
for (u32 i = 0; i < 63; ++i)
|
||||
for (u32 i = 0; i < 64; ++i)
|
||||
if ((flag & (1ull << i)) != 0)
|
||||
return i;
|
||||
return -1;
|
||||
|
|
|
@ -20,6 +20,7 @@ public:
|
|||
CLineRenderer& renderer,
|
||||
const boo::ObjToken<boo::IShaderPipeline>& pipeline,
|
||||
const boo::ObjToken<boo::ITexture>& texture)=0;
|
||||
virtual ~IDataBindingFactory() = default;
|
||||
};
|
||||
|
||||
private:
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
#include "CParasite.hpp"
|
||||
#include "World/CActorParameters.hpp"
|
||||
#include "Character/CModelData.hpp"
|
||||
#include "World/CPatternedInfo.hpp"
|
||||
#include "TCastTo.hpp"
|
||||
#include "World/CActorParameters.hpp"
|
||||
#include "World/CPatternedInfo.hpp"
|
||||
|
||||
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)
|
||||
{
|
||||
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, 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)
|
||||
{
|
||||
visitor.Visit(this);
|
||||
}
|
||||
}
|
||||
void CParasite::Accept(IVisitor &visitor) { visitor.Visit(this); }
|
||||
} // namespace urde::MP1
|
||||
|
|
|
@ -10,10 +10,38 @@ class CModelData;
|
|||
|
||||
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
|
||||
{
|
||||
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&);
|
||||
};
|
||||
|
|
|
@ -532,7 +532,14 @@ zeus::CAABox CGameProjectile::GetProjectileBounds() const
|
|||
std::min(x298_lastOrigin.z, GetTranslation().z) - x2a4_projExtent},
|
||||
{std::max(x298_lastOrigin.x, GetTranslation().x) + 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 CanCollideWithTrigger(CActor& act, CStateManager& mgr);
|
||||
zeus::CAABox GetProjectileBounds() const;
|
||||
std::experimental::optional<zeus::CAABox> GetTouchBounds() const;
|
||||
TUniqueId GetHomingTargetId() const { return x2c0_homingTargetId; }
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include "CFishCloud.hpp"
|
||||
#include "CActorParameters.hpp"
|
||||
#include "TCastTo.hpp"
|
||||
|
||||
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 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:
|
||||
CFishCloud(TUniqueId uid, bool active, std::string_view name, const CEntityInfo& info,
|
||||
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,
|
||||
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);
|
||||
|
||||
void Accept(IVisitor& visitor);
|
||||
void RemoveRepulsor(TUniqueId);
|
||||
void RemoveAttractor(TUniqueId);
|
||||
void AddRepulsor(TUniqueId, float, float);
|
||||
void AddAttractor(TUniqueId, float, float);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,68 @@
|
|||
#include "CFishCloudModifier.hpp"
|
||||
#include "CFishCloud.hpp"
|
||||
#include "CStateManager.hpp"
|
||||
#include "CActorParameters.hpp"
|
||||
#include "TCastTo.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
CFishCloudModifier::CFishCloudModifier(TUniqueId uid, bool active, std::string_view name, const CEntityInfo& eInfo,
|
||||
const zeus::CVector3f& pos, bool b2, bool b3, float f1, float f2)
|
||||
: CActor(uid, active, name, eInfo, zeus::CTransform::Translate(pos), CModelData::CModelDataNull(), {EMaterialTypes::NoStepLogic},
|
||||
CActorParameters::None(), kInvalidUniqueId)
|
||||
, xe8_(f1)
|
||||
, xec_(f2)
|
||||
, xf0_isRepulsor(b2)
|
||||
, xf1_(b3)
|
||||
{
|
||||
}
|
||||
|
||||
void CFishCloudModifier::Accept(IVisitor& visitor)
|
||||
{
|
||||
visitor.Visit(this);
|
||||
}
|
||||
|
||||
void CFishCloudModifier::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr)
|
||||
{
|
||||
CActor::AcceptScriptMsg(msg, uid, mgr);
|
||||
|
||||
if ((msg == EScriptObjectMessage::Activate || msg == EScriptObjectMessage::InitializedInArea) && GetActive())
|
||||
AddSelf(mgr);
|
||||
else if (msg == EScriptObjectMessage::Deactivate || msg == EScriptObjectMessage::Deleted)
|
||||
RemoveSelf(mgr);
|
||||
}
|
||||
|
||||
void CFishCloudModifier::AddSelf(CStateManager& mgr)
|
||||
{
|
||||
for (const SConnection& conn : GetConnectionList())
|
||||
{
|
||||
if (conn.x0_state != EScriptObjectState::Modify || conn.x4_msg != EScriptObjectMessage::Follow)
|
||||
continue;
|
||||
|
||||
if (TCastToPtr<CFishCloud> fishCloud = mgr.ObjectById(mgr.GetIdForScript(conn.x8_objId)))
|
||||
{
|
||||
if (xf0_isRepulsor)
|
||||
fishCloud->AddRepulsor(GetUniqueId(), xe8_, xec_);
|
||||
else
|
||||
fishCloud->AddAttractor(GetUniqueId(), xe8_, xec_);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CFishCloudModifier::RemoveSelf(CStateManager& mgr)
|
||||
{
|
||||
for (const SConnection& conn : GetConnectionList())
|
||||
{
|
||||
if (conn.x0_state != EScriptObjectState::Modify || conn.x4_msg != EScriptObjectMessage::Follow)
|
||||
continue;
|
||||
|
||||
if (TCastToPtr<CFishCloud> fishCloud = mgr.ObjectById(mgr.GetIdForScript(conn.x8_objId)))
|
||||
{
|
||||
if (xf0_isRepulsor)
|
||||
fishCloud->RemoveRepulsor(GetUniqueId());
|
||||
else
|
||||
fishCloud->RemoveAttractor(GetUniqueId());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
#ifndef __URDE_CFISHCLOUDMODIFIER_HPP__
|
||||
#define __URDE_CFISHCLOUDMODIFIER_HPP__
|
||||
|
||||
#include "CActor.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
class CFishCloudModifier : public CActor
|
||||
{
|
||||
float xe8_;
|
||||
float xec_;
|
||||
bool xf0_isRepulsor;
|
||||
bool xf1_;
|
||||
public:
|
||||
CFishCloudModifier(TUniqueId, bool, std::string_view, const CEntityInfo&, const zeus::CVector3f&, bool, bool, float, float);
|
||||
void Accept(IVisitor& visitor);
|
||||
void AcceptScriptMsg(EScriptObjectMessage, TUniqueId, CStateManager&);
|
||||
|
||||
void AddSelf(CStateManager&);
|
||||
void RemoveSelf(CStateManager&);
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
|
@ -614,17 +614,11 @@ void CGameArea::UpdateFog(float dt)
|
|||
|
||||
void CGameArea::OtherAreaOcclusionChanged()
|
||||
{
|
||||
if (GetPostConstructed()->x10e0_ == 3 && GetPostConstructed()->x10dc_occlusionState != EOcclusionState::Occluded)
|
||||
if (GetPostConstructed()->x10e0_ == 3 && GetPostConstructed()->x10dc_occlusionState == EOcclusionState::Visible)
|
||||
{
|
||||
bool unloaded = true;
|
||||
bool transferred = true;
|
||||
#if 0
|
||||
bool unloaded = UnloadAllloadedTextures();
|
||||
bool transferred = TransferTokensToARAM();
|
||||
#endif
|
||||
x12c_postConstructed->x1108_27_ = (unloaded && transferred);
|
||||
x12c_postConstructed->x1108_27_ = false;
|
||||
}
|
||||
else
|
||||
else if (GetPostConstructed()->x10dc_occlusionState == EOcclusionState::Visible)
|
||||
{
|
||||
ReloadAllUnloadedTextures();
|
||||
}
|
||||
|
@ -647,10 +641,10 @@ void CGameArea::PingOcclusionState()
|
|||
unloaded = UnloadAllloadedTextures();
|
||||
transferred = TransferTokens();
|
||||
#endif
|
||||
x12c_postConstructed->x1108_27_ = (unloaded && transferred);
|
||||
|
||||
x12c_postConstructed->x1108_26_ = true;
|
||||
if (unloaded && transferred)
|
||||
x12c_postConstructed->x1108_27_ = true;
|
||||
}
|
||||
x12c_postConstructed->x1108_26_ = true;
|
||||
}
|
||||
|
||||
void CGameArea::PreRender()
|
||||
|
|
|
@ -48,7 +48,6 @@ set(WORLD_SOURCES
|
|||
CScriptPickupGenerator.hpp CScriptPickupGenerator.cpp
|
||||
CScriptPointOfInterest.hpp CScriptPointOfInterest.cpp
|
||||
CScriptAreaAttributes.hpp CScriptAreaAttributes.cpp
|
||||
CFishCloud.hpp CFishCloud.cpp
|
||||
CScriptVisorFlare.hpp CScriptVisorFlare.cpp
|
||||
CScriptWorldTeleporter.hpp CScriptWorldTeleporter.cpp
|
||||
CScriptCameraWaypoint.hpp CScriptCameraWaypoint.cpp
|
||||
|
@ -74,6 +73,8 @@ set(WORLD_SOURCES
|
|||
CScriptPlayerStateChange.hpp CScriptPlayerStateChange.cpp
|
||||
CScriptTargetingPoint.hpp CScriptTargetingPoint.cpp
|
||||
CScriptPlayerActor.hpp CScriptPlayerActor.cpp
|
||||
CFishCloud.hpp CFishCloud.cpp
|
||||
CFishCloudModifier.hpp CFishCloudModifier.cpp
|
||||
CScriptSwitch.hpp CScriptSwitch.cpp
|
||||
CWallWalker.hpp CWallWalker.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,
|
||||
CModelData&& mData, const zeus::CAABox& aabb, float mass, float zMomentum,
|
||||
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)
|
||||
: CPhysicsActor(uid, active, name, info, xf, std::move(mData), matList, aabb, SMoverData(mass), actParms, 0.3f, 0.1f)
|
||||
, x258_initialHealth(hInfo)
|
||||
|
|
|
@ -33,7 +33,7 @@ public:
|
|||
CScriptActor(TUniqueId uid, std::string_view name, const CEntityInfo& info, const zeus::CTransform& xf,
|
||||
CModelData&& mData, const zeus::CAABox& aabb, float mass, float zMomentum,
|
||||
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);
|
||||
void Accept(IVisitor& visitor);
|
||||
void AcceptScriptMsg(EScriptObjectMessage, TUniqueId, CStateManager&);
|
||||
|
|
|
@ -18,9 +18,13 @@ CScriptColorModulate::CScriptColorModulate(TUniqueId uid, std::string_view name,
|
|||
{
|
||||
x54_24_ = b1;
|
||||
x54_25_ = b2;
|
||||
x54_26_ = b3;
|
||||
x54_27_ = b4;
|
||||
x54_26_depthEqual = b3;
|
||||
x54_27_depthUpdate = b4;
|
||||
x54_28_ = b5;
|
||||
x54_29_ = false;
|
||||
x54_30_ = false;
|
||||
x54_31_ = false;
|
||||
x55_24_ = false;
|
||||
}
|
||||
|
||||
void CScriptColorModulate::Accept(IVisitor& visitor)
|
||||
|
@ -31,7 +35,7 @@ void CScriptColorModulate::Accept(IVisitor& visitor)
|
|||
void CScriptColorModulate::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId objId, CStateManager& mgr)
|
||||
{
|
||||
CEntity::AcceptScriptMsg(msg, objId, mgr);
|
||||
return;
|
||||
|
||||
if (!GetActive())
|
||||
return;
|
||||
|
||||
|
@ -81,7 +85,6 @@ void CScriptColorModulate::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId o
|
|||
|
||||
void CScriptColorModulate::Think(float dt, CStateManager& mgr)
|
||||
{
|
||||
return;
|
||||
if (!GetActive() || !x54_30_)
|
||||
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)
|
||||
|
@ -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))
|
||||
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)
|
||||
|
@ -188,7 +329,7 @@ void CScriptColorModulate::End(CStateManager& stateMgr)
|
|||
SetTargetFlags(stateMgr, CModelFlags(0, 0, 3, zeus::CColor::skWhite));
|
||||
|
||||
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);
|
||||
|
||||
|
|
|
@ -12,10 +12,15 @@ class CScriptColorModulate : public CEntity
|
|||
public:
|
||||
enum class EBlendMode
|
||||
{
|
||||
Zero,
|
||||
One,
|
||||
Two,
|
||||
Three,
|
||||
Four,
|
||||
};
|
||||
|
||||
private:
|
||||
TUniqueId x34_ = kInvalidUniqueId;
|
||||
TUniqueId x34_parent = kInvalidUniqueId;
|
||||
u32 x38_ = 0;
|
||||
float x3c_;
|
||||
zeus::CColor x40_;
|
||||
|
@ -29,8 +34,8 @@ private:
|
|||
{
|
||||
bool x54_24_ : 1;
|
||||
bool x54_25_ : 1;
|
||||
bool x54_26_ : 1;
|
||||
bool x54_27_ : 1;
|
||||
bool x54_26_depthEqual : 1;
|
||||
bool x54_27_depthUpdate : 1;
|
||||
bool x54_28_ : 1;
|
||||
bool x54_29_ : 1;
|
||||
bool x54_30_ : 1;
|
||||
|
@ -49,8 +54,8 @@ public:
|
|||
void Think(float, CStateManager &);
|
||||
CModelFlags CalculateFlags(const zeus::CColor&) const;
|
||||
void SetTargetFlags(CStateManager&, const CModelFlags&);
|
||||
static void FadeOutHelper(CStateManager&, TUniqueId, float);
|
||||
static void FadeInHelper(CStateManager&, TUniqueId, float);
|
||||
static TUniqueId FadeOutHelper(CStateManager&, TUniqueId, float);
|
||||
static TUniqueId FadeInHelper(CStateManager&, TUniqueId, float);
|
||||
void End(CStateManager&);
|
||||
};
|
||||
}
|
||||
|
|
|
@ -85,6 +85,7 @@ void CScriptDamageableTrigger::AcceptScriptMsg(EScriptObjectMessage msg, TUnique
|
|||
case EScriptObjectMessage::Deactivate:
|
||||
if (x30_24_active && x300_25_alphaOut)
|
||||
return;
|
||||
[[fallthrough]];
|
||||
case EScriptObjectMessage::Activate:
|
||||
if (!x30_24_active || x300_25_alphaOut)
|
||||
{
|
||||
|
@ -135,7 +136,7 @@ void CScriptDamageableTrigger::Render(const CStateManager& mgr) const
|
|||
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)
|
||||
return;
|
||||
|
@ -184,10 +185,10 @@ float CScriptDamageableTrigger::GetPuddleAlphaScale() const
|
|||
|
||||
void CScriptDamageableTrigger::Think(float dt, CStateManager& mgr)
|
||||
{
|
||||
if (!x30_24_active)
|
||||
if (!GetActive())
|
||||
return;
|
||||
|
||||
const CGameArea* area = mgr.GetWorld()->GetAreaAlways(x4_areaId);
|
||||
const CGameArea* area = mgr.GetWorld()->GetAreaAlways(GetAreaIdAlways());
|
||||
CGameArea::EOcclusionState occState =
|
||||
area->IsPostConstructed() ? area->GetOcclusionState() : CGameArea::EOcclusionState::Occluded;
|
||||
x300_24_notOccluded = occState == CGameArea::EOcclusionState::Visible;
|
||||
|
@ -208,6 +209,7 @@ void CScriptDamageableTrigger::Think(float dt, CStateManager& mgr)
|
|||
|
||||
SetLinkedObjectAlpha(0.f, mgr);
|
||||
x300_25_alphaOut = false;
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -221,17 +223,17 @@ void CScriptDamageableTrigger::Think(float dt, CStateManager& mgr)
|
|||
}
|
||||
if (x250_alphaTimer <= 0.75f)
|
||||
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
|
||||
{
|
||||
if (!x30_24_active || !x300_24_notOccluded)
|
||||
return {};
|
||||
return {zeus::CAABox(x14c_bounds.min + GetTranslation(), x14c_bounds.max + GetTranslation())};
|
||||
if (x30_24_active && x300_24_notOccluded)
|
||||
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,
|
||||
const zeus::CVector3f position, const zeus::CVector3f& extents, s32 dock, TAreaId area,
|
||||
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),
|
||||
SMoverData(1.f), CActorParameters::None(), 0.3f, 0.1f)
|
||||
, x258_dockReferenceCount(dockReferenceCount)
|
||||
|
@ -40,7 +40,6 @@ void CScriptDock::Accept(IVisitor& visitor)
|
|||
|
||||
void CScriptDock::Think(float dt, CStateManager& mgr)
|
||||
{
|
||||
x30_24_active = true;
|
||||
if (!GetActive())
|
||||
{
|
||||
UpdateAreaActivateFlags(mgr);
|
||||
|
@ -135,7 +134,7 @@ void CScriptDock::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStat
|
|||
for (CEntity* ent : lst)
|
||||
{
|
||||
TCastToPtr<CScriptDoor> door(ent);
|
||||
if (door && !door->IsConnectedToArea(mgr, aid))
|
||||
if (door && door->IsConnectedToArea(mgr, aid))
|
||||
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);
|
||||
aid = dock->GetConnectedAreaId(dock->GetReferenceCount());
|
||||
}
|
||||
else if (aid == 0 || (aid >= mgr.GetWorld()->GetNumAreas() || !mgr.WorldNC()->GetArea(aid)->GetActive()))
|
||||
return;
|
||||
CWorld::PropogateAreaChain(CGameArea::EOcclusionState(msg == EScriptObjectMessage::Increment),
|
||||
mgr.WorldNC()->GetArea(aid), mgr.WorldNC());
|
||||
|
||||
if (aid >= 0 && aid < mgr.GetWorld()->GetNumAreas() && mgr.WorldNC()->GetArea(aid)->GetActive())
|
||||
CWorld::PropogateAreaChain(CGameArea::EOcclusionState(msg == EScriptObjectMessage::Increment),
|
||||
mgr.WorldNC()->GetArea(aid), mgr.WorldNC());
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -7,7 +7,7 @@ namespace urde
|
|||
{
|
||||
CScriptDockAreaChange::CScriptDockAreaChange(TUniqueId uid, std::string_view name, const CEntityInfo& info, s32 w1,
|
||||
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:
|
||||
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 AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId objId, CStateManager &stateMgr);
|
||||
};
|
||||
|
|
|
@ -16,7 +16,7 @@ namespace urde
|
|||
static CMaterialList MakeDoorMaterialList(bool open)
|
||||
{
|
||||
CMaterialList ret;
|
||||
//ret.Add(EMaterialTypes::Solid);
|
||||
ret.Add(EMaterialTypes::Solid);
|
||||
ret.Add(EMaterialTypes::Immovable);
|
||||
ret.Add(EMaterialTypes::Orbit);
|
||||
if (!open)
|
||||
|
@ -28,18 +28,18 @@ 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& 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),
|
||||
aabb, SMoverData(1.f), actParms, 0.3f, 0.1f)
|
||||
{
|
||||
x258_animLen = animLen;
|
||||
x2a8_24_ = false;
|
||||
x2a8_25_ = open;
|
||||
x2a8_24_closing = false;
|
||||
x2a8_25_wasOpen = open;
|
||||
x2a8_26_isOpen = open;
|
||||
x2a8_27_ = false;
|
||||
x2a8_28_ = b2;
|
||||
x2a8_27_conditionsMet = false;
|
||||
x2a8_28_projectilesCollide = projectilesCollide;
|
||||
x2a8_29_ballDoor = ballDoor;
|
||||
x2a8_30_ = false;
|
||||
x2a8_30_doClose = false;
|
||||
x264_ = GetBoundingBox();
|
||||
x284_modelBounds = x64_modelData->GetBounds(xf.getRotation());
|
||||
x29c_ = vec;
|
||||
|
@ -77,18 +77,18 @@ void CScriptDoor::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStat
|
|||
|
||||
if (x2a8_26_isOpen)
|
||||
{
|
||||
if (x27e_partner2 != kInvalidUniqueId)
|
||||
{
|
||||
if (CEntity* ent = mgr.ObjectById(x27e_partner2))
|
||||
mgr.SendScriptMsg(ent, GetUniqueId(), EScriptObjectMessage::Close);
|
||||
}
|
||||
// if (x27e_partner2 != kInvalidUniqueId)
|
||||
// {
|
||||
// if (CEntity* ent = mgr.ObjectById(x27e_partner2))
|
||||
// mgr.SendScriptMsg(ent, GetUniqueId(), EScriptObjectMessage::Close);
|
||||
// }
|
||||
x2a8_26_isOpen = false;
|
||||
SetDoorAnimation(EDoorAnimType::Close);
|
||||
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);
|
||||
}
|
||||
break;
|
||||
|
@ -101,17 +101,17 @@ void CScriptDoor::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStat
|
|||
{
|
||||
if (x2a8_26_isOpen)
|
||||
return;
|
||||
x2a8_30_ = true;
|
||||
x2a8_30_doClose = true;
|
||||
mgr.SendScriptMsg(door, GetUniqueId(), EScriptObjectMessage::Close);
|
||||
}
|
||||
}
|
||||
else if (x2a8_26_isOpen)
|
||||
{
|
||||
x2a8_30_ = true;
|
||||
x2a8_30_doClose = true;
|
||||
if (TCastToPtr<CScriptDoor> door = mgr.ObjectById(x27e_partner2))
|
||||
{
|
||||
mgr.SendScriptMsg(door, GetUniqueId(), EScriptObjectMessage::Close);
|
||||
x2a8_30_ = true;
|
||||
x2a8_30_doClose = true;
|
||||
}
|
||||
x2a8_26_isOpen = false;
|
||||
SetDoorAnimation(EDoorAnimType::Close);
|
||||
|
@ -128,15 +128,15 @@ void CScriptDoor::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStat
|
|||
switch(doorCond)
|
||||
{
|
||||
case 1:
|
||||
x2a8_27_ = true;
|
||||
x280_ = uid;
|
||||
x2a8_27_conditionsMet = true;
|
||||
x280_prevDoor = uid;
|
||||
break;
|
||||
case 2:
|
||||
OpenDoor(uid, mgr);
|
||||
break;
|
||||
default:
|
||||
x2a8_25_= false;
|
||||
x2a8_24_ = true;
|
||||
x2a8_25_wasOpen= false;
|
||||
x2a8_24_closing = true;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
@ -148,21 +148,21 @@ void CScriptDoor::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStat
|
|||
if (conn.x4_msg == EScriptObjectMessage::Increment)
|
||||
{
|
||||
TUniqueId dock = mgr.GetIdForScript(conn.x8_objId);
|
||||
if (TCastToConstPtr<CScriptDock>(mgr.GetObjectById(dock)))
|
||||
x282_dockId = dock;
|
||||
if (TCastToConstPtr<CScriptDock> d = mgr.GetObjectById(dock))
|
||||
x282_dockId = d->GetUniqueId();
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case EScriptObjectMessage::SetToZero:
|
||||
{
|
||||
x2a8_28_ = true;
|
||||
x2a8_28_projectilesCollide = true;
|
||||
mgr.MapWorldInfo()->SetDoorVisited(mgr.GetEditorIdForUniqueId(GetUniqueId()), true);
|
||||
break;
|
||||
}
|
||||
case EScriptObjectMessage::SetToMax:
|
||||
{
|
||||
x2a8_28_ = false;
|
||||
x2a8_28_projectilesCollide = false;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -179,50 +179,44 @@ void CScriptDoor::Think(float dt, CStateManager& mgr)
|
|||
if (!x2a8_26_isOpen && x25c_animTime < 0.5f)
|
||||
x25c_animTime += dt;
|
||||
|
||||
if (x2a8_27_ && GetDoorOpenCondition(mgr) == 2)
|
||||
if (x2a8_27_conditionsMet && GetDoorOpenCondition(mgr) == 2)
|
||||
{
|
||||
x2a8_27_ = false;
|
||||
OpenDoor(x280_, mgr);
|
||||
x2a8_27_conditionsMet = false;
|
||||
OpenDoor(x280_prevDoor, mgr);
|
||||
}
|
||||
|
||||
if (x2a8_24_)
|
||||
if (x2a8_24_closing)
|
||||
{
|
||||
x2a8_25_ = false;
|
||||
x2a8_25_wasOpen = false;
|
||||
mgr.GetCameraManager()->GetBallCamera()->DoorClosed(GetUniqueId());
|
||||
x2a8_28_ = false;
|
||||
x2a8_24_ = false;
|
||||
x2a8_28_projectilesCollide = false;
|
||||
x2a8_24_closing = false;
|
||||
SendScriptMsgs(EScriptObjectState::Closed, mgr, EScriptObjectMessage::Decrement);
|
||||
x25c_animTime = 0.f;
|
||||
x2a8_30_ = false;
|
||||
x2a8_30_doClose = false;
|
||||
}
|
||||
|
||||
if (x2a8_26_isOpen && !x64_modelData->IsAnimating())
|
||||
RemoveMaterial(EMaterialTypes::Solid, EMaterialTypes::Occluder, EMaterialTypes::Orbit, EMaterialTypes::Scannable, mgr);
|
||||
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());
|
||||
x2a8_28_ = false;
|
||||
x2a8_27_ = false;
|
||||
x2a8_28_projectilesCollide = false;
|
||||
x2a8_27_conditionsMet = false;
|
||||
SendScriptMsgs(EScriptObjectState::Closed, mgr, EScriptObjectMessage::None);
|
||||
}
|
||||
|
||||
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
|
||||
AddMaterial(/*EMaterialTypes::Solid, */EMaterialTypes::Metal, EMaterialTypes::Occluder, EMaterialTypes::Orbit, mgr);
|
||||
AddMaterial(EMaterialTypes::Solid, EMaterialTypes::Metal, EMaterialTypes::Occluder, EMaterialTypes::Orbit, mgr);
|
||||
}
|
||||
|
||||
if (x64_modelData->IsAnimating())
|
||||
{
|
||||
float f1 = x64_modelData->GetAnimationDuration(s32(x260_doorState));
|
||||
float f0 = x258_animLen;
|
||||
f0 = f1 / f0;
|
||||
f1 = f0 * dt;
|
||||
UpdateAnimation(f1, mgr, true);
|
||||
}
|
||||
UpdateAnimation((x64_modelData->GetAnimationDuration(s32(x260_doorState)) / x258_animLen) * dt, mgr, true);
|
||||
|
||||
xe7_31_targetable = mgr.GetPlayerState()->GetCurrentVisor() == CPlayerState::EPlayerVisor::Scan;
|
||||
}
|
||||
|
@ -239,7 +233,7 @@ void CScriptDoor::ForceClosed(CStateManager & mgr)
|
|||
if (x2a8_26_isOpen)
|
||||
{
|
||||
x2a8_26_isOpen = false;
|
||||
x2a8_25_ = false;
|
||||
x2a8_25_wasOpen = false;
|
||||
|
||||
mgr.GetCameraManager()->GetBallCamera()->DoorClosing(x8_uid);
|
||||
mgr.GetCameraManager()->GetBallCamera()->DoorClosed(x8_uid);
|
||||
|
@ -248,13 +242,13 @@ void CScriptDoor::ForceClosed(CStateManager & mgr)
|
|||
SendScriptMsgs(EScriptObjectState::Closed, mgr, EScriptObjectMessage::None);
|
||||
|
||||
x25c_animTime = 0.f;
|
||||
x2a8_27_ = false;
|
||||
x2a8_30_ = false;
|
||||
x2a8_27_conditionsMet = false;
|
||||
x2a8_30_doClose = false;
|
||||
}
|
||||
else if (x2a8_27_)
|
||||
else if (x2a8_27_conditionsMet)
|
||||
{
|
||||
x2a8_27_ = false;
|
||||
x2a8_30_ = false;
|
||||
x2a8_27_conditionsMet = false;
|
||||
x2a8_30_doClose = false;
|
||||
SendScriptMsgs(EScriptObjectState::Closed, mgr, EScriptObjectMessage::None);
|
||||
}
|
||||
}
|
||||
|
@ -283,8 +277,8 @@ void CScriptDoor::OpenDoor(TUniqueId uid, CStateManager& mgr)
|
|||
TEditorId eid = mgr.GetEditorIdForUniqueId(uid);
|
||||
mgr.MapWorldInfo()->SetDoorVisited(eid, true);
|
||||
x2a8_26_isOpen = true;
|
||||
x2a8_25_ = true;
|
||||
x2a8_27_ = false;
|
||||
x2a8_25_wasOpen = true;
|
||||
x2a8_27_conditionsMet = false;
|
||||
|
||||
if (const CScriptDoor* door = TCastToConstPtr<CScriptDoor>(mgr.GetObjectById(uid)))
|
||||
x27c_partner1 = door->GetUniqueId();
|
||||
|
@ -321,7 +315,10 @@ void CScriptDoor::OpenDoor(TUniqueId uid, CStateManager& mgr)
|
|||
if (conn.x4_msg != EScriptObjectMessage::Open)
|
||||
continue;
|
||||
if (TCastToConstPtr<CScriptDoor> door = mgr.GetObjectById(mgr.GetIdForScript(conn.x8_objId)))
|
||||
{
|
||||
x27e_partner2 = door->GetUniqueId();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -333,7 +330,7 @@ u32 CScriptDoor::GetDoorOpenCondition(CStateManager& mgr)
|
|||
if (!dock)
|
||||
return 2;
|
||||
|
||||
if (x25c_animTime < 0.05f || x2a8_30_)
|
||||
if (x25c_animTime < 0.05f || x2a8_30_doClose)
|
||||
return 1;
|
||||
|
||||
TAreaId destArea = dock->GetAreaId();
|
||||
|
@ -368,19 +365,19 @@ u32 CScriptDoor::GetDoorOpenCondition(CStateManager& mgr)
|
|||
if (!door || door->GetUniqueId() == GetUniqueId())
|
||||
continue;
|
||||
|
||||
if (door->GetAreaIdAlways() == GetAreaIdAlways() && door->x2a8_25_)
|
||||
if (door->GetAreaIdAlways() == GetAreaIdAlways() && door->x2a8_25_wasOpen)
|
||||
{
|
||||
if (door->x282_dockId != kInvalidUniqueId)
|
||||
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;
|
||||
|
||||
if (!aliveArea->IsFinishedOccluding())
|
||||
if (!aliveArea.IsFinishedOccluding())
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -404,7 +401,7 @@ void CScriptDoor::SetDoorAnimation(CScriptDoor::EDoorAnimType type)
|
|||
|
||||
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 {};
|
||||
}
|
||||
|
|
|
@ -22,18 +22,18 @@ public:
|
|||
zeus::CAABox x264_;
|
||||
TUniqueId x27c_partner1 = kInvalidUniqueId;
|
||||
TUniqueId x27e_partner2 = kInvalidUniqueId;
|
||||
TUniqueId x280_ = kInvalidUniqueId;
|
||||
TUniqueId x280_prevDoor = kInvalidUniqueId;
|
||||
TUniqueId x282_dockId = kInvalidUniqueId;
|
||||
zeus::CAABox x284_modelBounds;
|
||||
zeus::CVector3f x29c_;
|
||||
|
||||
bool x2a8_24_ : 1;
|
||||
bool x2a8_25_ : 1;
|
||||
bool x2a8_24_closing : 1;
|
||||
bool x2a8_25_wasOpen : 1;
|
||||
bool x2a8_26_isOpen : 1;
|
||||
bool x2a8_27_ : 1;
|
||||
bool x2a8_28_ : 1;
|
||||
bool x2a8_27_conditionsMet : 1;
|
||||
bool x2a8_28_projectilesCollide : 1;
|
||||
bool x2a8_29_ballDoor : 1;
|
||||
bool x2a8_30_ : 1;
|
||||
bool x2a8_30_doClose : 1;
|
||||
public:
|
||||
CScriptDoor(TUniqueId, std::string_view name, const CEntityInfo& info,
|
||||
const zeus::CTransform&, CModelData&&, const CActorParameters&,
|
||||
|
|
|
@ -21,8 +21,12 @@ CScriptTrigger::CScriptTrigger(TUniqueId uid, std::string_view name, const CEnti
|
|||
, x12c_flags(triggerFlags)
|
||||
, x130_bounds(bounds)
|
||||
{
|
||||
x148_24_detectCamera = false;
|
||||
x148_25_camSubmerged = false;
|
||||
x148_26_deactivateOnEntered = deactivateOnEntered;
|
||||
x148_27_deactivateOnExited = deactivateOnExited;
|
||||
x148_28_playerTriggerProc = false;
|
||||
x148_29_didPhazonDamage = false;
|
||||
SetCallTouch(false);
|
||||
}
|
||||
|
||||
|
|
|
@ -488,14 +488,16 @@ void CWorld::TravelToArea(TAreaId aid, CStateManager& mgr, bool skipLoadOther)
|
|||
CGameArea* aliveAreas = x4c_chainHeads[3];
|
||||
while (aliveAreas)
|
||||
{
|
||||
MoveToChain(aliveAreas, EChain::AliveJudgement);
|
||||
CGameArea* aliveArea = aliveAreas;
|
||||
aliveAreas = aliveAreas->x130_next;
|
||||
MoveToChain(aliveArea, EChain::AliveJudgement);
|
||||
}
|
||||
CGameArea* loadingAreas = x4c_chainHeads[2];
|
||||
while (loadingAreas)
|
||||
{
|
||||
MoveToChain(loadingAreas, EChain::ToDeallocate);
|
||||
CGameArea* loadingArea = loadingAreas;
|
||||
loadingAreas = loadingAreas->x130_next;
|
||||
MoveToChain(loadingArea, EChain::ToDeallocate);
|
||||
}
|
||||
|
||||
CGameArea* area = x18_areas[aid].get();
|
||||
|
@ -532,11 +534,12 @@ void CWorld::TravelToArea(TAreaId aid, CStateManager& mgr, bool skipLoadOther)
|
|||
}
|
||||
}
|
||||
}
|
||||
CGameArea* judgementArea = x4c_chainHeads[4];
|
||||
while (judgementArea)
|
||||
CGameArea* judgementAreas = x4c_chainHeads[4];
|
||||
while (judgementAreas)
|
||||
{
|
||||
CGameArea* judgementArea = judgementAreas;
|
||||
judgementAreas = judgementArea->x130_next;
|
||||
MoveToChain(judgementArea, EChain::ToDeallocate);
|
||||
judgementArea = judgementArea->x130_next;
|
||||
}
|
||||
|
||||
size_t toStreamCount = 0;
|
||||
|
|
|
@ -40,6 +40,8 @@
|
|||
#include "CScriptPickupGenerator.hpp"
|
||||
#include "CScriptPlatform.hpp"
|
||||
#include "CScriptPlayerActor.hpp"
|
||||
#include "CFishCloud.hpp"
|
||||
#include "CFishCloudModifier.hpp"
|
||||
#include "CScriptPlayerHint.hpp"
|
||||
#include "CScriptPlayerStateChange.hpp"
|
||||
#include "CScriptPointOfInterest.hpp"
|
||||
|
@ -1629,7 +1631,8 @@ CEntity* ScriptLoader::LoadParasite(CStateManager& mgr, CInputStream& in, int pr
|
|||
return nullptr;
|
||||
const CAnimationParameters& animParms = pInfo.GetAnimationParameters();
|
||||
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)
|
||||
|
@ -1882,13 +1885,67 @@ CEntity* ScriptLoader::LoadAreaAttributes(CStateManager& mgr, CInputStream& in,
|
|||
|
||||
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,
|
||||
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)
|
||||
|
@ -1977,7 +2034,7 @@ CEntity* ScriptLoader::LoadVisorGoo(CStateManager& mgr, CInputStream& in, int pr
|
|||
float farProb = in.readFloatBig();
|
||||
zeus::CColor color;
|
||||
color.readRGBABig(in);
|
||||
u32 sfx = in.readUint32Big();
|
||||
s32 sfx = in.readInt32Big();
|
||||
bool forceShow = in.readBool();
|
||||
|
||||
if (particle.IsValid() || electric.IsValid())
|
||||
|
|
Loading…
Reference in New Issue