aboutsummaryrefslogtreecommitdiff
path: root/engines/startrek/room.cpp
diff options
context:
space:
mode:
authorMatthew Stewart2018-06-15 02:35:36 -0400
committerEugene Sandulenko2018-08-09 08:37:30 +0200
commitefda57c114ecbf62b4d5b76c12e648837d814cdb (patch)
tree440424ac9cc14c9182067d03de9e3a7415aa530b /engines/startrek/room.cpp
parent6e322ebfc5279ee16076b07b82a1dc2c44122b26 (diff)
downloadscummvm-rg350-efda57c114ecbf62b4d5b76c12e648837d814cdb.tar.gz
scummvm-rg350-efda57c114ecbf62b4d5b76c12e648837d814cdb.tar.bz2
scummvm-rg350-efda57c114ecbf62b4d5b76c12e648837d814cdb.zip
STARTREK: LOVE0 (start of 3rd mission)
Diffstat (limited to 'engines/startrek/room.cpp')
-rw-r--r--engines/startrek/room.cpp23
1 files changed, 19 insertions, 4 deletions
diff --git a/engines/startrek/room.cpp b/engines/startrek/room.cpp
index 844b8c3c7e..245edb707b 100644
--- a/engines/startrek/room.cpp
+++ b/engines/startrek/room.cpp
@@ -81,6 +81,10 @@ Room::Room(StarTrekEngine *vm, const Common::String &name) : _vm(vm) {
_roomActionList = tug3ActionList;
_numRoomActions = sizeof(tug3ActionList) / sizeof(RoomAction);
}
+ else if (name == "LOVE0") {
+ _roomActionList = love0ActionList;
+ _numRoomActions = sizeof(love0ActionList) / sizeof(RoomAction);
+ }
else {
warning("Room \"%s\" unimplemented", name.c_str());
_numRoomActions = 0;
@@ -327,6 +331,13 @@ Common::Point Room::getActorPos(int actorIndex) {
return _vm->_actorList[actorIndex].pos;
}
+/**
+ * Returns a word in range [start, end] (that's inclusive).
+ */
+int16 Room::getRandomWordInRange(int start, int end) {
+ return _vm->getRandomWord() % (end - start + 1) + start;
+}
+
void Room::playSoundEffectIndex(int soundEffect) {
_vm->playSoundEffectIndex(soundEffect);
}
@@ -368,23 +379,27 @@ void Room::playVoc(Common::String filename) {
_vm->_sound->playVoc(filename);
}
-void Room::spockScan(int direction, int text) {
+void Room::spockScan(int direction, int text, bool changeDirection) {
const char *dirs = "nsew";
Common::String anim = "sscan_";
anim.setChar(dirs[direction], 5);
- _vm->_awayMission.crewDirectionsAfterWalk[OBJECT_SPOCK] = direction;
+ if (changeDirection) // Check whether he should turn back to original direction after scanning
+ _vm->_awayMission.crewDirectionsAfterWalk[OBJECT_SPOCK] = direction;
+
loadActorAnim2(OBJECT_SPOCK, anim, -1, -1, 0);
playSoundEffectIndex(SND_TRICORDER);
showText(TX_SPEAKER_SPOCK, text);
}
-void Room::mccoyScan(int direction, int text) {
+void Room::mccoyScan(int direction, int text, bool changeDirection) {
const char *dirs = "nsew";
Common::String anim = "mscan_";
anim.setChar(dirs[direction], 5);
- _vm->_awayMission.crewDirectionsAfterWalk[OBJECT_MCCOY] = direction;
+ if (changeDirection)
+ _vm->_awayMission.crewDirectionsAfterWalk[OBJECT_MCCOY] = direction;
+
loadActorAnim2(OBJECT_MCCOY, anim, -1, -1, 0);
playSoundEffectIndex(SND_TRICORDER);
showText(TX_SPEAKER_MCCOY, text);