diff options
-rw-r--r-- | engines/avalanche/avalot.cpp | 17 | ||||
-rw-r--r-- | engines/avalanche/avalot.h | 2 | ||||
-rw-r--r-- | engines/avalanche/graphics.cpp | 9 | ||||
-rw-r--r-- | engines/avalanche/graphics.h | 2 | ||||
-rw-r--r-- | engines/avalanche/menu.cpp | 3 |
5 files changed, 21 insertions, 12 deletions
diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 6622a8d4e8..c73208ca61 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -201,13 +201,12 @@ void Clock::update() { // TODO: Move variables from Gyro to here (or at least so _oldMinute = _minute; } -void Clock::calcHand(uint16 angle, uint16 length, Common::Point &endPoint, Color color) { +Common::Point Clock::calcHand(uint16 angle, uint16 length, Color color) { if (angle > 900) { - endPoint.x = 177; - return; + return(Common::Point(177, 177)); } - endPoint = _vm->_graphics->drawArc(_vm->_graphics->_surface, kCenterX, kCenterY, 449 - angle, 450 - angle, length, color); + return(_vm->_graphics->drawArc(_vm->_graphics->_surface, kCenterX, kCenterY, 449 - angle, 450 - angle, length, color)); } void Clock::drawHand(const Common::Point &endPoint, Color color) { @@ -218,13 +217,13 @@ void Clock::drawHand(const Common::Point &endPoint, Color color) { } void Clock::plotHands() { - calcHand(_oldHourAngle, 14, _clockHandHour, kColorYellow); - calcHand(_oldMinute * 6, 17, _clockHandMinute, kColorYellow); + _clockHandHour = calcHand(_oldHourAngle, 14, kColorYellow); + _clockHandMinute = calcHand(_oldMinute * 6, 17, kColorYellow); drawHand(_clockHandHour, kColorBrown); drawHand(_clockHandMinute, kColorBrown); - calcHand(_hourAngle, 14, _clockHandHour, kColorBrown); - calcHand(_minute * 6, 17, _clockHandMinute, kColorBrown); + _clockHandHour = calcHand(_hourAngle, 14, kColorBrown); + _clockHandMinute = calcHand(_minute * 6, 17, kColorBrown); drawHand(_clockHandHour, kColorYellow); drawHand(_clockHandMinute, kColorYellow); } @@ -1142,7 +1141,7 @@ void AvalancheEngine::incScore(byte num) { } void AvalancheEngine::useCompass(const Common::Point &cursorPos) { - byte color = *(byte *)_graphics->_surface.getBasePtr(cursorPos.x, cursorPos.y / 2); + byte color = _graphics->getScreenColor(cursorPos); switch (color) { case kColorGreen: diff --git a/engines/avalanche/avalot.h b/engines/avalanche/avalot.h index 189b9cb488..6c5ef3155b 100644 --- a/engines/avalanche/avalot.h +++ b/engines/avalanche/avalot.h @@ -57,7 +57,7 @@ private: uint16 _hour, _minute, _second, _hourAngle, _oldHour, _oldMinute, _oldHourAngle; Common::Point _clockHandHour, _clockHandMinute; - void calcHand(uint16 angle, uint16 length, Common::Point &endPoint, Color color); + Common::Point calcHand(uint16 angle, uint16 length, Color color); void drawHand(const Common::Point &endPoint, Color color); void plotHands(); void chime(); diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index 77113ee54b..c4846d573c 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -372,6 +372,11 @@ void GraphicManager::drawMenuBlock(int x1, int y1, int x2, int y2, Color color) _surface.fillRect(Common::Rect(x1, y1, x2, y2), color); } +void GraphicManager::drawMenuItem(int x1, int y1, int x2, int y2) { + _surface.fillRect(Common::Rect(x1, y1, x2, y2), kMenuBackgroundColor); + _surface.frameRect(Common::Rect(x1 - 1, y1 - 1, x2 + 1, y2 + 1), kMenuBorderColor); +} + void GraphicManager::drawSpeedBar(int speed) { if (speed == _vm->kRun) { _surface.drawLine(336, 199, 338, 199, kColorLightblue); @@ -487,6 +492,10 @@ byte GraphicManager::getAlsoColor(int x1, int y1, int x2, int y2) { return returnColor; } +byte GraphicManager::getScreenColor(Common::Point pos) { + return *(byte *)_surface.getBasePtr(pos.x, pos.y / 2); +} + void GraphicManager::drawSprite(const SpriteInfo &sprite, byte picnum, int16 x, int16 y) { // First we make the pixels of the sprite blank. for (int j = 0; j < sprite._yLength; j++) { diff --git a/engines/avalanche/graphics.h b/engines/avalanche/graphics.h index 383370d87b..7af1f8a8b0 100644 --- a/engines/avalanche/graphics.h +++ b/engines/avalanche/graphics.h @@ -85,6 +85,7 @@ public: void drawSpeedBar(int speed); void drawBackgroundSprite(int16 x, int16 y, SpriteType &sprite); void drawMenuBlock(int x1, int y1, int x2, int y2, Color color); + void drawMenuItem(int x1, int y1, int x2, int y2); void wipeChar(int x, int y, Color color); void drawChar(byte ander, int x, int y, Color color); @@ -92,6 +93,7 @@ public: void clearTextBar(); void setAlsoLine(int x1, int y1, int x2, int y2, Color color); byte getAlsoColor(int x1, int y1, int x2, int y2); + byte getScreenColor(Common::Point pos); // The caller has to .free() the returned Surfaces!!! // Further information about these two: http://www.shikadi.net/moddingwiki/Raw_EGA_data diff --git a/engines/avalanche/menu.cpp b/engines/avalanche/menu.cpp index 21ed2d5813..f1c638913e 100644 --- a/engines/avalanche/menu.cpp +++ b/engines/avalanche/menu.cpp @@ -128,8 +128,7 @@ void MenuItem::display() { _activeNow = true; _dr->_menuActive = true; - _dr->_vm->_graphics->_surface.fillRect(Common::Rect((_flx1 + 1) * 8, 12, (_flx2 + 1) * 8, _fly), kMenuBackgroundColor); - _dr->_vm->_graphics->_surface.frameRect(Common::Rect((_flx1 + 1) * 8 - 1, 11, (_flx2 + 1) * 8 + 1, _fly + 1), kMenuBorderColor); + _dr->_vm->_graphics->drawMenuItem((_flx1 + 1) * 8, 12, (_flx2 + 1) * 8, _fly); displayOption(0, true); for (int y = 1; y < _optionNum; y++) |