Plenty of dependency stubs for CStateManager

This commit is contained in:
Jack Andersen 2016-08-14 11:11:44 -10:00
parent 91b5b3ed73
commit 24bfc47d1a
58 changed files with 983 additions and 30 deletions

View File

@ -369,7 +369,9 @@ void AROTBuilder::build(std::vector<std::vector<uint8_t>>& secs, const zeus::CAA
std::pair<std::unique_ptr<uint8_t[]>, uint32_t> AROTBuilder::buildCol(const ColMesh& mesh, BspNodeType& rootOut) std::pair<std::unique_ptr<uint8_t[]>, 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; int t = 0;
for (const ColMesh::Triangle& tri : mesh.trianges) for (const ColMesh::Triangle& tri : mesh.trianges)

View File

@ -34,4 +34,6 @@ add_library(DNACommon
Tweaks/ITweakGame.hpp Tweaks/ITweakGame.hpp
Tweaks/ITweakParticle.hpp Tweaks/ITweakParticle.hpp
Tweaks/ITweakPlayer.hpp Tweaks/ITweakPlayer.hpp
Tweaks/ITweakPlayerControl.hpp) Tweaks/ITweakPlayerControl.hpp
Tweaks/ITweakPlayerGun.hpp
Tweaks/ITweakGunRes.hpp)

View File

@ -87,10 +87,15 @@ void DeafBabeBuildFromBlender(DEAFBABE& db, const hecl::BlenderConnection::DataS
} }
db.materialCount = colMesh.materials.size(); db.materialCount = colMesh.materials.size();
zeus::CAABox fullAABB;
db.verts.reserve(colMesh.verts.size()); db.verts.reserve(colMesh.verts.size());
db.vertMats.resize(colMesh.verts.size()); db.vertMats.resize(colMesh.verts.size());
for (const auto& vert : colMesh.verts) for (const auto& vert : colMesh.verts)
{
fullAABB.accumulateBounds(zeus::CVector3f(vert));
db.verts.push_back(vert); db.verts.push_back(vert);
}
db.vertMatsCount = colMesh.verts.size(); db.vertMatsCount = colMesh.verts.size();
db.vertCount = 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.length = db.binarySize(0) - 8;
db.magic = 0xDEAFBABE; db.magic = 0xDEAFBABE;
db.version = 3; db.version = 3;
db.aabb[0] = colMesh.aabbMin; db.aabb[0] = fullAABB.min;
db.aabb[1] = colMesh.aabbMax; db.aabb[1] = fullAABB.max;
} }
template void DeafBabeBuildFromBlender<DNAMP1::DeafBabe>(DNAMP1::DeafBabe& db, const hecl::BlenderConnection::DataStream::ColMesh& colMesh); template void DeafBabeBuildFromBlender<DNAMP1::DeafBabe>(DNAMP1::DeafBabe& db, const hecl::BlenderConnection::DataStream::ColMesh& colMesh);

View File

@ -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

View File

@ -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__

View File

@ -19,7 +19,9 @@ make_dnalist(liblist
Tweaks/CTweakGame Tweaks/CTweakGame
Tweaks/CTweakParticle Tweaks/CTweakParticle
Tweaks/CTweakPlayer Tweaks/CTweakPlayer
Tweaks/CTweakPlayerControl) Tweaks/CTweakPlayerControl
Tweaks/CTweakPlayerGun
Tweaks/CTweakGunRes)
add_library(DNAMP1 add_library(DNAMP1
DNAMP1.hpp DNAMP1.cpp DNAMP1.hpp DNAMP1.cpp

View File

@ -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_

View File

@ -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_

View File

@ -5,8 +5,15 @@
namespace urde namespace urde
{ {
CGameState::CGameState()
{
x228_25_deferPowerupInit = true;
}
CGameState::CGameState(CBitStreamReader& stream) CGameState::CGameState(CBitStreamReader& stream)
{ {
x228_25_deferPowerupInit = true;
for (u32 i = 0; i < 128; i++) for (u32 i = 0; i < 128; i++)
stream.ReadEncoded(8); stream.ReadEncoded(8);
u32 tmp = stream.ReadEncoded(32); u32 tmp = stream.ReadEncoded(32);

View File

@ -22,6 +22,8 @@ public:
class CGameState class CGameState
{ {
friend class CStateManager;
int m_stateFlag = -1; int m_stateFlag = -1;
ResId x84_mlvlId = -1; ResId x84_mlvlId = -1;
std::vector<CWorldState> x88_worldStates; std::vector<CWorldState> x88_worldStates;
@ -30,8 +32,18 @@ class CGameState
float m_gameTime = 0.0; float m_gameTime = 0.0;
CGameOptions m_gameOpts; CGameOptions m_gameOpts;
double xa0_playTime; double xa0_playTime;
union
{
struct
{
bool x228_24_;
bool x228_25_deferPowerupInit;
};
u8 _dummy = 0;
};
public: public:
CGameState() = default; CGameState();
CGameState(CBitStreamReader& stream); CGameState(CBitStreamReader& stream);
void SetCurrentWorldId(unsigned int id, const std::string& name); void SetCurrentWorldId(unsigned int id, const std::string& name);
CWorldTransManager& WorldTransitionManager() {return x9c_transManager;} CWorldTransManager& WorldTransitionManager() {return x9c_transManager;}

View File

@ -11,14 +11,14 @@ void CObjectList::AddObject(CEntity& entity)
{ {
if (IsQualified()) if (IsQualified())
{ {
if (m_lastId != -1) if (m_firstId != -1)
m_list[m_lastId].next = entity.GetUniqueId() & 0x3ff; m_list[m_firstId].prev = entity.GetUniqueId() & 0x3ff;
TUniqueId prevLast = m_lastId; TUniqueId prevFirst = m_firstId;
m_lastId = entity.GetUniqueId() & 0x3ff; m_firstId = entity.GetUniqueId() & 0x3ff;
SObjectListEntry& newEnt = m_list[m_lastId]; SObjectListEntry& newEnt = m_list[m_firstId];
newEnt.entity = &entity; newEnt.entity = &entity;
newEnt.prev = prevLast; newEnt.next = prevFirst;
newEnt.next = -1; newEnt.prev = -1;
++m_count; ++m_count;
} }
} }
@ -29,21 +29,21 @@ void CObjectList::RemoveObject(TUniqueId uid)
SObjectListEntry& ent = m_list[uid]; SObjectListEntry& ent = m_list[uid];
if (!ent.entity || ent.entity->GetUniqueId() != uid) if (!ent.entity || ent.entity->GetUniqueId() != uid)
return; return;
if (uid == m_lastId) if (uid == m_firstId)
{ {
m_lastId = ent.prev; m_firstId = ent.next;
if (ent.prev != -1) if (ent.next != -1)
m_list[ent.prev].next = -1; m_list[ent.next].prev = -1;
} }
else else
{ {
if (ent.prev != -1) if (ent.next != -1)
m_list[ent.prev].next = -1; m_list[ent.next].prev = -1;
m_list[ent.next].prev = -1; m_list[ent.prev].next = -1;
} }
ent.entity = nullptr; ent.entity = nullptr;
ent.prev = -1;
ent.next = -1; ent.next = -1;
ent.prev = -1;
--m_count; --m_count;
} }
@ -51,14 +51,20 @@ const CEntity* CObjectList::GetObjectById(TUniqueId uid) const
{ {
if (!uid) if (!uid)
return nullptr; 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) CEntity* CObjectList::GetObjectById(TUniqueId uid)
{ {
if (!uid) if (!uid)
return nullptr; 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;} bool CObjectList::IsQualified() {return true;}

View File

@ -27,12 +27,12 @@ class CObjectList
struct SObjectListEntry struct SObjectListEntry
{ {
CEntity* entity = nullptr; CEntity* entity = nullptr;
TUniqueId prev = -1;
TUniqueId next = -1; TUniqueId next = -1;
TUniqueId prev = -1;
}; };
SObjectListEntry m_list[1024]; SObjectListEntry m_list[1024];
EGameObjectList m_listEnum; EGameObjectList m_listEnum;
TUniqueId m_lastId = -1; TUniqueId m_firstId = -1;
u16 m_count = 0; u16 m_count = 0;
int m_areaIdx = 0; int m_areaIdx = 0;
public: public:
@ -42,6 +42,8 @@ public:
void RemoveObject(TUniqueId uid); void RemoveObject(TUniqueId uid);
const CEntity* GetObjectById(TUniqueId uid) const; const CEntity* GetObjectById(TUniqueId uid) const;
CEntity* GetObjectById(TUniqueId uid); CEntity* GetObjectById(TUniqueId uid);
TUniqueId GetFirstObjectIndex() const { return m_firstId; }
TUniqueId GetNextObjectIndex(TUniqueId prev) const { return m_list[prev].next; }
virtual bool IsQualified(); virtual bool IsQualified();
}; };

View File

@ -162,6 +162,7 @@ public:
CPlayerState() : x188_staticIntf(5) { x0_24_ = true; } CPlayerState() : x188_staticIntf(5) { x0_24_ = true; }
CPlayerState(CBitStreamReader& stream); CPlayerState(CBitStreamReader& stream);
void PutTo(CBitStreamWriter& stream); void PutTo(CBitStreamWriter& stream);
}; };
} }

View File

@ -14,7 +14,9 @@
#include "CPlayerState.hpp" #include "CPlayerState.hpp"
#include "CGameState.hpp" #include "CGameState.hpp"
#include "World/CPlayer.hpp" #include "World/CPlayer.hpp"
#include "World/CPlayerGun.hpp"
#include "World/CMorphBall.hpp" #include "World/CMorphBall.hpp"
#include "World/CScriptSpawnPoint.hpp"
#include "AutoMapper/CMapWorldInfo.hpp" #include "AutoMapper/CMapWorldInfo.hpp"
#include <cmath> #include <cmath>
@ -361,7 +363,7 @@ void CStateManager::RecursiveDrawTree(TUniqueId) const
void CStateManager::SendScriptMsg(CEntity* dest, TUniqueId src, EScriptObjectMessage msg) 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); 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); x850_world->TravelToArea(x8cc_nextAreaId, *this, true);
UpdateRoomAcoustics(x8cc_nextAreaId); 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<CScriptSpawnPoint*>(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 */ /* TODO: Finish */
} }

View File

@ -0,0 +1,10 @@
#include "CActorLights.hpp"
namespace urde
{
CActorLights::CActorLights(u32, const zeus::CVector3f& vec, int, int, float)
{
}
}

View File

@ -1,12 +1,16 @@
#ifndef __URDE_CACTORLIGHTS_HPP__ #ifndef __URDE_CACTORLIGHTS_HPP__
#define __URDE_CACTORLIGHTS_HPP__ #define __URDE_CACTORLIGHTS_HPP__
#include "RetroTypes.hpp"
#include "zeus/CVector3f.hpp"
namespace urde namespace urde
{ {
class CActorLights class CActorLights
{ {
public: public:
CActorLights(u32, const zeus::CVector3f& vec, int, int, float);
void ActivateLights() const {} void ActivateLights() const {}
}; };

View File

@ -3,6 +3,8 @@
#include "../DataSpec/DNACommon/Tweaks/ITweakGame.hpp" #include "../DataSpec/DNACommon/Tweaks/ITweakGame.hpp"
#include "../DataSpec/DNACommon/Tweaks/ITweakPlayer.hpp" #include "../DataSpec/DNACommon/Tweaks/ITweakPlayer.hpp"
#include "../DataSpec/DNACommon/Tweaks/ITweakPlayerControl.hpp" #include "../DataSpec/DNACommon/Tweaks/ITweakPlayerControl.hpp"
#include "../DataSpec/DNACommon/Tweaks/ITweakPlayerGun.hpp"
#include "../DataSpec/DNACommon/Tweaks/ITweakGunRes.hpp"
#include "AutoMapper/ITweakAutoMapper.hpp" #include "AutoMapper/ITweakAutoMapper.hpp"
#include "GuiSys/ITweakGui.hpp" #include "GuiSys/ITweakGui.hpp"
@ -21,6 +23,8 @@ extern class CBooRenderer* g_Renderer;
extern DataSpec::ITweakGame* g_tweakGame; extern DataSpec::ITweakGame* g_tweakGame;
extern DataSpec::ITweakPlayer* g_tweakPlayer; extern DataSpec::ITweakPlayer* g_tweakPlayer;
extern DataSpec::ITweakPlayerControl* g_tweakPlayerControl; extern DataSpec::ITweakPlayerControl* g_tweakPlayerControl;
extern DataSpec::ITweakPlayerGun* g_tweakPlayerGun;
extern DataSpec::ITweakGunRes* g_tweakGunRes;
extern ITweakAutoMapper* g_tweakAutoMapper; extern ITweakAutoMapper* g_tweakAutoMapper;
extern ITweakGui* g_tweakGui; extern ITweakGui* g_tweakGui;

View File

View File

@ -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__

View File

@ -31,6 +31,7 @@ public:
class CEntity class CEntity
{ {
friend class CStateManager; friend class CStateManager;
friend class CObjectList;
protected: protected:
TAreaId x4_areaId; TAreaId x4_areaId;
TUniqueId x8_uid; TUniqueId x8_uid;
@ -44,7 +45,7 @@ protected:
{ {
bool x30_24_active : 1; bool x30_24_active : 1;
bool x30_25_ : 1; bool x30_25_ : 1;
bool x30_26_messagesBlocked : 1; bool x30_26_scriptingBlocked : 1;
bool x30_27_ : 1; bool x30_27_ : 1;
}; };
u8 _dummy = 0; u8 _dummy = 0;

View File

31
Runtime/World/CFidget.hpp Normal file
View File

@ -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__

View File

View File

@ -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__

View File

View File

@ -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__

View File

View File

@ -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__

View File

View File

@ -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__

View File

@ -0,0 +1,12 @@
#include "CGunController.hpp"
namespace urde
{
CGunController::CGunController(CModelData& modelData)
: x0_modelData(modelData)
{
x58_24_ = true;
}
}

View File

@ -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__

View File

View File

@ -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__

View File

@ -0,0 +1,10 @@
#include "CGunWeapon.hpp"
namespace urde
{
CGunWeapon::CGunWeapon(u32, EWeaponType type, TUniqueId, EMaterialTypes, const zeus::CVector3f& vec)
{
}
}

View File

@ -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__

View File

View File

@ -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__

View File

@ -4,6 +4,22 @@ set(WORLD_SOURCES
IGameArea.hpp IGameArea.cpp IGameArea.hpp IGameArea.cpp
CGameArea.hpp CGameArea.cpp CGameArea.hpp CGameArea.cpp
CPlayer.hpp CPlayer.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 CMorphBall.hpp CMorphBall.cpp
CActor.hpp CActor.cpp CActor.hpp CActor.cpp
CAi.hpp CAi.cpp CAi.hpp CAi.cpp
@ -67,6 +83,7 @@ set(WORLD_SOURCES
CHealthInfo.hpp CHealthInfo.cpp CHealthInfo.hpp CHealthInfo.cpp
CPatterned.hpp CPatterned.cpp CPatterned.hpp CPatterned.cpp
CHUDMemoParms.hpp CHUDMemoParms.cpp CHUDMemoParms.hpp CHUDMemoParms.cpp
CWorldShadow.hpp CWorldShadow.cpp
CFluidPlane.hpp) CFluidPlane.hpp)
runtime_add_list(World WORLD_SOURCES) runtime_add_list(World WORLD_SOURCES)

View File

View File

@ -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__

View File

View File

@ -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__

View File

@ -1,6 +1,7 @@
#include "CPlayer.hpp" #include "CPlayer.hpp"
#include "CActorParameters.hpp" #include "CActorParameters.hpp"
#include "CMorphBall.hpp" #include "CMorphBall.hpp"
#include "CPlayerGun.hpp"
namespace urde namespace urde
{ {
@ -18,4 +19,8 @@ CPlayer::CPlayer(TUniqueId uid, const zeus::CTransform& xf, const zeus::CAABox&
x768_morphball.reset(new CMorphBall(*this, f4)); x768_morphball.reset(new CMorphBall(*this, f4));
} }
void CPlayer::Teleport(const zeus::CTransform& xf, CStateManager& mgr, bool)
{
}
} }

View File

@ -9,14 +9,20 @@ namespace urde
{ {
class CMaterialList; class CMaterialList;
class CMorphBall; class CMorphBall;
class CPlayerGun;
class CPlayer : public CPhysicsActor class CPlayer : public CPhysicsActor
{ {
friend class CStateManager;
std::unique_ptr<CPlayerGun> x490_gun;
std::unique_ptr<CMorphBall> x768_morphball; std::unique_ptr<CMorphBall> x768_morphball;
public: public:
CPlayer(TUniqueId, const zeus::CTransform&, const zeus::CAABox&, unsigned int, CPlayer(TUniqueId, const zeus::CTransform&, const zeus::CAABox&, unsigned int,
const zeus::CVector3f&, float, float, float, float, const CMaterialList&); const zeus::CVector3f&, float, float, float, float, const CMaterialList&);
void Teleport(const zeus::CTransform& xf, CStateManager& mgr, bool);
}; };
} }

View File

@ -0,0 +1,10 @@
#include "CPlayerCameraBob.hpp"
namespace urde
{
CPlayerCameraBob::CPlayerCameraBob(ECameraBobType type, const zeus::CVector2f& vec, float)
{
}
}

View File

@ -0,0 +1,55 @@
#ifndef __URDE_CPLAYERCAMERABOB_HPP__
#define __URDE_CPLAYERCAMERABOB_HPP__
#include <float.h>
#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__

View File

@ -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 */
}
}

View File

@ -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<CGunMotion> x73c_;
std::unique_ptr<CGrappleArm> x740_;
std::unique_ptr<CAuxWeapon> x744_;
std::unique_ptr<CPowerBeam> x74c_;
std::unique_ptr<CIceBeam> x750_;
std::unique_ptr<CWaveBeam> x754_;
std::unique_ptr<CPlasmaBeam> x758_;
std::unique_ptr<CPhazonBeam> x75c_;
u32 x760_[4] = {};
std::unique_ptr<CElementGen> x774_;
std::unique_ptr<CWorldShadow> x82c_;
public:
CPlayerGun(TUniqueId id);
};
}
#endif // __URDE_CPLAYERGUN_HPP__

View File

View File

@ -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__

View File

@ -5,9 +5,19 @@ namespace urde
CScriptSpawnPoint::CScriptSpawnPoint(TUniqueId uid, const std::string& name, const CEntityInfo& info, CScriptSpawnPoint::CScriptSpawnPoint(TUniqueId uid, const std::string& name, const CEntityInfo& info,
const zeus::CTransform& xf, const std::vector<u32>& itemCounts, const zeus::CTransform& xf, const std::vector<u32>& itemCounts,
bool, bool active, bool) bool defaultSpawn, bool active, bool b3)
: CEntity(uid, info, active, name) : 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];
} }
} }

View File

@ -3,16 +3,32 @@
#include "CEntity.hpp" #include "CEntity.hpp"
#include "zeus/CTransform.hpp" #include "zeus/CTransform.hpp"
#include "CPlayerState.hpp"
namespace urde namespace urde
{ {
class CScriptSpawnPoint : public CEntity class CScriptSpawnPoint : public CEntity
{ {
zeus::CTransform x34_xf;
std::vector<u32> x64_itemCounts;
union
{
struct
{
bool x10c_24_firstSpawn : 1;
bool x10c_25_ : 1;
};
u8 _dummy = 0;
};
public: public:
CScriptSpawnPoint(TUniqueId, const std::string& name, const CEntityInfo& info, CScriptSpawnPoint(TUniqueId, const std::string& name, const CEntityInfo& info,
const zeus::CTransform& xf, const std::vector<u32>& itemCounts, const zeus::CTransform& xf, const std::vector<u32>& itemCounts,
bool, bool, bool); bool, bool, bool);
bool FirstSpawn() const { return x10c_24_firstSpawn; }
const zeus::CTransform& GetTransform() const { return x34_xf; }
u32 GetPowerup(CPlayerState::EItemType item) const;
}; };
} }

View File

View File

@ -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__

View File

@ -0,0 +1,10 @@
#include "CWorldShadow.hpp"
namespace urde
{
CWorldShadow::CWorldShadow(u32, u32, bool)
{
}
}

View File

@ -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__

2
hecl

@ -1 +1 @@
Subproject commit d50aeab9f16b3b6c06125316022fa7398024c68d Subproject commit f978570bf0f8297fd6b81acb122bb2b256bfae92