[Scummvm-cvs-logs] SF.net SVN: scummvm:[41760] scummvm/trunk/engines/gob
drmccoy at users.sourceforge.net
drmccoy at users.sourceforge.net
Mon Jun 22 12:29:33 CEST 2009
Revision: 41760
http://scummvm.svn.sourceforge.net/scummvm/?rev=41760&view=rev
Author: drmccoy
Date: 2009-06-22 10:29:32 +0000 (Mon, 22 Jun 2009)
Log Message:
-----------
Putting evalBoolResult() and evalExpr() into Script
Modified Paths:
--------------
scummvm/trunk/engines/gob/inter.cpp
scummvm/trunk/engines/gob/inter.h
scummvm/trunk/engines/gob/inter_fascin.cpp
scummvm/trunk/engines/gob/inter_v1.cpp
scummvm/trunk/engines/gob/inter_v2.cpp
scummvm/trunk/engines/gob/inter_v4.cpp
scummvm/trunk/engines/gob/inter_v5.cpp
scummvm/trunk/engines/gob/inter_v6.cpp
scummvm/trunk/engines/gob/scenery.cpp
scummvm/trunk/engines/gob/script.cpp
scummvm/trunk/engines/gob/script.h
Modified: scummvm/trunk/engines/gob/inter.cpp
===================================================================
--- scummvm/trunk/engines/gob/inter.cpp 2009-06-22 10:16:45 UTC (rev 41759)
+++ scummvm/trunk/engines/gob/inter.cpp 2009-06-22 10:29:32 UTC (rev 41760)
@@ -157,46 +157,6 @@
}
}
-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);
Modified: scummvm/trunk/engines/gob/inter.h
===================================================================
--- scummvm/trunk/engines/gob/inter.h 2009-06-22 10:16:45 UTC (rev 41759)
+++ scummvm/trunk/engines/gob/inter.h 2009-06-22 10:29:32 UTC (rev 41760)
@@ -100,8 +100,6 @@
void setupOpcodes();
void initControlVars(char full);
- char evalExpr(int16 *pRes);
- bool evalBoolResult();
void renewTimeInVars();
void storeMouse();
void storeKey(int16 key);
Modified: scummvm/trunk/engines/gob/inter_fascin.cpp
===================================================================
--- scummvm/trunk/engines/gob/inter_fascin.cpp 2009-06-22 10:16:45 UTC (rev 41759)
+++ scummvm/trunk/engines/gob/inter_fascin.cpp 2009-06-22 10:29:32 UTC (rev 41760)
@@ -221,37 +221,37 @@
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) {
Modified: scummvm/trunk/engines/gob/inter_v1.cpp
===================================================================
--- scummvm/trunk/engines/gob/inter_v1.cpp 2009-06-22 10:16:45 UTC (rev 41759)
+++ scummvm/trunk/engines/gob/inter_v1.cpp 2009-06-22 10:29:32 UTC (rev 41760)
@@ -254,7 +254,7 @@
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 @@
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 @@
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 @@
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 @@
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_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 @@
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 @@
_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 @@
do {
uint32 startPos = _vm->_game->_script->pos();
- flag = evalBoolResult();
+ flag = _vm->_game->_script->evalBoolResult();
if (_terminate)
return false;
@@ -799,7 +799,7 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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_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 @@
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 @@
// (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_manageDataFile(OpFuncParams ¶ms) {
- evalExpr(0);
+ _vm->_game->_script->evalExpr(0);
if (_vm->_game->_script->getResultStr()[0] != 0)
_vm->_dataIO->openDataFile(_vm->_game->_script->getResultStr());
Modified: scummvm/trunk/engines/gob/inter_v2.cpp
===================================================================
--- scummvm/trunk/engines/gob/inter_v2.cpp 2009-06-22 10:16:45 UTC (rev 41759)
+++ scummvm/trunk/engines/gob/inter_v2.cpp 2009-06-22 10:29:32 UTC (rev 41760)
@@ -211,7 +211,7 @@
default:
if (!found) {
- evalExpr(0);
+ _vm->_game->_script->evalExpr(0);
if (value == _vm->_game->_script->getResultInt())
found = true;
} else
@@ -507,7 +507,7 @@
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_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 @@
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 @@
} 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 @@
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 @@
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_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 @@
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 @@
int32 size;
SaveLoad::SaveMode mode;
- evalExpr(0);
+ _vm->_game->_script->evalExpr(0);
varOff = _vm->_game->_script->readVarIndex();
size = -1;
@@ -1345,10 +1345,10 @@
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 @@
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)",
Modified: scummvm/trunk/engines/gob/inter_v4.cpp
===================================================================
--- scummvm/trunk/engines/gob/inter_v4.cpp 2009-06-22 10:16:45 UTC (rev 41759)
+++ scummvm/trunk/engines/gob/inter_v4.cpp 2009-06-22 10:29:32 UTC (rev 41760)
@@ -152,7 +152,7 @@
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
Modified: scummvm/trunk/engines/gob/inter_v5.cpp
===================================================================
--- scummvm/trunk/engines/gob/inter_v5.cpp 2009-06-22 10:16:45 UTC (rev 41759)
+++ scummvm/trunk/engines/gob/inter_v5.cpp 2009-06-22 10:29:32 UTC (rev 41760)
@@ -94,7 +94,7 @@
}
void Inter_v5::o5_deleteFile() {
- evalExpr(0);
+ _vm->_game->_script->evalExpr(0);
warning("Dynasty Stub: deleteFile \"%s\"", _vm->_game->_script->getResultStr());
}
Modified: scummvm/trunk/engines/gob/inter_v6.cpp
===================================================================
--- scummvm/trunk/engines/gob/inter_v6.cpp 2009-06-22 10:16:45 UTC (rev 41759)
+++ scummvm/trunk/engines/gob/inter_v6.cpp 2009-06-22 10:29:32 UTC (rev 41760)
@@ -81,7 +81,7 @@
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 @@
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_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 @@
_vm->_game->_script->pop();
- evalExpr(&src);
+ _vm->_game->_script->evalExpr(&src);
return false;
}
@@ -301,7 +301,7 @@
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 @@
_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;
Modified: scummvm/trunk/engines/gob/scenery.cpp
===================================================================
--- scummvm/trunk/engines/gob/scenery.cpp 2009-06-22 10:16:45 UTC (rev 41759)
+++ scummvm/trunk/engines/gob/scenery.cpp 2009-06-22 10:29:32 UTC (rev 41760)
@@ -106,7 +106,7 @@
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 @@
int16 spr;
if (index == -1)
- _vm->_inter->evalExpr(&index);
+ _vm->_game->_script->evalExpr(&index);
if (_staticPictCount[index] == -1)
return;
@@ -433,7 +433,7 @@
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 @@
int16 spr;
if (index == -1)
- _vm->_inter->evalExpr(&index);
+ _vm->_game->_script->evalExpr(&index);
if (_animPictCount[index] == 0)
return;
Modified: scummvm/trunk/engines/gob/script.cpp
===================================================================
--- scummvm/trunk/engines/gob/script.cpp 2009-06-22 10:16:45 UTC (rev 41759)
+++ scummvm/trunk/engines/gob/script.cpp 2009-06-22 10:29:32 UTC (rev 41760)
@@ -247,6 +247,46 @@
_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();
}
Modified: scummvm/trunk/engines/gob/script.h
===================================================================
--- scummvm/trunk/engines/gob/script.h 2009-06-22 10:16:45 UTC (rev 41759)
+++ scummvm/trunk/engines/gob/script.h 2009-06-22 10:29:32 UTC (rev 41760)
@@ -68,6 +68,9 @@
int16 readExpr(byte stopToken, byte *type);
void skipExpr(char stopToken);
+ char evalExpr(int16 *pRes);
+ bool evalBoolResult();
+
int32 getResultInt();
char *getResultStr();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list