aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xengines/pegasus/ai/ai_area.cpp2
-rwxr-xr-xengines/pegasus/neighborhood/mars/mars.cpp3
-rwxr-xr-xengines/pegasus/neighborhood/mars/mars.h3
-rwxr-xr-xengines/pegasus/neighborhood/tsa/fulltsa.cpp1
-rwxr-xr-xengines/pegasus/neighborhood/tsa/fulltsa.h1
-rwxr-xr-xengines/pegasus/neighborhood/wsc/wsc.cpp3
-rwxr-xr-xengines/pegasus/neighborhood/wsc/wsc.h3
-rw-r--r--engines/pegasus/pegasus.cpp128
-rw-r--r--engines/pegasus/pegasus.h2
9 files changed, 137 insertions, 9 deletions
diff --git a/engines/pegasus/ai/ai_area.cpp b/engines/pegasus/ai/ai_area.cpp
index 9f297e3df6..923df41cf1 100755
--- a/engines/pegasus/ai/ai_area.cpp
+++ b/engines/pegasus/ai/ai_area.cpp
@@ -222,6 +222,7 @@ void AIArea::playAIAreaSequence(const tLowerClientSignature, const tLowerAreaSig
vm->_cursor->hide();
while (_middleAreaMovie.isRunning()) {
+ vm->checkCallBacks();
vm->refreshDisplay();
g_system->delayMillis(10);
}
@@ -245,6 +246,7 @@ void AIArea::playAIAreaSequence(const tLowerClientSignature, const tLowerAreaSig
vm->_cursor->hide();
while (_rightAreaMovie.isRunning()) {
+ vm->checkCallBacks();
vm->refreshDisplay();
g_system->delayMillis(10);
}
diff --git a/engines/pegasus/neighborhood/mars/mars.cpp b/engines/pegasus/neighborhood/mars/mars.cpp
index 3f46edb9a3..f13890cc18 100755
--- a/engines/pegasus/neighborhood/mars/mars.cpp
+++ b/engines/pegasus/neighborhood/mars/mars.cpp
@@ -292,11 +292,9 @@ const tRoomID kMars28 = 29;
const tRoomID kMars29 = 30;
const tRoomID kMars30 = 31;
const tRoomID kMars31 = 32;
-const tRoomID kMars31South = 33;
const tRoomID kMars32 = 34;
const tRoomID kMars33 = 35;
const tRoomID kMars33North = 36;
-const tRoomID kMars34 = 37;
const tRoomID kMars36 = 39;
const tRoomID kMars37 = 40;
const tRoomID kMars38 = 41;
@@ -308,7 +306,6 @@ const tRoomID kMars45 = 47;
const tRoomID kMars46 = 48;
const tRoomID kMars47 = 49;
const tRoomID kMars48 = 50;
-const tRoomID kMars49 = 51;
const tRoomID kMars50 = 52;
const tRoomID kMars51 = 53;
const tRoomID kMars52 = 54;
diff --git a/engines/pegasus/neighborhood/mars/mars.h b/engines/pegasus/neighborhood/mars/mars.h
index 3eb0fc80e6..b663a621af 100755
--- a/engines/pegasus/neighborhood/mars/mars.h
+++ b/engines/pegasus/neighborhood/mars/mars.h
@@ -53,8 +53,11 @@ enum tShuttleWeaponSelection {
};
const tRoomID kMars0A = 0;
+const tRoomID kMars31South = 33;
+const tRoomID kMars34 = 37;
const tRoomID kMars35 = 38;
const tRoomID kMars39 = 42;
+const tRoomID kMars49 = 51;
const tRoomID kMars60 = 58;
const tRoomID kMarsMaze004 = 60;
const tRoomID kMarsMaze200 = 224;
diff --git a/engines/pegasus/neighborhood/tsa/fulltsa.cpp b/engines/pegasus/neighborhood/tsa/fulltsa.cpp
index 8f5bf47338..1aac583ccc 100755
--- a/engines/pegasus/neighborhood/tsa/fulltsa.cpp
+++ b/engines/pegasus/neighborhood/tsa/fulltsa.cpp
@@ -112,7 +112,6 @@ const tRoomID kTSA23Cyan = 24;
const tRoomID kTSA24Cyan = 25;
const tRoomID kTSA25Cyan = 26;
const tRoomID kTSA21Red = 27;
-const tRoomID kTSA22Red = 28;
const tRoomID kTSA23Red = 29;
const tRoomID kTSA24Red = 30;
const tRoomID kTSA25Red = 31;
diff --git a/engines/pegasus/neighborhood/tsa/fulltsa.h b/engines/pegasus/neighborhood/tsa/fulltsa.h
index 447482f737..aa21192a33 100755
--- a/engines/pegasus/neighborhood/tsa/fulltsa.h
+++ b/engines/pegasus/neighborhood/tsa/fulltsa.h
@@ -50,6 +50,7 @@ protected:
// Room IDs.
const tRoomID kTSA00 = 0;
+const tRoomID kTSA22Red = 28;
const tRoomID kTSA37 = 42;
class FullTSA : public Neighborhood {
diff --git a/engines/pegasus/neighborhood/wsc/wsc.cpp b/engines/pegasus/neighborhood/wsc/wsc.cpp
index cc12a2fe69..e42b90e821 100755
--- a/engines/pegasus/neighborhood/wsc/wsc.cpp
+++ b/engines/pegasus/neighborhood/wsc/wsc.cpp
@@ -173,8 +173,6 @@ const tAlternateID kAltWSCPeopleAtW19North = 3;
// Room IDs.
const tRoomID kWSC02 = 1;
-const tRoomID kWSC02Morph = 2;
-const tRoomID kWSC02Messages = 3;
const tRoomID kWSC03 = 4;
const tRoomID kWSC04 = 5;
const tRoomID kWSC06 = 6;
@@ -233,7 +231,6 @@ const tRoomID kWSC60North = 58;
const tRoomID kWSC61 = 59;
const tRoomID kWSC61South = 60;
const tRoomID kWSC61West = 61;
-const tRoomID kWSC62 = 62;
const tRoomID kWSC63 = 63;
const tRoomID kWSC64 = 64;
const tRoomID kWSC65 = 65;
diff --git a/engines/pegasus/neighborhood/wsc/wsc.h b/engines/pegasus/neighborhood/wsc/wsc.h
index 554c2f713d..8646da3dbe 100755
--- a/engines/pegasus/neighborhood/wsc/wsc.h
+++ b/engines/pegasus/neighborhood/wsc/wsc.h
@@ -35,6 +35,9 @@ const tDisplayOrder kWSCMoleculeBinOrder = kMonitorLayer;
const tDisplayOrder kWSCMoleculesMovieOrder = kWSCMoleculeBinOrder + 1;
const tRoomID kWSC01 = 0;
+const tRoomID kWSC02Morph = 2;
+const tRoomID kWSC02Messages = 3;
+const tRoomID kWSC62 = 62;
class WSC : public Neighborhood {
public:
diff --git a/engines/pegasus/pegasus.cpp b/engines/pegasus/pegasus.cpp
index ab5ab55897..2871ed1f73 100644
--- a/engines/pegasus/pegasus.cpp
+++ b/engines/pegasus/pegasus.cpp
@@ -1227,9 +1227,8 @@ tInventoryResult PegasusEngine::addItemToInventory(InventoryItem *item) {
else
result = _items.addItem(item);
- // TODO
if (result == kTooMuchWeight)
- error("Out of inventory space");
+ destroyInventoryItem(pickItemToDestroy());
} while (result != kInventoryOK);
GameState.setTakenItem(item, true);
@@ -1945,4 +1944,129 @@ void PegasusEngine::drawScaledFrame(const Graphics::Surface *frame, uint16 x, ui
scaledFrame.free();
}
+void PegasusEngine::destroyInventoryItem(const tItemID itemID) {
+ InventoryItem *item = (InventoryItem *)g_allItems.findItemByID(itemID);
+
+ ItemExtraEntry entry;
+
+ switch (itemID) {
+ case kAirMask:
+ item->findItemExtra(kRemoveAirMask, entry);
+ item->setItemRoom(kMarsID, kMars49, kSouth);
+ break;
+ case kArgonCanister:
+ item->findItemExtra(kRemoveArgon, entry);
+ item->setItemRoom(kWSCID, kWSC02Morph, kSouth);
+ break;
+ case kCrowbar:
+ item->findItemExtra(kRemoveCrowbar, entry);
+ item->setItemRoom(kMarsID, kMars34, kSouth);
+ break;
+ case kJourneymanKey:
+ item->findItemExtra(kRemoveJourneymanKey, entry);
+ item->setItemRoom(kFullTSAID, kTSA22Red, kEast);
+ break;
+ case kMarsCard:
+ item->findItemExtra(kRemoveMarsCard, entry);
+ item->setItemRoom(kMarsID, kMars31South, kSouth);
+ break;
+ case kNitrogenCanister:
+ item->findItemExtra(kRemoveNitrogen, entry);
+ item->setItemRoom(kWSCID, kWSC02Messages, kSouth);
+ break;
+ case kOrangeJuiceGlassEmpty:
+ item->findItemExtra(kRemoveGlass, entry);
+ item->setItemRoom(kCaldoriaID, kCaldoriaReplicator, kNorth);
+ break;
+ case kPoisonDart:
+ item->findItemExtra(kRemoveDart, entry);
+ item->setItemRoom(kWSCID, kWSC01, kWest);
+ break;
+ case kSinclairKey:
+ item->findItemExtra(kRemoveSinclairKey, entry);
+ item->setItemRoom(kWSCID, kWSC02Morph, kSouth);
+ break;
+ default:
+ return;
+ }
+
+ g_interface->setCurrentInventoryItemID(itemID);
+ g_AIArea->playAIAreaSequence(kInventorySignature, kMiddleAreaSignature, entry.extraStart, entry.extraStop);
+ removeItemFromInventory(item);
+}
+
+tItemID PegasusEngine::pickItemToDestroy() {
+/*
+ Must pick an item to destroy
+
+ Part I: Polite -- try to find an item that's been used
+ Part II: Desperate -- return the first available item.
+*/
+
+ // Polite:
+ if (playerHasItemID(kOrangeJuiceGlassEmpty))
+ return kOrangeJuiceGlassEmpty;
+ if (playerHasItemID(kPoisonDart)) {
+ if (GameState.getCurrentNeighborhood() != kWSCID ||
+ GameState.getWSCAnalyzedDart())
+ return kPoisonDart;
+ }
+ if (playerHasItemID(kJourneymanKey)) {
+ if (GameState.getTSAState() >= kTSAPlayerGotHistoricalLog &&
+ GameState.getTSAState() != kPlayerOnWayToPrehistoric &&
+ GameState.getTSAState() != kPlayerWentToPrehistoric)
+ return kJourneymanKey;
+ }
+ if (playerHasItemID(kMarsCard)) {
+ if (GameState.getCurrentNeighborhood() != kMarsID || GameState.getMarsArrivedBelow())
+ return kMarsCard;
+ }
+
+ // Don't want to deal with deleting the sinclair key and argon canister, since it's
+ // impossible to pick them up one at a time.
+
+ if (playerHasItemID(kNitrogenCanister)) {
+ if (GameState.getScoringGotCardBomb() && GameState.getCurrentNeighborhood() != kMarsID)
+ return kNitrogenCanister;
+ }
+ if (playerHasItemID(kCrowbar)) {
+ if (GameState.getCurrentNeighborhood() == kWSCID) {
+ if (GameState.getCurrentRoom() >= kWSC62)
+ return kCrowbar;
+ } else if (GameState.getCurrentNeighborhood() == kMarsID) {
+ if (GameState.getScoringGotCardBomb())
+ return kCrowbar;
+ } else
+ return kCrowbar;
+ }
+ if (playerHasItemID(kAirMask)) {
+ if (GameState.getCurrentNeighborhood() == kMarsID) {
+ if (g_neighborhood->getAirQuality(GameState.getCurrentRoom()) == kAirQualityGood)
+ return kAirMask;
+ } else if (GameState.getCurrentNeighborhood() != kNoradAlphaID &&
+ GameState.getCurrentNeighborhood() != kNoradDeltaID) {
+ return kAirMask;
+ }
+ }
+
+ // Desperate:
+ if (playerHasItemID(kPoisonDart))
+ return kPoisonDart;
+ if (playerHasItemID(kJourneymanKey))
+ return kJourneymanKey;
+ if (playerHasItemID(kMarsCard))
+ return kMarsCard;
+ if (playerHasItemID(kNitrogenCanister))
+ return kNitrogenCanister;
+ if (playerHasItemID(kCrowbar))
+ return kCrowbar;
+ if (playerHasItemID(kAirMask))
+ return kAirMask;
+
+ // Should never get this far...
+ error("Could not find item to delete");
+
+ return kNoItemID;
+}
+
} // End of namespace Pegasus
diff --git a/engines/pegasus/pegasus.h b/engines/pegasus/pegasus.h
index e3a933a051..13145f3876 100644
--- a/engines/pegasus/pegasus.h
+++ b/engines/pegasus/pegasus.h
@@ -223,6 +223,8 @@ private:
Inventory _biochips;
tItemID _currentItemID;
tItemID _currentBiochipID;
+ void destroyInventoryItem(const tItemID itemID);
+ tItemID pickItemToDestroy();
// TimeBases
Common::List<TimeBase *> _timeBases;