Permalink
Browse files

STARTREK: Demon2, half of Demon3 done

  • Loading branch information...
Drenn1 authored and sev- committed May 26, 2018
1 parent 45ae72b commit 9e314e19d98bfb952c5fb1eb216fa97d0e95179f
@@ -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;
};

@@ -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);
@@ -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());
@@ -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



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

Oops, something went wrong.

0 comments on commit 9e314e1

Please sign in to comment.