Slightly rework refreshing cards in Riven (and remove the hackish changeToCard(0)).
svn-id: r48134
This commit is contained in:
parent
08d3c24c12
commit
e8c2c2b25c
4 changed files with 40 additions and 49 deletions
|
@ -127,16 +127,13 @@ Common::Error MohawkEngine_Riven::run() {
|
|||
needsUpdate = true;
|
||||
break;
|
||||
case Common::EVENT_LBUTTONDOWN:
|
||||
if (_curHotspot >= 0) {
|
||||
if (_curHotspot >= 0)
|
||||
runHotspotScript(_curHotspot, kMouseDownScript);
|
||||
//scheduleScript(_hotspots[_curHotspot].script, kMouseMovedPressedReleasedScript);
|
||||
}
|
||||
break;
|
||||
case Common::EVENT_LBUTTONUP:
|
||||
if (_curHotspot >= 0) {
|
||||
if (_curHotspot >= 0)
|
||||
runHotspotScript(_curHotspot, kMouseUpScript);
|
||||
//scheduleScript(_hotspots[_curHotspot].script, kMouseMovedPressedReleasedScript);
|
||||
} else
|
||||
else
|
||||
checkInventoryClick();
|
||||
break;
|
||||
case Common::EVENT_KEYDOWN:
|
||||
|
@ -156,9 +153,8 @@ Common::Error MohawkEngine_Riven::run() {
|
|||
for (uint16 i = 0; i < _hotspotCount; i++)
|
||||
_gfx->drawRect(_hotspots[i].rect, _hotspots[i].enabled);
|
||||
needsUpdate = true;
|
||||
} else {
|
||||
changeToCard();
|
||||
}
|
||||
} else
|
||||
refreshCard();
|
||||
break;
|
||||
case Common::KEYCODE_F5:
|
||||
runDialog(*_optionsDialog);
|
||||
|
@ -180,10 +176,8 @@ Common::Error MohawkEngine_Riven::run() {
|
|||
}
|
||||
}
|
||||
|
||||
if (_curHotspot >= 0) {
|
||||
if (_curHotspot >= 0)
|
||||
runHotspotScript(_curHotspot, kMouseInsideScript);
|
||||
//scheduleScript(_hotspots[_curHotspot].script, kMouseMovedPressedReleasedScript);
|
||||
}
|
||||
|
||||
if (shouldQuit()) {
|
||||
if (_eventMan->shouldRTL() && (getFeatures() & GF_DEMO) && !(_curStack == aspit && _curCard == 12)) {
|
||||
|
@ -274,13 +268,9 @@ struct RivenSpecialChange {
|
|||
{ tspit, 0x21b69, ospit, 0x2e76 } // Dome Linking Book
|
||||
};
|
||||
|
||||
void MohawkEngine_Riven::changeToCard(uint16 n) {
|
||||
bool refreshMode = (n == 0);
|
||||
|
||||
// While this could be run without harm, it doesn't need to be. This should add a speed boost.
|
||||
if (!refreshMode) {
|
||||
debug (1, "Changing to card %d", n);
|
||||
_curCard = n;
|
||||
void MohawkEngine_Riven::changeToCard(uint16 dest) {
|
||||
_curCard = dest;
|
||||
debug (1, "Changing to card %d", _curCard);
|
||||
|
||||
if (!(getFeatures() & GF_DEMO)) {
|
||||
for (byte i = 0; i < 13; i++)
|
||||
|
@ -294,9 +284,10 @@ void MohawkEngine_Riven::changeToCard(uint16 n) {
|
|||
runCardScript(kCardLeaveScript);
|
||||
|
||||
loadCard(_curCard);
|
||||
refreshCard(); // Handles hotspots and scripts
|
||||
}
|
||||
|
||||
// We need to reload hotspots when refreshing, however
|
||||
void MohawkEngine_Riven::refreshCard() {
|
||||
loadHotspots(_curCard);
|
||||
|
||||
_gfx->_updatesEnabled = true;
|
||||
|
|
|
@ -149,8 +149,9 @@ public:
|
|||
bool _activatedSLST;
|
||||
void runLoadDialog();
|
||||
|
||||
void changeToCard(uint16 = 0);
|
||||
void changeToCard(uint16 dest);
|
||||
void changeToStack(uint16);
|
||||
void refreshCard();
|
||||
Common::String getName(uint16 nameResource, uint16 nameID);
|
||||
Common::String getStackName(uint16 stack);
|
||||
void runCardScript(uint16 scriptType);
|
||||
|
|
|
@ -357,13 +357,13 @@ void RivenExternal::xtrapbookback(uint16 argc, uint16 *argv) {
|
|||
void RivenExternal::xatrapbookclose(uint16 argc, uint16 *argv) {
|
||||
// Close the trap book
|
||||
*_vm->matchVarToString("atrap") = 0;
|
||||
_vm->changeToCard(); // Refresh
|
||||
_vm->refreshCard();
|
||||
}
|
||||
|
||||
void RivenExternal::xatrapbookopen(uint16 argc, uint16 *argv) {
|
||||
// Open the trap book
|
||||
*_vm->matchVarToString("atrap") = 1;
|
||||
_vm->changeToCard(); // Refresh
|
||||
_vm->refreshCard();
|
||||
}
|
||||
|
||||
void RivenExternal::xarestoregame(uint16 argc, uint16 *argv) {
|
||||
|
@ -523,7 +523,7 @@ void RivenExternal::xbupdateboiler(uint16 argc, uint16 *argv) {
|
|||
// TODO: Stop MLST's 7 and 8
|
||||
}
|
||||
|
||||
_vm->changeToCard();
|
||||
_vm->refreshCard();
|
||||
}
|
||||
|
||||
void RivenExternal::xbsettrap(uint16 argc, uint16 *argv) {
|
||||
|
@ -659,21 +659,21 @@ void RivenExternal::xvalvecontrol(uint16 argc, uint16 *argv) {
|
|||
if (*valve == 0 && changeY <= -10) {
|
||||
*valve = 1;
|
||||
// TODO: Play movie
|
||||
_vm->changeToCard(); // Refresh
|
||||
_vm->refreshCard();
|
||||
} else if (*valve == 1) {
|
||||
if (changeX >= 0 && changeY >= 10) {
|
||||
*valve = 0;
|
||||
// TODO: Play movie
|
||||
_vm->changeToCard(); // Refresh
|
||||
_vm->refreshCard();
|
||||
} else if (changeX <= -10 && changeY <= 10) {
|
||||
*valve = 2;
|
||||
// TODO: Play movie
|
||||
_vm->changeToCard(); // Refresh
|
||||
_vm->refreshCard();
|
||||
}
|
||||
} else if (*valve == 2 && changeX >= 10) {
|
||||
*valve = 1;
|
||||
// TODO: Play movie
|
||||
_vm->changeToCard(); // Refresh
|
||||
_vm->refreshCard();
|
||||
}
|
||||
return;
|
||||
default:
|
||||
|
@ -1150,7 +1150,7 @@ void RivenExternal::xooffice30_closebook(uint16 argc, uint16 *argv) {
|
|||
|
||||
// We now need to draw PLST 1 and refresh, but PLST 1 is
|
||||
// drawn when refreshing anyway, so don't worry about that.
|
||||
_vm->changeToCard();
|
||||
_vm->refreshCard();
|
||||
}
|
||||
|
||||
void RivenExternal::xobedroom5_closedrawer(uint16 argc, uint16 *argv) {
|
||||
|
@ -1230,7 +1230,7 @@ void RivenExternal::xgwatch(uint16 argc, uint16 *argv) {
|
|||
_vm->_video->playMovieBlocking(1);
|
||||
|
||||
// And, finally, refresh
|
||||
_vm->changeToCard();
|
||||
_vm->refreshCard();
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------
|
||||
|
@ -1369,7 +1369,7 @@ void RivenExternal::xtexterior300_telescopedown(uint16 argc, uint16 *argv) {
|
|||
|
||||
// Now move the telescope down a position and refresh
|
||||
*telescopePos -= 1;
|
||||
_vm->changeToCard();
|
||||
_vm->refreshCard();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1393,7 +1393,7 @@ void RivenExternal::xtexterior300_telescopeup(uint16 argc, uint16 *argv) {
|
|||
|
||||
// Now move the telescope up a position and refresh
|
||||
*telescopePos += 1;
|
||||
_vm->changeToCard();
|
||||
_vm->refreshCard();
|
||||
}
|
||||
|
||||
void RivenExternal::xtisland390_covercombo(uint16 argc, uint16 *argv) {
|
||||
|
|
|
@ -417,17 +417,16 @@ void RivenScript::runExternalCommand(uint16 op, uint16 argc, uint16 *argv) {
|
|||
// Parameter 0: transition type
|
||||
// Parameters 1-4: transition rectangle
|
||||
void RivenScript::transition(uint16 op, uint16 argc, uint16 *argv) {
|
||||
if (argc == 1) {
|
||||
if (argc == 1)
|
||||
_vm->_gfx->scheduleTransition(argv[0]);
|
||||
} else {
|
||||
else
|
||||
_vm->_gfx->scheduleTransition(argv[0], Common::Rect(argv[1], argv[2], argv[3], argv[4]));
|
||||
}
|
||||
}
|
||||
|
||||
// Command 19: reload card
|
||||
void RivenScript::refreshCard(uint16 op, uint16 argc, uint16 *argv) {
|
||||
debug(2, "Reloading card");
|
||||
_vm->changeToCard();
|
||||
debug(2, "Refreshing card");
|
||||
_vm->refreshCard();
|
||||
}
|
||||
|
||||
// Command 20: disable screen update
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue