[Scummvm-cvs-logs] CVS: scummvm/common util.cpp,1.4,1.5

Max Horn fingolfin at users.sourceforge.net
Mon Sep 16 03:43:02 CEST 2002


Update of /cvsroot/scummvm/scummvm/common
In directory usw-pr-cvs1:/tmp/cvs-serv25324/common

Modified Files:
	util.cpp 
Log Message:
added some comments, cleanup

Index: util.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/common/util.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- util.cpp	15 Sep 2002 09:06:02 -0000	1.4
+++ util.cpp	16 Sep 2002 10:42:12 -0000	1.5
@@ -21,9 +21,15 @@
 #include "stdafx.h"
 #include "util.h"
 
+//
 // 8-bit alpha blending routines
-int BlendCache[256][256];
+//
+static int BlendCache[256][256];
 
+//
+// Find the entry in the given palette which matches the color defined by
+// the tripel (r,b,g) most closely.
+//
 int RGBMatch(byte *palette, int r, int g, int b)
 {
 	int i, bestidx = 0, besterr = 0xFFFFFF;
@@ -45,6 +51,9 @@
 	return bestidx;
 }
 
+//
+// Blend two 8 bit colors into a third, all colors being defined by palette indices.
+//
 int Blend(int src, int dst, byte *palette)
 {
 	int r, g, b;
@@ -70,6 +79,9 @@
 	return (BlendCache[dst][src] = RGBMatch(palette, r , g , b ));
 }
 
+//
+// Reset the blending cache
+//
 void ClearBlendCache(byte *palette, int weight)
 {
 	for (int i = 0; i < 256; i++)
@@ -80,9 +92,9 @@
 }
 
 
-/*
- * Print hexdump of the data passed in, 8 bytes a row
- */
+//
+// Print hexdump of the data passed in, 8 bytes a row
+//
 void hexdump(const byte * data, int len)
 {
 	int i;
@@ -121,7 +133,12 @@
 	printf("|\n");
 }
 
-// Resource string length, supports special chars starting with FF
+//
+// Given a pointer to a Scumm resource, this function returns the length
+// of the (string) data in that resource. To do so it understands certain
+// special chars starting with FF. The reason for this function is that
+// sometimes resource data will contain 0 bytes, thus we can't just use strlen.
+//
 int resStrLen(const char *src)
 {
 	int num = 0;





More information about the Scummvm-git-logs mailing list