aboutsummaryrefslogtreecommitdiff
path: root/engines/mads/nebular
diff options
context:
space:
mode:
authorPaul Gilbert2014-06-06 20:04:46 -0400
committerPaul Gilbert2014-06-06 20:04:46 -0400
commit17cc86d1721d275d56845754b9a32710b0e0d2f0 (patch)
tree7787620f8779c8ca0664df608df7111d94de0a37 /engines/mads/nebular
parent3c1c080c3a236ca9aac40d7f04f82b57ec879cbe (diff)
downloadscummvm-rg350-17cc86d1721d275d56845754b9a32710b0e0d2f0.tar.gz
scummvm-rg350-17cc86d1721d275d56845754b9a32710b0e0d2f0.tar.bz2
scummvm-rg350-17cc86d1721d275d56845754b9a32710b0e0d2f0.zip
MADS: Refactoring and cleanup of the game startup code
Diffstat (limited to 'engines/mads/nebular')
-rw-r--r--engines/mads/nebular/dialogs_nebular.cpp10
-rw-r--r--engines/mads/nebular/game_nebular.cpp42
-rw-r--r--engines/mads/nebular/game_nebular.h9
3 files changed, 56 insertions, 5 deletions
diff --git a/engines/mads/nebular/dialogs_nebular.cpp b/engines/mads/nebular/dialogs_nebular.cpp
index 3fb61990e2..fdf3ee1392 100644
--- a/engines/mads/nebular/dialogs_nebular.cpp
+++ b/engines/mads/nebular/dialogs_nebular.cpp
@@ -269,6 +269,14 @@ void DialogsNebular::showDialog() {
case DIALOG_GAME_MENU:
//GameMenuDialog::show();
break;
+ case DIALOG_DIFFICULTY: {
+/*
+ DifficultyDialog *dlg = new DifficultyDialog(_vm);
+ dlg->show();
+ delete dlg;
+ break;
+*/
+ }
default:
break;
}
@@ -712,7 +720,7 @@ void ScreenDialog::setFrame(int frameNumber, int depth) {
void ScreenDialog::show() {
Scene &scene = _vm->_game->_scene;
- while (_selectedLine < 1) {
+ while (_selectedLine < 1 && !_vm->shouldQuit()) {
handleEvents();
if (_v3) {
if (!_v1)
diff --git a/engines/mads/nebular/game_nebular.cpp b/engines/mads/nebular/game_nebular.cpp
index 8289437c73..d6d7a07e52 100644
--- a/engines/mads/nebular/game_nebular.cpp
+++ b/engines/mads/nebular/game_nebular.cpp
@@ -48,18 +48,54 @@ ProtectionResult GameNebular::checkCopyProtection() {
_globals[kCopyProtectFailed] = -1;
if (!ConfMan.getBool("copy_protection"))
- return true;
+ return true;
* DEBUG: Disabled for now
CopyProtectionDialog *dlg = new CopyProtectionDialog(_vm, false);
dlg->show();
delete dlg;
*/
-
- // DEBUG: Return that copy protection failed
return PROTECTION_SUCCEED;
}
+void GameNebular::startGame() {
+ // Show the main menu
+ // TODO: Show the main menu here
+
+ // Check copy protection
+ ProtectionResult protectionResult = checkCopyProtection();
+ switch (protectionResult) {
+ case PROTECTION_FAIL:
+ // Copy protection failed
+ _scene._nextSceneId = 804;
+ initializeGlobals();
+ _globals[kCopyProtectFailed] = true;
+ return;
+ case PROTECTION_ESCAPE:
+ // User escaped out of copy protection dialog
+ _vm->quitGame();
+ return;
+ default:
+ // Copy protection check succeeded
+ break;
+ }
+
+ initSection(_sectionNumber);
+ _statusFlag = true;
+
+ _vm->_dialogs->_pendingDialog = DIALOG_DIFFICULTY;
+ _vm->_dialogs->showDialog();
+ _vm->_dialogs->_pendingDialog = DIALOG_NONE;
+
+ _priorSectionNumber = 0;
+ _priorSectionNumber = -1;
+ _scene._priorSceneId = 0;
+ _scene._currentSceneId = -1;
+ _scene._nextSceneId = 101;
+
+ initializeGlobals();
+}
+
void GameNebular::initializeGlobals() {
int count, count2;
int bad;
diff --git a/engines/mads/nebular/game_nebular.h b/engines/mads/nebular/game_nebular.h
index 6620deaea6..da607d47ee 100644
--- a/engines/mads/nebular/game_nebular.h
+++ b/engines/mads/nebular/game_nebular.h
@@ -38,6 +38,11 @@ enum Difficulty {
DIFFICULTY_HARD = 1, DIFFICULTY_MEDIUM = 2, DIFFICULTY_EASY = 3
};
+
+enum ProtectionResult {
+ PROTECTION_SUCCEED = 0, PROTECTION_FAIL = 1, PROTECTION_ESCAPE = 2
+};
+
enum InventoryObject {
OBJ_NONE = -1,
OBJ_BINOCULARS = 0,
@@ -98,10 +103,12 @@ enum InventoryObject {
class GameNebular : public Game {
friend class Game;
+private:
+ ProtectionResult checkCopyProtection();
protected:
GameNebular(MADSEngine *vm);
- virtual ProtectionResult checkCopyProtection();
+ virtual void startGame();
virtual void initializeGlobals();