2016-04-13 06:07:23 +00:00
|
|
|
#ifndef __URDE_CPASDATABASE_HPP__
|
|
|
|
#define __URDE_CPASDATABASE_HPP__
|
2016-04-10 04:49:02 +00:00
|
|
|
|
|
|
|
#include "IOStreams.hpp"
|
|
|
|
#include "CPASAnimState.hpp"
|
|
|
|
|
|
|
|
namespace urde
|
|
|
|
{
|
|
|
|
|
2016-04-27 19:59:38 +00:00
|
|
|
class CRandom16;
|
|
|
|
class CPASAnimParmData;
|
2016-04-10 04:49:02 +00:00
|
|
|
class CPASDatabase
|
|
|
|
{
|
|
|
|
std::vector<CPASAnimState> x0_states;
|
2016-04-27 19:59:38 +00:00
|
|
|
s32 x10_defaultState;
|
2016-04-10 04:49:02 +00:00
|
|
|
void AddAnimState(CPASAnimState&& state);
|
2016-04-27 19:59:38 +00:00
|
|
|
void SetDefaultState(s32 state) {x10_defaultState = state;}
|
2016-04-10 04:49:02 +00:00
|
|
|
public:
|
|
|
|
CPASDatabase(CInputStream& in);
|
2016-04-27 19:59:38 +00:00
|
|
|
|
|
|
|
void FindBestAnimation(const CPASAnimParmData&, int) const;
|
|
|
|
void FindBestAnimation(const CPASAnimParmData&, CRandom16&, int) const;
|
|
|
|
s32 GetDefaultState() const { return x10_defaultState; }
|
|
|
|
s32 GetNumAnimStates() const { return x0_states.size(); }
|
|
|
|
const CPASAnimState* GetAnimState(s32 id) const
|
|
|
|
{
|
|
|
|
for (const CPASAnimState& state : x0_states)
|
|
|
|
if (id == state.GetStateId())
|
|
|
|
return &state;
|
|
|
|
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
const CPASAnimState* GetAnimStateByIndex(s32 index) const
|
|
|
|
{
|
|
|
|
if (index < 0 || index >= x0_states.size())
|
|
|
|
return nullptr;
|
|
|
|
|
|
|
|
return &x0_states.at(index);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool HasState(s32 id) const
|
|
|
|
{
|
|
|
|
for (const CPASAnimState& state : x0_states)
|
|
|
|
return true;
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
2016-04-10 04:49:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2016-04-13 06:07:23 +00:00
|
|
|
#endif // __URDE_CPASDATABASE_HPP__
|