aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2019-11-09 18:52:06 -0800
committerPaul Gilbert2019-11-11 18:20:30 -0800
commit19cc1221f3433a6178e7e0286c4b96e8359d4390 (patch)
tree266a658c1185b416d68c335ee5eec2f6b5a8106b /engines
parent86e7717e62b11e1f35145d14d55e012379a40e50 (diff)
downloadscummvm-rg350-19cc1221f3433a6178e7e0286c4b96e8359d4390.tar.gz
scummvm-rg350-19cc1221f3433a6178e7e0286c4b96e8359d4390.tar.bz2
scummvm-rg350-19cc1221f3433a6178e7e0286c4b96e8359d4390.zip
GLK: ARCHETYPE: Engine fixes for input line processing
Diffstat (limited to 'engines')
-rw-r--r--engines/glk/archetype/archetype.cpp2
-rw-r--r--engines/glk/archetype/parser.cpp11
-rw-r--r--engines/glk/archetype/sys_object.cpp2
3 files changed, 10 insertions, 5 deletions
diff --git a/engines/glk/archetype/archetype.cpp b/engines/glk/archetype/archetype.cpp
index 4ea197ea5c..3792938b8b 100644
--- a/engines/glk/archetype/archetype.cpp
+++ b/engines/glk/archetype/archetype.cpp
@@ -293,7 +293,7 @@ bool Archetype::send_message(int transport, int message_sent, int recipient,
if (DebugMan.isDebugChannelEnabled(DEBUG_MSGS)) {
++scummvm;
- debugN(String::format("%d ", scummvm).c_str());
+ //debugN(String::format("%d ", scummvm).c_str());
r._kind = IDENT;
r._data._ident.ident_kind = OBJECT_ID;
diff --git a/engines/glk/archetype/parser.cpp b/engines/glk/archetype/parser.cpp
index 4867cbb7f2..0d2dcbbda4 100644
--- a/engines/glk/archetype/parser.cpp
+++ b/engines/glk/archetype/parser.cpp
@@ -128,8 +128,10 @@ static void parse_sentence_substitute(int start, ParsePtr pp, int &next_starting
if (sublen > g_vm->Abbreviate)
sublen = g_vm->Abbreviate;
+ // WORKAROUND: Original encoded object number as two bytes. ScummVM strings don't like
+ // 0 bytes in the middle of the string, so we encode it as plain text
g_vm->Command = g_vm->Command.left(start)
- + String::format("%%%c%c^", pp->object >> 8, pp->object & 0xff)
+ + String::format("%%%d^", pp->object)
+ String(g_vm->Command.c_str() + start + sublen + 1);
next_starting = next_starting - sublen + 4;
@@ -163,7 +165,7 @@ static bool parse_sentence_next_chunk(int &start_at, String &the_chunk, int &nex
void parse_sentence() {
const int nfillers = 3;
const char *const FILTERS[nfillers] = { " a ", " an ", " the " };
- int next_starting;
+ int next_starting = 0;
String s;
NodePtr np, near_match, far_match;
ParsePtr pp;
@@ -233,8 +235,9 @@ bool pop_object(int &intback, String &strback) {
} else {
if (g_vm->Command.firstChar() == '%') {
// parsed object
- intback = ((int)g_vm->Command[1] << 8) | ((int)g_vm->Command[2]);
- g_vm->Command.del(0, 4);
+ int nextPos = -1;
+ intback = String(g_vm->Command.c_str() + 1).val(&nextPos);
+ g_vm->Command = String(g_vm->Command.c_str() + nextPos + 1);
} else {
intback = -1;
i = g_vm->Command.indexOf('%');
diff --git a/engines/glk/archetype/sys_object.cpp b/engines/glk/archetype/sys_object.cpp
index 233fde1709..ad98afbff7 100644
--- a/engines/glk/archetype/sys_object.cpp
+++ b/engines/glk/archetype/sys_object.cpp
@@ -108,6 +108,7 @@ void send_to_system(int transport, String &strmsg, ResultType &result, ContextTy
break;
}
}
+ break;
case PLAYER_CMD:
normalize_string(strmsg, g_vm->Command);
@@ -119,6 +120,7 @@ void send_to_system(int transport, String &strmsg, ResultType &result, ContextTy
result._kind = STR_PTR;
result._data._str.acl_str = NewDynStr(g_vm->Command);
sys_state = IDLING;
+ break;
case ABBR:
result._kind = STR_PTR;