aboutsummaryrefslogtreecommitdiff
path: root/engines/lastexpress/data/cursor.cpp
diff options
context:
space:
mode:
authorJulien Templier2011-02-09 00:23:35 +0000
committerJulien Templier2011-02-09 00:23:35 +0000
commit6b477ee33e0a2aeb0f7e4990cc2c00f7dd2e585b (patch)
tree2548f5a55fbc283cda48395f6b8e150bb81c02dc /engines/lastexpress/data/cursor.cpp
parent6a6caa80a3ca05e9226b9bec364afa6495d85df6 (diff)
downloadscummvm-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/cursor.cpp')
-rw-r--r--engines/lastexpress/data/cursor.cpp17
1 files changed, 10 insertions, 7 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++;