From 27bee1cc35d839456997121a4879f11f4e76a431 Mon Sep 17 00:00:00 2001 From: Phillip Stephens Date: Fri, 20 May 2016 02:17:51 -0700 Subject: [PATCH] More loader imps --- Runtime/MP1/CBeetle.hpp | 4 ++- Runtime/World/CDamageInfo.cpp | 12 ++++++++ Runtime/World/CDamageInfo.hpp | 12 +++++--- Runtime/World/CHUDMemoParms.cpp | 1 + Runtime/World/CHUDMemoParms.hpp | 22 +++++++++++++++ Runtime/World/CMakeLists.txt | 3 ++ Runtime/World/CScriptCameraFilterKeyframe.cpp | 11 ++++++++ Runtime/World/CScriptCameraFilterKeyframe.hpp | 25 +++++++++++++++++ Runtime/World/CScriptHUDMemo.cpp | 12 ++++++++ Runtime/World/CScriptHUDMemo.hpp | 25 +++++++++++++++++ Runtime/World/ScriptLoader.cpp | 28 +++++++++++++++++++ 11 files changed, 150 insertions(+), 5 deletions(-) create mode 100644 Runtime/World/CDamageInfo.cpp create mode 100644 Runtime/World/CHUDMemoParms.cpp create mode 100644 Runtime/World/CHUDMemoParms.hpp create mode 100644 Runtime/World/CScriptCameraFilterKeyframe.cpp create mode 100644 Runtime/World/CScriptCameraFilterKeyframe.hpp create mode 100644 Runtime/World/CScriptHUDMemo.cpp create mode 100644 Runtime/World/CScriptHUDMemo.hpp diff --git a/Runtime/MP1/CBeetle.hpp b/Runtime/MP1/CBeetle.hpp index 32b8c4bb3..3c61b434b 100644 --- a/Runtime/MP1/CBeetle.hpp +++ b/Runtime/MP1/CBeetle.hpp @@ -12,8 +12,10 @@ namespace MP1 class CBeetle : public CPatterned { public: - enum EEntranceType + enum class EEntranceType : u32 { + FacePlayer, + UseOrientation }; private: public: diff --git a/Runtime/World/CDamageInfo.cpp b/Runtime/World/CDamageInfo.cpp new file mode 100644 index 000000000..223888583 --- /dev/null +++ b/Runtime/World/CDamageInfo.cpp @@ -0,0 +1,12 @@ +#include "CDamageInfo.hpp" +#include "CDamageVulnerability.hpp" + +namespace urde +{ + +float CDamageInfo::GetRadiusDamage(const CDamageVulnerability& dVuln) +{ + return 0.f; +} + +} diff --git a/Runtime/World/CDamageInfo.hpp b/Runtime/World/CDamageInfo.hpp index 966ea2307..b707a9719 100644 --- a/Runtime/World/CDamageInfo.hpp +++ b/Runtime/World/CDamageInfo.hpp @@ -7,6 +7,7 @@ namespace urde { +class CDamageVulnerability; class CDamageInfo { EWeaponType x0_type = EWeaponType::None; @@ -20,8 +21,8 @@ class CDamageInfo }; u8 _dummy = 0; }; - float x8_damage1; - float xc_damage2; + float x8_damage; + float xc_radiusDamage; float x10_radius; float x14_knockback; bool x18_ = false; @@ -31,11 +32,14 @@ public: { in.readUint32Big(); x0_type = EWeaponType(in.readUint32Big()); - x8_damage1 = in.readFloatBig(); - xc_damage2 = x8_damage1; + x8_damage = in.readFloatBig(); + xc_radiusDamage = x8_damage; x10_radius = in.readFloatBig(); x14_knockback = in.readFloatBig(); } + + float GetRadiusDamage() const { return xc_radiusDamage; } + float GetRadiusDamage(const CDamageVulnerability& dVuln); }; } diff --git a/Runtime/World/CHUDMemoParms.cpp b/Runtime/World/CHUDMemoParms.cpp new file mode 100644 index 000000000..2b8b46011 --- /dev/null +++ b/Runtime/World/CHUDMemoParms.cpp @@ -0,0 +1 @@ +#include "CHUDMemoParms.hpp" diff --git a/Runtime/World/CHUDMemoParms.hpp b/Runtime/World/CHUDMemoParms.hpp new file mode 100644 index 000000000..fddd1fcdf --- /dev/null +++ b/Runtime/World/CHUDMemoParms.hpp @@ -0,0 +1,22 @@ +#ifndef CHUDMEMOPARMS_HPP +#define CHUDMEMOPARMS_HPP + +#include "IOStreams.hpp" + +namespace urde +{ +class CHUDMemoParms +{ + float x0_; + bool x4_; + bool x5_ = false; + bool x6_ = false; +public: + CHUDMemoParms(CInputStream& in) + : x0_(in.readFloatBig()), + x4_(in.readBool()) + {} +}; +} + +#endif // CHUDMEMOPARMS_HPP diff --git a/Runtime/World/CMakeLists.txt b/Runtime/World/CMakeLists.txt index 7718794b0..ce1f0c498 100644 --- a/Runtime/World/CMakeLists.txt +++ b/Runtime/World/CMakeLists.txt @@ -40,6 +40,8 @@ set(WORLD_SOURCES CScriptMemoryRelay.hpp CScriptMemoryRelay.cpp CScriptRandomRelay.hpp CScriptRandomRelay.cpp CScriptRelay.hpp CScriptRelay.cpp + CScriptHUDMemo.hpp CScriptHUDMemo.cpp + CScriptCameraFilterKeyframe.hpp CScriptCameraFilterKeyframe.cpp CScriptDamageableTrigger.hpp CScriptDamageableTrigger.cpp CScriptActorRotate.hpp CScriptActorRotate.cpp CScriptSpecialFunction.hpp CScriptSpecialFunction.cpp @@ -55,6 +57,7 @@ set(WORLD_SOURCES CPatternedInfo.hpp CPatternedInfo.cpp CHealthInfo.hpp CHealthInfo.cpp CPatterned.hpp CPatterned.cpp + CHUDMemoParms.hpp CHUDMemoParms.cpp CFluidPlane.hpp) runtime_add_list(World WORLD_SOURCES) diff --git a/Runtime/World/CScriptCameraFilterKeyframe.cpp b/Runtime/World/CScriptCameraFilterKeyframe.cpp new file mode 100644 index 000000000..204795441 --- /dev/null +++ b/Runtime/World/CScriptCameraFilterKeyframe.cpp @@ -0,0 +1,11 @@ +#include "CScriptCameraFilterKeyframe.hpp" + +namespace urde +{ +CScriptCameraFilterKeyframe::CScriptCameraFilterKeyframe(TUniqueId uid, const std::string &name, const CEntityInfo& info, + u32, u32, u32, u32, const zeus::CColor&, float, float, + u32, bool active) + : CEntity(uid, info, active, name) +{} + +} diff --git a/Runtime/World/CScriptCameraFilterKeyframe.hpp b/Runtime/World/CScriptCameraFilterKeyframe.hpp new file mode 100644 index 000000000..545ec223f --- /dev/null +++ b/Runtime/World/CScriptCameraFilterKeyframe.hpp @@ -0,0 +1,25 @@ +#ifndef CSCRIPTCAMERAFILTERKEYFRAME_HPP +#define CSCRIPTCAMERAFILTERKEYFRAME_HPP + +#include "CEntity.hpp" +#include "zeus/CColor.hpp" + +namespace urde +{ +class CScriptCameraFilterKeyframe : public CEntity +{ + u32 x34_; + u32 x38_; + u32 x3c_; + u32 x40_; + zeus::CColor x44_; + float x48_; + float x4c_; + u32 x50_; +public: + CScriptCameraFilterKeyframe(TUniqueId, const std::string&, const CEntityInfo&, u32, u32, u32, u32, const zeus::CColor&, + float, float, u32, bool); +}; +} + +#endif // CSCRIPTCAMERAFILTERKEYFRAME_HPP diff --git a/Runtime/World/CScriptHUDMemo.cpp b/Runtime/World/CScriptHUDMemo.cpp new file mode 100644 index 000000000..2b255e588 --- /dev/null +++ b/Runtime/World/CScriptHUDMemo.cpp @@ -0,0 +1,12 @@ +#include "CScriptHUDMemo.hpp" + +namespace urde +{ + +CScriptHUDMemo::CScriptHUDMemo(TUniqueId uid, const std::string& name, const CEntityInfo& info, const CHUDMemoParms&, + CScriptHUDMemo::EDisplayType, ResId, bool active) + : CEntity(uid, info, active, name) +{ +} + +} diff --git a/Runtime/World/CScriptHUDMemo.hpp b/Runtime/World/CScriptHUDMemo.hpp new file mode 100644 index 000000000..e6114c142 --- /dev/null +++ b/Runtime/World/CScriptHUDMemo.hpp @@ -0,0 +1,25 @@ +#ifndef CSCRIPTHUDMEMO_HPP +#define CSCRIPTHUDMEMO_HPP + +#include "CEntity.hpp" +#include "CHUDMemoParms.hpp" + +namespace urde +{ +class CScriptHUDMemo : public CEntity +{ +public: + enum class EDisplayType + { + StatusMessage, + MessageBox, + }; + +private: +public: + CScriptHUDMemo(TUniqueId, const std::string&, const CEntityInfo&, const CHUDMemoParms&, + CScriptHUDMemo::EDisplayType, ResId, bool); +}; +} + +#endif // CSCRIPTHUDMEMO_HPP diff --git a/Runtime/World/ScriptLoader.cpp b/Runtime/World/ScriptLoader.cpp index 69ad17625..bf8d3b5ae 100644 --- a/Runtime/World/ScriptLoader.cpp +++ b/Runtime/World/ScriptLoader.cpp @@ -34,6 +34,8 @@ #include "CScriptMemoryRelay.hpp" #include "CScriptRandomRelay.hpp" #include "CScriptRelay.hpp" +#include "CScriptHUDMemo.hpp" +#include "CScriptCameraFilterKeyframe.hpp" #include "CScriptDamageableTrigger.hpp" #include "CScriptActorRotate.hpp" #include "CScriptSpecialFunction.hpp" @@ -1012,11 +1014,37 @@ CEntity* ScriptLoader::LoadBeetle(CStateManager& mgr, CInputStream& in, CEntity* ScriptLoader::LoadHUDMemo(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { + if (propCount != 5 && !EnsurePropertyCount(propCount, 6, "HUDMemo")) + return 0; + const std::string* name = mgr.HashInstanceName(in); + CHUDMemoParms hParms(in); + CScriptHUDMemo::EDisplayType displayType = CScriptHUDMemo::EDisplayType::MessageBox; + if (propCount == 6) + displayType = CScriptHUDMemo::EDisplayType(in.readUint32Big()); + ResId message = in.readUint32Big(); + bool active = in.readBool(); + + return new CScriptHUDMemo(mgr.AllocateUniqueId(), *name, info, hParms, displayType, message, active); } CEntity* ScriptLoader::LoadCameraFilterKeyframe(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { + if (!EnsurePropertyCount(propCount, 10, "CameraFilterKeyframe")) + return nullptr; + const std::string* name = mgr.HashInstanceName(in); + bool active = in.readBool(); + u32 w1 = in.readUint32Big(); + u32 w2 = in.readUint32Big(); + u32 w3 = in.readUint32Big(); + u32 w4 = in.readUint32Big(); + zeus::CColor color; + color.readRGBABig(in); + float f1 = in.readFloatBig(); + float f2 = in.readFloatBig(); + u32 w5 = in.readUint32Big(); + + return new CScriptCameraFilterKeyframe(mgr.AllocateUniqueId(), *name, info, w1, w2, w3, w4, color, f1, f2, w5, active); } CEntity* ScriptLoader::LoadCameraBlurKeyframe(CStateManager& mgr, CInputStream& in,