diff options
author | Julien Templier | 2011-02-09 00:23:35 +0000 |
---|---|---|
committer | Julien Templier | 2011-02-09 00:23:35 +0000 |
commit | 6b477ee33e0a2aeb0f7e4990cc2c00f7dd2e585b (patch) | |
tree | 2548f5a55fbc283cda48395f6b8e150bb81c02dc /engines/lastexpress/data | |
parent | 6a6caa80a3ca05e9226b9bec364afa6495d85df6 (diff) | |
download | scummvm-rg350-6b477ee33e0a2aeb0f7e4990cc2c00f7dd2e585b.tar.gz scummvm-rg350-6b477ee33e0a2aeb0f7e4990cc2c00f7dd2e585b.tar.bz2 scummvm-rg350-6b477ee33e0a2aeb0f7e4990cc2c00f7dd2e585b.zip |
LASTEXPRESS: Refactor inventory handling
- Rewrite menu icon part of Inventory::handleMouseEvent()
- Add proper support for icon brightness
- Add drawItem method in place of macro
svn-id: r55846
Diffstat (limited to 'engines/lastexpress/data')
-rw-r--r-- | engines/lastexpress/data/cursor.cpp | 17 | ||||
-rw-r--r-- | engines/lastexpress/data/cursor.h | 4 |
2 files changed, 12 insertions, 9 deletions
diff --git a/engines/lastexpress/data/cursor.cpp b/engines/lastexpress/data/cursor.cpp index 3acb8dd4c0..fca9ed5d45 100644 --- a/engines/lastexpress/data/cursor.cpp +++ b/engines/lastexpress/data/cursor.cpp @@ -33,6 +33,8 @@ namespace LastExpress { +uint16 brigthnessData[4] = { 0, 0x7BDE, 0x739C, 0x6318 }; + Cursor::Cursor() : _current(kCursorMAX) { memset(&_cursors, 0, sizeof(_cursors)); } @@ -105,17 +107,17 @@ const uint16 *Cursor::getCursorImage(CursorStyle style) const { } -Icon::Icon(CursorStyle style) : _style(style), _x(0), _y(0), _brightness(100) {} +Icon::Icon(CursorStyle style) : _style(style), _x(0), _y(0), _brightnessIndex(-1) {} void Icon::setPosition(int16 x, int16 y) { _x = x; _y = y; } -void Icon::setBrightness(uint brightness) { - assert(brightness <= 100); +void Icon::setBrightness(int16 brightnessIndex) { + assert(brightnessIndex < ARRAYSIZE(brigthnessData)); - _brightness = (uint8)brightness; + _brightnessIndex = brightnessIndex; } Common::Rect Icon::draw(Graphics::Surface *surface) { @@ -127,11 +129,12 @@ Common::Rect Icon::draw(Graphics::Surface *surface) { for (int j = 0; j < 32; j++) { uint16 *s = (uint16 *)surface->getBasePtr(_x, _y + j); for (int i = 0; i < 32; i++) { - if (_brightness == 100) + + // Adjust brightness + if (_brightnessIndex == -1) *s = *image; else - // HACK change color to show highlight - *s = (*image & 0x739C) >> 1; + *s = (*image & brigthnessData[_brightnessIndex]) >> _brightnessIndex; // Update the image and surface pointers image++; diff --git a/engines/lastexpress/data/cursor.h b/engines/lastexpress/data/cursor.h index 0e9556aa6e..d23aa86a95 100644 --- a/engines/lastexpress/data/cursor.h +++ b/engines/lastexpress/data/cursor.h @@ -54,13 +54,13 @@ public: Icon(CursorStyle style); void setPosition(int16 x, int16 y); - void setBrightness(uint brightness); + void setBrightness(int16 brightnessIndex); Common::Rect draw(Graphics::Surface *surface); private: CursorStyle _style; int16 _x, _y; - uint8 _brightness; + int16 _brightnessIndex; }; class Cursor { |