[Scummvm-cvs-logs] CVS: scummvm/sky text.cpp,1.19,1.20 text.h,1.10,1.11

Oliver Kiehl olki at users.sourceforge.net
Fri May 9 10:12:07 CEST 2003


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

Modified Files:
	text.cpp text.h 
Log Message:
use huffman trees instead of that spaghetti code


Index: text.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/text.cpp,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- text.cpp	3 May 2003 23:32:04 -0000	1.19
+++ text.cpp	9 May 2003 17:11:47 -0000	1.20
@@ -364,2890 +364,1100 @@
 
 }
 
-char SkyText_v00267::getTextChar() {
-
-	//NOTE: The decoding code for the floppy versions (both demo and full version) is _completely_ different.
-	//This code is based on disassembly of the v0.0267 binary.
-	
-
-	if (getTBit())
-		goto ab73;
[...3936 lines suppressed...]
-label_119:
-	if (getTBit())
-		goto label_121;
-
-	return '{';
-
-label_121:
-	if (getTBit())
-		goto label_122;
-
-	return (char)148;
-
-label_122:
-	return '|';
-
-
-	return '!'; //should never be reached
+	return traverseTree(huffTree_00372);
 }
 

Index: text.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/text.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- text.h	29 Apr 2003 19:52:24 -0000	1.10
+++ text.h	9 May 2003 17:11:47 -0000	1.11
@@ -24,6 +24,12 @@
 
 #include "sky/disk.h"
 
+struct HuffTree {
+	char lChild;
+	char rChild;
+	char value;
+};
+
 class SkyText {
 public:
 	SkyText(SkyDisk *skyDisk, uint32 gameVersion, uint16 _language);
@@ -36,6 +42,7 @@
 protected:
 	bool getTBit();
 	void fnSetFont(uint32 fontNr);
+	char traverseTree(const HuffTree *huffTree);
 	virtual char getTextChar() = 0;
 
 	SkyDisk *_skyDisk;





More information about the Scummvm-git-logs mailing list