diff --git a/engines/startrek/awaymission.cpp b/engines/startrek/awaymission.cpp index 0265f4ed60be..f352fb68d8b2 100644 --- a/engines/startrek/awaymission.cpp +++ b/engines/startrek/awaymission.cpp @@ -465,7 +465,7 @@ void StarTrekEngine::handleAwayMissionAction() { int16 roomIndex = _room->readRdfWord(RDF_WARP_ROOM_INDICES + warpIndex * 2); unloadRoom(); _sound->loadMusicFile("ground"); - loadRoom(_missionName, roomIndex); + loadRoom(_missionName, 4); // FIXME initAwayCrewPositions(warpIndex ^ 1); } break; diff --git a/engines/startrek/awaymission.h b/engines/startrek/awaymission.h index 178b78887bc2..15333da0cb7d 100644 --- a/engines/startrek/awaymission.h +++ b/engines/startrek/awaymission.h @@ -45,9 +45,9 @@ struct AwayMission { // If a bit in "crewDownBitset" is set, the corresponding timer in "crewGetupTimers" // begins counting down. When it reaches 0, they get up. - byte crewDownBitset; + byte crewDownBitset; // 0x24 - int8 crewDirectionsAfterWalk[4]; // Sets an object's direction after they finish walking somewhere? + int8 crewDirectionsAfterWalk[4]; // 0x25: Sets an object's direction after they finish walking somewhere? // Mission-specific variables union { @@ -71,15 +71,19 @@ struct AwayMission { byte field41; // 0x41 bool foundMiner; // 0x43 bool field45; // 0x45 + bool field47; // 0x47 bool warpsDisabled; // 0x48 bool boulder1Gone; // 0x49 bool boulder2Gone; // 0x4a bool boulder3Gone; // 0x4b bool boulder4Gone; // 0x4c bool doorOpened; // 0x4d + bool field4e; // 0x4e + byte field4f; // 0x4f bool gotBerries; // 0x50 bool madeHypoDytoxin; // 0x51 byte field56; // 0x56 + bool foundAlienRoom; // 0x57 } demon; }; diff --git a/engines/startrek/module.mk b/engines/startrek/module.mk index a374f80a7caf..79dd0ecad58c 100644 --- a/engines/startrek/module.mk +++ b/engines/startrek/module.mk @@ -21,7 +21,8 @@ MODULE_OBJS = \ rooms/demon0.o \ rooms/demon1.o \ rooms/demon2.o \ - rooms/demon3.o + rooms/demon3.o \ + rooms/demon4.o diff --git a/engines/startrek/room.cpp b/engines/startrek/room.cpp index d44ad9632aa2..2c181a51a2d8 100644 --- a/engines/startrek/room.cpp +++ b/engines/startrek/room.cpp @@ -53,6 +53,10 @@ Room::Room(StarTrekEngine *vm, const Common::String &name) : _vm(vm) { _roomActionList = demon3ActionList; _numRoomActions = sizeof(demon3ActionList) / sizeof(RoomAction); } + else if (name == "DEMON4") { + _roomActionList = demon4ActionList; + _numRoomActions = sizeof(demon4ActionList) / sizeof(RoomAction); + } else { warning("Room \"%s\" unimplemented", name.c_str()); _numRoomActions = 0; @@ -208,11 +212,11 @@ int Room::showText(int speaker, int text) { textIDs[0] = speaker; textIDs[1] = text; textIDs[2] = TX_BLANK; - showText(textIDs); + return showText(textIDs); } int Room::showText(int text) { - showText(TX_NULL, text); + return showText(TX_NULL, text); } void Room::giveItem(int item) { diff --git a/engines/startrek/room.h b/engines/startrek/room.h index a9aca4495eb1..da93a1e14a4e 100644 --- a/engines/startrek/room.h +++ b/engines/startrek/room.h @@ -308,6 +308,32 @@ class Room { void demon3LookAtPanel(); void demon3LookAtLight(); + // DEMON4 + void demon4Tick1(); + void demon4FinishedAnimation1(); + void demon4FinishedAnimation2(); + void demon4FinishedAnimation3(); + void demon4UsePhaserOnPanel(); + void demon4UsePhaserOnPattern(); + void demon4UsePhaserOnMccoy(); + void demon4LookAtPattern(); + void demon4LookAtAlien(); + void demon4LookAnywhere(); + void demon4LookAtSecurityEquipment(); + void demon4LookAtFloor(); + void demon4LookAtKirk(); + void demon4LookAtMccoy(); + void demon4LookAtSpock(); + void demon4LookAtRedshirt(); + void demon4LookAtChamber(); + void demon4LookAtPanel(); + void demon4UseKirkOnPanel(); + void demon4UseSpockOnPanel(); + void demon4UseMccoyOnPanel(); + void demon4UseRedshirtOnPanel(); + void demon4UseCrewmanOnPanel(); + void demon4CrewmanReachedPanel(); + private: // Room-specific variables. This is memset'ed to 0 when the room is initialized. union { @@ -331,6 +357,11 @@ class Room { char boulderAnim[10]; // 0xd4 int16 usedPhaserOnDoor; // 0xd6 } demon3; + + struct { + bool cb; // 0xcb + int16 crewmanUsingPanel; // 0xcf + } demon4; } _roomVar; }; diff --git a/engines/startrek/rooms/demon4.cpp b/engines/startrek/rooms/demon4.cpp new file mode 100644 index 000000000000..3596761c7de8 --- /dev/null +++ b/engines/startrek/rooms/demon4.cpp @@ -0,0 +1,147 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "startrek/room.h" + +namespace StarTrek { + +void Room::demon4Tick1() { + playVoc("DEM4LOOP"); + + if (!_vm->_awayMission.demon.healedMiner) + _vm->_awayMission.demon.minerDead = true; + + if (_vm->_awayMission.demon.field4e) { + loadActorAnim(10, "bxrise2", 0x122, 0x91, 0); + loadActorAnim(8, "stpout2", 0x107, 0x92, 0); + _roomVar.demon4.cb = true; + + if ((_vm->_awayMission.demon.field4f & 0x10) && !_vm->_awayMission.demon.field47) + _vm->_awayMission.timers[6] = 20; + } + + if (!_vm->_awayMission.demon.foundAlienRoom) { + _vm->_awayMission.demon.foundAlienRoom = true; + playMidiMusicTracks(1, -1); + } +} + +void Room::demon4FinishedAnimation1() { + // TODO +} + +void Room::demon4FinishedAnimation2() { +} + +void Room::demon4FinishedAnimation3() { +} + +void Room::demon4UsePhaserOnPanel() { + showText(TX_SPEAKER_SPOCK, TX_DEM4_013); +} + +void Room::demon4UsePhaserOnPattern() { + showText(TX_SPEAKER_SPOCK, TX_DEM4_045); +} + +void Room::demon4UsePhaserOnMccoy() { + showText(TX_SPEAKER_MCCOY, TX_DEM4_018); +} + +void Room::demon4LookAtPattern() { + showText(TX_DEM4N002); + +} + +void Room::demon4LookAtAlien() { + showText(TX_DEM4N007); +} + +void Room::demon4LookAnywhere() { + showText(TX_DEM4N004); +} + +void Room::demon4LookAtSecurityEquipment() { + showText(TX_DEM4N008); +} + +void Room::demon4LookAtFloor() { + showText(TX_DEM4N009); +} + +void Room::demon4LookAtKirk() { + showText(TX_DEM4N003); +} + +void Room::demon4LookAtMccoy() { + showText(TX_DEM4N000); +} + +void Room::demon4LookAtSpock() { + showText(TX_DEM4N005); +} + +void Room::demon4LookAtRedshirt() { + showText(TX_DEM4N001); +} + +void Room::demon4LookAtChamber() { + showText(TX_DEM4N006); +} + +void Room::demon4LookAtPanel() { + showText(TX_DEM4N012); +} + +void Room::demon4UseKirkOnPanel() { + _roomVar.demon4.crewmanUsingPanel = OBJECT_KIRK; + demon4UseCrewmanOnPanel(); +} + +void Room::demon4UseSpockOnPanel() { + _roomVar.demon4.crewmanUsingPanel = OBJECT_SPOCK; + demon4UseCrewmanOnPanel(); +} + +void Room::demon4UseMccoyOnPanel() { + _roomVar.demon4.crewmanUsingPanel = OBJECT_MCCOY; + demon4UseCrewmanOnPanel(); +} + +void Room::demon4UseRedshirtOnPanel() { + _roomVar.demon4.crewmanUsingPanel = OBJECT_REDSHIRT; + demon4UseCrewmanOnPanel(); +} + +void Room::demon4UseCrewmanOnPanel() { + if (_vm->_awayMission.demon.field4e) + return; + walkCrewman(_roomVar.demon4.crewmanUsingPanel, 0xda, 0x83, 3); + _vm->_awayMission.crewDirectionsAfterWalk[_roomVar.demon4.crewmanUsingPanel] = DIR_N; + _vm->_awayMission.transitioningIntoRoom = true; +} + +void Room::demon4CrewmanReachedPanel() { + // TODO: puzzle implementation +} + +} diff --git a/engines/startrek/rooms/function_map.h b/engines/startrek/rooms/function_map.h index fca7aaa0fd8d..1761bda3148a 100644 --- a/engines/startrek/rooms/function_map.h +++ b/engines/startrek/rooms/function_map.h @@ -309,6 +309,41 @@ RoomAction demon3ActionList[] = { }; +RoomAction demon4ActionList[] = { + { Action(ACTION_TICK, 1, 0, 0), &Room::demon4Tick1 }, + { Action(ACTION_FINISHED_ANIMATION, 1, 0, 0), &Room::demon4FinishedAnimation1 }, + { Action(ACTION_FINISHED_ANIMATION, 2, 0, 0), &Room::demon4FinishedAnimation2 }, + { Action(ACTION_FINISHED_ANIMATION, 3, 0, 0), &Room::demon4FinishedAnimation3 }, + + // TODO: everything + + { Action(ACTION_USE, OBJECT_IPHASERS, 0x21, 0), &Room::demon4UsePhaserOnPanel }, + { Action(ACTION_USE, OBJECT_IPHASERS, 0x20, 0), &Room::demon4UsePhaserOnPattern }, + { Action(ACTION_USE, OBJECT_IPHASERS, OBJECT_MCCOY, 0), &Room::demon4UsePhaserOnMccoy }, + + // TODO + + { Action(ACTION_LOOK, 0x20, 0, 0), &Room::demon4LookAtPattern }, + { Action(ACTION_LOOK, 8, 0, 0), &Room::demon4LookAtAlien }, + { Action(ACTION_LOOK, -1, 0, 0), &Room::demon4LookAnywhere }, + { Action(ACTION_LOOK, 0x22, 0, 0), &Room::demon4LookAtSecurityEquipment }, + { Action(ACTION_LOOK, 0x23, 0, 0), &Room::demon4LookAtFloor }, + + { Action(ACTION_LOOK, OBJECT_KIRK, 0, 0), &Room::demon4LookAtKirk }, + { Action(ACTION_LOOK, OBJECT_MCCOY, 0, 0), &Room::demon4LookAtMccoy }, + { Action(ACTION_LOOK, OBJECT_SPOCK, 0, 0), &Room::demon4LookAtSpock }, + { Action(ACTION_LOOK, OBJECT_REDSHIRT, 0, 0), &Room::demon4LookAtRedshirt }, + + { Action(ACTION_LOOK, 10, 0, 0), &Room::demon4LookAtChamber }, + { Action(ACTION_LOOK, 0x21, 0, 0), &Room::demon4LookAtPanel }, + + { Action(ACTION_USE, OBJECT_KIRK, 0x21, 0), &Room::demon4UseKirkOnPanel }, + { Action(ACTION_USE, OBJECT_SPOCK, 0x21, 0), &Room::demon4UseSpockOnPanel }, + { Action(ACTION_USE, OBJECT_MCCOY, 0x21, 0), &Room::demon4UseMccoyOnPanel }, + { Action(ACTION_USE, OBJECT_REDSHIRT, 0x21, 0), &Room::demon4UseRedshirtOnPanel }, + { Action(ACTION_FINISHED_WALKING, 3, 0, 0), &Room::demon4CrewmanReachedPanel }, +}; + } #endif diff --git a/engines/startrek/text.h b/engines/startrek/text.h index e1a4864dc90a..f23736bf9cba 100644 --- a/engines/startrek/text.h +++ b/engines/startrek/text.h @@ -245,6 +245,68 @@ enum GameStringIDs { TX_DEM3_F21, + TX_DEM4_010, + TX_DEM4_035, + TX_DEM4_030, + TX_DEM4_011, + TX_DEM4N014, + TX_DEM4_031, + TX_DEM4N012, + TX_DEM4N013, + TX_DEM4_001, + TX_DEM4_012, + TX_DEM4_044, + TX_DEM4_002, + TX_DEM4_004, + TX_DEM4_009, + TX_DEM4_042, + TX_DEM4_043, + TX_DEM4_039, + TX_DEM4_008, + TX_DEM4_007, + TX_DEM4_041, + TX_DEM4_040, + TX_DEM4_038, + TX_DEM4_037, + TX_DEM4N002, + TX_DEM4N010, + TX_DEM4N008, + TX_DEM4N007, + TX_DEM4N000, + TX_DEM4N005, + TX_DEM4N001, + TX_DEM4N004, + TX_DEM4N003, + TX_DEM4_015, + TX_DEM4_024, + TX_DEM4_046, + TX_DEM4_019, + TX_DEM4_022, + TX_DEM4_047, + TX_DEM4_021, + TX_DEM4_020, + TX_DEM4_014, + TX_DEM4_025, + TX_DEM4_023, + TX_DEM4_027, + TX_DEM4_026, + TX_DEM4_029, + TX_DEM4_033, + TX_DEM4_032, + TX_DEM4_013, + TX_DEM4_045, + TX_DEM4_018, + TX_DEM4N011, + TX_DEM4_034, + TX_DEM4_017, + TX_DEM4_036, + TX_DEM4_006, + TX_DEM4_003, + TX_DEM4_005, + TX_DEM4N009, + TX_DEM4N006, + + TX_END }; @@ -466,6 +528,68 @@ const char * const g_gameStrings[] = { "#DEM3\\DEM3N008#The hand's circuitry triggers a connection, and the door opens.", "#DEM3\\DEM3_019#He's dead, Jim...", "#DEM3\\DEM3_F21#Oh, thank you, kind souls, for saving my life. Let me rest here for a little before returning to report this miracle to Prelate Angiven.", + + + "#DEM4\\DEM4_010#I would be glad to accept your application to the Federation. We shall have a diplomatic envoy sent to make the final arrangements.", + "#DEM4\\DEM4_035#We look forward to meeting them. We also look forward to having discourse with the colonists. Farewell. May the Holy One bless you.", + "#DEM4\\DEM4_030#Live long and prosper.", + "#DEM4\\DEM4_011#Kirk to Enterprise... Beam us up, Mr. Scott.", + "#DEM4\\DEM4N014#You fit the key into the slot, but you cannot find a way to turn it.", + "#DEM4\\DEM4_031#Have you found the key?", + "#DEM4\\DEM4N012#It looks like a control panel with slide switches.", + "#DEM4\\DEM4N013#Nothing Happens.", + "#DEM4\\DEM4_001#I think we've found the answer to our mystery.", + "#DEM4\\DEM4_012#This seems to be a Cryogenic Suspension chamber, Captain.", + "#DEM4\\DEM4_044#Welcome to our home. Thank you for repairing our Sonambutron.", + "#DEM4\\DEM4_002#Stop! You're trespassing on Federation territory.", + "#DEM4\\DEM4_004#I welcome you on behalf of the United Federation of Planets. Who are you? Where do you come from?", + "#DEM4\\DEM4_009#We did fix your machine. Can we write the repair bill off against rent on this land?", + "#DEM4\\DEM4_042#Violence is hardly necessary, Captain Kirk. We owe you a debt for your service to us, and are more than willing to peacefully co-exist with your kind.", + "#DEM4\\DEM4_043#We call ourselves Nauians. Thousands of years ago, we saw that meteor impacts were going to cause an Ice Age. We created this huge underground shelter to preserve our race, keeping us in suspended animation until the planet had recovered. We programmed the machinery to revive us at the next eclipse, but we did not count on the destruction of our moon.", + "#DEM4\\DEM4_039#So the Ferengi are not the only traders in the universe! Yes, Captain Kirk, excusing the settlers' debts is an excellent way of ensuring that our people will be friends.", + "#DEM4\\DEM4_008#Some advanced civilization!", + "#DEM4\\DEM4_007#Perhaps you can tell us about the demons.", + "#DEM4\\DEM4_041#There is no need for disrespect, intruder. Our race is old and powerful, wise in many things. Like our guardians, for example.", + "#DEM4\\DEM4_040#The demons, as you call them, are created by a machine designed to keep intruders away from our sleep chambers. It pulls from the minds of any approaching creature their most feared enemy and produces replicas to scare them away. For you and your crew it was Klingons, for the Tellarite a wolf-demon, and for the other Humans a demon from their religion. On behalf of my people, thank you for waking us. I will turn off the machinery which creates our guardians, so that they no longer bedevil those with whom we now share our home.", + "#DEM4\\DEM4_038#Oh woe! Alas! The key is missing, I can do nothing! Even we will suffer the attacks of our own guardians unless the key can be found! I implore you, if you can help, please do so.", + "#DEM4\\DEM4_037#I see you have already shut off the machinery that creates the guardians. I have no way to thank you, Captain, but please carry this request from my people to yours. We have much ancient knowledge we can share, and we would like to join your Federation. Go in peace.", + "#DEM4\\DEM4N002#It appears to be an abstract piece of alien art.", + "#DEM4\\DEM4N010#This is where the panel should pop up.", + "#DEM4\\DEM4N008#This appears to control some unusual security equipment.", + "#DEM4\\DEM4N007#The alien is humanoid, with green reptilian skin. It appears unarmed.", + "#DEM4\\DEM4N000#Dr. McCoy looks back.", + "#DEM4\\DEM4N005#Spock is analyzing the alien machines.", + "#DEM4\\DEM4N001#Ensign Everts is looking around.", + "#DEM4\\DEM4N004#Many alien machines fill the room.", + "#DEM4\\DEM4N003#James T. Kirk, Captain of the Enterprise.", + "#DEM4\\DEM4_015#I wonder who, or what, constructed all this.", + "#DEM4\\DEM4_024#Logically, the machinery is sustaining some type of life in suspended animation. If we can reactivate the machines, then we may be able to meet its creators.", + "#DEM4\\DEM4_046#I'm just a security officer, sir.", + "#DEM4\\DEM4_019#Perhaps we should try to communicate with the alien.", + "#DEM4\\DEM4_022#Fascinating. this lifeform may represent what would have happened had the dinosaurs of your earth not become extinct.", + "#DEM4\\DEM4_047#What is that?", + "#DEM4\\DEM4_021#You should ask Spock, Jim.", + "#DEM4\\DEM4_020#This is a very old and very complex life-support system. It appears to still be operational.", + "#DEM4\\DEM4_014#Fascinating, Captain. It is a diagram of a lunar eclipse of this planet. See how the red ball, the moon, is casting a shadow on the blue ball, Pollux V. This must be a very old piece of work, because this planet's moon was destroyed thousands of years ago.", + "#DEM4\\DEM4_025#The machinery is waiting for the gravitational pull of another eclipse to activate it, an eclipse that will never come. And one other thing, Captain. This may also be a diagram showing the proper settings on that control panel.", + "#DEM4\\DEM4_023#It is an alien life-support system, Captain, utilizing geothermal energy. It is still functioning, waiting for some sort of signal.", + "#DEM4\\DEM4_027#This control panel is a manual override for the alien life-support equipment.", + "#DEM4\\DEM4_026#This alien construction takes readings of mental activity. It also activates manufacturing equipment related to security, and includes a short-distance transportation device.", + "#DEM4\\DEM4_029#This lifeform appears to be intelligent, a new sentient race. There appear to be resemblances between it and the silotis, although the present forms are quite small and definitely nonsentient.", + "#DEM4\\DEM4_033#There is no need for violence, Captain. We are a peaceful people.", + "#DEM4\\DEM4_032#Our patience is exhausted! Now feel our wrath!", + "#DEM4\\DEM4_013#Captain, Starfleet would not be pleased.", + "#DEM4\\DEM4_045#I do not think that would be a prudent action, sir.", + "#DEM4\\DEM4_018#Ouch!", + "#DEM4\\DEM4N011#You meet your death at the hands of a race that could have been your ally. What a waste. Better luck next time.", + "#DEM4\\DEM4_034#You found the key! I can now turn off the machinery creating our guardians, and no more sentients shall be at risk. Surely the Holy One smiles upon us all. I have no way to thank you, Captain, but please carry this request from my people to yours. We have much ancient knowledge we can share, and we would like to join your Federation. Go in peace.", + "#DEM4\\DEM4_017#Jim, think about that skull we picked up from Brother Stephen. Now look at this alien. See the resemblance?", + "#DEM4\\DEM4_036#A child? No, I see many differences. This must be what our people who did not slumber have become. Still, I would like to see these remains properly interred, according to the precepts of our religion. May I keep this?", + "#DEM4\\DEM4_006#Of course. I think you will get along well with the Pollux inhabitants, and I'm sure you will have interesting theological discussions.", + "#DEM4\\DEM4_003#I think I should return it to where I got it from.", + "#DEM4\\DEM4_005#No, I want to keep it as a memento for myself.", + "#DEM4\\DEM4N009#This floor contains conduits for conducting geothermal energy.", + "#DEM4\\DEM4N006#The alien emerged from this metal chamber.", }; }