aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/agos/agos.cpp5
-rw-r--r--engines/agos/agos.h14
-rw-r--r--engines/agos/contain.cpp101
-rw-r--r--engines/agos/debug.h2
-rw-r--r--engines/agos/intern.h3
-rw-r--r--engines/agos/items.cpp15
-rw-r--r--engines/agos/module.mk1
-rw-r--r--engines/agos/rooms.cpp23
-rw-r--r--engines/agos/vga.cpp34
9 files changed, 190 insertions, 8 deletions
diff --git a/engines/agos/agos.cpp b/engines/agos/agos.cpp
index 6d8ca880ba..1ff3cfb580 100644
--- a/engines/agos/agos.cpp
+++ b/engines/agos/agos.cpp
@@ -235,6 +235,7 @@ AGOSEngine::AGOSEngine(OSystem *syst)
_firstTimeStruct = 0;
_pendingDeleteTimeEvent = 0;
+ _initMouse = 0;
_mouseX = 0;
_mouseY = 0;
_mouseXOld = 0;
@@ -1142,6 +1143,8 @@ void AGOSEngine::setup_cond_c_helper() {
}
if (getGameType() == GType_PP)
_variableArray[199] = id;
+ else if (getGameType() == GType_WW)
+ _variableArray[10] = id;
else
_variableArray[60] = id;
break;
@@ -1247,6 +1250,8 @@ startOver:
}
if (getGameType() == GType_PP)
_variableArray[199] = id;
+ else if (getGameType() == GType_WW)
+ _variableArray[10] = id;
else
_variableArray[60] = id;
displayName(ha);
diff --git a/engines/agos/agos.h b/engines/agos/agos.h
index 8e9c5e785d..c9a83114c8 100644
--- a/engines/agos/agos.h
+++ b/engines/agos/agos.h
@@ -336,6 +336,7 @@ protected:
TimeEvent *_firstTimeStruct, *_pendingDeleteTimeEvent;
+ bool _initMouse;
int _mouseX, _mouseY;
int _mouseXOld, _mouseYOld;
@@ -407,8 +408,8 @@ protected:
VgaTimerEntry *_nextVgaTimerToProcess;
- Item *_objectArray[20];
- Item *_itemStore[20];
+ Item *_objectArray[50];
+ Item *_itemStore[50];
uint16 _shortText[40];
uint16 _shortTextX[40];
@@ -983,6 +984,14 @@ public:
uint16 getDoorState(Item *item, uint16 d);
uint16 getExitOf(Item *item, uint16 d);
+ void moveDirn(Item *i, int x);
+
+ int sizeContents(Item *x);
+ int sizeOfRec(Item *o, int d);
+ int sizeRec(Item *x, int d);
+
+ int canPlace(Item *x, Item *y);
+ void xPlace(Item *x, Item *y);
// Opcodes, Elvira 1 only
void oe1_present();
@@ -1000,6 +1009,7 @@ public:
void oe1_printStats();
// Opcodes, Waxworks only
+ void oww_moveDirn();
void oww_goto();
void oww_whereTo();
void oww_menu();
diff --git a/engines/agos/contain.cpp b/engines/agos/contain.cpp
new file mode 100644
index 0000000000..4f692b58f8
--- /dev/null
+++ b/engines/agos/contain.cpp
@@ -0,0 +1,101 @@
+/* ScummVM - Scumm Interpreter
+ * Copyright (C) 2001 Ludvig Strigeus
+ * Copyright (C) 2001-2006 The ScummVM project
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+#include "common/stdafx.h"
+
+#include "agos/agos.h"
+#include "agos/intern.h"
+
+namespace AGOS {
+
+int AGOSEngine::canPlace(Item *x, Item *y) {
+ Item *z = derefItem(x->parent);
+ SubObject *o = (SubObject *)findChildOfType(y, 2);
+ int ct;
+ int cap;
+
+ if (o == NULL)
+ return(0); /* Fits Fine */
+
+ xPlace(x,NULL); /* Avoid disturbing figures */
+ if (o)
+ cap = sizeContents(y);
+
+ xPlace(x, z);
+ if ((o) && (o->objectFlags & kOFVolume)) {
+ ct = getOffsetOfChild2Param(o, kOFVoice);
+ cap = o->objectFlagValue[ct] - cap;
+ cap -= sizeOfRec(x, 0); /* - size of item going in */
+ if (cap < 0)
+ return -1; /* Too big to fit */
+ }
+
+ return 0;
+}
+
+void AGOSEngine::xPlace(Item *x, Item *y) {
+ if (x->parent != 0)
+ unlinkItem(x);
+
+ linkItem(x, y);
+}
+
+int AGOSEngine::sizeContents(Item *x) {
+ return sizeRec(x, 0);
+}
+
+int AGOSEngine::sizeRec(Item *x, int d) {
+ Item *o;
+ int n = 0;
+
+ o = derefItem(x->child);
+
+ if (d > 32)
+ return(0);
+ while (o) {
+ n += sizeOfRec(o,d);
+ o = derefItem(o->child);
+ }
+
+ return n;
+}
+
+int AGOSEngine::sizeOfRec(Item *o, int d) {
+ SubObject *a = (SubObject *)findChildOfType(o, 2);
+ int ct;
+
+ if ((a) && (a->objectFlags & kOFSoft)) {
+ if (a->objectFlags & kOFSize) {
+ ct = getOffsetOfChild2Param(a, kOFSize);
+ return a->objectFlagValue[ct] + sizeRec(o, d + 1);
+ }
+ return sizeRec(o, d + 1);
+ }
+ if ((a) && (a->objectFlags & kOFSize)) {
+ ct = getOffsetOfChild2Param(a, kOFSize);
+ return a->objectFlagValue[ct];
+ }
+ return 0;
+}
+
+} // End of namespace AGOS
diff --git a/engines/agos/debug.h b/engines/agos/debug.h
index 520eb9b3c0..72fa09221d 100644
--- a/engines/agos/debug.h
+++ b/engines/agos/debug.h
@@ -95,7 +95,7 @@ static const char *const ww_opcode_name_table[256] = {
/* 52 */
"VV|MODF",
"VW|RANDOM",
- NULL,
+ "B|MOVE_DIRN",
"I|SET_A_PARENT",
/* 56 */
"IB|SET_CHILD2_BIT",
diff --git a/engines/agos/intern.h b/engines/agos/intern.h
index 4a762b98a5..c3a425f7c9 100644
--- a/engines/agos/intern.h
+++ b/engines/agos/intern.h
@@ -179,7 +179,8 @@ enum SubObjectFlags {
kOFKeyColor2 = 0x40,
kOFMenu = 0x80,
kOFNumber = 0x100,
- kOFVoice = 0x200
+ kOFSoft = 0x200, // Waxworks
+ kOFVoice = 0x200 // Others
};
enum GameFeatures {
diff --git a/engines/agos/items.cpp b/engines/agos/items.cpp
index 6a2d1ccffd..80c0eb3f03 100644
--- a/engines/agos/items.cpp
+++ b/engines/agos/items.cpp
@@ -314,6 +314,7 @@ void AGOSEngine::setupWaxworksOpcodes(OpcodeProc *op) {
setupCommonOpcodes(op);
// Confirmed
+ op[54] = &AGOSEngine::oww_moveDirn;
op[55] = &AGOSEngine::oww_goto;
op[70] = &AGOSEngine::o1_printLongText;
op[83] = &AGOSEngine::o1_rescan;
@@ -1010,9 +1011,15 @@ void AGOSEngine::o_picture() {
_picture8600 = (vga_res == 8600);
- if (mode == 4)
+ if (mode == 4) {
vc29_stopAllSounds();
+ if (!_initMouse) {
+ _initMouse = 1;
+ vc33_setMouseOn();
+ }
+ }
+
if (_lockWord & 0x10)
error("o_picture: _lockWord & 0x10");
@@ -1725,6 +1732,12 @@ void AGOSEngine::oe1_printStats() {
// Waxworks Opcodes
// -----------------------------------------------------------------------
+void AGOSEngine::oww_moveDirn() {
+ // 54: move direction
+ int16 d = getVarOrByte();
+ moveDirn(me(), d);
+}
+
void AGOSEngine::oww_goto() {
// 55: set itemA parent
uint item = getNextItemID();
diff --git a/engines/agos/module.mk b/engines/agos/module.mk
index d58c545866..8be332758a 100644
--- a/engines/agos/module.mk
+++ b/engines/agos/module.mk
@@ -4,6 +4,7 @@ MODULE_OBJS := \
agos.o \
animation.o \
charset.o \
+ contain.o \
cursor.o \
debug.o \
debugger.o \
diff --git a/engines/agos/rooms.cpp b/engines/agos/rooms.cpp
index 2af76d8c60..e321485e53 100644
--- a/engines/agos/rooms.cpp
+++ b/engines/agos/rooms.cpp
@@ -62,6 +62,29 @@ uint16 AGOSEngine::getExitOf(Item *item, uint16 d) {
return subRoom->roomExit[d];
}
+void AGOSEngine::moveDirn(Item *i, int x) {
+ Item *d;
+ uint16 n;
+
+ if (i->parent == 0)
+ return;
+
+ n = getExitOf(derefItem(i->parent), x);
+ if (derefItem(n) == NULL) {
+ loadRoomItems(n);
+ n=getExitOf(derefItem(i->parent), x);
+ }
+
+ d = derefItem(n);
+ if (d) {
+ n = getDoorState(derefItem(i->parent), x);
+ if(n == 1) {
+ if(!canPlace(i,d))
+ setItemParent(i,d);
+ }
+ }
+}
+
bool AGOSEngine::loadRoomItems(uint item) {
byte *p;
uint i, min_num, max_num;
diff --git a/engines/agos/vga.cpp b/engines/agos/vga.cpp
index 2e7d01e091..6e56fcc3f1 100644
--- a/engines/agos/vga.cpp
+++ b/engines/agos/vga.cpp
@@ -186,9 +186,9 @@ void AGOSEngine::setupVgaOpcodes() {
switch (getGameType()) {
case GType_ELVIRA:
+ case GType_ELVIRA2:
setupElvira1VideoOpcodes(vga_opcode_table);
break;
- case GType_ELVIRA2:
case GType_WW:
case GType_SIMON1:
setupCommonVideoOpcodes(vga_opcode_table);
@@ -2449,8 +2449,36 @@ void AGOSEngine::vc60_killSprite() {
void AGOSEngine::vc61_setMaskImage() {
if (getGameType() == GType_WW) {
- // FIXME
- vcReadVarOrWord();
+ uint16 a = vcReadVarOrWord();
+ byte *src, *dst;
+
+ if (a == 6) {
+ src = _curVgaFile2 + 800;
+ dst = getBackBuf();
+ memcpy(dst, src, 64000);
+ a = 4;
+ }
+
+ src = _curVgaFile2 + 3360;
+ dst = getBackBuf() + 3840;
+
+ uint tmp = a;
+ while (tmp--) {
+ src += 1712;
+ dst += 1536;
+ }
+
+ src += 800;
+
+ if (a != 5) {
+
+
+
+ }
+
+ if (a == 6) {
+
+ }
} else {
VgaSprite *vsp = findCurSprite();