aboutsummaryrefslogtreecommitdiff
path: root/scumm/string.cpp
diff options
context:
space:
mode:
authorMax Horn2003-05-24 23:39:40 +0000
committerMax Horn2003-05-24 23:39:40 +0000
commitd356ba445271de59d91559e1abebe7a80907db36 (patch)
tree9a21f779d4e98eb4507909f1fa76c62b4375d7e7 /scumm/string.cpp
parent8bcdbed35a604fe7fcde6bad598249b2a0aadc3f (diff)
downloadscummvm-rg350-d356ba445271de59d91559e1abebe7a80907db36.tar.gz
scummvm-rg350-d356ba445271de59d91559e1abebe7a80907db36.tar.bz2
scummvm-rg350-d356ba445271de59d91559e1abebe7a80907db36.zip
simplified addIntToStack a bit *cough*; added experimental code for the message opcode 7 in V2 codes (see also patch #742851)
svn-id: r7917
Diffstat (limited to 'scumm/string.cpp')
-rw-r--r--scumm/string.cpp29
1 files changed, 10 insertions, 19 deletions
diff --git a/scumm/string.cpp b/scumm/string.cpp
index 42b91ac657..5c624df4e2 100644
--- a/scumm/string.cpp
+++ b/scumm/string.cpp
@@ -583,6 +583,14 @@ const byte *Scumm::addMessageToStack(const byte *msg) {
if (_features & GF_AFTER_V8) {
addStringToStack(READ_LE_UINT32(ptr + num));
num += 4;
+ } else if (_features & GF_AFTER_V2) {
+ int var = READ_LE_UINT16(ptr + num);
+ num += 2;
+ char c;
+ while ((c = _scummVars[var])) {
+ if (c != '@')
+ *_msgPtrToAdd++ = c;
+ }
} else {
addStringToStack(READ_LE_UINT16(ptr + num));
num += 2;
@@ -625,27 +633,10 @@ const byte *Scumm::addMessageToStack(const byte *msg) {
}
void Scumm::addIntToStack(int var) {
- int num, max;
- byte flag;
+ int num;
num = readVar(var);
- if (num < 0) {
- *_msgPtrToAdd++ = '-';
- num = -num;
- }
-
- flag = 0;
- max = 10000;
- do {
- if (num >= max || flag) {
- *_msgPtrToAdd++ = num / max + '0';
- num -= (num / max) * max;
- flag = 1;
- }
- max /= 10;
- if (max == 1)
- flag = 1;
- } while (max);
+ _msgPtrToAdd += sprintf((char *)_msgPtrToAdd, "%d", num);
}
void Scumm::addVerbToStack(int var)