[Scummvm-git-logs] scummvm master -> 659f143664e399d52df28021aa4e532555f3db71

mgerhardy martin.gerhardy at gmail.com
Tue Aug 3 19:12:43 UTC 2021


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

Summary:
b3e3bbc90d TWINE: replaced magic numbers
659f143664 TWINE: fixed holomap in high-res mode


Commit: b3e3bbc90df4977b2d66ca4da4ee19491b95d85e
    https://github.com/scummvm/scummvm/commit/b3e3bbc90df4977b2d66ca4da4ee19491b95d85e
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-08-03T21:12:33+02:00

Commit Message:
TWINE: replaced magic numbers

this isn't a 100% match with the disassembly - but the constants are close enough
for this use-case and gives a better feeling of the reasoning

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


diff --git a/engines/twine/renderer/renderer.cpp b/engines/twine/renderer/renderer.cpp
index f0034ce6e2..77d91b5169 100644
--- a/engines/twine/renderer/renderer.cpp
+++ b/engines/twine/renderer/renderer.cpp
@@ -1576,8 +1576,8 @@ void Renderer::fillHolomapPolygons(const Vertex &vertex1, const Vertex &vertex2,
 }
 
 void Renderer::renderHolomapVertices(const Vertex vertexCoordinates[3], const Vertex vertexAngles[3]) {
-	int32 top = 32000;
-	int32 bottom = -32000;
+	int32 top = SCENE_SIZE_MAX;
+	int32 bottom = SCENE_SIZE_MIN;
 	fillHolomapPolygons(vertexCoordinates[0], vertexCoordinates[1], vertexAngles[0], vertexAngles[1], top, bottom);
 	fillHolomapPolygons(vertexCoordinates[1], vertexCoordinates[2], vertexAngles[1], vertexAngles[2], top, bottom);
 	fillHolomapPolygons(vertexCoordinates[2], vertexCoordinates[0], vertexAngles[2], vertexAngles[0], top, bottom);


Commit: 659f143664e399d52df28021aa4e532555f3db71
    https://github.com/scummvm/scummvm/commit/659f143664e399d52df28021aa4e532555f3db71
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-08-03T21:12:33+02:00

Commit Message:
TWINE: fixed holomap in high-res mode

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


diff --git a/engines/twine/holomap.cpp b/engines/twine/holomap.cpp
index afd35dbf05..f745ce96e5 100644
--- a/engines/twine/holomap.cpp
+++ b/engines/twine/holomap.cpp
@@ -503,7 +503,9 @@ void Holomap::processHolomap() {
 
 	_engine->_text->initTextBank(TextBankId::Inventory_Intro_and_Holomap);
 	_engine->_text->setFontCrossColor(COLOR_9);
-	_engine->_renderer->setCameraPosition(_engine->width() / 2, 190, 128, 1024, 1024);
+	const int32 cameraPosX = _engine->width() / 2;
+	const int32 cameraPosY = 190;
+	_engine->_renderer->setCameraPosition(cameraPosX, cameraPosY, 128, 1024, 1024);
 
 	int32 currentLocation = _engine->_scene->_currentSceneIdx;
 	_engine->_text->drawHolomapLocation(_locations[currentLocation].textIndex);
@@ -542,21 +544,21 @@ void Holomap::processHolomap() {
 		}
 
 		if (_engine->_input->isActionActive(TwinEActionType::HolomapLeft)) {
-			xRot += ANGLE_1;
+			xRot += ANGLE_2;
 			rotate = true;
 			time = _engine->_lbaTime;
 		} else if (_engine->_input->isActionActive(TwinEActionType::HolomapRight)) {
-			xRot -= 8;
+			xRot -= ANGLE_2;
 			rotate = true;
 			time = _engine->_lbaTime;
 		}
 
 		if (_engine->_input->isActionActive(TwinEActionType::HolomapUp)) {
-			yRot += 8;
+			yRot += ANGLE_2;
 			rotate = true;
 			time = _engine->_lbaTime;
 		} else if (_engine->_input->isActionActive(TwinEActionType::HolomapDown)) {
-			yRot -= 8;
+			yRot -= ANGLE_2;
 			rotate = true;
 			time = _engine->_lbaTime;
 		}
@@ -583,7 +585,7 @@ void Holomap::processHolomap() {
 
 		if (redraw) {
 			redraw = false;
-			const Common::Rect rect(170, 0, 470, 330);
+			const Common::Rect &rect = _engine->centerOnScreenX(300, 0, 330);
 			_engine->_interface->drawFilledRect(rect, COLOR_BLACK);
 			_engine->_renderer->setBaseRotation(xRot, yRot, 0, true);
 			_engine->_renderer->setLightVector(xRot, yRot, 0);
@@ -594,7 +596,8 @@ void Holomap::processHolomap() {
 			renderLocations(xRot, yRot, 0, true);
 			drawHolomapText(_engine->width() / 2, 25, "HoloMap");
 			if (rotate) {
-				_engine->_menu->drawRectBorders(300, 170, 340, 210);
+				const Common::Rect &targetRect = _engine->centerOnScreen(40, 40);
+				_engine->_menu->drawRectBorders(targetRect.left, cameraPosY - 20, targetRect.right, cameraPosY + 20);
 			}
 		}
 
diff --git a/engines/twine/twine.cpp b/engines/twine/twine.cpp
index 64a289666b..138e3e443e 100644
--- a/engines/twine/twine.cpp
+++ b/engines/twine/twine.cpp
@@ -1159,6 +1159,14 @@ bool TwinEEngine::unlockAchievement(const Common::String &id) {
 	return AchMan.setAchievement(id);
 }
 
+Common::Rect TwinEEngine::centerOnScreenX(int32 w, int32 y, int32 h) const {
+	const int32 left = width() / 2 - w / 2;
+	const int32 right = left + w;
+	const int32 top = y;
+	const int32 bottom = top + h;
+	return Common::Rect(left, top, right, bottom);
+}
+
 Common::Rect TwinEEngine::centerOnScreen(int32 w, int32 h) const {
 	const int32 left = width() / 2 - w / 2;
 	const int32 right = left + w;
diff --git a/engines/twine/twine.h b/engines/twine/twine.h
index 713665e054..8cd06d91ff 100644
--- a/engines/twine/twine.h
+++ b/engines/twine/twine.h
@@ -300,6 +300,7 @@ public:
 	int height() const;
 	Common::Rect rect() const;
 	Common::Rect centerOnScreen(int32 w, int32 h) const;
+	Common::Rect centerOnScreenX(int32 w, int32 y, int32 h) const;
 
 	void initSceneryView();
 	void exitSceneryView();




More information about the Scummvm-git-logs mailing list