diff options
author | Sven Hesse | 2011-02-04 15:54:21 +0000 |
---|---|---|
committer | Sven Hesse | 2011-02-04 15:54:21 +0000 |
commit | 6a99b6f34044594e511dd8223c777e9c1c06d1cd (patch) | |
tree | af8e2a30bad0d298a8bb7d4a45dbebfd65b395c8 /engines | |
parent | 209f5bd77e9fa5f9b8d671b0f8a0e9a7e2530a25 (diff) | |
download | scummvm-rg350-6a99b6f34044594e511dd8223c777e9c1c06d1cd.tar.gz scummvm-rg350-6a99b6f34044594e511dd8223c777e9c1c06d1cd.tar.bz2 scummvm-rg350-6a99b6f34044594e511dd8223c777e9c1c06d1cd.zip |
GOB: Add Inter::readValue()
svn-id: r55767
Diffstat (limited to 'engines')
-rw-r--r-- | engines/gob/inter.cpp | 20 | ||||
-rw-r--r-- | engines/gob/inter.h | 2 |
2 files changed, 22 insertions, 0 deletions
diff --git a/engines/gob/inter.cpp b/engines/gob/inter.cpp index a21850aebf..9b4b06eea3 100644 --- a/engines/gob/inter.cpp +++ b/engines/gob/inter.cpp @@ -435,4 +435,24 @@ void Inter::storeString(const char *value) { storeString(varIndex, type, value); } +uint32 Inter::readValue(uint16 index, uint16 type) { + switch (type) { + case TYPE_IMM_INT8: + case TYPE_VAR_INT8: + case TYPE_ARRAY_INT8: + return (uint32)(((int32)((int8)READ_VARO_UINT8(index)))); + break; + + case TYPE_VAR_INT16: + case TYPE_VAR_INT32_AS_INT16: + case TYPE_ARRAY_INT16: + return (uint32)(((int32)((int16)READ_VARO_UINT16(index)))); + + default: + return READ_VARO_UINT32(index); + } + + return 0; +} + } // End of namespace Gob diff --git a/engines/gob/inter.h b/engines/gob/inter.h index 6a403ce928..47b1cd4210 100644 --- a/engines/gob/inter.h +++ b/engines/gob/inter.h @@ -162,6 +162,8 @@ protected: void storeString(uint16 index, uint16 type, const char *value); void storeString(const char *value); + + uint32 readValue(uint16 index, uint16 type); }; class Inter_v1 : public Inter { |