1
0
Fork 0
mirror of https://git.rip/DMCA_FUCKER/re3.git synced 2024-11-05 12:25:54 +00:00

anim velocity union

This commit is contained in:
aap 2021-01-13 13:06:38 +01:00
parent e3a261d29c
commit 2804ad2363
6 changed files with 29 additions and 28 deletions

View file

@ -8,7 +8,7 @@
CAnimBlendClumpData::CAnimBlendClumpData(void) CAnimBlendClumpData::CAnimBlendClumpData(void)
{ {
numFrames = 0; numFrames = 0;
velocity = nil; velocity2d = nil;
frames = nil; frames = nil;
link.Init(); link.Init();
} }

View file

@ -3,7 +3,6 @@
#include "AnimBlendList.h" #include "AnimBlendList.h"
// TODO: put somewhere else
struct AnimBlendFrameData struct AnimBlendFrameData
{ {
enum { enum {
@ -31,7 +30,10 @@ class CAnimBlendClumpData
public: public:
CAnimBlendLink link; CAnimBlendLink link;
int32 numFrames; int32 numFrames;
CVector *velocity; union {
CVector2D *velocity2d;
CVector *velocity3d;
};
// order of frames is determined by RW hierarchy // order of frames is determined by RW hierarchy
AnimBlendFrameData *frames; AnimBlendFrameData *frames;

View file

@ -33,7 +33,7 @@ FrameUpdateCallBackNonSkinned(AnimBlendFrameData *frame, void *arg)
AnimBlendFrameUpdateData *updateData = (AnimBlendFrameUpdateData*)arg; AnimBlendFrameUpdateData *updateData = (AnimBlendFrameUpdateData*)arg;
if(frame->flag & AnimBlendFrameData::VELOCITY_EXTRACTION && if(frame->flag & AnimBlendFrameData::VELOCITY_EXTRACTION &&
gpAnimBlendClump->velocity){ gpAnimBlendClump->velocity2d){
if(frame->flag & AnimBlendFrameData::VELOCITY_EXTRACTION_3D) if(frame->flag & AnimBlendFrameData::VELOCITY_EXTRACTION_3D)
FrameUpdateCallBackWith3dVelocityExtractionNonSkinned(frame, arg); FrameUpdateCallBackWith3dVelocityExtractionNonSkinned(frame, arg);
else else
@ -142,11 +142,11 @@ FrameUpdateCallBackWithVelocityExtractionNonSkinned(AnimBlendFrameData *frame, v
} }
if((frame->flag & AnimBlendFrameData::IGNORE_TRANSLATION) == 0){ if((frame->flag & AnimBlendFrameData::IGNORE_TRANSLATION) == 0){
gpAnimBlendClump->velocity->x = transx - curx; gpAnimBlendClump->velocity2d->x = transx - curx;
gpAnimBlendClump->velocity->y = transy - cury; gpAnimBlendClump->velocity2d->y = transy - cury;
if(looped){ if(looped){
gpAnimBlendClump->velocity->x += endx; gpAnimBlendClump->velocity2d->x += endx;
gpAnimBlendClump->velocity->y += endy; gpAnimBlendClump->velocity2d->y += endy;
} }
mat->pos.x = pos.x - transx; mat->pos.x = pos.x - transx;
mat->pos.y = pos.y - transy; mat->pos.y = pos.y - transy;
@ -222,9 +222,9 @@ FrameUpdateCallBackWith3dVelocityExtractionNonSkinned(AnimBlendFrameData *frame,
} }
if((frame->flag & AnimBlendFrameData::IGNORE_TRANSLATION) == 0){ if((frame->flag & AnimBlendFrameData::IGNORE_TRANSLATION) == 0){
*gpAnimBlendClump->velocity = trans - cur; *gpAnimBlendClump->velocity3d = trans - cur;
if(looped) if(looped)
*gpAnimBlendClump->velocity += end; *gpAnimBlendClump->velocity3d += end;
mat->pos.x = (pos - trans).x + frame->resetPos.x; mat->pos.x = (pos - trans).x + frame->resetPos.x;
mat->pos.y = (pos - trans).y + frame->resetPos.y; mat->pos.y = (pos - trans).y + frame->resetPos.y;
mat->pos.z = (pos - trans).z + frame->resetPos.z; mat->pos.z = (pos - trans).z + frame->resetPos.z;
@ -244,7 +244,7 @@ FrameUpdateCallBackSkinned(AnimBlendFrameData *frame, void *arg)
AnimBlendFrameUpdateData *updateData = (AnimBlendFrameUpdateData*)arg; AnimBlendFrameUpdateData *updateData = (AnimBlendFrameUpdateData*)arg;
if(frame->flag & AnimBlendFrameData::VELOCITY_EXTRACTION && if(frame->flag & AnimBlendFrameData::VELOCITY_EXTRACTION &&
gpAnimBlendClump->velocity){ gpAnimBlendClump->velocity2d){
if(frame->flag & AnimBlendFrameData::VELOCITY_EXTRACTION_3D) if(frame->flag & AnimBlendFrameData::VELOCITY_EXTRACTION_3D)
FrameUpdateCallBackWith3dVelocityExtractionSkinned(frame, arg); FrameUpdateCallBackWith3dVelocityExtractionSkinned(frame, arg);
else else
@ -354,11 +354,11 @@ FrameUpdateCallBackWithVelocityExtractionSkinned(AnimBlendFrameData *frame, void
} }
if((frame->flag & AnimBlendFrameData::IGNORE_TRANSLATION) == 0){ if((frame->flag & AnimBlendFrameData::IGNORE_TRANSLATION) == 0){
gpAnimBlendClump->velocity->x = transx - curx; gpAnimBlendClump->velocity2d->x = transx - curx;
gpAnimBlendClump->velocity->y = transy - cury; gpAnimBlendClump->velocity2d->y = transy - cury;
if(looped){ if(looped){
gpAnimBlendClump->velocity->x += endx; gpAnimBlendClump->velocity2d->x += endx;
gpAnimBlendClump->velocity->y += endy; gpAnimBlendClump->velocity2d->y += endy;
} }
xform->t.x = pos.x - transx; xform->t.x = pos.x - transx;
xform->t.y = pos.y - transy; xform->t.y = pos.y - transy;
@ -434,9 +434,9 @@ FrameUpdateCallBackWith3dVelocityExtractionSkinned(AnimBlendFrameData *frame, vo
} }
if((frame->flag & AnimBlendFrameData::IGNORE_TRANSLATION) == 0){ if((frame->flag & AnimBlendFrameData::IGNORE_TRANSLATION) == 0){
*gpAnimBlendClump->velocity = trans - cur; *gpAnimBlendClump->velocity3d = trans - cur;
if(looped) if(looped)
*gpAnimBlendClump->velocity += end; *gpAnimBlendClump->velocity3d += end;
xform->t.x = (pos - trans).x + frame->resetPos.x; xform->t.x = (pos - trans).x + frame->resetPos.x;
xform->t.y = (pos - trans).y + frame->resetPos.y; xform->t.y = (pos - trans).y + frame->resetPos.y;
xform->t.z = (pos - trans).z + frame->resetPos.z; xform->t.z = (pos - trans).z + frame->resetPos.z;
@ -446,7 +446,7 @@ FrameUpdateCallBackWith3dVelocityExtractionSkinned(AnimBlendFrameData *frame, vo
void void
FrameUpdateCallBackOffscreen(AnimBlendFrameData *frame, void *arg) FrameUpdateCallBackOffscreen(AnimBlendFrameData *frame, void *arg)
{ {
if(frame->flag & AnimBlendFrameData::VELOCITY_EXTRACTION && gpAnimBlendClump->velocity) if(frame->flag & AnimBlendFrameData::VELOCITY_EXTRACTION && gpAnimBlendClump->velocity2d)
FrameUpdateCallBackWithVelocityExtractionSkinned(frame, arg); FrameUpdateCallBackWithVelocityExtractionSkinned(frame, arg);
} }
@ -466,7 +466,7 @@ FrameUpdateCallBackNonSkinnedCompressed(AnimBlendFrameData *frame, void *arg)
AnimBlendFrameUpdateData *updateData = (AnimBlendFrameUpdateData*)arg; AnimBlendFrameUpdateData *updateData = (AnimBlendFrameUpdateData*)arg;
if(frame->flag & AnimBlendFrameData::VELOCITY_EXTRACTION && if(frame->flag & AnimBlendFrameData::VELOCITY_EXTRACTION &&
gpAnimBlendClump->velocity){ gpAnimBlendClump->velocity2d){
if(updateData->foobar) if(updateData->foobar)
for(node = updateData->nodes; *node; node++) for(node = updateData->nodes; *node; node++)
if((*node)->sequence && (*node)->association->IsPartial()) if((*node)->sequence && (*node)->association->IsPartial())
@ -511,9 +511,9 @@ FrameUpdateCallBackNonSkinnedCompressed(AnimBlendFrameData *frame, void *arg)
} }
if((frame->flag & AnimBlendFrameData::IGNORE_TRANSLATION) == 0){ if((frame->flag & AnimBlendFrameData::IGNORE_TRANSLATION) == 0){
*gpAnimBlendClump->velocity = trans - cur; *gpAnimBlendClump->velocity3d = trans - cur;
if(looped) if(looped)
*gpAnimBlendClump->velocity += end; *gpAnimBlendClump->velocity3d += end;
mat->pos.x = (pos - trans).x + frame->resetPos.x; mat->pos.x = (pos - trans).x + frame->resetPos.x;
mat->pos.y = (pos - trans).y + frame->resetPos.y; mat->pos.y = (pos - trans).y + frame->resetPos.y;
mat->pos.z = (pos - trans).z + frame->resetPos.z; mat->pos.z = (pos - trans).z + frame->resetPos.z;
@ -573,7 +573,7 @@ FrameUpdateCallBackSkinnedCompressed(AnimBlendFrameData *frame, void *arg)
AnimBlendFrameUpdateData *updateData = (AnimBlendFrameUpdateData*)arg; AnimBlendFrameUpdateData *updateData = (AnimBlendFrameUpdateData*)arg;
if(frame->flag & AnimBlendFrameData::VELOCITY_EXTRACTION && if(frame->flag & AnimBlendFrameData::VELOCITY_EXTRACTION &&
gpAnimBlendClump->velocity){ gpAnimBlendClump->velocity2d){
if(updateData->foobar) if(updateData->foobar)
for(node = updateData->nodes; *node; node++) for(node = updateData->nodes; *node; node++)
if((*node)->sequence && (*node)->association->IsPartial()) if((*node)->sequence && (*node)->association->IsPartial())
@ -620,9 +620,9 @@ FrameUpdateCallBackSkinnedCompressed(AnimBlendFrameData *frame, void *arg)
} }
if((frame->flag & AnimBlendFrameData::IGNORE_TRANSLATION) == 0){ if((frame->flag & AnimBlendFrameData::IGNORE_TRANSLATION) == 0){
*gpAnimBlendClump->velocity = trans - cur; *gpAnimBlendClump->velocity3d = trans - cur;
if(looped) if(looped)
*gpAnimBlendClump->velocity += end; *gpAnimBlendClump->velocity3d += end;
xform->t.x = (pos - trans).x + frame->resetPos.x; xform->t.x = (pos - trans).x + frame->resetPos.x;
xform->t.y = (pos - trans).y + frame->resetPos.y; xform->t.y = (pos - trans).y + frame->resetPos.y;
xform->t.z = (pos - trans).z + frame->resetPos.z; xform->t.z = (pos - trans).z + frame->resetPos.z;

View file

@ -437,7 +437,7 @@ RpAnimBlendNodeUpdateKeyframes(AnimBlendFrameData *frames, AnimBlendFrameUpdateD
CAnimBlendAssociation *a = (*node)->association; CAnimBlendAssociation *a = (*node)->association;
for(i = 0; i < numNodes; i++) for(i = 0; i < numNodes; i++)
if((frames[i].flag & AnimBlendFrameData::VELOCITY_EXTRACTION) == 0 || if((frames[i].flag & AnimBlendFrameData::VELOCITY_EXTRACTION) == 0 ||
gpAnimBlendClump->velocity == nil){ gpAnimBlendClump->velocity2d == nil){
if((*node)[i].sequence) if((*node)[i].sequence)
(*node)[i].FindKeyFrame(a->currentTime - a->timeStep); (*node)[i].FindKeyFrame(a->currentTime - a->timeStep);
} }

View file

@ -46,7 +46,7 @@ CCutsceneObject::SetModelIndex(uint32 id)
CEntity::SetModelIndex(id); CEntity::SetModelIndex(id);
assert(RwObjectGetType(m_rwObject) == rpCLUMP); assert(RwObjectGetType(m_rwObject) == rpCLUMP);
RpAnimBlendClumpInit((RpClump*)m_rwObject); RpAnimBlendClumpInit((RpClump*)m_rwObject);
(*RPANIMBLENDCLUMPDATA(m_rwObject))->velocity = &m_vecMoveSpeed; (*RPANIMBLENDCLUMPDATA(m_rwObject))->velocity3d = &m_vecMoveSpeed;
(*RPANIMBLENDCLUMPDATA(m_rwObject))->frames[0].flag |= AnimBlendFrameData::VELOCITY_EXTRACTION_3D; (*RPANIMBLENDCLUMPDATA(m_rwObject))->frames[0].flag |= AnimBlendFrameData::VELOCITY_EXTRACTION_3D;
} }

View file

@ -434,8 +434,7 @@ CPed::SetModelIndex(uint32 mi)
if (!CanUseTorsoWhenLooking()) if (!CanUseTorsoWhenLooking())
m_pedIK.m_flags |= CPedIK::LOOKAROUND_HEAD_ONLY; m_pedIK.m_flags |= CPedIK::LOOKAROUND_HEAD_ONLY;
// This is a mistake by R*, velocity is CVector, whereas m_vecAnimMoveDelta is CVector2D. (*RPANIMBLENDCLUMPDATA(m_rwObject))->velocity2d = &m_vecAnimMoveDelta;
(*RPANIMBLENDCLUMPDATA(m_rwObject))->velocity = (CVector*) &m_vecAnimMoveDelta;
if(modelInfo->GetHitColModel() == nil) if(modelInfo->GetHitColModel() == nil)
modelInfo->CreateHitColModelSkinned(GetClump()); modelInfo->CreateHitColModelSkinned(GetClump());