diff options
-rw-r--r-- | engines/sci/engine/kernel_tables.h | 5 | ||||
-rw-r--r-- | engines/sci/engine/kstring.cpp | 7 |
2 files changed, 8 insertions, 4 deletions
diff --git a/engines/sci/engine/kernel_tables.h b/engines/sci/engine/kernel_tables.h index 2d0f1c3933..7be85fc3e5 100644 --- a/engines/sci/engine/kernel_tables.h +++ b/engines/sci/engine/kernel_tables.h @@ -331,8 +331,7 @@ static const SciKernelMapSubEntry kString_subops[] = { { SIG_UNTIL_SCI21MID, 11, MAP_CALL(StringPrintf), "[or](.*)", NULL }, { SIG_UNTIL_SCI21MID, 12, MAP_CALL(StringPrintfBuf), "[or](.*)", NULL }, { SIG_UNTIL_SCI21MID, 13, MAP_CALL(StringAtoi), "[or]", NULL }, - // exact functionality of Trim is unknown atm - { SIG_UNTIL_SCI21MID, 14, MAP_CALL(StringTrim), "[or]", NULL }, + { SIG_UNTIL_SCI21MID, 14, MAP_CALL(StringTrim), "[or]i", NULL }, { SIG_UNTIL_SCI21MID, 15, MAP_CALL(StringUpper), "[or]", NULL }, { SIG_UNTIL_SCI21MID, 16, MAP_CALL(StringLower), "[or]", NULL }, // the following 2 are unknown atm (happen in Phantasmagoria) @@ -345,7 +344,7 @@ static const SciKernelMapSubEntry kString_subops[] = { { SIG_SINCE_SCI21LATE, 9, MAP_CALL(StringPrintf), "[or](.*)", NULL }, { SIG_SINCE_SCI21LATE,10, MAP_CALL(StringPrintfBuf), "[or](.*)", NULL }, { SIG_SINCE_SCI21LATE,11, MAP_CALL(StringAtoi), "[or]", NULL }, - { SIG_SINCE_SCI21LATE,12, MAP_CALL(StringTrim), "[or]", NULL }, + { SIG_SINCE_SCI21LATE,12, MAP_CALL(StringTrim), "[or]i", NULL }, { SIG_SINCE_SCI21LATE,13, MAP_CALL(StringUpper), "[or]", NULL }, { SIG_SINCE_SCI21LATE,14, MAP_CALL(StringLower), "[or]", NULL }, { SIG_SINCE_SCI21LATE,15, MAP_CALL(StringTrn), "[or]", NULL }, diff --git a/engines/sci/engine/kstring.cpp b/engines/sci/engine/kstring.cpp index cd0d6af936..310e38dbd1 100644 --- a/engines/sci/engine/kstring.cpp +++ b/engines/sci/engine/kstring.cpp @@ -860,7 +860,12 @@ reg_t kStringAtoi(EngineState *s, int argc, reg_t *argv) { } reg_t kStringTrim(EngineState *s, int argc, reg_t *argv) { - warning("kStringTrim (argc = %d)", argc); + Common::String string = s->_segMan->getString(argv[0]); + + string.trim(); + // TODO: Second parameter (bitfield, trim from left, right, center) + warning("kStringTrim (%d)", argv[1].getOffset()); + s->_segMan->strcpy(argv[0], string.c_str()); return NULL_REG; } |