diff options
author | Sven Hesse | 2009-06-22 10:11:53 +0000 |
---|---|---|
committer | Sven Hesse | 2009-06-22 10:11:53 +0000 |
commit | 1dafcabb4379c205add3d27c428e22c2f970f865 (patch) | |
tree | 03e536ad0f7bf4b20e4fee0bfcdb78805c46e772 /engines/gob | |
parent | f6717373b5130deb0dcd9d307867bb9aeada3f89 (diff) | |
download | scummvm-rg350-1dafcabb4379c205add3d27c428e22c2f970f865.tar.gz scummvm-rg350-1dafcabb4379c205add3d27c428e22c2f970f865.tar.bz2 scummvm-rg350-1dafcabb4379c205add3d27c428e22c2f970f865.zip |
Encapsulated access to _resultStr
svn-id: r41751
Diffstat (limited to 'engines/gob')
-rw-r--r-- | engines/gob/inter_v1.cpp | 24 | ||||
-rw-r--r-- | engines/gob/inter_v2.cpp | 54 | ||||
-rw-r--r-- | engines/gob/inter_v4.cpp | 2 | ||||
-rw-r--r-- | engines/gob/inter_v5.cpp | 2 | ||||
-rw-r--r-- | engines/gob/inter_v6.cpp | 8 | ||||
-rw-r--r-- | engines/gob/parse.cpp | 4 | ||||
-rw-r--r-- | engines/gob/parse.h | 4 |
7 files changed, 51 insertions, 47 deletions
diff --git a/engines/gob/inter_v1.cpp b/engines/gob/inter_v1.cpp index d1727ad4e1..9368965585 100644 --- a/engines/gob/inter_v1.cpp +++ b/engines/gob/inter_v1.cpp @@ -599,7 +599,7 @@ void Inter_v1::o1_loadCurLayer() { void Inter_v1::o1_playCDTrack() { evalExpr(0); _vm->_sound->adlibPlayBgMusic(); // Mac version - _vm->_sound->cdPlay(_vm->_parse->_resultStr); // PC CD version + _vm->_sound->cdPlay(_vm->_parse->getResultStr()); // PC CD version } void Inter_v1::o1_getCDTrackPos() { @@ -860,7 +860,7 @@ bool Inter_v1::o1_assign(OpFuncParams ¶ms) { if (srcType == TYPE_IMM_INT16) WRITE_VARO_UINT8(dest, result); else - WRITE_VARO_STR(dest, _vm->_parse->_resultStr); + WRITE_VARO_STR(dest, _vm->_parse->getResultStr()); break; } @@ -945,7 +945,7 @@ bool Inter_v1::o1_loadTot(OpFuncParams ¶ms) { if ((*_vm->_global->_inter_execPtr & 0x80) != 0) { _vm->_global->_inter_execPtr++; evalExpr(0); - strncpy0(buf, _vm->_parse->_resultStr, 15); + strncpy0(buf, _vm->_parse->getResultStr(), 15); } else { size = (int8) *_vm->_global->_inter_execPtr++; for (int i = 0; i < size; i++) @@ -1587,13 +1587,13 @@ bool Inter_v1::o1_checkData(OpFuncParams ¶ms) { evalExpr(0); varOff = _vm->_parse->parseVarIndex(); - handle = _vm->_dataIO->openData(_vm->_parse->_resultStr); + handle = _vm->_dataIO->openData(_vm->_parse->getResultStr()); WRITE_VAR_OFFSET(varOff, handle); if (handle >= 0) _vm->_dataIO->closeData(handle); else - warning("File \"%s\" not found", _vm->_parse->_resultStr); + warning("File \"%s\" not found", _vm->_parse->getResultStr()); return false; } @@ -1614,7 +1614,7 @@ bool Inter_v1::o1_insertStr(OpFuncParams ¶ms) { pos = _vm->_parse->parseValExpr(); char *str = GET_VARO_FSTR(strVar); - _vm->_util->insertStr(_vm->_parse->_resultStr, str, pos); + _vm->_util->insertStr(_vm->_parse->getResultStr(), str, pos); return false; } @@ -1639,7 +1639,7 @@ bool Inter_v1::o1_strstr(OpFuncParams ¶ms) { evalExpr(0); resVar = _vm->_parse->parseVarIndex(); - char *res = strstr(GET_VARO_STR(strVar), _vm->_parse->_resultStr); + char *res = strstr(GET_VARO_STR(strVar), _vm->_parse->getResultStr()); pos = res ? (res - (GET_VARO_STR(strVar))) : -1; WRITE_VAR_OFFSET(resVar, pos); return false; @@ -1705,7 +1705,7 @@ bool Inter_v1::o1_loadFont(OpFuncParams ¶ms) { _vm->_dataIO->closeData(_vm->_game->_extHandle); _vm->_draw->_fonts[index] = - _vm->_util->loadFont(_vm->_parse->_resultStr); + _vm->_util->loadFont(_vm->_parse->getResultStr()); if (_vm->_game->_extHandle >= 0) _vm->_game->_extHandle = _vm->_dataIO->openData(_vm->_game->_curExtFile); @@ -1738,7 +1738,7 @@ bool Inter_v1::o1_readData(OpFuncParams ¶ms) { _vm->_dataIO->closeData(_vm->_game->_extHandle); WRITE_VAR(1, 1); - handle = _vm->_dataIO->openData(_vm->_parse->_resultStr); + handle = _vm->_dataIO->openData(_vm->_parse->getResultStr()); if (handle >= 0) { DataStream *stream = _vm->_dataIO->openAsStream(handle, true); @@ -1778,7 +1778,7 @@ bool Inter_v1::o1_writeData(OpFuncParams ¶ms) { size = _vm->_parse->parseValExpr(); offset = _vm->_parse->parseValExpr(); - warning("Attempted to write to file \"%s\"", _vm->_parse->_resultStr); + warning("Attempted to write to file \"%s\"", _vm->_parse->getResultStr()); WRITE_VAR(1, 0); return false; @@ -1787,8 +1787,8 @@ bool Inter_v1::o1_writeData(OpFuncParams ¶ms) { bool Inter_v1::o1_manageDataFile(OpFuncParams ¶ms) { evalExpr(0); - if (_vm->_parse->_resultStr[0] != 0) - _vm->_dataIO->openDataFile(_vm->_parse->_resultStr); + if (_vm->_parse->getResultStr()[0] != 0) + _vm->_dataIO->openDataFile(_vm->_parse->getResultStr()); else _vm->_dataIO->closeDataFile(); return false; diff --git a/engines/gob/inter_v2.cpp b/engines/gob/inter_v2.cpp index 9cb4c12d53..7508bca214 100644 --- a/engines/gob/inter_v2.cpp +++ b/engines/gob/inter_v2.cpp @@ -511,7 +511,7 @@ void Inter_v2::o2_playCDTrack() { _vm->_draw->blitInvalidated(); evalExpr(0); - _vm->_sound->cdPlay(_vm->_parse->_resultStr); + _vm->_sound->cdPlay(_vm->_parse->getResultStr()); } void Inter_v2::o2_waitCDTrackEnd() { @@ -529,7 +529,7 @@ void Inter_v2::o2_readLIC() { char path[40]; evalExpr(0); - strncpy0(path, _vm->_parse->_resultStr, 35); + strncpy0(path, _vm->_parse->getResultStr(), 35); strcat(path, ".LIC"); _vm->_sound->cdLoadLIC(path); @@ -577,7 +577,7 @@ void Inter_v2::o2_totSub() { if (length & 0x80) { evalExpr(0); - strcpy(totFile, _vm->_parse->_resultStr); + strcpy(totFile, _vm->_parse->getResultStr()); } else { for (i = 0; i < length; i++) totFile[i] = (char) *_vm->_global->_inter_execPtr++; @@ -962,8 +962,8 @@ void Inter_v2::o2_playImd() { bool close; evalExpr(0); - _vm->_parse->_resultStr[8] = 0; - strncpy0(imd, _vm->_parse->_resultStr, 127); + _vm->_parse->getResultStr()[8] = 0; + strncpy0(imd, _vm->_parse->getResultStr(), 127); x = _vm->_parse->parseValExpr(); y = _vm->_parse->parseValExpr(); @@ -976,7 +976,7 @@ void Inter_v2::o2_playImd() { palCmd = 1 << (flags & 0x3F); debugC(1, kDebugVideo, "Playing video \"%s\" @ %d+%d, frames %d - %d, " - "paletteCmd %d (%d - %d), flags %X", _vm->_parse->_resultStr, x, y, + "paletteCmd %d (%d - %d), flags %X", _vm->_parse->getResultStr(), x, y, startFrame, lastFrame, palCmd, palStart, palEnd, flags); if ((imd[0] != 0) && !_vm->_vidPlayer->primaryOpen(imd, x, y, flags)) { @@ -1015,10 +1015,10 @@ void Inter_v2::o2_getImdInfo() { // WORKAROUND: The nut rolling animation in the administration center // in Woodruff is called "noixroul", but the scripts think it's "noixroule". if ((_vm->getGameType() == kGameTypeWoodruff) && - (!scumm_stricmp(_vm->_parse->_resultStr, "noixroule"))) - strcpy(_vm->_parse->_resultStr, "noixroul"); + (!scumm_stricmp(_vm->_parse->getResultStr(), "noixroule"))) + strcpy(_vm->_parse->getResultStr(), "noixroul"); - _vm->_vidPlayer->writeVideoInfo(_vm->_parse->_resultStr, varX, varY, + _vm->_vidPlayer->writeVideoInfo(_vm->_parse->getResultStr(), varX, varY, varFrames, varWidth, varHeight); } @@ -1026,7 +1026,7 @@ void Inter_v2::o2_openItk() { char fileName[32]; evalExpr(0); - strncpy0(fileName, _vm->_parse->_resultStr, 27); + strncpy0(fileName, _vm->_parse->getResultStr(), 27); if (!strchr(fileName, '.')) strcat(fileName, ".ITK"); @@ -1083,7 +1083,7 @@ bool Inter_v2::o2_assign(OpFuncParams ¶ms) { if (srcType == TYPE_IMM_INT16) WRITE_VARO_UINT8(dest, result); else - WRITE_VARO_STR(dest, _vm->_parse->_resultStr); + WRITE_VARO_STR(dest, _vm->_parse->getResultStr()); break; } } @@ -1315,17 +1315,17 @@ bool Inter_v2::o2_checkData(OpFuncParams ¶ms) { size = -1; handle = 1; - mode = _vm->_saveLoad->getSaveMode(_vm->_parse->_resultStr); + mode = _vm->_saveLoad->getSaveMode(_vm->_parse->getResultStr()); if (mode == SaveLoad::kSaveModeNone) { - handle = _vm->_dataIO->openData(_vm->_parse->_resultStr); + handle = _vm->_dataIO->openData(_vm->_parse->getResultStr()); if (handle >= 0) { _vm->_dataIO->closeData(handle); - size = _vm->_dataIO->getDataSize(_vm->_parse->_resultStr); + size = _vm->_dataIO->getDataSize(_vm->_parse->getResultStr()); } else - warning("File \"%s\" not found", _vm->_parse->_resultStr); + warning("File \"%s\" not found", _vm->_parse->getResultStr()); } else if (mode == SaveLoad::kSaveModeSave) - size = _vm->_saveLoad->getSize(_vm->_parse->_resultStr); + size = _vm->_saveLoad->getSize(_vm->_parse->getResultStr()); else if (mode == SaveLoad::kSaveModeExists) size = 23; @@ -1333,7 +1333,7 @@ bool Inter_v2::o2_checkData(OpFuncParams ¶ms) { handle = -1; debugC(2, kDebugFileIO, "Requested size of file \"%s\": %d", - _vm->_parse->_resultStr, size); + _vm->_parse->getResultStr(), size); WRITE_VAR_OFFSET(varOff, handle); WRITE_VAR(16, (uint32) size); @@ -1358,12 +1358,12 @@ bool Inter_v2::o2_readData(OpFuncParams ¶ms) { retSize = 0; debugC(2, kDebugFileIO, "Read from file \"%s\" (%d, %d bytes at %d)", - _vm->_parse->_resultStr, dataVar, size, offset); + _vm->_parse->getResultStr(), dataVar, size, offset); - mode = _vm->_saveLoad->getSaveMode(_vm->_parse->_resultStr); + mode = _vm->_saveLoad->getSaveMode(_vm->_parse->getResultStr()); if (mode == SaveLoad::kSaveModeSave) { WRITE_VAR(1, 1); - if (_vm->_saveLoad->load(_vm->_parse->_resultStr, dataVar, size, offset)) + if (_vm->_saveLoad->load(_vm->_parse->getResultStr(), dataVar, size, offset)) WRITE_VAR(1, 0); return false; } else if (mode == SaveLoad::kSaveModeIgnore) @@ -1371,7 +1371,7 @@ bool Inter_v2::o2_readData(OpFuncParams ¶ms) { if (size < 0) { warning("Attempted to read a raw sprite from file \"%s\"", - _vm->_parse->_resultStr); + _vm->_parse->getResultStr()); return false ; } else if (size == 0) { dataVar = 0; @@ -1380,13 +1380,13 @@ bool Inter_v2::o2_readData(OpFuncParams ¶ms) { buf = _variables->getAddressOff8(dataVar); - if (_vm->_parse->_resultStr[0] == 0) { + if (_vm->_parse->getResultStr()[0] == 0) { WRITE_VAR(1, size); return false; } WRITE_VAR(1, 1); - handle = _vm->_dataIO->openData(_vm->_parse->_resultStr); + handle = _vm->_dataIO->openData(_vm->_parse->getResultStr()); if (handle < 0) return false; @@ -1428,16 +1428,16 @@ bool Inter_v2::o2_writeData(OpFuncParams ¶ms) { offset = _vm->_parse->getResultInt(); debugC(2, kDebugFileIO, "Write to file \"%s\" (%d, %d bytes at %d)", - _vm->_parse->_resultStr, dataVar, size, offset); + _vm->_parse->getResultStr(), dataVar, size, offset); WRITE_VAR(1, 1); - mode = _vm->_saveLoad->getSaveMode(_vm->_parse->_resultStr); + mode = _vm->_saveLoad->getSaveMode(_vm->_parse->getResultStr()); if (mode == SaveLoad::kSaveModeSave) { - if (_vm->_saveLoad->save(_vm->_parse->_resultStr, dataVar, size, offset)) + if (_vm->_saveLoad->save(_vm->_parse->getResultStr(), dataVar, size, offset)) WRITE_VAR(1, 0); } else if (mode == SaveLoad::kSaveModeNone) - warning("Attempted to write to file \"%s\"", _vm->_parse->_resultStr); + warning("Attempted to write to file \"%s\"", _vm->_parse->getResultStr()); return false; } diff --git a/engines/gob/inter_v4.cpp b/engines/gob/inter_v4.cpp index ccc50ebb24..057f71a227 100644 --- a/engines/gob/inter_v4.cpp +++ b/engines/gob/inter_v4.cpp @@ -153,7 +153,7 @@ void Inter_v4::o4_playVmdOrMusic() { bool close; evalExpr(0); - strncpy0(fileName, _vm->_parse->_resultStr, 127); + strncpy0(fileName, _vm->_parse->getResultStr(), 127); // WORKAROUND: The nut rolling animation in the administration center // in Woodruff is called "noixroul", but the scripts think it's "noixroule". diff --git a/engines/gob/inter_v5.cpp b/engines/gob/inter_v5.cpp index 70ae183e1d..4221a56654 100644 --- a/engines/gob/inter_v5.cpp +++ b/engines/gob/inter_v5.cpp @@ -96,7 +96,7 @@ void Inter_v5::setupOpcodesGob() { void Inter_v5::o5_deleteFile() { evalExpr(0); - warning("Dynasty Stub: deleteFile \"%s\"", _vm->_parse->_resultStr); + warning("Dynasty Stub: deleteFile \"%s\"", _vm->_parse->getResultStr()); } void Inter_v5::o5_initScreen() { diff --git a/engines/gob/inter_v6.cpp b/engines/gob/inter_v6.cpp index ef160ce339..365457abeb 100644 --- a/engines/gob/inter_v6.cpp +++ b/engines/gob/inter_v6.cpp @@ -81,7 +81,7 @@ void Inter_v6::o6_totSub() { if (length & 0x80) { evalExpr(0); - strcpy(totFile, _vm->_parse->_resultStr); + strcpy(totFile, _vm->_parse->getResultStr()); } else { for (i = 0; i < length; i++) totFile[i] = (char) *_vm->_global->_inter_execPtr++; @@ -109,7 +109,7 @@ void Inter_v6::o6_playVmdOrMusic() { bool close; evalExpr(0); - strncpy0(fileName, _vm->_parse->_resultStr, 127); + strncpy0(fileName, _vm->_parse->getResultStr(), 127); x = _vm->_parse->parseValExpr(); y = _vm->_parse->parseValExpr(); @@ -175,7 +175,7 @@ void Inter_v6::o6_openItk() { char fileName[32]; evalExpr(0); - strncpy0(fileName, _vm->_parse->_resultStr, 27); + strncpy0(fileName, _vm->_parse->getResultStr(), 27); if (!strchr(fileName, '.')) strcat(fileName, ".ITK"); @@ -327,7 +327,7 @@ bool Inter_v6::o6_assign(OpFuncParams ¶ms) { if (srcType == TYPE_IMM_INT16) WRITE_VARO_UINT8(dest, result); else - WRITE_VARO_STR(dest, _vm->_parse->_resultStr); + WRITE_VARO_STR(dest, _vm->_parse->getResultStr()); break; } } diff --git a/engines/gob/parse.cpp b/engines/gob/parse.cpp index 9982fb3eb9..48442be483 100644 --- a/engines/gob/parse.cpp +++ b/engines/gob/parse.cpp @@ -1144,4 +1144,8 @@ int32 Parse::getResultInt() { return _resultInt; } +char *Parse::getResultStr() { + return _resultStr; +} + } // End of namespace Gob diff --git a/engines/gob/parse.h b/engines/gob/parse.h index 4a13a3154b..997da4eb51 100644 --- a/engines/gob/parse.h +++ b/engines/gob/parse.h @@ -123,8 +123,7 @@ public: int16 parseExpr(byte stopToken, byte *type); int32 getResultInt(); - - char _resultStr[200]; + char *getResultStr(); private: class Stack { @@ -156,6 +155,7 @@ private: GobEngine *_vm; int32 _resultInt; + char _resultStr[200]; int32 encodePtr(byte *ptr, int type); byte *decodePtr(int32 n); |