aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTorbjörn Andersson2010-11-01 11:25:11 +0000
committerTorbjörn Andersson2010-11-01 11:25:11 +0000
commit68469f45ceeb8592020e262d616c98327416120e (patch)
tree8889b0ebccf8a1732236bda3112f260f6aca7ff4
parente48cdb378c89e17c5f213eb921c0841aca062bd6 (diff)
downloadscummvm-rg350-68469f45ceeb8592020e262d616c98327416120e.tar.gz
scummvm-rg350-68469f45ceeb8592020e262d616c98327416120e.tar.bz2
scummvm-rg350-68469f45ceeb8592020e262d616c98327416120e.zip
SWORD2: Cleanup pause handling
Removed a bunch of pause-related code which I either can't remember why it's there, or which doesn't seem to serve any useful purpose. Most things I've tried seem to work as well or better than before. svn-id: r53997
-rw-r--r--engines/sword2/animation.cpp6
-rw-r--r--engines/sword2/animation.h1
-rw-r--r--engines/sword2/logic.cpp10
-rw-r--r--engines/sword2/logic.h2
-rw-r--r--engines/sword2/palette.cpp3
-rw-r--r--engines/sword2/sound.cpp12
-rw-r--r--engines/sword2/sound.h3
-rw-r--r--engines/sword2/sword2.cpp54
-rw-r--r--engines/sword2/sword2.h4
9 files changed, 15 insertions, 80 deletions
diff --git a/engines/sword2/animation.cpp b/engines/sword2/animation.cpp
index 10895b2ec1..f664e784d5 100644
--- a/engines/sword2/animation.cpp
+++ b/engines/sword2/animation.cpp
@@ -398,10 +398,4 @@ MoviePlayer *makeMoviePlayer(const char *name, Sword2Engine *vm, Audio::Mixer *s
return NULL;
}
-void MoviePlayer::pauseMovie(bool pause) {
- if (_bgSoundHandle) {
- _snd->pauseHandle(*_bgSoundHandle, pause);
- }
-}
-
} // End of namespace Sword2
diff --git a/engines/sword2/animation.h b/engines/sword2/animation.h
index ee32b1d5f2..4796d39097 100644
--- a/engines/sword2/animation.h
+++ b/engines/sword2/animation.h
@@ -76,7 +76,6 @@ public:
bool load(const char *name);
void play(MovieText *movieTexts, uint32 numMovieTexts, uint32 leadIn, uint32 leadOut);
- void pauseMovie(bool pause);
protected:
Sword2Engine *_vm;
diff --git a/engines/sword2/logic.cpp b/engines/sword2/logic.cpp
index 394bf7ddc8..511561c55a 100644
--- a/engines/sword2/logic.cpp
+++ b/engines/sword2/logic.cpp
@@ -278,16 +278,6 @@ void Logic::resetKillList() {
}
/**
- * Pause or unpause the currently playing cutscene movie, if any.
- * @param pause true if pausing, false if unpausing
- */
-
-void Logic::pauseMovie(bool pause) {
- if (_moviePlayer)
- _moviePlayer->pauseMovie(pause);
-}
-
-/**
* Read current location number from script vars
*/
diff --git a/engines/sword2/logic.h b/engines/sword2/logic.h
index 8c49225df2..793f87d037 100644
--- a/engines/sword2/logic.h
+++ b/engines/sword2/logic.h
@@ -317,8 +317,6 @@ public:
void logicOne(uint32 new_script);
void resetKillList();
- void pauseMovie(bool pause);
-
// Read location number from script vars
uint32 getLocationNum();
};
diff --git a/engines/sword2/palette.cpp b/engines/sword2/palette.cpp
index 84ebd142ca..dd1a2ba877 100644
--- a/engines/sword2/palette.cpp
+++ b/engines/sword2/palette.cpp
@@ -171,6 +171,9 @@ void Screen::setPalette(int16 startEntry, int16 noEntries, byte *colourTable, ui
}
void Screen::dimPalette(bool dim) {
+ if (getFadeStatus() != RDFADE_NONE)
+ return;
+
if (dim != _dimPalette) {
_dimPalette = dim;
setSystemPalette(_palette, 0, 256);
diff --git a/engines/sword2/sound.cpp b/engines/sword2/sound.cpp
index e36c946eba..b1d0dee81b 100644
--- a/engines/sword2/sound.cpp
+++ b/engines/sword2/sound.cpp
@@ -393,18 +393,6 @@ int32 Sound::stopFx(int32 i) {
return RD_OK;
}
-void Sound::pauseAllSound() {
- pauseMusic();
- pauseSpeech();
- pauseFx();
-}
-
-void Sound::unpauseAllSound() {
- unpauseMusic();
- unpauseSpeech();
- unpauseFx();
-}
-
void Sound::printFxQueue() {
int freeSlots = 0;
diff --git a/engines/sword2/sound.h b/engines/sword2/sound.h
index 29bbdf22ca..5acc39179f 100644
--- a/engines/sword2/sound.h
+++ b/engines/sword2/sound.h
@@ -262,9 +262,6 @@ public:
void pauseMusic();
void unpauseMusic();
- void pauseAllSound();
- void unpauseAllSound();
-
void playMovieSound(int32 res, int type);
void stopMovieSounds();
diff --git a/engines/sword2/sword2.cpp b/engines/sword2/sword2.cpp
index b3b688771a..1d56306f58 100644
--- a/engines/sword2/sword2.cpp
+++ b/engines/sword2/sword2.cpp
@@ -295,8 +295,6 @@ Sword2Engine::Sword2Engine(OSystem *syst) : Engine(syst) {
_renderSkip = false;
#endif
- _gamePaused = false;
-
_gameCycle = 0;
_gameSpeed = 1;
@@ -516,10 +514,18 @@ Common::Error Sword2Engine::run() {
} else if (ke->kbd.hasFlags(0) || ke->kbd.hasFlags(Common::KBD_SHIFT)) {
switch (ke->kbd.keycode) {
case Common::KEYCODE_p:
- if (_gamePaused)
+ if (isPaused()) {
+ _screen->dimPalette(false);
pauseEngine(false);
- else
+ } else {
pauseEngine(true);
+#ifdef SWORD2_DEBUG
+ if (!_stepOneCycle)
+ _screen->dimPalette(true);
+#else
+ _screen->dimPalette(true);
+#endif
+ }
break;
#if 0
// Disabled because of strange rumors about the
@@ -551,7 +557,7 @@ Common::Error Sword2Engine::run() {
}
// skip GameCycle if we're paused
- if (!_gamePaused) {
+ if (!isPaused()) {
_gameCycle++;
gameCycle();
}
@@ -798,49 +804,13 @@ void Sword2Engine::sleepUntil(uint32 time) {
}
}
-void Sword2Engine::pauseEngine(bool pause) {
- if (pause == _gamePaused)
- return;
-
- // We don't need to hide the cursor for outside pausing. Not as long
- // as it replaces the cursor with the GUI cursor, at least.
-
- _mouse->pauseEngine(pause);
- pauseEngineIntern(pause);
-
- if (pause) {
-#ifdef SWORD2_DEBUG
- // Don't dim it if we're single-stepping through frames
- // dim the palette during the pause
-
- if (!_stepOneCycle)
- _screen->dimPalette(true);
-#else
- _screen->dimPalette(true);
-#endif
- } else {
- _screen->dimPalette(false);
-
- // If mouse is about or we're in a chooser menu
- if (!_mouse->getMouseStatus() || _mouse->isChoosing())
- _mouse->setMouse(NORMAL_MOUSE_ID);
- }
-}
-
void Sword2Engine::pauseEngineIntern(bool pause) {
- if (pause == _gamePaused)
- return;
+ Engine::pauseEngineIntern(pause);
if (pause) {
- _sound->pauseAllSound();
- _logic->pauseMovie(true);
_screen->pauseScreen(true);
- _gamePaused = true;
} else {
- _logic->pauseMovie(false);
_screen->pauseScreen(false);
- _sound->unpauseAllSound();
- _gamePaused = false;
}
}
diff --git a/engines/sword2/sword2.h b/engines/sword2/sword2.h
index 4fb856804b..ed1c335474 100644
--- a/engines/sword2/sword2.h
+++ b/engines/sword2/sword2.h
@@ -155,8 +155,6 @@ public:
Sword2Engine(OSystem *syst);
~Sword2Engine();
- void pauseEngine(bool pause);
-
int getFramesPerSecond();
void registerDefaultSettings();
@@ -237,8 +235,6 @@ public:
char *getSaveFileName(uint16 slotNo);
uint32 findBufferSize();
- bool _gamePaused;
-
void startGame();
void gameCycle();
void restartGame();