[Scummvm-cvs-logs] CVS: scummvm/scumm charset.cpp,2.104,2.105 charset.h,2.30,2.31 intern.h,2.208,2.209 script_v7he.cpp,2.56,2.57

Travis Howell kirben at users.sourceforge.net
Tue Aug 31 00:41:10 CEST 2004


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

Modified Files:
	charset.cpp charset.h intern.h script_v7he.cpp 
Log Message:

Move function as requested.


Index: charset.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/charset.cpp,v
retrieving revision 2.104
retrieving revision 2.105
diff -u -d -r2.104 -r2.105
--- charset.cpp	31 Aug 2004 07:32:53 -0000	2.104
+++ charset.cpp	31 Aug 2004 07:40:28 -0000	2.105
@@ -50,30 +50,6 @@
 	_curId = 0;
 }
 
-int CharsetRenderer::getLetter(int letter) {
-	int offset, result;
-
-	byte *ptr = _vm->getResourceAddress(rtCharset, _curId);
-	if (!ptr)
-		error("CharsetRenderer::getLetter: charset %d not found!", _curId);
-
-	offset = READ_LE_UINT32(ptr + 29 + letter);
-	if (offset == 0)
-		return 0;
-
-	ptr += offset;
-	
-	result = READ_LE_UINT16(ptr + 2);
-	byte start = *ptr;
-
-	if (result >= 0x80) {
-		result = result - 256 + start;
-	} else {
-		result += start;
-	};
-	return (result);
-}
-
 void CharsetRendererCommon::setCurID(byte id) {
 	checkRange(_vm->_numCharsets - 1, 0, id, "Printing with bad charset %d");
 

Index: charset.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/charset.h,v
retrieving revision 2.30
retrieving revision 2.31
diff -u -d -r2.30 -r2.31
--- charset.h	30 Aug 2004 11:52:33 -0000	2.30
+++ charset.h	31 Aug 2004 07:40:28 -0000	2.31
@@ -71,7 +71,6 @@
 	virtual void printChar(int chr) = 0;
 	virtual void drawChar(int chr, const Graphics::Surface &s, int x, int y) {}
 
-	int getLetter(int letter);
 	int getStringWidth(int a, const byte *str);
 	void addLinebreaks(int a, byte *str, int pos, int maxwidth);
 	

Index: intern.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/intern.h,v
retrieving revision 2.208
retrieving revision 2.209
diff -u -d -r2.208 -r2.209
--- intern.h	30 Aug 2004 11:52:33 -0000	2.208
+++ intern.h	31 Aug 2004 07:40:28 -0000	2.209
@@ -615,6 +615,7 @@
 	virtual const char *getOpcodeDesc(byte i);
 
 	byte stringLen(byte *);
+	int getCharsetOffset(int letter);
 
 	/* Version 7 script opcodes */
 	void o7_cursorCommand();

Index: script_v7he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v7he.cpp,v
retrieving revision 2.56
retrieving revision 2.57
diff -u -d -r2.56 -r2.57
--- script_v7he.cpp	30 Aug 2004 14:26:52 -0000	2.56
+++ script_v7he.cpp	31 Aug 2004 07:40:28 -0000	2.57
@@ -407,6 +407,31 @@
 	return len;
 }
 
+int ScummEngine_v7he::getCharsetOffset(int letter) {
+	int offset, result;
+	int id = _charset->getCurID();
+
+	byte *ptr = getResourceAddress(rtCharset, id);
+	if (!ptr)
+		error("getCharsetOffset: charset %d not found!", id);
+
+	offset = READ_LE_UINT32(ptr + 29 + letter);
+	if (offset == 0)
+		return 0;
+
+	ptr += offset;
+	
+	result = READ_LE_UINT16(ptr + 2);
+	byte start = *ptr;
+
+	if (result >= 0x80) {
+		result = result - 256 + start;
+	} else {
+		result += start;
+	};
+	return (result);
+}
+
 void ScummEngine_v7he::o7_cursorCommand() {
 	int a, i;
 	int args[16];
@@ -726,8 +751,7 @@
 	writeVar(0, array);
 	while (len >= pos) {
 		letter = readArray(0, 0, pos);
-		if (letter)
-			result += _charset->getLetter(letter);
+		result += getCharsetOffset(letter);
 		pos++;
 	}
 
@@ -903,7 +927,7 @@
 
 	while (len <= pos) {
 		letter = readArray(0, 0, pos);
-		result += _charset->getLetter(letter);
+		result += getCharsetOffset(letter);
 		if (result >= ebx)
 			break;
 		pos++;





More information about the Scummvm-git-logs mailing list