aboutsummaryrefslogtreecommitdiff
path: root/engines/lure
diff options
context:
space:
mode:
authorPaul Gilbert2008-01-02 11:15:36 +0000
committerPaul Gilbert2008-01-02 11:15:36 +0000
commit977c9fb5f338780d3886b6695c8082a98381ab00 (patch)
treea95882899ad6ab1806e852bfe8ab85eb7b14d337 /engines/lure
parenteff113c486ca9b68dba28537c002b74d94152abb (diff)
downloadscummvm-rg350-977c9fb5f338780d3886b6695c8082a98381ab00.tar.gz
scummvm-rg350-977c9fb5f338780d3886b6695c8082a98381ab00.tar.bz2
scummvm-rg350-977c9fb5f338780d3886b6695c8082a98381ab00.zip
Enhanced cursor code to handle cursors in EGA mode
svn-id: r30143
Diffstat (limited to 'engines/lure')
-rw-r--r--engines/lure/res.cpp35
-rw-r--r--engines/lure/res.h6
2 files changed, 37 insertions, 4 deletions
diff --git a/engines/lure/res.cpp b/engines/lure/res.cpp
index 64ddbf1a4e..b8af8d973b 100644
--- a/engines/lure/res.cpp
+++ b/engines/lure/res.cpp
@@ -408,6 +408,41 @@ void Resources::insertPaletteSubset(Palette &p) {
p.palette()->copyFrom(_paletteSubset->palette(), 60*4, 220*4, 8*4);
}
+byte *Resources::getCursor(uint8 cursorNum) {
+ if (!LureEngine::getReference().isEGA())
+ return _cursors->data() + (cursorNum * CURSOR_SIZE);
+
+ Common::set_to(&_cursor[0], &_cursor[0] + CURSOR_SIZE, 0);
+ byte *pSrc = _cursors->data() + (cursorNum * 64);
+ byte *pDest = &_cursor[0];
+ int planeNum = 0;
+
+ for (int y = 0; y < 16; ++y) {
+ for (int x = 0; x < 2; ++x) {
+ for (int planeNum = 0; planeNum < 2; ++planeNum, ++pSrc) {
+
+ byte v = *pSrc;
+ for (int bitCtr = 0; bitCtr < 8; ++bitCtr, v <<= 1) {
+ if ((v & 0x80) != 0)
+ *(pDest + bitCtr) |= 1 << planeNum;
+ else
+ *(pDest + bitCtr) &= ~(1 << planeNum);
+ }
+ }
+
+ pDest += 8;
+ }
+ }
+
+ // Post-process the cells to swap any values of 2 and 3
+ for (int index = 0; index < CURSOR_SIZE; ++index) {
+ if (_cursor[index] == 2) _cursor[index] = 3;
+ else if (_cursor[index] == 3) _cursor[index] = 2;
+ }
+
+ return &_cursor[0];
+}
+
HotspotData *Resources::getHotspot(uint16 hotspotId) {
HotspotDataList::iterator i;
diff --git a/engines/lure/res.h b/engines/lure/res.h
index c95f254b57..3c13ce1891 100644
--- a/engines/lure/res.h
+++ b/engines/lure/res.h
@@ -90,6 +90,7 @@ private:
int _talkSelection;
int _talkStartEntry;
uint16 _talkingCharacter;
+ byte _cursor[CURSOR_WIDTH * CURSOR_HEIGHT];
void reloadData();
void freeData();
@@ -104,10 +105,7 @@ public:
RoomData *getRoom(uint16 roomNumber);
bool checkHotspotExtent(HotspotData *hotspot);
void insertPaletteSubset(Palette &p);
-
- byte *getCursor(uint8 cursorNum) {
- return _cursors->data() + (cursorNum * CURSOR_SIZE);
- }
+ byte *getCursor(uint8 cursorNum);
HotspotDataList &hotspotData() { return _hotspotData; }
HotspotOverrideList &hotspotOverrides() { return _hotspotOverrides; }
HotspotAnimList &animRecords() { return _animData; }