2019-06-11 08:59:28 +02:00
|
|
|
#include "common.h"
|
2020-04-17 15:31:11 +02:00
|
|
|
|
2020-04-23 22:25:18 +02:00
|
|
|
#include "RwHelper.h"
|
2019-10-30 00:12:58 +01:00
|
|
|
#include "General.h"
|
2019-06-11 08:59:28 +02:00
|
|
|
#include "NodeName.h"
|
|
|
|
#include "VisibilityPlugins.h"
|
2020-04-23 22:25:18 +02:00
|
|
|
#include "Bones.h"
|
2019-06-11 08:59:28 +02:00
|
|
|
#include "AnimBlendClumpData.h"
|
|
|
|
#include "AnimBlendHierarchy.h"
|
|
|
|
#include "AnimBlendAssociation.h"
|
|
|
|
#include "RpAnimBlend.h"
|
2020-04-23 22:25:18 +02:00
|
|
|
#ifdef PED_SKIN
|
|
|
|
#include "PedModelInfo.h"
|
|
|
|
#endif
|
2019-06-11 08:59:28 +02:00
|
|
|
|
2020-04-17 07:54:14 +02:00
|
|
|
RwInt32 ClumpOffset;
|
2019-06-11 08:59:28 +02:00
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
ID_RPANIMBLEND = MAKECHUNKID(rwVENDORID_ROCKSTAR, 0xFD),
|
|
|
|
};
|
|
|
|
|
|
|
|
void*
|
|
|
|
AnimBlendClumpCreate(void *object, RwInt32 offsetInObject, RwInt32 sizeInObject)
|
|
|
|
{
|
|
|
|
*RWPLUGINOFFSET(CAnimBlendClumpData*, object, offsetInObject) = nil;
|
|
|
|
return object;
|
|
|
|
}
|
|
|
|
|
|
|
|
void*
|
|
|
|
AnimBlendClumpDestroy(void *object, RwInt32 offsetInObject, RwInt32 sizeInObject)
|
|
|
|
{
|
|
|
|
CAnimBlendClumpData *data;
|
|
|
|
data = *RPANIMBLENDCLUMPDATA(object);
|
|
|
|
if(data){
|
|
|
|
RpAnimBlendClumpRemoveAllAssociations((RpClump*)object);
|
|
|
|
delete data;
|
|
|
|
*RPANIMBLENDCLUMPDATA(object) = nil;
|
|
|
|
}
|
|
|
|
return object;
|
|
|
|
}
|
|
|
|
|
|
|
|
void *AnimBlendClumpCopy(void *dstObject, const void *srcObject, RwInt32 offsetInObject, RwInt32 sizeInObject) { return nil; }
|
|
|
|
|
|
|
|
bool
|
|
|
|
RpAnimBlendPluginAttach(void)
|
|
|
|
{
|
|
|
|
ClumpOffset = RpClumpRegisterPlugin(sizeof(CAnimBlendClumpData*), ID_RPANIMBLEND,
|
|
|
|
AnimBlendClumpCreate, AnimBlendClumpDestroy, AnimBlendClumpCopy);
|
|
|
|
return ClumpOffset >= 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
CAnimBlendAssociation*
|
|
|
|
RpAnimBlendGetNextAssociation(CAnimBlendAssociation *assoc)
|
|
|
|
{
|
|
|
|
if(assoc->link.next)
|
2019-06-27 05:30:29 +02:00
|
|
|
return CAnimBlendAssociation::FromLink(assoc->link.next);
|
2019-06-11 08:59:28 +02:00
|
|
|
return nil;
|
|
|
|
}
|
|
|
|
|
|
|
|
CAnimBlendAssociation*
|
|
|
|
RpAnimBlendGetNextAssociation(CAnimBlendAssociation *assoc, uint32 mask)
|
|
|
|
{
|
|
|
|
CAnimBlendLink *link;
|
|
|
|
for(link = assoc->link.next; link; link = link->next){
|
|
|
|
assoc = CAnimBlendAssociation::FromLink(link);
|
|
|
|
if(assoc->flags & mask)
|
|
|
|
return assoc;
|
|
|
|
}
|
|
|
|
return nil;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
RpAnimBlendAllocateData(RpClump *clump)
|
|
|
|
{
|
|
|
|
*RPANIMBLENDCLUMPDATA(clump) = new CAnimBlendClumpData;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
RpAnimBlendClumpSetBlendDeltas(RpClump *clump, uint32 mask, float delta)
|
|
|
|
{
|
|
|
|
CAnimBlendClumpData *clumpData = *RPANIMBLENDCLUMPDATA(clump);
|
|
|
|
for(CAnimBlendLink *link = clumpData->link.next; link; link = link->next){
|
|
|
|
CAnimBlendAssociation *assoc = CAnimBlendAssociation::FromLink(link);
|
|
|
|
if(mask == 0 || (assoc->flags & mask))
|
|
|
|
assoc->blendDelta = delta;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
RpAnimBlendClumpRemoveAllAssociations(RpClump *clump)
|
|
|
|
{
|
|
|
|
RpAnimBlendClumpRemoveAssociations(clump, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
RpAnimBlendClumpRemoveAssociations(RpClump *clump, uint32 mask)
|
|
|
|
{
|
|
|
|
CAnimBlendClumpData *clumpData = *RPANIMBLENDCLUMPDATA(clump);
|
|
|
|
CAnimBlendLink *next;
|
|
|
|
for(CAnimBlendLink *link = clumpData->link.next; link; link = next){
|
|
|
|
next = link->next;
|
|
|
|
CAnimBlendAssociation *assoc = CAnimBlendAssociation::FromLink(link);
|
|
|
|
if(mask == 0 || (assoc->flags & mask))
|
|
|
|
if(assoc)
|
|
|
|
delete assoc;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
RwFrame*
|
|
|
|
FrameForAllChildrenCountCallBack(RwFrame *frame, void *data)
|
|
|
|
{
|
|
|
|
int *numFrames = (int*)data;
|
|
|
|
(*numFrames)++;
|
|
|
|
RwFrameForAllChildren(frame, FrameForAllChildrenCountCallBack, data);
|
|
|
|
return frame;
|
|
|
|
}
|
|
|
|
|
|
|
|
RwFrame*
|
|
|
|
FrameForAllChildrenFillFrameArrayCallBack(RwFrame *frame, void *data)
|
|
|
|
{
|
|
|
|
AnimBlendFrameData **frames = (AnimBlendFrameData**)data;
|
|
|
|
(*frames)->frame = frame;
|
|
|
|
(*frames)++;
|
|
|
|
RwFrameForAllChildren(frame, FrameForAllChildrenFillFrameArrayCallBack, frames);
|
|
|
|
return frame;
|
|
|
|
}
|
|
|
|
|
2020-04-23 22:25:18 +02:00
|
|
|
// FrameInitCallBack on PS2
|
2019-06-11 08:59:28 +02:00
|
|
|
void
|
2020-04-23 22:25:18 +02:00
|
|
|
FrameInitCBnonskin(AnimBlendFrameData *frameData, void*)
|
2019-06-11 08:59:28 +02:00
|
|
|
{
|
|
|
|
frameData->flag = 0;
|
|
|
|
frameData->resetPos = *RwMatrixGetPos(RwFrameGetMatrix(frameData->frame));
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2020-04-23 22:25:18 +02:00
|
|
|
FrameInitCBskin(AnimBlendFrameData *frameData, void*)
|
2019-06-11 08:59:28 +02:00
|
|
|
{
|
2020-04-23 22:25:18 +02:00
|
|
|
frameData->flag = 0;
|
|
|
|
}
|
|
|
|
|
2019-06-11 08:59:28 +02:00
|
|
|
#ifdef PED_SKIN
|
2020-04-23 22:25:18 +02:00
|
|
|
void
|
|
|
|
RpAnimBlendClumpInitSkinned(RpClump *clump)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
RwV3d boneTab[64];
|
|
|
|
CAnimBlendClumpData *clumpData;
|
|
|
|
RpAtomic *atomic;
|
|
|
|
RpSkin *skin;
|
|
|
|
RpHAnimHierarchy *hier;
|
|
|
|
int numBones;
|
|
|
|
|
|
|
|
RpAnimBlendAllocateData(clump);
|
|
|
|
clumpData = *RPANIMBLENDCLUMPDATA(clump);
|
|
|
|
atomic = IsClumpSkinned(clump);
|
|
|
|
assert(atomic);
|
|
|
|
skin = RpSkinGeometryGetSkin(RpAtomicGetGeometry(atomic));
|
|
|
|
assert(skin);
|
|
|
|
numBones = RpSkinGetNumBones(skin);
|
|
|
|
clumpData->SetNumberOfBones(numBones);
|
|
|
|
hier = GetAnimHierarchyFromSkinClump(clump);
|
|
|
|
assert(hier);
|
|
|
|
memset(boneTab, 0, sizeof(boneTab));
|
|
|
|
SkinGetBonePositionsToTable(clump, boneTab);
|
|
|
|
|
|
|
|
AnimBlendFrameData *frames = clumpData->frames;
|
|
|
|
for(i = 0; i < numBones; i++){
|
|
|
|
frames[i].nodeID = HIERNODEID(hier, i);
|
|
|
|
frames[i].resetPos = boneTab[i];
|
|
|
|
frames[i].hanimFrame = (RpHAnimStdKeyFrame*)rpHANIMHIERARCHYGETINTERPFRAME(hier, i);
|
|
|
|
}
|
|
|
|
clumpData->ForAllFrames(FrameInitCBskin, nil);
|
|
|
|
clumpData->frames[0].flag |= AnimBlendFrameData::VELOCITY_EXTRACTION;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
void
|
|
|
|
RpAnimBlendClumpInitNotSkinned(RpClump *clump)
|
|
|
|
{
|
2019-06-11 08:59:28 +02:00
|
|
|
int numFrames = 0;
|
|
|
|
CAnimBlendClumpData *clumpData;
|
|
|
|
RwFrame *root;
|
|
|
|
AnimBlendFrameData *frames;
|
|
|
|
|
|
|
|
RpAnimBlendAllocateData(clump);
|
|
|
|
clumpData = *RPANIMBLENDCLUMPDATA(clump);
|
|
|
|
root = RpClumpGetFrame(clump);
|
|
|
|
RwFrameForAllChildren(root, FrameForAllChildrenCountCallBack, &numFrames);
|
|
|
|
clumpData->SetNumberOfFrames(numFrames);
|
|
|
|
frames = clumpData->frames;
|
|
|
|
RwFrameForAllChildren(root, FrameForAllChildrenFillFrameArrayCallBack, &frames);
|
2020-04-23 22:25:18 +02:00
|
|
|
clumpData->ForAllFrames(FrameInitCBnonskin, nil);
|
2019-06-11 08:59:28 +02:00
|
|
|
clumpData->frames[0].flag |= AnimBlendFrameData::VELOCITY_EXTRACTION;
|
2020-04-23 22:25:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
RpAnimBlendClumpInit(RpClump *clump)
|
|
|
|
{
|
|
|
|
#ifdef PED_SKIN
|
|
|
|
if(IsClumpSkinned(clump))
|
|
|
|
RpAnimBlendClumpInitSkinned(clump);
|
|
|
|
else
|
2019-06-11 08:59:28 +02:00
|
|
|
#endif
|
2020-04-23 22:25:18 +02:00
|
|
|
RpAnimBlendClumpInitNotSkinned(clump);
|
2019-06-11 08:59:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
RpAnimBlendClumpIsInitialized(RpClump *clump)
|
|
|
|
{
|
|
|
|
CAnimBlendClumpData *clumpData = *RPANIMBLENDCLUMPDATA(clump);
|
|
|
|
return clumpData && clumpData->numFrames != 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
CAnimBlendAssociation*
|
|
|
|
RpAnimBlendClumpGetAssociation(RpClump *clump, uint32 id)
|
|
|
|
{
|
|
|
|
CAnimBlendClumpData *clumpData = *RPANIMBLENDCLUMPDATA(clump);
|
|
|
|
|
|
|
|
if(clumpData == nil) return nil;
|
|
|
|
|
|
|
|
for(CAnimBlendLink *link = clumpData->link.next; link; link = link->next){
|
|
|
|
CAnimBlendAssociation *assoc = CAnimBlendAssociation::FromLink(link);
|
|
|
|
if(assoc->animId == id)
|
|
|
|
return assoc;
|
|
|
|
}
|
|
|
|
return nil;
|
|
|
|
}
|
|
|
|
|
|
|
|
CAnimBlendAssociation*
|
|
|
|
RpAnimBlendClumpGetMainAssociation(RpClump *clump, CAnimBlendAssociation **assocRet, float *blendRet)
|
|
|
|
{
|
|
|
|
CAnimBlendClumpData *clumpData = *RPANIMBLENDCLUMPDATA(clump);
|
|
|
|
|
|
|
|
if(clumpData == nil) return nil;
|
|
|
|
|
|
|
|
CAnimBlendAssociation *mainAssoc = nil;
|
|
|
|
CAnimBlendAssociation *secondAssoc = nil;
|
2020-02-25 20:01:56 +01:00
|
|
|
float mainBlend = 0.0f;
|
|
|
|
float secondBlend = 0.0f;
|
2019-06-11 08:59:28 +02:00
|
|
|
for(CAnimBlendLink *link = clumpData->link.next; link; link = link->next){
|
|
|
|
CAnimBlendAssociation *assoc = CAnimBlendAssociation::FromLink(link);
|
|
|
|
|
|
|
|
if(assoc->IsPartial())
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if(assoc->blendAmount > mainBlend){
|
|
|
|
secondBlend = mainBlend;
|
|
|
|
mainBlend = assoc->blendAmount;
|
|
|
|
|
|
|
|
secondAssoc = mainAssoc;
|
|
|
|
mainAssoc = assoc;
|
|
|
|
}else if(assoc->blendAmount > secondBlend){
|
|
|
|
secondBlend = assoc->blendAmount;
|
|
|
|
secondAssoc = assoc;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(assocRet) *assocRet = secondAssoc;
|
|
|
|
if(blendRet) *blendRet = secondBlend;
|
|
|
|
return mainAssoc;
|
|
|
|
}
|
|
|
|
|
|
|
|
CAnimBlendAssociation*
|
|
|
|
RpAnimBlendClumpGetMainPartialAssociation(RpClump *clump)
|
|
|
|
{
|
|
|
|
CAnimBlendClumpData *clumpData = *RPANIMBLENDCLUMPDATA(clump);
|
|
|
|
|
|
|
|
if(clumpData == nil) return nil;
|
|
|
|
|
|
|
|
CAnimBlendAssociation *mainAssoc = nil;
|
2020-02-25 20:01:56 +01:00
|
|
|
float mainBlend = 0.0f;
|
2019-06-11 08:59:28 +02:00
|
|
|
for(CAnimBlendLink *link = clumpData->link.next; link; link = link->next){
|
|
|
|
CAnimBlendAssociation *assoc = CAnimBlendAssociation::FromLink(link);
|
|
|
|
|
|
|
|
if(!assoc->IsPartial())
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if(assoc->blendAmount > mainBlend){
|
|
|
|
mainBlend = assoc->blendAmount;
|
|
|
|
mainAssoc = assoc;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return mainAssoc;
|
|
|
|
}
|
|
|
|
|
|
|
|
CAnimBlendAssociation*
|
|
|
|
RpAnimBlendClumpGetMainAssociation_N(RpClump *clump, int n)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
CAnimBlendClumpData *clumpData = *RPANIMBLENDCLUMPDATA(clump);
|
|
|
|
|
|
|
|
if(clumpData == nil) return nil;
|
|
|
|
|
|
|
|
i = 0;
|
|
|
|
for(CAnimBlendLink *link = clumpData->link.next; link; link = link->next){
|
|
|
|
CAnimBlendAssociation *assoc = CAnimBlendAssociation::FromLink(link);
|
|
|
|
|
|
|
|
if(assoc->IsPartial())
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if(i == n)
|
|
|
|
return assoc;
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
return nil;
|
|
|
|
}
|
|
|
|
|
|
|
|
CAnimBlendAssociation*
|
|
|
|
RpAnimBlendClumpGetMainPartialAssociation_N(RpClump *clump, int n)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
CAnimBlendClumpData *clumpData = *RPANIMBLENDCLUMPDATA(clump);
|
|
|
|
|
|
|
|
if(clumpData == nil) return nil;
|
|
|
|
|
|
|
|
i = 0;
|
|
|
|
for(CAnimBlendLink *link = clumpData->link.next; link; link = link->next){
|
|
|
|
CAnimBlendAssociation *assoc = CAnimBlendAssociation::FromLink(link);
|
|
|
|
|
|
|
|
if(!assoc->IsPartial())
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if(i == n)
|
|
|
|
return assoc;
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
return nil;
|
|
|
|
}
|
|
|
|
|
|
|
|
CAnimBlendAssociation*
|
|
|
|
RpAnimBlendClumpGetFirstAssociation(RpClump *clump, uint32 mask)
|
|
|
|
{
|
|
|
|
CAnimBlendClumpData *clumpData = *RPANIMBLENDCLUMPDATA(clump);
|
|
|
|
|
|
|
|
if(clumpData == nil) return nil;
|
|
|
|
|
|
|
|
for(CAnimBlendLink *link = clumpData->link.next; link; link = link->next){
|
|
|
|
CAnimBlendAssociation *assoc = CAnimBlendAssociation::FromLink(link);
|
|
|
|
if(assoc->flags & mask)
|
|
|
|
return assoc;
|
|
|
|
}
|
|
|
|
return nil;
|
|
|
|
}
|
|
|
|
|
|
|
|
CAnimBlendAssociation*
|
|
|
|
RpAnimBlendClumpGetFirstAssociation(RpClump *clump)
|
|
|
|
{
|
|
|
|
CAnimBlendClumpData *clumpData = *RPANIMBLENDCLUMPDATA(clump);
|
|
|
|
if(clumpData == nil) return nil;
|
|
|
|
if(clumpData->link.next == nil) return nil;
|
|
|
|
return CAnimBlendAssociation::FromLink(clumpData->link.next);
|
|
|
|
}
|
|
|
|
|
2020-04-23 22:25:18 +02:00
|
|
|
// FillFrameArrayCallBack on PS2
|
2019-06-11 08:59:28 +02:00
|
|
|
void
|
2020-04-23 22:25:18 +02:00
|
|
|
FillFrameArrayCBnonskin(AnimBlendFrameData *frame, void *arg)
|
2019-06-11 08:59:28 +02:00
|
|
|
{
|
|
|
|
AnimBlendFrameData **frames = (AnimBlendFrameData**)arg;
|
|
|
|
frames[CVisibilityPlugins::GetFrameHierarchyId(frame->frame)] = frame;
|
|
|
|
}
|
|
|
|
|
2020-04-23 22:25:18 +02:00
|
|
|
#ifdef PED_SKIN
|
|
|
|
void
|
|
|
|
RpAnimBlendClumpFillFrameArraySkin(RpClump *clump, AnimBlendFrameData **frames)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
CAnimBlendClumpData *clumpData = *RPANIMBLENDCLUMPDATA(clump);
|
|
|
|
RpHAnimHierarchy *hier = GetAnimHierarchyFromSkinClump(clump);
|
|
|
|
for(i = PED_MID; i < PED_NODE_MAX; i++)
|
|
|
|
frames[i] = &clumpData->frames[RpHAnimIDGetIndex(hier, ConvertPedNode2BoneTag(i))];
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2019-06-11 08:59:28 +02:00
|
|
|
void
|
|
|
|
RpAnimBlendClumpFillFrameArray(RpClump *clump, AnimBlendFrameData **frames)
|
|
|
|
{
|
|
|
|
#ifdef PED_SKIN
|
2020-04-23 22:25:18 +02:00
|
|
|
if(IsClumpSkinned(clump))
|
|
|
|
RpAnimBlendClumpFillFrameArraySkin(clump, frames);
|
|
|
|
else
|
2019-06-11 08:59:28 +02:00
|
|
|
#endif
|
2020-04-23 22:25:18 +02:00
|
|
|
(*RPANIMBLENDCLUMPDATA(clump))->ForAllFrames(FillFrameArrayCBnonskin, frames);
|
2019-06-11 08:59:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
AnimBlendFrameData *pFrameDataFound;
|
|
|
|
|
2020-04-23 22:25:18 +02:00
|
|
|
// FrameFindCallBack on PS2
|
2019-06-11 08:59:28 +02:00
|
|
|
void
|
2020-04-23 22:25:18 +02:00
|
|
|
FrameFindByNameCBnonskin(AnimBlendFrameData *frame, void *arg)
|
2019-06-11 08:59:28 +02:00
|
|
|
{
|
|
|
|
char *nodename = GetFrameNodeName(frame->frame);
|
2019-10-30 00:12:58 +01:00
|
|
|
if(!CGeneral::faststricmp(nodename, (char*)arg))
|
2019-06-11 08:59:28 +02:00
|
|
|
pFrameDataFound = frame;
|
|
|
|
}
|
|
|
|
|
2020-04-23 22:25:18 +02:00
|
|
|
#ifdef PED_SKIN
|
|
|
|
void
|
|
|
|
FrameFindByNameCBskin(AnimBlendFrameData *frame, void *arg)
|
|
|
|
{
|
|
|
|
const char *name = ConvertBoneTag2BoneName(frame->nodeID);
|
|
|
|
if(name && CGeneral::faststricmp(name, (char*)arg) == 0)
|
|
|
|
pFrameDataFound = frame;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2019-06-11 08:59:28 +02:00
|
|
|
AnimBlendFrameData*
|
|
|
|
RpAnimBlendClumpFindFrame(RpClump *clump, const char *name)
|
|
|
|
{
|
|
|
|
pFrameDataFound = nil;
|
|
|
|
#ifdef PED_SKIN
|
2020-04-23 22:25:18 +02:00
|
|
|
if(IsClumpSkinned(clump))
|
|
|
|
(*RPANIMBLENDCLUMPDATA(clump))->ForAllFrames(FrameFindByNameCBskin, (void*)name);
|
|
|
|
else
|
2019-06-11 08:59:28 +02:00
|
|
|
#endif
|
2020-04-23 22:25:18 +02:00
|
|
|
(*RPANIMBLENDCLUMPDATA(clump))->ForAllFrames(FrameFindByNameCBnonskin, (void*)name);
|
2019-06-11 08:59:28 +02:00
|
|
|
return pFrameDataFound;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
RpAnimBlendClumpUpdateAnimations(RpClump *clump, float timeDelta)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
AnimBlendFrameUpdateData updateData;
|
|
|
|
float totalLength = 0.0f;
|
|
|
|
float totalBlend = 0.0f;
|
|
|
|
CAnimBlendLink *link, *next;
|
|
|
|
CAnimBlendClumpData *clumpData = *RPANIMBLENDCLUMPDATA(clump);
|
|
|
|
gpAnimBlendClump = clumpData;
|
|
|
|
|
|
|
|
if(clumpData->link.next == nil)
|
|
|
|
return;
|
|
|
|
|
|
|
|
// Update blend and get node array
|
|
|
|
i = 0;
|
|
|
|
updateData.foobar = 0;
|
|
|
|
for(link = clumpData->link.next; link; link = next){
|
|
|
|
next = link->next;
|
|
|
|
CAnimBlendAssociation *assoc = CAnimBlendAssociation::FromLink(link);
|
|
|
|
if(assoc->UpdateBlend(timeDelta)){
|
|
|
|
// CAnimManager::UncompressAnimation(v6->hierarchy)
|
|
|
|
updateData.nodes[i++] = assoc->GetNode(0);
|
|
|
|
if(assoc->flags & ASSOC_MOVEMENT){
|
|
|
|
totalLength += assoc->hierarchy->totalLength/assoc->speed * assoc->blendAmount;
|
|
|
|
totalBlend += assoc->blendAmount;
|
|
|
|
}else
|
|
|
|
updateData.foobar = 1;
|
|
|
|
}
|
|
|
|
}
|
2019-06-30 12:53:39 +02:00
|
|
|
updateData.nodes[i] = nil;
|
2019-06-11 08:59:28 +02:00
|
|
|
|
2020-04-23 22:25:18 +02:00
|
|
|
#ifdef PED_SKIN
|
|
|
|
if(IsClumpSkinned(clump))
|
|
|
|
clumpData->ForAllFrames(FrameUpdateCallBackSkinned, &updateData);
|
|
|
|
else
|
|
|
|
#endif
|
|
|
|
clumpData->ForAllFrames(FrameUpdateCallBackNonSkinned, &updateData);
|
2019-06-11 08:59:28 +02:00
|
|
|
|
|
|
|
for(link = clumpData->link.next; link; link = link->next){
|
|
|
|
CAnimBlendAssociation *assoc = CAnimBlendAssociation::FromLink(link);
|
|
|
|
float relSpeed = totalLength == 0.0f ? 1.0f : totalBlend/totalLength;
|
|
|
|
assoc->UpdateTime(timeDelta, relSpeed);
|
|
|
|
}
|
|
|
|
RwFrameUpdateObjects(RpClumpGetFrame(clump));
|
|
|
|
}
|