mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-03 09:23:37 +00:00
TSAGE: Rework parts of the cursor code to better match the original
This also fixes the problem with the cursor appearing in cutscenes when you press any key
This commit is contained in:
parent
e448ad0f5d
commit
2b112a9c58
@ -73,12 +73,11 @@ MessageDialog::MessageDialog(const Common::String &message, const Common::String
|
||||
|
||||
int MessageDialog::show(const Common::String &message, const Common::String &btn1Message, const Common::String &btn2Message) {
|
||||
// Ensure that the cursor is the arrow
|
||||
_globals->_events.pushCursor(CURSOR_ARROW);
|
||||
_globals->_events.showCursor();
|
||||
_globals->_events.setCursor(CURSOR_ARROW);
|
||||
|
||||
int result = show2(message, btn1Message, btn2Message);
|
||||
|
||||
_globals->_events.popCursor();
|
||||
_globals->_events.setCursorFromFlag();
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,7 @@ namespace tSage {
|
||||
|
||||
EventsClass::EventsClass() {
|
||||
_currentCursor = CURSOR_NONE;
|
||||
hideCursor();
|
||||
_lastCursor = CURSOR_NONE;
|
||||
_frameNumber = 0;
|
||||
_priorFrameTime = 0;
|
||||
_prevDelayFrame = 0;
|
||||
@ -140,17 +140,11 @@ bool EventsClass::getEvent(Event &evt, int eventMask) {
|
||||
* @cursorType Specified cursor number
|
||||
*/
|
||||
void EventsClass::setCursor(CursorType cursorType) {
|
||||
if (cursorType == _lastCursor)
|
||||
return;
|
||||
|
||||
_lastCursor = cursorType;
|
||||
_globals->clearFlag(122);
|
||||
|
||||
if ((_currentCursor == cursorType) && CursorMan.isVisible())
|
||||
return;
|
||||
|
||||
if (cursorType == CURSOR_NONE) {
|
||||
if (CursorMan.isVisible())
|
||||
CursorMan.showMouse(false);
|
||||
return;
|
||||
}
|
||||
|
||||
CursorMan.showMouse(true);
|
||||
|
||||
const byte *cursor;
|
||||
@ -158,8 +152,8 @@ void EventsClass::setCursor(CursorType cursorType) {
|
||||
uint size;
|
||||
|
||||
switch (cursorType) {
|
||||
case OBJECT_STUNNER:
|
||||
// Stunner cursor
|
||||
case CURSOR_NONE:
|
||||
// No cursor
|
||||
cursor = _resourceManager->getSubResource(4, 1, 6, &size);
|
||||
_globals->setFlag(122);
|
||||
break;
|
||||
@ -215,8 +209,8 @@ void EventsClass::pushCursor(CursorType cursorType) {
|
||||
uint size;
|
||||
|
||||
switch (cursorType) {
|
||||
case CURSOR_CROSSHAIRS:
|
||||
// Crosshairs cursor
|
||||
case CURSOR_NONE:
|
||||
// No cursor
|
||||
cursor = _resourceManager->getSubResource(4, 1, 6, &size);
|
||||
break;
|
||||
|
||||
@ -273,19 +267,19 @@ void EventsClass::setCursor(Graphics::Surface &cursor, int transColor, const Com
|
||||
}
|
||||
|
||||
void EventsClass::setCursorFromFlag() {
|
||||
setCursor(_globals->getFlag(122) ? CURSOR_CROSSHAIRS : _currentCursor);
|
||||
setCursor(isCursorVisible() ? _currentCursor : CURSOR_NONE);
|
||||
}
|
||||
|
||||
void EventsClass::showCursor() {
|
||||
CursorMan.showMouse(true);
|
||||
setCursor(_currentCursor);
|
||||
}
|
||||
|
||||
void EventsClass::hideCursor() {
|
||||
CursorMan.showMouse(false);
|
||||
setCursor(CURSOR_NONE);
|
||||
}
|
||||
|
||||
bool EventsClass::isCursorVisible() const {
|
||||
return CursorMan.isVisible();
|
||||
return !_globals->getFlag(122);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -80,6 +80,7 @@ public:
|
||||
|
||||
Common::Point _mousePos;
|
||||
CursorType _currentCursor;
|
||||
CursorType _lastCursor;
|
||||
|
||||
void setCursor(CursorType cursorType);
|
||||
void pushCursor(CursorType cursorType);
|
||||
|
@ -1328,10 +1328,9 @@ void RingworldGame::handleSaveLoad(bool saveFlag, int &saveSlot, Common::String
|
||||
}
|
||||
|
||||
void RingworldGame::start() {
|
||||
// Set some default flags and cursor
|
||||
// Set some default flags
|
||||
_globals->setFlag(12);
|
||||
_globals->setFlag(34);
|
||||
_globals->_events.setCursor(CURSOR_WALK);
|
||||
|
||||
// Set the screen to scroll in response to the player moving off-screen
|
||||
_globals->_scrollFollower = &_globals->_player;
|
||||
|
@ -113,6 +113,8 @@ void Scene1000::Action3::signal() {
|
||||
setDelay(240);
|
||||
break;
|
||||
case 5: {
|
||||
_globals->_player.enableControl();
|
||||
|
||||
const char *SEEN_INTRO = "seen_intro";
|
||||
if (!ConfMan.hasKey(SEEN_INTRO) || !ConfMan.getBool(SEEN_INTRO)) {
|
||||
// First time being played, so show the introduction
|
||||
|
Loading…
x
Reference in New Issue
Block a user