[Scummvm-cvs-logs] SF.net SVN: scummvm: [30138] scummvm/trunk/engines/lure
dreammaster at users.sourceforge.net
dreammaster at users.sourceforge.net
Wed Jan 2 04:36:23 CET 2008
Revision: 30138
http://scummvm.svn.sourceforge.net/scummvm/?rev=30138&view=rev
Author: dreammaster
Date: 2008-01-01 19:36:19 -0800 (Tue, 01 Jan 2008)
Log Message:
-----------
Room backgrounds now display in EGA mode
Modified Paths:
--------------
scummvm/trunk/engines/lure/room.cpp
scummvm/trunk/engines/lure/room.h
scummvm/trunk/engines/lure/surface.cpp
scummvm/trunk/engines/lure/surface.h
Modified: scummvm/trunk/engines/lure/room.cpp
===================================================================
--- scummvm/trunk/engines/lure/room.cpp 2008-01-02 00:48:18 UTC (rev 30137)
+++ scummvm/trunk/engines/lure/room.cpp 2008-01-02 03:36:19 UTC (rev 30138)
@@ -37,7 +37,7 @@
RoomLayer::RoomLayer(uint16 screenId, bool backgroundLayer):
Surface(FULL_SCREEN_WIDTH, FULL_SCREEN_HEIGHT) {
- loadScreen(screenId);
+ Disk &disk = Disk::getReference();
byte *screenData = data().data();
int cellY;
int cellIndex = 0;
@@ -45,6 +45,27 @@
// Reset all the cells to unused
Common::set_to((uint8 *) _cells, (uint8 *) _cells + GRID_SIZE, 0xff);
+ // Load up the screen data
+ MemoryBlock *rawData = disk.getEntry(screenId);
+ loadScreen(rawData);
+
+ uint16 v = READ_BE_UINT16(rawData->data());
+ bool is5Bit = (v & 0xfffe) == 0x140;
+ delete rawData;
+
+ _paletteId = (screenId & 0xffe0) - 1;
+ if (is5Bit) {
+ uint16 roomNumber = Room::getReference().roomNumber();
+
+ if (roomNumber == 6)
+ _paletteId = 0x45ff;
+ else if (roomNumber == 49)
+ _paletteId = 0xf1ff;
+ else {
+ _paletteId = 0x40ff;
+ }
+ }
+
// Loop through each cell of the screen
for (cellY = 0; cellY < NUM_VERT_RECTS; ++cellY) {
for (int cellX = 0; cellX < NUM_HORIZ_RECTS; ++cellX) {
@@ -522,6 +543,7 @@
Resources &res = Resources::getReference();
Game &game = Game::getReference();
Mouse &mouse = Mouse::getReference();
+ bool isEGA = LureEngine::getReference().isEGA();
mouse.pushCursorNum(CURSOR_DISK);
@@ -560,7 +582,6 @@
_numLayers = _roomData->numLayers;
if (showOverlay) ++_numLayers;
- uint16 paletteId = (_roomData->layers[0] & 0xffe0) - 1;
for (uint8 layerNum = 0; layerNum < _numLayers; ++layerNum)
_layers[layerNum] = new RoomLayer(_roomData->layers[layerNum],
layerNum == 0);
@@ -569,11 +590,15 @@
layersPostProcess();
// Generate the palette for the room that will be faded in
- //Palette p(MAIN_PALETTE_SIZE, NULL, RGB64);
- Palette p(GAME_PALETTE_RESOURCE_ID);
- Palette tempPalette(paletteId);
- p.copyFrom(&tempPalette);
- res.insertPaletteSubset(p);
+ Palette *p;
+ if (isEGA) {
+ p = new Palette(_layers[0]->paletteId());
+ } else {
+ p = new Palette(GAME_PALETTE_RESOURCE_ID);
+ Palette tempPalette(_layers[0]->paletteId());
+ p->copyFrom(&tempPalette);
+ res.insertPaletteSubset(*p);
+ }
// Set the new room number
res.fieldList().setField(ROOM_NUMBER, newRoomNumber);
@@ -603,11 +628,12 @@
_screen.update();
if (fadeFlag)
- _screen.paletteFadeIn(&p);
+ _screen.paletteFadeIn(p);
else
- _screen.setPalette(&p);
+ _screen.setPalette(p);
mouse.popCursor();
+ delete p;
}
// checkCursor
Modified: scummvm/trunk/engines/lure/room.h
===================================================================
--- scummvm/trunk/engines/lure/room.h 2008-01-02 00:48:18 UTC (rev 30137)
+++ scummvm/trunk/engines/lure/room.h 2008-01-02 03:36:19 UTC (rev 30138)
@@ -48,6 +48,7 @@
class RoomLayer: public Surface {
private:
byte _cells[FULL_VERT_RECTS][FULL_HORIZ_RECTS];
+ uint16 _paletteId;
public:
RoomLayer(uint16 screenId, bool backgroundLayer);
bool isOccupied(byte cellX, byte cellY) {
@@ -59,6 +60,7 @@
void setCell(byte cellX, byte cellY, byte value) {
_cells[cellY][cellX] = value;
}
+ uint16 paletteId() { return _paletteId; }
};
enum CursorState {CS_NONE, CS_ACTION, CS_SEQUENCE, CS_TALKING, CS_BUMPED};
Modified: scummvm/trunk/engines/lure/surface.cpp
===================================================================
--- scummvm/trunk/engines/lure/surface.cpp 2008-01-02 00:48:18 UTC (rev 30137)
+++ scummvm/trunk/engines/lure/surface.cpp 2008-01-02 03:36:19 UTC (rev 30138)
@@ -106,14 +106,26 @@
void Surface::loadScreen(uint16 resourceId) {
MemoryBlock *rawData = Disk::getReference().getEntry(resourceId);
+ loadScreen(rawData);
+ delete rawData;
+}
+
+void Surface::loadScreen(MemoryBlock *rawData) {
PictureDecoder decoder;
- MemoryBlock *tmpScreen = decoder.decode(rawData, FULL_SCREEN_HEIGHT * FULL_SCREEN_WIDTH + 1);
- delete rawData;
+ uint16 v = READ_BE_UINT16(rawData->data());
+ bool is5Bit = (v & 0xfffe) == 0x140;
+ MemoryBlock *tmpScreen;
+
+ if (is5Bit)
+ // 5-bit decompression
+ tmpScreen = decoder.egaDecode(rawData, FULL_SCREEN_HEIGHT * FULL_SCREEN_WIDTH + 1);
+ else
+ // VGA decompression
+ tmpScreen = decoder.vgaDecode(rawData, FULL_SCREEN_HEIGHT * FULL_SCREEN_WIDTH + 1);
+
empty();
-
_data->copyFrom(tmpScreen, 0, MENUBAR_Y_SIZE * FULL_SCREEN_WIDTH,
(FULL_SCREEN_HEIGHT - MENUBAR_Y_SIZE) * FULL_SCREEN_WIDTH);
-
delete tmpScreen;
}
Modified: scummvm/trunk/engines/lure/surface.h
===================================================================
--- scummvm/trunk/engines/lure/surface.h 2008-01-02 00:48:18 UTC (rev 30137)
+++ scummvm/trunk/engines/lure/surface.h 2008-01-02 03:36:19 UTC (rev 30138)
@@ -52,6 +52,7 @@
MemoryBlock &data() { return *_data; }
void loadScreen(uint16 resourceId);
+ void loadScreen(MemoryBlock *data);
int writeChar(uint16 x, uint16 y, uint8 ascii, bool transparent, uint8 colour);
void writeString(uint16 x, uint16 y, Common::String line, bool transparent,
uint8 colour = DIALOG_TEXT_COLOUR, bool varLength = true);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list