[Scummvm-cvs-logs] SF.net SVN: scummvm:[38318] scummvm/trunk/engines/sci/scicore

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Sun Feb 15 23:28:51 CET 2009


Revision: 38318
          http://scummvm.svn.sourceforge.net/scummvm/?rev=38318&view=rev
Author:   fingolfin
Date:     2009-02-15 22:28:50 +0000 (Sun, 15 Feb 2009)

Log Message:
-----------
SCI: Run astyle to make the code be more compliant with our Code Formatting Guidelines: scicore dir

Modified Paths:
--------------
    scummvm/trunk/engines/sci/scicore/aatree.cpp
    scummvm/trunk/engines/sci/scicore/console.cpp
    scummvm/trunk/engines/sci/scicore/decompress0.cpp
    scummvm/trunk/engines/sci/scicore/decompress01.cpp
    scummvm/trunk/engines/sci/scicore/decompress1.cpp
    scummvm/trunk/engines/sci/scicore/decompress11.cpp
    scummvm/trunk/engines/sci/scicore/exe.cpp
    scummvm/trunk/engines/sci/scicore/exe_dec.h
    scummvm/trunk/engines/sci/scicore/exe_lzexe.cpp
    scummvm/trunk/engines/sci/scicore/exe_raw.cpp
    scummvm/trunk/engines/sci/scicore/games.h
    scummvm/trunk/engines/sci/scicore/hashmap.cpp
    scummvm/trunk/engines/sci/scicore/modules.cpp
    scummvm/trunk/engines/sci/scicore/old_objects.cpp
    scummvm/trunk/engines/sci/scicore/reg_t_hashmap.cpp
    scummvm/trunk/engines/sci/scicore/resource.cpp
    scummvm/trunk/engines/sci/scicore/resource_map.cpp
    scummvm/trunk/engines/sci/scicore/resource_patch.cpp
    scummvm/trunk/engines/sci/scicore/resourcecheck.cpp
    scummvm/trunk/engines/sci/scicore/sci_memory.cpp
    scummvm/trunk/engines/sci/scicore/script.cpp
    scummvm/trunk/engines/sci/scicore/tools.cpp
    scummvm/trunk/engines/sci/scicore/versions.cpp
    scummvm/trunk/engines/sci/scicore/vocab.cpp
    scummvm/trunk/engines/sci/scicore/vocab_debug.cpp

Modified: scummvm/trunk/engines/sci/scicore/aatree.cpp
===================================================================
--- scummvm/trunk/engines/sci/scicore/aatree.cpp	2009-02-15 22:28:12 UTC (rev 38317)
+++ scummvm/trunk/engines/sci/scicore/aatree.cpp	2009-02-15 22:28:50 UTC (rev 38318)
@@ -30,8 +30,7 @@
 
 #include "sci/include/sci_memory.h"
 
-struct aatree
-{
+struct aatree {
 	struct aatree *left, *right;
 	int level;
 	void *key;
@@ -41,8 +40,7 @@
 static aatree_t bottom = {&bottom, &bottom, 0, NULL};
 
 static void
-skew(aatree_t **t)
-{
+skew(aatree_t **t) {
 	if ((*t)->left->level == (*t)->level) {
 		/* Rotate right */
 		aatree_t *temp = *t;
@@ -53,8 +51,7 @@
 }
 
 static void
-split(aatree_t **t)
-{
+split(aatree_t **t) {
 	if ((*t)->right->right->level == (*t)->level) {
 		/* Rotate left */
 		aatree_t *temp = *t;
@@ -66,8 +63,7 @@
 }
 
 static int
-delete_node(void *x, aatree_t **t, aatree_t *deleted, int (*compar)(const void *, const void *))
-{
+delete_node(void *x, aatree_t **t, aatree_t *deleted, int (*compar)(const void *, const void *)) {
 	int retval = -1;
 
 	if (*t != &bottom) {
@@ -91,8 +87,7 @@
 			*t = (*t)->right;
 			sci_free(temp);
 			retval = 0;
-		}
-		else if (((*t)->left->level < (*t)->level - 1) || ((*t)->right->level < (*t)->level - 1)) {
+		} else if (((*t)->left->level < (*t)->level - 1) || ((*t)->right->level < (*t)->level - 1)) {
 			(*t)->level--;
 			if ((*t)->right->level > (*t)->level)
 				(*t)->right->level = (*t)->level;
@@ -108,14 +103,12 @@
 }
 
 aatree_t *
-aatree_new()
-{
+aatree_new() {
 	return ⊥
 }
 
 int
-aatree_insert(void *x, aatree_t **t, int (*compar)(const void *, const void *))
-{
+aatree_insert(void *x, aatree_t **t, int (*compar)(const void *, const void *)) {
 	int retval = -1;
 	int c;
 
@@ -145,14 +138,12 @@
 }
 
 int
-aatree_delete(void *x, aatree_t **t, int (*compar)(const void *, const void *))
-{
+aatree_delete(void *x, aatree_t **t, int (*compar)(const void *, const void *)) {
 	return delete_node(x, t, &bottom, compar);
 }
 
 aatree_t *
-aatree_walk(aatree_t *t, int direction)
-{
+aatree_walk(aatree_t *t, int direction) {
 	if ((direction == AATREE_WALK_LEFT) && (t->left != &bottom))
 		return t->left;
 
@@ -163,14 +154,12 @@
 }
 
 void *
-aatree_get_data(aatree_t *t)
-{
+aatree_get_data(aatree_t *t) {
 	return t->key;
 }
 
 void
-aatree_free(aatree_t *t)
-{
+aatree_free(aatree_t *t) {
 	if (t == &bottom)
 		return;
 

Modified: scummvm/trunk/engines/sci/scicore/console.cpp
===================================================================
--- scummvm/trunk/engines/sci/scicore/console.cpp	2009-02-15 22:28:12 UTC (rev 38317)
+++ scummvm/trunk/engines/sci/scicore/console.cpp	2009-02-15 22:28:50 UTC (rev 38318)
@@ -44,12 +44,11 @@
 
 
 int
-sciprintf (const char *fmt, ...)
-{
+sciprintf(const char *fmt, ...) {
 	va_list argp;
 	size_t bufsize = 256;
 	unsigned int i;
-	char *buf 	= (char *) sci_malloc (bufsize);
+	char *buf 	= (char *) sci_malloc(bufsize);
 
 	if (NULL == fmt) {
 		fprintf(stderr, "console.c: sciprintf(): NULL passed for parameter fmt\n");
@@ -61,24 +60,24 @@
 		return -1;
 	}
 
-	va_start (argp, fmt);
-	while ((i = vsnprintf (buf, bufsize - 1, fmt, argp)) == -1
-	       || (i >= bufsize - 2)) {
+	va_start(argp, fmt);
+	while ((i = vsnprintf(buf, bufsize - 1, fmt, argp)) == -1
+	        || (i >= bufsize - 2)) {
 		/* while we're out of space... */
-		va_end (argp);
-		va_start (argp, fmt);	/* reset argp */
+		va_end(argp);
+		va_start(argp, fmt);	/* reset argp */
 
-		free (buf);
-		buf = (char *) sci_malloc (bufsize <<= 1);
+		free(buf);
+		buf = (char *) sci_malloc(bufsize <<= 1);
 	}
-	va_end (argp);
+	va_end(argp);
 
 	if (con_passthrough)
-		printf ("%s", buf);
+		printf("%s", buf);
 	if (con_file)
-		fprintf (con_file, "%s", buf);
+		fprintf(con_file, "%s", buf);
 
-	
+
 	if (_con_string_callback)
 		_con_string_callback(buf);
 	else
@@ -88,26 +87,22 @@
 }
 
 void
-con_set_string_callback(void(*callback)(char *))
-{
+con_set_string_callback(void(*callback)(char *)) {
 	_con_string_callback = callback;
 }
 
 void
-con_set_pixmap_callback(void(*callback)(gfx_pixmap_t *))
-{
+con_set_pixmap_callback(void(*callback)(gfx_pixmap_t *)) {
 	_con_pixmap_callback = callback;
 }
 
 int
-con_can_handle_pixmaps(void)
-{
+con_can_handle_pixmaps(void) {
 	return _con_pixmap_callback != NULL;
 }
 
 int
-con_insert_pixmap(gfx_pixmap_t *pixmap)
-{
+con_insert_pixmap(gfx_pixmap_t *pixmap) {
 	if (_con_pixmap_callback)
 		_con_pixmap_callback(pixmap);
 	else
@@ -117,34 +112,30 @@
 
 
 void
-open_console_file (char *filename)
-{
-  if (con_file != NULL)
-    fclose (con_file);
+open_console_file(char *filename) {
+	if (con_file != NULL)
+		fclose(con_file);
 
-  if (NULL == filename)
-  {
-    fprintf(stderr, "console.c: open_console_file(): NULL passed for parameter filename\r\n");
-  }
+	if (NULL == filename) {
+		fprintf(stderr, "console.c: open_console_file(): NULL passed for parameter filename\r\n");
+	}
 #ifdef WIN32
-  con_file = fopen (filename, "wt");
+	con_file = fopen(filename, "wt");
 #else
-  con_file = fopen (filename, "w");
+	con_file = fopen(filename, "w");
 #endif
 
-  if (NULL == con_file)
-    fprintf(stderr, "console.c: open_console_file(): Could not open output file %s\n", filename);
+	if (NULL == con_file)
+		fprintf(stderr, "console.c: open_console_file(): Could not open output file %s\n", filename);
 
 }
 
 void
-close_console_file (void)
-{
-  if (con_file != NULL)
-  {
-    fclose (con_file);
-    con_file = NULL;
-  }
+close_console_file(void) {
+	if (con_file != NULL) {
+		fclose(con_file);
+		con_file = NULL;
+	}
 }
 
 

Modified: scummvm/trunk/engines/sci/scicore/decompress0.cpp
===================================================================
--- scummvm/trunk/engines/sci/scicore/decompress0.cpp	2009-02-15 22:28:12 UTC (rev 38317)
+++ scummvm/trunk/engines/sci/scicore/decompress0.cpp	2009-02-15 22:28:50 UTC (rev 38318)
@@ -36,7 +36,7 @@
 /* 9-12 bit LZW encoding */
 int
 decrypt1(guint8 *dest, guint8 *src, int length, int complength)
-     /* Doesn't do length checking yet */
+/* Doesn't do length checking yet */
 {
 	/* Theory: Considering the input as a bit stream, we get a series of
 	** 9 bit elements in the beginning. Every one of them is a 'token'
@@ -73,9 +73,9 @@
 
 		guint32 tokenmaker = src[bytectr++] >> bitctr;
 		if (bytectr < complength)
-			tokenmaker |= (src[bytectr] << (8-bitctr));
-		if (bytectr+1 < complength)
-			tokenmaker |= (src[bytectr+1] << (16-bitctr));
+			tokenmaker |= (src[bytectr] << (8 - bitctr));
+		if (bytectr + 1 < complength)
+			tokenmaker |= (src[bytectr+1] << (16 - bitctr));
 
 		token = tokenmaker & bitmask;
 
@@ -98,44 +98,40 @@
 				int i;
 
 				if (token > 0xff) {
-				  if (token >= tokenctr)
-				    {
+					if (token >= tokenctr) {
 #ifdef _SCI_DECOMPRESS_DEBUG
-				      fprintf(stderr, "decrypt1: Bad token %x!\n", token);
+						fprintf(stderr, "decrypt1: Bad token %x!\n", token);
 #endif
-				      /* Well this is really bad  */
-				      /* May be it should throw something like SCI_ERROR_DECOMPRESSION_INSANE */
-				    } else
-				      {
-					tokenlastlength = tokenlengthlist[token]+1;
-					if (destctr+tokenlastlength>length)
-					  {
+						/* Well this is really bad  */
+						/* May be it should throw something like SCI_ERROR_DECOMPRESSION_INSANE */
+					} else {
+						tokenlastlength = tokenlengthlist[token] + 1;
+						if (destctr + tokenlastlength > length) {
 #ifdef _SCI_DECOMPRESS_DEBUG
 
-					    /* For me this seems a normal situation, It's necessary to handle it*/
-					    printf ("decrypt1: Trying to write beyond the end of array(len=%d, destctr=%d, tok_len=%d)!\n",
-						    length, destctr, tokenlastlength);
+							/* For me this seems a normal situation, It's necessary to handle it*/
+							printf("decrypt1: Trying to write beyond the end of array(len=%d, destctr=%d, tok_len=%d)!\n",
+							       length, destctr, tokenlastlength);
 #endif
 
-					    i = 0;
-					    for (; destctr<length; destctr++) {
-					      dest[destctr++] = dest [tokenlist[token]+i];
-					      i++;
-					    }
-					  } else
-					for (i=0; i< tokenlastlength; i++) {
-						dest[destctr++] = dest[tokenlist[token]+i];
+							i = 0;
+							for (; destctr < length; destctr++) {
+								dest[destctr++] = dest [tokenlist[token] + i];
+								i++;
+							}
+						} else
+							for (i = 0; i < tokenlastlength; i++) {
+								dest[destctr++] = dest[tokenlist[token] + i];
+							}
 					}
-				      }
 				} else {
 					tokenlastlength = 1;
-				  if (destctr >= length)
-				    {
+					if (destctr >= length) {
 #ifdef _SCI_DECOMPRESS_DEBUG
-				      printf ("decrypt1: Try to write single byte beyond end of array!\n");
+						printf("decrypt1: Try to write single byte beyond end of array!\n");
 #endif
-				    } else
-					dest[destctr++] = (byte)token;
+					} else
+						dest[destctr++] = (byte)token;
 				}
 
 			}
@@ -149,7 +145,7 @@
 				} else continue; /* no further tokens allowed */
 			}
 
-			tokenlist[tokenctr] = destctr-tokenlastlength;
+			tokenlist[tokenctr] = destctr - tokenlastlength;
 			tokenlengthlist[tokenctr++] = tokenlastlength;
 
 		}
@@ -169,8 +165,7 @@
 
 /* decrypt2 helper function */
 gint16 getc2(guint8 *node, guint8 *src,
-	     guint16 *bytectr, guint16 *bitctr, int complength)
-{
+             guint16 *bytectr, guint16 *bitctr, int complength) {
 	guint16 next;
 
 	while (node[1] != 0) {
@@ -189,23 +184,22 @@
 				if (++(*bytectr) > complength)
 					return -1;
 				else if (*bytectr < complength)
-					result |= src[*bytectr] >> (8-(*bitctr));
+					result |= src[*bytectr] >> (8 - (*bitctr));
 
 				result &= 0x0ff;
 				return (result | 0x100);
 			}
-		}
-		else {
+		} else {
 			next = node[1] >> 4;  /* high 4 bits */
 		}
-		node += next<<1;
+		node += next << 1;
 	}
 	return getInt16(node);
 }
 
 /* Huffman token decryptor */
 int decrypt2(guint8* dest, guint8* src, int length, int complength)
-     /* no complength checking atm */
+/* no complength checking atm */
 {
 	guint8 numnodes, terminator;
 	guint8 *nodes;
@@ -214,11 +208,11 @@
 
 	numnodes = src[0];
 	terminator = src[1];
-	bytectr = 2+ (numnodes << 1);
-	nodes = src+2;
+	bytectr = 2 + (numnodes << 1);
+	nodes = src + 2;
 
 	while (((c = getc2(nodes, src, &bytectr, &bitctr, complength))
-		!= (0x0100 | terminator)) && (c >= 0)) {
+	        != (0x0100 | terminator)) && (c >= 0)) {
 		if (length-- == 0) return SCI_ERROR_DECOMPRESSION_OVERFLOW;
 
 		*dest = (guint8)c;
@@ -232,8 +226,7 @@
 /* Carl Muckenhoupt's decompression code ends here                         */
 /***************************************************************************/
 
-int sci0_get_compression_method(int resh)
-{
+int sci0_get_compression_method(int resh) {
 	guint16 compressedLength;
 	guint16 compressionMethod;
 	guint16 result_size;
@@ -243,8 +236,8 @@
 		return SCI_ERROR_IO_ERROR;
 
 	if ((read(resh, &compressedLength, 2) != 2) ||
-	    (read(resh, &result_size, 2) != 2) ||
-	    (read(resh, &compressionMethod, 2) != 2))
+	        (read(resh, &result_size, 2) != 2) ||
+	        (read(resh, &compressionMethod, 2) != 2))
 		return SCI_ERROR_IO_ERROR;
 
 #ifdef WORDS_BIGENDIAN
@@ -255,14 +248,13 @@
 }
 
 
-int decompress0(resource_t *result, int resh, int sci_version)
-{
+int decompress0(resource_t *result, int resh, int sci_version) {
 	guint16 compressedLength;
 	guint16 compressionMethod;
 	guint16 result_size;
 	guint8 *buffer;
 
-	if (read(resh, &(result->id),2) != 2)
+	if (read(resh, &(result->id), 2) != 2)
 		return SCI_ERROR_IO_ERROR;
 
 #ifdef WORDS_BIGENDIAN
@@ -275,8 +267,8 @@
 		return SCI_ERROR_DECOMPRESSION_INSANE;
 
 	if ((read(resh, &compressedLength, 2) != 2) ||
-	    (read(resh, &result_size, 2) != 2) ||
-	    (read(resh, &compressionMethod, 2) != 2))
+	        (read(resh, &result_size, 2) != 2) ||
+	        (read(resh, &compressionMethod, 2) != 2))
 		return SCI_ERROR_IO_ERROR;
 
 #ifdef WORDS_BIGENDIAN
@@ -287,7 +279,7 @@
 	result->size = result_size;
 
 	if ((result->size > SCI_MAX_RESOURCE_SIZE) ||
-	    (compressedLength > SCI_MAX_RESOURCE_SIZE))
+	        (compressedLength > SCI_MAX_RESOURCE_SIZE))
 		return SCI_ERROR_RESOURCE_TOO_BIG;
 	/* With SCI0, this simply cannot happen. */
 
@@ -311,15 +303,15 @@
 
 #ifdef _SCI_DECOMPRESS_DEBUG
 	fprintf(stderr, "Resource %s.%03hi encrypted with method %hi at %.2f%%"
-		" ratio\n",
-		sci_resource_types[result->type], result->number, compressionMethod,
-		(result->size == 0)? -1.0 :
-		(100.0 * compressedLength / result->size));
+	        " ratio\n",
+	        sci_resource_types[result->type], result->number, compressionMethod,
+	        (result->size == 0) ? -1.0 :
+	        (100.0 * compressedLength / result->size));
 	fprintf(stderr, "  compressedLength = 0x%hx, actualLength=0x%hx\n",
-		compressedLength, result->size);
+	        compressedLength, result->size);
 #endif
 
-	switch(compressionMethod) {
+	switch (compressionMethod) {
 
 	case 0: /* no compression */
 		if (result->size != compressedLength) {
@@ -356,9 +348,9 @@
 		break;
 
 	default:
-		fprintf(stderr,"Resource %s.%03hi: Compression method %hi not "
-			"supported!\n", sci_resource_types[result->type], result->number,
-			compressionMethod);
+		fprintf(stderr, "Resource %s.%03hi: Compression method %hi not "
+		        "supported!\n", sci_resource_types[result->type], result->number,
+		        compressionMethod);
 		free(result->data);
 		result->data = 0; /* So that we know that it didn't work */
 		result->status = SCI_STATUS_NOMALLOC;

Modified: scummvm/trunk/engines/sci/scicore/decompress01.cpp
===================================================================
--- scummvm/trunk/engines/sci/scicore/decompress01.cpp	2009-02-15 22:28:12 UTC (rev 38317)
+++ scummvm/trunk/engines/sci/scicore/decompress01.cpp	2009-02-15 22:28:50 UTC (rev 38318)
@@ -50,25 +50,23 @@
 
 guint32 gbits(int numbits,  guint8 * data, int dlen);
 
-void decryptinit3(void)
-{
+void decryptinit3(void) {
 	int i;
 	lastchar = lastbits = s_bitstring = stakptr = 0;
 	numbits = 9;
 	curtoken = 0x102;
 	endtoken = 0x1ff;
 	decryptstart = 0;
-	gbits(0,0,0);
-	for(i=0;i<0x1004;i++) {
-		tokens[i].next=0;
-		tokens[i].data=0;
+	gbits(0, 0, 0);
+	for (i = 0;i < 0x1004;i++) {
+		tokens[i].next = 0;
+		tokens[i].data = 0;
 	}
 }
 
-int decrypt3(guint8 *dest, guint8 *src, int length, int complength)
-{
+int decrypt3(guint8 *dest, guint8 *src, int length, int complength) {
 	static gint16 token;
-	while(length != 0) {
+	while (length != 0) {
 
 		switch (decryptstart) {
 		case 0:
@@ -97,7 +95,7 @@
 				token = lastbits;
 				stak[stakptr++] = lastchar;
 			}
-			while ((token > 0xff)&&(token < 0x1004)) { /* follow links back in data */
+			while ((token > 0xff) && (token < 0x1004)) { /* follow links back in data */
 				stak[stakptr++] = tokens[token].data;
 				token = tokens[token].next;
 			}
@@ -131,26 +129,24 @@
 	return 0;     /* [DJ] shut up compiler warning */
 }
 
-guint32 gbits(int numbits,  guint8 * data, int dlen)
-{
+guint32 gbits(int numbits,  guint8 * data, int dlen) {
 	int place; /* indicates location within byte */
 	guint32 bitstring;
-	static guint32 whichbit=0;
+	static guint32 whichbit = 0;
 	int i;
 
-	if(numbits==0) {whichbit=0; return 0;}
+	if (numbits == 0) {whichbit = 0; return 0;}
 
 	place = whichbit >> 3;
-	bitstring=0;
-	for(i=(numbits>>3)+1;i>=0;i--)
-		{
-			if (i+place < dlen)
-				bitstring |=data[place+i] << (8*(2-i));
-		}
+	bitstring = 0;
+	for (i = (numbits >> 3) + 1;i >= 0;i--) {
+		if (i + place < dlen)
+			bitstring |= data[place+i] << (8 * (2 - i));
+	}
 	/*  bitstring = data[place+2] | (long)(data[place+1])<<8
 	    | (long)(data[place])<<16;*/
-	bitstring >>= 24-(whichbit & 7)-numbits;
-	bitstring &= (0xffffffff >> (32-numbits));
+	bitstring >>= 24 - (whichbit & 7) - numbits;
+	bitstring &= (0xffffffff >> (32 - numbits));
 	/* Okay, so this could be made faster with a table lookup.
 	   It doesn't matter. It's fast enough as it is. */
 	whichbit += numbits;
@@ -193,25 +189,22 @@
 #define EXTRA_MAGIC_SIZE 15
 
 static
-void decode_rle(byte **rledata, byte **pixeldata, byte *outbuffer, int size)
-{
+void decode_rle(byte **rledata, byte **pixeldata, byte *outbuffer, int size) {
 	int pos = 0;
 	char nextbyte;
 	byte *rd = *rledata;
 	byte *ob = outbuffer;
 	byte *pd = *pixeldata;
 
-	while (pos < size)
-	{
+	while (pos < size) {
 		nextbyte = *(rd++);
 		*(ob++) = nextbyte;
 		pos ++;
-		switch (nextbyte&0xC0)
-		{
+		switch (nextbyte&0xC0) {
 		case 0x40 :
 		case 0x00 :
 			memcpy(ob, pd, nextbyte);
-			pd +=nextbyte;
+			pd += nextbyte;
 			ob += nextbyte;
 			pos += nextbyte;
 			break;
@@ -236,20 +229,17 @@
  * Yes, this is inefficient.
  */
 static
-int rle_size(byte *rledata, int dsize)
-{
+int rle_size(byte *rledata, int dsize) {
 	int pos = 0;
 	char nextbyte;
 	int size = 0;
-	
-	while (pos < dsize)
-	{
+
+	while (pos < dsize) {
 		nextbyte = *(rledata++);
 		pos ++;
 		size ++;
-		
-		switch (nextbyte&0xC0)
-		{
+
+		switch (nextbyte&0xC0) {
 		case 0x40 :
 		case 0x00 :
 			pos += nextbyte;
@@ -265,8 +255,7 @@
 	return size;
 }
 
-byte *pic_reorder(byte *inbuffer, int dsize)
-{
+byte *pic_reorder(byte *inbuffer, int dsize) {
 	byte *reorderBuffer;
 	int view_size;
 	int view_start;
@@ -276,13 +265,13 @@
 	byte *writer;
 	char viewdata[CEL_HEADER_SIZE];
 	byte *cdata, *cdata_start;
-	
-	writer = reorderBuffer=(byte *) malloc(dsize);
 
+	writer = reorderBuffer = (byte *) malloc(dsize);
+
 	*(writer++) = PIC_OP_OPX;
 	*(writer++) = PIC_OPX_SET_PALETTE;
 
-	for (i=0;i<256;i++) /* Palette translation map */
+	for (i = 0;i < 256;i++) /* Palette translation map */
 		*(writer++) = i;
 
 	putInt16(writer, 0); /* Palette stamp */
@@ -299,29 +288,27 @@
 
 	memcpy(viewdata, seeker, sizeof(viewdata));
 	seeker += sizeof(viewdata);
-	
+
 	memcpy(writer, seeker, 4*256); /* Palette */
-	seeker += 4*256;
-	writer += 4*256;
+	seeker += 4 * 256;
+	writer += 4 * 256;
 
-	if (view_start != PAL_SIZE + 2) /* +2 for the opcode */
-	{
-		memcpy(writer, seeker, view_start-PAL_SIZE-2);
+	if (view_start != PAL_SIZE + 2) { /* +2 for the opcode */
+		memcpy(writer, seeker, view_start - PAL_SIZE - 2);
 		seeker += view_start - PAL_SIZE - 2;
 		writer += view_start - PAL_SIZE - 2;
 	}
 
-	if (dsize != view_start+EXTRA_MAGIC_SIZE+view_size)
-	{
-		memcpy(reorderBuffer+view_size+view_start+EXTRA_MAGIC_SIZE, seeker, 
-		       dsize-view_size-view_start-EXTRA_MAGIC_SIZE);
-		seeker += dsize-view_size-view_start-EXTRA_MAGIC_SIZE;
+	if (dsize != view_start + EXTRA_MAGIC_SIZE + view_size) {
+		memcpy(reorderBuffer + view_size + view_start + EXTRA_MAGIC_SIZE, seeker,
+		       dsize - view_size - view_start - EXTRA_MAGIC_SIZE);
+		seeker += dsize - view_size - view_start - EXTRA_MAGIC_SIZE;
 	}
 
-	cdata_start=cdata=(byte *) malloc(cdata_size);
+	cdata_start = cdata = (byte *) malloc(cdata_size);
 	memcpy(cdata, seeker, cdata_size);
 	seeker += cdata_size;
-	
+
 	writer = reorderBuffer + view_start;
 	*(writer++) = PIC_OP_OPX;
 	*(writer++) = PIC_OPX_EMBEDDED_VIEW;
@@ -335,9 +322,9 @@
 	writer += sizeof(viewdata);
 
 	*(writer++) = 0;
-	
+
 	decode_rle(&seeker, &cdata, writer, view_size);
-	
+
 	free(cdata_start);
 	free(inbuffer);
 	return reorderBuffer;
@@ -346,22 +333,23 @@
 #define VIEW_HEADER_COLORS_8BIT 0x80
 
 static
-void build_cel_headers(byte **seeker, byte **writer, int celindex, int *cc_lengths, int max)
-{
+void build_cel_headers(byte **seeker, byte **writer, int celindex, int *cc_lengths, int max) {
 	int c, w;
-	
-	for (c=0;c<max;c++)
-	{
-		w=getUInt16(*seeker);
-		putInt16(*writer, w); 
-		*seeker += 2; *writer += 2;
-		w=getUInt16(*seeker);
-		putInt16(*writer, w); 
-		*seeker += 2; *writer += 2;
-		w=getUInt16(*seeker);
-		putInt16(*writer, w); 
-		*seeker += 2; *writer += 2;
-		w=*((*seeker)++);
+
+	for (c = 0;c < max;c++) {
+		w = getUInt16(*seeker);
+		putInt16(*writer, w);
+		*seeker += 2;
+		*writer += 2;
+		w = getUInt16(*seeker);
+		putInt16(*writer, w);
+		*seeker += 2;
+		*writer += 2;
+		w = getUInt16(*seeker);
+		putInt16(*writer, w);
+		*seeker += 2;
+		*writer += 2;
+		w = *((*seeker)++);
 		putInt16(*writer, w); /* Zero extension */
 		*writer += 2;
 
@@ -372,8 +360,7 @@
 
 
 
-byte *view_reorder(byte *inbuffer, int dsize)
-{
+byte *view_reorder(byte *inbuffer, int dsize) {
 	byte *cellengths;
 	int loopheaders;
 	int lh_present;
@@ -386,15 +373,15 @@
 	byte *outbuffer = (byte *) malloc(dsize);
 	byte *writer = outbuffer;
 	byte *lh_ptr;
-	byte *rle_ptr,*pix_ptr;
+	byte *rle_ptr, *pix_ptr;
 	int l, lb, c, celindex, lh_last = -1;
 	int chptr;
 	int w;
 	int *cc_lengths;
 	byte **cc_pos;
-	
+
 	/* Parse the main header */
-	cellengths = inbuffer+getUInt16(seeker)+2;
+	cellengths = inbuffer + getUInt16(seeker) + 2;
 	seeker += 2;
 	loopheaders = *(seeker++);
 	lh_present = *(seeker++);
@@ -407,12 +394,12 @@
 	cel_total = getUInt16(seeker);
 	seeker += 2;
 
-	cc_pos = (byte **) malloc(sizeof(byte *)*cel_total);
-	cc_lengths = (int *) malloc(sizeof(int)*cel_total);
-	
-	for (c=0;c<cel_total;c++)
-		cc_lengths[c] = getUInt16(cellengths+2*c);
-	
+	cc_pos = (byte **) malloc(sizeof(byte *) * cel_total);
+	cc_lengths = (int *) malloc(sizeof(int) * cel_total);
+
+	for (c = 0;c < cel_total;c++)
+		cc_lengths[c] = getUInt16(cellengths + 2 * c);
+
 	*(writer++) = loopheaders;
 	*(writer++) = VIEW_HEADER_COLORS_8BIT;
 	putInt16(writer, lh_mask);
@@ -423,32 +410,29 @@
 	writer += 2;
 
 	lh_ptr = writer;
-	writer += 2*loopheaders; /* Make room for the loop offset table */
+	writer += 2 * loopheaders; /* Make room for the loop offset table */
 
 	pix_ptr = writer;
-	
+
 	memcpy(celcounts, seeker, lh_present);
 	seeker += lh_present;
 
 	lb = 1;
 	celindex = 0;
 
-	rle_ptr = pix_ptr = cellengths + (2*cel_total);
+	rle_ptr = pix_ptr = cellengths + (2 * cel_total);
 	w = 0;
-	
-	for (l=0;l<loopheaders;l++)
-	{
-		if (lh_mask & lb) /* The loop is _not_ present */
-		{
+
+	for (l = 0;l < loopheaders;l++) {
+		if (lh_mask & lb) { /* The loop is _not_ present */
 			if (lh_last == -1) {
 				fprintf(stderr, "Error: While reordering view: Loop not present, but can't re-use last loop!\n");
 				lh_last = 0;
 			}
 			putInt16(lh_ptr, lh_last);
 			lh_ptr += 2;
-		} else
-		{
-			lh_last = writer-outbuffer;
+		} else {
+			lh_last = writer - outbuffer;
 			putInt16(lh_ptr, lh_last);
 			lh_ptr += 2;
 			putInt16(writer, celcounts[w]);
@@ -457,64 +441,61 @@
 			writer += 2;
 
 			/* Now, build the cel offset table */
-			chptr = (writer - outbuffer)+(2*celcounts[w]);
+			chptr = (writer - outbuffer) + (2 * celcounts[w]);
 
-			for (c=0;c<celcounts[w];c++)
-			{
+			for (c = 0;c < celcounts[w];c++) {
 				putInt16(writer, chptr);
 				writer += 2;
 				cc_pos[celindex+c] = outbuffer + chptr;
-				chptr += 8 + getUInt16(cellengths+2*(celindex+c));
+				chptr += 8 + getUInt16(cellengths + 2 * (celindex + c));
 			}
 
 			build_cel_headers(&seeker, &writer, celindex, cc_lengths, celcounts[w]);
-			
+
 			celindex += celcounts[w];
 			w++;
 		}
 
-		lb = lb << 1;	
-	}	
+		lb = lb << 1;
+	}
 
-	if (celindex < cel_total)
-	{
+	if (celindex < cel_total) {
 		fprintf(stderr, "View decompression generated too few (%d / %d) headers!\n", celindex, cel_total);
 		return NULL;
 	}
-	
+
 	/* Figure out where the pixel data begins. */
-	for (c=0;c<cel_total;c++)
+	for (c = 0;c < cel_total;c++)
 		pix_ptr += rle_size(pix_ptr, cc_lengths[c]);
 
-	rle_ptr = cellengths + (2*cel_total);
-	for (c=0;c<cel_total;c++)
-		decode_rle(&rle_ptr, &pix_ptr, cc_pos[c]+8, cc_lengths[c]);
+	rle_ptr = cellengths + (2 * cel_total);
+	for (c = 0;c < cel_total;c++)
+		decode_rle(&rle_ptr, &pix_ptr, cc_pos[c] + 8, cc_lengths[c]);
 
 	*(writer++) = 'P';
 	*(writer++) = 'A';
 	*(writer++) = 'L';
-	
-	for (c=0;c<256;c++)
+
+	for (c = 0;c < 256;c++)
 		*(writer++) = c;
 
 	seeker -= 4; /* The missing four. Don't ask why. */
-	memcpy(writer, seeker, 4*256+4);
-	
+	memcpy(writer, seeker, 4*256 + 4);
+
 	free(cc_pos);
 	free(cc_lengths);
 	free(inbuffer);
-	return outbuffer;	
+	return outbuffer;
 }
 
 
 
-int decompress01(resource_t *result, int resh, int sci_version)
-{
+int decompress01(resource_t *result, int resh, int sci_version) {
 	guint16 compressedLength, result_size;
 	guint16 compressionMethod;
 	guint8 *buffer;
 
-	if (read(resh, &(result->id),2) != 2)
+	if (read(resh, &(result->id), 2) != 2)
 		return SCI_ERROR_IO_ERROR;
 
 #ifdef WORDS_BIGENDIAN
@@ -528,8 +509,8 @@
 		return SCI_ERROR_DECOMPRESSION_INSANE;
 
 	if ((read(resh, &compressedLength, 2) != 2) ||
-	    (read(resh, &result_size, 2) != 2) ||
-	    (read(resh, &compressionMethod, 2) != 2))
+	        (read(resh, &result_size, 2) != 2) ||
+	        (read(resh, &compressionMethod, 2) != 2))
 		return SCI_ERROR_IO_ERROR;
 
 #ifdef WORDS_BIGENDIAN
@@ -544,7 +525,7 @@
 	/* This return will never happen in SCI0 or SCI1 (does it have any use?) */
 
 	if ((result->size > SCI_MAX_RESOURCE_SIZE) ||
-	    (compressedLength > SCI_MAX_RESOURCE_SIZE))
+	        (compressedLength > SCI_MAX_RESOURCE_SIZE))
 		return SCI_ERROR_RESOURCE_TOO_BIG;
 
 	if (compressedLength > 4)
@@ -567,15 +548,15 @@
 
 #ifdef _SCI_DECOMPRESS_DEBUG
 	fprintf(stderr, "Resource %s.%03hi encrypted with method SCI01/%hi at %.2f%%"
-		" ratio\n",
-		sci_resource_types[result->type], result->number, compressionMethod,
-		(result->size == 0)? -1.0 :
-		(100.0 * compressedLength / result->size));
+	        " ratio\n",
+	        sci_resource_types[result->type], result->number, compressionMethod,
+	        (result->size == 0) ? -1.0 :
+	        (100.0 * compressedLength / result->size));
 	fprintf(stderr, "  compressedLength = 0x%hx, actualLength=0x%hx\n",
-		compressedLength, result->size);
+	        compressedLength, result->size);
 #endif
 
-	switch(compressionMethod) {
+	switch (compressionMethod) {
 
 	case 0: /* no compression */
 		if (result->size != compressedLength) {
@@ -612,7 +593,7 @@
 		result->status = SCI_STATUS_ALLOCATED;
 		break;
 
-	case 3: 
+	case 3:
 		decryptinit3();
 		if (decrypt3(result->data, buffer, result->size, compressedLength)) {
 			free(result->data);
@@ -637,11 +618,11 @@
 		result->data = pic_reorder(result->data, result->size);
 		result->status = SCI_STATUS_ALLOCATED;
 		break;
-		
+
 	default:
-		fprintf(stderr,"Resource %s.%03hi: Compression method SCI1/%hi not "
-			"supported!\n", sci_resource_types[result->type], result->number,
-			compressionMethod);
+		fprintf(stderr, "Resource %s.%03hi: Compression method SCI1/%hi not "
+		        "supported!\n", sci_resource_types[result->type], result->number,
+		        compressionMethod);
 		free(result->data);
 		result->data = 0; /* So that we know that it didn't work */
 		result->status = SCI_STATUS_NOMALLOC;

Modified: scummvm/trunk/engines/sci/scicore/decompress1.cpp
===================================================================
--- scummvm/trunk/engines/sci/scicore/decompress1.cpp	2009-02-15 22:28:12 UTC (rev 38317)
+++ scummvm/trunk/engines/sci/scicore/decompress1.cpp	2009-02-15 22:28:50 UTC (rev 38318)
@@ -67,15 +67,14 @@
 #define CALLC(x) { if ((x) == -SCI_ERROR_DECOMPRESSION_OVERFLOW) return -SCI_ERROR_DECOMPRESSION_OVERFLOW; }
 
 static inline int
-getbits_msb_first(struct bit_read_struct *inp, int bits)
-{
+getbits_msb_first(struct bit_read_struct *inp, int bits) {
 	int morebytes = (bits + inp->bitpos - 1) >> 3;
 	int result = 0;
 	int i;
 
 	if (inp->bytepos + morebytes >= inp->length) {
-		fprintf(stderr,"read out-of-bounds with bytepos %d + morebytes %d >= length %d\n",
-			inp->bytepos, morebytes, inp->length);
+		fprintf(stderr, "read out-of-bounds with bytepos %d + morebytes %d >= length %d\n",
+		        inp->bytepos, morebytes, inp->length);
 		return -SCI_ERROR_DECOMPRESSION_OVERFLOW;
 	}
 
@@ -94,15 +93,14 @@
 static int DEBUG_DCL_INFLATE = 0; /* FIXME: Make this a define eventually */
 
 static inline int
-getbits(struct bit_read_struct *inp, int bits)
-{
+getbits(struct bit_read_struct *inp, int bits) {
 	int morebytes = (bits + inp->bitpos - 1) >> 3;
 	int result = 0;
 	int i;
 
 	if (inp->bytepos + morebytes >= inp->length) {
-		fprintf(stderr,"read out-of-bounds with bytepos %d + morebytes %d >= length %d\n",
-			inp->bytepos, morebytes, inp->length);
+		fprintf(stderr, "read out-of-bounds with bytepos %d + morebytes %d >= length %d\n",
+		        inp->bytepos, morebytes, inp->length);
 		return -SCI_ERROR_DECOMPRESSION_OVERFLOW;
 	}
 
@@ -116,28 +114,27 @@
 	inp->bytepos += morebytes;
 
 	if (DEBUG_DCL_INFLATE)
-		fprintf(stderr,"(%d:%04x)", bits, result);
+		fprintf(stderr, "(%d:%04x)", bits, result);
 
 	return result;
 }
 
 static int
-huffman_lookup(struct bit_read_struct *inp, int *tree)
-{
+huffman_lookup(struct bit_read_struct *inp, int *tree) {
 	int pos = 0;
 	int bit;
 
 	while (!(tree[pos] & HUFFMAN_LEAF)) {
 		CALLC(bit = getbits(inp, 1));
 		if (DEBUG_DCL_INFLATE)
-			fprintf(stderr,"[%d]:%d->", pos, bit);
+			fprintf(stderr, "[%d]:%d->", pos, bit);
 		if (bit)
 			pos = tree[pos] & ~(~0 << BRANCH_SHIFT);
 		else
 			pos = tree[pos] >> BRANCH_SHIFT;
 	}
 	if (DEBUG_DCL_INFLATE)
-		fprintf(stderr,"=%02x\n", tree[pos] & 0xffff);
+		fprintf(stderr, "=%02x\n", tree[pos] & 0xffff);
 	return tree[pos] & 0xffff;
 }
 
@@ -146,8 +143,7 @@
 #define DCL_ASCII_MODE 1
 
 static int
-decrypt4_hdyn(byte *dest, int length, struct bit_read_struct *reader)
-{
+decrypt4_hdyn(byte *dest, int length, struct bit_read_struct *reader) {
 	int mode, length_param, value, val_length, val_distance;
 	int write_pos = 0;
 	int M[] = {0x07, 0x08, 0x0A, 0x0E, 0x16, 0x26, 0x46, 0x86, 0x106};
@@ -156,28 +152,28 @@
 	CALLC(length_param = getbits(reader, 8));
 
 	if (mode == DCL_ASCII_MODE) {
-		fprintf(stderr,"DCL-INFLATE: Warning: Decompressing ASCII mode (untested)\n");
+		fprintf(stderr, "DCL-INFLATE: Warning: Decompressing ASCII mode (untested)\n");
 		/*		DEBUG_DCL_INFLATE = 1; */
 	} else if (mode) {
-		fprintf(stderr,"DCL-INFLATE: Error: Encountered mode %02x, expected 00 or 01\n", mode);
+		fprintf(stderr, "DCL-INFLATE: Error: Encountered mode %02x, expected 00 or 01\n", mode);
 		return 1;
 	}
 
 	if (DEBUG_DCL_INFLATE) {
 		int i;
 		for (i = 0; i < reader->length; i++) {
-			fprintf(stderr,"%02x ", reader->data[i]);
-			if (!((i+1) & 0x1f))
-				fprintf(stderr,"\n");
+			fprintf(stderr, "%02x ", reader->data[i]);
+			if (!((i + 1) & 0x1f))
+				fprintf(stderr, "\n");
 		}
 
 
-		fprintf(stderr,"\n---\n");
+		fprintf(stderr, "\n---\n");
 	}
 
 
 	if (length_param < 3 || length_param > 6)
-		fprintf(stderr,"Warning: Unexpected length_param value %d (expected in [3,6])\n", length_param);
+		fprintf(stderr, "Warning: Unexpected length_param value %d (expected in [3,6])\n", length_param);
 
 	while (write_pos < length) {
 		CALLC(value = getbits(reader, 1));
@@ -196,7 +192,7 @@
 			}
 
 			if (DEBUG_DCL_INFLATE)
-				fprintf(stderr," | ");
+				fprintf(stderr, " | ");
 
 			CALLC(value = huffman_lookup(reader, distance_tree));
 
@@ -214,7 +210,7 @@
 			++val_distance;
 
 			if (DEBUG_DCL_INFLATE)
-				fprintf(stderr,"\nCOPY(%d from %d)\n", val_length, val_distance);
+				fprintf(stderr, "\nCOPY(%d from %d)\n", val_length, val_distance);
 
 			if (val_length + write_pos > length) {
 				fprintf(stderr, "DCL-INFLATE Error: Write out of bounds while copying %d bytes\n", val_length);
@@ -227,14 +223,14 @@
 			}
 
 			while (val_length) {
-				int copy_length = (val_length > val_distance)? val_distance : val_length;
+				int copy_length = (val_length > val_distance) ? val_distance : val_length;
 
 				memcpy(dest + write_pos, dest + write_pos - val_distance, copy_length);
 
 				if (DEBUG_DCL_INFLATE) {
 					int i;
 					for (i = 0; i < copy_length; i++)
-						fprintf(stderr,"\33[32;31m%02x\33[37;37m ", dest[write_pos + i]);
+						fprintf(stderr, "\33[32;31m%02x\33[37;37m ", dest[write_pos + i]);
 					fprintf(stderr, "\n");
 				}
 
@@ -261,8 +257,7 @@
 }
 
 int
-decrypt4(guint8* dest, guint8* src, int length, int complength)
-{
+decrypt4(guint8* dest, guint8* src, int length, int complength) {
 	struct bit_read_struct reader;
 
 	reader.length = complength;
@@ -280,15 +275,14 @@
 int decrypt3(guint8* dest, guint8* src, int length, int complength);
 int decompress1(resource_t *result, int resh, int early);
 
-int decompress1(resource_t *result, int resh, int sci_version)
-{
+int decompress1(resource_t *result, int resh, int sci_version) {
 	guint16 compressedLength;
 	guint16 compressionMethod, result_size;
 	guint8 *buffer;
 	guint8 tempid;
 
 	if (sci_version == SCI_VERSION_1_EARLY) {
-		if (read(resh, &(result->id),2) != 2)
+		if (read(resh, &(result->id), 2) != 2)
 			return SCI_ERROR_IO_ERROR;
 
 #ifdef WORDS_BIGENDIAN
@@ -306,7 +300,7 @@
 
 		result->id = tempid;
 
-		result->type = result->id &0x7f;
+		result->type = result->id & 0x7f;
 		if (read(resh, &(result->number), 2) != 2)
 			return SCI_ERROR_IO_ERROR;
 
@@ -318,8 +312,8 @@
 	}
 
 	if ((read(resh, &compressedLength, 2) != 2) ||
-	    (read(resh, &result_size, 2) != 2) ||
-	    (read(resh, &compressionMethod, 2) != 2))
+	        (read(resh, &result_size, 2) != 2) ||
+	        (read(resh, &compressionMethod, 2) != 2))
 		return SCI_ERROR_IO_ERROR;
 
 #ifdef WORDS_BIGENDIAN
@@ -330,7 +324,7 @@
 	result->size = result_size;
 
 	if ((result->size > SCI_MAX_RESOURCE_SIZE) ||
-	    (compressedLength > SCI_MAX_RESOURCE_SIZE))
+	        (compressedLength > SCI_MAX_RESOURCE_SIZE))
 		return SCI_ERROR_RESOURCE_TOO_BIG;
 
 	if (compressedLength > 4)
@@ -353,17 +347,17 @@
 
 #ifdef _SCI_DECOMPRESS_DEBUG
 	fprintf(stderr, "Resource %i.%s encrypted with method SCI1%c/%hi at %.2f%%"
-		" ratio\n",
-		result->number, sci_resource_type_suffixes[result->type],
-		early? 'e' : 'l',
-		compressionMethod,
-		(result->size == 0)? -1.0 :
-		(100.0 * compressedLength / result->size));
+	        " ratio\n",
+	        result->number, sci_resource_type_suffixes[result->type],
+	        early ? 'e' : 'l',
+	        compressionMethod,
+	        (result->size == 0) ? -1.0 :
+	        (100.0 * compressedLength / result->size));
 	fprintf(stderr, "  compressedLength = 0x%hx, actualLength=0x%hx\n",
-		compressedLength, result->size);
+	        compressedLength, result->size);
 #endif
 
-	switch(compressionMethod) {
+	switch (compressionMethod) {
 
 	case 0: /* no compression */
 		if (result->size != compressedLength) {
@@ -400,7 +394,7 @@
 		result->status = SCI_STATUS_ALLOCATED;
 		break;
 
-	case 3: 
+	case 3:
 		decryptinit3();
 		if (decrypt3(result->data, buffer, result->size, compressedLength)) {
 			free(result->data);
@@ -425,11 +419,11 @@
 		result->data = pic_reorder(result->data, result->size);
 		result->status = SCI_STATUS_ALLOCATED;
 		break;
-		
+
 	default:
-		fprintf(stderr,"Resource %s.%03hi: Compression method SCI1/%hi not "
-			"supported!\n", sci_resource_types[result->type], result->number,
-			compressionMethod);
+		fprintf(stderr, "Resource %s.%03hi: Compression method SCI1/%hi not "
+		        "supported!\n", sci_resource_types[result->type], result->number,
+		        compressionMethod);
 		free(result->data);
 		result->data = 0; /* So that we know that it didn't work */
 		result->status = SCI_STATUS_NOMALLOC;

Modified: scummvm/trunk/engines/sci/scicore/decompress11.cpp
===================================================================
--- scummvm/trunk/engines/sci/scicore/decompress11.cpp	2009-02-15 22:28:12 UTC (rev 38317)
+++ scummvm/trunk/engines/sci/scicore/decompress11.cpp	2009-02-15 22:28:50 UTC (rev 38318)
@@ -35,8 +35,7 @@
 int decrypt3(guint8* dest, guint8* src, int length, int complength);
 int decrypt4(guint8* dest, guint8* src, int length, int complength);
 
-int decompress11(resource_t *result, int resh, int sci_version)
-{
+int decompress11(resource_t *result, int resh, int sci_version) {
 	guint16 compressedLength;
 	guint16 compressionMethod, result_size;
 	guint8 *buffer;
@@ -49,7 +48,7 @@
 
 	result->id = tempid;
 
-	result->type = result->id &0x7f;
+	result->type = result->id & 0x7f;
 	if (read(resh, &(result->number), 2) != 2)
 		return SCI_ERROR_IO_ERROR;
 
@@ -60,8 +59,8 @@
 		return SCI_ERROR_DECOMPRESSION_INSANE;
 
 	if ((read(resh, &compressedLength, 2) != 2) ||
-	    (read(resh, &result_size, 2) != 2) ||
-	    (read(resh, &compressionMethod, 2) != 2))
+	        (read(resh, &result_size, 2) != 2) ||
+	        (read(resh, &compressionMethod, 2) != 2))
 		return SCI_ERROR_IO_ERROR;
 
 #ifdef WORDS_BIGENDIAN
@@ -71,12 +70,12 @@
 #endif
 	result->size = result_size;
 
-  /*  if ((result->size < 0) || (compressedLength < 0))
-      return SCI_ERROR_DECOMPRESSION_INSANE; */
-  /* This return will never happen in SCI0 or SCI1 (does it have any use?) */
+	/*  if ((result->size < 0) || (compressedLength < 0))
+	    return SCI_ERROR_DECOMPRESSION_INSANE; */
+	/* This return will never happen in SCI0 or SCI1 (does it have any use?) */
 
 	if ((result->size > SCI_MAX_RESOURCE_SIZE) ||
-	    (compressedLength > SCI_MAX_RESOURCE_SIZE))
+	        (compressedLength > SCI_MAX_RESOURCE_SIZE))
 		return SCI_ERROR_RESOURCE_TOO_BIG;
 
 	if (compressedLength > 0)
@@ -103,18 +102,18 @@
 
 #ifdef _SCI_DECOMPRESS_DEBUG
 	fprintf(stderr, "Resource %i.%s encrypted with method SCI1.1/%hi at %.2f%%"
-		" ratio\n",
-		result->number, sci_resource_type_suffixes[result->type],
-		compressionMethod,
-		(result->size == 0)? -1.0 :
-		(100.0 * compressedLength / result->size));
+	        " ratio\n",
+	        result->number, sci_resource_type_suffixes[result->type],
+	        compressionMethod,
+	        (result->size == 0) ? -1.0 :
+	        (100.0 * compressedLength / result->size));
 	fprintf(stderr, "  compressedLength = 0x%hx, actualLength=0x%hx\n",
-		compressedLength, result->size);
+	        compressedLength, result->size);
 #endif
 
 	DDEBUG("/%d[%d]", compressionMethod, result->size);
 
-	switch(compressionMethod) {
+	switch (compressionMethod) {
 
 	case 0: /* no compression */
 		if (result->size != compressedLength) {
@@ -143,17 +142,17 @@
 
 	case 3:
 	case 4: /* NYI */
-		fprintf(stderr,"Resource %d.%s: Warning: compression type #%d not yet implemented\n",
-			result->number, sci_resource_type_suffixes[result->type], compressionMethod);
+		fprintf(stderr, "Resource %d.%s: Warning: compression type #%d not yet implemented\n",
+		        result->number, sci_resource_type_suffixes[result->type], compressionMethod);
 		free(result->data);
 		result->data = NULL;
 		result->status = SCI_STATUS_NOMALLOC;
 		break;
 
 	default:
-		fprintf(stderr,"Resource %d.%s: Compression method SCI1/%hi not "
-			"supported!\n", result->number, sci_resource_type_suffixes[result->type],
-			compressionMethod);
+		fprintf(stderr, "Resource %d.%s: Compression method SCI1/%hi not "
+		        "supported!\n", result->number, sci_resource_type_suffixes[result->type],
+		        compressionMethod);
 		free(result->data);
 		result->data = NULL; /* So that we know that it didn't work */
 		result->status = SCI_STATUS_NOMALLOC;
@@ -161,7 +160,7 @@
 		return SCI_ERROR_UNKNOWN_COMPRESSION;
 	}
 
-  free(buffer);
-  return 0;
+	free(buffer);
+	return 0;
 }
 

Modified: scummvm/trunk/engines/sci/scicore/exe.cpp
===================================================================
--- scummvm/trunk/engines/sci/scicore/exe.cpp	2009-02-15 22:28:12 UTC (rev 38317)
+++ scummvm/trunk/engines/sci/scicore/exe.cpp	2009-02-15 22:28:50 UTC (rev 38318)
@@ -39,15 +39,13 @@
 	NULL
 };
 
-struct _exe_file
-{
+struct _exe_file {
 	struct _exe_decompressor *decompressor;
 	struct _exe_handle *handle;
 };
 
 exe_file_t *
-exe_open(const char *filename)
-{
+exe_open(const char *filename) {
 	int i = 0;
 	exe_decompressor_t *dec;
 
@@ -58,7 +56,7 @@
 			exe_file_t *file = (exe_file_t*)sci_malloc(sizeof(exe_file_t));
 
 			sciprintf("Scanning '%s' with decompressor '%s'\n",
-				  filename, dec->name);
+			          filename, dec->name);
 
 			file->handle = handle;
 			file->decompressor = dec;
@@ -72,14 +70,12 @@
 }
 
 int
-exe_read(exe_file_t *file, void *buf, int count)
-{
+exe_read(exe_file_t *file, void *buf, int count) {
 	return file->decompressor->read(file->handle, buf, count);
 }
 
 void
-exe_close(exe_file_t *file)
-{
+exe_close(exe_file_t *file) {
 	file->decompressor->close(file->handle);
 
 	sci_free(file);

Modified: scummvm/trunk/engines/sci/scicore/exe_dec.h
===================================================================
--- scummvm/trunk/engines/sci/scicore/exe_dec.h	2009-02-15 22:28:12 UTC (rev 38317)
+++ scummvm/trunk/engines/sci/scicore/exe_dec.h	2009-02-15 22:28:50 UTC (rev 38318)
@@ -35,7 +35,7 @@
 	            ** of lower-case (where applicable) alphanumerics
 	            */
 
-	exe_handle_t * (*open) (const char *filename);
+	exe_handle_t * (*open)(const char *filename);
 	/* Opens an executable file
 	** Parameters: (const char *) filename: Filename of executable to open.
 	** Returns   : (exe_handle_t *) Decompressor file handle, or NULL on
@@ -44,7 +44,7 @@
 	** decompressor. If this is not the case the function will fail.
 	*/
 
-	int (*read) (exe_handle_t *handle, void *buf, int count);
+	int (*read)(exe_handle_t *handle, void *buf, int count);
 	/* Reads from executable file
 	** Parameters: (exe_handle_t *) handle: Decompressor file handle.
 	**             (void *) buf: Buffer to store decompressed data.
@@ -56,7 +56,7 @@
 	**                   reached.
 	*/
 
-	void (*close) (exe_handle_t *handle);
+	void (*close)(exe_handle_t *handle);
 	/* Closes a decompressor file handle.
 	** Parameters: (exe_handle_t *) handle: Decompressor file handle.
 	** Returns   : (void)

Modified: scummvm/trunk/engines/sci/scicore/exe_lzexe.cpp
===================================================================
--- scummvm/trunk/engines/sci/scicore/exe_lzexe.cpp	2009-02-15 22:28:12 UTC (rev 38317)
+++ scummvm/trunk/engines/sci/scicore/exe_lzexe.cpp	2009-02-15 22:28:50 UTC (rev 38318)
@@ -49,8 +49,7 @@
 */
 #define LZEXE_BUFFER_MAX (LZEXE_BUFFER_SIZE - 256)
 
-struct _exe_handle
-{
+struct _exe_handle {
 	FILE *f;
 
 	/* Output buffer. */
@@ -66,8 +65,7 @@
 };
 
 static int
-lzexe_read_uint16(FILE *f, int *value)
-{
+lzexe_read_uint16(FILE *f, int *value) {
 	int data;
 
 	if ((*value = fgetc(f)) == EOF)
@@ -81,8 +79,7 @@
 }
 
 static int
-lzexe_read_uint8(FILE *f, int *value)
-{
+lzexe_read_uint8(FILE *f, int *value) {
 	if ((*value = fgetc(f)) == EOF)
 		return 0;
 
@@ -90,8 +87,7 @@
 }
 
 static int
-lzexe_init(exe_handle_t *handle, FILE *f)
-{
+lzexe_init(exe_handle_t *handle, FILE *f) {
 	handle->f = f;
 	handle->bufptr = handle->buffer;
 	handle->eod = 0;
@@ -104,27 +100,23 @@
 }
 
 static int
-lzexe_get_bit(exe_handle_t *handle, int *bit)
-{
+lzexe_get_bit(exe_handle_t *handle, int *bit) {
 	*bit = handle->buf & 1;
 
-	if (--handle->count == 0)
-	{
+	if (--handle->count == 0) {
 		if (!lzexe_read_uint16(handle->f, &handle->buf))
 			return 0;
 		handle->count = 16;
-	}
-	else
+	} else
 		handle->buf >>= 1;
 
 	return 1;
 }
 
 static int
-lzexe_decompress(exe_handle_t *handle)
-{
+lzexe_decompress(exe_handle_t *handle) {
 	while (!handle->eod
-	       && handle->bufptr - handle->buffer <= LZEXE_BUFFER_MAX) {
+	        && handle->bufptr - handle->buffer <= LZEXE_BUFFER_MAX) {
 		int bit;
 		int len, span;
 
@@ -222,8 +214,7 @@
 }
 
 static exe_handle_t *
-lzexe_open(const char *filename)
-{
+lzexe_open(const char *filename) {
 	exe_handle_t *handle;
 	guint8 head[0x20];
 	guint8 size[2];
@@ -242,7 +233,7 @@
 	** overlays == 0.
 	*/
 	if (UINT16(head) != 0x5a4d || UINT16(head + 8) != 2
-	    || UINT16(head + 0x1a) != 0)
+	        || UINT16(head + 0x1a) != 0)
 		return NULL;
 
 	/* Verify that first relocation item offset is 0x1c. */
@@ -251,7 +242,7 @@
 
 	/* Look for lzexe signature. */
 	if (memcmp(head + 0x1c, "LZ09", 4)
-            && memcmp(head + 0x1c, "LZ91", 4)) {
+	        && memcmp(head + 0x1c, "LZ91", 4)) {
 		return NULL;
 	}
 
@@ -281,8 +272,7 @@
 }
 
 static int
-lzexe_read(exe_handle_t *handle, void *buf, int count)
-{
+lzexe_read(exe_handle_t *handle, void *buf, int count) {
 	int done = 0;
 
 	while (done != count) {
@@ -326,8 +316,7 @@
 }
 
 static void
-lzexe_close(exe_handle_t *handle)
-{
+lzexe_close(exe_handle_t *handle) {
 	fclose(handle->f);
 
 	sci_free(handle);

Modified: scummvm/trunk/engines/sci/scicore/exe_raw.cpp
===================================================================
--- scummvm/trunk/engines/sci/scicore/exe_raw.cpp	2009-02-15 22:28:12 UTC (rev 38317)
+++ scummvm/trunk/engines/sci/scicore/exe_raw.cpp	2009-02-15 22:28:50 UTC (rev 38318)
@@ -28,16 +28,14 @@
 #include <stdio.h>
 #include "sci/include/sci_memory.h"
 
-struct _exe_handle
-{
+struct _exe_handle {
 	FILE *f;
 };
 
 #include "sci/scicore/exe_dec.h"
 
 static exe_handle_t *
-raw_open(const char *filename)
-{
+raw_open(const char *filename) {
 	FILE *f = sci_fopen(filename, "rb");
 	exe_handle_t *handle;
 
@@ -51,14 +49,12 @@
 }
 
 static int
-raw_read(exe_handle_t *handle, void *buf, int count)
-{
+raw_read(exe_handle_t *handle, void *buf, int count) {
 	return fread(buf, 1, count, handle->f);
 }
 
 static void
-raw_close(exe_handle_t *handle)
-{
+raw_close(exe_handle_t *handle) {
 	fclose(handle->f);
 
 	sci_free(handle);

Modified: scummvm/trunk/engines/sci/scicore/games.h
===================================================================
--- scummvm/trunk/engines/sci/scicore/games.h	2009-02-15 22:28:12 UTC (rev 38317)
+++ scummvm/trunk/engines/sci/scicore/games.h	2009-02-15 22:28:50 UTC (rev 38318)
@@ -35,89 +35,89 @@
 #include "sci/include/versions.h"
 
 typedef struct _sci_game {
-  int id; /* currently CRC of resource.001 */
-  int res_version;
-  sci_version_t version;
-  const char *name;
+	int id; /* currently CRC of resource.001 */
+	int res_version;
+	sci_version_t version;
+	const char *name;
 } sci_game_t;
 
 /* Interpreter versions for Amiga and Atari ST ports are tentative */
 sci_game_t sci_games[] = {
-	{ 0x5D451535, SCI_VERSION_AUTODETECT, SCI_VERSION(1,000,510), "Leisure Suit Larry 1 v1.0-mac"}, /* x.yyy.zzz */ /* Launcher says v2.0, game crashes on DoAvoider */
-	{ 0x6C176EE0, SCI_VERSION_AUTODETECT, SCI_VERSION(1,000,577), "Leisure Suit Larry 1 v2.1"},
-	{ 0x1C36E076, SCI_VERSION_AUTODETECT, SCI_VERSION(1,000,510), "Leisure Suit Larry 1 v1.000-es"}, /* 1.SQ4.057 */ /* Crashes on function 0x7b */
+	{ 0x5D451535, SCI_VERSION_AUTODETECT, SCI_VERSION(1, 000, 510), "Leisure Suit Larry 1 v1.0-mac"}, /* x.yyy.zzz */ /* Launcher says v2.0, game crashes on DoAvoider */
+	{ 0x6C176EE0, SCI_VERSION_AUTODETECT, SCI_VERSION(1, 000, 577), "Leisure Suit Larry 1 v2.1"},
+	{ 0x1C36E076, SCI_VERSION_AUTODETECT, SCI_VERSION(1, 000, 510), "Leisure Suit Larry 1 v1.000-es"}, /* 1.SQ4.057 */ /* Crashes on function 0x7b */
 
-	{ 0xFEAB629D, SCI_VERSION_AUTODETECT, SCI_VERSION(0,000,343), "Leisure Suit Larry 2 v1.000.011-3.5"},
-	{ 0x13DD3CD2, SCI_VERSION_AUTODETECT, SCI_VERSION(0,000,343), "Leisure Suit Larry 2 v1.000.011-5.25" },
-	{ 0x1D0F3B31, SCI_VERSION_AUTODETECT, SCI_VERSION(0,000,572), "Leisure Suit Larry 2 v1.001.006-st"}, /* 1.000.159 */
-	{ 0x40BEC726, SCI_VERSION_AUTODETECT, SCI_VERSION(0,000,409), "Leisure Suit Larry 2 v1.002.000-3.5"},
-	{ 0x0C848403, SCI_VERSION_AUTODETECT, SCI_VERSION(0,000,409), "Leisure Suit Larry 2 v1.002.000-5.25" },
-	{ 0x7E9CF339, SCI_VERSION_AUTODETECT, SCI_VERSION(0,000,572), "Leisure Suit Larry 2 v1.003-ami"}, /* x.yyy.zzz */
+	{ 0xFEAB629D, SCI_VERSION_AUTODETECT, SCI_VERSION(0, 000, 343), "Leisure Suit Larry 2 v1.000.011-3.5"},
+	{ 0x13DD3CD2, SCI_VERSION_AUTODETECT, SCI_VERSION(0, 000, 343), "Leisure Suit Larry 2 v1.000.011-5.25" },
+	{ 0x1D0F3B31, SCI_VERSION_AUTODETECT, SCI_VERSION(0, 000, 572), "Leisure Suit Larry 2 v1.001.006-st"}, /* 1.000.159 */
+	{ 0x40BEC726, SCI_VERSION_AUTODETECT, SCI_VERSION(0, 000, 409), "Leisure Suit Larry 2 v1.002.000-3.5"},
+	{ 0x0C848403, SCI_VERSION_AUTODETECT, SCI_VERSION(0, 000, 409), "Leisure Suit Larry 2 v1.002.000-5.25" },
+	{ 0x7E9CF339, SCI_VERSION_AUTODETECT, SCI_VERSION(0, 000, 572), "Leisure Suit Larry 2 v1.003-ami"}, /* x.yyy.zzz */
 
-	{ 0x06D737B5, SCI_VERSION_AUTODETECT, SCI_VERSION(0,000,572), "Leisure Suit Larry 3 v1.003-3.5" },
-	{ 0xE0A1C352, SCI_VERSION_AUTODETECT, SCI_VERSION(0,000,572), "Leisure Suit Larry 3 v1.003-5.25" },
-	{ 0xC48FE83A, SCI_VERSION_AUTODETECT, SCI_VERSION(0,000,572), "Leisure Suit Larry 3 v1.021-3.5" },
-	{ 0x484587DD, SCI_VERSION_AUTODETECT, SCI_VERSION(0,000,572), "Leisure Suit Larry 3 v1.021-5.25"},
-/*	{ 0x????????, SCI_VERSION_AUTODETECT, SCI_VERSION(0,000,572), "Leisure Suit Larry 3 v1.021-st"},*/ /* 1.002.026 */
-	{ 0x6348030A, SCI_VERSION_AUTODETECT, SCI_VERSION(0,000,572), "Leisure Suit Larry 3 v1.039-ami"}, /* 1.002.032 */
+	{ 0x06D737B5, SCI_VERSION_AUTODETECT, SCI_VERSION(0, 000, 572), "Leisure Suit Larry 3 v1.003-3.5" },
+	{ 0xE0A1C352, SCI_VERSION_AUTODETECT, SCI_VERSION(0, 000, 572), "Leisure Suit Larry 3 v1.003-5.25" },
+	{ 0xC48FE83A, SCI_VERSION_AUTODETECT, SCI_VERSION(0, 000, 572), "Leisure Suit Larry 3 v1.021-3.5" },
+	{ 0x484587DD, SCI_VERSION_AUTODETECT, SCI_VERSION(0, 000, 572), "Leisure Suit Larry 3 v1.021-5.25"},
+	/*	{ 0x????????, SCI_VERSION_AUTODETECT, SCI_VERSION(0,000,572), "Leisure Suit Larry 3 v1.021-st"},*/ /* 1.002.026 */
+	{ 0x6348030A, SCI_VERSION_AUTODETECT, SCI_VERSION(0, 000, 572), "Leisure Suit Larry 3 v1.039-ami"}, /* 1.002.032 */
 
-	{ 0x94EA377B, SCI_VERSION_AUTODETECT, SCI_VERSION(0,000,685), "CB1" },
-	{ 0xFD9EE7BD, SCI_VERSION_AUTODETECT, SCI_VERSION(0,000,685), "Camelot" },
-	{ 0x2829987F, SCI_VERSION_AUTODETECT, SCI_VERSION(0,000,685), "Camelot" },
-	{ 0x980CEAD3, SCI_VERSION_AUTODETECT, SCI_VERSION(0,000,629), "Demo Quest" },
-	{ 0x3DB972CA, SCI_VERSION_AUTODETECT, SCI_VERSION(0,000,572), "Hoyle 2" },
-	{ 0xC0B37651, SCI_VERSION_AUTODETECT, SCI_VERSION(0,000,685), "Iceman" },
-	{ 0xDABA6B8A, SCI_VERSION_AUTODETECT, SCI_VERSION(0,000,999), "KQ1 v1.000.051-3.5" }, /* S.old.010 */
-	{ 0x270E37F3, SCI_VERSION_AUTODETECT, SCI_VERSION(0,000,274), "KQ4" },
-	{ 0x685F1205, SCI_VERSION_AUTODETECT, SCI_VERSION(0,000,502), "KQ4" },
-	{ 0xC14E3A2A, SCI_VERSION_AUTODETECT, SCI_VERSION(0,000,395), "PQ2" },
-	{ 0x4BD66036, SCI_VERSION_AUTODETECT, SCI_VERSION(0,000,490), "PQ2" },
-	{ 0x7132D6D8, SCI_VERSION_AUTODETECT, SCI_VERSION(0,000,629), "QfG1" },
-	{ 0xF8F4913F, SCI_VERSION_AUTODETECT, SCI_VERSION(0,000,685), "SQ3" },
-	{ 0x34FBC324, SCI_VERSION_AUTODETECT, SCI_VERSION(0,000,999), "SQ3/DE" }, /* S.old.114 */
-	{ 0xE4A3234D, SCI_VERSION_AUTODETECT, SCI_VERSION(0,000,506), "Fun Seekers Guide v1.02"},
-	{ 0x85AFE241, SCI_VERSION_AUTODETECT, SCI_VERSION(0,000,519), "Hoyle 1 v1.000.104"},
-	{ 0xE0E070C3, SCI_VERSION_AUTODETECT, SCI_VERSION(0,000,572), "Hoyle 2 v1.000.011"},
-	{ 0xD0B8794E, SCI_VERSION_AUTODETECT, SCI_VERSION(0,000,668), "Iceman v1.023"},
-	{ 0x94EA377B, SCI_VERSION_AUTODETECT, SCI_VERSION(0,000,631), "The Colonel's Bequest v1.000.046"},
-	{ 0x28543FDF, SCI_VERSION_AUTODETECT, SCI_VERSION(0,000,453), "Astro Chicken"},
-	{ 0x31F46F7D, SCI_VERSION_AUTODETECT, SCI_VERSION(0,000,453), "Space Quest III v1.0V int"},
-	{ 0xAA2C94B9, SCI_VERSION_AUTODETECT, SCI_VERSION(0,000,685), "Mixed-Up Mother Goose v1.011 Int.#8.2.90"},
-	{ 0x3B15678B, SCI_VERSION_AUTODETECT, SCI_VERSION(0,000,631), "The Colonel's Bequest v1.000.046-3.5"},
-	{ 0x0E042F46, SCI_VERSION_AUTODETECT, SCI_VERSION(0,000,530), "Hoyle 1 v1.000.113-3.5"},
-	{ 0x1EACB959, SCI_VERSION_AUTODETECT, SCI_VERSION(0,000,566), "HQ v1.000-5.25"},
-	{ 0x2BEAF5E7, SCI_VERSION_AUTODETECT, SCI_VERSION(0,000,566), "HQ v1.001-5.25"},
-	{ 0x63626D3E, SCI_VERSION_AUTODETECT, SCI_VERSION(0,000,668), "Iceman v1.023-5.25"},
-	{ 0xDA5E7B7D, SCI_VERSION_AUTODETECT, SCI_VERSION(0,000,409), "KQ4 v1.003.006-3.5"},
-	{ 0x376A5472, SCI_VERSION_AUTODETECT, SCI_VERSION(0,000,502), "KQ4 v1.006.003-5.25"},
-	{ 0x364B40B2, SCI_VERSION_AUTODETECT, SCI_VERSION(0,000,395), "PQ2 v1.001.000-5.25"},
-	{ 0x664B4123, SCI_VERSION_AUTODETECT, SCI_VERSION(0,000,409), "PQ2 v1.001.006-3.5"},
-	{ 0x379F4582, SCI_VERSION_AUTODETECT, SCI_VERSION(0,000,453), "SQ3 v1.0V-5.25"},
-	{ 0x04B0B081, SCI_VERSION_AUTODETECT, SCI_VERSION(0,000,294), "xmascard v1.04"},
+	{ 0x94EA377B, SCI_VERSION_AUTODETECT, SCI_VERSION(0, 000, 685), "CB1" },
+	{ 0xFD9EE7BD, SCI_VERSION_AUTODETECT, SCI_VERSION(0, 000, 685), "Camelot" },
+	{ 0x2829987F, SCI_VERSION_AUTODETECT, SCI_VERSION(0, 000, 685), "Camelot" },
+	{ 0x980CEAD3, SCI_VERSION_AUTODETECT, SCI_VERSION(0, 000, 629), "Demo Quest" },
+	{ 0x3DB972CA, SCI_VERSION_AUTODETECT, SCI_VERSION(0, 000, 572), "Hoyle 2" },
+	{ 0xC0B37651, SCI_VERSION_AUTODETECT, SCI_VERSION(0, 000, 685), "Iceman" },
+	{ 0xDABA6B8A, SCI_VERSION_AUTODETECT, SCI_VERSION(0, 000, 999), "KQ1 v1.000.051-3.5" }, /* S.old.010 */
+	{ 0x270E37F3, SCI_VERSION_AUTODETECT, SCI_VERSION(0, 000, 274), "KQ4" },
+	{ 0x685F1205, SCI_VERSION_AUTODETECT, SCI_VERSION(0, 000, 502), "KQ4" },
+	{ 0xC14E3A2A, SCI_VERSION_AUTODETECT, SCI_VERSION(0, 000, 395), "PQ2" },
+	{ 0x4BD66036, SCI_VERSION_AUTODETECT, SCI_VERSION(0, 000, 490), "PQ2" },
+	{ 0x7132D6D8, SCI_VERSION_AUTODETECT, SCI_VERSION(0, 000, 629), "QfG1" },
+	{ 0xF8F4913F, SCI_VERSION_AUTODETECT, SCI_VERSION(0, 000, 685), "SQ3" },
+	{ 0x34FBC324, SCI_VERSION_AUTODETECT, SCI_VERSION(0, 000, 999), "SQ3/DE" }, /* S.old.114 */
+	{ 0xE4A3234D, SCI_VERSION_AUTODETECT, SCI_VERSION(0, 000, 506), "Fun Seekers Guide v1.02"},
+	{ 0x85AFE241, SCI_VERSION_AUTODETECT, SCI_VERSION(0, 000, 519), "Hoyle 1 v1.000.104"},
+	{ 0xE0E070C3, SCI_VERSION_AUTODETECT, SCI_VERSION(0, 000, 572), "Hoyle 2 v1.000.011"},
+	{ 0xD0B8794E, SCI_VERSION_AUTODETECT, SCI_VERSION(0, 000, 668), "Iceman v1.023"},
+	{ 0x94EA377B, SCI_VERSION_AUTODETECT, SCI_VERSION(0, 000, 631), "The Colonel's Bequest v1.000.046"},
+	{ 0x28543FDF, SCI_VERSION_AUTODETECT, SCI_VERSION(0, 000, 453), "Astro Chicken"},
+	{ 0x31F46F7D, SCI_VERSION_AUTODETECT, SCI_VERSION(0, 000, 453), "Space Quest III v1.0V int"},
+	{ 0xAA2C94B9, SCI_VERSION_AUTODETECT, SCI_VERSION(0, 000, 685), "Mixed-Up Mother Goose v1.011 Int.#8.2.90"},
+	{ 0x3B15678B, SCI_VERSION_AUTODETECT, SCI_VERSION(0, 000, 631), "The Colonel's Bequest v1.000.046-3.5"},
+	{ 0x0E042F46, SCI_VERSION_AUTODETECT, SCI_VERSION(0, 000, 530), "Hoyle 1 v1.000.113-3.5"},
+	{ 0x1EACB959, SCI_VERSION_AUTODETECT, SCI_VERSION(0, 000, 566), "HQ v1.000-5.25"},
+	{ 0x2BEAF5E7, SCI_VERSION_AUTODETECT, SCI_VERSION(0, 000, 566), "HQ v1.001-5.25"},
+	{ 0x63626D3E, SCI_VERSION_AUTODETECT, SCI_VERSION(0, 000, 668), "Iceman v1.023-5.25"},
+	{ 0xDA5E7B7D, SCI_VERSION_AUTODETECT, SCI_VERSION(0, 000, 409), "KQ4 v1.003.006-3.5"},
+	{ 0x376A5472, SCI_VERSION_AUTODETECT, SCI_VERSION(0, 000, 502), "KQ4 v1.006.003-5.25"},
+	{ 0x364B40B2, SCI_VERSION_AUTODETECT, SCI_VERSION(0, 000, 395), "PQ2 v1.001.000-5.25"},
+	{ 0x664B4123, SCI_VERSION_AUTODETECT, SCI_VERSION(0, 000, 409), "PQ2 v1.001.006-3.5"},
+	{ 0x379F4582, SCI_VERSION_AUTODETECT, SCI_VERSION(0, 000, 453), "SQ3 v1.0V-5.25"},
+	{ 0x04B0B081, SCI_VERSION_AUTODETECT, SCI_VERSION(0, 000, 294), "xmascard v1.04"},
 
-	{ 0x4447B28D, SCI_VERSION_AUTODETECT, SCI_VERSION(1,000,72),  "Trial v1.105"},
+	{ 0x4447B28D, SCI_VERSION_AUTODETECT, SCI_VERSION(1, 000, 72),  "Trial v1.105"},
 
-	{ 0xB1C2CCAE, SCI_VERSION_AUTODETECT, SCI_VERSION(1,000,200), "SQ4 v1.052"}, /* 1.000.753 */
-	{ 0xAA6AF6A9, SCI_VERSION_AUTODETECT, SCI_VERSION(1,000,60),  "KQ5 v0.000.062"},
-	{ 0x092C2C0D, 3,		      SCI_VERSION(1,000,172), "jones v1.000.060"}, /* x.yyy.zzz */
+	{ 0xB1C2CCAE, SCI_VERSION_AUTODETECT, SCI_VERSION(1, 000, 200), "SQ4 v1.052"}, /* 1.000.753 */
+	{ 0xAA6AF6A9, SCI_VERSION_AUTODETECT, SCI_VERSION(1, 000, 60),  "KQ5 v0.000.062"},
+	{ 0x092C2C0D, 3,		      SCI_VERSION(1, 000, 172), "jones v1.000.060"}, /* x.yyy.zzz */
 
-	{ 0xC415A485, SCI_VERSION_AUTODETECT, SCI_VERSION(1,000,172), "jones v1.000.060-cd"}, /* x.yyy.zzz */
+	{ 0xC415A485, SCI_VERSION_AUTODETECT, SCI_VERSION(1, 000, 172), "jones v1.000.060-cd"}, /* x.yyy.zzz */
 
-	{ 0x89C595E3, SCI_VERSION_AUTODETECT, SCI_VERSION(1,000,510), "SQ1 v2.000"}, /* T.A00.081 */
-	{ 0x09D4FC54, SCI_VERSION_AUTODETECT, SCI_VERSION(1,000,510), "LSL5 v1.000"}, /* T.A00.169 */
-	{ 0xF3ED1D81, SCI_VERSION_AUTODETECT, SCI_VERSION(1,000,510), "PQ3 v1.00"}, /* T.A00.178 */
-	{ 0x501B5E6B, SCI_VERSION_AUTODETECT, SCI_VERSION(1,000,510), "Brain v1.000"}, /* 1.000.044 */
-	{ 0xB1B7279B, SCI_VERSION_AUTODETECT, SCI_VERSION(1,000,510), "Longbow v1.000"}, /* 1.000.168 */
+	{ 0x89C595E3, SCI_VERSION_AUTODETECT, SCI_VERSION(1, 000, 510), "SQ1 v2.000"}, /* T.A00.081 */
+	{ 0x09D4FC54, SCI_VERSION_AUTODETECT, SCI_VERSION(1, 000, 510), "LSL5 v1.000"}, /* T.A00.169 */
+	{ 0xF3ED1D81, SCI_VERSION_AUTODETECT, SCI_VERSION(1, 000, 510), "PQ3 v1.00"}, /* T.A00.178 */
+	{ 0x501B5E6B, SCI_VERSION_AUTODETECT, SCI_VERSION(1, 000, 510), "Brain v1.000"}, /* 1.000.044 */
+	{ 0xB1B7279B, SCI_VERSION_AUTODETECT, SCI_VERSION(1, 000, 510), "Longbow v1.000"}, /* 1.000.168 */
 
-	{ 0x82595EBE, SCI_VERSION_AUTODETECT, SCI_VERSION(0,000,453), "SQ3 v1.0V-ami"}, /* x.yyy.zzz */
-	{ 0xF6080B61, SCI_VERSION_AUTODETECT, SCI_VERSION(0,000,530), "Hoyle 1 v1.000.139-ami"}, /* x.yyy.zzz */
+	{ 0x82595EBE, SCI_VERSION_AUTODETECT, SCI_VERSION(0, 000, 453), "SQ3 v1.0V-ami"}, /* x.yyy.zzz */
+	{ 0xF6080B61, SCI_VERSION_AUTODETECT, SCI_VERSION(0, 000, 530), "Hoyle 1 v1.000.139-ami"}, /* x.yyy.zzz */
 
-	{ 0x8AFEA2D0, 2,		      SCI_VERSION(1,000,000), "KQ1 v1.000.054-ami"}, /* 1.003.007 */
+	{ 0x8AFEA2D0, 2,		      SCI_VERSION(1, 000, 000), "KQ1 v1.000.054-ami"}, /* 1.003.007 */
 
 	/* Undetermined Amiga versions: */
-/*	{ 0x8AE5F854, ?, SCI_VERSION(), "ARTHUR" }, */
-/*	{ 0x9FB7015B, ?, SCI_VERSION(), "CB1" }, */
-/*	{ 0x560CEDD5, ?, SCI_VERSION(), "iceMan" }, */
+	/*	{ 0x8AE5F854, ?, SCI_VERSION(), "ARTHUR" }, */
+	/*	{ 0x9FB7015B, ?, SCI_VERSION(), "CB1" }, */
+	/*	{ 0x560CEDD5, ?, SCI_VERSION(), "iceMan" }, */
 
 	{ 0, 0, 0, NULL } /* terminator */
 };

Modified: scummvm/trunk/engines/sci/scicore/hashmap.cpp
===================================================================
--- scummvm/trunk/engines/sci/scicore/hashmap.cpp	2009-02-15 22:28:12 UTC (rev 38317)
+++ scummvm/trunk/engines/sci/scicore/hashmap.cpp	2009-02-15 22:28:50 UTC (rev 38318)
@@ -183,4 +183,4 @@
 		return oldnode->value;						\
 	} else return -1; /* Not found */					\
 }										\
-
+ 

Modified: scummvm/trunk/engines/sci/scicore/modules.cpp
===================================================================
--- scummvm/trunk/engines/sci/scicore/modules.cpp	2009-02-15 22:28:12 UTC (rev 38317)
+++ scummvm/trunk/engines/sci/scicore/modules.cpp	2009-02-15 22:28:50 UTC (rev 38318)
@@ -34,19 +34,18 @@
 
 
 static sci_module_t *
-_sci_try_open_module(char *filename, char *path, char *struct_name, void **handle)
-{
+_sci_try_open_module(char *filename, char *path, char *struct_name, void **handle) {
 	char *fullname = sci_malloc(strlen(path) + strlen(DIR_SEPARATOR_STR)
-				+ strlen(filename));
+	                            + strlen(filename));
 	sci_module_t *module;
-fprintf(stderr,"Trying module %s at %s\n", filename, path);
+	fprintf(stderr, "Trying module %s at %s\n", filename, path);
 	strcpy(fullname, path);
 	strcat(fullname, DIR_SEPARATOR_STR);
 	strcat(fullname, filename);
 
-fprintf(stderr,"Total name is %s\n", fullname);
+	fprintf(stderr, "Total name is %s\n", fullname);
 	*handle = dlopen(fullname, RTLD_NOW);
-fprintf(stderr,"Could not open because: %s\n", dlerror());
+	fprintf(stderr, "Could not open because: %s\n", dlerror());
 	free(fullname);
 
 	if (!*handle)
@@ -54,19 +53,18 @@
 
 	module = (sci_module_t *) dlsym(*handle, struct_name);
 	if (!module)
-		fprintf(stderr,"%s: Failed to find symbol '%s'.\n",
-			fullname, struct_name);
+		fprintf(stderr, "%s: Failed to find symbol '%s'.\n",
+		        fullname, struct_name);
 
 	return module;
 }
 
 void *
 sci_find_module(char *path, char *name, char *type, char *struct_prefix,
-		char *file_suffix, int magic, int version, void **handle)
-{
+                char *file_suffix, int magic, int version, void **handle) {
 	char *module_name = sci_malloc(strlen(type) + strlen(DIR_SEPARATOR_STR)
-				 + strlen(name) + strlen(file_suffix)
-				 + strlen(MODULE_NAME_SUFFIX) + 1);
+	                               + strlen(name) + strlen(file_suffix)
+	                               + strlen(MODULE_NAME_SUFFIX) + 1);
 	char *struct_name = sci_malloc(strlen(struct_prefix) + strlen(name) + 1);
 	char *dir_end;
 	char *path_pos = path;
@@ -88,19 +86,19 @@
 			*dir_end = 0;
 
 		module = _sci_try_open_module(module_name, path_pos,
-					      struct_name, handle);
+		                              struct_name, handle);
 
 		if (module) {
 			if (module->class_magic != magic) {
 				fprintf(stderr, "%s at %s is not a %s module, skipping...\n",
-					module_name, path_pos, type);
+				        module_name, path_pos, type);
 				dlclose(*handle);
 				module = NULL;
 			} else if (module->class_version != version) {
 				fprintf(stderr, "%s at %s has %s module version %d,"
-					" expected %d- skipping...\n",
-					module_name, path_pos, type, module->class_version,
-					version);
+				        " expected %d- skipping...\n",
+				        module_name, path_pos, type, module->class_version,
+				        version);
 				dlclose(*handle);
 				module = NULL;
 			}
@@ -115,8 +113,8 @@
 
 	if (!module) {
 		*handle = NULL;
-		fprintf(stderr,"%s module '%s' not found in path '%s'.\n",
-			type, name, path);
+		fprintf(stderr, "%s module '%s' not found in path '%s'.\n",
+		        type, name, path);
 	} else {
 		if (dir_end)
 			*dir_end = 0;
@@ -137,14 +135,13 @@
 
 
 void
-sci_close_module(void *module, char *type, char *name)
-{
+sci_close_module(void *module, char *type, char *name) {
 	if (!module)
 		return;
 
 	if (dlclose(module)) {
-		fprintf(stderr,"Error while closing %s module '%s': %s\n",
-			type, name, dlerror());
+		fprintf(stderr, "Error while closing %s module '%s': %s\n",
+		        type, name, dlerror());
 	}
 }
 

Modified: scummvm/trunk/engines/sci/scicore/old_objects.cpp
===================================================================
--- scummvm/trunk/engines/sci/scicore/old_objects.cpp	2009-02-15 22:28:12 UTC (rev 38317)
+++ scummvm/trunk/engines/sci/scicore/old_objects.cpp	2009-02-15 22:28:50 UTC (rev 38318)
@@ -25,359 +25,328 @@
 int max_object;
 
 const char* globals[] = {
-  /*00*/
-  "ego",
-  "GAMEID",
-  "roomXX",
-  "speed",
-  /*04*/
-  "quitFlag",
-  "cast",
-  "regions",
-  "timer",
-  /*08*/
-  "sounds",
-  "inv",
-  "eventHandler",
-  "roomNumberExit",
-  /*0C*/
-  "previousRoomNumber",
-  "roomNumber",
-  "enterDebugModeOnRoomExit",
-  "score",
-  /*10*/
-  "maximumScore",
-  "11",
-  "speed",
-  "13",
-  /*14*/
-  "14",
-  "loadCursor",
-  "normalFont",
-  "restoreSaveFont", /*dialogFont*/
-  /*18*/
-  "18",
-  "19",
-  "defaultFont",
-  "1B",
-  /*1C*/
-  "pointerToVersionNumber",
-  "locales",
-  "pointerToSaveGameDirectory",
-  "1F"
+	/*00*/
+	"ego",
+	"GAMEID",
+	"roomXX",
+	"speed",
+	/*04*/
+	"quitFlag",
+	"cast",
+	"regions",
+	"timer",
+	/*08*/
+	"sounds",
+	"inv",
+	"eventHandler",
+	"roomNumberExit",
+	/*0C*/
+	"previousRoomNumber",
+	"roomNumber",
+	"enterDebugModeOnRoomExit",
+	"score",
+	/*10*/
+	"maximumScore",
+	"11",
+	"speed",
+	"13",
+	/*14*/
+	"14",
+	"loadCursor",
+	"normalFont",
+	"restoreSaveFont", /*dialogFont*/
+	/*18*/
+	"18",
+	"19",
+	"defaultFont",
+	"1B",
+	/*1C*/
+	"pointerToVersionNumber",
+	"locales",
+	"pointerToSaveGameDirectory",
+	"1F"
 };
 
-static int add_object(object* obj)
-{
+static int add_object(object* obj) {
 	FLEXARRAY_APPEND(object*, fobjects, obj, return 1);
 	return 0;
 }
 
-static void dump(byte* data, int len)
-{
-	int i=0;
-	while(i<len)
-	{
+static void dump(byte* data, int len) {
+	int i = 0;
+	while (i < len) {
 		printf("%02X ", data[i++]);
-		if(i%8==0) printf("   ");
-		if(i%16==0) printf("\n");
+		if (i % 8 == 0) printf("   ");
+		if (i % 16 == 0) printf("\n");
 	}
-	if(i%16) printf("\n");
+	if (i % 16) printf("\n");
 }
 
-static void printMethod(object* obj, int meth, int indent)
-{
-	script_method* m=obj->methods[meth];
+static void printMethod(object* obj, int meth, int indent) {
+	script_method* m = obj->methods[meth];
 	int i, j;
 
-	for(j=0; j<indent*2-1; j++) printf(" ");
+	for (j = 0; j < indent*2 - 1; j++) printf(" ");
 	printf("Method %s\n", snames[m->number]);
 
-	for(i=0; i<m->used; i++)
-	{
-		script_opcode op=m->data[i];
+	for (i = 0; i < m->used; i++) {
+		script_opcode op = m->data[i];
 
-		for(j=0; j<indent; j++) printf("  ");
+		for (j = 0; j < indent; j++) printf("  ");
 		printf("%s ", opcodes[op.opcode].name);
 
-		switch(op.opcode)
-		{
-			case 0x21: /*callk*/
-			{
-				if(op.arg1>knames_count) printf("<no such kernel function %02X> ", op.arg1);
-				else printf("%s ", knames[op.arg1]);
-				printf("%02X", op.arg2);
-			} break;
-			case 0x28: /*class*/
-			{
-				if(op.arg1>max_object) printf("<no such class %02X>", op.arg1);
-				else
-				{
-					/* [DJ] op.arg1+1 adjusts for the <root> object */
-                                        if(fobjects.data[op.arg1+1]==0) printf("<null object>");
-					else printf("%s", fobjects.data[op.arg1+1]->name);
+		switch (op.opcode) {
+		case 0x21: { /*callk*/
+			if (op.arg1 > knames_count) printf("<no such kernel function %02X> ", op.arg1);
+			else printf("%s ", knames[op.arg1]);
+			printf("%02X", op.arg2);
+		}
+		break;
+		case 0x28: { /*class*/
+			if (op.arg1 > max_object) printf("<no such class %02X>", op.arg1);
+			else {
+				/* [DJ] op.arg1+1 adjusts for the <root> object */
+				if (fobjects.data[op.arg1+1] == 0) printf("<null object>");
+				else printf("%s", fobjects.data[op.arg1+1]->name);
+			}
+		}
+		break;
+		case 0x44: {
+			if (op.arg1 > 0x20) printf("<no such global %02X> ", op.arg1);
+			else printf("%s ", globals[op.arg1]);
+		}
+		break;
+		default: {
+			int args[3];
+			args[0] = op.arg1;
+			args[1] = op.arg2;
+			args[2] = op.arg3;
+			for (j = 0; j < 3; j++) {
+				switch (formats[op.opcode][j]) {
+				case Script_Invalid: {
+					printf("<invalid> ");
 				}
-			} break;
-			case 0x44:
-			{
-				if(op.arg1>0x20) printf("<no such global %02X> ", op.arg1);
-				else printf("%s ", globals[op.arg1]);
-			} break;
-			default:
-			{
-				int args[3];
-				args[0]=op.arg1;
-				args[1]=op.arg2;
-				args[2]=op.arg3;
-				for(j=0; j<3; j++)
-				{
-					switch(formats[op.opcode][j])
-					{
-						case Script_Invalid:
-						{
-								printf("<invalid> ");
-						} break;
-						case Script_None:
-						{
-							j=3;
-						} break;
-					        case Script_SByte:
-						case Script_Byte:
-						{
-							printf("%02X ", args[j]);
-						} break;
-						case Script_Word:
-					        case Script_SVariable:
-						case Script_Variable:
-                                                case Script_SRelative:
-                                                case Script_Property:
-                                                case Script_Global:
-                                                case Script_Local:
-                                                case Script_Temp:
-                                                case Script_Param:
-						{
-							printf("%04X ", args[j]);
-						} break;
-						case Script_SWord:
-						{
-							if(args[j]<0) printf("-%04X", -args[j]);
-							else printf("%04X", args[j]);
-						} break;
-						case Script_End:
-						{
-							printf("\n");
-							return;
-						} break;
-						default:
-						{
-							printf("<unknown arg type %d> ", formats[op.opcode][j]);
-						}
-					}
+				break;
+				case Script_None: {
+					j = 3;
 				}
-			} break;
+				break;
+				case Script_SByte:
+				case Script_Byte: {
+					printf("%02X ", args[j]);
+				}
+				break;
+				case Script_Word:
+				case Script_SVariable:
+				case Script_Variable:
+				case Script_SRelative:
+				case Script_Property:
+				case Script_Global:
+				case Script_Local:
+				case Script_Temp:
+				case Script_Param: {
+					printf("%04X ", args[j]);
+				}
+				break;
+				case Script_SWord: {
+					if (args[j] < 0) printf("-%04X", -args[j]);
+					else printf("%04X", args[j]);
+				}
+				break;
+				case Script_End: {
+					printf("\n");
+					return;
+				}
+				break;
+				default: {
+					printf("<unknown arg type %d> ", formats[op.opcode][j]);
+				}
+				}
+			}
 		}
+		break;
+		}
 		printf("\n");
 	}
 }
 
-static void printObject_r(object* obj, int flags, int level)
-{
+static void printObject_r(object* obj, int flags, int level) {
 	int i;
-	for(i=0; i<level; i++) printf("  ");
-	if(obj==0) printf("(null)\n");
-	else
-	{
+	for (i = 0; i < level; i++) printf("  ");
+	if (obj == 0) printf("(null)\n");
+	else {
 		printf("%s\n", obj->name);
-		if(flags&SCRIPT_PRINT_METHODS)
-		{
-			for(i=0; i<obj->method_count; i++)
-			{
-				printMethod(obj, i, level+1);
+		if (flags&SCRIPT_PRINT_METHODS) {
+			for (i = 0; i < obj->method_count; i++) {
+				printMethod(obj, i, level + 1);
 			}
 		}
-		if(flags&SCRIPT_PRINT_CHILDREN)
-		{
-			for(i=0; i<obj->children.used; i++)
-			{
-				printObject_r(obj->children.data[i], flags, level+1);
+		if (flags&SCRIPT_PRINT_CHILDREN) {
+			for (i = 0; i < obj->children.used; i++) {
+				printObject_r(obj->children.data[i], flags, level + 1);
 			}
 		}
 	}
 }
 
-void printObject(object* obj, int flags)
-{
+void printObject(object* obj, int flags) {
 	printf("pO(%p, %d)\n", obj, flags);
 	printObject_r(obj, flags, 0);
 }
 
-static object* object_new()
-{
-	object* obj= (object*)sci_malloc(sizeof(object));
-	if(obj==0) return 0;
+static object* object_new() {
+	object* obj = (object*)sci_malloc(sizeof(object));
+	if (obj == 0) return 0;
 
-	obj->parent=0;
+	obj->parent = 0;
 	FLEXARRAY_INIT(object*, obj->children);
-	obj->name=0;
-	obj->selector_count=0;
-	obj->selector_numbers=0;
-	obj->methods=0;
-	obj->method_count=0;
+	obj->name = 0;
+	obj->selector_count = 0;
+	obj->selector_numbers = 0;
+	obj->methods = 0;
+	obj->method_count = 0;
 
 	return obj;
 }
 
-static int add_child(object* parent, object* child)
-{
+static int add_child(object* parent, object* child) {
 	FLEXARRAY_APPEND(object*, parent->children, child, return 1);
 	return 0;
 }
 
-static object* fake_object(const char* reason)
-{
-	object* obj=object_new();
-	if(obj==0)
-	{
-		#ifdef SCRIPT_DEBUG
+static object* fake_object(const char* reason) {
+	object* obj = object_new();
+	if (obj == 0) {
+#ifdef SCRIPT_DEBUG
 		printf("object_new failed during fake for %s\n", reason);
-		#endif
+#endif
 		free(obj);
 		return 0;
 	}
-	if(add_child(object_root, obj))
-	{
-		#ifdef SCRIPT_DEBUG
+	if (add_child(object_root, obj)) {
+#ifdef SCRIPT_DEBUG
 		printf("add_child failed during fake for %s\n", reason);
-		#endif
+#endif
 		free(obj);
 		return 0;
 	}
-	obj->name=reason;
-	if(add_object(obj))
-	{
-		#ifdef SCRIPT_DEBUG
+	obj->name = reason;
+	if (add_object(obj)) {
+#ifdef SCRIPT_DEBUG
 		printf("add_object failed during fake for %s\n", reason);
-		#endif
+#endif
 		/*FIXME: clean up parent*/
 		return 0;
 	}
 	return obj;
 }
 
-static script_method* decode_method(byte* data)
-{
-  script_method* m;
-  int done=0;
-  int pos=0;
-  static int count=0;
+static script_method* decode_method(byte* data) {
+	script_method* m;
+	int done = 0;
+	int pos = 0;
+	static int count = 0;
 
-  count++;
+	count++;
 
-  if((m= (script_method*)sci_malloc(sizeof(script_method)))==0) return 0;
-  FLEXARRAY_INIT(script_opcode, *m);
+	if ((m = (script_method*)sci_malloc(sizeof(script_method))) == 0) return 0;
+	FLEXARRAY_INIT(script_opcode, *m);
 
-  while(!done)
-    {
-      int op=data[pos]>>1;
-      int size=2-(data[pos]&1);
-      int* args[3];
-      int arg;
-      int old_pos;
+	while (!done) {
+		int op = data[pos] >> 1;
+		int size = 2 - (data[pos] & 1);
+		int* args[3];
+		int arg;
+		int old_pos;
 
-      FLEXARRAY_ADD_SPACE(script_opcode, *m, 1, return 0);
-      old_pos=pos;
-      m->data[m->used-1].pos=pos;
-      m->data[m->used-1].opcode=op;
+		FLEXARRAY_ADD_SPACE(script_opcode, *m, 1, return 0);
+		old_pos = pos;
+		m->data[m->used-1].pos = pos;
+		m->data[m->used-1].opcode = op;
 
-      /*Copy the adresses of the args to an array for convenience*/
-      args[0]=&m->data[m->used-1].arg1;
-      args[1]=&m->data[m->used-1].arg2;
-      args[2]=&m->data[m->used-1].arg3;
+		/*Copy the adresses of the args to an array for convenience*/
+		args[0] = &m->data[m->used-1].arg1;
+		args[1] = &m->data[m->used-1].arg2;
+		args[2] = &m->data[m->used-1].arg3;
 
-      /*Skip past the opcode*/
-      pos++;
+		/*Skip past the opcode*/
+		pos++;
 
-      for(arg=0; arg<4; arg++)
-	{
-	  switch(formats[op][arg])
-	    {
-	    case Script_Invalid: /*Can't happen(tm)*/
-	      {
-	      	int i;
-		printf("Invalid opcode %02X at %04X in method %d\n", op, pos, count);
-		for(i=m->used-9; i<m->used-1; i++)
-		{
-			printf("%s[%02X] ", opcodes[m->data[i].opcode].name, m->data[i].opcode);
-			dump(data+m->data[i].pos, m->data[i].size);
+		for (arg = 0; arg < 4; arg++) {
+			switch (formats[op][arg]) {
+			case Script_Invalid: { /*Can't happen(tm)*/
+				int i;
+				printf("Invalid opcode %02X at %04X in method %d\n", op, pos, count);
+				for (i = m->used - 9; i < m->used - 1; i++) {
+					printf("%s[%02X] ", opcodes[m->data[i].opcode].name, m->data[i].opcode);
+					dump(data + m->data[i].pos, m->data[i].size);
+				}
+				printf("Dump from %04X-%04X\n", pos - 16, pos + 16);
+				dump(data + pos - 16, 32);
+			}
+			break;
+			case Script_None: { /*No more args*/
+				arg = 4;
+			}
+			break;
+			case Script_Byte: /*Just a one byte arg*/
+			case Script_SByte: {
+				*args[arg] = data[pos++];
+			}
+			break;
+			case Script_Word: { /*A two byte arg*/
+				*args[arg] = getInt16(data + pos);
+				pos += 2;
+			}
+			break;
+			case Script_SWord: { /*A signed two-byte arg*/
+				int t = getInt16(data + pos);
+				if (t&0x8000) *args[arg] = -(t & 0x7FFF);
+				else *args[arg] = t;
+				pos += 2;
+			}
+			break;
+			case Script_Variable: /*Size of arg depends on LSB in opcode*/
+			case Script_SVariable:
+			case Script_SRelative:
+			case Script_Property:
+			case Script_Global:
+			case Script_Local:
+			case Script_Temp:
+			case Script_Param: {
+				if (size == 1) *args[arg] = data[pos++];
+				else {
+					*args[arg] = getInt16(data + pos);
+					pos += 2;
+				}
+			}
+			break;
+			case Script_End: { /*Special tag for ret*/
+				done = 1;
+				arg = 4;
+			}
+			break;
+			default: { /*Can't happen(tm)*/
+				printf("Unknown argument format %d for op %02X\n", formats[op][arg], op);
+			}
+			break;
+			}
 		}
-		printf("Dump from %04X-%04X\n", pos-16, pos+16);
-		dump(data + pos - 16, 32);
-	      } break;
-	    case Script_None: /*No more args*/
-	      {
-		arg=4;
-	      } break;
-	    case Script_Byte: /*Just a one byte arg*/
-	    case Script_SByte:
-	      {
-		*args[arg]=data[pos++];
-	      } break;
-	    case Script_Word: /*A two byte arg*/
-	      {
-		*args[arg]=getInt16(data+pos);
-		pos+=2;
-	      } break;
-	    case Script_SWord: /*A signed two-byte arg*/
-	      {
-		int t=getInt16(data+pos);
-		if(t&0x8000) *args[arg]=-(t&0x7FFF);
-		else *args[arg]=t;
-		pos+=2;
-	      } break;
-	    case Script_Variable: /*Size of arg depends on LSB in opcode*/
-            case Script_SVariable:
-            case Script_SRelative:
-            case Script_Property:
-            case Script_Global:
-            case Script_Local:
-            case Script_Temp:
-            case Script_Param:
-	      {
-		if(size==1) *args[arg]=data[pos++];
-		else
-		{
-			*args[arg]=getInt16(data+pos);
-			pos+=2;
-		}
-	      } break;
-	    case Script_End: /*Special tag for ret*/
-	      {
-		done=1;
-		arg=4;
-	      } break;
-	    default: /*Can't happen(tm)*/
-	      {
-		printf("Unknown argument format %d for op %02X\n", formats[op][arg], op);
-	      } break;
-	    }
+		fflush(stdout);
+		if (m->used) m->data[m->used-1].size = pos - old_pos;
 	}
-      fflush(stdout);
-      if (m->used) m->data[m->used-1].size=pos-old_pos;
-    }
 
-  return m;
+	return m;
 }
 
 #ifdef SCRIPT_DEBUG
-void list_code_blocks(resource_t* r)
-{
-	int pos=getInt16(r->data+2);
-	while(pos<r->size-2)
-	{
-		int type=getInt16(r->data+pos);
-		int len=getInt16(r->data+pos+2);
-		if(type==2) printf("%X-%X\n", pos, pos+len);
-		pos+=len;
+void list_code_blocks(resource_t* r) {
+	int pos = getInt16(r->data + 2);
+	while (pos < r->size - 2) {
+		int type = getInt16(r->data + pos);
+		int len = getInt16(r->data + pos + 2);
+		if (type == 2) printf("%X-%X\n", pos, pos + len);
+		pos += len;
 	}
 }
 #endif
@@ -385,93 +354,83 @@
 
 /*These expect the frame, the whole frame, and, well, other stuff too,
  *I guess, as long as it looks like a frame*/
-static int get_type(unsigned char* obj)
-{
+static int get_type(unsigned char* obj) {
 	return getInt16(obj);
 }
 
-static int get_length(unsigned char* obj)
-{
-	return getInt16(obj+2);
+static int get_length(unsigned char* obj) {
+	return getInt16(obj + 2);
 }
 
-static int get_selector_count(unsigned char* obj)
-{
-	return getInt16(obj+10);
+static int get_selector_count(unsigned char* obj) {
+	return getInt16(obj + 10);
 }
 
-static int get_selector_value(unsigned char* obj, int sel)
-{
-	assert(sel<get_selector_count(obj));
+static int get_selector_value(unsigned char* obj, int sel) {
+	assert(sel < get_selector_count(obj));
 	return getInt16(obj + 12 + sel*2);
 }
 
 /*Bas things happen if the method offset value is wrong*/
-static unsigned char* get_method_area(unsigned char* obj)
-{
-	return obj+getInt16(obj+8)+10;
+static unsigned char* get_method_area(unsigned char* obj) {
+	return obj + getInt16(obj + 8) + 10;
 }
 
-static int get_method_count(unsigned char* obj)
-{
+static int get_method_count(unsigned char* obj) {
 	return getInt16(get_method_area(obj));
 }
 
-static int get_method_number(unsigned char* obj, int i)
-{
-	assert(i<get_method_count(obj));
-	return getInt16(get_method_area(obj)+2+2*i);
+static int get_method_number(unsigned char* obj, int i) {
+	assert(i < get_method_count(obj));
+	return getInt16(get_method_area(obj) + 2 + 2*i);
 }
 
-static int get_method_location(unsigned char* obj, int i)
-{
-	assert(i<get_method_count(obj));
-	return getInt16(get_method_area(obj)+4+2*get_method_count(obj)+2*i);
+static int get_method_location(unsigned char* obj, int i) {
+	assert(i < get_method_count(obj));
+	return getInt16(get_method_area(obj) + 4 + 2*get_method_count(obj) + 2*i);
 }
 
 
 /*Returns the position of the first frame of type 'type' in resource 'r',
  *starting from the frame starting at 'start', or -1 on failure.
  */
-static int find_frame(resource_t* r, int type, unsigned int start)
-{
-	int t=-1;
+static int find_frame(resource_t* r, int type, unsigned int start) {
+	int t = -1;
 	unsigned int pos = start;
 	unsigned char* frame;
 
-	assert(start<=r->size-4);
+	assert(start <= r->size - 4);
 
-	#ifdef SCRIPT_DEBUG
+#ifdef SCRIPT_DEBUG
 	printf("Searching for frame of type %d in script %03d, starting at %#x\n", type, r->number, start);
-	dump(r->data+start, 32);
-	#endif
+	dump(r->data + start, 32);
+#endif
 
 	/*Some times there's an extra byte at the beginning. Christoph?*/
 #if 1
-	if(pos==0 && r->size>=6 && \
-	   !((0<getInt16(r->data)) && (10>getInt16(r->data)))) pos=2;
+	if (pos == 0 && r->size >= 6 && \
+	        !((0 < getInt16(r->data)) && (10 > getInt16(r->data)))) pos = 2;
 #else
-	if(pos == 0) 
+	if (pos == 0)
 		pos = 2;
 #endif
 	frame = r->data + pos;
-	while(1)
-	{
+	while (1) {
 #ifdef SCRIPT_DEBUG
 		printf("offset = %#x\n", pos);
 		dump(frame, 32);
 #endif
 		t = get_type(frame);
-		if(t == type) 
+		if (t == type)
 			break;
 
-		if(t == 0) 
+		if (t == 0)
 			return -1;
 
-		pos+=get_length(frame);
-		if(pos > (r->size - 2)) 
+		pos += get_length(frame);
+		if (pos > (r->size - 2))
 			return -1;
-		frame+=get_length(frame);
+		frame += get_length(frame);
 	}
 
 	return pos;
@@ -482,8 +441,7 @@
 /*FIXME: lots of things are identical to read_object and read_class. Some of
  *these would benefit from being put in separate functions.*/
 
-static object* read_object(resource_mgr_t *resmgr, int script, int positions[1000])
-{
+static object* read_object(resource_mgr_t *resmgr, int script, int positions[1000]) {
 	resource_t* r = scir_find_resource(resmgr, sci_script, script, 0);
 	unsigned char* raw;
 	int pos;
@@ -491,94 +449,85 @@
 
 	printf("Searching for object in script %03d\n", script);
 
-	if(r==0) return 0;
+	if (r == 0) return 0;
 
 	/*Skip to the next object*/
-	#ifdef SCRIPT_DEBUG
+#ifdef SCRIPT_DEBUG
 	printf("pre skip: pos=%#x\n", positions[script]);
-	#endif
-	pos=find_frame(r, 1, positions[script]);
-	#ifdef SCRIPT_DEBUG
+#endif
+	pos = find_frame(r, 1, positions[script]);
+#ifdef SCRIPT_DEBUG
 	printf("post skip: pos=%#x\n", pos);
-	#endif
-	if(pos==-1) return 0;
-	else positions[script]=pos+get_length(r->data+pos);
-	#ifdef SCRIPT_DEBUG
-	printf("post post: pos=%#x (len=%#x)\n", positions[script], get_length(r->data+pos));
-	#endif
+#endif
+	if (pos == -1) return 0;
+	else positions[script] = pos + get_length(r->data + pos);
+#ifdef SCRIPT_DEBUG
+	printf("post post: pos=%#x (len=%#x)\n", positions[script], get_length(r->data + pos));
+#endif
 
 	/*Construct the object*/
-	obj=object_new();
-	raw=r->data+pos;
+	obj = object_new();
+	raw = r->data + pos;
 
 	/*Fill in the name*/
-	if(get_selector_count(raw)<4) obj->name="<anonymous>";
-	else
-	{
+	if (get_selector_count(raw) < 4) obj->name = "<anonymous>";
+	else {
 		if (get_selector_value(raw, 3))
 			obj->name = (char *) r->data + get_selector_value(raw, 3);
-		else obj->name="<null>";
+		else obj->name = "<null>";
 	}
 
 	/*Fill in the class*/
-	if(get_selector_count(raw)==0) obj->parent=object_root;
-	else
-	{
-		int parent_id=get_selector_value(raw, 1);
-		if(parent_id>=fobjects.used)
-		{
+	if (get_selector_count(raw) == 0) obj->parent = object_root;
+	else {
+		int parent_id = get_selector_value(raw, 1);
+		if (parent_id >= fobjects.used) {
 			free(obj);
 			return 0;
 		}
-		if(parent_id<1) obj->parent=object_root;
-		else obj->parent=fobjects.data[parent_id];
+		if (parent_id < 1) obj->parent = object_root;
+		else obj->parent = fobjects.data[parent_id];
 	}
 
 	/*Add the object to the class*/
-	if(!obj->parent)
-	{
+	if (!obj->parent) {
 		free(obj);
 		return 0;
 	}
-	if(add_child(obj->parent, obj)){
+	if (add_child(obj->parent, obj)) {
 		free(obj);
 		return 0;
 	}
-	if(add_object(obj))
-	{
+	if (add_object(obj)) {
 		free(obj);
 		return 0;
 	}
 
 	/*FIXME: decode selectors here*/
 
-	obj->method_count=get_method_count(raw);
-	obj->methods= (script_method**)sci_malloc(obj->method_count*sizeof(script_method));
-	if(obj->methods==0)
-	{
+	obj->method_count = get_method_count(raw);
+	obj->methods = (script_method**)sci_malloc(obj->method_count * sizeof(script_method));
+	if (obj->methods == 0) {
 		free(obj);
 		return 0;
 	} else {
 		int i;
-		for(i=0; i<obj->method_count; i++)
-		{
-			int number=get_method_number(raw, i);
-			int position=get_method_location(raw, i);
+		for (i = 0; i < obj->method_count; i++) {
+			int number = get_method_number(raw, i);
+			int position = get_method_location(raw, i);
 
-			if((obj->methods[i]=decode_method(r->data+position))==0)
-			{
-				obj->method_count=i-1;
+			if ((obj->methods[i] = decode_method(r->data + position)) == 0) {
+				obj->method_count = i - 1;
 				break;
 			}
-			obj->methods[i]->number=number;
+			obj->methods[i]->number = number;
 		}
 	}
 
 	return obj;
 }
 
-static object* read_class(resource_mgr_t *resmgr, int script, int positions[1000])
-{
+static object* read_class(resource_mgr_t *resmgr, int script, int positions[1000]) {
 	resource_t* r = scir_find_resource(resmgr, sci_script, script, 0);
 	unsigned char* raw;
 	int pos;
@@ -586,62 +535,57 @@
 
 	printf("Searching for class in script %03d\n", script);
 
-	if(r==0) return fake_object("<resource not found>");
+	if (r == 0) return fake_object("<resource not found>");
 
 	/*Skip to the next class*/
-	#ifdef SCRIPT_DEBUG
+#ifdef SCRIPT_DEBUG
 	printf("pre skip: pos=%#x\n", positions[script]);
-	#endif
-	pos=find_frame(r, 6, positions[script]);
-	#ifdef SCRIPT_DEBUG
+#endif
+	pos = find_frame(r, 6, positions[script]);
+#ifdef SCRIPT_DEBUG
 	printf("post skip: pos=%#x\n", pos);
-	#endif
-	if(pos==-1) return fake_object("<no more classes in script>");
-	else positions[script]=pos+get_length(r->data+pos);
-	#ifdef SCRIPT_DEBUG
-	printf("post post: pos=%#x (len=%#x)\n", positions[script], get_length(r->data+pos));
-	#endif
+#endif
+	if (pos == -1) return fake_object("<no more classes in script>");
+	else positions[script] = pos + get_length(r->data + pos);
+#ifdef SCRIPT_DEBUG
+	printf("post post: pos=%#x (len=%#x)\n", positions[script], get_length(r->data + pos));
+#endif
 
 	/*Construct the object*/
-	obj=object_new();
-	raw=r->data+pos;
+	obj = object_new();
+	raw = r->data + pos;
 
 	/*Fill in the name*/
-	if(get_selector_count(raw)<4) obj->name="<anonymous>";
-	else
-	{
+	if (get_selector_count(raw) < 4) obj->name = "<anonymous>";
+	else {
 		if (get_selector_value(raw, 3))
 			obj->name = (char *) r->data + get_selector_value(raw, 3);
-		else obj->name="<null>";
+		else obj->name = "<null>";
 	}
 
 	/*Fill in the parent*/
-	if(get_selector_count(raw)==0) obj->parent=object_root;
-	else
-	{
-		int superclass_id=get_selector_value(raw, 1);
+	if (get_selector_count(raw) == 0) obj->parent = object_root;
+	else {
+		int superclass_id = get_selector_value(raw, 1);
 		printf("superclass==%d\n", superclass_id);
-		if(superclass_id>=fobjects.used)
-		{
+		if (superclass_id >= fobjects.used) {
 			free(obj);
 			return fake_object("<no such superclass>");
 		}
-		if(superclass_id<1) obj->parent=object_root;
-		else obj->parent=fobjects.data[superclass_id];
+		if (superclass_id < 1) obj->parent = object_root;
+		else obj->parent = fobjects.data[superclass_id];
 	}
 
 	/*Add the class to the hierarchy*/
-	if(!obj->parent)
-	{
+	if (!obj->parent) {
 		free(obj);
 		return fake_object("<null parent>");
 	}
-	if(add_child(obj->parent, obj)){
+	if (add_child(obj->parent, obj)) {
 		free(obj);
 		return fake_object("<add_child failed>");
 	}
-	if(add_object(obj))
-	{
+	if (add_object(obj)) {
 		free(obj);
 		return fake_object("<add_object failed>");
 	}
@@ -651,64 +595,58 @@
 	return obj;
 }
 
-void freeObject(object* obj)
-{
+void freeObject(object* obj) {
 	int i;
-	for(i=0; i<obj->children.used; i++) freeObject(obj->children.data[i]);
+	for (i = 0; i < obj->children.used; i++) freeObject(obj->children.data[i]);
 	free(obj);
 }
 
-static int objects_init(resource_mgr_t *resmgr)
-{
+static int objects_init(resource_mgr_t *resmgr) {
 	FLEXARRAY_INIT(object*, fobjects);
-	max_object=0;
+	max_object = 0;
 
-	if((object_root=object_new())==0) return 1;
-	object_root->name="<root>";
+	if ((object_root = object_new()) == 0) return 1;
+	object_root->name = "<root>";
 	add_object(object_root);
 
-	opcodes=vocabulary_get_opcodes(resmgr);
-	knames=vocabulary_get_knames(resmgr, &knames_count);
-	snames=vocabulary_get_snames(resmgr, NULL, 0);
+	opcodes = vocabulary_get_opcodes(resmgr);
+	knames = vocabulary_get_knames(resmgr, &knames_count);
+	snames = vocabulary_get_snames(resmgr, NULL, 0);
 
 	return 0;
 }
 
-int loadObjects(resource_mgr_t *resmgr)
-{
+int loadObjects(resource_mgr_t *resmgr) {
 	int i;
 	int *classes, class_count;
 	int positions[1000];
 
-	if(objects_init(resmgr))
-	{
-		#ifdef SCRIPT_DEBUG
+	if (objects_init(resmgr)) {
+#ifdef SCRIPT_DEBUG
 		perror("objects_init");
-		#endif
+#endif
 		return 1;
 	}
-	classes=vocabulary_get_classes(resmgr, &class_count);
+	classes = vocabulary_get_classes(resmgr, &class_count);
 
-	for(i=0; i<1000; i++) positions[i]=0;
-	for(i=0; i<class_count; i++)
-	{
+	for (i = 0; i < 1000; i++) positions[i] = 0;
+	for (i = 0; i < class_count; i++) {
 #ifdef SCRIPT_DEBUG
-                printf ("\n\nReading class 0x%02X\n", i);
+		printf("\n\nReading class 0x%02X\n", i);
 #endif
-                if(read_class(resmgr, classes[i], positions)==0)
-		{
-			#ifdef SCRIPT_DEBUG
+		if (read_class(resmgr, classes[i], positions) == 0) {
+#ifdef SCRIPT_DEBUG
 			fprintf(stderr, "Failed to load class %d, which is a parent.\n", i);
-			#endif
+#endif
 			return 1;
 		}
 	}
 
-	for(i=0; i<1000; i++) positions[i]=0;
-	for(i=0; i<1000; i++) while(read_object(resmgr, i, positions));
+	for (i = 0; i < 1000; i++) positions[i] = 0;
+	for (i = 0; i < 1000; i++) while (read_object(resmgr, i, positions));
 
-	object_map=fobjects.data;
-	max_object=fobjects.used;
+	object_map = fobjects.data;
+	max_object = fobjects.used;
 
 	return 0;
 }

Modified: scummvm/trunk/engines/sci/scicore/reg_t_hashmap.cpp
===================================================================
--- scummvm/trunk/engines/sci/scicore/reg_t_hashmap.cpp	2009-02-15 22:28:12 UTC (rev 38317)
+++ scummvm/trunk/engines/sci/scicore/reg_t_hashmap.cpp	2009-02-15 22:28:50 UTC (rev 38318)
@@ -31,8 +31,7 @@
 #include "sci/scicore/hashmap.cpp"
 
 static inline int
-compare_reg_t (reg_t lhs, reg_t rhs)
-{
+compare_reg_t (reg_t lhs, reg_t rhs) {
 	if (lhs.segment == rhs.segment)
 		return lhs.offset - rhs.offset;
 	else

Modified: scummvm/trunk/engines/sci/scicore/resource.cpp
===================================================================
--- scummvm/trunk/engines/sci/scicore/resource.cpp	2009-02-15 22:28:12 UTC (rev 38317)
+++ scummvm/trunk/engines/sci/scicore/resource.cpp	2009-02-15 22:28:50 UTC (rev 38318)
@@ -68,18 +68,21 @@
 	"Decompression failed: Decompression buffer overflow",
 	"Decompression failed: Sanity check failed",
 	"Decompression failed: Resource too big",
-	"SCI version is unsupported"};
+	"SCI version is unsupported"
+};
 
-const char* sci_resource_types[] = {"view","pic","script","text","sound",
-				    "memory","vocab","font","cursor",
-				    "patch","bitmap","palette","cdaudio",
-				    "audio","sync","message","map","heap"};
+const char* sci_resource_types[] = {"view", "pic", "script", "text", "sound",
+                                    "memory", "vocab", "font", "cursor",
+                                    "patch", "bitmap", "palette", "cdaudio",
+                                    "audio", "sync", "message", "map", "heap"
+                                   };
 /* These are the 18 resource types supported by SCI1 */
 
-const char *sci_resource_type_suffixes[] = {"v56","p56","scr","tex","snd",
-					    "   ","voc","fon","cur","pat",
-					    "bit","pal","cda","aud","syn",
-					    "msg","map","hep"};
+const char *sci_resource_type_suffixes[] = {"v56", "p56", "scr", "tex", "snd",
+        "   ", "voc", "fon", "cur", "pat",
+        "bit", "pal", "cda", "aud", "syn",
+        "msg", "map", "hep"
+                                           };
 
 
 int resourcecmp(const void *first, const void *second);
@@ -113,17 +116,16 @@
 };
 
 
-int resourcecmp (const void *first, const void *second)
-{
+int resourcecmp(const void *first, const void *second) {
 	if (((resource_t *)first)->type ==
-	    ((resource_t *)second)->type)
+	        ((resource_t *)second)->type)
 		return (((resource_t *)first)->number <
-			((resource_t *)second)->number)? -1 :
-		!(((resource_t *)first)->number ==
-		  ((resource_t *)second)->number);
+		        ((resource_t *)second)->number) ? -1 :
+		       !(((resource_t *)first)->number ==
+		         ((resource_t *)second)->number);
 	else
 		return (((resource_t *)first)->type <
-			((resource_t *)second)->type)? -1 : 1;
+		        ((resource_t *)second)->type) ? -1 : 1;
 }
 
 
@@ -135,8 +137,7 @@
 /*-----------------------------*/
 
 void
-_scir_add_altsource(resource_t *res, resource_source_t *source, unsigned int file_offset)
-{
+_scir_add_altsource(resource_t *res, resource_source_t *source, unsigned int file_offset) {
 	resource_altsource_t *rsrc = (resource_altsource_t*)sci_malloc(sizeof(resource_altsource_t));
 
 	rsrc->next = res->alt_sources;
@@ -146,8 +147,7 @@
 }
 
 resource_t *
-_scir_find_resource_unsorted(resource_t *res, int res_nr, int type, int number)
-{
+_scir_find_resource_unsorted(resource_t *res, int res_nr, int type, int number) {
 	int i;
 	for (i = 0; i < res_nr; i++)
 		if (res[i].number == number && res[i].type == type)
@@ -160,10 +160,9 @@
 /*-----------------------------------*/
 
 resource_source_t *
-scir_add_external_map(resource_mgr_t *mgr, char *file_name)
-{
-	resource_source_t *newsrc = (resource_source_t *) 
-		malloc(sizeof(resource_source_t));
+scir_add_external_map(resource_mgr_t *mgr, char *file_name) {
+	resource_source_t *newsrc = (resource_source_t *)
+	                            malloc(sizeof(resource_source_t));
 
 	/* Add the new source to the SLL of sources */
 	newsrc->next = mgr->sources;
@@ -179,10 +178,9 @@
 
 resource_source_t *
 scir_add_volume(resource_mgr_t *mgr, resource_source_t *map, char *filename,
-		int number, int extended_addressing)
-{
-	resource_source_t *newsrc = (resource_source_t *) 
-		malloc(sizeof(resource_source_t));
+                int number, int extended_addressing) {
+	resource_source_t *newsrc = (resource_source_t *)
+	                            malloc(sizeof(resource_source_t));
 
 	/* Add the new source to the SLL of sources */
 	newsrc->next = mgr->sources;
@@ -197,10 +195,9 @@
 }
 
 resource_source_t *
-scir_add_patch_dir(resource_mgr_t *mgr, int type, char *dirname)
-{
-	resource_source_t *newsrc = (resource_source_t *) 
-		malloc(sizeof(resource_source_t));
+scir_add_patch_dir(resource_mgr_t *mgr, int type, char *dirname) {
+	resource_source_t *newsrc = (resource_source_t *)
+	                            malloc(sizeof(resource_source_t));
 
 	/* Add the new source to the SLL of sources */
 	newsrc->next = mgr->sources;
@@ -213,15 +210,13 @@
 }
 
 resource_source_t *
-scir_get_volume(resource_mgr_t *mgr, resource_source_t *map, int volume_nr)
-{
+scir_get_volume(resource_mgr_t *mgr, resource_source_t *map, int volume_nr) {
 	resource_source_t *seeker = mgr->sources;
 
-	while (seeker)
-	{
+	while (seeker) {
 		if (seeker->source_type == RESSOURCE_TYPE_VOLUME &&
-		    seeker->associated_map == map &&
-		    seeker->location.file.volume_number == volume_nr)
+		        seeker->associated_map == map &&
+		        seeker->location.file.volume_number == volume_nr)
 			return seeker;
 		seeker = seeker->next;
 	}
@@ -234,16 +229,14 @@
 /*------------------------------------------------*/
 
 static void
-_scir_init_trivial(resource_mgr_t *mgr)
-{
+_scir_init_trivial(resource_mgr_t *mgr) {
 	mgr->resources_nr = 0;
 	mgr->resources = (resource_t*)sci_malloc(1);
 }
 
 
 static void
-_scir_load_from_patch_file(int fh, resource_t *res, char *filename)
-{
+_scir_load_from_patch_file(int fh, resource_t *res, char *filename) {
 	unsigned int really_read;
 
 	res->data = (unsigned char*)sci_malloc(res->size);
@@ -251,7 +244,7 @@
 
 	if (really_read < res->size) {
 		sciprintf("Error: Read %d bytes from %s but expected %d!\n",
-			  really_read, filename, res->size);
+		          really_read, filename, res->size);
 		exit(1);
 	}
 
@@ -259,8 +252,7 @@
 }
 
 static void
-_scir_load_resource(resource_mgr_t *mgr, resource_t *res, int protect)
-{
+_scir_load_resource(resource_mgr_t *mgr, resource_t *res, int protect) {
 	char filename[MAXPATHLEN];
 	int fh;
 	resource_t backup;
@@ -273,7 +265,7 @@
 
 		if (!patch_sprintfers[mgr->sci_version]) {
 			sciprintf("Resource manager's SCI version (%d) has no patch file name printers -> internal error!\n",
-				  mgr->sci_version);
+			          mgr->sci_version);
 			exit(1);
 		}
 
@@ -292,7 +284,7 @@
 			*raiser = toupper(*raiser); /* Uppercasify */
 			++raiser;
 		}
-		fh = sci_open(filename, O_RDONLY|O_BINARY);
+		fh = sci_open(filename, O_RDONLY | O_BINARY);
 	}    /* Try case-insensitively name */
 
 	if (!IS_VALID_FD(fh)) {
@@ -309,22 +301,22 @@
 	lseek(fh, res->file_offset, SEEK_SET);
 
 	if (res->source->source_type == RESSOURCE_TYPE_DIRECTORY ||
-	    res->source->source_type == RESSOURCE_TYPE_AUDIO_DIRECTORY)
+	        res->source->source_type == RESSOURCE_TYPE_AUDIO_DIRECTORY)
 		_scir_load_from_patch_file(fh, res, filename);
 	else if (!decompressors[mgr->sci_version]) {
 		/* Check whether we support this at all */
 		sciprintf("Resource manager's SCI version (%d) is invalid!\n",
-			  mgr->sci_version);
+		          mgr->sci_version);
 		exit(1);
 	} else {
 		int error = /* Decompress from regular resource file */
-			decompressors[mgr->sci_version](res, fh, mgr->sci_version);
+		    decompressors[mgr->sci_version](res, fh, mgr->sci_version);
 
 		if (error) {
 			sciprintf("Error %d occured while reading %s.%03d"
-				  " from resource file: %s\n",
-				  error, sci_resource_types[res->type], res->number,
-				  sci_error_types[error]);
+			          " from resource file: %s\n",
+			          error, sci_resource_types[res->type], res->number,
+			          sci_error_types[error]);
 
 			if (protect)
 				memcpy(res, &backup, sizeof(resource_t));
@@ -342,21 +334,19 @@
 }
 
 resource_t *
-scir_test_resource(resource_mgr_t *mgr, int type, int number)
-{
+scir_test_resource(resource_mgr_t *mgr, int type, int number) {
 	resource_t binseeker;
 	binseeker.type = type;
 	binseeker.number = number;
 	return (resource_t *)
-		bsearch(&binseeker, mgr->resources, mgr->resources_nr,
-			sizeof(resource_t), resourcecmp);
+	       bsearch(&binseeker, mgr->resources, mgr->resources_nr,
+	               sizeof(resource_t), resourcecmp);
 }
 
 int sci0_get_compression_method(int resh);
 
 int
-sci_test_view_type(resource_mgr_t *mgr)
-{
+sci_test_view_type(resource_mgr_t *mgr) {
 	int fh;
 	char filename[MAXPATHLEN];
 	int compression;
@@ -365,14 +355,13 @@
 
 	mgr->sci_version = SCI_VERSION_AUTODETECT;
 
-	for (i=0;i<1000;i++)
-	{
+	for (i = 0;i < 1000;i++) {
 		res = scir_test_resource(mgr, sci_view, i);
 
 		if (!res) continue;
 
 		if (res->source->source_type == RESSOURCE_TYPE_DIRECTORY ||
-		    res->source->source_type == RESSOURCE_TYPE_AUDIO_DIRECTORY)
+		        res->source->source_type == RESSOURCE_TYPE_AUDIO_DIRECTORY)
 			continue;
 
 		strcpy(filename, res->source->location.file.name);
@@ -384,9 +373,9 @@
 				*raiser = toupper(*raiser); /* Uppercasify */
 				++raiser;
 			}
-			fh = sci_open(filename, O_RDONLY|O_BINARY);
+			fh = sci_open(filename, O_RDONLY | O_BINARY);
 		}    /* Try case-insensitively name */
-		
+
 		if (!IS_VALID_FD(fh)) continue;
 		lseek(fh, res->file_offset, SEEK_SET);
 
@@ -398,14 +387,13 @@
 	}
 
 	/* Try the same thing with pics */
-	for (i=0;i<1000;i++)
-	{
+	for (i = 0;i < 1000;i++) {
 		res = scir_test_resource(mgr, sci_pic, i);
 
 		if (!res) continue;
 
 		if (res->source->source_type == RESSOURCE_TYPE_DIRECTORY ||
-		    res->source->source_type == RESSOURCE_TYPE_AUDIO_DIRECTORY)
+		        res->source->source_type == RESSOURCE_TYPE_AUDIO_DIRECTORY)
 			continue;
 
 		strcpy(filename, res->source->location.file.name);
@@ -418,9 +406,9 @@
 				*raiser = toupper(*raiser); /* Uppercasify */
 				++raiser;
 			}
-			fh = sci_open(filename, O_RDONLY|O_BINARY);
+			fh = sci_open(filename, O_RDONLY | O_BINARY);
 		}    /* Try case-insensitively name */
-		
+
 		if (!IS_VALID_FD(fh)) continue;
 		lseek(fh, res->file_offset, SEEK_SET);
 
@@ -433,14 +421,13 @@
 
 	return mgr->sci_version;
 }
-	
 
-		
+
+
 int
 scir_add_appropriate_sources(resource_mgr_t *mgr,
-			     int allow_patches,
-			     char *dir)
-{
+                             int allow_patches,
+                             char *dir) {
 	const char *trailing_slash = "";
 	//char path_separator;
 	sci_dir_t dirent;
@@ -449,14 +436,13 @@
 	int fd;
 	char fullname[MAXPATHLEN];
 
-	if (dir[strlen(dir)-1] != G_DIR_SEPARATOR)
-	{
+	if (dir[strlen(dir)-1] != G_DIR_SEPARATOR) {
 		trailing_slash = G_DIR_SEPARATOR_S;
 	}
 
 	name = (char *)malloc(strlen(dir) + 1 +
-		      strlen("RESOURCE.MAP") + 1);
-	
+	                      strlen("RESOURCE.MAP") + 1);
+
 	sprintf(fullname, "%s%s%s", dir, trailing_slash, "RESOURCE.MAP");
 	fd = sci_open("RESOURCE.MAP", O_RDONLY | O_BINARY);
 	if (!IS_VALID_FD(fd)) return 0;
@@ -465,8 +451,7 @@
 	free(name);
 	sci_init_dir(&dirent);
 	name = sci_find_first(&dirent, "RESOURCE.0??");
-	while (name != NULL)
-	{
+	while (name != NULL) {
 		char *dot = strrchr(name, '.');
 		int number = atoi(dot + 1);
 
@@ -484,8 +469,7 @@
 }
 
 static int
-_scir_scan_new_sources(resource_mgr_t *mgr, int *detected_version, resource_source_t *source)
-{
+_scir_scan_new_sources(resource_mgr_t *mgr, int *detected_version, resource_source_t *source) {
 	int preset_version = mgr->sci_version;
 	int resource_error = 0;
 	int dummy = mgr->sci_version;
@@ -498,35 +482,33 @@
 	if (source->next)
 		_scir_scan_new_sources(mgr, detected_version, source->next);
 
-	if (!source->scanned)
-	{
+	if (!source->scanned) {
 		source->scanned = 1;
-		switch (source->source_type)
-		{
+		switch (source->source_type) {
 		case RESSOURCE_TYPE_DIRECTORY:
 			if (mgr->sci_version <= SCI_VERSION_01)
 				sci0_read_resource_patches(source,
-							   &mgr->resources,
-							   &mgr->resources_nr);
+				                           &mgr->resources,
+				                           &mgr->resources_nr);
 			else
 				sci1_read_resource_patches(source,
-							   &mgr->resources,
-							   &mgr->resources_nr);
+				                           &mgr->resources,
+				                           &mgr->resources_nr);
 			break;
 		case RESSOURCE_TYPE_EXTERNAL_MAP:
 			if (preset_version <= SCI_VERSION_01_VGA_ODD
-			    /* || preset_version == SCI_VERSION_AUTODETECT -- subsumed by the above line */) {
+			        /* || preset_version == SCI_VERSION_AUTODETECT -- subsumed by the above line */) {
 				resource_error =
-					sci0_read_resource_map(mgr, 
-							       source,
-							       &mgr->resources,
-							       &mgr->resources_nr,
-							       detected_version);
-				
+				    sci0_read_resource_map(mgr,
+				                           source,
+				                           &mgr->resources,
+				                           &mgr->resources_nr,
+				                           detected_version);
+
 #if 0
 				if (resource_error >= SCI_ERROR_CRITICAL) {
 					sciprintf("Resmgr: Error while loading resource map: %s\n",
-						  sci_error_types[resource_error]);
+					          sci_error_types[resource_error]);
 					if (resource_error == SCI_ERROR_RESMAP_NOT_FOUND)
 						sciprintf("Running SCI games without a resource map is not supported ATM\n");
 					sci_free(mgr);
@@ -546,34 +528,33 @@
 				}
 #endif
 			}
-			
-			if ((preset_version == SCI_VERSION_1_EARLY)||
-			    (preset_version == SCI_VERSION_1_LATE)||
-			    (preset_version == SCI_VERSION_1_1)||
-			    ((*detected_version == SCI_VERSION_AUTODETECT)&&(preset_version == SCI_VERSION_AUTODETECT)))
-			{
+
+			if ((preset_version == SCI_VERSION_1_EARLY) ||
+			        (preset_version == SCI_VERSION_1_LATE) ||
+			        (preset_version == SCI_VERSION_1_1) ||
+			        ((*detected_version == SCI_VERSION_AUTODETECT) && (preset_version == SCI_VERSION_AUTODETECT))) {
 				resource_error =
-					sci1_read_resource_map(mgr,
-							       source,
-							       scir_get_volume(mgr, source, 0),
-							       &mgr->resources,
-							       &mgr->resources_nr,
-							       detected_version);
-					
+				    sci1_read_resource_map(mgr,
+				                           source,
+				                           scir_get_volume(mgr, source, 0),
+				                           &mgr->resources,
+				                           &mgr->resources_nr,

@@ Diff output truncated at 100000 characters. @@

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list