[Scummvm-git-logs] scummvm master -> 0047aaa04e7949b48ea27d49ec5556524f6e9521

mgerhardy noreply at scummvm.org
Wed Oct 16 14:00:33 UTC 2024


This automated email contains information about 11 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
02dd26889f TWINE: reduced scope in Renderer::fillTextPolyNoClip
16249e34b2 TWINE: added debug option for playing the object-found-animation
68f7c92940 TWINE: renamed members and functions to match original sources
85fef59c8a TWINE: use setInterAnimObjet2 for rendering the actors
4149f82613 TWINE: started to unify animation code with original sources
a3d1b69960 TWINE: comments about future renames
fe207a1432 TWINE: don't interfere with the actor animation state when doing the object found animation
1fc869a139 TWINE: restore the life script offset after playing the obj found animation
5972fb1cc6 TWINE: handle the global flag of doSetInterAnimObjet
53e0eac95a TWINE: removed unsetClip call that is not present in the original sources
0047aaa04e TWINE: fixed issue #15407


Commit: 02dd26889fa9377fb828d01ddf2e2ee11d6206a6
    https://github.com/scummvm/scummvm/commit/02dd26889fa9377fb828d01ddf2e2ee11d6206a6
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2024-10-16T16:00:17+02:00

Commit Message:
TWINE: reduced scope in Renderer::fillTextPolyNoClip

Changed paths:
    engines/twine/renderer/renderer.cpp


diff --git a/engines/twine/renderer/renderer.cpp b/engines/twine/renderer/renderer.cpp
index 0580e997828..a727974b0e7 100644
--- a/engines/twine/renderer/renderer.cpp
+++ b/engines/twine/renderer/renderer.cpp
@@ -1875,32 +1875,29 @@ void Renderer::fillTextPolyNoClip(int32 yMin, int32 yMax, const uint8 *holomapIm
 	const uint16 *pV0 = (const uint16 *)&_taby0[yMin];
 	const uint16 *pU1 = (const uint16 *)&_tabx1[yMin];
 	const uint16 *pV1 = (const uint16 *)&_taby1[yMin];
-	byte *pDest;
-	int32 ustep, vstep;
-	int16 xMin, xMax;
-	uint32 u0, v0, u1, v1, idx;
-	int32 u, v;
 
 	yMax -= yMin;
 
 	for (; yMax >= 0; yMax--) {
-		xMin = *pVerticG++;
-		xMax = *pVerticD++;
+		int16 xMin = *pVerticG++;
+		int16 xMax = *pVerticD++;
 		xMax -= xMin;
 
+		uint32 u0, v0;
+		int32 u, v;
 		u = u0 = *pU0++;
 		v = v0 = *pV0++;
-		u1 = *pU1++;
-		v1 = *pV1++;
+		uint32 u1 = *pU1++;
+		uint32 v1 = *pV1++;
 
 		if (xMax > 0) {
-			pDest = pDestLine + xMin;
+			byte *pDest = pDestLine + xMin;
 
-			ustep = ((int32)u1 - (int32)u0 + 1) / xMax;
-			vstep = ((int32)v1 - (int32)v0 + 1) / xMax;
+			int32 ustep = ((int32)u1 - (int32)u0 + 1) / xMax;
+			int32 vstep = ((int32)v1 - (int32)v0 + 1) / xMax;
 
 			for (; xMax > 0; xMax--) {
-				idx = ((u >> 8) & 0xFF) | (v & 0xFF00); // u0&0xFF00=column*256, v0&0xFF00 = line*256
+				uint32 idx = ((u >> 8) & 0xFF) | (v & 0xFF00); // u0&0xFF00=column*256, v0&0xFF00 = line*256
 				*pDest++ = holomapImage[idx];
 
 				u += ustep;


Commit: 16249e34b281c14e50f8538143ada513dab8c1c5
    https://github.com/scummvm/scummvm/commit/16249e34b281c14e50f8538143ada513dab8c1c5
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2024-10-16T16:00:17+02:00

Commit Message:
TWINE: added debug option for playing the object-found-animation

Changed paths:
    engines/twine/debugger/debug_state.h
    engines/twine/debugger/debugtools.cpp
    engines/twine/resources/resources.h
    engines/twine/scene/gamestate.cpp
    engines/twine/twine.cpp


diff --git a/engines/twine/debugger/debug_state.h b/engines/twine/debugger/debug_state.h
index 4b1187157b0..b99e3123ad9 100644
--- a/engines/twine/debugger/debug_state.h
+++ b/engines/twine/debugger/debug_state.h
@@ -95,6 +95,7 @@ public:
 	bool _loggerWindow = false;
 	bool _frameTimeWindow = false;
 	bool _frameDataRecording = true;
+	bool _playFoundItemAnimation = false;
 
 	bool _useFreeCamera = false;
 	bool _disableGridRendering = false;
diff --git a/engines/twine/debugger/debugtools.cpp b/engines/twine/debugger/debugtools.cpp
index 450f26863a0..ad7f3007475 100644
--- a/engines/twine/debugger/debugtools.cpp
+++ b/engines/twine/debugger/debugtools.cpp
@@ -826,6 +826,14 @@ static void debuggerMenu(TwinEEngine *engine) {
 			actor->_posObj = engine->_grid->_worldCube;
 			actor->_posObj.y += 1000;
 		}
+
+		if (ImGui::BeginMenu("Animations")) {
+			if (ImGui::MenuItem("Found item")) {
+				engine->_debugState->_playFoundItemAnimation = true;
+			}
+			ImGui::EndMenu();
+		}
+
 		if (ImGui::BeginMenu("Palettes")) {
 			LifeScriptContext fakeCtx(0, engine->_scene->_sceneHero);
 			if (ImGui::MenuItem("Show palette")) {
diff --git a/engines/twine/resources/resources.h b/engines/twine/resources/resources.h
index d70a6c7384e..c413d1602f4 100644
--- a/engines/twine/resources/resources.h
+++ b/engines/twine/resources/resources.h
@@ -169,7 +169,7 @@ public:
 	uint32 _spriteSizeTable[NUM_SPRITES]{0};
 	SpriteData _spriteData[NUM_SPRITES];
 
-	AnimData _animData[NUM_ANIMS];
+	AnimData _animData[NUM_ANIMS]; // HQR_Anims
 
 	/** Table with all loaded samples */
 	uint8 *_samplesTable[NUM_SAMPLES]{nullptr};
diff --git a/engines/twine/scene/gamestate.cpp b/engines/twine/scene/gamestate.cpp
index 7900a7cce8d..a0fc7b27aa0 100644
--- a/engines/twine/scene/gamestate.cpp
+++ b/engines/twine/scene/gamestate.cpp
@@ -349,12 +349,12 @@ void GameState::doFoundObj(InventoryItems item) {
 	_engine->_renderer->renderIsoModel(bodyPos, LBAAngles::ANGLE_0, LBAAngles::ANGLE_45, LBAAngles::ANGLE_0, bodyData, modelRect);
 	_engine->_interface->setClip(modelRect);
 
-	const int32 itemX = (_engine->_scene->_sceneHero->_posObj.x + SIZE_BRICK_Y) / SIZE_BRICK_XZ;
+	const int32 itemX = (_engine->_scene->_sceneHero->_posObj.x + DEMI_BRICK_XZ) / SIZE_BRICK_XZ;
 	int32 itemY = _engine->_scene->_sceneHero->_posObj.y / SIZE_BRICK_Y;
 	if (_engine->_scene->_sceneHero->brickShape() != ShapeType::kNone) {
 		itemY++;
 	}
-	const int32 itemZ = (_engine->_scene->_sceneHero->_posObj.z + SIZE_BRICK_Y) / SIZE_BRICK_XZ;
+	const int32 itemZ = (_engine->_scene->_sceneHero->_posObj.z + DEMI_BRICK_XZ) / SIZE_BRICK_XZ;
 
 	_engine->_grid->drawOverBrick(itemX, itemY, itemZ);
 
@@ -380,7 +380,7 @@ void GameState::doFoundObj(InventoryItems item) {
 
 	_engine->_text->initVoxToPlayTextId((TextId)item);
 
-	const int32 bodyAnimIdx = _engine->_animations->searchAnim(AnimationTypes::kFoundItem);
+	const int32 bodyAnimIdx = _engine->_animations->searchAnim(AnimationTypes::kFoundItem, OWN_ACTOR_SCENE_INDEX);
 	const AnimData &currentAnimData = _engine->_resources->_animData[bodyAnimIdx];
 
 	AnimTimerDataStruct tmpAnimTimer = _engine->_scene->_sceneHero->_animTimerData;
diff --git a/engines/twine/twine.cpp b/engines/twine/twine.cpp
index 1153110efad..9fd6f157cbb 100644
--- a/engines/twine/twine.cpp
+++ b/engines/twine/twine.cpp
@@ -1117,6 +1117,14 @@ bool TwinEEngine::runGameEngine() { // mainLoopInteration
 			_scriptLife->doLife(a);
 		}
 
+		if (_debugState->_playFoundItemAnimation) {
+			_debugState->_playFoundItemAnimation = false;
+			LifeScriptContext fakeCtx(0, _scene->_sceneHero);
+			fakeCtx.stream.writeByte(InventoryItems::kiHolomap);
+			fakeCtx.stream.seek(0);
+			_scriptLife->lFOUND_OBJECT(this, fakeCtx);
+		}
+
 		processActorSamplePosition(a);
 
 		if (_sceneLoopState != SceneLoopState::Continue) {


Commit: 68f7c92940889bd6a31cefc5e714ca12b31be848
    https://github.com/scummvm/scummvm/commit/68f7c92940889bd6a31cefc5e714ca12b31be848
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2024-10-16T16:00:17+02:00

Commit Message:
TWINE: renamed members and functions to match original sources

Changed paths:
    engines/twine/debugger/debug_state.cpp
    engines/twine/renderer/redraw.cpp
    engines/twine/renderer/redraw.h
    engines/twine/scene/animations.cpp
    engines/twine/scene/animations.h
    engines/twine/scene/gamestate.cpp
    engines/twine/text.cpp
    engines/twine/twine.cpp
    engines/twine/twine.h


diff --git a/engines/twine/debugger/debug_state.cpp b/engines/twine/debugger/debug_state.cpp
index 65dc46bfb7d..d4d6dd8c648 100644
--- a/engines/twine/debugger/debug_state.cpp
+++ b/engines/twine/debugger/debug_state.cpp
@@ -172,7 +172,7 @@ bool DebugState::displayActors() {
 		const int16 rbottom = positions.frontBottomRightPoint2D.y;
 		Common::Rect actorRect(rleft, rtop, rright, rbottom);
 		actorRect.extend(filledRect);
-		_engine->_redraw->addRedrawArea(actorRect);
+		_engine->_redraw->addPhysBox(actorRect);
 		state = true;
 	}
 	return state;
diff --git a/engines/twine/renderer/redraw.cpp b/engines/twine/renderer/redraw.cpp
index 8f30a541093..a94d8d58d62 100644
--- a/engines/twine/renderer/redraw.cpp
+++ b/engines/twine/renderer/redraw.cpp
@@ -52,7 +52,7 @@ Redraw::Redraw(TwinEEngine *engine) : _engine(engine), _bubbleSpriteIndex(SPRITE
 void Redraw::addRedrawCurrentArea(const Common::Rect &redrawArea) {
 	const int32 area = (redrawArea.right - redrawArea.left) * (redrawArea.bottom - redrawArea.top);
 
-	for (int32 i = 0; i < _numOfRedrawBox; ++i) {
+	for (int32 i = 0; i < _nbOptPhysBox; ++i) {
 		Common::Rect &rect = _currentRedrawList[i];
 		const int32 leftValue = MIN<int32>(redrawArea.left, rect.left);
 		const int32 rightValue = MAX<int32>(redrawArea.right, rect.right);
@@ -73,7 +73,7 @@ void Redraw::addRedrawCurrentArea(const Common::Rect &redrawArea) {
 		}
 	}
 
-	Common::Rect &rect = _currentRedrawList[_numOfRedrawBox];
+	Common::Rect &rect = _currentRedrawList[_nbOptPhysBox];
 	rect.left = redrawArea.left;
 	rect.top = redrawArea.top;
 	rect.right = redrawArea.right;
@@ -82,10 +82,10 @@ void Redraw::addRedrawCurrentArea(const Common::Rect &redrawArea) {
 	assert(rect.left <= rect.right);
 	assert(rect.top <= rect.bottom);
 
-	_numOfRedrawBox++;
+	_nbOptPhysBox++;
 }
 
-void Redraw::addRedrawArea(const Common::Rect &rect) {
+void Redraw::addPhysBox(const Common::Rect &rect) {
 	if (!rect.isValidRect()) {
 		return;
 	}
@@ -110,35 +110,35 @@ void Redraw::addRedrawArea(int32 left, int32 top, int32 right, int32 bottom) {
 		return;
 	}
 
-	Common::Rect &rect = _nextRedrawList[_currNumOfRedrawBox];
+	Common::Rect &rect = _nextRedrawList[_nbPhysBox];
 	rect.left = left;
 	rect.top = top;
 	rect.right = right;
 	rect.bottom = bottom;
 
-	_currNumOfRedrawBox++;
+	_nbPhysBox++;
 
 	addRedrawCurrentArea(rect);
 }
 
 void Redraw::moveNextAreas() {
-	_numOfRedrawBox = 0;
+	_nbOptPhysBox = 0;
 
-	for (int32 i = 0; i < _currNumOfRedrawBox; i++) {
+	for (int32 i = 0; i < _nbPhysBox; i++) {
 		addRedrawCurrentArea(_nextRedrawList[i]);
 	}
 }
 
-void Redraw::flipRedrawAreas() {
-	for (int32 i = 0; i < _numOfRedrawBox; i++) { // redraw areas on screen
+void Redraw::flipBoxes() {
+	for (int32 i = 0; i < _nbOptPhysBox; i++) { // redraw areas on screen
 		_engine->copyBlockPhys(_currentRedrawList[i]);
 	}
 
 	moveNextAreas();
 }
 
-void Redraw::blitBackgroundAreas() {
-	for (int32 i = 0; i < _numOfRedrawBox; i++) {
+void Redraw::clsBoxes() {
+	for (int32 i = 0; i < _nbOptPhysBox; i++) {
 		_engine->blitWorkToFront(_currentRedrawList[i]);
 	}
 }
@@ -392,14 +392,14 @@ void Redraw::processDrawListShadows(const DrawListStruct &drawCmd) {
 
 		_engine->_grid->drawOverBrick(tmpX, tmpY, tmpZ);
 
-		addRedrawArea(_engine->_interface->_clip);
+		addPhysBox(_engine->_interface->_clip);
 
 		_engine->_debugState->drawClip(renderRect);
 	}
 	_engine->_interface->unsetClip();
 }
 
-void Redraw::processDrawListActors(const DrawListStruct &drawCmd, bool bgRedraw) {
+void Redraw::processDrawListActors(const DrawListStruct &drawCmd, bool flagflip) {
 	const int32 actorIdx = drawCmd.numObj;
 	ActorStruct *actor = _engine->_scene->getActor(actorIdx);
 	if (actor->_anim >= 0) {
@@ -432,10 +432,10 @@ void Redraw::processDrawListActors(const DrawListStruct &drawCmd, bool bgRedraw)
 
 		_engine->_grid->drawOverBrick(tempX, tempY, tempZ);
 
-		addRedrawArea(_engine->_interface->_clip);
+		addPhysBox(_engine->_interface->_clip);
 
-		if (actor->_flags.bIsBackgrounded && bgRedraw) {
-			_engine->blitFrontToWork(_engine->_interface->_clip);
+		if (actor->_flags.bIsBackgrounded && flagflip) {
+			_engine->copyBlock(_engine->_interface->_clip);
 		}
 
 		_engine->_debugState->drawClip(_engine->_interface->_clip);
@@ -493,10 +493,10 @@ void Redraw::processDrawListActorSprites(const DrawListStruct &drawCmd, bool bgR
 			_engine->_grid->drawOverBrick3(xm, ym, zm);
 		}
 
-		addRedrawArea(_engine->_interface->_clip);
+		addPhysBox(_engine->_interface->_clip);
 
 		if (actor->_flags.bIsBackgrounded && bgRedraw) {
-			_engine->blitFrontToWork(_engine->_interface->_clip);
+			_engine->copyBlock(_engine->_interface->_clip);
 		}
 
 		_engine->_debugState->drawClip(renderRect);
@@ -534,7 +534,7 @@ void Redraw::processDrawListExtras(const DrawListStruct &drawCmd) {
 		const int32 zm = (extra->pos.z + DEMI_BRICK_XZ) / SIZE_BRICK_XZ;
 
 		_engine->_grid->drawOverBrick(xm, ym, zm);
-		addRedrawArea(_engine->_interface->_clip);
+		addPhysBox(_engine->_interface->_clip);
 
 		// show clipping area
 		//drawRectBorders(renderRect);
@@ -739,7 +739,7 @@ void Redraw::renderOverlays() {
 
 			_engine->_grid->drawSprite(renderRect.left, renderRect.top, spritePtr);
 
-			addRedrawArea(_engine->_interface->_clip);
+			addPhysBox(_engine->_interface->_clip);
 			break;
 		}
 		case OverlayType::koNumber: {
@@ -761,7 +761,7 @@ void Redraw::renderOverlays() {
 
 			_engine->_text->drawText(renderRect.left, renderRect.top, text);
 
-			addRedrawArea(_engine->_interface->_clip);
+			addPhysBox(_engine->_interface->_clip);
 
 			_engine->_interface->unsetClip();
 			break;
@@ -787,7 +787,7 @@ void Redraw::renderOverlays() {
 
 			_engine->_text->drawText(renderRect.left, renderRect.top, text);
 
-			addRedrawArea(_engine->_interface->_clip);
+			addPhysBox(_engine->_interface->_clip);
 			_engine->_interface->unsetClip();
 			break;
 		}
@@ -802,7 +802,7 @@ void Redraw::renderOverlays() {
 			_overlayRotation += 1; // overlayRotation += 8;
 			_engine->_renderer->draw3dObject(40, 40, bodyPtr, _overlayRotation, 16000);
 			_engine->_menu->drawRectBorders(rect);
-			addRedrawArea(rect);
+			addPhysBox(rect);
 			_engine->_gameState->init3DGame();
 			_engine->_interface->unsetClip();
 			break;
@@ -828,7 +828,7 @@ void Redraw::renderOverlays() {
 
 			_engine->_text->drawText(renderRect.left, renderRect.top, text);
 
-			addRedrawArea(_engine->_interface->_clip);
+			addPhysBox(_engine->_interface->_clip);
 			_engine->_interface->unsetClip();
 			break;
 		}
@@ -869,7 +869,7 @@ void Redraw::renderText() {
 	_engine->_text->drawText(x, y, _text.c_str(), true);
 	_engine->copyBlockPhys(x, y, x + width, y + height);
 	const Common::Rect redraw(x, y, x + width, y + height);
-	addRedrawArea(redraw);
+	addPhysBox(redraw);
 }
 
 void Redraw::drawScene(bool bgRedraw) { // AffScene
@@ -897,14 +897,14 @@ void Redraw::drawScene(bool bgRedraw) { // AffScene
 			_engine->_screens->fadeToPal(_engine->_screens->_ptrPal);
 		}
 	} else {
-		blitBackgroundAreas();
+		clsBoxes();
 	}
 
 	DrawListStruct drawList[NUM_MAX_ACTORS + EXTRA_MAX_ENTRIES]; // ListTri[MAX_OBJECTS + MAX_EXTRAS]
 	int32 drawListPos = fillActorDrawingList(drawList, bgRedraw);
 	drawListPos = fillExtraDrawingList(drawList, drawListPos);
 
-	_currNumOfRedrawBox = 0;
+	_nbPhysBox = 0;
 	sortDrawingList(drawList, drawListPos);
 	correctZLevels(drawList, drawListPos);
 	processDrawList(drawList, drawListPos, bgRedraw);
@@ -925,7 +925,7 @@ void Redraw::drawScene(bool bgRedraw) { // AffScene
 		moveNextAreas();
 		_engine->restoreTimer();
 	} else {
-		flipRedrawAreas();
+		flipBoxes();
 	}
 
 	if (_engine->_screens->_flagFade) {
diff --git a/engines/twine/renderer/redraw.h b/engines/twine/renderer/redraw.h
index d19d3466921..4d41ed0a69c 100644
--- a/engines/twine/renderer/redraw.h
+++ b/engines/twine/renderer/redraw.h
@@ -152,9 +152,9 @@ public:
 	bool _firstTime = false;
 
 	/** Current number of redraw regions in the screen */
-	int32 _currNumOfRedrawBox = 0; // fullRedrawVar8
+	int32 _nbPhysBox = 0; // fullRedrawVar8
 	/** Number of redraw regions in the screen */
-	int32 _numOfRedrawBox = 0;
+	int32 _nbOptPhysBox = 0;
 
 	int _sceneryViewX = 0; // xmin
 	int _sceneryViewY = 0; // ymin
@@ -175,16 +175,16 @@ public:
 	 * @param bottom end height to redraw the region
 	 */
 	void addRedrawArea(int32 left, int32 top, int32 right, int32 bottom); // AddPhysBox
-	void addRedrawArea(const Common::Rect &rect); // AddPhysBox
+	void addPhysBox(const Common::Rect &rect); // AddPhysBox
 
 	/**
 	 * Flip currentRedrawList regions in the screen
 	 * This only updates small areas in the screen so few CPU processor is used
 	 */
-	void flipRedrawAreas();
+	void flipBoxes();
 
 	/** Blit/Update all screen regions in the currentRedrawList */
-	void blitBackgroundAreas();
+	void clsBoxes();
 
 	/**
 	 * This is responsible for the entire game screen redraw
diff --git a/engines/twine/scene/animations.cpp b/engines/twine/scene/animations.cpp
index 1d2bcdb3eb6..e58dc96a213 100644
--- a/engines/twine/scene/animations.cpp
+++ b/engines/twine/scene/animations.cpp
@@ -92,20 +92,20 @@ int16 Animations::patchInterStep(int32 deltaTime, int32 keyFrameLength, int16 ne
 	return computedPos;
 }
 
-bool Animations::setInterAnimObjet(int32 keyframeIdx, const AnimData &animData, BodyData &bodyData, AnimTimerDataStruct *animTimerDataPtr) {
-	if (!bodyData.isAnimated()) {
+bool Animations::doSetInterAnimObjet(int32 framedest, const AnimData &animData, BodyData &pBody, AnimTimerDataStruct *ptranimdest, bool global) {
+	if (!pBody.isAnimated()) {
 		return false;
 	}
-	const KeyFrame *keyFrame = animData.getKeyframe(keyframeIdx);
+	const KeyFrame *keyFrame = animData.getKeyframe(framedest);
 
-	_currentStep.x = keyFrame->x;
-	_currentStep.y = keyFrame->y;
-	_currentStep.z = keyFrame->z;
+	_animStep.x = keyFrame->x;
+	_animStep.y = keyFrame->y;
+	_animStep.z = keyFrame->z;
 
 	_animMasterRot = keyFrame->animMasterRot;
 	_animStepBeta = ToAngle(keyFrame->animStepBeta);
 
-	const int16 numBones = bodyData.getNumBones();
+	const int16 numBones = pBody.getNumBones();
 
 	int32 numOfBonesInAnim = animData.getNumBoneframes();
 	if (numOfBonesInAnim > numBones) {
@@ -113,17 +113,17 @@ bool Animations::setInterAnimObjet(int32 keyframeIdx, const AnimData &animData,
 	}
 	const int32 keyFrameLength = keyFrame->length;
 
-	const KeyFrame *lastKeyFramePtr = animTimerDataPtr->ptr;
-	int32 remainingFrameTime = animTimerDataPtr->time;
+	const KeyFrame *lastKeyFramePtr = ptranimdest->ptr;
+	int32 remainingFrameTime = ptranimdest->time;
 	if (lastKeyFramePtr == nullptr) {
 		lastKeyFramePtr = keyFrame;
 		remainingFrameTime = keyFrameLength;
 	}
 	const int32 deltaTime = _engine->timerRef - remainingFrameTime;
 	if (deltaTime >= keyFrameLength) {
-		copyKeyFrameToState(keyFrame, bodyData, numOfBonesInAnim);
-		animTimerDataPtr->ptr = keyFrame;
-		animTimerDataPtr->time = _engine->timerRef;
+		copyKeyFrameToState(keyFrame, pBody, numOfBonesInAnim);
+		ptranimdest->ptr = keyFrame;
+		ptranimdest->time = _engine->timerRef;
 		return true;
 	}
 
@@ -136,7 +136,7 @@ bool Animations::setInterAnimObjet(int32 keyframeIdx, const AnimData &animData,
 	int16 boneIdx = 1;
 	int16 tmpNumOfPoints = MIN<int16>(lastKeyFramePtr->boneframes.size() - 1, numOfBonesInAnim - 1);
 	do {
-		BoneFrame *boneState = bodyData.getBoneState(boneIdx);
+		BoneFrame *boneState = pBody.getBoneState(boneIdx);
 		const BoneFrame &boneFrame = keyFrame->boneframes[boneIdx];
 		const BoneFrame &lastBoneFrame = lastKeyFramePtr->boneframes[boneIdx];
 
@@ -175,9 +175,9 @@ void Animations::setAnimObjet(int32 keyframeIdx, const AnimData &animData, BodyD
 
 	const KeyFrame *keyFrame = animData.getKeyframe(keyframeIdx);
 
-	_currentStep.x = keyFrame->x;
-	_currentStep.y = keyFrame->y;
-	_currentStep.z = keyFrame->z;
+	_animStep.x = keyFrame->x;
+	_animStep.y = keyFrame->y;
+	_animStep.z = keyFrame->z;
 
 	_animMasterRot = keyFrame->animMasterRot;
 	_animStepBeta = ToAngle(keyFrame->animStepBeta);
@@ -237,9 +237,9 @@ bool Animations::setInterDepObjet(int32 keyframeIdx, const AnimData &animData, A
 
 	const int32 deltaTime = _engine->timerRef - remainingFrameTime;
 
-	_currentStep.x = keyFrame->x;
-	_currentStep.y = keyFrame->y;
-	_currentStep.z = keyFrame->z;
+	_animStep.x = keyFrame->x;
+	_animStep.y = keyFrame->y;
+	_animStep.z = keyFrame->z;
 
 	_animMasterRot = keyFrame->animMasterRot;
 	_animStepBeta = ToAngle(keyFrame->animStepBeta);
@@ -251,9 +251,9 @@ bool Animations::setInterDepObjet(int32 keyframeIdx, const AnimData &animData, A
 	}
 
 	_animStepBeta = (_animStepBeta * deltaTime) / keyFrameLength;
-	_currentStep.x = (_currentStep.x * deltaTime) / keyFrameLength;
-	_currentStep.y = (_currentStep.y * deltaTime) / keyFrameLength;
-	_currentStep.z = (_currentStep.z * deltaTime) / keyFrameLength;
+	_animStep.x = (_animStep.x * deltaTime) / keyFrameLength;
+	_animStep.y = (_animStep.y * deltaTime) / keyFrameLength;
+	_animStep.z = (_animStep.z * deltaTime) / keyFrameLength;
 
 	return false;
 }
@@ -572,14 +572,14 @@ void Animations::doAnim(int32 actorIdx) {
 			actor->_beta = ClampAngle(actor->_beta + _animStepBeta - actor->_animStepBeta);
 			actor->_animStepBeta = _animStepBeta;
 
-			const IVec2 &destPos = _engine->_renderer->rotate(_currentStep.x, _currentStep.z, actor->_beta);
+			const IVec2 &destPos = _engine->_renderer->rotate(_animStep.x, _animStep.z, actor->_beta);
 
-			_currentStep.x = destPos.x;
-			_currentStep.z = destPos.y;
+			_animStep.x = destPos.x;
+			_animStep.z = destPos.y;
 
-			processActor = actor->posObj() + _currentStep - actor->_animStep;
+			processActor = actor->posObj() + _animStep - actor->_animStep;
 
-			actor->_animStep = _currentStep;
+			actor->_animStep = _animStep;
 
 			actor->_workFlags.bAnimEnded = 0;
 			actor->_workFlags.bAnimNewFrame = 0;
diff --git a/engines/twine/scene/animations.h b/engines/twine/scene/animations.h
index 421ec3f698e..03bc1cef7ba 100644
--- a/engines/twine/scene/animations.h
+++ b/engines/twine/scene/animations.h
@@ -48,16 +48,20 @@ private:
 	void copyKeyFrameToState(const KeyFrame *keyframe, BodyData &bodyData, int32 numBones) const;
 	void copyStateToKeyFrame(KeyFrame *keyframe, const BodyData &bodyData) const;
 
+	bool doSetInterAnimObjet(int32 keyframeIdx, const AnimData &animData, BodyData &bodyData, AnimTimerDataStruct *animTimerDataPt, bool global);
+
 	int _animKeyframeBufIdx = 0;
 	KeyFrame _animKeyframeBuf[32];
 
 	/** Rotation by anim and not by engine */
-	int16 _animMasterRot = 0; // AnimMasterRot
+	int16 _animMasterRot = 0;
 	/** Last rotation angle */
-	int16 _animStepBeta = 0; // AnimStepBeta
+	int16 _animStepBeta = 0;
+	int16 _animStepAlpha = 0;
+	int16 _animStepGamma = 0;
 
 	/** Current step coordinates */
-	IVec3 _currentStep;
+	IVec3 _animStep;
 
 public:
 	Animations(TwinEEngine *engine);
@@ -81,7 +85,13 @@ public:
 	 * @param bodyData Body model data
 	 * @param animTimerDataPtr Animation time data
 	 */
-	bool setInterAnimObjet(int32 keyframeIdx, const AnimData &animData, BodyData &bodyData, AnimTimerDataStruct *animTimerDataPtr);
+	bool setInterAnimObjet(int32 keyframeIdx, const AnimData &animData, BodyData &bodyData, AnimTimerDataStruct *animTimerDataPtr) {
+		return doSetInterAnimObjet(keyframeIdx, animData, bodyData, animTimerDataPtr, true);
+	}
+
+	bool setInterAnimObjet2(int32 keyframeIdx, const AnimData &animData, BodyData &bodyData, AnimTimerDataStruct *animTimerDataPtr) {
+		return doSetInterAnimObjet(keyframeIdx, animData, bodyData, animTimerDataPtr, false);
+	}
 
 	/**
 	 * Get entity anim index (This is taken from File3D entities)
diff --git a/engines/twine/scene/gamestate.cpp b/engines/twine/scene/gamestate.cpp
index a0fc7b27aa0..b32746f5391 100644
--- a/engines/twine/scene/gamestate.cpp
+++ b/engines/twine/scene/gamestate.cpp
@@ -381,23 +381,23 @@ void GameState::doFoundObj(InventoryItems item) {
 	_engine->_text->initVoxToPlayTextId((TextId)item);
 
 	const int32 bodyAnimIdx = _engine->_animations->searchAnim(AnimationTypes::kFoundItem, OWN_ACTOR_SCENE_INDEX);
-	const AnimData &currentAnimData = _engine->_resources->_animData[bodyAnimIdx];
+	const AnimData &ptranim = _engine->_resources->_animData[bodyAnimIdx];
 
 	AnimTimerDataStruct tmpAnimTimer = _engine->_scene->_sceneHero->_animTimerData;
 
 	_engine->_animations->stockInterAnim(bodyData, &_engine->_scene->_sceneHero->_animTimerData);
 
-	uint currentAnimState = 0;
+	uint frameanim = 0;
 
-	_engine->_redraw->_numOfRedrawBox = 0;
+	_engine->_redraw->_nbOptPhysBox = 0;
 
 	ScopedKeyMap uiKeyMap(_engine, uiKeyMapId);
 	int16 itemAngle = LBAAngles::ANGLE_0;
 	for (;;) {
 		FrameMarker frame(_engine, 66);
 		_engine->_interface->unsetClip();
-		_engine->_redraw->_currNumOfRedrawBox = 0;
-		_engine->_redraw->blitBackgroundAreas();
+		_engine->_redraw->_nbPhysBox = 0;
+		_engine->_redraw->clsBoxes();
 		_engine->_interface->shadeBox(boxRect, 4);
 
 		_engine->_interface->setClip(boxRect);
@@ -407,21 +407,21 @@ void GameState::doFoundObj(InventoryItems item) {
 		_engine->_renderer->draw3dObject(projPos.x, projPos.y, _engine->_resources->_inventoryTable[item], itemAngle, 10000);
 
 		_engine->_menu->drawRectBorders(boxRect);
-		_engine->_redraw->addRedrawArea(boxRect);
+		_engine->_redraw->addPhysBox(boxRect);
 		_engine->_interface->unsetClip();
 		init3DGame();
 
-		if (_engine->_animations->setInterAnimObjet(currentAnimState, currentAnimData, bodyData, &_engine->_scene->_sceneHero->_animTimerData)) {
-			currentAnimState++; // keyframe
-			if (currentAnimState >= currentAnimData.getNbFramesAnim()) {
-				currentAnimState = currentAnimData.getLoopFrame();
+		if (_engine->_animations->setInterAnimObjet(frameanim, ptranim, bodyData, &_engine->_scene->_sceneHero->_animTimerData)) {
+			frameanim++; // keyframe
+			if (frameanim >= ptranim.getNbFramesAnim()) {
+				frameanim = ptranim.getLoopFrame();
 			}
 		}
 
 		_engine->_renderer->renderIsoModel(bodyPos, LBAAngles::ANGLE_0, LBAAngles::ANGLE_45, LBAAngles::ANGLE_0, bodyData, modelRect);
 		_engine->_interface->setClip(modelRect);
 		_engine->_grid->drawOverBrick(itemX, itemY, itemZ);
-		_engine->_redraw->addRedrawArea(modelRect);
+		_engine->_redraw->addPhysBox(modelRect);
 
 		if (textState == ProgressiveTextState::ContinueRunning) {
 			_engine->_interface->unsetClip();
@@ -430,7 +430,7 @@ void GameState::doFoundObj(InventoryItems item) {
 			_engine->_text->fadeInRemainingChars();
 		}
 
-		_engine->_redraw->flipRedrawAreas();
+		_engine->_redraw->flipBoxes();
 
 		_engine->readKeys();
 		if (_engine->_input->toggleAbortAction()) {
diff --git a/engines/twine/text.cpp b/engines/twine/text.cpp
index 2f160e0534a..d1db16cf52f 100644
--- a/engines/twine/text.cpp
+++ b/engines/twine/text.cpp
@@ -468,7 +468,7 @@ void Text::initDialWindow() {
 	}
 
 	_nbChar = 0;
-	_engine->blitFrontToWork(_dialTextBox);
+	_engine->copyBlock(_dialTextBox);
 }
 
 void Text::secondInitDialWindow() {
diff --git a/engines/twine/twine.cpp b/engines/twine/twine.cpp
index 9fd6f157cbb..2856b2440cc 100644
--- a/engines/twine/twine.cpp
+++ b/engines/twine/twine.cpp
@@ -1278,7 +1278,7 @@ void TwinEEngine::blitWorkToFront(const Common::Rect &rect) {
 	copyBlockPhys(rect);
 }
 
-void TwinEEngine::blitFrontToWork(const Common::Rect &rect) {
+void TwinEEngine::copyBlock(const Common::Rect &rect) {
 	_interface->blitBox(rect, _frontVideoBuffer, _workVideoBuffer);
 }
 
diff --git a/engines/twine/twine.h b/engines/twine/twine.h
index 2a7064a9908..46133777824 100644
--- a/engines/twine/twine.h
+++ b/engines/twine/twine.h
@@ -359,7 +359,7 @@ public:
 	int getRandomNumber(uint max = 0x7FFF);
 
 	void blitWorkToFront(const Common::Rect &rect);
-	void blitFrontToWork(const Common::Rect &rect);
+	void copyBlock(const Common::Rect &rect);
 	void restoreFrontBuffer();
 	void saveFrontBuffer();
 


Commit: 85fef59c8a42ad19a78b53f1ccd30eacf921bfea
    https://github.com/scummvm/scummvm/commit/85fef59c8a42ad19a78b53f1ccd30eacf921bfea
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2024-10-16T16:00:17+02:00

Commit Message:
TWINE: use setInterAnimObjet2 for rendering the actors

Changed paths:
    engines/twine/renderer/redraw.cpp


diff --git a/engines/twine/renderer/redraw.cpp b/engines/twine/renderer/redraw.cpp
index a94d8d58d62..8a21e4de3c9 100644
--- a/engines/twine/renderer/redraw.cpp
+++ b/engines/twine/renderer/redraw.cpp
@@ -404,7 +404,7 @@ void Redraw::processDrawListActors(const DrawListStruct &drawCmd, bool flagflip)
 	ActorStruct *actor = _engine->_scene->getActor(actorIdx);
 	if (actor->_anim >= 0) {
 		const AnimData &animData = _engine->_resources->_animData[actor->_anim];
-		_engine->_animations->setInterAnimObjet(actor->_frame, animData, actor->_entityDataPtr->getBody(actor->_body), &actor->_animTimerData);
+		_engine->_animations->setInterAnimObjet2(actor->_frame, animData, actor->_entityDataPtr->getBody(actor->_body), &actor->_animTimerData);
 	}
 
 	const IVec3 &delta = actor->posObj() - _engine->_grid->_worldCube;


Commit: 4149f82613370d097e34534949ae19f20c72d20c
    https://github.com/scummvm/scummvm/commit/4149f82613370d097e34534949ae19f20c72d20c
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2024-10-16T16:00:17+02:00

Commit Message:
TWINE: started to unify animation code with original sources

setInterDepObjet and doSetInterAnimObjet

Changed paths:
    engines/twine/scene/animations.cpp


diff --git a/engines/twine/scene/animations.cpp b/engines/twine/scene/animations.cpp
index e58dc96a213..27224647a8a 100644
--- a/engines/twine/scene/animations.cpp
+++ b/engines/twine/scene/animations.cpp
@@ -98,36 +98,44 @@ bool Animations::doSetInterAnimObjet(int32 framedest, const AnimData &animData,
 	}
 	const KeyFrame *keyFrame = animData.getKeyframe(framedest);
 
-	_animStep.x = keyFrame->x;
-	_animStep.y = keyFrame->y;
-	_animStep.z = keyFrame->z;
-
-	_animMasterRot = keyFrame->animMasterRot;
-	_animStepBeta = ToAngle(keyFrame->animStepBeta);
-
 	const int16 numBones = pBody.getNumBones();
 
 	int32 numOfBonesInAnim = animData.getNumBoneframes();
 	if (numOfBonesInAnim > numBones) {
 		numOfBonesInAnim = numBones;
 	}
-	const int32 keyFrameLength = keyFrame->length;
+	const int32 timeDest = keyFrame->length;
 
 	const KeyFrame *lastKeyFramePtr = ptranimdest->ptr;
 	int32 remainingFrameTime = ptranimdest->time;
 	if (lastKeyFramePtr == nullptr) {
 		lastKeyFramePtr = keyFrame;
-		remainingFrameTime = keyFrameLength;
+		remainingFrameTime = timeDest;
 	}
-	const int32 deltaTime = _engine->timerRef - remainingFrameTime;
-	if (deltaTime >= keyFrameLength) {
+	const int32 time = _engine->timerRef - remainingFrameTime;
+	if (time >= timeDest) {
 		copyKeyFrameToState(keyFrame, pBody, numOfBonesInAnim);
 		ptranimdest->ptr = keyFrame;
 		ptranimdest->time = _engine->timerRef;
+
+		_animStep.x = keyFrame->x;
+		_animStep.y = keyFrame->y;
+		_animStep.z = keyFrame->z;
+		_animMasterRot = keyFrame->animMasterRot;
+		_animStepAlpha = ToAngle(keyFrame->animStepAlpha);
+		_animStepBeta = ToAngle(keyFrame->animStepBeta);
+		_animStepGamma = ToAngle(keyFrame->animStepGamma);
+
 		return true;
 	}
 
-	_animStepBeta = (_animStepBeta * deltaTime) / keyFrameLength;
+	_animStep.x = keyFrame->x;
+	_animStep.y = keyFrame->y;
+	_animStep.z = keyFrame->z;
+	_animMasterRot = keyFrame->animMasterRot;
+	_animStepAlpha = (keyFrame->animStepAlpha * time) / timeDest;
+	_animStepBeta = (keyFrame->animStepBeta * time) / timeDest;
+	_animStepGamma = (keyFrame->animStepGamma * time) / timeDest;
 
 	if (numOfBonesInAnim <= 1) {
 		return false;
@@ -143,15 +151,15 @@ bool Animations::doSetInterAnimObjet(int32 framedest, const AnimData &animData,
 		boneState->type = boneFrame.type;
 		switch (boneFrame.type) {
 		case BoneType::TYPE_ROTATE:
-			boneState->x = patchInterAngle(deltaTime, keyFrameLength, boneFrame.x, lastBoneFrame.x);
-			boneState->y = patchInterAngle(deltaTime, keyFrameLength, boneFrame.y, lastBoneFrame.y);
-			boneState->z = patchInterAngle(deltaTime, keyFrameLength, boneFrame.z, lastBoneFrame.z);
+			boneState->x = patchInterAngle(time, timeDest, boneFrame.x, lastBoneFrame.x);
+			boneState->y = patchInterAngle(time, timeDest, boneFrame.y, lastBoneFrame.y);
+			boneState->z = patchInterAngle(time, timeDest, boneFrame.z, lastBoneFrame.z);
 			break;
 		case BoneType::TYPE_TRANSLATE:
 		case BoneType::TYPE_ZOOM:
-			boneState->x = patchInterStep(deltaTime, keyFrameLength, boneFrame.x, lastBoneFrame.x);
-			boneState->y = patchInterStep(deltaTime, keyFrameLength, boneFrame.y, lastBoneFrame.y);
-			boneState->z = patchInterStep(deltaTime, keyFrameLength, boneFrame.z, lastBoneFrame.z);
+			boneState->x = patchInterStep(time, timeDest, boneFrame.x, lastBoneFrame.x);
+			boneState->y = patchInterStep(time, timeDest, boneFrame.y, lastBoneFrame.y);
+			boneState->z = patchInterStep(time, timeDest, boneFrame.z, lastBoneFrame.z);
 			break;
 		default:
 			error("Unsupported animation rotation mode %d", boneFrame.type);
@@ -228,32 +236,35 @@ void Animations::copyKeyFrameToState(const KeyFrame *keyframe, BodyData &bodyDat
 
 bool Animations::setInterDepObjet(int32 keyframeIdx, const AnimData &animData, AnimTimerDataStruct *animTimerDataPtr) {
 	const KeyFrame *keyFrame = animData.getKeyframe(keyframeIdx);
-	const int32 keyFrameLength = keyFrame->length;
+	const int32 timeDest = keyFrame->length;
 
 	int32 remainingFrameTime = animTimerDataPtr->time;
 	if (animTimerDataPtr->ptr == nullptr) {
-		remainingFrameTime = keyFrameLength;
+		remainingFrameTime = timeDest;
 	}
 
-	const int32 deltaTime = _engine->timerRef - remainingFrameTime;
-
-	_animStep.x = keyFrame->x;
-	_animStep.y = keyFrame->y;
-	_animStep.z = keyFrame->z;
+	const int32 time = _engine->timerRef - remainingFrameTime;
 
 	_animMasterRot = keyFrame->animMasterRot;
-	_animStepBeta = ToAngle(keyFrame->animStepBeta);
 
-	if (deltaTime >= keyFrameLength) {
+	if (time >= timeDest) {
+		_animStep.x = keyFrame->x;
+		_animStep.y = keyFrame->y;
+		_animStep.z = keyFrame->z;
+		_animStepAlpha = ToAngle(keyFrame->animStepAlpha);
+		_animStepBeta = ToAngle(keyFrame->animStepBeta);
+		_animStepGamma = ToAngle(keyFrame->animStepGamma);
 		animTimerDataPtr->ptr = animData.getKeyframe(keyframeIdx);
 		animTimerDataPtr->time = _engine->timerRef;
 		return true; // finished animation
 	}
 
-	_animStepBeta = (_animStepBeta * deltaTime) / keyFrameLength;
-	_animStep.x = (_animStep.x * deltaTime) / keyFrameLength;
-	_animStep.y = (_animStep.y * deltaTime) / keyFrameLength;
-	_animStep.z = (_animStep.z * deltaTime) / keyFrameLength;
+	_animStep.x = (keyFrame->x * time) / timeDest;
+	_animStep.y = (keyFrame->y * time) / timeDest;
+	_animStep.z = (keyFrame->z * time) / timeDest;
+	_animStepAlpha = ToAngle((keyFrame->animStepAlpha * time) / timeDest);
+	_animStepBeta = ToAngle((keyFrame->animStepBeta * time) / timeDest);
+	_animStepGamma = ToAngle((keyFrame->animStepGamma * time) / timeDest);
 
 	return false;
 }


Commit: a3d1b699605cc8031c39c3674c75c1aeee8ef25f
    https://github.com/scummvm/scummvm/commit/a3d1b699605cc8031c39c3674c75c1aeee8ef25f
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2024-10-16T16:00:17+02:00

Commit Message:
TWINE: comments about future renames

Changed paths:
    engines/twine/parser/anim.h


diff --git a/engines/twine/parser/anim.h b/engines/twine/parser/anim.h
index 87f7d5d7050..0682f7eccee 100644
--- a/engines/twine/parser/anim.h
+++ b/engines/twine/parser/anim.h
@@ -37,9 +37,9 @@ enum BoneType : uint16 {
 
 struct BoneFrame {
 	BoneType type = BoneType::TYPE_ROTATE;
-	int16 x = 0;
-	int16 y = 0;
-	int16 z = 0;
+	int16 x = 0; // alpha
+	int16 y = 0; // beta
+	int16 z = 0; // gamma
 };
 
 struct KeyFrame {


Commit: fe207a1432fdd94040afede5306b6a91fe6c3f84
    https://github.com/scummvm/scummvm/commit/fe207a1432fdd94040afede5306b6a91fe6c3f84
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2024-10-16T16:00:18+02:00

Commit Message:
TWINE: don't interfere with the actor animation state when doing the object found animation

Changed paths:
    engines/twine/scene/gamestate.cpp


diff --git a/engines/twine/scene/gamestate.cpp b/engines/twine/scene/gamestate.cpp
index b32746f5391..daaf287376e 100644
--- a/engines/twine/scene/gamestate.cpp
+++ b/engines/twine/scene/gamestate.cpp
@@ -383,14 +383,13 @@ void GameState::doFoundObj(InventoryItems item) {
 	const int32 bodyAnimIdx = _engine->_animations->searchAnim(AnimationTypes::kFoundItem, OWN_ACTOR_SCENE_INDEX);
 	const AnimData &ptranim = _engine->_resources->_animData[bodyAnimIdx];
 
-	AnimTimerDataStruct tmpAnimTimer = _engine->_scene->_sceneHero->_animTimerData;
-
 	_engine->_animations->stockInterAnim(bodyData, &_engine->_scene->_sceneHero->_animTimerData);
 
 	uint frameanim = 0;
 
 	_engine->_redraw->_nbOptPhysBox = 0;
 
+	AnimTimerDataStruct animTimerData;
 	ScopedKeyMap uiKeyMap(_engine, uiKeyMapId);
 	int16 itemAngle = LBAAngles::ANGLE_0;
 	for (;;) {
@@ -411,7 +410,7 @@ void GameState::doFoundObj(InventoryItems item) {
 		_engine->_interface->unsetClip();
 		init3DGame();
 
-		if (_engine->_animations->setInterAnimObjet(frameanim, ptranim, bodyData, &_engine->_scene->_sceneHero->_animTimerData)) {
+		if (_engine->_animations->setInterAnimObjet(frameanim, ptranim, bodyData, &animTimerData)) {
 			frameanim++; // keyframe
 			if (frameanim >= ptranim.getNbFramesAnim()) {
 				frameanim = ptranim.getLoopFrame();
@@ -466,8 +465,6 @@ void GameState::doFoundObj(InventoryItems item) {
 	init3DGame();
 	_engine->_text->initSceneTextBank();
 	_engine->_text->stopVox(_engine->_text->_currDialTextEntry);
-
-	_engine->_scene->_sceneHero->_animTimerData = tmpAnimTimer;
 	_engine->_interface->unsetClip();
 }
 


Commit: 1fc869a1393cf17fff7fbfe21f67d73dad07b944
    https://github.com/scummvm/scummvm/commit/1fc869a1393cf17fff7fbfe21f67d73dad07b944
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2024-10-16T16:00:18+02:00

Commit Message:
TWINE: restore the life script offset after playing the obj found animation

Changed paths:
    engines/twine/twine.cpp


diff --git a/engines/twine/twine.cpp b/engines/twine/twine.cpp
index 2856b2440cc..ce7b5bce2a0 100644
--- a/engines/twine/twine.cpp
+++ b/engines/twine/twine.cpp
@@ -1119,10 +1119,12 @@ bool TwinEEngine::runGameEngine() { // mainLoopInteration
 
 		if (_debugState->_playFoundItemAnimation) {
 			_debugState->_playFoundItemAnimation = false;
+			auto tmp = _scene->_sceneHero->_offsetLife;
 			LifeScriptContext fakeCtx(0, _scene->_sceneHero);
 			fakeCtx.stream.writeByte(InventoryItems::kiHolomap);
 			fakeCtx.stream.seek(0);
 			_scriptLife->lFOUND_OBJECT(this, fakeCtx);
+			_scene->_sceneHero->_offsetLife = tmp;
 		}
 
 		processActorSamplePosition(a);


Commit: 5972fb1cc6d9862e8bb6b61cafee9b904f9fe950
    https://github.com/scummvm/scummvm/commit/5972fb1cc6d9862e8bb6b61cafee9b904f9fe950
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2024-10-16T16:00:18+02:00

Commit Message:
TWINE: handle the global flag of doSetInterAnimObjet

Changed paths:
    engines/twine/scene/animations.cpp


diff --git a/engines/twine/scene/animations.cpp b/engines/twine/scene/animations.cpp
index 27224647a8a..c331fc2f66e 100644
--- a/engines/twine/scene/animations.cpp
+++ b/engines/twine/scene/animations.cpp
@@ -114,29 +114,34 @@ bool Animations::doSetInterAnimObjet(int32 framedest, const AnimData &animData,
 	}
 	const int32 time = _engine->timerRef - remainingFrameTime;
 	if (time >= timeDest) {
-		copyKeyFrameToState(keyFrame, pBody, numOfBonesInAnim);
 		ptranimdest->ptr = keyFrame;
-		ptranimdest->time = _engine->timerRef;
 
+		if (global) {
+			ptranimdest->time = _engine->timerRef;
+
+			_animStep.x = keyFrame->x;
+			_animStep.y = keyFrame->y;
+			_animStep.z = keyFrame->z;
+			_animMasterRot = keyFrame->animMasterRot;
+			_animStepAlpha = ToAngle(keyFrame->animStepAlpha);
+			_animStepBeta = ToAngle(keyFrame->animStepBeta);
+			_animStepGamma = ToAngle(keyFrame->animStepGamma);
+		}
+
+		copyKeyFrameToState(keyFrame, pBody, numOfBonesInAnim);
+
+		return true;
+	}
+
+	if (global) {
 		_animStep.x = keyFrame->x;
 		_animStep.y = keyFrame->y;
 		_animStep.z = keyFrame->z;
 		_animMasterRot = keyFrame->animMasterRot;
-		_animStepAlpha = ToAngle(keyFrame->animStepAlpha);
-		_animStepBeta = ToAngle(keyFrame->animStepBeta);
-		_animStepGamma = ToAngle(keyFrame->animStepGamma);
-
-		return true;
+		_animStepAlpha = (keyFrame->animStepAlpha * time) / timeDest;
+		_animStepBeta = (keyFrame->animStepBeta * time) / timeDest;
+		_animStepGamma = (keyFrame->animStepGamma * time) / timeDest;
 	}
-
-	_animStep.x = keyFrame->x;
-	_animStep.y = keyFrame->y;
-	_animStep.z = keyFrame->z;
-	_animMasterRot = keyFrame->animMasterRot;
-	_animStepAlpha = (keyFrame->animStepAlpha * time) / timeDest;
-	_animStepBeta = (keyFrame->animStepBeta * time) / timeDest;
-	_animStepGamma = (keyFrame->animStepGamma * time) / timeDest;
-
 	if (numOfBonesInAnim <= 1) {
 		return false;
 	}


Commit: 53e0eac95ac2bb281cf01d2c636bdb2ec1781703
    https://github.com/scummvm/scummvm/commit/53e0eac95ac2bb281cf01d2c636bdb2ec1781703
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2024-10-16T16:00:18+02:00

Commit Message:
TWINE: removed unsetClip call that is not present in the original sources

Changed paths:
    engines/twine/scene/gamestate.cpp


diff --git a/engines/twine/scene/gamestate.cpp b/engines/twine/scene/gamestate.cpp
index daaf287376e..3d7aeeda26a 100644
--- a/engines/twine/scene/gamestate.cpp
+++ b/engines/twine/scene/gamestate.cpp
@@ -465,7 +465,6 @@ void GameState::doFoundObj(InventoryItems item) {
 	init3DGame();
 	_engine->_text->initSceneTextBank();
 	_engine->_text->stopVox(_engine->_text->_currDialTextEntry);
-	_engine->_interface->unsetClip();
 }
 
 void GameState::gameAskChoice(TextId choiceIdx) {


Commit: 0047aaa04e7949b48ea27d49ec5556524f6e9521
    https://github.com/scummvm/scummvm/commit/0047aaa04e7949b48ea27d49ec5556524f6e9521
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2024-10-16T16:00:18+02:00

Commit Message:
TWINE: fixed issue #15407

see https://bugs.scummvm.org/ticket/15407

introduced in f0e9fe38aba66e831d0891fdb28a864316baaa3c

Changed paths:
    engines/twine/renderer/renderer.cpp


diff --git a/engines/twine/renderer/renderer.cpp b/engines/twine/renderer/renderer.cpp
index a727974b0e7..201233b6763 100644
--- a/engines/twine/renderer/renderer.cpp
+++ b/engines/twine/renderer/renderer.cpp
@@ -269,6 +269,8 @@ void Renderer::rotMatIndex2(IMatrix3x3 *pDest, const IMatrix3x3 *pSrc, const IVe
 		tmp.row2.y = (pSrc->row2.y * nCos - pSrc->row2.x * nSin) / SCENE_SIZE_HALF;
 		tmp.row3.x = (pSrc->row3.y * nSin + pSrc->row3.x * nCos) / SCENE_SIZE_HALF;
 		tmp.row3.y = (pSrc->row3.y * nCos - pSrc->row3.x * nSin) / SCENE_SIZE_HALF;
+
+		pSrc = &tmp;
 	}
 
 	if (lBeta) {




More information about the Scummvm-git-logs mailing list