diff options
-rw-r--r-- | engines/startrek/awaymission.h | 16 | ||||
-rw-r--r-- | engines/startrek/bitmap.h | 8 | ||||
-rw-r--r-- | engines/startrek/graphics.cpp | 2 | ||||
-rw-r--r-- | engines/startrek/module.mk | 4 | ||||
-rw-r--r-- | engines/startrek/room.cpp | 26 | ||||
-rw-r--r-- | engines/startrek/room.h | 82 | ||||
-rw-r--r-- | engines/startrek/rooms/demon0.cpp | 62 | ||||
-rw-r--r-- | engines/startrek/rooms/demon1.cpp | 50 | ||||
-rw-r--r-- | engines/startrek/rooms/demon2.cpp | 342 | ||||
-rw-r--r-- | engines/startrek/rooms/demon3.cpp | 437 | ||||
-rw-r--r-- | engines/startrek/rooms/function_map.h | 92 | ||||
-rw-r--r-- | engines/startrek/sound.cpp | 11 | ||||
-rw-r--r-- | engines/startrek/startrek.cpp | 1 | ||||
-rw-r--r-- | engines/startrek/startrek.h | 2 |
14 files changed, 1066 insertions, 69 deletions
diff --git a/engines/startrek/awaymission.h b/engines/startrek/awaymission.h index 2e5b7d99d5..9087589729 100644 --- a/engines/startrek/awaymission.h +++ b/engines/startrek/awaymission.h @@ -61,9 +61,23 @@ struct AwayMission { bool askedPrelateAboutSightings; // 0x36 byte field37; // 0x37 bool mccoyMentionedFlora; // 0x38 + byte numBouldersGone; // 0x39 byte enteredFrom; // 0x3a - + bool field3c; // 0x3c + bool curedBrother; // 0x3d + bool knowAboutHypoDytoxin; // 0x3f + byte field41; // 0x41 + bool foundMiner; // 0x43 + bool field45; // 0x45 bool warpsDisabled; // 0x48 + bool boulder1Gone; // 0x49 + bool boulder2Gone; // 0x4a + bool boulder3Gone; // 0x4b + bool boulder4Gone; // 0x4c + bool doorRevealed; // 0x4d + bool gotBerries; // 0x50 + bool madeHypoDytoxin; // 0x51 + byte field56; // 0x56 } demon; }; diff --git a/engines/startrek/bitmap.h b/engines/startrek/bitmap.h index fcebd67aa0..b4c7a87115 100644 --- a/engines/startrek/bitmap.h +++ b/engines/startrek/bitmap.h @@ -9,10 +9,10 @@ namespace StarTrek { struct Bitmap { - uint16 xoffset; - uint16 yoffset; - uint16 width; - uint16 height; + int16 xoffset; + int16 yoffset; + int16 width; + int16 height; byte *pixels; Bitmap(Common::SharedPtr<FileStream> stream); diff --git a/engines/startrek/graphics.cpp b/engines/startrek/graphics.cpp index 2e289514f0..a5b2b7bc71 100644 --- a/engines/startrek/graphics.cpp +++ b/engines/startrek/graphics.cpp @@ -493,6 +493,8 @@ void Graphics::drawAllSprites(bool updateScreen) { // Redraw the background on every dirty rectangle for (int i = 0; i < numDirtyRects; i++) { Common::Rect &r = dirtyRects[i]; + if (r.width() == 0 || r.height() == 0) + continue; int offset = r.top * SCREEN_WIDTH + r.left; _vm->_system->copyRectToScreen(_backgroundImage->pixels+offset, SCREEN_WIDTH, r.left, r.top, r.width(), r.height()); diff --git a/engines/startrek/module.mk b/engines/startrek/module.mk index 94c2c8c661..a374f80a7c 100644 --- a/engines/startrek/module.mk +++ b/engines/startrek/module.mk @@ -19,7 +19,9 @@ MODULE_OBJS = \ startrek.o \ text.o \ rooms/demon0.o \ - rooms/demon1.o + rooms/demon1.o \ + rooms/demon2.o \ + rooms/demon3.o diff --git a/engines/startrek/room.cpp b/engines/startrek/room.cpp index f6e94f7338..1de12153f1 100644 --- a/engines/startrek/room.cpp +++ b/engines/startrek/room.cpp @@ -21,6 +21,7 @@ */ #include "startrek/filestream.h" +#include "startrek/iwfile.h" #include "startrek/room.h" #include "startrek/startrek.h" @@ -44,6 +45,14 @@ Room::Room(StarTrekEngine *vm, const Common::String &name) : _vm(vm) { _roomActionList = demon1ActionList; _numRoomActions = sizeof(demon1ActionList) / sizeof(RoomAction); } + else if (name == "DEMON2") { + _roomActionList = demon2ActionList; + _numRoomActions = sizeof(demon2ActionList) / sizeof(RoomAction); + } + else if (name == "DEMON3") { + _roomActionList = demon3ActionList; + _numRoomActions = sizeof(demon3ActionList) / sizeof(RoomAction); + } else { warning("Room \"%s\" unimplemented", name.c_str()); _numRoomActions = 0; @@ -199,7 +208,7 @@ void Room::loadRoomIndex(int roomIndex, int spawnIndex) { } void Room::walkCrewman(int actorIndex, int16 destX, int16 destY, uint16 finishedAnimActionParam) { - if (!(actorIndex >= OBJECT_KIRK && actorIndex < OBJECT_REDSHIRT)) + if (!(actorIndex >= OBJECT_KIRK && actorIndex <= OBJECT_REDSHIRT)) error("Tried to walk a non PC"); Actor *actor = &_vm->_actorList[actorIndex]; @@ -212,6 +221,21 @@ void Room::walkCrewman(int actorIndex, int16 destX, int16 destY, uint16 finished } } +/** + * Loads a pair of .map and .iw files to change the room's collisions and pathfinding. + */ +void Room::loadMapFile(const Common::String &name) { + _vm->_mapFilename = name; + _vm->_iwFile.reset(); + _vm->_mapFile.reset(); + _vm->_iwFile = SharedPtr<IWFile>(new IWFile(_vm, name + ".iw")); + _vm->_mapFile = _vm->loadFile(name + ".map"); +} + +Common::Point Room::getActorPos(int actorIndex) { + return _vm->_actorList[actorIndex].pos; +} + void Room::playSoundEffectIndex(int soundEffect) { _vm->playSoundEffectIndex(soundEffect); } diff --git a/engines/startrek/room.h b/engines/startrek/room.h index c7392449e5..785be2717e 100644 --- a/engines/startrek/room.h +++ b/engines/startrek/room.h @@ -49,6 +49,11 @@ const int RDF_WARP_ROOM_INDICES = 0x22; const int RDF_ROOM_ENTRY_POSITIONS = 0x2a; const int RDF_BEAM_IN_POSITIONS = 0xaa; +const char SPEAKER_KIRK[] = "Capt. Kirk"; +const char SPEAKER_SPOCK[] = "Mr. Spock"; +const char SPEAKER_MCCOY[] = "Dr. McCoy"; +const char SPEAKER_EVERTS[] = "Ensign Everts"; + class Room { public: @@ -101,6 +106,8 @@ private: void giveItem(int item); // Cmd 0x04 void loadRoomIndex(int roomIndex, int spawnIndex); // Cmd 0x06 void walkCrewman(int actorIndex, int16 destX, int16 destY, uint16 finishedAnimActionParam);// Cmd 0x08 + void loadMapFile(const Common::String &name); // Cmd 0x09 + Common::Point getActorPos(int actorIndex); // Cmd 0x0d void playSoundEffectIndex(int soundEffect); // Cmd 0x0f void playMidiMusicTracks(int startTrack, int loopTrack); // Cmd 0x10 void showGameOverMenu(); // Cmd 0x12 @@ -204,6 +211,68 @@ public: void demon1TalkToRedshirt(); void demon1TalkToUnconsciousCrewman(); + // DEMON2 + void demon2Tick1(); + void demon2WalkToCave(); + void demon2ReachedCave(); + void demon2TouchedWarp1(); + void demon2LookAtCave(); + void demon2LookAtMountain(); + void demon2LookAtBerries(); + void demon2LookAtFern(); + void demon2LookAtMoss(); + void demon2LookAtLights(); + void demon2LookAtAnything(); + void demon2LookAtKirk(); + void demon2LookAtSpock(); + void demon2LookAtMcCoy(); + void demon2LookAtRedshirt(); + void demon2TalkToKirk(); + void demon2TalkToSpock(); + void demon2TalkToMcCoy(); + void demon2TalkToRedshirt(); + void demon2UsePhaserOnBerries(); + void demon2UseSTricorderOnBerries(); + void demon2UseSTricorderOnMoss(); + void demon2UseSTricorderOnFern(); + void demon2UseSTricorderOnCave(); + void demon2UseMTricorderOnBerries(); + void demon2GetBerries(); + void demon2ReachedBerries(); + void demon2PickedUpBerries(); + + // DEMON3 + void demon3Tick1(); + void demon3Timer0Expired(); + void demon3Timer1Expired(); + void demon3Timer3Expired(); + void demon3FinishedAnimation1(); + void demon3FinishedAnimation2(); + void demon3FinishedWalking5(); + void demon3McCoyInFiringPosition(); + void demon3SpockInFiringPosition(); + void demon3RedShirtInFiringPosition(); + void demon3KirkInFiringPosition(); + void demon3CrewmanInFiringPosition(); + void demon3PullOutPhaserAndFireAtBoulder(); + void demon3FireAtBoulder(); + void demon3UsePhaserOnRedshirt(); + void demon3UseStunPhaserOnBoulder(); + void demon3UsePhaserOnBoulder1(); + void demon3UsePhaserOnBoulder2(); + void demon3UsePhaserOnBoulder3(); + void demon3UsePhaserOnBoulder4(); + void demon3BoulderCommon(); + void demon3UseSTricorderOnMiner(); + void demon3UseSTricorderOnPanel(); + void demon3UseSTricorderOnBoulder(); + void demon3UseMTricorderOnBoulder(); + void demon3UseCrewmanOnPanel(); + void demon3UseRedshirtOnPanel(); + void demon3RedshirtReachedPanel(); + void demon3RedshirtUsedPanel(); + void demon3RedshirtElectrocuted(); + private: // Room-specific variables. This is memset'ed to 0 when the room is initialized. union { @@ -213,6 +282,19 @@ private: bool kirkShooting; char d6[10]; } demon1; + + struct { + bool shootingBoulder; // 0xca + bool boulder1Shot; // 0xcb + byte boulderBeingShot; // 0xcc + bool kirkInPosition; // 0xcd + bool redshirtInPosition; // 0xce + bool spockInPosition; // 0xcf + bool mccoyInPosition; // 0xd0 + bool inFiringPosition; // 0xd1 + bool kirkPhaserOut; // 0xd3 + char boulderAnim[10]; // 0xd4 + } demon3; } _roomVar; }; diff --git a/engines/startrek/rooms/demon0.cpp b/engines/startrek/rooms/demon0.cpp index b9c01373be..529bf746d2 100644 --- a/engines/startrek/rooms/demon0.cpp +++ b/engines/startrek/rooms/demon0.cpp @@ -54,7 +54,7 @@ void Room::demon0Tick100() { void Room::demon0Tick140() { const char *text[] = { - "Dr. McCoy", + SPEAKER_MCCOY, "#DEM0\\DEM0_016#Captain, the flora on this planet is very interesting. I wonder how useful it may be for medicinal purposes.", "" }; @@ -114,7 +114,7 @@ void Room::demon0ReachedTopDoor() { void Room::demon0TalkToPrelate() { const char *options1[] = { - "Capt. Kirk", + SPEAKER_KIRK, "#DEM0\\DEM0_006#I'm Captain James T. Kirk of the U.S.S. Enterprise. We have received word that alien lifeforms are creating problems at your mining facilities at Idyll Mountain. Tell me more.", "#DEM0\\DEM0_008#Most High Prelate Angiven, I am honored to meet you. I consider it my divine duty to assist you in any possible way with the spawn of the devil.", "#DEM0\\DEM0_003#Been seeing ghosts and bogeymen eh? I find that a little hard to believe.", @@ -131,7 +131,7 @@ void Room::demon0TalkToPrelate() { "" }; const char *options2[] = { - "Capt. Kirk", + SPEAKER_KIRK, "#DEM0\\DEM0_002#Aside from seeing demons, has any hard data been collected? Any evidence I could see?", "#DEM0\\DEM0_005#Demons? Gates of Hell? This is the 23rd Century!", "" @@ -142,7 +142,7 @@ void Room::demon0TalkToPrelate() { "" }; const char *options3[] = { - "Capt. Kirk", + SPEAKER_KIRK, "#DEM0\\DEM0_010#What can you tell me about the mine itself?", "#DEM0\\DEM0_012#You're wasting the time of a starship capable of destroying this planet with campfire stories? No wonder you were dumped out here in the middle of nowhere.", "" @@ -215,7 +215,7 @@ void Room::demon0LookAtPrelate() { void Room::demon0UsePhaserOnSnow() { // BUG: doesn't check if redshirt is dead. const char *text[] = { - "Ensign Everts", + SPEAKER_EVERTS, "#DEM0\\DEM0_039#Aw, Captain, please don't melt the snow. I've never seen it before.", "" }; @@ -224,7 +224,7 @@ void Room::demon0UsePhaserOnSnow() { void Room::demon0UsePhaserOnSign() { const char *text[] = { - "Dr. McCoy", + SPEAKER_MCCOY, "#DEM0\\DEM0_017#Quite the vandal aren't we, Jim?", "" }; @@ -233,17 +233,17 @@ void Room::demon0UsePhaserOnSign() { void Room::demon0UsePhaserOnShelter() { const char *text1[] = { - "Dr. McCoy", + SPEAKER_MCCOY, "#DEM0\\DEM0_015#Burning down their house is not the best way to gain their confidence Jim!", "" }; const char *text2[] = { - "Mr. Spock", + SPEAKER_SPOCK, "#DEM0\\DEM0_013#Captain, Doctor McCoy is correct.", "" }; const char *text3[] = { - "Ensign Everts", + SPEAKER_EVERTS, "#DEM0\\DEM0_040#Is he always this trigger happy on ground missions?", "" }; @@ -255,7 +255,7 @@ void Room::demon0UsePhaserOnShelter() { void Room::demon0UsePhaserOnPrelate() { const char *text[] = { - "Dr. McCoy", + SPEAKER_MCCOY, "#DEM0\\DEM0_020#Jim! Are you out of your mind?", "" }; @@ -354,22 +354,22 @@ void Room::demon0LookAtShelter() { void Room::demon0TalkToKirk() { const char *text1[] = { - "Capt. Kirk", + SPEAKER_KIRK, "#DEM0\\DEM0_009#This planet's as beautiful as everyone says it is.", "" }; const char *text2[] = { - "Dr. McCoy", + SPEAKER_MCCOY, "#DEM0\\DEM0_027#The trees. The fresh air. The freezing cold...", "" }; const char *text3[] = { - "Capt. Kirk", + SPEAKER_KIRK, "#DEM0\\DEM0_004#C'mon Bones, the cold will improve your circulation.", "" }; const char *text4[] = { - "Dr. McCoy", + SPEAKER_MCCOY, "#DEM0\\DEM0_024#Some people get too much circulation!", "" }; @@ -382,32 +382,32 @@ void Room::demon0TalkToKirk() { void Room::demon0TalkToRedshirt() { const char *text1[] = { - "Ensign Everts", + SPEAKER_EVERTS, "#DEM0\\DEM0_043#I've never seen snow like this before. This is great!", "" }; const char *text2[] = { - "Dr. McCoy", + SPEAKER_MCCOY, "#DEM0\\DEM0_026#You mean you've never built a snowman, ensign?", "" }; const char *text3[] = { - "Ensign Everts", + SPEAKER_EVERTS, "#DEM0\\DEM0_042#I've never even thrown a snowball. Do you think anyone would mind?", "" }; const char *text4[] = { - "Dr. McCoy", + SPEAKER_MCCOY, "#DEM0\\DEM0_025#Well...", "" }; const char *text5[] = { - "Capt. Kirk", + SPEAKER_KIRK, "#DEM0\\DEM0_007#Later Ensign. We have work to do.", "" }; const char *text6[] = { - "Ensign Everts", + SPEAKER_EVERTS, "#DEM0\\DEM0_044#Of course, sir.", "" }; @@ -423,22 +423,22 @@ void Room::demon0TalkToRedshirt() { void Room::demon0TalkToMcCoy() { if (_vm->_awayMission.demon.talkedToPrelate) { const char *text1[] = { - "Capt. Kirk", + SPEAKER_KIRK, "#DEM0\\DEM0_011#You look rather cold, Bones.", "" }; const char *text2[] = { - "Dr. McCoy", + SPEAKER_MCCOY, "#DEM0\\DEM0_023#I'm not cold, I'm freezing! And that damn transporter just had to set me down in the middle of a snow drift!", "" }; const char *text3[] = { - "Mr. Spock", + SPEAKER_SPOCK, "#DEM0\\DEM0_029#A centimeter of snow does not technically constitute a drift, Doctor.", "" }; const char *text4[] = { - "Ensign Everts", + SPEAKER_EVERTS, "#DEM0\\DEM0_041#And doctors say that patients complain too much!", "" }; @@ -451,7 +451,7 @@ void Room::demon0TalkToMcCoy() { } else { const char *text1[] = { - "Dr. McCoy", + SPEAKER_MCCOY, "#DEM0\\DEM0_019#I don't know if the problem is real, the result of a new illness, or mass hysteria. But at the very least, there's an injured miner who needs my help.", "" }; @@ -465,7 +465,7 @@ void Room::demon0TalkToMcCoy() { void Room::demon0TalkToSpock() { const char *text1[] = { - "Mr. Spock", + SPEAKER_SPOCK, "#DEM0\\DEM0_014#Captain, demons and supernatural creatures are, almost by definition, illogical. Yet it is evident these people believe what they have seen. Barring illness or mass hysteria, I agree that a real problem seems to exist.", "" }; @@ -482,7 +482,7 @@ void Room::demon0TalkToSpock() { void Room::demon0AskPrelateAboutSightings() { const char *text2[] = { - "Capt. Kirk", + SPEAKER_KIRK, "#DEM0\\DEM0_001#Doctor, you need to investigate the possibility of disease, mental or physical, among these people, before we go chasing up the mountains. Prelate Angiven, may we see those who have encountered the demons?", "" }; @@ -503,7 +503,7 @@ void Room::demon0UseSTricorderAnywhere() { playSoundEffectIndex(0x04); const char *text[] = { - "Mr. Spock", + SPEAKER_SPOCK, "#DEM0\\DEM0_028#Captain, reading the rocks in this area, I find that this locality may have been disturbed in the distant past. Recent disturbances created by the colonists' construction and mining prevent me from discovering anything further.", "" }; @@ -516,7 +516,7 @@ void Room::demon0UseMTricorderAnywhere() { playSoundEffectIndex(0x04); const char *text[] = { - "Dr. McCoy", + SPEAKER_MCCOY, "#DEM0\\DEM0_021#Jim, I am not picking up any unusual life here, just native lifeforms and the settlers. The colonists are all human, except for the one Tellarite. If there are demons here, they don't register on my tricorder.", "" }; @@ -529,7 +529,7 @@ void Room::demon0UseMTricorderOnPrelate() { if (_vm->_awayMission.demon.talkedToPrelate) { const char *text[] = { - "Dr. McCoy", + SPEAKER_MCCOY, "#DEM0\\DEM0_018#His blood pressure's up a bit, but he believes he's telling the truth.", "" }; @@ -537,7 +537,7 @@ void Room::demon0UseMTricorderOnPrelate() { } else { const char *text[] = { - "Dr. McCoy", + SPEAKER_MCCOY, "#DEM0\\DEM0_022#The man's in perfect health.", "" }; diff --git a/engines/startrek/rooms/demon1.cpp b/engines/startrek/rooms/demon1.cpp index 7559dd7512..2830ff9279 100644 --- a/engines/startrek/rooms/demon1.cpp +++ b/engines/startrek/rooms/demon1.cpp @@ -216,7 +216,7 @@ void Room::demon1KirkShot() { void Room::demon1UsePhaserOnAnything() { const char *text[] = { - "Dr. McCoy", + SPEAKER_MCCOY, "#DEM1\\DEM1_011#The fire fight is over, Jim. I think you can put that away now.", "" }; @@ -270,7 +270,7 @@ void Room::demon1KlingonDropsHand() { return; const char *rshirtText[] = { - "Ensign Everts", + SPEAKER_EVERTS, "#DEM1\\DEM1_025#I guess they don't make Klingons like they used to, Sir.", "" }; @@ -367,7 +367,7 @@ void Room::demon1Timer5Expired() { "" }; const char *text2[] = { - "Capt. Kirk", + SPEAKER_KIRK, "#DEM1\\DEM1_003#We're fine. Did you register any Disruptor fire?", "" }; @@ -377,22 +377,22 @@ void Room::demon1Timer5Expired() { "" }; const char *text4[] = { - "Capt. Kirk", + SPEAKER_KIRK, "#DEM1\\DEM1_002#No just an idea, Kirk out.", "" }; const char *text5[] = { - "Mr. Spock", + SPEAKER_SPOCK, "#DEM1\\DEM1_020#Fascinating. I begin to suspect that we have stumbled upon something that the colonists would never have uncovered.", "" }; const char *text6[] = { - "Capt. Kirk", + SPEAKER_KIRK, "#DEM1\\DEM1_004#What is it, Spock?", "" }; const char *text7[] = { - "Mr. Spock", + SPEAKER_SPOCK, "#DEM1\\DEM1_021#I wish to gather further data before making a definite conclusion, Captain.", "" }; @@ -409,7 +409,7 @@ void Room::demon1Timer5Expired() { void Room::demon1UseMTricorderOnKlingon() { const char *text[] = { - "Dr. McCoy", + SPEAKER_MCCOY, "#DEM1\\DEM1_012#This is definitely not a real klingon Jim.", "" }; @@ -420,7 +420,7 @@ void Room::demon1UseMTricorderOnKlingon() { void Room::demon1UseSTricorderOnTulips() { const char *text[] = { - "Mr. Spock", + SPEAKER_SPOCK, "#DEM1\\DEM1_007#Khytellian tulips are a perennial flower that survive in almost any climate.", "" }; @@ -431,7 +431,7 @@ void Room::demon1UseSTricorderOnTulips() { void Room::demon1UseSTricorderOnPods() { const char *text[] = { - "Mr. Spock", + SPEAKER_SPOCK, "#DEM1\\DEM1_008#The Brandzite pod is similar to terran milkweed except that the silk pods are in bright iridecent colors.", "" }; @@ -442,7 +442,7 @@ void Room::demon1UseSTricorderOnPods() { void Room::demon1UseSTricorderOnCattails() { const char *text[] = { - "Mr. Spock", + SPEAKER_SPOCK, "#DEM1\\DEM1_005#Doctis Cattails are similar to their terran name sake except that they are known to cause hives if in contact with flesh for any amount of time.", "" }; @@ -453,7 +453,7 @@ void Room::demon1UseSTricorderOnCattails() { void Room::demon1UseSTricorderOnFerns() { const char *text[] = { - "Mr. Spock", + SPEAKER_SPOCK, "#DEM1\\DEM1_006#Gindorian ferns are regarded as an intergalactic weed, Captain.", "" }; @@ -464,7 +464,7 @@ void Room::demon1UseSTricorderOnFerns() { void Room::demon1UseSTricorderOnHand() { const char *text[] = { - "Mr. Spock", + SPEAKER_SPOCK, "#DEM1\\DEM1_017#This is a detached hand with some kind of circuitry in the palm, Captain.", "" }; @@ -480,7 +480,7 @@ void Room::demon1UseSTricorderOnKlingon1() { if (_roomVar.demon1.numKlingonsKilled == 3 && !_vm->_awayMission.demon.tookKlingonHand && _rdfData[0xcf] != 1) { const char *text[] = { - "Mr. Spock", + SPEAKER_SPOCK, "#DEM1\\DEM1_018#This is not a Klingon, Captain, not a real one. It is an organic construct -- an android-like robot. It looks like a Klingon, but the appearance is entirely superficial. There is something different about this particular construct. Come here, Captain, look at the hand.It seems to have been separated from the body. There is a wiring circuit in the middle of the palm.", "" }; @@ -489,7 +489,7 @@ void Room::demon1UseSTricorderOnKlingon1() { } else { const char *text[] = { - "Mr. Spock", + SPEAKER_SPOCK, "#DEM1\\DEM1_019#This is not a Klingon, Captain, not a real one. It is an organic construct -- an android-like robot. It looks like a Klingon, but the appearance is entirely superficial.", "" }; @@ -502,7 +502,7 @@ void Room::demon1UseSTricorderOnKlingon2Or3() { playSoundEffectIndex(0x04); const char *text[] = { - "Mr. Spock", + SPEAKER_SPOCK, "#DEM1\\DEM1_019#This is not a Klingon, Captain, not a real one. It is an organic construct -- an android-like robot. It looks like a Klingon, but the appearance is entirely superficial.", "" }; @@ -526,7 +526,7 @@ void Room::demon1UseMTricorderOnRedshirt() { void Room::demon1UseMTricorderOnCrewman() { const char *text[] = { - "Dr. McCoy", + SPEAKER_MCCOY, "#DEM1\\DEM1_009#He's only stunned. He'll be back up in a few seconds.", "" }; @@ -741,7 +741,7 @@ void Room::demon1LookAtRedshirt() { void Room::demon1TalkToKirk() { const char *text[] = { - "Capt. Kirk", + SPEAKER_KIRK, "#DEM1\\DEM1_001#We were caught flat footed there. I don't want any more surprises to catch us off guard.", "" }; @@ -756,22 +756,22 @@ void Room::demon1TalkToSpock() { demon1TalkToUnconsciousCrewman(); else { const char *text1[] = { - "Mr. Spock", + SPEAKER_SPOCK, "#DEM1\\DEM1_022#Captain, I detect a recent avalanche, approximately 6.2 kilometers away, that occurred within the last three days. The mountain may be quite dangerous.", "" }; const char *text2[] = { - "Dr. McCoy", + SPEAKER_MCCOY, "#DEM1\\DEM1_013#Demons, Klingons, avalanches... What's next, the Wicked Witch of the West?", "" }; const char *text3[] = { - "Mr. Spock", + SPEAKER_SPOCK, "#DEM1\\DEM1_024#That is not logical, doctor.", "" }; const char *text4[] = { - "Dr. McCoy", + SPEAKER_MCCOY, "#DEM1\\DEM1_014#It wasn't supposed to be logical, you green blooded Vulcan! Why does everything have to be so damned logical?", "" }; @@ -787,12 +787,12 @@ void Room::demon1TalkToMcCoy() { demon1TalkToUnconsciousCrewman(); else { const char *text1[] = { - "Dr. McCoy", + SPEAKER_MCCOY, "#DEM1\\DEM1_015#Well, we've seen Klingons. Now all we need is a few Romulans...", "" }; const char *text2[] = { - "Mr. Spock", + SPEAKER_SPOCK, "#DEM1\\DEM1_023#Control your thoughts, Doctor. There is a high probability that something here is using our own memories against us.", "" }; @@ -806,7 +806,7 @@ void Room::demon1TalkToRedshirt() { demon1TalkToUnconsciousCrewman(); else { const char *text[] = { - "Ensign Everts", + SPEAKER_EVERTS, "#DEM1\\DEM1_026#I guess this isn't such a great planet after all.", "" }; diff --git a/engines/startrek/rooms/demon2.cpp b/engines/startrek/rooms/demon2.cpp new file mode 100644 index 0000000000..7d2d0194a5 --- /dev/null +++ b/engines/startrek/rooms/demon2.cpp @@ -0,0 +1,342 @@ +/* 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::demon2Tick1() { + playVoc("DEM2LOOP"); +} + +void Room::demon2WalkToCave() { + walkCrewman(OBJECT_KIRK, 0x83, 0x5c, 2); +} + +void Room::demon2ReachedCave() { + loadRoomIndex(3, 1); +} + +void Room::demon2TouchedWarp1() { + _vm->_awayMission.demon.enteredFrom = 2; + _vm->_awayMission.rdfStillDoDefaultAction = true; +} + +void Room::demon2LookAtCave() { + const char *text[] = { + nullptr, + "#DEM2\\DEM2N009#Mine entrance.", + "" + }; + showRoomSpecificText(text); +} + +void Room::demon2LookAtMountain() { + const char *text[] = { + nullptr, + "#DEM2\\DEM2N007#Idyll Mountain.", + "" + }; + showRoomSpecificText(text); +} + +void Room::demon2LookAtBerries() { + const char *text[] = { + nullptr, + "#DEM2\\DEM2N012#Various types of berries grow amongst the bushes.", + "" + }; + showRoomSpecificText(text); +} + +void Room::demon2LookAtFern() { + const char *text[] = { + nullptr, + "#DEM2\\DEM2N005#A Gindorian fern.", + "" + }; + showRoomSpecificText(text); +} + +void Room::demon2LookAtMoss() { + const char *text[] = { + nullptr, + "#DEM2\\DEM2N010#Phequedian moss grows on the cave wall.", + "" + }; + showRoomSpecificText(text); +} + +void Room::demon2LookAtLights() { + const char *text[] = { + nullptr, + "#DEM2\\DEM2N006#Feeble lights illuminate the mine tunnel.", + "" + }; + showRoomSpecificText(text); +} + +void Room::demon2LookAtAnything() { + const char *text[] = { + nullptr, + "#DEM2\\DEM2N011#The mine entrance goes deep into Mount Idyll.", + "" + }; + showRoomSpecificText(text); +} + +void Room::demon2LookAtKirk() { + const char *text[] = { + nullptr, + "#DEM2\\DEM2N002#James T. Kirk. Always wondering what the next surprise will be.", + "" + }; + showRoomSpecificText(text); +} + +void Room::demon2LookAtSpock() { + const char *text[] = { + nullptr, + "#DEM2\\DEM2N004#Spock. Perhaps the most brilliant mind in Starfleet, pondering a most peculiar mystery.", + "" + }; + showRoomSpecificText(text); +} + +void Room::demon2LookAtMcCoy() { + const char *text[] = { + nullptr, + "#DEM2\\DEM2N003#Leonard McCoy. Hoping that the cave will be warmer than outside.", + "" + }; + showRoomSpecificText(text); +} + +void Room::demon2LookAtRedshirt() { + const char *text[] = { + nullptr, + "#DEM2\\DEM2N000#Ensign Everts. Keeping a sharp eye out for anything dangerous.", + "" + }; + showRoomSpecificText(text); +} + +void Room::demon2TalkToKirk() { + const char *text[] = { + SPEAKER_KIRK, + "#DEM2\\DEM2_001#The answer to this mystery lies ahead of us, gentlemen.", + "" + }; + showRoomSpecificText(text); +} + +void Room::demon2TalkToSpock() { + const char *text1[] = { + SPEAKER_SPOCK, + "#DEM2\\DEM2_018#Whoever was trying to stop us may not stop with those Klingons, Captain. I recommend extreme caution.", + "" + }; + const char *text2[] = { + SPEAKER_KIRK, + "#DEM2\\DEM2_003#The thought had occurred to me, Mr. Spock, but thank you for mentioning it.", + "" + }; + showRoomSpecificText(text1); + showRoomSpecificText(text2); +} + +void Room::demon2TalkToMcCoy() { + const char *text1[] = { + SPEAKER_MCCOY, + "#DEM2\\DEM2_015#Does your tricorder say the cave is warmer, Spock...", + "" + }; + const char *text2[] = { + SPEAKER_SPOCK, + "#DEM2\\DEM2_017#It is not logical for me to use my tricorder to determine the cave's temperature, doctor. I do not see what purpose it would serve.", + "" + }; + const char *text3[] = { + SPEAKER_MCCOY, + "#DEM2\\DEM2_016#Spock, everybody talks about the weather!", + "" + }; + showRoomSpecificText(text1); + showRoomSpecificText(text2); + showRoomSpecificText(text3); +} + +void Room::demon2TalkToRedshirt() { + const char *text1[] = { + SPEAKER_EVERTS, + "#DEM2\\DEM2_019#I'm sorry I let you down with those Klingons back there. I should have been paying more attention.", + "" + }; + const char *text2[] = { + SPEAKER_KIRK, + "#DEM2\\DEM2_002#Just don't make that mistake again, Ensign.", + "" + }; + const char *text3[] = { + SPEAKER_EVERTS, + "#DEM2\\DEM2_020#Those Klingons give me the willies. They always have. My sister was wounded by them in the Chozon ambush.", + "" + }; + const char *text4[] = { + SPEAKER_KIRK, + "#DEM2\\DEM2_004#We've all had our share of conflict with Klingons, Ensign. The Organians told me that one day Humans and Klingons will become good friends. I wonder if I'll ever live to see that day.", + "" + }; + showRoomSpecificText(text1); + showRoomSpecificText(text2); + showRoomSpecificText(text3); + showRoomSpecificText(text4); +} + +void Room::demon2UsePhaserOnBerries() { + const char *text[] = { + SPEAKER_MCCOY, + "#DEM2\\DEM2_011#Jim, you usually pick food and then cook it.", + "" + }; + showRoomSpecificText(text); +} + +void Room::demon2UseSTricorderOnBerries() { + loadActorAnim2(OBJECT_SPOCK, "sscane", -1, -1, 0); + playSoundEffectIndex(0x04); + + const char *text[] = { + SPEAKER_SPOCK, + "#DEM2\\DEM2_008#These seem to be Laraxian berries, Captain. They have several medicinal uses, but Dr. McCoy would know more.", + "" + }; + showRoomSpecificText(text); +} + +void Room::demon2UseSTricorderOnMoss() { + loadActorAnim2(OBJECT_SPOCK, "sscann", -1, -1, 0); + playSoundEffectIndex(0x04); + + const char *text[] = { + SPEAKER_SPOCK, + "#DEM2\\DEM2_007#The Phequedine moss extracts nourishment from hafnium, Captain.", + "" + }; + showRoomSpecificText(text); +} + +void Room::demon2UseSTricorderOnFern() { + loadActorAnim2(OBJECT_SPOCK, "sscann", -1, -1, 0); + playSoundEffectIndex(0x04); + + const char *text[] = { + SPEAKER_SPOCK, + "#DEM2\\DEM2_006#Gindorian ferns are regarded as an intergalactic weed, Captain.", + "" + }; + showRoomSpecificText(text); +} + +void Room::demon2UseSTricorderOnCave() { + loadActorAnim2(OBJECT_SPOCK, "sscann", -1, -1, 0); + playSoundEffectIndex(0x04); + + // NOTE: audio file for this is empty. + const char *text[] = { + SPEAKER_SPOCK, + "#DEM2\\DEM2_005#Captain, I'm having trouble getting reliable readings from inside the mountain. Unusual crystalline structures within the ore may be at fault, though I cannot say for certain.", + "" + }; + showRoomSpecificText(text); +} + +void Room::demon2UseMTricorderOnBerries() { + loadActorAnim2(OBJECT_MCCOY, "mscane", -1, -1, 0); + playSoundEffectIndex(0x04); + + if (_vm->_awayMission.demon.curedBrother) { + const char *text[] = { + SPEAKER_MCCOY, + "#DEM2\\DEM2_013#These are the Laraxian Berries we used to cure Brother Chub.", + "" + }; + showRoomSpecificText(text); + } + else if (_vm->_awayMission.demon.madeHypoDytoxin) { + const char *text[] = { + SPEAKER_MCCOY, + "#DEM2\\DEM2_009#Jim, these are Laraxian Berries that we used to make the Hypo-Dytoxin.", + "" + }; + showRoomSpecificText(text); + } + else if (_vm->_awayMission.demon.knowAboutHypoDytoxin) { + const char *text[] = { + SPEAKER_MCCOY, + "#DEM2\\DEM2_010#Jim, these are the berries we need to synthesize the Hypo-Dytoxin. We must get these to Brother Stephen quickly.", + "" + }; + showRoomSpecificText(text); + } + else { + const char *text[] = { + SPEAKER_MCCOY, + "#DEM2\\DEM2_012#These are Laraxian Berries. From what I remember, certain chemical compounds in the berry can be used to treat Nugaireyn infections.", + "" + }; + showRoomSpecificText(text); + } +} + +void Room::demon2GetBerries() { + if (_vm->_awayMission.demon.gotBerries) { + const char *text[] = { + SPEAKER_MCCOY, + "#DEM2\\DEM2_014#We don't need any more berries, Jim.", + "" + }; + showRoomSpecificText(text); + } + else { + walkCrewman(OBJECT_KIRK, 0xe8, 0x97, 1); + } +} + +void Room::demon2ReachedBerries() { + loadActorAnim2(OBJECT_KIRK, "kusehe", -1, -1, 1); + playVoc("PIKBERRY"); +} + +void Room::demon2PickedUpBerries() { + const char *text[] = { + nullptr, + "#DEM2\\DEM2N013#You have retrieved a sample of berries.", + "" + }; + showRoomSpecificText(text); + giveItem(OBJECT_IBERRY); + _vm->_awayMission.demon.gotBerries = true; + _vm->_awayMission.missionScore += 1; +} + +} diff --git a/engines/startrek/rooms/demon3.cpp b/engines/startrek/rooms/demon3.cpp new file mode 100644 index 0000000000..c7ad9ce86a --- /dev/null +++ b/engines/startrek/rooms/demon3.cpp @@ -0,0 +1,437 @@ +/* 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::demon3Tick1() { + playVoc("DEM3LOOP"); + loadActorAnim(8, "light", 0xab, 0x03, 0); + + _roomVar.demon3.boulder1Shot = true; + if (!_vm->_awayMission.demon.boulder1Gone) { + loadActorAnim(9, "bldr1", 0x26, 0, 0); + _roomVar.demon3.boulder1Shot = false; + } + if (!_vm->_awayMission.demon.boulder2Gone) { + loadActorAnim(10, "bldr2", 0x22, 0, 0); + } + if (!_vm->_awayMission.demon.boulder3Gone) { + loadActorAnim(11, "bldr3", 0x22, 0, 0); + } + if (!_vm->_awayMission.demon.boulder4Gone) { + loadActorAnim(12, "bldr4", 0x22, 0, 0); + } + + if (_vm->_awayMission.demon.doorRevealed) { + loadActorAnim(14, "door2", 0x82, 0x0c, 0); + } + else { + loadMapFile("demon3a"); + } + + if (!_vm->_awayMission.demon.field3c && _vm->_awayMission.demon.boulder4Gone) + loadActorAnim(13, "miner", 0xda, 0x6c, 0); + if (_vm->_awayMission.redshirtDead && !_vm->_awayMission.demon.field45) + loadActorAnim(OBJECT_REDSHIRT, "deadre", 0x46, 0xa0, 0); + + if (_vm->_awayMission.demon.field41 == 0) + _vm->_awayMission.demon.field41++; + + if (!_vm->_awayMission.demon.field56) { + _vm->_awayMission.demon.field56 = true; + playMidiMusicTracks(0, -1); + } +} + +// Boulder falling over +void Room::demon3Timer0Expired() { + _roomVar.demon3.boulder1Shot = true; + loadActorAnim2(9, "drbldr", 0x26, 0, 0); + _vm->_awayMission.timers[1] = 13; + _vm->_awayMission.demon.boulder1Gone = true; + _vm->_awayMission.demon.numBouldersGone++; + _vm->_awayMission.transitioningIntoRoom = true; + playMidiMusicTracks(2, -1); + playVoc("BOULDERK"); +} + +// Redshirt pushing Kirk away +void Room::demon3Timer1Expired() { + _roomVar.demon3.kirkPhaserOut = false; + loadActorAnim2(OBJECT_REDSHIRT, "redkil", 0x46, 0xa0, 0); + loadActorAnim2(OBJECT_KIRK, "redkil", 0x46, 0xa0, 1); +} + +void Room::demon3Timer3Expired() { + // TODO +} + +void Room::demon3FinishedAnimation1() { + loadActorAnim2(OBJECT_KIRK, "kstnds", 0xee, 0xa6, 0); + loadActorAnim2(OBJECT_REDSHIRT, "deadre", 0x46, 0xa0, 0); + loadActorStandAnim(OBJECT_SPOCK); + walkCrewman(OBJECT_MCCOY, 0x9c, 0xb2, 5); + _roomVar.demon3.inFiringPosition = false; + _vm->_awayMission.redshirtDead = true; +} + +void Room::demon3FinishedAnimation2() { + // TODO +} + +void Room::demon3FinishedWalking5() { + loadActorAnim2(OBJECT_MCCOY, "mscanw", -1, -1, 0); + playSoundEffectIndex(0x04); + + const char *text[] = { + SPEAKER_MCCOY, + "#DEM3\\DEM3_019#He's dead, Jim...", + "" + }; + showRoomSpecificText(text); + + _vm->_awayMission.transitioningIntoRoom = false; +} + +void Room::demon3McCoyInFiringPosition() { + loadActorAnim2(OBJECT_MCCOY, "mwaitn", 0xd6, 0xb8, 0); + _roomVar.demon3.mccoyInPosition = true; + demon3CrewmanInFiringPosition(); +} + +void Room::demon3SpockInFiringPosition() { + loadActorAnim2(OBJECT_SPOCK, "swaitn", 0xae, 0xb4, 0); + _roomVar.demon3.spockInPosition = true; + demon3CrewmanInFiringPosition(); +} + +void Room::demon3RedShirtInFiringPosition() { + loadActorAnim2(OBJECT_REDSHIRT, "rwaitn", 0x46, 0xa0, 0); + _roomVar.demon3.redshirtInPosition = true; + demon3CrewmanInFiringPosition(); +} + +void Room::demon3KirkInFiringPosition() { + loadActorAnim2(OBJECT_KIRK, "kwaitn", 0x79, 0xa0, 0); + _roomVar.demon3.kirkInPosition = true; + demon3CrewmanInFiringPosition(); +} + +void Room::demon3CrewmanInFiringPosition() { + if (_roomVar.demon3.kirkInPosition && _roomVar.demon3.spockInPosition && _roomVar.demon3.mccoyInPosition && (_vm->_awayMission.redshirtDead || _roomVar.demon3.redshirtInPosition)) + demon3PullOutPhaserAndFireAtBoulder(); +} + +void Room::demon3PullOutPhaserAndFireAtBoulder() { + if (_roomVar.demon3.kirkPhaserOut) + demon3FireAtBoulder(); + else { + loadActorAnim2(OBJECT_KIRK, "kfiren", -1, -1, 4); + _roomVar.demon3.kirkPhaserOut = true; + } +} + +void Room::demon3FireAtBoulder() { + _roomVar.demon3.kirkInPosition = false; + _roomVar.demon3.spockInPosition = false; + _roomVar.demon3.mccoyInPosition = false; + _roomVar.demon3.redshirtInPosition = false; + _roomVar.demon3.shootingBoulder = false; + + switch (_roomVar.demon3.boulderBeingShot) { + case 1: + loadActorAnim2(9, "sbldr1", 0x22, 0, 0); + break; + case 2: + loadActorAnim2(10, "sbldr2", 0x22, 0, 0); + break; + case 3: + loadActorAnim2(11, "sbldr3", 0x22, 0, 0); + break; + case 4: + loadActorAnim2(12, "sbldr4", 0x22, 0, 0); + break; + default: { + // This should never happen (in the original game, this would cause a stack + // misalignment? + const char *text[] = { + "wes", + "There is a boulder check error.", + "" + }; + showRoomSpecificText(text); + break; + } + } + + loadActorAnim(17, _roomVar.demon3.boulderAnim, 0, 0, 0); + playSoundEffectIndex(0x06); + if (!_roomVar.demon3.boulder1Shot) + _vm->_awayMission.timers[0] = 1; + _vm->_awayMission.transitioningIntoRoom = false; +} + +void Room::demon3UsePhaserOnRedshirt() { + if (!_vm->_awayMission.redshirtDead) + return; + const char *text[] = { + SPEAKER_MCCOY, + "#DEM3\\DEM3_013#He's already dead, Jim. Isn't that good enough for you?", + "" + }; + showRoomSpecificText(text); +} + +void Room::demon3UseStunPhaserOnBoulder() { + const char *text[] = { + SPEAKER_SPOCK, + "#DEM3\\DEM3_007#Captain, the stun setting would be very ineffective on these boulders.", + "" + }; + showRoomSpecificText(text); +} + +void Room::demon3UsePhaserOnBoulder1() { + if (_roomVar.demon3.shootingBoulder || _vm->_awayMission.demon.boulder1Gone) + return; + _vm->_awayMission.demon.boulder1Gone = true; + _vm->_awayMission.demon.numBouldersGone++; + _roomVar.demon3.boulderBeingShot = 1; + _roomVar.demon3.boulder1Shot = true; + strcpy(_roomVar.demon3.boulderAnim, "s0r3s2"); + demon3BoulderCommon(); +} + +void Room::demon3UsePhaserOnBoulder2() { + if (_roomVar.demon3.shootingBoulder || _vm->_awayMission.demon.boulder2Gone) + return; + _vm->_awayMission.demon.boulder2Gone = true; + _vm->_awayMission.demon.numBouldersGone++; + _roomVar.demon3.boulderBeingShot = 2; + strcpy(_roomVar.demon3.boulderAnim, "s0r3s3"); + demon3BoulderCommon(); +} + +void Room::demon3UsePhaserOnBoulder3() { + if (_vm->_awayMission.demon.boulder1Gone) { + if (_roomVar.demon3.shootingBoulder || _vm->_awayMission.demon.boulder3Gone) + return; + _vm->_awayMission.demon.boulder3Gone = true; + _vm->_awayMission.demon.numBouldersGone++; + _roomVar.demon3.boulderBeingShot = 3; + strcpy(_roomVar.demon3.boulderAnim, "s0r3s1"); + demon3BoulderCommon(); + } + else { + const char *text[] = { + SPEAKER_SPOCK, + "#DEM3\\DEM3_006#Captain, the structure is extremely unstable. I would not recommend disturbing the lower section before the upper sections have been cleared.", + "" + }; + showRoomSpecificText(text); + } +} + +void Room::demon3UsePhaserOnBoulder4() { + if (_vm->_awayMission.demon.boulder2Gone) { + if (_roomVar.demon3.shootingBoulder || _vm->_awayMission.demon.boulder4Gone) + return; + _vm->_awayMission.demon.boulder4Gone = true; + _vm->_awayMission.demon.numBouldersGone++; + _roomVar.demon3.boulderBeingShot = 4; + strcpy(_roomVar.demon3.boulderAnim, "s0r3s4"); + _vm->_awayMission.demon.foundMiner = true; + demon3BoulderCommon(); + } + else { + // BUG: Spock doesn't speak, even though an audio file exists + const char *text[] = { + SPEAKER_SPOCK, + "Captain, the structure is extremely unstable. I would not recommend disturbing the lower section before the upper sections have been cleared.", + "" + }; + showRoomSpecificText(text); + } +} + +void Room::demon3BoulderCommon() { + _vm->_awayMission.transitioningIntoRoom = true; + Common::Point pos = getActorPos(13); + /* FIXME + if (!(pos.x == 0x79 && pos.y == 0xa0)) { + _roomVar.demon3.inFiringPosition = false; + _roomVar.demon3.kirkPhaserOut = false; + } + */ + + if (_roomVar.demon3.inFiringPosition) { + demon3PullOutPhaserAndFireAtBoulder(); + } + else { + const char *text[] = { + SPEAKER_KIRK, + "#DEM3\\DEM3_001#Assume firing positions.", + "" + }; + showRoomSpecificText(text); + + walkCrewman(OBJECT_KIRK, 0x79, 0xa0, 1); + walkCrewman(OBJECT_SPOCK, 0xae, 0xb4, 2); + walkCrewman(OBJECT_MCCOY, 0xd6, 0xb8, 3); + if (!_vm->_awayMission.redshirtDead) + walkCrewman(OBJECT_REDSHIRT, 0x46, 0xa0, 4); + + _roomVar.demon3.shootingBoulder = true; + _roomVar.demon3.inFiringPosition = true; + } +} + +void Room::demon3UseSTricorderOnMiner() { + loadActorAnim2(OBJECT_SPOCK, "sscann", -1, -1, 0); + playSoundEffectIndex(0x04); + const char *text[] = { + SPEAKER_SPOCK, + "#DEM3\\DEM3_008#I think Doctor McCoy would be better suited to deal with this.", + "" + }; + showRoomSpecificText(text); +} + +void Room::demon3UseSTricorderOnPanel() { + loadActorAnim2(OBJECT_SPOCK, "sscann", -1, -1, 0); + playSoundEffectIndex(0x04); + const char *text[] = { + SPEAKER_SPOCK, + "#DEM3\\DEM3_009#It appears to be a security lock designed to open the door when the correct hand print is registered.", + "" + }; + showRoomSpecificText(text); +} + +void Room::demon3UseSTricorderOnBoulder() { + if (_vm->_awayMission.demon.foundMiner) + return; + loadActorAnim2(OBJECT_SPOCK, "sscann", -1, -1, 0); + playSoundEffectIndex(0x04); + const char *text[] = { + SPEAKER_SPOCK, + "#DEM3\\DEM3_010#Captain, there are several weak points in the cave-in's structure. Careful use of our phasers, from the top down, should be able to clear it.", + "" + }; + showRoomSpecificText(text); +} + +void Room::demon3UseMTricorderOnBoulder() { + if (_vm->_awayMission.demon.foundMiner) + return; + loadActorAnim2(OBJECT_MCCOY, "mscann", -1, -1, 0); + playSoundEffectIndex(0x04); + const char *text[] = { + SPEAKER_MCCOY, + "#DEM3\\DEM3_020#I'm picking up weak vital signs. If we don't dig him out soon, we're going to lose him!", + "" + }; + showRoomSpecificText(text); +} + +void Room::demon3UseCrewmanOnPanel() { + if (_vm->_awayMission.demon.numBouldersGone != 4 || _vm->_awayMission.redshirtDead) + return; + const char *text[] = { + SPEAKER_EVERTS, + "#DEM3\\DEM3_031#Sir, it may be dangerous. Let me try it.", + "" + }; + showRoomSpecificText(text); + demon3UseRedshirtOnPanel(); +} + +void Room::demon3UseRedshirtOnPanel() { + if (_vm->_awayMission.redshirtDead) + return; + if (_vm->_awayMission.demon.numBouldersGone != 4) { + const char *text[] = { + SPEAKER_EVERTS, + "#DEM3\\DEM3_030#Sir, I think we should clear the rest of the rocks before we check out the device.", + "" + }; + showRoomSpecificText(text); + } + else { + walkCrewman(OBJECT_REDSHIRT, 0xd8, 0x70, 8); + } +} + +void Room::demon3RedshirtReachedPanel() { + loadActorAnim2(OBJECT_REDSHIRT, "rusehn", -1, -1, 5); +} + +void Room::demon3RedshirtUsedPanel() { + if (!_vm->_awayMission.demon.foundMiner) + return; + + _vm->_awayMission.demon.field41++; + if (_vm->_awayMission.demon.field41 == 5) { + playVoc("EFX3"); + const char *text[] = { + SPEAKER_EVERTS, + "#DEM3\\DEM3_A32#Aieeee!", + "" + }; + showRoomSpecificText(text); + + loadActorAnim2(OBJECT_REDSHIRT, "rkille", -1, -1, 3); + playSoundEffectIndex(0x06); + _vm->_awayMission.redshirtDead = true; + _vm->_awayMission.demon.field45 = true; + } + else { + const char *textTable[] = { + "#DEM3\\DEM3N005#Nothing happens.", + "#DEM3\\DEM3_033#I think I was shocked, sir.", + "#DEM3\\DEM3_035#That was definitely a mild shock.", + "#DEM3\\DEM3_034#Ouch, that hurt.", + }; + + const char *text[] = { + "SPEAKER_EVERTS", + nullptr, + "" + }; + text[1] = textTable[_vm->_awayMission.demon.field41 - 1]; + showRoomSpecificText(text); + walkCrewman(OBJECT_REDSHIRT, 0xbe, 0x9b, 0); + } +} + +void Room::demon3RedshirtElectrocuted() { + const char *text[] = { + SPEAKER_MCCOY, + "#DEM3\\DEM3_018#He's dead Jim.", + "" + }; + showRoomSpecificText(text); +} + +} diff --git a/engines/startrek/rooms/function_map.h b/engines/startrek/rooms/function_map.h index 0743b794ff..274dea7c89 100644 --- a/engines/startrek/rooms/function_map.h +++ b/engines/startrek/rooms/function_map.h @@ -170,6 +170,98 @@ RoomAction demon1ActionList[] = { { Action(ACTION_TALK, OBJECT_REDSHIRT, 0, 0), &Room::demon1TalkToRedshirt }, }; +RoomAction demon2ActionList[] = { + { Action(ACTION_TICK, 1, 0, 0), &Room::demon2Tick1 }, + { Action(ACTION_WALK, 0x27, 0, 0), &Room::demon2WalkToCave }, + { Action(ACTION_FINISHED_WALKING, 2, 0, 0), &Room::demon2ReachedCave }, + { Action(ACTION_TOUCHED_WARP, 1, 0, 0), &Room::demon2TouchedWarp1 }, + + { Action(ACTION_LOOK, 0x27, 0, 0), &Room::demon2LookAtCave }, + { Action(ACTION_LOOK, 0x20, 0, 0), &Room::demon2LookAtCave }, + { Action(ACTION_LOOK, 0x21, 0, 0), &Room::demon2LookAtMountain }, + { Action(ACTION_LOOK, 0x22, 0, 0), &Room::demon2LookAtMountain }, + { Action(ACTION_LOOK, 0x23, 0, 0), &Room::demon2LookAtBerries }, + { Action(ACTION_LOOK, 0x24, 0, 0), &Room::demon2LookAtFern }, + { Action(ACTION_LOOK, 0x25, 0, 0), &Room::demon2LookAtMoss }, + { Action(ACTION_LOOK, 0x26, 0, 0), &Room::demon2LookAtLights }, + { Action(ACTION_LOOK, -1, 0, 0), &Room::demon2LookAtAnything }, + + { Action(ACTION_LOOK, OBJECT_KIRK, 0, 0), &Room::demon2LookAtKirk }, + { Action(ACTION_LOOK, OBJECT_SPOCK, 0, 0), &Room::demon2LookAtSpock }, + { Action(ACTION_LOOK, OBJECT_MCCOY, 0, 0), &Room::demon2LookAtMcCoy }, + { Action(ACTION_LOOK, OBJECT_REDSHIRT, 0, 0), &Room::demon2LookAtRedshirt }, + + { Action(ACTION_TALK, OBJECT_KIRK, 0, 0), &Room::demon2TalkToKirk }, + { Action(ACTION_TALK, OBJECT_SPOCK, 0, 0), &Room::demon2TalkToSpock }, + { Action(ACTION_TALK, OBJECT_MCCOY, 0, 0), &Room::demon2TalkToMcCoy }, + { Action(ACTION_TALK, OBJECT_REDSHIRT, 0, 0), &Room::demon2TalkToRedshirt }, + + { Action(ACTION_USE, OBJECT_IPHASERK, 0x23, 0), &Room::demon2UsePhaserOnBerries }, + { Action(ACTION_USE, OBJECT_IPHASERS, 0x23, 0), &Room::demon2UsePhaserOnBerries }, + + { Action(ACTION_USE, OBJECT_ISTRICOR, 0x23, 0), &Room::demon2UseSTricorderOnBerries }, + { Action(ACTION_USE, OBJECT_ISTRICOR, 0x25, 0), &Room::demon2UseSTricorderOnMoss }, + { Action(ACTION_USE, OBJECT_ISTRICOR, 0x24, 0), &Room::demon2UseSTricorderOnFern }, + { Action(ACTION_USE, OBJECT_ISTRICOR, 0x20, 0), &Room::demon2UseSTricorderOnCave }, + { Action(ACTION_USE, OBJECT_ISTRICOR, 0x21, 0), &Room::demon2UseSTricorderOnCave }, + { Action(ACTION_USE, OBJECT_ISTRICOR, 0x22, 0), &Room::demon2UseSTricorderOnCave }, + + { Action(ACTION_USE, OBJECT_IMTRICOR, 0x23, 0), &Room::demon2UseMTricorderOnBerries }, + { Action(ACTION_GET, 0x23, 0, 0), &Room::demon2GetBerries }, + { Action(ACTION_FINISHED_WALKING, 1, 0, 0), &Room::demon2ReachedBerries }, + { Action(ACTION_FINISHED_ANIMATION, 1, 0, 0), &Room::demon2PickedUpBerries }, +}; + +RoomAction demon3ActionList[] = { + { Action(ACTION_TICK, 1, 0, 0), &Room::demon3Tick1 }, + { Action(ACTION_TIMER_EXPIRED, 0, 0, 0), &Room::demon3Timer0Expired }, + { Action(ACTION_TIMER_EXPIRED, 1, 0, 0), &Room::demon3Timer1Expired }, + { Action(ACTION_TIMER_EXPIRED, 3, 0, 0), &Room::demon3Timer3Expired }, + + { Action(ACTION_FINISHED_ANIMATION, 1, 0, 0), &Room::demon3FinishedAnimation1 }, + { Action(ACTION_FINISHED_ANIMATION, 2, 0, 0), &Room::demon3FinishedAnimation2 }, + { Action(ACTION_FINISHED_WALKING, 5, 0, 0), &Room::demon3FinishedWalking5 }, + + { Action(ACTION_FINISHED_WALKING, 3, 0, 0), &Room::demon3McCoyInFiringPosition }, + { Action(ACTION_FINISHED_WALKING, 2, 0, 0), &Room::demon3SpockInFiringPosition }, + { Action(ACTION_FINISHED_WALKING, 4, 0, 0), &Room::demon3RedShirtInFiringPosition }, + { Action(ACTION_FINISHED_WALKING, 1, 0, 0), &Room::demon3KirkInFiringPosition }, + + { Action(ACTION_FINISHED_ANIMATION, 4, 0, 0), &Room::demon3FireAtBoulder }, + + { Action(ACTION_USE, OBJECT_IPHASERS, OBJECT_REDSHIRT, 0), &Room::demon3UsePhaserOnRedshirt }, + { Action(ACTION_USE, OBJECT_IPHASERK, OBJECT_REDSHIRT, 0), &Room::demon3UsePhaserOnRedshirt }, + + { Action(ACTION_USE, OBJECT_IPHASERS, 9, 0), &Room::demon3UseStunPhaserOnBoulder }, + { Action(ACTION_USE, OBJECT_IPHASERS, 10, 0), &Room::demon3UseStunPhaserOnBoulder }, + { Action(ACTION_USE, OBJECT_IPHASERS, 11, 0), &Room::demon3UseStunPhaserOnBoulder }, + { Action(ACTION_USE, OBJECT_IPHASERS, 12, 0), &Room::demon3UseStunPhaserOnBoulder }, + + { Action(ACTION_USE, OBJECT_IPHASERK, 9, 0), &Room::demon3UsePhaserOnBoulder1 }, + { Action(ACTION_USE, OBJECT_IPHASERK, 10, 0), &Room::demon3UsePhaserOnBoulder2 }, + { Action(ACTION_USE, OBJECT_IPHASERK, 11, 0), &Room::demon3UsePhaserOnBoulder3 }, + { Action(ACTION_USE, OBJECT_IPHASERK, 12, 0), &Room::demon3UsePhaserOnBoulder4 }, + + { Action(ACTION_USE, OBJECT_ISTRICOR, 13, 0), &Room::demon3UseSTricorderOnMiner }, + { Action(ACTION_USE, OBJECT_ISTRICOR, 0x20, 0), &Room::demon3UseSTricorderOnPanel }, + { Action(ACTION_USE, OBJECT_ISTRICOR, 9, 0), &Room::demon3UseSTricorderOnBoulder }, + { Action(ACTION_USE, OBJECT_ISTRICOR, 10, 0), &Room::demon3UseSTricorderOnBoulder }, + { Action(ACTION_USE, OBJECT_ISTRICOR, 11, 0), &Room::demon3UseSTricorderOnBoulder }, + { Action(ACTION_USE, OBJECT_ISTRICOR, 12, 0), &Room::demon3UseSTricorderOnBoulder }, + { Action(ACTION_USE, OBJECT_IMTRICOR, 9, 0), &Room::demon3UseMTricorderOnBoulder }, + { Action(ACTION_USE, OBJECT_IMTRICOR, 10, 0), &Room::demon3UseMTricorderOnBoulder }, + { Action(ACTION_USE, OBJECT_IMTRICOR, 11, 0), &Room::demon3UseMTricorderOnBoulder }, + { Action(ACTION_USE, OBJECT_IMTRICOR, 12, 0), &Room::demon3UseMTricorderOnBoulder }, + + { Action(ACTION_USE, OBJECT_KIRK, 0x20, 0), &Room::demon3UseCrewmanOnPanel }, + { Action(ACTION_USE, OBJECT_SPOCK, 0x20, 0), &Room::demon3UseCrewmanOnPanel }, + { Action(ACTION_USE, OBJECT_MCCOY, 0x20, 0), &Room::demon3UseCrewmanOnPanel }, + { Action(ACTION_USE, OBJECT_REDSHIRT, 0x20, 0), &Room::demon3UseRedshirtOnPanel }, + { Action(ACTION_FINISHED_WALKING, 8, 0, 0), &Room::demon3RedshirtReachedPanel }, + { Action(ACTION_FINISHED_ANIMATION, 5, 0, 0), &Room::demon3RedshirtUsedPanel }, + { Action(ACTION_FINISHED_ANIMATION, 3, 0, 0), &Room::demon3RedshirtElectrocuted }, +}; + } #endif diff --git a/engines/startrek/sound.cpp b/engines/startrek/sound.cpp index 553d011c25..128c968820 100644 --- a/engines/startrek/sound.cpp +++ b/engines/startrek/sound.cpp @@ -212,9 +212,11 @@ void Sound::playSpeech(const Common::String &basename) { error("Couldn't open '%s'", filename.c_str()); Audio::AudioStream *audioStream = Audio::makeVOCStream(readStream, Audio::FLAG_UNSIGNED, DisposeAfterUse::YES); - if (audioQueue == nullptr) - audioQueue = Audio::makeQueuingAudioStream(audioStream->getRate(), audioStream->isStereo()); - audioQueue->queueAudioStream(audioStream, DisposeAfterUse::YES); + if (audioStream != nullptr) { + if (audioQueue == nullptr) + audioQueue = Audio::makeQueuingAudioStream(audioStream->getRate(), audioStream->isStereo()); + audioQueue->queueAudioStream(audioStream, DisposeAfterUse::YES); + } name.erase(0,i+1); } @@ -222,9 +224,8 @@ void Sound::playSpeech(const Common::String &basename) { if (audioQueue != nullptr) { audioQueue->finish(); _vm->_system->getMixer()->playStream(Audio::Mixer::kSpeechSoundType, &_speechHandle, audioQueue); + _playingSpeech = true; } - - _playingSpeech = true; } /** diff --git a/engines/startrek/startrek.cpp b/engines/startrek/startrek.cpp index 35a6c9fdc8..96e74bf1b2 100644 --- a/engines/startrek/startrek.cpp +++ b/engines/startrek/startrek.cpp @@ -358,6 +358,7 @@ int StarTrekEngine::loadActorAnim(int actorIndex, const Common::String &animName if (actorIndex == -1) { // TODO + warning("loadActorAnim: actor == -1"); } else actor = &_actorList[actorIndex]; diff --git a/engines/startrek/startrek.h b/engines/startrek/startrek.h index f5715d5888..e37f4427c6 100644 --- a/engines/startrek/startrek.h +++ b/engines/startrek/startrek.h @@ -428,13 +428,13 @@ public: Graphics *_gfx; Sound *_sound; + SharedPtr<IWFile> _iwFile; private: Common::RandomSource _randomSource; Common::MacResManager *_macResFork; SharedPtr<Room> _room; - SharedPtr<IWFile> _iwFile; }; } // End of namespace StarTrek |