[Scummvm-cvs-logs] SF.net SVN: scummvm: [24103] scummvm/trunk/engines/agos
kirben at users.sourceforge.net
kirben at users.sourceforge.net
Wed Oct 4 05:29:27 CEST 2006
Revision: 24103
http://svn.sourceforge.net/scummvm/?rev=24103&view=rev
Author: kirben
Date: 2006-10-03 20:29:14 -0700 (Tue, 03 Oct 2006)
Log Message:
-----------
Add more code for WW
Modified Paths:
--------------
scummvm/trunk/engines/agos/agos.cpp
scummvm/trunk/engines/agos/agos.h
scummvm/trunk/engines/agos/debug.h
scummvm/trunk/engines/agos/intern.h
scummvm/trunk/engines/agos/items.cpp
scummvm/trunk/engines/agos/module.mk
scummvm/trunk/engines/agos/rooms.cpp
scummvm/trunk/engines/agos/vga.cpp
Added Paths:
-----------
scummvm/trunk/engines/agos/contain.cpp
Modified: scummvm/trunk/engines/agos/agos.cpp
===================================================================
--- scummvm/trunk/engines/agos/agos.cpp 2006-10-03 14:34:30 UTC (rev 24102)
+++ scummvm/trunk/engines/agos/agos.cpp 2006-10-04 03:29:14 UTC (rev 24103)
@@ -235,6 +235,7 @@
_firstTimeStruct = 0;
_pendingDeleteTimeEvent = 0;
+ _initMouse = 0;
_mouseX = 0;
_mouseY = 0;
_mouseXOld = 0;
@@ -1142,6 +1143,8 @@
}
if (getGameType() == GType_PP)
_variableArray[199] = id;
+ else if (getGameType() == GType_WW)
+ _variableArray[10] = id;
else
_variableArray[60] = id;
break;
@@ -1247,6 +1250,8 @@
}
if (getGameType() == GType_PP)
_variableArray[199] = id;
+ else if (getGameType() == GType_WW)
+ _variableArray[10] = id;
else
_variableArray[60] = id;
displayName(ha);
Modified: scummvm/trunk/engines/agos/agos.h
===================================================================
--- scummvm/trunk/engines/agos/agos.h 2006-10-03 14:34:30 UTC (rev 24102)
+++ scummvm/trunk/engines/agos/agos.h 2006-10-04 03:29:14 UTC (rev 24103)
@@ -336,6 +336,7 @@
TimeEvent *_firstTimeStruct, *_pendingDeleteTimeEvent;
+ bool _initMouse;
int _mouseX, _mouseY;
int _mouseXOld, _mouseYOld;
@@ -407,8 +408,8 @@
VgaTimerEntry *_nextVgaTimerToProcess;
- Item *_objectArray[20];
- Item *_itemStore[20];
+ Item *_objectArray[50];
+ Item *_itemStore[50];
uint16 _shortText[40];
uint16 _shortTextX[40];
@@ -983,7 +984,15 @@
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();
void oe1_notPresent();
@@ -1000,6 +1009,7 @@
void oe1_printStats();
// Opcodes, Waxworks only
+ void oww_moveDirn();
void oww_goto();
void oww_whereTo();
void oww_menu();
Added: scummvm/trunk/engines/agos/contain.cpp
===================================================================
--- scummvm/trunk/engines/agos/contain.cpp (rev 0)
+++ scummvm/trunk/engines/agos/contain.cpp 2006-10-04 03:29:14 UTC (rev 24103)
@@ -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
Property changes on: scummvm/trunk/engines/agos/contain.cpp
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Date Rev Author URL Id
Name: svn:eol-style
+ native
Modified: scummvm/trunk/engines/agos/debug.h
===================================================================
--- scummvm/trunk/engines/agos/debug.h 2006-10-03 14:34:30 UTC (rev 24102)
+++ scummvm/trunk/engines/agos/debug.h 2006-10-04 03:29:14 UTC (rev 24103)
@@ -95,7 +95,7 @@
/* 52 */
"VV|MODF",
"VW|RANDOM",
- NULL,
+ "B|MOVE_DIRN",
"I|SET_A_PARENT",
/* 56 */
"IB|SET_CHILD2_BIT",
Modified: scummvm/trunk/engines/agos/intern.h
===================================================================
--- scummvm/trunk/engines/agos/intern.h 2006-10-03 14:34:30 UTC (rev 24102)
+++ scummvm/trunk/engines/agos/intern.h 2006-10-04 03:29:14 UTC (rev 24103)
@@ -179,7 +179,8 @@
kOFKeyColor2 = 0x40,
kOFMenu = 0x80,
kOFNumber = 0x100,
- kOFVoice = 0x200
+ kOFSoft = 0x200, // Waxworks
+ kOFVoice = 0x200 // Others
};
enum GameFeatures {
Modified: scummvm/trunk/engines/agos/items.cpp
===================================================================
--- scummvm/trunk/engines/agos/items.cpp 2006-10-03 14:34:30 UTC (rev 24102)
+++ scummvm/trunk/engines/agos/items.cpp 2006-10-04 03:29:14 UTC (rev 24103)
@@ -314,6 +314,7 @@
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 @@
_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 @@
// 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();
Modified: scummvm/trunk/engines/agos/module.mk
===================================================================
--- scummvm/trunk/engines/agos/module.mk 2006-10-03 14:34:30 UTC (rev 24102)
+++ scummvm/trunk/engines/agos/module.mk 2006-10-04 03:29:14 UTC (rev 24103)
@@ -4,6 +4,7 @@
agos.o \
animation.o \
charset.o \
+ contain.o \
cursor.o \
debug.o \
debugger.o \
Modified: scummvm/trunk/engines/agos/rooms.cpp
===================================================================
--- scummvm/trunk/engines/agos/rooms.cpp 2006-10-03 14:34:30 UTC (rev 24102)
+++ scummvm/trunk/engines/agos/rooms.cpp 2006-10-04 03:29:14 UTC (rev 24103)
@@ -62,6 +62,29 @@
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;
Modified: scummvm/trunk/engines/agos/vga.cpp
===================================================================
--- scummvm/trunk/engines/agos/vga.cpp 2006-10-03 14:34:30 UTC (rev 24102)
+++ scummvm/trunk/engines/agos/vga.cpp 2006-10-04 03:29:14 UTC (rev 24103)
@@ -186,9 +186,9 @@
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::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();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list