Skip to content

Commit

Permalink
AVALANCHE: Move/rename/implement Help::plotButton().
Browse files Browse the repository at this point in the history
  • Loading branch information
uruk committed Feb 11, 2014
1 parent db2baa6 commit 6ffbbc8
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 6 deletions.
34 changes: 34 additions & 0 deletions engines/avalanche/graphics.cpp
Expand Up @@ -652,6 +652,40 @@ void GraphicManager::ghostDrawBackgroundItems(Common::File &file) {
refreshScreen();
}

/**
* @remarks Originally called 'plot_button'
*/
void GraphicManager::helpDrawButton(int y, byte which) {
if (y > 200) {
_vm->_graphics->setBackgroundColor(kColorGreen);
_vm->_system->delayMillis(10);
_vm->_graphics->setBackgroundColor(kColorBlack);
return;
}

Common::File file;

if (!file.open("buttons.avd"))
error("AVALANCHE: Help: File not found: buttons.avd");

file.seek(which * 930); // 930 is the size of one button.

Graphics::Surface button = loadPictureGraphic(file);

int x = 0;
if (y == -177) {
x = 229;
y = 5;
}
else
x = 470;

_vm->_graphics->drawPicture(_surface, button, x, y);

button.free();
file.close();
}

/**
* This function mimics Pascal's getimage().
*/
Expand Down
3 changes: 3 additions & 0 deletions engines/avalanche/graphics.h
Expand Up @@ -103,6 +103,9 @@ class GraphicManager {
void ghostDrawPicture(const Graphics::Surface &picture, uint16 destX, uint16 destY);
void ghostDrawBackgroundItems(Common::File &file);

// Help's function:
void helpDrawButton(int y, byte which);

void clearAlso();
void clearTextBar();
void setAlsoLine(int x1, int y1, int x2, int y2, Color color);
Expand Down
7 changes: 2 additions & 5 deletions engines/avalanche/help.cpp
Expand Up @@ -38,11 +38,8 @@ Help::Help(AvalancheEngine *vm) {
_highlightWas = 0;
}

void Help::plotButton(int8 y, byte which) {
warning("STUB: Help::plotButton()");
}

void Help::getMe(byte which) {
// Help icons are 80x20.

_highlightWas = 177; // Forget where the highlight was.

Expand All @@ -61,7 +58,7 @@ void Help::getMe(byte which) {
_vm->_graphics->drawFilledRectangle(Common::Rect(8, 40, 450, 200), kColorWhite);

byte index = file.readByte();
plotButton(-177, index);
_vm->_graphics->helpDrawButton(-177, index);

// Plot the title:
_vm->_graphics->drawNormalText(title, _vm->_font, 8, 629 - 8 * title.size(), 26, kColorBlack);
Expand Down
1 change: 0 additions & 1 deletion engines/avalanche/help.h
Expand Up @@ -49,7 +49,6 @@ class Help {
Button _buttons[10];
byte _highlightWas;

void plotButton(int8 y, byte which);
void getMe(byte which);
Common::String getLine(Common::File &file); // It was a nested function in getMe().
byte checkMouse(); // Returns clicked-on button, or 0 if none.
Expand Down

0 comments on commit 6ffbbc8

Please sign in to comment.