mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-14 16:07:39 +00:00
TWINE: cleanup
This commit is contained in:
parent
6bd38bd0ae
commit
c767b26557
@ -71,28 +71,28 @@ void Actor::loadHeroEntities() {
|
||||
error("Failed to load actor athletic 3d data");
|
||||
}
|
||||
_engine->_scene->sceneHero->entityDataPtr = heroEntityATHLETIC;
|
||||
heroAnimIdxATHLETIC = _engine->_animations->getBodyAnimIndex(0, 0);
|
||||
heroAnimIdxATHLETIC = _engine->_animations->getBodyAnimIndex(AnimationTypes::kStanding);
|
||||
|
||||
heroEntityAGGRESSIVESize = _engine->_hqrdepack->hqrGetallocEntry(&heroEntityAGGRESSIVE, Resources::HQR_FILE3D_FILE, FILE3DHQR_HEROAGGRESSIVE);
|
||||
if (heroEntityAGGRESSIVESize == 0) {
|
||||
error("Failed to load actor aggressive 3d data");
|
||||
}
|
||||
_engine->_scene->sceneHero->entityDataPtr = heroEntityAGGRESSIVE;
|
||||
heroAnimIdxAGGRESSIVE = _engine->_animations->getBodyAnimIndex(0, 0);
|
||||
heroAnimIdxAGGRESSIVE = _engine->_animations->getBodyAnimIndex(AnimationTypes::kStanding);
|
||||
|
||||
heroEntityDISCRETESize = _engine->_hqrdepack->hqrGetallocEntry(&heroEntityDISCRETE, Resources::HQR_FILE3D_FILE, FILE3DHQR_HERODISCRETE);
|
||||
if (heroEntityDISCRETESize == 0) {
|
||||
error("Failed to load actor discrete 3d data");
|
||||
}
|
||||
_engine->_scene->sceneHero->entityDataPtr = heroEntityDISCRETE;
|
||||
heroAnimIdxDISCRETE = _engine->_animations->getBodyAnimIndex(0, 0);
|
||||
heroAnimIdxDISCRETE = _engine->_animations->getBodyAnimIndex(AnimationTypes::kStanding);
|
||||
|
||||
heroEntityPROTOPACKSize = _engine->_hqrdepack->hqrGetallocEntry(&heroEntityPROTOPACK, Resources::HQR_FILE3D_FILE, FILE3DHQR_HEROPROTOPACK);
|
||||
if (heroEntityPROTOPACKSize == 0) {
|
||||
error("Failed to load actor protopack 3d data");
|
||||
}
|
||||
_engine->_scene->sceneHero->entityDataPtr = heroEntityPROTOPACK;
|
||||
heroAnimIdxPROTOPACK = _engine->_animations->getBodyAnimIndex(0, 0);
|
||||
heroAnimIdxPROTOPACK = _engine->_animations->getBodyAnimIndex(AnimationTypes::kStanding);
|
||||
|
||||
heroEntityNORMALSize = _engine->_hqrdepack->hqrGetallocEntry(&heroEntityNORMAL, Resources::HQR_FILE3D_FILE, FILE3DHQR_HERONORMAL);
|
||||
if (heroEntityNORMALSize == 0) {
|
||||
@ -100,7 +100,7 @@ void Actor::loadHeroEntities() {
|
||||
}
|
||||
_engine->_scene->sceneHero->entityDataPtr = heroEntityNORMAL;
|
||||
_engine->_scene->sceneHero->entityDataSize = heroEntityNORMALSize;
|
||||
heroAnimIdxNORMAL = _engine->_animations->getBodyAnimIndex(0, 0);
|
||||
heroAnimIdxNORMAL = _engine->_animations->getBodyAnimIndex(AnimationTypes::kStanding);
|
||||
|
||||
_engine->_scene->sceneHero->animExtraPtr = _engine->_animations->currentActorAnimExtraPtr;
|
||||
}
|
||||
|
@ -353,33 +353,28 @@ int32 Animations::setModelAnimation(int32 animState, uint8 *animPtr, uint8 *body
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32 Animations::getBodyAnimIndex(int32 animIdx, int32 actorIdx) {
|
||||
int8 type;
|
||||
uint16 realAnimIdx;
|
||||
uint8 *bodyPtr;
|
||||
uint8 *ptr, *ptr2;
|
||||
int32 Animations::getBodyAnimIndex(AnimationTypes animIdx, int32 actorIdx) {
|
||||
uint8 *costumePtr = NULL;
|
||||
ActorStruct *actor;
|
||||
|
||||
actor = _engine->_scene->getActor(actorIdx);
|
||||
bodyPtr = actor->entityDataPtr;
|
||||
ActorStruct *actor = _engine->_scene->getActor(actorIdx);
|
||||
uint8 *bodyPtr = actor->entityDataPtr;
|
||||
|
||||
do {
|
||||
type = *(bodyPtr++);
|
||||
int8 type = *(bodyPtr++);
|
||||
|
||||
if (type == -1) {
|
||||
currentActorAnimExtraPtr = NULL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
ptr = (bodyPtr + 1);
|
||||
uint8 *ptr = (bodyPtr + 1);
|
||||
|
||||
if (type == 3) {
|
||||
if (animIdx == *bodyPtr) {
|
||||
ptr++;
|
||||
realAnimIdx = *(int16 *)(ptr);
|
||||
uint16 realAnimIdx = *(int16 *)(ptr);
|
||||
ptr += 2;
|
||||
ptr2 = ptr;
|
||||
uint8 *ptr2 = ptr;
|
||||
ptr++;
|
||||
if (*ptr2 != 0) {
|
||||
costumePtr = ptr - 1;
|
||||
@ -397,37 +392,28 @@ int32 Animations::getBodyAnimIndex(int32 animIdx, int32 actorIdx) {
|
||||
}
|
||||
|
||||
int32 Animations::stockAnimation(uint8 *animPtr, uint8 *bodyPtr, AnimTimerDataStruct *animTimerDataPtr) {
|
||||
int32 playAnim;
|
||||
uint8 *ptr;
|
||||
int32 *edi;
|
||||
int32 *esi;
|
||||
int32 var0;
|
||||
int32 var1;
|
||||
int32 var2;
|
||||
int32 counter;
|
||||
|
||||
playAnim = *(int16 *)(bodyPtr);
|
||||
int32 playAnim = *(int16 *)(bodyPtr);
|
||||
|
||||
if (playAnim & 2) {
|
||||
ptr = (bodyPtr + 0x10);
|
||||
uint8 *ptr = (bodyPtr + 0x10);
|
||||
|
||||
animTimerDataPtr->time = _engine->lbaTime;
|
||||
animTimerDataPtr->ptr = animPtr;
|
||||
|
||||
var0 = *(int16 *)(ptr - 2);
|
||||
int32 var0 = *(int16 *)(ptr - 2);
|
||||
ptr = ptr + var0;
|
||||
|
||||
var1 = *(int16 *)(ptr);
|
||||
int32 var1 = *(int16 *)(ptr);
|
||||
var1 = var1 + var1 * 2;
|
||||
|
||||
ptr = ptr + var1 * 2 + 2;
|
||||
|
||||
var2 = *(int16 *)(ptr);
|
||||
counter = var2;
|
||||
int32 var2 = *(int16 *)(ptr);
|
||||
int32 counter = var2;
|
||||
var2 = (var2 * 8) + 8;
|
||||
|
||||
edi = (int32 *)(animPtr + 8);
|
||||
esi = (int32 *)(ptr + 10);
|
||||
int32* edi = (int32 *)(animPtr + 8);
|
||||
int32* esi = (int32 *)(ptr + 10);
|
||||
|
||||
do {
|
||||
*(edi++) = *(esi++);
|
||||
@ -442,29 +428,16 @@ int32 Animations::stockAnimation(uint8 *animPtr, uint8 *bodyPtr, AnimTimerDataSt
|
||||
}
|
||||
|
||||
int32 Animations::verifyAnimAtKeyframe(int32 animIdx, uint8 *animPtr, uint8 *bodyPtr, AnimTimerDataStruct *animTimerDataPtr) {
|
||||
int16 bodyHeader;
|
||||
|
||||
uint8 *ebx;
|
||||
int32 ebp;
|
||||
int32 eax;
|
||||
int32 keyFrameLength;
|
||||
int32 numOfPointInAnim = -1;
|
||||
uint8 *keyFramePtrOld;
|
||||
|
||||
numOfPointInAnim = *(int16 *)(animPtr + 2);
|
||||
|
||||
int32 numOfPointInAnim = *(int16 *)(animPtr + 2);
|
||||
keyFramePtr = ((numOfPointInAnim * 8 + 8) * animIdx) + animPtr + 8;
|
||||
|
||||
keyFrameLength = *(int16 *)(keyFramePtr);
|
||||
|
||||
bodyHeader = *(int16 *)(bodyPtr);
|
||||
|
||||
int32 keyFrameLength = *(int16 *)(keyFramePtr);
|
||||
int16 bodyHeader = *(int16 *)(bodyPtr);
|
||||
if (!(bodyHeader & 2)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
ebx = animTimerDataPtr->ptr;
|
||||
ebp = animTimerDataPtr->time;
|
||||
uint8 *ebx = animTimerDataPtr->ptr;
|
||||
int32 ebp = animTimerDataPtr->time;
|
||||
|
||||
if (!ebx) {
|
||||
ebx = keyFramePtr;
|
||||
@ -473,7 +446,7 @@ int32 Animations::verifyAnimAtKeyframe(int32 animIdx, uint8 *animPtr, uint8 *bod
|
||||
|
||||
lastKeyFramePtr = ebx;
|
||||
|
||||
eax = _engine->lbaTime - ebp;
|
||||
int32 eax = _engine->lbaTime - ebp;
|
||||
|
||||
if (eax >= keyFrameLength) {
|
||||
animTimerDataPtr->ptr = keyFramePtr;
|
||||
@ -488,7 +461,7 @@ int32 Animations::verifyAnimAtKeyframe(int32 animIdx, uint8 *animPtr, uint8 *bod
|
||||
|
||||
return 1;
|
||||
}
|
||||
keyFramePtrOld = keyFramePtr;
|
||||
uint8 *keyFramePtrOld = keyFramePtr;
|
||||
|
||||
lastKeyFramePtr += 8;
|
||||
keyFramePtr += 8;
|
||||
@ -795,7 +768,7 @@ int32 Animations::initAnim(AnimationTypes newAnim, int16 animType, uint8 animExt
|
||||
int32 animIndex = getBodyAnimIndex(newAnim, actorIdx);
|
||||
|
||||
if (animIndex == -1) {
|
||||
animIndex = getBodyAnimIndex(0, actorIdx);
|
||||
animIndex = getBodyAnimIndex(AnimationTypes::kStanding, actorIdx);
|
||||
}
|
||||
|
||||
if (animType != 4 && actor->animType == 2) {
|
||||
@ -1008,8 +981,8 @@ void Animations::processActorAnimations(int32 actorIdx) { // DoAnim
|
||||
actor->previousAnimIdx = getBodyAnimIndex(actor->anim, actorIdx);
|
||||
|
||||
if (actor->previousAnimIdx == -1) {
|
||||
actor->previousAnimIdx = getBodyAnimIndex(0, actorIdx);
|
||||
actor->anim = kStanding;
|
||||
actor->previousAnimIdx = getBodyAnimIndex(AnimationTypes::kStanding, actorIdx);
|
||||
actor->anim = AnimationTypes::kStanding;
|
||||
}
|
||||
|
||||
actor->animExtraPtr = currentActorAnimExtraPtr;
|
||||
|
@ -25,6 +25,7 @@
|
||||
|
||||
#include "common/scummsys.h"
|
||||
#include "twine/actor.h"
|
||||
#include "twine/scene.h"
|
||||
|
||||
namespace TwinE {
|
||||
|
||||
@ -106,7 +107,7 @@ public:
|
||||
* @param animIdx Entity animation index
|
||||
* @param actorIdx Actor index
|
||||
*/
|
||||
int32 getBodyAnimIndex(int32 animIdx, int32 actorIdx);
|
||||
int32 getBodyAnimIndex(AnimationTypes animIdx, int32 actorIdx = OWN_ACTOR_SCENE_INDEX);
|
||||
|
||||
/**
|
||||
* Stock animation - copy the next keyFrame from a different buffer
|
||||
|
@ -327,7 +327,8 @@ void GameState::processFoundItem(int32 item) {
|
||||
|
||||
_engine->_text->initVoxToPlay(item);
|
||||
|
||||
uint8 *currentAnim = _engine->_animations->animTable[_engine->_animations->getBodyAnimIndex(kFoundItem, 0)];
|
||||
const int32 bodyAnimIdx = _engine->_animations->getBodyAnimIndex(AnimationTypes::kFoundItem);
|
||||
uint8 *currentAnim = _engine->_animations->animTable[bodyAnimIdx];
|
||||
|
||||
AnimTimerDataStruct tmpAnimTimer = _engine->_scene->sceneHero->animTimerData;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user