[Scummvm-git-logs] scummvm master -> 0d2faeb7cf5a6b5606e1d6ab01c2162a31080bef

mgerhardy noreply at scummvm.org
Thu Oct 10 18:53:53 UTC 2024


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

Summary:
713b19ee2a TWINE: removed TODO comment from holomap code
d1a1be8f71 TWINE: moved functions out of class scope (boundRuleThree/lerp)
90ee431c75 TWINE: renamed methods and member vars to match the original sources (holomap)
1e331168d8 TWINE: fixed resetting the dark palette when entering the main menu again
0d2faeb7cf TWINE: show all palettes in the debugger


Commit: 713b19ee2a3811a2eb85ccbccf785851dbaa1e01
    https://github.com/scummvm/scummvm/commit/713b19ee2a3811a2eb85ccbccf785851dbaa1e01
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2024-10-10T20:01:10+02:00

Commit Message:
TWINE: removed TODO comment from holomap code

this was already fixed

Changed paths:
    engines/twine/holomap_v1.cpp


diff --git a/engines/twine/holomap_v1.cpp b/engines/twine/holomap_v1.cpp
index 4a946b65b9f..770b9d4e350 100644
--- a/engines/twine/holomap_v1.cpp
+++ b/engines/twine/holomap_v1.cpp
@@ -544,7 +544,6 @@ void HolomapV1::holoMap() {
 
 	initHoloDatas();
 
-	// TODO: not visible
 	drawTitle(_engine->width() / 2, 25, "HoloMap");
 
 	const int32 cameraPosX = _engine->width() / 2;


Commit: d1a1be8f711e61fb1bd4954b0d0dc768e3e0baf3
    https://github.com/scummvm/scummvm/commit/d1a1be8f711e61fb1bd4954b0d0dc768e3e0baf3
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2024-10-10T20:22:06+02:00

Commit Message:
TWINE: moved functions out of class scope (boundRuleThree/lerp)

Changed paths:
    engines/twine/audio/sound.cpp
    engines/twine/holomap_v1.cpp
    engines/twine/menu/menu.cpp
    engines/twine/parser/anim.cpp
    engines/twine/renderer/redraw.cpp
    engines/twine/renderer/screens.cpp
    engines/twine/renderer/screens.h
    engines/twine/scene/buggy.cpp
    engines/twine/scene/collision.cpp
    engines/twine/scene/collision.h
    engines/twine/scene/extra.cpp
    engines/twine/scene/gamestate.cpp
    engines/twine/script/script_life.cpp
    engines/twine/twine.cpp
    engines/twine/twine.h


diff --git a/engines/twine/audio/sound.cpp b/engines/twine/audio/sound.cpp
index 9465523998b..6c3445194bf 100644
--- a/engines/twine/audio/sound.cpp
+++ b/engines/twine/audio/sound.cpp
@@ -73,7 +73,7 @@ void Sound::setSamplePosition(int32 channelIdx, int32 x, int32 y, int32 z) {
 	const int32 camY = _engine->_grid->_newCamera.y * SIZE_BRICK_Y;
 	const int32 camZ = _engine->_grid->_newCamera.z * SIZE_BRICK_XZ;
 	int32 distance = getDistance3D(camX, camY, camZ, x, y, z);
-	distance = _engine->_collision->boundRuleThree(0, distance, 10000, 255);
+	distance = boundRuleThree(0, distance, 10000, 255);
 	byte targetVolume = 0;
 	if (distance < 255) {
 		targetVolume = 255 - distance;
diff --git a/engines/twine/holomap_v1.cpp b/engines/twine/holomap_v1.cpp
index 770b9d4e350..99e8d9e4a63 100644
--- a/engines/twine/holomap_v1.cpp
+++ b/engines/twine/holomap_v1.cpp
@@ -188,7 +188,7 @@ void HolomapV1::computeCoorMapping() {
 	int projectedIndex = 0;
 	for (int32 alpha = -LBAAngles::ANGLE_90; alpha <= LBAAngles::ANGLE_90; alpha += LBAAngles::ANGLE_11_25) {
 		for (int32 beta = 0; beta < LBAAngles::ANGLE_360; beta += LBAAngles::ANGLE_11_25) {
-			_projectedSurfacePositions[projectedIndex].x2 = _engine->_screens->lerp(0, 255 * LBAAngles::ANGLE_90 + 255, LBAAngles::ANGLE_360 - 1, beta);
+			_projectedSurfacePositions[projectedIndex].x2 = lerp(0, 255 * LBAAngles::ANGLE_90 + 255, LBAAngles::ANGLE_360 - 1, beta);
 			if (alpha == LBAAngles::ANGLE_90) {
 				_projectedSurfacePositions[projectedIndex].y2 = 255 * LBAAngles::ANGLE_90 + 255;
 			} else {
@@ -632,8 +632,8 @@ void HolomapV1::holoMap() {
 
 		if (automove) {
 			const int32 dt = _engine->timerRef - otimer;
-			calpha = _engine->_collision->boundRuleThree(oalpha, dalpha, 75, dt);
-			cbeta = _engine->_collision->boundRuleThree(obeta, dbeta, 75, dt);
+			calpha = boundRuleThree(oalpha, dalpha, 75, dt);
+			cbeta = boundRuleThree(obeta, dbeta, 75, dt);
 			flagredraw = true;
 		}
 
diff --git a/engines/twine/menu/menu.cpp b/engines/twine/menu/menu.cpp
index c639b7bca9f..abd1c79c352 100644
--- a/engines/twine/menu/menu.cpp
+++ b/engines/twine/menu/menu.cpp
@@ -298,22 +298,22 @@ void Menu::drawButtonGfx(const MenuSettings *menuSettings, const Common::Rect &r
 			switch (buttonId) {
 			case MenuButtonTypes::kMusicVolume: {
 				const int volume = _engine->_system->getMixer()->getVolumeForSoundType(Audio::Mixer::kMusicSoundType);
-				newWidth = _engine->_screens->lerp(rect.left, rect.right, Audio::Mixer::kMaxMixerVolume, volume);
+				newWidth = lerp(rect.left, rect.right, Audio::Mixer::kMaxMixerVolume, volume);
 				break;
 			}
 			case MenuButtonTypes::kSoundVolume: {
 				const int volume = _engine->_system->getMixer()->getVolumeForSoundType(Audio::Mixer::kSFXSoundType);
-				newWidth = _engine->_screens->lerp(rect.left, rect.right, Audio::Mixer::kMaxMixerVolume, volume);
+				newWidth = lerp(rect.left, rect.right, Audio::Mixer::kMaxMixerVolume, volume);
 				break;
 			}
 			case MenuButtonTypes::kCDVolume: {
 				const AudioCDManager::Status status = _engine->_system->getAudioCDManager()->getStatus();
-				newWidth = _engine->_screens->lerp(rect.left, rect.right, Audio::Mixer::kMaxMixerVolume, status.volume);
+				newWidth = lerp(rect.left, rect.right, Audio::Mixer::kMaxMixerVolume, status.volume);
 				break;
 			}
 			case MenuButtonTypes::kSpeechVolume: {
 				const int volume = _engine->_system->getMixer()->getVolumeForSoundType(Audio::Mixer::kSpeechSoundType);
-				newWidth = _engine->_screens->lerp(rect.left, rect.right, Audio::Mixer::kMaxMixerVolume, volume);
+				newWidth = lerp(rect.left, rect.right, Audio::Mixer::kMaxMixerVolume, volume);
 				break;
 			}
 			}
@@ -1006,7 +1006,7 @@ int32 Menu::giveupMenu() {
 void Menu::drawHealthBar(int32 left, int32 right, int32 top, int32 barLeftPadding, int32 barHeight) {
 	_engine->_grid->drawSprite(left, top + 3, _engine->_resources->_spriteData[SPRITEHQR_LIFEPOINTS]);
 	const int32 barLeft = left + barLeftPadding;
-	const int32 healthBarRight = _engine->_screens->lerp(barLeft, right, 50, _engine->_scene->_sceneHero->_lifePoint);
+	const int32 healthBarRight = lerp(barLeft, right, 50, _engine->_scene->_sceneHero->_lifePoint);
 	const int32 barBottom = top + barHeight;
 	_engine->_interface->box(Common::Rect(barLeft, top, healthBarRight, barBottom), COLOR_91);
 	_engine->_interface->box(Common::Rect(healthBarRight, top, left + 325, barBottom), COLOR_BLACK);
@@ -1016,13 +1016,13 @@ void Menu::drawHealthBar(int32 left, int32 right, int32 top, int32 barLeftPaddin
 void Menu::drawCloverLeafs(int32 newBoxLeft, int32 boxRight, int32 top) {
 	// Clover leaf boxes
 	for (int32 i = 0; i < _engine->_gameState->_inventoryNumLeafsBox; i++) {
-		const int32 leftSpritePos = _engine->_screens->lerp(newBoxLeft, boxRight, 10, i);
+		const int32 leftSpritePos = lerp(newBoxLeft, boxRight, 10, i);
 		_engine->_grid->drawSprite(leftSpritePos, top + 58, _engine->_resources->_spriteData[SPRITEHQR_CLOVERLEAFBOX]);
 	}
 
 	// Clover leafs
 	for (int32 i = 0; i < _engine->_gameState->_inventoryNumLeafs; i++) {
-		const int32 leftSpritePos = _engine->_screens->lerp(newBoxLeft, boxRight, 10, i);
+		const int32 leftSpritePos = lerp(newBoxLeft, boxRight, 10, i);
 		_engine->_grid->drawSprite(leftSpritePos + 2, top + 60, _engine->_resources->_spriteData[SPRITEHQR_CLOVERLEAF]);
 	}
 }
@@ -1042,16 +1042,16 @@ void Menu::drawMagicPointsBar(int32 left, int32 right, int32 top, int32 barLeftP
 	const int32 barBottom = top + barHeight;
 	// max magic level is 4
 	const int32 maxMagicPoints = 4 * 20;
-	const int32 barRight = _engine->_screens->lerp(barLeft, right, maxMagicPoints, _engine->_gameState->_magicPoint);
+	const int32 barRight = lerp(barLeft, right, maxMagicPoints, _engine->_gameState->_magicPoint);
 	const Common::Rect pointsRect(barLeft, top, barRight, barBottom);
 	_engine->_interface->box(pointsRect, COLOR_75);
 
 	for (int32 l = 0; l < _engine->_gameState->_magicLevelIdx; l++) {
-		const int32 x1 = _engine->_screens->lerp(barLeft, right, 40, _engine->_gameState->_magicLevelIdx * 10);
+		const int32 x1 = lerp(barLeft, right, 40, _engine->_gameState->_magicLevelIdx * 10);
 		_engine->_interface->drawLine(x1, top + barHeight, x1, top + 35 + 15 - 1, 0);
 	}
 
-	const int32 rectRight = _engine->_screens->lerp(barLeft, right, 40, _engine->_gameState->_magicLevelIdx * 10);
+	const int32 rectRight = lerp(barLeft, right, 40, _engine->_gameState->_magicLevelIdx * 10);
 	drawRectBorders(barLeft, top, rectRight, barBottom);
 }
 
diff --git a/engines/twine/parser/anim.cpp b/engines/twine/parser/anim.cpp
index dc3415bb3dd..af2a5a6b728 100644
--- a/engines/twine/parser/anim.cpp
+++ b/engines/twine/parser/anim.cpp
@@ -83,7 +83,7 @@ const KeyFrame* AnimData::getKeyframe(uint index) const {
 	return &_keyframes[index];
 }
 
-uint16 AnimData::getLoopFrame() const {
+uint16 AnimData::getLoopFrame() const { // GetBouclageAnim
 	return _loopFrame;
 }
 
diff --git a/engines/twine/renderer/redraw.cpp b/engines/twine/renderer/redraw.cpp
index c9f21c11838..55de8ec6086 100644
--- a/engines/twine/renderer/redraw.cpp
+++ b/engines/twine/renderer/redraw.cpp
@@ -767,7 +767,7 @@ void Redraw::renderOverlays() {
 			break;
 		}
 		case OverlayType::koNumberRange: {
-			const int32 range = _engine->_collision->boundRuleThree(overlay->info, overlay->num, 100, overlay->timerEnd - _engine->timerRef - _engine->toSeconds(1));
+			const int32 range = boundRuleThree(overlay->info, overlay->num, 100, overlay->timerEnd - _engine->timerRef - _engine->toSeconds(1));
 
 			char text[10];
 			Common::sprintf_s(text, "%d", range);
diff --git a/engines/twine/renderer/screens.cpp b/engines/twine/renderer/screens.cpp
index 1d066ada124..22eb0b5be8f 100644
--- a/engines/twine/renderer/screens.cpp
+++ b/engines/twine/renderer/screens.cpp
@@ -171,13 +171,6 @@ bool Screens::loadBitmapDelay(const char *image, int32 seconds) {
 	return false;
 }
 
-int32 Screens::lerp(int32 val1, int32 val2, int32 nbstep, int32 step) {  // RegleTrois32
-	if (nbstep < 0) {
-		return val2;
-	}
-	return (((val2 - val1) * step) / nbstep) + val1;
-}
-
 void Screens::fadePal(uint8 r, uint8 g, uint8 b, const Graphics::Palette &rgbaPal, int32 intensity) {
 	Graphics::Palette pal{NUMOFCOLORS};
 
diff --git a/engines/twine/renderer/screens.h b/engines/twine/renderer/screens.h
index 55aeb09defa..837aa313bde 100644
--- a/engines/twine/renderer/screens.h
+++ b/engines/twine/renderer/screens.h
@@ -94,17 +94,6 @@ public:
 
 	bool loadBitmapDelay(const char *image, int32 seconds);
 
-	/**
-	 * Linear interpolation of the given value between start and end
-	 * @param value color component
-	 * @param start lower range
-	 * @param end upper range
-	 * @param t the location in given range
-	 * @return the lerped value
-	 * @note Doesn't clamp
-	 */
-	int32 lerp(int32 value, int32 start, int32 end, int32 t);
-
 	/**
 	 * Adjust between two palettes
 	 * @param pal1 palette from adjust
diff --git a/engines/twine/scene/buggy.cpp b/engines/twine/scene/buggy.cpp
index ad46bc93f2f..7bf7fb105f3 100644
--- a/engines/twine/scene/buggy.cpp
+++ b/engines/twine/scene/buggy.cpp
@@ -587,17 +587,17 @@ void Buggy::moveBuggy(ActorStruct *ptrobj) {
 
 		switch (Gear) {
 		case -1:
-			pitch = _engine->_collision->boundRuleThree(3000, MAX_SAMPLE_PITCH2, MAX_SPEED, ABS(ptb->Speed));
+			pitch = boundRuleThree(3000, MAX_SAMPLE_PITCH2, MAX_SPEED, ABS(ptb->Speed));
 			break;
 
 		case 0:
-			pitch = _engine->_collision->boundRuleThree(3000, MAX_SAMPLE_PITCH, MAX_SPEED, ABS(ptb->Speed));
+			pitch = boundRuleThree(3000, MAX_SAMPLE_PITCH, MAX_SPEED, ABS(ptb->Speed));
 			if (pitch >= MAX_SAMPLE_PITCH)
 				TimerGear = 1;
 			break;
 
 		case 1:
-			pitch = _engine->_collision->boundRuleThree(MAX_SAMPLE_PITCH2, MIN_SAMPLE_PITCH2, TEMPO_GEAR, TimerGear - TimerRefHR);
+			pitch = boundRuleThree(MAX_SAMPLE_PITCH2, MIN_SAMPLE_PITCH2, TEMPO_GEAR, TimerGear - TimerRefHR);
 			break;
 
 		default:
diff --git a/engines/twine/scene/collision.cpp b/engines/twine/scene/collision.cpp
index 2251ae7662d..86991391731 100644
--- a/engines/twine/scene/collision.cpp
+++ b/engines/twine/scene/collision.cpp
@@ -82,18 +82,6 @@ bool Collision::checkZvOnZv(int32 actorIdx1, int32 actorIdx2) const {
 	return true;
 }
 
-int32 Collision::boundRuleThree(int32 val1, int32 val2, int32 nbstep, int32 step) const { // BoundRegleTrois
-	if (step <= 0) {
-		return val1;
-	}
-
-	if (step >= nbstep) {
-		return val2;
-	}
-
-	return val1 + (((val2 - val1) * step) / nbstep);
-}
-
 void Collision::reajustPos(IVec3 &processActor, ShapeType brickShape) const {
 	if (brickShape <= ShapeType::kSolid) {
 		return;
diff --git a/engines/twine/scene/collision.h b/engines/twine/scene/collision.h
index f1413dcc360..c0beca7f5bb 100644
--- a/engines/twine/scene/collision.h
+++ b/engines/twine/scene/collision.h
@@ -51,8 +51,6 @@ public:
 	 */
 	bool checkZvOnZv(int32 actorIdx1, int32 actorIdx2) const;
 
-	int32 boundRuleThree(int32 start, int32 end, int32 maxDelay, int32 delay) const;
-
 	/**
 	 * Reajust actor position in scene according with brick shape bellow actor
 	 * @param brickShape Shape of brick bellow the actor
diff --git a/engines/twine/scene/extra.cpp b/engines/twine/scene/extra.cpp
index 17dcc8094b2..37e648b4455 100644
--- a/engines/twine/scene/extra.cpp
+++ b/engines/twine/scene/extra.cpp
@@ -501,7 +501,7 @@ void Extra::gereExtras() {
 		const int32 deltaT = _engine->timerRef - extra->spawnTime;
 
 		if (extra->type & ExtraType::EXPLOSION) {
-			extra->sprite = _engine->_collision->boundRuleThree(SPRITEHQR_EXPLOSION_FIRST_FRAME, 100, 30, deltaT);
+			extra->sprite = boundRuleThree(SPRITEHQR_EXPLOSION_FIRST_FRAME, 100, 30, deltaT);
 			continue;
 		}
 		// process extra moving
diff --git a/engines/twine/scene/gamestate.cpp b/engines/twine/scene/gamestate.cpp
index eab417838a2..57ddabc2579 100644
--- a/engines/twine/scene/gamestate.cpp
+++ b/engines/twine/scene/gamestate.cpp
@@ -538,8 +538,8 @@ void GameState::processGameoverAnimation() {
 			return;
 		}
 
-		zoom = _engine->_collision->boundRuleThree(40000, 3200, _engine->toSeconds(10), _engine->timerRef - startLbaTime);
-		const int32 angle = _engine->_screens->lerp(1, LBAAngles::ANGLE_360, _engine->toSeconds(2), (_engine->timerRef - startLbaTime) % _engine->toSeconds(2));
+		zoom = boundRuleThree(40000, 3200, _engine->toSeconds(10), _engine->timerRef - startLbaTime);
+		const int32 angle = lerp(1, LBAAngles::ANGLE_360, _engine->toSeconds(2), (_engine->timerRef - startLbaTime) % _engine->toSeconds(2));
 
 		_engine->blitWorkToFront(rect);
 		_engine->_renderer->setFollowCamera(0, 0, 0, 0, -angle, 0, zoom);
diff --git a/engines/twine/script/script_life.cpp b/engines/twine/script/script_life.cpp
index b72d4c23e03..3fac184d70e 100644
--- a/engines/twine/script/script_life.cpp
+++ b/engines/twine/script/script_life.cpp
@@ -1129,7 +1129,7 @@ int32 ScriptLife::lGIVE_GOLD_PIECES(TwinEEngine *engine, LifeScriptContext &ctx)
 	for (int16 i = 0; i < OVERLAY_MAX_ENTRIES; i++) {
 		OverlayListStruct *overlay = &engine->_redraw->overlayList[i];
 		if (overlay->num != -1 && overlay->type == OverlayType::koNumberRange) {
-			overlay->num = engine->_collision->boundRuleThree(overlay->info, overlay->num, engine->toSeconds(2), overlay->timerEnd - engine->timerRef - engine->toSeconds(1));
+			overlay->num = boundRuleThree(overlay->info, overlay->num, engine->toSeconds(2), overlay->timerEnd - engine->timerRef - engine->toSeconds(1));
 			overlay->info = engine->_gameState->_goldPieces;
 			overlay->timerEnd = engine->timerRef + engine->toSeconds(3);
 			hideRange = true;
diff --git a/engines/twine/twine.cpp b/engines/twine/twine.cpp
index 27db423f709..5bb804c1285 100644
--- a/engines/twine/twine.cpp
+++ b/engines/twine/twine.cpp
@@ -144,6 +144,25 @@ void TwineScreen::update() {
 	Super::update();
 }
 
+int32 boundRuleThree(int32 val1, int32 val2, int32 nbstep, int32 step) { // BoundRegleTrois
+	if (step <= 0) {
+		return val1;
+	}
+
+	if (step >= nbstep) {
+		return val2;
+	}
+
+	return val1 + (((val2 - val1) * step) / nbstep);
+}
+
+int32 lerp(int32 val1, int32 val2, int32 nbstep, int32 step) {  // RegleTrois32
+	if (nbstep < 0) {
+		return val2;
+	}
+	return (((val2 - val1) * step) / nbstep) + val1;
+}
+
 TwinEEngine::TwinEEngine(OSystem *system, Common::Language language, uint32 flags, Common::Platform platform, TwineGameType gameType)
 	: Engine(system), _gameType(gameType), _gameLang(language), _frontVideoBuffer(this), _gameFlags(flags), _platform(platform), _rnd("twine") {
 	// Add default file directories
diff --git a/engines/twine/twine.h b/engines/twine/twine.h
index 6ba784e2528..4a91ef94860 100644
--- a/engines/twine/twine.h
+++ b/engines/twine/twine.h
@@ -198,6 +198,20 @@ public:
 	void update() override;
 };
 
+
+int32 boundRuleThree(int32 val1, int32 val2, int32 nbstep, int32 step);
+
+/**
+ * Linear interpolation of the given value between start and end
+ * @param value color component
+ * @param start lower range
+ * @param end upper range
+ * @param t the location in given range
+ * @return the lerped value
+ * @note Doesn't clamp
+ */
+int32 lerp(int32 value, int32 start, int32 end, int32 t);
+
 class TwinEEngine : public Engine {
 private:
 	int32 _isTimeFreezed = 0;


Commit: 90ee431c75d5689b8cf5adc34c13f9e9145a0c8a
    https://github.com/scummvm/scummvm/commit/90ee431c75d5689b8cf5adc34c13f9e9145a0c8a
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2024-10-10T20:39:46+02:00

Commit Message:
TWINE: renamed methods and member vars to match the original sources (holomap)

Changed paths:
    engines/twine/debugger/debugtools.cpp
    engines/twine/holomap_v1.cpp
    engines/twine/holomap_v1.h
    engines/twine/menu/menu.cpp
    engines/twine/parser/anim.h
    engines/twine/parser/holomap.cpp
    engines/twine/parser/holomap.h
    engines/twine/renderer/redraw.cpp
    engines/twine/scene/animations.cpp
    engines/twine/scene/animations.h
    engines/twine/scene/gamestate.cpp


diff --git a/engines/twine/debugger/debugtools.cpp b/engines/twine/debugger/debugtools.cpp
index a3616372b64..aa324a63027 100644
--- a/engines/twine/debugger/debugtools.cpp
+++ b/engines/twine/debugger/debugtools.cpp
@@ -367,7 +367,7 @@ static void sceneDetailsWindows(TwinEEngine *engine) {
 				ImGui::Text("location: %i", trajectory->locationIdx);
 				ImGui::Text("trajectory location: %i", trajectory->trajLocationIdx);
 				ImGui::Text("vehicle: %i", trajectory->vehicleIdx);
-				ImGui::Text("pos: %i %i %i", trajectory->pos.x, trajectory->pos.y, trajectory->pos.z);
+				ImGui::Text("pos: %i %i %i", trajectory->angle.x, trajectory->angle.y, trajectory->angle.z);
 				ImGui::Text("num anim frames: %i", trajectory->numAnimFrames);
 				ImGui::Unindent();
 			}
diff --git a/engines/twine/holomap_v1.cpp b/engines/twine/holomap_v1.cpp
index 99e8d9e4a63..2dcd8dedaec 100644
--- a/engines/twine/holomap_v1.cpp
+++ b/engines/twine/holomap_v1.cpp
@@ -297,9 +297,9 @@ void HolomapV1::drawTitle(int32 x, int32 y, const char *title) {
 	_engine->copyBlockPhys(x0, y0, x1, y1);
 }
 
-void HolomapV1::drawHoloObj(const IVec3 &angle, int32 alpha, int32 beta) {
+void HolomapV1::drawHoloObj(const IVec3 &angle, int32 alpha, int32 beta, int16 size) {
 	_engine->_renderer->setAngleCamera(alpha, beta, 0);
-	const IVec3 &m = _engine->_renderer->worldRotatePoint(IVec3(0, 0, 1000));
+	const IVec3 &m = _engine->_renderer->worldRotatePoint(IVec3(0, 0, 1000 + size));
 	_engine->_renderer->setFollowCamera(0, 0, 0, angle.x, angle.y, angle.z, distance(zDistanceTrajectory));
 	_engine->_interface->unsetClip();
 	Common::Rect dirtyRect;
@@ -308,25 +308,25 @@ void HolomapV1::drawHoloObj(const IVec3 &angle, int32 alpha, int32 beta) {
 }
 
 void HolomapV1::renderHolomapVehicle(uint &frameNumber, ActorMoveStruct &move, AnimTimerDataStruct &animTimerData, BodyData &bodyData, AnimData &animData) {
-	const int16 newAngle = move.getRealAngle(_engine->timerRef);
+	const int16 vbeta = move.getRealAngle(_engine->timerRef);
 	if (move.timeValue == 0) {
 		_engine->_movements->initRealAngle(LBAAngles::ANGLE_0, -LBAAngles::ANGLE_90, 500, &move);
 	}
 
-	if (_engine->_animations->doSetInterAnimObjet(frameNumber, animData, bodyData, &animTimerData)) {
+	if (_engine->_animations->setInterAnimObjet(frameNumber, animData, bodyData, &animTimerData)) {
 		frameNumber++;
-		if (frameNumber >= animData.getNumKeyframes()) {
+		if (frameNumber >= animData.getNbFramesAnim()) {
 			frameNumber = animData.getLoopFrame();
 		}
 	}
-	const Common::Rect rect(0, _engine->height() - 280, 200, _engine->height() - 1);
-	_engine->_renderer->setProjection(rect.width() / 2, _engine->height() - 80, 128, 900, 900);
+	_engine->_renderer->setProjection(100, 100 + 300, 128, 900, 900);
 	_engine->_renderer->setFollowCamera(0, 0, 0, 60, 128, 0, distance(30000));
 	_engine->_renderer->setLightVector(-60, 128, 0);
 	// background of the vehicle
+	const Common::Rect rect(0, _engine->height() - 180, 200, _engine->height());
 	_engine->_interface->box(rect, COLOR_BLACK);
 	Common::Rect dummy;
-	_engine->_renderer->affObjetIso(0, 0, 0, LBAAngles::ANGLE_0, newAngle, LBAAngles::ANGLE_0, bodyData, dummy);
+	_engine->_renderer->affObjetIso(0, 0, 0, LBAAngles::ANGLE_0, vbeta, LBAAngles::ANGLE_0, bodyData, dummy);
 	_engine->copyBlockPhys(rect);
 }
 
@@ -356,7 +356,7 @@ void HolomapV1::holoTraj(int32 trajectoryIndex) {
 	const int32 cameraPosX = _engine->width() / 2 + 80;
 	const int32 cameraPosY = _engine->height() / 2;
 	_engine->_renderer->setProjection(cameraPosX, cameraPosY, 128, 1024, 1024);
-	_engine->_renderer->setFollowCamera(0, 0, 0, data->pos.x, data->pos.y, data->pos.z, distance(zDistanceTrajectory));
+	_engine->_renderer->setFollowCamera(0, 0, 0, data->angle.x, data->angle.y, data->angle.z, distance(zDistanceTrajectory));
 
 	constexpr TwineResource holomapImageRes(Resources::HQR_RESS_FILE, RESSHQR_HOLOIMG);
 	uint8 *holomapImagePtr = nullptr;
@@ -367,7 +367,7 @@ void HolomapV1::holoTraj(int32 trajectoryIndex) {
 	drawHoloMap(holomapImagePtr, holomapImageSize);
 
 	const Location &loc = _listHoloPos[data->locationIdx];
-	drawHoloObj(data->pos, loc.alpha, loc.beta);
+	drawHoloObj(data->angle, loc.alpha, loc.beta, 0);
 
 	ActorMoveStruct move;
 	AnimTimerDataStruct animTimerData;
@@ -401,26 +401,26 @@ void HolomapV1::holoTraj(int32 trajectoryIndex) {
 
 		// now render the holomap path
 		_engine->_renderer->setProjection(cameraPosX, cameraPosY, 128, 1024, 1024);
-		_engine->_renderer->setFollowCamera(0, 0, 0, data->pos.x, data->pos.y, data->pos.z, distance(zDistanceTrajectory));
-		_engine->_renderer->setLightVector(data->pos.x, data->pos.y, 0);
+		_engine->_renderer->setFollowCamera(0, 0, 0, data->angle.x, data->angle.y, data->angle.z, distance(zDistanceTrajectory));
+		_engine->_renderer->setLightVector(data->angle.x, data->angle.y, 0);
 
 		// animate the path from point 1 to point 2 by rendering a point model on each position
 		// on the globe every 40 timeunits
 		if (frameTime + 40 <= _engine->timerRef) {
 			frameTime = _engine->timerRef;
-			int32 modelX;
-			int32 modelY;
+			int32 alpha;
+			int32 beta;
 			if (trajAnimFrameIdx < data->numAnimFrames) {
-				modelX = data->positions[trajAnimFrameIdx].x;
-				modelY = data->positions[trajAnimFrameIdx].y;
+				alpha = data->positions[trajAnimFrameIdx].x;
+				beta = data->positions[trajAnimFrameIdx].y;
 			} else {
 				if (data->numAnimFrames < trajAnimFrameIdx) {
 					break;
 				}
-				modelX = loc.alpha;
-				modelY = loc.beta;
+				alpha = loc.alpha;
+				beta = loc.beta;
 			}
-			drawHoloObj(data->pos, modelX, modelY);
+			drawHoloObj(data->angle, alpha, beta, 0);
 			++trajAnimFrameIdx;
 		}
 
diff --git a/engines/twine/holomap_v1.h b/engines/twine/holomap_v1.h
index fdb3368009b..6bfc614b42c 100644
--- a/engines/twine/holomap_v1.h
+++ b/engines/twine/holomap_v1.h
@@ -80,7 +80,7 @@ private:
 	/**
 	 * Renders a holomap path with single path points appearing slowly one after another
 	 */
-	void drawHoloObj(const IVec3 &angle, int32 x, int32 y);
+	void drawHoloObj(const IVec3 &angle, int32 x, int32 y, int16 size);
 	void computeCoorGlobe(Common::SeekableReadStream *holomapSurfaceStream);
 	void computeCoorMapping();
 	void computeGlobeProj();
diff --git a/engines/twine/menu/menu.cpp b/engines/twine/menu/menu.cpp
index abd1c79c352..9ec62716524 100644
--- a/engines/twine/menu/menu.cpp
+++ b/engines/twine/menu/menu.cpp
@@ -1125,9 +1125,9 @@ void Menu::drawBehaviour(int32 left, int32 top, HeroBehaviourType behaviour, int
 
 	uint currentAnimState = _behaviourAnimState[(byte)behaviour];
 
-	if (_engine->_animations->doSetInterAnimObjet(currentAnimState, currentAnimData, *_behaviourEntity, &_behaviourAnimData[(byte)behaviour])) {
+	if (_engine->_animations->setInterAnimObjet(currentAnimState, currentAnimData, *_behaviourEntity, &_behaviourAnimData[(byte)behaviour])) {
 		currentAnimState++; // keyframe
-		if (currentAnimState >= currentAnimData.getNumKeyframes()) {
+		if (currentAnimState >= currentAnimData.getNbFramesAnim()) {
 			currentAnimState = currentAnimData.getLoopFrame();
 		}
 		_behaviourAnimState[(byte)behaviour] = currentAnimState;
diff --git a/engines/twine/parser/anim.h b/engines/twine/parser/anim.h
index 67789194bfc..87f7d5d7050 100644
--- a/engines/twine/parser/anim.h
+++ b/engines/twine/parser/anim.h
@@ -73,12 +73,12 @@ public:
 
 	const KeyFrame *getKeyframe(uint index) const;
 	const Common::Array<KeyFrame> &getKeyframes() const;
-	uint getNumKeyframes() const;
+	uint getNbFramesAnim() const;
 	uint16 getLoopFrame() const;
 	uint16 getNumBoneframes() const;
 };
 
-inline uint AnimData::getNumKeyframes() const {
+inline uint AnimData::getNbFramesAnim() const {
 	return getKeyframes().size();
 }
 
diff --git a/engines/twine/parser/holomap.cpp b/engines/twine/parser/holomap.cpp
index a6b7fb381aa..bf298d1bbb2 100644
--- a/engines/twine/parser/holomap.cpp
+++ b/engines/twine/parser/holomap.cpp
@@ -37,9 +37,9 @@ bool TrajectoryData::loadFromStream(Common::SeekableReadStream &stream, bool lba
 		data.locationIdx = stream.readSint16LE();
 		data.trajLocationIdx = stream.readSint16LE();
 		data.vehicleIdx = stream.readSint16LE();
-		data.pos.x = stream.readSint16LE();
-		data.pos.y = stream.readSint16LE();
-		data.pos.z = stream.readSint16LE();
+		data.angle.x = stream.readSint16LE();
+		data.angle.y = stream.readSint16LE();
+		data.angle.z = stream.readSint16LE();
 		data.numAnimFrames = stream.readSint16LE();
 		assert(data.numAnimFrames < ARRAYSIZE(data.positions));
 		for (int32 i = 0; i < data.numAnimFrames; ++i) {
diff --git a/engines/twine/parser/holomap.h b/engines/twine/parser/holomap.h
index f661c9d2e39..f837f610dce 100644
--- a/engines/twine/parser/holomap.h
+++ b/engines/twine/parser/holomap.h
@@ -48,7 +48,7 @@ struct Trajectory {
 	int16 locationIdx = -1;
 	int16 trajLocationIdx = -1;
 	int16 vehicleIdx = -1;
-	IVec3 pos;
+	IVec3 angle;
 	int16 numAnimFrames = 0;
 	TrajectoryPos positions[512];
 
diff --git a/engines/twine/renderer/redraw.cpp b/engines/twine/renderer/redraw.cpp
index 55de8ec6086..57722e7535f 100644
--- a/engines/twine/renderer/redraw.cpp
+++ b/engines/twine/renderer/redraw.cpp
@@ -404,7 +404,7 @@ void Redraw::processDrawListActors(const DrawListStruct &drawCmd, bool bgRedraw)
 	ActorStruct *actor = _engine->_scene->getActor(actorIdx);
 	if (actor->_anim >= 0) {
 		const AnimData &animData = _engine->_resources->_animData[actor->_anim];
-		_engine->_animations->doSetInterAnimObjet(actor->_frame, animData, actor->_entityDataPtr->getBody(actor->_body), &actor->_animTimerData);
+		_engine->_animations->setInterAnimObjet(actor->_frame, animData, actor->_entityDataPtr->getBody(actor->_body), &actor->_animTimerData);
 	}
 
 	const IVec3 &delta = actor->posObj() - _engine->_grid->_worldCube;
diff --git a/engines/twine/scene/animations.cpp b/engines/twine/scene/animations.cpp
index 5abb8120749..4b5e0ca47f2 100644
--- a/engines/twine/scene/animations.cpp
+++ b/engines/twine/scene/animations.cpp
@@ -95,7 +95,7 @@ int16 Animations::patchInterStep(int32 deltaTime, int32 keyFrameLength, int16 ne
 	return computedPos;
 }
 
-bool Animations::doSetInterAnimObjet(int32 keyframeIdx, const AnimData &animData, BodyData &bodyData, AnimTimerDataStruct *animTimerDataPtr) {
+bool Animations::setInterAnimObjet(int32 keyframeIdx, const AnimData &animData, BodyData &bodyData, AnimTimerDataStruct *animTimerDataPtr) {
 	if (!bodyData.isAnimated()) {
 		return false;
 	}
@@ -595,7 +595,7 @@ void Animations::doAnim(int32 actorIdx) {
 				processAnimActions(actorIdx);
 
 				int16 numKeyframe = actor->_frame;
-				if (numKeyframe == (int16)animData.getNumKeyframes()) {
+				if (numKeyframe == (int16)animData.getNbFramesAnim()) {
 					actor->_workFlags.bIsHitting = 0;
 
 					if (actor->_flagAnim == AnimType::kAnimationTypeRepeat) {
diff --git a/engines/twine/scene/animations.h b/engines/twine/scene/animations.h
index 54f6f5d8cbb..421ec3f698e 100644
--- a/engines/twine/scene/animations.h
+++ b/engines/twine/scene/animations.h
@@ -81,7 +81,7 @@ public:
 	 * @param bodyData Body model data
 	 * @param animTimerDataPtr Animation time data
 	 */
-	bool doSetInterAnimObjet(int32 keyframeIdx, const AnimData &animData, BodyData &bodyData, AnimTimerDataStruct *animTimerDataPtr);
+	bool setInterAnimObjet(int32 keyframeIdx, const AnimData &animData, BodyData &bodyData, AnimTimerDataStruct *animTimerDataPtr);
 
 	/**
 	 * 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 57ddabc2579..7f00c78f654 100644
--- a/engines/twine/scene/gamestate.cpp
+++ b/engines/twine/scene/gamestate.cpp
@@ -413,9 +413,9 @@ void GameState::doFoundObj(InventoryItems item) {
 		_engine->_interface->unsetClip();
 		init3DGame();
 
-		if (_engine->_animations->doSetInterAnimObjet(currentAnimState, currentAnimData, bodyData, &_engine->_scene->_sceneHero->_animTimerData)) {
+		if (_engine->_animations->setInterAnimObjet(currentAnimState, currentAnimData, bodyData, &_engine->_scene->_sceneHero->_animTimerData)) {
 			currentAnimState++; // keyframe
-			if (currentAnimState >= currentAnimData.getNumKeyframes()) {
+			if (currentAnimState >= currentAnimData.getNbFramesAnim()) {
 				currentAnimState = currentAnimData.getLoopFrame();
 			}
 		}


Commit: 1e331168d8c274fe5e75dcaebc5c08c62314cc0e
    https://github.com/scummvm/scummvm/commit/1e331168d8c274fe5e75dcaebc5c08c62314cc0e
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2024-10-10T20:41:45+02:00

Commit Message:
TWINE: fixed resetting the dark palette when entering the main menu again

Changed paths:
    engines/twine/menu/menu.cpp
    engines/twine/menu/menu.h
    engines/twine/twine.cpp


diff --git a/engines/twine/menu/menu.cpp b/engines/twine/menu/menu.cpp
index 9ec62716524..f9c984323a2 100644
--- a/engines/twine/menu/menu.cpp
+++ b/engines/twine/menu/menu.cpp
@@ -964,7 +964,7 @@ EngineState Menu::run() {
 	return EngineState::Menu;
 }
 
-int32 Menu::giveupMenu() {
+int32 Menu::quitMenu() {
 	_engine->saveFrontBuffer();
 	_engine->_sound->pauseSamples();
 
diff --git a/engines/twine/menu/menu.h b/engines/twine/menu/menu.h
index c43ae0442ba..392127e5bb5 100644
--- a/engines/twine/menu/menu.h
+++ b/engines/twine/menu/menu.h
@@ -238,7 +238,7 @@ public:
 	EngineState run();
 
 	/** Used to run the in-game give-up menu */
-	int32 giveupMenu();
+	int32 quitMenu();
 
 	void inGameOptionsMenu();
 
diff --git a/engines/twine/twine.cpp b/engines/twine/twine.cpp
index 5bb804c1285..adf3a91e05e 100644
--- a/engines/twine/twine.cpp
+++ b/engines/twine/twine.cpp
@@ -871,7 +871,7 @@ int32 TwinEEngine::toSeconds(int x) const {
 
 void TwinEEngine::processOptionsMenu() {
 	ScopedEngineFreeze scoped(this);
-	extInitSvga();
+	testRestoreModeSVGA(true) ;
 	_sound->pauseSamples();
 	_menu->inGameOptionsMenu();
 	_scene->playSceneMusic();
@@ -924,8 +924,8 @@ bool TwinEEngine::runGameEngine() { // mainLoopInteration
 		// Process give up menu - Press ESC
 		if (_input->toggleAbortAction() && _scene->_sceneHero->_lifePoint > 0 && _scene->_sceneHero->_body != -1 && !_scene->_sceneHero->_staticFlags.bIsInvisible) {
 			ScopedEngineFreeze scopedFreeze(this);
-			extInitSvga();
-			const int giveUp = _menu->giveupMenu();
+			testRestoreModeSVGA(true) ;
+			const int giveUp = _menu->quitMenu();
 			if (giveUp == kQuitEngine) {
 				return false;
 			}


Commit: 0d2faeb7cf5a6b5606e1d6ab01c2162a31080bef
    https://github.com/scummvm/scummvm/commit/0d2faeb7cf5a6b5606e1d6ab01c2162a31080bef
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2024-10-10T20:53:32+02:00

Commit Message:
TWINE: show all palettes in the debugger

Changed paths:
    engines/twine/debugger/debugtools.cpp


diff --git a/engines/twine/debugger/debugtools.cpp b/engines/twine/debugger/debugtools.cpp
index aa324a63027..6cb99cd3dab 100644
--- a/engines/twine/debugger/debugtools.cpp
+++ b/engines/twine/debugger/debugtools.cpp
@@ -178,8 +178,21 @@ static void paletteWindow(TwinEEngine *engine) {
 	ImGui::SetNextWindowSize(windowSize, ImGuiCond_FirstUseEver);
 
 	if (ImGui::Begin("Palettes", &engine->_debugState->_paletteWindow)) {
-		const Graphics::Palette &palette = engine->_frontVideoBuffer.getPalette();
-		ImGuiEx::Palette(palette);
+		if (engine->_screens->_flagPalettePcx) {
+			ImGui::Text("palettepcx is active");
+		} else {
+			ImGui::Text("ptrpal is active");
+		}
+
+		ImGui::SeparatorText("Front buffer palette");
+		const Graphics::Palette &frontBufferPalette = engine->_frontVideoBuffer.getPalette();
+		ImGuiEx::Palette(frontBufferPalette);
+
+		ImGui::SeparatorText("PalettePCX");
+		ImGuiEx::Palette(engine->_screens->_palettePcx);
+
+		ImGui::SeparatorText("Palette");
+		ImGuiEx::Palette(engine->_screens->_ptrPal);
 	}
 	ImGui::End();
 }




More information about the Scummvm-git-logs mailing list