In Riven, if we get a change card opcode on a mouse down event, ignore the next mouse up event so we don't misinterpret that as an event in the next card; minor cleanup.

svn-id: r49393
This commit is contained in:
Matthew Hoops 2010-06-02 15:26:35 +00:00
parent af3fec8c26
commit a8deacfc7e
4 changed files with 26 additions and 11 deletions

View File

@ -47,6 +47,7 @@ MohawkEngine_Riven::MohawkEngine_Riven(OSystem *syst, const MohawkGameDescriptio
_cardData.hasData = false;
_gameOver = false;
_activatedSLST = false;
_ignoreNextMouseUp = false;
_extrasFile = NULL;
// Attempt to let game run from the CDs
@ -147,10 +148,15 @@ Common::Error MohawkEngine_Riven::run() {
runHotspotScript(_curHotspot, kMouseDownScript);
break;
case Common::EVENT_LBUTTONUP:
if (_curHotspot >= 0)
runHotspotScript(_curHotspot, kMouseUpScript);
else
checkInventoryClick();
// See RivenScript::switchCard() for more information on why we sometimes
// disable the next up event.
if (!_ignoreNextMouseUp) {
if (_curHotspot >= 0)
runHotspotScript(_curHotspot, kMouseUpScript);
else
checkInventoryClick();
}
_ignoreNextMouseUp = false;
break;
case Common::EVENT_KEYDOWN:
switch (event.kbd.keycode) {

View File

@ -113,7 +113,6 @@ public:
Common::RandomSource *_rnd;
Card _cardData;
bool _gameOver;
GUI::Debugger *getDebugger();
@ -147,6 +146,10 @@ private:
uint32 *_vars;
uint32 _varCount;
// Miscellaneous
bool _gameOver;
bool _ignoreNextMouseUp;
public:
Common::SeekableReadStream *getExtrasResource(uint32 tag, uint16 id);
bool _activatedSLST;
@ -180,6 +183,9 @@ public:
uint32 *getLocalVar(uint32 index);
uint32 *matchVarToString(Common::String varName);
uint32 *matchVarToString(const char *varName);
void setGameOver() { _gameOver = true; }
void ignoreNextMouseUp() { _ignoreNextMouseUp = true; }
};
} // End of namespace Mohawk

View File

@ -210,7 +210,7 @@ void RivenExternal::runEndGame(uint16 video) {
_vm->_video->playMovieBlocking(video);
// TODO: Play until the last frame and then run the credits
_vm->_gameOver = true;
_vm->setGameOver();
}
void RivenExternal::runDomeButtonMovie() {

View File

@ -298,13 +298,10 @@ void RivenScript::processCommands(bool runCommands) {
// Command 1: draw tBMP resource (tbmp_id, left, top, right, bottom, u0, u1, u2, u3)
void RivenScript::drawBitmap(uint16 op, uint16 argc, uint16 *argv) {
if (argc < 5) {
// Copy the image to the whole screen, ignoring the rest of the parameters
if (argc < 5) // Copy the image to the whole screen, ignoring the rest of the parameters
_vm->_gfx->copyImageToScreen(argv[0], 0, 0, 608, 392);
} else {
// Copy the image to a certain part of the screen
else // Copy the image to a certain part of the screen
_vm->_gfx->copyImageToScreen(argv[0], argv[1], argv[2], argv[3], argv[4]);
}
// Now, update the screen
_vm->_gfx->updateScreen();
@ -313,6 +310,12 @@ void RivenScript::drawBitmap(uint16 op, uint16 argc, uint16 *argv) {
// Command 2: go to card (card id)
void RivenScript::switchCard(uint16 op, uint16 argc, uint16 *argv) {
_vm->changeToCard(argv[0]);
// WORKAROUND: If we changed card on a mouse down event,
// we want to ignore the next mouse up event so we don't
// change card when lifting the mouse on the next card.
if (_scriptType == kMouseDownScript)
_vm->ignoreNextMouseUp();
}
// Command 3: play an SLST from the script