From 24bfc47d1a622be0bc1ea40e1c6b8bf7ac271af2 Mon Sep 17 00:00:00 2001 From: Jack Andersen Date: Sun, 14 Aug 2016 11:11:44 -1000 Subject: [PATCH] Plenty of dependency stubs for CStateManager --- DataSpec/DNACommon/AROTBuilder.cpp | 4 +- DataSpec/DNACommon/CMakeLists.txt | 4 +- DataSpec/DNACommon/DeafBabe.cpp | 9 +- DataSpec/DNACommon/Tweaks/ITweakGunRes.hpp | 65 ++++++++ DataSpec/DNACommon/Tweaks/ITweakPlayerGun.hpp | 22 +++ DataSpec/DNAMP1/CMakeLists.txt | 4 +- DataSpec/DNAMP1/Tweaks/CTweakGunRes.hpp | 121 +++++++++++++++ DataSpec/DNAMP1/Tweaks/CTweakPlayerGun.hpp | 19 +++ Runtime/CGameState.cpp | 7 + Runtime/CGameState.hpp | 14 +- Runtime/CObjectList.cpp | 40 ++--- Runtime/CObjectList.hpp | 6 +- Runtime/CPlayerState.hpp | 1 + Runtime/CStateManager.cpp | 48 +++++- Runtime/Character/CActorLights.cpp | 10 ++ Runtime/Character/CActorLights.hpp | 4 + Runtime/GameGlobalObjects.hpp | 4 + Runtime/World/CAuxWeapon.cpp | 0 Runtime/World/CAuxWeapon.hpp | 17 +++ Runtime/World/CEntity.hpp | 3 +- Runtime/World/CFidget.cpp | 0 Runtime/World/CFidget.hpp | 31 ++++ Runtime/World/CGSComboFire.cpp | 0 Runtime/World/CGSComboFire.hpp | 29 ++++ Runtime/World/CGSFidget.cpp | 0 Runtime/World/CGSFidget.hpp | 21 +++ Runtime/World/CGSFreeLook.cpp | 0 Runtime/World/CGSFreeLook.hpp | 21 +++ Runtime/World/CGrappleArm.cpp | 0 Runtime/World/CGrappleArm.hpp | 21 +++ Runtime/World/CGunController.cpp | 12 ++ Runtime/World/CGunController.hpp | 36 +++++ Runtime/World/CGunMotion.cpp | 0 Runtime/World/CGunMotion.hpp | 21 +++ Runtime/World/CGunWeapon.cpp | 10 ++ Runtime/World/CGunWeapon.hpp | 20 +++ Runtime/World/CIceBeam.cpp | 0 Runtime/World/CIceBeam.hpp | 15 ++ Runtime/World/CMakeLists.txt | 17 +++ Runtime/World/CPhazonBeam.cpp | 0 Runtime/World/CPhazonBeam.hpp | 15 ++ Runtime/World/CPlasmaBeam.cpp | 0 Runtime/World/CPlasmaBeam.hpp | 15 ++ Runtime/World/CPlayer.cpp | 5 + Runtime/World/CPlayer.hpp | 6 + Runtime/World/CPlayerCameraBob.cpp | 10 ++ Runtime/World/CPlayerCameraBob.hpp | 55 +++++++ Runtime/World/CPlayerGun.cpp | 21 +++ Runtime/World/CPlayerGun.hpp | 141 ++++++++++++++++++ Runtime/World/CPowerBeam.cpp | 0 Runtime/World/CPowerBeam.hpp | 15 ++ Runtime/World/CScriptSpawnPoint.cpp | 14 +- Runtime/World/CScriptSpawnPoint.hpp | 16 ++ Runtime/World/CWaveBeam.cpp | 0 Runtime/World/CWaveBeam.hpp | 15 ++ Runtime/World/CWorldShadow.cpp | 10 ++ Runtime/World/CWorldShadow.hpp | 17 +++ hecl | 2 +- 58 files changed, 983 insertions(+), 30 deletions(-) create mode 100644 DataSpec/DNACommon/Tweaks/ITweakGunRes.hpp create mode 100644 DataSpec/DNACommon/Tweaks/ITweakPlayerGun.hpp create mode 100644 DataSpec/DNAMP1/Tweaks/CTweakGunRes.hpp create mode 100644 DataSpec/DNAMP1/Tweaks/CTweakPlayerGun.hpp create mode 100644 Runtime/World/CAuxWeapon.cpp create mode 100644 Runtime/World/CAuxWeapon.hpp create mode 100644 Runtime/World/CFidget.cpp create mode 100644 Runtime/World/CFidget.hpp create mode 100644 Runtime/World/CGSComboFire.cpp create mode 100644 Runtime/World/CGSComboFire.hpp create mode 100644 Runtime/World/CGSFidget.cpp create mode 100644 Runtime/World/CGSFidget.hpp create mode 100644 Runtime/World/CGSFreeLook.cpp create mode 100644 Runtime/World/CGSFreeLook.hpp create mode 100644 Runtime/World/CGrappleArm.cpp create mode 100644 Runtime/World/CGrappleArm.hpp create mode 100644 Runtime/World/CGunController.cpp create mode 100644 Runtime/World/CGunController.hpp create mode 100644 Runtime/World/CGunMotion.cpp create mode 100644 Runtime/World/CGunMotion.hpp create mode 100644 Runtime/World/CGunWeapon.cpp create mode 100644 Runtime/World/CGunWeapon.hpp create mode 100644 Runtime/World/CIceBeam.cpp create mode 100644 Runtime/World/CIceBeam.hpp create mode 100644 Runtime/World/CPhazonBeam.cpp create mode 100644 Runtime/World/CPhazonBeam.hpp create mode 100644 Runtime/World/CPlasmaBeam.cpp create mode 100644 Runtime/World/CPlasmaBeam.hpp create mode 100644 Runtime/World/CPlayerCameraBob.cpp create mode 100644 Runtime/World/CPlayerCameraBob.hpp create mode 100644 Runtime/World/CPlayerGun.cpp create mode 100644 Runtime/World/CPlayerGun.hpp create mode 100644 Runtime/World/CPowerBeam.cpp create mode 100644 Runtime/World/CPowerBeam.hpp create mode 100644 Runtime/World/CWaveBeam.cpp create mode 100644 Runtime/World/CWaveBeam.hpp create mode 100644 Runtime/World/CWorldShadow.cpp create mode 100644 Runtime/World/CWorldShadow.hpp diff --git a/DataSpec/DNACommon/AROTBuilder.cpp b/DataSpec/DNACommon/AROTBuilder.cpp index 3295d1e10..0a9179d06 100644 --- a/DataSpec/DNACommon/AROTBuilder.cpp +++ b/DataSpec/DNACommon/AROTBuilder.cpp @@ -369,7 +369,9 @@ void AROTBuilder::build(std::vector>& secs, const zeus::CAA std::pair, uint32_t> AROTBuilder::buildCol(const ColMesh& mesh, BspNodeType& rootOut) { - zeus::CAABox fullAabb(zeus::CVector3f(mesh.aabbMin), zeus::CVector3f(mesh.aabbMax)); + zeus::CAABox fullAabb; + for (const auto& vert : mesh.verts) + fullAabb.accumulateBounds(zeus::CVector3f(vert)); int t = 0; for (const ColMesh::Triangle& tri : mesh.trianges) diff --git a/DataSpec/DNACommon/CMakeLists.txt b/DataSpec/DNACommon/CMakeLists.txt index e0d0dfc17..68d206994 100644 --- a/DataSpec/DNACommon/CMakeLists.txt +++ b/DataSpec/DNACommon/CMakeLists.txt @@ -34,4 +34,6 @@ add_library(DNACommon Tweaks/ITweakGame.hpp Tweaks/ITweakParticle.hpp Tweaks/ITweakPlayer.hpp - Tweaks/ITweakPlayerControl.hpp) + Tweaks/ITweakPlayerControl.hpp + Tweaks/ITweakPlayerGun.hpp + Tweaks/ITweakGunRes.hpp) diff --git a/DataSpec/DNACommon/DeafBabe.cpp b/DataSpec/DNACommon/DeafBabe.cpp index 126af5f94..d72743b2a 100644 --- a/DataSpec/DNACommon/DeafBabe.cpp +++ b/DataSpec/DNACommon/DeafBabe.cpp @@ -87,10 +87,15 @@ void DeafBabeBuildFromBlender(DEAFBABE& db, const hecl::BlenderConnection::DataS } db.materialCount = colMesh.materials.size(); + zeus::CAABox fullAABB; + db.verts.reserve(colMesh.verts.size()); db.vertMats.resize(colMesh.verts.size()); for (const auto& vert : colMesh.verts) + { + fullAABB.accumulateBounds(zeus::CVector3f(vert)); db.verts.push_back(vert); + } db.vertMatsCount = colMesh.verts.size(); db.vertCount = colMesh.verts.size(); @@ -130,8 +135,8 @@ void DeafBabeBuildFromBlender(DEAFBABE& db, const hecl::BlenderConnection::DataS db.length = db.binarySize(0) - 8; db.magic = 0xDEAFBABE; db.version = 3; - db.aabb[0] = colMesh.aabbMin; - db.aabb[1] = colMesh.aabbMax; + db.aabb[0] = fullAABB.min; + db.aabb[1] = fullAABB.max; } template void DeafBabeBuildFromBlender(DNAMP1::DeafBabe& db, const hecl::BlenderConnection::DataStream::ColMesh& colMesh); diff --git a/DataSpec/DNACommon/Tweaks/ITweakGunRes.hpp b/DataSpec/DNACommon/Tweaks/ITweakGunRes.hpp new file mode 100644 index 000000000..ce4535d82 --- /dev/null +++ b/DataSpec/DNACommon/Tweaks/ITweakGunRes.hpp @@ -0,0 +1,65 @@ +#ifndef __DNACOMMON_ITWEAKGUNRES_HPP__ +#define __DNACOMMON_ITWEAKGUNRES_HPP__ + +#include "../DNACommon.hpp" + +namespace DataSpec +{ + +struct ITweakGunRes : BigYAML +{ + virtual const std::string& GetGunMotion() const=0; + virtual const std::string& GetGrappleArm() const=0; + virtual const std::string& GetRightHand() const=0; + + virtual const std::string& GetPowerBeam() const=0; + virtual const std::string& GetIceBeam() const=0; + virtual const std::string& GetWaveBeam() const=0; + virtual const std::string& GetPlasmaBeam() const=0; + virtual const std::string& GetPhazonBeam() const=0; + + virtual const std::string& GetHoloTransition() const=0; + + virtual const std::string& GetBombSet() const=0; + virtual const std::string& GetBombExplode() const=0; + virtual const std::string& GetPowerBombExplode() const=0; + + virtual const std::string& GetPowerBeamWeapon() const=0; + virtual const std::string& GetPowerBallWeapon() const=0; + virtual const std::string& GetIceBeamWeapon() const=0; + virtual const std::string& GetIceBallWeapon() const=0; + virtual const std::string& GetWaveBeamWeapon() const=0; + virtual const std::string& GetWaveBallWeapon() const=0; + virtual const std::string& GetPlasmaBeamWeapon() const=0; + virtual const std::string& GetPlasmaBallWeapon() const=0; + virtual const std::string& GetPhazonBeamWeapon() const=0; + virtual const std::string& GetPhazonBallWeapon() const=0; + + virtual const std::string& GetPowerMuzzleParticle() const=0; + virtual const std::string& GetIceMuzzleParticle() const=0; + virtual const std::string& GetWaveMuzzleParticle() const=0; + virtual const std::string& GetPlasmaMuzzleParticle() const=0; + virtual const std::string& GetPhazonMuzzleParticle() const=0; + + virtual const std::string& GetPowerChargeParticle() const=0; + virtual const std::string& GetIceChargeParticle() const=0; + virtual const std::string& GetWaveChargeParticle() const=0; + virtual const std::string& GetPlasmaChargeParticle() const=0; + virtual const std::string& GetPhazonChargeParticle() const=0; + + virtual const std::string& GetPowerAuxMuzzleParticle() const=0; + virtual const std::string& GetIceAuxMuzzleParticle() const=0; + virtual const std::string& GetWaveAuxMuzzleParticle() const=0; + virtual const std::string& GetPlasmaAuxMuzzleParticle() const=0; + virtual const std::string& GetPhazonAuxMuzzleParticle() const=0; + + virtual const std::string& GetGrappleSegmentParticle() const=0; + virtual const std::string& GetGrappleClawParticle() const=0; + virtual const std::string& GetGrappleHitParticle() const=0; + virtual const std::string& GetGrappleMuzzleParticle() const=0; + virtual const std::string& GetGrappleSwooshParticle() const=0; +}; + +} + +#endif diff --git a/DataSpec/DNACommon/Tweaks/ITweakPlayerGun.hpp b/DataSpec/DNACommon/Tweaks/ITweakPlayerGun.hpp new file mode 100644 index 000000000..4a4daa40c --- /dev/null +++ b/DataSpec/DNACommon/Tweaks/ITweakPlayerGun.hpp @@ -0,0 +1,22 @@ +#ifndef __DNACOMMON_ITWEAKPLAYERGUN_HPP__ +#define __DNACOMMON_ITWEAKPLAYERGUN_HPP__ + +#include "../DNACommon.hpp" +#include "zeus/CAABox.hpp" + +namespace DataSpec +{ + +struct ITweakPlayerGun : BigYAML +{ + virtual float GetSomething1() const=0; // x24 + virtual float GetSomething2() const=0; // x28 + virtual float GetSomething3() const=0; // x2c + virtual float GetSomething4() const=0; // x30 + virtual float GetSomething5() const=0; // x34 + virtual float GetSomething6() const=0; // x38 +}; + +} + +#endif // __DNACOMMON_ITWEAKPLAYERGUN_HPP__ diff --git a/DataSpec/DNAMP1/CMakeLists.txt b/DataSpec/DNAMP1/CMakeLists.txt index 89b9081c8..3b55beaa3 100644 --- a/DataSpec/DNAMP1/CMakeLists.txt +++ b/DataSpec/DNAMP1/CMakeLists.txt @@ -19,7 +19,9 @@ make_dnalist(liblist Tweaks/CTweakGame Tweaks/CTweakParticle Tweaks/CTweakPlayer - Tweaks/CTweakPlayerControl) + Tweaks/CTweakPlayerControl + Tweaks/CTweakPlayerGun + Tweaks/CTweakGunRes) add_library(DNAMP1 DNAMP1.hpp DNAMP1.cpp diff --git a/DataSpec/DNAMP1/Tweaks/CTweakGunRes.hpp b/DataSpec/DNAMP1/Tweaks/CTweakGunRes.hpp new file mode 100644 index 000000000..c6f31b596 --- /dev/null +++ b/DataSpec/DNAMP1/Tweaks/CTweakGunRes.hpp @@ -0,0 +1,121 @@ +#ifndef _DNAMP1_CTWEAKGUNRES_HPP_ +#define _DNAMP1_CTWEAKGUNRES_HPP_ + +#include "../../DNACommon/Tweaks/ITweakGunRes.hpp" + +namespace DataSpec +{ +namespace DNAMP1 +{ + +struct CTweakPlayerGun : ITweakGunRes +{ + DECL_YAML + + String<-1> m_gunMotion; + String<-1> m_grappleArm; + String<-1> m_rightHand; + + String<-1> m_powerBeam; + String<-1> m_iceBeam; + String<-1> m_waveBeam; + String<-1> m_plasmaBeam; + String<-1> m_phazonBeam; + + String<-1> m_holoTransition; + + String<-1> m_bombSet; + String<-1> m_bombExplode; + String<-1> m_powerBombExplode; + + String<-1> m_powerBeamWp; + String<-1> m_powerBallWp; + String<-1> m_iceBeamWp; + String<-1> m_iceBallWp; + String<-1> m_waveBeamWp; + String<-1> m_waveBallWp; + String<-1> m_plasmaBeamWp; + String<-1> m_plasmaBallWp; + String<-1> m_phazonBeamWp; + String<-1> m_phazonBallWp; + + String<-1> m_powerMuzzle; + String<-1> m_iceMuzzle; + String<-1> m_waveMuzzle; + String<-1> m_plasmaMuzzle; + String<-1> m_phazonMuzzle; + + String<-1> m_powerCharge; + String<-1> m_iceCharge; + String<-1> m_waveCharge; + String<-1> m_plasmaCharge; + String<-1> m_phazonCharge; + + String<-1> m_powerAuxMuzzle; + String<-1> m_iceAuxMuzzle; + String<-1> m_waveAuxMuzzle; + String<-1> m_plasmaAuxMuzzle; + String<-1> m_phazonAuxMuzzle; + + String<-1> m_grappleSegment; + String<-1> m_grappleClaw; + String<-1> m_grappleHit; + String<-1> m_grappleMuzzle; + String<-1> m_grappleSwoosh; + + const std::string& GetGunMotion() const { return m_gunMotion; } + const std::string& GetGrappleArm() const { return m_grappleArm; } + const std::string& GetRightHand() const { return m_rightHand; } + + const std::string& GetPowerBeam() const { return m_powerBeam; } + const std::string& GetIceBeam() const { return m_iceBeam; } + const std::string& GetWaveBeam() const { return m_waveBeam; } + const std::string& GetPlasmaBeam() const { return m_plasmaBeam; } + const std::string& GetPhazonBeam() const { return m_phazonBeam; } + + const std::string& GetHoloTransition() const { return m_holoTransition; } + + const std::string& GetBombSet() const { return m_bombSet; } + const std::string& GetBombExplode() const { return m_bombExplode; } + const std::string& GetPowerBombExplode() const { return m_powerBombExplode; } + + const std::string& GetPowerBeamWeapon() const { return m_powerBeamWp; } + const std::string& GetPowerBallWeapon() const { return m_powerBallWp; } + const std::string& GetIceBeamWeapon() const { return m_iceBeamWp; } + const std::string& GetIceBallWeapon() const { return m_iceBallWp; } + const std::string& GetWaveBeamWeapon() const { return m_waveBeamWp; } + const std::string& GetWaveBallWeapon() const { return m_waveBallWp; } + const std::string& GetPlasmaBeamWeapon() const { return m_plasmaBeamWp; } + const std::string& GetPlasmaBallWeapon() const { return m_plasmaBallWp; } + const std::string& GetPhazonBeamWeapon() const { return m_phazonBeamWp; } + const std::string& GetPhazonBallWeapon() const { return m_phazonBallWp; } + + const std::string& GetPowerMuzzleParticle() const { return m_powerMuzzle; } + const std::string& GetIceMuzzleParticle() const { return m_iceMuzzle; } + const std::string& GetWaveMuzzleParticle() const { return m_waveMuzzle; } + const std::string& GetPlasmaMuzzleParticle() const { return m_plasmaMuzzle; } + const std::string& GetPhazonMuzzleParticle() const { return m_phazonMuzzle; } + + const std::string& GetPowerChargeParticle() const { return m_powerCharge; } + const std::string& GetIceChargeParticle() const { return m_iceCharge; } + const std::string& GetWaveChargeParticle() const { return m_waveCharge; } + const std::string& GetPlasmaChargeParticle() const { return m_plasmaCharge; } + const std::string& GetPhazonChargeParticle() const { return m_phazonCharge; } + + const std::string& GetPowerAuxMuzzleParticle() const { return m_powerAuxMuzzle; } + const std::string& GetIceAuxMuzzleParticle() const { return m_iceAuxMuzzle; } + const std::string& GetWaveAuxMuzzleParticle() const { return m_waveAuxMuzzle; } + const std::string& GetPlasmaAuxMuzzleParticle() const { return m_plasmaAuxMuzzle; } + const std::string& GetPhazonAuxMuzzleParticle() const { return m_phazonAuxMuzzle; } + + const std::string& GetGrappleSegmentParticle() const { return m_grappleSegment; } + const std::string& GetGrappleClawParticle() const { return m_grappleClaw; } + const std::string& GetGrappleHitParticle() const { return m_grappleHit; } + const std::string& GetGrappleMuzzleParticle() const { return m_grappleMuzzle; } + const std::string& GetGrappleSwooshParticle() const { return m_grappleSwoosh; } +}; + +} +} + +#endif // _DNAMP1_CTWEAKGUNRES_HPP_ diff --git a/DataSpec/DNAMP1/Tweaks/CTweakPlayerGun.hpp b/DataSpec/DNAMP1/Tweaks/CTweakPlayerGun.hpp new file mode 100644 index 000000000..d6c154ce4 --- /dev/null +++ b/DataSpec/DNAMP1/Tweaks/CTweakPlayerGun.hpp @@ -0,0 +1,19 @@ +#ifndef _DNAMP1_CTWEAKPLAYERGUN_HPP_ +#define _DNAMP1_CTWEAKPLAYERGUN_HPP_ + +#include "../../DNACommon/Tweaks/ITweakPlayerGun.hpp" + +namespace DataSpec +{ +namespace DNAMP1 +{ + +struct CTweakPlayerGun : ITweakPlayerGun +{ + DECL_YAML +}; + +} +} + +#endif // _DNAMP1_CTWEAKPLAYERGUN_HPP_ diff --git a/Runtime/CGameState.cpp b/Runtime/CGameState.cpp index 2306ac44c..cf518c07f 100644 --- a/Runtime/CGameState.cpp +++ b/Runtime/CGameState.cpp @@ -5,8 +5,15 @@ namespace urde { +CGameState::CGameState() +{ + x228_25_deferPowerupInit = true; +} + CGameState::CGameState(CBitStreamReader& stream) { + x228_25_deferPowerupInit = true; + for (u32 i = 0; i < 128; i++) stream.ReadEncoded(8); u32 tmp = stream.ReadEncoded(32); diff --git a/Runtime/CGameState.hpp b/Runtime/CGameState.hpp index 944a85cde..07a0cc359 100644 --- a/Runtime/CGameState.hpp +++ b/Runtime/CGameState.hpp @@ -22,6 +22,8 @@ public: class CGameState { + friend class CStateManager; + int m_stateFlag = -1; ResId x84_mlvlId = -1; std::vector x88_worldStates; @@ -30,8 +32,18 @@ class CGameState float m_gameTime = 0.0; CGameOptions m_gameOpts; double xa0_playTime; + + union + { + struct + { + bool x228_24_; + bool x228_25_deferPowerupInit; + }; + u8 _dummy = 0; + }; public: - CGameState() = default; + CGameState(); CGameState(CBitStreamReader& stream); void SetCurrentWorldId(unsigned int id, const std::string& name); CWorldTransManager& WorldTransitionManager() {return x9c_transManager;} diff --git a/Runtime/CObjectList.cpp b/Runtime/CObjectList.cpp index ec0f49233..56c3eb33c 100644 --- a/Runtime/CObjectList.cpp +++ b/Runtime/CObjectList.cpp @@ -11,14 +11,14 @@ void CObjectList::AddObject(CEntity& entity) { if (IsQualified()) { - if (m_lastId != -1) - m_list[m_lastId].next = entity.GetUniqueId() & 0x3ff; - TUniqueId prevLast = m_lastId; - m_lastId = entity.GetUniqueId() & 0x3ff; - SObjectListEntry& newEnt = m_list[m_lastId]; + if (m_firstId != -1) + m_list[m_firstId].prev = entity.GetUniqueId() & 0x3ff; + TUniqueId prevFirst = m_firstId; + m_firstId = entity.GetUniqueId() & 0x3ff; + SObjectListEntry& newEnt = m_list[m_firstId]; newEnt.entity = &entity; - newEnt.prev = prevLast; - newEnt.next = -1; + newEnt.next = prevFirst; + newEnt.prev = -1; ++m_count; } } @@ -29,21 +29,21 @@ void CObjectList::RemoveObject(TUniqueId uid) SObjectListEntry& ent = m_list[uid]; if (!ent.entity || ent.entity->GetUniqueId() != uid) return; - if (uid == m_lastId) + if (uid == m_firstId) { - m_lastId = ent.prev; - if (ent.prev != -1) - m_list[ent.prev].next = -1; + m_firstId = ent.next; + if (ent.next != -1) + m_list[ent.next].prev = -1; } else { - if (ent.prev != -1) - m_list[ent.prev].next = -1; - m_list[ent.next].prev = -1; + if (ent.next != -1) + m_list[ent.next].prev = -1; + m_list[ent.prev].next = -1; } ent.entity = nullptr; - ent.prev = -1; ent.next = -1; + ent.prev = -1; --m_count; } @@ -51,14 +51,20 @@ const CEntity* CObjectList::GetObjectById(TUniqueId uid) const { if (!uid) return nullptr; - return m_list[uid & 0x3ff].entity; + const SObjectListEntry& ent = m_list[uid & 0x3ff]; + if (ent.entity->x30_26_scriptingBlocked) + return nullptr; + return ent.entity; } CEntity* CObjectList::GetObjectById(TUniqueId uid) { if (!uid) return nullptr; - return m_list[uid & 0x3ff].entity; + SObjectListEntry& ent = m_list[uid & 0x3ff]; + if (ent.entity->x30_26_scriptingBlocked) + return nullptr; + return ent.entity; } bool CObjectList::IsQualified() {return true;} diff --git a/Runtime/CObjectList.hpp b/Runtime/CObjectList.hpp index aaebff5b3..b6dad703b 100644 --- a/Runtime/CObjectList.hpp +++ b/Runtime/CObjectList.hpp @@ -27,12 +27,12 @@ class CObjectList struct SObjectListEntry { CEntity* entity = nullptr; - TUniqueId prev = -1; TUniqueId next = -1; + TUniqueId prev = -1; }; SObjectListEntry m_list[1024]; EGameObjectList m_listEnum; - TUniqueId m_lastId = -1; + TUniqueId m_firstId = -1; u16 m_count = 0; int m_areaIdx = 0; public: @@ -42,6 +42,8 @@ public: void RemoveObject(TUniqueId uid); const CEntity* GetObjectById(TUniqueId uid) const; CEntity* GetObjectById(TUniqueId uid); + TUniqueId GetFirstObjectIndex() const { return m_firstId; } + TUniqueId GetNextObjectIndex(TUniqueId prev) const { return m_list[prev].next; } virtual bool IsQualified(); }; diff --git a/Runtime/CPlayerState.hpp b/Runtime/CPlayerState.hpp index 6264dcb0f..c23a23e13 100644 --- a/Runtime/CPlayerState.hpp +++ b/Runtime/CPlayerState.hpp @@ -162,6 +162,7 @@ public: CPlayerState() : x188_staticIntf(5) { x0_24_ = true; } CPlayerState(CBitStreamReader& stream); void PutTo(CBitStreamWriter& stream); + }; } diff --git a/Runtime/CStateManager.cpp b/Runtime/CStateManager.cpp index 71daf987c..3c2a6f82e 100644 --- a/Runtime/CStateManager.cpp +++ b/Runtime/CStateManager.cpp @@ -14,7 +14,9 @@ #include "CPlayerState.hpp" #include "CGameState.hpp" #include "World/CPlayer.hpp" +#include "World/CPlayerGun.hpp" #include "World/CMorphBall.hpp" +#include "World/CScriptSpawnPoint.hpp" #include "AutoMapper/CMapWorldInfo.hpp" #include @@ -361,7 +363,7 @@ void CStateManager::RecursiveDrawTree(TUniqueId) const void CStateManager::SendScriptMsg(CEntity* dest, TUniqueId src, EScriptObjectMessage msg) { - if (dest && !dest->x30_26_messagesBlocked) + if (dest && !dest->x30_26_scriptingBlocked) { dest->AcceptScriptMsg(msg, src, *this); } @@ -531,6 +533,50 @@ void CStateManager::InitializeState(ResId mlvlId, TAreaId aid, ResId mreaId) x850_world->TravelToArea(x8cc_nextAreaId, *this, true); UpdateRoomAcoustics(x8cc_nextAreaId); + TUniqueId entId = x80c_allObjs->GetFirstObjectIndex(); + while (entId != kInvalidUniqueId) + { + CEntity* ent = x80c_allObjs->GetObjectById(entId); + SendScriptMsg(ent, kInvalidUniqueId, EScriptObjectMessage::InternalMessage14); + entId = x80c_allObjs->GetNextObjectIndex(entId); + } + + entId = x80c_allObjs->GetFirstObjectIndex(); + while (entId != kInvalidUniqueId) + { + CScriptSpawnPoint* sp = dynamic_cast(x80c_allObjs->GetObjectById(entId)); + if (sp && sp->x30_24_active && sp->FirstSpawn()) + { + const zeus::CTransform& xf = sp->GetTransform(); + zeus::CVector3f lookVec{xf.basis[0][1], xf.basis[1][1], xf.basis[2][1]}; + if (lookVec.canBeNormalized()) + { + auto lookXf = zeus::lookAt(xf.origin, lookVec); + x84c_player->Teleport(lookXf, *this, true); + } + + if (!g_GameState->x228_25_deferPowerupInit) + break; + + g_GameState->x228_25_deferPowerupInit = false; + for (int i=0 ; i<41 ; ++i) + { + CPlayerState::EItemType iType = CPlayerState::EItemType(i); + + u32 spawnPu = sp->GetPowerup(iType); + u32 statePu = x8b8_playerState->GetItemCapacity(iType); + if (statePu < spawnPu) + x8b8_playerState->InitializePowerUp(iType, spawnPu - statePu); + + spawnPu = sp->GetPowerup(iType); + statePu = x8b8_playerState->GetItemAmount(iType); + if (statePu < spawnPu) + x8b8_playerState->IncrPickup(iType, spawnPu - statePu); + } + } + entId = x80c_allObjs->GetNextObjectIndex(entId); + } + /* TODO: Finish */ } diff --git a/Runtime/Character/CActorLights.cpp b/Runtime/Character/CActorLights.cpp index e69de29bb..f81af7dba 100644 --- a/Runtime/Character/CActorLights.cpp +++ b/Runtime/Character/CActorLights.cpp @@ -0,0 +1,10 @@ +#include "CActorLights.hpp" + +namespace urde +{ + +CActorLights::CActorLights(u32, const zeus::CVector3f& vec, int, int, float) +{ +} + +} diff --git a/Runtime/Character/CActorLights.hpp b/Runtime/Character/CActorLights.hpp index a33f91e51..58b61bb6a 100644 --- a/Runtime/Character/CActorLights.hpp +++ b/Runtime/Character/CActorLights.hpp @@ -1,12 +1,16 @@ #ifndef __URDE_CACTORLIGHTS_HPP__ #define __URDE_CACTORLIGHTS_HPP__ +#include "RetroTypes.hpp" +#include "zeus/CVector3f.hpp" + namespace urde { class CActorLights { public: + CActorLights(u32, const zeus::CVector3f& vec, int, int, float); void ActivateLights() const {} }; diff --git a/Runtime/GameGlobalObjects.hpp b/Runtime/GameGlobalObjects.hpp index 8789c032c..b356151fc 100644 --- a/Runtime/GameGlobalObjects.hpp +++ b/Runtime/GameGlobalObjects.hpp @@ -3,6 +3,8 @@ #include "../DataSpec/DNACommon/Tweaks/ITweakGame.hpp" #include "../DataSpec/DNACommon/Tweaks/ITweakPlayer.hpp" #include "../DataSpec/DNACommon/Tweaks/ITweakPlayerControl.hpp" +#include "../DataSpec/DNACommon/Tweaks/ITweakPlayerGun.hpp" +#include "../DataSpec/DNACommon/Tweaks/ITweakGunRes.hpp" #include "AutoMapper/ITweakAutoMapper.hpp" #include "GuiSys/ITweakGui.hpp" @@ -21,6 +23,8 @@ extern class CBooRenderer* g_Renderer; extern DataSpec::ITweakGame* g_tweakGame; extern DataSpec::ITweakPlayer* g_tweakPlayer; extern DataSpec::ITweakPlayerControl* g_tweakPlayerControl; +extern DataSpec::ITweakPlayerGun* g_tweakPlayerGun; +extern DataSpec::ITweakGunRes* g_tweakGunRes; extern ITweakAutoMapper* g_tweakAutoMapper; extern ITweakGui* g_tweakGui; diff --git a/Runtime/World/CAuxWeapon.cpp b/Runtime/World/CAuxWeapon.cpp new file mode 100644 index 000000000..e69de29bb diff --git a/Runtime/World/CAuxWeapon.hpp b/Runtime/World/CAuxWeapon.hpp new file mode 100644 index 000000000..8de01b4b1 --- /dev/null +++ b/Runtime/World/CAuxWeapon.hpp @@ -0,0 +1,17 @@ +#ifndef __URDE_CAUXWEAPON_HPP__ +#define __URDE_CAUXWEAPON_HPP__ + +#include "RetroTypes.hpp" + +namespace urde +{ + +class CAuxWeapon +{ +public: + CAuxWeapon(TUniqueId id); +}; + +} + +#endif // __URDE_CAUXWEAPON_HPP__ diff --git a/Runtime/World/CEntity.hpp b/Runtime/World/CEntity.hpp index cf65e9d34..59040e68e 100644 --- a/Runtime/World/CEntity.hpp +++ b/Runtime/World/CEntity.hpp @@ -31,6 +31,7 @@ public: class CEntity { friend class CStateManager; + friend class CObjectList; protected: TAreaId x4_areaId; TUniqueId x8_uid; @@ -44,7 +45,7 @@ protected: { bool x30_24_active : 1; bool x30_25_ : 1; - bool x30_26_messagesBlocked : 1; + bool x30_26_scriptingBlocked : 1; bool x30_27_ : 1; }; u8 _dummy = 0; diff --git a/Runtime/World/CFidget.cpp b/Runtime/World/CFidget.cpp new file mode 100644 index 000000000..e69de29bb diff --git a/Runtime/World/CFidget.hpp b/Runtime/World/CFidget.hpp new file mode 100644 index 000000000..8a9bae1d8 --- /dev/null +++ b/Runtime/World/CFidget.hpp @@ -0,0 +1,31 @@ +#ifndef __URDE_CFIDGET_HPP__ +#define __URDE_CFIDGET_HPP__ + +#include "RetroTypes.hpp" + +namespace urde +{ + +class CFidget +{ + u32 x0_ = 0; + u32 x4_ = -1; + u32 x8_ = 0; + u32 xc_ = -1; + u32 x10_ = 3; + float x14_ = 0.f; + float x18_ = 0.f; + float x1c_ = 0.f; + float x20_ = 0.f; + float x24_ = 0.f; + float x28_ = 0.f; + float x2c_ = 0.f; + float x30_ = 105.f; + bool x34_24_ = false; +public: + +}; + +} + +#endif // __URDE_CFIDGET_HPP__ diff --git a/Runtime/World/CGSComboFire.cpp b/Runtime/World/CGSComboFire.cpp new file mode 100644 index 000000000..e69de29bb diff --git a/Runtime/World/CGSComboFire.hpp b/Runtime/World/CGSComboFire.hpp new file mode 100644 index 000000000..1a4300710 --- /dev/null +++ b/Runtime/World/CGSComboFire.hpp @@ -0,0 +1,29 @@ +#ifndef __URDE_CGSCOMBOFIRE_HPP__ +#define __URDE_CGSCOMBOFIRE_HPP__ + +#include "RetroTypes.hpp" + +namespace urde +{ + +class CGSComboFire +{ + float x0_ = 0.f; + u32 x4_ = -1; + u32 x8_ = -1; + u32 xc_ = -1; + + union + { + struct + { + bool x10_24_ : 1; + bool x10_25_ : 1; + }; + u8 _dummy = 0; + }; +}; + +} + +#endif // __URDE_CGSCOMBOFIRE_HPP__ diff --git a/Runtime/World/CGSFidget.cpp b/Runtime/World/CGSFidget.cpp new file mode 100644 index 000000000..e69de29bb diff --git a/Runtime/World/CGSFidget.hpp b/Runtime/World/CGSFidget.hpp new file mode 100644 index 000000000..c64072014 --- /dev/null +++ b/Runtime/World/CGSFidget.hpp @@ -0,0 +1,21 @@ +#ifndef __URDE_CGSFIDGET_HPP__ +#define __URDE_CGSFIDGET_HPP__ + +#include "RetroTypes.hpp" + +namespace urde +{ + +class CGSFidget +{ + u32 x4_ = 0; + u32 x8_ = 0; + u32 xc_ = 0; + u32 x10_ = -1; + u32 x14_ = -1; + u32 x18_ = -1; +}; + +} + +#endif // __URDE_CGSFIDGET_HPP__ diff --git a/Runtime/World/CGSFreeLook.cpp b/Runtime/World/CGSFreeLook.cpp new file mode 100644 index 000000000..e69de29bb diff --git a/Runtime/World/CGSFreeLook.hpp b/Runtime/World/CGSFreeLook.hpp new file mode 100644 index 000000000..0c578e526 --- /dev/null +++ b/Runtime/World/CGSFreeLook.hpp @@ -0,0 +1,21 @@ +#ifndef __URDE_CGSFREELOOK_HPP__ +#define __URDE_CGSFREELOOK_HPP__ + +#include "RetroTypes.hpp" + +namespace urde +{ + +class CGSFreeLook +{ + float x0_ = 0.f; + u32 x4_ = -1; + u32 x8_ = -1; + u32 xc_ = 0; + u32 x10_ = -1; + bool x14_ = false; +}; + +} + +#endif // __URDE_CGSFREELOOK_HPP__ diff --git a/Runtime/World/CGrappleArm.cpp b/Runtime/World/CGrappleArm.cpp new file mode 100644 index 000000000..e69de29bb diff --git a/Runtime/World/CGrappleArm.hpp b/Runtime/World/CGrappleArm.hpp new file mode 100644 index 000000000..d52a19428 --- /dev/null +++ b/Runtime/World/CGrappleArm.hpp @@ -0,0 +1,21 @@ +#ifndef __URDE_CGRAPPLEARM_HPP__ +#define __URDE_CGRAPPLEARM_HPP__ + +#include "RetroTypes.hpp" +#include "zeus/CVector3f.hpp" +#include "Character/CModelData.hpp" + +namespace urde +{ + +class CGrappleArm +{ + CModelData x0_modelData; + +public: + CGrappleArm(const zeus::CVector3f& vec); +}; + +} + +#endif // __URDE_CGRAPPLEARM_HPP__ diff --git a/Runtime/World/CGunController.cpp b/Runtime/World/CGunController.cpp new file mode 100644 index 000000000..dd69a9506 --- /dev/null +++ b/Runtime/World/CGunController.cpp @@ -0,0 +1,12 @@ +#include "CGunController.hpp" + +namespace urde +{ + +CGunController::CGunController(CModelData& modelData) +: x0_modelData(modelData) +{ + x58_24_ = true; +} + +} diff --git a/Runtime/World/CGunController.hpp b/Runtime/World/CGunController.hpp new file mode 100644 index 000000000..5c97eea78 --- /dev/null +++ b/Runtime/World/CGunController.hpp @@ -0,0 +1,36 @@ +#ifndef __URDE_CGUNCONTROLLER_HPP__ +#define __URDE_CGUNCONTROLLER_HPP__ + +#include "Character/CModelData.hpp" +#include "CGSFreeLook.hpp" +#include "CGSComboFire.hpp" +#include "CGSFidget.hpp" + +namespace urde +{ + +class CGunController +{ + CModelData& x0_modelData; + CGSFreeLook x4_freeLook; + CGSComboFire x1c_comboFire; + CGSFidget x30_fidget; + u32 x50_ = 0; + u32 x54_ = -1; + + union + { + struct + { + bool x58_24_ : 1; + bool x58_25_ : 1; + }; + u8 _dummy = 0; + }; +public: + CGunController(CModelData& modelData); +}; + +} + +#endif // __URDE_CGUNCONTROLLER_HPP__ diff --git a/Runtime/World/CGunMotion.cpp b/Runtime/World/CGunMotion.cpp new file mode 100644 index 000000000..e69de29bb diff --git a/Runtime/World/CGunMotion.hpp b/Runtime/World/CGunMotion.hpp new file mode 100644 index 000000000..02909e97e --- /dev/null +++ b/Runtime/World/CGunMotion.hpp @@ -0,0 +1,21 @@ +#ifndef __URDE_CGUNMOTION_HPP__ +#define __URDE_CGUNMOTION_HPP__ + +#include "RetroTypes.hpp" +#include "zeus/CVector3f.hpp" +#include "Character/CModelData.hpp" + +namespace urde +{ + +class CGunMotion +{ + CModelData x0_modelData; + +public: + CGunMotion(u32, const zeus::CVector3f& vec); +}; + +} + +#endif // __URDE_CGUNMOTION_HPP__ diff --git a/Runtime/World/CGunWeapon.cpp b/Runtime/World/CGunWeapon.cpp new file mode 100644 index 000000000..dc9729c83 --- /dev/null +++ b/Runtime/World/CGunWeapon.cpp @@ -0,0 +1,10 @@ +#include "CGunWeapon.hpp" + +namespace urde +{ + +CGunWeapon::CGunWeapon(u32, EWeaponType type, TUniqueId, EMaterialTypes, const zeus::CVector3f& vec) +{ +} + +} diff --git a/Runtime/World/CGunWeapon.hpp b/Runtime/World/CGunWeapon.hpp new file mode 100644 index 000000000..5761def20 --- /dev/null +++ b/Runtime/World/CGunWeapon.hpp @@ -0,0 +1,20 @@ +#ifndef __URDE_CGUNWEAPON_HPP__ +#define __URDE_CGUNWEAPON_HPP__ + +#include "RetroTypes.hpp" +#include "CWeaponMgr.hpp" +#include "Collision/CMaterialList.hpp" +#include "zeus/CVector3f.hpp" + +namespace urde +{ + +class CGunWeapon +{ +public: + CGunWeapon(u32, EWeaponType type, TUniqueId, EMaterialTypes, const zeus::CVector3f& vec); +}; + +} + +#endif // __URDE_CGUNWEAPON_HPP__ diff --git a/Runtime/World/CIceBeam.cpp b/Runtime/World/CIceBeam.cpp new file mode 100644 index 000000000..e69de29bb diff --git a/Runtime/World/CIceBeam.hpp b/Runtime/World/CIceBeam.hpp new file mode 100644 index 000000000..61a5f58dd --- /dev/null +++ b/Runtime/World/CIceBeam.hpp @@ -0,0 +1,15 @@ +#ifndef __URDE_CICEBEAM_HPP__ +#define __URDE_CICEBEAM_HPP__ + +#include "CGunWeapon.hpp" + +namespace urde +{ + +class CIceBeam : public CGunWeapon +{ +}; + +} + +#endif // __URDE_CICEBEAM_HPP__ diff --git a/Runtime/World/CMakeLists.txt b/Runtime/World/CMakeLists.txt index 717946c04..df758cb30 100644 --- a/Runtime/World/CMakeLists.txt +++ b/Runtime/World/CMakeLists.txt @@ -4,6 +4,22 @@ set(WORLD_SOURCES IGameArea.hpp IGameArea.cpp CGameArea.hpp CGameArea.cpp CPlayer.hpp CPlayer.cpp + CPlayerCameraBob.hpp CPlayerCameraBob.cpp + CPlayerGun.hpp CPlayerGun.cpp + CGunWeapon.hpp CGunWeapon.cpp + CAuxWeapon.hpp CAuxWeapon.cpp + CPowerBeam.hpp CPowerBeam.cpp + CIceBeam.hpp CIceBeam.cpp + CWaveBeam.hpp CWaveBeam.cpp + CPlasmaBeam.hpp CPlasmaBeam.cpp + CPhazonBeam.hpp CPhazonBeam.cpp + CGunMotion.hpp CGunMotion.cpp + CGrappleArm.hpp CGrappleArm.cpp + CGunController.hpp CGunController.cpp + CGSFreeLook.hpp CGSFreeLook.cpp + CGSComboFire.hpp CGSComboFire.cpp + CGSFidget.hpp CGSFidget.cpp + CFidget.hpp CFidget.cpp CMorphBall.hpp CMorphBall.cpp CActor.hpp CActor.cpp CAi.hpp CAi.cpp @@ -67,6 +83,7 @@ set(WORLD_SOURCES CHealthInfo.hpp CHealthInfo.cpp CPatterned.hpp CPatterned.cpp CHUDMemoParms.hpp CHUDMemoParms.cpp + CWorldShadow.hpp CWorldShadow.cpp CFluidPlane.hpp) runtime_add_list(World WORLD_SOURCES) diff --git a/Runtime/World/CPhazonBeam.cpp b/Runtime/World/CPhazonBeam.cpp new file mode 100644 index 000000000..e69de29bb diff --git a/Runtime/World/CPhazonBeam.hpp b/Runtime/World/CPhazonBeam.hpp new file mode 100644 index 000000000..ecc29aa05 --- /dev/null +++ b/Runtime/World/CPhazonBeam.hpp @@ -0,0 +1,15 @@ +#ifndef __URDE_CPHAZONBEAM_HPP__ +#define __URDE_CPHAZONBEAM_HPP__ + +#include "CGunWeapon.hpp" + +namespace urde +{ + +class CPhazonBeam : public CGunWeapon +{ +}; + +} + +#endif // __URDE_CPHAZONBEAM_HPP__ diff --git a/Runtime/World/CPlasmaBeam.cpp b/Runtime/World/CPlasmaBeam.cpp new file mode 100644 index 000000000..e69de29bb diff --git a/Runtime/World/CPlasmaBeam.hpp b/Runtime/World/CPlasmaBeam.hpp new file mode 100644 index 000000000..dee879ddc --- /dev/null +++ b/Runtime/World/CPlasmaBeam.hpp @@ -0,0 +1,15 @@ +#ifndef __URDE_CPLASMABEAM_HPP__ +#define __URDE_CPLASMABEAM_HPP__ + +#include "CGunWeapon.hpp" + +namespace urde +{ + +class CPlasmaBeam : public CGunWeapon +{ +}; + +} + +#endif // __URDE_CPLASMABEAM_HPP__ diff --git a/Runtime/World/CPlayer.cpp b/Runtime/World/CPlayer.cpp index 2284d02df..aed651f59 100644 --- a/Runtime/World/CPlayer.cpp +++ b/Runtime/World/CPlayer.cpp @@ -1,6 +1,7 @@ #include "CPlayer.hpp" #include "CActorParameters.hpp" #include "CMorphBall.hpp" +#include "CPlayerGun.hpp" namespace urde { @@ -18,4 +19,8 @@ CPlayer::CPlayer(TUniqueId uid, const zeus::CTransform& xf, const zeus::CAABox& x768_morphball.reset(new CMorphBall(*this, f4)); } +void CPlayer::Teleport(const zeus::CTransform& xf, CStateManager& mgr, bool) +{ +} + } diff --git a/Runtime/World/CPlayer.hpp b/Runtime/World/CPlayer.hpp index eb17aa992..a50b0ec6c 100644 --- a/Runtime/World/CPlayer.hpp +++ b/Runtime/World/CPlayer.hpp @@ -9,14 +9,20 @@ namespace urde { class CMaterialList; class CMorphBall; +class CPlayerGun; class CPlayer : public CPhysicsActor { + friend class CStateManager; + + std::unique_ptr x490_gun; std::unique_ptr x768_morphball; public: CPlayer(TUniqueId, const zeus::CTransform&, const zeus::CAABox&, unsigned int, const zeus::CVector3f&, float, float, float, float, const CMaterialList&); + + void Teleport(const zeus::CTransform& xf, CStateManager& mgr, bool); }; } diff --git a/Runtime/World/CPlayerCameraBob.cpp b/Runtime/World/CPlayerCameraBob.cpp new file mode 100644 index 000000000..4c5aa7454 --- /dev/null +++ b/Runtime/World/CPlayerCameraBob.cpp @@ -0,0 +1,10 @@ +#include "CPlayerCameraBob.hpp" + +namespace urde +{ + +CPlayerCameraBob::CPlayerCameraBob(ECameraBobType type, const zeus::CVector2f& vec, float) +{ +} + +} diff --git a/Runtime/World/CPlayerCameraBob.hpp b/Runtime/World/CPlayerCameraBob.hpp new file mode 100644 index 000000000..a6e92604c --- /dev/null +++ b/Runtime/World/CPlayerCameraBob.hpp @@ -0,0 +1,55 @@ +#ifndef __URDE_CPLAYERCAMERABOB_HPP__ +#define __URDE_CPLAYERCAMERABOB_HPP__ + +#include +#include "RetroTypes.hpp" +#include "zeus/CVector2f.hpp" +#include "zeus/CTransform.hpp" + +namespace urde +{ + +class CPlayerCameraBob +{ +public: + enum class ECameraBobType + { + Zero, + One + }; +private: + ECameraBobType x0_type; + zeus::CVector2f x4_vec; + float xc_; + float x10_ = 0.f; + float x14_ = 0.f; + float x18_ = 0.f; + float x1c_ = 0.f; + u32 x20_ = 8; + u32 x24_ = 8; + bool x28_ = false; + bool x29_ = false; + zeus::CTransform x2c_; + float x5c_ = 0.f; + float x60_ = 0.f; + float x64_ = 0.f; + float x68_ = 0.f; + float x6c_ = 0.f; + float x70_ = 0.f; + float x74_ = 0.f; + float x78_ = 0.f; + zeus::CVector3f x7c_[4] = {zeus::CVector3f{0.f, 1.f, 0.f}}; + float xb0_[4] = {0.f}; + float xc4_ = 0.f; + float xc8_ = 0.1f; + u32 xcc_ = 0; + zeus::CTransform xd0_; + float x100_ = FLT_EPSILON; + float x104_ = 0.f; +public: + CPlayerCameraBob(ECameraBobType type, const zeus::CVector2f& vec, float); +}; + +} + +#endif // __URDE_CPLAYERCAMERABOB_HPP__ diff --git a/Runtime/World/CPlayerGun.cpp b/Runtime/World/CPlayerGun.cpp new file mode 100644 index 000000000..df326d655 --- /dev/null +++ b/Runtime/World/CPlayerGun.cpp @@ -0,0 +1,21 @@ +#include "CPlayerGun.hpp" +#include "GameGlobalObjects.hpp" + +namespace urde +{ + +CPlayerGun::CPlayerGun(TUniqueId id) +: x0_lights(8, zeus::CVector3f{-30.f, 0.f, 30.f}, 4, 4, 0), x538_thisId(id), + x550_camBob(CPlayerCameraBob::ECameraBobType::One, + zeus::CVector2f(0.071f, 0.141f), 0.47f), + x678_morph(g_tweakPlayerGun->GetSomething6(), g_tweakPlayerGun->GetSomething5()) +{ + x354_ = g_tweakPlayerGun->GetSomething3(); + x358_ = g_tweakPlayerGun->GetSomething4(); + x668_ = g_tweakPlayerGun->GetSomething1(); + x66c_ = g_tweakPlayerGun->GetSomething2(); + + /* TODO: Finish */ +} + +} diff --git a/Runtime/World/CPlayerGun.hpp b/Runtime/World/CPlayerGun.hpp new file mode 100644 index 000000000..5e0f46b04 --- /dev/null +++ b/Runtime/World/CPlayerGun.hpp @@ -0,0 +1,141 @@ +#ifndef __URDE_CPLAYERGUN_HPP__ +#define __URDE_CPLAYERGUN_HPP__ + +#include "RetroTypes.hpp" +#include "Character/CActorLights.hpp" +#include "CFidget.hpp" +#include "zeus/CTransform.hpp" +#include "zeus/CAABox.hpp" +#include "CPlayerCameraBob.hpp" +#include "CGunMotion.hpp" +#include "CGrappleArm.hpp" +#include "CAuxWeapon.hpp" +#include "CPowerBeam.hpp" +#include "CIceBeam.hpp" +#include "CWaveBeam.hpp" +#include "CPlasmaBeam.hpp" +#include "CPhazonBeam.hpp" +#include "Particle/CElementGen.hpp" +#include "Character/CModelData.hpp" +#include "CWorldShadow.hpp" + +namespace urde +{ + +class CPlayerGun +{ + struct CGunMorph + { + CGunMorph(float, float); + }; + + CActorLights x0_lights; + u32 x2e0_ = 0; + u32 x2e4_ = 0; + u32 x2e8_ = 0; + u32 x2ec_ = 0; + u32 x2f0_ = 0; + u32 x2f4_ = 0; + u32 x2f8_ = 1; + u32 x2fc_ = 0; + u32 x300_ = 0; + u32 x304_ = 0; + u32 x308_ = 3; + u32 x30c_ = 0; + u32 x310_ = 0; + u32 x314_ = 0; + u32 x318_ = 0; + u32 x31c_ = 0; + u32 x320_ = 0; + u32 x324_ = 4; + u32 x328_ = 0x2000; + u32 x32c_ = 0; + u32 x330_ = 0; + u32 x334_ = 0; + u32 x338_ = 0; + u32 x33c_ = 0; + float x340_ = 0.f; + float x344_ = 0.f; + float x348_ = 0.f; + float x34c_ = 0.f; + float x350_ = 0.f; + float x354_; + float x358_; + float x35c_ = 0.f; + float x360_ = 0.f; + float x364_ = 0.f; + float x368_ = 0.f; + float x36c_ = 1.f; + float x370_ = 1.f; + float x374_ = 0.f; + float x378_ = 0.f; + float x37c_ = 0.f; + float x380_ = 0.f; + float x384_ = 0.f; + float x388_ = 0.f; + float x38c_ = 0.f; + float x390_ = 0.f; + float x394_ = 0.f; + float x398_ = 0.f; + float x39c_ = 0.f; + float x3a0_ = 0.f; + CFidget x3a4_fidget; + zeus::CVector3f x3dc_; + zeus::CTransform x3e8_; + zeus::CTransform x418_; + zeus::CTransform x448_; + zeus::CTransform x478_; + zeus::CTransform x4a8_; + zeus::CTransform x4d8_; + zeus::CTransform x508_; + TUniqueId x538_thisId; + TUniqueId x53a_ = kInvalidUniqueId; + TUniqueId x53c_ = kInvalidUniqueId; + u32 x544_ = 0; + u32 x548_ = 0; + u32 x54c_ = 0; + CPlayerCameraBob x550_camBob; + u32 x658_ = 1; + float x65c_ = 0.f; + float x660_ = 0.f; + float x664_ = 0.f; + float x668_; + float x66c_; + TUniqueId x670_ = kInvalidUniqueId; + u32 x674_ = 0; + CGunMorph x678_morph; + bool x6a0_24_ = true; + float x6a4_ = 0.f; + float x6a8_ = 0.f; + float x6ac_ = 0.f; + float x6b0_ = 0.f; + float x6b4_ = 0.f; + float x6b8_ = 0.f; + float x6bc_ = 0.f; + u32 x6c0_ = 0; + u32 x6c4_ = 0; + zeus::CAABox x6c8_; + CModelData x6e0_; + u32 x72c_ = 0; + u32 x730_ = 0; + u32 x734_ = 0; + u32 x738_ = 0; + std::unique_ptr x73c_; + std::unique_ptr x740_; + std::unique_ptr x744_; + std::unique_ptr x74c_; + std::unique_ptr x750_; + std::unique_ptr x754_; + std::unique_ptr x758_; + std::unique_ptr x75c_; + u32 x760_[4] = {}; + std::unique_ptr x774_; + std::unique_ptr x82c_; + +public: + CPlayerGun(TUniqueId id); +}; + +} + +#endif // __URDE_CPLAYERGUN_HPP__ diff --git a/Runtime/World/CPowerBeam.cpp b/Runtime/World/CPowerBeam.cpp new file mode 100644 index 000000000..e69de29bb diff --git a/Runtime/World/CPowerBeam.hpp b/Runtime/World/CPowerBeam.hpp new file mode 100644 index 000000000..cf86879e9 --- /dev/null +++ b/Runtime/World/CPowerBeam.hpp @@ -0,0 +1,15 @@ +#ifndef __URDE_CPOWERBEAM_HPP__ +#define __URDE_CPOWERBEAM_HPP__ + +#include "CGunWeapon.hpp" + +namespace urde +{ + +class CPowerBeam : public CGunWeapon +{ +}; + +} + +#endif // __URDE_CPOWERBEAM_HPP__ diff --git a/Runtime/World/CScriptSpawnPoint.cpp b/Runtime/World/CScriptSpawnPoint.cpp index ec3053ad7..e7f39667a 100644 --- a/Runtime/World/CScriptSpawnPoint.cpp +++ b/Runtime/World/CScriptSpawnPoint.cpp @@ -5,9 +5,19 @@ namespace urde CScriptSpawnPoint::CScriptSpawnPoint(TUniqueId uid, const std::string& name, const CEntityInfo& info, const zeus::CTransform& xf, const std::vector& itemCounts, - bool, bool active, bool) -: CEntity(uid, info, active, name) + bool defaultSpawn, bool active, bool b3) +: CEntity(uid, info, active, name), x34_xf(xf), x64_itemCounts(itemCounts) { + x10c_24_firstSpawn = defaultSpawn; + x10c_25_ = b3; +} + +u32 CScriptSpawnPoint::GetPowerup(CPlayerState::EItemType item) const +{ + int idx = int(item); + if (idx >= x64_itemCounts.size()) + return x64_itemCounts.front(); + return x64_itemCounts[idx]; } } diff --git a/Runtime/World/CScriptSpawnPoint.hpp b/Runtime/World/CScriptSpawnPoint.hpp index f79447b4d..1fea0be73 100644 --- a/Runtime/World/CScriptSpawnPoint.hpp +++ b/Runtime/World/CScriptSpawnPoint.hpp @@ -3,16 +3,32 @@ #include "CEntity.hpp" #include "zeus/CTransform.hpp" +#include "CPlayerState.hpp" namespace urde { class CScriptSpawnPoint : public CEntity { + zeus::CTransform x34_xf; + std::vector x64_itemCounts; + union + { + struct + { + bool x10c_24_firstSpawn : 1; + bool x10c_25_ : 1; + }; + u8 _dummy = 0; + }; public: CScriptSpawnPoint(TUniqueId, const std::string& name, const CEntityInfo& info, const zeus::CTransform& xf, const std::vector& itemCounts, bool, bool, bool); + + bool FirstSpawn() const { return x10c_24_firstSpawn; } + const zeus::CTransform& GetTransform() const { return x34_xf; } + u32 GetPowerup(CPlayerState::EItemType item) const; }; } diff --git a/Runtime/World/CWaveBeam.cpp b/Runtime/World/CWaveBeam.cpp new file mode 100644 index 000000000..e69de29bb diff --git a/Runtime/World/CWaveBeam.hpp b/Runtime/World/CWaveBeam.hpp new file mode 100644 index 000000000..f43013b67 --- /dev/null +++ b/Runtime/World/CWaveBeam.hpp @@ -0,0 +1,15 @@ +#ifndef __URDE_CWAVEBEAM_HPP__ +#define __URDE_CWAVEBEAM_HPP__ + +#include "CGunWeapon.hpp" + +namespace urde +{ + +class CWaveBeam : public CGunWeapon +{ +}; + +} + +#endif // __URDE_CWAVEBEAM_HPP__ diff --git a/Runtime/World/CWorldShadow.cpp b/Runtime/World/CWorldShadow.cpp new file mode 100644 index 000000000..f8c9f0e1a --- /dev/null +++ b/Runtime/World/CWorldShadow.cpp @@ -0,0 +1,10 @@ +#include "CWorldShadow.hpp" + +namespace urde +{ + +CWorldShadow::CWorldShadow(u32, u32, bool) +{ +} + +} diff --git a/Runtime/World/CWorldShadow.hpp b/Runtime/World/CWorldShadow.hpp new file mode 100644 index 000000000..8a87226ab --- /dev/null +++ b/Runtime/World/CWorldShadow.hpp @@ -0,0 +1,17 @@ +#ifndef __URDE_CWORLDSHADOW_HPP__ +#define __URDE_CWORLDSHADOW_HPP__ + +#include "RetroTypes.hpp" + +namespace urde +{ + +class CWorldShadow +{ +public: + CWorldShadow(u32, u32, bool); +}; + +} + +#endif // __URDE_CWORLDSHADOW_HPP__ diff --git a/hecl b/hecl index d50aeab9f..f978570bf 160000 --- a/hecl +++ b/hecl @@ -1 +1 @@ -Subproject commit d50aeab9f16b3b6c06125316022fa7398024c68d +Subproject commit f978570bf0f8297fd6b81acb122bb2b256bfae92