diff --git a/engines/myst3/cursor.cpp b/engines/myst3/cursor.cpp index e34db26fe30..50990662c44 100644 --- a/engines/myst3/cursor.cpp +++ b/engines/myst3/cursor.cpp @@ -37,24 +37,24 @@ struct CursorData { uint32 nodeID; uint16 hotspotX; uint16 hotspotY; - double transparency; - double transparencyXbox; + float transparency; + float transparencyXbox; }; static const CursorData availableCursors[] = { - { 1000, 8, 8, 0.25, 0.00 }, // Default cursor - { 1001, 8, 8, 0.50, 0.50 }, // On top of inventory item - { 1002, 8, 8, 0.50, 0.50 }, // Drag cursor - { 1003, 1, 5, 0.50, 0.50 }, - { 1004, 14, 5, 0.50, 0.50 }, - { 1005, 16, 14, 0.50, 0.50 }, - { 1006, 16, 14, 0.50, 0.50 }, - { 1007, 8, 8, 0.55, 0.55 }, - { 1000, 8, 8, 0.25, 0.00 }, // Default cursor - { 1001, 8, 8, 0.50, 0.50 }, - { 1011, 16, 16, 0.50, 0.50 }, - { 1000, 6, 1, 0.50, 0.50 }, - { 1000, 8, 8, 0.00, 0.25 } // Invisible cursor + { 1000, 8, 8, 0.25f, 0.00f }, // Default cursor + { 1001, 8, 8, 0.50f, 0.50f }, // On top of inventory item + { 1002, 8, 8, 0.50f, 0.50f }, // Drag cursor + { 1003, 1, 5, 0.50f, 0.50f }, + { 1004, 14, 5, 0.50f, 0.50f }, + { 1005, 16, 14, 0.50f, 0.50f }, + { 1006, 16, 14, 0.50f, 0.50f }, + { 1007, 8, 8, 0.55f, 0.55f }, + { 1000, 8, 8, 0.25f, 0.00f }, // Default cursor + { 1001, 8, 8, 0.50f, 0.50f }, + { 1011, 16, 16, 0.50f, 0.50f }, + { 1000, 6, 1, 0.50f, 0.50f }, + { 1000, 8, 8, 0.00f, 0.25f } // Invisible cursor }; Cursor::Cursor(Myst3Engine *vm) : @@ -63,7 +63,7 @@ Cursor::Cursor(Myst3Engine *vm) : _hideLevel(0), _lockedAtCenter(false) { - // The cursor is drawn unscaled + // The cursor is manually scaled _scaled = false; _isConstrainedToWindow = false; @@ -143,7 +143,7 @@ void Cursor::changeCursor(uint32 index) { _currentCursorID = index; } -double Cursor::getTransparencyForId(uint32 cursorId) { +float Cursor::getTransparencyForId(uint32 cursorId) { assert(cursorId < ARRAYSIZE(availableCursors)); if (_vm->getPlatform() == Common::kPlatformXbox) { return availableCursors[cursorId].transparencyXbox; @@ -208,18 +208,24 @@ void Cursor::draw() { } // Rect where to draw the cursor - Common::Rect screenRect = Common::Rect(texture->width, texture->height); - screenRect.translate(_position.x - cursor.hotspotX, _position.y - cursor.hotspotY); + Common::Rect viewport = _vm->_gfx->viewport(); + float scale = MIN( + viewport.width() / (float) Renderer::kOriginalWidth, + viewport.height() / (float) Renderer::kOriginalHeight + ); - // Rect where to draw the cursor + Common::Rect screenRect = Common::Rect(texture->width * scale, texture->height * scale); + screenRect.translate(_position.x - cursor.hotspotX * scale, _position.y - cursor.hotspotY * scale); + + // Texture rect Common::Rect textureRect = Common::Rect(texture->width, texture->height); - float transparency = 1.0; + float transparency = 1.0f; int32 varTransparency = _vm->_state->getCursorTransparency(); if (_lockedAtCenter || varTransparency == 0) { if (varTransparency >= 0) - transparency = varTransparency / 100.0; + transparency = varTransparency / 100.0f; else transparency = getTransparencyForId(_currentCursorID); } diff --git a/engines/myst3/cursor.h b/engines/myst3/cursor.h index 224b6d554fd..bd9cc6c0b96 100644 --- a/engines/myst3/cursor.h +++ b/engines/myst3/cursor.h @@ -73,7 +73,7 @@ private: bool _lockedAtCenter; void loadAvailableCursors(); - double getTransparencyForId(uint32 cursorId); + float getTransparencyForId(uint32 cursorId); }; } // End of namespace Myst3