aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/illusions/actor.cpp4
-rw-r--r--engines/illusions/illusions.cpp32
-rw-r--r--engines/illusions/illusions.h2
-rw-r--r--engines/illusions/sequenceopcodes.cpp5
-rw-r--r--engines/illusions/sequenceopcodes.h1
5 files changed, 37 insertions, 7 deletions
diff --git a/engines/illusions/actor.cpp b/engines/illusions/actor.cpp
index 75b49004b6..97c8dc0e61 100644
--- a/engines/illusions/actor.cpp
+++ b/engines/illusions/actor.cpp
@@ -700,11 +700,9 @@ void Control::startMoveActor(uint32 sequenceId, Common::Point destPt, uint32 cal
// TODO _actor->_field_C0 = destPt.x;
// TODO _actor->_field_C2 = destPt.y;
- /* TODO
uint newFacing;
- if (calcPointDirection(_actor->_position, destPt, newFacing))
+ if (_vm->calcPointDirection(_actor->_position, destPt, newFacing))
faceActor(newFacing);
- */
if (actorType->_value1E)
_actor->_pathCtrY = actorType->_value1E;
diff --git a/engines/illusions/illusions.cpp b/engines/illusions/illusions.cpp
index 684314e2cb..a024b8da94 100644
--- a/engines/illusions/illusions.cpp
+++ b/engines/illusions/illusions.cpp
@@ -349,10 +349,36 @@ uint32 IllusionsEngine::getPriorityFromBase(int16 priority) {
return 32000000 * priority;
}
-bool IllusionsEngine::calcPointDirection(Common::Point &pos1, Common::Point &pos2, uint &facing) {
- // TODO
+bool IllusionsEngine::calcPointDirection(Common::Point &srcPt, Common::Point &dstPt, uint &facing) {
facing = 0;
- return false;
+ uint xd = 0, yd = 0;
+ if (srcPt.x < dstPt.x)
+ xd = 0x40;
+ else if (srcPt.x > dstPt.x)
+ xd = 0x04;
+ else
+ xd = 0x00;
+ if (srcPt.y < dstPt.y)
+ yd = 0x01;
+ else if (srcPt.y > dstPt.y)
+ yd = 0x10;
+ else
+ yd = 0x00;
+ if (!xd && !yd)
+ facing = 0;
+ else if (!yd && xd)
+ facing = xd;
+ else if (yd && !xd)
+ facing = yd;
+ else if (xd == 0x04 && yd == 0x01)
+ facing = 0x02;
+ else if (xd == 0x40 && yd == 0x01)
+ facing = 0x80;
+ else if (xd == 0x04 && yd == 0x10)
+ facing = 0x08;
+ else if (xd == 0x40 && yd == 0x10)
+ facing = 0x20;
+ return facing != 0;
}
void IllusionsEngine::playVideo(uint32 videoId, uint32 objectId, uint32 priority, uint32 threadId) {
diff --git a/engines/illusions/illusions.h b/engines/illusions/illusions.h
index cf3549e8bb..08a9f760ef 100644
--- a/engines/illusions/illusions.h
+++ b/engines/illusions/illusions.h
@@ -126,7 +126,7 @@ public:
int convertPanXCoord(int16 x);
Common::Point getNamedPointPosition(uint32 namedPointId);
uint32 getPriorityFromBase(int16 priority);
- bool calcPointDirection(Common::Point &pos1, Common::Point &pos2, uint &facing);
+ bool calcPointDirection(Common::Point &srcPt, Common::Point &dstPt, uint &facing);
void playVideo(uint32 videoId, uint32 objectId, uint32 value, uint32 threadId);
diff --git a/engines/illusions/sequenceopcodes.cpp b/engines/illusions/sequenceopcodes.cpp
index e53a7ec222..818b6816a1 100644
--- a/engines/illusions/sequenceopcodes.cpp
+++ b/engines/illusions/sequenceopcodes.cpp
@@ -56,6 +56,7 @@ void SequenceOpcodes::initOpcodes() {
for (uint i = 0; i < 256; ++i)
_opcodes[i] = 0;
// Register opcodes
+ OPCODE(1, opYield);
OPCODE(2, opSetFrameIndex);
OPCODE(3, opEndSequence);
OPCODE(4, opIncFrameDelay);
@@ -103,6 +104,10 @@ void SequenceOpcodes::freeOpcodes() {
#define ARG_INT16(name) int16 name = opCall.readSint16(); debug(1, "ARG_INT16(" #name " = %d)", name);
#define ARG_UINT32(name) uint32 name = opCall.readUint32(); debug(1, "ARG_UINT32(" #name " = %08X)", name);
+void SequenceOpcodes::opYield(Control *control, OpCall &opCall) {
+ opCall._result = 2;
+}
+
void SequenceOpcodes::opSetFrameIndex(Control *control, OpCall &opCall) {
ARG_INT16(frameIndex);
if (control->_actor->_flags & 0x80) {
diff --git a/engines/illusions/sequenceopcodes.h b/engines/illusions/sequenceopcodes.h
index 747287e4a7..02561e3dc2 100644
--- a/engines/illusions/sequenceopcodes.h
+++ b/engines/illusions/sequenceopcodes.h
@@ -45,6 +45,7 @@ protected:
void freeOpcodes();
// Opcodes
+ void opYield(Control *control, OpCall &opCall);
void opSetFrameIndex(Control *control, OpCall &opCall);
void opEndSequence(Control *control, OpCall &opCall);
void opIncFrameDelay(Control *control, OpCall &opCall);