diff --git a/Runtime/Collision/CMaterialList.hpp b/Runtime/Collision/CMaterialList.hpp index 5ad38ad38..95666e03c 100644 --- a/Runtime/Collision/CMaterialList.hpp +++ b/Runtime/Collision/CMaterialList.hpp @@ -27,6 +27,7 @@ enum class EMaterialTypes FourtyOne = 41, FourtyTwo = 42, FourtyThree = 43, + FourtyFour = 44, FourtyEight = 48, FourtyNine = 49, Fifty = 50, diff --git a/Runtime/World/CMakeLists.txt b/Runtime/World/CMakeLists.txt index 3aec90969..eadd6fcd3 100644 --- a/Runtime/World/CMakeLists.txt +++ b/Runtime/World/CMakeLists.txt @@ -42,7 +42,9 @@ set(WORLD_SOURCES CScriptRelay.hpp CScriptRelay.cpp CScriptHUDMemo.hpp CScriptHUDMemo.cpp CScriptCameraFilterKeyframe.hpp CScriptCameraFilterKeyframe.cpp + CScriptCameraBlurKeyframe.hpp CScriptCameraBlurKeyframe.cpp CScriptDamageableTrigger.hpp CScriptDamageableTrigger.cpp + CScriptDebris.hpp CScriptDebris.cpp CScriptActorRotate.hpp CScriptActorRotate.cpp CScriptSpecialFunction.hpp CScriptSpecialFunction.cpp CGrappleParameters.hpp diff --git a/Runtime/World/CScriptCameraBlurKeyframe.cpp b/Runtime/World/CScriptCameraBlurKeyframe.cpp new file mode 100644 index 000000000..0a4d06794 --- /dev/null +++ b/Runtime/World/CScriptCameraBlurKeyframe.cpp @@ -0,0 +1,10 @@ +#include "CScriptCameraBlurKeyframe.hpp" + +namespace urde +{ +CScriptCameraBlurKeyframe::CScriptCameraBlurKeyframe(TUniqueId uid, const std::string& name, const CEntityInfo& info, + u32, float, u32, float, float, bool active) + : CEntity(uid, info, active, name) +{ +} +} diff --git a/Runtime/World/CScriptCameraBlurKeyframe.hpp b/Runtime/World/CScriptCameraBlurKeyframe.hpp new file mode 100644 index 000000000..156412d00 --- /dev/null +++ b/Runtime/World/CScriptCameraBlurKeyframe.hpp @@ -0,0 +1,15 @@ +#ifndef __URDE_CSCRIPTCAMERABLURKEYFRAME__ +#define __URDE_CSCRIPTCAMERABLURKEYFRAME__ + +#include "CEntity.hpp" + +namespace urde +{ +class CScriptCameraBlurKeyframe : public CEntity +{ +public: + CScriptCameraBlurKeyframe(TUniqueId, const std::string&, const CEntityInfo&, u32, float, u32, float, float, bool); +}; +} + +#endif // __URDE_CSCRIPTCAMERABLURKEYFRAME__ diff --git a/Runtime/World/CScriptDebris.cpp b/Runtime/World/CScriptDebris.cpp new file mode 100644 index 000000000..85d5fb989 --- /dev/null +++ b/Runtime/World/CScriptDebris.cpp @@ -0,0 +1,29 @@ +#include "CScriptDebris.hpp" + +namespace urde +{ + +CScriptDebris::CScriptDebris(TUniqueId uid, const std::string& name, const CEntityInfo& info, const zeus::CTransform& xf, + CModelData&& mData, const CActorParameters& aParams, ResId, const zeus::CVector3f&, float, + const zeus::CVector3f&, const zeus::CColor&, float f1, float f2, float f3, + CScriptDebris::EScaleType, bool, bool, bool active) + : CPhysicsActor(uid, active, name, info, xf, std::move(mData), + CMaterialList(EMaterialTypes::Nineteen, EMaterialTypes::FourtyFour), + mData.GetBounds(xf.getRotation()), SMoverData(f2), aParams, 0.3, 0.1) +{ + +} + +#if 0 +CScriptDebris::CScriptDebris(TUniqueId, const std::string&, const CEntityInfo&, const zeus::CTransform&, CModelData&&, + const CActorParameters&, float, float, float, float, float, float, float, float, float, + const zeus::CColor&, const zeus::CColor&, float, const zeus::CVector3f&, const zeus::CVector3f&, + float, float, const zeus::CVector3f&, u32, const zeus::CVector3f&, bool, bool, + CScriptDebris::EOrientationType, u32, const zeus::CVector3f&, bool, bool, + CScriptDebris::EOrientationType, u32, const zeus::CVector3f&, CScriptDebris::EOrientationType, + bool, bool, bool) +{ +} +#endif + +} diff --git a/Runtime/World/CScriptDebris.hpp b/Runtime/World/CScriptDebris.hpp new file mode 100644 index 000000000..f433c6c99 --- /dev/null +++ b/Runtime/World/CScriptDebris.hpp @@ -0,0 +1,36 @@ +#ifndef __URDE_CSCRIPTDEBRIS_HPP__ +#define __URDE_CSCRIPTDEBRIS_HPP__ + +#include "CPhysicsActor.hpp" + +namespace urde +{ +class CScriptDebris : public CPhysicsActor +{ +public: + enum class EScaleType + { + }; + + enum class EOrientationType + { + }; + +private: + //TReservedAverage x2e0_; +public: + CScriptDebris(TUniqueId, const std::string&, const CEntityInfo&, const zeus::CTransform&, CModelData&&, + const CActorParameters&, ResId, const zeus::CVector3f&, float, const zeus::CVector3f&, + const zeus::CColor&, float, float, float, EScaleType, bool, bool, bool); +#if 0 + CScriptDebris(TUniqueId, const std::string&, const CEntityInfo&, const zeus::CTransform&, CModelData&&, + const CActorParameters&, float, float, float, float, float, float, float, float, float, + const zeus::CColor&, const zeus::CColor&, float, const zeus::CVector3f&, const zeus::CVector3f&, + float, float, const zeus::CVector3f&, u32, const zeus::CVector3f&, bool, bool, EOrientationType, u32, + const zeus::CVector3f&, bool, bool, EOrientationType, u32, const zeus::CVector3f&, EOrientationType, + bool, bool, bool); +#endif +}; +} + +#endif // __URDE_CSCRIPTDEBRIS_HPP__ diff --git a/Runtime/World/ScriptLoader.cpp b/Runtime/World/ScriptLoader.cpp index 913d043c9..b7b9cf834 100644 --- a/Runtime/World/ScriptLoader.cpp +++ b/Runtime/World/ScriptLoader.cpp @@ -36,7 +36,9 @@ #include "CScriptRelay.hpp" #include "CScriptHUDMemo.hpp" #include "CScriptCameraFilterKeyframe.hpp" +#include "CScriptCameraBlurKeyframe.hpp" #include "CScriptDamageableTrigger.hpp" +#include "CScriptDebris.hpp" #include "CScriptActorRotate.hpp" #include "CScriptSpecialFunction.hpp" #include "Camera/CCinematicCamera.hpp" @@ -1050,7 +1052,18 @@ CEntity* ScriptLoader::LoadCameraFilterKeyframe(CStateManager& mgr, CInputStream CEntity* ScriptLoader::LoadCameraBlurKeyframe(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { - return nullptr; + if (!EnsurePropertyCount(propCount, 7, "CameraBlurKeyframe")) + return nullptr; + + const std::string* name = mgr.HashInstanceName(in); + bool active = in.readBool(); + u32 w1 = in.readUint32Big(); + float f1 = in.readFloatBig(); + u32 w2 = in.readUint32Big(); + float f2 = in.readFloatBig(); + float f3 = in.readFloatBig(); + + return new CScriptCameraBlurKeyframe(mgr.AllocateUniqueId(), *name, info, w1, f1, w2, f2, f3, active); } u32 ClassifyVector(const zeus::CVector3f& dir) @@ -1073,7 +1086,7 @@ u32 ClassifyVector(const zeus::CVector3f& dir) u32 TransformDamagableTriggerFlags(CStateManager& mgr, TAreaId aId, u32 flags) { - CGameArea* area = mgr.GetWorld()->GetGameAreas().at(aId).get(); + CGameArea* area = mgr.GetWorld()->GetGameAreas().at(u32(aId)).get(); zeus::CTransform rotation = area->GetTransform().getRotation(); u32 ret = 0; @@ -1119,7 +1132,30 @@ CEntity* ScriptLoader::LoadDamageableTrigger(CStateManager& mgr, CInputStream& i CEntity* ScriptLoader::LoadDebris(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { - return nullptr; + if (!EnsurePropertyCount(propCount, 18, "Debris")) + return nullptr; + + SScaledActorHead head = LoadScaledActorHead(in, mgr); + float f1 = in.readFloatBig(); + zeus::CVector3f v1 = zeus::CVector3f::ReadBig(in); + zeus::CColor color; + color.readRGBABig(in); + float f2 = in.readFloatBig(); + float f3 = in.readFloatBig(); + float f4 = in.readFloatBig(); + CScriptDebris::EScaleType scaleType = CScriptDebris::EScaleType(in.readUint32Big()); + bool b1 = in.readBool(); + ResId model = in.readUint32Big(); + CActorParameters aParams = LoadActorParameters(in); + ResId w3 = in.readUint32Big(); + zeus::CVector3f v2 = zeus::CVector3f::ReadBig(in); + bool b2 = in.readBool(); + bool b3 = in.readBool(); + + if (!g_ResFactory->GetResourceTypeById(model)) + return nullptr; + return new CScriptDebris(mgr.AllocateUniqueId(), head.x0_name, info, head.x10_transform, CStaticRes(model, head.x40_scale), + aParams, w3, v2, f1, v1, color, f2, f3, f4, scaleType, b2, b1, b3); } CEntity* ScriptLoader::LoadCameraShaker(CStateManager& mgr, CInputStream& in, @@ -1243,7 +1279,7 @@ CEntity* ScriptLoader::LoadWater(CStateManager& mgr, CInputStream& in, 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, heatWaveHeight, heatWaveSpeed, heatWaveColor, lightmap, f22, f23, f24, - w21, w22, b5, bitVal0, bitVal0, bitset); + w21, w22, b5, bitVal0, bitVal1, bitset); } CEntity* ScriptLoader::LoadWarWasp(CStateManager& mgr, CInputStream& in,