[Scummvm-git-logs] scummvm master -> 1a8e6a359771d45d800980ac018d79800bb3b958
mgerhardy
martin.gerhardy at gmail.com
Mon Mar 8 19:14:44 UTC 2021
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:
1a8e6a3597 TWINE: use AnimData methods
Commit: 1a8e6a359771d45d800980ac018d79800bb3b958
https://github.com/scummvm/scummvm/commit/1a8e6a359771d45d800980ac018d79800bb3b958
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-03-08T20:14:31+01:00
Commit Message:
TWINE: use AnimData methods
Changed paths:
engines/twine/holomap.cpp
engines/twine/menu/menu.cpp
engines/twine/menu/menu.h
engines/twine/metaengine.cpp
engines/twine/scene/animations.cpp
engines/twine/scene/animations.h
engines/twine/scene/gamestate.cpp
diff --git a/engines/twine/holomap.cpp b/engines/twine/holomap.cpp
index 8668fba178..510bd2aace 100644
--- a/engines/twine/holomap.cpp
+++ b/engines/twine/holomap.cpp
@@ -327,7 +327,7 @@ void Holomap::drawHolomapTrajectory(int32 trajectoryIndex) {
uint8 *modelPtr = nullptr;
HQR::getAllocEntry(&modelPtr, Resources::HQR_RESS_FILE, data.getModel());
Renderer::prepareIsoModel(modelPtr);
- int16 frameNumber = 0;
+ uint frameNumber = 0;
int32 frameTime = _engine->lbaTime;
int16 trajAnimFrameIdx = 0;
@@ -360,8 +360,8 @@ void Holomap::drawHolomapTrajectory(int32 trajectoryIndex) {
if (_engine->_animations->setModelAnimation(frameNumber, animData, animPtr, modelPtr, &animTimerData)) {
frameNumber++;
- if (frameNumber >= _engine->_animations->getNumKeyframes(animPtr)) {
- frameNumber = _engine->_animations->getStartKeyframe(animPtr);
+ if (frameNumber >= animData.getNumKeyframes()) {
+ frameNumber = animData.getLoopFrame();
}
}
_engine->_renderer->setCameraPosition(100, 400, 128, 900, 900);
diff --git a/engines/twine/menu/menu.cpp b/engines/twine/menu/menu.cpp
index 8c45f90b6f..8d66c06181 100644
--- a/engines/twine/menu/menu.cpp
+++ b/engines/twine/menu/menu.cpp
@@ -917,12 +917,12 @@ void Menu::drawBehaviour(int32 left, int32 top, HeroBehaviourType behaviour, int
const uint8 *currentAnim = _engine->_resources->animTable[animIdx];
const AnimData ¤tAnimData = _engine->_resources->animData[animIdx];
- int16 currentAnimState = behaviourAnimState[(byte)behaviour];
+ uint currentAnimState = behaviourAnimState[(byte)behaviour];
if (_engine->_animations->setModelAnimation(currentAnimState, currentAnimData, currentAnim, behaviourEntity, &behaviourAnimData[(byte)behaviour])) {
currentAnimState++; // keyframe
- if (currentAnimState >= _engine->_animations->getNumKeyframes(currentAnim)) {
- currentAnimState = _engine->_animations->getStartKeyframe(currentAnim);
+ if (currentAnimState >= currentAnimData.getNumKeyframes()) {
+ currentAnimState = currentAnimData.getLoopFrame();
}
behaviourAnimState[(byte)behaviour] = currentAnimState;
}
diff --git a/engines/twine/menu/menu.h b/engines/twine/menu/menu.h
index 675abcae7d..09ea164707 100644
--- a/engines/twine/menu/menu.h
+++ b/engines/twine/menu/menu.h
@@ -139,7 +139,7 @@ private:
/** Hero behaviour menu entity */
uint8 *behaviourEntity = 0;
/** Behaviour menu anim state */
- int16 behaviourAnimState[4]; // winTab
+ uint behaviourAnimState[4]; // winTab
/** Behaviour menu anim data pointer */
AnimTimerDataStruct behaviourAnimData[4];
diff --git a/engines/twine/metaengine.cpp b/engines/twine/metaengine.cpp
index 56b6308c8f..14b6fdac52 100644
--- a/engines/twine/metaengine.cpp
+++ b/engines/twine/metaengine.cpp
@@ -28,8 +28,9 @@
#include "common/system.h"
#include "common/translation.h"
#include "engines/advancedDetector.h"
-#include "twine/detection.h"
+#include "graphics/scaler.h"
#include "twine/achievements_tables.h"
+#include "twine/detection.h"
#include "twine/input.h"
#include "twine/twine.h"
@@ -62,6 +63,8 @@ public:
const ExtraGuiOptions getExtraGuiOptions(const Common::String &target) const override;
const Common::AchievementsInfo getAchievementsInfo(const Common::String &target) const override;
+
+ void getSavegameThumbnail(Graphics::Surface &thumb) override;
};
static const ExtraGuiOption OptWallCollision = {
@@ -191,6 +194,10 @@ const Common::AchievementsInfo TwinEMetaEngine::getAchievementsInfo(const Common
return result;
}
+void TwinEMetaEngine::getSavegameThumbnail(Graphics::Surface &thumb) {
+ thumb.copyFrom(((TwinEEngine*)g_engine)->workVideoBuffer);
+}
+
//
// unused:
// JOY_LEFT_TRIGGER
diff --git a/engines/twine/scene/animations.cpp b/engines/twine/scene/animations.cpp
index 641dbc99df..8d1cab5471 100644
--- a/engines/twine/scene/animations.cpp
+++ b/engines/twine/scene/animations.cpp
@@ -75,14 +75,6 @@ const uint8 *Animations::getKeyFrameData(int32 frameIdx, const uint8 *animPtr) {
return (const uint8 *)((numOfBonesInAnim * 8 + 8) * frameIdx + animPtr + 8);
}
-int16 Animations::getNumKeyframes(const uint8 *animPtr) {
- return READ_LE_INT16(animPtr + 0);
-}
-
-int16 Animations::getStartKeyframe(const uint8 *animPtr) {
- return READ_LE_INT16(animPtr + 4);
-}
-
void Animations::applyAnimStepRotation(uint8 *ptr, int32 deltaTime, int32 keyFrameLength, const uint8 *keyFramePtr, const uint8 *lastKeyFramePtr) {
const int16 lastAngle = ClampAngle(READ_LE_INT16(lastKeyFramePtr));
const int16 newAngle = ClampAngle(READ_LE_INT16(keyFramePtr));
diff --git a/engines/twine/scene/animations.h b/engines/twine/scene/animations.h
index eef3157c5f..c9ac54d624 100644
--- a/engines/twine/scene/animations.h
+++ b/engines/twine/scene/animations.h
@@ -82,18 +82,6 @@ public:
const uint8 *getKeyFrameData(int32 frameIdx, const uint8 *animPtr);
- /**
- * Get total number of keyframes in animation
- * @param animPtr Pointer to animation
- */
- int16 getNumKeyframes(const uint8 *animPtr);
-
- /**
- * Get first keyframes in animation
- * @param animPtr Pointer to animation
- */
- int16 getStartKeyframe(const uint8 *animPtr);
-
/**
* Set new body animation
* @param keyframeIdx Animation key frame index
diff --git a/engines/twine/scene/gamestate.cpp b/engines/twine/scene/gamestate.cpp
index 1b8fb52bfa..641d2ae57f 100644
--- a/engines/twine/scene/gamestate.cpp
+++ b/engines/twine/scene/gamestate.cpp
@@ -368,7 +368,7 @@ void GameState::processFoundItem(int32 item) {
_engine->_animations->stockAnimation(bodyPtr, &_engine->_scene->sceneHero->animTimerData);
- int32 currentAnimState = 0;
+ uint currentAnimState = 0;
_engine->_redraw->numOfRedrawBox = 0;
@@ -394,8 +394,8 @@ void GameState::processFoundItem(int32 item) {
if (_engine->_animations->setModelAnimation(currentAnimState, currentAnimData, currentAnim, bodyPtr, &_engine->_scene->sceneHero->animTimerData)) {
currentAnimState++; // keyframe
- if (currentAnimState >= _engine->_animations->getNumKeyframes(currentAnim)) {
- currentAnimState = _engine->_animations->getStartKeyframe(currentAnim);
+ if (currentAnimState >= currentAnimData.getNumKeyframes()) {
+ currentAnimState = currentAnimData.getLoopFrame();
}
}
More information about the Scummvm-git-logs
mailing list