summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoraap <aap@papnet.eu>2021-01-13 13:06:38 +0100
committeraap <aap@papnet.eu>2021-01-13 13:06:38 +0100
commit2804ad2363626958be7513014b9a302ea72768b6 (patch)
tree7b8dcfe41c57392b982df3e41f0762246dfd7646 /src
parente3a261d29cbb10abc0776ca697512349845a105c (diff)
anim velocity union
Diffstat (limited to 'src')
-rw-r--r--src/animation/AnimBlendClumpData.cpp2
-rw-r--r--src/animation/AnimBlendClumpData.h6
-rw-r--r--src/animation/FrameUpdate.cpp42
-rw-r--r--src/animation/RpAnimBlend.cpp2
-rw-r--r--src/objects/CutsceneObject.cpp2
-rw-r--r--src/peds/Ped.cpp3
6 files changed, 29 insertions, 28 deletions
diff --git a/src/animation/AnimBlendClumpData.cpp b/src/animation/AnimBlendClumpData.cpp
index 4e8f3153..620c2229 100644
--- a/src/animation/AnimBlendClumpData.cpp
+++ b/src/animation/AnimBlendClumpData.cpp
@@ -8,7 +8,7 @@
CAnimBlendClumpData::CAnimBlendClumpData(void)
{
numFrames = 0;
- velocity = nil;
+ velocity2d = nil;
frames = nil;
link.Init();
}
diff --git a/src/animation/AnimBlendClumpData.h b/src/animation/AnimBlendClumpData.h
index 633fc7b9..bb711b28 100644
--- a/src/animation/AnimBlendClumpData.h
+++ b/src/animation/AnimBlendClumpData.h
@@ -3,7 +3,6 @@
#include "AnimBlendList.h"
-// TODO: put somewhere else
struct AnimBlendFrameData
{
enum {
@@ -31,7 +30,10 @@ class CAnimBlendClumpData
public:
CAnimBlendLink link;
int32 numFrames;
- CVector *velocity;
+ union {
+ CVector2D *velocity2d;
+ CVector *velocity3d;
+ };
// order of frames is determined by RW hierarchy
AnimBlendFrameData *frames;
diff --git a/src/animation/FrameUpdate.cpp b/src/animation/FrameUpdate.cpp
index a085fd4b..e35bd4c8 100644
--- a/src/animation/FrameUpdate.cpp
+++ b/src/animation/FrameUpdate.cpp
@@ -33,7 +33,7 @@ FrameUpdateCallBackNonSkinned(AnimBlendFrameData *frame, void *arg)
AnimBlendFrameUpdateData *updateData = (AnimBlendFrameUpdateData*)arg;
if(frame->flag & AnimBlendFrameData::VELOCITY_EXTRACTION &&
- gpAnimBlendClump->velocity){
+ gpAnimBlendClump->velocity2d){
if(frame->flag & AnimBlendFrameData::VELOCITY_EXTRACTION_3D)
FrameUpdateCallBackWith3dVelocityExtractionNonSkinned(frame, arg);
else
@@ -142,11 +142,11 @@ FrameUpdateCallBackWithVelocityExtractionNonSkinned(AnimBlendFrameData *frame, v
}
if((frame->flag & AnimBlendFrameData::IGNORE_TRANSLATION) == 0){
- gpAnimBlendClump->velocity->x = transx - curx;
- gpAnimBlendClump->velocity->y = transy - cury;
+ gpAnimBlendClump->velocity2d->x = transx - curx;
+ gpAnimBlendClump->velocity2d->y = transy - cury;
if(looped){
- gpAnimBlendClump->velocity->x += endx;
- gpAnimBlendClump->velocity->y += endy;
+ gpAnimBlendClump->velocity2d->x += endx;
+ gpAnimBlendClump->velocity2d->y += endy;
}
mat->pos.x = pos.x - transx;
mat->pos.y = pos.y - transy;
@@ -222,9 +222,9 @@ FrameUpdateCallBackWith3dVelocityExtractionNonSkinned(AnimBlendFrameData *frame,
}
if((frame->flag & AnimBlendFrameData::IGNORE_TRANSLATION) == 0){
- *gpAnimBlendClump->velocity = trans - cur;
+ *gpAnimBlendClump->velocity3d = trans - cur;
if(looped)
- *gpAnimBlendClump->velocity += end;
+ *gpAnimBlendClump->velocity3d += end;
mat->pos.x = (pos - trans).x + frame->resetPos.x;
mat->pos.y = (pos - trans).y + frame->resetPos.y;
mat->pos.z = (pos - trans).z + frame->resetPos.z;
@@ -244,7 +244,7 @@ FrameUpdateCallBackSkinned(AnimBlendFrameData *frame, void *arg)
AnimBlendFrameUpdateData *updateData = (AnimBlendFrameUpdateData*)arg;
if(frame->flag & AnimBlendFrameData::VELOCITY_EXTRACTION &&
- gpAnimBlendClump->velocity){
+ gpAnimBlendClump->velocity2d){
if(frame->flag & AnimBlendFrameData::VELOCITY_EXTRACTION_3D)
FrameUpdateCallBackWith3dVelocityExtractionSkinned(frame, arg);
else
@@ -354,11 +354,11 @@ FrameUpdateCallBackWithVelocityExtractionSkinned(AnimBlendFrameData *frame, void
}
if((frame->flag & AnimBlendFrameData::IGNORE_TRANSLATION) == 0){
- gpAnimBlendClump->velocity->x = transx - curx;
- gpAnimBlendClump->velocity->y = transy - cury;
+ gpAnimBlendClump->velocity2d->x = transx - curx;
+ gpAnimBlendClump->velocity2d->y = transy - cury;
if(looped){
- gpAnimBlendClump->velocity->x += endx;
- gpAnimBlendClump->velocity->y += endy;
+ gpAnimBlendClump->velocity2d->x += endx;
+ gpAnimBlendClump->velocity2d->y += endy;
}
xform->t.x = pos.x - transx;
xform->t.y = pos.y - transy;
@@ -434,9 +434,9 @@ FrameUpdateCallBackWith3dVelocityExtractionSkinned(AnimBlendFrameData *frame, vo
}
if((frame->flag & AnimBlendFrameData::IGNORE_TRANSLATION) == 0){
- *gpAnimBlendClump->velocity = trans - cur;
+ *gpAnimBlendClump->velocity3d = trans - cur;
if(looped)
- *gpAnimBlendClump->velocity += end;
+ *gpAnimBlendClump->velocity3d += end;
xform->t.x = (pos - trans).x + frame->resetPos.x;
xform->t.y = (pos - trans).y + frame->resetPos.y;
xform->t.z = (pos - trans).z + frame->resetPos.z;
@@ -446,7 +446,7 @@ FrameUpdateCallBackWith3dVelocityExtractionSkinned(AnimBlendFrameData *frame, vo
void
FrameUpdateCallBackOffscreen(AnimBlendFrameData *frame, void *arg)
{
- if(frame->flag & AnimBlendFrameData::VELOCITY_EXTRACTION && gpAnimBlendClump->velocity)
+ if(frame->flag & AnimBlendFrameData::VELOCITY_EXTRACTION && gpAnimBlendClump->velocity2d)
FrameUpdateCallBackWithVelocityExtractionSkinned(frame, arg);
}
@@ -466,7 +466,7 @@ FrameUpdateCallBackNonSkinnedCompressed(AnimBlendFrameData *frame, void *arg)
AnimBlendFrameUpdateData *updateData = (AnimBlendFrameUpdateData*)arg;
if(frame->flag & AnimBlendFrameData::VELOCITY_EXTRACTION &&
- gpAnimBlendClump->velocity){
+ gpAnimBlendClump->velocity2d){
if(updateData->foobar)
for(node = updateData->nodes; *node; node++)
if((*node)->sequence && (*node)->association->IsPartial())
@@ -511,9 +511,9 @@ FrameUpdateCallBackNonSkinnedCompressed(AnimBlendFrameData *frame, void *arg)
}
if((frame->flag & AnimBlendFrameData::IGNORE_TRANSLATION) == 0){
- *gpAnimBlendClump->velocity = trans - cur;
+ *gpAnimBlendClump->velocity3d = trans - cur;
if(looped)
- *gpAnimBlendClump->velocity += end;
+ *gpAnimBlendClump->velocity3d += end;
mat->pos.x = (pos - trans).x + frame->resetPos.x;
mat->pos.y = (pos - trans).y + frame->resetPos.y;
mat->pos.z = (pos - trans).z + frame->resetPos.z;
@@ -573,7 +573,7 @@ FrameUpdateCallBackSkinnedCompressed(AnimBlendFrameData *frame, void *arg)
AnimBlendFrameUpdateData *updateData = (AnimBlendFrameUpdateData*)arg;
if(frame->flag & AnimBlendFrameData::VELOCITY_EXTRACTION &&
- gpAnimBlendClump->velocity){
+ gpAnimBlendClump->velocity2d){
if(updateData->foobar)
for(node = updateData->nodes; *node; node++)
if((*node)->sequence && (*node)->association->IsPartial())
@@ -620,9 +620,9 @@ FrameUpdateCallBackSkinnedCompressed(AnimBlendFrameData *frame, void *arg)
}
if((frame->flag & AnimBlendFrameData::IGNORE_TRANSLATION) == 0){
- *gpAnimBlendClump->velocity = trans - cur;
+ *gpAnimBlendClump->velocity3d = trans - cur;
if(looped)
- *gpAnimBlendClump->velocity += end;
+ *gpAnimBlendClump->velocity3d += end;
xform->t.x = (pos - trans).x + frame->resetPos.x;
xform->t.y = (pos - trans).y + frame->resetPos.y;
xform->t.z = (pos - trans).z + frame->resetPos.z;
diff --git a/src/animation/RpAnimBlend.cpp b/src/animation/RpAnimBlend.cpp
index c4103dbf..9223d198 100644
--- a/src/animation/RpAnimBlend.cpp
+++ b/src/animation/RpAnimBlend.cpp
@@ -437,7 +437,7 @@ RpAnimBlendNodeUpdateKeyframes(AnimBlendFrameData *frames, AnimBlendFrameUpdateD
CAnimBlendAssociation *a = (*node)->association;
for(i = 0; i < numNodes; i++)
if((frames[i].flag & AnimBlendFrameData::VELOCITY_EXTRACTION) == 0 ||
- gpAnimBlendClump->velocity == nil){
+ gpAnimBlendClump->velocity2d == nil){
if((*node)[i].sequence)
(*node)[i].FindKeyFrame(a->currentTime - a->timeStep);
}
diff --git a/src/objects/CutsceneObject.cpp b/src/objects/CutsceneObject.cpp
index 8d1be357..e36d8e25 100644
--- a/src/objects/CutsceneObject.cpp
+++ b/src/objects/CutsceneObject.cpp
@@ -46,7 +46,7 @@ CCutsceneObject::SetModelIndex(uint32 id)
CEntity::SetModelIndex(id);
assert(RwObjectGetType(m_rwObject) == rpCLUMP);
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;
}
diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp
index 572395d8..a4490c2f 100644
--- a/src/peds/Ped.cpp
+++ b/src/peds/Ped.cpp
@@ -434,8 +434,7 @@ CPed::SetModelIndex(uint32 mi)
if (!CanUseTorsoWhenLooking())
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))->velocity = (CVector*) &m_vecAnimMoveDelta;
+ (*RPANIMBLENDCLUMPDATA(m_rwObject))->velocity2d = &m_vecAnimMoveDelta;
if(modelInfo->GetHitColModel() == nil)
modelInfo->CreateHitColModelSkinned(GetClump());