[Scummvm-cvs-logs] CVS: scummvm/kyra font.cpp,1.6,1.7 wsamovie.cpp,1.6,1.7

Joost Peters joostp at users.sourceforge.net
Thu Mar 3 13:43:16 CET 2005


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

Modified Files:
	font.cpp wsamovie.cpp 
Log Message:
big endian fixes


Index: font.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/kyra/font.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- font.cpp	9 Jan 2005 16:06:29 -0000	1.6
+++ font.cpp	3 Mar 2005 21:42:20 -0000	1.7
@@ -41,8 +41,18 @@
 	_buffer = buffer;
 	
 	Common::MemoryReadStream bufferstream(buffer, size);
-	
-	bufferstream.read(&_fontHeader, sizeof(_fontHeader));
+
+	_fontHeader._size = bufferstream.readUint16LE();
+	_fontHeader._magic1 = bufferstream.readUint16LE();
+	_fontHeader._magic2 = bufferstream.readUint16LE();
+	_fontHeader._magic3 = bufferstream.readUint16LE();
+	_fontHeader._charWidthOffset = bufferstream.readUint16LE();
+	_fontHeader._charBitsOffset = bufferstream.readUint16LE();
+	_fontHeader._charHeightOffset = bufferstream.readUint16LE();
+	_fontHeader._version = bufferstream.readUint16LE();
+	_fontHeader._countChars = bufferstream.readUint16LE();
+	_fontHeader._width = bufferstream.readByte();
+	_fontHeader._height = bufferstream.readByte();	
 	
 	// tests for the magic values
 	if(_fontHeader._magic1 != FontHeader_Magic1 || _fontHeader._magic2 != FontHeader_Magic2 ||
@@ -236,14 +246,14 @@
 		
 		PreRenderedChar newChar;
 		
-		newChar.c = new uint8[(_charHeight[currentChar] >> 8) * _charWidth[currentChar]];
-		assert(newChar.c);
-		memset(newChar.c, 0, sizeof(uint8) * (_charHeight[currentChar] >> 8) * _charWidth[currentChar]);
-		newChar.height = (_charHeight[currentChar] >> 8);
+		newChar.height = READ_LE_UINT16(&_charHeight[currentChar]) >> 8;
 		newChar.width = _charWidth[currentChar];
-		newChar.heightadd = _charHeight[currentChar] & 0xFF;
+		newChar.heightadd = READ_LE_UINT16(&_charHeight[currentChar]) & 0xFF;
+		newChar.c = new uint8[newChar.height * newChar.width];
+		assert(newChar.c);
+		memset(newChar.c, 0, sizeof(uint8) * newChar.height * newChar.width);
 		
-		uint8* src = _buffer + _offsetTable[currentChar];
+		uint8* src = _buffer + READ_LE_UINT16(&_offsetTable[currentChar]);
 		uint8* dst = &newChar.c[0];
 		uint8 index = 0;
 		

Index: wsamovie.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/kyra/wsamovie.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- wsamovie.cpp	9 Jan 2005 16:06:29 -0000	1.6
+++ wsamovie.cpp	3 Mar 2005 21:42:20 -0000	1.7
@@ -45,8 +45,14 @@
 	// I like these Streams .... =)
 	Common::MemoryReadStream datastream(data, size);
 		
-	datastream.read(&_wsaHeader, sizeof(_wsaHeader));
-
+	_wsaHeader._numFrames = datastream.readUint16LE();
+	_wsaHeader._width = datastream.readUint16LE();
+	_wsaHeader._height = datastream.readUint16LE();
+	_wsaHeader._xPos = datastream.readByte();
+	_wsaHeader._yPos = datastream.readByte();
+	_wsaHeader._delta = datastream.readUint16LE();
+	_wsaHeader._type = datastream.readUint16LE();
+	
 #ifdef DUMP_FILES
 	// TODO: make Linux/BSD conform
 	FILE* wsaheader = fopen("dumps/wsaheader.txt", "w+");





More information about the Scummvm-git-logs mailing list