mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-18 07:53:12 +00:00
Fix movement in Elvira 1
svn-id: r24260
This commit is contained in:
parent
043fe970c5
commit
c5044d67c9
@ -928,7 +928,6 @@ public:
|
||||
void o_mod();
|
||||
void o_modf();
|
||||
void o_random();
|
||||
void o_moveDirn();
|
||||
void o_goto();
|
||||
void o_oset();
|
||||
void o_oclear();
|
||||
@ -1041,6 +1040,10 @@ public:
|
||||
int sizeOfRec(Item *o, int d);
|
||||
int sizeRec(Item *x, int d);
|
||||
|
||||
int weighUp(Item *x);
|
||||
int weightRec(Item *x, int d);
|
||||
int weightOf(Item *x);
|
||||
|
||||
int canPlace(Item *x, Item *y);
|
||||
void xPlace(Item *x, Item *y);
|
||||
|
||||
@ -1058,7 +1061,9 @@ public:
|
||||
void oe1_copyof();
|
||||
void oe1_copyfo();
|
||||
void oe1_whatO();
|
||||
void oe1_weigh();
|
||||
void oe1_setFF();
|
||||
void oe1_moveDirn();
|
||||
void oe1_score();
|
||||
void oe1_doClass();
|
||||
void oe1_pobj();
|
||||
@ -1088,6 +1093,7 @@ public:
|
||||
void oe1_setStore();
|
||||
|
||||
// Opcodes, Elvira 2 only
|
||||
void oe2_moveDirn();
|
||||
void oe2_loadUserGame();
|
||||
void oe2_setDoorOpen();
|
||||
void oe2_setDoorClosed();
|
||||
|
@ -98,4 +98,33 @@ int AGOSEngine::sizeOfRec(Item *o, int d) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int AGOSEngine::weighUp(Item *x) {
|
||||
return weightRec(x, 0);
|
||||
}
|
||||
|
||||
int AGOSEngine::weightRec(Item *x, int d) {
|
||||
int n = weightOf(x);
|
||||
Item *o;
|
||||
|
||||
if (d > 32)
|
||||
return 0;
|
||||
o = derefItem(x->child);
|
||||
while (o) {
|
||||
n += weightRec(o, d + 1);
|
||||
o = derefItem(o->next);
|
||||
}
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
int AGOSEngine::weightOf(Item *x) {
|
||||
SubObject *o = (SubObject *)findChildOfType(x, 2);
|
||||
SubPlayer *p = (SubPlayer *)findChildOfType(x, 3);
|
||||
if (o)
|
||||
return o->objectWeight;
|
||||
if (p)
|
||||
return p->weight;
|
||||
return 0;
|
||||
}
|
||||
|
||||
} // End of namespace AGOS
|
||||
|
@ -101,7 +101,7 @@ static const char *const elvira1_opcodeNameTable[300] = {
|
||||
"WW|MOVE",
|
||||
"W|WHAT_O",
|
||||
NULL,
|
||||
NULL,
|
||||
"IW|WEIGH",
|
||||
/* 60 */
|
||||
"W|SET_FF",
|
||||
"W|ZERO",
|
||||
|
@ -209,6 +209,7 @@ void AGOSEngine::setupElvira1Opcodes(OpcodeProc *op) {
|
||||
op[56] = &AGOSEngine::o_copyff;
|
||||
op[57] = &AGOSEngine::oe1_whatO;
|
||||
|
||||
op[59] = &AGOSEngine::oe1_weigh;
|
||||
op[60] = &AGOSEngine::oe1_setFF;
|
||||
op[61] = &AGOSEngine::o_clear;
|
||||
|
||||
@ -225,7 +226,7 @@ void AGOSEngine::setupElvira1Opcodes(OpcodeProc *op) {
|
||||
op[74] = &AGOSEngine::o_modf;
|
||||
op[75] = &AGOSEngine::o_random;
|
||||
|
||||
op[76] = &AGOSEngine::o_moveDirn;
|
||||
op[76] = &AGOSEngine::oe1_moveDirn;
|
||||
op[77] = &AGOSEngine::o_goto;
|
||||
|
||||
op[80] = &AGOSEngine::o_oset;
|
||||
@ -350,7 +351,7 @@ void AGOSEngine::setupElvira2Opcodes(OpcodeProc *op) {
|
||||
op[34] = &AGOSEngine::oe1_copyof;
|
||||
op[35] = &AGOSEngine::oe1_copyfo;
|
||||
op[37] = &AGOSEngine::oe1_whatO;
|
||||
op[54] = &AGOSEngine::o_moveDirn;
|
||||
op[54] = &AGOSEngine::oe2_moveDirn;
|
||||
op[73] = &AGOSEngine::oe1_pobj;
|
||||
op[74] = &AGOSEngine::oe1_pName;
|
||||
op[75] = &AGOSEngine::oe1_pcName;
|
||||
@ -406,7 +407,7 @@ void AGOSEngine::setupWaxworksOpcodes(OpcodeProc *op) {
|
||||
op[34] = &AGOSEngine::oe1_copyof;
|
||||
op[37] = &AGOSEngine::oe1_whatO;
|
||||
op[35] = &AGOSEngine::oe1_copyfo;
|
||||
op[54] = &AGOSEngine::o_moveDirn;
|
||||
op[54] = &AGOSEngine::oww_moveDirn;
|
||||
op[55] = &AGOSEngine::oww_goto;
|
||||
op[70] = &AGOSEngine::o1_printLongText;
|
||||
op[73] = &AGOSEngine::oe1_pobj;
|
||||
@ -892,20 +893,6 @@ void AGOSEngine::o_random() {
|
||||
writeVariable(var, _rnd.getRandomNumber(value - 1));
|
||||
}
|
||||
|
||||
void AGOSEngine::o_moveDirn() {
|
||||
// 54: move direction
|
||||
int16 d = getVarOrByte();
|
||||
|
||||
if (getGameType() == GType_WW) {
|
||||
moveDirn_ww(me(), d);
|
||||
} else if (getGameType() == GType_ELVIRA2) {
|
||||
moveDirn_e2(me(), d);
|
||||
} else {
|
||||
moveDirn_e1(me(), d);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void AGOSEngine::o_goto() {
|
||||
// 55: set itemA parent
|
||||
uint item = getNextItemID();
|
||||
@ -1867,11 +1854,23 @@ void AGOSEngine::oe1_whatO() {
|
||||
_objectItem = findMaster(levelOf(me()), _scriptAdj2, _scriptNoun2);
|
||||
}
|
||||
|
||||
void AGOSEngine::oe1_weigh() {
|
||||
// 59: weight
|
||||
Item *item = getNextItemPtr();
|
||||
writeVariable(getVarOrWord(), weighUp(item));
|
||||
}
|
||||
|
||||
void AGOSEngine::oe1_setFF() {
|
||||
// 60: set FF
|
||||
writeNextVarContents(0xFF);
|
||||
}
|
||||
|
||||
void AGOSEngine::oe1_moveDirn() {
|
||||
// 54: move direction
|
||||
int16 d = readVariable(getVarOrWord());
|
||||
moveDirn_e1(me(), d);
|
||||
}
|
||||
|
||||
void AGOSEngine::oe1_score() {
|
||||
// 90: score
|
||||
SubPlayer *p = (SubPlayer *) findChildOfType(me(), 3);
|
||||
@ -1937,7 +1936,16 @@ void AGOSEngine::oe1_cFlag() {
|
||||
}
|
||||
|
||||
void AGOSEngine::oe1_means() {
|
||||
// 165: TODO
|
||||
// 165: means
|
||||
_scriptVerb = getNextWord();
|
||||
_scriptNoun1 = getNextWord();
|
||||
_scriptNoun2 = getNextWord();
|
||||
|
||||
if (getVarOrWord()) {
|
||||
int16 tmp = _scriptNoun1;
|
||||
_scriptNoun1 = _scriptNoun2;
|
||||
_scriptNoun2 = tmp;
|
||||
}
|
||||
}
|
||||
|
||||
void AGOSEngine::oe1_setUserItem() {
|
||||
@ -2125,6 +2133,12 @@ void AGOSEngine::oe1_setStore() {
|
||||
// Elvira 2 Opcodes
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
void AGOSEngine::oe2_moveDirn() {
|
||||
// 54: move direction
|
||||
int16 d = getVarOrByte();
|
||||
moveDirn_e2(me(), d);
|
||||
}
|
||||
|
||||
void AGOSEngine::oe2_loadUserGame() {
|
||||
// 89: load user game
|
||||
getStringPtrByID(getNextStringID());
|
||||
@ -2193,6 +2207,12 @@ void AGOSEngine::oe2_getSuperRoom() {
|
||||
// Waxworks Opcodes
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
void AGOSEngine::oww_moveDirn() {
|
||||
// 54: move direction
|
||||
int16 d = getVarOrByte();
|
||||
moveDirn_ww(me(), d);
|
||||
}
|
||||
|
||||
void AGOSEngine::oww_goto() {
|
||||
// 55: set itemA parent
|
||||
uint item = getNextItemID();
|
||||
|
Loading…
x
Reference in New Issue
Block a user