[Scummvm-cvs-logs] CVS: scummvm/saga actor.cpp,1.197,1.198

Eugene Sandulenko sev at users.sourceforge.net
Sun Oct 9 19:09:55 CEST 2005


Update of /cvsroot/scummvm/scummvm/saga
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16398

Modified Files:
	actor.cpp 
Log Message:
Eliminate font substitution ugliness.


Index: actor.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/actor.cpp,v
retrieving revision 1.197
retrieving revision 1.198
diff -u -d -r1.197 -r1.198
--- actor.cpp	9 Oct 2005 16:25:47 -0000	1.197
+++ actor.cpp	10 Oct 2005 02:09:08 -0000	1.198
@@ -1012,12 +1012,13 @@
 			_activeSpeech.drawRect.top = _speechBoxScript.top;
 			_activeSpeech.drawRect.bottom = _speechBoxScript.bottom;
 		} else {
+			FontId font = (_vm->getGameType() == GType_ITE ? kMediumFont : kIHNMMainFont);
 			width = _activeSpeech.speechBox.width();
-			height = _vm->_font->getHeight((_vm->getGameType() == GType_ITE ? kMediumFont : kIHNMMainFont), _activeSpeech.strings[0], width - 2, _activeSpeech.getFontFlags(0)) + 1;
+			height = _vm->_font->getHeight(font, _activeSpeech.strings[0], width - 2, _activeSpeech.getFontFlags(0)) + 1;
 
 			if (height > 40 && width < _vm->getDisplayWidth() - 100) {
 				width = _vm->getDisplayWidth() - 100;
-				height = _vm->_font->getHeight((_vm->getGameType() == GType_ITE ? kMediumFont : kIHNMMainFont), _activeSpeech.strings[0], width - 2, _activeSpeech.getFontFlags(0)) + 1;
+				height = _vm->_font->getHeight(font, _activeSpeech.strings[0], width - 2, _activeSpeech.getFontFlags(0)) + 1;
 			}
 
 			_activeSpeech.speechBox.setWidth(width);
@@ -1626,9 +1627,11 @@
 		outputString = _activeSpeech.strings[0];
 	}
 
+	FontId font = (_vm->getGameType() == GType_ITE ? kMediumFont : kIHNMMainFont);
+
 	if (_activeSpeech.actorsCount > 1) {
-		height = _vm->_font->getHeight((_vm->getGameType() == GType_ITE ? kMediumFont : kIHNMMainFont));
-		width = _vm->_font->getStringWidth((_vm->getGameType() == GType_ITE ? kMediumFont : kIHNMMainFont), _activeSpeech.strings[0], 0, kFontNormal);
+		height = _vm->_font->getHeight(font);
+		width = _vm->_font->getStringWidth(font, _activeSpeech.strings[0], 0, kFontNormal);
 
 		for (i = 0; i < _activeSpeech.actorsCount; i++) {
 			actor = getActor(_activeSpeech.actorIds[i]);
@@ -1637,11 +1640,11 @@
 			textPoint.x = clamp( 10, actor->_screenPosition.x - width / 2, _vm->getDisplayWidth() - 10 - width);
 			textPoint.y = clamp( 10, actor->_screenPosition.y - 58, _vm->_scene->getHeight() - 10 - height);
 
-			_vm->_font->textDraw((_vm->getGameType() == GType_ITE ? kMediumFont : kIHNMMainFont), backBuffer, _activeSpeech.strings[0], textPoint,
+			_vm->_font->textDraw(font, backBuffer, _activeSpeech.strings[0], textPoint,
 				_activeSpeech.speechColor[i], _activeSpeech.outlineColor[i], _activeSpeech.getFontFlags(i));
 		}
 	} else {
-		_vm->_font->textDrawRect((_vm->getGameType() == GType_ITE ? kMediumFont : kIHNMMainFont), backBuffer, _activeSpeech.strings[0], _activeSpeech.drawRect, _activeSpeech.speechColor[0],
+		_vm->_font->textDrawRect(font, backBuffer, _activeSpeech.strings[0], _activeSpeech.drawRect, _activeSpeech.speechColor[0],
 			_activeSpeech.outlineColor[0], _activeSpeech.getFontFlags(0));
 	}
 }





More information about the Scummvm-git-logs mailing list