aboutsummaryrefslogtreecommitdiff
path: root/engines/mads/nebular/game_nebular.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/mads/nebular/game_nebular.cpp')
-rw-r--r--engines/mads/nebular/game_nebular.cpp146
1 files changed, 81 insertions, 65 deletions
diff --git a/engines/mads/nebular/game_nebular.cpp b/engines/mads/nebular/game_nebular.cpp
index fd669bc5cf..e8e0a4f42c 100644
--- a/engines/mads/nebular/game_nebular.cpp
+++ b/engines/mads/nebular/game_nebular.cpp
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
@@ -45,30 +45,86 @@ GameNebular::GameNebular(MADSEngine *vm)
}
ProtectionResult GameNebular::checkCopyProtection() {
- /*
- // DEBUG: Flag copy protection failure
- _globals[kCopyProtectFailed] = -1;
+ //if (!ConfMan.getBool("copy_protection"))
+ // return PROTECTION_SUCCEED;
- if (!ConfMan.getBool("copy_protection"))
- return true;
+ CopyProtectionDialog *dlg;
+ bool correctAnswer;
- * DEBUG: Disabled for now
- CopyProtectionDialog *dlg = new CopyProtectionDialog(_vm, false);
+ dlg = new CopyProtectionDialog(_vm, false);
dlg->show();
+ correctAnswer = dlg->isCorrectAnswer();
delete dlg;
- */
- return PROTECTION_SUCCEED;
+
+ if (!correctAnswer && !_vm->shouldQuit()) {
+ dlg = new CopyProtectionDialog(_vm, true);
+ dlg->show();
+ correctAnswer = dlg->isCorrectAnswer();
+ delete dlg;
+ }
+
+ return correctAnswer ? PROTECTION_SUCCEED : PROTECTION_FAIL;
}
void GameNebular::startGame() {
- /*
+ // First handle any ending credits from a just finished game session.
+ // Note that, with the exception of the decompression ending, which doesn't
+ // use animations, the remaining animations will automatically launch their
+ // own text view credits when the animation is completed
+ switch (_winStatus) {
+ case 1:
+ // No shields failure ending
+ AnimationView::execute(_vm, "rexend1");
+ break;
+ case 2:
+ // Shields, but no targetting failure ending
+ AnimationView::execute(_vm, "rexend2");
+ break;
+ case 3:
+ // Completed game successfully, so activate quotes item on the main menu
+ ConfMan.setBool("ShowQuotes", true);
+ ConfMan.flushToDisk();
+
+ AnimationView::execute(_vm, "rexend3");
+ break;
+ case 4:
+ // Decompression ending
+ TextView::execute(_vm, "ending4");
+ break;
+ }
+
+ do {
+ checkShowDialog();
+ _winStatus = 0;
+
+ _sectionNumber = 1;
+ initSection(_sectionNumber);
+ _vm->_events->setCursor(CURSOR_ARROW);
+ _statusFlag = true;
+
+ // Show the main menu
+ _vm->_dialogs->_pendingDialog = DIALOG_MAIN_MENU;
+ _vm->_dialogs->showDialog();
+ } while (!_vm->shouldQuit() && _vm->_dialogs->_pendingDialog != DIALOG_NONE);
+
+ if (_vm->shouldQuit())
+ return;
+
+ _priorSectionNumber = 0;
+ _priorSectionNumber = -1;
+ _scene._priorSceneId = 0;
+ _scene._currentSceneId = -1;
+ _scene._nextSceneId = 101;
+
+ initializeGlobals();
+
// 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:
@@ -79,23 +135,6 @@ void GameNebular::startGame() {
// Copy protection check succeeded
break;
}
- */
-
- initSection(_sectionNumber);
- _statusFlag = true;
-
- // Show the main menu
- _vm->_dialogs->_pendingDialog = DIALOG_MAIN_MENU;
- _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() {
@@ -245,10 +284,12 @@ void GameNebular::initializeGlobals() {
// Final setup based on selected difficulty level
switch (_difficulty) {
case DIFFICULTY_HARD:
- _objects.setRoom(OBJ_PLANT_STALK, NOWHERE);
- _objects.setRoom(OBJ_PENLIGHT, NOWHERE);
+ _objects.setRoom(OBJ_BLOWGUN, NOWHERE);
+ _objects.setRoom(OBJ_NOTE, NOWHERE);
- _globals[kLeavesStatus] = LEAVES_ON_TRAP;
+ _globals[kLeavesStatus] = LEAVES_ON_GROUND;
+ _globals[kDurafailRecharged] = 0;
+ _globals[kPenlightCellStatus] = FIRST_TIME_UNCHARGED_DURAFAIL;
break;
case DIFFICULTY_MEDIUM:
@@ -260,12 +301,10 @@ void GameNebular::initializeGlobals() {
break;
case DIFFICULTY_EASY:
- _objects.setRoom(OBJ_BLOWGUN, NOWHERE);
- _objects.setRoom(OBJ_NOTE, NOWHERE);
+ _objects.setRoom(OBJ_PLANT_STALK, NOWHERE);
+ _objects.setRoom(OBJ_PENLIGHT, NOWHERE);
- _globals[kLeavesStatus] = LEAVES_ON_GROUND;
- _globals[kPenlightCellStatus] = FIRST_TIME_UNCHARGED_DURAFAIL;
- _globals[kDurafailRecharged] = 0;
+ _globals[kLeavesStatus] = LEAVES_ON_TRAP;
break;
}
@@ -310,32 +349,9 @@ void GameNebular::setSectionHandler() {
}
void GameNebular::checkShowDialog() {
- // Handling to start endgame sequences if the win/lose type has been set
- switch (_winStatus) {
- case 1:
- // No shields failure ending
- AnimationView::execute(_vm, "rexend1");
- break;
- case 2:
- // Shields, but no targetting failure ending
- AnimationView::execute(_vm, "rexend2");
- break;
- case 3:
- // Completed game successfully, so activate quotes item on the main menu
- ConfMan.setBool("ShowQuotes", true);
- ConfMan.flushToDisk();
-
- AnimationView::execute(_vm, "rexend3");
- break;
- case 4:
- // Decompression ending
- TextView::execute(_vm, "ending4");
- break;
- }
- _winStatus = 0;
-
// Loop for showing dialogs, if any need to be shown
- if (_vm->_dialogs->_pendingDialog && _player._stepEnabled && !_globals[kCopyProtectFailed]) {
+ if (_vm->_dialogs->_pendingDialog && (_player._stepEnabled || _winStatus)
+ && !_globals[kCopyProtectFailed]) {
_player.releasePlayerSprites();
// Make a thumbnail in case it's needed for making a savegame
@@ -454,7 +470,7 @@ void GameNebular::doObjectAction() {
dialogs.show(464);
} else if (action.isAction(VERB_REFLECT)) {
dialogs.show(466);
- } else if (action.isAction(VERB_GAZE_INTO, NOUN_REARVIEW_MIRROR)) {
+ } else if (action.isAction(VERB_GAZE_INTO, NOUN_REARVIEW_MIRROR)) {
dialogs.show(467);
} else if (action.isAction(VERB_EAT, NOUN_CHICKEN_BOMB)) {
dialogs.show(469);
@@ -810,7 +826,7 @@ void GameNebular::step() {
(_player._facing == _player._turnToFacing)) {
if (_scene._frameStartTime >= *((uint32 *)&_globals[kWalkerTiming])) {
if (!_player._stopWalkerIndex) {
- int randomVal = _vm->getRandomNumber(29999);;
+ int randomVal = _vm->getRandomNumber(29999);
if (_globals[kSexOfRex] == REX_MALE) {
switch (_player._facing) {
case FACING_SOUTHWEST: