[Scummvm-cvs-logs] scummvm master -> df39d9a9639d3f55a07af2bdd767d89095e109bd

sev- sev at scummvm.org
Tue Apr 15 21:18:58 CEST 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:
df39d9a963 FULLPIPE: Implement ModalMainMenu::init()


Commit: df39d9a9639d3f55a07af2bdd767d89095e109bd
    https://github.com/scummvm/scummvm/commit/df39d9a9639d3f55a07af2bdd767d89095e109bd
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2014-04-15T22:17:56+03:00

Commit Message:
FULLPIPE: Implement ModalMainMenu::init()

Changed paths:
    engines/fullpipe/constants.h
    engines/fullpipe/fullpipe.cpp
    engines/fullpipe/fullpipe.h
    engines/fullpipe/modal.cpp
    engines/fullpipe/modal.h



diff --git a/engines/fullpipe/constants.h b/engines/fullpipe/constants.h
index 741a55f..c0b7ed9 100644
--- a/engines/fullpipe/constants.h
+++ b/engines/fullpipe/constants.h
@@ -267,6 +267,7 @@ namespace Fullpipe {
 #define TrubaUp 680
 
 // Main Menu
+#define PIC_MEX_BGR 5300
 #define PIC_MNU_AUTHORS_L 4624
 #define PIC_MNU_CONTINUE_L 4626
 #define PIC_MNU_DEBUG_L 4632
diff --git a/engines/fullpipe/fullpipe.cpp b/engines/fullpipe/fullpipe.cpp
index 2b4c90b..c6cc270 100644
--- a/engines/fullpipe/fullpipe.cpp
+++ b/engines/fullpipe/fullpipe.cpp
@@ -191,6 +191,10 @@ void FullpipeEngine::initialize() {
 	_mgm = new MGM;
 }
 
+void FullpipeEngine::restartGame() {
+	warning("STUB: FullpipeEngine::restartGame()");
+}
+
 Common::Error FullpipeEngine::run() {
 	const Graphics::PixelFormat format(2, 5, 6, 5, 0, 11, 5, 0, 0);
 	// Initialize backend
diff --git a/engines/fullpipe/fullpipe.h b/engines/fullpipe/fullpipe.h
index 11d7585..9ba5da3 100644
--- a/engines/fullpipe/fullpipe.h
+++ b/engines/fullpipe/fullpipe.h
@@ -91,6 +91,7 @@ public:
 	GUI::Debugger *getDebugger() { return _console; }
 
 	void initialize();
+	void restartGame();
 
 	void setMusicAllowed(int val) { _musicAllowed = val; }
 
diff --git a/engines/fullpipe/modal.cpp b/engines/fullpipe/modal.cpp
index 46830fc..ba42096 100644
--- a/engines/fullpipe/modal.cpp
+++ b/engines/fullpipe/modal.cpp
@@ -901,6 +901,136 @@ bool ModalMainMenu::handleMessage(ExCommand *message) {
 	return false;
 }
 
+bool ModalMainMenu::init(int counterdiff) {
+	switch (_hoverAreaId) {
+	case PIC_MNU_RESTART_L:
+		g_fp->restartGame();
+
+		if (this == g_fp->_modalObject)
+			return false;
+
+		delete this;
+		break;
+
+	case PIC_MNU_EXIT_L:
+		{
+			ModalQuery *mq = new ModalQuery();
+
+			g_fp->_modalObject = mq;
+
+			mq->_parentObj = this;
+			mq->create(_scene, PIC_MEX_BGR);
+
+			_hoverAreaId = 0;
+
+			return true;
+		}
+
+	case PIC_MNU_DEBUG_L:
+		g_fp->_gameLoader->unloadScene(SC_MAINMENU);
+		g_fp->_sceneRect = _screct;
+
+		if (!g_fp->_currentScene)
+			error("ModalMainMenu::init: Bad state");
+
+		g_fp->_currentScene->_x = _bgX;
+		g_fp->_currentScene->_y = _bgY;
+
+		g_fp->_gameLoader->preloadScene(g_fp->_currentScene->_sceneId, SC_DBGMENU);
+
+		return false;
+
+	case PIC_MNU_CONTINUE_L:
+		if (!_mfield_34) {
+			g_fp->_gameLoader->unloadScene(SC_MAINMENU);
+			g_fp->_sceneRect = _screct;
+
+			if (g_fp->_currentScene) {
+				g_fp->_currentScene->_x = _bgX;
+				g_fp->_currentScene->_y = _bgY;
+			}
+
+			return false;
+		}
+
+		g_fp->restartGame();
+
+		if (this == g_fp->_modalObject)
+			return false;
+
+		delete this;
+		break;
+
+	case PIC_MNU_AUTHORS_L:
+		g_fp->_modalObject = new ModalCredits();
+		g_fp->_modalObject->_parentObj = this;
+
+		_hoverAreaId = 0;
+
+		return true;
+
+	case PIC_MNU_SAVE_L:
+	case PIC_MNU_LOAD_L:
+		{
+			ModalSaveGame *sg = new ModalSaveGame();
+
+			g_fp->_modalObject = sg;
+			g_fp->_modalObject->_parentObj = _parentObj;
+
+			int mode = 0;
+			if (_hoverAreaId == PIC_MNU_SAVE_L)
+				mode = 1;
+
+			sg->setup(g_fp->accessScene(SC_MAINMENU), mode);
+			sg->setScene(g_fp->accessScene(SC_MAINMENU));
+
+			sg->_rect = _screct;
+			sg->_oldBgX = _bgX;
+			sg->_oldBgY = _bgY;
+
+			delete this;
+		}
+
+		break;
+
+	default:
+		if (_lastArea) {
+			updateSliderPos();
+		} else {
+			g_fp->_cursorId = PIC_CSR_DEFAULT;
+
+			int idx = checkHover(g_fp->_mouseScreenPos);
+
+			if (idx < 0)
+				goto LABEL_40;
+
+			g_fp->_cursorId = PIC_CSR_DEFAULT;
+
+			if (idx != this->_menuSliderIdx && idx != this->_musicSliderIdx )
+				goto LABEL_40;
+		}
+
+		g_fp->_cursorId = PIC_CSR_LIFT;
+
+	LABEL_40:
+		g_fp->setCursor(g_fp->_cursorId);
+
+		updateVolume();
+
+		return true;
+	}
+
+	return true;
+}
+
+void ModalMainMenu::updateVolume() {
+	warning("STUB: ModalMainMenu::updateVolume()");
+}
+
+void ModalMainMenu::updateSliderPos() {
+	warning("STUB: ModalMainMenu::updateSliderPos()");
+}
+
 int ModalMainMenu::checkHover(Common::Point &point) {
 	warning("STUB: ModalMainMenu::checkHover()");
 
@@ -1008,6 +1138,18 @@ void ModalHelp::launch() {
 	}
 }
 
+void ModalQuery::create(Scene *sc, int picId) {
+	warning("STUB: ModalQuery::create()");
+}
+
+void ModalSaveGame::setScene(Scene *sc) {
+	warning("STUB: ModalSaveGame::setScene()");
+}
+
+void ModalSaveGame::setup(Scene *sc, int mode) {
+	warning("STUB: ModalSaveGame::setup()");
+}
+
 void FullpipeEngine::openHelp() {
 	if (!_modalObject) {
 		ModalHelp *help = new ModalHelp;
diff --git a/engines/fullpipe/modal.h b/engines/fullpipe/modal.h
index b932b69..c891ed4 100644
--- a/engines/fullpipe/modal.h
+++ b/engines/fullpipe/modal.h
@@ -174,7 +174,7 @@ public:
 
 	virtual bool pollEvent() { return true; }
 	virtual bool handleMessage(ExCommand *message);
-	virtual bool init(int counterdiff) { return true; }
+	virtual bool init(int counterdiff);
 	virtual void update();
 	virtual void saveload() {}
 
@@ -184,6 +184,8 @@ private:
 	void setSliderPos();
 	void enableDebugMenu(char c);
 	int checkHover(Common::Point &point);
+	void updateVolume();
+	void updateSliderPos();
 };
 
 class ModalHelp : public BaseModalObject {
@@ -210,7 +212,7 @@ public:
 
 class ModalQuery : public BaseModalObject {
 public:
-	ModalQuery();
+	ModalQuery() {}
 	virtual ~ModalQuery() {}
 
 	virtual bool pollEvent() { return true; }
@@ -218,11 +220,13 @@ public:
 	virtual bool init(int counterdiff) { return true; }
 	virtual void update() {}
 	virtual void saveload() {}
+
+	void create(Scene *sc, int picId);
 };
 
 class ModalSaveGame : public BaseModalObject {
 public:
-	ModalSaveGame();
+	ModalSaveGame() {}
 	virtual ~ModalSaveGame() {}
 
 	virtual bool pollEvent() { return true; }
@@ -230,6 +234,13 @@ public:
 	virtual bool init(int counterdiff) { return true; }
 	virtual void update() {}
 	virtual void saveload() {}
+
+	void setScene(Scene *sc);
+	void setup(Scene *sc, int mode);
+
+	Common::Rect _rect;
+	int _oldBgX;
+	int _oldBgY;
 };
 
 






More information about the Scummvm-git-logs mailing list