PRIVATE: some palette fixes when the games is paused/unpaused

This commit is contained in:
neuromancer 2021-10-30 18:10:22 +02:00
parent a14662a5ef
commit b9f84d4410
3 changed files with 20 additions and 9 deletions

View File

@ -513,12 +513,7 @@ static void fTransition(ArgArray args) {
static void fResume(ArgArray args) {
assert(args[0].type == NUM);
debugC(1, kPrivateDebugScript, "Resume(%d)", args[0].u.val); // this value is always 1
g_private->_nextSetting = g_private->_pausedSetting;
g_private->_pausedSetting = "";
g_private->_mode = 1;
g_private->_origin = Common::Point(kOriginOne[0], kOriginOne[1]);
if (g_private->_videoDecoder)
g_private->_videoDecoder->pauseVideo(false);
g_private->resumeGame();
}
static void fMovie(ArgArray args) {

View File

@ -264,7 +264,7 @@ Common::Error PrivateEngine::run() {
else if (selectSafeDigit(mousePos))
break;
selectPauseMovie(mousePos);
selectPauseGame(mousePos);
selectPhoneArea(mousePos);
selectPoliceRadioArea(mousePos);
selectAMRadioArea(mousePos);
@ -601,11 +601,12 @@ Common::String PrivateEngine::getInventoryCursor() {
return "k7";
}
void PrivateEngine::selectPauseMovie(Common::Point mousePos) {
void PrivateEngine::selectPauseGame(Common::Point mousePos) {
if (_mode == 1 && !_policeBustEnabled) {
uint32 tol = 15;
Common::Rect window(_origin.x - tol, _origin.y - tol, _screenW - _origin.x + tol, _screenH - _origin.y + tol);
if (!window.contains(mousePos)) {
// Pause game and return to desktop
if (_pausedSetting.empty()) {
if (!_nextSetting.empty())
_pausedSetting = _nextSetting;
@ -621,6 +622,20 @@ void PrivateEngine::selectPauseMovie(Common::Point mousePos) {
}
}
void PrivateEngine::resumeGame() {
_nextSetting = _pausedSetting;
_pausedSetting = "";
_mode = 1;
_origin = Common::Point(kOriginOne[0], kOriginOne[1]);
if (_videoDecoder) {
_videoDecoder->pauseVideo(false);
const byte *videoPalette = g_private->_videoDecoder->getPalette();
g_system->getPaletteManager()->setPalette(videoPalette, 0, 256);
drawScreenFrame(videoPalette);
}
}
void PrivateEngine::selectExit(Common::Point mousePos) {
mousePos = mousePos - _origin;
if (mousePos.x < 0 || mousePos.y < 0)

View File

@ -168,11 +168,12 @@ public:
void initFuncs();
// User input
void selectPauseMovie(Common::Point);
void selectPauseGame(Common::Point);
void selectMask(Common::Point);
void selectExit(Common::Point);
void selectLoadGame(Common::Point);
void selectSaveGame(Common::Point);
void resumeGame();
// Cursors
bool cursorPauseMovie(Common::Point);