aboutsummaryrefslogtreecommitdiff
path: root/engines/cge2
diff options
context:
space:
mode:
Diffstat (limited to 'engines/cge2')
-rw-r--r--engines/cge2/toolbar.cpp9
-rw-r--r--engines/cge2/vmenu.cpp12
-rw-r--r--engines/cge2/vmenu.h9
3 files changed, 19 insertions, 11 deletions
diff --git a/engines/cge2/toolbar.cpp b/engines/cge2/toolbar.cpp
index be9f73e5b4..5880dfce6a 100644
--- a/engines/cge2/toolbar.cpp
+++ b/engines/cge2/toolbar.cpp
@@ -129,18 +129,15 @@ void CGE2Engine::checkMusicSwitch() {
}
void CGE2Engine::quit() {
- Common::Array<Choice *> quitMenu; // Deleted in VMenu's destructor.
- quitMenu.push_back(new ExitGameChoice(this));
- quitMenu.push_back(new ReturnToGameChoice(this));
-
if (_commandHandler->idle()) {
if (VMenu::_addr) {
_commandHandlerTurbo->addCommand(kCmdKill, -1, 0, VMenu::_addr);
ReturnToGameChoice rqsChoice(this);
rqsChoice.proc();
} else {
- quitMenu[0]->_text = _text->getText(kQuitText);
- quitMenu[1]->_text = _text->getText(kNoQuitText);
+ Common::Array<Choice *> quitMenu; // Deleted in VMenu's destructor.
+ quitMenu.push_back(new ExitGameChoice(this));
+ quitMenu.push_back(new ReturnToGameChoice(this));
(new VMenu(this, quitMenu, V2D(this, -1, -1), kCBMnu))->setName(_text->getText(kQuitTitle));
_commandHandlerTurbo->addCommand(kCmdSeq, kPowerRef, 0, nullptr);
keyClick();
diff --git a/engines/cge2/vmenu.cpp b/engines/cge2/vmenu.cpp
index ceb69f099d..6afe5e9a61 100644
--- a/engines/cge2/vmenu.cpp
+++ b/engines/cge2/vmenu.cpp
@@ -25,16 +25,26 @@
* Copyright (c) 1994-1997 Janus B. Wisniewski and L.K. Avalon
*/
-#include "cge2/cge2.h"
+#include "cge2/text.h"
#include "cge2/vmenu.h"
#include "cge2/events.h"
namespace CGE2 {
+Choice::Choice(CGE2Engine *vm) : _vm(vm), _text(nullptr) {}
+
+ExitGameChoice::ExitGameChoice(CGE2Engine *vm) : Choice(vm) {
+ _text = _vm->_text->getText(kQuitText);
+}
+
void ExitGameChoice::proc() {
_vm->switchScene(-1);
}
+ReturnToGameChoice::ReturnToGameChoice(CGE2Engine *vm) : Choice(vm) {
+ _text = _vm->_text->getText(kNoQuitText);
+}
+
void ReturnToGameChoice::proc() {
_vm->_commandHandlerTurbo->addCommand(kCmdSeq, kPowerRef, 1, nullptr);
_vm->keyClick();
diff --git a/engines/cge2/vmenu.h b/engines/cge2/vmenu.h
index e28eee74b8..60796e750a 100644
--- a/engines/cge2/vmenu.h
+++ b/engines/cge2/vmenu.h
@@ -33,6 +33,7 @@
#define kLt 3
#define kRb 1
+#include "cge2/cge2.h"
#include "cge2/talk.h"
namespace CGE2 {
@@ -42,21 +43,21 @@ protected:
CGE2Engine *_vm;
public:
char *_text;
+
virtual void proc() = 0;
- Choice(CGE2Engine *vm) : _vm(vm), _text(nullptr) {}
- virtual ~Choice() {}
+ Choice(CGE2Engine *vm);
};
class ExitGameChoice : public Choice {
public:
- ExitGameChoice(CGE2Engine *vm) : Choice(vm) {}
+ ExitGameChoice(CGE2Engine *vm);
void proc();
};
class ReturnToGameChoice : public Choice {
public:
- ReturnToGameChoice(CGE2Engine *vm) : Choice(vm) {}
+ ReturnToGameChoice(CGE2Engine *vm);
void proc();
};