mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-05 09:10:29 +00:00
STARK: Delay changing screen after a FMV ends
Prevents the game screen from being visible for one frame before scripts have a chance to update it after a FMV ends. All user interface screen changes should probably be updated to work that way. Running the update method of a screen and the render method of another on the same frame seems really bad.
This commit is contained in:
parent
7302d18f36
commit
fee73851f0
@ -70,13 +70,13 @@ UserInterface::UserInterface(Gfx::Driver *gfx) :
|
|||||||
_exitGame(false),
|
_exitGame(false),
|
||||||
_quitToMainMenu(false),
|
_quitToMainMenu(false),
|
||||||
_shouldToggleSubtitle(false),
|
_shouldToggleSubtitle(false),
|
||||||
|
_shouldGoBackToPreviousScreen(false),
|
||||||
_fmvScreen(nullptr),
|
_fmvScreen(nullptr),
|
||||||
_gameScreen(nullptr),
|
_gameScreen(nullptr),
|
||||||
_interactive(true),
|
_interactive(true),
|
||||||
_interactionAttemptDenied(false),
|
_interactionAttemptDenied(false),
|
||||||
_currentScreen(nullptr),
|
_currentScreen(nullptr),
|
||||||
_gameWindowThumbnail(nullptr),
|
_gameWindowThumbnail(nullptr) {
|
||||||
_prevScreenNameStack() {
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UserInterface::~UserInterface() {
|
UserInterface::~UserInterface() {
|
||||||
@ -151,12 +151,12 @@ void UserInterface::handleDoubleClick() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void UserInterface::handleEscape() {
|
void UserInterface::handleEscape() {
|
||||||
bool handled = false;
|
bool handled = StarkGameInterface->skipCurrentSpeeches();
|
||||||
|
|
||||||
handled = StarkGameInterface->skipCurrentSpeeches();
|
|
||||||
if (!handled) {
|
if (!handled) {
|
||||||
handled = skipFMV();
|
handled = skipFMV();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!handled) {
|
if (!handled) {
|
||||||
Screen::Name curScreenName = _currentScreen->getName();
|
Screen::Name curScreenName = _currentScreen->getName();
|
||||||
if (curScreenName != Screen::kScreenGame && curScreenName != Screen::kScreenMainMenu) {
|
if (curScreenName != Screen::kScreenGame && curScreenName != Screen::kScreenMainMenu) {
|
||||||
@ -195,7 +195,7 @@ void UserInterface::requestFMVPlayback(const Common::String &name) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void UserInterface::onFMVStopped() {
|
void UserInterface::onFMVStopped() {
|
||||||
backPrevScreen();
|
_shouldGoBackToPreviousScreen = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UserInterface::changeScreen(Screen::Name screenName) {
|
void UserInterface::changeScreen(Screen::Name screenName) {
|
||||||
@ -218,17 +218,8 @@ void UserInterface::backPrevScreen() {
|
|||||||
_prevScreenNameStack.pop();
|
_prevScreenNameStack.pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
void UserInterface::performQuitToMainMenu() {
|
|
||||||
assert(_quitToMainMenu);
|
|
||||||
|
|
||||||
changeScreen(Screen::kScreenGame);
|
|
||||||
StarkResourceProvider->shutdown();
|
|
||||||
changeScreen(Screen::kScreenMainMenu);
|
|
||||||
_prevScreenNameStack.clear();
|
|
||||||
_quitToMainMenu = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void UserInterface::restoreScreenHistory() {
|
void UserInterface::restoreScreenHistory() {
|
||||||
|
_shouldGoBackToPreviousScreen = false;
|
||||||
_prevScreenNameStack.clear();
|
_prevScreenNameStack.clear();
|
||||||
_prevScreenNameStack.push(Screen::kScreenMainMenu);
|
_prevScreenNameStack.push(Screen::kScreenMainMenu);
|
||||||
}
|
}
|
||||||
@ -465,4 +456,19 @@ void UserInterface::toggleExitDisplay() {
|
|||||||
_gameScreen->getGameWindow()->toggleExitDisplay();
|
_gameScreen->getGameWindow()->toggleExitDisplay();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void UserInterface::doQueuedScreenChange() {
|
||||||
|
if (_quitToMainMenu) {
|
||||||
|
changeScreen(Screen::kScreenGame);
|
||||||
|
StarkResourceProvider->shutdown();
|
||||||
|
changeScreen(Screen::kScreenMainMenu);
|
||||||
|
_prevScreenNameStack.clear();
|
||||||
|
_quitToMainMenu = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_shouldGoBackToPreviousScreen) {
|
||||||
|
backPrevScreen();
|
||||||
|
_shouldGoBackToPreviousScreen = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} // End of namespace Stark
|
} // End of namespace Stark
|
||||||
|
@ -101,10 +101,11 @@ public:
|
|||||||
/** Back to the previous displayed screen */
|
/** Back to the previous displayed screen */
|
||||||
void backPrevScreen();
|
void backPrevScreen();
|
||||||
|
|
||||||
|
/** Apply the scheduled screen change if any */
|
||||||
|
void doQueuedScreenChange();
|
||||||
|
|
||||||
/** Back to the main menu screen and rest resources */
|
/** Back to the main menu screen and rest resources */
|
||||||
void requestQuitToMainMenu() { _quitToMainMenu = true; }
|
void requestQuitToMainMenu() { _quitToMainMenu = true; }
|
||||||
bool hasQuitToMainMenuRequest() { return _quitToMainMenu; }
|
|
||||||
void performQuitToMainMenu();
|
|
||||||
|
|
||||||
/** Restore the screen travelling history to the initial state*/
|
/** Restore the screen travelling history to the initial state*/
|
||||||
void restoreScreenHistory();
|
void restoreScreenHistory();
|
||||||
@ -231,6 +232,9 @@ private:
|
|||||||
|
|
||||||
bool _shouldToggleSubtitle;
|
bool _shouldToggleSubtitle;
|
||||||
|
|
||||||
|
// TODO: Generalize to all screen changes
|
||||||
|
bool _shouldGoBackToPreviousScreen;
|
||||||
|
|
||||||
Graphics::Surface *_gameWindowThumbnail;
|
Graphics::Surface *_gameWindowThumbnail;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -184,9 +184,7 @@ void StarkEngine::mainLoop() {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_userInterface->hasQuitToMainMenuRequest()) {
|
_userInterface->doQueuedScreenChange();
|
||||||
_userInterface->performQuitToMainMenu();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_resourceProvider->hasLocationChangeRequest()) {
|
if (_resourceProvider->hasLocationChangeRequest()) {
|
||||||
_global->setNormalSpeed();
|
_global->setNormalSpeed();
|
||||||
|
Loading…
Reference in New Issue
Block a user