aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Sandulenko2014-01-24 07:21:50 -0800
committerEugene Sandulenko2014-01-24 07:21:50 -0800
commit89640976c4be7defb49b346350a8dba8fd1ebdd6 (patch)
treed0b582ce09a08c856330209eeade0051811d6f5d
parentce383aca1ee1f7f27c284169a2757ea3870e1bb1 (diff)
downloadscummvm-rg350-89640976c4be7defb49b346350a8dba8fd1ebdd6.tar.gz
scummvm-rg350-89640976c4be7defb49b346350a8dba8fd1ebdd6.tar.bz2
scummvm-rg350-89640976c4be7defb49b346350a8dba8fd1ebdd6.zip
FULLPIPE: Implement ModalFinal
-rw-r--r--engines/fullpipe/fullpipe.h3
-rw-r--r--engines/fullpipe/gfx.cpp4
-rw-r--r--engines/fullpipe/modal.cpp97
-rw-r--r--engines/fullpipe/modal.h35
-rw-r--r--engines/fullpipe/sound.cpp4
5 files changed, 141 insertions, 2 deletions
diff --git a/engines/fullpipe/fullpipe.h b/engines/fullpipe/fullpipe.h
index aa6e0dac3a..0fc69c2de3 100644
--- a/engines/fullpipe/fullpipe.h
+++ b/engines/fullpipe/fullpipe.h
@@ -157,6 +157,7 @@ public:
void stopSoundStream2();
void stopAllSoundStreams();
void stopAllSoundInstances(int id);
+ void updateSoundVolume();
int _sfxVolume;
@@ -224,6 +225,8 @@ public:
int (*_updateScreenCallback)();
int (*_updateCursorCallback)();
+ void drawAlphaRectangle(int x1, int y1, int x2, int y2, int alpha);
+
int _cursorId;
int _minCursorId;
int _maxCursorId;
diff --git a/engines/fullpipe/gfx.cpp b/engines/fullpipe/gfx.cpp
index a67a4d7b19..2d68600dbb 100644
--- a/engines/fullpipe/gfx.cpp
+++ b/engines/fullpipe/gfx.cpp
@@ -1295,4 +1295,8 @@ DynamicPhase *Shadows::findSize(int width, int height) {
return _items[idx].dynPhase;
}
+void FullpipeEngine::drawAlphaRectangle(int x1, int y1, int x2, int y2, int alpha) {
+ warning("STUB: FullpipeEngine::drawAlphaRectangle()");
+}
+
} // End of namespace Fullpipe
diff --git a/engines/fullpipe/modal.cpp b/engines/fullpipe/modal.cpp
index ddb5b63d6a..5ee6395f6a 100644
--- a/engines/fullpipe/modal.cpp
+++ b/engines/fullpipe/modal.cpp
@@ -560,6 +560,103 @@ void FullpipeEngine::openMap() {
}
}
+ModalFinal::ModalFinal() {
+ _flags = 0;
+ _counter = 255;
+ _sfxVolume = g_fp->_sfxVolume;
+}
+
+ModalFinal::~ModalFinal() {
+ if (g_vars->sceneFinal_var01) {
+ g_fp->_gameLoader->unloadScene(SC_FINAL2);
+ g_fp->_gameLoader->unloadScene(SC_FINAL3);
+ g_fp->_gameLoader->unloadScene(SC_FINAL4);
+
+ g_fp->_currentScene = g_fp->accessScene(SC_FINAL1);
+
+ g_fp->stopAllSounds();
+
+ g_vars->sceneFinal_var01 = 0;
+ }
+
+ g_fp->_sfxVolume = _sfxVolume;
+}
+
+bool ModalFinal::init(int counterdiff) {
+ if (g_vars->sceneFinal_var01) {
+ g_fp->_gameLoader->updateSystems(42);
+
+ return true;
+ }
+
+ if (_counter > 0) {
+ _flags |= 2u;
+
+ g_fp->_gameLoader->updateSystems(42);
+
+ return true;
+ }
+
+ unloadScenes();
+
+ g_fp->_modalObject = new ModalCredits();
+
+ return true;
+}
+
+void ModalFinal::unloadScenes() {
+ g_fp->_gameLoader->unloadScene(SC_FINAL2);
+ g_fp->_gameLoader->unloadScene(SC_FINAL3);
+ g_fp->_gameLoader->unloadScene(SC_FINAL4);
+
+ g_fp->_currentScene = g_fp->accessScene(SC_FINAL1);
+
+ g_fp->stopAllSounds();
+}
+
+bool ModalFinal::handleMessage(ExCommand *cmd) {
+ if (cmd->_messageKind == 17 && cmd->_messageNum == 36 && cmd->_keyCode == 27) {
+ g_fp->_modalObject = new ModalMainMenu();
+ g_fp->_modalObject->_parentObj = this;
+
+ return true;
+ }
+
+ return false;
+}
+
+void ModalFinal::update() {
+ if (g_fp->_currentScene) {
+ g_fp->_currentScene->draw();
+
+ if (_flags & 1) {
+ g_fp->drawAlphaRectangle(0, 0, 800, 600, 0xff - _counter);
+
+ _counter += 10;
+
+ if (_counter >= 255) {
+ _counter = 255;
+ _flags &= 0xfe;
+ }
+ } else {
+ if (!(_flags & 2))
+ return;
+
+ g_fp->drawAlphaRectangle(0, 0, 800, 600, 0xff - _counter);
+ _counter -= 10;
+
+ if (_counter <= 0) {
+ _counter = 0;
+ _flags &= 0xFD;
+ }
+ }
+
+ g_fp->_sfxVolume = _counter * (_sfxVolume + 3000) / 255 - 3000;
+
+ g_fp->updateSoundVolume();
+ }
+}
+
void FullpipeEngine::openHelp() {
warning("STUB: FullpipeEngine::openHelp()");
}
diff --git a/engines/fullpipe/modal.h b/engines/fullpipe/modal.h
index 65210aaab3..925e4ed58e 100644
--- a/engines/fullpipe/modal.h
+++ b/engines/fullpipe/modal.h
@@ -107,9 +107,27 @@ class ModalMap : public BaseModalObject {
};
class ModalFinal : public BaseModalObject {
+ int _flags;
+ int _counter;
+ int _sfxVolume;
+
+ public:
+ ModalFinal();
+ virtual ~ModalFinal();
+
+ virtual bool pollEvent() { return true; }
+ virtual bool handleMessage(ExCommand *message);
+ virtual bool init(int counterdiff);
+ virtual void update();
+ virtual void saveload() {}
+
+ void unloadScenes();
+};
+
+class ModalCredits : public BaseModalObject {
public:
- ModalFinal() {}
- virtual ~ModalFinal() {}
+ ModalCredits() {}
+ virtual ~ModalCredits() {}
virtual bool pollEvent() { return true; }
virtual bool handleMessage(ExCommand *message) { return false; }
@@ -118,6 +136,19 @@ class ModalFinal : public BaseModalObject {
virtual void saveload() {}
};
+class ModalMainMenu : public BaseModalObject {
+ public:
+ ModalMainMenu() {}
+ virtual ~ModalMainMenu() {}
+
+ virtual bool pollEvent() { return true; }
+ virtual bool handleMessage(ExCommand *message) { return false; }
+ virtual bool init(int counterdiff) { return true; }
+ virtual void update() {}
+ virtual void saveload() {}
+};
+
+
} // End of namespace Fullpipe
#endif /* FULLPIPE_MODAL_H */
diff --git a/engines/fullpipe/sound.cpp b/engines/fullpipe/sound.cpp
index cf66cb40a1..fd25e2c903 100644
--- a/engines/fullpipe/sound.cpp
+++ b/engines/fullpipe/sound.cpp
@@ -199,4 +199,8 @@ void FullpipeEngine::stopAllSoundInstances(int id) {
}
}
+void FullpipeEngine::updateSoundVolume() {
+ debug(3, "STUB FullpipeEngine::updateSoundVolume()");
+}
+
} // End of namespace Fullpipe