[Scummvm-cvs-logs] CVS: scummex image.cpp,1.3,1.4 image.h,1.3,1.4 scummex.cpp,1.6,1.7 scummex.h,1.3,1.4

Max Horn fingolfin at users.sourceforge.net
Fri Sep 19 12:54:35 CEST 2003


Update of /cvsroot/scummvm/scummex
In directory sc8-pr-cvs1:/tmp/cvs-serv10734

Modified Files:
	image.cpp image.h scummex.cpp scummex.h 
Log Message:
cleanup; endian fixes (still doesn't show me anything when I load some files on MacOS)

Index: image.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummex/image.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- image.cpp	19 Sep 2003 11:15:05 -0000	1.3
+++ image.cpp	19 Sep 2003 15:47:41 -0000	1.4
@@ -27,9 +27,9 @@
 uint32 offset;
 
 Image::Image() {
-	transp = 0;
-	width = 0;
-	height = 0;
+	_transp = 0;
+	_width = 0;
+	_height = 0;
 	_resource = new Resource();
 }
 
@@ -39,36 +39,36 @@
 
 int Image::drawPalette(BlockTable *_blockTable, int id, File& _input)
 {
-    int addindex = 0;
-    int index = 0;
+	int addindex = 0;
+	int index = 0;
 
-    _gui->DisplayImage("Block Palette", 384, 384);
+	_gui->DisplayImage("Block Palette", 384, 384);
 
-    _input.seek(_blockTable[id].offset + 8, SEEK_SET);
+	_input.seek(_blockTable[id].offset + 8, SEEK_SET);
 
-    for (int j = 0; j < 256; j++) {
-	_rgbTable[j].red = _input.readByte();	// red
-	_rgbTable[j].green = _input.readByte();	// green
-	_rgbTable[j].blue = _input.readByte();	// blue
-    }
+	for (int j = 0; j < 256; j++) {
+		_rgbTable[j].red = _input.readByte();	// red
+		_rgbTable[j].green = _input.readByte(); // green
+		_rgbTable[j].blue = _input.readByte();	// blue
+	}
 
-    int x = 0, y = 0;
-    for (int v = 0; v < 16; v++) {
-	for (int k = 0; k < 384 / 16; k++) {
-	    for (int l = 0; l < 16; l++) {
-		for (int j = 0; j < 384 / 16; j++) {
-		    index = l + addindex;
-		    _gui->PutPixel(x++, y, _rgbTable[index].red, _rgbTable[index].green, _rgbTable[index].blue);
+	int x = 0, y = 0;
+	for (int v = 0; v < 16; v++) {
+		for (int k = 0; k < 384 / 16; k++) {
+			for (int l = 0; l < 16; l++) {
+				for (int j = 0; j < 384 / 16; j++) {
+					index = l + addindex;
+					_gui->PutPixel(x++, y, _rgbTable[index].red, _rgbTable[index].green, _rgbTable[index].blue);
+				}
+			}
+			y++;
+			x = 0;
 		}
-	    }
-	    y++;
-	    x = 0;
+		addindex += 16;
 	}
-	addindex += 16;
-    }
 
-    _gui->DrawImage();
-    return 0;
+	_gui->DrawImage();
+	return 0;
 }
 
 int Image::drawBG(File& _input, BlockTable *_blockTable, int id, char* filename)
@@ -80,18 +80,18 @@
 	} else {
 		RMHDindex = _resource->findBlock(0, _blockTable, _input, id, "RMHD", "-1");
 	}
-	width = _blockTable[RMHDindex].width;
-	height = _blockTable[RMHDindex].height;
+	_width = _blockTable[RMHDindex].width;
+	_height = _blockTable[RMHDindex].height;
 
-	_gui->DisplayImage("Room Image", width, height);
+	_gui->DisplayImage("Room Image", _width, _height);
 	
 	if (_blockTable[id].blockTypeID != 209) {
 		TRNSindex = _resource->findBlock(0, _blockTable, _input, id, "TRNS", "-1");
-		transp = _blockTable[TRNSindex].trans;
+		_transp = _blockTable[TRNSindex].trans;
 		CLUTindex = _resource->findBlock(0, _blockTable, _input, id, "CLUT", "APAL", "NPAL", "-1");
 		_input.seek(_blockTable[CLUTindex].offset + 8, SEEK_SET);
 	} else {
-		transp = 260;
+		_transp = 260;
 		CLUTindex = _resource->findBlock(0, _blockTable, _input, id, "PA", "-1");
 		_input.seek(_blockTable[CLUTindex].offset + 8, SEEK_SET);
 	}
@@ -108,7 +108,7 @@
 		SMAPindex = id;
 	}
 
-	offsets = new uint32[width/8];
+	_offsets = new uint32[_width/8];
 	
 	if (_blockTable[id].blockTypeID != 209) {
 		_input.seek(_blockTable[SMAPindex].offset + 8, SEEK_SET);
@@ -116,10 +116,10 @@
 		_input.seek(_blockTable[SMAPindex].offset + 10, SEEK_SET);
 	}
 
-	for (int x = 0; x < width/8; x++) 
-		offsets[x] = _input.readUint32LE() + _blockTable[SMAPindex].offset;
+	for (int x = 0; x < _width/8; x++) 
+		_offsets[x] = _input.readUint32LE() + _blockTable[SMAPindex].offset;
 
-	for (uint8 x = 0; x < width/8; x++)
+	for (int x = 0; x < _width/8; x++)
 	{
 		offset = x*8;
 
@@ -137,14 +137,14 @@
 
 	RMHDindex = _resource->findBlock(1, _blockTable, _input, id, "IMHD", "-1");
 	
-	width = _blockTable[RMHDindex].width;
-	height = _blockTable[RMHDindex].height;
+	_width = _blockTable[RMHDindex].width;
+	_height = _blockTable[RMHDindex].height;
 	
-	_gui->DisplayImage("Object", width, height);
+	_gui->DisplayImage("Object", _width, _height);
 	
 	TRNSindex = _resource->findBlock(0, _blockTable, _input, id, "TRNS", "-1");
 
-	transp = _blockTable[TRNSindex].trans;
+	_transp = _blockTable[TRNSindex].trans;
 	
 	CLUTindex = _resource->findBlock(0, _blockTable, _input, id, "CLUT", "APAL", "NPAL", "-1");
 
@@ -158,13 +158,13 @@
 	
 	SMAPindex = _resource->findBlock(1, _blockTable, _input, id, "SMAP", "-1");
 
-	offsets = new uint32[width/8];
+	_offsets = new uint32[_width/8];
 	
 	_input.seek(_blockTable[SMAPindex].offset + 8, SEEK_SET);
-	for (int x = 0; x < width/8; x++) 
-		offsets[x] = _input.readUint32LE() + _blockTable[SMAPindex].offset;
+	for (int x = 0; x < _width/8; x++) 
+		_offsets[x] = _input.readUint32LE() + _blockTable[SMAPindex].offset;
 
-	for (uint8 x = 0; x < width/8; x++)
+	for (int x = 0; x < _width/8; x++)
 	{
 		offset = x*8;
 
@@ -180,7 +180,7 @@
 	uint8 compr_method, parameter;
 	bool horiz;	
 		
-	_input.seek(offsets[pos], SEEK_SET);
+	_input.seek(_offsets[pos], SEEK_SET);
 	
 	/* Initializes bit stream */
 	_input.getbit(0);
@@ -195,7 +195,7 @@
 	{
 		case 0:
 			/* Uncompressed */
-			decode_uncompressed(height, _input);
+			decode_uncompressed(_height, _input);
 			break;
 					
 		case 1:
@@ -205,17 +205,17 @@
 	 	
 			/* 1st compression method */
 			if (horiz)
-				decode_horiz(height, parameter, _input);
+				decode_horiz(_height, parameter, _input);
 			else 
-				decode_vert(height, parameter, _input);
+				decode_vert(_height, parameter, _input);
 			break;
 	 
 		default:
 			/* 2nd compression method */
-	  		if ((compr_method >= 0x54) && (compr_method <= 0x60))
-	  			decode2transp(height, parameter, _input); 
+			if ((compr_method >= 0x54) && (compr_method <= 0x60))
+				decode2transp(_height, parameter, _input); 
 			else
-				decode2(height, parameter, _input);
+				decode2(_height, parameter, _input);
 			break;
 	}
 	
@@ -304,7 +304,7 @@
 			if (y == 0) 
 			{ 
 				index = _input.readByte();
-				if (index != transp)
+				if (index != _transp)
 					_gui->PutPixel(0 + offset, 0, _rgbTable[index].red, _rgbTable[index].green, _rgbTable[index].blue); 
 				x++;
 			}	
@@ -318,7 +318,7 @@
 						index = 0;
 						for (uint8 cx = 0; cx < parameter; cx++) 
 							index += (_input.getbit(1) << cx);
-						if (index != transp)
+						if (index != _transp)
 							_gui->PutPixel(x + offset, y, _rgbTable[index].red, _rgbTable[index].green, _rgbTable[index].blue); 
 						x++;
 					}
@@ -330,7 +330,7 @@
 						if (command < 4) 
 						{
 							index -= 4-command;
-							if (index != transp)
+							if (index != _transp)
 								_gui->PutPixel(x + offset, y, _rgbTable[index].red, _rgbTable[index].green, _rgbTable[index].blue); 
 							x++;
 						}
@@ -346,7 +346,7 @@
 									x = 0; 
 									y++; 
 								}
-								if (index != transp)
+								if (index != _transp)
 									_gui->PutPixel(x + offset, y, _rgbTable[index].red, _rgbTable[index].green, _rgbTable[index].blue); 
 								x++;
 						 		
@@ -355,7 +355,7 @@
 						else 
 						{
 						 	index += command-4;
-							if (index != transp)
+							if (index != _transp)
 								_gui->PutPixel(x + offset, y, _rgbTable[index].red, _rgbTable[index].green, _rgbTable[index].blue); 
 							x++;
 						}							
@@ -399,8 +399,8 @@
 						_gui->PutPixel(x + offset, y, _rgbTable[index].red, _rgbTable[index].green, _rgbTable[index].blue);
 					}	
 					else
-				  	{
-				  		subt =- subt;
+					{
+						subt =- subt;
 						index -= subt;
 						_gui->PutPixel(x + offset, y, _rgbTable[index].red, _rgbTable[index].green, _rgbTable[index].blue);
 					}
@@ -445,8 +445,8 @@
 						_gui->PutPixel(y + offset, x, _rgbTable[index].red, _rgbTable[index].green, _rgbTable[index].blue);
 					}	
 					else
-				  	{
-				  		subt =- subt;
+					{
+						subt =- subt;
 						index -= subt;
 						_gui->PutPixel(y + offset, x, _rgbTable[index].red, _rgbTable[index].green, _rgbTable[index].blue);
 					}
@@ -468,12 +468,12 @@
 			if ((y == 0) && (x == 0)) 
 			{
 				index = _input.readByte();
-				if (index != transp)
+				if (index != _transp)
 					_gui->PutPixel(0 + offset, 0, _rgbTable[index].red, _rgbTable[index].green, _rgbTable[index].blue); 
 				x++;
 			}				
 			if (_input.getbit(1) == 0) 
-				if (index != transp)
+				if (index != _transp)
 					_gui->PutPixel(x + offset, y, _rgbTable[index].red, _rgbTable[index].green, _rgbTable[index].blue);
 			else 
 			{
@@ -483,7 +483,7 @@
 				 	for (uint8 cx = 0; cx < parameter; cx++) 
 						index += (_input.getbit(1) << cx );
 					subt = 1;
-				 	if (index != transp)
+				 	if (index != _transp)
 				 		_gui->PutPixel(x + offset, y, _rgbTable[index].red, _rgbTable[index].green, _rgbTable[index].blue);
 				}
 				else
@@ -491,14 +491,14 @@
 				 	if (_input.getbit(1) == 0) 
 				 	{						 
 						index -= subt;
-						if (index != transp)
+						if (index != _transp)
 							_gui->PutPixel(x + offset, y, _rgbTable[index].red, _rgbTable[index].green, _rgbTable[index].blue);
 					}	
 					else
-				  	{
-				  		subt =- subt;
+					{
+						subt =- subt;
 						index -= subt;
-						if (index != transp)
+						if (index != _transp)
 							_gui->PutPixel(x + offset, y, _rgbTable[index].red, _rgbTable[index].green, _rgbTable[index].blue);
 					}
 				} 
@@ -519,12 +519,12 @@
 			if ((y == 0) && (x == 0)) 
 			{
 				index = _input.readByte();
-				if (index != transp)
+				if (index != _transp)
 					_gui->PutPixel(0 + offset, 0, _rgbTable[index].red, _rgbTable[index].green, _rgbTable[index].blue); 
 				x++;
 			}				
 			if (_input.getbit(1) == 0) 
-				if (index != transp)
+				if (index != _transp)
 					_gui->PutPixel(y + offset, x, _rgbTable[index].red, _rgbTable[index].green, _rgbTable[index].blue);
 			else 
 			{
@@ -534,7 +534,7 @@
 				 	for (uint8 cx = 0; cx < parameter; cx++) 
 						index += (_input.getbit(1) << cx );
 					subt = 1;
-				 	if (index != transp)
+				 	if (index != _transp)
 				 		_gui->PutPixel(y + offset, x, _rgbTable[index].red, _rgbTable[index].green, _rgbTable[index].blue);
 				}
 				else
@@ -542,14 +542,14 @@
 				 	if (_input.getbit(1) == 0) 
 				 	{						 
 						index -= subt;
-						if (index != transp)
+						if (index != _transp)
 							_gui->PutPixel(y + offset, x, _rgbTable[index].red, _rgbTable[index].green, _rgbTable[index].blue);
 					}	
 					else
-				  	{
-				  		subt =- subt;
+					{
+						subt =- subt;
 						index -= subt;
-						if (index != transp)
+						if (index != _transp)
 							_gui->PutPixel(y + offset, x, _rgbTable[index].red, _rgbTable[index].green, _rgbTable[index].blue);
 					}
 				} 

Index: image.h
===================================================================
RCS file: /cvsroot/scummvm/scummex/image.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- image.h	19 Sep 2003 11:15:05 -0000	1.3
+++ image.h	19 Sep 2003 15:47:42 -0000	1.4
@@ -34,11 +34,11 @@
 class Image {
 private:
 	struct rgbtable _rgbTable[256];
-	uint32 palette[256];
-	int transp;
-	uint32 *offsets;
-	int width;
-	int height;
+	uint32 _palette[256];
+	int _transp;
+	uint32 *_offsets;
+	int _width;
+	int _height;
 	Resource *_resource;
 	GUI_wxWindows *_gui;
 

Index: scummex.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummex/scummex.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- scummex.cpp	19 Sep 2003 11:15:05 -0000	1.6
+++ scummex.cpp	19 Sep 2003 15:47:42 -0000	1.7
@@ -36,7 +36,8 @@
 }
 
 void ScummEX::getFileType(const char *filename) {
-	encbyte = 0;
+	uint32 tag;
+	_encbyte = 0;
 	char buf[256];
 	
 	if (_input.isOpen()) {
@@ -45,7 +46,7 @@
 		_input.close();
 	}
 		
-	_input.open(filename, 1, encbyte);
+	_input.open(filename, 1, _encbyte);
 
 	sprintf(buf, "ScummEX - %s", filename);
 	_gui->SetTitle(buf);
@@ -53,7 +54,7 @@
 	_gui->EnableToolbarTool(ID_Close);
 	_gui->EnableToolbarTool(ID_FileInfo);
 
-	tag = _input.readUint32LE();
+	_input.read(&tag, 4);
 
 	switch (tag) {
 		case MKID('LB83'):
@@ -65,7 +66,7 @@
 			_resource->searchBlocks(_blockTable, _input);
 			return;
 			
-		case 542461779: //SOU
+		case MKID('SOU '):
 			_input.seek(0, SEEK_SET);
 			_sound->parseSOU(_blockTable, _input);
 			return;
@@ -85,11 +86,11 @@
 	
 	_input.close();
 	
-	encbyte = 0x69;
+	_encbyte = 0x69;
 	
-	_input.open(filename, 1, encbyte);
+	_input.open(filename, 1, _encbyte);
 
-	tag = _input.readUint32LE();
+	_input.read(&tag, 4);
 
 	switch (tag) {
 		case MKID('RNAM'):
@@ -273,7 +274,7 @@
 void ScummEX::FileInfo() {
 	int fsize;
 	fsize = _input.size();
-	_gui->FileInfoDialog(fsize, encbyte);
+	_gui->FileInfoDialog(fsize, _encbyte);
 }
 	
 void ScummEX::UpdateInfosFromTree(int blockid) {

Index: scummex.h
===================================================================
RCS file: /cvsroot/scummvm/scummex/scummex.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- scummex.h	19 Sep 2003 01:36:40 -0000	1.3
+++ scummex.h	19 Sep 2003 15:47:42 -0000	1.4
@@ -30,7 +30,7 @@
 
 class ScummEX {
 private:
-	byte encbyte;
+	byte _encbyte;
 	
 	Image *_image;
 	Sound *_sound;
@@ -40,7 +40,6 @@
 public:
 	File _input;
 	File _output;
-	uint32 tag;
 	uint32 block_id;
 	
 





More information about the Scummvm-git-logs mailing list