[Scummvm-cvs-logs] scummvm master -> 8eeb8f2814f946730323001462e4fcc8b9c7a652

dreammaster dreammaster at scummvm.org
Thu Nov 10 10:59:06 CET 2011


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:
8eeb8f2814 TSAGE: Implemented R2R help dialog


Commit: 8eeb8f2814f946730323001462e4fcc8b9c7a652
    https://github.com/scummvm/scummvm/commit/8eeb8f2814f946730323001462e4fcc8b9c7a652
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2011-11-10T01:58:28-08:00

Commit Message:
TSAGE: Implemented R2R help dialog

Changed paths:
    engines/tsage/ringworld2/ringworld2_dialogs.cpp
    engines/tsage/ringworld2/ringworld2_dialogs.h
    engines/tsage/ringworld2/ringworld2_logic.cpp
    engines/tsage/staticres.cpp
    engines/tsage/staticres.h



diff --git a/engines/tsage/ringworld2/ringworld2_dialogs.cpp b/engines/tsage/ringworld2/ringworld2_dialogs.cpp
index 553a10a..4cb023d 100644
--- a/engines/tsage/ringworld2/ringworld2_dialogs.cpp
+++ b/engines/tsage/ringworld2/ringworld2_dialogs.cpp
@@ -341,6 +341,103 @@ CharacterDialog::CharacterDialog() {
 	setCenter(160, 100);
 }
 
+/*--------------------------------------------------------------------------*/
+
+void HelpDialog::show() {
+	HelpDialog *dlg = new HelpDialog();
+	dlg->draw();
+
+	// Show the character selection dialog
+	GfxButton *btn = dlg->execute(&dlg->_btnResume);
+
+	// If a function button was selected, take care of it
+	Event evt;
+	evt.eventType = EVENT_KEYPRESS;
+	evt.kbd.keycode = Common::KEYCODE_INVALID;
+	if (btn == &dlg->_btnList[0]) {
+		evt.kbd.keycode = Common::KEYCODE_F2;
+	} else if (btn == &dlg->_btnList[1]) {
+		evt.kbd.keycode = Common::KEYCODE_F3;
+	} else if (btn == &dlg->_btnList[2]) {
+		evt.kbd.keycode = Common::KEYCODE_F4;
+	} else if (btn == &dlg->_btnList[3]) {
+		evt.kbd.keycode = Common::KEYCODE_F5;
+	} else if (btn == &dlg->_btnList[4]) {
+		evt.kbd.keycode = Common::KEYCODE_F7;
+	} else if (btn == &dlg->_btnList[5]) {
+		evt.kbd.keycode = Common::KEYCODE_F8;
+	} else if (btn == &dlg->_btnList[6]) {
+		evt.kbd.keycode = Common::KEYCODE_F10;
+	}
+
+	// Remove the dialog
+	dlg->remove();
+	delete dlg;
+
+	// If a action button was selected, dispatch to handle it
+	if (evt.kbd.keycode != Common::KEYCODE_INVALID)
+		R2_GLOBALS._game->processEvent(evt);
+}
+
+HelpDialog::HelpDialog() {
+	// Set the title and game version
+	_msgTitle.set(HELP_MSG, 172, ALIGN_CENTER);
+	_msgTitle._bounds.moveTo(5, 0);
+	_msgVersion.set(GAME_VERSION, 172, ALIGN_CENTER);
+	_msgVersion._bounds.moveTo(5, _msgTitle._bounds.bottom + 3);
+	addElements(&_msgTitle, &_msgVersion, NULL);	
+
+	// Set buttons
+	_btnList[0].setText(F2);
+	_btnList[0]._bounds.moveTo(5, _msgVersion._bounds.bottom + 2);
+	_btnDescription[0].set(SOUND_OPTIONS, 140, ALIGN_LEFT);
+	_btnDescription[0]._bounds.moveTo(_btnList[0]._bounds.right + 2, _btnList[0]._bounds.top + 4);
+
+	_btnList[1].setText(F3);
+	_btnList[1]._bounds.moveTo(5, _btnList[0]._bounds.bottom);
+	_btnDescription[1].set(QUIT_GAME, 140, ALIGN_LEFT);
+	_btnDescription[1]._bounds.moveTo(_btnList[1]._bounds.right + 2, _btnList[1]._bounds.top + 4);
+
+	_btnList[2].setText(F4);
+	_btnList[2]._bounds.moveTo(5, _btnList[1]._bounds.bottom);
+	_btnDescription[2].set(RESTART_GAME, 140, ALIGN_LEFT);
+	_btnDescription[2]._bounds.moveTo(_btnList[2]._bounds.right + 2, _btnList[2]._bounds.top + 4);
+
+	_btnList[3].setText(F5);
+	_btnList[3]._bounds.moveTo(5, _btnList[2]._bounds.bottom);
+	_btnDescription[3].set(SAVE_GAME, 140, ALIGN_LEFT);
+	_btnDescription[3]._bounds.moveTo(_btnList[3]._bounds.right + 2, _btnList[3]._bounds.top + 4);
+
+	_btnList[4].setText(F7);
+	_btnList[4]._bounds.moveTo(5, _btnList[3]._bounds.bottom);
+	_btnDescription[4].set(RESTORE_GAME, 140, ALIGN_LEFT);
+	_btnDescription[4]._bounds.moveTo(_btnList[4]._bounds.right + 2, _btnList[4]._bounds.top + 4);
+
+	_btnList[5].setText(F8);
+	_btnList[5]._bounds.moveTo(5, _btnList[4]._bounds.bottom);
+	_btnDescription[5].set(SHOW_CREDITS, 140, ALIGN_LEFT);
+	_btnDescription[5]._bounds.moveTo(_btnList[5]._bounds.right + 2, _btnList[5]._bounds.top + 4);
+
+	_btnList[6].setText(F10);
+	_btnList[6]._bounds.moveTo(5, _btnList[5]._bounds.bottom);
+	_btnDescription[6].set(PAUSE_GAME, 140, ALIGN_LEFT);
+	_btnDescription[6]._bounds.moveTo(_btnList[6]._bounds.right + 2, _btnList[6]._bounds.top + 4);
+
+	for (int i = 0; i < 7; ++i) {
+		addElements(&_btnList[i], &_btnDescription[i], NULL);
+	}
+
+	// Add 'Resume' button
+	_btnResume.setText(RESUME_PLAY);
+	_btnResume._bounds.moveTo(5, _btnList[6]._bounds.bottom + 2);
+	addElements(&_btnResume, NULL);
+
+	// Set the dialog size and position
+	frame();
+	_bounds.collapse(-6, -6);
+	setCenter(160, 100);
+}
+
 } // End of namespace Ringworld2
 
 } // End of namespace TsAGE
diff --git a/engines/tsage/ringworld2/ringworld2_dialogs.h b/engines/tsage/ringworld2/ringworld2_dialogs.h
index 89e5054..02a1aed 100644
--- a/engines/tsage/ringworld2/ringworld2_dialogs.h
+++ b/engines/tsage/ringworld2/ringworld2_dialogs.h
@@ -71,6 +71,19 @@ public:
 	static void show();
 };
 
+class HelpDialog: public GfxDialog {
+private:
+	GfxMessage _msgTitle, _msgVersion;
+	GfxButton _btnList[7];
+	GfxMessage _btnDescription[7];
+	GfxButton _btnResume;
+public:
+	HelpDialog();
+	virtual ~HelpDialog() {}
+
+	static void show();
+};
+
 } // End of namespace Ringworld2
 
 } // End of namespace TsAGE
diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp
index 94aa8c5..fa8d0be 100644
--- a/engines/tsage/ringworld2/ringworld2_logic.cpp
+++ b/engines/tsage/ringworld2/ringworld2_logic.cpp
@@ -659,7 +659,7 @@ void Ringworld2Game::processEvent(Event &event) {
 		switch (event.kbd.keycode) {
 		case Common::KEYCODE_F1:
 			// F1 - Help
-//			MessageDialog::show(HELP_MSG, OK_BTN_STRING);
+			HelpDialog::show();
 			break;
 
 		case Common::KEYCODE_F2:
@@ -685,6 +685,11 @@ void Ringworld2Game::processEvent(Event &event) {
 			g_globals->_events.setCursorFromFlag();
 			break;
 
+		case Common::KEYCODE_F8:
+			// F8 - Credits
+			warning("TODO: Show Credits");
+			break;
+
 		case Common::KEYCODE_F10:
 			// F10 - Pause
 			GfxDialog::setPalette();
diff --git a/engines/tsage/staticres.cpp b/engines/tsage/staticres.cpp
index 84b76ad..238e7b3 100644
--- a/engines/tsage/staticres.cpp
+++ b/engines/tsage/staticres.cpp
@@ -199,6 +199,23 @@ const char *CHAR_SEEKER_MSG = "  Seeker  ";
 const char *CHAR_MIRANDA_MSG = "Miranda";
 const char *CHAR_CANCEL_MSG = "  Cancel  ";
 
+const char *GAME_VERSION = "ScummVM Version";
+const char *SOUND_OPTIONS = "Sound options";
+const char *QUIT_GAME = "Quit";
+const char *RESTART_GAME = "Restart";
+const char *SAVE_GAME = "Save game";
+const char *RESTORE_GAME = "Restore game";
+const char *SHOW_CREDITS = "Show credits";
+const char *PAUSE_GAME = "Pause game";
+const char *RESUME_PLAY = "  Resume play  ";
+const char *F2 = "F2";
+const char *F3 = "F3";
+const char *F4 = "F4";
+const char *F5 = "F5";
+const char *F7 = "F7";
+const char *F8 = "F8";
+const char *F10 = "F10";
+
 } // End of namespace Ringworld2
 
 } // End of namespace TsAGE
diff --git a/engines/tsage/staticres.h b/engines/tsage/staticres.h
index 2fd97d1..faff3f4 100644
--- a/engines/tsage/staticres.h
+++ b/engines/tsage/staticres.h
@@ -157,6 +157,23 @@ extern const char *CHAR_SEEKER_MSG;
 extern const char *CHAR_MIRANDA_MSG;
 extern const char *CHAR_CANCEL_MSG;
 
+extern const char *GAME_VERSION;
+extern const char *SOUND_OPTIONS;
+extern const char *QUIT_GAME;
+extern const char *RESTART_GAME;
+extern const char *SAVE_GAME;
+extern const char *RESTORE_GAME;
+extern const char *SHOW_CREDITS;
+extern const char *PAUSE_GAME;
+extern const char *RESUME_PLAY;
+extern const char *F2;
+extern const char *F3;
+extern const char *F4;
+extern const char *F5;
+extern const char *F7;
+extern const char *F8;
+extern const char *F10;
+
 } // End of namespace Ringworld2
 
 } // End of namespace TsAGE






More information about the Scummvm-git-logs mailing list