aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorJaromir Wysoglad2019-05-31 16:38:32 +0200
committerThierry Crozat2019-07-28 15:09:14 +0100
commitb9c528425ae154660e2c2c3041b5dc285a1621e0 (patch)
tree0de3d6282d54926acadd4d4147d9404e14653831 /engines
parent1985c5bf578faa4d8b3e67ad03a5af35d58e1e86 (diff)
downloadscummvm-rg350-b9c528425ae154660e2c2c3041b5dc285a1621e0.tar.gz
scummvm-rg350-b9c528425ae154660e2c2c3041b5dc285a1621e0.tar.bz2
scummvm-rg350-b9c528425ae154660e2c2c3041b5dc285a1621e0.zip
SUPERNOVA2: Add some more generic interactoins
Diffstat (limited to 'engines')
-rw-r--r--engines/supernova2/ms2_def.h6
-rw-r--r--engines/supernova2/state.cpp85
-rw-r--r--engines/supernova2/state.h3
3 files changed, 91 insertions, 3 deletions
diff --git a/engines/supernova2/ms2_def.h b/engines/supernova2/ms2_def.h
index 9884086b27..697c4ac14f 100644
--- a/engines/supernova2/ms2_def.h
+++ b/engines/supernova2/ms2_def.h
@@ -162,9 +162,9 @@ kString160, kString161, kString162, kString163, kString164,
kString165, kString166, kString167, kString168, kString169,
kString170, kString171, kString172, kString173, kString174,
kString175, kString176, kString177, kStringDefaultDescription, kStringLooksMetal,
-kStringTaxiArrives, kStringNothingHappens, kStringEmpty, kStringWalletOpen, kString184,
-kString185, kString186, kString187, kString188, kString189,
-kString190, kString191, kString192, kString193, kString194,
+kStringTaxiArrives, kStringNothingHappens, kStringEmpty, kStringWalletOpen, kStringAttachMagnet,
+kStringPoleMagnet, kStringCunning, kStringMustBuyFirst, kStringInsertChip, kStringTransferCD,
+kStringCDNotInserted, kStringRemoveChip, kStringChipNotInserted, kStringWhatFor, kString194,
kString195, kString196, kString197, kString198, kString199,
kStringAirportEntrance, kStringAirport, kStringDowntown, kStringCulturePalace, kStringEarth,
kStringPrivateApartment, kStringLeaveTaxi, kStringPay, kStringAddress, kStringCheater,
diff --git a/engines/supernova2/state.cpp b/engines/supernova2/state.cpp
index 8455ade1d9..766529a0ed 100644
--- a/engines/supernova2/state.cpp
+++ b/engines/supernova2/state.cpp
@@ -38,6 +38,8 @@ bool GameManager::serialize(Common::WriteStream *out) {
// GameState
out->writeSint16LE(_state._money);
out->writeByte(_state._addressKnown);
+ out->writeByte(_state._poleMagnet);
+ out->writeByte(_state._admission);
// Inventory
out->writeSint32LE(_inventory.getSize());
@@ -66,6 +68,8 @@ bool GameManager::deserialize(Common::ReadStream *in, int version) {
// GameState
_state._money = in->readSint16LE();
_state._addressKnown = in->readByte();
+ _state._poleMagnet = in->readByte();
+ _state._admission = in->readByte();
_vm->setGameString(kStringMoney, Common::String::format("%d Xa", _state._money));
_oldTime = g_system->getMillis();
@@ -260,6 +264,8 @@ void GameManager::initState() {
_state._money = 20;
_state._addressKnown = false;
_state._previousRoom = _currentRoom;
+ _state._poleMagnet = false;
+ _state._admission = 0;
}
void GameManager::initRooms() {
@@ -1005,6 +1011,78 @@ bool GameManager::genericInteract(Action verb, Object &obj1, Object &obj2) {
taxi();
} else
_vm->renderMessage(kStringNothingHappens);
+ } else if (verb == ACTION_USE && Object::combine(obj1, obj2, ROD, MAGNET)) {
+ Object *o1, *o2;
+ if (obj2._type == ROD) {
+ o1 = &obj2;
+ o2 = &obj1;
+ } else {
+ o1 = &obj1;
+ o2 = &obj2;
+ }
+ if (!(o1->_type & CARRIED))
+ return false;
+
+ if (!(o2->_type & CARRIED))
+ takeObject(*o2);
+
+ _vm->renderMessage(kStringAttachMagnet);
+ o1->_name = kStringPoleMagnet;
+ o1->_description = kStringCunning;
+ _inventory.remove(*o2);
+ } else if (verb == ACTION_USE && Object::combine(obj1, obj2, CHIP, PLAYER)) {
+ Object *o1, *o2;
+ if (obj2._id == CHIP) {
+ o1 = &obj2;
+ o2 = &obj1;
+ } else {
+ o1 = &obj1;
+ o2 = &obj2;
+ }
+ if (!(o2->_type & CARRIED))
+ _vm->renderMessage(kStringMustBuyFirst);
+ else {
+ if (!(o1->_type & CARRIED))
+ {
+ _vm->renderImage(1);
+ _vm->renderImage(2 + 128);
+ _currentRoom->getObject(0)->_click = 255;
+ }
+ else
+ _inventory.remove(*o1);
+
+ _vm->renderMessage(kStringInsertChip);
+ if (_state._admission)
+ _state._admission = 2;
+ else
+ _state._admission = 1;
+ }
+ } else if (verb == ACTION_USE && Object::combine(obj1, obj2, DISCMAN, PLAYER)) {
+ switch (_state._admission) {
+ case 1:
+ // fall through
+ case 2:
+ _vm->renderMessage(kStringTransferCD);
+ _state._admission = 2;
+ break;
+ default:
+ _vm->renderMessage(kStringCDNotInserted);
+ }
+ } else if (verb == ACTION_OPEN && Object::combine(obj1, obj2, DISCMAN, PLAYER)) {
+ switch (_state._admission) {
+ case 1:
+ _state._admission = 0;
+ playerTakeOut();
+ break;
+ case 2:
+ _state._admission = 3;
+ playerTakeOut();
+ break;
+ default:
+ _vm->renderMessage(kStringChipNotInserted);
+ }
+ } else if (verb == ACTION_OPEN && obj1._id == DISCMAN) {
+ _vm->renderMessage(kStringWhatFor);
} else
return false;
return true;
@@ -1298,5 +1376,12 @@ void GameManager::taxi() {
_vm->_allowSaveGame = true;
}
+
+void GameManager::playerTakeOut() {
+ _vm->renderMessage(kStringRemoveChip);
+ Object *o = _rooms[APARTMENT]->getObject(0);
+ o->_section = 0;
+ takeObject(*o);
+}
}
diff --git a/engines/supernova2/state.h b/engines/supernova2/state.h
index d26e8228d7..a355fac075 100644
--- a/engines/supernova2/state.h
+++ b/engines/supernova2/state.h
@@ -37,6 +37,8 @@ struct GameState {
int16 _money;
bool _addressKnown;
Room *_previousRoom;
+ bool _poleMagnet;
+ char _admission;
};
class Inventory {
@@ -192,6 +194,7 @@ public:
void leaveTaxi();
void taxiUnknownDestination();
void taxiPayment(int price, int destination);
+ void playerTakeOut();
private:
int _prevImgId;