[Scummvm-cvs-logs] CVS: scummvm/sky text.cpp,1.48.2.2,1.48.2.3 text.h,1.24.2.1,1.24.2.2

Robert G?ffringmann lavosspawn at users.sourceforge.net
Fri Aug 1 08:51:11 CEST 2003


Update of /cvsroot/scummvm/scummvm/sky
In directory sc8-pr-cvs1:/tmp/cvs-serv9032/sky

Modified Files:
      Tag: branch-0-5-0
	text.cpp text.h 
Log Message:
applied eriktorbjorn's fixes for the LINC charset to branch, too.

Index: text.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/text.cpp,v
retrieving revision 1.48.2.2
retrieving revision 1.48.2.3
diff -u -d -r1.48.2.2 -r1.48.2.3
--- text.cpp	31 Jul 2003 21:59:10 -0000	1.48.2.2
+++ text.cpp	1 Aug 2003 15:48:20 -0000	1.48.2.3
@@ -50,18 +50,11 @@
 		_controlCharacterSet.charHeight = 12;
 		_controlCharacterSet.charSpacing = 0;
 
-		// In version 0.0288, decrease the character width for the
-		// LINC terminal font by one for every character, except
-		// space which has to be one pixel wider instead.
-		if (SkyState::_systemVars.gameVersion == 288) {
-			for (int i = 1; i < CHAR_SET_HEADER; i++)
-				_controlCharacterSet.addr[i]--;
-			_controlCharacterSet.addr[0]++;
-		}
-		
 		_linkCharacterSet.addr = _skyDisk->loadFile(60521, NULL);
 		_linkCharacterSet.charHeight = 12;
 		_linkCharacterSet.charSpacing = 1;
+
+		patchLINCCharset();
 	} else {
 		_controlCharacterSet.addr = NULL;
 		_linkCharacterSet.addr = NULL;
@@ -79,6 +72,119 @@
 	if (_preAfterTableArea) free(_preAfterTableArea);
 }
 
+void SkyText::patchChar(byte *charSetPtr, int width, int height, int c, const uint16 *data) {
+	byte *ptr = charSetPtr + (CHAR_SET_HEADER + (height << 2) * c);
+
+	charSetPtr[c] = width;
+
+	for (int i = 0; i < height; i++) {
+		ptr[i * 4 + 0] = ptr[i * 4 + 2] = (data[i] & 0xFF00) >> 8;
+		ptr[i * 4 + 1] = ptr[i * 4 + 3] = data[i] & 0x00FF;
+	}
+}
+
+void SkyText::patchLINCCharset() {
+	// The LINC terminal charset looks strange in some cases. This
+	// function attempts to patch up the worst blemishes.
+
+	byte *charSetPtr = _controlCharacterSet.addr;
+	int charHeight = _controlCharacterSet.charHeight;
+
+	// In v0.0288, decrease the character spacing is too wide. Decrease
+	// the width for every character by one, except for space which needs
+	// to be one pixel wider than before.
+
+	if (SkyState::_systemVars.gameVersion == 288) {
+		for (int i = 1; i < CHAR_SET_HEADER; i++)
+			charSetPtr[i]--;
+		charSetPtr[0]++;
+	}
+
+	// NOTE: I have only tested this part of the code with v0.0372
+
+	// Several characters are different in this charset than in the other
+	// two. This is particularly noticeable when using a non-English
+	// version.
+
+	const uint16 slash[] = {
+		0x0000, 0x0000, 0x0000, 0x0800, 0x1000, 0x1000,
+		0x2000,	0x2000, 0x4000, 0x0000, 0x0000, 0x0000
+	};
+
+	const uint16 lt[] = {
+		0x0000, 0x0000, 0x0800, 0x1000, 0x2000, 0x4000,
+		0x2000, 0x1000, 0x0800, 0x0000, 0x0000, 0x0000
+	};
+
+	const uint16 gt[] = {
+		0x0000, 0x0000, 0x4000, 0x2000, 0x1000, 0x0800,
+		0x1000, 0x2000, 0x4000, 0x0000, 0x0000, 0x0000
+	};
+
+	const uint16 a_umlaut[] = {
+        0x0000, 0x0000, 0x2800, 0x0000, 0x3000, 0x0800,
+		0x3800, 0x4800, 0x3800,	0x0000,	0x0000,	0x0000
+	};
+
+	const uint16 o_umlaut[] = {
+		0x0000,	0x0000,	0x4800,	0x0000,	0x3000,	0x4800,
+		0x4800,	0x4800,	0x3000,	0x0000,	0x0000,	0x0000
+	};
+
+	const uint16 u_umlaut[] = {
+		0x0000,	0x0000,	0x4800,	0x0000,	0x4800,	0x4800,
+		0x4800,	0x4800,	0x3000,	0x0000,	0x0000,	0x0000
+	};
+
+	const uint16 A_umlaut[] = {
+		0x0000, 0x4800, 0x0000, 0x3000, 0x4800, 0x4800,
+		0x7800, 0x4800, 0x4800, 0x0000, 0x0000, 0x0000
+	};
+
+	const uint16 O_umlaut[] = {
+		0x0000,	0x4800,	0x0000,	0x3000,	0x4800, 0x4800,
+		0x4800,	0x4800,	0x3000,	0x0000,	0x0000,	0x0000
+	};
+
+	const uint16 U_umlaut[] = {
+		0x0000, 0x4800, 0x0000, 0x4800, 0x4800, 0x4800,
+		0x4800, 0x4800, 0x3000, 0x0000,	0x0000,	0x0000
+	};
+
+	const uint16 normal_j[] = {
+		0x0000, 0x0000, 0x0000, 0x0800, 0x0000, 0x0800,
+		0x0800,	0x0800, 0x0800, 0x4800, 0x3000, 0x0000
+	};
+
+	const uint16 german_sz[] = {
+		0x0000, 0x0000, 0x2000, 0x5000, 0x5000, 0x4800,
+		0x4800, 0x4800, 0x5000, 0x0000, 0x0000, 0x0000
+	};
+
+	const uint16 normal_1[] = {
+		0x0000, 0x0000, 0x0000, 0x1000, 0x7000, 0x1000,
+		0x1000, 0x1000, 0x7c00, 0x0000, 0x0000, 0x0000
+	};
+
+	patchChar(charSetPtr, 5, charHeight,  3, u_umlaut);
+	patchChar(charSetPtr, 5, charHeight,  8, german_sz);
+	patchChar(charSetPtr, 5, charHeight,  9, o_umlaut);
+	patchChar(charSetPtr, 5, charHeight, 93, U_umlaut);
+	patchChar(charSetPtr, 5, charHeight, 74, normal_j);
+	patchChar(charSetPtr, 6, charHeight, 17, normal_1);
+	if (SkyState::_systemVars.gameVersion <= 303) {
+		patchChar(charSetPtr, 5, charHeight, 10, a_umlaut);
+	} else {
+		patchChar(charSetPtr, 5, charHeight, 94, A_umlaut);
+		patchChar(charSetPtr, 5, charHeight, 95, O_umlaut);
+
+		// Used by, for instance, the BRIEFING.DOC file in all (?) languages
+		patchChar(charSetPtr, 5, charHeight, 96, lt);
+		patchChar(charSetPtr, 5, charHeight, 97, gt);
+		patchChar(charSetPtr, 5, charHeight, 98, slash);
+	}
+}
+
 void SkyText::fnSetFont(uint32 fontNr) { 
 
 	struct charSet *newCharSet;
@@ -116,10 +222,10 @@
 }
 
 void SkyText::getText(uint32 textNr) { //load text #"textNr" into textBuffer
-	
+
 	if (patchMessage(textNr))
 		return ;
-	
+
 	uint32 sectionNo = (textNr & 0x0F000) >> 12;
 	
 	if (SkyState::_itemList[FIRST_TEXT_SEC + sectionNo] == (void **)NULL) { //check if already loaded

Index: text.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/text.h,v
retrieving revision 1.24.2.1
retrieving revision 1.24.2.2
diff -u -d -r1.24.2.1 -r1.24.2.2
--- text.h	31 Jul 2003 21:59:10 -0000	1.24.2.1
+++ text.h	1 Aug 2003 15:48:20 -0000	1.24.2.2
@@ -58,6 +58,8 @@
 	bool getTBit();
 	void initHuffTree();
 	char getTextChar();
+	void patchChar(byte *charSetPtr, int width, int height, int c, const uint16 *data);
+	void patchLINCCharset();
 	bool patchMessage(uint32 textNum);
 
 	SkyDisk *_skyDisk;
@@ -113,3 +115,4 @@
 };
 
 #endif
+





More information about the Scummvm-git-logs mailing list