mirror of
https://github.com/aap/librw.git
synced 2024-11-25 05:05:42 +00:00
fixed hanim a bit
This commit is contained in:
parent
7cea137baf
commit
ba7070f6e8
@ -177,7 +177,7 @@ AnimInterpolator::create(int32 numNodes, int32 maxFrameSize)
|
|||||||
int32 sz;
|
int32 sz;
|
||||||
int32 realsz = maxFrameSize;
|
int32 realsz = maxFrameSize;
|
||||||
|
|
||||||
// Add some space for pointers and padding, hopefully this will
|
// Add some space for pointers and padding, hopefully this will be
|
||||||
// enough. Don't change maxFrameSize not to mess up streaming.
|
// enough. Don't change maxFrameSize not to mess up streaming.
|
||||||
if(sizeof(void*) > 4)
|
if(sizeof(void*) > 4)
|
||||||
realsz += 16;
|
realsz += 16;
|
||||||
|
@ -848,9 +848,9 @@ static D3DFORMAT fbFormats[] = {
|
|||||||
// D3DFMT_A1R5G5B5,
|
// D3DFMT_A1R5G5B5,
|
||||||
/// D3DFMT_A2R10G10B10, // works but let's not use it...
|
/// D3DFMT_A2R10G10B10, // works but let's not use it...
|
||||||
// D3DFMT_A8R8G8B8,
|
// D3DFMT_A8R8G8B8,
|
||||||
D3DFMT_R5G6B5,
|
D3DFMT_X8R8G8B8,
|
||||||
// D3DFMT_X1R5G5B5,
|
// D3DFMT_X1R5G5B5,
|
||||||
D3DFMT_X8R8G8B8
|
D3DFMT_R5G6B5
|
||||||
};
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -47,13 +47,19 @@ HAnimHierarchy::create(int32 numNodes, int32 *nodeFlags, int32 *nodeIDs,
|
|||||||
}else{
|
}else{
|
||||||
hier->matricesUnaligned = rwNew(hier->numNodes*64 + 0xF, MEMDUR_EVENT | ID_HANIM);
|
hier->matricesUnaligned = rwNew(hier->numNodes*64 + 0xF, MEMDUR_EVENT | ID_HANIM);
|
||||||
hier->matrices =
|
hier->matrices =
|
||||||
(Matrix*)((uintptr)hier->matricesUnaligned & ~0xF);
|
(Matrix*)(((uintptr)hier->matricesUnaligned + 0xF) & ~0xF);
|
||||||
}
|
}
|
||||||
hier->nodeInfo = rwNewT(HAnimNodeInfo, hier->numNodes, MEMDUR_EVENT | ID_HANIM);
|
hier->nodeInfo = rwNewT(HAnimNodeInfo, hier->numNodes, MEMDUR_EVENT | ID_HANIM);
|
||||||
for(int32 i = 0; i < hier->numNodes; i++){
|
for(int32 i = 0; i < hier->numNodes; i++){
|
||||||
hier->nodeInfo[i].id = nodeIDs[i];
|
if(nodeIDs)
|
||||||
|
hier->nodeInfo[i].id = nodeIDs[i];
|
||||||
|
else
|
||||||
|
hier->nodeInfo[i].id = 0;
|
||||||
hier->nodeInfo[i].index = i;
|
hier->nodeInfo[i].index = i;
|
||||||
hier->nodeInfo[i].flags = nodeFlags[i];
|
if(nodeFlags)
|
||||||
|
hier->nodeInfo[i].flags = nodeFlags[i];
|
||||||
|
else
|
||||||
|
hier->nodeInfo[i].flags = 0;
|
||||||
hier->nodeInfo[i].frame = nil;
|
hier->nodeInfo[i].frame = nil;
|
||||||
}
|
}
|
||||||
return hier;
|
return hier;
|
||||||
@ -195,9 +201,14 @@ createHAnim(void *object, int32 offset, int32)
|
|||||||
static void*
|
static void*
|
||||||
destroyHAnim(void *object, int32 offset, int32)
|
destroyHAnim(void *object, int32 offset, int32)
|
||||||
{
|
{
|
||||||
|
int i;
|
||||||
HAnimData *hanim = PLUGINOFFSET(HAnimData, object, offset);
|
HAnimData *hanim = PLUGINOFFSET(HAnimData, object, offset);
|
||||||
if(hanim->hierarchy)
|
if(hanim->hierarchy){
|
||||||
hanim->hierarchy->destroy();
|
for(i = 0; i < hanim->hierarchy->numNodes; i++)
|
||||||
|
hanim->hierarchy->nodeInfo[i].frame = nil;
|
||||||
|
if(object == hanim->hierarchy->parentFrame)
|
||||||
|
hanim->hierarchy->destroy();
|
||||||
|
}
|
||||||
hanim->id = -1;
|
hanim->id = -1;
|
||||||
hanim->hierarchy = nil;
|
hanim->hierarchy = nil;
|
||||||
return object;
|
return object;
|
||||||
@ -206,11 +217,24 @@ destroyHAnim(void *object, int32 offset, int32)
|
|||||||
static void*
|
static void*
|
||||||
copyHAnim(void *dst, void *src, int32 offset, int32)
|
copyHAnim(void *dst, void *src, int32 offset, int32)
|
||||||
{
|
{
|
||||||
|
int i;
|
||||||
HAnimData *dsthanim = PLUGINOFFSET(HAnimData, dst, offset);
|
HAnimData *dsthanim = PLUGINOFFSET(HAnimData, dst, offset);
|
||||||
HAnimData *srchanim = PLUGINOFFSET(HAnimData, src, offset);
|
HAnimData *srchanim = PLUGINOFFSET(HAnimData, src, offset);
|
||||||
|
HAnimHierarchy *srchier, *dsthier;
|
||||||
dsthanim->id = srchanim->id;
|
dsthanim->id = srchanim->id;
|
||||||
// TODO
|
|
||||||
dsthanim->hierarchy = nil;
|
dsthanim->hierarchy = nil;
|
||||||
|
srchier = srchanim->hierarchy;
|
||||||
|
if(srchier && !(srchier->flags & HAnimHierarchy::SUBHIERARCHY)){
|
||||||
|
dsthier = HAnimHierarchy::create(srchier->numNodes, nil, nil, srchier->flags, srchier->currentAnim->maxInterpKeyFrameSize);
|
||||||
|
for(i = 0; i < dsthier->numNodes; i++){
|
||||||
|
dsthier->nodeInfo[i].frame = nil;
|
||||||
|
dsthier->nodeInfo[i].flags = srchier->nodeInfo[i].flags;
|
||||||
|
dsthier->nodeInfo[i].index = srchier->nodeInfo[i].index;
|
||||||
|
dsthier->nodeInfo[i].id = srchier->nodeInfo[i].id;
|
||||||
|
}
|
||||||
|
dsthanim->hierarchy = dsthier;
|
||||||
|
dsthier->parentFrame = (Frame*)dst;
|
||||||
|
}
|
||||||
return dst;
|
return dst;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user