MOHAWK: Update the card and stack variables when entering new locations

This commit is contained in:
Bastien Bouclet 2016-08-07 11:39:12 +02:00 committed by Eugene Sandulenko
parent 05bed84a85
commit 9926475937
5 changed files with 12 additions and 4 deletions

View File

@ -42,6 +42,7 @@ RivenCard::RivenCard(MohawkEngine_Riven *vm, uint16 id) :
loadCardSoundList(id);
loadCardHotspotEnableList(id);
loadCardWaterEffectList(id);
setCurrentCardVariable();
}
RivenCard::~RivenCard() {
@ -432,6 +433,10 @@ void RivenCard::runLeaveScripts() {
_vm->_scriptMan->runScript(script, false);
}
void RivenCard::setCurrentCardVariable() {
_vm->_vars["currentcardid"] = _id;
}
RivenHotspot::RivenHotspot(MohawkEngine_Riven *vm, Common::ReadStream *stream) :
_vm(vm) {
loadFromStream(stream);

View File

@ -124,6 +124,7 @@ private:
void loadCardSoundList(uint16 id);
void loadCardHotspotEnableList(uint16 id);
void loadCardWaterEffectList(uint16 id);
void setCurrentCardVariable();
RivenScriptPtr getScript(uint16 scriptType) const;
void defaultLoadScript();

View File

@ -403,10 +403,6 @@ Common::Error RivenSaveLoad::saveGame(const int slot, const Common::String &desc
Common::String filename = buildSaveFilename(slot);
// Convert class variables to variable numbers
_vm->_vars["currentstackid"] = _vm->getStack()->getId();
_vm->_vars["currentcardid"] = _vm->getCard()->getId();
Common::OutSaveFile *saveFile = _saveFileMan->openForSaving(filename);
if (!saveFile)
return Common::kWritingFailed;

View File

@ -33,6 +33,7 @@ RivenStack::RivenStack(MohawkEngine_Riven *vm, uint16 id) :
_id(id) {
loadResourceNames();
loadCardIdMap();
setCurrentStackVariable();
}
RivenStack::~RivenStack() {
@ -116,6 +117,10 @@ uint32 RivenStack::getCurrentCardGlobalId() const {
return _cardIdMap[_vm->getCard()->getId()];
}
void RivenStack::setCurrentStackVariable() {
_vm->_vars["currentstackid"] = _id;
}
RivenNameList::RivenNameList() {
}

View File

@ -98,6 +98,7 @@ public:
private:
void loadResourceNames();
void loadCardIdMap();
void setCurrentStackVariable();
MohawkEngine_Riven *_vm;