diff options
author | Paul Gilbert | 2015-01-21 21:51:45 -0500 |
---|---|---|
committer | Paul Gilbert | 2015-01-21 21:51:45 -0500 |
commit | 1b264ed299fd87262c2cf228418ec606fdf75646 (patch) | |
tree | c0732dba737da7b3ea74d3530138c610245018fc /engines/xeen | |
parent | 932222de7dd32ff0a0b643a2e9d756160bff27bf (diff) | |
download | scummvm-rg350-1b264ed299fd87262c2cf228418ec606fdf75646.tar.gz scummvm-rg350-1b264ed299fd87262c2cf228418ec606fdf75646.tar.bz2 scummvm-rg350-1b264ed299fd87262c2cf228418ec606fdf75646.zip |
XEEN: Implemented the first few script commands
Diffstat (limited to 'engines/xeen')
-rw-r--r-- | engines/xeen/interface.cpp | 5 | ||||
-rw-r--r-- | engines/xeen/interface.h | 5 | ||||
-rw-r--r-- | engines/xeen/scripts.cpp | 125 | ||||
-rw-r--r-- | engines/xeen/scripts.h | 16 |
4 files changed, 98 insertions, 53 deletions
diff --git a/engines/xeen/interface.cpp b/engines/xeen/interface.cpp index e31b9e240a..4b4e88afec 100644 --- a/engines/xeen/interface.cpp +++ b/engines/xeen/interface.cpp @@ -734,7 +734,10 @@ void Interface::draw3d(bool updateFlag) { assembleBorder(); - // TODO: write strings + // Draw any on-screen text if flagged to do so + if (_upDoorText && combat._attackMonsters[0] == -1) { + screen._windows[3].writeString(_screenText); + } if (updateFlag) { screen._windows[1].update(); diff --git a/engines/xeen/interface.h b/engines/xeen/interface.h index 37ac7be5be..87edb02c5d 100644 --- a/engines/xeen/interface.h +++ b/engines/xeen/interface.h @@ -71,8 +71,8 @@ private: bool _isAnimReset; byte _tillMove; int _overallFrame; - bool _upDoorText; int _steppingFX; + Common::String _interfaceText; void initDrawStructs(); @@ -105,7 +105,8 @@ private: bool checkMoveDirection(int key); public: int _intrIndex1; - Common::String _interfaceText; + Common::String _screenText; + bool _upDoorText; public: Interface(XeenEngine *vm); diff --git a/engines/xeen/scripts.cpp b/engines/xeen/scripts.cpp index 50584a2551..44b5cb325e 100644 --- a/engines/xeen/scripts.cpp +++ b/engines/xeen/scripts.cpp @@ -87,7 +87,7 @@ void Scripts::checkEvents() { int var18 = 0; _itemType = 0; - int var4F = 0; + _var4F = 0; bool var50 = false; _whoWill = 0; Mode oldMode = _vm->_mode; @@ -101,7 +101,7 @@ void Scripts::checkEvents() { } do { - int var4 = 0; + _lineNum = 0; int varA = 0; _animCounter = 0; int var4E = 0; @@ -111,28 +111,33 @@ void Scripts::checkEvents() { _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]; + while (_lineNum >= 0) { + // Break out of the events if there's an attacking monster + if (combat._attackMonsters[0] != -1) { + _eventSkipped = true; + break; + } - 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); + _eventSkipped = false; + uint eventIndex; + for (eventIndex = 0; eventIndex < map._events.size(); ++eventIndex) { + MazeEvent &event = map._events[eventIndex]; - } else { - var50 = true; + if (event._position == pt && party._mazeDirection != (pt.x | pt.y) + && event._line == _lineNum) { + if (event._direction == party._mazeDirection || event._direction == DIR_ALL) { + _vm->_mode = MODE_9; + _paramText = event._parameters.size() == 0 ? "" : + map._events._text[event._parameters[0]]; + doOpcode(event._opcode, event._parameters); + break; + } else { + var50 = true; + } } } + if (eventIndex == map._events.size()) + break; } } while (0); @@ -151,20 +156,20 @@ 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, + nullptr, &Scripts::cmdDisplay1, &Scripts::cmdDoorTextSml, &Scripts::cmdDoorTextLrg, &Scripts::cmdSignText, - &Scripts::cmdNPC, &Scripts::cmdPlayFX, &Scripts::cmdTeleportAndExit, - &Scripts::cmdIf1, &Scripts::cmdIf2, &Scripts::cmdIf3, + &Scripts::cmdNPC, &Scripts::cmdPlayFX, &Scripts::cmdTeleport, + &Scripts::cmdIf, &Scripts::cmdIf, &Scripts::cmdIf, &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::cmdReturn, &Scripts::cmdSetVar, &Scripts::cmdTakeOrGive, + &Scripts::cmdTakeOrGive, &Scripts::cmdCutsceneEndClouds, + &Scripts::cmdTeleport, &Scripts::cmdWhoWill, &Scripts::cmdRndDamage, &Scripts::cmdMoveWallObj, &Scripts::cmdAlterCellFlag, - &Scripts::cmdAlterHed, &Scripts::cmdDisplayStat, &Scripts::cmdTakeOrGive4, + &Scripts::cmdAlterHed, &Scripts::cmdDisplayStat, &Scripts::cmdTakeOrGive, &Scripts::cmdSeatTextSml, &Scripts::cmdPlayEventVoc, &Scripts::cmdDisplayBottom, &Scripts::cmdIfMapFlag, &Scripts::cmdSelRndChar, &Scripts::cmdGiveEnchanted, &Scripts::cmdItemType, &Scripts::cmdMakeNothingHere, &Scripts::cmdNoAction2, @@ -178,20 +183,64 @@ void Scripts::doOpcode(Opcode opcode, Common::Array<byte> ¶ms) { (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) {} +/** + * Display a msesage on-screen + */ +void Scripts::cmdDisplay1(Common::Array<byte> ¶ms) { + Screen &screen = *_vm->_screen; + Common::String msg = Common::String::format("\r\x03c%s", _paramText.c_str()); + + screen._windows[12].close(); + if (screen._windows[38]._enabled) + screen._windows[38].open(); + screen._windows[38].writeString(msg); + screen._windows[38].update(); + + _var4F = true; + cmdNoAction(params); +} + +/** + * Displays a door text message using the small font + */ +void Scripts::cmdDoorTextSml(Common::Array<byte> ¶ms) { + Interface &intf = *_vm->_interface; + intf._screenText = Common::String::format("\x02\f08\x03c\t116\v025%s\x03l\fd\x01", + _paramText.c_str()); + intf._upDoorText = true; + intf.draw3d(true); + _var4F = true; + + cmdNoAction(params); +} + +/** + * Displays a door text message using the large font + */ +void Scripts::cmdDoorTextLrg(Common::Array<byte> ¶ms) { + Interface &intf = *_vm->_interface; + intf._screenText = Common::String::format("\f04\x03c\t116\v030%s\x03l\fd", + _paramText.c_str()); + intf._upDoorText = true; + intf.draw3d(true); + _var4F = true; + + cmdNoAction(params); +} + 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::cmdTeleport(Common::Array<byte> ¶ms) {} +void Scripts::cmdIf(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::cmdNoAction(Common::Array<byte> ¶ms) { + // Move to next line + _lineNum = _vm->_party->_partyDead ? -1 : _lineNum + 1; +} + void Scripts::cmdRemove(Common::Array<byte> ¶ms) {} void Scripts::cmdSetChar(Common::Array<byte> ¶ms) {} void Scripts::cmdSpawn(Common::Array<byte> ¶ms) {} @@ -206,17 +255,13 @@ 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) {} diff --git a/engines/xeen/scripts.h b/engines/xeen/scripts.h index 2fbcf78b38..9690887a16 100644 --- a/engines/xeen/scripts.h +++ b/engines/xeen/scripts.h @@ -126,22 +126,22 @@ private: int _treasureItems; int _treasureGold; int _treasureGems; + int _lineNum; int _v2; + int _var4F; int _nEdamageType; + Common::String _paramText; void doOpcode(Opcode opcode, Common::Array<byte> ¶ms); - void cmdNone(Common::Array<byte> ¶ms); - void cmdDisplay0x01(Common::Array<byte> ¶ms); + void cmdDisplay1(Common::Array<byte> ¶ms); void cmdDoorTextSml(Common::Array<byte> ¶ms); void cmdDoorTextLrg(Common::Array<byte> ¶ms); void cmdSignText(Common::Array<byte> ¶ms); void cmdNPC(Common::Array<byte> ¶ms); void cmdPlayFX(Common::Array<byte> ¶ms); - void cmdTeleportAndExit(Common::Array<byte> ¶ms); - void cmdIf1(Common::Array<byte> ¶ms); - void cmdIf2(Common::Array<byte> ¶ms); - void cmdIf3(Common::Array<byte> ¶ms); + void cmdTeleport(Common::Array<byte> ¶ms); + void cmdIf(Common::Array<byte> ¶ms); void cmdMoveObj(Common::Array<byte> ¶ms); void cmdTakeOrGive(Common::Array<byte> ¶ms); void cmdNoAction(Common::Array<byte> ¶ms); @@ -159,17 +159,13 @@ private: void cmdCallEvent(Common::Array<byte> ¶ms); void cmdReturn(Common::Array<byte> ¶ms); void cmdSetVar(Common::Array<byte> ¶ms); - void cmdTakeOrGive2(Common::Array<byte> ¶ms); - void cmdTakeOrGive3(Common::Array<byte> ¶ms); void cmdCutsceneEndClouds(Common::Array<byte> ¶ms); - void cmdTeleportAndContinue(Common::Array<byte> ¶ms); void cmdWhoWill(Common::Array<byte> ¶ms); void cmdRndDamage(Common::Array<byte> ¶ms); void cmdMoveWallObj(Common::Array<byte> ¶ms); void cmdAlterCellFlag(Common::Array<byte> ¶ms); void cmdAlterHed(Common::Array<byte> ¶ms); void cmdDisplayStat(Common::Array<byte> ¶ms); - void cmdTakeOrGive4(Common::Array<byte> ¶ms); void cmdSeatTextSml(Common::Array<byte> ¶ms); void cmdPlayEventVoc(Common::Array<byte> ¶ms); void cmdDisplayBottom(Common::Array<byte> ¶ms); |