aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaromir Wysoglad2019-05-30 15:12:37 +0200
committerThierry Crozat2019-07-28 15:09:14 +0100
commit701a9570070009dfc45f93330d19645b6f6ed1ce (patch)
treec5624edce685c49ff13fd8bcf253a1ac022ed6ae
parent6bd7e561b4325b48255d0d71a654432fd1c84889 (diff)
downloadscummvm-rg350-701a9570070009dfc45f93330d19645b6f6ed1ce.tar.gz
scummvm-rg350-701a9570070009dfc45f93330d19645b6f6ed1ce.tar.bz2
scummvm-rg350-701a9570070009dfc45f93330d19645b6f6ed1ce.zip
SUPERNOVA2: Add taxi stand room
-rw-r--r--engines/supernova2/ms2_def.h12
-rw-r--r--engines/supernova2/rooms.cpp58
-rw-r--r--engines/supernova2/rooms.h10
-rw-r--r--engines/supernova2/state.cpp22
-rw-r--r--engines/supernova2/state.h3
5 files changed, 98 insertions, 7 deletions
diff --git a/engines/supernova2/ms2_def.h b/engines/supernova2/ms2_def.h
index 1891e36db1..a495adf585 100644
--- a/engines/supernova2/ms2_def.h
+++ b/engines/supernova2/ms2_def.h
@@ -145,7 +145,7 @@ kString75, kString76, kString77, kString78, kString79,
kString80, kString81, kString82, kString83, kString84,
kString85, kString86, kString87, kString88, kString89,
kString90, kString91, kString92, kString93, kString94,
-kString95, kString96, kString97, kString98, kString99,
+kStringEntrance, kString96, kString97, kString98, kString99,
kString100, kString101, kString102, kStringDinosaurHead, kString104,
kString105, kStringSuctionCup, kString107, kString108, kString109,
kString110, kString111, kString112, kString113, kString114,
@@ -166,8 +166,8 @@ kString180, kString181, kString182, kString183, kString184,
kString185, kString186, kString187, kString188, kString189,
kString190, kString191, kString192, kString193, kString194,
kString195, kString196, kString197, kString198, kString199,
-kStringAirportEntrance, kString201, kString202, kString203, kString204,
-kString205, kString206, kString207, kString208, kString209,
+kStringAirportEntrance, kStringAirport, kStringDowntown, kStringCulturePalace, kStringEarth,
+kStringPrivateApartment, kStringLeaveTaxi, kStringPay, kString208, kString209,
kString210, kString211, kString212, kString213, kString214,
kString215, kString216, kString217, kString218, kString219,
kString220, kString221, kString222, kString223, kString224,
@@ -182,9 +182,9 @@ kString260, kString261, kString262, kString263, kString264,
kString265, kString266, kString267, kString268, kStringKnife,
kStringKnifeDescription, kStringMoney, kStringDiscman, kStringDiscmanDescription, kStringSuctionCupDescription,
kStringSpecialCard, kStringSpecialCardDescription, kStringAlarmCracker, kStringAlarmCrackerDescription, kStringKeycard,
-kStringSpaceship, kStringSpaceshipDescription, kStringVehicles, kStringVehiclesDescription, kString284,
-kString285, kString286, kString287, kString288, kString289,
-kString290, kString291, kString292, kString293, kString294,
+kStringSpaceship, kStringSpaceshipDescription, kStringVehicles, kStringVehiclesDescription, kStringVehicle,
+kStringVehicleDescription, kStringEntranceDescription, kStringWallet, kStringWalletDescription, kStringDevice,
+kStringDeviceDescription, kStringIdCard, kStringIdCardDescription, kString293, kString294,
kString295, kString296, kString297, kString298, kString299,
kString300, kString301, kString302, kString303, kString304,
kString305, kString306, kString307, kString308, kString309,
diff --git a/engines/supernova2/rooms.cpp b/engines/supernova2/rooms.cpp
index 4aa196dc49..7b96ee3bb6 100644
--- a/engines/supernova2/rooms.cpp
+++ b/engines/supernova2/rooms.cpp
@@ -509,10 +509,66 @@ void Airport::onEntrance() {
for (int i = 0; i < 3; ++i)
_gm->_inventory.add(*_gm->_rooms[INTRO]->getObject(i));
- setRoomSeen(true);
if (hasSeen() == false) {
_vm->renderMessage(kStringAirportEntrance);
}
setRoomSeen(true);
}
+
+TaxiStand::TaxiStand(Supernova2Engine *vm, GameManager *gm) {
+ _vm = vm;
+ _gm = gm;
+
+ _fileNumber = 3;
+ _id = TAXISTAND;
+ _shown[0] = kShownTrue;
+ _shown[1] = kShownTrue;
+ _shown[2] = kShownTrue;
+ _shown[3] = kShownFalse;
+ _shown[4] = kShownFalse;
+ _shown[5] = kShownFalse;
+ _shown[6] = kShownFalse;
+ _shown[7] = kShownTrue;
+
+ _objectState[0] = Object(_id, kStringVehicle, kStringVehicleDescription, TAXI, NULLTYPE, 2, 2, 0, NULLROOM, 11);
+ _objectState[1] = Object(_id, kStringVehicle, kStringVehicleDescription, NULLOBJECT, NULLTYPE, 1, 1, 0);
+ _objectState[2] = Object(_id, kStringEntrance, kStringEntranceDescription, DOOR, EXIT | OPENABLE | CLOSED, 3, 3, 0, NULLROOM, 1);
+ _objectState[3] = Object(_id, kStringWallet, kStringWalletDescription, WALLET, TAKE, 0, 0, 7 + 128);
+ _objectState[4] = Object(_id, kStringDevice, kStringDeviceDescription, TRANSMITTER, TAKE | PRESS, 255, 255, 0);
+ _objectState[5] = Object(_id, kStringIdCard, kStringIdCardDescription, ID_CARD, TAKE | COMBINABLE, 255, 255, 0);
+ _objectState[5] = Object(_id, kStringAirport, kStringDefaultDescription, NULLOBJECT, EXIT, 255, 255, 0, AIRPORT, 22);
+}
+
+void TaxiStand::onEntrance() {
+ setRoomSeen(true);
+}
+
+void TaxiStand::animation() {
+ if (isSectionVisible(4)) {
+ setSectionVisible(1, kShownFalse);
+ setSectionVisible(2, kShownFalse);
+ setSectionVisible(3, kShownFalse);
+ setSectionVisible(4, kShownFalse);
+ }
+ else if (isSectionVisible(3))
+ setSectionVisible(4, kShownTrue);
+ else if (isSectionVisible(2))
+ setSectionVisible(3, kShownTrue);
+ else if (isSectionVisible(1))
+ setSectionVisible(2, kShownTrue);
+ else
+ setSectionVisible(1, kShownTrue);
+ _gm->setAnimationTimer(7);
+}
+
+bool TaxiStand::interact(Action verb, Object &obj1, Object &obj2) {
+ if (verb == ACTION_WALK && obj1._id == TAXI && isSectionVisible(6))
+ ;//taxi
+ else if ((verb == ACTION_WALK || verb == ACTION_OPEN) && obj1._id == DOOR)
+ _vm->renderMessage(obj1._description);
+ else
+ return false;
+ return true;
+}
+
}
diff --git a/engines/supernova2/rooms.h b/engines/supernova2/rooms.h
index 9dbc6c4a80..547fcf4e2e 100644
--- a/engines/supernova2/rooms.h
+++ b/engines/supernova2/rooms.h
@@ -100,5 +100,15 @@ public:
private:
};
+class TaxiStand : public Room {
+public:
+ TaxiStand(Supernova2Engine *vm, GameManager *gm);
+ virtual void onEntrance();
+ virtual void animation();
+ virtual bool interact(Action verb, Object &obj1, Object &obj2);
+
+private:
+};
+
}
#endif // SUPERNOVA2_ROOMS_H
diff --git a/engines/supernova2/state.cpp b/engines/supernova2/state.cpp
index 00b54c147e..4a10522cd8 100644
--- a/engines/supernova2/state.cpp
+++ b/engines/supernova2/state.cpp
@@ -158,6 +158,7 @@ GameManager::~GameManager() {
void GameManager::destroyRooms() {
delete _rooms[INTRO];
delete _rooms[AIRPORT];
+ delete _rooms[TAXISTAND];
}
void GameManager::initState() {
@@ -174,6 +175,7 @@ void GameManager::initState() {
_mouseY = -1;
_mouseField = -1;
_inventoryScroll = 0;
+ _oldTime = g_system->getMillis();
_timerPaused = 0;
_timePaused = false;
_messageDuration = 0;
@@ -193,6 +195,7 @@ void GameManager::initState() {
void GameManager::initRooms() {
_rooms[INTRO] = new Intro(_vm, this);
_rooms[AIRPORT] = new Airport(_vm, this);
+ _rooms[TAXISTAND] = new TaxiStand(_vm, this);
}
void GameManager::initGui() {
@@ -238,6 +241,7 @@ void GameManager::initGui() {
}
void GameManager::updateEvents() {
+ handleTime();
if (_animationEnabled && !_vm->_screen->isMessageShown() && _animationTimer == 0)
_currentRoom->animation();
@@ -677,6 +681,24 @@ bool GameManager::waitOnInput(int ticks, Common::KeyCode &keycode) {
return false;
}
+void GameManager::setAnimationTimer(int ticks) {
+ _animationTimer = ticksToMsec(ticks);
+}
+
+void GameManager::handleTime() {
+ if (_timerPaused)
+ return;
+ int32 newTime = g_system->getMillis();
+ int32 delta = newTime - _oldTime;
+
+ if (_animationTimer > delta)
+ _animationTimer -= delta;
+ else
+ _animationTimer = 0;
+
+ _oldTime = newTime;
+}
+
int GameManager::invertSection(int section) {
if (section < 128)
section += 128;
diff --git a/engines/supernova2/state.h b/engines/supernova2/state.h
index 27e56315f9..b849cde14d 100644
--- a/engines/supernova2/state.h
+++ b/engines/supernova2/state.h
@@ -130,6 +130,7 @@ public:
Object _nullObject;
Object *_currentInputObject;
Object *_inputObject[2];
+ int32 _oldTime;
uint _timePaused;
bool _timerPaused;
int32 _messageDuration;
@@ -168,6 +169,8 @@ public:
void changeRoom(RoomId id);
void resetInputState();
void handleInput();
+ void handleTime();
+ void setAnimationTimer(int ticks);
private:
int _prevImgId;