[Scummvm-cvs-logs] scummvm master -> 89640976c4be7defb49b346350a8dba8fd1ebdd6

sev- sev at scummvm.org
Fri Jan 24 17:19:08 CET 2014


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
89640976c4 FULLPIPE: Implement ModalFinal


Commit: 89640976c4be7defb49b346350a8dba8fd1ebdd6
    https://github.com/scummvm/scummvm/commit/89640976c4be7defb49b346350a8dba8fd1ebdd6
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2014-01-24T07:21:50-08:00

Commit Message:
FULLPIPE: Implement ModalFinal

Changed paths:
    engines/fullpipe/fullpipe.h
    engines/fullpipe/gfx.cpp
    engines/fullpipe/modal.cpp
    engines/fullpipe/modal.h
    engines/fullpipe/sound.cpp



diff --git a/engines/fullpipe/fullpipe.h b/engines/fullpipe/fullpipe.h
index aa6e0da..0fc69c2 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 a67a4d7..2d68600 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 ddb5b63..5ee6395 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 65210aa..925e4ed 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 cf66cb4..fd25e2c 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






More information about the Scummvm-git-logs mailing list