aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorFilippos Karapetis2007-08-24 12:05:05 +0000
committerFilippos Karapetis2007-08-24 12:05:05 +0000
commit84d2dda5ed95ccadd99a56b664e12ced6219da41 (patch)
tree28cf2fff80bdab6b609b3c5bc8ab56c4555b7ac7 /engines
parentef7c66893a28e24bf10ec63e86dcd91f4b380061 (diff)
downloadscummvm-rg350-84d2dda5ed95ccadd99a56b664e12ced6219da41.tar.gz
scummvm-rg350-84d2dda5ed95ccadd99a56b664e12ced6219da41.tar.bz2
scummvm-rg350-84d2dda5ed95ccadd99a56b664e12ced6219da41.zip
Code cleanup for the IHNM demo
svn-id: r28707
Diffstat (limited to 'engines')
-rw-r--r--engines/saga/animation.cpp5
-rw-r--r--engines/saga/gfx.cpp4
-rw-r--r--engines/saga/interface.cpp51
-rw-r--r--engines/saga/scene.cpp2
-rw-r--r--engines/saga/scene.h4
5 files changed, 25 insertions, 41 deletions
diff --git a/engines/saga/animation.cpp b/engines/saga/animation.cpp
index 00abc02d86..7de88abc7a 100644
--- a/engines/saga/animation.cpp
+++ b/engines/saga/animation.cpp
@@ -312,12 +312,13 @@ void Anim::clearCutaway(void) {
_vm->_interface->restoreMode();
if (_vm->getGameId() != GID_IHNM_DEMO) {
- if (_vm->_scene->currentSceneNumber() >= 144 && _vm->_scene->currentSceneNumber() <= 149) {
+ _vm->_gfx->showCursor(true);
+ } else {
+ if (_vm->_scene->isNonInteractiveIHNMDemoPart()) {
// Don't show the mouse cursor in the non-interactive part of the IHNM demo
} else {
_vm->_gfx->showCursor(true);
}
- } else {
// Enable the save reminder state after each cutaway for the IHNM demo
_vm->_interface->setSaveReminderState(true);
}
diff --git a/engines/saga/gfx.cpp b/engines/saga/gfx.cpp
index 7aec6a05ce..31e730d8d2 100644
--- a/engines/saga/gfx.cpp
+++ b/engines/saga/gfx.cpp
@@ -462,6 +462,10 @@ void Gfx::palFade(PalEntry *srcPal, int16 from, int16 to, int16 start, int16 num
}
void Gfx::showCursor(bool state) {
+ // Don't show the mouse cursor in the non-interactive part of the IHNM demo
+ if (_vm->_scene->isNonInteractiveIHNMDemoPart())
+ state = false;
+
CursorMan.showMouse(state);
}
diff --git a/engines/saga/interface.cpp b/engines/saga/interface.cpp
index 23c590765e..4ed1c69649 100644
--- a/engines/saga/interface.cpp
+++ b/engines/saga/interface.cpp
@@ -351,15 +351,6 @@ int Interface::activate() {
draw();
}
- if (_vm->getGameId() != GID_IHNM_DEMO) {
- _vm->_gfx->showCursor(true);
- } else {
- if (_vm->_scene->currentSceneNumber() >= 144 && _vm->_scene->currentSceneNumber() <= 149) {
- // Don't show the mouse cursor in the non-interactive part of the IHNM demo
- } else {
- _vm->_gfx->showCursor(true);
- }
- }
return SUCCESS;
}
@@ -406,9 +397,6 @@ void Interface::setMode(int mode) {
if (_vm->getGameId() == GID_IHNM_DEMO) {
_inMainMode = true;
_saveReminderState = 1;
- if ((_vm->_scene->currentSceneNumber() >= 144 && _vm->_scene->currentSceneNumber() <= 149) ||
- _vm->_scene->currentSceneNumber() == 0 || _vm->_scene->currentSceneNumber() == -1)
- _vm->_gfx->showCursor(false);
}
} else if (mode == kPanelOption) {
// Show the cursor in the IHNM demo
@@ -512,10 +500,8 @@ bool Interface::processAscii(uint16 ascii) {
return true;
}
- if (_vm->getGameId() == GID_IHNM_DEMO) {
- if (_vm->_scene->currentSceneNumber() >= 144 && _vm->_scene->currentSceneNumber() <= 149)
- _vm->_scene->showIHNMDemoSpecialScreen();
- }
+ if (_vm->_scene->isNonInteractiveIHNMDemoPart())
+ _vm->_scene->showIHNMDemoSpecialScreen();
break;
case kPanelCutaway:
if (ascii == 27) { // Esc
@@ -525,10 +511,8 @@ bool Interface::processAscii(uint16 ascii) {
return true;
}
- if (_vm->getGameId() == GID_IHNM_DEMO) {
- if (_vm->_scene->currentSceneNumber() >= 144 && _vm->_scene->currentSceneNumber() <= 149)
- _vm->_scene->showIHNMDemoSpecialScreen();
- }
+ if (_vm->_scene->isNonInteractiveIHNMDemoPart())
+ _vm->_scene->showIHNMDemoSpecialScreen();
break;
case kPanelVideo:
if (ascii == 27) { // Esc
@@ -542,10 +526,8 @@ bool Interface::processAscii(uint16 ascii) {
return true;
}
- if (_vm->getGameId() == GID_IHNM_DEMO) {
- if (_vm->_scene->currentSceneNumber() >= 144 && _vm->_scene->currentSceneNumber() <= 149)
- _vm->_scene->showIHNMDemoSpecialScreen();
- }
+ if (_vm->_scene->isNonInteractiveIHNMDemoPart())
+ _vm->_scene->showIHNMDemoSpecialScreen();
break;
case kPanelOption:
// TODO: check input dialog keys
@@ -1553,11 +1535,8 @@ void Interface::setOption(PanelButton *panelButton) {
} else {
if (_vm->_scene->currentChapterNumber() == 8) {
setMode(kPanelChapterSelection);
- } else if (_vm->getGameId() == GID_IHNM_DEMO) {
- if (_vm->_scene->currentSceneNumber() >= 144 && _vm->_scene->currentSceneNumber() <= 149)
- setMode(kPanelNull);
- else
- setMode(kPanelMain);
+ } else if (_vm->_scene->isNonInteractiveIHNMDemoPart()) {
+ setMode(kPanelNull);
} else {
setMode(kPanelMain);
}
@@ -1577,11 +1556,9 @@ void Interface::setOption(PanelButton *panelButton) {
}
break;
case kTextSave:
- // Disallow saving in the non-interactive part of the IHNM demo
- if (_vm->getGameId() == GID_IHNM_DEMO) {
- if (_vm->_scene->currentSceneNumber() >= 144 && _vm->_scene->currentSceneNumber() <= 149)
- return;
- }
+ // Disallow saving in the non-interactive part of the IHNM demo (original demo didn't support saving at all)
+ if (_vm->_scene->isNonInteractiveIHNMDemoPart())
+ return;
if (!_vm->isSaveListFull() && (_optionSaveFileTitleNumber == 0)) {
_textInputString[0] = 0;
@@ -1800,10 +1777,8 @@ void Interface::update(const Point& mousePoint, int updateFlag) {
break;
case kPanelNull:
- if (_vm->getGameId() == GID_IHNM_DEMO && (updateFlag & UPDATE_MOUSECLICK)) {
- if (_vm->_scene->currentSceneNumber() >= 144 && _vm->_scene->currentSceneNumber() <= 149)
- _vm->_scene->showIHNMDemoSpecialScreen();
- }
+ if (_vm->_scene->isNonInteractiveIHNMDemoPart() && (updateFlag & UPDATE_MOUSECLICK))
+ _vm->_scene->showIHNMDemoSpecialScreen();
break;
}
diff --git a/engines/saga/scene.cpp b/engines/saga/scene.cpp
index 5ab7fbb4a5..3076fa26cf 100644
--- a/engines/saga/scene.cpp
+++ b/engines/saga/scene.cpp
@@ -655,7 +655,7 @@ void Scene::loadScene(LoadSceneParams *loadSceneParams) {
debug(3, "Loading scene number %d:", _sceneNumber);
- if (_vm->getGameId() == GID_IHNM_DEMO && (_sceneNumber >= 144 && _sceneNumber <= 149)) {
+ if (isNonInteractiveIHNMDemoPart()) {
// WORKAROUND for the non-interactive part of the IHNM demo: When restarting the
// non-interactive demo, opcode sfMainMode is incorrectly called. Therefore, if any
// of the scenes of the non-interactive demo are loaded (scenes 144-149), set panel
diff --git a/engines/saga/scene.h b/engines/saga/scene.h
index da97bddff5..47abfcb959 100644
--- a/engines/saga/scene.h
+++ b/engines/saga/scene.h
@@ -345,6 +345,10 @@ class Scene {
void clearPsychicProfile();
void showIHNMDemoSpecialScreen();
+ bool isNonInteractiveIHNMDemoPart() {
+ return _vm->getGameId() == GID_IHNM_DEMO && (_sceneNumber >= 144 && _sceneNumber <= 149);
+ }
+
private:
void loadScene(LoadSceneParams *loadSceneParams);
void loadSceneDescriptor(uint32 resourceId);