aboutsummaryrefslogtreecommitdiff
path: root/scumm
diff options
context:
space:
mode:
authorMax Horn2003-05-21 16:28:02 +0000
committerMax Horn2003-05-21 16:28:02 +0000
commit8a82e59065433e679958feb864208db0bba0f354 (patch)
treeffa430f18a2a93b1eca150d6f3106e94739f2be6 /scumm
parent4fb4626ac99eed69c86afd94371c5784f2ede61a (diff)
downloadscummvm-rg350-8a82e59065433e679958feb864208db0bba0f354.tar.gz
scummvm-rg350-8a82e59065433e679958feb864208db0bba0f354.tar.bz2
scummvm-rg350-8a82e59065433e679958feb864208db0bba0f354.zip
constness fixes
svn-id: r7787
Diffstat (limited to 'scumm')
-rw-r--r--scumm/charset.cpp6
-rw-r--r--scumm/charset.h2
-rw-r--r--scumm/script_v5.cpp6
-rw-r--r--scumm/scumm.h8
-rw-r--r--scumm/string.cpp7
-rw-r--r--scumm/verbs.cpp4
6 files changed, 16 insertions, 17 deletions
diff --git a/scumm/charset.cpp b/scumm/charset.cpp
index bb13e43491..380a00af61 100644
--- a/scumm/charset.cpp
+++ b/scumm/charset.cpp
@@ -94,7 +94,7 @@ int CharsetRendererClassic::getCharWidth(byte chr) {
return spacing;
}
-int CharsetRenderer::getStringWidth(int arg, byte *text) {
+int CharsetRenderer::getStringWidth(int arg, const byte *text) {
int pos = 0;
int width = 1;
byte chr;
@@ -112,8 +112,8 @@ int CharsetRenderer::getStringWidth(int arg, byte *text) {
if (chr == 8) { // 'Verb on next line'
if (arg == 1)
break;
- while (text[pos] == ' ')
- text[pos++] = '@';
+ while (text[pos++] == ' ')
+ ;
continue;
}
if (chr == 10 || chr == 21 || chr == 12 || chr == 13) {
diff --git a/scumm/charset.h b/scumm/charset.h
index 002dcfa5c3..c436591542 100644
--- a/scumm/charset.h
+++ b/scumm/charset.h
@@ -61,7 +61,7 @@ public:
virtual void printChar(int chr) = 0;
- int getStringWidth(int a, byte *str);
+ int getStringWidth(int a, const byte *str);
void addLinebreaks(int a, byte *str, int pos, int maxwidth);
virtual void setCurID(byte id) = 0;
diff --git a/scumm/script_v5.cpp b/scumm/script_v5.cpp
index 2a81d7d8b9..bc3e3a7830 100644
--- a/scumm/script_v5.cpp
+++ b/scumm/script_v5.cpp
@@ -1002,7 +1002,7 @@ void Scumm_v5::o5_getActorScale() {
// INDY3 uses this opcode as a wait_for_actor();
if ((_gameId == GID_INDY3_256) || (_gameId == GID_INDY3)) {
- byte *oldaddr = _scriptPointer - 1;
+ const byte *oldaddr = _scriptPointer - 1;
if (derefActorSafe(getVarOrDirectByte(0x80), "o5_wait")->moving) {
_scriptPointer = oldaddr;
o5_breakHere();
@@ -2301,9 +2301,7 @@ void Scumm_v5::o5_verbOps() {
}
void Scumm_v5::o5_wait() {
- byte *oldaddr;
-
- oldaddr = _scriptPointer - 1;
+ const byte *oldaddr = _scriptPointer - 1;
if ((_gameId == GID_INDY3_256) || (_gameId == GID_INDY3)) {
_opcode = 2;
diff --git a/scumm/scumm.h b/scumm/scumm.h
index f5b4037546..f9772ebd0a 100644
--- a/scumm/scumm.h
+++ b/scumm/scumm.h
@@ -487,7 +487,7 @@ protected:
/* Script VM - should be in Script class */
uint32 _localScriptList[NUM_LOCALSCRIPT];
- byte *_scriptPointer, *_scriptOrgPointer;
+ const byte *_scriptPointer, *_scriptOrgPointer;
byte _opcode, _numNestedScripts, _currentScript;
uint16 _curExecScript;
byte **_lastCodePtr;
@@ -1017,7 +1017,7 @@ public:
void CHARSET_1();
void drawString(int a);
void drawDescString(byte *msg);
- byte *addMessageToStack(byte *msg);
+ const byte *addMessageToStack(const byte *msg);
void addIntToStack(int var);
void addVerbToStack(int var);
void addNameToStack(int var);
@@ -1028,7 +1028,7 @@ public:
int _numInMsgStack;
byte *_msgPtrToAdd;
- byte *_messagePtr;
+ const byte *_messagePtr;
int16 _talkDelay;
bool _keepText;
uint16 _language;
@@ -1037,7 +1037,7 @@ public:
struct langIndexNode *_languageIndex;
int _languageStrCount;
void loadLanguageBundle();
- void translateText(byte *text, byte *trans_buff);
+ void translateText(const byte *text, byte *trans_buff);
byte _transText[500];
#if defined(SCUMM_LITTLE_ENDIAN)
diff --git a/scumm/string.cpp b/scumm/string.cpp
index 28618138f7..0f09ab197f 100644
--- a/scumm/string.cpp
+++ b/scumm/string.cpp
@@ -55,7 +55,8 @@ void Scumm::unkMessage1() {
}
void Scumm::unkMessage2() {
- byte buf[100], *tmp;
+ byte buf[100];
+ const byte *tmp;
_msgPtrToAdd = buf;
tmp = _messagePtr = addMessageToStack(_messagePtr);
@@ -508,7 +509,7 @@ void Scumm::drawString(int a) {
}
}
-byte *Scumm::addMessageToStack(byte *msg) {
+const byte *Scumm::addMessageToStack(const byte *msg) {
int num, numorg;
unsigned char *ptr, chr;
@@ -835,7 +836,7 @@ void Scumm::loadLanguageBundle() {
_existLanguageFile = true;
}
-void Scumm::translateText(byte *text, byte *trans_buff) {
+void Scumm::translateText(const byte *text, byte *trans_buff) {
char name[20], tmp[500], tmp2[20], num_s[20], number[4], enc;
int32 num, l, j, k, r, pos = 0;
char *buf = _languageBuffer;
diff --git a/scumm/verbs.cpp b/scumm/verbs.cpp
index 500e5ac044..31f3637f96 100644
--- a/scumm/verbs.cpp
+++ b/scumm/verbs.cpp
@@ -79,14 +79,14 @@ void Scumm::redrawV2Inventory() {
if (curInventoryCount > 0) { // Draw Up Arrow
_string[1].xpos = 145;
_string[1].ypos = virtscr[2].topline + 32;
- _messagePtr = (byte*)strdup("U");
+ _messagePtr = (const byte *)"U";
drawString(1);
}
if (items == 4) { // Draw Down Arrow
_string[1].xpos = 145;
_string[1].ypos = virtscr[2].topline + 47;
- _messagePtr = (byte*)strdup("D");
+ _messagePtr = (const byte *)"D";
drawString(1);
}
}