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