[Scummvm-cvs-logs] CVS: scummvm/scumm charset.cpp,2.2,2.3 charset.h,2.2,2.3 scumm.h,1.106,1.107 scummvm.cpp,2.9,2.10 string.cpp,1.63,1.64

Max Horn fingolfin at users.sourceforge.net
Wed Dec 25 13:43:02 CET 2002


Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1:/tmp/cvs-serv19412

Modified Files:
	charset.cpp charset.h scumm.h scummvm.cpp string.cpp 
Log Message:
more cleanup

Index: charset.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/charset.cpp,v
retrieving revision 2.2
retrieving revision 2.3
diff -u -d -r2.2 -r2.3
--- charset.cpp	25 Dec 2002 21:14:26 -0000	2.2
+++ charset.cpp	25 Dec 2002 21:42:21 -0000	2.3
@@ -67,8 +67,9 @@
 	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;

Index: charset.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/charset.h,v
retrieving revision 2.2
retrieving revision 2.3
diff -u -d -r2.2 -r2.3
--- charset.h	25 Dec 2002 21:14:26 -0000	2.2
+++ charset.h	25 Dec 2002 21:42:22 -0000	2.3
@@ -58,22 +58,21 @@
 	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]; }
 };
 
 

Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.h,v
retrieving revision 1.106
retrieving revision 1.107
diff -u -d -r1.106 -r1.107
--- scumm.h	25 Dec 2002 21:04:47 -0000	1.106
+++ scumm.h	25 Dec 2002 21:42:22 -0000	1.107
@@ -80,8 +80,7 @@
 
 struct VerbSlot;
 
-class ObjectData {
-public:
+struct ObjectData {
 	uint32 offs_obim_to_room;
 	uint32 offs_obcd_to_room;
 	int16 walk_x, walk_y;

Index: scummvm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scummvm.cpp,v
retrieving revision 2.9
retrieving revision 2.10
diff -u -d -r2.9 -r2.10
--- scummvm.cpp	25 Dec 2002 21:04:47 -0000	2.9
+++ scummvm.cpp	25 Dec 2002 21:42:22 -0000	2.10
@@ -178,24 +178,18 @@
 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()

Index: string.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/string.cpp,v
retrieving revision 1.63
retrieving revision 1.64
diff -u -d -r1.63 -r1.64
--- string.cpp	25 Dec 2002 21:14:26 -0000	1.63
+++ string.cpp	25 Dec 2002 21:42:22 -0000	1.64
@@ -203,7 +203,7 @@
 	_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 @@
 			} 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 @@
 			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 @@
 
 	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 @@
 	_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 @@
 		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 @@
 	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 @@
 			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 @@
 	for (i = 0; i < 16; i++)
 		_charset->_colorMap[i] = _charsetData[_charset->getCurID()][i];
 }
+
 void Scumm::loadLanguageBundle() {
 	File file;
 





More information about the Scummvm-git-logs mailing list