[Scummvm-cvs-logs] SF.net SVN: scummvm: [29853] scummvm/trunk/engines/cine

cyx at users.sourceforge.net cyx at users.sourceforge.net
Thu Dec 13 20:07:10 CET 2007


Revision: 29853
          http://scummvm.svn.sourceforge.net/scummvm/?rev=29853&view=rev
Author:   cyx
Date:     2007-12-13 11:07:10 -0800 (Thu, 13 Dec 2007)

Log Message:
-----------
use CLIP template for clipping, made an array static const and renamed MAX_OBJECTDATA to MAX_VAR

Modified Paths:
--------------
    scummvm/trunk/engines/cine/cine.cpp
    scummvm/trunk/engines/cine/gfx.cpp
    scummvm/trunk/engines/cine/object.cpp
    scummvm/trunk/engines/cine/object.h
    scummvm/trunk/engines/cine/sound.cpp

Modified: scummvm/trunk/engines/cine/cine.cpp
===================================================================
--- scummvm/trunk/engines/cine/cine.cpp	2007-12-13 17:53:31 UTC (rev 29852)
+++ scummvm/trunk/engines/cine/cine.cpp	2007-12-13 19:07:10 UTC (rev 29853)
@@ -136,7 +136,7 @@
 		objectTable[i].name[0] = 0;
 	}
 
-	for (i = 0; i < NUM_MAX_OBJECTDATA; i++) {
+	for (i = 0; i < NUM_MAX_VAR; i++) {
 		globalVars[i] = 0;
 	}
 
@@ -170,7 +170,7 @@
 
 	objScriptList.next = NULL;
 	objScriptList.scriptPtr = NULL;
-	
+
 	globalScriptsHead.next = NULL;
 	globalScriptsHead.scriptPtr = NULL;
 

Modified: scummvm/trunk/engines/cine/gfx.cpp
===================================================================
--- scummvm/trunk/engines/cine/gfx.cpp	2007-12-13 17:53:31 UTC (rev 29852)
+++ scummvm/trunk/engines/cine/gfx.cpp	2007-12-13 19:07:10 UTC (rev 29853)
@@ -133,19 +133,10 @@
 	}
 }
 
-int8 clipColor(int8 color) {
-	if (color < 0)
-		color = 0;
-	else if (color > 7)
-		color = 7;
-
-	return color;
-}
-
 static uint16 transformColor(uint16 baseColor, int8 r, int8 g, int8 b) {
-	int8 oriR = clipColor((baseColor & 0x7) + r);
-	int8 oriG = clipColor(((baseColor & 0x70) >> 4) + g);
-	int8 oriB = clipColor(((baseColor & 0x700) >> 8) + b);
+	int8 oriR = CLIP( (baseColor & 0x007)       + r, 0, 7);
+	int8 oriG = CLIP(((baseColor & 0x070) >> 4) + g, 0, 7);
+	int8 oriB = CLIP(((baseColor & 0x700) >> 8) + b, 0, 7);
 
 	return oriR | (oriG << 4) | (oriB << 8);
 }

Modified: scummvm/trunk/engines/cine/object.cpp
===================================================================
--- scummvm/trunk/engines/cine/object.cpp	2007-12-13 17:53:31 UTC (rev 29852)
+++ scummvm/trunk/engines/cine/object.cpp	2007-12-13 19:07:10 UTC (rev 29853)
@@ -36,7 +36,7 @@
 namespace Cine {
 
 objectStruct objectTable[NUM_MAX_OBJECT];
-uint16 globalVars[NUM_MAX_OBJECTDATA + 1];
+uint16 globalVars[NUM_MAX_VAR];
 overlayHeadElement overlayHead;
 
 void unloadAllMasks(void) {

Modified: scummvm/trunk/engines/cine/object.h
===================================================================
--- scummvm/trunk/engines/cine/object.h	2007-12-13 17:53:31 UTC (rev 29852)
+++ scummvm/trunk/engines/cine/object.h	2007-12-13 19:07:10 UTC (rev 29853)
@@ -50,10 +50,10 @@
 };
 
 #define NUM_MAX_OBJECT 255
-#define NUM_MAX_OBJECTDATA 255
+#define NUM_MAX_VAR 256
 
 extern objectStruct objectTable[NUM_MAX_OBJECT];
-extern uint16 globalVars[NUM_MAX_OBJECTDATA + 1];
+extern uint16 globalVars[NUM_MAX_VAR];
 
 extern overlayHeadElement overlayHead;
 

Modified: scummvm/trunk/engines/cine/sound.cpp
===================================================================
--- scummvm/trunk/engines/cine/sound.cpp	2007-12-13 17:53:31 UTC (rev 29852)
+++ scummvm/trunk/engines/cine/sound.cpp	2007-12-13 19:07:10 UTC (rev 29853)
@@ -304,21 +304,17 @@
 	OPLWriteReg(_opl, 0xBD, _vibrato);
 	OPLWriteReg(_opl, 0x08, 0x40);
 
-	int i, j;
-	int oplRegs[] = { 0x60, 0x80, 0x20, 0xE0 };
+	static const int oplRegs[] = { 0x40, 0x60, 0x80, 0x20, 0xE0 };
 
-	for (i = 0; i < 18; ++i) {
-		OPLWriteReg(_opl, 0x40 | _operatorsTable[i], 0);
-	}
-	for (i = 0; i < 9; ++i) {
+	for (int i = 0; i < 9; ++i) {
 		OPLWriteReg(_opl, 0xB0 | i, 0);
 	}
-	for (i = 0; i < 9; ++i) {
+	for (int i = 0; i < 9; ++i) {
 		OPLWriteReg(_opl, 0xC0 | i, 0);
 	}
 
-	for (j = 0; j < 4; j++) {
-		for (i = 0; i < 18; ++i) {
+	for (int j = 0; j < 5; j++) {
+		for (int i = 0; i < 18; ++i) {
 			OPLWriteReg(_opl, oplRegs[j] | _operatorsTable[i], 0);
 		}
 	}


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