diff options
author | Jaromir Wysoglad | 2019-06-03 17:03:27 +0200 |
---|---|---|
committer | Thierry Crozat | 2019-07-28 15:09:14 +0100 |
commit | 286f12c830eff01f94fac339eb7037162e54e7fc (patch) | |
tree | f5bd133a8e3296e29d5484a53f5dada9e09da467 | |
parent | 247deea4fcee03156b8c3e471081083ce4785a80 (diff) | |
download | scummvm-rg350-286f12c830eff01f94fac339eb7037162e54e7fc.tar.gz scummvm-rg350-286f12c830eff01f94fac339eb7037162e54e7fc.tar.bz2 scummvm-rg350-286f12c830eff01f94fac339eb7037162e54e7fc.zip |
SUPERNOVA2: Add cabin room
-rw-r--r-- | engines/supernova2/ms2_def.h | 18 | ||||
-rw-r--r-- | engines/supernova2/rooms.cpp | 78 | ||||
-rw-r--r-- | engines/supernova2/rooms.h | 2 | ||||
-rw-r--r-- | engines/supernova2/state.cpp | 3 | ||||
-rw-r--r-- | engines/supernova2/state.h | 1 |
5 files changed, 92 insertions, 10 deletions
diff --git a/engines/supernova2/ms2_def.h b/engines/supernova2/ms2_def.h index c3d9d03ca7..ecebb37716 100644 --- a/engines/supernova2/ms2_def.h +++ b/engines/supernova2/ms2_def.h @@ -107,7 +107,7 @@ enum ObjectId { TKNIFE,ROPE,NOTE,MOUTH, HOLE1,HOLE2,HOLE3,HOLE4,HOLE5,HOLE6,HOLE7,HOLE8,HOLE9,HOLE10, HOLE11,HOLE12,HOLE13,HOLE14,HOLE15,HOLE16,HOLE17,HOLE18,HOLE19,HOLE20, - HOLE21,HOLE22,HOLE23,HOLE24,HOLE25,SHIELD, + HOLE21,HOLE22,HOLE23,HOLE24,HOLE25,SIGN, SLOT,HOLE,STONES, BST1,BST2,BST3,BST4,BST5,BST6,BST7,BST8, BST9,BST10,BST11,BST12,BST13,BST14,BST15,BST16, @@ -116,7 +116,7 @@ enum ObjectId { BMASK,BOTTLE,PLAYER,TOOTHBRUSH,BOOKS,LEXICON,PLANT,SNAKE, CUP,JOYSTICK,BOTTLE1,BOTTLE2,BOTTLE3,BOTTLE4,BOX,FACES, SELLER,POSTER,AXACUSSER,KP_ENTRANCE,CHIP,CARD, - DOODLE,DOODLE2,BELL,GROPE,DOOR_L,DOOR_R,ID_CARD, + SCRIBBLE1,SCRIBBLE2,BELL,GROPE,DOOR_L,DOOR_R,ID_CARD, MAGNET,UNDER_BED,KEY,VALVE,WARDROBE,DISCMAN, SMALL_DOOR,BACK_MONEY,WALL,SUCTION_CUP,IMITATION,SP_KEYCARD,ALARM_CRACKER, ENCRYPTED_DOOR,ALARM_ANLAGE,MUS_STREET,BIG_DOOR,INVESTMENT, @@ -153,12 +153,12 @@ kString115, kString116, kString117, kString118, kString119, kString120, kString121, kString122, kString123, kString124, kString125, kString126, kString127, kString128, kString129, kString130, kString131, kString132, kString133, kString134, -kString135, kString136, kString137, kString138, kString139, +kString135, kString136, kStringSign, kString138, kString139, kString140, kString141, kString142, kString143, kString144, kString145, kString146, kString147, kString148, kString149, kString150, kString151, kString152, kString153, kString154, kString155, kString156, kString157, kString158, kString159, -kString160, kString161, kString162, kString163, kString164, +kString160, kString161, kString162, kStringSlot, kString164, kString165, kString166, kString167, kString168, kStringExit, kString170, kString171, kString172, kString173, kString174, kString175, kString176, kString177, kStringDefaultDescription, kStringLooksMetal, @@ -169,8 +169,8 @@ kString195, kString196, kString197, kString198, kString199, kStringAirportEntrance, kStringAirport, kStringDowntown, kStringCulturePalace, kStringEarth, kStringPrivateApartment, kStringLeaveTaxi, kStringPay, kStringAddress, kStringCheater, kStringNotEnoughMoney, kStringTaxiAccelerating, kString5MinutesLater, kStringAlreadyHavePole, kStringSawPole, -kStringOnlyShop, kStringCabinOccupiedSay, kString217, kString218, kString219, -kString220, kString221, kString222, kString223, kString224, +kStringOnlyShop, kStringCabinOccupiedSay, kStringTakeMoney, kStringAlreadyPaid, kStringNoMoney, +kStringPay10Xa, kStringWillPassOut, kStringRest, kString223, kString224, kString225, kString226, kString227, kString228, kString229, kString230, kString231, kString232, kString233, kString234, kString235, kString236, kString237, kString238, kString239, @@ -187,9 +187,9 @@ kStringVehicleDescription, kStringEntranceDescription, kStringWallet, kStringWal kStringDeviceDescription, kStringIdCard, kStringIdCardDescription, kStringStaircase, kStringStaircaseDescription, kStringBusinessStreet, kStringBusinessStreetDescription, kStringRod, kStringPost, kStringRailing, kStringPoster, kStringPosterDescription, kStringCabin, kStringCabinFree, kStringCabinOccupied, -kStringFeet, kStringFeetDescription, kString307, kString308, kString309, -kString310, kString311, kString312, kString313, kString314, -kString315, kString316, kString317, kString318, kString319, +kStringFeet, kStringFeetDescription, kStringHood, kStringHoodDescription, kString400Xa, +kString10Xa, kStringSlotDescription1, kStringSlotDescription2, kStringChair, kStringChairDescription, +kStringScribble, kStringFace, kStringFaceDescription, kString318, kString319, kString320, kString321, kString322, kString323, kString324, kString325, kString326, kString327, kString328, kString329, kString330, kString331, kString332, kString333, kString334, diff --git a/engines/supernova2/rooms.cpp b/engines/supernova2/rooms.cpp index 936c827bc4..f15c03f3db 100644 --- a/engines/supernova2/rooms.cpp +++ b/engines/supernova2/rooms.cpp @@ -737,10 +737,23 @@ bool Games::interact(Action verb, Object &obj1, Object &obj2) { Cabin::Cabin(Supernova2Engine *vm, GameManager *gm) { _vm = vm; _gm = gm; + _paid = false; - _fileNumber = 6; + _fileNumber = 7; _id = CABIN; _shown[0] = kShownTrue; + + _objectState[0] = Object(_id, kStringExit, kStringDefaultDescription, NULLOBJECT, EXIT, 255, 255, 0, GAMES, 22); + _objectState[1] = Object(_id, kStringHood, kStringHoodDescription, NULLOBJECT, NULLTYPE, 0, 0, 0); + _objectState[2] = Object(_id, kString400Xa, kStringDefaultDescription, PRIZE, TAKE, 255, 255, 2 + 180); + _objectState[3] = Object(_id, kString10Xa, kStringDefaultDescription, BACK_MONEY, TAKE, 255, 255, 2 + 128); + _objectState[4] = Object(_id, kStringSlot, kStringSlotDescription1, SLOT1, COMBINABLE, 2, 2, 0); + _objectState[5] = Object(_id, kStringSlot, kStringSlotDescription2, NULLOBJECT, COMBINABLE, 3, 3, 0); + _objectState[6] = Object(_id, kStringChair, kStringChairDescription, CHAIR, NULLTYPE, 4, 4, 0); + _objectState[7] = Object(_id, kStringScribble, kStringDefaultDescription, SCRIBBLE1, NULLTYPE, 5, 5, 0); + _objectState[8] = Object(_id, kStringScribble, kStringDefaultDescription, SCRIBBLE2, NULLTYPE, 6, 6, 0); + _objectState[9] = Object(_id, kStringFace, kStringFaceDescription, NULLOBJECT, NULLTYPE, 7, 7, 0); + _objectState[10] = Object(_id, kStringSign, kStringDefaultDescription, SIGN, UNNECESSARY, 1, 1, 0); } void Cabin::onEntrance() { @@ -748,9 +761,72 @@ void Cabin::onEntrance() { } void Cabin::animation() { + if (_paid) { + if (isSectionVisible(1)) + _vm->renderImage(1 + 128); + else + _vm->renderImage(1); + } + _gm->setAnimationTimer(4); } bool Cabin::interact(Action verb, Object &obj1, Object &obj2) { + if (verb == ACTION_USE && Object::combine(obj1, obj2, MONEY, SLOT1)) { + if (isSectionVisible(2)) + _vm->renderMessage(kStringTakeMoney); + else if (_paid) + _vm->renderMessage(kStringAlreadyPaid); + else if (_gm->_state._money < 10) + _vm->renderMessage(kStringNoMoney); + else { + _vm->renderMessage(kStringPay10Xa); + _gm->takeMoney(-10); + _paid = true; + } + } + else if (verb == ACTION_USE && obj1._id == CHAIR) { + if (_paid) { + if (_var2) { + _vm->paletteFadeOut(); + _vm->setCurrentImage(31); + _vm->renderImage(0); + _vm->paletteFadeIn(); + _paid = true; + _gm->waitOnInput(100000); + _vm->paletteFadeOut(); + _vm->setCurrentImage(7); + _vm->renderImage(0); + setSectionVisible(1, kShownFalse); + _paid = false; + _vm->renderRoom(*this); + _vm->renderImage(2); + _gm->drawMapExits(); + _gm->drawInventory(); + _gm->drawStatus(); + _gm->drawCommandBox(); + _vm->paletteFadeIn(); + getObject(3)->_click = 8; + } else { + _gm->_state._tipsy = false; + _vm->paletteFadeOut(); + _vm->_system->fillScreen(kColorBlack); + Common::String text = _vm->getGameString(kStringWillPassOut); + _vm->renderMessage(text); + _gm->waitOnInput((text.size() + 20) * _vm->_textSpeed / 10); + _vm->removeMessage(); + _vm->saveGame(kSleepAutosaveSlot, "autosave"); + _gm->_inventory.clear(); + _gm->changeRoom(PYRAMID); + _gm->drawStatus(); + _gm->drawInventory(); + _gm->drawMapExits(); + _gm->drawCommandBox(); + } + } else + _vm->renderMessage(kStringRest); + } + else + return false; return true; } diff --git a/engines/supernova2/rooms.h b/engines/supernova2/rooms.h index b82229bede..288023c786 100644 --- a/engines/supernova2/rooms.h +++ b/engines/supernova2/rooms.h @@ -138,6 +138,8 @@ public: virtual bool interact(Action verb, Object &obj1, Object &obj2); private: + bool _paid; + bool _var2; // Not sure what this variable means yet }; class Kiosk : public Room { diff --git a/engines/supernova2/state.cpp b/engines/supernova2/state.cpp index 3cfed253dc..c60b5048d4 100644 --- a/engines/supernova2/state.cpp +++ b/engines/supernova2/state.cpp @@ -40,6 +40,7 @@ bool GameManager::serialize(Common::WriteStream *out) { out->writeByte(_state._addressKnown); out->writeByte(_state._poleMagnet); out->writeByte(_state._admission); + out->writeByte(_state._tipsy); // Inventory out->writeSint32LE(_inventory.getSize()); @@ -70,6 +71,7 @@ bool GameManager::deserialize(Common::ReadStream *in, int version) { _state._addressKnown = in->readByte(); _state._poleMagnet = in->readByte(); _state._admission = in->readByte(); + _state._tipsy = in->readByte(); _vm->setGameString(kStringMoney, Common::String::format("%d Xa", _state._money)); _oldTime = g_system->getMillis(); @@ -333,6 +335,7 @@ void GameManager::initState() { _state._previousRoom = _currentRoom; _state._poleMagnet = false; _state._admission = 0; + _state._tipsy = false; } void GameManager::initRooms() { diff --git a/engines/supernova2/state.h b/engines/supernova2/state.h index c69aebce0a..3d8b650f06 100644 --- a/engines/supernova2/state.h +++ b/engines/supernova2/state.h @@ -39,6 +39,7 @@ struct GameState { Room *_previousRoom; bool _poleMagnet; char _admission; + bool _tipsy; }; class Inventory { |