aboutsummaryrefslogtreecommitdiff
path: root/engines/tsage/ringworld2/ringworld2_dialogs.cpp
diff options
context:
space:
mode:
authorPaul Gilbert2011-11-02 20:44:28 +1100
committerPaul Gilbert2011-11-02 20:44:28 +1100
commit5d08dbfa114fd03b9d811f2a961c13dbc4804d2c (patch)
tree2d42a8bd9e25a55ff5e389c23fb2d0c495db2cac /engines/tsage/ringworld2/ringworld2_dialogs.cpp
parente9aebf0a210271cb2489332ad0c4ea13bea7542f (diff)
downloadscummvm-rg350-5d08dbfa114fd03b9d811f2a961c13dbc4804d2c.tar.gz
scummvm-rg350-5d08dbfa114fd03b9d811f2a961c13dbc4804d2c.tar.bz2
scummvm-rg350-5d08dbfa114fd03b9d811f2a961c13dbc4804d2c.zip
TSAGE: Implemented the character selection dialog logic in R2RW
Diffstat (limited to 'engines/tsage/ringworld2/ringworld2_dialogs.cpp')
-rw-r--r--engines/tsage/ringworld2/ringworld2_dialogs.cpp117
1 files changed, 116 insertions, 1 deletions
diff --git a/engines/tsage/ringworld2/ringworld2_dialogs.cpp b/engines/tsage/ringworld2/ringworld2_dialogs.cpp
index 7abf2c9a45..553a10a5a6 100644
--- a/engines/tsage/ringworld2/ringworld2_dialogs.cpp
+++ b/engines/tsage/ringworld2/ringworld2_dialogs.cpp
@@ -31,6 +31,7 @@
#include "tsage/staticres.h"
#include "tsage/globals.h"
#include "tsage/ringworld2/ringworld2_dialogs.h"
+#include "tsage/ringworld2/ringworld2_logic.h"
namespace TsAGE {
@@ -195,11 +196,125 @@ void CharacterDialog::show() {
CharacterDialog *dlg = new CharacterDialog();
dlg->draw();
- /*GfxButton *btn = */dlg->execute(&dlg->_btnCancel);
+ // Make the default button the currently active character
+ GfxButton *btn = NULL;
+ int oldCharacter = R2_GLOBALS._player._characterIndex;
+ switch (oldCharacter) {
+ case 1:
+ btn = &dlg->_btnQuinn;
+ break;
+ case 2:
+ btn = &dlg->_btnSeeker;
+ break;
+ case 3:
+ btn = &dlg->_btnMiranda;
+ break;
+ default:
+ break;
+ }
+
+ // Show the character selection dialog
+ btn = dlg->execute(btn);
+ // Figure out the new selected character
+ if (btn == &dlg->_btnQuinn)
+ R2_GLOBALS._player._characterIndex = 1;
+ else if (btn == &dlg->_btnSeeker)
+ R2_GLOBALS._player._characterIndex = 2;
+ else if (btn == &dlg->_btnMiranda)
+ R2_GLOBALS._player._characterIndex = 3;
+ // Remove the dialog
dlg->remove();
delete dlg;
+
+ // Only do transfer if a different character was selected
+ if (R2_GLOBALS._player._characterIndex != oldCharacter) {
+ // Save the details of the previously active character
+ SceneExt *scene = (SceneExt *)R2_GLOBALS._sceneManager._scene;
+ scene->saveCharacter(oldCharacter);
+
+ // Play a transition sound as the character is changed
+ if (R2_GLOBALS._player._characterScene[0] != 300) {
+ switch (R2_GLOBALS._v565F1[R2_GLOBALS._player._characterIndex]) {
+ case 0:
+ R2_GLOBALS._sound4.stop();
+ break;
+ case 1:
+ R2_GLOBALS._sound4.play(45);
+ break;
+ case 2:
+ R2_GLOBALS._sound4.play(4);
+ break;
+ case 3:
+ R2_GLOBALS._sound4.play(5);
+ break;
+ case 4:
+ R2_GLOBALS._sound4.play(6);
+ break;
+ default:
+ break;
+ }
+ } else if (R2_GLOBALS._v565F1[R2_GLOBALS._player._characterIndex] > 1) {
+ switch (R2_GLOBALS._v565F1[R2_GLOBALS._player._characterIndex]) {
+ case 2:
+ R2_GLOBALS._sound4.play(45);
+ break;
+ case 3:
+ R2_GLOBALS._sound4.play(4);
+ break;
+ case 4:
+ R2_GLOBALS._sound4.play(5);
+ break;
+ case 5:
+ R2_GLOBALS._sound4.play(6);
+ break;
+ default:
+ break;
+ }
+ } else if ((R2_GLOBALS._player._characterScene[1] == 300) && (R2_GLOBALS._v565F1[1] != 1)) {
+ switch (R2_GLOBALS._v565F1[1]) {
+ case 2:
+ R2_GLOBALS._sound4.play(45);
+ break;
+ case 3:
+ R2_GLOBALS._sound4.play(4);
+ break;
+ case 4:
+ R2_GLOBALS._sound4.play(5);
+ break;
+ case 5:
+ R2_GLOBALS._sound4.play(6);
+ break;
+ default:
+ break;
+ }
+ } else if (R2_GLOBALS._player._characterScene[2] != 300) {
+ R2_GLOBALS._sound4.stop();
+ } else if (R2_GLOBALS._v565F1[2] == 1) {
+ R2_GLOBALS._sound4.stop();
+ } else {
+ switch (R2_GLOBALS._v565F1[1]) {
+ case 2:
+ R2_GLOBALS._sound4.play(45);
+ break;
+ case 3:
+ R2_GLOBALS._sound4.play(4);
+ break;
+ case 4:
+ R2_GLOBALS._sound4.play(5);
+ break;
+ case 5:
+ R2_GLOBALS._sound4.play(6);
+ break;
+ default:
+ break;
+ }
+ }
+
+ // Change to whichever scene the newly selected character is in
+ R2_GLOBALS._sceneManager.changeScene(R2_GLOBALS._player._characterScene[R2_GLOBALS._player._characterIndex]);
+ }
}
CharacterDialog::CharacterDialog() {