[Scummvm-cvs-logs] SF.net SVN: scummvm:[41723] scummvm/trunk/engines/kyra/screen.cpp

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Sun Jun 21 03:22:23 CEST 2009


Revision: 41723
          http://scummvm.svn.sourceforge.net/scummvm/?rev=41723&view=rev
Author:   lordhoto
Date:     2009-06-21 01:22:23 +0000 (Sun, 21 Jun 2009)

Log Message:
-----------
Cleanup.

Modified Paths:
--------------
    scummvm/trunk/engines/kyra/screen.cpp

Modified: scummvm/trunk/engines/kyra/screen.cpp
===================================================================
--- scummvm/trunk/engines/kyra/screen.cpp	2009-06-21 01:15:47 UTC (rev 41722)
+++ scummvm/trunk/engines/kyra/screen.cpp	2009-06-21 01:22:23 UTC (rev 41723)
@@ -1023,6 +1023,7 @@
 	// FIXME: add font support for amiga version
 	if (_vm->gameFlags().platform == Common::kPlatformAmiga)
 		return 0;
+
 	return *(_fonts[_currentFont].fontData + _fonts[_currentFont].fontDescOffset + 4);
 }
 
@@ -1030,6 +1031,7 @@
 	// FIXME: add font support for amiga version
 	if (_vm->gameFlags().platform == Common::kPlatformAmiga)
 		return 0;
+
 	return *(_fonts[_currentFont].fontData + _fonts[_currentFont].fontDescOffset + 5);
 }
 
@@ -1037,9 +1039,14 @@
 	// FIXME: add font support for amiga version
 	if (_vm->gameFlags().platform == Common::kPlatformAmiga)
 		return 0;
+
 	if (c & 0xFF00)
 		return SJIS_CHARSIZE >> 1;
-	return (int)_fonts[_currentFont].charWidthTable[c] + _charWidth;
+
+	if (_fonts[_currentFont].lastGlyph < c)
+		return 0;
+	else
+		return (int)_fonts[_currentFont].charWidthTable[c] + _charWidth;
 }
 
 int Screen::getTextWidth(const char *str) const {
@@ -1082,8 +1089,7 @@
 	cmap[1] = color1;
 	setTextColor(cmap, 0, 1);
 
-	Font *fnt = &_fonts[_currentFont];
-	const uint8 charHeightFnt = *(fnt->fontData + fnt->fontDescOffset + 4);
+	const uint8 charHeightFnt = getFontHeight();
 	uint8 charHeight = 0;
 
 	if (x < 0)
@@ -1147,7 +1153,7 @@
 	if (!charWidth || charWidth + x > SCREEN_W)
 		return;
 
-	uint8 charH0 = *(fnt->fontData + fnt->fontDescOffset + 4);
+	uint8 charH0 = getFontHeight();
 	if (!charH0 || charH0 + y > SCREEN_H)
 		return;
 
@@ -1198,7 +1204,7 @@
 	}
 
 	if (_curPage == 0 || _curPage == 1)
-		addDirtyRect(x, y, charWidth, *(fnt->fontData + fnt->fontDescOffset + 4));
+		addDirtyRect(x, y, charWidth, getFontHeight());
 }
 
 void Screen::drawShape(uint8 pageNum, const uint8 *shapeData, int x, int y, int sd, int flags, ...) {


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list