AGOS: cleanup

svn-id: r48227
This commit is contained in:
Max Horn 2010-03-10 20:56:54 +00:00
parent 80fae481b0
commit 8d1431a5ab
2 changed files with 57 additions and 54 deletions

View File

@ -263,62 +263,65 @@ void AGOSEngine::moveDirn(Item *i, uint x) {
// Elvira 2 specific
int AGOSEngine_Elvira2::changeExitStates(SubSuperRoom *sr, int n, int d, uint16 s) {
int b, bd;
uint16 mask = 3;
uint16 bs = s;
uint16 mask;
switch (d) {
case 0:
b =- (sr->roomX); bd = 2;
if (((n % (sr->roomX * sr->roomY)) / sr->roomX) == 0)
return(0);
else
break;
case 1:
b = 1; bd = 3;
if (((n % (sr->roomX * sr->roomY)) % sr->roomX) == 0)
return 0;
else
break;
case 2:
b = sr->roomX; bd = 0;
if (((n % (sr->roomX * sr->roomY)) / sr->roomX) == (sr->roomY - 1))
return 0;
else
break;
case 3:
b =- 1; bd = 1;
if (((n % (sr->roomX * sr->roomY)) % sr->roomX) == 1)
return 0;
else
break;
case 4:
b =- (sr->roomX * sr->roomY); bd = 5;
if (n < (sr->roomX * sr->roomY))
return 0;
else
break;
case 5:
b = sr->roomX * sr->roomY; bd = 4;
if (n > (sr->roomX * sr->roomY * (sr->roomZ - 1)))
return 0;
else
break;
default:
case 0:
b = -(sr->roomX);
bd = 2;
if (((n % (sr->roomX * sr->roomY)) / sr->roomX) == 0)
return 0;
else
break;
case 1:
b = 1;
bd = 3;
if (((n % (sr->roomX * sr->roomY)) % sr->roomX) == 0)
return 0;
else
break;
case 2:
b = sr->roomX;
bd = 0;
if (((n % (sr->roomX * sr->roomY)) / sr->roomX) == (sr->roomY - 1))
return 0;
else
break;
case 3:
b = -1;
bd = 1;
if (((n % (sr->roomX * sr->roomY)) % sr->roomX) == 1)
return 0;
else
break;
case 4:
b = -(sr->roomX * sr->roomY);
bd = 5;
if (n < (sr->roomX * sr->roomY))
return 0;
else
break;
case 5:
b = sr->roomX * sr->roomY;
bd = 4;
if (n > (sr->roomX * sr->roomY * (sr->roomZ - 1)))
return 0;
else
break;
default:
return 0;
}
n--;
d <<= 1;
mask <<= d;
s <<= d;
mask = (3 << d);
sr->roomExitStates[n] &= ~mask;
sr->roomExitStates[n] |= s;
mask = 3;
n += b;
sr->roomExitStates[n] |= (s << d);
bd <<= 1;
mask <<= bd;
bs <<= bd;
sr->roomExitStates[n] &= ~mask;
sr->roomExitStates[n] |= bs;
mask = (3 << bd);
sr->roomExitStates[n + b] &= ~mask;
sr->roomExitStates[n + b] |= (s << bd);
return 1;
}

View File

@ -644,17 +644,17 @@ void AGOSEngine_Elvira2::oe2_printMonsterDamage() {
void AGOSEngine_Elvira2::oe2_isAdjNoun() {
// 179: item unk1 unk2 is
Item *item = getNextItemPtr();
int16 a = getNextWord(), n = getNextWord();
int16 a = getNextWord();
int16 n = getNextWord();
if (getGameType() == GType_ELVIRA2) {
if (getGameType() == GType_ELVIRA2 && item == NULL) {
// WORKAROUND bug #1745996: A NULL item can occur when
// interacting with items in the dinning room
if (item == NULL) {
setScriptCondition(false);
return;
}
setScriptCondition(false);
return;
}
assert(item);
setScriptCondition(item->adjective == a && item->noun == n);
}