fixed hanim for 64 bit

This commit is contained in:
aap 2020-07-24 23:28:55 +02:00
parent 15918feb8e
commit b5b64ca351
6 changed files with 17 additions and 8 deletions

View File

@ -18,7 +18,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)
CVector vec, pos(0.0f, 0.0f, 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;
@ -383,7 +383,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,7 +170,7 @@ RpAnimBlendClumpInitSkinned(RpClump *clump)
for(i = 0; i < numBones; i++){
frames[i].nodeID = HIERNODEID(hier, i);
frames[i].resetPos = boneTab[i];
frames[i].hanimFrame = (RpHAnimStdKeyFrame*)rpHANIMHIERARCHYGETINTERPFRAME(hier, i);
frames[i].hanimFrame = (RpHAnimStdInterpFrame*)rpHANIMHIERARCHYGETINTERPFRAME(hier, i);
}
clumpData->ForAllFrames(FrameInitCBskin, nil);
clumpData->frames[0].flag |= AnimBlendFrameData::VELOCITY_EXTRACTION;

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

@ -579,7 +579,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);