diff options
author | Paul Gilbert | 2015-01-21 20:42:44 -0500 |
---|---|---|
committer | Paul Gilbert | 2015-01-21 20:42:44 -0500 |
commit | 932222de7dd32ff0a0b643a2e9d756160bff27bf (patch) | |
tree | 3be023b947f38976ce24640676d51b98710f48e9 /engines/xeen/scripts.cpp | |
parent | 69ca508e8fd16e79bfa5a0f66ced3ccf9fb2dbf8 (diff) | |
download | scummvm-rg350-932222de7dd32ff0a0b643a2e9d756160bff27bf.tar.gz scummvm-rg350-932222de7dd32ff0a0b643a2e9d756160bff27bf.tar.bz2 scummvm-rg350-932222de7dd32ff0a0b643a2e9d756160bff27bf.zip |
XEEN: Skeleton beginnings of script handling
Diffstat (limited to 'engines/xeen/scripts.cpp')
-rw-r--r-- | engines/xeen/scripts.cpp | 161 |
1 files changed, 161 insertions, 0 deletions
diff --git a/engines/xeen/scripts.cpp b/engines/xeen/scripts.cpp index 55388ec343..50584a2551 100644 --- a/engines/xeen/scripts.cpp +++ b/engines/xeen/scripts.cpp @@ -22,6 +22,7 @@ #include "xeen/scripts.h" #include "xeen/party.h" +#include "xeen/xeen.h" namespace Xeen { @@ -65,9 +66,76 @@ void MazeEvents::synchronize(XeenSerializer &s) { /*------------------------------------------------------------------------*/ Scripts::Scripts(XeenEngine *vm) : _vm(vm) { + Common::fill(&_charFX[0], &_charFX[MAX_ACTIVE_PARTY], 0); + _whoWill = 0; + _itemType = 0; + _treasureItems = 0; + _treasureGold = 0; + _treasureGems = 0; + + _v2 = 0; + _nEdamageType = 0; + _animCounter = 0; + _eventSkipped = false; } void Scripts::checkEvents() { + Combat &combat = *_vm->_combat; + Interface &intf = *_vm->_interface; + Map &map = *_vm->_map; + Party &party = *_vm->_party; + + int var18 = 0; + _itemType = 0; + int var4F = 0; + bool var50 = false; + _whoWill = 0; + Mode oldMode = _vm->_mode; + Common::fill(&_charFX[0], &_charFX[MAX_ACTIVE_PARTY], 0); + int items = _treasureItems; + + if (_treasureGold & _treasureItems) { + // TODO + } else { + // TODO + } + + do { + int var4 = 0; + int varA = 0; + _animCounter = 0; + int var4E = 0; + const Common::Point pt = party._mazePosition; + int varC = 1; + _v2 = 1; + _nEdamageType = 0; + int var40 = -1; + + // Break out of the events if there's an attacking monster + if (combat._attackMonsters[0] != -1) { + _eventSkipped = true; + break; + } + + _eventSkipped = false; + + for (uint eventIndex = 0; eventIndex < map._events.size(); ++eventIndex) { + MazeEvent &event = map._events[eventIndex]; + + if (event._position == pt && party._mazeDirection != (pt.x | pt.y)) { + if (event._direction == party._mazeDirection || event._direction == DIR_ALL) { + _vm->_mode = MODE_9; + intf._interfaceText = event._parameters.size() == 0 ? "" : + map._events._text[event._parameters[0]]; + doOpcode(event._opcode, event._parameters); + + } else { + var50 = true; + } + } + } + } while (0); + // TODO } @@ -79,4 +147,97 @@ void Scripts::openGrate(int v1, int v2) { // TODO } +typedef void(Scripts::*ScriptMethodPtr)(Common::Array<byte> &); + +void Scripts::doOpcode(Opcode opcode, Common::Array<byte> ¶ms) { + static const ScriptMethodPtr COMMAND_LIST[] = { + &Scripts::cmdNone, &Scripts::cmdDisplay0x01, &Scripts::cmdDoorTextSml, + &Scripts::cmdDoorTextLrg, &Scripts::cmdSignText, + &Scripts::cmdNPC, &Scripts::cmdPlayFX, &Scripts::cmdTeleportAndExit, + &Scripts::cmdIf1, &Scripts::cmdIf2, &Scripts::cmdIf3, + &Scripts::cmdMoveObj, &Scripts::cmdTakeOrGive, &Scripts::cmdNoAction, + &Scripts::cmdRemove, &Scripts::cmdSetChar, &Scripts::cmdSpawn, + &Scripts::cmdDoTownEvent, &Scripts::cmdExit, &Scripts::cmdAfterMap, + &Scripts::cmdGiveExtended, &Scripts::cmdConfirmWord, &Scripts::cmdDamage, + &Scripts::cmdJumpRnd, &Scripts::cmdAfterEvent, &Scripts::cmdCallEvent, + &Scripts::cmdReturn, &Scripts::cmdSetVar, &Scripts::cmdTakeOrGive2, + &Scripts::cmdTakeOrGive3, &Scripts::cmdCutsceneEndClouds, + &Scripts::cmdTeleportAndContinue, &Scripts::cmdWhoWill, + &Scripts::cmdRndDamage, &Scripts::cmdMoveWallObj, &Scripts::cmdAlterCellFlag, + &Scripts::cmdAlterHed, &Scripts::cmdDisplayStat, &Scripts::cmdTakeOrGive4, + &Scripts::cmdSeatTextSml, &Scripts::cmdPlayEventVoc, &Scripts::cmdDisplayBottom, + &Scripts::cmdIfMapFlag, &Scripts::cmdSelRndChar, &Scripts::cmdGiveEnchanted, + &Scripts::cmdItemType, &Scripts::cmdMakeNothingHere, &Scripts::cmdNoAction2, + &Scripts::cmdChooseNumeric, &Scripts::cmdDisplayBottomTwoLines, + &Scripts::cmdDisplayLarge, &Scripts::cmdExchObj, &Scripts::cmdFallToMap, + &Scripts::cmdDisplayMain, &Scripts::cmdGoto, &Scripts::cmdConfirmWord2, + &Scripts::cmdGotoRandom, &Scripts::cmdCutsceneEndDarkside, + &Scripts::cmdCutsceneEdWorld, &Scripts::cmdFlipWorld, &Scripts::cmdPlayCD + }; + + (this->*COMMAND_LIST[opcode])(params); +} + +void Scripts::cmdNone(Common::Array<byte> ¶ms) {} +void Scripts::cmdDisplay0x01(Common::Array<byte> ¶ms) {} +void Scripts::cmdDoorTextSml(Common::Array<byte> ¶ms) {} +void Scripts::cmdDoorTextLrg(Common::Array<byte> ¶ms) {} +void Scripts::cmdSignText(Common::Array<byte> ¶ms) {} +void Scripts::cmdNPC(Common::Array<byte> ¶ms) {} +void Scripts::cmdPlayFX(Common::Array<byte> ¶ms) {} +void Scripts::cmdTeleportAndExit(Common::Array<byte> ¶ms) {} +void Scripts::cmdIf1(Common::Array<byte> ¶ms) {} +void Scripts::cmdIf2(Common::Array<byte> ¶ms) {} +void Scripts::cmdIf3(Common::Array<byte> ¶ms) {} +void Scripts::cmdMoveObj(Common::Array<byte> ¶ms) {} +void Scripts::cmdTakeOrGive(Common::Array<byte> ¶ms) {} +void Scripts::cmdNoAction(Common::Array<byte> ¶ms) {} +void Scripts::cmdRemove(Common::Array<byte> ¶ms) {} +void Scripts::cmdSetChar(Common::Array<byte> ¶ms) {} +void Scripts::cmdSpawn(Common::Array<byte> ¶ms) {} +void Scripts::cmdDoTownEvent(Common::Array<byte> ¶ms) {} +void Scripts::cmdExit(Common::Array<byte> ¶ms) {} +void Scripts::cmdAfterMap(Common::Array<byte> ¶ms) {} +void Scripts::cmdGiveExtended(Common::Array<byte> ¶ms) {} +void Scripts::cmdConfirmWord(Common::Array<byte> ¶ms) {} +void Scripts::cmdDamage(Common::Array<byte> ¶ms) {} +void Scripts::cmdJumpRnd(Common::Array<byte> ¶ms) {} +void Scripts::cmdAfterEvent(Common::Array<byte> ¶ms) {} +void Scripts::cmdCallEvent(Common::Array<byte> ¶ms) {} +void Scripts::cmdReturn(Common::Array<byte> ¶ms) {} +void Scripts::cmdSetVar(Common::Array<byte> ¶ms) {} +void Scripts::cmdTakeOrGive2(Common::Array<byte> ¶ms) {} +void Scripts::cmdTakeOrGive3(Common::Array<byte> ¶ms) {} +void Scripts::cmdCutsceneEndClouds(Common::Array<byte> ¶ms) {} +void Scripts::cmdTeleportAndContinue(Common::Array<byte> ¶ms) {} +void Scripts::cmdWhoWill(Common::Array<byte> ¶ms) {} +void Scripts::cmdRndDamage(Common::Array<byte> ¶ms) {} +void Scripts::cmdMoveWallObj(Common::Array<byte> ¶ms) {} +void Scripts::cmdAlterCellFlag(Common::Array<byte> ¶ms) {} +void Scripts::cmdAlterHed(Common::Array<byte> ¶ms) {} +void Scripts::cmdDisplayStat(Common::Array<byte> ¶ms) {} +void Scripts::cmdTakeOrGive4(Common::Array<byte> ¶ms) {} +void Scripts::cmdSeatTextSml(Common::Array<byte> ¶ms) {} +void Scripts::cmdPlayEventVoc(Common::Array<byte> ¶ms) {} +void Scripts::cmdDisplayBottom(Common::Array<byte> ¶ms) {} +void Scripts::cmdIfMapFlag(Common::Array<byte> ¶ms) {} +void Scripts::cmdSelRndChar(Common::Array<byte> ¶ms) {} +void Scripts::cmdGiveEnchanted(Common::Array<byte> ¶ms) {} +void Scripts::cmdItemType(Common::Array<byte> ¶ms) {} +void Scripts::cmdMakeNothingHere(Common::Array<byte> ¶ms) {} +void Scripts::cmdNoAction2(Common::Array<byte> ¶ms) {} +void Scripts::cmdChooseNumeric(Common::Array<byte> ¶ms) {} +void Scripts::cmdDisplayBottomTwoLines(Common::Array<byte> ¶ms) {} +void Scripts::cmdDisplayLarge(Common::Array<byte> ¶ms) {} +void Scripts::cmdExchObj(Common::Array<byte> ¶ms) {} +void Scripts::cmdFallToMap(Common::Array<byte> ¶ms) {} +void Scripts::cmdDisplayMain(Common::Array<byte> ¶ms) {} +void Scripts::cmdGoto(Common::Array<byte> ¶ms) {} +void Scripts::cmdConfirmWord2(Common::Array<byte> ¶ms) {} +void Scripts::cmdGotoRandom(Common::Array<byte> ¶ms) {} +void Scripts::cmdCutsceneEndDarkside(Common::Array<byte> ¶ms) {} +void Scripts::cmdCutsceneEdWorld(Common::Array<byte> ¶ms) {} +void Scripts::cmdFlipWorld(Common::Array<byte> ¶ms) {} +void Scripts::cmdPlayCD(Common::Array<byte> ¶ms) {} + } // End of namespace Xeen |