aboutsummaryrefslogtreecommitdiff
path: root/engines/lure
diff options
context:
space:
mode:
authorPaul Gilbert2008-01-02 03:36:19 +0000
committerPaul Gilbert2008-01-02 03:36:19 +0000
commitb2d2bd6f2d4e33ffe545046540a386253d43f8b3 (patch)
tree05bacdb4662f4461fbc95f2f8a1c530f75db6eed /engines/lure
parent9db76278efd93a6aec7cea7ce1c59fa993c332e0 (diff)
downloadscummvm-rg350-b2d2bd6f2d4e33ffe545046540a386253d43f8b3.tar.gz
scummvm-rg350-b2d2bd6f2d4e33ffe545046540a386253d43f8b3.tar.bz2
scummvm-rg350-b2d2bd6f2d4e33ffe545046540a386253d43f8b3.zip
Room backgrounds now display in EGA mode
svn-id: r30138
Diffstat (limited to 'engines/lure')
-rw-r--r--engines/lure/room.cpp44
-rw-r--r--engines/lure/room.h2
-rw-r--r--engines/lure/surface.cpp20
-rw-r--r--engines/lure/surface.h1
4 files changed, 54 insertions, 13 deletions
diff --git a/engines/lure/room.cpp b/engines/lure/room.cpp
index 6576420f24..1252879659 100644
--- a/engines/lure/room.cpp
+++ b/engines/lure/room.cpp
@@ -37,7 +37,7 @@ static Room *int_room;
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 @@ RoomLayer::RoomLayer(uint16 screenId, bool backgroundLayer):
// 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 @@ void Room::setRoomNumber(uint16 newRoomNumber, bool showOverlay) {
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 @@ void Room::setRoomNumber(uint16 newRoomNumber, bool showOverlay) {
_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 @@ void Room::setRoomNumber(uint16 newRoomNumber, bool showOverlay) {
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 @@ void Room::setRoomNumber(uint16 newRoomNumber, bool showOverlay) {
_screen.update();
if (fadeFlag)
- _screen.paletteFadeIn(&p);
+ _screen.paletteFadeIn(p);
else
- _screen.setPalette(&p);
+ _screen.setPalette(p);
mouse.popCursor();
+ delete p;
}
// checkCursor
diff --git a/engines/lure/room.h b/engines/lure/room.h
index e208698a2e..057f47842e 100644
--- a/engines/lure/room.h
+++ b/engines/lure/room.h
@@ -48,6 +48,7 @@ namespace Lure {
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 @@ public:
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};
diff --git a/engines/lure/surface.cpp b/engines/lure/surface.cpp
index 30c633faf4..bc4eda9986 100644
--- a/engines/lure/surface.cpp
+++ b/engines/lure/surface.cpp
@@ -106,14 +106,26 @@ Surface::~Surface() {
void Surface::loadScreen(uint16 resourceId) {
MemoryBlock *rawData = Disk::getReference().getEntry(resourceId);
- PictureDecoder decoder;
- MemoryBlock *tmpScreen = decoder.decode(rawData, FULL_SCREEN_HEIGHT * FULL_SCREEN_WIDTH + 1);
+ loadScreen(rawData);
delete rawData;
- empty();
+}
+
+void Surface::loadScreen(MemoryBlock *rawData) {
+ PictureDecoder decoder;
+ 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;
}
diff --git a/engines/lure/surface.h b/engines/lure/surface.h
index 71a184be87..789fec6f14 100644
--- a/engines/lure/surface.h
+++ b/engines/lure/surface.h
@@ -52,6 +52,7 @@ public:
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);