aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2002-12-25 21:42:22 +0000
committerMax Horn2002-12-25 21:42:22 +0000
commit748ac8fe378e8abdde3d42fabda36c414e2d1362 (patch)
tree317266bde878f2c3eb2c66aeccc6ffa4f36d1096
parentd808e4da1f419ebcf8fb1a7554b09a867ae973ef (diff)
downloadscummvm-rg350-748ac8fe378e8abdde3d42fabda36c414e2d1362.tar.gz
scummvm-rg350-748ac8fe378e8abdde3d42fabda36c414e2d1362.tar.bz2
scummvm-rg350-748ac8fe378e8abdde3d42fabda36c414e2d1362.zip
more cleanup
svn-id: r6149
-rw-r--r--scumm/charset.cpp3
-rw-r--r--scumm/charset.h7
-rw-r--r--scumm/scumm.h3
-rw-r--r--scumm/scummvm.cpp24
-rw-r--r--scumm/string.cpp21
5 files changed, 26 insertions, 32 deletions
diff --git a/scumm/charset.cpp b/scumm/charset.cpp
index 23bbd1847a..4701d2d234 100644
--- a/scumm/charset.cpp
+++ b/scumm/charset.cpp
@@ -67,8 +67,9 @@ int CharsetRenderer::getSpacing(byte chr, byte *charset)
return spacing;
}
-int CharsetRenderer::getStringWidth(int arg, byte *text, int pos)
+int CharsetRenderer::getStringWidth(int arg, byte *text)
{
+ int pos = 0;
byte *ptr;
int width;
byte chr;
diff --git a/scumm/charset.h b/scumm/charset.h
index 98af8f954b..5c5e931737 100644
--- a/scumm/charset.h
+++ b/scumm/charset.h
@@ -58,22 +58,21 @@ protected:
byte *_charPtr;
void drawBits(VirtScreen *vs, byte *dst, byte *mask, int drawTop, int width, int height);
+ byte *getFontPtr(byte id);
public:
-
CharsetRenderer(Scumm *vm) : _vm(vm) {}
void printChar(int chr);
void printCharOld(int chr);
int getSpacing(byte chr, byte *charset);
- int getStringWidth(int a, byte *str, int pos);
+ int getStringWidth(int a, byte *str);
void addLinebreaks(int a, byte *str, int pos, int maxwidth);
void setCurID(byte id);
int getCurID() { return _curId; }
- byte *getFontPtr() { return _fontPtr; }
- byte *getFontPtr(byte id);
+ int getFontHeight() { return _fontPtr[1]; }
};
diff --git a/scumm/scumm.h b/scumm/scumm.h
index 57651b42ef..04440e913a 100644
--- a/scumm/scumm.h
+++ b/scumm/scumm.h
@@ -80,8 +80,7 @@ struct MemBlkHeader {
struct VerbSlot;
-class ObjectData {
-public:
+struct ObjectData {
uint32 offs_obim_to_room;
uint32 offs_obcd_to_room;
int16 walk_x, walk_y;
diff --git a/scumm/scummvm.cpp b/scumm/scummvm.cpp
index 9b2d6b1554..96f6ae426d 100644
--- a/scumm/scummvm.cpp
+++ b/scumm/scummvm.cpp
@@ -178,24 +178,18 @@ Scumm::Scumm (GameDetector *detector, OSystem *syst)
Scumm::~Scumm ()
{
delete [] _actors;
-
- if (_pauseDialog)
- delete _pauseDialog;
- if (_optionsDialog)
- delete _optionsDialog;
- if (_saveLoadDialog)
- delete _saveLoadDialog;
+
+ delete _charset;
+ delete _pauseDialog;
+ delete _optionsDialog;
+ delete _saveLoadDialog;
delete _bundle;
delete _sound;
- if (_imuse)
- delete _imuse;
- if (_imuseDigital)
- delete _imuseDigital;
- if (_existLanguageFile)
- delete _languageBuffer;
- if (_audioNames)
- delete _audioNames;
+ delete _imuse;
+ delete _imuseDigital;
+ delete _languageBuffer;
+ delete _audioNames;
}
void Scumm::scummInit()
diff --git a/scumm/string.cpp b/scumm/string.cpp
index db5d19488d..73dca4ba06 100644
--- a/scumm/string.cpp
+++ b/scumm/string.cpp
@@ -203,7 +203,7 @@ void Scumm::CHARSET_1()
_charset->addLinebreaks(0, buffer, 0, t);
if (_charset->_center) {
- _charset->_nextLeft -= _charset->getStringWidth(0, buffer, 0) >> 1;
+ _charset->_nextLeft -= _charset->getStringWidth(0, buffer) >> 1;
if (_charset->_nextLeft < 0)
_charset->_nextLeft = 0;
}
@@ -228,9 +228,9 @@ void Scumm::CHARSET_1()
} else {
_charset->_nextLeft = _string[0].xpos;
if (_charset->_center) {
- _charset->_nextLeft -= _charset->getStringWidth(0, buffer, 0) >> 1;
+ _charset->_nextLeft -= _charset->getStringWidth(0, buffer) >> 1;
}
- _charset->_nextTop += _charset->getFontPtr()[1];
+ _charset->_nextTop += _charset->getFontHeight();
_charset->_disableOffsX = true;
continue;
}
@@ -299,13 +299,13 @@ void Scumm::CHARSET_1()
buffer += 2;
break;
case 14: {
- int oldy = _charset->getFontPtr()[1];
+ int oldy = _charset->getFontHeight();
_charset->setCurID(*buffer++);
buffer += 2;
for (i = 0; i < 4; i++)
_charset->_colorMap[i] = _charsetData[_charset->getCurID()][i];
- _charset->_nextTop -= _charset->getFontPtr()[1] - oldy;
+ _charset->_nextTop -= _charset->getFontHeight() - oldy;
break;
}
default:
@@ -341,7 +341,7 @@ void Scumm::description()
buffer = _charset->_buffer;
_string[0].ypos = camera._cur.y + 88;
- _string[0].xpos = (_realWidth / 2) - (_charset->getStringWidth(0, buffer, 0) >> 1);
+ _string[0].xpos = (_realWidth / 2) - (_charset->getStringWidth(0, buffer) >> 1);
if (_string[0].xpos < 0)
_string[0].xpos = 0;
@@ -402,7 +402,7 @@ void Scumm::drawDescString(byte *msg)
_charset->_nextTop = _string[0].ypos;
// Center text
- _charset->_nextLeft -= _charset->getStringWidth(0, buffer, 0) >> 1;
+ _charset->_nextLeft -= _charset->getStringWidth(0, buffer) >> 1;
if (_charset->_nextLeft < 0)
_charset->_nextLeft = 0;
@@ -455,7 +455,7 @@ void Scumm::drawString(int a)
for (i = 0; i < 4; i++)
_charset->_colorMap[i] = _charsetData[_charset->getCurID()][i];
- fontHeight = _charset->getFontPtr()[1];
+ fontHeight = _charset->getFontHeight();
}
_msgPtrToAdd = buf;
@@ -474,7 +474,7 @@ void Scumm::drawString(int a)
if (space)
*space = '\0';
if (_charset->_center) {
- _charset->_left -= _charset->getStringWidth(a, buf, 0) >> 1;
+ _charset->_left -= _charset->getStringWidth(a, buf) >> 1;
}
if (!(_features & GF_AFTER_V7))
@@ -506,7 +506,7 @@ void Scumm::drawString(int a)
case 1:
case 8:
if (_charset->_center) {
- _charset->_left = _charset->_startLeft - _charset->getStringWidth(a, buf, i);
+ _charset->_left = _charset->_startLeft - _charset->getStringWidth(a, buf + i);
} else {
_charset->_left = _charset->_startLeft;
}
@@ -757,6 +757,7 @@ void Scumm::initCharset(int charsetno)
for (i = 0; i < 16; i++)
_charset->_colorMap[i] = _charsetData[_charset->getCurID()][i];
}
+
void Scumm::loadLanguageBundle() {
File file;