aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorSven Hesse2011-02-04 15:53:44 +0000
committerSven Hesse2011-02-04 15:53:44 +0000
commit209f5bd77e9fa5f9b8d671b0f8a0e9a7e2530a25 (patch)
tree7ef63ef9c2ee51312d8c37ef5883a6881f43d787 /engines
parentc18035c07a3c582e78c61843ddd6c17d0a99c809 (diff)
downloadscummvm-rg350-209f5bd77e9fa5f9b8d671b0f8a0e9a7e2530a25.tar.gz
scummvm-rg350-209f5bd77e9fa5f9b8d671b0f8a0e9a7e2530a25.tar.bz2
scummvm-rg350-209f5bd77e9fa5f9b8d671b0f8a0e9a7e2530a25.zip
GOB: Move storeValue/storeString to class Inter
svn-id: r55766
Diffstat (limited to 'engines')
-rw-r--r--engines/gob/inter.cpp70
-rw-r--r--engines/gob/inter.h12
-rw-r--r--engines/gob/inter_v7.cpp70
3 files changed, 76 insertions, 76 deletions
diff --git a/engines/gob/inter.cpp b/engines/gob/inter.cpp
index 7c4dc7ec69..a21850aebf 100644
--- a/engines/gob/inter.cpp
+++ b/engines/gob/inter.cpp
@@ -365,4 +365,74 @@ void Inter::delocateVars() {
_variables = 0;
}
+void Inter::storeValue(uint16 index, uint16 type, uint32 value) {
+ switch (type) {
+ case OP_ARRAY_INT8:
+ case TYPE_VAR_INT8:
+ WRITE_VARO_UINT8(index, value);
+ break;
+
+ case TYPE_VAR_INT16:
+ case TYPE_VAR_INT32_AS_INT16:
+ case TYPE_ARRAY_INT16:
+ WRITE_VARO_UINT16(index, value);
+ break;
+
+ default:
+ WRITE_VARO_UINT32(index, value);
+ }
+}
+
+void Inter::storeValue(uint32 value) {
+ uint16 type;
+ uint16 index = _vm->_game->_script->readVarIndex(0, &type);
+
+ storeValue(index, type, value);
+}
+
+void Inter::storeString(uint16 index, uint16 type, const char *value) {
+ uint32 maxLength = _vm->_global->_inter_animDataSize * 4 - 1;
+ char *str = GET_VARO_STR(index);
+
+ switch (type) {
+ case TYPE_VAR_STR:
+ if (strlen(value) > maxLength)
+ warning("Inter_v7::storeString(): String too long");
+
+ Common::strlcpy(str, value, maxLength);
+ break;
+
+ case TYPE_IMM_INT8:
+ case TYPE_VAR_INT8:
+ strcpy(str, value);
+ break;
+
+ case TYPE_ARRAY_INT8:
+ WRITE_VARO_UINT8(index, atoi(value));
+ break;
+
+ case TYPE_VAR_INT16:
+ case TYPE_VAR_INT32_AS_INT16:
+ case TYPE_ARRAY_INT16:
+ WRITE_VARO_UINT16(index, atoi(value));
+ break;
+
+ case TYPE_VAR_INT32:
+ case TYPE_ARRAY_INT32:
+ WRITE_VARO_UINT32(index, atoi(value));
+ break;
+
+ default:
+ warning("Inter_v7::storeString(): Requested to store a string into type %d", type);
+ break;
+ }
+}
+
+void Inter::storeString(const char *value) {
+ uint16 type;
+ uint16 varIndex = _vm->_game->_script->readVarIndex(0, &type);
+
+ storeString(varIndex, type, value);
+}
+
} // End of namespace Gob
diff --git a/engines/gob/inter.h b/engines/gob/inter.h
index 07e873c703..6a403ce928 100644
--- a/engines/gob/inter.h
+++ b/engines/gob/inter.h
@@ -156,6 +156,12 @@ protected:
void o_drawNOP() {}
void o_funcNOP(OpFuncParams &params) {}
void o_gobNOP(OpGobParams &params) {}
+
+ void storeValue(uint16 index, uint16 type, uint32 value);
+ void storeValue(uint32 value);
+
+ void storeString(uint16 index, uint16 type, const char *value);
+ void storeString(const char *value);
};
class Inter_v1 : public Inter {
@@ -630,12 +636,6 @@ private:
INIConfig _inis;
Databases _databases;
- void storeValue(uint16 index, uint16 type, uint32 value);
- void storeValue(uint32 value);
-
- void storeString(uint16 index, uint16 type, const char *value);
- void storeString(const char *value);
-
Common::String findFile(const Common::String &mask);
};
diff --git a/engines/gob/inter_v7.cpp b/engines/gob/inter_v7.cpp
index eab68e725a..c318252b68 100644
--- a/engines/gob/inter_v7.cpp
+++ b/engines/gob/inter_v7.cpp
@@ -515,76 +515,6 @@ void Inter_v7::o7_oemToANSI(OpGobParams &params) {
_vm->_game->_script->skip(2);
}
-void Inter_v7::storeValue(uint16 index, uint16 type, uint32 value) {
- switch (type) {
- case OP_ARRAY_INT8:
- case TYPE_VAR_INT8:
- WRITE_VARO_UINT8(index, value);
- break;
-
- case TYPE_VAR_INT16:
- case TYPE_VAR_INT32_AS_INT16:
- case TYPE_ARRAY_INT16:
- WRITE_VARO_UINT16(index, value);
- break;
-
- default:
- WRITE_VARO_UINT32(index, value);
- }
-}
-
-void Inter_v7::storeValue(uint32 value) {
- uint16 type;
- uint16 index = _vm->_game->_script->readVarIndex(0, &type);
-
- storeValue(index, type, value);
-}
-
-void Inter_v7::storeString(uint16 index, uint16 type, const char *value) {
- uint32 maxLength = _vm->_global->_inter_animDataSize * 4 - 1;
- char *str = GET_VARO_STR(index);
-
- switch (type) {
- case TYPE_VAR_STR:
- if (strlen(value) > maxLength)
- warning("Inter_v7::storeString(): String too long");
-
- Common::strlcpy(str, value, maxLength);
- break;
-
- case TYPE_IMM_INT8:
- case TYPE_VAR_INT8:
- strcpy(str, value);
- break;
-
- case TYPE_ARRAY_INT8:
- WRITE_VARO_UINT8(index, atoi(value));
- break;
-
- case TYPE_VAR_INT16:
- case TYPE_VAR_INT32_AS_INT16:
- case TYPE_ARRAY_INT16:
- WRITE_VARO_UINT16(index, atoi(value));
- break;
-
- case TYPE_VAR_INT32:
- case TYPE_ARRAY_INT32:
- WRITE_VARO_UINT32(index, atoi(value));
- break;
-
- default:
- warning("Inter_v7::storeString(): Requested to store a string into type %d", type);
- break;
- }
-}
-
-void Inter_v7::storeString(const char *value) {
- uint16 type;
- uint16 varIndex = _vm->_game->_script->readVarIndex(0, &type);
-
- storeString(varIndex, type, value);
-}
-
void Inter_v7::o7_gob0x201(OpGobParams &params) {
uint16 varIndex = _vm->_game->_script->readUint16();