mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-03 07:59:38 +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),
|
||||
_quitToMainMenu(false),
|
||||
_shouldToggleSubtitle(false),
|
||||
_shouldGoBackToPreviousScreen(false),
|
||||
_fmvScreen(nullptr),
|
||||
_gameScreen(nullptr),
|
||||
_interactive(true),
|
||||
_interactionAttemptDenied(false),
|
||||
_currentScreen(nullptr),
|
||||
_gameWindowThumbnail(nullptr),
|
||||
_prevScreenNameStack() {
|
||||
_gameWindowThumbnail(nullptr) {
|
||||
}
|
||||
|
||||
UserInterface::~UserInterface() {
|
||||
@ -151,12 +151,12 @@ void UserInterface::handleDoubleClick() {
|
||||
}
|
||||
|
||||
void UserInterface::handleEscape() {
|
||||
bool handled = false;
|
||||
bool handled = StarkGameInterface->skipCurrentSpeeches();
|
||||
|
||||
handled = StarkGameInterface->skipCurrentSpeeches();
|
||||
if (!handled) {
|
||||
handled = skipFMV();
|
||||
}
|
||||
|
||||
if (!handled) {
|
||||
Screen::Name curScreenName = _currentScreen->getName();
|
||||
if (curScreenName != Screen::kScreenGame && curScreenName != Screen::kScreenMainMenu) {
|
||||
@ -195,7 +195,7 @@ void UserInterface::requestFMVPlayback(const Common::String &name) {
|
||||
}
|
||||
|
||||
void UserInterface::onFMVStopped() {
|
||||
backPrevScreen();
|
||||
_shouldGoBackToPreviousScreen = true;
|
||||
}
|
||||
|
||||
void UserInterface::changeScreen(Screen::Name screenName) {
|
||||
@ -218,17 +218,8 @@ void UserInterface::backPrevScreen() {
|
||||
_prevScreenNameStack.pop();
|
||||
}
|
||||
|
||||
void UserInterface::performQuitToMainMenu() {
|
||||
assert(_quitToMainMenu);
|
||||
|
||||
changeScreen(Screen::kScreenGame);
|
||||
StarkResourceProvider->shutdown();
|
||||
changeScreen(Screen::kScreenMainMenu);
|
||||
_prevScreenNameStack.clear();
|
||||
_quitToMainMenu = false;
|
||||
}
|
||||
|
||||
void UserInterface::restoreScreenHistory() {
|
||||
_shouldGoBackToPreviousScreen = false;
|
||||
_prevScreenNameStack.clear();
|
||||
_prevScreenNameStack.push(Screen::kScreenMainMenu);
|
||||
}
|
||||
@ -465,4 +456,19 @@ void UserInterface::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
|
||||
|
@ -101,10 +101,11 @@ public:
|
||||
/** Back to the previous displayed screen */
|
||||
void backPrevScreen();
|
||||
|
||||
/** Apply the scheduled screen change if any */
|
||||
void doQueuedScreenChange();
|
||||
|
||||
/** Back to the main menu screen and rest resources */
|
||||
void requestQuitToMainMenu() { _quitToMainMenu = true; }
|
||||
bool hasQuitToMainMenuRequest() { return _quitToMainMenu; }
|
||||
void performQuitToMainMenu();
|
||||
|
||||
/** Restore the screen travelling history to the initial state*/
|
||||
void restoreScreenHistory();
|
||||
@ -231,6 +232,9 @@ private:
|
||||
|
||||
bool _shouldToggleSubtitle;
|
||||
|
||||
// TODO: Generalize to all screen changes
|
||||
bool _shouldGoBackToPreviousScreen;
|
||||
|
||||
Graphics::Surface *_gameWindowThumbnail;
|
||||
};
|
||||
|
||||
|
@ -184,9 +184,7 @@ void StarkEngine::mainLoop() {
|
||||
break;
|
||||
}
|
||||
|
||||
if (_userInterface->hasQuitToMainMenuRequest()) {
|
||||
_userInterface->performQuitToMainMenu();
|
||||
}
|
||||
_userInterface->doQueuedScreenChange();
|
||||
|
||||
if (_resourceProvider->hasLocationChangeRequest()) {
|
||||
_global->setNormalSpeed();
|
||||
|
Loading…
Reference in New Issue
Block a user