Permalink
Browse files

STARTREK: Demon6, including the special case menu

  • Loading branch information...
Drenn1 authored and sev- committed May 30, 2018
1 parent e5a97d9 commit 1290b7ea0298dc6a565e2593ecb703710d051830
@@ -79,7 +79,7 @@ void StarTrekEngine::loadRoom(const Common::String &missionName, int roomIndex)
_screenName = _missionName + (char)(_roomIndex + '0');

_gfx->setBackgroundImage(_gfx->loadBitmap(_screenName));
_gfx->loadPri(_screenName + ".pri");
_gfx->loadPri(_screenName);
_gfx->loadPalette("palette");
_gfx->copyBackgroundScreen();

@@ -54,16 +54,19 @@ struct AwayMission {
// Demon World
struct {
bool wasRudeToPrelate; // 0x29
bool insultedStephen; // 0x2b
bool beatKlingons; // 0x2f
bool tookKlingonHand; // 0x31

bool talkedToPrelate; // 0x33
bool stephenWelcomedToStudy; // 0x34
bool prelateWelcomedCrew; // 0x35
bool askedPrelateAboutSightings; // 0x36
byte field37; // 0x37
bool mccoyMentionedFlora; // 0x38
byte numBouldersGone; // 0x39
byte enteredFrom; // 0x3a
bool field3b; // 0x3b
bool repairedHand; // 0x3b
bool healedMiner; // 0x3c
bool curedChub; // 0x3d
bool field3e; // 0x3e
@@ -80,9 +83,11 @@ struct AwayMission {
bool boulder4Gone; // 0x4c
bool doorOpened; // 0x4d
bool field4e; // 0x4e
byte field4f; // 0x4f
byte itemsTakenFromCase; // 0x4f
bool gotBerries; // 0x50
bool madeHypoDytoxin; // 0x51
bool gavePointsForDytoxin; // 0x54
bool lookedAtComputer; // 0x55
byte field56; // 0x56
bool foundAlienRoom; // 0x57
} demon;
@@ -46,6 +46,7 @@ Graphics::Graphics(StarTrekEngine *vm) : _vm(vm), _egaMode(false) {
_font = new Font(_vm);

_numSprites = 0;
_pushedNumSprites = -1;

_palData = new byte[256 * 3];
_lutData = new byte[256 * 3];
@@ -160,7 +161,7 @@ void Graphics::decPaletteFadeLevel() {


void Graphics::loadPri(const Common::String &priFile) {
SharedPtr<FileStream> priStream = _vm->loadFile(priFile);
SharedPtr<FileStream> priStream = _vm->loadFile(priFile + ".pri");
priStream->read(_priData, SCREEN_WIDTH * SCREEN_HEIGHT / 2);
}

@@ -554,6 +555,15 @@ void Graphics::drawAllSprites(bool updateScreen) {
}
}

/**
* Sets "bitmapChanged" to true on all sprites before calling drawAllSprites.
*/
void Graphics::forceDrawAllSprites(bool updateScreen) {
for (int i = 0; i < _numSprites; i++)
_sprites[i]->bitmapChanged = true;
drawAllSprites(updateScreen);
}

/**
* Returns the sprite at the given position (ignores mouse).
*/
@@ -613,6 +623,24 @@ void Graphics::delSprite(Sprite *sprite) {
error("delSprite: sprite not in list");
}

void Graphics::pushSprites() {
if (_pushedNumSprites != -1)
error("Tried to push sprites more than once");
_pushedNumSprites = _numSprites;
memcpy(_pushedSprites, _sprites, sizeof(_sprites));

_numSprites = 0;
}

void Graphics::popSprites() {
if (_pushedNumSprites == -1)
error("Tried to pop sprites without a prior push");
_numSprites = _pushedNumSprites;
memcpy(_sprites, _pushedSprites, sizeof(_sprites));

_pushedNumSprites = -1;
}


void Graphics::copyBackgroundScreen() {
drawDirectToScreen(_backgroundImage);
@@ -76,11 +76,16 @@ class Graphics {
void drawSprite(const Sprite &sprite);
void drawSprite(const Sprite &sprite, const Common::Rect &rect);
void drawAllSprites(bool updateScreen=true);
void forceDrawAllSprites(bool updateScreen=true);
Sprite *getSpriteAt(int16 x, int16 y);
Sprite *getSpriteAt(Common::Point p) { return getSpriteAt(p.x, p.y); }

void addSprite(Sprite *sprite);
void delSprite(Sprite *sprite);

// Save/load the current state of sprites. Can only push once for now.
void pushSprites();
void popSprites();

void copyBackgroundScreen();
void drawDirectToScreen(SharedPtr<Bitmap> bitmap);
@@ -105,6 +110,10 @@ class Graphics {
Sprite *_sprites[MAX_SPRITES];
int _numSprites;

// Analagous to above, used when pushing/popping
Sprite *_pushedSprites[MAX_SPRITES];
int _pushedNumSprites;

// Any changes to the mouse image are buffered until the next time "drawAllSprites" is
// called (since the original game treats it like a sprite).
bool _mouseToBeShown;
@@ -23,7 +23,8 @@ MODULE_OBJS = \
rooms/demon2.o \
rooms/demon3.o \
rooms/demon4.o \
rooms/demon5.o
rooms/demon5.o \
rooms/demon6.o \



@@ -61,6 +61,10 @@ Room::Room(StarTrekEngine *vm, const Common::String &name) : _vm(vm) {
_roomActionList = demon5ActionList;
_numRoomActions = sizeof(demon5ActionList) / sizeof(RoomAction);
}
else if (name == "DEMON6") {
_roomActionList = demon6ActionList;
_numRoomActions = sizeof(demon6ActionList) / sizeof(RoomAction);
}
else {
warning("Room \"%s\" unimplemented", name.c_str());
_numRoomActions = 0;
@@ -107,6 +107,7 @@ class Room {
void loseItem(int item); // Cmd 0x07
void walkCrewman(int actorIndex, int16 destX, int16 destY, uint16 finishedAnimActionParam);// Cmd 0x08
void loadMapFile(const Common::String &name); // Cmd 0x09
// Command 0x0c: "demon6ShowCase"
Common::Point getActorPos(int actorIndex); // Cmd 0x0d
void playSoundEffectIndex(int soundEffect); // Cmd 0x0f
void playMidiMusicTracks(int startTrack, int loopTrack); // Cmd 0x10
@@ -370,6 +371,71 @@ class Room {
void demon5CheckCompletedStudy();
void demon5GetCrate();

// DEMON6
void demon6Tick1();
void demon6Tick30();
void demon6SpockReachedComputer();
void demon6WalkToDoor();
void demon6TouchedDoorOpenTrigger();
void demon6DoorOpenedOrReachedDoor();
void demon6UsePhaserOnStephen();
void demon6UsePhaserOnCase();
void demon6LookAtWorkspace();
void demon6LookAtCase();
void demon6LookAtTable();
void demon6LookAtMineral();
void demon6LookAtShells();
void demon6LookAtSkull();
void demon6LookAtMetal();
void demon6LookAtMeteor();
void demon6LookAtMountain();
void demon6LookAtSynthesizer();
void demon6LookAtKirk();
void demon6LookAtSpock();
void demon6LookAtMccoy();
void demon6LookAtRedshirt();
void demon6LookAtComputer();
void demon6LookAnywhere();
void demon6LookAtStephen();
void demon6TalkToMccoy();
void demon6TalkToSpock();
void demon6TalkToKirk();
void demon6TalkToRedshirt();
void demon6TalkToStephen();
void demon6UseBerryOnStephen();
void demon6UseBerryOnSynthesizer();
void demon6MccoyReachedSynthesizer();
void demon6FinishedMakingHypoDytoxin();
void demon6UseHandOnWorkspace();
void demon6SpockReachedWorkspace();
void demon6SpockFinishedRepairingHand();
void demon6UseAnythingOnWorkspace();
void demon6UseCrewmanOnCase();
void demon6UseKirkOnComputer();
void demon6UseMccoyOnComputer();
void demon6UseRedshirtOnComputer();
void demon6UseSpockOnComputer();
void demon6UseMineralOnStephen();
void demon6UseShellsOnStephen();
void demon6UseMeteorOnStephen();
void demon6UseSkullOnStephen();
void demon6UseMetalOnStephen();
void demon6ReturnItemToStephen(int item);
void demon6UseHandOnStephen();
void demon6UseMTricoderOnStephen();
void demon6UseSTricoderOnTable();
void demon6UseSTricoderOnComputer();
void demon6UseSTricoderOnMineral();
void demon6UseSTricoderOnShells();
void demon6UseSTricoderOnSkull();
void demon6UseSTricoderOnMetal();
void demon6UseSTricoderOnMeteor();
void demon6UseSTricoderOnCase();
void demon6UseSTricoderOnSynthesizer();
void demon6GetCase();
void demon6KirkReachedCase();
int demon6ShowCase(int visible);

private:
// Room-specific variables. This is memset'ed to 0 when the room is initialized.
union {
@@ -414,6 +480,14 @@ class Room {
bool movingToDoor; // 0xd5
} demon5;

struct {
bool insultedStephenRecently; // 0xca
bool stephenInRoom; // 0xcb
bool caseOpened; // 0xcd
byte doorCounter; // 0xce
bool movingToDoor; // 0xcf
} demon6;

} _roomVar;
};

@@ -43,6 +43,9 @@ void Room::demon0Tick60() {
}

void Room::demon0Tick100() {
if (_vm->_awayMission.demon.talkedToPrelate || _vm->_awayMission.demon.prelateWelcomedCrew)
return;
_vm->_awayMission.demon.prelateWelcomedCrew = true;
showText(TX_SPEAKER_ANGIVEN, TX_DEM0_036);
}

@@ -85,7 +85,7 @@ void Room::demon3Timer1Expired() {

// Door just opened
void Room::demon3Timer3Expired() {
if (_vm->_awayMission.demon.field3b) {
if (_vm->_awayMission.demon.repairedHand) {
showText(TX_DEM3N008);
loadActorAnim(14, "door", 0x82, 0xc, 0);
loadMapFile("demon3");
@@ -35,7 +35,7 @@ void Room::demon4Tick1() {
loadActorAnim(8, "stpout2", 0x107, 0x92, 0);
_roomVar.demon4.cb = true;

if ((_vm->_awayMission.demon.field4f & 0x10) && !_vm->_awayMission.demon.field47)
if ((_vm->_awayMission.demon.itemsTakenFromCase & 0x10) && !_vm->_awayMission.demon.field47)
_vm->_awayMission.timers[6] = 20;
}

@@ -62,12 +62,13 @@ void Room::demon5UseSTricorderOnCrate() {
showText(TX_SPEAKER_SPOCK, TX_DEM5_006);
}

// FIXME: should work when used on people as well, but doesn't
void Room::demon5UsePhaserOnAnything() {
showText(TX_SPEAKER_SPOCK, TX_DEM5_007);
}

void Room::demon5UseHandOnStephen() {
if (_vm->_awayMission.demon.field3b)
if (_vm->_awayMission.demon.repairedHand)
showText(TX_SPEAKER_STEPHEN, TX_DEM5_036);
else
showText(TX_SPEAKER_STEPHEN, TX_DEM5_039);
Oops, something went wrong.

0 comments on commit 1290b7e

Please sign in to comment.