Permalink
Browse files

STARTREK: Link away missions together, temporarily

  • Loading branch information...
Drenn1 authored and sev- committed Jul 25, 2018
1 parent 5572525 commit b1fa6126cc0429aaa378550f28d234e06d35a3aa
@@ -45,7 +45,7 @@ void StarTrekEngine::initAwayMission() {
}

void StarTrekEngine::runAwayMission() {
while (true) {
while (_gameMode == GAMEMODE_AWAYMISSION && !_resetGameMode) {
// Original game manipulates the stack when the room changes to return execution
// to this point. Instead of doing that, just check if a variable is set.
if (_roomIndexToLoad != -1 && _spawnIndexToLoad != -1) {
@@ -227,6 +227,7 @@ void StarTrekEngine::showOptionsMenu(int x, int y) {
break;
case 1: // Load
showLoadMenu();
_resetGameMode = true;
break;
case 2: // Enable music
_sound->setMusicEnabled(true);
@@ -955,15 +956,17 @@ void StarTrekEngine::showGameOverMenu() {
case 0: // Load game
_gfx->fadeoutScreen();
showLoadMenu(); // TODO: this probably manipulates the stack to jump out of this function...
break;
_resetGameMode = true;
return;
case 1: // Restart
_gfx->fadeoutScreen();
// TODO
break;
_resetGameMode = true;
return;
case 2: // Quit
_gfx->fadeoutScreen();
_system->quit();
break;
return;
default:
break;
}
@@ -444,7 +444,20 @@ void Room::endMission(int16 score, int16 arg1, int16 arg2) {

_vm->_awayMission.disableInput = false;

// TODO: game mode switch
// TODO: This is a stopgap measure (loading the next away mission immediately).
// Replace this with the proper code later.
_vm->_gameMode = GAMEMODE_BEAMDOWN;
if (_vm->_missionName == "DEMON")
_vm->_missionToLoad = "TUG";
if (_vm->_missionName == "TUG")
_vm->_missionToLoad = "LOVE";
if (_vm->_missionName == "LOVE")
_vm->_missionToLoad = "MUDD";
if (_vm->_missionName == "MUDD")
_vm->_missionToLoad = "FEATHER";
if (_vm->_missionName == "FEATHER")
_vm->_missionToLoad = "TRIAL";
_vm->_roomIndexToLoad = 0;
}

void Room::showGameOverMenu() { // TODO: takes an optional parameter?
@@ -135,13 +135,17 @@ Common::Error StarTrekEngine::runGameMode(int mode) {
_gameMode = mode;

_sound->stopAllVocSounds();
if (!_sound->_loopingAudioName.empty())
_sound->playVoc(_sound->_loopingAudioName);

_resetGameMode = true;
if (_gameMode == GAMEMODE_START)
_gameMode = GAMEMODE_BRIDGE;

while (true) {
if (_resetGameMode) {
if (!_sound->_loopingAudioName.empty())
_sound->playVoc(_sound->_loopingAudioName);
_resetGameMode = false;
}
TrekEvent event;

if (_gameMode != _lastGameMode) {
@@ -628,6 +628,7 @@ class StarTrekEngine : public ::Engine {
public:
int _gameMode;
int _lastGameMode;
bool _resetGameMode;

// NOTE: this has a different meaning than the original game. When non-empty, a new
// room load is triggered, as opposed to original behaviour where this was only read

0 comments on commit b1fa612

Please sign in to comment.