diff options
| -rw-r--r-- | engines/agos/agos.h | 4 | ||||
| -rw-r--r-- | engines/agos/items.cpp | 2 | ||||
| -rw-r--r-- | engines/agos/script_e1.cpp | 86 | ||||
| -rw-r--r-- | engines/agos/subroutine.cpp | 11 | 
4 files changed, 94 insertions, 9 deletions
diff --git a/engines/agos/agos.h b/engines/agos/agos.h index 1f2e854b64..9845b912cf 100644 --- a/engines/agos/agos.h +++ b/engines/agos/agos.h @@ -701,6 +701,10 @@ protected:  	// Waxworks specific  	void moveDirn_ww(Item *i, uint x); +	int16 levelOf(Item *item);  +	int16 moreText(Item *i); +	void lobjFunc(Item *i, const char *f); +  	int canPlace(Item *x, Item *y);  	int contains(Item *a, Item *b);  	int sizeContents(Item *x); diff --git a/engines/agos/items.cpp b/engines/agos/items.cpp index 31574e6dbb..0c111021ed 100644 --- a/engines/agos/items.cpp +++ b/engines/agos/items.cpp @@ -102,7 +102,7 @@ void AGOSEngine::createPlayer() {  	p->size = 0;  	p->weight = 0;  	p->strength = 6000; -	//p->flag = xxx; +	p->flags = 1; // Male  	p->level = 1;  	p->score = 0; diff --git a/engines/agos/script_e1.cpp b/engines/agos/script_e1.cpp index 8eb9759809..f64dd32972 100644 --- a/engines/agos/script_e1.cpp +++ b/engines/agos/script_e1.cpp @@ -346,7 +346,35 @@ void AGOSEngine::oe1_score() {  void AGOSEngine::oe1_look() {  	// 96: look -	debug(0, "oe1_look: stub"); +	Item *i = derefItem(me()->parent); +	if (i == NULL) +		return; + +	SubRoom *r = (SubRoom *)findChildOfType(i, 1); +	SubObject *o = (SubObject *)findChildOfType(i, 2); +	SubPlayer *p = (SubPlayer *)findChildOfType(i, 3); +	if (p == NULL) +		return; + +	if ((o) && (!r)) { +		showMessageFormat("In the %s\n", (const char *)getStringPtrByID(i->itemName)); +	} else if (p) { +		showMessageFormat("Carried by %s\n", (const char *)getStringPtrByID(i->itemName)); +	} + +	if (r) { +		showMessageFormat("%s", (const char *)getStringPtrByID(r->roomLong)); +	} + +	showMessageFormat("\n"); + +	Item *l = derefItem(i->child); +	if (l) { +		lobjFunc(l, "You can see ");	/* Show objects */ +	} +	if (r && (r->flags & 4) && levelOf(i) < 10000) { +		shutdown(); +	}  }  void AGOSEngine::oe1_doClass() { @@ -714,4 +742,60 @@ void AGOSEngine::oe1_printMonsterHit() {  	mouseOn();  } +int16 AGOSEngine::levelOf(Item *item) { +	SubPlayer *p = (SubPlayer *) findChildOfType(item, 3); +	if (p == NULL) +		return 0; + +	return p->level; +} + +int16 AGOSEngine::moreText(Item *i) { +	SubObject *o; +	i = derefItem(i->next); + +	while (i) { +		o = (SubObject *)findChildOfType(i, 2); +		if ((o) && (o->objectFlags & 1)) +			goto l1; +		if (i != me()) +			return 1; +	l1:	i = derefItem(i->next); +	} + +	return 0; +} + +void AGOSEngine::lobjFunc(Item *i, const char *f) { +	int n = 0; +	SubObject *o; + +	while (i) { +		o = (SubObject *)findChildOfType(i, 2); +		if ((o) && (o->objectFlags & 1)) +			goto l1; +		if (i == me()) +			goto l1; +		if (n == 0) { +			if (f) +				showMessageFormat("%s", f); +			n = 1; +		} else { +			if (moreText(i)) +				showMessageFormat(", "); +			else +				showMessageFormat(" and "); +		} +		showMessageFormat("%s", (const char *)getStringPtrByID(i->itemName)); +l1:		i = derefItem(i->next); +	} +	if (f) { +		if (n == 1) +			showMessageFormat(".\n"); +	} else { +		if (n == 0) +			showMessageFormat("nothing"); +	} +} +  } // End of namespace AGOS diff --git a/engines/agos/subroutine.cpp b/engines/agos/subroutine.cpp index 575b6d7845..427b120629 100644 --- a/engines/agos/subroutine.cpp +++ b/engines/agos/subroutine.cpp @@ -670,7 +670,7 @@ void AGOSEngine::readSubroutineLine(Common::SeekableReadStream *in, SubroutineLi  		int16 tmp = in->readUint16BE();  		WRITE_BE_UINT16(q, tmp);  		while (tmp != 10000) { -			if (READ_BE_UINT16(q) == 0xC6) { +			if (READ_BE_UINT16(q) == 198) {  				in->readUint16BE();  			} else {  				q = readSingleOpcode(in, q); @@ -679,9 +679,6 @@ void AGOSEngine::readSubroutineLine(Common::SeekableReadStream *in, SubroutineLi  			tmp = in->readUint16BE();  			WRITE_BE_UINT16(q, tmp);  		} - -		size = (q - line_buffer + 1) * 2; -		memcpy(allocateTable(size), line_buffer, size);  	} else {  		while ((*q = in->readByte()) != 0xFF) {  			if (*q == 87) { @@ -690,10 +687,10 @@ void AGOSEngine::readSubroutineLine(Common::SeekableReadStream *in, SubroutineLi  				q = readSingleOpcode(in, q);  			}  		} - -		size = (q - line_buffer + 1); -		memcpy(allocateTable(size), line_buffer, size);  	} + +	size = (q - line_buffer + 1); +	memcpy(allocateTable(size), line_buffer, size);  }  byte *AGOSEngine::readSingleOpcode(Common::SeekableReadStream *in, byte *ptr) {  | 
