aboutsummaryrefslogtreecommitdiff
path: root/engines/hopkins/events.cpp
diff options
context:
space:
mode:
authorPaul Gilbert2012-09-22 09:55:40 +1000
committerPaul Gilbert2012-09-22 09:55:40 +1000
commit1a639302782e35307ee82d4961f7f784fb2fd917 (patch)
tree980df097182b8bbc09bfd60339501cf0f1e834c1 /engines/hopkins/events.cpp
parentf20e411734ea67e940218fcd83f0bac7be2b41be (diff)
downloadscummvm-rg350-1a639302782e35307ee82d4961f7f784fb2fd917.tar.gz
scummvm-rg350-1a639302782e35307ee82d4961f7f784fb2fd917.tar.bz2
scummvm-rg350-1a639302782e35307ee82d4961f7f784fb2fd917.zip
HOPKINS: Disabled VBL() method code and added ScummVM cursor display.
I'm not yet sure whether VBL was only concerned with displaying the cursor, but it had some loops using the lItCounter, so it was causing infinite loops. Whatever else VBL actually does besides cursor display will have to be converted to a more ScummVM friendly implementation.
Diffstat (limited to 'engines/hopkins/events.cpp')
-rw-r--r--engines/hopkins/events.cpp49
1 files changed, 49 insertions, 0 deletions
diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp
index f3c1740d17..e2f6c9df1f 100644
--- a/engines/hopkins/events.cpp
+++ b/engines/hopkins/events.cpp
@@ -105,11 +105,13 @@ bool EventsManager::BMOUSE() {
void EventsManager::MOUSE_OFF() {
souris_flag = false;
+ g_system->showMouse(false);
}
void EventsManager::MOUSE_ON() {
souris_on();
souris_flag = true;
+ g_system->showMouse(true);
}
void EventsManager::CHANGE_MOUSE(int id) {
@@ -124,6 +126,53 @@ void EventsManager::CHANGE_MOUSE(int id) {
if (OLD_ICONE != cursorId || !cursorId) {
OLD_ICONE = cursorId;
souris_n = cursorId;
+
+ // Backup the current sprite clipping bounds and reset them
+ Common::Rect clipBounds(_vm->_graphicsManager.min_x, _vm->_graphicsManager.min_y,
+ _vm->_graphicsManager.max_x, _vm->_graphicsManager.max_y);
+ _vm->_graphicsManager.min_x = _vm->_graphicsManager.min_y = 0;
+ _vm->_graphicsManager.max_x = _vm->_globals.OBJL;
+ _vm->_graphicsManager.max_y = _vm->_globals.OBJH;
+ int pitch = _vm->_graphicsManager.nbrligne2;
+ _vm->_graphicsManager.nbrligne2 = _vm->_globals.OBJL;
+
+ // Draw the cursor onto a temporary surface
+ byte *cursorSurface = new byte[_vm->_globals.OBJH * _vm->_globals.OBJL];
+ Common::fill(cursorSurface, cursorSurface + _vm->_globals.OBJH * _vm->_globals.OBJL, 0);
+ _vm->_graphicsManager.Sprite_Vesa(cursorSurface, pointeur_souris, 300, 300, cursorId);
+
+ // Reset the clipping bounds
+ _vm->_graphicsManager.min_x = clipBounds.left;
+ _vm->_graphicsManager.min_y = clipBounds.top;
+ _vm->_graphicsManager.max_x = clipBounds.right;
+ _vm->_graphicsManager.max_y = clipBounds.bottom;
+ _vm->_graphicsManager.nbrligne2 = pitch;
+
+ // Convert the cursor to the pixel format. At the moment, it's hardcoded
+ // to expect the game to be in 16-bit mode
+ uint16 *cursorPixels = new uint16[_vm->_globals.OBJH * _vm->_globals.OBJL];
+ const byte *srcP = cursorSurface;
+ uint16 *destP = cursorPixels;
+
+ for (int yp = 0; yp < _vm->_globals.OBJH; ++yp) {
+ const byte *lineSrcP = srcP;
+ uint16 *lineDestP = destP;
+
+ for (int xp = 0; xp < _vm->_globals.OBJL; ++xp)
+ *lineDestP++ = *(uint16 *)&_vm->_graphicsManager.PAL_PIXELS[*lineSrcP++ * 2];
+
+ srcP += _vm->_globals.OBJL;
+ destP += _vm->_globals.OBJL;
+ }
+
+ // Set the ScummVM cursor from the surface
+ Graphics::PixelFormat pixelFormat = g_system->getScreenFormat();
+ g_system->setMouseCursor(cursorPixels, _vm->_globals.OBJL, _vm->_globals.OBJH,
+ 0, 0, 0, true, &pixelFormat);
+
+ // Delete the cursor surface
+ delete[] cursorPixels;
+ delete[] cursorSurface;
}
}
}