mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-20 08:48:13 +00:00
XEEN: Implement script opcodes for cmdCallEvent and cmdReturn
This commit is contained in:
parent
c08e54fde1
commit
fac1d0642f
@ -109,7 +109,7 @@ void Scripts::checkEvents() {
|
|||||||
// int varA = 0;
|
// int varA = 0;
|
||||||
_animCounter = 0;
|
_animCounter = 0;
|
||||||
// int var4E = 0;
|
// int var4E = 0;
|
||||||
const Common::Point pt = party._mazePosition;
|
_currentPos = party._mazePosition;
|
||||||
_charIndex = 1;
|
_charIndex = 1;
|
||||||
_v2 = 1;
|
_v2 = 1;
|
||||||
_nEdamageType = 0;
|
_nEdamageType = 0;
|
||||||
@ -127,8 +127,8 @@ void Scripts::checkEvents() {
|
|||||||
for (eventIndex = 0; eventIndex < map._events.size(); ++eventIndex) {
|
for (eventIndex = 0; eventIndex < map._events.size(); ++eventIndex) {
|
||||||
MazeEvent &event = map._events[eventIndex];
|
MazeEvent &event = map._events[eventIndex];
|
||||||
|
|
||||||
if (event._position == pt && party._mazeDirection != (pt.x | pt.y)
|
if (event._position == _currentPos && party._mazeDirection !=
|
||||||
&& event._line == _lineNum) {
|
(_currentPos.x | _currentPos.y) && event._line == _lineNum) {
|
||||||
if (event._direction == party._mazeDirection || event._direction == DIR_ALL) {
|
if (event._direction == party._mazeDirection || event._direction == DIR_ALL) {
|
||||||
_vm->_mode = MODE_9;
|
_vm->_mode = MODE_9;
|
||||||
_paramText = event._parameters.size() == 0 ? "" :
|
_paramText = event._parameters.size() == 0 ? "" :
|
||||||
@ -454,8 +454,33 @@ void Scripts::cmdConfirmWord(Common::Array<byte> ¶ms) {
|
|||||||
void Scripts::cmdDamage(Common::Array<byte> ¶ms) { error("TODO"); }
|
void Scripts::cmdDamage(Common::Array<byte> ¶ms) { error("TODO"); }
|
||||||
void Scripts::cmdJumpRnd(Common::Array<byte> ¶ms) { error("TODO"); }
|
void Scripts::cmdJumpRnd(Common::Array<byte> ¶ms) { error("TODO"); }
|
||||||
void Scripts::cmdAfterEvent(Common::Array<byte> ¶ms) { error("TODO"); }
|
void Scripts::cmdAfterEvent(Common::Array<byte> ¶ms) { error("TODO"); }
|
||||||
void Scripts::cmdCallEvent(Common::Array<byte> ¶ms) { error("TODO"); }
|
|
||||||
void Scripts::cmdReturn(Common::Array<byte> ¶ms) { error("TODO"); }
|
/**
|
||||||
|
* Stores the current location and line for later resuming, and set up to execute
|
||||||
|
* a script at a given location
|
||||||
|
*/
|
||||||
|
void Scripts::cmdCallEvent(Common::Array<byte> ¶ms) {
|
||||||
|
_stack.push(StackEntry(_currentPos, _lineNum));
|
||||||
|
_currentPos = Common::Point(params[0], params[1]);
|
||||||
|
_lineNum = params[2] - 1;
|
||||||
|
|
||||||
|
_var4F = true;
|
||||||
|
cmdNoAction(params);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return from executing a script to the script location that previously
|
||||||
|
* called the script
|
||||||
|
*/
|
||||||
|
void Scripts::cmdReturn(Common::Array<byte> ¶ms) {
|
||||||
|
StackEntry &se = _stack.top();
|
||||||
|
_currentPos = se;
|
||||||
|
_lineNum = se.line;
|
||||||
|
|
||||||
|
_var4F = true;
|
||||||
|
cmdNoAction(params);
|
||||||
|
}
|
||||||
|
|
||||||
void Scripts::cmdSetVar(Common::Array<byte> ¶ms) { error("TODO"); }
|
void Scripts::cmdSetVar(Common::Array<byte> ¶ms) { error("TODO"); }
|
||||||
void Scripts::cmdCutsceneEndClouds(Common::Array<byte> ¶ms) { error("TODO"); }
|
void Scripts::cmdCutsceneEndClouds(Common::Array<byte> ¶ms) { error("TODO"); }
|
||||||
|
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
#include "common/scummsys.h"
|
#include "common/scummsys.h"
|
||||||
#include "common/system.h"
|
#include "common/system.h"
|
||||||
#include "common/serializer.h"
|
#include "common/serializer.h"
|
||||||
|
#include "common/stack.h"
|
||||||
#include "common/str-array.h"
|
#include "common/str-array.h"
|
||||||
#include "xeen/files.h"
|
#include "xeen/files.h"
|
||||||
|
|
||||||
@ -117,6 +118,12 @@ public:
|
|||||||
void synchronize(XeenSerializer &s);
|
void synchronize(XeenSerializer &s);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct StackEntry : public Common::Point {
|
||||||
|
int line;
|
||||||
|
|
||||||
|
StackEntry(const Common::Point &pt, int l) : Common::Point(pt), line(l) {}
|
||||||
|
};
|
||||||
|
|
||||||
class Scripts {
|
class Scripts {
|
||||||
private:
|
private:
|
||||||
XeenEngine *_vm;
|
XeenEngine *_vm;
|
||||||
@ -133,6 +140,8 @@ private:
|
|||||||
int _nEdamageType;
|
int _nEdamageType;
|
||||||
Common::String _paramText;
|
Common::String _paramText;
|
||||||
MazeEvent *_event;
|
MazeEvent *_event;
|
||||||
|
Common::Point _currentPos;
|
||||||
|
Common::Stack<StackEntry> _stack;
|
||||||
|
|
||||||
void doOpcode(MazeEvent &event);
|
void doOpcode(MazeEvent &event);
|
||||||
void cmdDisplay1(Common::Array<byte> ¶ms);
|
void cmdDisplay1(Common::Array<byte> ¶ms);
|
||||||
|
Loading…
Reference in New Issue
Block a user