[Scummvm-cvs-logs] SF.net SVN: scummvm: [24639] scummvm/trunk/engines/agos

kirben at users.sourceforge.net kirben at users.sourceforge.net
Mon Nov 6 14:59:27 CET 2006


Revision: 24639
          http://svn.sourceforge.net/scummvm/?rev=24639&view=rev
Author:   kirben
Date:     2006-11-06 05:59:11 -0800 (Mon, 06 Nov 2006)

Log Message:
-----------
Cleanup

Modified Paths:
--------------
    scummvm/trunk/engines/agos/agos.h
    scummvm/trunk/engines/agos/contain.cpp
    scummvm/trunk/engines/agos/rooms.cpp
    scummvm/trunk/engines/agos/script.cpp
    scummvm/trunk/engines/agos/script_e1.cpp
    scummvm/trunk/engines/agos/script_ff.cpp
    scummvm/trunk/engines/agos/script_s1.cpp
    scummvm/trunk/engines/agos/script_s2.cpp
    scummvm/trunk/engines/agos/window.cpp

Modified: scummvm/trunk/engines/agos/agos.h
===================================================================
--- scummvm/trunk/engines/agos/agos.h	2006-11-06 13:55:40 UTC (rev 24638)
+++ scummvm/trunk/engines/agos/agos.h	2006-11-06 13:59:11 UTC (rev 24639)
@@ -666,8 +666,6 @@
 	void waitForSync(uint a);
 
 	uint getOffsetOfChild2Param(SubObject *child, uint prop);
-	void setTextColor(uint color);
-	void scriptMouseOn();
 	void scriptMouseOff();
 	void freezeBottom();
 	void unfreezeBottom();
@@ -685,8 +683,8 @@
 	void setDoorState(Item *i, uint16 d, uint16 n);
 
 	// Elvira 1 specific
-	uint16 getDoorOf(Item *item, uint16 d);
-	uint16 getExitOf_e1(Item *item, uint16 d);
+	Item *getDoorOf(Item *item, uint16 d);
+	Item *getExitOf_e1(Item *item, uint16 d);
 	void moveDirn_e1(Item *i, uint x);
 
 	// Elvira 2 specific
@@ -778,6 +776,7 @@
 	void clearWindow(WindowBlock *window);
 	void changeWindow(uint a);
 	void closeWindow(uint a);
+	void setTextColor(uint color);
 	void windowPutChar(WindowBlock *window, byte c, byte b = 0);
 
 	HitArea *findBox(uint hitarea_id);
@@ -1133,6 +1132,8 @@
 	void oe1_printPlayerHit();
 	void oe1_printMonsterHit();
 
+	void synchChain(Item *i);
+
 	// Opcodes, Elvira 2
 	void oe2_moveDirn();
 	void oe2_doClass();
@@ -1218,6 +1219,7 @@
 	void os2_stopAnimate();
 	void os2_playTune();
 	void os2_screenTextPObj();
+	void os2_mouseOn();
 	void os2_mouseOff();
 	void os2_isShortText();
 	void os2_clearMarks();
@@ -1243,6 +1245,7 @@
 	void off_hyperLinkOff();
 	void off_checkPaths();
 	void off_screenTextPObj();
+	void off_mouseOn();
 	void off_mouseOff();
 	void off_loadVideo();
 	void off_playVideo();

Modified: scummvm/trunk/engines/agos/contain.cpp
===================================================================
--- scummvm/trunk/engines/agos/contain.cpp	2006-11-06 13:55:40 UTC (rev 24638)
+++ scummvm/trunk/engines/agos/contain.cpp	2006-11-06 13:59:11 UTC (rev 24639)
@@ -81,7 +81,7 @@
 }
 
 void AGOSEngine::xPlace(Item *x, Item *y) {
-	if (x->parent != 0)
+	if (derefItem(x->parent))
 		unlinkItem(x);
 
 	linkItem(x, y);

Modified: scummvm/trunk/engines/agos/rooms.cpp
===================================================================
--- scummvm/trunk/engines/agos/rooms.cpp	2006-11-06 13:55:40 UTC (rev 24638)
+++ scummvm/trunk/engines/agos/rooms.cpp	2006-11-06 13:59:11 UTC (rev 24639)
@@ -124,7 +124,7 @@
 }
 
 // Elvira 1 specific
-uint16 AGOSEngine::getDoorOf(Item *i, uint16 d) {
+Item *AGOSEngine::getDoorOf(Item *i, uint16 d) {
 	SubGenExit *g;
 	Item *x;
 
@@ -137,10 +137,10 @@
 		return 0;
 	if (isRoom(x))
 		return 0;
-	return itemPtrToID(x);
+	return x;
 }
 
-uint16 AGOSEngine::getExitOf_e1(Item *item, uint16 d) {
+Item *AGOSEngine::getExitOf_e1(Item *item, uint16 d) {
 	SubGenExit *g;
 	Item *x;
 
@@ -152,24 +152,22 @@
 	if (x == NULL)
 		return 0;
 	if (isRoom(x))
-		return itemPtrToID(x);
+		return x;
 	if (x->state != 0)
 		return 0;
-	return x->parent;
+	return derefItem(x->parent);
 }
 
 void AGOSEngine::moveDirn_e1(Item *i, uint x) {
 	Item *d, *p;
-	uint16 n;
 
-	if (i->parent == 0)
+	p = derefItem(i->parent);
+	if (p == 0)
 		return;
 
-	p = derefItem(i->parent);
 
-	n = getExitOf_e1(p, x);
-	d = derefItem(n);
-	if (n) {
+	d = getExitOf_e1(p, x);
+	if (d) {
 		if (canPlace(i, d))
 			return;
 
@@ -177,7 +175,7 @@
 		return;
 	}
 
-	d = derefItem(getDoorOf(p, x));
+	d = getDoorOf(p, x);
 	if (d) {
 		const byte *name = getStringPtrByID(d->itemName);
 		if (d->state == 1)

Modified: scummvm/trunk/engines/agos/script.cpp
===================================================================
--- scummvm/trunk/engines/agos/script.cpp	2006-11-06 13:55:40 UTC (rev 24638)
+++ scummvm/trunk/engines/agos/script.cpp	2006-11-06 13:59:11 UTC (rev 24639)
@@ -481,15 +481,19 @@
 void AGOSEngine::o_inc() {
 	// 59: item inc state
 	Item *item = getNextItemPtr();
-	if (item->state <= 30000)
+	if (item->state <= 30000) {
 		setItemState(item, item->state + 1);
+		synchChain(item);
+	}
 }
 
 void AGOSEngine::o_dec() {
 	// 60: item dec state
 	Item *item = getNextItemPtr();
-	if (item->state >= 0)
+	if (item->state >= 0) {
 		setItemState(item, item->state - 1);
+		synchChain(item);
+	}
 }
 
 void AGOSEngine::o_setState() {
@@ -501,6 +505,7 @@
 	if (value > 30000)
 		value = 30000;
 	setItemState(item, value);
+	synchChain(item);
 }
 
 void AGOSEngine::o_print() {
@@ -810,9 +815,13 @@
 	// 126: do class icons
 	Item *item = getNextItemPtr();
 	uint num = getVarOrByte();
-	uint a = 1 << getVarOrByte();
+	uint a = getVarOrByte();
+
 	mouseOff();
-	drawIconArray(num, item, 1, a);
+	if (getGameType() == GType_ELVIRA1)
+		drawIconArray(num, item, 0, a);
+	else
+		drawIconArray(num, item, 0, 1 << a);
 	mouseOn();
 }
 
@@ -1085,20 +1094,22 @@
 	return getScriptReturn();
 }
 
-void AGOSEngine::scriptMouseOn() {
-	if ((getGameType() == GType_FF || getGameType() == GType_PP) && _mouseCursor != 5) {
-		resetVerbs();
-		_noRightClick = 0;
-	} else if (getGameType() == GType_SIMON2 && getBitFlag(79)) {
-		_mouseCursor = 0;
+Child *nextSub(Child *sub, int16 key) {
+	Child *a = sub->next;
+	while (a) {
+		if (a->type == key)
+			return a;
+		a = a->next;
 	}
-	_mouseHideCount = 0;
+	return NULL;
 }
 
-void AGOSEngine::scriptMouseOff() {
-	_lockWord |= 0x8000;
-	vc34_setMouseOff();
-	_lockWord &= ~0x8000;
+void AGOSEngine::synchChain(Item *i) {
+	SubUserChain *c = (SubUserChain *)findChildOfType(i, 8);
+	while (c) {
+		setItemState(derefItem(c->chChained), i->state);
+		c = (SubUserChain *)nextSub((Child *)c, 8);
+	}
 }
 
 void AGOSEngine::sendSync(uint a) {
@@ -1109,13 +1120,6 @@
 	_lockWord &= ~0x8000;
 }
 
-void AGOSEngine::setTextColor(uint color) {
-	WindowBlock *window;
-
-	window = _windowArray[_curWindow];
-	window->text_color = color;
-}
-
 void AGOSEngine::stopAnimate(uint a) {
 	uint16 b = to16Wrapper(a);
 	_lockWord |= 0x8000;
@@ -1124,18 +1128,6 @@
 	_lockWord &= ~0x8000;
 }
 
-void AGOSEngine::stopAnimateSimon2(uint a, uint b) {
-	uint16 items[2];
-
-	items[0] = to16Wrapper(a);
-	items[1] = to16Wrapper(b);
-
-	_lockWord |= 0x8000;
-	_vcPtr = (byte *)&items;
-	vc60_stopAnimation();
-	_lockWord &= ~0x8000;
-}
-
 void AGOSEngine::waitForSync(uint a) {
 	const uint maxCount = (getGameType() == GType_SIMON1) ? 500 : 1000;
 

Modified: scummvm/trunk/engines/agos/script_e1.cpp
===================================================================
--- scummvm/trunk/engines/agos/script_e1.cpp	2006-11-06 13:55:40 UTC (rev 24638)
+++ scummvm/trunk/engines/agos/script_e1.cpp	2006-11-06 13:59:11 UTC (rev 24639)
@@ -436,9 +436,9 @@
 	int16 f = getVarOrWord();
 
 	if (f == 1)
-		_subjectItem = derefItem(getExitOf_e1(i, d));
+		_subjectItem = getExitOf_e1(i, d);
 	else
-		_objectItem = derefItem(getExitOf_e1(i, d));
+		_objectItem = getExitOf_e1(i, d);
 }
 
 void AGOSEngine::oe1_doorExit() {
@@ -455,7 +455,7 @@
 	if (c)
 		a = derefItem(c->chChained);
 	while (ct < 6) {
-		x = derefItem(getDoorOf(i, ct));
+		x = getDoorOf(i, ct);
 		if ((x == d) | (x == a)) {
 			writeVariable(f, ct);
 			return;

Modified: scummvm/trunk/engines/agos/script_ff.cpp
===================================================================
--- scummvm/trunk/engines/agos/script_ff.cpp	2006-11-06 13:55:40 UTC (rev 24638)
+++ scummvm/trunk/engines/agos/script_ff.cpp	2006-11-06 13:59:11 UTC (rev 24639)
@@ -67,7 +67,7 @@
 	op[177] = &AGOSEngine::off_screenTextPObj;
 	op[178] = &AGOSEngine::os1_getPathPosn;
 	op[179] = &AGOSEngine::os1_scnTxtLongText;
-	op[180] = &AGOSEngine::os1_mouseOn;
+	op[180] = &AGOSEngine::off_mouseOn;
 	op[181] = &AGOSEngine::off_mouseOff;
 	op[182] = &AGOSEngine::off_loadVideo;
 	op[183] = &AGOSEngine::off_playVideo;
@@ -336,6 +336,15 @@
 	}
 }
 
+void AGOSEngine::off_mouseOn() {
+	// 180: force mouseOn
+	if (_mouseCursor != 5) {
+		resetVerbs();
+		_noRightClick = 0;
+	}
+	_mouseHideCount = 0;
+}
+
 void AGOSEngine::off_mouseOff() {
 	// 181: force mouseOff
 	scriptMouseOff();

Modified: scummvm/trunk/engines/agos/script_s1.cpp
===================================================================
--- scummvm/trunk/engines/agos/script_s1.cpp	2006-11-06 13:55:40 UTC (rev 24638)
+++ scummvm/trunk/engines/agos/script_s1.cpp	2006-11-06 13:59:11 UTC (rev 24639)
@@ -267,7 +267,7 @@
 
 void AGOSEngine::os1_mouseOn() {
 	// 180: force mouseOn
-	scriptMouseOn();
+	_mouseHideCount = 0;
 }
 
 void AGOSEngine::os1_mouseOff() {
@@ -340,4 +340,10 @@
 	memcpy(_displayPalette, _videoBuf1, 1024);
 }
 
+void AGOSEngine::scriptMouseOff() {
+	_lockWord |= 0x8000;
+	vc34_setMouseOff();
+	_lockWord &= ~0x8000;
+}
+
 } // End of namespace AGOS

Modified: scummvm/trunk/engines/agos/script_s2.cpp
===================================================================
--- scummvm/trunk/engines/agos/script_s2.cpp	2006-11-06 13:55:40 UTC (rev 24638)
+++ scummvm/trunk/engines/agos/script_s2.cpp	2006-11-06 13:59:11 UTC (rev 24639)
@@ -54,7 +54,7 @@
 	op[177] = &AGOSEngine::os2_screenTextPObj;
 	op[178] = &AGOSEngine::os1_getPathPosn;
 	op[179] = &AGOSEngine::os1_scnTxtLongText;
-	op[180] = &AGOSEngine::os1_mouseOn;
+	op[180] = &AGOSEngine::os2_mouseOn;
 	op[181] = &AGOSEngine::os2_mouseOff;
 	op[184] = &AGOSEngine::os1_unloadZone;
 	op[186] = &AGOSEngine::os1_unfreezeZones;
@@ -215,6 +215,14 @@
 	}
 }
 
+void AGOSEngine::os2_mouseOn() {
+	// 180: force mouseOn
+	if (getGameType() == GType_SIMON2 && getBitFlag(79)) {
+		_mouseCursor = 0;
+	}
+	_mouseHideCount = 0;
+}
+
 void AGOSEngine::os2_mouseOff() {
 	// 181: force mouseOff
 	scriptMouseOff();
@@ -241,6 +249,18 @@
 		waitForMark(i);
 }
 
+void AGOSEngine::stopAnimateSimon2(uint a, uint b) {
+	uint16 items[2];
+
+	items[0] = to16Wrapper(a);
+	items[1] = to16Wrapper(b);
+
+	_lockWord |= 0x8000;
+	_vcPtr = (byte *)&items;
+	vc60_stopAnimation();
+	_lockWord &= ~0x8000;
+}
+
 void AGOSEngine::waitForMark(uint i) {
 	_exitCutscene = false;
 	while (!(_marks & (1 << i))) {

Modified: scummvm/trunk/engines/agos/window.cpp
===================================================================
--- scummvm/trunk/engines/agos/window.cpp	2006-11-06 13:55:40 UTC (rev 24638)
+++ scummvm/trunk/engines/agos/window.cpp	2006-11-06 13:59:11 UTC (rev 24639)
@@ -184,6 +184,13 @@
 	}
 }
 
+void AGOSEngine::setTextColor(uint color) {
+	WindowBlock *window;
+
+	window = _windowArray[_curWindow];
+	window->text_color = color;
+}
+
 void AGOSEngine::windowPutChar(uint a) {
 	if (_textWindow != _windowArray[0])
 		windowPutChar(_textWindow, a);


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