[Scummvm-git-logs] scummvm master -> 9b4d72151ecdd518d6ad873632aafadaf3393209
mgerhardy
martin.gerhardy at gmail.com
Sat Dec 12 11:01:18 UTC 2020
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
9b4d72151e TWINE: reverted "only load the entity data once"
Commit: 9b4d72151ecdd518d6ad873632aafadaf3393209
https://github.com/scummvm/scummvm/commit/9b4d72151ecdd518d6ad873632aafadaf3393209
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2020-12-12T12:01:05+01:00
Commit Message:
TWINE: reverted "only load the entity data once"
This reverts commit ab8aab37c0c2afc3a066e53006b7fbce48a5a354 and fixes a regression
in switching to the attack mode animation
Changed paths:
engines/twine/actor.cpp
engines/twine/actor.h
engines/twine/animations.cpp
engines/twine/entity.cpp
diff --git a/engines/twine/actor.cpp b/engines/twine/actor.cpp
index c5f4d9f9ad..55c44d0133 100644
--- a/engines/twine/actor.cpp
+++ b/engines/twine/actor.cpp
@@ -89,7 +89,6 @@ void Actor::loadHeroEntities() {
}
sceneHero->entityDataPtr = heroEntityATHLETIC;
sceneHero->entityDataSize = heroEntityATHLETICSize;
- sceneHero->entityData.loadFromBuffer(sceneHero->entityDataPtr, sceneHero->entityDataSize);
heroAnimIdxATHLETIC = _engine->_animations->getBodyAnimIndex(AnimationTypes::kStanding);
if (heroAnimIdxATHLETIC == -1) {
error("Could not find athletic animation data");
@@ -101,7 +100,6 @@ void Actor::loadHeroEntities() {
}
sceneHero->entityDataPtr = heroEntityAGGRESSIVE;
sceneHero->entityDataSize = heroEntityAGGRESSIVESize;
- sceneHero->entityData.loadFromBuffer(sceneHero->entityDataPtr, sceneHero->entityDataSize);
heroAnimIdxAGGRESSIVE = _engine->_animations->getBodyAnimIndex(AnimationTypes::kStanding);
if (heroAnimIdxAGGRESSIVE == -1) {
error("Could not find aggressive animation data");
@@ -113,7 +111,6 @@ void Actor::loadHeroEntities() {
}
sceneHero->entityDataPtr = heroEntityDISCRETE;
sceneHero->entityDataSize = heroEntityDISCRETESize;
- sceneHero->entityData.loadFromBuffer(sceneHero->entityDataPtr, sceneHero->entityDataSize);
heroAnimIdxDISCRETE = _engine->_animations->getBodyAnimIndex(AnimationTypes::kStanding);
if (heroAnimIdxDISCRETE == -1) {
error("Could not find discrete animation data");
@@ -125,7 +122,6 @@ void Actor::loadHeroEntities() {
}
sceneHero->entityDataPtr = heroEntityPROTOPACK;
sceneHero->entityDataSize = heroEntityPROTOPACKSize;
- sceneHero->entityData.loadFromBuffer(sceneHero->entityDataPtr, sceneHero->entityDataSize);
heroAnimIdxPROTOPACK = _engine->_animations->getBodyAnimIndex(AnimationTypes::kStanding);
if (heroAnimIdxPROTOPACK == -1) {
error("Could not find protopack animation data");
@@ -137,7 +133,6 @@ void Actor::loadHeroEntities() {
}
sceneHero->entityDataPtr = heroEntityNORMAL;
sceneHero->entityDataSize = heroEntityNORMALSize;
- sceneHero->entityData.loadFromBuffer(sceneHero->entityDataPtr, sceneHero->entityDataSize);
heroAnimIdxNORMAL = _engine->_animations->getBodyAnimIndex(AnimationTypes::kStanding);
if (heroAnimIdxNORMAL == -1) {
error("Could not find normal animation data");
@@ -534,7 +529,6 @@ void ActorStruct::loadModel(int32 modelIndex) {
if (!staticFlags.bIsSpriteActor) {
debug("Init actor with model %i", modelIndex);
entityDataSize = HQR::getAllocEntry(&entityDataPtr, Resources::HQR_FILE3D_FILE, modelIndex);
- entityData.loadFromBuffer(entityDataPtr, entityDataSize);
} else {
entityDataSize = 0;
free(entityDataPtr);
diff --git a/engines/twine/actor.h b/engines/twine/actor.h
index ec0f0c636c..b9df8535d5 100644
--- a/engines/twine/actor.h
+++ b/engines/twine/actor.h
@@ -150,8 +150,6 @@ private:
public:
~ActorStruct();
- EntityData entityData;
-
StaticFlagsStruct staticFlags;
DynamicFlagsStruct dynamicFlags;
diff --git a/engines/twine/animations.cpp b/engines/twine/animations.cpp
index 4f50fc9f3a..c8ddabe3cb 100644
--- a/engines/twine/animations.cpp
+++ b/engines/twine/animations.cpp
@@ -283,7 +283,9 @@ bool Animations::setModelAnimation(int32 animState, const uint8 *animPtr, uint8
int32 Animations::getBodyAnimIndex(AnimationTypes animIdx, int32 actorIdx) {
ActorStruct *actor = _engine->_scene->getActor(actorIdx);
- const int32 bodyAnimIndex = actor->entityData.getAnimIndex(animIdx);
+ EntityData entityData;
+ entityData.loadFromBuffer(actor->entityDataPtr, actor->entityDataSize);
+ const int32 bodyAnimIndex = entityData.getAnimIndex(animIdx);
if (bodyAnimIndex != -1) {
currentActorAnimExtraPtr = animIdx;
}
@@ -378,11 +380,13 @@ bool Animations::verifyAnimAtKeyframe(int32 animIdx, const uint8 *animPtr, AnimT
void Animations::processAnimActions(int32 actorIdx) {
ActorStruct *actor = _engine->_scene->getActor(actorIdx);
- if (actor->animExtraPtr == AnimationTypes::kAnimNone) {
+ if (actor->entityDataPtr == nullptr || actor->animExtraPtr == AnimationTypes::kAnimNone) {
return;
}
- const Common::Array<EntityAnim::Action> *actions = actor->entityData.getActions(actor->animExtraPtr);
+ EntityData entityData;
+ entityData.loadFromBuffer(actor->entityDataPtr, actor->entityDataSize);
+ const Common::Array<EntityAnim::Action> *actions = entityData.getActions(actor->animExtraPtr);
if (actions == nullptr) {
return;
}
diff --git a/engines/twine/entity.cpp b/engines/twine/entity.cpp
index 7afec2f428..af5beab502 100644
--- a/engines/twine/entity.cpp
+++ b/engines/twine/entity.cpp
@@ -147,8 +147,6 @@ bool EntityData::loadAnim(Common::SeekableReadStream &stream) {
}
bool EntityData::loadFromStream(Common::SeekableReadStream &stream) {
- _bodies.clear();
- _animations.clear();
do {
const uint8 opcode = stream.readByte();
if (opcode == 1) {
More information about the Scummvm-git-logs
mailing list