Skip to content

Commit

Permalink
ACCESS: Finish the implementation of cmdHelp (still a redraw issue)
Browse files Browse the repository at this point in the history
  • Loading branch information
Strangerke authored and dreammaster committed Dec 13, 2014
1 parent 3f44538 commit 2735101
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 5 deletions.
4 changes: 2 additions & 2 deletions engines/access/amazon/amazon_game.cpp
Expand Up @@ -726,7 +726,7 @@ void AmazonEngine::drawHelpText(const Common::String &msg) {
_events->showCursor();
}

void AmazonEngine::drawHelp() {
void AmazonEngine::drawHelp(const Common::String str) {
_events->hideCursor();
if (_useItem == 0) {
_buffer2.copyBuffer(_screen);
Expand Down Expand Up @@ -760,7 +760,7 @@ void AmazonEngine::drawHelp() {
_screen->fadeIn();

helpTitle();
drawHelpText("TODO: WHICH BUFFER?");
drawHelpText(str);
}

void AmazonEngine::startChapter(int chapter) {
Expand Down
2 changes: 1 addition & 1 deletion engines/access/amazon/amazon_game.h
Expand Up @@ -197,7 +197,7 @@ class AmazonEngine : public AccessEngine {
*/
void freeInactivePlayer();

void drawHelp();
void drawHelp(const Common::String str);

virtual void establish(int esatabIndex, int sub);

Expand Down
4 changes: 4 additions & 0 deletions engines/access/amazon/amazon_resources.cpp
Expand Up @@ -1772,6 +1772,10 @@ RiverStruct *RIVEROBJECTTBL[6] = {
ENDRIVER1, RIVER2OBJECTS, ENDRIVER2
};

const int HELP1COORDS[2][4] = {
{ 76, 129, 168, 183 }, { 187, 240, 168, 183 }
};

} // End of namespace Amazon

} // End of namespace Access
1 change: 1 addition & 0 deletions engines/access/amazon/amazon_resources.h
Expand Up @@ -126,6 +126,7 @@ extern RiverStruct RIVER2OBJECTS[53];
extern RiverStruct ENDRIVER2[1];

extern RiverStruct *RIVEROBJECTTBL[6];
extern const int HELP1COORDS[2][4];

} // End of namespace Amazon

Expand Down
47 changes: 45 additions & 2 deletions engines/access/amazon/amazon_scripts.cpp
Expand Up @@ -1887,8 +1887,51 @@ void AmazonScripts::cmdHelp() {
if (level < _game->_helpLevel)
_game->_moreHelp = 0;

_game->drawHelp();
error("TODO: more cmdHelp");
_game->drawHelp(helpMessage);

while(true) {
while(!_vm->shouldQuit() && !_vm->_events->_leftButton)
_vm->_events->pollEventsAndWait();

_vm->_events->debounceLeft();

static const Common::Rect butn1 = Common::Rect(HELP1COORDS[0][0], HELP1COORDS[0][2], HELP1COORDS[0][1], HELP1COORDS[0][3]);
static const Common::Rect butn2 = Common::Rect(HELP1COORDS[1][0], HELP1COORDS[1][2], HELP1COORDS[1][1], HELP1COORDS[1][3]);
const Common::Point pt = _vm->_events->_mousePos;

int choice = -1;
if (butn1.contains(pt))
choice = 0;
else if (butn2.contains(pt))
choice = 1;

if (choice < 0)
continue;

if (choice == 1) {
_game->_helpLevel = 0;
_game->_moreHelp = 1;
_game->_useItem = 0;
_vm->_events->hideCursor();
_vm->_screen->restoreScreen();
_vm->_screen->setPanel(0);
_vm->_buffer2.copyFrom(*_vm->_screen);
_vm->_screen->restorePalette();
_vm->_screen->setPalette();
_vm->_events->showCursor();
free(_vm->_objectsTable[45]);
_vm->_objectsTable[45] = nullptr;
_vm->_timers.restoreTimers();
break;
} else {
if ((_game->_moreHelp == 0) || (choice != 0))
continue;
++_game->_helpLevel;
_game->_useItem = 1;
break;
}
}
findNull();
}

void AmazonScripts::cmdCycleBack() {
Expand Down

0 comments on commit 2735101

Please sign in to comment.