This commit is contained in:
Jack Andersen 2017-07-30 19:19:26 -10:00
commit 0cae1bb036
28 changed files with 363 additions and 58 deletions

View File

@ -129,16 +129,16 @@ CGameState::GameFileStateInfo CGameState::LoadGameFileState(const u8* data)
if (origMLVL == 0x158EFE17)
itemPercent = 0;
else
itemPercent = std::ceil(playerState.CalculateItemCollectionRate() * 100.f / playerState.GetPickupTotal());
itemPercent = u32(std::ceil(playerState.CalculateItemCollectionRate() * 100.f / playerState.GetPickupTotal()));
ret.x18_itemPercent = itemPercent;
float somePercent;
float scanPercent;
if (playerState.GetTotalLogScans() == 0)
somePercent = 0.f;
scanPercent = 0.f;
else
somePercent = 100.f * playerState.GetLogScans() / float(playerState.GetTotalLogScans());
ret.x1c_scanPercent = somePercent;
scanPercent = 100.f * playerState.GetLogScans() / float(playerState.GetTotalLogScans());
ret.x1c_scanPercent = scanPercent;
return ret;
}

View File

@ -71,7 +71,7 @@ class CGameState
bool x0_[128] = {};
u32 x80_;
ResId x84_mlvlId = -1;
ResId x84_mlvlId = kInvalidResId;
std::vector<CWorldState> x88_worldStates;
std::shared_ptr<CPlayerState> x98_playerState;
std::shared_ptr<CWorldTransManager> x9c_transManager;

View File

@ -12,7 +12,7 @@ CCollisionSurface::CCollisionSurface(const zeus::CVector3f& a, const zeus::CVect
zeus::CVector3f CCollisionSurface::GetNormal() const
{
zeus::CVector3f v1 = ((xc_b - x0_a) * ((x18_c - x0_a) * (xc_b - x0_a))) - (x18_c - x0_a);
zeus::CVector3f v1 = xc_b.cross(x0_a);
return zeus::CUnitVector3f({v1.y, v1.z, v1.x}, true);
}

View File

@ -33,7 +33,7 @@ void MP1::CActorContraption::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId
else if (msg == EScriptObjectMessage::SetToZero)
ResetFlameThrowers(mgr);
AcceptScriptMsg(msg, uid, mgr);
CScriptActor::AcceptScriptMsg(msg, uid, mgr);
if (curActive == GetActive() || !GetActive())
return;

View File

@ -14,12 +14,13 @@ namespace urde
using FourCC = hecl::FourCC;
using ResId = u64;
#define kInvalidResId ResId(-1)
struct SObjectTag
{
FourCC type;
ResId id = -1;
operator bool() const { return (id & 0xffffffff) != 0xffffffff; }
ResId id = kInvalidResId;
operator bool() const { return (id != kInvalidResId); }
bool operator!=(const SObjectTag& other) const { return id != other.id; }
bool operator==(const SObjectTag& other) const { return id == other.id; }
bool operator<(const SObjectTag& other) const { return id < other.id; }
@ -41,10 +42,10 @@ struct TEditorId
{
TEditorId() = default;
TEditorId(u32 idin) : id(idin) {}
u32 id = -1;
u8 LayerNum() const { return (id >> 26) & 0x3f; }
u16 AreaNum() const { return (id >> 16) & 0x3ff; }
u16 Id() const { return id & 0xffff; }
u32 id = u32(-1);
u8 LayerNum() const { return u8((id >> 26) & 0x3f); }
u16 AreaNum() const { return u16((id >> 16) & 0x3ff); }
u16 Id() const { return u16(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); }
@ -57,7 +58,6 @@ using TAreaId = s32;
#define kInvalidEditorId TEditorId()
#define kInvalidUniqueId TUniqueId(-1)
#define kInvalidAreaId TAreaId(-1)
#define kInvalidResId ResId(-1)
}
#if 0

View File

@ -20,7 +20,73 @@ CActorModelParticles::CItem::CItem(const CEntity& ent, CActorModelParticles& par
x8_.resize(8);
}
u32 GetNextBestPt(s32 start, const zeus::CVector3f* vecPtr, s32 vecCount, CRandom16& rnd)
{
const zeus::CVector3f& startVec = vecPtr[start];
u32 ret;
float lastMag = 0.f;
for (s32 i = 0; i < 10; ++i)
{
u32 idx = u32(rnd.Range(0, vecCount - 1));
const zeus::CVector3f& rndVec = vecPtr[idx];
float mag = (startVec - rndVec).magSquared();
if (mag > lastMag)
{
ret = idx;
lastMag = mag;
}
}
return ret;
}
void CActorModelParticles::CItem::GeneratePoints(const zeus::CVector3f* v1, const zeus::CVector3f* v2, int w1)
{
for (std::pair<std::unique_ptr<CElementGen>, u32>& pair: x8_)
{
if (pair.first)
{
CRandom16 rnd(pair.second);
zeus::CVector3f vec = v1[u32(rnd.Float() * (w1 - 1))];
pair.first->SetTranslation(xec_ * vec);
}
}
if (x84_ > 0)
{
CRandom16 rnd(x88_seed1);
u32 count = (x84_ >= 16 ? 16 : x84_);
zeus::CVector3f uVec = zeus::CVector3f::skUp;
u32 idx = x80_;
for (u32 i = 0; i < count; ++i)
{
idx = GetNextBestPt(idx, v1, w1, rnd);
x78_->SetTranslation(xec_ * v1[idx]);
zeus::CVector3f v = v2[idx];
if (v.canBeNormalized())
{
v.normalize();
x78_->SetOrientation(zeus::CTransform{zeus::CVector3f::skUp.cross(v), v, zeus::CVector3f::skUp, zeus::CVector3f::skZero});
}
x78_->ForceParticleCreation(1);
}
x84_ -= count;
x88_seed1 = rnd.GetSeed();
}
if (xb0_ != -1)
{
CRandom16 rnd(xb4_seed2);
std::unique_ptr<CElementGen> iceGen = x128_parent.MakeIceGen();
iceGen->SetGlobalOrientAndTrans(xf8_);
u32 next = GetNextBestPt(xb0_, v1, w1, rnd);
iceGen->SetTranslation(xec_ * v1[next]);
iceGen->SetOrientation(zeus::CTransform::MakeRotationsBasedOnY(zeus::CUnitVector3f(v2[next])));
}
}
void CActorModelParticles::CItem::Update(float, CStateManager&)
{
}

View File

@ -27,15 +27,15 @@ public:
TAreaId x4_areaId;
rstl::reserved_vector<std::pair<std::unique_ptr<CElementGen>, u32>, 8> x8_;
float x6c_ = 0.f;
CSfxHandle x74_sfx;
bool x70_ = false;
CSfxHandle x74_sfx;
std::unique_ptr<CElementGen> x78_;
u32 x80_ = 0;
u32 x84_ = -1;
u32 x88_ = 99;
u32 x88_seed1 = 99;
rstl::reserved_vector<std::unique_ptr<CElementGen>, 4> x8c_;
u32 xb0_ = -1;
u32 xb4_ = 99;
u32 xb4_seed2 = 99;
std::unique_ptr<CElementGen> xb8_;
std::unique_ptr<CElementGen> xc0_;
u32 xc8_ = 0;
@ -44,9 +44,7 @@ public:
std::unique_ptr<u32> xd4_;
TToken<CTexture> xdc_ashy;
std::unique_ptr<CElementGen> xe4_;
float xec_ = 1.f;
float xf0_ = 1.f;
float xf4_ = 1.f;
zeus::CVector3f xec_ = zeus::CVector3f::skOne;
zeus::CTransform xf8_;
CActorModelParticles& x128_parent;
union
@ -63,6 +61,7 @@ public:
public:
CItem(const CEntity& ent, CActorModelParticles& parent);
void GeneratePoints(const zeus::CVector3f* v1, const zeus::CVector3f* v2, int w1);
void Update(float, CStateManager&);
};
private:

View File

@ -9,7 +9,11 @@ namespace urde
class CEffect : public CActor
{
public:
CEffect(TUniqueId uid, const CEntityInfo& info, bool active, const std::string& name, const zeus::CTransform& xf);
CEffect(TUniqueId uid, const CEntityInfo& info, bool active, const std::string& name,
const zeus::CTransform& xf);
virtual void AddToRenderer(const zeus::CFrustum&, const CStateManager&) const {}
virtual void Render(const CStateManager&) const {}
};
}

View File

@ -29,6 +29,7 @@ private:
EFluidType x44_fluidType;
float x48_;
public:
CFluidPlane() = default;
CFluidPlane(u32, u32, u32, EFluidType, float, const CFluidUVMotion&, float);
virtual void Ripple(float mag, TUniqueId rippler, const zeus::CVector3f& pos,

View File

@ -0,0 +1,14 @@
#ifndef __URDE_CFLUIDPLANEDOOR_HPP__
#define __URDE_CFLUIDPLANEDOOR_HPP__
#include "CFluidPlane.hpp
namespace urde
{
class CFluidPlaneDoor : public CFluidPlane
{
};
}
#endif // __URDE_CFLUIDPLANEDOOR_HPP__

View File

@ -1,16 +1,57 @@
#include "CFluidUVMotion.hpp"
#include "zeus/Math.hpp"
namespace urde
{
CFluidUVMotion::CFluidUVMotion(float a, float b, const urde::CFluidUVMotion::SFluidLayerMotion& c, const urde::CFluidUVMotion::SFluidLayerMotion& d, const urde::CFluidUVMotion::SFluidLayerMotion& e)
CFluidUVMotion::CFluidUVMotion(float a, float b, const CFluidUVMotion::SFluidLayerMotion& c,
const CFluidUVMotion::SFluidLayerMotion& d, const CFluidUVMotion::SFluidLayerMotion& e)
: x4c_(1.f/a)
, x50_(b)
{
x4c_ = 1.f / a;
x50_ = b;
x0_fluidLayers.resize(3);
x0_fluidLayers[0] = c;
x0_fluidLayers[1] = d;
x0_fluidLayers[2] = e;
}
CFluidUVMotion::CFluidUVMotion(float, float)
{}
void CFluidUVMotion::CalculateFluidTextureOffset(float f31, float offsets[3][2])
{
float f29 = f31 * x4c_;
float f28 = f29 * zeus::fastCosF(x50_);
f29 = f29 / zeus::fastSinF(x50_);
for (u32 i = 0 ; i<x0_fluidLayers.size() ; ++i)
{
const SFluidLayerMotion& layer = x0_fluidLayers[i];
float f30 = f31 / layer.x4_a;
float f25;
float f26;
float f27;
switch(layer.x0_motion)
{
case EFluidUVMotion::Zero:
f26 = 0.f;
f27 = 0.f;
break;
case EFluidUVMotion::One:
f30 = (M_PIF * 2.f) * (f30 - zeus::floorF(f30));
f27 = (M_PIF * 2.f) * zeus::fastSinF(f30);
f26 = layer.xc_c * zeus::fastSinF(f30);
break;
case EFluidUVMotion::Two:
f27 = 0.f;
f26 = zeus::fastCosF((M_PIF * 2.f) * layer.xc_c);
break;
}
f25 = (f26 * ((f27 * f29) + zeus::fastCosF(layer.x8_b))) + zeus::fastSinF(layer.x8_b);
f26 = (f27 * ((f26 * f28) + zeus::fastCosF(layer.x8_b))) + zeus::fastSinF(layer.x8_b);
offsets[i][0] = f25 - zeus::floorF(f25);
offsets[i][1] = f26 - zeus::floorF(f26);
}
}
}

View File

@ -2,6 +2,7 @@
#define __URDE_CFLUIDUVMOTION_HPP__
#include "rstl.hpp"
#include "RetroTypes.hpp"
namespace urde
{
@ -10,17 +11,19 @@ class CFluidUVMotion
public:
enum class EFluidUVMotion
{
Zero
Zero,
One,
Two,
};
struct SFluidLayerMotion
{
EFluidUVMotion x0_motion = EFluidUVMotion::Zero;
float x4_a = 0.f;
float x4_a = 0.16666667f;
float x8_b = 0.f;
float xc_c = 0.f;
float x10_d = 0.f;
float x14_e = 0.f;
float xc_c = 1.f;
float x10_d = 5.f;
float x14_e = 0.2f;
SFluidLayerMotion() = default;
SFluidLayerMotion(EFluidUVMotion motion, float a, float b, float c, float d)
@ -35,9 +38,12 @@ private:
float x50_;
public:
CFluidUVMotion(float a, float b, const SFluidLayerMotion& c, const SFluidLayerMotion& d, const SFluidLayerMotion& e);
CFluidUVMotion(float, float);
const rstl::reserved_vector<SFluidLayerMotion, 3>& GetFluidLayers() const { return x0_fluidLayers; }
void GetOrientation() const;
void GetOOTimeToWrapTexPage() const;
void CalculateFluidTextureOffset(float, float[3][2]);
};
}
#endif // __URDE_CFLUIDUVMOTION_HPP__

View File

@ -50,6 +50,7 @@ set(WORLD_SOURCES
CScriptAreaAttributes.hpp CScriptAreaAttributes.cpp
CFishCloud.hpp CFishCloud.cpp
CScriptVisorFlare.hpp CScriptVisorFlare.cpp
CScriptWorldTeleporter.hpp CScriptWorldTeleporter.cpp
CScriptCameraWaypoint.hpp CScriptCameraWaypoint.cpp
CScriptCoverPoint.hpp CScriptCoverPoint.cpp
CScriptSpawnPoint.hpp CScriptSpawnPoint.cpp
@ -69,6 +70,7 @@ set(WORLD_SOURCES
CScriptActorRotate.hpp CScriptActorRotate.cpp
CScriptSpecialFunction.hpp CScriptSpecialFunction.cpp
CScriptPlayerHint.hpp CScriptPlayerHint.cpp
CScriptPlayerStateChange.hpp CScriptPlayerStateChange.cpp
CScriptTargetingPoint.hpp CScriptTargetingPoint.cpp
CScriptPlayerActor.hpp CScriptPlayerActor.cpp
CScriptSwitch.hpp CScriptSwitch.cpp

View File

@ -6,13 +6,12 @@ namespace urde
{
CPFArea::CPFArea(const std::unique_ptr<u8[]>&& buf, int len)
{
x13c_ = buf.get();
}
std::unique_ptr<IObj> FPathFindAreaFactory(const SObjectTag& /*tag*/, const std::unique_ptr<u8[]>& buf,
const CVParamTransfer &xfer)
{
return TToken<CPFArea>::GetIObjObjectFor(
std::unique_ptr<CPFArea>(new CPFArea(std::move(buf), *reinterpret_cast<int*>(xfer.GetObj()))));
std::make_unique<CPFArea>(std::move(buf), *reinterpret_cast<int*>(xfer.GetObj())));
}
}

View File

@ -20,6 +20,16 @@ public:
void Rmv(s32);
};
class CPFNode
{
zeus::CVector3f x0_position;
zeus::CVector3f xc_normal;
public:
const zeus::CVector3f& GetPos() const { return x0_position; }
const zeus::CVector3f& GetNormal() const { return xc_normal; }
};
class CPFAreaOctree;
class CPFArea
{
float x0_ = FLT_MAX;
@ -49,15 +59,9 @@ class CPFArea
u32 x74_ = 0;
CPFOpenList x78_;
u32 x138_;
u8* x13c_ = nullptr;
u32 x140_ = 0;
u8* x144_ = nullptr;
u32 x148_ = 0;
u8* x14c_ = nullptr;
u32 x150_ = 0;
u8* x154_ = nullptr;
u32 x158_ = 0;
u32 x15c_ = 0;
std::unique_ptr<u8[]> x13c_data = nullptr;
std::vector<CPFNode> x140_nodes;
/*std::vector<> x150_;*/
u32 x160_ = 0;
u32 x164_ = 0;
u32 x168_ = 0;
@ -65,9 +69,25 @@ class CPFArea
u32 x170_ = 0;
u32 x174_ = 0;
std::vector<CPFRegionData> x178_;
zeus::CTransform x188_;
zeus::CTransform x188_transform;
public:
CPFArea(const std::unique_ptr<u8[]>&& buf, int len);
void SetTransform(const zeus::CTransform& xf) { x188_transform = xf; }
const zeus::CTransform& GetTransform() const { return x188_transform; }
CPFRegion* GetRegion(s32) const { return nullptr; }
void GetClosestPoint() const;
void OpenList();
void ClosedSet();
CPFRegionData* GetRegionData() const;
CPFLink* GetLink(s32);
CPFNode* GetNode(s32) const;
CPFAreaOctree* GetOctree(s32);
void GetOctreeRegionPtrs(s32);
void GetOctreeRegionList(const zeus::CVector3f&);
void FindRegions(rstl::reserved_vector<CPFRegion, 4>&, const zeus::CVector3f&, u32);
void FindClosestRegion(const zeus::CVector3f&, u32, float);
void FindClosestReachablePoint(rstl::reserved_vector<CPFRegion, 4>&, const zeus::CVector3f&, u32);
};

View File

@ -0,0 +1,23 @@
#ifndef __URDE_CPATHFINDAREAOCTREE_HPP__
#define __URDE_CPATHFINDAREAOCTREE_HPP__
#include "rstl.hpp"
#include "CPathFindRegion.hpp"
#include "zeus/CVector3f.hpp"
namespace urde
{
class CPFArea;
class CPFAreaOctree
{
public:
void Fixup(CPFArea&);
void GetChildIndex(const zeus::CVector3f&) const;
void GetRegionList(const zeus::CVector3f&) const;
void GetRegionListList(rstl::reserved_vector<rstl::prereserved_vector<CPFRegion>, 32>, const zeus::CVector3f&, float);
bool IsPointInPaddedAABox(const zeus::CVector3f&, float);
void Render();
};
}
#endif // __URDE_CPATHFINDAREAOCTREE_HPP__

View File

@ -1,7 +1,8 @@
#include "CPathFindOpenList.hpp"
namespace urde
{
CPFOpenList::CPFOpenList() {}
CPFOpenList::CPFOpenList()
{}
void CPFOpenList::Clear() {}
}

View File

@ -1,7 +1,12 @@
#include "CPathFindRegion.hpp"
#include "CPathFindArea.hpp"
namespace urde
{
void CPFRegion::Fixup(CPFArea& area, s32& r5)
{
}
void CPFRegionData::SetOpenLess(CPFRegion* region) { x24_openLess = region; }
void CPFRegionData::SetOpenMore(CPFRegion* region) { x28_openMore = region; }

View File

@ -22,7 +22,6 @@ class CPFRegion
zeus::CVector3f x28_;
zeus::CAABox x34_;
u32 x4c_;
public:
CPFRegion() = default;
void SetData(CPFRegionData*) {}
@ -35,7 +34,7 @@ public:
void GetLink(s32) const;
void SetCentroid(const zeus::CVector3f&);
zeus::CVector3f GetCentroid() const;
void Fixup(CPFArea&, s32);
void Fixup(CPFArea&, s32&);
bool IsPointInside(const zeus::CVector3f&);
zeus::CVector3f GetNormal();
s32 GetNumNodes() const;

View File

@ -51,10 +51,6 @@ float CPhysicsActor::GetStepDownHeight() const { return x240_stepDownHeight; }
float CPhysicsActor::GetWeight() const { return 24.525002f * xe8_mass; }
void CPhysicsActor::sub_8011A4C(float f) { x238_maximumCollisionVelocity = f; }
float CPhysicsActor::sub_8011A4B8() const { return x238_maximumCollisionVelocity; }
void CPhysicsActor::SetPrimitiveOffset(const zeus::CVector2f& offset) { x1e8_primitiveOffset = offset; }
zeus::CVector3f CPhysicsActor::GetPrimitiveOffset() { return x1e8_primitiveOffset; }

View File

@ -133,8 +133,6 @@ public:
virtual float GetWeight() const;
float GetMass() const { return xe8_mass; }
void sub_8011A4C(float f);
float sub_8011A4B8() const;
void SetPrimitiveOffset(const zeus::CVector2f& offset);
zeus::CVector3f GetPrimitiveOffset();
void MoveCollisionPrimitive(const zeus::CVector3f& offset);

View File

@ -2242,7 +2242,7 @@ void CPlayer::UpdateAimTargetPrediction(const zeus::CTransform& xf, const CState
{
if (TCastToConstPtr<CActor> target = mgr.GetObjectById(x3f4_aimTarget))
{
x9c6_27_aimingAtProjectile = TCastToConstPtr<CGameProjectile>(target);
x9c6_27_aimingAtProjectile = TCastToConstPtr<CGameProjectile>(target.GetPtr());
zeus::CVector3f instantTarget = target->GetAimPosition(mgr, 0.f);
zeus::CVector3f gunToTarget = instantTarget - xf.origin;
float timeToTarget = gunToTarget.magnitude() / x490_gun->GetBeamVelocity();

View File

@ -0,0 +1,50 @@
#include "CScriptPlayerStateChange.hpp"
#include "CStateManager.hpp"
#include "CPlayerState.hpp"
#include "Input/ControlMapper.hpp"
#include "TCastTo.hpp"
namespace urde
{
CScriptPlayerStateChange::CScriptPlayerStateChange(TUniqueId uid, const std::string& name, const CEntityInfo& info,
bool active, u32 itemType, u32 itemCount, u32 itemCapacity,
EControl control, EControlCommandOption controlCmdOpt)
: CEntity(uid, info, active, name)
, x34_itemType(itemType)
, x38_itemCount(itemCount)
, x3c_itemCapacity(itemCapacity)
, x40_ctrl(control)
, x44_ctrlCmdOpt(controlCmdOpt)
{
}
void CScriptPlayerStateChange::Accept(IVisitor& visitor)
{
visitor.Visit(this);
}
void CScriptPlayerStateChange::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId objId, CStateManager& stateMgr)
{
if (GetActive() && msg == EScriptObjectMessage::SetToZero)
{
stateMgr.GetPlayerState()->InitializePowerUp(CPlayerState::EItemType(x34_itemType), x3c_itemCapacity);
stateMgr.GetPlayerState()->IncrPickup(CPlayerState::EItemType(x34_itemType), x38_itemCount);
if (x44_ctrlCmdOpt == EControlCommandOption::Filtered && x40_ctrl == EControl::Filtered)
{
bool filtered = x44_ctrlCmdOpt != EControlCommandOption::Unfiltered;
ControlMapper::SetCommandFiltered(ControlMapper::ECommands::OrbitClose, filtered);
ControlMapper::SetCommandFiltered(ControlMapper::ECommands::OrbitConfirm, filtered);
ControlMapper::SetCommandFiltered(ControlMapper::ECommands::OrbitDown, filtered);
ControlMapper::SetCommandFiltered(ControlMapper::ECommands::OrbitFar, filtered);
ControlMapper::SetCommandFiltered(ControlMapper::ECommands::OrbitLeft, filtered);
ControlMapper::SetCommandFiltered(ControlMapper::ECommands::OrbitObject, filtered);
ControlMapper::SetCommandFiltered(ControlMapper::ECommands::OrbitRight, filtered);
ControlMapper::SetCommandFiltered(ControlMapper::ECommands::OrbitSelect, filtered);
ControlMapper::SetCommandFiltered(ControlMapper::ECommands::OrbitUp, filtered);
}
}
CEntity::AcceptScriptMsg(msg, objId, stateMgr);
}
}

View File

@ -0,0 +1,36 @@
#ifndef __URDE_CSCRIPTPLAYERSTATECHANGE_HPP__
#define __URDE_CSCRIPTPLAYERSTATECHANGE_HPP__
#include "World/CEntity.hpp"
namespace urde
{
class CScriptPlayerStateChange : public CEntity
{
public:
enum class EControl
{
Unfiltered,
Filtered
};
enum class EControlCommandOption
{
Unfiltered,
Filtered
};
private:
u32 x34_itemType;
u32 x38_itemCount;
u32 x3c_itemCapacity;
EControl x40_ctrl;
EControlCommandOption x44_ctrlCmdOpt;
public:
CScriptPlayerStateChange(TUniqueId, const std::string&, const CEntityInfo&, bool, u32, u32, u32, EControl,
EControlCommandOption);
void Accept(IVisitor& visit);
void AcceptScriptMsg(EScriptObjectMessage, TUniqueId, CStateManager&);
};
}
#endif // __URDE_CSCRIPTPLAYERSTATECHANGE_HPP__

View File

@ -266,7 +266,7 @@ void CScriptTrigger::Touch(CActor& act, CStateManager& mgr)
if (pl)
{
if (x148_28_ == false)
if (!x148_28_)
{
x148_28_ = true;
if (x148_29_didPhazonDamage)

View File

@ -2,5 +2,9 @@
namespace urde
{
CScriptWorldTeleporter::CScriptWorldTeleporter(TUniqueId uid, const std::string& name, const CEntityInfo& info,
bool active, u32, u32)
: CEntity(uid, info, active, name)
{
}
}

View File

@ -2,16 +2,44 @@
#define __CSCRIPTWORLDTELEPORTER_HPP__
#include "CEntity.hpp"
#include "zeus/CVector3f.hpp"
namespace urde
{
class CScriptWorldTeleporter
class CScriptWorldTeleporter : public CEntity
{
u32 x34_;
u32 x38_;
u32 x3c_ = 0;
union
{
struct
{
bool x40_24_ : 1;
bool x40_25_ : 1;
bool x40_26_ : 1;
bool x40_27_ : 1;
};
u8 _dummy = 0;
};
float x44_ = 0.1f;
float x48_ = 8.0f;
float x4c_ = 0.0f;
u32 x50_ = -1;
u32 x54_ = -1;
u32 x58_ = 0;
zeus::CVector3f x5c_;
u32 x68_ = -1;
zeus::CVector3f x6c_;
u32 x78_ = -1;
zeus::CVector3f x7c_;
u32 x88_ = -1;
public:
CScriptWorldTeleporter(TUniqueId, const std::string&, const CEntityInfo&, bool, u32, u32);
};
}
#endif // __CSCRIPTWORLDTELEPORTER_HPP__

View File

@ -50,6 +50,7 @@
#include "CScriptActorRotate.hpp"
#include "CScriptSpecialFunction.hpp"
#include "CScriptSwitch.hpp"
#include "CScriptPlayerStateChange.hpp"
#include "CWallCrawlerSwarm.hpp"
#include "CScriptAiJumpPoint.hpp"
#include "CScriptColorModulate.hpp"
@ -1896,7 +1897,19 @@ CEntity* ScriptLoader::LoadSwitch(CStateManager& mgr, CInputStream& in, int prop
CEntity* ScriptLoader::LoadPlayerStateChange(CStateManager& mgr, CInputStream& in, int propCount,
const CEntityInfo& info)
{
return nullptr;
if (!EnsurePropertyCount(propCount, 7, "PlayerStateChange"))
return nullptr;
std::string name = mgr.HashInstanceName(in);
bool active = in.readBool();
s32 itemType = in.readUint32Big();
s32 itemCount = in.readInt32Big();
s32 itemCapacity = in.readInt32Big();
CScriptPlayerStateChange::EControl ctrl = CScriptPlayerStateChange::EControl(in.readUint32Big());
CScriptPlayerStateChange::EControlCommandOption ctrlCmdOpt =
CScriptPlayerStateChange::EControlCommandOption(in.readUint32Big());
return new CScriptPlayerStateChange(mgr.AllocateUniqueId(), name, info, active, itemType, itemCount, itemCapacity,
ctrl, ctrlCmdOpt);
}
CEntity* ScriptLoader::LoadThardus(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)