mirror of
https://github.com/SMGCommunity/Petari.git
synced 2024-12-03 11:11:13 +00:00
do some random functions, ModelUtil, and move J3DModel to its proper location
This commit is contained in:
parent
d1ec5f3780
commit
f7cb317d13
20
include/Animation/BckCtrl.h
Normal file
20
include/Animation/BckCtrl.h
Normal file
@ -0,0 +1,20 @@
|
||||
#ifndef BCKCTRL_H
|
||||
#define BCKCTRL_H
|
||||
|
||||
#include "types.h"
|
||||
|
||||
class BckCtrlData
|
||||
{
|
||||
public:
|
||||
BckCtrlData();
|
||||
|
||||
u32 _0;
|
||||
s16 _4;
|
||||
s16 _6;
|
||||
s16 _8;
|
||||
s16 _A;
|
||||
s16 _C;
|
||||
u16 _E;
|
||||
};
|
||||
|
||||
#endif // BCKCTRL_H
|
@ -12,6 +12,11 @@ namespace MR
|
||||
bool isNearZero(const JGeometry::TVec3<f32> &, f32);
|
||||
f32 mod(f32, f32);
|
||||
void normalize(JGeometry::TVec3<f32> *);
|
||||
|
||||
f32 getRandom();
|
||||
f32 getRandom(f32, f32);
|
||||
f32 getRandom(s32, s32);
|
||||
f32 getRandomDegree();
|
||||
};
|
||||
|
||||
#endif // MATHUTIL_H
|
@ -3,6 +3,7 @@
|
||||
|
||||
#include "Actor/LiveActor/LiveActor.h"
|
||||
#include "Model/J3D/J3DModel.h"
|
||||
#include "OS/OSMutex.h"
|
||||
|
||||
namespace MR
|
||||
{
|
||||
@ -10,6 +11,8 @@ namespace MR
|
||||
void calcAnimModelManager(LiveActor *);
|
||||
J3DModel* getJ3DModel(const LiveActor *);
|
||||
void calcJ3DModel(LiveActor *);
|
||||
s16 getBckFrameMax(const LiveActor *, const char *);
|
||||
|
||||
ResourceHolder* getResourceHolder(const LiveActor *);
|
||||
ResourceHolder* getModelResourceHolder(const LiveActor *);
|
||||
|
||||
@ -18,6 +21,13 @@ namespace MR
|
||||
void syncJointAnimation(LiveActor *, const LiveActor *);
|
||||
|
||||
void syncMaterialAnimation(LiveActor *, const LiveActor *);
|
||||
|
||||
template<int T>
|
||||
class MutexHolder
|
||||
{
|
||||
public:
|
||||
static OSMutex sMutex;
|
||||
};
|
||||
}
|
||||
|
||||
#endif // MODELUTIL_H
|
@ -13,7 +13,8 @@ public:
|
||||
bool isExistMaterialAnim();
|
||||
|
||||
ResTable* mResourceTable; // _0
|
||||
u8 _4[0x38-0x4];
|
||||
ResTable* _4;
|
||||
u8 _8[0x38-0x8];
|
||||
u32 _38;
|
||||
u32 _3C;
|
||||
u32 _40;
|
||||
|
@ -11,4 +11,15 @@ namespace MR
|
||||
{
|
||||
return (a2 + (a1 / a4) * (a3 - a2));
|
||||
}
|
||||
|
||||
f32 getRandom(f32 min, f32 max)
|
||||
{
|
||||
return min + ((max - min) * getRandom());
|
||||
}
|
||||
|
||||
f32 getRandomDegree()
|
||||
{
|
||||
// todo -- figure out why 0.0f get omitted
|
||||
return 0.0f + (360.0f * getRandom());
|
||||
}
|
||||
};
|
@ -1,4 +1,5 @@
|
||||
#include "MR/ModelUtil.h"
|
||||
#include "Animation/BckCtrl.h"
|
||||
|
||||
namespace MR
|
||||
{
|
||||
@ -22,6 +23,13 @@ namespace MR
|
||||
return pActor->mModelManager->getJ3DModel();
|
||||
}
|
||||
|
||||
void calcJ3DModel(LiveActor *pActor)
|
||||
{
|
||||
OSLockMutex(&MR::MutexHolder<0>::sMutex);
|
||||
MR::getJ3DModel(pActor)->calc();
|
||||
OSUnlockMutex(&MR::MutexHolder<0>::sMutex);
|
||||
}
|
||||
|
||||
J3DModelData* getJ3DModelData(const LiveActor *pActor)
|
||||
{
|
||||
if (pActor->mModelManager == 0)
|
||||
@ -32,6 +40,12 @@ namespace MR
|
||||
return pActor->mModelManager->getJ3DModelData();
|
||||
}
|
||||
|
||||
s16 getBckFrameMax(const LiveActor *pActor, const char *pBck)
|
||||
{
|
||||
BckCtrlData* data = (BckCtrlData*)MR::getResourceHolder(pActor)->_4->getRes(pBck);
|
||||
return data->_6;
|
||||
}
|
||||
|
||||
ResourceHolder* getResourceHolder(const LiveActor *pActor)
|
||||
{
|
||||
if (pActor->mModelManager != 0)
|
||||
|
Loading…
Reference in New Issue
Block a user