diff options
author | Matthew Hoops | 2010-01-30 02:40:15 +0000 |
---|---|---|
committer | Matthew Hoops | 2010-01-30 02:40:15 +0000 |
commit | bc64dfb52e09345b149071674db480aebe456a76 (patch) | |
tree | 09ae058b63fdd655f75d07c0b2071765078e2f2a /engines/sci/engine/kstring.cpp | |
parent | da46fc9b35287237ad6f9336159703e605ef565c (diff) | |
download | scummvm-rg350-bc64dfb52e09345b149071674db480aebe456a76.tar.gz scummvm-rg350-bc64dfb52e09345b149071674db480aebe456a76.tar.bz2 scummvm-rg350-bc64dfb52e09345b149071674db480aebe456a76.zip |
Implement kString(Printf) and resizing of SCI32 strings in kFormat().
svn-id: r47697
Diffstat (limited to 'engines/sci/engine/kstring.cpp')
-rw-r--r-- | engines/sci/engine/kstring.cpp | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/engines/sci/engine/kstring.cpp b/engines/sci/engine/kstring.cpp index 89d1d0da56..f4c264b72c 100644 --- a/engines/sci/engine/kstring.cpp +++ b/engines/sci/engine/kstring.cpp @@ -271,10 +271,12 @@ reg_t kFormat(EngineState *s, int argc, reg_t *argv) { switch (xfer) { case 's': { /* Copy string */ reg_t reg = argv[startarg + paramindex]; - if (s->_segMan->isObject(reg)) { - Selector slc = s->_kernel->findSelector("data"); // TODO: place in selector table - reg = read_selector(s->_segMan, reg, slc); - } + +#ifdef ENABLE_SCI32 + // If the string is a string object, get to the actual string in the data selector + if (s->_segMan->isObject(reg)) + reg = GET_SEL32(s->_segMan, reg, data); +#endif Common::String tempsource = (reg == NULL_REG) ? "" : kernel_lookup_text(s, reg, arguments[paramindex + 1]); @@ -398,6 +400,14 @@ reg_t kFormat(EngineState *s, int argc, reg_t *argv) { free(arguments); *target = 0; /* Terminate string */ + +#ifdef ENABLE_SCI32 + // Resize SCI32 strings if necessary + if (getSciVersion() >= SCI_VERSION_2) { + SciString *string = s->_segMan->lookupString(dest); + string->setSize(strlen(targetbuf) + 1); + } +#endif s->_segMan->strcpy(dest, targetbuf); |