diff options
author | Filippos Karapetis | 2010-05-26 14:25:51 +0000 |
---|---|---|
committer | Filippos Karapetis | 2010-05-26 14:25:51 +0000 |
commit | bfaba64c6a3aee6875bf135147c2f29a621c876b (patch) | |
tree | 865ac5f5ccb5c802bb57fc681e903a56aec42b32 /engines/sci/engine/segment.cpp | |
parent | d502bdf982410dfc0e5731fa9a83f543f08bd744 (diff) | |
download | scummvm-rg350-bfaba64c6a3aee6875bf135147c2f29a621c876b.tar.gz scummvm-rg350-bfaba64c6a3aee6875bf135147c2f29a621c876b.tar.bz2 scummvm-rg350-bfaba64c6a3aee6875bf135147c2f29a621c876b.zip |
Made find_unique_script_block() a member of the Script class
svn-id: r49241
Diffstat (limited to 'engines/sci/engine/segment.cpp')
-rw-r--r-- | engines/sci/engine/segment.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/engines/sci/engine/segment.cpp b/engines/sci/engine/segment.cpp index 0c468a3cc2..b26ac4f78e 100644 --- a/engines/sci/engine/segment.cpp +++ b/engines/sci/engine/segment.cpp @@ -395,6 +395,30 @@ int Script::getSynonymsNr() const { return _numSynonyms; } +byte *Script::findBlock(int type) { + byte *buf = _buf; + bool oldScriptHeader = (getSciVersion() == SCI_VERSION_0_EARLY); + + if (oldScriptHeader) + buf += 2; + + do { + int seekerType = READ_LE_UINT16(buf); + + if (seekerType == 0) + break; + if (seekerType == type) + return buf; + + int seekerSize = READ_LE_UINT16(buf + 2); + assert(seekerSize > 0); + buf += seekerSize; + } while (1); + + return NULL; +} + + // memory operations void Script::mcpyInOut(int dst, const void *src, size_t n) { |