This commit is contained in:
Jack Andersen 2017-01-15 07:51:01 -10:00
commit 7db63f3663
39 changed files with 707 additions and 448 deletions

View File

@ -4,54 +4,54 @@ namespace urde
{
CObjectList::CObjectList(EGameObjectList listEnum)
: m_listEnum(listEnum)
: x2004_listEnum(listEnum)
{}
void CObjectList::AddObject(CEntity& entity)
{
if (IsQualified(entity))
{
if (m_firstId != -1)
m_list[m_firstId].prev = entity.GetUniqueId() & 0x3ff;
TUniqueId prevFirst = m_firstId;
m_firstId = entity.GetUniqueId() & 0x3ff;
SObjectListEntry& newEnt = m_list[m_firstId];
if (x2008_firstId != -1)
x0_list[x2008_firstId].prev = entity.GetUniqueId() & 0x3ff;
TUniqueId prevFirst = x2008_firstId;
x2008_firstId = entity.GetUniqueId() & 0x3ff;
SObjectListEntry& newEnt = x0_list[x2008_firstId];
newEnt.entity = &entity;
newEnt.next = prevFirst;
newEnt.prev = -1;
++m_count;
++x200a_count;
}
}
void CObjectList::RemoveObject(TUniqueId uid)
{
uid = uid & 0x3ff;
SObjectListEntry& ent = m_list[uid];
SObjectListEntry& ent = x0_list[uid];
if (!ent.entity || ent.entity->GetUniqueId() != uid)
return;
if (uid == m_firstId)
if (uid == x2008_firstId)
{
m_firstId = ent.next;
x2008_firstId = ent.next;
if (ent.next != -1)
m_list[ent.next].prev = -1;
x0_list[ent.next].prev = -1;
}
else
{
if (ent.next != -1)
m_list[ent.next].prev = -1;
m_list[ent.prev].next = -1;
x0_list[ent.next].prev = -1;
x0_list[ent.prev].next = -1;
}
ent.entity = nullptr;
ent.next = -1;
ent.prev = -1;
--m_count;
--x200a_count;
}
const CEntity* CObjectList::GetObjectById(TUniqueId uid) const
{
if (!uid)
return nullptr;
const SObjectListEntry& ent = m_list[uid & 0x3ff];
const SObjectListEntry& ent = x0_list[uid & 0x3ff];
if (ent.entity->x30_26_scriptingBlocked)
return nullptr;
return ent.entity;
@ -61,7 +61,7 @@ CEntity* CObjectList::GetObjectById(TUniqueId uid)
{
if (!uid)
return nullptr;
SObjectListEntry& ent = m_list[uid & 0x3ff];
SObjectListEntry& ent = x0_list[uid & 0x3ff];
if (ent.entity->x30_26_scriptingBlocked)
return nullptr;
return ent.entity;

View File

@ -27,14 +27,13 @@ class CObjectList
struct SObjectListEntry
{
CEntity* entity = nullptr;
TUniqueId next = -1;
TUniqueId prev = -1;
TUniqueId next = kInvalidUniqueId;
TUniqueId prev = kInvalidUniqueId;
};
SObjectListEntry m_list[1024];
EGameObjectList m_listEnum;
TUniqueId m_firstId = kInvalidUniqueId;
u16 m_count = 0;
int m_areaIdx = 0;
SObjectListEntry x0_list[1024];
EGameObjectList x2004_listEnum;
TUniqueId x2008_firstId = kInvalidUniqueId;
u16 x200a_count = 0;
public:
class iterator
{
@ -47,7 +46,7 @@ public:
bool operator!=(const iterator& other) const { return m_id != other.m_id; }
CEntity* operator*() const { return m_list.GetObjectById(m_id); }
};
iterator begin() { return iterator(*this, m_firstId); }
iterator begin() { return iterator(*this, x2008_firstId); }
iterator end() { return iterator(*this, kInvalidUniqueId); }
CObjectList(EGameObjectList listEnum);
@ -55,9 +54,10 @@ public:
void AddObject(CEntity& entity);
void RemoveObject(TUniqueId uid);
const CEntity* GetObjectById(TUniqueId uid) const;
const CEntity* GetObjectByIndex(s32 index) const { return x0_list[index].entity; }
CEntity* GetObjectById(TUniqueId uid);
TUniqueId GetFirstObjectIndex() const { return m_firstId; }
TUniqueId GetNextObjectIndex(TUniqueId prev) const { return m_list[prev].next; }
TUniqueId GetFirstObjectIndex() const { return x2008_firstId; }
TUniqueId GetNextObjectIndex(TUniqueId prev) const { return x0_list[prev & 0x3ff].next; }
virtual bool IsQualified(const CEntity&);
};

View File

@ -181,7 +181,7 @@ CHealthInfo& CPlayerState::HealthInfo()
return xc_health;
}
CHealthInfo CPlayerState::GetHealthInfo() const
const CHealthInfo& CPlayerState::GetHealthInfo() const
{
return xc_health;
}

View File

@ -134,7 +134,7 @@ public:
u32 CalculateItemCollectionRate() const;
CHealthInfo& HealthInfo();
CHealthInfo GetHealthInfo() const;
const CHealthInfo &GetHealthInfo() const;
u32 GetPickupTotal() { return 99; }
void SetIsFusionEnabled(bool val) { x0_26_fusion = val; }
bool IsFusionEnabled() const { return x0_26_fusion; }

View File

@ -1,4 +1,5 @@
#include "CSortedLists.hpp"
#include "World/CActor.hpp"
namespace urde
{
@ -20,9 +21,19 @@ void CSortedListManager::RemoveFromList(ESortedList list, s16 id)
SSortedList& sl = xb000_sortedLists[u32(list)];
}
void CSortedListManager::Remove(const CActor *)
void CSortedListManager::Remove(const CActor* act)
{
SNode& node = x0_nodes[act->GetUniqueId() & 0x3ff];
if (node.x2a_full == false)
return;
RemoveFromList(ESortedList::Zero, node.x1c_);
RemoveFromList(ESortedList::Three, node.x22_);
RemoveFromList(ESortedList::One, node.x1e_);
RemoveFromList(ESortedList::Four, node.x24_);
RemoveFromList(ESortedList::Two, node.x20_);
RemoveFromList(ESortedList::Five, node.x26_);
node.x2a_full = false;
}
}

View File

@ -20,7 +20,7 @@ struct SSortedList
{
TUniqueId x0_ids[1024];
u32 x800_;
void Reset() {std::fill(std::begin(x0_ids), std::end(x0_ids), -1);}
void Reset() {std::fill(std::begin(x0_ids), std::end(x0_ids), kInvalidUniqueId);}
SSortedList() {Reset();}
};
@ -31,11 +31,14 @@ class CSortedListManager
{
u32 x0_ = 0;
zeus::CAABox x4_box = zeus::CAABox::skNullBox;
u32 x1c_;
u32 x20_;
u32 x24_;
u32 x28_ = -1;
bool x2a_ = false;
u16 x1c_;
u16 x1e_;
u16 x20_;
u16 x22_;
u16 x24_;
u16 x26_;
u16 x28_ = -1;
bool x2a_full = false;
};
SNode x0_nodes[1024];
SSortedList xb000_sortedLists[6];

View File

@ -29,25 +29,24 @@
namespace urde
{
logvisor::Module LogModule("urde::CStateManager");
CStateManager::CStateManager(const std::weak_ptr<CRelayTracker>& relayTracker,
const std::weak_ptr<CMapWorldInfo>& mwInfo,
const std::weak_ptr<CPlayerState>& playerState,
const std::weak_ptr<CMapWorldInfo>& mwInfo, const std::weak_ptr<CPlayerState>& playerState,
const std::weak_ptr<CWorldTransManager>& wtMgr,
const std::weak_ptr<CWorldLayerState>& layerState)
: x80c_allObjs(new CObjectList(EGameObjectList::All)),
x814_actorObjs(new CActorList()),
x81c_physActorObjs(new CPhysicsActorList()),
x824_cameraObjs(new CGameCameraList()),
x82c_lightObjs(new CGameLightList()),
x834_listenAiObjs(new CListeningAiList()),
x83c_aiWaypointObjs(new CAiWaypointList()),
x844_platformAndDoorObjs(new CPlatformAndDoorList()),
x8b8_playerState(playerState),
x8bc_relayTracker(relayTracker),
x8c0_mapWorldInfo(mwInfo),
x8c4_worldTransManager(wtMgr),
x8c8_worldLayerState(layerState)
: x80c_allObjs(new CObjectList(EGameObjectList::All))
, x814_actorObjs(new CActorList())
, x81c_physActorObjs(new CPhysicsActorList())
, x824_cameraObjs(new CGameCameraList())
, x82c_lightObjs(new CGameLightList())
, x834_listenAiObjs(new CListeningAiList())
, x83c_aiWaypointObjs(new CAiWaypointList())
, x844_platformAndDoorObjs(new CPlatformAndDoorList())
, x8b8_playerState(playerState)
, x8bc_relayTracker(relayTracker)
, x8c0_mapWorldInfo(mwInfo)
, x8c4_worldTransManager(wtMgr)
, x8c8_worldLayerState(layerState)
{
x86c_stateManagerContainer.reset(new CStateManagerContainer);
x870_cameraManager = &x86c_stateManagerContainer->x0_cameraManager;
@ -100,7 +99,8 @@ CStateManager::CStateManager(const std::weak_ptr<CRelayTracker>& relayTracker,
x90c_loaderFuncs[int(EScriptObjectType::GrapplePoint)] = ScriptLoader::LoadGrapplePoint;
x90c_loaderFuncs[int(EScriptObjectType::PuddleSpore)] = ScriptLoader::LoadPuddleSpore;
x90c_loaderFuncs[int(EScriptObjectType::DebugCameraWaypoint)] = ScriptLoader::LoadDebugCameraWaypoint;
x90c_loaderFuncs[int(EScriptObjectType::SpiderBallAttractionSurface)] = ScriptLoader::LoadSpiderBallAttractionSurface;
x90c_loaderFuncs[int(EScriptObjectType::SpiderBallAttractionSurface)] =
ScriptLoader::LoadSpiderBallAttractionSurface;
x90c_loaderFuncs[int(EScriptObjectType::PuddleToadGamma)] = ScriptLoader::LoadPuddleToadGamma;
x90c_loaderFuncs[int(EScriptObjectType::DistanceFog)] = ScriptLoader::LoadDistanceFog;
x90c_loaderFuncs[int(EScriptObjectType::FireFlea)] = ScriptLoader::LoadFireFlea;
@ -144,7 +144,7 @@ CStateManager::CStateManager(const std::weak_ptr<CRelayTracker>& relayTracker,
x90c_loaderFuncs[int(EScriptObjectType::ColorModulate)] = ScriptLoader::LoadColorModulate;
x90c_loaderFuncs[int(EScriptObjectType::ThardusRockProjectile)] = ScriptLoader::LoadThardusRockProjectile;
x90c_loaderFuncs[int(EScriptObjectType::Midi)] = ScriptLoader::LoadMidi;
x90c_loaderFuncs[int(EScriptObjectType::StreamedAudio)] = ScriptLoader::LoadStreamedMusic;
x90c_loaderFuncs[int(EScriptObjectType::StreamedAudio)] = ScriptLoader::LoadStreamedAudio;
x90c_loaderFuncs[int(EScriptObjectType::WorldTeleporterToo)] = ScriptLoader::LoadWorldTeleporter;
x90c_loaderFuncs[int(EScriptObjectType::Repulsor)] = ScriptLoader::LoadRepulsor;
x90c_loaderFuncs[int(EScriptObjectType::GunTurret)] = ScriptLoader::LoadGunTurret;
@ -203,7 +203,8 @@ void CStateManager::UpdateThermalVisor()
for (const CGameArea::Dock& dock : area->GetDocks())
{
zeus::CVector3f dockCenter = (dock.GetPlaneVertices()[0] + dock.GetPlaneVertices()[1] +
dock.GetPlaneVertices()[2] + dock.GetPlaneVertices()[3]) * 0.25f;
dock.GetPlaneVertices()[2] + dock.GetPlaneVertices()[3]) *
0.25f;
dockCenter.z = 0.f;
float dist = (playerXYPos - dockCenter).magSquared();
if (dist < closestDist)
@ -237,9 +238,8 @@ void CStateManager::UpdateThermalVisor()
else
closestDist = 0.5f;
xf24_thermColdScale1 =
(1.f - closestDist) * lastArea->GetPostConstructed()->x111c_thermalCurrent +
closestDist * area->GetPostConstructed()->x111c_thermalCurrent;
xf24_thermColdScale1 = (1.f - closestDist) * lastArea->GetPostConstructed()->x111c_thermalCurrent +
closestDist * area->GetPostConstructed()->x111c_thermalCurrent;
return;
}
}
@ -248,12 +248,10 @@ void CStateManager::UpdateThermalVisor()
}
}
bool CStateManager::RenderLast(TUniqueId)
{
return false;
}
bool CStateManager::RenderLast(TUniqueId) { return false; }
void CStateManager::AddDrawableActorPlane(const CActor& actor, const zeus::CPlane& plane, const zeus::CAABox& aabb) const
void CStateManager::AddDrawableActorPlane(const CActor& actor, const zeus::CPlane& plane,
const zeus::CAABox& aabb) const
{
#if 0
actor.SetAddedToken(x8dc_ + 1);
@ -261,8 +259,7 @@ void CStateManager::AddDrawableActorPlane(const CActor& actor, const zeus::CPlan
g_Renderer->AddPlaneObject(static_cast<const void*>(&actor), aabb, plane, 0);
}
void CStateManager::AddDrawableActor(const CActor& actor, const zeus::CVector3f& vec,
const zeus::CAABox& aabb) const
void CStateManager::AddDrawableActor(const CActor& actor, const zeus::CVector3f& vec, const zeus::CAABox& aabb) const
{
#if 0
actor.SetAddedToken(x8dc_ + 1);
@ -271,59 +268,40 @@ void CStateManager::AddDrawableActor(const CActor& actor, const zeus::CVector3f&
IRenderer::EDrawableSorting::SortedCallback);
}
void CStateManager::SpecialSkipCinematic()
void CStateManager::SpecialSkipCinematic() {}
void CStateManager::GetVisAreaId() const {}
void CStateManager::GetWeaponIdCount(TUniqueId, EWeaponType) {}
void CStateManager::RemoveWeaponId(TUniqueId, EWeaponType) {}
void CStateManager::AddWeaponId(TUniqueId, EWeaponType) {}
void CStateManager::UpdateEscapeSequenceTimer(float) {}
float CStateManager::GetEscapeSequenceTimer() const { return 0.f; }
void CStateManager::ResetEscapeSequenceTimer(float) {}
void CStateManager::SetupParticleHook(const CActor& actor) const {}
void CStateManager::MurderScriptInstanceNames() {}
std::string CStateManager::HashInstanceName(CInputStream& in)
{
#ifdef NDEBUG
static std::string name;
while (in.readByte() != 0) {};
return name;
#else
return in.readString();
#endif
}
void CStateManager::GetVisAreaId() const
{
}
void CStateManager::SetActorAreaId(CActor& actor, TAreaId) {}
void CStateManager::GetWeaponIdCount(TUniqueId, EWeaponType)
{
}
void CStateManager::RemoveWeaponId(TUniqueId, EWeaponType)
{
}
void CStateManager::AddWeaponId(TUniqueId, EWeaponType)
{
}
void CStateManager::UpdateEscapeSequenceTimer(float)
{
}
float CStateManager::GetEscapeSequenceTimer() const
{
return 0.f;
}
void CStateManager::ResetEscapeSequenceTimer(float)
{
}
void CStateManager::SetupParticleHook(const CActor& actor) const
{
}
void CStateManager::MurderScriptInstanceNames()
{
}
const std::string* CStateManager::HashInstanceName(CInputStream& in)
{
return nullptr;
}
void CStateManager::SetActorAreaId(CActor& actor, TAreaId)
{
}
void CStateManager::TouchSky() const
{
}
void CStateManager::TouchSky() const {}
void CStateManager::TouchPlayerActor()
{
@ -347,63 +325,33 @@ void CStateManager::DrawSpaceWarp(const zeus::CVector3f& v, float strength) cons
}
}
void CStateManager::DrawReflection(const zeus::CVector3f&)
{
}
void CStateManager::DrawReflection(const zeus::CVector3f&) {}
void CStateManager::CacheReflection()
{
}
void CStateManager::CacheReflection() {}
bool CStateManager::CanCreateProjectile(TUniqueId, EWeaponType, int) const
{
return false;
}
bool CStateManager::CanCreateProjectile(TUniqueId, EWeaponType, int) const { return false; }
const CGameLightList* CStateManager::GetDynamicLightList() const
{
return nullptr;
}
const CGameLightList* CStateManager::GetDynamicLightList() const { return nullptr; }
void CStateManager::BuildDynamicLightListForWorld(std::vector<CLight>& listOut) const
{
}
void CStateManager::BuildDynamicLightListForWorld(std::vector<CLight>& listOut) const {}
void CStateManager::DrawDebugStuff() const
{
}
void CStateManager::DrawDebugStuff() const {}
void CStateManager::RenderCamerasAndAreaLights() const
{
}
void CStateManager::RenderCamerasAndAreaLights() const {}
void CStateManager::DrawE3DeathEffect() const
{
}
void CStateManager::DrawE3DeathEffect() const {}
void CStateManager::DrawAdditionalFilters() const
{
}
void CStateManager::DrawAdditionalFilters() const {}
void CStateManager::DrawWorld() const
{
}
void CStateManager::DrawWorld() const {}
void CStateManager::SetupFogForArea(const CGameArea& area) const
{
}
void CStateManager::SetupFogForArea(const CGameArea& area) const {}
void CStateManager::PreRender()
{
}
void CStateManager::PreRender() {}
void CStateManager::GetVisSetForArea(TAreaId, TAreaId) const
{
}
void CStateManager::GetVisSetForArea(TAreaId, TAreaId) const {}
void CStateManager::RecursiveDrawTree(TUniqueId) const
{
}
void CStateManager::RecursiveDrawTree(TUniqueId) const {}
void CStateManager::SendScriptMsg(CEntity* dest, TUniqueId src, EScriptObjectMessage msg)
{
@ -426,16 +374,13 @@ void CStateManager::SendScriptMsgAlways(TUniqueId dest, TUniqueId src, EScriptOb
dst->AcceptScriptMsg(msg, src, *this);
}
void CStateManager::SendScriptMsg(TUniqueId src, TEditorId dest,
EScriptObjectMessage msg, EScriptObjectState state)
void CStateManager::SendScriptMsg(TUniqueId src, TEditorId dest, EScriptObjectMessage msg, EScriptObjectState state)
{
CEntity* ent = ObjectById(src);
auto search = GetIdListForScript(dest);
if (ent &&
search.first != x890_scriptIdMap.cend() &&
search.second != x890_scriptIdMap.cend())
if (ent && search.first != x890_scriptIdMap.cend() && search.second != x890_scriptIdMap.cend())
{
for (auto it = search.first ; it != search.second ; ++it)
for (auto it = search.first; it != search.second; ++it)
{
TUniqueId id = it->second;
CEntity* dobj = x80c_allObjs->GetObjectById(id);
@ -444,39 +389,23 @@ void CStateManager::SendScriptMsg(TUniqueId src, TEditorId dest,
}
}
void CStateManager::FreeScriptObjects(TAreaId)
{
}
void CStateManager::FreeScriptObjects(TAreaId) {}
void CStateManager::GetBuildForScript(TEditorId) const
{
}
void CStateManager::GetBuildForScript(TEditorId) const {}
TEditorId CStateManager::GetEditorIdForUniqueId(TUniqueId) const
{
return 0;
}
TEditorId CStateManager::GetEditorIdForUniqueId(TUniqueId) const { return 0; }
TUniqueId CStateManager::GetIdForScript(TEditorId) const
{
return 0;
}
TUniqueId CStateManager::GetIdForScript(TEditorId) const { return kInvalidUniqueId; }
std::pair<std::multimap<TEditorId, TUniqueId>::const_iterator,
std::multimap<TEditorId, TUniqueId>::const_iterator>
std::pair<std::multimap<TEditorId, TUniqueId>::const_iterator, std::multimap<TEditorId, TUniqueId>::const_iterator>
CStateManager::GetIdListForScript(TEditorId id) const
{
return x890_scriptIdMap.equal_range(id);
}
void CStateManager::LoadScriptObjects(TAreaId aid, CInputStream& in, std::vector<TEditorId>& idsOut)
{
}
void CStateManager::LoadScriptObjects(TAreaId aid, CInputStream& in, std::vector<TEditorId>& idsOut) {}
void CStateManager::LoadScriptObject(TAreaId, EScriptObjectType, u32,
CInputStream& in)
{
}
void CStateManager::LoadScriptObject(TAreaId, EScriptObjectType, u32, CInputStream& in) {}
void CStateManager::InitScriptObjects(std::vector<TEditorId>& ids)
{
@ -490,29 +419,26 @@ void CStateManager::InitScriptObjects(std::vector<TEditorId>& ids)
MurderScriptInstanceNames();
}
void CStateManager::InformListeners(const zeus::CVector3f&, EListenNoiseType)
{
}
void CStateManager::InformListeners(const zeus::CVector3f&, EListenNoiseType) {}
bool CStateManager::ApplyKnockBack(CActor& actor, const CDamageInfo& info,
const CDamageVulnerability&, const zeus::CVector3f&, float)
bool CStateManager::ApplyKnockBack(CActor& actor, const CDamageInfo& info, const CDamageVulnerability&,
const zeus::CVector3f&, float)
{
return false;
}
bool CStateManager::ApplyDamageToWorld(TUniqueId, const CActor&, const zeus::CVector3f&,
const CDamageInfo& info, const CMaterialFilter&)
bool CStateManager::ApplyDamageToWorld(TUniqueId, const CActor&, const zeus::CVector3f&, const CDamageInfo& info,
const CMaterialFilter&)
{
return false;
}
void CStateManager::ProcessRadiusDamage(const CActor&, CActor&, const zeus::CVector3f&,
const CDamageInfo& info, const CMaterialFilter&)
void CStateManager::ProcessRadiusDamage(const CActor&, CActor&, const zeus::CVector3f&, const CDamageInfo& info,
const CMaterialFilter&)
{
}
bool CStateManager::ApplyRadiusDamage(const CActor&, const zeus::CVector3f&, CActor&,
const CDamageInfo& info)
bool CStateManager::ApplyRadiusDamage(const CActor&, const zeus::CVector3f&, CActor&, const CDamageInfo& info)
{
return false;
}
@ -541,45 +467,29 @@ bool CStateManager::ApplyLocalDamage(const zeus::CVector3f& vec1, const zeus::CV
{
if (x870_cameraManager->IsInCinematicCamera())
{
}
}
return false;
}
bool CStateManager::ApplyDamage(TUniqueId, TUniqueId, TUniqueId, const CDamageInfo& info,
const CMaterialFilter&)
bool CStateManager::ApplyDamage(TUniqueId, TUniqueId, TUniqueId, const CDamageInfo& info, const CMaterialFilter&)
{
return false;
}
void CStateManager::UpdateAreaSounds()
{
}
void CStateManager::UpdateAreaSounds() {}
void CStateManager::FrameEnd()
{
}
void CStateManager::FrameEnd() {}
void CStateManager::ProcessPlayerInput()
{
}
void CStateManager::ProcessPlayerInput() {}
void CStateManager::ProcessInput(const CFinalInput& input)
{
}
void CStateManager::ProcessInput(const CFinalInput& input) {}
void CStateManager::Update(float dt)
{
}
void CStateManager::Update(float dt) {}
void CStateManager::UpdateGameState()
{
}
void CStateManager::UpdateGameState() {}
void CStateManager::FrameBegin()
{
}
void CStateManager::FrameBegin() {}
void CStateManager::InitializeState(ResId mlvlId, TAreaId aid, ResId mreaId)
{
@ -636,7 +546,7 @@ void CStateManager::InitializeState(ResId mlvlId, TAreaId aid, ResId mreaId)
break;
g_GameState->x228_25_deferPowerupInit = false;
for (int i=0 ; i<int(CPlayerState::EItemType::Max) ; ++i)
for (int i = 0; i < int(CPlayerState::EItemType::Max); ++i)
{
CPlayerState::EItemType iType = CPlayerState::EItemType(i);
@ -673,10 +583,9 @@ void CStateManager::CreateStandardGameObjects()
float unk3 = g_tweakPlayer->GetX27C();
zeus::CAABox pBounds = {{-xyHe, -xyHe, 0.f}, {xyHe, xyHe, height}};
auto q = zeus::CQuaternion::fromAxisAngle(zeus::CVector3f{0.f, 0.f, 1.f}, zeus::degToRad(129.6f));
x84c_player.reset(new CPlayer(AllocateUniqueId(), zeus::CTransform(q), pBounds, 0,
zeus::CVector3f{1.65f, 1.65f, 1.65f},
200.f, unk1, unk2, unk3, CMaterialList(EMaterialTypes::Player,
EMaterialTypes::Solid, EMaterialTypes::GroundCollider)));
x84c_player.reset(new CPlayer(
AllocateUniqueId(), zeus::CTransform(q), pBounds, 0, zeus::CVector3f{1.65f, 1.65f, 1.65f}, 200.f, unk1, unk2,
unk3, CMaterialList(EMaterialTypes::Player, EMaterialTypes::Solid, EMaterialTypes::GroundCollider)));
AddObject(*x84c_player);
}
@ -692,18 +601,11 @@ const CObjectList* CStateManager::GetObjectListById(EGameObjectList type) const
return lists[int(type)].get();
}
void CStateManager::RemoveObject(TUniqueId)
{
}
void CStateManager::RemoveObject(TUniqueId) {}
void CStateManager::RemoveActor(TUniqueId)
{
void CStateManager::RemoveActor(TUniqueId) {}
}
void CStateManager::UpdateRoomAcoustics(TAreaId)
{
}
void CStateManager::UpdateRoomAcoustics(TAreaId) {}
void CStateManager::SetCurrentAreaId(TAreaId aid)
{
@ -722,9 +624,7 @@ void CStateManager::SetCurrentAreaId(TAreaId aid)
x850_world->GetMapWorld()->RecalculateWorldSphere(*x8c0_mapWorldInfo, *x850_world);
}
void CStateManager::ClearGraveyard()
{
}
void CStateManager::ClearGraveyard() {}
void CStateManager::DeleteObjectRequest(TUniqueId id)
{
@ -749,63 +649,39 @@ void CStateManager::DeleteObjectRequest(TUniqueId id)
}
}
CEntity* CStateManager::ObjectById(TUniqueId uid)
{
return x80c_allObjs->GetObjectById(uid);
}
const CEntity* CStateManager::GetObjectById(TUniqueId uid) const
{
return x80c_allObjs->GetObjectById(uid);
}
CEntity* CStateManager::ObjectById(TUniqueId uid) { return x80c_allObjs->GetObjectById(uid); }
const CEntity* CStateManager::GetObjectById(TUniqueId uid) const { return x80c_allObjs->GetObjectById(uid); }
void CStateManager::AreaUnloaded(TAreaId)
void CStateManager::AreaUnloaded(TAreaId) {}
void CStateManager::PrepareAreaUnload(TAreaId) {}
void CStateManager::AreaLoaded(TAreaId) {}
void CStateManager::BuildNearList(rstl::reserved_vector<TUniqueId, 1024>& listOut, const zeus::CVector3f&,
const zeus::CVector3f&, float, const CMaterialFilter&, const CActor*) const
{
}
void CStateManager::PrepareAreaUnload(TAreaId)
void CStateManager::BuildColliderList(rstl::reserved_vector<TUniqueId, 1024>& listOut, const CActor&,
const zeus::CAABox&) const
{
}
void CStateManager::AreaLoaded(TAreaId)
{
}
void CStateManager::BuildNearList(rstl::reserved_vector<TUniqueId, 1024>& listOut,
const zeus::CVector3f&, const zeus::CVector3f&, float,
void CStateManager::BuildNearList(rstl::reserved_vector<TUniqueId, 1024>& listOut, const zeus::CAABox&,
const CMaterialFilter&, const CActor*) const
{
}
void CStateManager::BuildColliderList(rstl::reserved_vector<TUniqueId, 1024>& listOut,
const CActor&, const zeus::CAABox&) const
{
}
void CStateManager::UpdateActorInSortedLists(CActor&) {}
void CStateManager::BuildNearList(rstl::reserved_vector<TUniqueId, 1024>& listOut,
const zeus::CAABox&, const CMaterialFilter&, const CActor*) const
{
}
void CStateManager::UpdateSortedLists() {}
void CStateManager::UpdateActorInSortedLists(CActor&)
{
}
zeus::CAABox CStateManager::CalculateObjectBounds(const CActor&) { return {}; }
void CStateManager::UpdateSortedLists()
{
}
void CStateManager::AddObject(CEntity&) {}
zeus::CAABox CStateManager::CalculateObjectBounds(const CActor&)
{
return {};
}
void CStateManager::AddObject(CEntity&)
{
}
void CStateManager::AddObject(CEntity*)
{
}
void CStateManager::AddObject(CEntity*) {}
bool CStateManager::RayStaticIntersection(const zeus::CVector3f&, const zeus::CVector3f&, float,
const CMaterialFilter&) const
@ -813,20 +689,33 @@ bool CStateManager::RayStaticIntersection(const zeus::CVector3f&, const zeus::CV
return false;
}
bool CStateManager::RayWorldIntersection(TUniqueId, const zeus::CVector3f&, const zeus::CVector3f&,
float, const CMaterialFilter&,
bool CStateManager::RayWorldIntersection(TUniqueId, const zeus::CVector3f&, const zeus::CVector3f&, float,
const CMaterialFilter&,
const rstl::reserved_vector<TUniqueId, 1024>& list) const
{
return false;
}
void CStateManager::UpdateObjectInLists(CEntity&)
{
}
void CStateManager::UpdateObjectInLists(CEntity&) {}
TUniqueId CStateManager::AllocateUniqueId()
{
return 0;
const s16 lastIndex = x0_nextFreeIndex;
s16 ourIndex = 0;
do
{
ourIndex = x0_nextFreeIndex;
x0_nextFreeIndex = (x0_nextFreeIndex + 1) & 0x3ff;
if (ourIndex == lastIndex)
LogModule.report(logvisor::Fatal, "Object List Full!");
}
while (x80c_allObjs->GetObjectByIndex(ourIndex) != nullptr);
x8_idArr[ourIndex]++;
if (((ourIndex | ((x8_idArr[ourIndex]) << 10)) & 0xFFFF) == kInvalidUniqueId)
x8_idArr[0] = 0;
return ((ourIndex | ((x8_idArr[ourIndex]) << 10)) & 0xFFFF);
}
std::pair<u32, u32> CStateManager::CalculateScanCompletionRate() const
@ -837,8 +726,7 @@ std::pair<u32, u32> CStateManager::CalculateScanCompletionRate() const
for (const std::pair<u32, float>& scan : x8b8_playerState->GetScanTimes())
{
CSaveWorld::EScanCategory category = g_MemoryCardSys->GetScanStates()[idx++].second;
if (category != CSaveWorld::EScanCategory::None &&
category != CSaveWorld::EScanCategory::Research)
if (category != CSaveWorld::EScanCategory::None && category != CSaveWorld::EScanCategory::Research)
{
++denom;
if (scan.second == 1.f)
@ -848,4 +736,9 @@ std::pair<u32, u32> CStateManager::CalculateScanCompletionRate() const
return {num, denom};
}
bool CStateManager::ApplyDamage(TUniqueId, TUniqueId, TUniqueId, const CDamageInfo& info, const CMaterialFilter&,
const zeus::CVector3f&)
{
return false;
}
}

View File

@ -54,6 +54,7 @@ struct SScriptObjectStream
class CStateManager
{
s16 x0_nextFreeIndex = 0;
TUniqueId x8_idArr[1024] = {};
std::unique_ptr<CObjectList> x80c_allObjs;
@ -162,6 +163,7 @@ class CStateManager
TUniqueId xf6c_playerActor;
void UpdateThermalVisor();
TUniqueId xf74_lastTrigger = kInvalidUniqueId;
public:
/* TODO: Figure out what these are
* Public for CScriptRelay
@ -189,7 +191,7 @@ public:
void ResetEscapeSequenceTimer(float);
void SetupParticleHook(const CActor& actor) const;
void MurderScriptInstanceNames();
const std::string* HashInstanceName(CInputStream& in);
std::string HashInstanceName(CInputStream& in);
void SetActorAreaId(CActor& actor, TAreaId);
void TouchSky() const;
void TouchPlayerActor();
@ -236,6 +238,8 @@ public:
const CWeaponMode&);
bool ApplyDamage(TUniqueId, TUniqueId, TUniqueId, const CDamageInfo& info,
const CMaterialFilter&);
bool ApplyDamage(TUniqueId, TUniqueId, TUniqueId, const CDamageInfo& info,
const CMaterialFilter&, const zeus::CVector3f&);
void UpdateAreaSounds();
void FrameEnd();
void ProcessPlayerInput();
@ -306,6 +310,8 @@ public:
CAiWaypointList& GetAiWaypointObjectList() const { return *x83c_aiWaypointObjs; }
CPlatformAndDoorList& GetPlatformAndDoorObjectList() const { return *x844_platformAndDoorObjs; }
std::pair<u32, u32> CalculateScanCompletionRate() const;
void SetLastTrigger(TUniqueId uid) { xf74_lastTrigger = uid; }
TUniqueId GetLastTrigger() const { return xf74_lastTrigger; }
};
}

View File

@ -143,7 +143,7 @@ void CCameraManager::Update(float dt, CStateManager& stateMgr)
CGameCamera* CCameraManager::GetCurrentCamera(CStateManager& stateMgr) const
{
CObjectList* camList = stateMgr.ObjectListById(EGameObjectList::GameCamera);
return static_cast<CGameCamera*>(camList->GetObjectById(GetCurrentCameraId()));
return TCastToPtr<CGameCamera>(camList->GetObjectById(GetCurrentCameraId())).GetPtr();
}
const CGameCamera* CCameraManager::GetCurrentCamera(const CStateManager& stateMgr) const
@ -169,7 +169,7 @@ void CCameraManager::ThinkCameras(float dt, CStateManager& mgr)
for (CEntity* ent : gcList)
{
CGameCamera* gc = TCastToPtr<CGameCamera>(ent);
TCastToPtr<CGameCamera> gc(ent);
if (gc)
{
gc->Think(dt, mgr);
@ -221,7 +221,7 @@ void CCameraManager::ResetCameras(CStateManager& mgr)
for (CEntity* ent : mgr.GetCameraObjectList())
{
CGameCamera* camObj = static_cast<CGameCamera*>(ent);
TCastToPtr<CGameCamera> camObj(ent);
camObj->Reset(xf, mgr);
}
}

View File

@ -60,7 +60,7 @@ void CFirstPersonCamera::CalculateGunFollowOrientationAndTransform(zeus::CTransf
void CFirstPersonCamera::UpdateTransform(CStateManager& mgr, float dt)
{
CPlayer* player = static_cast<CPlayer*>(mgr.ObjectById(GetWatchedObject()));
TCastToPtr<CPlayer> player(mgr.ObjectById(GetWatchedObject()));
if (!player)
{
x34_transform = zeus::CTransform::Identity();
@ -108,13 +108,12 @@ void CFirstPersonCamera::UpdateTransform(CStateManager& mgr, float dt)
rVec = v;
}
}
else if (player->x304_ == 0 && player->x2f8_morphTransState == 0 && player->x3dc_ && x1c4_pitchId == kInvalidUniqueId)
else if (player->x304_ == 0 && player->GetMorphballTransitionState() == CPlayer::EPlayerMorphBallState::Unmorphed &&
player->x3dc_ && x1c4_pitchId == kInvalidUniqueId)
{
if (player->x294_ > 0.f)
{
float angle = zeus::clamp(0.f, (player->x294_ - g_tweakPlayer->GetX288()) /
g_tweakPlayer->GetX28c(),
1.f) *
float angle = zeus::clamp(0.f, (player->x294_ - g_tweakPlayer->GetX288()) / g_tweakPlayer->GetX28c(), 1.f) *
g_tweakPlayer->GetX290();
angle += x1c0_;
rVec.x = 0.f;
@ -125,9 +124,7 @@ void CFirstPersonCamera::UpdateTransform(CStateManager& mgr, float dt)
}
else if (player->x29c_ > 0.f)
{
float angle = zeus::clamp(0.f, (player->x29c_ - g_tweakPlayer->GetX294()) /
g_tweakPlayer->GetX298(),
1.f) *
float angle = zeus::clamp(0.f, (player->x29c_ - g_tweakPlayer->GetX294()) / g_tweakPlayer->GetX298(), 1.f) *
g_tweakPlayer->GetX29C();
rVec.x = 0.f;
rVec.y = std::cos(angle);
@ -174,8 +171,9 @@ void CFirstPersonCamera::UpdateTransform(CStateManager& mgr, float dt)
if (rVecCpy.canBeNormalized())
rVecCpy.normalize();
gunXf = zeus::CQuaternion::lookAt(rVecCpy, gunFrontVec, zeus::CRelAngle::FromDegrees(360.f)).toTransform() *
x190_gunFollowXf.getRotation();
gunXf =
zeus::CQuaternion::lookAt(rVecCpy, gunFrontVec, zeus::CRelAngle::FromDegrees(360.f)).toTransform() *
x190_gunFollowXf.getRotation();
gunFrontVec = gunXf.frontVector();
if (gunFrontVec.canBeNormalized())
@ -233,14 +231,13 @@ void CFirstPersonCamera::UpdateTransform(CStateManager& mgr, float dt)
}
zeus::CTransform bobXf = player->GetCameraBob()->GetCameraBobTransformation();
if (player->x2f8_morphTransState == 1 || player->x304_ == 5 || player->x3b8_ == 0 || mgr.x904_ == 1 ||
mgr.GetCameraManager()->IsInCinematicCamera())
if (player->GetMorphballTransitionState() == CPlayer::EPlayerMorphBallState::Morphed || player->x304_ == 5 ||
player->x3b8_ == 0 || mgr.x904_ == 1 || mgr.GetCameraManager()->IsInCinematicCamera())
{
bobXf = zeus::CTransform::Identity();
player->GetCameraBob()->SetCameraBobTransform(bobXf);
}
x190_gunFollowXf = qGun.toTransform() * gunXf;
x34_transform = x190_gunFollowXf * bobXf.getRotation();

View File

@ -35,7 +35,7 @@ class CIkChain
public:
CIkChain() = default;
bool GetActive() const;
bool GetActive() const { return x44_24_activated; }
void Update(float);
void Deactivate();
void Activate(const CAnimData&, const CSegId&, const zeus::CTransform&);

View File

@ -98,7 +98,7 @@ bool CParticleGenInfoGeneric::HasLight() const
TUniqueId CParticleGenInfoGeneric::GetLightId() const
{
return 0;
return kInvalidUniqueId;
}
void CParticleGenInfoGeneric::SetModulationColor(const zeus::CColor& color)

View File

@ -37,6 +37,9 @@ CENTITY_TYPES = (
('CScriptActorKeyframe', 'World/CScriptActorKeyframe.hpp'),
('CScriptTrigger', 'World/CScriptTrigger.hpp'),
('CScriptSound', 'World/CScriptSound.hpp'),
('CWeapon', 'Weapon/CWeapon.hpp'),
('CGameProjectile', 'Weapon/CGameProjectile.hpp'),
('CBeamProjectile', 'Weapon/CBeamProjectile.hpp'),
('CPlasmaProjectile', 'Weapon/CPlasmaProjectile.hpp'),
('CScriptCounter', 'World/CScriptCounter.hpp'),
('CScriptBeam', 'World/CScriptBeam.hpp'),

View File

@ -36,9 +36,6 @@ struct SObjectTag
}
};
using TUniqueId = s16;
using TAreaId = s32;
struct TEditorId
{
TEditorId() = default;
@ -46,13 +43,16 @@ struct TEditorId
u32 id = -1;
u8 LayerNum() const { return (id >> 26) & 0x3f; }
u16 AreaNum() const { return (id >> 16) & 0x3ff; }
TUniqueId Id() const { return id & 0xffff; }
u16 Id() const { return id & 0xffff; }
bool operator<(const TEditorId& other) const { return (id & 0x3ffffff) < (other.id & 0x3ffffff); }
bool operator!=(const TEditorId& other) const { return (id & 0x3ffffff) != (other.id & 0x3ffffff); }
bool operator==(const TEditorId& other) const { return (id & 0x3ffffff) == (other.id & 0x3ffffff); }
};
using TUniqueId = s16;
using TAreaId = s32;
#define kInvalidEditorId TEditorId()
#define kInvalidUniqueId TUniqueId(-1)
#define kInvalidAreaId TAreaId(-1)
@ -107,7 +107,7 @@ public:
if (this->empty())
return {};
return {::GetAverage<T>(this->data(), this->size()) };
return {::GetAverage<T>(this->data(), this->size())};
}
void Clear() { this->clear(); }

View File

@ -1,4 +1,5 @@
#include "Weapon/CBeamProjectile.hpp"
#include "TCastTo.hpp"
namespace urde
{
@ -35,4 +36,10 @@ void CBeamProjectile::UpdateFX(const zeus::CTransform &, float, CStateManager &)
{
}
void CBeamProjectile::Accept(urde::IVisitor& visitor)
{
visitor.Visit(this);
}
}

View File

@ -10,6 +10,7 @@ public:
CBeamProjectile(const TToken<CWeaponDescription>&, const std::string&, EWeaponType, const zeus::CTransform&, int,
float, float, EMaterialTypes, const CDamageInfo&, TUniqueId, TAreaId, TUniqueId, u32, bool);
virtual void Accept(IVisitor &visitor);
float GetMaxRadius() const;
zeus::CVector3f GetSurfaceNormal() const;
void GetDamageType() const;

View File

@ -1,4 +1,5 @@
#include "Weapon/CGameProjectile.hpp"
#include "TCastTo.hpp"
namespace urde
{
@ -7,7 +8,7 @@ CGameProjectile::CGameProjectile(bool active, const TToken<CWeaponDescription>&,
const CDamageInfo& dInfo, TUniqueId owner, TAreaId aid, TUniqueId uid, TUniqueId,
u32 w1, bool b2, const zeus::CVector3f&,
const rstl::optional_object<TLockedToken<CGenDescription>>&, s16, bool b3)
: CWeapon(owner, aid, uid, active, wType, name, xf,
: CWeapon(owner, aid, active, uid, wType, name, xf,
CMaterialFilter::MakeIncludeExclude(
{EMaterialTypes::NonSolidDamageable, matType},
{EMaterialTypes::Projectile, EMaterialTypes::ProjectilePassthrough, matType, EMaterialTypes::Solid}),
@ -28,4 +29,10 @@ CWeapon::EProjectileAttrib CGameProjectile::GetBeamAttribType(EWeaponType wType)
return EProjectileAttrib::None;
}
void CGameProjectile::Accept(urde::IVisitor& visitor)
{
visitor.Visit(this);
}
}

View File

@ -19,6 +19,7 @@ public:
EMaterialTypes, const CDamageInfo&, TUniqueId, TAreaId, TUniqueId, TUniqueId, u32, bool,
const zeus::CVector3f&, const rstl::optional_object<TLockedToken<CGenDescription>>&, s16, bool);
virtual void Accept(IVisitor &visitor);
static EProjectileAttrib GetBeamAttribType(EWeaponType wType);
};
}

View File

@ -1,5 +1,6 @@
#include "CWeapon.hpp"
#include "World/CActorParameters.hpp"
#include "TCastTo.hpp"
namespace urde
{
@ -11,4 +12,10 @@ CWeapon::CWeapon(TUniqueId uid, TAreaId aid, bool active, TUniqueId, EWeaponType
CActorParameters::None(), kInvalidUniqueId)
{
}
void CWeapon::Accept(urde::IVisitor& visitor)
{
visitor.Visit(this);
}
}

View File

@ -16,16 +16,21 @@ public:
Ice = (1 << 3),
Wave = (1 << 4),
Plasma = (1 << 5),
Phazon = (1 << 6)
Phazon = (1 << 6),
Unknown1 = (1 << 7),
Bombs = (1 << 8),
PowerBombs = (1 << 9),
};
private:
EProjectileAttrib xe8_projectileAttribs;
public:
CWeapon(TUniqueId, TAreaId, bool, TUniqueId, EWeaponType, const std::string&, const zeus::CTransform&,
const CMaterialFilter&, const CMaterialList&, const CDamageInfo&, EProjectileAttrib, CModelData&&);
virtual void Accept(IVisitor &visitor);
bool HasAttrib(EProjectileAttrib) const;
EProjectileAttrib GetAttribField() const;
EProjectileAttrib GetAttribField() const { return xe8_projectileAttribs; }
const CMaterialFilter& GetFilter() const;
void SetFilter(const CMaterialFilter&);
TUniqueId GetOwnerId() const;

View File

@ -2,8 +2,11 @@
namespace urde
{
CWeaponMode::CWeaponMode(EWeaponType type, bool, bool)
CWeaponMode::CWeaponMode(EWeaponType type, bool b1, bool b2, bool b3)
: x0_weaponType(type)
, x4_24_(b1)
, x4_25_(b2)
, x4_26_instantKill(b3)
{
}
@ -14,42 +17,42 @@ EWeaponType CWeaponMode::GetType() const
CWeaponMode CWeaponMode::Invalid()
{
return CWeaponMode(EWeaponType::None, false, false);
return CWeaponMode(EWeaponType::None);
}
CWeaponMode CWeaponMode::Phazon()
{
return CWeaponMode(EWeaponType::Phazon, false, false);
return CWeaponMode(EWeaponType::Phazon);
}
CWeaponMode CWeaponMode::Plasma()
{
return CWeaponMode(EWeaponType::Plasma, false, false);
return CWeaponMode(EWeaponType::Plasma);
}
CWeaponMode CWeaponMode::Wave()
{
return CWeaponMode(EWeaponType::Wave, false, false);
return CWeaponMode(EWeaponType::Wave);
}
CWeaponMode CWeaponMode::BoostBall()
{
return CWeaponMode(EWeaponType::BoostBall, false, false);
return CWeaponMode(EWeaponType::BoostBall);
}
CWeaponMode CWeaponMode::Ice()
{
return CWeaponMode(EWeaponType::Ice, false, false);
return CWeaponMode(EWeaponType::Ice);
}
CWeaponMode CWeaponMode::Power()
{
return CWeaponMode(EWeaponType::Power, false, false);
return CWeaponMode(EWeaponType::Power);
}
CWeaponMode CWeaponMode::Bomb()
{
return CWeaponMode(EWeaponType::Bomb, false, false);
return CWeaponMode(EWeaponType::Bomb);
}
}

View File

@ -20,7 +20,7 @@ class CWeaponMode
};
public:
CWeaponMode() = default;
CWeaponMode(EWeaponType, bool = false, bool = false);
CWeaponMode(EWeaponType, bool = false, bool = false, bool instaKill = false);
EWeaponType GetType() const;

View File

@ -28,7 +28,14 @@ public:
x10_radius = in.readFloatBig();
x14_knockback = in.readFloatBig();
}
CDamageInfo(const CWeaponMode&, float damage, float radius, float knockback);
CDamageInfo(const CWeaponMode& mode, float damage, float radius, float knockback)
: x0_weaponMode(mode)
, x8_damage(damage)
, xc_radiusDamage(damage)
, x10_radius(radius)
, x14_knockback(knockback)
{}
CDamageInfo(const CDamageInfo& other) = default;
const CWeaponMode& GetWeaponMode() const { return x0_weaponMode; }

View File

@ -2,6 +2,7 @@
#define __URDE_CDAMAGEVULNERABILITY_HPP__
#include "RetroTypes.hpp"
#include "Weapon/CWeaponMode.hpp"
namespace urde
{
@ -106,6 +107,8 @@ public:
else
ConstructNew(in, propCount);
}
bool WeaponHurts(const CWeaponMode&, u32) const { return false; }
};
}

View File

@ -799,9 +799,7 @@ void CGameArea::PostConstructArea()
++secIt;
}
x12c_postConstructed->x10c0_areaObjs.reset(new CObjectList(EGameObjectList::Invalid));
x12c_postConstructed->x10c0_areaObjs->m_areaIdx = x4_selfIdx;
x12c_postConstructed->x10c0_areaObjs.reset(new CAreaObjectList(x4_selfIdx));
x12c_postConstructed->x10c4_areaFog.reset(new CAreaFog());
xf0_24_postConstructed = true;
@ -920,4 +918,9 @@ void CGameArea::SetAreaAttributes(const CScriptAreaAttributes* areaAttributes)
x12c_postConstructed->x1128_worldLightingLevel = areaAttributes->GetWorldLightingLevel();
}
bool CGameArea::CAreaObjectList::IsQualified(const CEntity& ent)
{
return (ent.GetAreaId() == x200c_areaIdx);
}
}

View File

@ -122,6 +122,21 @@ class CGameArea : public IGameArea
std::list<std::shared_ptr<ProjectResourceFactoryBase::AsyncTask>> xf8_loadTransactions;
public:
class CAreaObjectList : public CObjectList
{
private:
TAreaId x200c_areaIdx = 0;
public:
CAreaObjectList(TAreaId areaIdx)
: CObjectList(EGameObjectList::Invalid)
, x200c_areaIdx(areaIdx)
{
}
bool IsQualified(const CEntity& ent);
};
enum class EOcclusionState
{
NotOccluded,
@ -170,7 +185,7 @@ public:
TLockedToken<CPFArea> x10ac_path;
// bool x10b8_ = 0; optional flag for CToken
u32 x10bc_ = 0;
std::unique_ptr<CObjectList> x10c0_areaObjs;
std::unique_ptr<CAreaObjectList> x10c0_areaObjs;
std::unique_ptr<CAreaFog> x10c4_areaFog;
std::unique_ptr<u8[]> x10c8_sclyBuf;
u32 x10d0_sclySize = 0;
@ -242,12 +257,6 @@ private:
public:
struct CAreaObjectList : public IAreaObjectList
{
bool IsQualified(const CEntity& ent);
};
CGameArea(CInputStream& in, int idx, int mlvlVersion);
bool IsFinishedOccluding() const;

View File

@ -66,6 +66,7 @@ set(WORLD_SOURCES
CScriptSwitch.hpp CScriptSwitch.cpp
CScriptAiJumpPoint.hpp CScriptAiJumpPoint.cpp
CScriptColorModulate.hpp CScriptColorModulate.cpp
CScriptStreamedMusic.hpp CScriptStreamedMusic.cpp
CRepulsor.hpp CRepulsor.cpp
CScriptCameraPitchVolume.hpp CScriptCameraPitchVolume.cpp
CScriptCameraHintTrigger.hpp CScriptCameraHintTrigger.cpp

View File

@ -32,9 +32,9 @@ void CPlayer::Update(float, CStateManager& mgr) {}
bool CPlayer::IsPlayerDeadEnough() const
{
if (x2f8_morphTransState == 0)
if (x2f8_morphTransState == CPlayer::EPlayerMorphBallState::Unmorphed)
return x9f4_ < 2.5f;
else if (x2f8_morphTransState == 1)
else if (x2f8_morphTransState == CPlayer::EPlayerMorphBallState::Morphed)
return x9f4_ < 6.f;
return false;
@ -75,7 +75,7 @@ void CPlayer::Accept(IVisitor& visitor)
visitor.Visit(this);
}
CHealthInfo* CPlayer::HealthInfo(CStateManager& mgr) { return nullptr; }
CHealthInfo* CPlayer::HealthInfo(CStateManager& mgr) { return &mgr.GetPlayerState()->HealthInfo(); }
bool CPlayer::IsUnderBetaMetroidAttack(CStateManager& mgr) const { return false; }
@ -166,7 +166,7 @@ void CPlayer::DrawGun(CStateManager& mgr) {}
void CPlayer::HolsterGun(CStateManager& mgr) {}
bool CPlayer::GetMorphballTransitionState() const { return false; }
CPlayer::EPlayerMorphBallState CPlayer::GetMorphballTransitionState() const { return x2f8_morphTransState; }
void CPlayer::UpdateGrappleArmTransform(const zeus::CVector3f&, CStateManager& mgr, float) {}
@ -365,4 +365,21 @@ void CPlayer::CVisorSteam::Update(float dt)
}
void CPlayer::SetSpawnedMorphBallState(CPlayer::EPlayerMorphBallState, CStateManager&) {}
void CPlayer::DecrementPhazon()
{
if (xa10_ == 0)
return;
xa10_--;
}
void CPlayer::IncrementPhazon()
{
if (xa10_ != 0)
xa10_++;
else
xa14_ = 0.f;
}
}

View File

@ -50,7 +50,7 @@ public:
Unmorphed,
Morphed,
Morphing,
UnMorphing
Unmorphing
};
private:
@ -98,7 +98,7 @@ private:
zeus::CAABox x2d8_;
float x2f0_ = 0.f;
u32 x2f4_cameraState = 0;
u32 x2f8_morphTransState = 0;
EPlayerMorphBallState x2f8_morphTransState = EPlayerMorphBallState::Unmorphed;
u32 x2fc_ = 0;
float x300_ = 0.f;
u32 x304_ = 0;
@ -185,9 +185,12 @@ private:
float x79c_;
CVisorSteam x7a0_ = CVisorSteam(0.f, 0.f, 0.f, -1);
float x9f4_;
TUniqueId xa00_;
float xa04_;
ResId xa08_steamTextureId;
ResId xa0c_;
u32 xa10_;
float xa14_;
public:
CPlayer(TUniqueId, const zeus::CTransform&, const zeus::CAABox&, unsigned int, const zeus::CVector3f&, float, float,
@ -248,7 +251,7 @@ public:
void UpdateGunTransform(const zeus::CVector3f&, float, CStateManager& mgr, bool);
void DrawGun(CStateManager& mgr);
void HolsterGun(CStateManager& mgr);
bool GetMorphballTransitionState() const;
CPlayer::EPlayerMorphBallState GetMorphballTransitionState() const;
void UpdateGrappleArmTransform(const zeus::CVector3f&, CStateManager& mgr, float);
void ApplyGrappleForces(const CFinalInput& input, CStateManager& mgr, float);
bool ValidateFPPosition(const zeus::CVector3f& pos, CStateManager& mgr);
@ -318,6 +321,9 @@ public:
void Touch();
const std::unique_ptr<CPlayerCameraBob>& GetCameraBob() const { return x76c_cameraBob; }
void DecrementPhazon();
void IncrementPhazon();
};
}

View File

@ -50,7 +50,18 @@ void CPlayerCameraBob::SetPlayerVelocity(const zeus::CVector3f& velocity)
x68_ = zeus::min(x68_, velocity.z);
}
void CPlayerCameraBob::SetBobMagnitude(float magnitude) { x10_bobMagnitude = zeus::clamp(0.f, magnitude, 1.f); }
void CPlayerCameraBob::SetBobMagnitude(float magnitude)
{
#if 0
/* Retro Original (This is why underpaid (re: unpaid) interns make crappy programmers) */
x10_bobMagnitude = magnitude;
x10_bobMagnitude = std::max(0.f, x10_bobMagnitude);
x10_bobMagnitude = std::max(1.f, x10_bobMagnitude);
#else
/* Should fix lightshow */
x10_bobMagnitude = zeus::clamp(0.f, magnitude, 1.f);
#endif
}
void CPlayerCameraBob::SetBobTimeScale(float ts) { x18_bobTimeScale = zeus::clamp(0.f, ts, 1.f); }

View File

@ -27,7 +27,7 @@ void CScriptBeam::Accept(IVisitor& visitor)
void CScriptBeam::Think(float dt, CStateManager& mgr)
{
#if 0
CPlasmaProjectile* proj = static_cast<CPlasmaProjectile*>(mgr.GetObjectById(x154_projectileId));
TCastToPtr<CGameProjectile> proj{mgr.GetObjectById(x154_projectileId)};
if (proj)
{
if (proj->GetActive())

View File

@ -42,7 +42,7 @@ rstl::optional_object<zeus::CAABox> CScriptCameraPitchVolume::GetTouchBounds() c
void CScriptCameraPitchVolume::Touch(CActor& act, CStateManager& mgr)
{
CPlayer* pl = TCastToPtr<CPlayer>(act);
TCastToPtr<CPlayer> pl(act);
if (!pl)
return;

View File

@ -74,7 +74,7 @@ void CScriptDock::Think(float dt, CStateManager& mgr)
CObjectList& objs = mgr.WorldNC()->GetArea(aid)->GetAreaObjects();
for (CEntity* ent : objs)
{
CScriptDock* dock = static_cast<CScriptDock*>(ent);
TCastToPtr<CScriptDock> dock(ent);
if (dock && dock->GetDockId() == otherDock)
dock->SetLoadConnected(mgr, true);
}
@ -129,7 +129,7 @@ void CScriptDock::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStat
CPlatformAndDoorList& lst = mgr.GetPlatformAndDoorObjectList();
for (CEntity* ent : lst)
{
CScriptDoor* door = static_cast<CScriptDoor*>(ent);
TCastToPtr<CScriptDoor> door(ent);
if (door && !door->IsConnectedToArea(mgr, aid))
door->ForceClosed(mgr);
}
@ -176,7 +176,7 @@ void CScriptDock::Touch(CActor& act, CStateManager&)
if (x264_dockState == EDockState::Three)
return;
if (static_cast<CPlayer*>(&act) != nullptr)
if (TCastToPtr<CPlayer>(act))
x264_dockState = EDockState::PlayerTouched;
}

View File

@ -29,7 +29,7 @@ void CScriptDockAreaChange::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId
for (auto it = search.first ; it != search.second ; ++it)
{
TUniqueId id = it->second;
CScriptDock* dock = TCastToPtr<CScriptDock>(stateMgr.ObjectById(id));
TCastToPtr<CScriptDock> dock(stateMgr.ObjectById(id));
if (dock)
dock->SetDockReference(stateMgr, x34_dockReference);
}

View File

@ -4,23 +4,27 @@
#include "Collision/CMaterialList.hpp"
#include "CStateManager.hpp"
#include "TCastTo.hpp"
#include "World/CPlayer.hpp"
#include "Weapon/CGameProjectile.hpp"
#include "Weapon/CWeapon.hpp"
#include "CPlayerState.hpp"
namespace urde
{
CScriptTrigger::CScriptTrigger(TUniqueId uid, const std::string& name, const CEntityInfo& info,
const zeus::CVector3f& pos, const zeus::CAABox& bounds,
const CDamageInfo& dInfo, const zeus::CVector3f& forceField,
ETriggerFlags triggerFlags, bool active, bool b2, bool b3)
const zeus::CVector3f& pos, const zeus::CAABox& bounds, const CDamageInfo& dInfo,
const zeus::CVector3f& forceField, ETriggerFlags triggerFlags, bool active, bool b2,
bool b3)
: CActor(uid, active, name, info, zeus::CTransform::Translate(pos), CModelData::CModelDataNull(),
CMaterialList(EMaterialTypes::Trigger), CActorParameters::None(), kInvalidUniqueId),
x100_damageInfo(dInfo),
x11c_forceField(forceField),
x128_forceMagnitude(forceField.magnitude()),
x12c_flags(triggerFlags),
x130_bounds(bounds),
x148_26_(b2),
x148_27_(b3)
CMaterialList(EMaterialTypes::Trigger), CActorParameters::None(), kInvalidUniqueId)
, x100_damageInfo(dInfo)
, x11c_forceField(forceField)
, x128_forceMagnitude(forceField.magnitude())
, x12c_flags(triggerFlags)
, x130_bounds(bounds)
, x148_26_deactivateOnEntered(b2)
, x148_27_deactivateOnExited(b3)
{
}
@ -29,23 +33,180 @@ void CScriptTrigger::Accept(IVisitor& visitor)
visitor.Visit(this);
}
CScriptTrigger::CObjectTracker* CScriptTrigger::FindInhabitant(TUniqueId id)
void CScriptTrigger::Think(float dt, CStateManager& mgr)
{
const auto& iter = std::find(xe8_inhabitants.begin(), xe8_inhabitants.end(), id);
if (GetActive())
UpdateInhabitants(dt, mgr);
}
if (iter != xe8_inhabitants.end())
void CScriptTrigger::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr)
{
if (GetActive() && (msg == EScriptObjectMessage::Deactivate || msg == EScriptObjectMessage::InternalMessage12))
{
if (msg == EScriptObjectMessage::Deactivate)
{
xe8_inhabitants.clear();
x148_25_ = false;
}
if (x148_28_)
{
x148_28_ = false;
if (x148_29_didPhazonDamage)
{
mgr.Player()->DecrementPhazon();
x148_29_didPhazonDamage = false;
}
if (x8_uid == mgr.GetLastTrigger())
mgr.SetLastTrigger(kInvalidUniqueId);
}
}
CEntity::AcceptScriptMsg(msg, uid, mgr);
;
}
CScriptTrigger::CObjectTracker* CScriptTrigger::FindObject(TUniqueId id)
{
auto& inhabitants = GetInhabitants();
const auto& iter = std::find(inhabitants.begin(), inhabitants.end(), id);
if (iter != inhabitants.end())
return &(*iter);
return nullptr;
}
void CScriptTrigger::UpdateInhabitants(CStateManager& mgr)
void CScriptTrigger::UpdateInhabitants(float dt, CStateManager& mgr)
{
#if 0
for (auto it = xe8_inhabitants.begin(); it != xe8_inhabitants.end();)
{
TCastToPtr<CActor> act(mgr.ObjectById((*it).GetObjectId()));
if (act->GetUniqueId() == mgr.Player()->GetUniqueId())
{
TCastToPtr<CPlayer> pl(act);
if (bool(x12c_flags & ETriggerFlags::DetectPlayer))
{
using EPlayerMorphBallState = CPlayer::EPlayerMorphBallState;
EPlayerMorphBallState mState = pl->GetMorphballTransitionState();
if ((mState == EPlayerMorphBallState::Morphed &&
bool(x12c_flags & ETriggerFlags::DetectMorphedPlayer)) ||
(mState == EPlayerMorphBallState::Unmorphed &&
bool(x12c_flags & ETriggerFlags::DetectUnmorphedPlayer)))
{
it = xe8_inhabitants.erase(it);
if (x148_28_)
{
x148_28_ = false;
if (x148_29_didPhazonDamage)
{
mgr.Player()->DecrementPhazon();
x148_29_didPhazonDamage = false;
}
if (mgr.GetLastTrigger() == GetUniqueId())
mgr.SetLastTrigger(kInvalidUniqueId);
}
InhabitantExited(*act, mgr);
continue;
}
}
const auto& touchBounds = GetTouchBounds();
const auto& actTouchBounds = act->GetTouchBounds();
if (touchBounds && actTouchBounds)
{
if (actTouchBounds->intersects(*touchBounds))
{
inhabitantExited = true;
InhabitantIdle(*act, mgr);
if (act->HealthInfo() && x100_damageInfo.GetDamage() > 0.f)
mgr.ApplyDamage(GetUniqueId(), act->GetUniqueId(), GetUniqueId(), x100_damageInfo, CMaterialFilter::MakeIncludeExclude({EMaterialTypes::Solid}, {0ull}));
TCastToPtr<CPhysicsActor> physAct{act};
if (physAct)
{
float forceMult = 1.f;
if (bool(x12c_flags & ETriggerFlags::UseBooleanIntersection))
forceMult = touchBounds->booleanIntersection(*actTouchBounds).volume() / actTouchBounds->volume();
zeus::CVector3f force = forceMult * x11c_forceField;
if (bool(x12c_flags & ETriggerFlags::UseCollisionImpulses))
{
physAct->ApplyImpulseWR(force, zeus::CAxisAngle::sIdentity);
physAct->UseCollisionImpulses();
}
else
physAct->ApplyForceWR(force, zeus::CAxisAngle::sIdentity);
}
}
}
else
{
it = xe8_inhabitants.erase(it);
if (mgr.Player()->GetUniqueId() == (*it).GetObjectId())
{
if (x148_28_)
{
x148_28_ = false;
if (x148_29_didPhazonDamage)
{
mgr.Player()->DecrementPhazon();
x148_29_didPhazonDamage = false;
}
}
}
if (mgr.GetLastTrigger() == GetUniqueId())
mgr.SetLastTrigger(kInvalidUniqueId);
InhabitantExited(*act, mgr);
continue;
}
}
else
{
it = xe8_inhabitants.erase(it);
if (mgr.Player()->GetUniqueId() == (*it).GetObjectId())
{
if (x148_28_)
{
x148_28_ = false;
if (x148_29_didPhazonDamage)
{
mgr.Player()->DecrementPhazon();
x148_29_didPhazonDamage = false;
}
}
}
if (mgr.GetLastTrigger() == GetUniqueId())
mgr.SetLastTrigger(kInvalidUniqueId);
}
}
if (bool(x12c_flags & ETriggerFlags::DetectPlayerIfInside) && x148_24_playerInside && !inhabitantExited)
{
SendScriptMsgs(EScriptObjectState::Inside, mgr, EScriptObjectMessage::None);
return;
}
if (!player)
{
SendScriptMsgs(EScriptObjectState::Exited, mgr, EScriptObjectMessage::None);
if (x148_27_deactivateOnExited)
{
mgr.SendScriptMsg(GetUniqueId(), mgr.GetEditorIdForUniqueId(GetUniqueId()), EScriptObjectMessage::Deactivate,
EScriptObjectState::Exited);
}
}
#endif
}
const std::list<CScriptTrigger::CObjectTracker>&CScriptTrigger::GetInhabitants() const
{
return xe8_inhabitants;
}
std::list<CScriptTrigger::CObjectTracker>& CScriptTrigger::GetInhabitants() { return xe8_inhabitants; }
rstl::optional_object<zeus::CAABox> CScriptTrigger::GetTouchBounds() const
{
@ -53,10 +214,108 @@ rstl::optional_object<zeus::CAABox> CScriptTrigger::GetTouchBounds() const
return {GetTriggerBoundsWR()};
return {};
}
static const CWeaponMode sktonOHurtWeaponMode = CWeaponMode(EWeaponType::Power, false, false, true);
void CScriptTrigger::Touch(CActor& act, CStateManager& mgr)
{
if (!act.GetActive() || act.GetMaterialList().HasMaterial(EMaterialTypes::Trigger))
return;
if (FindObject(act.GetUniqueId()) == nullptr)
{
ETriggerFlags testFlags = ETriggerFlags::None;
TCastToPtr<CPlayer> pl(act);
if (pl)
{
if (x128_forceMagnitude > 0.f && (x12c_flags & ETriggerFlags::DetectPlayer) != ETriggerFlags::None &&
mgr.GetLastTrigger() == kInvalidUniqueId)
mgr.SetLastTrigger(x8_uid);
testFlags |= ETriggerFlags::DetectPlayer;
if (pl->GetMorphballTransitionState() == CPlayer::EPlayerMorphBallState::Unmorphed)
testFlags |= ETriggerFlags::DetectUnmorphedPlayer;
else if (pl->GetMorphballTransitionState() == CPlayer::EPlayerMorphBallState::Morphed)
testFlags |= ETriggerFlags::DetectMorphedPlayer;
}
else if (TCastToPtr<CAi>(act))
{
testFlags |= ETriggerFlags::DetectAI;
}
else if (TCastToPtr<CGameProjectile>(act))
{
testFlags |= ETriggerFlags::DetectProjectiles1 | ETriggerFlags::DetectProjectiles2 |
ETriggerFlags::DetectProjectiles3 | ETriggerFlags::DetectProjectiles4 |
ETriggerFlags::DetectProjectiles5 | ETriggerFlags::DetectProjectiles6 |
ETriggerFlags::DetectProjectiles7;
}
else if (CWeapon* weap = TCastToPtr<CWeapon>(act))
{
if ((weap->GetAttribField() & CWeapon::EProjectileAttrib::Bombs) != CWeapon::EProjectileAttrib::None)
testFlags |= ETriggerFlags::DetectBombs;
else if ((weap->GetAttribField() & CWeapon::EProjectileAttrib::PowerBombs) !=
CWeapon::EProjectileAttrib::None)
testFlags |= ETriggerFlags::DetectPowerBombs;
}
if ((testFlags & x12c_flags) != ETriggerFlags::None)
{
xe8_inhabitants.push_back(act.GetUniqueId());
InhabitantAdded(act, mgr);
if (pl)
{
if (x148_28_ == false)
{
x148_28_ = true;
if (x148_29_didPhazonDamage)
{
mgr.Player()->DecrementPhazon();
x148_29_didPhazonDamage = false;
}
else if (x100_damageInfo.GetDamage() > 0.f)
{
const CDamageVulnerability* dVuln = mgr.Player()->GetDamageVulnerability();
if (dVuln->WeaponHurts(x100_damageInfo.GetWeaponMode(), 0) &&
x100_damageInfo.GetWeaponMode().GetType() == EWeaponType::Phazon &&
!mgr.GetPlayerState()->HasPowerUp(CPlayerState::EItemType::PhazonSuit))
{
pl->IncrementPhazon();
x148_29_didPhazonDamage = true;
}
}
}
}
SendScriptMsgs(EScriptObjectState::Entered, mgr, EScriptObjectMessage::None);
if (x148_26_deactivateOnEntered)
{
mgr.SendScriptMsg(x8_uid, mgr.GetEditorIdForUniqueId(x8_uid), EScriptObjectMessage::Deactivate,
EScriptObjectState::Entered);
if (act.HealthInfo() && x100_damageInfo.GetDamage() > 0.f)
{
mgr.ApplyDamage(x8_uid, act.GetUniqueId(), x8_uid, x100_damageInfo,
CMaterialFilter::MakeIncludeExclude({EMaterialTypes::Solid}, {0ull}),
zeus::CVector3f::skZero);
}
}
if ((x12c_flags & ETriggerFlags::KillOnEnter) != ETriggerFlags::None && act.HealthInfo())
{
CHealthInfo* hInfo = act.HealthInfo();
mgr.ApplyDamage(
x8_uid, act.GetUniqueId(), x8_uid, {sktonOHurtWeaponMode, 10.f * hInfo->GetHP(), 0.f, 0.f},
CMaterialFilter::MakeIncludeExclude({EMaterialTypes::Solid}, {0ull}), zeus::CVector3f::skZero);
}
}
else
InhabitantRejected(act, mgr);
}
}
zeus::CAABox CScriptTrigger::GetTriggerBoundsWR() const
{
return {x130_bounds.min + x34_transform.origin, x130_bounds.max + x34_transform.origin};
}
}

View File

@ -10,6 +10,7 @@ namespace urde
// TODO - Phil: Figure out what each of the DetectProjectiles actually mean
enum class ETriggerFlags : u32
{
None = 0,
DetectPlayer = (1 << 0),
DetectAI = (1 << 1),
DetectProjectiles1 = (1 << 2),
@ -17,19 +18,19 @@ enum class ETriggerFlags : u32
DetectProjectiles3 = (1 << 4),
DetectProjectiles4 = (1 << 5),
DetectBombs = (1 << 6),
Unknown1 = (1 << 7),
DetectPowerBombs = (1 << 7),
DetectProjectiles5 = (1 << 8),
DetectProjectiles6 = (1 << 9),
DetectProjectiles7 = (1 << 10),
KillOnEnter = (1 << 11),
DetectMorphedPlayer = (1 << 12),
ApplyForce = (1 << 13),
UseCollisionImpulses = (1 << 13),
DetectPlayerIfInside = (1 << 14),
Unknown2 = (1 << 15),
UseBooleanIntersection = (1 << 15),
DetectUnmorphedPlayer = (1 << 16),
BlockEnvironmentalEffects = (1 << 17)
};
ENABLE_BITWISE_ENUM(ETriggerFlags)
ENABLE_BITWISE_ENUM(ETriggerFlags);
class CScriptTrigger : public CActor
{
@ -42,7 +43,7 @@ public:
CObjectTracker(TUniqueId id) : x0_id(id) {}
TUniqueId GetObjectId() const { return x0_id; }
bool operator==(const CObjectTracker& other) { return x0_id == other.x0_id; }
bool operator==(const CObjectTracker& other) const { return x0_id == other.x0_id; }
};
protected:
@ -56,12 +57,12 @@ protected:
union {
struct
{
bool x148_24_ : 1;
bool x148_24_playerInside : 1;
bool x148_25_ : 1;
bool x148_26_ : 1;
bool x148_27_ : 1;
bool x148_26_deactivateOnEntered : 1;
bool x148_27_deactivateOnExited : 1;
bool x148_28_ : 1;
bool x148_29_ : 1;
bool x148_29_didPhazonDamage : 1;
};
u8 dummy = 0;
};
@ -72,14 +73,17 @@ public:
ETriggerFlags triggerFlags, bool, bool, bool);
void Accept(IVisitor& visitor);
void Think(float, CStateManager &);
void AcceptScriptMsg(EScriptObjectMessage, TUniqueId, CStateManager &);
virtual void InhabitantRejected(CActor&, CStateManager&) {}
virtual void InhabitantExited(CActor&, CStateManager&) {}
virtual void InhabitantIdle(CActor&, CStateManager&) {}
virtual void InhabitantAdded(CActor&, CStateManager&) {}
CObjectTracker* FindInhabitant(TUniqueId);
void UpdateInhabitants(CStateManager&);
const std::list<CObjectTracker>& GetInhabitants() const;
CObjectTracker* FindObject(TUniqueId);
void UpdateInhabitants(float, CStateManager&);
std::list<CObjectTracker>& GetInhabitants();
rstl::optional_object<zeus::CAABox> GetTouchBounds() const;
void Touch(CActor &, CStateManager &);
zeus::CAABox GetTriggerBoundsWR() const;
};
}

View File

@ -42,11 +42,6 @@ public:
void SetReferenceCount(s32 v) { x0_referenceCount = v; x48_isReferenced = true; }
};
struct IAreaObjectList
{
virtual bool IsQualified(const CEntity& ent)=0;
};
virtual bool IGetScriptingMemoryAlways() const=0;
virtual TAreaId IGetAreaId() const=0;
virtual ResId IGetAreaAssetId() const=0;

View File

@ -126,7 +126,7 @@ static zeus::CTransform LoadEditorTransformPivotOnly(CInputStream& in)
static SActorHead LoadActorHead(CInputStream& in, CStateManager& stateMgr)
{
SActorHead ret;
ret.x0_name = *stateMgr.HashInstanceName(in);
ret.x0_name = stateMgr.HashInstanceName(in);
ret.x10_transform = LoadEditorTransform(in);
return ret;
}
@ -502,7 +502,7 @@ CEntity* ScriptLoader::LoadTrigger(CStateManager& mgr, CInputStream& in, int pro
if (!EnsurePropertyCount(propCount, 9, "Trigger"))
return nullptr;
const std::string* name = mgr.HashInstanceName(in);
std::string name = mgr.HashInstanceName(in);
zeus::CVector3f position;
position.readBig(in);
@ -525,7 +525,7 @@ CEntity* ScriptLoader::LoadTrigger(CStateManager& mgr, CInputStream& in, int pro
const zeus::CTransform& areaXf = mgr.WorldNC()->GetGameAreas()[info.GetAreaId()]->GetTransform();
zeus::CVector3f orientedForce = areaXf.basis * forceVec;
return new CScriptTrigger(mgr.AllocateUniqueId(), *name, info, position, box, dInfo, orientedForce, flags, active,
return new CScriptTrigger(mgr.AllocateUniqueId(), name, info, position, box, dInfo, orientedForce, flags, active,
b2, b3);
}
@ -534,7 +534,7 @@ CEntity* ScriptLoader::LoadTimer(CStateManager& mgr, CInputStream& in, int propC
if (!EnsurePropertyCount(propCount, 6, "Timer"))
return nullptr;
const std::string* name = mgr.HashInstanceName(in);
std::string name = mgr.HashInstanceName(in);
float f1 = in.readFloatBig();
float f2 = in.readFloatBig();
@ -542,7 +542,7 @@ CEntity* ScriptLoader::LoadTimer(CStateManager& mgr, CInputStream& in, int propC
bool b2 = in.readBool();
bool b3 = in.readBool();
return new CScriptTimer(mgr.AllocateUniqueId(), *name, info, f1, f2, b1, b2, b3);
return new CScriptTimer(mgr.AllocateUniqueId(), name, info, f1, f2, b1, b2, b3);
}
CEntity* ScriptLoader::LoadCounter(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
@ -550,14 +550,14 @@ CEntity* ScriptLoader::LoadCounter(CStateManager& mgr, CInputStream& in, int pro
if (!EnsurePropertyCount(propCount, 5, "Counter"))
return nullptr;
const std::string* name = mgr.HashInstanceName(in);
std::string name = mgr.HashInstanceName(in);
u32 w1 = in.readUint32Big();
u32 w2 = in.readUint32Big();
bool b1 = in.readBool();
bool b2 = in.readBool();
return new CScriptCounter(mgr.AllocateUniqueId(), *name, info, w1, w2, b1, b2);
return new CScriptCounter(mgr.AllocateUniqueId(), name, info, w1, w2, b1, b2);
}
CEntity* ScriptLoader::LoadEffect(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
@ -696,7 +696,7 @@ CEntity* ScriptLoader::LoadGenerator(CStateManager& mgr, CInputStream& in, int p
if (!EnsurePropertyCount(propCount, 8, "Generator"))
return nullptr;
const std::string* name = mgr.HashInstanceName(in);
std::string name = mgr.HashInstanceName(in);
u32 w1 = in.readUint32Big();
bool b1 = in.readBool();
@ -709,7 +709,7 @@ CEntity* ScriptLoader::LoadGenerator(CStateManager& mgr, CInputStream& in, int p
float f1 = in.readFloatBig();
float f2 = in.readFloatBig();
return new CScriptGenerator(mgr.AllocateUniqueId(), *name, info, w1, b1, v1, b2, b3, f1, f2);
return new CScriptGenerator(mgr.AllocateUniqueId(), name, info, w1, b1, v1, b2, b3, f1, f2);
}
CEntity* ScriptLoader::LoadDock(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
@ -717,7 +717,7 @@ CEntity* ScriptLoader::LoadDock(CStateManager& mgr, CInputStream& in, int propCo
if (!EnsurePropertyCount(propCount, 7, "Dock"))
return nullptr;
const std::string* name = mgr.HashInstanceName(in);
std::string name = mgr.HashInstanceName(in);
bool active = in.readBool();
zeus::CVector3f position;
position.readBig(in);
@ -726,7 +726,7 @@ CEntity* ScriptLoader::LoadDock(CStateManager& mgr, CInputStream& in, int propCo
u32 dock = in.readUint32Big();
TAreaId area = in.readUint32Big();
bool b1 = in.readBool();
return new CScriptDock(mgr.AllocateUniqueId(), *name, info, position, scale, dock, area, active, 0, b1);
return new CScriptDock(mgr.AllocateUniqueId(), name, info, position, scale, dock, area, active, 0, b1);
}
CEntity* ScriptLoader::LoadCamera(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
@ -815,7 +815,7 @@ CEntity* ScriptLoader::LoadSpawnPoint(CStateManager& mgr, CInputStream& in, int
if (!EnsurePropertyCount(propCount, 35, "SpawnPoint"))
return nullptr;
const std::string* name = mgr.HashInstanceName(in);
std::string name = mgr.HashInstanceName(in);
zeus::CVector3f position;
position.readBig(in);
@ -834,7 +834,7 @@ CEntity* ScriptLoader::LoadSpawnPoint(CStateManager& mgr, CInputStream& in, int
if (propCount > 34)
morphed = in.readBool();
return new CScriptSpawnPoint(mgr.AllocateUniqueId(), *name, info,
return new CScriptSpawnPoint(mgr.AllocateUniqueId(), name, info,
ConvertEditorEulerToTransform4f(rotation, position), itemCounts, defaultSpawn, active, morphed);
}
@ -929,27 +929,27 @@ CEntity* ScriptLoader::LoadMemoryRelay(CStateManager& mgr, CInputStream& in, int
if (!EnsurePropertyCount(propCount, 3, "MemoryRelay") || propCount > 4)
return nullptr;
const std::string* name = mgr.HashInstanceName(in);
std::string name = mgr.HashInstanceName(in);
bool b1 = in.readBool();
bool b2 = in.readBool();
bool b3 = false;
if (propCount > 3)
b3 = in.readBool();
return new CScriptMemoryRelay(mgr.AllocateUniqueId(), *name, info, b1, b2, b3);
return new CScriptMemoryRelay(mgr.AllocateUniqueId(), name, info, b1, b2, b3);
}
CEntity* ScriptLoader::LoadRandomRelay(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
{
if (!EnsurePropertyCount(propCount, 5, "RandomRelay"))
return nullptr;
const std::string* name = mgr.HashInstanceName(in);
std::string name = mgr.HashInstanceName(in);
u32 w1 = in.readUint32Big();
u32 w2 = in.readUint32Big();
bool b1 = in.readBool();
bool b2 = in.readBool();
return new CScriptRandomRelay(mgr.AllocateUniqueId(), *name, info, w1, w2, b1, b2);
return new CScriptRandomRelay(mgr.AllocateUniqueId(), name, info, w1, w2, b1, b2);
}
CEntity* ScriptLoader::LoadRelay(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
@ -957,19 +957,19 @@ CEntity* ScriptLoader::LoadRelay(CStateManager& mgr, CInputStream& in, int propC
if (!EnsurePropertyCount(propCount, 2, "Relay") || propCount > 3)
return nullptr;
const std::string* name = mgr.HashInstanceName(in);
std::string name = mgr.HashInstanceName(in);
if (propCount >= 3)
in.readUint32Big();
bool b1 = in.readBool();
return new CScriptRelay(mgr.AllocateUniqueId(), *name, info, b1);
return new CScriptRelay(mgr.AllocateUniqueId(), name, info, b1);
}
CEntity* ScriptLoader::LoadBeetle(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
{
if (!EnsurePropertyCount(propCount, 16, "Beetle"))
return nullptr;
const std::string* name = mgr.HashInstanceName(in);
std::string name = mgr.HashInstanceName(in);
CPatterned::EFlavorType flavor = CPatterned::EFlavorType(in.readUint32Big());
zeus::CTransform xfrm = LoadEditorTransform(in);
zeus::CVector3f scale = zeus::CVector3f::ReadBig(in);
@ -1000,7 +1000,7 @@ CEntity* ScriptLoader::LoadBeetle(CStateManager& mgr, CInputStream& in, int prop
const CAnimationParameters& animParams = pInfo.GetAnimationParameters();
CAnimRes animRes(animParams.GetACSFile(), animParams.GetCharacter(), scale, animParams.GetInitialAnimation(), true);
return new MP1::CBeetle(mgr.AllocateUniqueId(), *name, info, xfrm, animRes, pInfo, flavor, entrance, dInfo, dVuln2,
return new MP1::CBeetle(mgr.AllocateUniqueId(), name, info, xfrm, animRes, pInfo, flavor, entrance, dInfo, dVuln2,
v1, f2, f3, f1, dVuln1, aParams, abdomenRes);
}
@ -1008,7 +1008,7 @@ CEntity* ScriptLoader::LoadHUDMemo(CStateManager& mgr, CInputStream& in, int pro
{
if (propCount != 5 && !EnsurePropertyCount(propCount, 6, "HUDMemo"))
return 0;
const std::string* name = mgr.HashInstanceName(in);
std::string name = mgr.HashInstanceName(in);
CHUDMemoParms hParms(in);
CScriptHUDMemo::EDisplayType displayType = CScriptHUDMemo::EDisplayType::MessageBox;
if (propCount == 6)
@ -1016,7 +1016,7 @@ CEntity* ScriptLoader::LoadHUDMemo(CStateManager& mgr, CInputStream& in, int pro
ResId message = in.readUint32Big();
bool active = in.readBool();
return new CScriptHUDMemo(mgr.AllocateUniqueId(), *name, info, hParms, displayType, message, active);
return new CScriptHUDMemo(mgr.AllocateUniqueId(), name, info, hParms, displayType, message, active);
}
CEntity* ScriptLoader::LoadCameraFilterKeyframe(CStateManager& mgr, CInputStream& in, int propCount,
@ -1024,7 +1024,7 @@ CEntity* ScriptLoader::LoadCameraFilterKeyframe(CStateManager& mgr, CInputStream
{
if (!EnsurePropertyCount(propCount, 10, "CameraFilterKeyframe"))
return nullptr;
const std::string* name = mgr.HashInstanceName(in);
std::string name = mgr.HashInstanceName(in);
bool active = in.readBool();
u32 w1 = in.readUint32Big();
u32 w2 = in.readUint32Big();
@ -1036,7 +1036,7 @@ CEntity* ScriptLoader::LoadCameraFilterKeyframe(CStateManager& mgr, CInputStream
float f2 = in.readFloatBig();
u32 w5 = in.readUint32Big();
return new CScriptCameraFilterKeyframe(mgr.AllocateUniqueId(), *name, info, w1, w2, w3, w4, color, f1, f2, w5,
return new CScriptCameraFilterKeyframe(mgr.AllocateUniqueId(), name, info, w1, w2, w3, w4, color, f1, f2, w5,
active);
}
@ -1046,7 +1046,7 @@ CEntity* ScriptLoader::LoadCameraBlurKeyframe(CStateManager& mgr, CInputStream&
if (!EnsurePropertyCount(propCount, 7, "CameraBlurKeyframe"))
return nullptr;
const std::string* name = mgr.HashInstanceName(in);
std::string name = mgr.HashInstanceName(in);
bool active = in.readBool();
u32 w1 = in.readUint32Big();
float f1 = in.readFloatBig();
@ -1054,7 +1054,7 @@ CEntity* ScriptLoader::LoadCameraBlurKeyframe(CStateManager& mgr, CInputStream&
float f2 = in.readFloatBig();
float f3 = in.readFloatBig();
return new CScriptCameraBlurKeyframe(mgr.AllocateUniqueId(), *name, info, w1, f1, w2, f2, f3, active);
return new CScriptCameraBlurKeyframe(mgr.AllocateUniqueId(), name, info, w1, f1, w2, f2, f3, active);
}
u32 ClassifyVector(const zeus::CVector3f& dir)
@ -1101,7 +1101,7 @@ CEntity* ScriptLoader::LoadDamageableTrigger(CStateManager& mgr, CInputStream& i
if (!EnsurePropertyCount(propCount, 12, "DamageableTrigger"))
return nullptr;
const std::string* name = mgr.HashInstanceName(in);
std::string name = mgr.HashInstanceName(in);
zeus::CVector3f position(zeus::CVector3f::ReadBig(in));
zeus::CVector3f volume(zeus::CVector3f::ReadBig(in));
@ -1115,7 +1115,7 @@ CEntity* ScriptLoader::LoadDamageableTrigger(CStateManager& mgr, CInputStream& i
CScriptDamageableTrigger::ECanOrbit canOrbit = CScriptDamageableTrigger::ECanOrbit(in.readBool());
bool active = in.readBool();
CVisorParameters vParms = LoadVisorParameters(in);
return new CScriptDamageableTrigger(mgr.AllocateUniqueId(), *name, info, position, volume, hInfo, dVuln,
return new CScriptDamageableTrigger(mgr.AllocateUniqueId(), name, info, position, volume, hInfo, dVuln,
triggerFlags, w1, w2, w3, canOrbit, active, vParms);
}
@ -1158,7 +1158,7 @@ CEntity* ScriptLoader::LoadActorKeyframe(CStateManager& mgr, CInputStream& in, i
if (!EnsurePropertyCount(propCount, 7, "ActorKeyframe"))
return nullptr;
const std::string* name = mgr.HashInstanceName(in);
std::string name = mgr.HashInstanceName(in);
s32 w1 = in.readInt32Big();
bool b1 = in.readBool();
float f1 = in.readFloatBig();
@ -1169,7 +1169,7 @@ CEntity* ScriptLoader::LoadActorKeyframe(CStateManager& mgr, CInputStream& in, i
if (w1 == -1)
return nullptr;
return new CScriptActorKeyframe(mgr.AllocateUniqueId(), *name, info, w1, b1, f1, false, w2, active, f2);
return new CScriptActorKeyframe(mgr.AllocateUniqueId(), name, info, w1, b1, f1, false, w2, active, f2);
}
CEntity* ScriptLoader::LoadWater(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
@ -1177,7 +1177,7 @@ CEntity* ScriptLoader::LoadWater(CStateManager& mgr, CInputStream& in, int propC
if (!EnsurePropertyCount(propCount, 63, "Water"))
return nullptr;
const std::string* name = mgr.HashInstanceName(in);
std::string name = mgr.HashInstanceName(in);
zeus::CVector3f position;
position.readBig(in);
zeus::CVector3f extent;
@ -1188,7 +1188,7 @@ CEntity* ScriptLoader::LoadWater(CStateManager& mgr, CInputStream& in, int propC
ETriggerFlags triggerFlags = ETriggerFlags(in.readUint32Big()) | ETriggerFlags::DetectProjectiles1 |
ETriggerFlags::DetectProjectiles2 | ETriggerFlags::DetectProjectiles3 |
ETriggerFlags::DetectProjectiles4 | ETriggerFlags::DetectBombs |
ETriggerFlags::Unknown1 | ETriggerFlags::DetectProjectiles5 |
ETriggerFlags::DetectPowerBombs | ETriggerFlags::DetectProjectiles5 |
ETriggerFlags::DetectProjectiles6 | ETriggerFlags::DetectProjectiles7;
bool b1 = in.readBool();
bool displaySurface = in.readBool();
@ -1280,7 +1280,7 @@ CEntity* ScriptLoader::LoadWater(CStateManager& mgr, CInputStream& in, int propC
realTextureId5 = textureId5;
return new CScriptWater(
mgr, mgr.AllocateUniqueId(), *name, info, position, box, dInfo, orientedForce, triggerFlags, b1, displaySurface,
mgr, mgr.AllocateUniqueId(), name, info, position, box, dInfo, orientedForce, triggerFlags, b1, displaySurface,
textureId1, textureId2, textureId3, textureId4, realTextureId5, realTextureId6, -1, otherV2, f1, f2, f3, active,
fluidType, b4, f4, fluidMotion, f5, f6, f7, f8, f9, f10, f11, f12, c1, c2, enterParticle, partId2, partId3,
partId4, partId5, soundId1, soundId2, soundId3, soundId4, soundId5, f13, w19, f14, f15, f16, f17, f18, f19,
@ -1292,7 +1292,7 @@ CEntity* ScriptLoader::LoadWarWasp(CStateManager& mgr, CInputStream& in, int pro
if (!EnsurePropertyCount(propCount, 13, "WarWasp"))
return nullptr;
const std::string* name = mgr.HashInstanceName(in);
std::string name = mgr.HashInstanceName(in);
CPatterned::EFlavorType flavor = CPatterned::EFlavorType(in.readUint32Big());
zeus::CTransform xf = LoadEditorTransformPivotOnly(in);
zeus::CVector3f scale;
@ -1318,7 +1318,7 @@ CEntity* ScriptLoader::LoadWarWasp(CStateManager& mgr, CInputStream& in, int pro
CAnimRes res(aParms.GetACSFile(), aParms.GetCharacter(), scale, true, aParms.GetInitialAnimation());
CModelData mData(res);
return new MP1::CWarWasp(mgr.AllocateUniqueId(), *name, info, xf, std::move(mData), pInfo, flavor, collider,
return new MP1::CWarWasp(mgr.AllocateUniqueId(), name, info, xf, std::move(mData), pInfo, flavor, collider,
damageInfo1, actorParms, weaponDesc, damageInfo2, particle, w1);
}
@ -1416,11 +1416,11 @@ CEntity* ScriptLoader::LoadGrapplePoint(CStateManager& mgr, CInputStream& in, in
if (!EnsurePropertyCount(propCount, 5, "GrapplePoint"))
return nullptr;
const std::string* name = mgr.HashInstanceName(in);
std::string name = mgr.HashInstanceName(in);
zeus::CTransform grappleXf = LoadEditorTransform(in);
bool active = in.readBool();
CGrappleParameters parameters = LoadGrappleParameters(in);
return new CScriptGrapplePoint(mgr.AllocateUniqueId(), *name, info, grappleXf, active, parameters);
return new CScriptGrapplePoint(mgr.AllocateUniqueId(), name, info, grappleXf, active, parameters);
}
CEntity* ScriptLoader::LoadPuddleSpore(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
@ -1450,7 +1450,7 @@ CEntity* ScriptLoader::LoadDistanceFog(CStateManager& mgr, CInputStream& in, int
if (!EnsurePropertyCount(propCount, 8, "DistanceFog"))
return nullptr;
const std::string* name = mgr.HashInstanceName(in);
std::string name = mgr.HashInstanceName(in);
u32 mode = in.readUint32Big();
zeus::CColor color;
color.readRGBABig(in);
@ -1476,7 +1476,7 @@ CEntity* ScriptLoader::LoadDistanceFog(CStateManager& mgr, CInputStream& in, int
else if (mode == 5)
realMode = ERglFogMode::PerspRevExp2;
return new CScriptDistanceFog(mgr.AllocateUniqueId(), *name, info, realMode, color, range, colorDelta, rangeDelta,
return new CScriptDistanceFog(mgr.AllocateUniqueId(), name, info, realMode, color, range, colorDelta, rangeDelta,
expl, active, 0.f, 0.f, 0.f, 0.f);
}
@ -1495,11 +1495,11 @@ CEntity* ScriptLoader::LoadDockAreaChange(CStateManager& mgr, CInputStream& in,
if (!EnsurePropertyCount(propCount, 3, "DockAreaChange"))
return nullptr;
const std::string* name = mgr.HashInstanceName(in);
std::string name = mgr.HashInstanceName(in);
s32 w1 = in.readInt32Big();
bool active = in.readBool();
return new CScriptDockAreaChange(mgr.AllocateUniqueId(), *name, info, w1, active);
return new CScriptDockAreaChange(mgr.AllocateUniqueId(), name, info, w1, active);
}
CEntity* ScriptLoader::LoadActorRotate(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
@ -1507,14 +1507,14 @@ CEntity* ScriptLoader::LoadActorRotate(CStateManager& mgr, CInputStream& in, int
if (!EnsurePropertyCount(propCount, 6, "ActorRotate"))
return nullptr;
const std::string* name = mgr.HashInstanceName(in);
std::string name = mgr.HashInstanceName(in);
zeus::CVector3f rotation = zeus::CVector3f::ReadBig(in);
float scale = in.readFloatBig();
bool b1 = in.readBool();
bool b2 = in.readBool();
bool active = in.readBool();
return new CScriptActorRotate(mgr.AllocateUniqueId(), *name, info, rotation, scale, b1, b2, active);
return new CScriptActorRotate(mgr.AllocateUniqueId(), name, info, rotation, scale, b1, b2, active);
}
CEntity* ScriptLoader::LoadSpecialFunction(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
@ -1571,11 +1571,11 @@ CEntity* ScriptLoader::LoadPickupGenerator(CStateManager& mgr, CInputStream& in,
if (!EnsurePropertyCount(propCount, 4, "PickupGenerator"))
return nullptr;
const std::string* name = mgr.HashInstanceName(in);
std::string name = mgr.HashInstanceName(in);
zeus::CVector3f pos = zeus::CVector3f::ReadBig(in);
bool active = in.readBool();
float f1 = in.readFloatBig();
return new CScriptPickupGenerator(mgr.AllocateUniqueId(), *name, info, pos, f1, active);
return new CScriptPickupGenerator(mgr.AllocateUniqueId(), name, info, pos, f1, active);
}
CEntity* ScriptLoader::LoadAIKeyframe(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
@ -1716,12 +1716,12 @@ CEntity* ScriptLoader::LoadSwitch(CStateManager& mgr, CInputStream& in, int prop
if (!EnsurePropertyCount(propCount, 4, "Switch"))
return nullptr;
const std::string* name = mgr.HashInstanceName(in);
std::string name = mgr.HashInstanceName(in);
bool active = in.readBool();
bool b2 = in.readBool();
bool b3 = in.readBool();
return new CScriptSwitch(mgr.AllocateUniqueId(), *name, info, active, b2, b3);
return new CScriptSwitch(mgr.AllocateUniqueId(), name, info, active, b2, b3);
}
CEntity* ScriptLoader::LoadPlayerStateChange(CStateManager& mgr, CInputStream& in, int propCount,
@ -1769,7 +1769,7 @@ CEntity* ScriptLoader::LoadColorModulate(CStateManager& mgr, CInputStream& in, i
if (!EnsurePropertyCount(propCount, 12, "ColorModulate"))
return nullptr;
const std::string* name = mgr.HashInstanceName(in);
std::string name = mgr.HashInstanceName(in);
zeus::CColor c1;
c1.readRGBABig(in);
zeus::CColor c2;
@ -1783,7 +1783,7 @@ CEntity* ScriptLoader::LoadColorModulate(CStateManager& mgr, CInputStream& in, i
bool b4 = in.readBool();
bool b5 = in.readBool();
bool active = in.readBool();
return new CScriptColorModulate(mgr.AllocateUniqueId(), *name, info, c1, c2, bm, f1, f2, b1, b2, b3, b4, b5,
return new CScriptColorModulate(mgr.AllocateUniqueId(), name, info, c1, c2, bm, f1, f2, b1, b2, b3, b4, b5,
active);
}
@ -1798,12 +1798,12 @@ CEntity* ScriptLoader::LoadMidi(CStateManager& mgr, CInputStream& in, int propCo
return nullptr;
}
CEntity* ScriptLoader::LoadStreamedMusic(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
CEntity* ScriptLoader::LoadStreamedAudio(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
{
if (!EnsurePropertyCount(propCount, 9, "StreamedAudio"))
return nullptr;
const std::string* name = mgr.HashInstanceName(in);
const std::string name = mgr.HashInstanceName(in);
bool b1 = in.readBool();
std::string fileName = in.readString();
bool b2 = in.readBool();
@ -1813,7 +1813,7 @@ CEntity* ScriptLoader::LoadStreamedMusic(CStateManager& mgr, CInputStream& in, i
u32 w2 = in.readUint32Big();
bool b3 = in.readBool();
return new CScriptStreamedMusic(mgr.AllocateUniqueId(), info, *name, b1, fileName, b2, f1, f2, w1, !w2, b3);
return new CScriptStreamedMusic(mgr.AllocateUniqueId(), info, name, b1, fileName, b2, f1, f2, w1, !w2, b3);
}
CEntity* ScriptLoader::LoadRepulsor(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
@ -1821,12 +1821,12 @@ CEntity* ScriptLoader::LoadRepulsor(CStateManager& mgr, CInputStream& in, int pr
if (!EnsurePropertyCount(propCount, 4, "Repulsor"))
return nullptr;
const std::string* name = mgr.HashInstanceName(in);
std::string name = mgr.HashInstanceName(in);
zeus::CVector3f center = in.readVec3fBig();
bool active = in.readBool();
float radius = in.readFloatBig();
return new CRepulsor(mgr.AllocateUniqueId(), active, *name, info, center, radius);
return new CRepulsor(mgr.AllocateUniqueId(), active, name, info, center, radius);
}
CEntity* ScriptLoader::LoadGunTurret(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
@ -1854,7 +1854,7 @@ CEntity* ScriptLoader::LoadRadialDamage(CStateManager& mgr, CInputStream& in, in
if (!EnsurePropertyCount(propCount, 5, "RadialDamage"))
return nullptr;
const std::string* name = mgr.HashInstanceName(in);
std::string name = mgr.HashInstanceName(in);
zeus::CVector3f center = zeus::CVector3f::ReadBig(in);
bool active = in.readBool();
CDamageInfo dInfo(in);
@ -1862,7 +1862,7 @@ CEntity* ScriptLoader::LoadRadialDamage(CStateManager& mgr, CInputStream& in, in
zeus::CTransform xf = ConvertEditorEulerToTransform4f(zeus::CVector3f::skZero, center);
return new CScriptSpecialFunction(
mgr.AllocateUniqueId(), *name, info, xf, CScriptSpecialFunction::ESpecialFunction::RadialDamage, "", radius,
mgr.AllocateUniqueId(), name, info, xf, CScriptSpecialFunction::ESpecialFunction::RadialDamage, "", radius,
0.f, 0.f, 0.f, zeus::CVector3f::skZero, zeus::CColor::skBlack, active, dInfo, -1, -1, -1, -1, -1, -1);
}
@ -2080,7 +2080,7 @@ CEntity* ScriptLoader::LoadShadowProjector(CStateManager& mgr, CInputStream& in,
if (!EnsurePropertyCount(propCount, 10, "ShadowProjector"))
return nullptr;
const std::string* name = mgr.HashInstanceName(in);
std::string name = mgr.HashInstanceName(in);
zeus::CVector3f position(zeus::CVector3f::ReadBig(in));
bool b1 = in.readBool();
float f1 = in.readFloatBig();
@ -2090,7 +2090,7 @@ CEntity* ScriptLoader::LoadShadowProjector(CStateManager& mgr, CInputStream& in,
float f4 = in.readFloatBig();
bool b2 = in.readBool();
u32 w1 = in.readUint32Big();
return new CScriptShadowProjector(mgr.AllocateUniqueId(), *name, info, zeus::CTransform::Translate(position), b1,
return new CScriptShadowProjector(mgr.AllocateUniqueId(), name, info, zeus::CTransform::Translate(position), b1,
vec2, b2, f1, f2, f3, f4, w1);
}

View File

@ -123,7 +123,7 @@ public:
static CEntity* LoadColorModulate(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info);
static CEntity* LoadThardusRockProjectile(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info);
static CEntity* LoadMidi(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info);
static CEntity* LoadStreamedMusic(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info);
static CEntity* LoadStreamedAudio(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info);
static CEntity* LoadRepulsor(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info);
static CEntity* LoadGunTurret(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info);
static CEntity* LoadFogVolume(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info);