fixed hanim for 64 bit

This commit is contained in:
aap 2020-07-24 23:29:33 +02:00
parent b05cb3f1a3
commit 1c44368f0a
6 changed files with 18 additions and 9 deletions

View File

@ -19,7 +19,7 @@ struct AnimBlendFrameData
#ifdef PED_SKIN
union {
RwFrame *frame;
RpHAnimStdKeyFrame *hanimFrame;
RpHAnimStdInterpFrame *hanimFrame;
};
int32 nodeID;
#else

View File

@ -236,7 +236,7 @@ FrameUpdateCallBackSkinned(AnimBlendFrameData *frame, void *arg)
float transBlendAmount = 0.0f;
CQuaternion q, rot(0.0f, 0.0f, 0.0f, 0.0f);
float totalBlendAmount = 0.0f;
RpHAnimStdKeyFrame *xform = frame->hanimFrame;
RpHAnimStdInterpFrame *xform = frame->hanimFrame;
CAnimBlendNode **node;
AnimBlendFrameUpdateData *updateData = (AnimBlendFrameUpdateData*)arg;
@ -297,7 +297,7 @@ FrameUpdateCallBackWithVelocityExtractionSkinned(AnimBlendFrameData *frame, void
float curx = 0.0f, cury = 0.0f;
float endx = 0.0f, endy = 0.0f;
bool looped = false;
RpHAnimStdKeyFrame *xform = frame->hanimFrame;
RpHAnimStdInterpFrame *xform = frame->hanimFrame;
CAnimBlendNode **node;
AnimBlendFrameUpdateData *updateData = (AnimBlendFrameUpdateData*)arg;
@ -381,7 +381,7 @@ FrameUpdateCallBackWith3dVelocityExtractionSkinned(AnimBlendFrameData *frame, vo
CVector cur(0.0f, 0.0f, 0.0f);
CVector end(0.0f, 0.0f, 0.0f);
bool looped = false;
RpHAnimStdKeyFrame *xform = frame->hanimFrame;
RpHAnimStdInterpFrame *xform = frame->hanimFrame;
CAnimBlendNode **node;
AnimBlendFrameUpdateData *updateData = (AnimBlendFrameUpdateData*)arg;

View File

@ -170,9 +170,9 @@ RpAnimBlendClumpInitSkinned(RpClump *clump)
frames[i].nodeID = HIERNODEID(hier, i);
frames[i].resetPos = boneTab[i];
#ifdef LIBRW
frames[i].hanimFrame = (RpHAnimStdKeyFrame*)rpHANIMHIERARCHYGETINTERPFRAME(hier, i);
frames[i].hanimFrame = (RpHAnimStdInterpFrame*)rpHANIMHIERARCHYGETINTERPFRAME(hier, i);
#else
frames[i].hanimFrame = (RpHAnimStdKeyFrame*)rtANIMGETINTERPFRAME(hier->currentAnim, i);
frames[i].hanimFrame = (RpHAnimStdInterpFrame*)rtANIMGETINTERPFRAME(hier->currentAnim, i);
#endif
}
clumpData->ForAllFrames(FrameInitCBskin, nil);

View File

@ -41,6 +41,7 @@
#define HIERNODEINFO(hier) ((hier)->pNodeInfo)
#define HIERNODEID(hier, i) ((hier)->pNodeInfo[i].nodeID)
#define HANIMFRAME(anim, i) ((RwUInt8*)(anim)->pFrames + (i)*(anim)->interpInfo->keyFrameSize)
#define RpHAnimStdInterpFrame RpHAnimStdKeyFrame
#endif
#ifdef RWHALFPIXEL

View File

@ -648,7 +648,7 @@ CEntity::UpdateRpHAnim(void)
char buf[256];
if(this == (CEntity*)FindPlayerPed())
for(i = 0; i < hier->numNodes; i++){
RpHAnimStdKeyFrame *kf = (RpHAnimStdKeyFrame*)rpHANIMHIERARCHYGETINTERPFRAME(hier, i);
RpHAnimStdInterpFrame *kf = (RpHAnimStdInterpFrame*)rpHANIMHIERARCHYGETINTERPFRAME(hier, i);
sprintf(buf, "%6.3f %6.3f %6.3f %6.3f %6.3f %6.3f %6.3f %d %s",
kf->q.imag.x, kf->q.imag.y, kf->q.imag.z, kf->q.real,
kf->t.x, kf->t.y, kf->t.z,

View File

@ -17,7 +17,15 @@ struct RpHAnimStdKeyFrame
RtQuat q;
RwV3d t;
};
// same story, this one only exists in later RW versions
// but we need it for 64 bit builds because offset and size differs!
struct RpHAnimStdInterpFrame
{
RpHAnimStdKeyFrame *keyFrame1;
RpHAnimStdKeyFrame *keyFrame2;
RtQuat q;
RwV3d t;
};
enum RpHAnimHierarchyFlag
{
@ -56,7 +64,7 @@ RwBool RpHAnimHierarchyUpdateMatrices(RpHAnimHierarchy *hierarchy);
#define rpHANIMHIERARCHYGETINTERPFRAME( hierarchy, nodeIndex ) \
( (void *)( ( (RwUInt8 *)&(hierarchy->interpolator[1]) + \
((nodeIndex) * \
hierarchy->interpolator->currentAnimKeyFrameSize) ) ) )
hierarchy->interpolator->currentInterpKeyFrameSize) ) ) )
RpHAnimAnimation *RpHAnimAnimationCreate(RwInt32 typeID, RwInt32 numFrames, RwInt32 flags, RwReal duration);