Various imps and stubs

This commit is contained in:
Phillip Stephens 2016-09-13 22:45:46 -07:00
parent 8b23c0538e
commit c20eb76189
26 changed files with 479 additions and 134 deletions

View File

@ -0,0 +1,33 @@
#include "CAudioStateWin.hpp"
#include "CSfxManager.hpp"
#include "CArchitectureMessage.hpp"
#include "CArchitectureQueue.hpp"
#include "GameGlobalObjects.hpp"
#include "CGameState.hpp"
namespace urde
{
CIOWin::EMessageReturn CAudioStateWin::OnMessage(const CArchitectureMessage& msg, CArchitectureQueue& queue)
{
#if 0
const EArchMsgType msgType = msg.GetType();
if (msgType == EArchMsgType::SetGameState)
{
CSfxManager::KillAll(CSfxManager::ESfxChannels::One);
CSfxManager::TurnOnChannel(CSfxManager::ESfxChannels::One);
}
else if (msgType == EArchMsgType::QuitGameplay)
{
if (g_GameState->GetWorldTransitionManager()->GetTransitionType() == CWorldTransManager::ETransType::Disabled ||
g_Main->x12c_ != 0)
{
CSfxManager::SetChannel(CSfxManager::ESfxChannels::Zero);
CSfxManager::KillAll(CSfxManager::ESfxChannels::One);
}
}
#endif
return EMessageReturn::Normal;
}
}

View File

@ -5,15 +5,11 @@
namespace urde
{
class CAudioStateWin : public CIOWin
{
public:
CAudioStateWin() : CIOWin("CAudioStateWin") {}
CIOWin::EMessageReturn OnMessage(const CArchitectureMessage& msg, CArchitectureQueue& queue)
{
return EMessageReturn::Normal;
}
CIOWin::EMessageReturn OnMessage(const CArchitectureMessage& msg, CArchitectureQueue& queue);
};
}

View File

@ -38,12 +38,7 @@ CMapUniverse::CMapWorldData::CMapWorldData(CInputStream& in, u32 version)
x60_ = zeus::CColor::lerp(zeus::CColor::skWhite, x5c_, 0.5f);
for (const zeus::CTransform& xf : x44_areaData)
{
zeus::CMatrix4f mat = xf.toMatrix4f().transposed();
x64_.x += mat.vec[1].x;
x64_.y += mat.vec[2].y;
x64_.z += mat.vec[3].z;
}
x64_ += xf.origin;
x64_ *= 1.0f / float(x44_areaData.size());
}

View File

@ -4,11 +4,11 @@
namespace urde
{
CFirstPersonCamera::CFirstPersonCamera(TUniqueId uid, const zeus::CTransform& xf, TUniqueId id2,
float, float a, float b, float c, float d)
CFirstPersonCamera::CFirstPersonCamera(TUniqueId uid, const zeus::CTransform& xf, TUniqueId watchedObj,
float, float fov, float nearz, float farz, float aspect)
: CGameCamera(uid, true, "First Person Camera",
CEntityInfo(kInvalidAreaId, CEntity::NullConnectionList),
xf, a, b, c, d, id2, 0, 0)
xf, fov, nearz, farz, aspect, watchedObj, false, 0)
{
}

View File

@ -1,14 +1,114 @@
#include "CGameCamera.hpp"
#include "CStateManager.hpp"
#include "Camera/CCameraManager.hpp"
#include "World/CActorParameters.hpp"
namespace urde
{
CGameCamera::CGameCamera(TUniqueId uid, bool active, const std::string& name, const CEntityInfo& info,
const zeus::CTransform& xf, float, float, float, float, TUniqueId, bool, u32)
: CActor(uid, active, name, info, xf, CModelData::CModelDataNull(),
CMaterialList(EMaterialTypes::Zero), CActorParameters::None(), kInvalidUniqueId)
const zeus::CTransform& xf, float fovy, float znear, float zfar, float aspect, TUniqueId uid2,
bool b1, u32 w1)
: CActor(uid, active, name, info, xf, CModelData::CModelDataNull(), CMaterialList(EMaterialTypes::Zero),
CActorParameters::None(), kInvalidUniqueId)
, xe8_watchedObject(uid2)
, x12c_(xf)
, x15c_fov(fovy)
, x160_znear(znear)
, x164_zfar(zfar)
, x168_aspect(aspect)
, x16c_(w1)
, x170_24_perspDirty(true)
, x170_25_disablesInput(b1)
, x180_(fovy)
, x184_(fovy)
{
xe7_29_ = false;
}
void CGameCamera::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr)
{
if (msg == EScriptObjectMessage::InternalMessage15)
{
mgr.GetCameraManager()->SetInsideFluid(true, uid);
return;
}
else if (msg == EScriptObjectMessage::InternalMessage17)
{
mgr.GetCameraManager()->SetInsideFluid(false, kInvalidUniqueId);
return;
}
CActor::AcceptScriptMsg(msg, uid, mgr);
}
void CGameCamera::SetActive(bool active)
{
CActor::SetActive(active);
xe7_29_ = false;
}
zeus::CMatrix4f CGameCamera::GetPerspectiveMatrix() const
{
if (x170_24_perspDirty)
{
const_cast<CGameCamera*>(this)->xec_perspectiveMatrix =
CGraphics::CalculatePerspectiveMatrix(x15c_fov, x168_aspect, x160_znear, x164_zfar, false);
const_cast<CGameCamera*>(this)->x170_24_perspDirty = false;
}
return xec_perspectiveMatrix;
}
zeus::CVector3f CGameCamera::ConvertToScreenSpace(const zeus::CVector3f& v) const
{
zeus::CVector3f rVec = x34_transform.transposeRotate(v - x34_transform.origin);
if (rVec.x == 0.f && rVec.y == 0.f && rVec.z == 0.f)
return {-1.f, -1.f, 1.f};
zeus::CMatrix4f mtx = GetPerspectiveMatrix();
return mtx.multiplyOneOverW(rVec);
}
zeus::CTransform CGameCamera::ValidateCameraTransform(const zeus::CTransform& a, const zeus::CTransform& b)
{
zeus::CTransform xfCpy(a);
constexpr double epsilon = FLT_EPSILON * 1000.f;
if ((a.rightVector().magnitude() - 1.f) >= epsilon || (a.frontVector().magnitude() - 1.f) >= epsilon ||
(a.upVector().magnitude() - 1.f) >= epsilon)
xfCpy.orthonormalize();
float f2 = zeus::kUpVec.x + a.upVector().x * a.upVector().y * a.upVector().z * zeus::kUpVec.y + zeus::kUpVec.z;
if (std::fabs(f2) > 1.0f)
f2 = (f2 >= -0.f ? -1.0f : 1.0f);
if (std::fabs(f2) > 0.999f)
xfCpy = b;
if (xfCpy.upVector().z < -0.2f)
xfCpy = zeus::CQuaternion::fromAxisAngle(xfCpy.frontVector(), M_PIF).toTransform() * xfCpy;
if (std::fabs(xfCpy.rightVector().z - 0.f) >= 0.000009f && std::fabs(xfCpy.upVector().z - 0.f) > 0.000009f)
{
if (xfCpy.frontVector().canBeNormalized())
xfCpy = zeus::lookAt(zeus::CUnitVector3f(xfCpy.frontVector(), true), zeus::CVector3f::skZero);
else
xfCpy = b;
}
xfCpy.origin = a.origin;
return xfCpy;
}
float CGameCamera::GetNearClipDistance() const { return x160_znear; }
float CGameCamera::GetFarClipDistance() const { return x164_zfar; }
float CGameCamera::GetAspectRatio() const { return x168_aspect; }
TUniqueId CGameCamera::GetWatchedObject() const { return xe8_watchedObject; }
float CGameCamera::GetFov() const { return x15c_fov; }
void CGameCamera::SetFov(float fov) { x15c_fov = fov; }
}

View File

@ -10,16 +10,50 @@ class CFinalInput;
class CGameCamera : public CActor
{
TUniqueId xe8_watchedObject;
zeus::CMatrix4f xec_perspectiveMatrix;
zeus::CTransform x12c_;
float x15c_fov;
float x160_znear;
float x164_zfar;
float x168_aspect;
u32 x16c_;
union {
struct
{
bool x170_24_perspDirty : 1;
bool x170_25_disablesInput : 1;
};
u32 _dummy = 0;
};
float x174_ = 0.f;
float x178_ = 0.f;
float x17c_ = 0.f;
float x180_;
float x184_;
public:
CGameCamera(TUniqueId, bool active, const std::string& name, const CEntityInfo& info,
const zeus::CTransform& xf, float fov, float nearz, float farz, float aspect,
TUniqueId, bool, u32);
const zeus::CTransform& GetTransform() const {return x34_transform;}
CGameCamera(TUniqueId, bool active, const std::string& name, const CEntityInfo& info, const zeus::CTransform& xf,
float fov, float nearz, float farz, float aspect, TUniqueId, bool, u32);
void AcceptScriptMsg(EScriptObjectMessage, TUniqueId, CStateManager&);
void SetActive(bool active);
virtual void ProcessInput(const CFinalInput&, CStateManager& mgr) = 0;
virtual void Reset(const zeus::CTransform&, CStateManager& mgr) = 0;
const zeus::CTransform& GetTransform() const { return x34_transform; }
zeus::CMatrix4f GetPerspectiveMatrix() const;
zeus::CVector3f ConvertToScreenSpace(const zeus::CVector3f&) const;
zeus::CTransform ValidateCameraTransform(const zeus::CTransform&, const zeus::CTransform&);
float GetNearClipDistance() const;
float GetFarClipDistance() const;
float GetAspectRatio() const;
TUniqueId GetWatchedObject() const;
float GetFov() const;
void SetFov(float);
void GetControllerNumber() const;
bool DisablesInput() const;
virtual void ProcessInput(const CFinalInput&, CStateManager& mgr)=0;
virtual void Reset(const zeus::CTransform&, CStateManager& mgr)=0;
};
}
#endif // __URDE_CGAMECAMERA_HPP__

View File

@ -8,6 +8,18 @@ namespace urde
class CAnimTreeDoubleChild : public CAnimTreeNode
{
public:
class CDoubleChildAdvancementResult
{
CCharAnimTime x0_;
SAdvancementDeltas x8_;
SAdvancementDeltas x24_;
public:
CDoubleChildAdvancementResult(const CCharAnimTime&, const SAdvancementDeltas&, const SAdvancementDeltas);
void GetLeftAdvancementDeltas() const;
void GetRightAdvancementDeltas() const;
void GetTrueAdvancement() const;
};
protected:
std::shared_ptr<CAnimTreeNode> x14_a;
std::shared_ptr<CAnimTreeNode> x18_b;
@ -32,8 +44,8 @@ public:
std::shared_ptr<IAnimReader> VGetBestUnblendedChild() const;
void VGetWeightedReaders(std::vector<std::pair<float, std::weak_ptr<IAnimReader>>>& out, float w) const;
virtual float VGetLeftChildWeight() const = 0;
float GetLeftChildWeight() const { return VGetLeftChildWeight(); }
//virtual float VGetTotalChildWeight(float) const = 0;
//float GetTotalChildWeight(float f) const { return VGetTotalChildWeight(f); }
virtual float VGetRightChildWeight() const = 0;
float GetRightChildWeight() const { return VGetRightChildWeight(); }

View File

@ -1,13 +0,0 @@
#ifndef __URDE_CANIMTREESCALE_HPP__
#define __URDE_CANIMTREESCALE_HPP__
namespace urde
{
class CAnimTreeScale
{
};
}
#endif // __URDE_CANIMTREESCALE_HPP__

View File

@ -5,6 +5,7 @@ namespace urde
CAnimTreeSingleChild::CAnimTreeSingleChild(const std::weak_ptr<CAnimTreeNode>& node, const std::string& name)
: CAnimTreeNode(name)
, x14_child(node.lock())
{
}

View File

@ -0,0 +1,50 @@
#include "CAnimTreeTimeScale.hpp"
namespace urde
{
CAnimTreeTimeScale::CAnimTreeTimeScale(const std::weak_ptr<CAnimTreeNode>& node, float scale, const std::string& name)
: CAnimTreeSingleChild(node, name)
, x18_timeScale(new CConstantAnimationTimeScale(scale))
{
}
std::string CAnimTreeTimeScale::CreatePrimitiveName(const std::weak_ptr<CAnimTreeNode>&, float, const CCharAnimTime&, float)
{
return {};
}
CCharAnimTime CAnimTreeTimeScale::GetRealLifeTime(const CCharAnimTime& time) const
{
CCharAnimTime timeRem = x14_child->VGetTimeRemaining();
CCharAnimTime tmp = std::min(timeRem, time);
if (x28_ > CCharAnimTime())
{
if (tmp < CCharAnimTime(x28_ * x20_))
return x18_timeScale->TimeScaleIntegral(x20_, x20_ + tmp);
else
{
CCharAnimTime integral = x18_timeScale->TimeScaleIntegral(x20_, x28_);
if (integral > tmp)
return x18_timeScale->FindUpperLimit(x20_, tmp) * x20_;
else
return integral + (integral * tmp);
}
}
return tmp;
}
void CAnimTreeTimeScale::VSetPhase(float phase)
{
x14_child->VSetPhase(phase);
}
std::shared_ptr<IAnimReader> CAnimTreeTimeScale::VSimplified()
{
return {};
}
}

View File

@ -1,11 +1,25 @@
#ifndef __URDE_CANIMTREETIMESCALE_HPP__
#define __URDE_CANIMTREETIMESCALE_HPP__
#include "CAnimTreeSingleChild.hpp"
#include "CConstantAnimationTimeScale.hpp"
namespace urde
{
class CAnimTreeTimeScale
class CAnimTreeTimeScale : public CAnimTreeSingleChild
{
std::unique_ptr<CConstantAnimationTimeScale> x18_timeScale;
CCharAnimTime x20_;
CCharAnimTime x28_;
public:
CAnimTreeTimeScale(const std::weak_ptr<CAnimTreeNode>&, float, const std::string&);
static std::string CreatePrimitiveName(const std::weak_ptr<CAnimTreeNode>&, float, const CCharAnimTime&, float);
CCharAnimTime GetRealLifeTime(const CCharAnimTime&) const;
void VSetPhase(float);
std::shared_ptr<IAnimReader> VSimplified();
};
}

View File

@ -11,10 +11,11 @@ CAnimTreeTweenBase::CAnimTreeTweenBase(bool b1, const std::weak_ptr<CAnimTreeNod
{
}
void CAnimTreeTweenBase::VGetSegStatementSet(const CSegIdList& list, CSegStatementSet& setOut) const
/*void CAnimTreeTweenBase::VGetTotalChildWeight(float t) const
{
}*/
}
void CAnimTreeTweenBase::VGetSegStatementSet(const CSegIdList& list, CSegStatementSet& setOut) const {}
void CAnimTreeTweenBase::VGetSegStatementSet(const CSegIdList& list, CSegStatementSet& setOut,
const CCharAnimTime& time) const
@ -23,21 +24,30 @@ void CAnimTreeTweenBase::VGetSegStatementSet(const CSegIdList& list, CSegStateme
bool CAnimTreeTweenBase::VHasOffset(const CSegId& seg) const
{
return false;
return (x14_a->VHasOffset(seg) || x18_b->VHasOffset(seg));
}
zeus::CVector3f CAnimTreeTweenBase::VGetOffset(const CSegId& seg) const
{
return {};
const float weight = GetBlendingWeight();
if (weight >= 1.0f)
return x18_b->VGetOffset(seg);
const zeus::CVector3f oA = x14_a->VGetOffset(seg);
const zeus::CVector3f oB = x18_b->VGetOffset(seg);
return zeus::CVector3f::lerp(oA, oB, weight);
}
zeus::CQuaternion CAnimTreeTweenBase::VGetRotation(const CSegId& seg) const
{
return {};
const float weight = GetBlendingWeight();
if (weight >= 1.0f)
return x18_b->VGetRotation(seg);
const zeus::CQuaternion qA = x14_a->VGetRotation(seg);
const zeus::CQuaternion qB = x18_b->VGetRotation(seg);
return zeus::CQuaternion::slerp(qA, qB, weight);
}
std::shared_ptr<IAnimReader> CAnimTreeTweenBase::VSimplified()
{
return {};
}
std::shared_ptr<IAnimReader> CAnimTreeTweenBase::VSimplified() { return {}; }
}

View File

@ -24,7 +24,7 @@ public:
float GetBlendingWeight() const { return VGetBlendingWeight(); }
float VGetLeftChildWeight() const { return 1.f - GetBlendingWeight(); }
//void VGetTotalChildWeight(float) const;
float VGetRightChildWeight() const { return GetBlendingWeight(); }
void VGetSegStatementSet(const CSegIdList& list, CSegStatementSet& setOut) const;

View File

@ -9,36 +9,36 @@ namespace urde
CCharAnimTime CCharAnimTime::Infinity()
{
CCharAnimTime ret(1.f);
ret.m_type = Type::Infinity;
ret.x4_type = EType::Infinity;
return ret;
}
bool CCharAnimTime::EqualsZero() const
{
if (m_type == Type::ZeroIncreasing || m_type == Type::ZeroSteady || m_type == Type::ZeroDecreasing)
if (x4_type == EType::ZeroIncreasing || x4_type == EType::ZeroSteady || x4_type == EType::ZeroDecreasing)
return false;
return (m_time == 0.f);
return (x0_time == 0.f);
}
bool CCharAnimTime::EpsilonZero() const
{
return (std::fabs(m_time) < FLT_EPSILON);
return (std::fabs(x0_time) < FLT_EPSILON);
}
bool CCharAnimTime::GreaterThanZero() const
{
if (EqualsZero())
return false;
return (m_time > 0.f);
return (x0_time > 0.f);
}
bool CCharAnimTime::operator ==(const CCharAnimTime& other) const
{
if (m_type == Type::NonZero)
if (x4_type == EType::NonZero)
{
if (other.m_type == Type::NonZero)
return m_time == other.m_time;
if (other.x4_type == EType::NonZero)
return x0_time == other.x0_time;
return !other.EqualsZero();
}
@ -47,18 +47,18 @@ bool CCharAnimTime::operator ==(const CCharAnimTime& other) const
if (other.EqualsZero())
{
int type = -1;
if (m_type != Type::ZeroDecreasing)
if (x4_type != EType::ZeroDecreasing)
{
if (m_type != Type::ZeroSteady)
if (x4_type != EType::ZeroSteady)
type = 1;
else
type = 0;
}
int otherType = -1;
if (other.m_type != Type::ZeroDecreasing)
if (other.x4_type != EType::ZeroDecreasing)
{
if (other.m_type != Type::ZeroSteady)
if (other.x4_type != EType::ZeroSteady)
otherType = 1;
else
otherType = 0;
@ -69,8 +69,8 @@ bool CCharAnimTime::operator ==(const CCharAnimTime& other) const
return false;
}
if (other.m_type == Type::Infinity)
return m_time * other.m_time < 0.f;
if (other.x4_type == EType::Infinity)
return x0_time * other.x0_time < 0.f;
return false;
}
@ -103,14 +103,14 @@ bool CCharAnimTime::operator >(const CCharAnimTime& other) const
bool CCharAnimTime::operator <(const CCharAnimTime& other) const
{
if (m_type == Type::NonZero)
if (x4_type == EType::NonZero)
{
if (other.m_type == Type::NonZero)
return m_time < other.m_time;
if (other.x4_type == EType::NonZero)
return x0_time < other.x0_time;
if (other.EqualsZero())
return m_time < 0.f;
return x0_time < 0.f;
else
return other.m_time > 0.f;
return other.x0_time > 0.f;
}
if (EqualsZero())
@ -118,18 +118,18 @@ bool CCharAnimTime::operator <(const CCharAnimTime& other) const
if (other.EqualsZero())
{
int type = -1;
if (m_type != Type::ZeroDecreasing)
if (x4_type != EType::ZeroDecreasing)
{
if (m_type != Type::ZeroSteady)
if (x4_type != EType::ZeroSteady)
type = 1;
else
type = 0;
}
int otherType = -1;
if (other.m_type != Type::ZeroDecreasing)
if (other.x4_type != EType::ZeroDecreasing)
{
if (other.m_type != Type::ZeroSteady)
if (other.x4_type != EType::ZeroSteady)
otherType = 1;
else
otherType = 0;
@ -138,15 +138,15 @@ bool CCharAnimTime::operator <(const CCharAnimTime& other) const
return type < otherType;
}
if (other.m_type == Type::NonZero)
return other.m_time > 0.f;
return other.m_time < 0.f;
if (other.x4_type == EType::NonZero)
return other.x0_time > 0.f;
return other.x0_time < 0.f;
}
else
{
if (m_type == Type::Infinity)
return m_time < 0.f && other.m_time > 0.f;
return m_time < other.m_time;
if (x4_type == EType::Infinity)
return x0_time < 0.f && other.x0_time > 0.f;
return x0_time < other.x0_time;
}
}
@ -164,33 +164,33 @@ CCharAnimTime& CCharAnimTime::operator+=(const CCharAnimTime& other)
CCharAnimTime CCharAnimTime::operator+(const CCharAnimTime& other)
{
if (m_type == Type::Infinity && other.m_type == Type::Infinity)
if (x4_type == EType::Infinity && other.x4_type == EType::Infinity)
{
if (other.m_time != m_time)
if (other.x0_time != x0_time)
return CCharAnimTime();
return *this;
}
else if (m_type == Type::Infinity)
else if (x4_type == EType::Infinity)
return *this;
else if (other.m_type == Type::Infinity)
else if (other.x4_type == EType::Infinity)
return other;
if (!EqualsZero() || !other.EqualsZero())
return CCharAnimTime(m_time + other.m_time);
return CCharAnimTime(x0_time + other.x0_time);
int type = -1;
if (m_type != Type::ZeroDecreasing)
if (x4_type != EType::ZeroDecreasing)
{
if (m_type != Type::ZeroSteady)
if (x4_type != EType::ZeroSteady)
type = 1;
else
type = 0;
}
int otherType = -1;
if (other.m_type != Type::ZeroDecreasing)
if (other.x4_type != EType::ZeroDecreasing)
{
if (other.m_type != Type::ZeroSteady)
if (other.x4_type != EType::ZeroSteady)
otherType = 1;
else
otherType = 0;
@ -201,11 +201,11 @@ CCharAnimTime CCharAnimTime::operator+(const CCharAnimTime& other)
CCharAnimTime ret;
if (otherType == -1)
ret.m_type = Type::ZeroDecreasing;
ret.x4_type = EType::ZeroDecreasing;
else if (otherType == 0)
ret.m_type = Type::ZeroSteady;
ret.x4_type = EType::ZeroSteady;
else
ret.m_type = Type::ZeroIncreasing;
ret.x4_type = EType::ZeroIncreasing;
return ret;
}
@ -218,37 +218,37 @@ CCharAnimTime& CCharAnimTime::operator-=(const CCharAnimTime& other)
CCharAnimTime CCharAnimTime::operator-(const CCharAnimTime& other)
{
if (m_type == Type::Infinity && other.m_type == Type::Infinity)
if (x4_type == EType::Infinity && other.x4_type == EType::Infinity)
{
if (other.m_time == m_time)
if (other.x0_time == x0_time)
return CCharAnimTime();
return *this;
}
else if (m_type == Type::Infinity)
else if (x4_type == EType::Infinity)
return *this;
else if (other.m_type == Type::Infinity)
else if (other.x4_type == EType::Infinity)
{
CCharAnimTime ret(-other.m_time);
ret.m_type = Type::Infinity;
CCharAnimTime ret(-other.x0_time);
ret.x4_type = EType::Infinity;
return ret;
}
if (!EqualsZero() || !other.EqualsZero())
return CCharAnimTime(m_time - other.m_time);
return CCharAnimTime(x0_time - other.x0_time);
int type = -1;
if (m_type != Type::ZeroDecreasing)
if (x4_type != EType::ZeroDecreasing)
{
if (m_type != Type::ZeroSteady)
if (x4_type != EType::ZeroSteady)
type = 1;
else
type = 0;
}
int otherType = -1;
if (other.m_type != Type::ZeroDecreasing)
if (other.x4_type != EType::ZeroDecreasing)
{
if (other.m_type != Type::ZeroSteady)
if (other.x4_type != EType::ZeroSteady)
otherType = 1;
else
otherType = 0;
@ -257,44 +257,44 @@ CCharAnimTime CCharAnimTime::operator-(const CCharAnimTime& other)
CCharAnimTime ret;
type -= otherType;
if (type == -1)
ret.m_type = Type::ZeroDecreasing;
ret.x4_type = EType::ZeroDecreasing;
else if (type == 0)
ret.m_type = Type::ZeroSteady;
ret.x4_type = EType::ZeroSteady;
else
ret.m_type = Type::ZeroIncreasing;
ret.x4_type = EType::ZeroIncreasing;
return ret;
}
CCharAnimTime CCharAnimTime::operator*(const CCharAnimTime& other)
{
if (m_type == Type::Infinity && other.m_type == Type::Infinity)
if (x4_type == EType::Infinity && other.x4_type == EType::Infinity)
{
if (other.m_time != m_time)
if (other.x0_time != x0_time)
return CCharAnimTime();
return *this;
}
else if (m_type == Type::Infinity)
else if (x4_type == EType::Infinity)
return *this;
else if (other.m_type == Type::Infinity)
else if (other.x4_type == EType::Infinity)
return other;
if (!EqualsZero() || !other.EqualsZero())
return CCharAnimTime(m_time * other.m_time);
return CCharAnimTime(x0_time * other.x0_time);
int type = -1;
if (m_type != Type::ZeroDecreasing)
if (x4_type != EType::ZeroDecreasing)
{
if (m_type != Type::ZeroSteady)
if (x4_type != EType::ZeroSteady)
type = 1;
else
type = 0;
}
int otherType = -1;
if (other.m_type != Type::ZeroDecreasing)
if (other.x4_type != EType::ZeroDecreasing)
{
if (other.m_type != Type::ZeroSteady)
if (other.x4_type != EType::ZeroSteady)
otherType = 1;
else
otherType = 0;
@ -305,11 +305,11 @@ CCharAnimTime CCharAnimTime::operator*(const CCharAnimTime& other)
CCharAnimTime ret;
if (otherType == -1)
ret.m_type = Type::ZeroDecreasing;
ret.x4_type = EType::ZeroDecreasing;
else if (otherType == 0)
ret.m_type = Type::ZeroSteady;
ret.x4_type = EType::ZeroSteady;
else
ret.m_type = Type::ZeroIncreasing;
ret.x4_type = EType::ZeroIncreasing;
return ret;
}
@ -320,14 +320,14 @@ CCharAnimTime CCharAnimTime::operator*(const float& other)
return ret;
if (!EqualsZero())
return CCharAnimTime(m_time * other);
return CCharAnimTime(x0_time * other);
if (other > 0.f)
return *this;
else if (other == 0.f)
return ret;
ret.m_type = m_type;
ret.x4_type = x4_type;
return ret;
}
@ -336,7 +336,7 @@ float CCharAnimTime::operator/(const CCharAnimTime& other)
if (other.EqualsZero())
return 0.f;
return m_time / other.m_time;
return x0_time / other.x0_time;
}
}

View File

@ -8,26 +8,35 @@ namespace urde
class CCharAnimTime
{
float m_time = 0.f;
enum class Type
public:
enum class EType
{
NonZero,
ZeroIncreasing,
ZeroSteady,
ZeroDecreasing,
Infinity
} m_type = Type::ZeroSteady;
};
private:
float x0_time = 0.f;
EType x4_type = EType::ZeroSteady;
public:
CCharAnimTime() = default;
CCharAnimTime(CInputStream& in)
: m_time(in.readFloatBig()),
m_type(Type(in.readUint32Big())) {}
: x0_time(in.readFloatBig()),
x4_type(EType(in.readUint32Big())) {}
CCharAnimTime(float time)
: m_time(time),
m_type(m_time != 0.f ? Type::NonZero : Type::ZeroSteady) {}
: x0_time(time),
x4_type(x0_time != 0.f ? EType::NonZero : EType::ZeroSteady) {}
CCharAnimTime(EType type, const float& t)
: x0_time(t)
, x4_type(type)
{
}
static CCharAnimTime Infinity();
operator float() const {return m_time;}
operator float() const {return x0_time;}
bool EqualsZero() const;
bool EpsilonZero() const;

View File

@ -0,0 +1,19 @@
#include "CConstantAnimationTimeScale.hpp"
namespace urde
{
float CConstantAnimationTimeScale::VTimeScaleIntegral(const float& a, const float& b) const { return (b - a) * x4_; }
float CConstantAnimationTimeScale::VFindUpperLimit(const float& a, const float& b) const { return (b / x4_) + a; }
std::unique_ptr<IVaryingAnimationTimeScale> CConstantAnimationTimeScale::VClone() const
{
return std::make_unique<CConstantAnimationTimeScale>(x4_);
}
std::unique_ptr<IVaryingAnimationTimeScale> CConstantAnimationTimeScale::VGetFunctionMirrored(const float&) const
{
return Clone();
}
}

View File

@ -0,0 +1,22 @@
#ifndef __URDE_CONSTANTANIMATIONTIMESCALE_HPP__
#define __URDE_CONSTANTANIMATIONTIMESCALE_HPP__
#include "IVaryingAnimationTimeScale.hpp"
namespace urde
{
class CConstantAnimationTimeScale : public IVaryingAnimationTimeScale
{
private:
float x4_;
public:
CConstantAnimationTimeScale(float f) : x4_(f) {}
u32 GetType() const { return 0; }
float VTimeScaleIntegral(const float &, const float &) const;
float VFindUpperLimit(const float &, const float &) const;
std::unique_ptr<IVaryingAnimationTimeScale> VClone() const;
std::unique_ptr<IVaryingAnimationTimeScale> VGetFunctionMirrored(const float &) const;
};
}
#endif // __URDE_CONSTANTANIMATIONTIMESCALE_HPP__

View File

@ -0,0 +1,31 @@
#ifndef __URDE_CLINEARANIMATIONTIMESCALE_HPP__
#define __URDE_CLINEARANIMATIONTIMESCALE_HPP__
#include "IVaryingAnimationTimeScale.hpp"
namespace urde
{
class CLinearAnimationTimeScale : public IVaryingAnimationTimeScale
{
public:
class CFunctionDescription
{
public:
CFunctionDescription(const float&, const float&, const float&);
CFunctionDescription FunctionMirroredAround(const float&) const;
};
private:
public:
CLinearAnimationTimeScale(const CCharAnimTime&, float, const CCharAnimTime&, float);
u32 GetType() const { return 1; }
float VTimeScaleIntegral(const float &, const float &) const { return 0.f; }
float VFindUpperLimit(const float &, const float &) const { return 0.f; }
std::unique_ptr<IVaryingAnimationTimeScale> VClone() { return {}; }
std::unique_ptr<IVaryingAnimationTimeScale> VGetFunctionMirrored(const float &) const { return {}; }
float TimeScaleIntegralWithSortedLimits(const CFunctionDescription&, const float&, const float&);
float GetScale(const CFunctionDescription&, const float&);
};
}
#endif // __URDE_CLINEARANIMATIONTIMESCALE_HPP__

View File

@ -7,6 +7,9 @@ set(CHARACTER_SOURCES
CCharAnimTime.hpp CCharAnimTime.cpp
IMetaAnim.hpp IMetaAnim.cpp
IMetaTrans.hpp
IVaryingAnimationTimeScale.hpp
CLinearAnimationTimeScale.hpp CLinearAnimationTimeScale.cpp
CConstantAnimationTimeScale.hpp CConstantAnimationTimeScale.cpp
CAnimationDatabase.hpp
CAnimationDatabaseGame.hpp CAnimationDatabaseGame.cpp
CTransitionDatabase.hpp
@ -53,7 +56,6 @@ set(CHARACTER_SOURCES
CTreeUtils.hpp CTreeUtils.cpp
CAnimTreeBlend.hpp CAnimTreeBlend.cpp
CAnimTreeNode.hpp CAnimTreeNode.cpp
CAnimTreeScale.hpp CAnimTreeScale.cpp
CAnimTreeTimeScale.hpp CAnimTreeTimeScale.cpp
CAnimTreeTransition.hpp CAnimTreeTransition.cpp
CAnimTreeTweenBase.hpp CAnimTreeTweenBase.cpp

View File

@ -0,0 +1,29 @@
#ifndef __URDE_IVARYINGANIMATIONTIMESCALE_HPP__
#define __URDE_IVARYINGANIMATIONTIMESCALE_HPP__
#include "CCharAnimTime.hpp"
namespace urde
{
class IVaryingAnimationTimeScale
{
public:
virtual u32 GetType() const = 0;
virtual float VTimeScaleIntegral(const float&, const float&) const = 0;
virtual float VFindUpperLimit(const float&, const float&) const = 0;
virtual std::unique_ptr<IVaryingAnimationTimeScale> VClone() const = 0;
virtual std::unique_ptr<IVaryingAnimationTimeScale> VGetFunctionMirrored(const float&) const = 0;
CCharAnimTime FindUpperLimit(const CCharAnimTime& a, const CCharAnimTime& b) const
{
return VFindUpperLimit(a, b);
}
CCharAnimTime TimeScaleIntegral(const CCharAnimTime& a, const CCharAnimTime& b) const
{
return VTimeScaleIntegral(a, b);
}
std::unique_ptr<IVaryingAnimationTimeScale> Clone() const { return VClone(); }
};
}
#endif // __URDE_IVARYINGANIMATIONTIMESCALE_HPP__

View File

@ -3,6 +3,7 @@
#include "RetroTypes.hpp"
#include "zeus/CVector3f.hpp"
#include "zeus/CQuaternion.hpp"
#include "zeus/CTransform.hpp"
namespace urde

View File

@ -286,21 +286,21 @@ bool CVEParticleLocation::GetValue(int /*frame*/, zeus::CVector3f& valOut) const
bool CVEParticleSystemOrientationFront::GetValue(int /*frame*/, zeus::CVector3f& valOut) const
{
zeus::CMatrix4f trans = CParticleGlobals::g_currentParticleSystem->x4_system->GetOrientation().toMatrix4f().transposed();
valOut.assign(trans.vec[0].y, trans.vec[1].z, trans.vec[3].x);
valOut.assign(trans.vec[0].y, trans.vec[1].y, trans.vec[2].y);
return false;
}
bool CVEParticleSystemOrientationUp::GetValue(int /*frame*/, zeus::CVector3f& valOut) const
{
zeus::CMatrix4f trans = CParticleGlobals::g_currentParticleSystem->x4_system->GetOrientation().toMatrix4f().transposed();
valOut.assign(trans.vec[0].z, trans.vec[2].x, trans.vec[3].y);
valOut.assign(trans.vec[0].z, trans.vec[1].z, trans.vec[2].z);
return false;
}
bool CVEParticleSystemOrientationRight::GetValue(int /*frame*/, zeus::CVector3f& valOut) const
{
zeus::CMatrix4f trans = CParticleGlobals::g_currentParticleSystem->x4_system->GetOrientation().toMatrix4f().transposed();
valOut.assign(trans.vec[0].x, trans.vec[1].y, trans.vec[2].z);
valOut.assign(trans.vec[0].x, trans.vec[1].x, trans.vec[2].x);
return false;
}

View File

@ -59,7 +59,6 @@ protected:
bool xe4_28_ : 1;
bool xe4_29_ : 1;
bool xe4_30_ : 1;
bool xe5_0_opaque : 1;
bool xe5_26_muted : 1;
bool xe5_27_useInSortedLists : 1;
bool xe5_28_callTouch : 1;

View File

@ -118,6 +118,7 @@ public:
bool IsTransitionEnabled() const { return x30_type != ETransType::Disabled; }
void DisableTransition();
void TouchModels();
ETransType GetTransType() { return x30_type; }
};
}

@ -1 +1 @@
Subproject commit 75248099540cc05b60beeac00fdebe47b80a1928
Subproject commit 981cc9d0b3e7f99b314ebe1ef87b23a94e38e58e