This commit is contained in:
Jack Andersen 2017-01-21 15:53:11 -10:00
commit e9222c7aba
38 changed files with 514 additions and 187 deletions

View File

@ -31,6 +31,7 @@ set(DNACOMMON_SOURCES
BabeDead.hpp BabeDead.cpp
RigInverter.hpp RigInverter.cpp
AROTBuilder.hpp AROTBuilder.cpp
Tweaks/ITweak.hpp
Tweaks/TweakWriter.hpp
Tweaks/ITweakGame.hpp
Tweaks/ITweakParticle.hpp
@ -40,7 +41,8 @@ set(DNACOMMON_SOURCES
Tweaks/ITweakGunRes.hpp
Tweaks/ITweakPlayerRes.hpp
Tweaks/ITweakGui.hpp
Tweaks/ITweakSlideShow.hpp)
Tweaks/ITweakSlideShow.hpp
Tweaks/ITweakTargeting.hpp)
dataspec_add_list(DNACommon DNACOMMON_SOURCES)
list(APPEND DNACOMMON_SOURCES ${liblist})

View File

@ -0,0 +1,13 @@
#ifndef __DNACOMMON_ITWEAK_HPP__
#define __DNACOMMON_ITWEAK_HPP__
#include "../DNACommon.hpp"
namespace DataSpec
{
struct ITweak : BigYAML
{
};
}
#endif // __DNACOMMON_ITWEAK_HPP__

View File

@ -1,12 +1,12 @@
#ifndef __DNACOMMON_ITWEAKGAME_HPP__
#define __DNACOMMON_ITWEAKGAME_HPP__
#include "../DNACommon.hpp"
#include "ITweak.hpp"
namespace DataSpec
{
struct ITweakGame : BigYAML
struct ITweakGame : ITweak
{
virtual const std::string& GetWorldPrefix() const = 0;
virtual bool GetSplashScreensDisabled() const = 0;

View File

@ -1,13 +1,13 @@
#ifndef __DNACOMMON_ITWEAKGUI_HPP__
#define __DNACOMMON_ITWEAKGUI_HPP__
#include "../DNACommon.hpp"
#include "ITweak.hpp"
#include "zeus/CVector2f.hpp"
namespace DataSpec
{
struct ITweakGui : BigYAML
struct ITweakGui : ITweak
{
virtual float GetScanSpeed(int idx) const=0;
virtual float GetXrayBlurScaleLinear() const=0;

View File

@ -1,13 +1,13 @@
#ifndef __DNACOMMON_ITWEAKGUNRES_HPP__
#define __DNACOMMON_ITWEAKGUNRES_HPP__
#include "../DNACommon.hpp"
#include "ITweak.hpp"
#include "Runtime/IFactory.hpp"
namespace DataSpec
{
struct ITweakGunRes : BigYAML
struct ITweakGunRes : ITweak
{
using ResId = int64_t;
enum class EBeamId

View File

@ -1,12 +1,12 @@
#ifndef __DNACOMMON_ITWEAKPARTICLE_HPP__
#define __DNACOMMON_ITWEAKPARTICLE_HPP__
#include "../DNACommon.hpp"
#include "ITweak.hpp"
namespace DataSpec
{
struct ITweakParticle : BigYAML
struct ITweakParticle : ITweak
{
};

View File

@ -1,13 +1,13 @@
#ifndef __DNACOMMON_ITWEAKPLAYER_HPP__
#define __DNACOMMON_ITWEAKPLAYER_HPP__
#include "../DNACommon.hpp"
#include "ITweak.hpp"
#include "zeus/CAABox.hpp"
namespace DataSpec
{
struct ITweakPlayer : BigYAML
struct ITweakPlayer : ITweak
{
virtual float GetX50() const=0;
virtual float GetX54() const=0;

View File

@ -1,12 +1,12 @@
#ifndef __DNACOMMON_ITWEAKPLAYERCONTROL_HPP__
#define __DNACOMMON_ITWEAKPLAYERCONTROL_HPP__
#include "../DNACommon.hpp"
#include "ITweak.hpp"
namespace DataSpec
{
struct ITweakPlayerControl : BigYAML
struct ITweakPlayerControl : ITweak
{
virtual atUint32 GetMapping(atUint32) const=0;
};

View File

@ -1,13 +1,13 @@
#ifndef __DNACOMMON_ITWEAKPLAYERGUN_HPP__
#define __DNACOMMON_ITWEAKPLAYERGUN_HPP__
#include "../DNACommon.hpp"
#include "ITweak.hpp"
#include "zeus/CAABox.hpp"
namespace DataSpec
{
struct ITweakPlayerGun : BigYAML
struct ITweakPlayerGun : ITweak
{
virtual float GetSomething1() const=0; // x24
virtual float GetSomething2() const=0; // x28

View File

@ -1,13 +1,13 @@
#ifndef __DNACOMMON_ITWEAKPLAYERRES_HPP__
#define __DNACOMMON_ITWEAKPLAYERRES_HPP__
#include "../DNACommon.hpp"
#include "ITweak.hpp"
#include "Runtime/IFactory.hpp"
namespace DataSpec
{
struct ITweakPlayerRes : BigYAML
struct ITweakPlayerRes : ITweak
{
using ResId = int64_t;
enum class EBeamId

View File

@ -1,12 +1,12 @@
#ifndef __DNACOMMON_ITWEAKSLIDESHOW_HPP__
#define __DNACOMMON_ITWEAKSLIDESHOW_HPP__
#include "../DNACommon.hpp"
#include "ITweak.hpp"
namespace DataSpec
{
struct ITweakSlideShow : BigYAML
struct ITweakSlideShow : ITweak
{
virtual const std::string& GetFont() const=0;
virtual const zeus::CColor& GetFontColor() const=0;

View File

@ -0,0 +1,12 @@
#ifndef __DNACOMMON_ITWEAKTARGETING_HPP__
#define __DNACOMMON_ITWEAKTARGETING_HPP__
#include "ITweak.hpp"
namespace DataSpec
{
struct ITweakTargeting : public ITweak
{
};
}
#endif // __DNACOMMON_ITWEAKTARGETING_HPP__

View File

@ -28,7 +28,8 @@ make_dnalist(liblist DNAMP1
Tweaks/CTweakPlayerRes
Tweaks/CTweakGui
Tweaks/CTweakSlideShow
Tweaks/CTweakCameraBob)
Tweaks/CTweakCameraBob
Tweaks/CTweakTargeting)
set(DNAMP1_SOURCES
DNAMP1.hpp DNAMP1.cpp
@ -48,7 +49,8 @@ set(DNAMP1_SOURCES
SCLY.hpp SCLY.cpp
FRME.cpp
DeafBabe.cpp
Tweaks/CTweakPlayer.cpp)
Tweaks/CTweakPlayer.cpp
Tweaks/CTweakTargeting.cpp)
dataspec_add_list(DNAMP1 DNAMP1_SOURCES)
list(APPEND DNAMP1_SOURCES ${liblist})

View File

@ -33,6 +33,7 @@
#include "Tweaks/CTweakCameraBob.hpp"
#include "Tweaks/CTweakSlideShow.hpp"
#include "Tweaks/CTweakGame.hpp"
#include "Tweaks/CTweakTargeting.hpp"
namespace DataSpec
{
@ -385,6 +386,8 @@ ResExtractor<PAKBridge> PAKBridge::LookupExtractor(const PAK& pak, const PAK::En
return {ExtractTweak<CTweakSlideShow>, {_S(".yaml")}};
if (!name.compare("Game"))
return {ExtractTweak<CTweakGame>, {_S(".yaml")}};
if (!name.compare("Targeting"))
return {ExtractTweak<CTweakTargeting>, {_S(".yaml")}};
}
break;
}

View File

@ -0,0 +1,153 @@
#ifndef _DNAMP1_CTWEAKTARGETING_HPP_
#define _DNAMP1_CTWEAKTARGETING_HPP_
#include "../../DNACommon/Tweaks/ITweakTargeting.hpp"
namespace DataSpec
{
namespace DNAMP1
{
struct CTweakTargeting : public ITweakTargeting
{
DECL_YAML
Value<atUint32> x4_;
Value<float> x8_;
Value<float> xc_;
Value<float> x10_;
Value<float> x14_;
Value<float> x18_;
Value<float> x1c_;
Value<float> x20_;
Value<float> x24_;
Value<float> x28_;
Value<float> x2c_;
Value<atVec3f> x30_;
Value<atVec3f> x3c_;
Value<float> x48_;
Value<float> x4c_;
Value<float> x50_;
Value<float> x54_;
Value<float> x58_;
Value<float> x5c_;
Value<atVec3f> x60_;
Value<atVec3f> x6c_;
Value<atVec3f> x78_;
Value<atVec3f> x84_;
Value<float> x90_;
Value<float> x94_;
Value<float> x98_;
Value<float> x9c_;
Value<float> xa0_;
Value<float> xa4_;
Value<float> xa8_;
Value<float> xac_;
Value<atVec4f> xb0_;
Value<float> xb4_;
Value<atVec4f> xb8_;
Value<float> xbc_;
Value<float> xc0_;
Value<float> xc4_;
Value<float> xc8_;
Value<atVec4f> xcc_;
Value<float> xd0_;
Value<float> xd4_;
Value<atVec4f> xd8_;
Value<atVec4f> xdc_;
Value<atVec4f> xe0_;
Value<atVec4f> xe4_;
Value<float> xe8_;
Value<float> xec_;
Value<float> xf0_;
Value<atVec4f> xf4_;
Value<atUint32> xf8_entryCount;
struct UnkVec : BigYAML
{
DECL_YAML
Value<atUint32> count;
Vector<float, DNA_COUNT(count)> floats;
};
Vector<UnkVec, DNA_COUNT(xf8_entryCount)> xf8_;
Value<atUint32> x108_entryCount;
Vector<float, DNA_COUNT(x108_entryCount)> x108_;
Value<float> x118_;
Value<atVec4f> x11c_;
Value<atUint32> x120_;
Value<float> x124_;
Value<float> x128_;
Value<float> x12c_;
Value<atVec4f> x130_;
Value<float> x134_;
Value<float> x138_;
Value<atVec4f> x13c_;
Value<float> x140_;
Value<float> x144_;
Value<float> x148_;
Value<atVec4f> x14c_;
Value<atVec4f> x150_;
Value<float> x154_;
Value<float> x158_;
Value<float> x15c_;
Value<float> x160_;
Value<float> x164_;
Value<float> x168_;
Value<float> x16c_;
Value<float> x170_;
Value<float> x174_;
Value<float> x178_;
Value<float> x17c_;
Value<float> x180_;
Value<float> x184_;
Value<float> x188_;
Value<float> x18c_;
Value<float> x190_;
Value<float> x194_;
Value<float> x198_;
Value<float> x19c_;
Value<float> x1a0_;
Value<atVec4f> x1a4_;
Value<atVec4f> x1a8_;
Value<atVec4f> x1ac_;
Value<float> x1b0_;
Value<atVec4f> x1b4_;
Value<float> x1b8_;
Value<atVec4f> x1bc_;
Value<atVec4f> x1c0_;
Value<float> x1c4_;
Value<bool> x1c8_;
Value<atVec4f> x1cc_;
Value<float> x1d0_;
Value<atVec4f> x1d4_;
Value<atVec4f> x1d8_;
Value<atVec4f> x1dc_;
Value<float> x1e0_;
Value<float> x1e4_;
Value<float> x1e8_;
Value<float> x1ec_;
Value<float> x1f0_;
Value<float> x1f4_;
Value<float> x1f8_;
Value<float> x1fc_;
Value<float> x200_;
Value<float> x204_;
Value<float> x208_;
Value<float> x20c_;
Value<float> x210_;
Value<atVec4f> x214_;
Value<float> x218_;
Value<float> x21c_;
Value<float> x220_;
Value<float> x224_;
CTweakTargeting() = default;
CTweakTargeting(athena::io::IStreamReader& r)
{
this->read(r);
x124_ = -1.f * ((2 * M_PIF) * (0.003f * x124_));
x140_ = (2.f * M_PIF) * (0.003f * x140_);
x144_ = (2.f * M_PIF) * (0.003f * x144_);
x208_ = (2.f * M_PIF) * (0.003f * x208_);
}
};
}
}
#endif // _DNAMP1_CTWEAKTARGETING_HPP_

View File

@ -1,108 +1,148 @@
#include "CParticleGenInfo.hpp"
#include "Graphics/IRenderer.hpp"
#include "Particle/CParticleGen.hpp"
#include "GameGlobalObjects.hpp"
#include "World/CGameLight.hpp"
#include "CStateManager.hpp"
#include "Graphics/CBooRenderer.hpp"
#include "TCastTo.hpp"
namespace urde
{
CParticleGenInfo::CParticleGenInfo(const SObjectTag& part, int frameCount, const std::string& boneName,
const zeus::CVector3f& scale, CParticleData::EParentedMode parentMode,
int a)
: x4_part(part), xc_seconds(frameCount / 60.f), x10_boneName(boneName), x28_parentMode(parentMode),
x2c_a(a), x30_particleScale(scale)
{}
static TUniqueId _initializeLight(const std::weak_ptr<CParticleGen>& system,
CStateManager& stateMgr, int lightId)
const zeus::CVector3f& scale, CParticleData::EParentedMode parentMode, int a, int b)
: x4_part(part)
, xc_seconds(frameCount / 60.f)
, x10_boneName(boneName)
, x28_parentMode(parentMode)
, x2c_a(a)
, x30_particleScale(scale)
, x80_(b)
{
}
static TUniqueId _initializeLight(const std::weak_ptr<CParticleGen>& system, CStateManager& stateMgr, TAreaId areaId,
int lightId)
{
TUniqueId ret = kInvalidUniqueId;
std::shared_ptr<CParticleGen> systemRef = system.lock();
if (systemRef->SystemHasLight())
{
ret = stateMgr.AllocateUniqueId();
stateMgr.AddObject(
new CGameLight(ret, areaId, false, "ParticleLight",
zeus::CTransform(systemRef->GetOrientation().buildMatrix3f(), systemRef->GetTranslation()),
kInvalidUniqueId, systemRef->GetLight(), lightId, 0, 0.f));
}
return kInvalidUniqueId;
return ret;
}
CParticleGenInfoGeneric::CParticleGenInfoGeneric(const SObjectTag& part,
const std::weak_ptr<CParticleGen>& system,
CParticleGenInfoGeneric::CParticleGenInfoGeneric(const SObjectTag& part, const std::weak_ptr<CParticleGen>& system,
int frameCount, const std::string& boneName,
const zeus::CVector3f& scale,
CParticleData::EParentedMode parentMode,
int a, CStateManager& stateMgr, int lightId)
: CParticleGenInfo(part, frameCount, boneName, scale, parentMode, a), x80_system(system)
const zeus::CVector3f& scale, CParticleData::EParentedMode parentMode,
int a, CStateManager& stateMgr, TAreaId areaId, int lightId, int b)
: CParticleGenInfo(part, frameCount, boneName, scale, parentMode, a, b), x84_system(system)
{
if (lightId == -1)
x84_lightId = kInvalidUniqueId;
x88_lightId = kInvalidUniqueId;
else
x84_lightId = _initializeLight(system, stateMgr, lightId);
x88_lightId = _initializeLight(system, stateMgr, lightId, areaId);
}
void CParticleGenInfoGeneric::AddToRenderer()
{
}
void CParticleGenInfoGeneric::AddToRenderer() { g_Renderer->AddParticleGen(*x84_system.get()); }
void CParticleGenInfoGeneric::Render()
{
}
void CParticleGenInfoGeneric::Render() { x84_system->Render(); }
void CParticleGenInfoGeneric::Update(float dt, CStateManager& stateMgr)
{
x84_system->Update(dt);
if (x88_lightId != kInvalidUniqueId)
{
TCastToPtr<CGameLight> gl(stateMgr.ObjectById(x88_lightId));
if (gl)
gl->SetLight(x84_system->GetLight());
}
}
void CParticleGenInfoGeneric::SetOrientation(const zeus::CTransform& xf, CStateManager& stateMgr)
{
x84_system->SetOrientation(xf);
if (x88_lightId != kInvalidUniqueId)
{
TCastToPtr<CGameLight> gl(stateMgr.ObjectById(x88_lightId));
if (gl)
gl->SetRotation(zeus::CQuaternion(xf.buildMatrix3f()));
}
}
void CParticleGenInfoGeneric::SetTranslation(const zeus::CVector3f& trans, CStateManager& stateMgr)
{
x84_system->SetTranslation(trans);
if (x88_lightId != kInvalidUniqueId)
{
TCastToPtr<CGameLight> gl(stateMgr.ObjectById(x88_lightId));
if (gl)
gl->SetTranslation(trans);
}
}
void CParticleGenInfoGeneric::SetGlobalOrientation(const zeus::CTransform& xf, CStateManager& stateMgr)
{
x84_system->SetGlobalOrientation(xf);
if (x88_lightId != kInvalidUniqueId)
{
TCastToPtr<CGameLight> gl(stateMgr.ObjectById(x88_lightId));
if (gl)
gl->SetRotation(zeus::CQuaternion(xf.buildMatrix3f()));
}
}
void CParticleGenInfoGeneric::SetGlobalTranslation(const zeus::CVector3f& trans, CStateManager& stateMgr)
{
x84_system->SetGlobalTranslation(trans);
if (x88_lightId != kInvalidUniqueId)
{
TCastToPtr<CGameLight> gl(stateMgr.ObjectById(x88_lightId));
if (gl)
gl->SetTranslation(trans);
}
}
void CParticleGenInfoGeneric::SetGlobalScale(const zeus::CVector3f& scale)
void CParticleGenInfoGeneric::SetGlobalScale(const zeus::CVector3f& scale) { x84_system->SetGlobalScale(scale); }
void CParticleGenInfoGeneric::SetParticleEmission(bool emission, CStateManager& stateMgr)
{
x84_system->SetParticleEmission(emission);
TCastToPtr<CGameLight> gl(stateMgr.ObjectById(x88_lightId));
if (gl)
gl->SetActive(emission);
}
void CParticleGenInfoGeneric::SetParticleEmission(bool, CStateManager& stateMgr)
{
}
bool CParticleGenInfoGeneric::IsSystemDeletable() const
{
return false;
}
zeus::CAABox CParticleGenInfoGeneric::GetBounds() const
{
return {};
}
bool CParticleGenInfoGeneric::HasActiveParticles() const
{
return false;
}
void CParticleGenInfoGeneric::DestroyParticles()
{
}
bool CParticleGenInfoGeneric::HasLight() const
{
return false;
}
TUniqueId CParticleGenInfoGeneric::GetLightId() const
{
return kInvalidUniqueId;
}
void CParticleGenInfoGeneric::SetModulationColor(const zeus::CColor& color)
bool CParticleGenInfoGeneric::IsSystemDeletable() const { return x84_system->IsSystemDeletable(); }
rstl::optional_object<zeus::CAABox> CParticleGenInfoGeneric::GetBounds() const { return x84_system->GetBounds(); }
bool CParticleGenInfoGeneric::HasActiveParticles() const { return x84_system->GetParticleCount() != 0; }
void CParticleGenInfoGeneric::DestroyParticles() { x84_system->DestroyParticles(); }
bool CParticleGenInfoGeneric::HasLight() const { return x84_system->SystemHasLight(); }
TUniqueId CParticleGenInfoGeneric::GetLightId() const { return x88_lightId; }
void CParticleGenInfoGeneric::DeleteLight(CStateManager& mgr)
{
if (x88_lightId != kInvalidUniqueId)
mgr.DeleteObjectRequest(x88_lightId);
}
void CParticleGenInfoGeneric::SetModulationColor(const zeus::CColor& color) { x84_system->SetModulationColor(color); }
}

View File

@ -24,40 +24,61 @@ class CParticleGenInfo
zeus::CVector3f x30_particleScale;
float x3c_ = 0.f;
bool x40_ = false;
zeus::CTransform x44_;
zeus::CVector3f x74_;
zeus::CTransform x44_transform;
zeus::CVector3f x74_offset;
s32 x80_;
public:
CParticleGenInfo(const SObjectTag& part, int frameCount, const std::string& boneName,
const zeus::CVector3f&, CParticleData::EParentedMode parentMode, int a);
CParticleGenInfo(const SObjectTag& part, int frameCount, const std::string& boneName, const zeus::CVector3f&,
CParticleData::EParentedMode parentMode, int a, int b);
virtual ~CParticleGenInfo() = default;
virtual void AddToRenderer()=0;
virtual void Render()=0;
virtual void Update(float dt, CStateManager& stateMgr)=0;
virtual void SetOrientation(const zeus::CTransform& xf, CStateManager& stateMgr)=0;
virtual void SetTranslation(const zeus::CVector3f& trans, CStateManager& stateMgr)=0;
virtual void SetGlobalOrientation(const zeus::CTransform& xf, CStateManager& stateMgr)=0;
virtual void SetGlobalTranslation(const zeus::CVector3f& trans, CStateManager& stateMgr)=0;
virtual void SetGlobalScale(const zeus::CVector3f& scale)=0;
virtual void SetParticleEmission(bool, CStateManager& stateMgr)=0;
virtual bool IsSystemDeletable() const=0;
virtual zeus::CAABox GetBounds() const=0;
virtual bool HasActiveParticles() const=0;
virtual void DestroyParticles()=0;
virtual bool HasLight() const=0;
virtual TUniqueId GetLightId() const=0;
virtual void SetModulationColor(const zeus::CColor& color)=0;
virtual void AddToRenderer() = 0;
virtual void Render() = 0;
virtual void Update(float dt, CStateManager& stateMgr) = 0;
virtual void SetOrientation(const zeus::CTransform& xf, CStateManager& stateMgr) = 0;
virtual void SetTranslation(const zeus::CVector3f& trans, CStateManager& stateMgr) = 0;
virtual void SetGlobalOrientation(const zeus::CTransform& xf, CStateManager& stateMgr) = 0;
virtual void SetGlobalTranslation(const zeus::CVector3f& trans, CStateManager& stateMgr) = 0;
virtual void SetGlobalScale(const zeus::CVector3f& scale) = 0;
virtual void SetParticleEmission(bool, CStateManager& stateMgr) = 0;
virtual bool IsSystemDeletable() const = 0;
virtual rstl::optional_object<zeus::CAABox> GetBounds() const = 0;
virtual bool HasActiveParticles() const = 0;
virtual void DestroyParticles() = 0;
virtual bool HasLight() const = 0;
virtual TUniqueId GetLightId() const = 0;
virtual void DeleteLight(CStateManager&) const = 0;
virtual void SetModulationColor(const zeus::CColor& color) = 0;
void SetFlags(s32);
s32 GetFlags() const;
void SetIsGrabInitialData(bool);
bool GetIsGrabInitialData() const;
bool GetIsActive() const;
bool SetIsActive(bool);
void OffsetTime(float);
void SetCurOffset(const zeus::CVector3f& offset) { x74_offset = offset; }
void SetCurTransform(const zeus::CTransform& xf) { x44_transform = xf; }
void SetInactiveStartTime(float);
float GetInactiveStartTime() const;
float GetFinishTime() const;
float GetCurrentTime() const;
CParticleData::EParentedMode GetParentedMode() const { return x28_parentMode; }
const std::string& GetLocatorName() const { return x10_boneName; }
};
class CParticleGenInfoGeneric : public CParticleGenInfo
{
std::shared_ptr<CParticleGen> x80_system;
TUniqueId x84_lightId;
std::shared_ptr<CParticleGen> x84_system;
TUniqueId x88_lightId;
public:
CParticleGenInfoGeneric(const SObjectTag& part, const std::weak_ptr<CParticleGen>& system,
int, const std::string& boneName, const zeus::CVector3f& scale,
CParticleData::EParentedMode parentMode, int a, CStateManager& stateMgr,
int lightId);
CParticleGenInfoGeneric(const SObjectTag& part, const std::weak_ptr<CParticleGen>& system, int,
const std::string& boneName, const zeus::CVector3f& scale,
CParticleData::EParentedMode parentMode, int a, CStateManager& stateMgr, TAreaId,
int lightId, int b);
void AddToRenderer();
void Render();
@ -69,14 +90,14 @@ public:
void SetGlobalScale(const zeus::CVector3f& scale);
void SetParticleEmission(bool, CStateManager& stateMgr);
bool IsSystemDeletable() const;
zeus::CAABox GetBounds() const;
rstl::optional_object<zeus::CAABox> GetBounds() const;
bool HasActiveParticles() const;
void DestroyParticles();
bool HasLight() const;
TUniqueId GetLightId() const;
void DeleteLight(CStateManager&);
void SetModulationColor(const zeus::CColor& color);
};
}
#endif // __URDE_CPARTICLEGENINFO_HPP__

View File

@ -9,6 +9,7 @@ std::unique_ptr<std::vector<CCollisionPrimitive::Type>> CCollisionPrimitive::sCo
std::unique_ptr<std::vector<ComparisonFunc>> CCollisionPrimitive::sTableOfCollidables;
std::unique_ptr<std::vector<BooleanComparisonFunc>> CCollisionPrimitive::sTableOfBooleanCollidables;
std::unique_ptr<std::vector<MovingComparisonFunc>> CCollisionPrimitive::sTableOfMovingCollidables;
s32 CCollisionPrimitive::sNumTypes = 0;
bool CCollisionPrimitive::sTypesAdded = false;
bool CCollisionPrimitive::sTypesAdding = false;
bool CCollisionPrimitive::sCollidersAdded = false;
@ -68,13 +69,29 @@ void CCollisionPrimitive::InitAddMovingCollider(const MovingComparisonFunc& cmp,
InitAddMovingCollider({std::move(cmp), a, b});
}
void CCollisionPrimitive::InitAddCollider(const CCollisionPrimitive::Comparison& cmp) {}
void CCollisionPrimitive::InitAddCollider(const CCollisionPrimitive::Comparison& cmp)
{
}
void CCollisionPrimitive::InitAddCollider(const ComparisonFunc& cmp, const char* a, const char* b)
{
InitAddCollider({std::move(cmp), a, b});
}
void CCollisionPrimitive::InitEndColliders()
{
}
void CCollisionPrimitive::Unitialize()
{
sCollidersAdding = false;
sTypesAdding = false;
sCollisionTypeList.reset();
sTableOfCollidables.reset();
sTableOfMovingCollidables.reset();
sTableOfBooleanCollidables.reset();
}
CCollisionPrimitive::Type::Type(const std::function<void(u32)>& setter, const char* info)
: x0_setter(setter), x4_info(info)
{

View File

@ -94,6 +94,7 @@ private:
static std::unique_ptr<std::vector<ComparisonFunc>> sTableOfCollidables;
static std::unique_ptr<std::vector<BooleanComparisonFunc>> sTableOfBooleanCollidables;
static std::unique_ptr<std::vector<MovingComparisonFunc>> sTableOfMovingCollidables;
static s32 sNumTypes;
static bool sTypesAdded;
static bool sTypesAdding;
static bool sCollidersAdded;
@ -125,6 +126,8 @@ public:
static void InitAddCollider(const Comparison& cmp);
static void InitAddCollider(const ComparisonFunc&, const char*, const char*);
static void InitEndColliders();
static void Unitialize();
};
}

View File

@ -483,11 +483,11 @@ void CBooRenderer::PostRenderFogs()
void CBooRenderer::AddParticleGen(const CParticleGen& gen)
{
std::pair<zeus::CAABox, bool> bounds = gen.GetBounds();
if (bounds.second)
auto bounds = gen.GetBounds();
if (bounds)
{
zeus::CVector3f pt = bounds.first.closestPointAlongVector(xb0_viewPlane.vec);
Buckets::Insert(pt, bounds.first, EDrawableType::Particle, &gen, xb0_viewPlane, 0);
zeus::CVector3f pt = bounds.value().closestPointAlongVector(xb0_viewPlane.vec);
Buckets::Insert(pt, bounds.value(), EDrawableType::Particle, &gen, xb0_viewPlane, 0);
}
}

View File

@ -15,7 +15,6 @@ public:
rstl::reserved_vector<zeus::CVector2f, 4>&& uvs, bool);
static std::shared_ptr<CGuiWidget> Create(CGuiFrame* frame, CInputStream& in, CSimplePool* sp);
};
}
#endif // __URDE_CAUIIMAGEPANE_HPP__

View File

@ -118,7 +118,8 @@ std::shared_ptr<CGuiWidget> CGuiTextPane::Create(CGuiFrame* frame, CInputStream&
std::make_shared<CGuiTextPane>(parms, sp, dim, vec, fontId, props,
fontCol, outlineCol, extentX, extentY);
ret->ParseBaseInfo(frame, in, parms);
ret->TextSupport()->SetText(L"");
ret->InitializeBuffers();
ret->TextSupport()->SetText(L"?\?(?\?)");
return ret;
}

View File

@ -5,13 +5,13 @@ namespace urde
{
const std::vector<FourCC> CStringTable::skLanguages =
{
'ENGL',
'FREN',
'GERM',
'SPAN',
'ITAL',
'DUTC',
'JAPN'
FOURCC('ENGL'),
FOURCC('FREN'),
FOURCC('GERM'),
FOURCC('SPAN'),
FOURCC('ITAL'),
FOURCC('DUTC'),
FOURCC('JAPN')
};
FourCC CStringTable::mCurrentLanguage = CStringTable::skLanguages[0];

View File

@ -58,14 +58,14 @@ class CGameGlobalObjects
std::unique_ptr<CGameState> x134_gameState;
TLockedToken<CStringTable> x13c_mainStringTable;
CInGameTweakManager x150_tweakManager;
std::unique_ptr<CBooRenderer> m_renderer;
std::unique_ptr<IRenderer> m_renderer;
void LoadStringTable()
{
x13c_mainStringTable = g_SimplePool->GetObj("STRG_Main");
g_MainStringTable = x13c_mainStringTable.GetObj();
}
static CBooRenderer*
static IRenderer*
AllocateRenderer(IObjectStore& store, IFactory& resFactory)
{
g_Renderer = new CBooRenderer(store, resFactory);

View File

@ -1152,41 +1152,41 @@ void CElementGen::BuildParticleSystemBounds()
for (std::unique_ptr<CElementGen>& ch : x234_activePartChildren)
{
std::pair<zeus::CAABox, bool> chBounds = ch->GetBounds();
if (chBounds.second)
auto chBounds = ch->GetBounds();
if (chBounds)
{
accumulated = true;
aabb.accumulateBounds(chBounds.first);
aabb.accumulateBounds(chBounds.value());
}
}
for (std::unique_ptr<CElementGen>& ch : x248_finishPartChildren)
{
std::pair<zeus::CAABox, bool> chBounds = ch->GetBounds();
if (chBounds.second)
auto chBounds = ch->GetBounds();
if (chBounds)
{
accumulated = true;
aabb.accumulateBounds(chBounds.first);
aabb.accumulateBounds(chBounds.value());
}
}
for (std::unique_ptr<CParticleSwoosh>& ch : x260_swhcChildren)
{
std::pair<zeus::CAABox, bool> chBounds = ch->GetBounds();
if (chBounds.second)
auto chBounds = ch->GetBounds();
if (chBounds)
{
accumulated = true;
aabb.accumulateBounds(chBounds.first);
aabb.accumulateBounds(chBounds.value());
}
}
for (std::unique_ptr<CParticleElectric>& ch : x280_elscChildren)
{
std::pair<zeus::CAABox, bool> chBounds = ch->GetBounds();
if (chBounds.second)
auto chBounds = ch->GetBounds();
if (chBounds)
{
accumulated = true;
aabb.accumulateBounds(chBounds.first);
aabb.accumulateBounds(chBounds.value());
}
}
@ -2245,12 +2245,12 @@ bool CElementGen::IsSystemDeletable() const
return false;
}
std::pair<zeus::CAABox, bool> CElementGen::GetBounds() const
rstl::optional_object<zeus::CAABox> CElementGen::GetBounds() const
{
if (GetParticleCountAll() == 0)
return {zeus::CAABox(), false};
return {zeus::CAABox()};
else
return {x2c4_systemBounds, true};
return {x2c4_systemBounds};
}
u32 CElementGen::GetParticleCount() const

View File

@ -232,7 +232,7 @@ public:
const zeus::CVector3f& GetGlobalScale() const;
const zeus::CColor& GetModulationColor() const;
bool IsSystemDeletable() const;
std::pair<zeus::CAABox, bool> GetBounds() const;
rstl::optional_object<zeus::CAABox> GetBounds() const;
u32 GetParticleCount() const;
bool SystemHasLight() const;
CLight GetLight() const;

View File

@ -185,9 +185,9 @@ bool CParticleElectric::IsSystemDeletable() const
return false;
}
std::pair<zeus::CAABox, bool> CParticleElectric::GetBounds() const
rstl::optional_object<zeus::CAABox> CParticleElectric::GetBounds() const
{
return std::make_pair(zeus::CAABox(), false);
return {};
}
u32 CParticleElectric::GetParticleCount() const

View File

@ -97,7 +97,7 @@ public:
const zeus::CVector3f& GetGlobalScale() const;
const zeus::CColor& GetModulationColor() const;
bool IsSystemDeletable() const;
std::pair<zeus::CAABox, bool> GetBounds() const;
rstl::optional_object<zeus::CAABox> GetBounds() const;
u32 GetParticleCount() const;
bool SystemHasLight() const;
CLight GetLight() const;

View File

@ -36,7 +36,7 @@ public:
virtual const zeus::CVector3f& GetGlobalScale() const=0;
virtual const zeus::CColor& GetModulationColor() const=0;
virtual bool IsSystemDeletable() const=0;
virtual std::pair<zeus::CAABox, bool> GetBounds() const=0;
virtual rstl::optional_object<zeus::CAABox> GetBounds() const=0;
virtual u32 GetParticleCount() const=0;
virtual bool SystemHasLight() const=0;
virtual CLight GetLight() const=0;

View File

@ -88,9 +88,9 @@ bool CParticleSwoosh::IsSystemDeletable() const
return false;
}
std::pair<zeus::CAABox, bool> CParticleSwoosh::GetBounds() const
rstl::optional_object<zeus::CAABox> CParticleSwoosh::GetBounds() const
{
return std::make_pair(zeus::CAABox(), false);
return {};
}
u32 CParticleSwoosh::GetParticleCount() const

View File

@ -30,7 +30,7 @@ public:
const zeus::CVector3f& GetGlobalScale() const;
const zeus::CColor& GetModulationColor() const;
bool IsSystemDeletable() const;
std::pair<zeus::CAABox, bool> GetBounds() const;
rstl::optional_object<zeus::CAABox> GetBounds() const;
u32 GetParticleCount() const;
bool SystemHasLight() const;
CLight GetLight() const;

View File

@ -253,6 +253,14 @@ void CActor::SetSfxPitchBend(s32 val)
CSfxManager::PitchBend(*x8c_sfxHandle.get(), val);
}
void CActor::SetRotation(const zeus::CQuaternion &q)
{
x34_transform = q.toTransform(x34_transform.origin);
xe4_27_ = true;
xe4_28_ = true;
xe4_29_ = true;
}
void CActor::SetTranslation(const zeus::CVector3f& tr)
{
x34_transform.origin = tr;

View File

@ -140,11 +140,14 @@ public:
bool HasModelData() const;
const CSfxHandle* GetSfxHandle() const;
void SetSfxPitchBend(s32);
void SetRotation(const zeus::CQuaternion& q);
void SetTranslation(const zeus::CVector3f& tr);
void SetAddedToken(u32 tok);
float GetPitch() const;
float GetYaw() const;
const CModelData* GetModelData() const { return x64_modelData.get(); }
void EnsureRendered(const CStateManager&);
void EnsureRendered(const CStateManager&, const zeus::CVector3f&, const zeus::CVector3f&);
};
}

View File

@ -1,6 +1,7 @@
#include "CGameLight.hpp"
#include "CActorParameters.hpp"
#include "World/CGameLight.hpp"
#include "World/CActorParameters.hpp"
#include "CStateManager.hpp"
#include "TCastTo.hpp"
namespace urde
{
@ -9,20 +10,25 @@ CGameLight::CGameLight(TUniqueId uid, TAreaId aid, bool active, const std::strin
TUniqueId parentId, const CLight& light, u32 w1, u32 w2, float f1)
: CActor(uid, active, name, CEntityInfo(aid, CEntity::NullConnectionList), xf,
CModelData::CModelDataNull(), CMaterialList(), CActorParameters::None(), kInvalidUniqueId),
xe8_parentId(parentId), xec_light(light), x13c_(w1), x140_(w2), x144_(f1)
xe8_parentId(parentId), xec_light(light), x13c_(w1), x140_(w2), x144_lifeTime(f1)
{
xec_light.GetRadius();
xec_light.GetIntensity();
SetLightPriorityAndId();
}
void CGameLight::Accept(IVisitor &visitor)
{
visitor.Visit(this);
}
void CGameLight::Think(float dt, CStateManager& mgr)
{
if (x144_ <= 0.f)
if (x144_lifeTime <= 0.f)
return;
x144_ -= dt;
x144_lifeTime -= dt;
if (x144_ <= 0.f)
if (x144_lifeTime <= 0.f)
mgr.RemoveActor(GetUniqueId());
}

View File

@ -11,12 +11,13 @@ class CGameLight : public CActor
CLight xec_light;
u32 x13c_;
u32 x140_;
float x144_;
float x144_lifeTime;
public:
CGameLight(TUniqueId, TAreaId, bool, const std::string&, const zeus::CTransform&, TUniqueId, const CLight&, u32,
u32, float);
void Accept(IVisitor &visitor);
void Think(float, CStateManager&);
void SetLightPriorityAndId();
void SetLight(const CLight&);

View File

@ -3,45 +3,76 @@
namespace urde
{
CWorldLight::CWorldLight(CInputStream& in)
: x0_type(ELightType(in.readUint32Big())),
x4_color(zeus::CVector3f::ReadBig(in)),
x10_position(zeus::CVector3f::ReadBig(in)),
x1c_direction(zeus::CVector3f::ReadBig(in)),
x28_q(in.readFloatBig()),
x2c_cutoffAngle(in.readFloatBig()),
x34_castShadows(in.readBool()),
x38_(in.readFloatBig()),
x3c_falloff(EFalloffType(in.readUint32Big())),
x40_(in.readFloatBig())
: x0_type(EWorldLightType(in.readUint32Big()))
, x4_color(zeus::CVector3f::ReadBig(in))
, x10_position(zeus::CVector3f::ReadBig(in))
, x1c_direction(zeus::CVector3f::ReadBig(in))
, x28_q(in.readFloatBig())
, x2c_cutoffAngle(in.readFloatBig())
, x30_(in.readFloatBig())
, x34_castShadows(in.readBool())
, x38_(in.readFloatBig())
, x3c_falloff(EFalloffType(in.readUint32Big()))
, x40_(in.readFloatBig())
{
}
std::tuple<float, float, float> CalculateLightFalloff(EFalloffType falloff, float q)
{
float constant = 0.f;
float linear = 0.f;
float quadratic = 0.f;
if (falloff == EFalloffType::Constant)
constant = 2.f / q;
else if (falloff == EFalloffType::Linear)
linear = 250.f / q;
else if (falloff == EFalloffType::Quadratic)
quadratic = 25000.f / q;
return {constant, linear, quadratic};
}
CLight CWorldLight::GetAsCGraphicsLight() const
{
const float epsilon = 1.1920929e-7;
zeus::CVector3f tmpColor = x4_color;
zeus::CColor color(x4_color.x, x4_color.y, x4_color.z);
float tmp = x28_q;
if (epsilon < tmp)
tmp = 0.0000011920929f;
/*
if (x0_type == ELightType::Spot)
zeus::CVector3f float_color = x4_color;
float q = x28_q;
if (q < FLT_EPSILON)
q = 0.000001f;
if (x0_type == EWorldLightType::LocalAmbient)
{
float f2 = tmpColor.x;
float f0 = tmpColor.y;
float f1 = tmpColor.z;
float f3 = f2 * tmp;
f2 = f0 * tmp;
f0 = 1.0f;
f1 *= tmp;
tmpColor.x = f3;
tmpColor.y = f2;
tmpColor.z = f1;
float_color *= q;
if (float_color.x >= 1.f)
float_color.x = 1.f;
if (f3 >= f0)
if (float_color.y >= 1.f)
float_color.y = 1.f;
if (float_color.z >= 1.f)
float_color.z = 1.f;
return CLight::BuildLocalAmbient(x10_position, zeus::CColor(float_color.x, float_color.y, float_color.z, 1.f));
}
*/
return CLight::BuildPoint({}, {});
}
else if (x0_type == EWorldLightType::Directional)
{
return CLight::BuildDirectional(x1c_direction, zeus::CColor{x4_color.x, x4_color.y, x4_color.z, 1.f});
}
else if (x0_type == EWorldLightType::Spot)
{
CLight light = CLight::BuildSpot(x10_position, x1c_direction.normalized(),
zeus::CColor{x4_color.x, x4_color.y, x4_color.z, 1.f}, x2c_cutoffAngle * .5f);
float c, l, q;
std::tie(c, l, q) = CalculateLightFalloff(x3c_falloff, x28_q);
light.SetAttenuation(c, l, q);
return light;
}
float distC, distL, distQ;
std::tie(distC, distL, distQ) = CalculateLightFalloff(x3c_falloff, x28_q);
return CLight::BuildCustom(x10_position, zeus::CVector3f{0.f, 1.f, 0.f},
zeus::CColor{x4_color.x, x4_color.y, x4_color.z, 1.f}, distC, distL, distQ, 1.f, 0.f,
0.f);
}
}

View File

@ -7,7 +7,19 @@ namespace urde
{
class CWorldLight
{
ELightType x0_type = ELightType::Custom;
public:
enum class EWorldLightType
{
LocalAmbient,
Directional,
Custom,
Spot,
Spot2,
LocalAmbient2,
};
private:
EWorldLightType x0_type = EWorldLightType::Spot2;
zeus::CVector3f x4_color;
zeus::CVector3f x10_position;
zeus::CVector3f x1c_direction;