mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-13 21:31:53 +00:00
PEGASUS: Implement deleting items when inventory is full
This commit is contained in:
parent
5c2a89dc4a
commit
1529ed0891
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -50,6 +50,7 @@ protected:
|
||||
// Room IDs.
|
||||
|
||||
const tRoomID kTSA00 = 0;
|
||||
const tRoomID kTSA22Red = 28;
|
||||
const tRoomID kTSA37 = 42;
|
||||
|
||||
class FullTSA : public Neighborhood {
|
||||
|
@ -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;
|
||||
|
@ -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:
|
||||
|
@ -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
|
||||
|
@ -223,6 +223,8 @@ private:
|
||||
Inventory _biochips;
|
||||
tItemID _currentItemID;
|
||||
tItemID _currentBiochipID;
|
||||
void destroyInventoryItem(const tItemID itemID);
|
||||
tItemID pickItemToDestroy();
|
||||
|
||||
// TimeBases
|
||||
Common::List<TimeBase *> _timeBases;
|
||||
|
Loading…
Reference in New Issue
Block a user