[Scummvm-cvs-logs] CVS: scummvm/scumm akos.cpp,1.81,1.82 akos.h,1.23,1.24 bomp.cpp,2.8,2.9

Max Horn fingolfin at users.sourceforge.net
Thu Jun 19 09:04:04 CEST 2003


Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1:/tmp/cvs-serv3845

Modified Files:
	akos.cpp akos.h bomp.cpp 
Log Message:
made scale table const again; some cleanup in setupBompScale

Index: akos.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/akos.cpp,v
retrieving revision 1.81
retrieving revision 1.82
diff -u -d -r1.81 -r1.82
--- akos.cpp	19 Jun 2003 12:41:28 -0000	1.81
+++ akos.cpp	19 Jun 2003 16:03:12 -0000	1.82
@@ -408,9 +408,9 @@
 }
 
 #ifdef __PALM_OS__
-byte *default_scale_table;
+const byte *defaultScaleTable;
 #else
-byte default_scale_table[768] = {
+const byte defaultScaleTable[768] = {
 	0x00, 0x80, 0x40, 0xC0, 0x20, 0xA0, 0x60, 0xE0,
 	0x10, 0x90, 0x50, 0xD0, 0x30, 0xB0, 0x70, 0xF0,
 	0x08, 0x88, 0x48, 0xC8, 0x28, 0xA8, 0x68, 0xE8,
@@ -524,7 +524,7 @@
 
 	/* implement custom scale table */
 
-	v1.scaletable = default_scale_table;
+	v1.scaletable = defaultScaleTable;
 
 	// FIXME - which value for VAR_CUSTOMSCALETABLE in V8 ?
 	if (_vm->VAR_CUSTOMSCALETABLE != 0xFF && _vm->isGlobInMemory(rtString, _vm->VAR(_vm->VAR_CUSTOMSCALETABLE))) {
@@ -1368,7 +1368,7 @@
 #ifdef __PALM_OS__
 #include "scumm_globals.h" // init globals
 void Akos_initGlobals()		{	
-	GSETPTR(default_scale_table, GBVARS_DEFAULTSCALETABLE_INDEX, byte, GBVARS_SCUMM)
+	GSETPTR(defaultScaleTable, GBVARS_DEFAULTSCALETABLE_INDEX, byte, GBVARS_SCUMM)
 }
 void Akos_releaseGlobals()	{
 	GRELEASEPTR(GBVARS_DEFAULTSCALETABLE_INDEX, GBVARS_SCUMM)

Index: akos.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/akos.h,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- akos.h	16 Jun 2003 15:11:24 -0000	1.23
+++ akos.h	19 Jun 2003 16:03:12 -0000	1.24
@@ -25,6 +25,12 @@
 
 #include "base-costume.h"
 
+#ifdef __PALM_OS__
+extern const byte *defaultScaleTable;
+#else
+extern const byte defaultScaleTable[768];
+#endif
+
 struct CostumeData;
 struct AkosHeader;
 struct AkosOffset;

Index: bomp.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/bomp.cpp,v
retrieving revision 2.8
retrieving revision 2.9
diff -u -d -r2.8 -r2.9
--- bomp.cpp	19 Jun 2003 12:41:28 -0000	2.8
+++ bomp.cpp	19 Jun 2003 16:03:12 -0000	2.9
@@ -21,6 +21,7 @@
 
 #include "stdafx.h"
 #include "scumm.h"
+#include "akos.h"
 #include "bomp.h"
 
 
@@ -347,72 +348,40 @@
 	4, 3, 3, 2, 3, 2, 2, 1, 3, 2, 2, 1, 2, 1, 1, 0,
 };
 
-extern byte default_scale_table[768];
-
 int32 setupBompScale(byte *scaling, int32 size, byte scale) {
-	uint32 tmp = (256 - (size >> 1));
-	int32 count = (size + 7) >> 3;
-	assert(tmp < sizeof(default_scale_table));
-	byte *tmp_ptr = default_scale_table + tmp;
+	byte tmp;
+	int32 count;
+	const byte *tmp_ptr;
 	byte *tmp_scaling = scaling;
 	byte a = 0;
+	byte ret_value = 0;
+	const int offsets[8] = { 3, 2, 1, 0, 7, 6, 5, 4 };
 
-	while ((count--) != 0) {
-		tmp = *(tmp_ptr + 3);
-		a <<= 1;
-		if (scale < tmp) {
-			a |= 1;
-		}
-		tmp = *(tmp_ptr + 2);
-		a <<= 1;
-		if (scale < tmp) {
-			a |= 1;
-		}
-		tmp = *(tmp_ptr + 1);
-		a <<= 1;
-		if (scale < tmp) {
-			a |= 1;
-		}
-		tmp = *(tmp_ptr + 0);
-		a <<= 1;
-		if (scale < tmp) {
-			a |= 1;
-		}
-		tmp_ptr += 4;
-
-		tmp = *(tmp_ptr + 3);
-		a <<= 1;
-		if (scale < tmp) {
-			a |= 1;
-		}
-		tmp = *(tmp_ptr + 2);
-		a <<= 1;
-		if (scale < tmp) {
-			a |= 1;
-		}
-		tmp = *(tmp_ptr + 1);
-		a <<= 1;
-		if (scale < tmp) {
-			a |= 1;
-		}
-		tmp = *(tmp_ptr + 0);
-		a <<= 1;
-		if (scale < tmp) {
-			a |= 1;
+	count = (256 - (size >> 1));
+	assert(0 <= count && count < 768);
+	tmp_ptr = defaultScaleTable + count;
+	
+	count = (size + 7) >> 3;
+	while (count--) {
+		a = 0;
+		for (int i = 0; i < 8; i++) {
+			tmp = *(tmp_ptr + offsets[i]);
+			a <<= 1;
+			if (scale < tmp) {
+				a |= 1;
+			}
 		}
-		tmp_ptr += 4;
+		tmp_ptr += 8;
 
-		*(tmp_scaling++) = a;
+		*tmp_scaling++ = a;
 	}
 	if ((size & 7) != 0) {
 		*(tmp_scaling - 1) |= revBitMask[size & 7];
 	}
 
 	count = (size + 7) >> 3;
-	byte ret_value = 0;
 	while (count--) {
 		tmp = *scaling++;
-		assert(tmp < sizeof(_bompBitsTable));
 		ret_value += _bompBitsTable[tmp];
 	}
 





More information about the Scummvm-git-logs mailing list