diff --git a/DataSpec/DNACommon/Tweaks/ITweakPlayerGun.hpp b/DataSpec/DNACommon/Tweaks/ITweakPlayerGun.hpp index f85f66b3c..65f112438 100644 --- a/DataSpec/DNACommon/Tweaks/ITweakPlayerGun.hpp +++ b/DataSpec/DNACommon/Tweaks/ITweakPlayerGun.hpp @@ -40,6 +40,7 @@ struct ITweakPlayerGun : ITweak virtual float GetX30() const = 0; // x30 virtual float GetX34() const = 0; // x34 virtual float GetX38() const = 0; // x38 + virtual float GetRichochetDamage(atUint32) const = 0; }; } diff --git a/DataSpec/DNAMP1/Tweaks/CTweakPlayerGun.hpp b/DataSpec/DNAMP1/Tweaks/CTweakPlayerGun.hpp index 45bdfc952..f51cef57d 100644 --- a/DataSpec/DNAMP1/Tweaks/CTweakPlayerGun.hpp +++ b/DataSpec/DNAMP1/Tweaks/CTweakPlayerGun.hpp @@ -44,8 +44,8 @@ struct CTweakPlayerGun : ITweakPlayerGun }; SWeaponInfo xa8_beams[5]; SComboShotParam x1f0_combos[5]; // Originally rstl::prereserved_vector - Value x280_ricochetData[5]; // Originally rstl::prereserved_vector - Value unused; // Kept for consistency + Value x280_ricochetData[6]; // Originally rstl::prereserved_vector, extended to 6 to capture + // PhazonBeam's value CTweakPlayerGun() = default; CTweakPlayerGun(athena::io::IStreamReader& r) { @@ -59,6 +59,42 @@ struct CTweakPlayerGun : ITweakPlayerGun float GetX30() const { return x30_; } float GetX34() const { return x34_; } float GetX38() const { return x38_; } + float GetRichochetDamage(atUint32 type) const + { + switch (type) + { + case 0: // Power + return x280_ricochetData[0]; + case 1: // Ice + return x280_ricochetData[1]; + case 2: // Wave + return x280_ricochetData[2]; + case 3: // Plasma + return x280_ricochetData[3]; + case 6: // Missile + return x280_ricochetData[4]; + case 8: // Phazon + /* Note: In order to return the same value as retail we have to do a bit of a hack + * Retro accidentally forgot to load in PhazonBeam's richochet value, as a result, it loads the + * pointer to CTweakParticle's vtable. + */ +#if MP_v1088 + + return float(0x803D9CC4); +#else + return x280_ricochetData[5]; +#endif + default: + return 1.f; + } + } + + SWeaponInfo GetBeamInfo(atInt32 beam) const + { + if (beam < 0 || beam > 5) + return xa8_beams[0]; + return xa8_beams[beam]; + } }; } } diff --git a/Runtime/Camera/CCameraSpline.cpp b/Runtime/Camera/CCameraSpline.cpp new file mode 100644 index 000000000..a3d8efc9c --- /dev/null +++ b/Runtime/Camera/CCameraSpline.cpp @@ -0,0 +1,26 @@ +#include "Camera/CCameraSpline.hpp" +#include "CStateManager.hpp" +#include "World/CScriptCameraWaypoint.hpp" +#include "TCastTo.hpp" + +namespace urde +{ +CCameraSpline::CCameraSpline(bool b) : x48_(b) {} + +void CCameraSpline::CalculateKnots(TUniqueId cameraId, const std::vector& connections, CStateManager& mgr) +{ + const SConnection* lastConn = nullptr; + + for (const SConnection& conn : connections) + { + if (conn.x0_state == EScriptObjectState::CameraPath && conn.x4_msg == EScriptObjectMessage::Follow) + lastConn = &conn; + } + + if (lastConn) + { + TCastToPtr waypoint = mgr.ObjectById(mgr.GetIdForScript(lastConn->x8_objId)); + //if (waypoint) + } +} +} diff --git a/Runtime/Camera/CCameraSpline.hpp b/Runtime/Camera/CCameraSpline.hpp new file mode 100644 index 000000000..55ce5a4d3 --- /dev/null +++ b/Runtime/Camera/CCameraSpline.hpp @@ -0,0 +1,24 @@ +#ifndef __URDE_CCAMERASPLINE_HPP__ +#define __URDE_CCAMERASPLINE_HPP__ + +#include "World/CEntityInfo.hpp" + +namespace urde +{ +class CStateManager; +class CCameraSpline +{ + std::vector x4_; + std::vector x14_; + std::vector x24_; + std::vector x34_; + float x44_ = 0.f; + bool x48_ = false; +public: + CCameraSpline(bool); + void CalculateKnots(TUniqueId, const std::vector&, CStateManager&); + void Initialize(TUniqueId, const std::vector&, CStateManager&); +}; +} + +#endif // __URDE_CCAMERASPLINE_HPP__ diff --git a/Runtime/Camera/CMakeLists.txt b/Runtime/Camera/CMakeLists.txt index a14873477..599fd59c3 100644 --- a/Runtime/Camera/CMakeLists.txt +++ b/Runtime/Camera/CMakeLists.txt @@ -6,6 +6,7 @@ set(CAMERA_SOURCES CPathCamera.hpp CPathCamera.cpp CCinematicCamera.hpp CCinematicCamera.cpp CCameraShakeData.hpp CCameraShakeData.cpp - CCameraFilter.hpp CCameraFilter.cpp) + CCameraFilter.hpp CCameraFilter.cpp + CCameraSpline.hpp CCameraSpline.cpp) runtime_add_list(Camera CAMERA_SOURCES) diff --git a/Runtime/World/CEntity.hpp b/Runtime/World/CEntity.hpp index 8971d207d..b2701b1de 100644 --- a/Runtime/World/CEntity.hpp +++ b/Runtime/World/CEntity.hpp @@ -3,32 +3,13 @@ #include "RetroTypes.hpp" #include "ScriptObjectSupport.hpp" +#include "CEntityInfo.hpp" namespace urde { class CStateManager; class IVisitor; -struct SConnection -{ - EScriptObjectState x0_state; - EScriptObjectMessage x4_msg; - TEditorId x8_objId; -}; - -class CEntityInfo -{ - TAreaId x0_areaId; - std::vector x4_conns; - TEditorId x14_editorId; -public: - CEntityInfo(TAreaId aid, const std::vector& conns, TEditorId eid = kInvalidEditorId) - : x0_areaId(aid), x4_conns(conns), x14_editorId(eid) {} - TAreaId GetAreaId() const {return x0_areaId;} - std::vector GetConnectionList() const { return x4_conns; } - TEditorId GetEditorId() const { return x14_editorId; } -}; - class CEntity { friend class CStateManager; diff --git a/Runtime/World/CEntityInfo.hpp b/Runtime/World/CEntityInfo.hpp new file mode 100644 index 000000000..4e66ccd63 --- /dev/null +++ b/Runtime/World/CEntityInfo.hpp @@ -0,0 +1,32 @@ +#ifndef __URDE_CENTITYINFO_HPP__ +#define __URDE_CENTITYINFO_HPP__ + +#include +#include +#include "RetroTypes.hpp" +#include "World/ScriptObjectSupport.hpp" + +namespace urde +{ +struct SConnection +{ + EScriptObjectState x0_state; + EScriptObjectMessage x4_msg; + TEditorId x8_objId; +}; + +class CEntityInfo +{ + TAreaId x0_areaId; + std::vector x4_conns; + TEditorId x14_editorId; +public: + CEntityInfo(TAreaId aid, const std::vector& conns, TEditorId eid = kInvalidEditorId) + : x0_areaId(aid), x4_conns(conns), x14_editorId(eid) {} + TAreaId GetAreaId() const {return x0_areaId;} + std::vector GetConnectionList() const { return x4_conns; } + TEditorId GetEditorId() const { return x14_editorId; } +}; +} + +#endif // __URDE_CENTITYINFO_HPP__ diff --git a/Runtime/World/CMakeLists.txt b/Runtime/World/CMakeLists.txt index 89c1e10a5..b1c06a394 100644 --- a/Runtime/World/CMakeLists.txt +++ b/Runtime/World/CMakeLists.txt @@ -108,6 +108,7 @@ set(WORLD_SOURCES CRippleManager.hpp CRippleManager.cpp CRipple.hpp CRipple.cpp CDestroyableRock.hpp CDestroyableRock.cpp - CHUDBillboardEffect.hpp CHUDBillboardEffect.cpp) + CHUDBillboardEffect.hpp CHUDBillboardEffect.cpp + CEntityInfo.hpp) runtime_add_list(World WORLD_SOURCES) diff --git a/kabufuda b/kabufuda index 408ac735b..8ed773d16 160000 --- a/kabufuda +++ b/kabufuda @@ -1 +1 @@ -Subproject commit 408ac735b4741d2d4b27e1cf985c3f69098025be +Subproject commit 8ed773d16ff83e5885315db5382d7f8f8517a8b9