PARALLACTION: implement most of BRA 'swap' command.

I left out follower adjustments (need to find where it's used),
and mouse pointer swap.
This commit is contained in:
peres 2021-06-27 11:47:24 +09:00 committed by Filippos Karapetis
parent bfb795b66e
commit 1474d02f25
3 changed files with 32 additions and 2 deletions

View File

@ -272,7 +272,29 @@ DECLARE_COMMAND_OPCODE(scroll) {
DECLARE_COMMAND_OPCODE(swap) {
warning("Parallaction_br::cmdOp_swap not yet implemented");
warning("Parallaction_br::cmdOp_swap does not handle a follower yet");
/*
TODO:
- fixup follower
- change mouse pointer
*/
const char *newCharacterName = ctxt._cmd->_string.c_str();
AnimationPtr newCharacterAnimation = _vm->_location.findAnimation(newCharacterName);
AnimationPtr oldCharaterAnimation = _vm->_char._ani;
strlcpy(oldCharaterAnimation->_name, _vm->_char.getName(), ZONENAME_LENGTH);
_vm->_char.setName(newCharacterName);
_vm->_char._ani = newCharacterAnimation;
_vm->_char._talk = _vm->_disk->loadTalk(newCharacterName);
strlcpy(_vm->_char._ani->_name, "yourself", ZONENAME_LENGTH);
_vm->linkUnlinkedZoneAnimations();
_vm->_inventory = _vm->findInventory(newCharacterName);
_vm->_inventoryRenderer->setInventory(_vm->_inventory);
}

View File

@ -512,6 +512,7 @@ public:
void clearSubtitles();
Inventory *findInventory(const char *name);
void linkUnlinkedZoneAnimations();
void testCounterCondition(const Common::String &name, int op, int value);
void restoreOrSaveZoneFlags(ZonePtr z, bool restore);

View File

@ -456,7 +456,14 @@ void Parallaction_br::loadProgram(AnimationPtr a, const char *filename) {
return;
}
void Parallaction_br::linkUnlinkedZoneAnimations() {
ZoneList::iterator zit = _location._zones.begin();
for ( ; zit != _location._zones.end(); ++zit) {
if ((*zit)->_flags & kFlagsActive) {
(*zit)->_linkedAnim = _location.findAnimation((*zit)->_linkedName.c_str());
}
}
}
void Parallaction_br::changeCharacter(const char *name) {