[Scummvm-cvs-logs] CVS: scummvm/saga animation.cpp,1.66,1.67 events.cpp,1.67,1.68 gfx.cpp,1.62,1.63 gfx.h,1.39,1.40 scene.cpp,1.148,1.149
Eugene Sandulenko
sev at users.sourceforge.net
Tue Oct 4 18:42:02 CEST 2005
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/saga animation.cpp,1.65,1.66 events.cpp,1.66,1.67 gfx.cpp,1.61,1.62 gfx.h,1.38,1.39 resnames.h,1.36,1.37 saga.cpp,1.136,1.137 scene.cpp,1.147,1.148
- Next message: [Scummvm-cvs-logs] CVS: scummvm/saga gfx.cpp,1.63,1.64
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/scummvm/scummvm/saga
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25613
Modified Files:
animation.cpp events.cpp gfx.cpp gfx.h scene.cpp
Log Message:
Simplified palette code.
Index: animation.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/animation.cpp,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -d -r1.66 -r1.67
--- animation.cpp 5 Oct 2005 01:31:46 -0000 1.66
+++ animation.cpp 5 Oct 2005 01:40:55 -0000 1.67
@@ -114,7 +114,7 @@
const Rect rect(width, height);
bgSurface->blit(rect, buf);
- _vm->_gfx->setPalette(palette, 0, 248);
+ _vm->_gfx->setPalette(palette);
free(buf);
free(resourceData);
Index: events.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/events.cpp,v
retrieving revision 1.67
retrieving revision 1.68
diff -u -d -r1.67 -r1.68
--- events.cpp 5 Oct 2005 01:31:46 -0000 1.67
+++ events.cpp 5 Oct 2005 01:40:55 -0000 1.68
@@ -149,17 +149,11 @@
case kPalEvent:
switch (event->op) {
case kEventBlackToPal:
- if (_vm->getGameType() == GType_IHNM)
- _vm->_gfx->blackToPal((PalEntry *)event->data, event_pc, 0, 248);
- else
- _vm->_gfx->blackToPal((PalEntry *)event->data, event_pc);
+ _vm->_gfx->blackToPal((PalEntry *)event->data, event_pc);
break;
case kEventPalToBlack:
- if (_vm->getGameType() == GType_IHNM)
- _vm->_gfx->palToBlack((PalEntry *)event->data, event_pc, 0, 248);
- else
- _vm->_gfx->palToBlack((PalEntry *)event->data, event_pc);
+ _vm->_gfx->palToBlack((PalEntry *)event->data, event_pc);
break;
default:
break;
@@ -238,17 +232,11 @@
case kPalEvent:
switch (event->op) {
case kEventBlackToPal:
- if (_vm->getGameType() == GType_IHNM)
- _vm->_gfx->blackToPal((PalEntry *)event->data, event_pc, 0, 248);
- else
- _vm->_gfx->blackToPal((PalEntry *)event->data, event_pc);
+ _vm->_gfx->blackToPal((PalEntry *)event->data, event_pc);
break;
case kEventPalToBlack:
- if (_vm->getGameType() == GType_IHNM)
- _vm->_gfx->palToBlack((PalEntry *)event->data, event_pc, 0, 248);
- else
- _vm->_gfx->palToBlack((PalEntry *)event->data, event_pc);
+ _vm->_gfx->palToBlack((PalEntry *)event->data, event_pc);
break;
default:
break;
@@ -344,10 +332,7 @@
if (event->param == kEvPSetPalette) {
PalEntry *palPointer;
_vm->_scene->getBGPal(palPointer);
- if (_vm->getGameType() == GType_IHNM)
- _vm->_gfx->setPalette(palPointer, 0, 248);
- else
- _vm->_gfx->setPalette(palPointer);
+ _vm->_gfx->setPalette(palPointer);
}
}
}
Index: gfx.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/gfx.cpp,v
retrieving revision 1.62
retrieving revision 1.63
diff -u -d -r1.62 -r1.63
--- gfx.cpp 5 Oct 2005 01:31:46 -0000 1.62
+++ gfx.cpp 5 Oct 2005 01:40:55 -0000 1.63
@@ -191,12 +191,21 @@
free(resourcePointer);
- setPalette(_globalPalette, 0, 256);
+ setPalette(_globalPalette, true);
}
-void Gfx::setPalette(const PalEntry *pal, int from, int numcolors) {
+void Gfx::setPalette(const PalEntry *pal, bool full) {
int i;
byte *ppal;
+ int from, numcolors;
+
+ if (_vm->getGameType() != GType_IHNM || full) {
+ from = 0;
+ numcolors = PAL_ENTRIES;
+ } else {
+ from = 0;
+ numcolors = 248;
+ }
for (i = 0, ppal = &_currentPal[from * 4]; i < numcolors; i++, ppal += 4) {
ppal[0] = _globalPalette[i].red = pal[i].red;
@@ -250,15 +259,24 @@
}
}
-void Gfx::palToBlack(PalEntry *srcPal, double percent, int from, int numcolors) {
+void Gfx::palToBlack(PalEntry *srcPal, double percent) {
int i;
//int fade_max = 255;
int new_entry;
byte *ppal;
PalEntry *palE;
+ int from, numcolors;
double fpercent;
+ if (_vm->getGameType() != GType_IHNM) {
+ from = 0;
+ numcolors = PAL_ENTRIES;
+ } else {
+ from = 0;
+ numcolors = 248;
+ }
+
if (percent > 1.0) {
percent = 1.0;
}
@@ -308,12 +326,21 @@
_system->setPalette(_currentPal, 0, PAL_ENTRIES);
}
-void Gfx::blackToPal(PalEntry *srcPal, double percent, int from, int numcolors) {
+void Gfx::blackToPal(PalEntry *srcPal, double percent) {
int new_entry;
double fpercent;
byte *ppal;
int i;
PalEntry *palE;
+ int from, numcolors;
+
+ if (_vm->getGameType() != GType_IHNM) {
+ from = 0;
+ numcolors = PAL_ENTRIES;
+ } else {
+ from = 0;
+ numcolors = 248;
+ }
if (percent > 1.0) {
percent = 1.0;
Index: gfx.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/gfx.h,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -d -r1.39 -r1.40
--- gfx.h 5 Oct 2005 01:31:46 -0000 1.39
+++ gfx.h 5 Oct 2005 01:40:55 -0000 1.40
@@ -135,11 +135,11 @@
}
void initPalette();
- void setPalette(const PalEntry *pal, int from = 0, int numcolors = PAL_ENTRIES);
+ void setPalette(const PalEntry *pal, bool full = false);
void setPaletteColor(int n, int r, int g, int b);
void getCurrentPal(PalEntry *src_pal);
- void palToBlack(PalEntry *src_pal, double percent, int from = 0, int numcolors = PAL_ENTRIES);
- void blackToPal(PalEntry *src_pal, double percent, int from = 0, int numcolors = PAL_ENTRIES);
+ void palToBlack(PalEntry *src_pal, double percent);
+ void blackToPal(PalEntry *src_pal, double percent);
void updateCursor() { setCursor(); }
void showCursor(bool state);
Index: scene.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/scene.cpp,v
retrieving revision 1.148
retrieving revision 1.149
diff -u -d -r1.148 -r1.149
--- scene.cpp 5 Oct 2005 01:31:46 -0000 1.148
+++ scene.cpp 5 Oct 2005 01:40:55 -0000 1.149
@@ -447,10 +447,7 @@
cPal[j].blue = *pal++;
}
free(colors);
- if (_vm->getGameType() == GType_IHNM)
- _vm->_gfx->setPalette(cPal, 0, 248);
- else
- _vm->_gfx->setPalette(cPal);
+ _vm->_gfx->setPalette(cPal);
}
@@ -1135,10 +1132,7 @@
pal[c].green = *palPtr++;
pal[c].blue = *palPtr++;
}
- if (_vm->getGameType() == GType_IHNM)
- _vm->_gfx->setPalette(pal, 0, 248);
- else
- _vm->_gfx->setPalette(pal);
+ _vm->_gfx->setPalette(pal);
}
break;
default:
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/saga animation.cpp,1.65,1.66 events.cpp,1.66,1.67 gfx.cpp,1.61,1.62 gfx.h,1.38,1.39 resnames.h,1.36,1.37 saga.cpp,1.136,1.137 scene.cpp,1.147,1.148
- Next message: [Scummvm-cvs-logs] CVS: scummvm/saga gfx.cpp,1.63,1.64
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Scummvm-git-logs
mailing list