mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-13 21:31:53 +00:00
Add code for look opcode in elvira 1
svn-id: r24524
This commit is contained in:
parent
956d003fcf
commit
5ab37ca91d
@ -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);
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user