[Scummvm-cvs-logs] SF.net SVN: scummvm: [24141] scummvm/trunk/engines/agos
kirben at users.sourceforge.net
kirben at users.sourceforge.net
Fri Oct 6 16:44:50 CEST 2006
Revision: 24141
http://svn.sourceforge.net/scummvm/?rev=24141&view=rev
Author: kirben
Date: 2006-10-06 07:44:39 -0700 (Fri, 06 Oct 2006)
Log Message:
-----------
Add more code for Elvira 1
Modified Paths:
--------------
scummvm/trunk/engines/agos/agos.cpp
scummvm/trunk/engines/agos/agos.h
scummvm/trunk/engines/agos/debug.h
scummvm/trunk/engines/agos/icons.cpp
scummvm/trunk/engines/agos/intern.h
scummvm/trunk/engines/agos/items.cpp
scummvm/trunk/engines/agos/res.cpp
scummvm/trunk/engines/agos/saveload.cpp
Modified: scummvm/trunk/engines/agos/agos.cpp
===================================================================
--- scummvm/trunk/engines/agos/agos.cpp 2006-10-06 12:58:11 UTC (rev 24140)
+++ scummvm/trunk/engines/agos/agos.cpp 2006-10-06 14:44:39 UTC (rev 24141)
@@ -318,6 +318,9 @@
_nextVgaTimerToProcess = 0;
+ _classMask = 0;
+ _classMode1 = 0;
+ _classMode2 = 0;
_superRoomNumber = 0;
memset(_objectArray, 0, sizeof(_objectArray));
@@ -776,6 +779,31 @@
subUserFlag->userFlags[a] = b;
}
+int AGOSEngine::getUserItem(Item *item, int n) {
+ SubUserFlag *subUserFlag;
+
+ subUserFlag = (SubUserFlag *) findChildOfType(item, 9);
+ if (subUserFlag == NULL)
+ return 0;
+
+ if (n < 0 || n > 0)
+ return 0;
+
+ return subUserFlag->userItems[n];
+}
+
+void AGOSEngine::setUserItem(Item *item, int n, int m) {
+ SubUserFlag *subUserFlag;
+
+ subUserFlag = (SubUserFlag *) findChildOfType(item, 9);
+ if (subUserFlag == NULL) {
+ subUserFlag = (SubUserFlag *) allocateChildBlock(item, 9, sizeof(SubUserFlag));
+ }
+
+ if (n == 0)
+ subUserFlag->userItems[n] = m;
+}
+
void AGOSEngine::createPlayer() {
SubPlayer *p;
@@ -1051,23 +1079,23 @@
// the node to remove is first in the parent's children?
if (first == item) {
- parent->child = item->sibling;
+ parent->child = item->next;
item->parent = 0;
- item->sibling = 0;
+ item->next = 0;
return;
}
for (;;) {
if (!first)
error("unlinkItem: parent empty");
- if (first->sibling == 0)
+ if (first->next == 0)
error("unlinkItem: parent does not contain child");
- next = derefItem(first->sibling);
+ next = derefItem(first->next);
if (next == item) {
- first->sibling = next->sibling;
+ first->next = next->next;
item->parent = 0;
- item->sibling = 0;
+ item->next = 0;
return;
}
first = next;
@@ -1084,10 +1112,10 @@
item->parent = id;
if (parent != 0) {
- item->sibling = parent->child;
+ item->next = parent->child;
parent->child = itemPtrToID(item);
} else {
- item->sibling = 0;
+ item->next = 0;
}
}
@@ -1837,6 +1865,24 @@
return _itemArrayPtr[item];
}
+Item *AGOSEngine::findInByClass(Item *i, int16 m) {
+ i = derefItem(i->child);
+
+ while(i) {
+ if(i->classFlags & m) {
+ //_findNextPtr = derefItem(i->next);
+ return i;
+ }
+ if (m == 0) {
+ //_findNextPtr = derefItem(i->next);
+ return i;
+ }
+ i = derefItem(i->next);
+ }
+
+ return NULL;
+}
+
Item *AGOSEngine::findMaster(int16 pe, int16 a, int16 n) {
uint j;
Modified: scummvm/trunk/engines/agos/agos.h
===================================================================
--- scummvm/trunk/engines/agos/agos.h 2006-10-06 12:58:11 UTC (rev 24140)
+++ scummvm/trunk/engines/agos/agos.h 2006-10-06 14:44:39 UTC (rev 24141)
@@ -514,8 +514,6 @@
uint32 readUint32Wrapper(const void *src);
int allocGamePcVars(Common::File *in);
- int getUserFlag(Item *item, int a);
- void setUserFlag(Item *item, int a, int b);
void createPlayer();
void allocateStringTable(int num);
void setupStringTable(byte *mem, int num);
@@ -529,6 +527,11 @@
void loadSound(uint sound, int pan, int vol, uint type);
void loadVoice(uint speechId);
+ int getUserFlag(Item *item, int a);
+ int getUserItem(Item *item, int n);
+ void setUserFlag(Item *item, int a, int b);
+ void setUserItem(Item *item, int n, int m);
+
void paletteFadeOut(byte *palPtr, uint num, uint size);
byte *allocateItem(uint size);
@@ -990,6 +993,7 @@
void o_unloadZone();
void o_unfreezeZones();
+ Item *findInByClass(Item *i, int16 m);
Item *findMaster(int16 pe, int16 a, int16 n);
Item *nextMaster(int16 pe, Item *item, int16 a, int16 n);
int16 levelOf(Item *item);
@@ -1004,6 +1008,7 @@
void moveDirn_e2(Item *i, uint x);
void moveDirn_ww(Item *i, uint x);
+ uint _classMask, _classMode1, _classMode2;
uint _superRoomNumber;
int sizeContents(Item *x);
@@ -1024,10 +1029,13 @@
void oe1_notSibling();
void oe1_setFF();
void oe1_score();
- void oe1_opcode176();
- void oe1_opcode178();
+ void oe1_doClass();
+ void oe1_setUserItem();
+ void oe1_getUserItem();
+ void oe1_clearUserItem();
void oe1_findMaster();
void oe1_nextMaster();
+ void oe1_bitTest();
void oe1_zoneDisk();
void oe1_printStats();
Modified: scummvm/trunk/engines/agos/debug.h
===================================================================
--- scummvm/trunk/engines/agos/debug.h 2006-10-06 12:58:11 UTC (rev 24140)
+++ scummvm/trunk/engines/agos/debug.h 2006-10-06 14:44:39 UTC (rev 24141)
@@ -160,8 +160,8 @@
/* 104 */
NULL,
"W|START_SUB",
+ "IWW|DO_CLASS",
NULL,
- NULL,
/* 108 */
NULL,
NULL,
@@ -248,10 +248,10 @@
NULL,
NULL,
/* 176 */
- "IWI|UNK176",
+ "IWI|SET_USER_ITEM",
+ "IWW|GET_USER_ITEM",
+ "IW|CLEAR_USER_ITEM",
NULL,
- "IW|UNK178",
- NULL,
/* 180 */
"IWW|WHERE_TO",
NULL,
@@ -344,8 +344,8 @@
NULL,
/* 252 */
NULL,
+ "WWJ|BIT_TEST",
NULL,
- NULL,
"W|WAIT_SYNC",
/* 256 */
"W|SYNC",
Modified: scummvm/trunk/engines/agos/icons.cpp
===================================================================
--- scummvm/trunk/engines/agos/icons.cpp 2006-10-06 12:58:11 UTC (rev 24140)
+++ scummvm/trunk/engines/agos/icons.cpp 2006-10-06 14:44:39 UTC (rev 24141)
@@ -251,7 +251,7 @@
while (itemRef && width > curWidth) {
if ((classMask == 0 || itemRef->classFlags & classMask) && has_item_childflag_0x10(itemRef))
curWidth += iconSize;
- itemRef = derefItem(itemRef->sibling);
+ itemRef = derefItem(itemRef->next);
}
}
@@ -293,7 +293,7 @@
item_again = true;
}
}
- itemRef = derefItem(itemRef->sibling);
+ itemRef = derefItem(itemRef->next);
}
window->iconPtr->iconArray[k].item = NULL;
@@ -351,7 +351,7 @@
k++;
}
}
- itemRef = derefItem(itemRef->sibling);
+ itemRef = derefItem(itemRef->next);
}
line -= 52;
if (k == (flagnumber + 18))
@@ -394,7 +394,7 @@
idone = 1; /* Note completed screen */
}
}
-l1:; itemRef = derefItem(itemRef->sibling);
+l1:; itemRef = derefItem(itemRef->next);
}
window->iconPtr->iconArray[icount].item = NULL; /* END MARKINGS */
if (_variableArray[30] == 0) {
Modified: scummvm/trunk/engines/agos/intern.h
===================================================================
--- scummvm/trunk/engines/agos/intern.h 2006-10-06 12:58:11 UTC (rev 24140)
+++ scummvm/trunk/engines/agos/intern.h 2006-10-06 14:44:39 UTC (rev 24141)
@@ -103,7 +103,7 @@
struct Item {
uint16 parent;
uint16 child;
- uint16 sibling;
+ uint16 next;
int16 noun;
int16 adjective;
int16 state; /* signed int */
Modified: scummvm/trunk/engines/agos/items.cpp
===================================================================
--- scummvm/trunk/engines/agos/items.cpp 2006-10-06 12:58:11 UTC (rev 24140)
+++ scummvm/trunk/engines/agos/items.cpp 2006-10-06 14:44:39 UTC (rev 24141)
@@ -240,6 +240,7 @@
op[98] = &AGOSEngine::o_done;
op[105] = &AGOSEngine::o_process;
+ op[106] = &AGOSEngine::oe1_doClass;
op[119] = &AGOSEngine::o_when;
@@ -253,10 +254,10 @@
op[164] = &AGOSEngine::o1_rescan;
- op[176] = &AGOSEngine::oe1_opcode176;
+ op[176] = &AGOSEngine::oe1_setUserItem;
+ op[177] = &AGOSEngine::oe1_getUserItem;
+ op[178] = &AGOSEngine::oe1_clearUserItem;
- op[178] = &AGOSEngine::oe1_opcode178;
-
op[180] = &AGOSEngine::oww_whereTo;
op[198] = &AGOSEngine::o_comment;
@@ -290,6 +291,8 @@
op[249] = &AGOSEngine::o_setClass;
op[250] = &AGOSEngine::o_unsetClass;
+ op[253] = &AGOSEngine::oe1_bitTest;
+
op[255] = &AGOSEngine::o_waitSync;
op[256] = &AGOSEngine::o_sync;
op[257] = &AGOSEngine::o_defObj;
@@ -1050,8 +1053,8 @@
}
void AGOSEngine::o_getNext() {
- // 91: set minusitem to sibling
- Item *item = derefItem(getNextItemPtr()->sibling);
+ // 91: set minusitem to next
+ Item *item = derefItem(getNextItemPtr()->next);
switch (getVarOrByte()) {
case 0:
_objectItem = item;
@@ -1794,19 +1797,55 @@
showMessageFormat("Your score is %ld.\n", p->score);
}
-void AGOSEngine::oe1_opcode176() {
- // 176
- getNextItemPtr();
- getVarOrWord();
- getNextItemPtr();
+void AGOSEngine::oe1_doClass() {
+ // 106: do class
+ Item *i = getNextItemPtr();
+ int16 cm = getVarOrWord();
+ int16 num = getVarOrWord();
+
+ _classMask = (cm != -1) ? 1 << cm : 0;
+ //_classLine = (SubroutineLine *)((uint32)_currentLine->next+(uint32)_currentTable);
+
+ if (num == 1) {
+ _subjectItem = findInByClass(i, (1 << cm));
+ if (_subjectItem)
+ _classMode1 = 1;
+ else
+ _classMode1 = 0;
+ } else {
+ _objectItem = findInByClass(i, (1 << cm));
+ if (_objectItem)
+ _classMode2 = 1;
+ else
+ _classMode2 = 0;
+ }
}
-void AGOSEngine::oe1_opcode178() {
- // 178
- getNextItemPtr();
- getVarOrWord();
+void AGOSEngine::oe1_setUserItem() {
+ // 176: set user item
+ Item *i = getNextItemPtr();
+ uint tmp = getVarOrWord();
+ setUserItem(i, tmp, getNextItemID());
}
+void AGOSEngine::oe1_getUserItem() {
+ // 177: get user item
+ Item *i = getNextItemPtr();
+ int n = getVarOrWord();
+
+ if (getVarOrWord() == 1)
+ _subjectItem = derefItem(getUserItem(i, n));
+ else
+ _objectItem = derefItem(getUserItem(i, n));
+}
+
+void AGOSEngine::oe1_clearUserItem() {
+ // 178: clear user item
+ Item *i = getNextItemPtr();
+ uint tmp = getVarOrWord();
+ setUserItem(i, tmp, 0);
+}
+
void AGOSEngine::oe1_findMaster() {
// 219: find master
int16 ad, no;
@@ -1838,6 +1877,14 @@
_objectItem = nextMaster(levelOf(me()), item, ad, no);
}
+void AGOSEngine::oe1_bitTest() {
+ // 253: bit test
+ int var = getVarOrWord();
+ int bit = getVarOrWord();
+
+ setScriptCondition((_variableArray[var] & (1 << bit)) != 0);
+}
+
void AGOSEngine::oe1_zoneDisk() {
// 267: set disk number of each zone
getVarOrWord();
Modified: scummvm/trunk/engines/agos/res.cpp
===================================================================
--- scummvm/trunk/engines/agos/res.cpp 2006-10-06 12:58:11 UTC (rev 24140)
+++ scummvm/trunk/engines/agos/res.cpp 2006-10-06 14:44:39 UTC (rev 24141)
@@ -267,7 +267,7 @@
item->noun = in->readUint16BE();
item->state = in->readUint16BE();
in->readUint16BE();
- item->sibling = (uint16)fileReadItemID(in);
+ item->next = (uint16)fileReadItemID(in);
item->child = (uint16)fileReadItemID(in);
item->parent = (uint16)fileReadItemID(in);
in->readUint16BE();
@@ -280,7 +280,7 @@
item->adjective = in->readUint16BE();
item->noun = in->readUint16BE();
item->state = in->readUint16BE();
- item->sibling = (uint16)fileReadItemID(in);
+ item->next = (uint16)fileReadItemID(in);
item->child = (uint16)fileReadItemID(in);
item->parent = (uint16)fileReadItemID(in);
in->readUint16BE();
@@ -290,7 +290,7 @@
item->adjective = in->readUint16BE();
item->noun = in->readUint16BE();
item->state = in->readUint16BE();
- item->sibling = (uint16)fileReadItemID(in);
+ item->next = (uint16)fileReadItemID(in);
item->child = (uint16)fileReadItemID(in);
item->parent = (uint16)fileReadItemID(in);
in->readUint16BE();
Modified: scummvm/trunk/engines/agos/saveload.cpp
===================================================================
--- scummvm/trunk/engines/agos/saveload.cpp 2006-10-06 12:58:11 UTC (rev 24140)
+++ scummvm/trunk/engines/agos/saveload.cpp 2006-10-06 14:44:39 UTC (rev 24141)
@@ -625,7 +625,7 @@
Item *item = _itemArrayPtr[item_index++];
f->writeUint16BE(item->parent);
- f->writeUint16BE(item->sibling);
+ f->writeUint16BE(item->next);
f->writeUint16BE(item->state);
f->writeUint16BE(item->classFlags);
@@ -751,7 +751,7 @@
Item *item = _itemArrayPtr[item_index++], *parent_item;
uint parent = f->readUint16BE();
- uint sibling = f->readUint16BE();
+ uint next = f->readUint16BE();
parent_item = derefItem(parent);
@@ -759,7 +759,7 @@
if (parent_item == NULL) {
item->parent = parent;
- item->sibling = sibling;
+ item->next = next;
}
item->state = f->readUint16BE();
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