diff options
-rw-r--r-- | engines/hopkins/events.cpp | 49 | ||||
-rw-r--r-- | engines/hopkins/graphics.cpp | 9 |
2 files changed, 56 insertions, 2 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; } } } diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index c18fa352ef..aa6f54529c 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -114,7 +114,6 @@ void GraphicsManager::SET_MODE(int width, int height) { height = Reel_Zoom(height, SDL_ECHELLE); } - //Graphics::PixelFormat pixelFormat16(2, 5, 5, 5, 0, 10, 5, 0, 0); Graphics::PixelFormat pixelFormat16(2, 5, 6, 5, 0, 11, 5, 0, 0); if (bpp == 8) { @@ -2131,6 +2130,8 @@ Aff_Zoom_Larg_Cont1: } void GraphicsManager::VBL() { + // Bulk of method currently disabled +/* int a1 = 0; signed __int16 v1; int v2; @@ -2249,6 +2250,10 @@ LABEL_54: do { for (;;) { + // TODO: Figure out the purpose of this loop waiting on lItCounter.. + // maybe it's for cursor animatoin? + _vm->_eventsManager.delay(10); + while (_vm->_eventsManager.CASSE || _vm->_globals.iRegul != 1) { if (_vm->_eventsManager.CASSE != 1) goto LABEL_63; @@ -2365,7 +2370,7 @@ LABEL_65: } LABEL_113: - + */ _vm->_soundManager.VERIF_SOUND(); return _vm->_eventsManager.CONTROLE_MES(); } |