This commit is contained in:
Jack Andersen 2016-08-15 10:59:34 -10:00
commit c1e74b6314
18 changed files with 296 additions and 42 deletions

View File

@ -6,6 +6,7 @@
#include "zeus/CVector2f.hpp"
#include "zeus/CQuaternion.hpp"
#include "CScannableObjectInfo.hpp"
#include "Graphics/CTexture.hpp"
namespace urde
{
@ -48,6 +49,7 @@ public:
struct SBucketBackground
{
};
public:
CScanDisplay() = default;
void StartScan(TUniqueId, const CScannableObjectInfo&, CGuiTextPane*, CGuiWidget*, float);

View File

View File

@ -0,0 +1,76 @@
#ifndef __URDE_CBODYCONTROLLER_HPP__
#define __URDE_CBODYCONTROLLER_HPP__
#include "RetroTypes.hpp"
#include "zeus/CQuaternion.hpp"
#include "CharacterCommon.hpp"
namespace urde
{
class CActor;
class CAnimPlaybackParms;
class CFinalInput;
class CPASAnimParmData;
class CRandom16;
class CStateManager;
class CBodyController
{
public:
CBodyController(CActor&, float, EBodyType);
void GetCurrentStateId() const;
void GetComandMgr();
void SetDoDeathAnims(bool);
bool IsElectrocuting() const;
bool IsOnFire() const;
bool IsFrozen() const;
void GetBodyStateInfo() const;
bool GetIsActive() const;
void BodyStateInfo();
float GetTurnSpeed() const;
pas::ELocomotionType GetLocomotionType() const;
void GetOwner();
bool IsAnimationOver() const;
void EnableAnimation(bool);
bool ShouldPlayDeathAnims() const;
void GetCurrentAnimId() const;
void Activate(CStateManager&);
void GetCurrentAdditiveState();
void SetState(pas::EAnimationState);
void Update(float, CStateManager&);
void Deactivate();
bool ShouldBeHurled() const;
bool HasBodyState(pas::EAnimationState);
pas::EFallState GetFallState() const;
void SetFallState(pas::EFallState);
void UpdateBody(float, CStateManager&);
void SetAdditiveState(pas::EAnimationState);
void SetTurnSpeed(float);
void SetCurrentAnimation(const CAnimPlaybackParms&, bool, bool);
void GetAnimTimeRemaining() const;
void SetPlaybackRate(float);
void MultiplyPlaybackRate(float);
void SetDeltaRotation(const zeus::CQuaternion&);
void FaceDirection(const zeus::CVector3f&, float);
void FaceDirection3D(const zeus::CVector3f&, float);
void HasBodyInfo(CActor&);
void ProcessInput(const CFinalInput&);
void GetPASDatabase() const;
void PlayBestAnimation(const CPASAnimParmData&, CRandom16&);
void LoopBestAnimation(const CPASAnimParmData&, CRandom16&);
void Freeze(float, float, float);
void UnFreeze();
void GetPercentageFrozen() const;
void SetOnFire(float);
void DouseFlames();
void SetElectrocuting(float);
void DouseElectrocuting();
void UpdateFrozenInfo(float, CStateManager&);
void GetCurrentAdditiveStateId() const;
EBodyType GetBodyType() const;
bool HasBeenFrozen() const;
void GetOwner() const;
};
}
#endif // __URDE_CBODYCONTROLLER_HPP__

View File

View File

@ -1,21 +1,10 @@
#ifndef CBODYSTATE_HPP
#define CBODYSTATE_HPP
#include "RetroTypes.hpp"
#include "CharacterCommon.hpp"
namespace urde
{
namespace pas
{
enum class ELocomotionType
{
};
enum class ELocomotionAnim
{
};
}
class CBodyController;
class CStateManager;
class CBodyState

View File

View File

@ -0,0 +1,75 @@
#ifndef __URDE_CBODYSTATECMDMGR_HPP__
#define __URDE_CBODYSTATECMDMGR_HPP__
#include "RetroTypes.hpp"
#include "CharacterCommon.hpp"
#include "zeus/CVector3f.hpp"
namespace urde
{
class CBodyStateCmd;
class CBCMeleeAttackCmd;
class CBCProjectileAttackCmd;
class CBCStepCmd;
class CBCJumpCmd;
class CBCGenerateCmd;
class CBCKnockBackCmd;
class CBCHurledCmd;
class CBCGetupCmd;
class CBCLoopReactionCmd;
class CBCKnockDownCmd;
class CBCSlideCmd;
class CBCScriptedCmd;
class CBCCoverCmd;
class CBCWallHangCmd;
class CBCAdditiveAimCmd;
class CBCLocomotionCmd;
class CBCAdditiveAimCmd;
class CBCAdditiveReactionCmd;
class CBCLoopAttackCmd;
class CBodyStateCmdMgr
{
public:
enum class ESteeringBlendMode
{
};
private:
public:
CBodyStateCmdMgr() = default;
void DeliverCmd(EBodyStateCmd);
void DeliverCmd(const CBodyStateCmd&);
void DeliverCmd(const CBCProjectileAttackCmd&);
void DeliverCmd(const CBCMeleeAttackCmd&);
void DeliverCmd(const CBCStepCmd&);
void DeliverCmd(const CBCGenerateCmd&);
void DeliverCmd(const CBCJumpCmd&);
void DeliverCmd(const CBCSlideCmd&);
void DeliverCmd(const CBCKnockBackCmd&);
void DeliverCmd(const CBCHurledCmd&);
void DeliverCmd(const CBCGetupCmd&);
void DeliverCmd(const CBCLoopReactionCmd&);
void DeliverCmd(const CBCKnockDownCmd&);
void DeliverCmd(const CBCScriptedCmd&);
void DeliverCmd(const CBCCoverCmd&);
void DeliverCmd(const CBCWallHangCmd&);
void DeliverCmd(const CBCAdditiveAimCmd&);
void DeliverCmd(const CBCLocomotionCmd&);
void DeliverCmd(const CBCAdditiveReactionCmd&);
void DeliverCmd(const CBCLoopAttackCmd&);
void DeliverTargetVector(const zeus::CVector3f&);
void DeliverAdditiveTargetVector(const zeus::CVector3f&);
void SetSteeringBlendSpeed(float);
void SetSteeringBlendMode(ESteeringBlendMode);
void SetSteeringSpeedRange(float, float);
void BlendSteeringCmds();
void Reset();
void ClearLocomtionCmds();
void GetCmd(EBodyStateCmd);
zeus::CVector3f GetTargetVector() const;
void GetFaceVector() const;
void GetMoveVector() const;
s32 GetNumSteerCmds() const;
zeus::CVector3f GetAdditiveTargetVector() const;
};
}
#endif // __URDE_CBODYSTATECMDMGR_HPP__

View File

@ -1,4 +1,5 @@
set(CHARACTER_SOURCES
CharacterCommon.hpp
CAssetFactory.hpp CAssetFactory.cpp
CCharacterFactory.hpp CCharacterFactory.cpp
CModelData.hpp CModelData.cpp
@ -78,6 +79,8 @@ set(CHARACTER_SOURCES
CAdditiveAnimPlayback.hpp CAdditiveAnimPlayback.cpp
CActorLights.hpp CActorLights.cpp
CAnimSysContext.hpp
CBodyState.hpp)
CBodyState.hpp CBodyState.cpp
CBodyStateCmdMgr.hpp CBodyStateCmdMgr.cpp
CBodyController.hpp CBodyController.cpp)
runtime_add_list(Character CHARACTER_SOURCES)

View File

@ -0,0 +1,37 @@
#ifndef __URDE_PASTYPES_HPP__
#define __URDE_PASTYPES_HPP__
namespace urde
{
namespace pas
{
enum class ELocomotionType
{
};
enum class ELocomotionAnim
{
};
enum class EAnimationState
{
};
enum class EFallState
{
};
}
enum class EBodyType
{
One,
Two = 2,
Three
};
enum class EBodyStateCmd
{
};
}
#endif // __URDE_PASTYPES_HPP__

View File

@ -578,7 +578,7 @@ CRealElement* CParticleDataFactory::GetRealElement(CInputStream& in)
{
CRealElement* a = GetRealElement(in);
CRealElement* b = GetRealElement(in);
return new CREISWT(a, b);
return new CREInitialSwitch(a, b);
}
case SBIG('CLTN'):
{

View File

@ -200,7 +200,7 @@ bool CRESineWave::GetValue(int frame, float& valOut) const
return false;
}
bool CREISWT::GetValue(int frame, float& valOut) const
bool CREInitialSwitch::GetValue(int frame, float& valOut) const
{
if (frame == 0)
x4_a->GetValue(frame, valOut);

View File

@ -155,12 +155,12 @@ public:
bool GetValue(int frame, float& valOut) const;
};
class CREISWT : public CRealElement
class CREInitialSwitch : public CRealElement
{
std::unique_ptr<CRealElement> x4_a;
std::unique_ptr<CRealElement> x8_b;
public:
CREISWT(CRealElement* a, CRealElement* b)
CREInitialSwitch(CRealElement* a, CRealElement* b)
: x4_a(a), x8_b(b) {}
bool GetValue(int frame, float& valOut) const;
};

View File

@ -14,8 +14,10 @@ class CStateManager;
class CAi;
typedef void (CAi::*CAiStateFunc)(CStateManager&, EStateMsg, float);
typedef bool (CAi::*CAiTriggerFunc)(CStateManager&, float);
class CAiFuncMap
{
static const std::vector<std::string> gkStateNames;
std::unordered_map<std::string, CAiStateFunc> x0_stateFuncs;
std::unordered_map<std::string, CAiTriggerFunc> x10_triggerFuncs;
public:

View File

@ -671,6 +671,7 @@ void CGameArea::AllocNewAreaData(int offset, int size)
bool CGameArea::Invalidate(CStateManager& mgr)
{
return false;
}
void CGameArea::CullDeadAreaRequests()

View File

@ -24,6 +24,7 @@ set(WORLD_SOURCES
CActor.hpp CActor.cpp
CAi.hpp CAi.cpp
CAiFuncMap.hpp CAiFuncMap.cpp
CStateMachine.hpp CStateMachine.cpp
CPatterned.hpp CPatterned.cpp
CPathFindArea.hpp CPathFindArea.cpp
CPathFindRegion.hpp CPathFindRegion.cpp

View File

@ -2,18 +2,12 @@
#define __URDE_CPATTERNED_HPP__
#include "CAi.hpp"
#include "Character/CBodyController.hpp"
namespace urde
{
class CPatternedInfo;
enum class EBodyType
{
One,
Two = 2,
Three
};
class CPatterned : public CAi
{
public:

View File

@ -5,6 +5,42 @@ namespace urde
{
CStateMachine::CStateMachine(CInputStream& in)
{
#if 0
u32 stateCount = in.readUint32Big();
x0_states.reserve(stateCount);
for (u32 i = 0 ; i<stateCount ; ++i)
{
std::string name = in.readString(31);
CAiStateFunc func = CAi::GetStateFunc(name.c_str());
x0_states.emplace_back(func, name);
}
x10_triggers.reserve(in.readUint32Big());
for (u32 i = 0 ; i<stateCount ; ++i)
{
x0_states[i].SetNumTriggers(in.readUint32Big());
if (x0_states[i].GetNumTriggers() == 0)
continue;
for (u32 j = 0 ; j<x0_states[i].GetNumTriggers() ; ++j)
x10_triggers.emplace_back();
for (u32 j = 0 ; j<x0_states[i].GetNumTriggers() ; ++j)
{
u32 triggerCount = in.readUint32Big();
u32 r19 = triggerCount - 1;
for (u32 k = 0 ; k<triggerCount ; ++k)
{
std::string name = in.readString(31);
CAiTriggerFunc func = CAi::GetTrigerFunc(name.c_str());
float f31 = in.readFloatBig();
}
}
}
#endif
}
s32 CStateMachine::GetStateIndex(const std::string& state)
@ -22,4 +58,32 @@ const std::vector<CAiState>& CStateMachine::GetStateVector() const
{
return x0_states;
}
float CStateMachineState::GetTime() const
{
return 0.f;
}
const std::vector<CAiState>* CStateMachineState::GetStateVector() const
{
if (!x0_machine)
return nullptr;
return &x0_machine->GetStateVector();
}
void CStateMachineState::Setup(const CStateMachine *machine)
{
x0_machine = machine;
x4_state = nullptr;
x8_ = 0.f;
xc_ = 0.f;
x10_= 0.f;
}
std::string CStateMachineState::GetName() const
{
return {};
}
}

View File

@ -10,10 +10,13 @@ class CAiState;
class CStateManager;
class CAiTrigger
{
u32 x0_ = 0;
u32 x4_ = 0;
u32 x8_ = 0;
float xc_ = 0.f;
u32 x10_;
bool x18_;
u32 x10_ = 0;
u32 x14_ = 0;
bool x18_ = false;
public:
CAiTrigger() = default;
bool GetAnd();
@ -40,17 +43,17 @@ class CAiState
u32 x20_;
u32 x24_;
u32 x28_;
u32 x2c_;
u32 x2c_numTriggers;
u32 x30_;
public:
CAiState(CAiStateFunc func, const char* name)
{}
u32 GetNumTriggers() const;
s32 GetNumTriggers() const;
CAiTrigger& GetTrig(s32) const;
const char* GetName() const;
void SetTriggers(CAiTrigger* triggers);
void SetNumTriggers(s32 numTriggers);
void SetNumTriggers(s32 numTriggers) { x2c_numTriggers = numTriggers; }
void CallFunc(CStateManager& mgr, CAi& ai, EStateMsg msg, float delta) const
{
if (x0_func)
@ -71,24 +74,24 @@ public:
class CStateMachineState
{
const CStateMachine* x0_ = nullptr;
const CStateMachine* x0_machine = nullptr;
CAiState* x4_state = nullptr;
float x8_ = 0;
float xc_ = 0;
float x10_ = 0;
union
{
struct
{
bool x18_24_ : 1;
};
u32 dummy = 0;
};
public:
CStateMachineState()=default;
void Setup(const CStateMachine* machine)
{
x0_ = machine;
x4_state = nullptr;
x8_ = 0.f;
xc_ = 0.f;
x10_= 0.f;
}
void SetDelay(float);
float GetDelay() const;
void GetActorState() const;
float GetTime() const;
void Update(CStateManager& mgr, CAi& ai, float delta)
{
@ -96,7 +99,14 @@ public:
if (x4_state)
x4_state->CallFunc(mgr, ai, EStateMsg::One, delta);
}
void SetState(CStateManager&, CAi&, s32);
void SetState(CStateManager &, CAi &, const std::string&);
const std::vector<CAiState>* GetStateVector() const;
void Setup(const CStateMachine* machine);
std::string GetName() const;
void SetDelay(float);
void GetRandom() const;
float GetDelay() const;
};
}