aboutsummaryrefslogtreecommitdiff
path: root/engines/access/events.cpp
diff options
context:
space:
mode:
authorPaul Gilbert2014-08-23 23:21:17 -0400
committerPaul Gilbert2014-08-23 23:21:17 -0400
commitee62d6c1cfce009331050fb9bf8bfecbb8f51472 (patch)
treecc0281eb48a9e03b05d74234804db208ec4fa6c3 /engines/access/events.cpp
parent955df7a94ce21d311d6e34d263d96070548d855e (diff)
downloadscummvm-rg350-ee62d6c1cfce009331050fb9bf8bfecbb8f51472.tar.gz
scummvm-rg350-ee62d6c1cfce009331050fb9bf8bfecbb8f51472.tar.bz2
scummvm-rg350-ee62d6c1cfce009331050fb9bf8bfecbb8f51472.zip
ACCESS: In progress inventory display screen
Diffstat (limited to 'engines/access/events.cpp')
-rw-r--r--engines/access/events.cpp88
1 files changed, 47 insertions, 41 deletions
diff --git a/engines/access/events.cpp b/engines/access/events.cpp
index 78bbdbf1ea..15c8f8cff0 100644
--- a/engines/access/events.cpp
+++ b/engines/access/events.cpp
@@ -41,11 +41,11 @@ EventsManager::EventsManager(AccessEngine *vm): _vm(vm) {
_priorFrameTime = 0;
_leftButton = _rightButton = false;
_mouseCol = _mouseRow = 0;
- _mouseMode = 0;
_cursorExitFlag = false;
}
EventsManager::~EventsManager() {
+ _invCursor.free();
}
void EventsManager::setCursor(CursorType cursorId) {
@@ -53,50 +53,56 @@ void EventsManager::setCursor(CursorType cursorId) {
return;
_cursorId = cursorId;
- if (_mouseMode == 1 && cursorId == CURSOR_ARROW)
- _mouseMode = 2;
- else if (_mouseMode == 2 && cursorId != CURSOR_ARROW)
- _mouseMode = 1;
-
- // Get a pointer to the mouse data to use, and get the cursor hotspot
- const byte *srcP = Amazon::CURSORS[cursorId];
- int hotspotX = (int16)READ_LE_UINT16(srcP);
- int hotspotY = (int16)READ_LE_UINT16(srcP + 2);
- srcP += 4;
-
- // Create a surface to build up the cursor on
- Graphics::Surface cursorSurface;
- cursorSurface.create(16, 16, Graphics::PixelFormat::createFormatCLUT8());
- byte *destP = (byte *)cursorSurface.getPixels();
- Common::fill(destP, destP + CURSOR_WIDTH * CURSOR_HEIGHT, 0);
-
- // Loop to build up the cursor
- for (int y = 0; y < CURSOR_HEIGHT; ++y) {
- destP = (byte *)cursorSurface.getBasePtr(0, y);
- int width = CURSOR_WIDTH;
- int skip = *srcP++;
- int plot = *srcP++;
- if (skip >= width)
- break;
+ if (cursorId == CURSOR_INVENTORY) {
+ // Set the cursor
+ CursorMan.replaceCursor(_invCursor.getPixels(), _invCursor.w, _invCursor.h,
+ 0, 0, 0);
+ } else {
+ // Get a pointer to the mouse data to use, and get the cursor hotspot
+ const byte *srcP = Amazon::CURSORS[cursorId];
+ int hotspotX = (int16)READ_LE_UINT16(srcP);
+ int hotspotY = (int16)READ_LE_UINT16(srcP + 2);
+ srcP += 4;
+
+ // Create a surface to build up the cursor on
+ Graphics::Surface cursorSurface;
+ cursorSurface.create(16, 16, Graphics::PixelFormat::createFormatCLUT8());
+ byte *destP = (byte *)cursorSurface.getPixels();
+ Common::fill(destP, destP + CURSOR_WIDTH * CURSOR_HEIGHT, 0);
+
+ // Loop to build up the cursor
+ for (int y = 0; y < CURSOR_HEIGHT; ++y) {
+ destP = (byte *)cursorSurface.getBasePtr(0, y);
+ int width = CURSOR_WIDTH;
+ int skip = *srcP++;
+ int plot = *srcP++;
+ if (skip >= width)
+ break;
+
+ // Skip over pixels
+ destP += skip;
+ width -= skip;
+
+ // Write out the pixels to plot
+ while (plot > 0 && width > 0) {
+ *destP++ = *srcP++;
+ --plot;
+ --width;
+ }
+ }
- // Skip over pixels
- destP += skip;
- width -= skip;
+ // Set the cursor
+ CursorMan.replaceCursor(cursorSurface.getPixels(), CURSOR_WIDTH, CURSOR_HEIGHT,
+ hotspotX, hotspotY, 0);
- // Write out the pixels to plot
- while (plot > 0 && width > 0) {
- *destP++ = *srcP++;
- --plot;
- --width;
- }
+ // Free the cursor surface
+ cursorSurface.free();
}
+}
- // Set the cursor
- CursorMan.replaceCursor(cursorSurface.getPixels(), CURSOR_WIDTH, CURSOR_HEIGHT,
- hotspotX, hotspotY, 0);
-
- // Free the cursor surface
- cursorSurface.free();
+void EventsManager::setCursorData(Graphics::Surface *src, const Common::Rect &r) {
+ _invCursor.create(r.width(), r.height(), Graphics::PixelFormat::createFormatCLUT8());
+ _invCursor.copyRectToSurface(*src, 0, 0, r);
}
void EventsManager::showCursor() {