mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-13 21:31:53 +00:00
Putting evalBoolResult() and evalExpr() into Script
svn-id: r41760
This commit is contained in:
parent
850203fc73
commit
7d005f62c3
@ -157,46 +157,6 @@ void Inter::initControlVars(char full) {
|
||||
}
|
||||
}
|
||||
|
||||
char Inter::evalExpr(int16 *pRes) {
|
||||
byte type;
|
||||
|
||||
_vm->_parse->printExpr(99);
|
||||
|
||||
_vm->_game->_script->readExpr(99, &type);
|
||||
if (!pRes)
|
||||
return type;
|
||||
|
||||
switch (type) {
|
||||
case TYPE_IMM_INT16:
|
||||
*pRes = _vm->_game->_script->getResultInt();
|
||||
break;
|
||||
|
||||
case TYPE_IMM_STR:
|
||||
case GOB_FALSE:
|
||||
*pRes = 0;
|
||||
break;
|
||||
|
||||
case GOB_TRUE:
|
||||
*pRes = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
bool Inter::evalBoolResult() {
|
||||
byte type;
|
||||
|
||||
_vm->_parse->printExpr(99);
|
||||
|
||||
_vm->_game->_script->readExpr(99, &type);
|
||||
if ( (type == GOB_TRUE) ||
|
||||
((type == TYPE_IMM_INT16) && _vm->_game->_script->getResultInt()))
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
void Inter::renewTimeInVars() {
|
||||
struct tm t;
|
||||
_vm->_system->getTimeAndDate(t);
|
||||
|
@ -100,8 +100,6 @@ public:
|
||||
void setupOpcodes();
|
||||
|
||||
void initControlVars(char full);
|
||||
char evalExpr(int16 *pRes);
|
||||
bool evalBoolResult();
|
||||
void renewTimeInVars();
|
||||
void storeMouse();
|
||||
void storeKey(int16 key);
|
||||
|
@ -221,37 +221,37 @@ void Inter_Fascination::oFascin_cdUnknown3() {
|
||||
void Inter_Fascination::oFascin_cdUnknown4() {
|
||||
int16 expr;
|
||||
warning("Fascination oFascin_cdUnknown4");
|
||||
evalExpr(&expr);
|
||||
warning ("evalExpr: %d, the rest is not yet implemented",expr);
|
||||
_vm->_game->_script->evalExpr(&expr);
|
||||
warning ("_vm->_game->_script->evalExpr: %d, the rest is not yet implemented",expr);
|
||||
}
|
||||
|
||||
void Inter_Fascination::oFascin_cdUnknown5() {
|
||||
int16 retVal1,expr;
|
||||
warning("Fascination oFascin_cdUnknown5");
|
||||
evalExpr(&expr);
|
||||
_vm->_game->_script->evalExpr(&expr);
|
||||
retVal1 = _vm->_game->_script->readVarIndex();
|
||||
warning ("evalExpr: %d Variable index %d, the rest is not yet implemented",expr, retVal1);
|
||||
warning ("_vm->_game->_script->evalExpr: %d Variable index %d, the rest is not yet implemented",expr, retVal1);
|
||||
}
|
||||
|
||||
void Inter_Fascination::oFascin_cdUnknown6() {
|
||||
int16 retVal1,expr;
|
||||
warning("Fascination oFascin_cdUnknown6");
|
||||
evalExpr(&expr);
|
||||
_vm->_game->_script->evalExpr(&expr);
|
||||
retVal1 = _vm->_game->_script->readVarIndex();
|
||||
warning ("evalExpr: %d Variable index %d, the rest is not yet implemented",expr, retVal1);
|
||||
warning ("_vm->_game->_script->evalExpr: %d Variable index %d, the rest is not yet implemented",expr, retVal1);
|
||||
}
|
||||
|
||||
void Inter_Fascination::oFascin_setRenderFlags() {
|
||||
int16 expr;
|
||||
// warning("Fascination oFascin_cdUnknown10 (set render flags)");
|
||||
evalExpr(&expr);
|
||||
_vm->_game->_script->evalExpr(&expr);
|
||||
warning("_draw_renderFlags <- %d",expr);
|
||||
_vm->_draw->_renderFlags = expr;
|
||||
}
|
||||
|
||||
void Inter_Fascination::oFascin_cdUnknown11() {
|
||||
// warning("Fascination oFascin_cdUnknown11 (set variable)");
|
||||
evalExpr(0);
|
||||
_vm->_game->_script->evalExpr(0);
|
||||
}
|
||||
|
||||
void Inter_Fascination::oFascin_playProtracker(OpGobParams ¶ms) {
|
||||
|
@ -254,7 +254,7 @@ void Inter_v1::checkSwitchTable(uint32 &offset) {
|
||||
len = _vm->_game->_script->readInt8();
|
||||
while (len != -5) {
|
||||
for (int i = 0; i < len; i++) {
|
||||
evalExpr(0);
|
||||
_vm->_game->_script->evalExpr(0);
|
||||
|
||||
if (_terminate)
|
||||
return;
|
||||
@ -401,11 +401,11 @@ void Inter_v1::o1_updateAnim() {
|
||||
int16 layer;
|
||||
int16 animation;
|
||||
|
||||
evalExpr(&deltaX);
|
||||
evalExpr(&deltaY);
|
||||
evalExpr(&animation);
|
||||
evalExpr(&layer);
|
||||
evalExpr(&frame);
|
||||
_vm->_game->_script->evalExpr(&deltaX);
|
||||
_vm->_game->_script->evalExpr(&deltaY);
|
||||
_vm->_game->_script->evalExpr(&animation);
|
||||
_vm->_game->_script->evalExpr(&layer);
|
||||
_vm->_game->_script->evalExpr(&frame);
|
||||
flags = _vm->_game->_script->readInt16();
|
||||
_vm->_scenery->updateAnim(layer, frame, animation, flags,
|
||||
deltaX, deltaY, 1);
|
||||
@ -517,10 +517,10 @@ void Inter_v1::o1_loadMultObject() {
|
||||
int16 objIndex;
|
||||
byte *multData;
|
||||
|
||||
evalExpr(&objIndex);
|
||||
evalExpr(&val);
|
||||
_vm->_game->_script->evalExpr(&objIndex);
|
||||
_vm->_game->_script->evalExpr(&val);
|
||||
*_vm->_mult->_objects[objIndex].pPosX = val;
|
||||
evalExpr(&val);
|
||||
_vm->_game->_script->evalExpr(&val);
|
||||
*_vm->_mult->_objects[objIndex].pPosY = val;
|
||||
|
||||
debugC(4, kDebugGameFlow, "Loading mult object %d", objIndex);
|
||||
@ -528,7 +528,7 @@ void Inter_v1::o1_loadMultObject() {
|
||||
multData = (byte *) _vm->_mult->_objects[objIndex].pAnimData;
|
||||
for (int i = 0; i < 11; i++) {
|
||||
if (_vm->_game->_script->peekUint16() != 99) {
|
||||
evalExpr(&val);
|
||||
_vm->_game->_script->evalExpr(&val);
|
||||
multData[i] = val;
|
||||
} else
|
||||
_vm->_game->_script->skip(1);
|
||||
@ -542,8 +542,8 @@ void Inter_v1::o1_getAnimLayerInfo() {
|
||||
int16 varUnk0;
|
||||
int16 varFrames;
|
||||
|
||||
evalExpr(&anim);
|
||||
evalExpr(&layer);
|
||||
_vm->_game->_script->evalExpr(&anim);
|
||||
_vm->_game->_script->evalExpr(&layer);
|
||||
|
||||
varDX = _vm->_game->_script->readVarIndex();
|
||||
varDY = _vm->_game->_script->readVarIndex();
|
||||
@ -557,7 +557,7 @@ void Inter_v1::o1_getAnimLayerInfo() {
|
||||
void Inter_v1::o1_getObjAnimSize() {
|
||||
int16 objIndex;
|
||||
|
||||
evalExpr(&objIndex);
|
||||
_vm->_game->_script->evalExpr(&objIndex);
|
||||
|
||||
Mult::Mult_AnimData &animData = *(_vm->_mult->_objects[objIndex].pAnimData);
|
||||
if (animData.isStatic == 0)
|
||||
@ -585,18 +585,18 @@ void Inter_v1::o1_renderStatic() {
|
||||
int16 layer;
|
||||
int16 index;
|
||||
|
||||
evalExpr(&index);
|
||||
evalExpr(&layer);
|
||||
_vm->_game->_script->evalExpr(&index);
|
||||
_vm->_game->_script->evalExpr(&layer);
|
||||
_vm->_scenery->renderStatic(index, layer);
|
||||
}
|
||||
|
||||
void Inter_v1::o1_loadCurLayer() {
|
||||
evalExpr(&_vm->_scenery->_curStatic);
|
||||
evalExpr(&_vm->_scenery->_curStaticLayer);
|
||||
_vm->_game->_script->evalExpr(&_vm->_scenery->_curStatic);
|
||||
_vm->_game->_script->evalExpr(&_vm->_scenery->_curStaticLayer);
|
||||
}
|
||||
|
||||
void Inter_v1::o1_playCDTrack() {
|
||||
evalExpr(0);
|
||||
_vm->_game->_script->evalExpr(0);
|
||||
_vm->_sound->adlibPlayBgMusic(); // Mac version
|
||||
_vm->_sound->cdPlay(_vm->_game->_script->getResultStr()); // PC CD version
|
||||
}
|
||||
@ -745,7 +745,7 @@ bool Inter_v1::o1_repeatUntil(OpFuncParams ¶ms) {
|
||||
|
||||
_vm->_game->_script->seek(blockPos + size + 1);
|
||||
|
||||
flag = evalBoolResult();
|
||||
flag = _vm->_game->_script->evalBoolResult();
|
||||
} while (!flag && !_break && !_terminate && !_vm->shouldQuit());
|
||||
|
||||
_nestLevel[0]--;
|
||||
@ -765,7 +765,7 @@ bool Inter_v1::o1_whileDo(OpFuncParams ¶ms) {
|
||||
do {
|
||||
uint32 startPos = _vm->_game->_script->pos();
|
||||
|
||||
flag = evalBoolResult();
|
||||
flag = _vm->_game->_script->evalBoolResult();
|
||||
|
||||
if (_terminate)
|
||||
return false;
|
||||
@ -799,7 +799,7 @@ bool Inter_v1::o1_if(OpFuncParams ¶ms) {
|
||||
byte cmd;
|
||||
bool boolRes;
|
||||
|
||||
boolRes = evalBoolResult();
|
||||
boolRes = _vm->_game->_script->evalBoolResult();
|
||||
if (boolRes) {
|
||||
if ((params.counter == params.cmdCount) && (params.retFlag == 2))
|
||||
return true;
|
||||
@ -843,7 +843,7 @@ bool Inter_v1::o1_assign(OpFuncParams ¶ms) {
|
||||
int16 dest = _vm->_game->_script->readVarIndex();
|
||||
|
||||
int16 result;
|
||||
int16 srcType = evalExpr(&result);
|
||||
int16 srcType = _vm->_game->_script->evalExpr(&result);
|
||||
|
||||
switch (destType) {
|
||||
case TYPE_VAR_INT32:
|
||||
@ -940,7 +940,7 @@ bool Inter_v1::o1_loadTot(OpFuncParams ¶ms) {
|
||||
|
||||
if ((_vm->_game->_script->peekByte() & 0x80) != 0) {
|
||||
_vm->_game->_script->skip(1);
|
||||
evalExpr(0);
|
||||
_vm->_game->_script->evalExpr(0);
|
||||
strncpy0(buf, _vm->_game->_script->getResultStr(), 15);
|
||||
} else {
|
||||
size = _vm->_game->_script->readInt8();
|
||||
@ -1581,7 +1581,7 @@ bool Inter_v1::o1_checkData(OpFuncParams ¶ms) {
|
||||
int16 handle;
|
||||
int16 varOff;
|
||||
|
||||
evalExpr(0);
|
||||
_vm->_game->_script->evalExpr(0);
|
||||
varOff = _vm->_game->_script->readVarIndex();
|
||||
handle = _vm->_dataIO->openData(_vm->_game->_script->getResultStr());
|
||||
|
||||
@ -1606,7 +1606,7 @@ bool Inter_v1::o1_insertStr(OpFuncParams ¶ms) {
|
||||
int16 strVar;
|
||||
|
||||
strVar = _vm->_game->_script->readVarIndex();
|
||||
evalExpr(0);
|
||||
_vm->_game->_script->evalExpr(0);
|
||||
pos = _vm->_game->_script->readValExpr();
|
||||
|
||||
char *str = GET_VARO_FSTR(strVar);
|
||||
@ -1632,7 +1632,7 @@ bool Inter_v1::o1_strstr(OpFuncParams ¶ms) {
|
||||
int16 pos;
|
||||
|
||||
strVar = _vm->_game->_script->readVarIndex();
|
||||
evalExpr(0);
|
||||
_vm->_game->_script->evalExpr(0);
|
||||
resVar = _vm->_game->_script->readVarIndex();
|
||||
|
||||
char *res = strstr(GET_VARO_STR(strVar), _vm->_game->_script->getResultStr());
|
||||
@ -1691,7 +1691,7 @@ bool Inter_v1::o1_blitCursor(OpFuncParams ¶ms) {
|
||||
bool Inter_v1::o1_loadFont(OpFuncParams ¶ms) {
|
||||
int16 index;
|
||||
|
||||
evalExpr(0);
|
||||
_vm->_game->_script->evalExpr(0);
|
||||
index = _vm->_game->_script->readInt16();
|
||||
|
||||
delete _vm->_draw->_fonts[index];
|
||||
@ -1724,7 +1724,7 @@ bool Inter_v1::o1_readData(OpFuncParams ¶ms) {
|
||||
int16 offset;
|
||||
int16 handle;
|
||||
|
||||
evalExpr(0);
|
||||
_vm->_game->_script->evalExpr(0);
|
||||
dataVar = _vm->_game->_script->readVarIndex();
|
||||
size = _vm->_game->_script->readValExpr();
|
||||
offset = _vm->_game->_script->readValExpr();
|
||||
@ -1769,7 +1769,7 @@ bool Inter_v1::o1_writeData(OpFuncParams ¶ms) {
|
||||
// (Gobliiins 1 doesn't use save file), so we just warn should it be
|
||||
// called regardless.
|
||||
|
||||
evalExpr(0);
|
||||
_vm->_game->_script->evalExpr(0);
|
||||
dataVar = _vm->_game->_script->readVarIndex();
|
||||
size = _vm->_game->_script->readValExpr();
|
||||
offset = _vm->_game->_script->readValExpr();
|
||||
@ -1781,7 +1781,7 @@ bool Inter_v1::o1_writeData(OpFuncParams ¶ms) {
|
||||
}
|
||||
|
||||
bool Inter_v1::o1_manageDataFile(OpFuncParams ¶ms) {
|
||||
evalExpr(0);
|
||||
_vm->_game->_script->evalExpr(0);
|
||||
|
||||
if (_vm->_game->_script->getResultStr()[0] != 0)
|
||||
_vm->_dataIO->openDataFile(_vm->_game->_script->getResultStr());
|
||||
|
@ -211,7 +211,7 @@ void Inter_v2::checkSwitchTable(uint32 &offset) {
|
||||
|
||||
default:
|
||||
if (!found) {
|
||||
evalExpr(0);
|
||||
_vm->_game->_script->evalExpr(0);
|
||||
if (value == _vm->_game->_script->getResultInt())
|
||||
found = true;
|
||||
} else
|
||||
@ -507,7 +507,7 @@ void Inter_v2::o2_playCDTrack() {
|
||||
if (!(_vm->_draw->_renderFlags & RENDERFLAG_NOBLITINVALIDATED))
|
||||
_vm->_draw->blitInvalidated();
|
||||
|
||||
evalExpr(0);
|
||||
_vm->_game->_script->evalExpr(0);
|
||||
_vm->_sound->cdPlay(_vm->_game->_script->getResultStr());
|
||||
}
|
||||
|
||||
@ -525,7 +525,7 @@ void Inter_v2::o2_stopCD() {
|
||||
void Inter_v2::o2_readLIC() {
|
||||
char path[40];
|
||||
|
||||
evalExpr(0);
|
||||
_vm->_game->_script->evalExpr(0);
|
||||
strncpy0(path, _vm->_game->_script->getResultStr(), 35);
|
||||
strcat(path, ".LIC");
|
||||
|
||||
@ -573,7 +573,7 @@ void Inter_v2::o2_totSub() {
|
||||
error("Length in o2_totSub is greater than 13 (%d)", length);
|
||||
|
||||
if (length & 0x80) {
|
||||
evalExpr(0);
|
||||
_vm->_game->_script->evalExpr(0);
|
||||
strcpy(totFile, _vm->_game->_script->getResultStr());
|
||||
} else {
|
||||
for (i = 0; i < length; i++)
|
||||
@ -619,7 +619,7 @@ void Inter_v2::o2_pushVars() {
|
||||
} else {
|
||||
int32 n = _vm->_game->_script->getResultInt();
|
||||
|
||||
if (evalExpr(&varOff) != 20)
|
||||
if (_vm->_game->_script->evalExpr(&varOff) != 20)
|
||||
n = 0;
|
||||
|
||||
memcpy(_varStack + _varStackPos, &n, 4);
|
||||
@ -958,7 +958,7 @@ void Inter_v2::o2_playImd() {
|
||||
uint16 palCmd;
|
||||
bool close;
|
||||
|
||||
evalExpr(0);
|
||||
_vm->_game->_script->evalExpr(0);
|
||||
_vm->_game->_script->getResultStr()[8] = 0;
|
||||
strncpy0(imd, _vm->_game->_script->getResultStr(), 127);
|
||||
|
||||
@ -1002,7 +1002,7 @@ void Inter_v2::o2_getImdInfo() {
|
||||
int16 varFrames;
|
||||
int16 varWidth, varHeight;
|
||||
|
||||
evalExpr(0);
|
||||
_vm->_game->_script->evalExpr(0);
|
||||
varX = _vm->_game->_script->readVarIndex();
|
||||
varY = _vm->_game->_script->readVarIndex();
|
||||
varFrames = _vm->_game->_script->readVarIndex();
|
||||
@ -1022,7 +1022,7 @@ void Inter_v2::o2_getImdInfo() {
|
||||
void Inter_v2::o2_openItk() {
|
||||
char fileName[32];
|
||||
|
||||
evalExpr(0);
|
||||
_vm->_game->_script->evalExpr(0);
|
||||
strncpy0(fileName, _vm->_game->_script->getResultStr(), 27);
|
||||
if (!strchr(fileName, '.'))
|
||||
strcat(fileName, ".ITK");
|
||||
@ -1053,7 +1053,7 @@ bool Inter_v2::o2_assign(OpFuncParams ¶ms) {
|
||||
|
||||
for (int i = 0; i < loopCount; i++) {
|
||||
int16 result;
|
||||
int16 srcType = evalExpr(&result);
|
||||
int16 srcType = _vm->_game->_script->evalExpr(&result);
|
||||
|
||||
switch (destType) {
|
||||
case TYPE_VAR_INT8:
|
||||
@ -1305,7 +1305,7 @@ bool Inter_v2::o2_checkData(OpFuncParams ¶ms) {
|
||||
int32 size;
|
||||
SaveLoad::SaveMode mode;
|
||||
|
||||
evalExpr(0);
|
||||
_vm->_game->_script->evalExpr(0);
|
||||
varOff = _vm->_game->_script->readVarIndex();
|
||||
|
||||
size = -1;
|
||||
@ -1345,10 +1345,10 @@ bool Inter_v2::o2_readData(OpFuncParams ¶ms) {
|
||||
byte *buf;
|
||||
SaveLoad::SaveMode mode;
|
||||
|
||||
evalExpr(0);
|
||||
_vm->_game->_script->evalExpr(0);
|
||||
dataVar = _vm->_game->_script->readVarIndex();
|
||||
size = _vm->_game->_script->readValExpr();
|
||||
evalExpr(0);
|
||||
_vm->_game->_script->evalExpr(0);
|
||||
offset = _vm->_game->_script->getResultInt();
|
||||
retSize = 0;
|
||||
|
||||
@ -1416,10 +1416,10 @@ bool Inter_v2::o2_writeData(OpFuncParams ¶ms) {
|
||||
int16 dataVar;
|
||||
SaveLoad::SaveMode mode;
|
||||
|
||||
evalExpr(0);
|
||||
_vm->_game->_script->evalExpr(0);
|
||||
dataVar = _vm->_game->_script->readVarIndex();
|
||||
size = _vm->_game->_script->readValExpr();
|
||||
evalExpr(0);
|
||||
_vm->_game->_script->evalExpr(0);
|
||||
offset = _vm->_game->_script->getResultInt();
|
||||
|
||||
debugC(2, kDebugFileIO, "Write to file \"%s\" (%d, %d bytes at %d)",
|
||||
|
@ -152,7 +152,7 @@ void Inter_v4::o4_playVmdOrMusic() {
|
||||
uint16 palCmd;
|
||||
bool close;
|
||||
|
||||
evalExpr(0);
|
||||
_vm->_game->_script->evalExpr(0);
|
||||
strncpy0(fileName, _vm->_game->_script->getResultStr(), 127);
|
||||
|
||||
// WORKAROUND: The nut rolling animation in the administration center
|
||||
|
@ -94,7 +94,7 @@ void Inter_v5::setupOpcodesGob() {
|
||||
}
|
||||
|
||||
void Inter_v5::o5_deleteFile() {
|
||||
evalExpr(0);
|
||||
_vm->_game->_script->evalExpr(0);
|
||||
|
||||
warning("Dynasty Stub: deleteFile \"%s\"", _vm->_game->_script->getResultStr());
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ void Inter_v6::o6_totSub() {
|
||||
error("Length in o2_totSub is greater than 13 (%d)", length);
|
||||
|
||||
if (length & 0x80) {
|
||||
evalExpr(0);
|
||||
_vm->_game->_script->evalExpr(0);
|
||||
strcpy(totFile, _vm->_game->_script->getResultStr());
|
||||
} else {
|
||||
for (i = 0; i < length; i++)
|
||||
@ -109,7 +109,7 @@ void Inter_v6::o6_playVmdOrMusic() {
|
||||
uint16 palCmd;
|
||||
bool close;
|
||||
|
||||
evalExpr(0);
|
||||
_vm->_game->_script->evalExpr(0);
|
||||
strncpy0(fileName, _vm->_game->_script->getResultStr(), 127);
|
||||
|
||||
x = _vm->_game->_script->readValExpr();
|
||||
@ -175,7 +175,7 @@ void Inter_v6::o6_playVmdOrMusic() {
|
||||
void Inter_v6::o6_openItk() {
|
||||
char fileName[32];
|
||||
|
||||
evalExpr(0);
|
||||
_vm->_game->_script->evalExpr(0);
|
||||
strncpy0(fileName, _vm->_game->_script->getResultStr(), 27);
|
||||
if (!strchr(fileName, '.'))
|
||||
strcat(fileName, ".ITK");
|
||||
@ -272,7 +272,7 @@ bool Inter_v6::o6_assign(OpFuncParams ¶ms) {
|
||||
|
||||
_vm->_game->_script->pop();
|
||||
|
||||
evalExpr(&src);
|
||||
_vm->_game->_script->evalExpr(&src);
|
||||
|
||||
return false;
|
||||
}
|
||||
@ -301,7 +301,7 @@ bool Inter_v6::o6_assign(OpFuncParams ¶ms) {
|
||||
|
||||
for (int i = 0; i < loopCount; i++) {
|
||||
int16 result;
|
||||
int16 srcType = evalExpr(&result);
|
||||
int16 srcType = _vm->_game->_script->evalExpr(&result);
|
||||
|
||||
switch (destType) {
|
||||
case TYPE_VAR_INT8:
|
||||
@ -393,7 +393,7 @@ bool Inter_v6::o6_fillRect(OpFuncParams ¶ms) {
|
||||
_vm->_draw->_spriteRight = _vm->_game->_script->readValExpr();
|
||||
_vm->_draw->_spriteBottom = _vm->_game->_script->readValExpr();
|
||||
|
||||
evalExpr(0);
|
||||
_vm->_game->_script->evalExpr(0);
|
||||
|
||||
_vm->_draw->_backColor = _vm->_game->_script->getResultInt() & 0xFFFF;
|
||||
uint16 extraVar = _vm->_game->_script->getResultInt() >> 16;
|
||||
|
@ -106,7 +106,7 @@ int16 Scenery::loadStatic(char search) {
|
||||
int16 sprResId;
|
||||
int16 sprIndex;
|
||||
|
||||
_vm->_inter->evalExpr(&sceneryIndex);
|
||||
_vm->_game->_script->evalExpr(&sceneryIndex);
|
||||
|
||||
size = _vm->_game->_script->readInt16();
|
||||
backsPtr = (int16 *) (_vm->_game->_script->getData() + _vm->_game->_script->pos());
|
||||
@ -212,7 +212,7 @@ void Scenery::freeStatic(int16 index) {
|
||||
int16 spr;
|
||||
|
||||
if (index == -1)
|
||||
_vm->_inter->evalExpr(&index);
|
||||
_vm->_game->_script->evalExpr(&index);
|
||||
|
||||
if (_staticPictCount[index] == -1)
|
||||
return;
|
||||
@ -433,7 +433,7 @@ int16 Scenery::loadAnim(char search) {
|
||||
uint32 layerPos;
|
||||
|
||||
extData = 0;
|
||||
_vm->_inter->evalExpr(&sceneryIndex);
|
||||
_vm->_game->_script->evalExpr(&sceneryIndex);
|
||||
picsCount = _vm->_game->_script->readInt16();
|
||||
resId = _vm->_game->_script->readInt16();
|
||||
|
||||
@ -546,7 +546,7 @@ void Scenery::freeAnim(int16 index) {
|
||||
int16 spr;
|
||||
|
||||
if (index == -1)
|
||||
_vm->_inter->evalExpr(&index);
|
||||
_vm->_game->_script->evalExpr(&index);
|
||||
|
||||
if (_animPictCount[index] == 0)
|
||||
return;
|
||||
|
@ -247,6 +247,46 @@ void Script::skipExpr(char stopToken) {
|
||||
_parser->skipExpr(stopToken);
|
||||
}
|
||||
|
||||
char Script::evalExpr(int16 *pRes) {
|
||||
byte type;
|
||||
|
||||
_parser->printExpr(99);
|
||||
|
||||
_parser->parseExpr(99, &type);
|
||||
if (!pRes)
|
||||
return type;
|
||||
|
||||
switch (type) {
|
||||
case TYPE_IMM_INT16:
|
||||
*pRes = _parser->getResultInt();
|
||||
break;
|
||||
|
||||
case TYPE_IMM_STR:
|
||||
case GOB_FALSE:
|
||||
*pRes = 0;
|
||||
break;
|
||||
|
||||
case GOB_TRUE:
|
||||
*pRes = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
bool Script::evalBoolResult() {
|
||||
byte type;
|
||||
|
||||
_parser->printExpr(99);
|
||||
|
||||
_parser->parseExpr(99, &type);
|
||||
if ( (type == GOB_TRUE) ||
|
||||
((type == TYPE_IMM_INT16) && _parser->getResultInt()))
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
int32 Script::getResultInt() {
|
||||
return _parser->getResultInt();
|
||||
}
|
||||
|
@ -68,6 +68,9 @@ public:
|
||||
int16 readExpr(byte stopToken, byte *type);
|
||||
void skipExpr(char stopToken);
|
||||
|
||||
char evalExpr(int16 *pRes);
|
||||
bool evalBoolResult();
|
||||
|
||||
int32 getResultInt();
|
||||
char *getResultStr();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user