Permalink
Browse files

STARTREK: Begin with Demon4

  • Loading branch information...
Drenn1 authored and sev- committed May 28, 2018
1 parent a6b87e8 commit 5b28ece2b5a4461cb0ef9c2fe24d73a35414a402
@@ -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;
@@ -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;
};

@@ -21,7 +21,8 @@ MODULE_OBJS = \
rooms/demon0.o \
rooms/demon1.o \
rooms/demon2.o \
rooms/demon3.o
rooms/demon3.o \
rooms/demon4.o



@@ -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) {
@@ -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;
};

@@ -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
}

}
@@ -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
Oops, something went wrong.

0 comments on commit 5b28ece

Please sign in to comment.