Skip to content

Commit

Permalink
STARTREK: Link away missions together, temporarily
Browse files Browse the repository at this point in the history
  • Loading branch information
Stewmath authored and sev- committed Aug 9, 2018
1 parent 5572525 commit b1fa612
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 7 deletions.
2 changes: 1 addition & 1 deletion engines/startrek/awaymission.cpp
Expand Up @@ -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) {
Expand Down
9 changes: 6 additions & 3 deletions engines/startrek/menu.cpp
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}
Expand Down
15 changes: 14 additions & 1 deletion engines/startrek/room.cpp
Expand Up @@ -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?
Expand Down
8 changes: 6 additions & 2 deletions engines/startrek/startrek.cpp
Expand Up @@ -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) {
Expand Down
1 change: 1 addition & 0 deletions engines/startrek/startrek.h
Expand Up @@ -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
Expand Down

0 comments on commit b1fa612

Please sign in to comment.