aboutsummaryrefslogtreecommitdiff
path: root/engines/mohawk
diff options
context:
space:
mode:
authorBastien Bouclet2018-04-24 19:57:05 +0200
committerBastien Bouclet2018-04-24 20:12:29 +0200
commitc1a12c2475ca90708b8c85ae3157f742870b0614 (patch)
tree990dbd2d57df68a943af939758ab754eb6f2bcf9 /engines/mohawk
parent00af6a9aec5f175fc548b12598eace3d42b98285 (diff)
downloadscummvm-rg350-c1a12c2475ca90708b8c85ae3157f742870b0614.tar.gz
scummvm-rg350-c1a12c2475ca90708b8c85ae3157f742870b0614.tar.bz2
scummvm-rg350-c1a12c2475ca90708b8c85ae3157f742870b0614.zip
MOHAWK: MYST: Redraw the tower angle line after the rotation completes
Fixes Trac#10499.
Diffstat (limited to 'engines/mohawk')
-rw-r--r--engines/mohawk/myst_stacks/myst.cpp32
-rw-r--r--engines/mohawk/myst_stacks/myst.h6
2 files changed, 22 insertions, 16 deletions
diff --git a/engines/mohawk/myst_stacks/myst.cpp b/engines/mohawk/myst_stacks/myst.cpp
index c63f908bda..114c9c9165 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 a74366f17c..ee89af115d 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);