aboutsummaryrefslogtreecommitdiff
path: root/engines/pegasus
diff options
context:
space:
mode:
authorMatthew Hoops2011-11-03 15:00:22 -0400
committerMatthew Hoops2011-11-03 15:00:22 -0400
commitd932df79bed5aac97e17c0920a5e75cb5ce733ee (patch)
treefa58fcc240da17ad82697c9e106158cb33659942 /engines/pegasus
parent053e1d6529753728710b5b29d789e24b0b9c4776 (diff)
downloadscummvm-rg350-d932df79bed5aac97e17c0920a5e75cb5ce733ee.tar.gz
scummvm-rg350-d932df79bed5aac97e17c0920a5e75cb5ce733ee.tar.bz2
scummvm-rg350-d932df79bed5aac97e17c0920a5e75cb5ce733ee.zip
PEGASUS: Fix segfault after sub chase sequence
Diffstat (limited to 'engines/pegasus')
-rw-r--r--engines/pegasus/pegasus.cpp29
-rw-r--r--engines/pegasus/pegasus.h2
2 files changed, 20 insertions, 11 deletions
diff --git a/engines/pegasus/pegasus.cpp b/engines/pegasus/pegasus.cpp
index 61a2383738..de2e7f422d 100644
--- a/engines/pegasus/pegasus.cpp
+++ b/engines/pegasus/pegasus.cpp
@@ -1255,17 +1255,22 @@ void PegasusEngine::useNeighborhood(Neighborhood *neighborhood) {
}
}
-void PegasusEngine::performJump(const tNeighborhoodID neighborhoodID) {
+void PegasusEngine::performJump(tNeighborhoodID neighborhoodID) {
+ if (_neighborhood)
+ useNeighborhood(0);
+
// Sub chase is special
if (neighborhoodID == kNoradSubChaseID) {
throwAwayEverything();
doSubChase();
- jumpToNewEnvironment(kNoradDeltaID, kNorad41, kEast);
- return;
- }
- if (_neighborhood)
- useNeighborhood(0);
+ if (shouldQuit())
+ return;
+
+ neighborhoodID = kNoradDeltaID;
+ GameState.setNextRoom(kNorad41);
+ GameState.setNextDirection(kEast);
+ }
Neighborhood *neighborhood;
makeNeighborhood(neighborhoodID, neighborhood);
@@ -1273,10 +1278,10 @@ void PegasusEngine::performJump(const tNeighborhoodID neighborhoodID) {
}
void PegasusEngine::startNeighborhood() {
- if (_currentItemID != kNoItemID)
+ if (g_interface && _currentItemID != kNoItemID)
g_interface->setCurrentInventoryItemID(_currentItemID);
- if (_currentBiochipID != kNoItemID)
+ if (g_interface && _currentBiochipID != kNoItemID)
g_interface->setCurrentBiochipID(_currentBiochipID);
setGameMode(kModeNavigation);
@@ -1344,7 +1349,7 @@ void PegasusEngine::startNewGame() {
void PegasusEngine::makeNeighborhood(tNeighborhoodID neighborhoodID, Neighborhood *&neighborhood) {
// TODO: CD check
-
+
switch (neighborhoodID) {
case kCaldoriaID:
neighborhood = new Caldoria(g_AIArea, this);
@@ -1367,8 +1372,12 @@ void PegasusEngine::makeNeighborhood(tNeighborhoodID neighborhoodID, Neighborhoo
case kNoradAlphaID:
neighborhood = new NoradAlpha(g_AIArea, this);
break;
+ case kNoradDeltaID:
+ createInterface();
+ error("TODO: Norad Delta");
+ break;
default:
- error("Unhandled neighborhood %d", neighborhoodID);
+ error("Unknown neighborhood %d", neighborhoodID);
}
}
diff --git a/engines/pegasus/pegasus.h b/engines/pegasus/pegasus.h
index f79219447f..2dcd317b07 100644
--- a/engines/pegasus/pegasus.h
+++ b/engines/pegasus/pegasus.h
@@ -265,7 +265,7 @@ private:
// Neighborhood
Neighborhood *_neighborhood;
void useNeighborhood(Neighborhood *neighborhood);
- void performJump(const tNeighborhoodID start);
+ void performJump(tNeighborhoodID start);
void startNewGame();
void startNeighborhood();
void makeNeighborhood(tNeighborhoodID, Neighborhood *&);