[Scummvm-cvs-logs] CVS: scummvm/queen display.h,1.1,1.2 display.cpp,1.1,1.2 logic.cpp,1.45,1.46
Gregory Montoir
cyx at users.sourceforge.net
Thu Oct 16 12:03:04 CEST 2003
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/queen talk.cpp,1.11,1.12 talk.h,1.9,1.10
- Next message: [Scummvm-cvs-logs] CVS: scummvm/queen cutaway.cpp,1.24,1.25 display.cpp,1.2,1.3 logic.h,1.33,1.34 queen.cpp,1.10,1.11 queen.h,1.7,1.8 resource.cpp,1.14,1.15 structs.h,1.11,1.12 xref.txt,1.7,1.8
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/scummvm/scummvm/queen
In directory sc8-pr-cvs1:/tmp/cvs-serv12687
Modified Files:
display.h display.cpp logic.cpp
Log Message:
modified/fixed palette code
Index: display.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/display.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- display.h 16 Oct 2003 13:54:48 -0000 1.1
+++ display.h 16 Oct 2003 18:57:55 -0000 1.2
@@ -62,9 +62,10 @@
void dynalumInit(Resource *resource, const char *roomName, uint16 roomNum);
void dynalumUpdate(int x, int y);
- void palSetRoom(const uint8 *pal, int start, int end);
- void palFadeIn(uint8 start, uint8 end, uint16 roomNum);
- void palFadeOut(uint8 start, uint8 end, uint16 roomNum);
+ void palConvert(uint8 *outPal, const uint8 *inPal, int start, int end);
+ void palSet(const uint8 *pal, int start, int end);
+ void palFadeIn(int start, int end, uint16 roomNum);
+ void palFadeOut(int start, int end, uint16 roomNum);
void palFadePanel();
void palCustomColors(uint16 roomNum); // check_colors
void palCustomScroll(uint16 roomNum); // check_pal_scroll
@@ -91,6 +92,10 @@
private:
+ enum {
+ FADE_SPEED = 16
+ };
+
enum BufferDimension {
BACKDROP_W = 640,
BACKDROP_H = 200,
@@ -103,9 +108,10 @@
TextRenderer _textRenderer;
struct {
- uint8 *screen;
uint8 *room;
+ uint8 *screen;
int dirtyMin, dirtyMax;
+ bool scrollable;
} _pals;
uint8 *_buffers[3];
Index: display.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/display.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- display.cpp 16 Oct 2003 13:54:48 -0000 1.1
+++ display.cpp 16 Oct 2003 18:57:56 -0000 1.2
@@ -19,6 +19,7 @@
*
*/
+#include "stdafx.h"
#include "queen/display.h"
#include "queen/defs.h"
#include "queen/resource.h"
@@ -114,11 +115,12 @@
_bufPitch[RB_SCREEN] = SCREEN_W;
_pals.room = new uint8[ 256 * 3 ];
- _pals.screen = new uint8[ 256 * 4 ];
+ _pals.screen = new uint8[ 256 * 3 ];
memset(_pals.room, 0, 256 * 3);
- memset(_pals.screen, 0, 256 * 4);
+ memset(_pals.screen, 0, 256 * 3);
_pals.dirtyMin = 0;
_pals.dirtyMax = 255;
+ _pals.scrollable = true;
_horizontalScroll = 0;
}
@@ -174,38 +176,56 @@
else if (c > 255) {
c = 255;
}
- _pals.screen[i * 4 + j] = (uint8)c;
+ _pals.screen[i * 3 + j] = (uint8)c;
}
}
_pals.dirtyMin = MIN(_pals.dirtyMin, 144);
- _pals.dirtyMax = MAX(_pals.dirtyMax, 160);
+ _pals.dirtyMax = MAX(_pals.dirtyMax, 159);
_dynalum.prevColMask = colMask;
}
}
-void Display::palSetRoom(const uint8 *pal, int start, int end) {
+void Display::palConvert(uint8 *outPal, const uint8 *inPal, int start, int end) {
int i;
- pal += start * 3;
- for (i = start; i < end; ++i, pal += 3) {
- _pals.screen[i << 2 | 0] = _pals.room[i * 3 + 0] = *(pal + 0);
- _pals.screen[i << 2 | 1] = _pals.room[i * 3 + 1] = *(pal + 1);
- _pals.screen[i << 2 | 2] = _pals.room[i * 3 + 2] = *(pal + 2);
- _pals.screen[i << 2 | 3] = 0;
+ for (i = start; i <= end; i++) {
+ outPal[4 * i + 0] = inPal[3 * i + 0];
+ outPal[4 * i + 1] = inPal[3 * i + 1];
+ outPal[4 * i + 2] = inPal[3 * i + 2];
+ outPal[4 * i + 3] = 0;
}
- _pals.dirtyMin = MIN(_pals.dirtyMin, start);
- _pals.dirtyMax = MAX(_pals.dirtyMax, end);
}
-void Display::palFadeIn(uint8 start, uint8 end, uint16 roomNum) {
- warning("Display::palFadeIn() unimplemented");
+void Display::palSet(const uint8 *pal, int start, int end) {
+
+ debug(9, "Display::palSet(%d, %d)", start, end);
+ uint8 tempPal[256 * 4];
+ palConvert(tempPal, _pals.screen, start, end);
+ _system->set_palette(tempPal + start * 4, start, end - start + 1);
}
-void Display::palFadeOut(uint8 start, uint8 end, uint16 roomNum) {
- warning("Display::palFadeOut() unimplemented");
+void Display::palFadeIn(int start, int end, uint16 roomNum) {
+
+ debug(9, "Display::palFadeIn(%d, %d)", start, end);
+ // FIXME: unfinished
+ memcpy(_pals.screen + start * 3, _pals.room + start * 3, (end - start + 1) * 3);
+ palSet(_pals.screen, start, end);
+ _pals.dirtyMin = start;
+ _pals.dirtyMax = end;
+ _pals.scrollable = true;
+}
+
+
+void Display::palFadeOut(int start, int end, uint16 roomNum) {
+
+ debug(9, "Display::palFadeOut(%d, %d)", start, end);
+ // FIXME: unfinished
+ memset(_pals.screen + start * 3, 0, (end - start + 1) * 3);
+ palSet(_pals.screen, start, end);
+ _pals.scrollable = false;
}
@@ -274,12 +294,10 @@
if (dynalum) {
dynalumUpdate(dynaX, dynaY);
}
-
- if (_pals.dirtyMin != 144 || _pals.dirtyMax != 145) {
- const uint8 *p = _pals.screen + 4 * _pals.dirtyMin;
- _system->set_palette(p, _pals.dirtyMin, _pals.dirtyMax);
+ if (_pals.dirtyMin != 144 || _pals.dirtyMax != 144) {
+ palSet(_pals.screen, _pals.dirtyMin, _pals.dirtyMax);
_pals.dirtyMin = 144;
- _pals.dirtyMax = 145;
+ _pals.dirtyMax = 144;
}
_system->copy_rect(_buffers[RB_SCREEN], _bufPitch[RB_SCREEN], 0, 0, SCREEN_W, SCREEN_H);
_system->update_screen();
@@ -364,7 +382,7 @@
_bdWidth = READ_LE_UINT16(pcxBuf + 12);
_bdHeight = READ_LE_UINT16(pcxBuf + 14);
pcxRead(_buffers[RB_BACKDROP], _bufPitch[RB_BACKDROP], pcxBuf + 128, _bdWidth, _bdHeight);
- palSetRoom(pcxBuf + size - 768, 0, useFullPal ? 256 : 144);
+ memcpy(_pals.room, pcxBuf + size - 768, useFullPal ? 256 * 3 : 144 * 3);
}
@@ -372,12 +390,13 @@
uint8 *dst = _buffers[RB_PANEL] + PANEL_W * 10;
pcxRead(dst, PANEL_W, pcxBuf + 128, PANEL_W, PANEL_H - 10);
- palSetRoom(pcxBuf + size - 768, 144, 256);
+ memcpy(_pals.room + 144 * 3, pcxBuf + size - 768 + 144 * 3, (256 - 144) * 3);
}
void Display::textDraw(uint16 x, uint16 y, uint8 color, const char *text, bool outlined) {
+ debug(9, "Display::textDraw(%s)", text);
_textRenderer.drawString(_buffers[RB_SCREEN], _bufPitch[RB_SCREEN], x, y, color, text, outlined);
}
Index: logic.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/logic.cpp,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -d -r1.45 -r1.46
--- logic.cpp 16 Oct 2003 16:58:30 -0000 1.45
+++ logic.cpp 16 Oct 2003 18:57:56 -0000 1.46
@@ -1147,15 +1147,17 @@
if (mode != RDM_FADE_NOJOE) {
pod = joeSetupInRoom(mode != RDM_FADE_JOE_XY, scale);
}
- if (mode != RDM_NOFADE_JOE) {
+ // FIXME: commented for now, to avoid color glitches when
+ // switching rooms during cutaway
+// if (mode != RDM_NOFADE_JOE) {
_graphics->update();
if (_currentRoom >= 114) {
_display->palFadeIn(0, 255, _currentRoom);
}
else {
- _display->palFadeOut(0, 223, _currentRoom);
+ _display->palFadeIn(0, 223, _currentRoom);
}
- }
+// }
if (pod != NULL) {
_walk->joeMove(0, pod->x, pod->y, inCutaway);
}
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/queen talk.cpp,1.11,1.12 talk.h,1.9,1.10
- Next message: [Scummvm-cvs-logs] CVS: scummvm/queen cutaway.cpp,1.24,1.25 display.cpp,1.2,1.3 logic.h,1.33,1.34 queen.cpp,1.10,1.11 queen.h,1.7,1.8 resource.cpp,1.14,1.15 structs.h,1.11,1.12 xref.txt,1.7,1.8
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Scummvm-git-logs
mailing list