aboutsummaryrefslogtreecommitdiff
path: root/engines/scumm
diff options
context:
space:
mode:
Diffstat (limited to 'engines/scumm')
-rw-r--r--engines/scumm/he/logic_he.cpp17
-rw-r--r--engines/scumm/script_v0.cpp16
-rw-r--r--engines/scumm/script_v2.cpp18
-rw-r--r--engines/scumm/scumm_v2.h2
4 files changed, 24 insertions, 29 deletions
diff --git a/engines/scumm/he/logic_he.cpp b/engines/scumm/he/logic_he.cpp
index b7d2c9264c..add9b982e2 100644
--- a/engines/scumm/he/logic_he.cpp
+++ b/engines/scumm/he/logic_he.cpp
@@ -75,22 +75,17 @@ void LogicHE::putInArray(int arg0, int idx2, int idx1, int val) {
int32 LogicHE::dispatch(int op, int numArgs, int32 *args) {
#if 1
- char tmp[32], str[256];
+ Common::String str;
+ str = Common::String::printf("LogicHE::dispatch(%d, %d, [", op, numArgs);
if (numArgs > 0)
- snprintf(tmp, 32, "%d", args[0]);
- else
- *tmp = 0;
-
- snprintf(str, 256, "LogicHE::dispatch(%d, %d, [%s", op, numArgs, tmp);
-
+ str += Common::String::printf("%d", args[0]);
for (int i = 1; i < numArgs; i++) {
- snprintf(tmp, 32, ", %d", args[i]);
- strncat(str, tmp, sizeof(str) - strlen(str) - 1);
+ str += Common::String::printf(", %d", args[i]);
}
- strncat(str, "])", sizeof(str) - strlen(str) - 1);
+ str += "])";
- debug(0, "%s", str);
+ debug(0, "%s", str.c_str());
#else
// Used for parallel trace utility
for (int i = 0; i < numArgs; i++)
diff --git a/engines/scumm/script_v0.cpp b/engines/scumm/script_v0.cpp
index 979a1b8508..cf44ee195e 100644
--- a/engines/scumm/script_v0.cpp
+++ b/engines/scumm/script_v0.cpp
@@ -425,8 +425,8 @@ void ScummEngine_v0::drawSentenceWord(int object, bool usePrep, bool objInInvent
// Append the 'object-name'
if (temp) {
- strcat(_sentenceBuf, " ");
- strcat(_sentenceBuf, (const char*)temp);
+ _sentenceBuf += " ";
+ _sentenceBuf += (const char *)temp;
}
// Append the modifier? (With / On / To / In)
@@ -469,7 +469,7 @@ void ScummEngine_v0::drawSentenceWord(int object, bool usePrep, bool objInInvent
lang = 0; // Default to english
}
- strcat(_sentenceBuf, prepositions[lang][sentencePrep]);
+ _sentenceBuf += prepositions[lang][sentencePrep];
}
}
@@ -482,7 +482,7 @@ void ScummEngine_v0::drawSentence() {
// Current Verb, Walk/Use
if (getResourceAddress(rtVerb, _activeVerb)) {
- strcpy(_sentenceBuf, (char*)getResourceAddress(rtVerb, _activeVerb));
+ _sentenceBuf = (char *)getResourceAddress(rtVerb, _activeVerb);
} else {
return;
}
@@ -528,8 +528,8 @@ void ScummEngine_v0::drawSentence() {
if (_activeActor) {
Actor *a = derefActor(_activeActor, "");
- strcat(_sentenceBuf, " ");
- strcat(_sentenceBuf, (const char*)a->getActorName());
+ _sentenceBuf += " ";
+ _sentenceBuf += (const char *)a->getActorName();
}
_string[2].charset = 1;
@@ -539,7 +539,7 @@ void ScummEngine_v0::drawSentence() {
_string[2].color = 16;
byte string[80];
- char *ptr = _sentenceBuf;
+ const char *ptr = _sentenceBuf.c_str();
int i = 0, len = 0;
// Maximum length of printable characters
@@ -562,7 +562,7 @@ void ScummEngine_v0::drawSentence() {
sentenceline.right = _virtscr[kVerbVirtScreen].w - 1;
restoreBackground(sentenceline);
- drawString(2, (byte*)string);
+ drawString(2, (byte *)string);
}
void ScummEngine_v0::o_stopCurrentScript() {
diff --git a/engines/scumm/script_v2.cpp b/engines/scumm/script_v2.cpp
index 22c015c644..d93e2ea3e4 100644
--- a/engines/scumm/script_v2.cpp
+++ b/engines/scumm/script_v2.cpp
@@ -965,15 +965,15 @@ void ScummEngine_v2::o2_drawSentence() {
return;
if (getResourceAddress(rtVerb, slot))
- strcpy(_sentenceBuf, (char*)getResourceAddress(rtVerb, slot));
+ _sentenceBuf = (char *)getResourceAddress(rtVerb, slot);
else
return;
if (VAR(VAR_SENTENCE_OBJECT1) > 0) {
temp = getObjOrActorName(VAR(VAR_SENTENCE_OBJECT1));
if (temp) {
- strcat(_sentenceBuf, " ");
- strcat(_sentenceBuf, (const char*)temp);
+ _sentenceBuf += " ";
+ _sentenceBuf += (const char *)temp;
}
// For V1 games, the engine must compute the preposition.
@@ -1018,16 +1018,16 @@ void ScummEngine_v2::o2_drawSentence() {
}
if (_game.platform == Common::kPlatformNES) {
- strcat(_sentenceBuf, (const char *)(getResourceAddress(rtCostume, 78) + VAR(VAR_SENTENCE_PREPOSITION) * 8 + 2));
+ _sentenceBuf += (const char *)(getResourceAddress(rtCostume, 78) + VAR(VAR_SENTENCE_PREPOSITION) * 8 + 2);
} else
- strcat(_sentenceBuf, prepositions[lang][VAR(VAR_SENTENCE_PREPOSITION)]);
+ _sentenceBuf += prepositions[lang][VAR(VAR_SENTENCE_PREPOSITION)];
}
if (VAR(VAR_SENTENCE_OBJECT2) > 0) {
temp = getObjOrActorName(VAR(VAR_SENTENCE_OBJECT2));
if (temp) {
- strcat(_sentenceBuf, " ");
- strcat(_sentenceBuf, (const char*)temp);
+ _sentenceBuf += " ";
+ _sentenceBuf += (const char *)temp;
}
}
@@ -1044,7 +1044,7 @@ void ScummEngine_v2::o2_drawSentence() {
_string[2].color = 13;
byte string[80];
- char *ptr = _sentenceBuf;
+ const char *ptr = _sentenceBuf.c_str();
int i = 0, len = 0;
// Maximum length of printable characters
@@ -1078,7 +1078,7 @@ void ScummEngine_v2::o2_drawSentence() {
}
restoreBackground(sentenceline);
- drawString(2, (byte*)string);
+ drawString(2, (byte *)string);
}
void ScummEngine_v2::o2_ifClassOfIs() {
diff --git a/engines/scumm/scumm_v2.h b/engines/scumm/scumm_v2.h
index ee9591bc45..be623924f1 100644
--- a/engines/scumm/scumm_v2.h
+++ b/engines/scumm/scumm_v2.h
@@ -44,7 +44,7 @@ protected:
V2MouseoverBox _mouseOverBoxesV2[7];
int8 _mouseOverBoxV2;
- char _sentenceBuf[256];
+ Common::String _sentenceBuf;
uint16 _inventoryOffset;
int _activeInventory;