AVALANCHE: Move/rename/implement Help::plotButton().

This commit is contained in:
uruk 2014-02-11 23:10:16 +01:00
parent db2baa6f06
commit 6ffbbc8ab2
4 changed files with 39 additions and 6 deletions

View File

@ -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().
*/

View File

@ -103,6 +103,9 @@ public:
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);

View File

@ -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.
@ -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);

View File

@ -49,7 +49,6 @@ private:
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.