[Scummvm-cvs-logs] CVS: scummvm newgui.cpp,1.14,1.15 newgui.h,1.9,1.10 Makefile.common,1.9,1.10 scummvm.cpp,1.169,1.170

Max Horn fingolfin at users.sourceforge.net
Wed Jul 10 15:50:10 CEST 2002


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

Modified Files:
	newgui.cpp newgui.h Makefile.common scummvm.cpp 
Log Message:
added prototype ListWidget (doesn't do anything yet, only serves to demo how it might look); renamed various NewGui methods and added frameRect method; made NewGui use our 'own' GUI colors (no worries if you don't like them, this is just an experiment); StaticTextWidget now clones its label (preventing problems when a game was loaded, thus invalidating string locations in memory)

Index: newgui.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/newgui.cpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- newgui.cpp	10 Jul 2002 16:49:44 -0000	1.14
+++ newgui.cpp	10 Jul 2002 22:49:41 -0000	1.15
@@ -24,9 +24,6 @@
 #include "guimaps.h"
 #include "gui/dialog.h"
 
-#define hline(x, y, x2, color) line(x, y, x2, y, color);
-#define vline(x, y, y2, color) line(x, y, x, y2, color);
-
 // 8-bit alpha blending routines
 int BlendCache[256][256];
 
@@ -51,7 +48,7 @@
 }
 
 int Blend(int src, int dst, byte *palette) {
-	int r, g, b, idx;
+	int r, g, b;
 	int alpha = 128;	// Level of transparency [0-256]
 	byte *srcpal = palette + (dst  * 3);
 	byte *dstpal = palette + (src * 3);
@@ -138,6 +135,18 @@
 		saveState();
 		if (_use_alpha_blending)
 			activeDialog->setupScreenBuf();
+#if 1
+	// FIXME - hack to encode our own custom GUI colors. Since we have to live
+	// with a given 8 bit palette, the result is not always as nice as one
+	// would wish, but this is just an experiment after all.
+	_bgcolor = RGBMatch(_s->_currentPalette, 0, 0, 0);
+
+	_color = RGBMatch(_s->_currentPalette, 80, 80, 80);
+	_shadowcolor = RGBMatch(_s->_currentPalette, 64, 64, 64);
+
+	_textcolor = RGBMatch(_s->_currentPalette, 32, 192, 32);
+	_textcolorhi = RGBMatch(_s->_currentPalette, 0, 256, 0);
+#endif
 		_prepare_for_gui = false;
 	}
 	
@@ -320,7 +329,7 @@
 	}
 }
 
-void NewGui::blendArea(int x, int y, int w, int h, byte color)
+void NewGui::blendRect(int x, int y, int w, int h, byte color)
 {
 	byte *ptr = getBasePtr(x, y);
 	if (ptr == NULL)
@@ -334,7 +343,7 @@
 	}
 }
 
-void NewGui::fillArea(int x, int y, int w, int h, byte color)
+void NewGui::fillRect(int x, int y, int w, int h, byte color)
 {
 	byte *ptr = getBasePtr(x, y);
 	if (ptr == NULL)
@@ -348,7 +357,28 @@
 	}
 }
 
-void NewGui::setAreaDirty(int x, int y, int w, int h)
+void NewGui::frameRect(int x, int y, int w, int h, byte color)
+{
+	int i;
+	byte *ptr, *basePtr = getBasePtr(x, y);
+	if (basePtr == NULL)
+		return;
+
+	ptr = basePtr;
+	for (i = 0; i < w; i++, ptr++)
+		*ptr = color;
+	ptr--;
+	for (i = 0; i < h; i++, ptr += 320)
+		*ptr = color;
+	ptr = basePtr;
+	for (i = 0; i < h; i++, ptr += 320)
+		*ptr = color;
+	ptr -= 320;
+	for (i = 0; i < w; i++, ptr++)
+		*ptr = color;
+}
+
+void NewGui::addDirtyRect(int x, int y, int w, int h)
 {
 	VirtScreen *vs = _s->findVirtScreen(y);
 

Index: newgui.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/newgui.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- newgui.h	10 Jul 2002 16:49:45 -0000	1.9
+++ newgui.h	10 Jul 2002 22:49:41 -0000	1.10
@@ -26,6 +26,9 @@
 class Dialog;
 class Scumm;
 
+#define hline(x, y, x2, color) line(x, y, x2, y, color);
+#define vline(x, y, y2, color) line(x, y, x, y2, color);
+
 // Extremly simple stack class, doesn't even do any error checking (for now)
 class DialogStack {
 protected:
@@ -97,9 +100,10 @@
 	byte *getBasePtr(int x, int y);
 	void box(int x, int y, int width, int height);
 	void line(int x, int y, int x2, int y2, byte color);
-	void blendArea(int x, int y, int w, int h, byte color);
-	void fillArea(int x, int y, int w, int h, byte color);
-	void setAreaDirty(int x, int y, int w, int h);
+	void blendRect(int x, int y, int w, int h, byte color);
+	void fillRect(int x, int y, int w, int h, byte color);
+	void frameRect(int x, int y, int w, int h, byte color);
+	void addDirtyRect(int x, int y, int w, int h);
 	void drawChar(const char c, int x, int y);
 	void drawString(const char *str, int x, int y, int w, byte color);
 

Index: Makefile.common
===================================================================
RCS file: /cvsroot/scummvm/scummvm/Makefile.common,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- Makefile.common	9 Jul 2002 14:31:00 -0000	1.9
+++ Makefile.common	10 Jul 2002 22:49:41 -0000	1.10
@@ -6,7 +6,7 @@
 
 INCS	= scumm.h scummsys.h stdafx.h
 
-OBJS	+= gui/widget.o gui/dialog.o newgui.o \
+OBJS	+= gui/widget.o gui/dialog.o gui/ListWidget.o newgui.o \
 	actor.o boxes.o costume.o gfx.o object.o resource.o \
 	saveload.o script.o scummvm.o sound.o string.o \
 	sys.o verbs.o script_v1.o script_v2.o debug.o gui.o \

Index: scummvm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scummvm.cpp,v
retrieving revision 1.169
retrieving revision 1.170
diff -u -d -r1.169 -r1.170
--- scummvm.cpp	8 Jul 2002 00:10:11 -0000	1.169
+++ scummvm.cpp	10 Jul 2002 22:49:41 -0000	1.170
@@ -1549,10 +1549,17 @@
 
 	/* FIXME: strange IF line? */
 	if (_gameId && !(_features & GF_SMALL_HEADER)	&& !(_features & GF_AFTER_V7)) {
-		_newgui->_bgcolor = _gui->_bgcolor = getDefaultGUIColor(0);
-		_newgui->_color = _gui->_color = getDefaultGUIColor(1);
-		_newgui->_textcolor = _gui->_textcolor = getDefaultGUIColor(2);
-		_newgui->_textcolorhi = _gui->_textcolorhi = getDefaultGUIColor(6);
-		_newgui->_shadowcolor = _gui->_shadowcolor = getDefaultGUIColor(8);
+		_gui->_bgcolor = getDefaultGUIColor(0);
+		_gui->_color = getDefaultGUIColor(1);
+		_gui->_textcolor = getDefaultGUIColor(2);
+		_gui->_textcolorhi = getDefaultGUIColor(6);
+		_gui->_shadowcolor = getDefaultGUIColor(8);
+#if 0
+		_newgui->_bgcolor = getDefaultGUIColor(0);
+		_newgui->_color = getDefaultGUIColor(1);
+		_newgui->_textcolor = getDefaultGUIColor(2);
+		_newgui->_textcolorhi = getDefaultGUIColor(6);
+		_newgui->_shadowcolor = getDefaultGUIColor(8);
+#endif
 	}
 }





More information about the Scummvm-git-logs mailing list