[Scummvm-git-logs] scummvm master -> c1a12c2475ca90708b8c85ae3157f742870b0614

bgK bastien.bouclet at gmail.com
Tue Apr 24 20:12:12 CEST 2018


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:
c1a12c2475 MOHAWK: MYST: Redraw the tower angle line after the rotation completes


Commit: c1a12c2475ca90708b8c85ae3157f742870b0614
    https://github.com/scummvm/scummvm/commit/c1a12c2475ca90708b8c85ae3157f742870b0614
Author: Bastien Bouclet (bastien.bouclet at gmail.com)
Date: 2018-04-24T20:12:29+02:00

Commit Message:
MOHAWK: MYST: Redraw the tower angle line after the rotation completes

Fixes Trac#10499.

Changed paths:
    engines/mohawk/myst_stacks/myst.cpp
    engines/mohawk/myst_stacks/myst.h


diff --git a/engines/mohawk/myst_stacks/myst.cpp b/engines/mohawk/myst_stacks/myst.cpp
index c63f908..114c9c9 100644
--- a/engines/mohawk/myst_stacks/myst.cpp
+++ b/engines/mohawk/myst_stacks/myst.cpp
@@ -38,7 +38,8 @@ namespace MystStacks {
 
 Myst::Myst(MohawkEngine_Myst *vm) :
 		MystScriptParser(vm),
-		_state(_vm->_gameState->_myst) {
+		_state(_vm->_gameState->_myst),
+		_towerRotationCenter(Common::Point(383, 124)) {
 	setupOpcodes();
 
 	// Card ID preinitialized by the engine for use by opcode 18
@@ -1021,10 +1022,9 @@ void Myst::o_towerRotationStart(uint16 var, const ArgumentsArray &args) {
 
 	_vm->_cursor->setCursor(700);
 
-	const Common::Point center = Common::Point(383, 124);
-	Common::Point end = towerRotationMapComputeCoords(center, _state.towerRotationAngle);
+	Common::Point end = towerRotationMapComputeCoords(_state.towerRotationAngle);
 	towerRotationMapComputeAngle();
-	towerRotationMapDrawLine(center, end);
+	towerRotationMapDrawLine(end, true);
 
 	_vm->_sound->playEffect(5378, true);
 }
@@ -3178,7 +3178,7 @@ void Myst::towerRotationMap_run() {
 		} else {
 			// Stop blinking label
 			_towerRotationBlinkLabel = false;
-			_towerRotationMapLabel->drawConditionalDataToScreen(0);
+			towerRotationMapRedraw();
 
 			// Blink tower
 			_startTime = time + 500;
@@ -3244,18 +3244,18 @@ uint16 Myst::towerRotationMapComputeAngle() {
 	return angle;
 }
 
-Common::Point Myst::towerRotationMapComputeCoords(const Common::Point &center, uint16 angle) {
+Common::Point Myst::towerRotationMapComputeCoords(uint16 angle) {
 	Common::Point end;
 
 	// Polar to rect coords
 	double radians = angle * M_PI / 180.0;
-	end.x = (int16)(center.x + cos(radians) * 310.0);
-	end.y = (int16)(center.y + sin(radians) * 310.0);
+	end.x = (int16)(_towerRotationCenter.x + cos(radians) * 310.0);
+	end.y = (int16)(_towerRotationCenter.y + sin(radians) * 310.0);
 
 	return end;
 }
 
-void Myst::towerRotationMapDrawLine(const Common::Point &center, const Common::Point &end) {
+void Myst::towerRotationMapDrawLine(const Common::Point &end, bool rotationLabelVisible) {
 	uint32 color;
 
 	if (_vm->getFeatures() & GF_ME) {
@@ -3290,18 +3290,22 @@ void Myst::towerRotationMapDrawLine(const Common::Point &center, const Common::P
 	_towerRotationMapTower->drawConditionalDataToScreen(0, false);
 
 	// Draw label
-	_towerRotationMapLabel->drawConditionalDataToScreen(1, false);
+	_towerRotationMapLabel->drawConditionalDataToScreen(rotationLabelVisible ? 1 : 0, false);
 
 	// Draw line
-	_vm->_gfx->drawLine(center, end, color);
+	_vm->_gfx->drawLine(_towerRotationCenter, end, color);
 	_vm->_gfx->copyBackBufferToScreen(rect);
 }
 
 void Myst::towerRotationMapRotate() {
-	const Common::Point center = Common::Point(383, 124);
 	uint16 angle = towerRotationMapComputeAngle();
-	Common::Point end = towerRotationMapComputeCoords(center, angle);
-	towerRotationMapDrawLine(center, end);
+	Common::Point end = towerRotationMapComputeCoords(angle);
+	towerRotationMapDrawLine(end, true);
+}
+
+void Myst::towerRotationMapRedraw() {
+	Common::Point end = towerRotationMapComputeCoords(_state.towerRotationAngle);
+	towerRotationMapDrawLine(end, false);
 }
 
 void Myst::o_forechamberDoor_init(uint16 var, const ArgumentsArray &args) {
diff --git a/engines/mohawk/myst_stacks/myst.h b/engines/mohawk/myst_stacks/myst.h
index a74366f..ee89af1 100644
--- a/engines/mohawk/myst_stacks/myst.h
+++ b/engines/mohawk/myst_stacks/myst.h
@@ -263,6 +263,7 @@ protected:
 	uint16 _towerRotationSpeed; // 124
 	bool _towerRotationMapClicked; // 132
 	bool _towerRotationOverSpot; // 136
+	const Common::Point _towerRotationCenter;
 
 	bool _matchBurning;
 	uint16 _matchGoOutCnt;
@@ -332,10 +333,11 @@ protected:
 	void clockResetGear(uint16 gear);
 
 	void towerRotationMapRotate();
+	void towerRotationMapRedraw();
 	void towerRotationDrawBuildings();
 	uint16 towerRotationMapComputeAngle();
-	Common::Point towerRotationMapComputeCoords(const Common::Point &center, uint16 angle);
-	void towerRotationMapDrawLine(const Common::Point &center, const Common::Point &end);
+	Common::Point towerRotationMapComputeCoords(uint16 angle);
+	void towerRotationMapDrawLine(const Common::Point &end, bool rotationLabelVisible);
 
 	void boilerFireInit();
 	void boilerFireUpdate(bool init);





More information about the Scummvm-git-logs mailing list