COMMON: Add a key color field to NECursor

This commit is contained in:
Matthew Hoops 2011-02-22 20:11:50 -05:00
parent a2a0b13de2
commit e053373dd3
3 changed files with 10 additions and 2 deletions

View File

@ -38,6 +38,7 @@ NECursor::NECursor() {
_hotspotX = 0;
_hotspotY = 0;
_surface = 0;
_keyColor = 0;
memset(_palette, 0, 256 * 3);
}
@ -61,6 +62,10 @@ uint16 NECursor::getHotspotY() const {
return _hotspotY;
}
byte NECursor::getKeyColor() const {
return _keyColor;
}
void NECursor::setDimensions(uint16 width, uint16 height) {
_width = width;
_height = height;
@ -156,7 +161,7 @@ bool NECursor::readCursor(SeekableReadStream &stream, uint32 count) {
else
*rowDest = 1;
} else
*rowDest = 0;
*rowDest = _keyColor;
}
}

View File

@ -50,6 +50,8 @@ public:
uint16 getHotspotX() const;
/** Return the cursor's hotspot's y coordinate. */
uint16 getHotspotY() const;
/** Return the cursor's transparent key. */
byte getKeyColor() const;
const byte *getSurface() const { return _surface; }
const byte *getPalette() const { return _palette; }
@ -70,6 +72,7 @@ private:
uint16 _height; ///< The cursor's height.
uint16 _hotspotX; ///< The cursor's hotspot's x coordinate.
uint16 _hotspotY; ///< The cursor's hotspot's y coordinate.
byte _keyColor; ///< The cursor's transparent key
/** Clear the cursor. */
void clear();

View File

@ -301,7 +301,7 @@ void NECursorManager::setCursor(uint16 id) {
for (uint32 i = 0; i < cursors.size(); i++) {
if (cursors[i].id == id) {
Common::NECursor *cursor = cursors[i].cursors[0];
CursorMan.replaceCursor(cursor->getSurface(), cursor->getWidth(), cursor->getHeight(), cursor->getHotspotX(), cursor->getHotspotY(), 0);
CursorMan.replaceCursor(cursor->getSurface(), cursor->getWidth(), cursor->getHeight(), cursor->getHotspotX(), cursor->getHotspotY(), cursor->getKeyColor());
CursorMan.replaceCursorPalette(cursor->getPalette(), 0, 256);
return;
}