mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-13 21:31:53 +00:00
Add more code for Elvira 2
svn-id: r24142
This commit is contained in:
parent
38195077d4
commit
4b900edfeb
@ -999,11 +999,14 @@ public:
|
||||
int16 levelOf(Item *item);
|
||||
int wordMatch(Item *item, int16 a, int16 n);
|
||||
|
||||
uint16 getBackExit(int n);
|
||||
uint16 getDoorOf(Item *item, uint16 d);
|
||||
uint16 getDoorState(Item *item, uint16 d);
|
||||
uint16 getExitOf_e1(Item *item, uint16 d);
|
||||
uint16 getExitOf(Item *item, uint16 d);
|
||||
uint16 getExitState(Item *item, uint16 x, uint16 d);
|
||||
void changeDoorState(SubRoom *r, uint16 d, uint16 n);
|
||||
void setDoorState(Item *i, uint16 d, uint16 n);
|
||||
void moveDirn_e1(Item *i, uint x);
|
||||
void moveDirn_e2(Item *i, uint x);
|
||||
void moveDirn_ww(Item *i, uint x);
|
||||
@ -1040,6 +1043,9 @@ public:
|
||||
void oe1_printStats();
|
||||
|
||||
// Opcodes, Elvira 2 only
|
||||
void oe2_setDoorState1();
|
||||
void oe2_setDoorState2();
|
||||
void oe2_setDoorState3();
|
||||
void oe2_opcode161();
|
||||
|
||||
// Opcodes, Waxworks only
|
||||
|
@ -566,10 +566,10 @@ static const char *const ww_opcode_name_table[256] = {
|
||||
"WJ|IS_BOX",
|
||||
"I|START_ITEM_SUB",
|
||||
/* 144 */
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
"IB|SET_DOOR_STATE1",
|
||||
"IB|SET_DOOR_STATE2",
|
||||
"IB|SET_DOOR_STATE3",
|
||||
"IB|SET_DOOR_STATE2",
|
||||
/* 148 */
|
||||
"IB|IF_DOOR_OPEN",
|
||||
NULL,
|
||||
|
@ -330,6 +330,10 @@ void AGOSEngine::setupElvira2Opcodes(OpcodeProc *op) {
|
||||
op[98] = &AGOSEngine::o1_animate;
|
||||
op[99] = &AGOSEngine::o1_stopAnimate;
|
||||
op[127] = &AGOSEngine::o1_playTune;
|
||||
op[144] = &AGOSEngine::oe2_setDoorState1;
|
||||
op[145] = &AGOSEngine::oe2_setDoorState2;
|
||||
op[146] = &AGOSEngine::oe2_setDoorState3;
|
||||
op[147] = &AGOSEngine::oe2_setDoorState2;
|
||||
op[148] = &AGOSEngine::oww_ifDoorOpen;
|
||||
op[161] = &AGOSEngine::oe2_opcode161;
|
||||
op[175] = &AGOSEngine::o_getDollar2;
|
||||
@ -374,6 +378,10 @@ void AGOSEngine::setupWaxworksOpcodes(OpcodeProc *op) {
|
||||
op[105] = &AGOSEngine::oww_menu;
|
||||
op[106] = &AGOSEngine::oww_textMenu;
|
||||
op[127] = &AGOSEngine::o1_playTune;
|
||||
op[144] = &AGOSEngine::oe2_setDoorState1;
|
||||
op[145] = &AGOSEngine::oe2_setDoorState2;
|
||||
op[146] = &AGOSEngine::oe2_setDoorState3;
|
||||
op[147] = &AGOSEngine::oe2_setDoorState2;
|
||||
op[148] = &AGOSEngine::oww_ifDoorOpen;
|
||||
op[175] = &AGOSEngine::o_getDollar2;
|
||||
op[179] = &AGOSEngine::o_isAdjNoun;
|
||||
@ -1899,6 +1907,24 @@ void AGOSEngine::oe1_printStats() {
|
||||
// Elvira 2 Opcodes
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
void AGOSEngine::oe2_setDoorState1() {
|
||||
// 144:
|
||||
Item *i = getNextItemPtr();
|
||||
setDoorState(i, getVarOrByte(), 1);
|
||||
}
|
||||
|
||||
void AGOSEngine::oe2_setDoorState2() {
|
||||
// 145:
|
||||
Item *i = getNextItemPtr();
|
||||
setDoorState(i, getVarOrByte(), 2);
|
||||
}
|
||||
|
||||
void AGOSEngine::oe2_setDoorState3() {
|
||||
// 146:
|
||||
Item *i = getNextItemPtr();
|
||||
setDoorState(i, getVarOrByte(), 3);
|
||||
}
|
||||
|
||||
void AGOSEngine::oe2_opcode161() {
|
||||
// 161:
|
||||
}
|
||||
|
@ -30,6 +30,19 @@ using Common::File;
|
||||
|
||||
namespace AGOS {
|
||||
|
||||
uint16 AGOSEngine::getBackExit(int n) {
|
||||
switch (n) {
|
||||
case 0:return 2;
|
||||
case 1:return 3;
|
||||
case 2:return 0;
|
||||
case 3:return 1;
|
||||
case 4:return 5;
|
||||
case 5:return 4;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint16 AGOSEngine::getDoorOf(Item *i, uint16 d) {
|
||||
SubGenExit *g;
|
||||
Item *x;
|
||||
@ -116,6 +129,53 @@ uint16 AGOSEngine::getExitState(Item *i, uint16 x, uint16 d) {
|
||||
return n;
|
||||
}
|
||||
|
||||
void AGOSEngine::changeDoorState(SubRoom *r, uint16 d, uint16 n) {
|
||||
uint16 mask=3;
|
||||
d <<= 1;
|
||||
mask <<= d;
|
||||
n <<= d;
|
||||
r->roomExitStates &= ~mask;
|
||||
r->roomExitStates|= n;
|
||||
}
|
||||
|
||||
void AGOSEngine::setDoorState(Item *i, uint16 d, uint16 n) {
|
||||
Item *j;
|
||||
SubRoom *r, *r1;
|
||||
uint16 d1;
|
||||
uint16 y = 0;
|
||||
|
||||
r = (SubRoom *)findChildOfType(i, 1);
|
||||
if (r == NULL)
|
||||
return;
|
||||
d1 = d;
|
||||
while (d > y) {
|
||||
if (getDoorState(i, y) == 0)
|
||||
d1--;
|
||||
y++;
|
||||
}
|
||||
changeDoorState(r, d, n);
|
||||
|
||||
j = derefItem(r->roomExit[d1]);
|
||||
if (j == NULL)
|
||||
return;
|
||||
r1 = (SubRoom *)findChildOfType(j, 1);
|
||||
if (r1 == NULL)
|
||||
return;
|
||||
d = getBackExit(d);
|
||||
d1 = d;
|
||||
y = 0;
|
||||
while(d > y) {
|
||||
if (getDoorState(j, y) == 0)
|
||||
d1--;
|
||||
y++;
|
||||
}
|
||||
/* Check are a complete exit pair */
|
||||
if (derefItem(r1->roomExit[d1]) != i)
|
||||
return;
|
||||
/* Change state of exit coming back */
|
||||
changeDoorState(r1, d, n);
|
||||
}
|
||||
|
||||
void AGOSEngine::moveDirn_e1(Item *i, uint x) {
|
||||
Item *d, *p;
|
||||
uint16 n;
|
||||
|
Loading…
Reference in New Issue
Block a user