Various Implementations

This commit is contained in:
Phillip Stephens 2016-11-20 13:53:15 -08:00
parent d733dce1cf
commit 83f3e3d4f1
29 changed files with 454 additions and 67 deletions

View File

@ -251,9 +251,22 @@ bool CStateManager::RenderLast(TUniqueId)
return false;
}
void CStateManager::AddDrawableActorPlane(const CActor& actor, const zeus::CPlane& plane, const zeus::CAABox& aabb) const
{
#if 0
actor.SetAddedToken(x8dc_ + 1);
#endif
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
{
#if 0
actor.SetAddedToken(x8dc_ + 1);
#endif
g_Renderer->AddDrawable(static_cast<const void*>(&actor), vec, aabb, 0,
IRenderer::EDrawableSorting::SortedCallback);
}
void CStateManager::SpecialSkipCinematic()

View File

@ -177,6 +177,7 @@ public:
const std::weak_ptr<CWorldLayerState>&);
bool RenderLast(TUniqueId);
void AddDrawableActorPlane(const CActor& actor, const zeus::CPlane&, const zeus::CAABox& aabb) const;
void AddDrawableActor(const CActor& actor, const zeus::CVector3f& vec, const zeus::CAABox& aabb) const;
void SpecialSkipCinematic();
void GetVisAreaId() const;

View File

@ -140,6 +140,9 @@ public:
const CActorLights* lights, const CModelFlags& drawFlags);
CAnimData* AnimationData() { return x10_animData.get(); }
const TLockedToken<CModel>& GetNormalModel() const { return x1c_normalModel; }
const TLockedToken<CModel>& GetXRayModel() const { return x2c_xrayModel; }
const TLockedToken<CModel>& GetThermalModel() const { return x3c_infraModel; }
bool IsNull() { return !x10_animData && !x1c_normalModel; }
};

View File

@ -29,4 +29,9 @@ void CParticleDatabase::AddToRendererClipped(const zeus::CFrustum& frustum)
{
}
void CParticleDatabase::GetActiveParticleLightIds(std::vector<TUniqueId>&)
{
}
}

View File

@ -14,17 +14,21 @@ class CCharLayoutInfo;
class CParticleDatabase
{
std::map<std::string, std::unique_ptr<CParticleGenInfo>> x3c_;
public:
void CacheParticleDesc(const CCharacterInfo::CParticleResData& desc);
void SetModulationColorAllActiveEffects(const zeus::CColor& color);
void SuspendAllActiveEffects(CStateManager& stateMgr);
void StartEffect(const std::string& name, u32 flags, const CParticleData& data,
const zeus::CVector3f& scale, CStateManager& stateMgr, TAreaId aid, u32 unk1);
void Update(float dt, const CPoseAsTransforms& pose, const CCharLayoutInfo& charInfo,
const zeus::CTransform& xf, const zeus::CVector3f& vec, CStateManager& stateMgr);
void StartEffect(const std::string& name, u32 flags, const CParticleData& data, const zeus::CVector3f& scale,
CStateManager& stateMgr, TAreaId aid, u32 unk1);
void Update(float dt, const CPoseAsTransforms& pose, const CCharLayoutInfo& charInfo, const zeus::CTransform& xf,
const zeus::CVector3f& vec, CStateManager& stateMgr);
void AddToRendererClipped(const zeus::CFrustum& frustum);
void GetActiveParticleLightIds(std::vector<TUniqueId>&);
void GetActiveParticleLightIdsFromParticleDB(
std::vector<TUniqueId>&,
const std::map<std::string, std::unique_ptr<CParticleGenInfo>, std::less<std::string>>&);
};
}
#endif // __URDE_CPARTICLEDATABASE_HPP__

View File

@ -256,7 +256,7 @@ s32 CCollisionResponseData::GetSoundEffectId(EWeaponCollisionResponseTypes type)
EWeaponCollisionResponseTypes CCollisionResponseData::GetWorldCollisionResponseType(s32 id)
{
if (id < 0 || id >= 32)
if (id < 0 || id >= s32(EWeaponCollisionResponseTypes::Unknown32))
return EWeaponCollisionResponseTypes::Default;
return skWorldMaterialTable[id];

View File

@ -19,7 +19,7 @@ enum class EWeaponCollisionResponseTypes
None, Default, Unknown2, Metal,
Grass, Ice, Goo, Wood,
Water, Mud, Lava, Sand,
Unknown12,Unknown13,Unknown14,Unknown15,
Projectile,Unknown13,Unknown14,Unknown15,
EnemyNormal,EnemySpecial,EnemyShielded,Unknown19,
Unknown20,Unknown21,Unknown22,Unknown23,
Unknown24,Unknown25,Unknown26,Unknown27,

View File

@ -61,10 +61,11 @@ void CActor::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateMana
case EScriptObjectMessage::InternalMessage12: // 34
{
RemoveEmitter();
/* TODO: Not sure about this
if (HasModelData() && x64_modelData->AnimationData() && x64_modelData->x28_)
x64_modelData->AnimationData().GetParticleDB().GetActiveParticleLightIds(mgr);
*/
#if 0
if (HasModelData() && x64_modelData->AnimationData() && x64_modelData->GetNormalModel())
x64_modelData->AnimationData()->GetParticleDB().GetActiveParticleLightIds(mgr);
#endif
}
break;
case EScriptObjectMessage::InternalMessage13: // 35
@ -91,9 +92,12 @@ void CActor::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateMana
CEntity::AcceptScriptMsg(msg, uid, mgr);
}
zeus::CAABox CActor::CalculateRenderBounds()
void CActor::CalculateRenderBounds()
{
return {};
if (x64_modelData && (x64_modelData->AnimationData() || x64_modelData->GetNormalModel()))
x9c_aabox = x64_modelData->GetBounds(x34_transform);
else
x9c_aabox = zeus::CAABox(x34_transform.origin, x34_transform.origin);
}
const CHealthInfo* CActor::GetHealthInfo() const
@ -183,7 +187,7 @@ void CActor::OnScanStateChanged(EScanState state, CStateManager& mgr)
}
zeus::CAABox CActor::GetSortingBounds(const zeus::CTransform &) const
zeus::CAABox CActor::GetSortingBounds(const CStateManager &) const
{
return {};
}
@ -311,6 +315,11 @@ void CActor::SetTranslation(const zeus::CVector3f &tr)
xe4_29_ = true;
}
void CActor::SetAddedToken(u32 tok)
{
xcc_addedToken = tok;
}
float CActor::GetPitch() const
{
return zeus::CQuaternion(x34_transform.buildMatrix3f()).pitch();

View File

@ -47,7 +47,7 @@ protected:
TUniqueId xc4_fluidId = kInvalidUniqueId;
TUniqueId xc6_ = kInvalidUniqueId;
s32 xc8_ = -1;
s32 xcc_ = -1;
s32 xcc_addedToken = -1;
float xd0_;
u8 xd4_ = 0x7F;
u32 xd8_ = 2;
@ -97,7 +97,7 @@ public:
virtual void AddToRenderer(const zeus::CFrustum&, const CStateManager&) const {}
virtual void Render(const CStateManager&) const {}
virtual bool CanRenderUnsorted(const CStateManager&) const { return false; }
virtual zeus::CAABox CalculateRenderBounds();
virtual void CalculateRenderBounds();
virtual const CHealthInfo* GetHealthInfo() const;
virtual const CDamageVulnerability* GetDamageVulnerability() const;
virtual const CDamageVulnerability* GetDamageVulnerability(const zeus::CVector3f&, const zeus::CVector3f&, const CDamageInfo&) const;
@ -111,7 +111,7 @@ public:
CWeaponMode&, int);
virtual void FluidFXThink(EFluidState, CScriptWater&, CStateManager&);
virtual void OnScanStateChanged(EScanState, CStateManager&);
virtual zeus::CAABox GetSortingBounds(const zeus::CTransform&) const;
virtual zeus::CAABox GetSortingBounds(const CStateManager&) const;
virtual void DoUserAnimEvent(CStateManager&, CInt32POINode&, EUserEventType);
@ -140,7 +140,7 @@ public:
const CSfxHandle* GetSfxHandle() const;
void SetSfxPitchBend(s32);
void SetTranslation(const zeus::CVector3f& tr);
void SetAddedToken(u32 tok);
float GetPitch() const;
float GetYaw() const;
};

View File

@ -0,0 +1,13 @@
#include "CFluidPlane.hpp"
namespace urde
{
CFluidPlane::CFluidPlane(u32, u32, u32, EFluidType, float, const urde::CFluidUVMotion&, float)
{
}
void CFluidPlane::Update()
{
}
}

View File

@ -1,13 +1,44 @@
#ifndef __URDE_CFLUIDPLANE_HPP__
#define __URDE_CFLUIDPLANE_HPP__
#include "RetroTypes.hpp"
namespace urde
{
class CFluidUVMotion;
class CRippleManager;
class CFluidPlane
{
public:
enum class EFluidType
{};
{
Zero,
One,
Two,
Three,
Four,
Five
};
private:
u32 x4_;
u32 x8_;
u32 xc_;
float x40_;
EFluidType x44_;
float x48_;
public:
CFluidPlane(u32, u32, u32, EFluidType, float, const CFluidUVMotion&, float);
virtual void Update();
float GetAlpha() const;
EFluidType GetFluidType() const;
const CFluidUVMotion& GetUVMotion() const;
void GetColorTexture() const;
bool HasColorTexture() const;
void GetTexturePattern1() const;
bool HasTexturePattern1() const;
void GetTexturePattern2() const;
bool HasTexturePattern2() const;
};
}

View File

@ -0,0 +1,13 @@
#include "CFluidPlaneCPU.hpp"
namespace urde
{
CFluidPlaneCPU::CFluidPlaneCPU(u32 w1, u32 w2, u32 w3, u32 w4, u32 w5, u32 w6, float f1, u32 w7, u32 w8,
EFluidType fluidType, float f2, const zeus::CVector3f& v1, float f3,
const urde::CFluidUVMotion& motion, float f4, float f5, float f6, float f7, float f8,
float f9, float f10, float f11, float f12, float f13, float f14, float f15, float f16,
float f17)
: CFluidPlane(w1, w2, w3, fluidType, f3, motion, f17)
{
}
}

View File

@ -0,0 +1,18 @@
#ifndef __URDE_CFLUIDPLANECPU_HPP__
#define __URDE_CFLUIDPLANECPU_HPP__
#include "CFluidPlane.hpp"
namespace urde
{
class CFluidUVMotion;
class CFluidPlaneCPU : public CFluidPlane
{
public:
CFluidPlaneCPU(u32, u32, u32, u32, u32, u32, float, u32, u32, EFluidType, float, const zeus::CVector3f&,
float, const CFluidUVMotion&, float, float, float, float, float, float, float, float, float, float,
float, float, float, float);
};
}
#endif // __URDE_CFLUIDPLANECPU_HPP__

View File

View File

View File

@ -54,6 +54,7 @@ set(WORLD_SOURCES
CScriptSound.hpp CScriptSound.cpp
CScriptGenerator.hpp CScriptGenerator.cpp
CScriptDock.hpp CScriptDock.cpp
CScriptActorKeyframe.hpp CScriptActorKeyframe.cpp
CScriptWater.hpp CScriptWater.cpp
CScriptGrapplePoint.hpp CScriptGrapplePoint.cpp
CScriptAreaAttributes.hpp CScriptAreaAttributes.cpp
@ -91,6 +92,10 @@ set(WORLD_SOURCES
CHUDMemoParms.hpp CHUDMemoParms.cpp
CWorldShadow.hpp CWorldShadow.cpp
CGameLight.hpp CGameLight.cpp
CFluidPlane.hpp)
CFluidPlane.hpp CFluidPlane.cpp
CFluidPlaneCPU.hpp CFluidPlaneCPU.cpp
CFluidPlaneDoor.hpp CFluidPlaneDoor.cpp
CRippleManager.hpp CRippleManager.cpp
CRipple.hpp CRipple.cpp)
runtime_add_list(World WORLD_SOURCES)

View File

@ -169,9 +169,8 @@ void CPlayer::PreRender(CStateManager& mgr, const zeus::CFrustum&)
{
}
zeus::CAABox CPlayer::CalculateRenderBounds()
void CPlayer::CalculateRenderBounds()
{
return {};
}
void CPlayer::AddToRenderer(const zeus::CFrustum&, CStateManager&)

View File

@ -215,7 +215,7 @@ public:
void Render(CStateManager& mgr) const;
void RenderReflectedPlayer(CStateManager& mgr) const;
void PreRender(CStateManager& mgr, const zeus::CFrustum&);
zeus::CAABox CalculateRenderBounds();
void CalculateRenderBounds();
void AddToRenderer(const zeus::CFrustum&, CStateManager&);
void ComputeFreeLook(const CFinalInput& input);
void UpdateFreeLook(float dt);

View File

@ -0,0 +1,7 @@
#include "CRipple.hpp"
namespace urde
{
CRipple::CRipple(TUniqueId, const zeus::CVector3f&, float)
{
}
}

35
Runtime/World/CRipple.hpp Normal file
View File

@ -0,0 +1,35 @@
#ifndef __URDE_CRIPPLE_HPP__
#define __URDE_CRIPPLE_HPP__
#include "RetroTypes.hpp"
#include "zeus/CVector3f.hpp"
namespace urde
{
class CRipple
{
private:
TUniqueId x0_;
float x4_ = 0.f;
zeus::CVector3f x8_;
float x14_ = 2.f;
float x18_ = 12.f;
float x1c_ = 3.f;
float x20_ = 0.25f;
float x24_ = 0.00098039221f;
public:
CRipple(TUniqueId, const zeus::CVector3f&, float);
void SetTime(float);
float GetTime() const;
float GetTimeFalloff() const;
TUniqueId GetUniqueId() const;
float GetFequency() const;
float GetAmplitude() const;
float GetOODistanceFalloff() const;
float GetDistanceFalloff() const;
zeus::CVector3f GetCenter() const;
float GetOOTimeFalloff() const;
};
}
#endif // __URDE_CRIPPLE_HPP__

View File

View File

View File

@ -0,0 +1,33 @@
#include "CScriptActorKeyframe.hpp"
namespace urde
{
CScriptActorKeyframe::CScriptActorKeyframe(TUniqueId uid, const std::string& name, const CEntityInfo& info, s32 animId,
bool b1, float f1, bool b2, u32 w2, bool active, float totalPlayback)
: CEntity(uid, info, active, name),
x34_animationId(animId),
x38_(f1),
x3c_(totalPlayback),
x40_(f1),
x44_24_(b1),
x44_25_(b2),
x44_26_(w2)
{
}
void CScriptActorKeyframe::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId objId, CStateManager& stateMgr)
{
}
void CScriptActorKeyframe::Think(float dt, CStateManager& mgr)
{
if (x44_25_)
;
}
void CScriptActorKeyframe::UpdateEntity(TUniqueId, CStateManager&)
{
}
}

View File

@ -0,0 +1,38 @@
#ifndef __URDE_CSCRIPTACTORKEYFRAME_HPP__
#define __URDE_CSCRIPTACTORKEYFRAME_HPP__
#include "CEntity.hpp"
namespace urde
{
class CScriptActorKeyframe : public CEntity
{
private:
s32 x34_animationId;
float x38_;
float x3c_;
float x40_;
union
{
struct
{
bool x44_24_ : 1;
bool x44_25_ : 1;
bool x44_26_ : 1;
bool x44_27_ : 1;
bool x44_28_ : 1;
bool x44_29_ : 1;
};
u8 _dummy = 0;
};
public:
CScriptActorKeyframe(TUniqueId uid, const std::string& name, const CEntityInfo& info, s32 w1, bool b1, float f1,
bool b2, u32 w2, bool active, float f2);
void AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId objId, CStateManager& stateMgr);
void Think(float, CStateManager &);
void UpdateEntity(TUniqueId, CStateManager&);
};
}
#endif // __URDE_CSCRIPTACTORKEYFRAME_HPP__

View File

@ -10,7 +10,7 @@ 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,
u32 triggerFlags, bool active, bool b2, bool b3)
ETriggerFlags triggerFlags, bool active, bool b2, bool b3)
: CActor(uid, active, name, info, zeus::CTransform::Translate(pos), CModelData::CModelDataNull(),
CMaterialList(EMaterialTypes::ThirtyFour), CActorParameters::None(), kInvalidUniqueId),
x100_damageInfo(dInfo),
@ -25,9 +25,8 @@ CScriptTrigger::CScriptTrigger(TUniqueId uid, const std::string& name, const CEn
CScriptTrigger::CObjectTracker* CScriptTrigger::FindInhabitant(TUniqueId id)
{
const auto& iter = std::find_if(xe8_inhabitants.begin(), xe8_inhabitants.end(), [&id](CObjectTracker& tr)->bool{
return tr.GetObjectId() == id;
});
const auto& iter = std::find(xe8_inhabitants.begin(), xe8_inhabitants.end(), id);
if (iter != xe8_inhabitants.end())
return &(*iter);
return nullptr;

View File

@ -6,30 +6,54 @@
namespace urde
{
// TODO - Phil: Figure out what each of the DetectProjectiles actually mean
enum class ETriggerFlags : u32
{
DetectPlayer = (1 << 0),
DetectAI = (1 << 1),
DetectProjectiles1 = (1 << 2),
DetectProjectiles2 = (1 << 3),
DetectProjectiles3 = (1 << 4),
DetectProjectiles4 = (1 << 5),
DetectBombs = (1 << 6),
Unknown1 = (1 << 7),
DetectProjectiles5 = (1 << 8),
DetectProjectiles6 = (1 << 9),
DetectProjectiles7 = (1 << 10),
KillOnEnter = (1 << 11),
DetectMorphedPlayer = (1 << 12),
ApplyForce = (1 << 13),
DetectPlayerIfInside = (1 << 14),
Unknown2 = (1 << 15),
DetectUnmorphedPlayer = (1 << 16),
BlockEnvironmentalEffects = (1 << 17)
};
ENABLE_BITWISE_ENUM(ETriggerFlags)
class CScriptTrigger : public CActor
{
public:
class CObjectTracker
{
TUniqueId x0_id;
public:
CObjectTracker(TUniqueId id)
: x0_id(id)
{}
CObjectTracker(TUniqueId id) : x0_id(id) {}
TUniqueId GetObjectId() const { return x0_id; }
bool operator==(const CObjectTracker& other) { return x0_id == other.x0_id; }
};
private:
std::list<CObjectTracker> xe8_inhabitants; /* Used to be CObjectTracker */
protected:
std::list<CObjectTracker> xe8_inhabitants;
CDamageInfo x100_damageInfo;
zeus::CVector3f x11c_forceField;
float x128_forceMagnitude;
u32 x12c_flags;
ETriggerFlags x12c_flags;
zeus::CAABox x130_bounds;
union
{
union {
struct
{
bool x148_24_ : 1;
@ -41,11 +65,11 @@ private:
};
u8 dummy = 0;
};
public:
CScriptTrigger(TUniqueId, const std::string& name, const CEntityInfo& info,
const zeus::CVector3f& pos, const zeus::CAABox&,
const CDamageInfo& dInfo, const zeus::CVector3f& orientedForce,
u32 triggerFlags, bool, bool, bool);
CScriptTrigger(TUniqueId, const std::string& name, const CEntityInfo& info, const zeus::CVector3f& pos,
const zeus::CAABox&, const CDamageInfo& dInfo, const zeus::CVector3f& orientedForce,
ETriggerFlags triggerFlags, bool, bool, bool);
virtual void InhabitantRejected(CActor&, CStateManager&) {}
virtual void InhabitantExited(CActor&, CStateManager&) {}
@ -57,7 +81,6 @@ public:
rstl::optional_object<zeus::CAABox> GetTouchBounds() const;
zeus::CAABox GetTriggerBoundsWR() const;
};
}
#endif // __URDE_CSCRIPTTRIGGER_HPP__

View File

@ -4,18 +4,86 @@
namespace urde
{
CScriptWater::CScriptWater(CStateManager& mgr, TUniqueId uid, const std::string& name,
const CEntityInfo& info, const zeus::CVector3f& pos, const zeus::CAABox& box,
const urde::CDamageInfo& dInfo, zeus::CVector3f& orientedForce, u32 triggerFlags,
bool b1, bool b2, ResId, ResId, ResId, ResId, ResId, ResId, ResId,
const zeus::CVector3f&, float, float, float, bool active, CFluidPlane::EFluidType,
bool, float, const CFluidUVMotion&,
float, float, float, float, float, float, float, float,
const zeus::CColor&, const zeus::CColor&, ResId, ResId, ResId, ResId,
ResId, s32, s32, s32, s32, s32, float, u32, float, float, float, float, float, float, float, float,
const zeus::CColor&, urde::ResId, float, float, float, u32, u32, bool, s32, s32, const u32*)
: CScriptTrigger(uid, name, info, pos, box, dInfo, orientedForce, triggerFlags, active, false, false)
const float CScriptWater::kSplashScales[6] =
{
1.0f, 3.0f, 0.709f,
1.19f, 0.709f, 1.f
};
CScriptWater::CScriptWater(CStateManager& mgr, TUniqueId uid, const std::string& name, const CEntityInfo& info,
const zeus::CVector3f& pos, const zeus::CAABox& box, const urde::CDamageInfo& dInfo,
zeus::CVector3f& orientedForce, ETriggerFlags triggerFlags, bool b1, bool b2, ResId, ResId, ResId,
ResId, ResId, ResId, ResId, const zeus::CVector3f&, float, float, float, bool active,
CFluidPlane::EFluidType, bool, float, const CFluidUVMotion&, float, float, float, float,
float, float, float, float, const zeus::CColor&, const zeus::CColor&, ResId, ResId, ResId,
ResId, ResId, s32, s32, s32, s32, s32, float, u32, float, float, float, float, float, float,
float, float, const zeus::CColor&, urde::ResId, float, float, float, u32, u32, bool, s32,
s32, const u32*)
: CScriptTrigger(uid, name, info, pos, box, dInfo, orientedForce, triggerFlags, active, false, false)
{
}
void CScriptWater::Think(float dt, CStateManager& mgr) { CScriptTrigger::Think(dt, mgr); }
void CScriptWater::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId other, CStateManager& mgr)
{
CScriptTrigger::AcceptScriptMsg(msg, other, mgr);
}
void CScriptWater::PreRender(const zeus::CFrustum&, const CStateManager&) {}
void CScriptWater::AddToRenderer(const zeus::CFrustum& /*frustum*/, const CStateManager& mgr) const
{
zeus::CPlane plane;
plane.vec = x34_transform.origin.normalized();
plane.d = x34_transform.origin.z + x130_bounds.max.z;
zeus::CAABox renderBounds = GetSortingBounds(mgr);
mgr.AddDrawableActorPlane(*this, plane, renderBounds);
}
void CScriptWater::Render(const CStateManager&) const {}
void CScriptWater::Touch(CActor&, CStateManager&)
{
}
void CScriptWater::CalculateRenderBounds()
{
}
zeus::CAABox CScriptWater::GetSortingBounds(const CStateManager&) const
{
}
EWeaponCollisionResponseTypes CScriptWater::GetCollisionResponseType(const zeus::CVector3f&, const zeus::CVector3f&, CWeaponMode&, int)
{
return EWeaponCollisionResponseTypes::Water;
}
s16 CScriptWater::GetSplashSound(float dt) const
{
return x29c_splashSounds[GetSplashIndex(dt)];
}
const TLockedToken<CParticleGen>& CScriptWater::GetSplashEffect(float dt) const
{
return x268_splashEffects[GetSplashIndex(dt)];
}
float CScriptWater::GetSplashEffectScale(float dt) const
{
if (std::fabs(dt - 1.f) < 0.0000099999997)
return kSplashScales[5];
u32 idx = GetSplashIndex(dt);
float s = dt - zeus::floorF(dt * 3.f);
return ((1.f - s) * (s * kSplashScales[idx * 2])) + kSplashScales[idx];
}
u32 CScriptWater::GetSplashIndex(float dt) const
{
u32 idx = dt * 3.f;
return (idx < 3 ? idx : idx - 1);
}
}

View File

@ -2,8 +2,7 @@
#define __URDE_CSCRIPTWATER_HPP__
#include "CScriptTrigger.hpp"
#include "CFluidPlane.hpp"
#include "CFluidPlaneCPU.hpp"
namespace urde
{
@ -12,17 +11,69 @@ class CFluidUVMotion;
class CScriptWater : public CScriptTrigger
{
private:
static const float kSplashScales[6];
u32 x150_ = 0;
std::unique_ptr<CFluidPlaneCPU> x1b4_;
zeus::CVector3f x1b8_;
float x1f4_;
float x1f8_ = 0.f;
zeus::CVector3f x1d4_;
std::vector<std::pair<TUniqueId, bool>> x200_waterInhabitants;
u32 x210_;
float x214_;
float x218_;
float x21c_;
float x220_;
float x224_;
zeus::CColor x228_;
u32 x22c_;
u32 x230_;
u32 x234_;
u32 x238_;
u32 x248_;
u32 x24c_;
bool x25c_;
s16 x260_;
s16 x262_;
u32 x264_ = 0;
TLockedToken<CParticleGen> x268_splashEffects[5];
s16 x29c_splashSounds[5];
public:
CScriptWater(CStateManager &,TUniqueId, const std::string& name, const CEntityInfo&, const zeus::CVector3f&,
const zeus::CAABox&, CDamageInfo const &, zeus::CVector3f&, u32, bool, bool,
ResId, ResId, ResId, ResId, ResId, ResId, ResId,
const zeus::CVector3f&, float, float, float, bool, CFluidPlane::EFluidType, bool, float, const CFluidUVMotion&,
float, float, float, float, float, float, float, float, const zeus::CColor&, const zeus::CColor&,
ResId, ResId, ResId, ResId, ResId, s32, s32, s32, s32, s32,
float, u32, float, float, float, float, float, float, float, float,
const zeus::CColor&, ResId, float, float, float, u32, u32, bool, s32, s32, const u32*);
};
CScriptWater(CStateManager&, TUniqueId, const std::string& name, const CEntityInfo&, const zeus::CVector3f&,
const zeus::CAABox&, CDamageInfo const&, zeus::CVector3f&, ETriggerFlags, bool, bool, ResId, ResId, ResId, ResId,
ResId, ResId, ResId, const zeus::CVector3f&, float, float, float, bool, CFluidPlane::EFluidType, bool,
float, const CFluidUVMotion&, float, float, float, float, float, float, float, float,
const zeus::CColor&, const zeus::CColor&, ResId, ResId, ResId, ResId, ResId, s32, s32, s32, s32, s32,
float, u32, float, float, float, float, float, float, float, float, const zeus::CColor&, ResId, float,
float, float, u32, u32, bool, s32, s32, const u32*);
void Think(float, CStateManager&);
void AcceptScriptMsg(EScriptObjectMessage, TUniqueId, CStateManager&);
void PreRender(const zeus::CFrustum&, const CStateManager&);
void AddToRenderer(const zeus::CFrustum&, const CStateManager&) const;
void Render(const CStateManager&) const;
void Touch(CActor &, CStateManager &);
void CalculateRenderBounds();
zeus::CAABox GetSortingBounds(const CStateManager&) const;
void RenderSurface();
EWeaponCollisionResponseTypes GetCollisionResponseType(const zeus::CVector3f&, const zeus::CVector3f&, CWeaponMode&,
int);
void UpdateSplashInhabitants(CStateManager&);
s16 GetSplashSound(float) const;
const TLockedToken<CParticleGen>& GetSplashEffect(float) const;
float GetSplashEffectScale(float) const;
u32 GetSplashIndex(float) const;
void FluidPlane();
zeus::CPlane GetWRSurfacePlane() const;
float GetSurfaceZ() const;
bool IsMorphing() const;
void SetMorphing(bool);
zeus::CColor GetSplashColor() const;
void SetFrustumPlanes(const zeus::CFrustum& frustum);
const zeus::CFrustum& GetFrustumPlanes() const;
};
}
#endif // __URDE_CSCRIPTWATER_HPP__

View File

@ -19,6 +19,7 @@
#include "CScriptTimer.hpp"
#include "CScriptCounter.hpp"
#include "CScriptDock.hpp"
#include "CScriptActorKeyframe.hpp"
#include "CScriptWater.hpp"
#include "CScriptEffect.hpp"
#include "CScriptPlatform.hpp"
@ -503,8 +504,8 @@ CEntity* ScriptLoader::LoadTrigger(CStateManager& mgr, CInputStream& in, int pro
zeus::CVector3f forceVec;
forceVec.readBig(in);
u32 w1 = in.readUint32Big();
bool b1 = in.readBool();
ETriggerFlags flags = ETriggerFlags(in.readUint32Big());
bool active = in.readBool();
bool b2 = in.readBool();
bool b3 = in.readBool();
@ -513,7 +514,7 @@ CEntity* ScriptLoader::LoadTrigger(CStateManager& mgr, CInputStream& in, int pro
const zeus::CTransform& areaXf = mgr.GetWorld()->GetGameAreas()[info.GetAreaId()]->GetTransform();
zeus::CVector3f orientedForce = areaXf.basis * forceVec;
return new CScriptTrigger(mgr.AllocateUniqueId(), *name, info, position, box, dInfo, orientedForce, w1, b1, b2, b3);
return new CScriptTrigger(mgr.AllocateUniqueId(), *name, info, position, box, dInfo, orientedForce, flags, active, b2, b3);
}
CEntity* ScriptLoader::LoadTimer(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
@ -1141,7 +1142,21 @@ CEntity* ScriptLoader::LoadCameraShaker(CStateManager& mgr, CInputStream& in, in
CEntity* ScriptLoader::LoadActorKeyframe(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
{
return nullptr;
if (!EnsurePropertyCount(propCount, 7, "ActorKeyframe"))
return nullptr;
const std::string* name = mgr.HashInstanceName(in);
s32 w1 = in.readInt32Big();
bool b1 = in.readBool();
float f1 = in.readFloatBig();
bool active = in.readBool();
u32 w2 = in.readUint32Big();
float f2 = in.readFloatBig();
if (w1 == -1)
return nullptr;
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)
@ -1157,7 +1172,11 @@ CEntity* ScriptLoader::LoadWater(CStateManager& mgr, CInputStream& in, int propC
CDamageInfo dInfo(in);
zeus::CVector3f orientedForce;
orientedForce.readBig(in);
u32 triggerFlags = in.readUint32Big() | 2044;
ETriggerFlags triggerFlags = ETriggerFlags(in.readUint32Big()) | ETriggerFlags::DetectProjectiles1 |
ETriggerFlags::DetectProjectiles2 | ETriggerFlags::DetectProjectiles3 |
ETriggerFlags::DetectProjectiles4 | ETriggerFlags::DetectBombs |
ETriggerFlags::Unknown1 | ETriggerFlags::DetectProjectiles5 |
ETriggerFlags::DetectProjectiles6 | ETriggerFlags::DetectProjectiles7;
bool b1 = in.readBool();
bool displaySurface = in.readBool();
ResId textureId1 = in.readUint32Big();