Fix guard response in Elvira 1

svn-id: r24261
This commit is contained in:
Travis Howell 2006-10-10 11:44:58 +00:00
parent c5044d67c9
commit 99df945038
5 changed files with 35 additions and 5 deletions

View File

@ -559,7 +559,7 @@ int AGOSEngine::init() {
return 0;
}
const static uint16 initialVideoWindows_Simon[24] = {
const static uint16 initialVideoWindows_Simon[20] = {
0, 0, 20, 200,
0, 0, 3, 136,
17, 0, 3, 136,
@ -567,7 +567,7 @@ const static uint16 initialVideoWindows_Simon[24] = {
0, 0, 20, 134
};
const static uint16 initialVideoWindows_Common[24] = {
const static uint16 initialVideoWindows_Common[20] = {
3, 0, 14, 136,
0, 0, 3, 136,
17, 0, 3, 136,
@ -713,7 +713,7 @@ void AGOSEngine::setupGame() {
_stringIdLocalMin = 1;
for (int i = 0; i < 24; i++) {
for (int i = 0; i < 20; i++) {
if (getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2)
_videoWindows[i] = initialVideoWindows_Simon[i];
else

View File

@ -1036,6 +1036,8 @@ public:
void moveDirn_e2(Item *i, uint x);
void moveDirn_ww(Item *i, uint x);
int contains(Item *a, Item *b);
int sizeContents(Item *x);
int sizeOfRec(Item *o, int d);
int sizeRec(Item *x, int d);
@ -1056,6 +1058,8 @@ public:
void oe1_isNotAt();
void oe1_sibling();
void oe1_notSibling();
void oe1_isIn();
void oe1_isNotIn();
void oe1_isPlayer();
void oe1_canPut();
void oe1_copyof();

View File

@ -60,6 +60,16 @@ void AGOSEngine::xPlace(Item *x, Item *y) {
linkItem(x, y);
}
int AGOSEngine::contains(Item *a, Item *b) {
while (derefItem(b->parent)) {
if (derefItem(b->parent) == a)
return 1;
b = derefItem(b->parent);
}
return 0;
}
int AGOSEngine::sizeContents(Item *x) {
return sizeRec(x, 0);
}

View File

@ -55,8 +55,8 @@ static const char *const elvira1_opcodeNameTable[300] = {
/* 20 */
"WWJ|IS_LEF",
"WWJ|IS_GEF",
NULL,
NULL,
"WWJ|IS_IN",
"WWJ|IS_NOT_IN",
/* 24 */
NULL,
NULL,

View File

@ -189,6 +189,8 @@ void AGOSEngine::setupElvira1Opcodes(OpcodeProc *op) {
op[19] = &AGOSEngine::o_notEqf;
op[20] = &AGOSEngine::o_ltf;
op[21] = &AGOSEngine::o_gtf;
op[22] = &AGOSEngine::oe1_isIn;
op[23] = &AGOSEngine::oe1_isNotIn;
op[29] = &AGOSEngine::o_chance;
op[30] = &AGOSEngine::oe1_isPlayer;
@ -1818,6 +1820,20 @@ void AGOSEngine::oe1_notSibling() {
setScriptCondition(item1->parent != item2->parent);
}
void AGOSEngine::oe1_isIn() {
// 22: is in
Item *item1 = getNextItemPtr();
Item *item2 = getNextItemPtr();
setScriptCondition(contains(item1, item2) != 0);
}
void AGOSEngine::oe1_isNotIn() {
// 23: is not in
Item *item1 = getNextItemPtr();
Item *item2 = getNextItemPtr();
setScriptCondition(contains(item1, item2) == 0);
}
void AGOSEngine::oe1_isPlayer() {
// 30: is player
setScriptCondition(isPlayer(getNextItemPtr()));