[Scummvm-cvs-logs] CVS: scummvm newgui.cpp,1.15,1.16 newgui.h,1.10,1.11 gui.cpp,1.57,1.58 Makefile.common,1.10,1.11
Max Horn
fingolfin at users.sourceforge.net
Fri Jul 12 09:25:02 CEST 2002
- Previous message: [Scummvm-cvs-logs] CVS: scummvm insane.cpp,1.42,1.43
- Next message: [Scummvm-cvs-logs] CVS: scummvm/gui ScrollBarWidget.cpp,NONE,1.1 util.cpp,NONE,1.1 ScrollBarWidget.h,NONE,1.1 util.h,NONE,1.1 ListWidget.cpp,1.1,1.2 dialog.cpp,1.15,1.16 widget.cpp,1.13,1.14 ListWidget.h,1.2,1.3 dialog.h,1.7,1.8 widget.h,1.10,1.11
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/scummvm/scummvm
In directory usw-pr-cvs1:/tmp/cvs-serv27540
Modified Files:
newgui.cpp newgui.h gui.cpp Makefile.common
Log Message:
Countless changes to the New GUI; some hightligths: new ScrollBarWidget class; ListWidget is usable (demo shows it off); added custom String/StringList classes
Index: newgui.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/newgui.cpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- newgui.cpp 10 Jul 2002 22:49:41 -0000 1.15
+++ newgui.cpp 12 Jul 2002 16:24:11 -0000 1.16
@@ -23,65 +23,10 @@
#include "newgui.h"
#include "guimaps.h"
#include "gui/dialog.h"
-
-// 8-bit alpha blending routines
-int BlendCache[256][256];
-
-int RGBMatch(byte *palette, int r, int g, int b) {
- int i, bestidx = 0, besterr = 0xFFFFFF;
- int error = 0;
-
- for (i = 0;i < 256;i++) {
- byte *pal = palette + (i * 3);
- int r_diff = r - (int)*pal++;
- int g_diff = g - (int)*pal++;
- int b_diff = b - (int)*pal++;
- r_diff *= r_diff; g_diff *= g_diff; b_diff *= b_diff;
-
- error = r_diff + g_diff + b_diff;
- if (error < besterr) {
- besterr = error;
- bestidx = i;
- }
- }
- return bestidx;
-}
-
-int Blend(int src, int dst, byte *palette) {
- int r, g, b;
- int alpha = 128; // Level of transparency [0-256]
- byte *srcpal = palette + (dst * 3);
- byte *dstpal = palette + (src * 3);
-
- if (BlendCache[dst][src] > -1)
- return BlendCache[dst][src];
-
- r = (*srcpal++ * alpha);
- r += (*dstpal++ * (256-alpha));
- r /= 256;
-
- g = (*srcpal++ * alpha);
- g += (*dstpal++ * (256-alpha));
- g /= 256;
-
- b = (*srcpal++ * alpha);
- b += (*dstpal++ * (256-alpha));
- b /= 256;
-
- return (BlendCache[dst][src] = RGBMatch(palette, r , g , b ));
-}
-
-void ClearBlendCache(byte *palette, int weight) {
- for (int i = 0; i < 256; i++)
- for (int j = 0 ; j < 256 ; j++)
-// BlendCache[i][j] = i; // No alphablending
-// BlendCache[i][j] = j; // 100% translucent
- BlendCache[i][j] = -1; // Enable alphablending
-}
+#include "gui/util.h"
/*
* TODO list
- * - keep a copy of the original game background, for alpha/moving
* - implement the missing / incomplete dialogs
* - add more widgets
* - add support for right/center aligned text
@@ -352,6 +297,21 @@
while (h--) {
for (int i = 0; i < w; i++) {
ptr[i] = color;
+ }
+ ptr += 320;
+ }
+}
+
+void NewGui::checkerRect(int x, int y, int w, int h, byte color)
+{
+ byte *ptr = getBasePtr(x, y);
+ if (ptr == NULL)
+ return;
+
+ while (h--) {
+ for (int i = 0; i < w; i++) {
+ if ((h ^ i) & 1)
+ ptr[i] = color;
}
ptr += 320;
}
Index: newgui.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/newgui.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- newgui.h 10 Jul 2002 22:49:41 -0000 1.10
+++ newgui.h 12 Jul 2002 16:24:11 -0000 1.11
@@ -102,6 +102,7 @@
void line(int x, int y, int x2, int y2, byte color);
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 checkerRect(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);
Index: gui.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui.cpp,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -d -r1.57 -r1.58
--- gui.cpp 12 Jul 2002 10:31:45 -0000 1.57
+++ gui.cpp 12 Jul 2002 16:24:11 -0000 1.58
@@ -908,11 +908,12 @@
result = (char *)_s->getStringAddress(string);
- if (!result) // Gracelessly degrade to english :)
+ if (!result) { // Gracelessly degrade to english :)
if (_s->_features & GF_AFTER_V6)
return string_map_table_v6[stringno - 1].string;
else
return string_map_table_v5[stringno - 1].string;
+ }
return result;
}
Index: Makefile.common
===================================================================
RCS file: /cvsroot/scummvm/scummvm/Makefile.common,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- Makefile.common 10 Jul 2002 22:49:41 -0000 1.10
+++ Makefile.common 12 Jul 2002 16:24:11 -0000 1.11
@@ -6,7 +6,8 @@
INCS = scumm.h scummsys.h stdafx.h
-OBJS += gui/widget.o gui/dialog.o gui/ListWidget.o newgui.o \
+OBJS += gui/widget.o gui/dialog.o gui/util.o newgui.o \
+ gui/ListWidget.o gui/ScrollBarWidget.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 \
- Previous message: [Scummvm-cvs-logs] CVS: scummvm insane.cpp,1.42,1.43
- Next message: [Scummvm-cvs-logs] CVS: scummvm/gui ScrollBarWidget.cpp,NONE,1.1 util.cpp,NONE,1.1 ScrollBarWidget.h,NONE,1.1 util.h,NONE,1.1 ListWidget.cpp,1.1,1.2 dialog.cpp,1.15,1.16 widget.cpp,1.13,1.14 ListWidget.h,1.2,1.3 dialog.h,1.7,1.8 widget.h,1.10,1.11
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Scummvm-git-logs
mailing list