mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-24 05:01:43 +00:00
NANCY: Cursor fixes
When exiting a scene while holding an item, the cursor shown is now the fourth version of the item cursor, just as it is in the original engine. When entering a scene through the map while holding an item, the cursor no longer gets reset to the default one.
This commit is contained in:
parent
54d6de7b57
commit
43c4c62f40
@ -162,7 +162,7 @@ void LeverPuzzle::handleInput(NancyInput &input) {
|
||||
}
|
||||
|
||||
if (NancySceneState.getViewport().convertViewportToScreen(_exitHotspot).contains(input.mousePos)) {
|
||||
g_nancy->_cursorManager->setCursorType(CursorManager::kExitArrow);
|
||||
g_nancy->_cursorManager->setCursorType(CursorManager::kExit);
|
||||
|
||||
if (input.input & NancyInput::kLeftMouseButtonUp) {
|
||||
_state = kActionTrigger;
|
||||
|
@ -163,7 +163,7 @@ void OrderingPuzzle::handleInput(NancyInput &input) {
|
||||
}
|
||||
|
||||
if (NancySceneState.getViewport().convertViewportToScreen(_exitHotspot).contains(input.mousePos)) {
|
||||
g_nancy->_cursorManager->setCursorType(CursorManager::kExitArrow);
|
||||
g_nancy->_cursorManager->setCursorType(CursorManager::kExit);
|
||||
|
||||
if (input.input & NancyInput::kLeftMouseButtonUp) {
|
||||
_state = kActionTrigger;
|
||||
|
@ -168,7 +168,7 @@ void PasswordPuzzle::handleInput(NancyInput &input) {
|
||||
}
|
||||
|
||||
if (NancySceneState.getViewport().convertViewportToScreen(_exitHotspot).contains(input.mousePos)) {
|
||||
g_nancy->_cursorManager->setCursorType(CursorManager::kExitArrow);
|
||||
g_nancy->_cursorManager->setCursorType(CursorManager::kExit);
|
||||
|
||||
if (input.input & NancyInput::kLeftMouseButtonUp) {
|
||||
_state = kActionTrigger;
|
||||
|
@ -72,7 +72,7 @@ protected:
|
||||
};
|
||||
|
||||
class Hot1FrExitSceneChange : public Hot1FrSceneChange {
|
||||
virtual CursorManager::CursorType getHoverCursor() const override { return CursorManager::kExitArrow; }
|
||||
virtual CursorManager::CursorType getHoverCursor() const override { return CursorManager::kExit; }
|
||||
|
||||
protected:
|
||||
virtual Common::String getRecordTypeName() const override { return "Hot1FrExitSceneChange"; }
|
||||
@ -190,7 +190,7 @@ public:
|
||||
virtual void readData(Common::SeekableReadStream &stream) override;
|
||||
virtual void execute() override;
|
||||
|
||||
virtual CursorManager::CursorType getHoverCursor() const override { return CursorManager::kExitArrow; }
|
||||
virtual CursorManager::CursorType getHoverCursor() const override { return CursorManager::kExit; }
|
||||
|
||||
protected:
|
||||
virtual Common::String getRecordTypeName() const override { return "MapCall"; }
|
||||
|
@ -172,7 +172,7 @@ void RotatingLockPuzzle::handleInput(NancyInput &input) {
|
||||
}
|
||||
|
||||
if (NancySceneState.getViewport().convertViewportToScreen(_exitHotspot).contains(input.mousePos)) {
|
||||
g_nancy->_cursorManager->setCursorType(CursorManager::kExitArrow);
|
||||
g_nancy->_cursorManager->setCursorType(CursorManager::kExit);
|
||||
|
||||
if (input.input & NancyInput::kLeftMouseButtonUp) {
|
||||
_state = kActionTrigger;
|
||||
|
@ -191,7 +191,7 @@ void SliderPuzzle::handleInput(NancyInput &input) {
|
||||
}
|
||||
|
||||
if (NancySceneState.getViewport().convertViewportToScreen(_exitHotspot).contains(input.mousePos)) {
|
||||
g_nancy->_cursorManager->setCursorType(CursorManager::kExitArrow);
|
||||
g_nancy->_cursorManager->setCursorType(CursorManager::kExit);
|
||||
|
||||
if (input.input & NancyInput::kLeftMouseButtonUp) {
|
||||
_state = kActionTrigger;
|
||||
|
@ -269,7 +269,7 @@ void Telephone::handleInput(NancyInput &input) {
|
||||
}
|
||||
|
||||
if (NancySceneState.getViewport().convertViewportToScreen(_exitHotspot).contains(input.mousePos)) {
|
||||
g_nancy->_cursorManager->setCursorType(CursorManager::kExitArrow);
|
||||
g_nancy->_cursorManager->setCursorType(CursorManager::kExit);
|
||||
|
||||
if (input.input & NancyInput::kLeftMouseButtonUp) {
|
||||
g_nancy->_sound->loadSound(_hangUpSound);
|
||||
|
@ -70,20 +70,16 @@ void CursorManager::setCursor(CursorType type, int16 itemID) {
|
||||
_curItemID = itemID;
|
||||
}
|
||||
|
||||
uint16 newID = 0;
|
||||
bool hasItem = false;
|
||||
|
||||
switch (type) {
|
||||
case kNormalArrow:
|
||||
newID = 4;
|
||||
_curCursorID = 4;
|
||||
break;
|
||||
case kHotspotArrow:
|
||||
newID = 6;
|
||||
_curCursorID = 6;
|
||||
break;
|
||||
case kExitArrow:
|
||||
newID = 3;
|
||||
break;
|
||||
default: {
|
||||
default:
|
||||
if (itemID == -1) {
|
||||
// No item held, set to eyeglass
|
||||
itemID = 0;
|
||||
@ -93,13 +89,12 @@ void CursorManager::setCursor(CursorType type, int16 itemID) {
|
||||
hasItem = true;
|
||||
}
|
||||
|
||||
newID = itemID * 4 + type;
|
||||
}
|
||||
_curCursorID = itemID * 4 + type;
|
||||
}
|
||||
|
||||
Graphics::ManagedSurface *surf;
|
||||
Common::Rect bounds = _cursors[newID].bounds;
|
||||
Common::Point hotspot = _cursors[newID].hotspot;
|
||||
Common::Rect bounds = _cursors[_curCursorID].bounds;
|
||||
Common::Point hotspot = _cursors[_curCursorID].hotspot;
|
||||
|
||||
if (hasItem) {
|
||||
surf = &_invCursorsSurface;
|
||||
|
@ -33,12 +33,13 @@ class NancyEngine;
|
||||
|
||||
class CursorManager {
|
||||
public:
|
||||
enum CursorType { kNormal = 0, kHotspot = 1, kMove = 2, kNormalArrow, kHotspotArrow, kExitArrow };
|
||||
enum CursorType { kNormal = 0, kHotspot = 1, kMove = 2, kExit = 3, kNormalArrow, kHotspotArrow };
|
||||
|
||||
CursorManager() :
|
||||
_isInitialized(false),
|
||||
_curItemID(-1),
|
||||
_curCursorType(kNormal) {}
|
||||
_curCursorType(kNormal),
|
||||
_curCursorID(0) {}
|
||||
|
||||
void init();
|
||||
|
||||
@ -63,6 +64,7 @@ private:
|
||||
|
||||
CursorType _curCursorType;
|
||||
int16 _curItemID;
|
||||
uint _curCursorID;
|
||||
bool _isInitialized;
|
||||
};
|
||||
|
||||
|
@ -135,6 +135,10 @@ void Scene::onStateEnter() {
|
||||
|
||||
g_nancy->_graphicsManager->redrawAll();
|
||||
|
||||
if (getHeldItem() != -1) {
|
||||
g_nancy->_cursorManager->setCursorItemID(getHeldItem());
|
||||
}
|
||||
|
||||
// Run once to clear out the previous scene when coming from Map
|
||||
process();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user