STARTREK: Reformat with artistic style

This commit is contained in:
Matthew Stewart 2018-07-23 22:53:10 -04:00 committed by Eugene Sandulenko
parent aa68655742
commit fe98dbb69d
52 changed files with 445 additions and 545 deletions

View file

@ -60,8 +60,12 @@ struct Action {
byte b3; byte b3;
// ACTION_USE, ACTION_GET, ACTION_LOOK, ACTION_TALK // ACTION_USE, ACTION_GET, ACTION_LOOK, ACTION_TALK
byte activeObject() const { return b1; } byte activeObject() const {
byte passiveObject() const { return b2; } return b1;
}
byte passiveObject() const {
return b2;
}
bool operator==(const Action &a) const { bool operator==(const Action &a) const {
return type == a.type && b1 == a.b1 && b2 == a.b2 && b3 == a.b3; return type == a.type && b1 == a.b1 && b2 == a.b2 && b3 == a.b3;

View file

@ -404,7 +404,7 @@ void StarTrekEngine::awayMissionUseObject(int16 clickedObject) {
tryWalkToHotspot = true; tryWalkToHotspot = true;
else if (_awayMission.activeObject == OBJECT_MCCOY && _room->actionHasCode(ACTION_USE, OBJECT_IMEDKIT, _awayMission.passiveObject, 0)) else if (_awayMission.activeObject == OBJECT_MCCOY && _room->actionHasCode(ACTION_USE, OBJECT_IMEDKIT, _awayMission.passiveObject, 0))
tryWalkToHotspot = true; tryWalkToHotspot = true;
else if (_awayMission.activeObject == OBJECT_SPOCK &&_room->actionHasCode(ACTION_USE, OBJECT_ISTRICOR, _awayMission.passiveObject, 0)) else if (_awayMission.activeObject == OBJECT_SPOCK && _room->actionHasCode(ACTION_USE, OBJECT_ISTRICOR, _awayMission.passiveObject, 0))
tryWalkToHotspot = true; tryWalkToHotspot = true;
if (!tryWalkToHotspot) { if (!tryWalkToHotspot) {
@ -694,7 +694,7 @@ void StarTrekEngine::checkTouchedLoadingZone(int16 x, int16 y) {
int16 offset = _room->getFirstDoorPolygonOffset(); int16 offset = _room->getFirstDoorPolygonOffset();
while (offset != _room->getDoorPolygonEndOffset()) { while (offset != _room->getDoorPolygonEndOffset()) {
if (isPointInPolygon((int16*)(_room->_rdfData + offset), x, y)) { if (isPointInPolygon((int16 *)(_room->_rdfData + offset), x, y)) {
uint16 var = _room->readRdfWord(offset); uint16 var = _room->readRdfWord(offset);
if (_activeDoorWarpHotspot != var) { if (_activeDoorWarpHotspot != var) {
_activeDoorWarpHotspot = var; _activeDoorWarpHotspot = var;
@ -712,7 +712,7 @@ void StarTrekEngine::checkTouchedLoadingZone(int16 x, int16 y) {
offset = _room->getFirstWarpPolygonOffset(); offset = _room->getFirstWarpPolygonOffset();
while (offset != _room->getWarpPolygonEndOffset()) { while (offset != _room->getWarpPolygonEndOffset()) {
if (isPointInPolygon((int16*)(_room->_rdfData + offset), x, y)) { if (isPointInPolygon((int16 *)(_room->_rdfData + offset), x, y)) {
uint16 var = _room->readRdfWord(offset); uint16 var = _room->readRdfWord(offset);
if (_activeWarpHotspot != var) { if (_activeWarpHotspot != var) {
_activeWarpHotspot = var; _activeWarpHotspot = var;

View file

@ -46,7 +46,7 @@ Bitmap::Bitmap(const Bitmap &bitmap) {
} }
Bitmap::Bitmap(int w, int h) : width(w), height(h), xoffset(0), yoffset(0) { Bitmap::Bitmap(int w, int h) : width(w), height(h), xoffset(0), yoffset(0) {
pixels = new byte[width*height]; pixels = new byte[width * height];
} }
Bitmap::~Bitmap() { Bitmap::~Bitmap() {

View file

@ -32,7 +32,7 @@ Common::Rect getRectEncompassing(Common::Rect r1, Common::Rect r2) {
uint16 r = max(r1.right, r2.right); uint16 r = max(r1.right, r2.right);
uint16 b = max(r1.bottom, r2.bottom); uint16 b = max(r1.bottom, r2.bottom);
return Common::Rect(l,t,r,b); return Common::Rect(l, t, r, b);
} }
void serializeRect(Common::Rect rect, Common::Serializer &ser) { void serializeRect(Common::Rect rect, Common::Serializer &ser) {

View file

@ -33,10 +33,14 @@ class Serializer;
namespace StarTrek { namespace StarTrek {
template<class T> template<class T>
T min(T a, T b) { return a < b ? a : b; } T min(T a, T b) {
return a < b ? a : b;
}
template<class T> template<class T>
T max(T a, T b) { return a > b ? a : b; } T max(T a, T b) {
return a > b ? a : b;
}
Common::Rect getRectEncompassing(Common::Rect r1, Common::Rect r2); Common::Rect getRectEncompassing(Common::Rect r1, Common::Rect r2);
void serializeRect(Common::Rect rect, Common::Serializer &ser); void serializeRect(Common::Rect rect, Common::Serializer &ser);

View file

@ -250,7 +250,7 @@ bool StarTrekMetaEngine::hasFeature(MetaEngineFeature f) const {
(f == kSavesSupportThumbnail) || (f == kSavesSupportThumbnail) ||
(f == kSavesSupportCreationDate) || (f == kSavesSupportCreationDate) ||
(f == kSavesSupportPlayTime) || (f == kSavesSupportPlayTime) ||
(f == kSimpleSavesNames); (f == kSimpleSavesNames);
} }
bool StarTrekMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const { bool StarTrekMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const {
@ -304,7 +304,9 @@ SaveStateList StarTrekMetaEngine::listSaves(const char *target) const {
} }
int StarTrekMetaEngine::getMaximumSaveSlot() const { return 999; } int StarTrekMetaEngine::getMaximumSaveSlot() const {
return 999;
}
void StarTrekMetaEngine::removeSaveState(const char *target, int slot) const { void StarTrekMetaEngine::removeSaveState(const char *target, int slot) const {
Common::String fileName = Common::String::format("%s.%03d", target, slot); Common::String fileName = Common::String::format("%s.%03d", target, slot);
@ -372,8 +374,8 @@ SaveStateDescriptor StarTrekMetaEngine::querySaveMetaInfos(const char *target, i
#if PLUGIN_ENABLED_DYNAMIC(STARTREK) #if PLUGIN_ENABLED_DYNAMIC(STARTREK)
REGISTER_PLUGIN_DYNAMIC(STARTREK, PLUGIN_TYPE_ENGINE, StarTrekMetaEngine); REGISTER_PLUGIN_DYNAMIC(STARTREK, PLUGIN_TYPE_ENGINE, StarTrekMetaEngine);
#else #else
REGISTER_PLUGIN_STATIC(STARTREK, PLUGIN_TYPE_ENGINE, StarTrekMetaEngine); REGISTER_PLUGIN_STATIC(STARTREK, PLUGIN_TYPE_ENGINE, StarTrekMetaEngine);
#endif #endif

View file

@ -161,7 +161,7 @@ bool StarTrekEngine::popNextEvent(TrekEvent *e, bool poll) {
void StarTrekEngine::addEventToQueue(const TrekEvent &e) { void StarTrekEngine::addEventToQueue(const TrekEvent &e) {
if (e.type == TREKEVENT_MOUSEMOVE && _mouseMoveEventInQueue) { if (e.type == TREKEVENT_MOUSEMOVE && _mouseMoveEventInQueue) {
// Only allow one mouse move event at once // Only allow one mouse move event at once
for (Common::List<TrekEvent>::iterator i = _eventQueue.begin(); i!=_eventQueue.end(); i++) { for (Common::List<TrekEvent>::iterator i = _eventQueue.begin(); i != _eventQueue.end(); i++) {
if (i->type == TREKEVENT_MOUSEMOVE) { if (i->type == TREKEVENT_MOUSEMOVE) {
*i = e; *i = e;
return; return;

View file

@ -18,7 +18,7 @@ FileStream::~FileStream() {
// ReadStream functions // ReadStream functions
uint32 FileStream::read(void* dataPtr, uint32 dataSize) { uint32 FileStream::read(void *dataPtr, uint32 dataSize) {
if (_pos + dataSize > (uint32)size()) if (_pos + dataSize > (uint32)size())
dataSize = size() - _pos; dataSize = size() - _pos;
memcpy(dataPtr, _data + _pos, dataSize); memcpy(dataPtr, _data + _pos, dataSize);

View file

@ -79,7 +79,7 @@ void Graphics::setBackgroundImage(SharedPtr<Bitmap> bitmap) {
void Graphics::drawBitmapToBackground(const Common::Rect &origRect, const Common::Rect &drawRect, SharedPtr<Bitmap> bitmap) { void Graphics::drawBitmapToBackground(const Common::Rect &origRect, const Common::Rect &drawRect, SharedPtr<Bitmap> bitmap) {
byte *dest = _backgroundImage->pixels + drawRect.top * SCREEN_WIDTH + drawRect.left; byte *dest = _backgroundImage->pixels + drawRect.top * SCREEN_WIDTH + drawRect.left;
byte *src = bitmap->pixels + (drawRect.left - origRect.left) byte *src = bitmap->pixels + (drawRect.left - origRect.left)
+ (drawRect.top - origRect.top) * bitmap->width; + (drawRect.top - origRect.top) * bitmap->width;
for (int y = drawRect.top; y < drawRect.bottom; y++) { for (int y = drawRect.top; y < drawRect.bottom; y++) {
for (int x = drawRect.left; x < drawRect.right; x++) { for (int x = drawRect.left; x < drawRect.right; x++) {
@ -298,19 +298,19 @@ void Graphics::drawSprite(const Sprite &sprite, ::Graphics::Surface *surface) {
// sprite's actual, full rectangle. // sprite's actual, full rectangle.
void Graphics::drawSprite(const Sprite &sprite, ::Graphics::Surface *surface, const Common::Rect &rect) { void Graphics::drawSprite(const Sprite &sprite, ::Graphics::Surface *surface, const Common::Rect &rect) {
Common::Rect spriteRect = Common::Rect(sprite.drawX, sprite.drawY, Common::Rect spriteRect = Common::Rect(sprite.drawX, sprite.drawY,
sprite.drawX + sprite.bitmap->width, sprite.drawY + sprite.bitmap->height); sprite.drawX + sprite.bitmap->width, sprite.drawY + sprite.bitmap->height);
assert(_screenRect.contains(rect)); assert(_screenRect.contains(rect));
assert(spriteRect.contains(rect)); assert(spriteRect.contains(rect));
byte *dest = (byte*)surface->getPixels() + rect.top*SCREEN_WIDTH + rect.left; byte *dest = (byte *)surface->getPixels() + rect.top * SCREEN_WIDTH + rect.left;
switch(sprite.drawMode) { switch (sprite.drawMode) {
case 0: { // Normal sprite case 0: { // Normal sprite
byte *src = sprite.bitmap->pixels + (rect.left - sprite.drawX) byte *src = sprite.bitmap->pixels + (rect.left - sprite.drawX)
+ (rect.top - sprite.drawY) * sprite.bitmap->width; + (rect.top - sprite.drawY) * sprite.bitmap->width;
int priOffset = rect.top*SCREEN_WIDTH + rect.left; int priOffset = rect.top * SCREEN_WIDTH + rect.left;
for (int y = rect.top; y < rect.bottom; y++) { for (int y = rect.top; y < rect.bottom; y++) {
for (int x = rect.left; x < rect.right; x++) { for (int x = rect.left; x < rect.right; x++) {
@ -342,7 +342,7 @@ void Graphics::drawSprite(const Sprite &sprite, ::Graphics::Surface *surface, co
case 2: { // Normal sprite with darkened background for "transparent" pixels (and no priority) case 2: { // Normal sprite with darkened background for "transparent" pixels (and no priority)
byte *src = sprite.bitmap->pixels + (rect.left - sprite.drawX) byte *src = sprite.bitmap->pixels + (rect.left - sprite.drawX)
+ (rect.top - sprite.drawY) * sprite.bitmap->width; + (rect.top - sprite.drawY) * sprite.bitmap->width;
for (int y = rect.top; y < rect.bottom; y++) { for (int y = rect.top; y < rect.bottom; y++) {
for (int x = rect.left; x < rect.right; x++) { for (int x = rect.left; x < rect.right; x++) {
@ -380,13 +380,13 @@ void Graphics::drawSprite(const Sprite &sprite, ::Graphics::Surface *surface, co
int drawWidth = rectangle1.width(); int drawWidth = rectangle1.width();
int drawHeight = rectangle1.height(); int drawHeight = rectangle1.height();
dest = (byte*)surface->getPixels() + sprite.drawY*SCREEN_WIDTH + sprite.drawX dest = (byte *)surface->getPixels() + sprite.drawY * SCREEN_WIDTH + sprite.drawX
+ rectangle1.top*8*SCREEN_WIDTH + rectangle1.left*8; + rectangle1.top * 8 * SCREEN_WIDTH + rectangle1.left * 8;
byte *src = sprite.bitmap->pixels + rectangle1.top * sprite.bitmap->width / 8 + rectangle1.left; byte *src = sprite.bitmap->pixels + rectangle1.top * sprite.bitmap->width / 8 + rectangle1.left;
for (int y=0; y < drawHeight; y++) { for (int y = 0; y < drawHeight; y++) {
for (int x=0; x < drawWidth; x++) { for (int x = 0; x < drawWidth; x++) {
byte c = *src; byte c = *src;
int textColor; int textColor;
@ -456,7 +456,7 @@ void Graphics::drawAllSprites(bool updateScreen) {
Common::sort(_sprites, _sprites + _numSprites, &compareSpritesByLayer); Common::sort(_sprites, _sprites + _numSprites, &compareSpritesByLayer);
// Update sprite rectangles // Update sprite rectangles
for (int i=0; i<_numSprites; i++) { for (int i = 0; i < _numSprites; i++) {
Sprite *spr = _sprites[i]; Sprite *spr = _sprites[i];
Common::Rect rect; Common::Rect rect;
@ -483,15 +483,13 @@ void Graphics::drawAllSprites(bool updateScreen) {
spr->rectangle2 = getRectEncompassing(spr->drawRect, spr->lastDrawRect); spr->rectangle2 = getRectEncompassing(spr->drawRect, spr->lastDrawRect);
spr->rect2Valid = 1; spr->rect2Valid = 1;
} }
} } else {
else {
spr->rectangle2 = spr->drawRect; spr->rectangle2 = spr->drawRect;
spr->rect2Valid = 1; spr->rect2Valid = 1;
} }
spr->isOnScreen = 1; spr->isOnScreen = 1;
} } else { // Off-screen
else { // Off-screen
spr->rect2Valid = 0; spr->rect2Valid = 0;
spr->isOnScreen = 0; spr->isOnScreen = 0;
} }
@ -508,13 +506,11 @@ void Graphics::drawAllSprites(bool updateScreen) {
if (spr->isOnScreen) { if (spr->isOnScreen) {
if (spr->rect2Valid) { if (spr->rect2Valid) {
dirtyRects[numDirtyRects++] = spr->rectangle2; dirtyRects[numDirtyRects++] = spr->rectangle2;
} } else {
else {
dirtyRects[numDirtyRects++] = spr->drawRect; dirtyRects[numDirtyRects++] = spr->drawRect;
dirtyRects[numDirtyRects++] = spr->lastDrawRect; dirtyRects[numDirtyRects++] = spr->lastDrawRect;
} }
} } else {
else {
dirtyRects[numDirtyRects++] = spr->lastDrawRect; dirtyRects[numDirtyRects++] = spr->lastDrawRect;
} }
} }
@ -584,8 +580,7 @@ void Graphics::drawAllSprites(bool updateScreen) {
if (_mouseToBeShown) { if (_mouseToBeShown) {
CursorMan.showMouse(true); CursorMan.showMouse(true);
_mouseToBeShown = false; _mouseToBeShown = false;
} } else if (_mouseToBeHidden) {
else if (_mouseToBeHidden) {
CursorMan.showMouse(false); CursorMan.showMouse(false);
_mouseToBeHidden = false; _mouseToBeHidden = false;
} }
@ -650,7 +645,7 @@ void Graphics::addSprite(Sprite *sprite) {
} }
void Graphics::delSprite(Sprite *sprite) { void Graphics::delSprite(Sprite *sprite) {
for (int i=0; i<_numSprites; i++) { for (int i = 0; i < _numSprites; i++) {
if (sprite != _sprites[i]) if (sprite != _sprites[i])
continue; continue;

View file

@ -104,16 +104,18 @@ public:
void drawTextChar(::Graphics::Surface *surface, const Sprite &sprite, int x, int y, const Common::Rect &rect); void drawTextChar(::Graphics::Surface *surface, const Sprite &sprite, int x, int y, const Common::Rect &rect);
void drawSprite(const Sprite &sprite, ::Graphics::Surface *surface); void drawSprite(const Sprite &sprite, ::Graphics::Surface *surface);
void drawSprite(const Sprite &sprite, ::Graphics::Surface *surface, const Common::Rect &rect); void drawSprite(const Sprite &sprite, ::Graphics::Surface *surface, const Common::Rect &rect);
void drawAllSprites(bool updateScreen=true); void drawAllSprites(bool updateScreen = true);
/** /**
* Sets "bitmapChanged" to true on all sprites before calling drawAllSprites. * Sets "bitmapChanged" to true on all sprites before calling drawAllSprites.
*/ */
void forceDrawAllSprites(bool updateScreen=true); void forceDrawAllSprites(bool updateScreen = true);
/** /**
* Returns the sprite at the given position (ignores mouse). * Returns the sprite at the given position (ignores mouse).
*/ */
Sprite *getSpriteAt(int16 x, int16 y); Sprite *getSpriteAt(int16 x, int16 y);
Sprite *getSpriteAt(Common::Point p) { return getSpriteAt(p.x, p.y); } Sprite *getSpriteAt(Common::Point p) {
return getSpriteAt(p.x, p.y);
}
void addSprite(Sprite *sprite); void addSprite(Sprite *sprite);
void delSprite(Sprite *sprite); void delSprite(Sprite *sprite);

View file

@ -38,7 +38,9 @@ class IWFile {
public: public:
IWFile(StarTrekEngine *vm, const Common::String &filename); IWFile(StarTrekEngine *vm, const Common::String &filename);
int getNumEntries() { return _numEntries; } int getNumEntries() {
return _numEntries;
}
/** /**
* Returns the index of the nearest "key position" in the room that an object can walk to * Returns the index of the nearest "key position" in the room that an object can walk to
* (in a straight line) from a given position. * (in a straight line) from a given position.

View file

@ -32,24 +32,24 @@ Common::SeekableReadStream *decodeLZSS(Common::SeekableReadStream *indata, uint3
/* /*
class LzssReadStream : public Common::SeekableReadStream { class LzssReadStream : public Common::SeekableReadStream {
private: private:
uint8 *_outLzssBufData; uint8 *_outLzssBufData;
uint32 _size; uint32 _size;
uint32 _pos; uint32 _pos;
uint32 decodeLZSS(Common::ReadStream *in, uint8 lengthmask, uint8 lengthbits); uint32 decodeLZSS(Common::ReadStream *in, uint8 lengthmask, uint8 lengthbits);
public: public:
LzssReadStream(Common::ReadStream *indata, uint8 lengthmask, uint8 lengthbits); LzssReadStream(Common::ReadStream *indata, uint8 lengthmask, uint8 lengthbits);
~LzssReadStream(); ~LzssReadStream();
bool eos() const; bool eos() const;
uint32 read(void *buf, uint32 length); uint32 read(void *buf, uint32 length);
int32 pos() const { return _pos; } int32 pos() const { return _pos; }
int32 size() const { return _size; } int32 size() const { return _size; }
bool seek(int32 offset, int whence) { bool seek(int32 offset, int whence) {
// TODO // TODO
return false; return false;
} }
}; };
*/ */

View file

@ -62,7 +62,7 @@ void StarTrekEngine::chooseMousePositionFromSprites(Sprite *sprites, int numSpri
Common::Rect rect = sprites[containMouseSprite].getRect(); Common::Rect rect = sprites[containMouseSprite].getRect();
if (mousePos.x < rect.left || mousePos.x >= rect.right if (mousePos.x < rect.left || mousePos.x >= rect.right
|| mousePos.y < rect.top || mousePos.y >= rect.bottom) { || mousePos.y < rect.top || mousePos.y >= rect.bottom) {
mousePos.x = (rect.left + rect.right) / 2; mousePos.x = (rect.left + rect.right) / 2;
mousePos.y = (rect.top + rect.bottom) / 2; mousePos.y = (rect.top + rect.bottom) / 2;
} }
@ -80,14 +80,14 @@ void StarTrekEngine::chooseMousePositionFromSprites(Sprite *sprites, int numSpri
int vCenter = (rect.top + rect.bottom) / 2; int vCenter = (rect.top + rect.bottom) / 2;
// Choose which sprite is closest based on certain criteria? // Choose which sprite is closest based on certain criteria?
switch(mode) { switch (mode) {
case 0: // Choose topmost, leftmost sprite that's below the cursor case 0: // Choose topmost, leftmost sprite that's below the cursor
if (((vCenter == mousePos.y && hCenter > mousePos.x) || vCenter > mousePos.y) if (((vCenter == mousePos.y && hCenter > mousePos.x) || vCenter > mousePos.y)
&& (vCenter < mouseY1 || (vCenter == mouseY1 && hCenter < mouseX1))) { && (vCenter < mouseY1 || (vCenter == mouseY1 && hCenter < mouseX1))) {
mouseX1 = hCenter; mouseX1 = hCenter;
mouseY1 = vCenter; mouseY1 = vCenter;
} }
// fall through // fall through
case 4: // Choose topmost, leftmost sprite case 4: // Choose topmost, leftmost sprite
if (vCenter < mouseY2 || (vCenter == mouseY2 && hCenter < mouseX2)) { if (vCenter < mouseY2 || (vCenter == mouseY2 && hCenter < mouseX2)) {
@ -98,16 +98,16 @@ void StarTrekEngine::chooseMousePositionFromSprites(Sprite *sprites, int numSpri
case 1: // Choose bottommost, rightmost sprite that's above the cursor case 1: // Choose bottommost, rightmost sprite that's above the cursor
if (((vCenter == mousePos.y && hCenter < mousePos.x) || vCenter < mousePos.y) if (((vCenter == mousePos.y && hCenter < mousePos.x) || vCenter < mousePos.y)
&& (mouseY1 == 0x7fff || vCenter > mouseY1 && (mouseY1 == 0x7fff || vCenter > mouseY1
|| (vCenter == mouseY1 && hCenter > mouseX1))) { || (vCenter == mouseY1 && hCenter > mouseX1))) {
mouseX1 = hCenter; mouseX1 = hCenter;
mouseY1 = vCenter; mouseY1 = vCenter;
} }
// fall through // fall through
case 5: // Choose bottommost, rightmost sprite case 5: // Choose bottommost, rightmost sprite
if (mouseY2 == 0x7fff || vCenter > mouseY2 if (mouseY2 == 0x7fff || vCenter > mouseY2
|| (vCenter == mouseY2 && hCenter > mouseX2)) { || (vCenter == mouseY2 && hCenter > mouseX2)) {
mouseX2 = hCenter; mouseX2 = hCenter;
mouseY2 = vCenter; mouseY2 = vCenter;
} }
@ -116,12 +116,12 @@ void StarTrekEngine::chooseMousePositionFromSprites(Sprite *sprites, int numSpri
case 2: case 2:
// This seems broken... OR condition on first line has no affect on the logic... // This seems broken... OR condition on first line has no affect on the logic...
if ((vCenter < mousePos.y || (vCenter == mouseY1 && hCenter == mousePos.x)) if ((vCenter < mousePos.y || (vCenter == mouseY1 && hCenter == mousePos.x))
&& (mouseX1 == 0x7fff || vCenter >= mouseY1)) { && (mouseX1 == 0x7fff || vCenter >= mouseY1)) {
mouseX1 = hCenter; mouseX1 = hCenter;
mouseY1 = vCenter; mouseY1 = vCenter;
} }
if (mouseX2 == 0x7fff || vCenter > mouseY2 if (mouseX2 == 0x7fff || vCenter > mouseY2
|| (hCenter == mouseX2 && vCenter == mouseY2)) { || (hCenter == mouseX2 && vCenter == mouseY2)) {
mouseX2 = hCenter; mouseX2 = hCenter;
mouseY2 = vCenter; mouseY2 = vCenter;
} }
@ -130,12 +130,12 @@ void StarTrekEngine::chooseMousePositionFromSprites(Sprite *sprites, int numSpri
case 3: case 3:
// Similar to above... // Similar to above...
if ((vCenter > mousePos.y || (vCenter == mouseY1 && hCenter == mousePos.x)) if ((vCenter > mousePos.y || (vCenter == mouseY1 && hCenter == mousePos.x))
&& (mouseX1 == 0x7fff || vCenter <= mouseY1)) { && (mouseX1 == 0x7fff || vCenter <= mouseY1)) {
mouseX1 = hCenter; mouseX1 = hCenter;
mouseY1 = vCenter; mouseY1 = vCenter;
} }
if (mouseX2 == 0x7fff || vCenter < mouseY2 if (mouseX2 == 0x7fff || vCenter < mouseY2
|| (hCenter == mouseX2 && vCenter == mouseY2)) { || (hCenter == mouseX2 && vCenter == mouseY2)) {
mouseX2 = hCenter; mouseX2 = hCenter;
mouseY2 = vCenter; mouseY2 = vCenter;
} }
@ -221,7 +221,7 @@ void StarTrekEngine::showOptionsMenu(int x, int y) {
// Can't use OPTIONBUTTON constants since the button retvals differ from the button // Can't use OPTIONBUTTON constants since the button retvals differ from the button
// indices... // indices...
switch(event) { switch (event) {
case 0: // Save case 0: // Save
showSaveMenu(); showSaveMenu();
break; break;
@ -342,8 +342,7 @@ selectAndExit:
break; break;
case TREKEVENT_MOUSEMOVE: case TREKEVENT_MOUSEMOVE:
mousePosChanged: mousePosChanged: {
{
Common::Point mouse = _gfx->getMousePos(); Common::Point mouse = _gfx->getMousePos();
Common::Point relMouse(mouse.x - pos.x, mouse.y - pos.y); Common::Point relMouse(mouse.x - pos.x, mouse.y - pos.y);
@ -587,7 +586,7 @@ void StarTrekEngine::setVisibleMenuButtons(uint32 bits) {
void StarTrekEngine::disableMenuButtons(uint32 bits) { void StarTrekEngine::disableMenuButtons(uint32 bits) {
_activeMenu->disabledButtons |= bits; _activeMenu->disabledButtons |= bits;
if (_activeMenu->selectedButton != -1 if (_activeMenu->selectedButton != -1
&& (_activeMenu->disabledButtons & (1 << _activeMenu->selectedButton))) { && (_activeMenu->disabledButtons & (1 << _activeMenu->selectedButton))) {
Sprite *sprite = &_activeMenu->sprites[_activeMenu->selectedButton]; Sprite *sprite = &_activeMenu->sprites[_activeMenu->selectedButton];
drawMenuButtonOutline(sprite->bitmap, 0x00); drawMenuButtonOutline(sprite->bitmap, 0x00);
@ -606,13 +605,13 @@ int StarTrekEngine::handleMenuEvents(uint32 ticksUntilClickingEnabled, bool inTe
while (true) { while (true) {
TrekEvent event; TrekEvent event;
while (popNextEvent(&event)) { while (popNextEvent(&event)) {
switch(event.type) { switch (event.type) {
case TREKEVENT_TICK: { case TREKEVENT_TICK: {
Common::Point mousePos = _gfx->getMousePos(); Common::Point mousePos = _gfx->getMousePos();
int buttonIndex = getMenuButtonAt(_activeMenu->sprites, _activeMenu->numButtons, mousePos.x, mousePos.y); int buttonIndex = getMenuButtonAt(_activeMenu->sprites, _activeMenu->numButtons, mousePos.x, mousePos.y);
if (buttonIndex != -1) { if (buttonIndex != -1) {
if (_activeMenu->disabledButtons & (1<<buttonIndex)) if (_activeMenu->disabledButtons & (1 << buttonIndex))
buttonIndex = -1; buttonIndex = -1;
} }
@ -689,7 +688,7 @@ rclick:
case Common::KEYCODE_SPACE: case Common::KEYCODE_SPACE:
if (!(_activeMenu->disabledButtons & (1 << TEXTBUTTON_NEXTCHOICE)) if (!(_activeMenu->disabledButtons & (1 << TEXTBUTTON_NEXTCHOICE))
&& _activeMenu->sprites[TEXTBUTTON_NEXTCHOICE].drawMode == 2) { && _activeMenu->sprites[TEXTBUTTON_NEXTCHOICE].drawMode == 2) {
playSoundEffectIndex(SND_SELECTION); playSoundEffectIndex(SND_SELECTION);
return TEXTBUTTON_NEXTCHOICE; return TEXTBUTTON_NEXTCHOICE;
} }
@ -698,7 +697,7 @@ rclick:
case Common::KEYCODE_HOME: case Common::KEYCODE_HOME:
case Common::KEYCODE_KP7: case Common::KEYCODE_KP7:
if (!(_activeMenu->disabledButtons & (1 << TEXTBUTTON_SCROLLUP)) if (!(_activeMenu->disabledButtons & (1 << TEXTBUTTON_SCROLLUP))
&& _activeMenu->sprites[TEXTBUTTON_SCROLLUP].drawMode == 2) { && _activeMenu->sprites[TEXTBUTTON_SCROLLUP].drawMode == 2) {
playSoundEffectIndex(SND_SELECTION); playSoundEffectIndex(SND_SELECTION);
return TEXTBUTTON_GOTO_TOP; return TEXTBUTTON_GOTO_TOP;
} }
@ -707,7 +706,7 @@ rclick:
case Common::KEYCODE_UP: case Common::KEYCODE_UP:
case Common::KEYCODE_KP8: case Common::KEYCODE_KP8:
if (!(_activeMenu->disabledButtons & (1 << TEXTBUTTON_SCROLLUP)) if (!(_activeMenu->disabledButtons & (1 << TEXTBUTTON_SCROLLUP))
&& _activeMenu->sprites[TEXTBUTTON_SCROLLUP].drawMode == 2) { && _activeMenu->sprites[TEXTBUTTON_SCROLLUP].drawMode == 2) {
playSoundEffectIndex(SND_SELECTION); playSoundEffectIndex(SND_SELECTION);
return TEXTBUTTON_SCROLLUP_ONELINE; return TEXTBUTTON_SCROLLUP_ONELINE;
} }
@ -716,7 +715,7 @@ rclick:
case Common::KEYCODE_PAGEUP: case Common::KEYCODE_PAGEUP:
case Common::KEYCODE_KP9: case Common::KEYCODE_KP9:
if (!(_activeMenu->disabledButtons & (1 << TEXTBUTTON_SCROLLUP)) if (!(_activeMenu->disabledButtons & (1 << TEXTBUTTON_SCROLLUP))
&& _activeMenu->sprites[TEXTBUTTON_SCROLLUP].drawMode == 2) { && _activeMenu->sprites[TEXTBUTTON_SCROLLUP].drawMode == 2) {
playSoundEffectIndex(SND_SELECTION); playSoundEffectIndex(SND_SELECTION);
return TEXTBUTTON_SCROLLUP; return TEXTBUTTON_SCROLLUP;
} }
@ -725,7 +724,7 @@ rclick:
case Common::KEYCODE_LEFT: case Common::KEYCODE_LEFT:
case Common::KEYCODE_KP4: case Common::KEYCODE_KP4:
if (!(_activeMenu->disabledButtons & (1 << TEXTBUTTON_PREVCHOICE)) if (!(_activeMenu->disabledButtons & (1 << TEXTBUTTON_PREVCHOICE))
&& _activeMenu->sprites[TEXTBUTTON_PREVCHOICE].drawMode == 2) { && _activeMenu->sprites[TEXTBUTTON_PREVCHOICE].drawMode == 2) {
playSoundEffectIndex(SND_SELECTION); playSoundEffectIndex(SND_SELECTION);
return TEXTBUTTON_PREVCHOICE; return TEXTBUTTON_PREVCHOICE;
} }
@ -734,7 +733,7 @@ rclick:
case Common::KEYCODE_RIGHT: case Common::KEYCODE_RIGHT:
case Common::KEYCODE_KP6: case Common::KEYCODE_KP6:
if (!(_activeMenu->disabledButtons & (1 << TEXTBUTTON_NEXTCHOICE)) if (!(_activeMenu->disabledButtons & (1 << TEXTBUTTON_NEXTCHOICE))
&& _activeMenu->sprites[TEXTBUTTON_NEXTCHOICE].drawMode == 2) { && _activeMenu->sprites[TEXTBUTTON_NEXTCHOICE].drawMode == 2) {
playSoundEffectIndex(SND_SELECTION); playSoundEffectIndex(SND_SELECTION);
return TEXTBUTTON_NEXTCHOICE; return TEXTBUTTON_NEXTCHOICE;
} }
@ -743,7 +742,7 @@ rclick:
case Common::KEYCODE_END: case Common::KEYCODE_END:
case Common::KEYCODE_KP1: case Common::KEYCODE_KP1:
if (!(_activeMenu->disabledButtons & (1 << TEXTBUTTON_SCROLLDOWN)) if (!(_activeMenu->disabledButtons & (1 << TEXTBUTTON_SCROLLDOWN))
&& _activeMenu->sprites[TEXTBUTTON_SCROLLDOWN].drawMode == 2) { && _activeMenu->sprites[TEXTBUTTON_SCROLLDOWN].drawMode == 2) {
playSoundEffectIndex(SND_SELECTION); playSoundEffectIndex(SND_SELECTION);
return TEXTBUTTON_GOTO_BOTTOM; return TEXTBUTTON_GOTO_BOTTOM;
} }
@ -752,7 +751,7 @@ rclick:
case Common::KEYCODE_DOWN: case Common::KEYCODE_DOWN:
case Common::KEYCODE_KP2: case Common::KEYCODE_KP2:
if (!(_activeMenu->disabledButtons & (1 << TEXTBUTTON_SCROLLDOWN)) if (!(_activeMenu->disabledButtons & (1 << TEXTBUTTON_SCROLLDOWN))
&& _activeMenu->sprites[TEXTBUTTON_SCROLLDOWN].drawMode == 2) { && _activeMenu->sprites[TEXTBUTTON_SCROLLDOWN].drawMode == 2) {
playSoundEffectIndex(SND_SELECTION); playSoundEffectIndex(SND_SELECTION);
return TEXTBUTTON_SCROLLDOWN_ONELINE; return TEXTBUTTON_SCROLLDOWN_ONELINE;
} }
@ -761,7 +760,7 @@ rclick:
case Common::KEYCODE_PAGEDOWN: case Common::KEYCODE_PAGEDOWN:
case Common::KEYCODE_KP3: case Common::KEYCODE_KP3:
if (!(_activeMenu->disabledButtons & (1 << TEXTBUTTON_SCROLLDOWN)) if (!(_activeMenu->disabledButtons & (1 << TEXTBUTTON_SCROLLDOWN))
&& _activeMenu->sprites[TEXTBUTTON_SCROLLDOWN].drawMode == 2) { && _activeMenu->sprites[TEXTBUTTON_SCROLLDOWN].drawMode == 2) {
playSoundEffectIndex(SND_SELECTION); playSoundEffectIndex(SND_SELECTION);
return TEXTBUTTON_SCROLLDOWN; return TEXTBUTTON_SCROLLDOWN;
} }
@ -986,7 +985,7 @@ void StarTrekEngine::showTextConfigurationMenu(bool fromOptionMenu) {
saveTextDisplayMode(val); saveTextDisplayMode(val);
} }
switch(val) { switch (val) {
case 0: case 0:
_textDisplayMode = TEXTDISPLAY_SUBTITLES; _textDisplayMode = TEXTDISPLAY_SUBTITLES;
break; break;

View file

@ -171,13 +171,12 @@ public:
fielda2(), fielda2(),
fielda4(), fielda4(),
fielda6() fielda6() {
{ memset(animFilename, 0, sizeof(animFilename));
memset(animFilename, 0, sizeof(animFilename)); memset(bitmapFilename, 0, sizeof(bitmapFilename));
memset(bitmapFilename, 0, sizeof(bitmapFilename)); memset(animationString2, 0, sizeof(animationString2));
memset(animationString2, 0, sizeof(animationString2)); memset(animationString, 0, sizeof(animationString));
memset(animationString, 0, sizeof(animationString)); }
}
}; };

View file

@ -30,18 +30,18 @@
// TODO: Delete this macro, replacing it with the next one. // TODO: Delete this macro, replacing it with the next one.
// New "[roomName]NumActions" variables need to be made before that. // New "[roomName]NumActions" variables need to be made before that.
#define ADD_ROOM_OLD(ROOM) {\ #define ADD_ROOM_OLD(ROOM) {\
if (name.equalsIgnoreCase(#ROOM)) {\ if (name.equalsIgnoreCase(#ROOM)) {\
_roomActionList = ROOM##ActionList;\ _roomActionList = ROOM##ActionList;\
_numRoomActions = sizeof(ROOM##ActionList) / sizeof(RoomAction);\ _numRoomActions = sizeof(ROOM##ActionList) / sizeof(RoomAction);\
}\ }\
} }
#define ADD_ROOM(ROOM) {\ #define ADD_ROOM(ROOM) {\
if (name.equalsIgnoreCase(#ROOM)) {\ if (name.equalsIgnoreCase(#ROOM)) {\
_roomActionList = ROOM##ActionList;\ _roomActionList = ROOM##ActionList;\
_numRoomActions = ROOM##NumActions;\ _numRoomActions = ROOM##NumActions;\
}\ }\
} }
namespace StarTrek { namespace StarTrek {
@ -277,8 +277,7 @@ int Room::showRoomSpecificText(const char **array) {
textColor = TEXTCOLOR_RED; textColor = TEXTCOLOR_RED;
else else
textColor = TEXTCOLOR_GREY; textColor = TEXTCOLOR_GREY;
} } else
else
textColor = TEXTCOLOR_YELLOW; textColor = TEXTCOLOR_YELLOW;
return _vm->showText(&StarTrekEngine::readTextFromArrayWithChoices, (uintptr)array, 20, 20, textColor, true, false, false); return _vm->showText(&StarTrekEngine::readTextFromArrayWithChoices, (uintptr)array, 20, 20, textColor, true, false, false);

View file

@ -64,10 +64,18 @@ public:
* "minimum" scale; that value rises to the "max scale" value by the time they reach * "minimum" scale; that value rises to the "max scale" value by the time they reach
* the "max Y" value. * the "max Y" value.
*/ */
uint16 getMaxY() { return readRdfWord(0x06); } uint16 getMaxY() {
uint16 getMinY() { return readRdfWord(0x08); } return readRdfWord(0x06);
Fixed8 getMinScale() { return Fixed8::fromRaw(readRdfWord(0x0a)); } }
Fixed8 getMaxScale() { return Fixed8::fromRaw(readRdfWord(0x0c)); } uint16 getMinY() {
return readRdfWord(0x08);
}
Fixed8 getMinScale() {
return Fixed8::fromRaw(readRdfWord(0x0a));
}
Fixed8 getMaxScale() {
return Fixed8::fromRaw(readRdfWord(0x0c));
}
/** /**
* Check if a particular action is defined for this room. * Check if a particular action is defined for this room.
@ -87,14 +95,26 @@ public:
bool handleActionWithBitmask(const Action &action); bool handleActionWithBitmask(const Action &action);
bool handleActionWithBitmask(byte type, byte b1, byte b2, byte b3); bool handleActionWithBitmask(byte type, byte b1, byte b2, byte b3);
uint16 getFirstHotspot() { return readRdfWord(0x12); } uint16 getFirstHotspot() {
uint16 getHotspotEnd() { return readRdfWord(0x14); } return readRdfWord(0x12);
}
uint16 getHotspotEnd() {
return readRdfWord(0x14);
}
// Warp-related stuff // Warp-related stuff
uint16 getFirstWarpPolygonOffset() { return readRdfWord(0x16); } uint16 getFirstWarpPolygonOffset() {
uint16 getWarpPolygonEndOffset() { return readRdfWord(0x18); } return readRdfWord(0x16);
uint16 getFirstDoorPolygonOffset() { return readRdfWord(0x1a); } }
uint16 getDoorPolygonEndOffset() { return readRdfWord(0x1c); } uint16 getWarpPolygonEndOffset() {
return readRdfWord(0x18);
}
uint16 getFirstDoorPolygonOffset() {
return readRdfWord(0x1a);
}
uint16 getDoorPolygonEndOffset() {
return readRdfWord(0x1c);
}
/** /**
* Get the point at which a crewman beams in to this room (not properly defined for * Get the point at which a crewman beams in to this room (not properly defined for

View file

@ -280,8 +280,7 @@ void Room::demon0TalkToMcCoy() {
showText(TX_SPEAKER_SPOCK, TX_DEM0_029); showText(TX_SPEAKER_SPOCK, TX_DEM0_029);
if (!_vm->_awayMission.redshirtDead) if (!_vm->_awayMission.redshirtDead)
showText(TX_SPEAKER_EVERTS, TX_DEM0_041); showText(TX_SPEAKER_EVERTS, TX_DEM0_041);
} } else {
else {
showText(TX_SPEAKER_MCCOY, TX_DEM0_019); showText(TX_SPEAKER_MCCOY, TX_DEM0_019);
if (!_vm->_awayMission.demon.askedPrelateAboutSightings) { if (!_vm->_awayMission.demon.askedPrelateAboutSightings) {
demon0AskPrelateAboutSightings(); demon0AskPrelateAboutSightings();

View file

@ -37,8 +37,7 @@ void Room::demon1Tick1() {
_vm->_awayMission.crewDirectionsAfterWalk[OBJECT_SPOCK] = DIR_N; _vm->_awayMission.crewDirectionsAfterWalk[OBJECT_SPOCK] = DIR_N;
_vm->_awayMission.crewDirectionsAfterWalk[OBJECT_MCCOY] = DIR_N; _vm->_awayMission.crewDirectionsAfterWalk[OBJECT_MCCOY] = DIR_N;
_vm->_awayMission.crewDirectionsAfterWalk[OBJECT_REDSHIRT] = DIR_N; _vm->_awayMission.crewDirectionsAfterWalk[OBJECT_REDSHIRT] = DIR_N;
} } else if (_vm->_awayMission.demon.enteredFrom == 2) { // Entered from north?
else if (_vm->_awayMission.demon.enteredFrom == 2) { // Entered from north?
_vm->_awayMission.crewDirectionsAfterWalk[OBJECT_KIRK] = DIR_S; _vm->_awayMission.crewDirectionsAfterWalk[OBJECT_KIRK] = DIR_S;
_vm->_awayMission.crewDirectionsAfterWalk[OBJECT_SPOCK] = DIR_S; _vm->_awayMission.crewDirectionsAfterWalk[OBJECT_SPOCK] = DIR_S;
_vm->_awayMission.crewDirectionsAfterWalk[OBJECT_MCCOY] = DIR_S; _vm->_awayMission.crewDirectionsAfterWalk[OBJECT_MCCOY] = DIR_S;
@ -48,8 +47,7 @@ void Room::demon1Tick1() {
if (!_vm->_awayMission.demon.beatKlingons) { if (!_vm->_awayMission.demon.beatKlingons) {
_vm->_awayMission.disableWalking = true; _vm->_awayMission.disableWalking = true;
_vm->_awayMission.timers[2] = 50; _vm->_awayMission.timers[2] = 50;
} } else {
else {
loadActorAnim(8, "klg1d2", 0x120, 0x82, 0); loadActorAnim(8, "klg1d2", 0x120, 0x82, 0);
if (!_vm->_awayMission.demon.tookKlingonHand) if (!_vm->_awayMission.demon.tookKlingonHand)
loadActorAnim(13, "klghnd", 0x10b, 0x8e, 0); loadActorAnim(13, "klghnd", 0x10b, 0x8e, 0);
@ -126,8 +124,7 @@ void Room::demon1Timer1Expired() {
// TODO // TODO
return; return;
} }
} } else if (_rdfData[0xcb] != 1) {
else if (_rdfData[0xcb] != 1) {
anim = "klg2f"; anim = "klg2f";
shooter = 9; shooter = 9;
switch (_roomVar.demon1.attackIndex) { switch (_roomVar.demon1.attackIndex) {
@ -147,8 +144,7 @@ void Room::demon1Timer1Expired() {
// TODO // TODO
return; return;
} }
} } else {
else {
anim = "klg3f"; anim = "klg3f";
shooter = 10; shooter = 10;
switch (_roomVar.demon1.attackIndex) { switch (_roomVar.demon1.attackIndex) {
@ -182,16 +178,13 @@ void Room::demon1KlingonFinishedAimingWeapon() {
if (_roomVar.demon1.attackIndex == 1) { if (_roomVar.demon1.attackIndex == 1) {
loadActorAnim2(OBJECT_REDSHIRT, "rstunn", -1, -1, 0); loadActorAnim2(OBJECT_REDSHIRT, "rstunn", -1, -1, 0);
crewman = OBJECT_REDSHIRT; crewman = OBJECT_REDSHIRT;
} } else if (_roomVar.demon1.attackIndex == 2) {
else if (_roomVar.demon1.attackIndex == 2) {
loadActorAnim2(OBJECT_SPOCK, "sstunn", -1, -1, 0); loadActorAnim2(OBJECT_SPOCK, "sstunn", -1, -1, 0);
crewman = OBJECT_SPOCK; crewman = OBJECT_SPOCK;
} } else if (_roomVar.demon1.attackIndex == 3) {
else if (_roomVar.demon1.attackIndex == 3) {
loadActorAnim2(OBJECT_MCCOY, "mstune", -1, -1, 0); loadActorAnim2(OBJECT_MCCOY, "mstune", -1, -1, 0);
crewman = OBJECT_MCCOY; crewman = OBJECT_MCCOY;
} } else if (_roomVar.demon1.attackIndex == 4) {
else if (_roomVar.demon1.attackIndex == 4) {
loadActorAnim2(OBJECT_KIRK, "kstunn", -1, -1, 1); loadActorAnim2(OBJECT_KIRK, "kstunn", -1, -1, 1);
crewman = OBJECT_KIRK; crewman = OBJECT_KIRK;
} }
@ -221,8 +214,7 @@ void Room::demon1UsePhaserOnKlingon1() {
if (_roomVar.demon1.kirkShooting) { if (_roomVar.demon1.kirkShooting) {
demon1ShootKlingon1(); demon1ShootKlingon1();
} } else {
else {
loadActorAnim2(OBJECT_KIRK, "kfiren", -1, -1, 3); loadActorAnim2(OBJECT_KIRK, "kfiren", -1, -1, 3);
_roomVar.demon1.kirkShooting = true; _roomVar.demon1.kirkShooting = true;
} }
@ -270,8 +262,7 @@ void Room::demon1UsePhaserOnKlingon2() {
if (_roomVar.demon1.kirkShooting) { if (_roomVar.demon1.kirkShooting) {
demon1ShootKlingon2(); demon1ShootKlingon2();
} } else {
else {
loadActorAnim2(OBJECT_KIRK, "kfiren", -1, -1, 4); loadActorAnim2(OBJECT_KIRK, "kfiren", -1, -1, 4);
_roomVar.demon1.kirkShooting = true; _roomVar.demon1.kirkShooting = true;
} }
@ -300,8 +291,7 @@ void Room::demon1UsePhaserOnKlingon3() {
if (_roomVar.demon1.kirkShooting) { if (_roomVar.demon1.kirkShooting) {
demon1ShootKlingon3(); demon1ShootKlingon3();
} } else {
else {
loadActorAnim2(OBJECT_KIRK, "kfiren", -1, -1, 5); loadActorAnim2(OBJECT_KIRK, "kfiren", -1, -1, 5);
_roomVar.demon1.kirkShooting = true; _roomVar.demon1.kirkShooting = true;
} }
@ -390,8 +380,7 @@ void Room::demon1UseSTricorderOnKlingon1() {
if (_roomVar.demon1.numKlingonsKilled == 3 && !_vm->_awayMission.demon.tookKlingonHand && _rdfData[0xcf] != 1) { if (_roomVar.demon1.numKlingonsKilled == 3 && !_vm->_awayMission.demon.tookKlingonHand && _rdfData[0xcf] != 1) {
showText(TX_SPEAKER_SPOCK, TX_DEM1_018); showText(TX_SPEAKER_SPOCK, TX_DEM1_018);
_rdfData[0xcf] = 1; _rdfData[0xcf] = 1;
} } else {
else {
showText(TX_SPEAKER_SPOCK, TX_DEM1_019); showText(TX_SPEAKER_SPOCK, TX_DEM1_019);
} }
} }

View file

@ -45,8 +45,7 @@ void Room::demon3Tick1() {
if (_vm->_awayMission.demon.doorOpened) { if (_vm->_awayMission.demon.doorOpened) {
loadActorAnim(14, "door2", 0x82, 0x0c, 0); loadActorAnim(14, "door2", 0x82, 0x0c, 0);
} } else {
else {
loadMapFile("demon3a"); loadMapFile("demon3a");
} }
@ -91,8 +90,7 @@ void Room::demon3Timer3Expired() {
loadMapFile("demon3"); loadMapFile("demon3");
_vm->_awayMission.demon.doorOpened = true; _vm->_awayMission.demon.doorOpened = true;
_vm->_awayMission.demon.missionScore += 2; _vm->_awayMission.demon.missionScore += 2;
} } else {
else {
showText(TX_DEM3N007); showText(TX_DEM3N007);
} }
} }
@ -237,8 +235,7 @@ void Room::demon3UsePhaserOnBoulder3() {
_roomVar.demon3.boulderBeingShot = 3; _roomVar.demon3.boulderBeingShot = 3;
strcpy(_roomVar.demon3.boulderAnim, "s0r3s1"); strcpy(_roomVar.demon3.boulderAnim, "s0r3s1");
demon3BoulderCommon(); demon3BoulderCommon();
} } else {
else {
showText(TX_SPEAKER_SPOCK, TX_DEM3_006); showText(TX_SPEAKER_SPOCK, TX_DEM3_006);
} }
} }
@ -253,8 +250,7 @@ void Room::demon3UsePhaserOnBoulder4() {
strcpy(_roomVar.demon3.boulderAnim, "s0r3s4"); strcpy(_roomVar.demon3.boulderAnim, "s0r3s4");
_vm->_awayMission.demon.foundMiner = true; _vm->_awayMission.demon.foundMiner = true;
demon3BoulderCommon(); demon3BoulderCommon();
} } else {
else {
// BUGFIX: In the original, the audio didn't play, despite the file existing (and // BUGFIX: In the original, the audio didn't play, despite the file existing (and
// despite it being used for the boulder on the left). // despite it being used for the boulder on the left).
showText(TX_SPEAKER_SPOCK, TX_DEM3_006); showText(TX_SPEAKER_SPOCK, TX_DEM3_006);
@ -271,8 +267,7 @@ void Room::demon3BoulderCommon() {
if (_roomVar.demon3.inFiringPosition) { if (_roomVar.demon3.inFiringPosition) {
demon3PullOutPhaserAndFireAtBoulder(); demon3PullOutPhaserAndFireAtBoulder();
} } else {
else {
showText(TX_SPEAKER_KIRK, TX_DEM3_001); showText(TX_SPEAKER_KIRK, TX_DEM3_001);
walkCrewman(OBJECT_KIRK, 0x79, 0xa0, 1); walkCrewman(OBJECT_KIRK, 0x79, 0xa0, 1);
@ -348,8 +343,7 @@ void Room::demon3RedshirtUsedPanel() {
playSoundEffectIndex(0x06); playSoundEffectIndex(0x06);
_vm->_awayMission.redshirtDead = true; _vm->_awayMission.redshirtDead = true;
_vm->_awayMission.demon.field45 = true; _vm->_awayMission.demon.field45 = true;
} } else {
else {
const int textTable[] = { const int textTable[] = {
TX_DEM3N005, TX_DEM3N005,
TX_DEM3_033, TX_DEM3_033,
@ -404,8 +398,7 @@ void Room::demon3UseHandOnPanel() {
if (_vm->_awayMission.demon.doorOpened) if (_vm->_awayMission.demon.doorOpened)
return; return;
walkCrewman(OBJECT_KIRK, 0xd8, 0x70, 7); walkCrewman(OBJECT_KIRK, 0xd8, 0x70, 7);
} } else {
else {
showText(TX_SPEAKER_SPOCK, TX_DEM3_005); showText(TX_SPEAKER_SPOCK, TX_DEM3_005);
} }
} }
@ -428,8 +421,7 @@ void Room::demon3UseMTricorderOnMiner() {
if (_vm->_awayMission.demon.minerDead) { if (_vm->_awayMission.demon.minerDead) {
showText(TX_SPEAKER_MCCOY, TX_DEM3_022); showText(TX_SPEAKER_MCCOY, TX_DEM3_022);
} } else {
else {
showText(TX_SPEAKER_MCCOY, TX_DEM3_023); showText(TX_SPEAKER_MCCOY, TX_DEM3_023);
} }
} }
@ -437,8 +429,7 @@ void Room::demon3UseMTricorderOnMiner() {
void Room::demon3UseMedkitOnMiner() { void Room::demon3UseMedkitOnMiner() {
if (_vm->_awayMission.demon.healedMiner) { if (_vm->_awayMission.demon.healedMiner) {
showText(TX_SPEAKER_MCCOY, TX_DEM3_015); showText(TX_SPEAKER_MCCOY, TX_DEM3_015);
} } else {
else {
walkCrewman(OBJECT_MCCOY, 0xe6, 0x7b, 6); walkCrewman(OBJECT_MCCOY, 0xe6, 0x7b, 6);
_roomVar.demon3.inFiringPosition = false; _roomVar.demon3.inFiringPosition = false;
_roomVar.demon3.kirkPhaserOut = false; _roomVar.demon3.kirkPhaserOut = false;
@ -452,8 +443,7 @@ void Room::demon3McCoyReachedMiner() {
void Room::demon3McCoyFinishedHealingMiner() { void Room::demon3McCoyFinishedHealingMiner() {
if (_vm->_awayMission.demon.minerDead) { if (_vm->_awayMission.demon.minerDead) {
showText(TX_SPEAKER_MCCOY, TX_DEM3_022); showText(TX_SPEAKER_MCCOY, TX_DEM3_022);
} } else {
else {
showText(TX_SPEAKER_MCCOY, TX_DEM3_021); showText(TX_SPEAKER_MCCOY, TX_DEM3_021);
_vm->_awayMission.demon.healedMiner = true; _vm->_awayMission.demon.healedMiner = true;
loadActorAnim2(13, "drmine", 0xda, 0x6c, 0); loadActorAnim2(13, "drmine", 0xda, 0x6c, 0);
@ -485,8 +475,7 @@ void Room::demon3TalkToSpock() {
void Room::demon3TalkToMccoy() { void Room::demon3TalkToMccoy() {
if (_vm->_awayMission.redshirtDead) { if (_vm->_awayMission.redshirtDead) {
showText(TX_SPEAKER_MCCOY, TX_DEM3_014); showText(TX_SPEAKER_MCCOY, TX_DEM3_014);
} } else {
else {
showText(TX_SPEAKER_MCCOY, TX_DEM3_025); showText(TX_SPEAKER_MCCOY, TX_DEM3_025);
showText(TX_SPEAKER_KIRK, TX_DEM3_003); showText(TX_SPEAKER_KIRK, TX_DEM3_003);
showText(TX_SPEAKER_MCCOY, TX_DEM3_024); showText(TX_SPEAKER_MCCOY, TX_DEM3_024);
@ -517,8 +506,7 @@ void Room::demon3LookAtRedshirt() {
if (_vm->_awayMission.redshirtDead) { if (_vm->_awayMission.redshirtDead) {
showText(TX_DEM3N017); showText(TX_DEM3N017);
// NOTE: there's an alternate string that isn't used? (TX_DEM3N018) // NOTE: there's an alternate string that isn't used? (TX_DEM3N018)
} } else {
else {
showText(TX_DEM3N003); showText(TX_DEM3N003);
} }
} }
@ -530,8 +518,7 @@ void Room::demon3LookAnywhere() {
void Room::demon3LookAtMiner() { void Room::demon3LookAtMiner() {
if (_vm->_awayMission.demon.healedMiner) { if (_vm->_awayMission.demon.healedMiner) {
showText(TX_DEM3N000); showText(TX_DEM3N000);
} } else {
else {
showText(TX_DEM3N006); showText(TX_DEM3N006);
} }
} }
@ -559,8 +546,7 @@ void Room::demon3LookAtStructure() {
void Room::demon3LookAtDoor() { void Room::demon3LookAtDoor() {
if (_vm->_awayMission.demon.doorOpened) { if (_vm->_awayMission.demon.doorOpened) {
showText(TX_DEM3N014); showText(TX_DEM3N014);
} } else {
else {
showText(TX_DEM3N012); showText(TX_DEM3N012);
} }
} }

View file

@ -140,8 +140,7 @@ void Room::demon4UsePhaserOnNauian() {
if (!_roomVar.demon4.triedToShootNauian) { // Lenient the first time if (!_roomVar.demon4.triedToShootNauian) { // Lenient the first time
showText(TX_SPEAKER_NAUIAN, TX_DEM4_033); showText(TX_SPEAKER_NAUIAN, TX_DEM4_033);
_roomVar.demon4.triedToShootNauian = true; _roomVar.demon4.triedToShootNauian = true;
} } else { // Murdery the second time
else { // Murdery the second time
showText(TX_SPEAKER_NAUIAN, TX_DEM4_032); showText(TX_SPEAKER_NAUIAN, TX_DEM4_032);
loadActorAnim2(10, "bxfire", 0, 0, 2); loadActorAnim2(10, "bxfire", 0, 0, 2);
playVoc("V0SPOCKT"); playVoc("V0SPOCKT");
@ -279,12 +278,10 @@ void Room::demon4TalkToNauian() {
_vm->_awayMission.disableInput = true; _vm->_awayMission.disableInput = true;
_vm->_awayMission.demon.missionScore += 5; _vm->_awayMission.demon.missionScore += 5;
_vm->_awayMission.timers[1] = 20; _vm->_awayMission.timers[1] = 20;
} } else {
else {
showText(TX_SPEAKER_NAUIAN, TX_DEM4_038); showText(TX_SPEAKER_NAUIAN, TX_DEM4_038);
} }
} } else {
else {
showText(TX_SPEAKER_NAUIAN, TX_DEM4_031); showText(TX_SPEAKER_NAUIAN, TX_DEM4_031);
} }
} }
@ -367,8 +364,7 @@ void Room::demon4CrewmanReachedPanel() {
loadActorAnim(9, "ctrl", 0, 0, 0); loadActorAnim(9, "ctrl", 0, 0, 0);
_vm->_awayMission.demon.missionScore += 3; _vm->_awayMission.demon.missionScore += 3;
_vm->_awayMission.timers[0] = 10; _vm->_awayMission.timers[0] = 10;
} } else
else
showText(TX_DEM4N013); showText(TX_DEM4N013);
walkCrewman(_roomVar.demon4.crewmanUsingPanel, 0xae, 0x93, 0); walkCrewman(_roomVar.demon4.crewmanUsingPanel, 0xae, 0x93, 0);

View file

@ -158,8 +158,7 @@ void Room::demon5TalkToRoberts() {
_roomVar.demon5.numTalkedTo++; _roomVar.demon5.numTalkedTo++;
demon5CheckCompletedStudy(); demon5CheckCompletedStudy();
} }
} } else {
else {
showText(TX_DEM5N010); showText(TX_DEM5N010);
} }
} }
@ -177,8 +176,7 @@ void Room::demon5TalkToChub() {
_roomVar.demon5.numTalkedTo++; _roomVar.demon5.numTalkedTo++;
demon5CheckCompletedStudy(); demon5CheckCompletedStudy();
} }
} } else {
else {
showText(TX_DEM5N013); showText(TX_DEM5N013);
} }
} }
@ -195,8 +193,7 @@ void Room::demon5TalkToGrisnash() {
_roomVar.demon5.numTalkedTo++; _roomVar.demon5.numTalkedTo++;
demon5CheckCompletedStudy(); demon5CheckCompletedStudy();
} }
} } else {
else {
showText(TX_DEM5N011); showText(TX_DEM5N011);
} }
} }
@ -214,21 +211,16 @@ void Room::demon5TalkToStephen() {
_roomVar.demon5.numTalkedTo++; _roomVar.demon5.numTalkedTo++;
demon5CheckCompletedStudy(); demon5CheckCompletedStudy();
} }
} } else if (!_vm->_awayMission.demon.knowAboutHypoDytoxin) {
else if (!_vm->_awayMission.demon.knowAboutHypoDytoxin) {
showText(TX_SPEAKER_ROBERTS, TX_DEM5_034); showText(TX_SPEAKER_ROBERTS, TX_DEM5_034);
} } else if (_vm->_awayMission.demon.madeHypoDytoxin) {
else if (_vm->_awayMission.demon.madeHypoDytoxin) {
showText(TX_SPEAKER_ROBERTS, TX_DEM5_035); showText(TX_SPEAKER_ROBERTS, TX_DEM5_035);
} } else if (_vm->_awayMission.demon.gotBerries) {
else if (_vm->_awayMission.demon.gotBerries) {
showText(TX_SPEAKER_ROBERTS, TX_DEM5_032); showText(TX_SPEAKER_ROBERTS, TX_DEM5_032);
_vm->_awayMission.demon.field3e = false; _vm->_awayMission.demon.field3e = false;
} } else if (_vm->_awayMission.demon.field3e) {
else if (_vm->_awayMission.demon.field3e) {
showText(TX_SPEAKER_ROBERTS, TX_DEM5_038); showText(TX_SPEAKER_ROBERTS, TX_DEM5_038);
} } else {
else {
showText(TX_SPEAKER_ROBERTS, TX_DEM5_034); showText(TX_SPEAKER_ROBERTS, TX_DEM5_034);
} }
} }
@ -258,8 +250,7 @@ void Room::demon5TalkToMccoy() {
showText(TX_SPEAKER_SPOCK, TX_DEM5_026); showText(TX_SPEAKER_SPOCK, TX_DEM5_026);
showText(TX_SPEAKER_MCCOY, TX_DEM5_019); showText(TX_SPEAKER_MCCOY, TX_DEM5_019);
} }
} } else {
else {
showText(TX_SPEAKER_MCCOY, TX_DEM5_017); showText(TX_SPEAKER_MCCOY, TX_DEM5_017);
} }
} }
@ -287,8 +278,7 @@ void Room::demon5UseMTricorderOnChub() {
_roomVar.demon5.scannedChub = true; _roomVar.demon5.scannedChub = true;
_roomVar.demon5.numScanned++; _roomVar.demon5.numScanned++;
demon5CheckCompletedStudy(); demon5CheckCompletedStudy();
} } else {
else {
if (_vm->_awayMission.demon.field3e) if (_vm->_awayMission.demon.field3e)
showText(TX_SPEAKER_MCCOY, TX_DEM5_010); showText(TX_SPEAKER_MCCOY, TX_DEM5_010);
else { else {

View file

@ -174,8 +174,7 @@ void Room::demon6TalkToStephen() {
void Room::demon6UseBerryOnStephen() { void Room::demon6UseBerryOnStephen() {
if (_vm->_awayMission.demon.knowAboutHypoDytoxin) { if (_vm->_awayMission.demon.knowAboutHypoDytoxin) {
showText(TX_SPEAKER_STEPHEN, TX_DEM6_027); showText(TX_SPEAKER_STEPHEN, TX_DEM6_027);
} } else {
else {
showText(TX_SPEAKER_STEPHEN, TX_DEM6_026); showText(TX_SPEAKER_STEPHEN, TX_DEM6_026);
} }
} }
@ -209,8 +208,7 @@ void Room::demon6FinishedMakingHypoDytoxin() {
void Room::demon6UseHandOnWorkspace() { void Room::demon6UseHandOnWorkspace() {
if (_vm->_awayMission.demon.repairedHand) { if (_vm->_awayMission.demon.repairedHand) {
showText(TX_SPEAKER_SPOCK, TX_DEM6N018); // FIXME showText(TX_SPEAKER_SPOCK, TX_DEM6N018); // FIXME
} } else {
else {
_vm->_awayMission.disableInput = true; _vm->_awayMission.disableInput = true;
showText(TX_SPEAKER_KIRK, TX_DEM6_005); showText(TX_SPEAKER_KIRK, TX_DEM6_005);
walkCrewman(OBJECT_SPOCK, 0xb3, 0xbb, 2); walkCrewman(OBJECT_SPOCK, 0xb3, 0xbb, 2);
@ -247,8 +245,7 @@ insult:
showText(TX_SPEAKER_STEPHEN, TX_DEM6_030); showText(TX_SPEAKER_STEPHEN, TX_DEM6_030);
_roomVar.demon6.insultedStephenRecently = true; _roomVar.demon6.insultedStephenRecently = true;
_vm->_awayMission.demon.insultedStephen = true; _vm->_awayMission.demon.insultedStephen = true;
} } else if (choice == 1) {
else if (choice == 1) {
showText(TX_SPEAKER_STEPHEN, TX_DEM6_034); showText(TX_SPEAKER_STEPHEN, TX_DEM6_034);
explain: explain:
while (true) { while (true) {
@ -280,8 +277,7 @@ explain:
goto error; goto error;
} }
} }
} } else if (choice == 2) {
else if (choice == 2) {
showText(TX_SPEAKER_STEPHEN, TX_DEM6_031); showText(TX_SPEAKER_STEPHEN, TX_DEM6_031);
int choices3[] = {TX_SPEAKER_KIRK, TX_DEM6_001, TX_DEM6_006, TX_BLANK}; int choices3[] = {TX_SPEAKER_KIRK, TX_DEM6_001, TX_DEM6_006, TX_BLANK};
choice = showText(choices3); choice = showText(choices3);
@ -292,13 +288,11 @@ explain:
goto explain; goto explain;
else else
goto error; goto error;
} } else {
else {
error: error:
showText(TX_DIALOG_ERROR); showText(TX_DIALOG_ERROR);
} }
} } else {
else {
showText(TX_DEM6N012); showText(TX_DEM6N012);
showText(TX_SPEAKER_MCCOY, TX_DEM6_019); showText(TX_SPEAKER_MCCOY, TX_DEM6_019);
} }

View file

@ -475,10 +475,10 @@ void Room::feather1CrewmanClimbVine() {
_vm->_awayMission.disableInput = true; _vm->_awayMission.disableInput = true;
if (_roomVar.feather.crewEscaped[_roomVar.feather.crewmanClimbingVine]) if (_roomVar.feather.crewEscaped[_roomVar.feather.crewmanClimbingVine])
walkCrewmanC(_roomVar.feather.crewmanClimbingVine, VINE_TOP_X, VINE_TOP_Y, walkCrewmanC(_roomVar.feather.crewmanClimbingVine, VINE_TOP_X, VINE_TOP_Y,
&Room::feather1ReachedVineToClimbDown); &Room::feather1ReachedVineToClimbDown);
else else
walkCrewmanC(_roomVar.feather.crewmanClimbingVine, VINE_BOT_X, VINE_BOT_Y, walkCrewmanC(_roomVar.feather.crewmanClimbingVine, VINE_BOT_X, VINE_BOT_Y,
&Room::feather1ReachedVineToClimbUp); &Room::feather1ReachedVineToClimbUp);
} }
void Room::feather1ReachedVineToClimbUp() { void Room::feather1ReachedVineToClimbUp() {

View file

@ -68,9 +68,9 @@ extern const RoomAction feather3ActionList[] = {
{ {ACTION_TALK, OBJECT_REDSHIRT, 0, 0}, &Room::feather3TalkToRedshirt }, { {ACTION_TALK, OBJECT_REDSHIRT, 0, 0}, &Room::feather3TalkToRedshirt },
{ {ACTION_TALK, OBJECT_TLAOXAC, 0, 0}, &Room::feather3TalkToTlaoxac }, { {ACTION_TALK, OBJECT_TLAOXAC, 0, 0}, &Room::feather3TalkToTlaoxac },
{ {ACTION_FINISHED_ANIMATION, 2, 0, 0}, &Room::feather3TlaoxacKilledRedshirt }, { {ACTION_FINISHED_ANIMATION, 2, 0, 0}, &Room::feather3TlaoxacKilledRedshirt },
{ {ACTION_USE, OBJECT_IMTRICOR, OBJECT_TLAOXAC, 0},&Room::feather3UseMTricorderOnTlaoxac }, { {ACTION_USE, OBJECT_IMTRICOR, OBJECT_TLAOXAC, 0}, &Room::feather3UseMTricorderOnTlaoxac },
{ {ACTION_USE, OBJECT_IMEDKIT, OBJECT_TLAOXAC, 0}, &Room::feather3UseMedkitOnTlaoxac }, { {ACTION_USE, OBJECT_IMEDKIT, OBJECT_TLAOXAC, 0}, &Room::feather3UseMedkitOnTlaoxac },
{ {ACTION_USE, OBJECT_IMEDKIT, OBJECT_REDSHIRT, 0},&Room::feather3UseMedkitOnRedshirt }, { {ACTION_USE, OBJECT_IMEDKIT, OBJECT_REDSHIRT, 0}, &Room::feather3UseMedkitOnRedshirt },
{ {ACTION_USE, OBJECT_IMEDKIT, 0xff, 0}, &Room::feather3UseMedkitAnywhere }, { {ACTION_USE, OBJECT_IMEDKIT, 0xff, 0}, &Room::feather3UseMedkitAnywhere },
{ {ACTION_USE, OBJECT_IMTRICOR, HOTSPOT_LIGHT_1, 0}, &Room::feather3UseMTricorderOnLight }, { {ACTION_USE, OBJECT_IMTRICOR, HOTSPOT_LIGHT_1, 0}, &Room::feather3UseMTricorderOnLight },
{ {ACTION_USE, OBJECT_IMTRICOR, HOTSPOT_LIGHT_2, 0}, &Room::feather3UseMTricorderOnLight }, { {ACTION_USE, OBJECT_IMTRICOR, HOTSPOT_LIGHT_2, 0}, &Room::feather3UseMTricorderOnLight },

View file

@ -39,13 +39,13 @@ extern const RoomAction feather4ActionList[] = {
{ {ACTION_USE, OBJECT_ISTRICOR, HOTSPOT_LIGHT_1, 0}, &Room::feather4UseSTricorderOnLight }, { {ACTION_USE, OBJECT_ISTRICOR, HOTSPOT_LIGHT_1, 0}, &Room::feather4UseSTricorderOnLight },
{ {ACTION_USE, OBJECT_ISTRICOR, HOTSPOT_LIGHT_2, 0}, &Room::feather4UseSTricorderOnLight }, { {ACTION_USE, OBJECT_ISTRICOR, HOTSPOT_LIGHT_2, 0}, &Room::feather4UseSTricorderOnLight },
{ {ACTION_USE, OBJECT_ISTRICOR, HOTSPOT_LIGHT_3, 0}, &Room::feather4UseSTricorderOnLight }, { {ACTION_USE, OBJECT_ISTRICOR, HOTSPOT_LIGHT_3, 0}, &Room::feather4UseSTricorderOnLight },
{ {ACTION_USE, OBJECT_ISTRICOR, HOTSPOT_MUSHROOM, 0},&Room::feather4UseSTricorderOnMushroom }, { {ACTION_USE, OBJECT_ISTRICOR, HOTSPOT_MUSHROOM, 0}, &Room::feather4UseSTricorderOnMushroom },
{ {ACTION_USE, OBJECT_ISTRICOR, HOTSPOT_FERN, 0}, &Room::feather4UseSTricorderOnFern }, { {ACTION_USE, OBJECT_ISTRICOR, HOTSPOT_FERN, 0}, &Room::feather4UseSTricorderOnFern },
{ {ACTION_USE, OBJECT_ISTRICOR, 0xff, 0}, &Room::feather4UseSTricorderAnywhere }, { {ACTION_USE, OBJECT_ISTRICOR, 0xff, 0}, &Room::feather4UseSTricorderAnywhere },
{ {ACTION_USE, OBJECT_IMTRICOR, HOTSPOT_LIGHT_1, 0}, &Room::feather4UseMTricorderOnLight }, { {ACTION_USE, OBJECT_IMTRICOR, HOTSPOT_LIGHT_1, 0}, &Room::feather4UseMTricorderOnLight },
{ {ACTION_USE, OBJECT_IMTRICOR, HOTSPOT_LIGHT_2, 0}, &Room::feather4UseMTricorderOnLight }, { {ACTION_USE, OBJECT_IMTRICOR, HOTSPOT_LIGHT_2, 0}, &Room::feather4UseMTricorderOnLight },
{ {ACTION_USE, OBJECT_IMTRICOR, HOTSPOT_LIGHT_3, 0}, &Room::feather4UseMTricorderOnLight }, { {ACTION_USE, OBJECT_IMTRICOR, HOTSPOT_LIGHT_3, 0}, &Room::feather4UseMTricorderOnLight },
{ {ACTION_USE, OBJECT_IMTRICOR, HOTSPOT_MUSHROOM, 0},&Room::feather4UseMTricorderOnMushroom }, { {ACTION_USE, OBJECT_IMTRICOR, HOTSPOT_MUSHROOM, 0}, &Room::feather4UseMTricorderOnMushroom },
{ {ACTION_USE, OBJECT_IMTRICOR, 0xff, 0}, &Room::feather4UseMTricorderAnywhere }, { {ACTION_USE, OBJECT_IMTRICOR, 0xff, 0}, &Room::feather4UseMTricorderAnywhere },
{ {ACTION_USE, OBJECT_IMEDKIT, 0xff, 0}, &Room::feather4UseMedkitAnywhere }, { {ACTION_USE, OBJECT_IMEDKIT, 0xff, 0}, &Room::feather4UseMedkitAnywhere },
{ {ACTION_TALK, OBJECT_MCCOY, 0, 0}, &Room::feather4TalkToMccoy }, { {ACTION_TALK, OBJECT_MCCOY, 0, 0}, &Room::feather4TalkToMccoy },

View file

@ -81,7 +81,7 @@ extern const RoomAction feather5ActionList[] = {
{ {ACTION_USE, OBJECT_IROCK, OBJECT_REDSHIRT, 0}, &Room::feather5UseRockOnRedshirt }, { {ACTION_USE, OBJECT_IROCK, OBJECT_REDSHIRT, 0}, &Room::feather5UseRockOnRedshirt },
{ {ACTION_USE, OBJECT_SPOCK, OBJECT_THROWN_FERN, 0}, &Room::feather5UseCrewmanOnThrownFern }, { {ACTION_USE, OBJECT_SPOCK, OBJECT_THROWN_FERN, 0}, &Room::feather5UseCrewmanOnThrownFern },
{ {ACTION_USE, OBJECT_MCCOY, OBJECT_THROWN_FERN, 0}, &Room::feather5UseCrewmanOnThrownFern }, { {ACTION_USE, OBJECT_MCCOY, OBJECT_THROWN_FERN, 0}, &Room::feather5UseCrewmanOnThrownFern },
{ {ACTION_USE, OBJECT_REDSHIRT, OBJECT_THROWN_FERN, 0},&Room::feather5UseCrewmanOnThrownFern }, { {ACTION_USE, OBJECT_REDSHIRT, OBJECT_THROWN_FERN, 0}, &Room::feather5UseCrewmanOnThrownFern },
{ {ACTION_USE, OBJECT_SPOCK, OBJECT_MONSTER, 0}, &Room::feather5UseSpockOnMonster }, { {ACTION_USE, OBJECT_SPOCK, OBJECT_MONSTER, 0}, &Room::feather5UseSpockOnMonster },
{ {ACTION_USE, OBJECT_MCCOY, OBJECT_MONSTER, 0}, &Room::feather5UseMccoyOnMonster }, { {ACTION_USE, OBJECT_MCCOY, OBJECT_MONSTER, 0}, &Room::feather5UseMccoyOnMonster },
{ {ACTION_USE, OBJECT_REDSHIRT, OBJECT_MONSTER, 0}, &Room::feather5UseRedshirtOnMonster }, { {ACTION_USE, OBJECT_REDSHIRT, OBJECT_MONSTER, 0}, &Room::feather5UseRedshirtOnMonster },

View file

@ -55,7 +55,7 @@ extern const RoomAction feather6ActionList[] = {
{ {ACTION_USE, OBJECT_IROCK, HOTSPOT_STALAGMITES, 0}, &Room::feather6UseRockOnStalagmites }, { {ACTION_USE, OBJECT_IROCK, HOTSPOT_STALAGMITES, 0}, &Room::feather6UseRockOnStalagmites },
{ {ACTION_USE, OBJECT_IROCK, HOTSPOT_EAST_EXIT, 0}, &Room::feather6UseRockOnStalagmites }, { {ACTION_USE, OBJECT_IROCK, HOTSPOT_EAST_EXIT, 0}, &Room::feather6UseRockOnStalagmites },
{ {ACTION_USE, OBJECT_IROCK, 0xff, 0}, &Room::feather6UseRockAnywhere }, { {ACTION_USE, OBJECT_IROCK, 0xff, 0}, &Room::feather6UseRockAnywhere },
{ {ACTION_USE, OBJECT_IKNIFE, HOTSPOT_STALAGMITES, 0},&Room::feather6UseKnifeOnStalagmites }, { {ACTION_USE, OBJECT_IKNIFE, HOTSPOT_STALAGMITES, 0}, &Room::feather6UseKnifeOnStalagmites },
{ {ACTION_USE, OBJECT_IKNIFE, 0xff, 0}, &Room::feather6UseKnifeAnywhere }, { {ACTION_USE, OBJECT_IKNIFE, 0xff, 0}, &Room::feather6UseKnifeAnywhere },
{ {ACTION_USE, OBJECT_IKNIFE, OBJECT_MCCOY, 0}, &Room::feather6UseKnifeOnMccoy }, { {ACTION_USE, OBJECT_IKNIFE, OBJECT_MCCOY, 0}, &Room::feather6UseKnifeOnMccoy },
{ {ACTION_USE, OBJECT_IKNIFE, OBJECT_SPOCK, 0}, &Room::feather6UseKnifeOnSpock }, { {ACTION_USE, OBJECT_IKNIFE, OBJECT_SPOCK, 0}, &Room::feather6UseKnifeOnSpock },
@ -78,14 +78,14 @@ extern const RoomAction feather6ActionList[] = {
{ {ACTION_TALK, OBJECT_MCCOY, 0, 0}, &Room::feather6TalkToMccoy }, { {ACTION_TALK, OBJECT_MCCOY, 0, 0}, &Room::feather6TalkToMccoy },
{ {ACTION_TALK, OBJECT_REDSHIRT, 0, 0}, &Room::feather6TalkToRedshirt }, { {ACTION_TALK, OBJECT_REDSHIRT, 0, 0}, &Room::feather6TalkToRedshirt },
{ {ACTION_TALK, OBJECT_SPOCK, 0, 0}, &Room::feather6TalkToSpock }, { {ACTION_TALK, OBJECT_SPOCK, 0, 0}, &Room::feather6TalkToSpock },
{ {ACTION_USE, OBJECT_IMTRICOR, HOTSPOT_EAST_EXIT, 0},&Room::feather6UseMTricorderOnEastExit }, { {ACTION_USE, OBJECT_IMTRICOR, HOTSPOT_EAST_EXIT, 0}, &Room::feather6UseMTricorderOnEastExit },
{ {ACTION_USE, OBJECT_IMTRICOR, HOTSPOT_ROCKS, 0}, &Room::feather6UseMTricorderOnRocks }, { {ACTION_USE, OBJECT_IMTRICOR, HOTSPOT_ROCKS, 0}, &Room::feather6UseMTricorderOnRocks },
{ {ACTION_USE, OBJECT_ISTRICOR, HOTSPOT_EAST_EXIT, 0},&Room::feather6UseSTricorderOnEastExit }, { {ACTION_USE, OBJECT_ISTRICOR, HOTSPOT_EAST_EXIT, 0}, &Room::feather6UseSTricorderOnEastExit },
{ {ACTION_USE, OBJECT_ISTRICOR, 0xff, 0}, &Room::feather6UseSTricorderAnywhere }, { {ACTION_USE, OBJECT_ISTRICOR, 0xff, 0}, &Room::feather6UseSTricorderAnywhere },
{ {ACTION_USE, OBJECT_ISTRICOR, HOTSPOT_ROCKS, 0}, &Room::feather6UseSTricorderOnRocks }, { {ACTION_USE, OBJECT_ISTRICOR, HOTSPOT_ROCKS, 0}, &Room::feather6UseSTricorderOnRocks },
{ {ACTION_USE, OBJECT_ISTRICOR, OBJECT_CRYSTALS, 0}, &Room::feather6UseSTricorderOnCrystals }, { {ACTION_USE, OBJECT_ISTRICOR, OBJECT_CRYSTALS, 0}, &Room::feather6UseSTricorderOnCrystals },
{ {ACTION_USE, OBJECT_ISTRICOR, HOTSPOT_STALACTITES, 0},&Room::feather6UseSTricorderOnStalactites }, { {ACTION_USE, OBJECT_ISTRICOR, HOTSPOT_STALACTITES, 0}, &Room::feather6UseSTricorderOnStalactites },
{ {ACTION_USE, OBJECT_ISTRICOR, HOTSPOT_STALAGMITES, 0},&Room::feather6UseSTricorderOnStalagmites }, { {ACTION_USE, OBJECT_ISTRICOR, HOTSPOT_STALAGMITES, 0}, &Room::feather6UseSTricorderOnStalagmites },
{ {ACTION_GET, OBJECT_CRYSTALS, 0, 0}, &Room::feather6GetCrystals }, { {ACTION_GET, OBJECT_CRYSTALS, 0, 0}, &Room::feather6GetCrystals },
{ {ACTION_USE, OBJECT_IKNIFE, OBJECT_CRYSTALS, 0}, &Room::feather6UseKnifeOnCrystals }, { {ACTION_USE, OBJECT_IKNIFE, OBJECT_CRYSTALS, 0}, &Room::feather6UseKnifeOnCrystals },

View file

@ -77,7 +77,7 @@ void Room::love1Tick1() {
common: common:
loadActorAnim(OBJECT_BOTTLE, _roomVar.love.bottleAnimation, 0xa3, 0x72, 0); loadActorAnim(OBJECT_BOTTLE, _roomVar.love.bottleAnimation, 0xa3, 0x72, 0);
// fall through // fall through
case BOTTLETYPE_NONE: case BOTTLETYPE_NONE:
break; break;
@ -308,8 +308,8 @@ void Room::love1KirkGotCureSample() {
giveItem(OBJECT_ISAMPLE); giveItem(OBJECT_ISAMPLE);
showText(TX_LOV1N035); showText(TX_LOV1N035);
// BUGFIX: after removing the cure, unset this variable. // BUGFIX: after removing the cure, unset this variable.
// Otherwise, any normal dish inserted afterward automagically becomes a cure. // Otherwise, any normal dish inserted afterward automagically becomes a cure.
_vm->_awayMission.love.chamberHasCure = false; _vm->_awayMission.love.chamberHasCure = false;
} else { } else {
giveItem(OBJECT_IDISHES); giveItem(OBJECT_IDISHES);

View file

@ -225,8 +225,7 @@ void Room::love3OpenedOrClosedServicePanel() {
showText(TX_LOV3N023); showText(TX_LOV3N023);
else else
showText(TX_LOV3N022); showText(TX_LOV3N022);
} } else
else
showText(TX_LOV3N020); showText(TX_LOV3N020);
} }
@ -246,8 +245,7 @@ void Room::love3ScrewedOrUnscrewedGasTank() {
if (!_vm->_awayMission.redshirtDead) if (!_vm->_awayMission.redshirtDead)
showText(TX_SPEAKER_FERRIS, TX_LOV3_022); showText(TX_SPEAKER_FERRIS, TX_LOV3_022);
_vm->_awayMission.love.gasTankUnscrewed = true; _vm->_awayMission.love.gasTankUnscrewed = true;
} } else {
else {
showText(TX_LOV3N015); showText(TX_LOV3N015);
_vm->_awayMission.love.gasTankUnscrewed = false; _vm->_awayMission.love.gasTankUnscrewed = false;
} }
@ -351,8 +349,7 @@ void Room::love3OpenedOrClosedGrate() {
_vm->_awayMission.love.gotPointsForOpeningGrate = true; _vm->_awayMission.love.gotPointsForOpeningGrate = true;
_vm->_awayMission.love.missionScore++; _vm->_awayMission.love.missionScore++;
} }
} } else {
else {
loadActorAnim(OBJECT_GRATE, "s3r4g1", 0x116, 0x8f, 0); loadActorAnim(OBJECT_GRATE, "s3r4g1", 0x116, 0x8f, 0);
_vm->_awayMission.love.grateRemoved = false; _vm->_awayMission.love.grateRemoved = false;
showText(TX_LOV3N032); showText(TX_LOV3N032);
@ -452,8 +449,7 @@ void Room::love3PouredRomulanLaughingGasDownShaft() {
if (_vm->_awayMission.love.romulansUnconsciousFromVirus) { if (_vm->_awayMission.love.romulansUnconsciousFromVirus) {
showText(TX_LOV3NA08); showText(TX_LOV3NA08);
_vm->_awayMission.love.romulansUnconsciousFromLaughingGas = false; _vm->_awayMission.love.romulansUnconsciousFromLaughingGas = false;
} } else {
else {
showText(TX_LOV3NA09); showText(TX_LOV3NA09);
playVoc("ROMULANL"); playVoc("ROMULANL");
} }
@ -500,8 +496,7 @@ void Room::love3ReachedGasTankUsingAntigrav() {
if (_vm->_awayMission.love.gasTankUnscrewed) { if (_vm->_awayMission.love.gasTankUnscrewed) {
loadActorAnimC(OBJECT_KIRK, "kusehe", -1, -1, &Room::love3PickedUpGasTank); loadActorAnimC(OBJECT_KIRK, "kusehe", -1, -1, &Room::love3PickedUpGasTank);
playVoc("SE3PLBAT"); playVoc("SE3PLBAT");
} } else {
else {
showText(TX_LOV3N010); showText(TX_LOV3N010);
showText(TX_SPEAKER_SPOCK, TX_LOV3_015); showText(TX_SPEAKER_SPOCK, TX_LOV3_015);
} }

View file

@ -41,8 +41,7 @@ void Room::love4Tick1() {
loadActorAnim2(OBJECT_ROMULAN_2, "s3r5r2b", 0xb9, 0xbb, 0); loadActorAnim2(OBJECT_ROMULAN_2, "s3r5r2b", 0xb9, 0xbb, 0);
loadActorAnim2(OBJECT_ROMULAN_3, "s3r5r3b", 0xef, 0xc4, 0); loadActorAnim2(OBJECT_ROMULAN_3, "s3r5r3b", 0xef, 0xc4, 0);
loadActorAnim2(OBJECT_ROMULAN_4, "s3r5r4b", 0x12a, 0xaa, 0); loadActorAnim2(OBJECT_ROMULAN_4, "s3r5r4b", 0x12a, 0xaa, 0);
} } else {
else {
loadActorAnim2(OBJECT_ROMULAN_1, "s3r5r1a", 0x36, 0xb3, 0); loadActorAnim2(OBJECT_ROMULAN_1, "s3r5r1a", 0x36, 0xb3, 0);
loadActorAnim2(OBJECT_ROMULAN_2, "s3r5r2a", 0xb9, 0xbb, 0); loadActorAnim2(OBJECT_ROMULAN_2, "s3r5r2a", 0xb9, 0xbb, 0);
loadActorAnim2(OBJECT_ROMULAN_3, "s3r5r3a", 0xef, 0xc4, 0); loadActorAnim2(OBJECT_ROMULAN_3, "s3r5r3a", 0xef, 0xc4, 0);

View file

@ -40,8 +40,7 @@ void Room::love5Tick1() {
if (_vm->_awayMission.love.freedMarcusAndCheever) { if (_vm->_awayMission.love.freedMarcusAndCheever) {
loadActorAnim(OBJECT_MARCUS, "marcusst", 0x28, 0xa6); loadActorAnim(OBJECT_MARCUS, "marcusst", 0x28, 0xa6);
loadActorAnim(OBJECT_CHEEVER, "s3gtupst", 0x49, 0xac); loadActorAnim(OBJECT_CHEEVER, "s3gtupst", 0x49, 0xac);
} } else {
else {
loadActorAnim(OBJECT_MARCUS, "marcus2", 0x28, 0xa6); loadActorAnim(OBJECT_MARCUS, "marcus2", 0x28, 0xa6);
loadActorAnim(OBJECT_CHEEVER, "s3gtup2", 0x49, 0xac); loadActorAnim(OBJECT_CHEEVER, "s3gtup2", 0x49, 0xac);
} }
@ -172,7 +171,7 @@ void Room::love5TalkToPreax() {
switch (choice) { switch (choice) {
case 1: case 1:
showText(TX_SPEAKER_MARCUS, TX_LOV5_043); showText(TX_SPEAKER_MARCUS, TX_LOV5_043);
// fall through // fall through
case 0: case 0:
showText(TX_SPEAKER_PREAX, TX_LOV5_061); showText(TX_SPEAKER_PREAX, TX_LOV5_061);
showText(TX_SPEAKER_KIRK, TX_LOV5_010); showText(TX_SPEAKER_KIRK, TX_LOV5_010);
@ -199,8 +198,7 @@ void Room::love5TalkToPreax() {
if (!_vm->_awayMission.love.spockCured) { if (!_vm->_awayMission.love.spockCured) {
showText(TX_SPEAKER_MCCOY, TX_LOV5_021); showText(TX_SPEAKER_MCCOY, TX_LOV5_021);
walkCrewmanC(OBJECT_MCCOY, 0x87, 0xc3, &Room::love5MccoyReachedSpockToCure); walkCrewmanC(OBJECT_MCCOY, 0x87, 0xc3, &Room::love5MccoyReachedSpockToCure);
} } else
else
love5EndMission(); love5EndMission();
} }
} else } else
@ -326,14 +324,12 @@ void Room::love5UseWaterOnPreax() {
_vm->_awayMission.love.missionScore++; _vm->_awayMission.love.missionScore++;
} }
loseItem(OBJECT_IH2O); loseItem(OBJECT_IH2O);
} } else {
else {
if (_vm->_awayMission.love.romulansUnconsciousFromVirus) { if (_vm->_awayMission.love.romulansUnconsciousFromVirus) {
showText(TX_SPEAKER_MCCOY, TX_LOV5_013); showText(TX_SPEAKER_MCCOY, TX_LOV5_013);
// BUGFIX: original didn't have correct speaker. Also, you shouldn't lose your // BUGFIX: original didn't have correct speaker. Also, you shouldn't lose your
// water since it's not actually used here, so a "loseItem" line was removed. // water since it's not actually used here, so a "loseItem" line was removed.
} } else {
else {
showText(TX_LOV5N017); showText(TX_LOV5N017);
if (!_vm->_awayMission.redshirtDead) { if (!_vm->_awayMission.redshirtDead) {
showText(TX_SPEAKER_FERRIS, TX_LOV5_053); showText(TX_SPEAKER_FERRIS, TX_LOV5_053);

View file

@ -67,8 +67,7 @@ void Room::loveaTimer0Expired() {
if (randomVal == 0 || _vm->_awayMission.redshirtDead) { if (randomVal == 0 || _vm->_awayMission.redshirtDead) {
speaker = TX_SPEAKER_MCCOY; speaker = TX_SPEAKER_MCCOY;
textTable = mccoyText; textTable = mccoyText;
} } else {
else {
speaker = TX_SPEAKER_FERRIS; speaker = TX_SPEAKER_FERRIS;
textTable = ferrisText; textTable = ferrisText;
} }
@ -122,8 +121,7 @@ void Room::loveaUseCureSampleOnSpock() {
if (_vm->_awayMission.love.spockCured) { if (_vm->_awayMission.love.spockCured) {
walkCrewman(OBJECT_SPOCK, _roomVar.love.cmnXPosToCureSpock, _roomVar.love.cmnYPosToCureSpock, 99); walkCrewman(OBJECT_SPOCK, _roomVar.love.cmnXPosToCureSpock, _roomVar.love.cmnYPosToCureSpock, 99);
walkCrewman(OBJECT_MCCOY, _roomVar.love.cmnXPosToCureSpock, _roomVar.love.cmnYPosToCureSpock + 10, 99); walkCrewman(OBJECT_MCCOY, _roomVar.love.cmnXPosToCureSpock, _roomVar.love.cmnYPosToCureSpock + 10, 99);
} } else
else
showText(TX_SPEAKER_MCCOY, TX_LOVA_F55); showText(TX_SPEAKER_MCCOY, TX_LOVA_F55);
} }
@ -162,20 +160,16 @@ void Room::loveaTimer2Expired() {
playMidiMusicTracks(2, -1); // FIXME: assembly had no second parameter...? playMidiMusicTracks(2, -1); // FIXME: assembly had no second parameter...?
showText(TX_GENER004); showText(TX_GENER004);
showGameOverMenu(); showGameOverMenu();
} } else if (_vm->_awayMission.love.spockInfectionCounter == 15) {
else if (_vm->_awayMission.love.spockInfectionCounter == 15) {
showText(TX_SPEAKER_SPOCK, TX_SPOKCOFF); showText(TX_SPEAKER_SPOCK, TX_SPOKCOFF);
_vm->_awayMission.love.spockInfectionCounter++; _vm->_awayMission.love.spockInfectionCounter++;
} } else if (_vm->_awayMission.love.spockInfectionCounter == 30) {
else if (_vm->_awayMission.love.spockInfectionCounter == 30) {
showText(TX_SPEAKER_MCCOY, TX_LOVA_F08); showText(TX_SPEAKER_MCCOY, TX_LOVA_F08);
_vm->_awayMission.love.spockInfectionCounter++; _vm->_awayMission.love.spockInfectionCounter++;
} } else if (_vm->_awayMission.love.spockInfectionCounter == 45) {
else if (_vm->_awayMission.love.spockInfectionCounter == 45) {
showText(TX_SPEAKER_SPOCK, TX_SPOKCOFF); showText(TX_SPEAKER_SPOCK, TX_SPOKCOFF);
_vm->_awayMission.love.spockInfectionCounter++; _vm->_awayMission.love.spockInfectionCounter++;
} } else if (_vm->_awayMission.love.spockInfectionCounter == 60) {
else if (_vm->_awayMission.love.spockInfectionCounter == 60) {
showText(TX_SPEAKER_SPOCK, TX_LOVA_F54); showText(TX_SPEAKER_SPOCK, TX_LOVA_F54);
_vm->_awayMission.love.romulansUnconsciousFromVirus = true; _vm->_awayMission.love.romulansUnconsciousFromVirus = true;
_vm->_awayMission.love.spockInfectionCounter++; _vm->_awayMission.love.spockInfectionCounter++;

View file

@ -42,10 +42,10 @@ namespace StarTrek {
void Room::mudd0Tick1() { void Room::mudd0Tick1() {
playVoc("MUD0LOOP"); playVoc("MUD0LOOP");
// NOTE: Using the floppy version's code here; Mudd disappears from this room after // NOTE: Using the floppy version's code here; Mudd disappears from this room after
// the first meeting. Fixes an issue where Mudd appears in the first room when he's // the first meeting. Fixes an issue where Mudd appears in the first room when he's
// supposed to be in the medbay. // supposed to be in the medbay.
// TODO: verify this matches with floppy version's code // TODO: verify this matches with floppy version's code
if (_vm->_awayMission.mudd.muddFirstRoomState != 0) if (_vm->_awayMission.mudd.muddFirstRoomState != 0)
_vm->_awayMission.mudd.muddFirstRoomState = 2; _vm->_awayMission.mudd.muddFirstRoomState = 2;
else { else {
@ -292,8 +292,7 @@ void Room::mudd0TalkToRedshirt() {
if (_vm->_awayMission.mudd.muddFirstRoomState == 2) { if (_vm->_awayMission.mudd.muddFirstRoomState == 2) {
showText(TX_SPEAKER_BUCHERT, TX_MUD0_039); showText(TX_SPEAKER_BUCHERT, TX_MUD0_039);
showText(TX_SPEAKER_KIRK, TX_MUD0_008); showText(TX_SPEAKER_KIRK, TX_MUD0_008);
} } else {
else {
showText(TX_SPEAKER_BUCHERT, TX_MUD0_040); showText(TX_SPEAKER_BUCHERT, TX_MUD0_040);
showText(TX_SPEAKER_MUDD, TX_MUD0_030); showText(TX_SPEAKER_MUDD, TX_MUD0_030);
showText(TX_SPEAKER_BUCHERT, TX_MUD0_041); showText(TX_SPEAKER_BUCHERT, TX_MUD0_041);

View file

@ -174,7 +174,7 @@ void Room::mudd1SpockPressedRedButton() {
case 1: case 1:
showText(TX_SPEAKER_KIRK, TX_MUD1_007); showText(TX_SPEAKER_KIRK, TX_MUD1_007);
// fall through // fall through
case 2: case 2:
_vm->_awayMission.mudd.torpedoStatus = 1; _vm->_awayMission.mudd.torpedoStatus = 1;

View file

@ -301,8 +301,7 @@ void Room::mudd2UseMedkitOnMudd() {
showText(TX_SPEAKER_MCCOY, TX_MUD2_021); showText(TX_SPEAKER_MCCOY, TX_MUD2_021);
else else
walkCrewmanC(OBJECT_MCCOY, 0xde, 0xaf, &Room::mudd2MccoyReachedMudd); walkCrewmanC(OBJECT_MCCOY, 0xde, 0xaf, &Room::mudd2MccoyReachedMudd);
} } else // Can't get to him since he's busy being crazy
else // Can't get to him since he's busy being crazy
showText(TX_SPEAKER_MCCOY, TX_MUD2_016); showText(TX_SPEAKER_MCCOY, TX_MUD2_016);
} }

View file

@ -190,8 +190,7 @@ void Room::mudd4UseKirkOnConsole() {
_vm->_awayMission.crewDirectionsAfterWalk[OBJECT_SPOCK] = DIR_N; _vm->_awayMission.crewDirectionsAfterWalk[OBJECT_SPOCK] = DIR_N;
walkCrewmanC(OBJECT_SPOCK, 0x6d, 0x9a, &Room::mudd4FinishedWalking3); walkCrewmanC(OBJECT_SPOCK, 0x6d, 0x9a, &Room::mudd4FinishedWalking3);
_vm->_awayMission.disableInput = true; _vm->_awayMission.disableInput = true;
} } else {
else {
if (!_roomVar.mudd.kirkUsingRightConsole) if (!_roomVar.mudd.kirkUsingRightConsole)
showText(TX_SPEAKER_KIRK, TX_MUD4_049); showText(TX_SPEAKER_KIRK, TX_MUD4_049);
_vm->_awayMission.crewDirectionsAfterWalk[OBJECT_KIRK] = DIR_N; _vm->_awayMission.crewDirectionsAfterWalk[OBJECT_KIRK] = DIR_N;
@ -257,8 +256,7 @@ void Room::mudd4KirkUsedViewScreen() {
_vm->_awayMission.mudd.gotPointsForEnablingViewscreen = true; _vm->_awayMission.mudd.gotPointsForEnablingViewscreen = true;
_vm->_awayMission.mudd.missionScore++; _vm->_awayMission.mudd.missionScore++;
} }
} } else {
else {
_vm->_awayMission.mudd.viewScreenEnabled = false; _vm->_awayMission.mudd.viewScreenEnabled = false;
loadActorAnim(OBJECT_VIEWSCREEN, "s4crvf", 0xa5, 0x76); loadActorAnim(OBJECT_VIEWSCREEN, "s4crvf", 0xa5, 0x76);
_vm->_awayMission.timers[3] = 5; _vm->_awayMission.timers[3] = 5;
@ -356,9 +354,9 @@ void Room::mudd4KirkReachedPositionToTalkToMudd() {
_vm->_awayMission.disableInput = false; _vm->_awayMission.disableInput = false;
if (_vm->_awayMission.mudd.discoveredLenseAndDegrimerFunction if (_vm->_awayMission.mudd.discoveredLenseAndDegrimerFunction
|| _vm->_awayMission.mudd.muddErasedDatabase || _vm->_awayMission.mudd.muddErasedDatabase
|| _vm->_awayMission.mudd.databaseDestroyed || _vm->_awayMission.mudd.databaseDestroyed
|| !_vm->_awayMission.mudd.accessedAlienDatabase) { // NOTE: why this last line? Test this... || !_vm->_awayMission.mudd.accessedAlienDatabase) { // NOTE: why this last line? Test this...
const int choices[] = { const int choices[] = {
TX_SPEAKER_KIRK, TX_SPEAKER_KIRK,
TX_MUD4_009, TX_MUD4_009,
@ -399,8 +397,7 @@ void Room::mudd4KirkReachedPositionToTalkToMudd() {
showText(TX_SPEAKER_KIRK, TX_MUD4_036); showText(TX_SPEAKER_KIRK, TX_MUD4_036);
showText(TX_SPEAKER_SPOCK, TX_MUD4_029); showText(TX_SPEAKER_SPOCK, TX_MUD4_029);
showText(TX_SPEAKER_KIRK, TX_MUD4_030); showText(TX_SPEAKER_KIRK, TX_MUD4_030);
} } else {
else {
// Mudd is forced to agree to give samples to a university. // Mudd is forced to agree to give samples to a university.
showText(TX_SPEAKER_MUDD, TX_MUD4_064); showText(TX_SPEAKER_MUDD, TX_MUD4_064);
showText(TX_SPEAKER_KIRK, TX_MUD4_012); showText(TX_SPEAKER_KIRK, TX_MUD4_012);
@ -420,8 +417,7 @@ void Room::mudd4KirkReachedPositionToTalkToMudd() {
endMission(_vm->_awayMission.mudd.missionScore, 0x1b, _vm->_awayMission.mudd.torpedoStatus); endMission(_vm->_awayMission.mudd.missionScore, 0x1b, _vm->_awayMission.mudd.torpedoStatus);
} }
} } else {
else {
const int choices[] = { const int choices[] = {
TX_SPEAKER_KIRK, TX_SPEAKER_KIRK,
TX_MUD4_014, TX_MUD4_014,

View file

@ -119,12 +119,12 @@ void Room::muddaTick() {
/* /*
// Unused: The positions to they originally walked to before collapsing. // Unused: The positions to they originally walked to before collapsing.
const Common::Point deathPositions[][4] = { const Common::Point deathPositions[][4] = {
{ Common::Point(0xbb, 0x8d), Common::Point(0xd0, 0x89), Common::Point(0xaa, 0x85), Common::Point(0xbf, 0x83) }, { Common::Point(0xbb, 0x8d), Common::Point(0xd0, 0x89), Common::Point(0xaa, 0x85), Common::Point(0xbf, 0x83) },
{ Common::Point(0xaa, 0xa5), Common::Point(0x83, 0xac), Common::Point(-1, -1), Common::Point(-1, -1) }, { Common::Point(0xaa, 0xa5), Common::Point(0x83, 0xac), Common::Point(-1, -1), Common::Point(-1, -1) },
{ Common::Point(0x108, 0xbb), Common::Point(0x118, 0xc4), Common::Point(0xfe, 0xb2), Common::Point(0x117, 0xae) }, { Common::Point(0x108, 0xbb), Common::Point(0x118, 0xc4), Common::Point(0xfe, 0xb2), Common::Point(0x117, 0xae) },
{ Common::Point(0xf1, 0x95), Common::Point(0xcd, 0x87), Common::Point(0xec, 0x84), Common::Point(0x110, 0xa6) }, { Common::Point(0xf1, 0x95), Common::Point(0xcd, 0x87), Common::Point(0xec, 0x84), Common::Point(0x110, 0xa6) },
{ Common::Point(0x8b, 0xb6), Common::Point(0x69, 0xb7), Common::Point(-1, -1), Common::Point(-1, -1) }, { Common::Point(0x8b, 0xb6), Common::Point(0x69, 0xb7), Common::Point(-1, -1), Common::Point(-1, -1) },
{ Common::Point(0x8b, 0xac), Common::Point(0x6f, 0x99), Common::Point(-1, -1), Common::Point(-1, -1) }, { Common::Point(0x8b, 0xac), Common::Point(0x6f, 0x99), Common::Point(-1, -1), Common::Point(-1, -1) },
}; };
*/ */

View file

@ -461,7 +461,7 @@ void Room::trial5ReachedHoleToPutGem() {
Common::Point(0x22, 0x95), Common::Point(0x22, 0x95),
Common::Point(0x3c, 0x95), Common::Point(0x3c, 0x95),
}; };
const char * const gemAnims[] = { const char *const gemAnims[] = {
"RedGem1", "RedGem2", "RedGem3", "RedGem1", "RedGem2", "RedGem3",
"GrnGem1", "GrnGem2", "GrnGem3", "GrnGem1", "GrnGem2", "GrnGem3",
"BluGem1", "BluGem2", "BluGem3", "BluGem1", "BluGem2", "BluGem3",

View file

@ -139,8 +139,7 @@ void Room::tug2GetBomb() {
_vm->_awayMission.disableInput = true; _vm->_awayMission.disableInput = true;
_vm->_awayMission.crewDirectionsAfterWalk[OBJECT_KIRK] = DIR_N; _vm->_awayMission.crewDirectionsAfterWalk[OBJECT_KIRK] = DIR_N;
walkCrewman(OBJECT_KIRK, 0xc9, 0xa0, 12); walkCrewman(OBJECT_KIRK, 0xc9, 0xa0, 12);
} } else
else
showText(TX_TUG2N024); showText(TX_TUG2N024);
} }
@ -297,8 +296,7 @@ void Room::tug2KirkGotWires() {
_vm->_awayMission.tug.gotWires = true; _vm->_awayMission.tug.gotWires = true;
_vm->_awayMission.disableInput = false; _vm->_awayMission.disableInput = false;
_vm->_awayMission.tug.missionScore += 3; _vm->_awayMission.tug.missionScore += 3;
} } else {
else {
loadActorStandAnim(OBJECT_WIRE); loadActorStandAnim(OBJECT_WIRE);
giveItem(OBJECT_IWIRING); giveItem(OBJECT_IWIRING);
_vm->_awayMission.tug.gotWires = true; _vm->_awayMission.tug.gotWires = true;
@ -368,8 +366,7 @@ void Room::tug2TurnedOffForceField() {
loadActorAnim2(OBJECT_BOMB, "t2bbo", -3, 1, 0); loadActorAnim2(OBJECT_BOMB, "t2bbo", -3, 1, 0);
// FIXME: doesn't play "PHASSHOT" sound effect like when kirk removes wires? // FIXME: doesn't play "PHASSHOT" sound effect like when kirk removes wires?
_vm->_awayMission.tug.field35 = 6; _vm->_awayMission.tug.field35 = 6;
} } else if (_vm->_awayMission.tug.field35 == 4 && !_vm->_awayMission.tug.brigForceFieldDown) {
else if (_vm->_awayMission.tug.field35 == 4 && !_vm->_awayMission.tug.brigForceFieldDown) {
_vm->_awayMission.tug.brigForceFieldDown = true; _vm->_awayMission.tug.brigForceFieldDown = true;
loadActorAnim2(OBJECT_BRIG, "fld10", 0, 0, 2); loadActorAnim2(OBJECT_BRIG, "fld10", 0, 0, 2);
_vm->_awayMission.tug.missionScore += 6; _vm->_awayMission.tug.missionScore += 6;
@ -459,7 +456,7 @@ void Room::tug2UseStunPhaserOnGuard2() {
} }
void Room::tug2KirkShootGuard2() { void Room::tug2KirkShootGuard2() {
if (_vm->_awayMission.tug.guard2Status == GUARDSTAT_UP){ if (_vm->_awayMission.tug.guard2Status == GUARDSTAT_UP) {
loadActorAnim2(OBJECT_GUARD_2, "p6stun", -1, -1, 0); loadActorAnim2(OBJECT_GUARD_2, "p6stun", -1, -1, 0);
_vm->_awayMission.tug.guard2Status = GUARDSTAT_STUNNED; _vm->_awayMission.tug.guard2Status = GUARDSTAT_STUNNED;
playSoundEffectIndex(SND_PHASSHOT); playSoundEffectIndex(SND_PHASSHOT);
@ -487,7 +484,7 @@ void Room::tug2UseKillPhaserOnGuard1() {
} }
void Room::tug2KirkKillGuard1() { void Room::tug2KirkKillGuard1() {
if (_vm->_awayMission.tug.guard1Status == GUARDSTAT_UP){ if (_vm->_awayMission.tug.guard1Status == GUARDSTAT_UP) {
loadActorAnim2(OBJECT_GUARD_1, "p5kill", -1, -1, 0); loadActorAnim2(OBJECT_GUARD_1, "p5kill", -1, -1, 0);
_vm->_awayMission.tug.guard1Status = GUARDSTAT_DEAD; _vm->_awayMission.tug.guard1Status = GUARDSTAT_DEAD;
playSoundEffectIndex(SND_PHASSHOT); playSoundEffectIndex(SND_PHASSHOT);
@ -515,7 +512,7 @@ void Room::tug2UseKillPhaserOnGuard2() {
} }
void Room::tug2KirkKillGuard2() { void Room::tug2KirkKillGuard2() {
if (_vm->_awayMission.tug.guard2Status == GUARDSTAT_UP){ if (_vm->_awayMission.tug.guard2Status == GUARDSTAT_UP) {
loadActorAnim2(OBJECT_GUARD_2, "p6kill", -1, -1, 0); loadActorAnim2(OBJECT_GUARD_2, "p6kill", -1, -1, 0);
_vm->_awayMission.tug.guard2Status = GUARDSTAT_DEAD; _vm->_awayMission.tug.guard2Status = GUARDSTAT_DEAD;
playSoundEffectIndex(SND_PHASSHOT); playSoundEffectIndex(SND_PHASSHOT);
@ -688,8 +685,7 @@ void Room::tug2Timer0Expired() {
_roomVar.tug2.shootingTarget = OBJECT_SPOCK; _roomVar.tug2.shootingTarget = OBJECT_SPOCK;
_vm->_awayMission.timers[2] = 40; _vm->_awayMission.timers[2] = 40;
tug2GuardShootsCrewman(); tug2GuardShootsCrewman();
} } else if (_roomVar.tug2.shootKirkOverride) {
else if (_roomVar.tug2.shootKirkOverride) {
tug2DetermineElasiShooter(); tug2DetermineElasiShooter();
_roomVar.tug2.shootingTarget = OBJECT_KIRK; _roomVar.tug2.shootingTarget = OBJECT_KIRK;
_vm->_awayMission.timers[2] = 40; // TODO _vm->_awayMission.timers[2] = 40; // TODO
@ -738,8 +734,7 @@ void Room::tug2GuardShootsCrewman() {
bitmapArray = g1ShotsOnKill; bitmapArray = g1ShotsOnKill;
else else
bitmapArray = g2ShotsOnKill; bitmapArray = g2ShotsOnKill;
} } else {
else {
anim = "_stune"; anim = "_stune";
if (_roomVar.tug2.shootingObject == OBJECT_GUARD_1) if (_roomVar.tug2.shootingObject == OBJECT_GUARD_1)
bitmapArray = g1ShotsOnStun; bitmapArray = g1ShotsOnStun;

View file

@ -208,8 +208,8 @@ void Room::tug3ElasiStunnedOrKilled() {
if (_vm->_awayMission.tug.bridgeWinMethod == 1) if (_vm->_awayMission.tug.bridgeWinMethod == 1)
return; return;
if (_vm->_awayMission.tug.bridgeElasi1Status == GUARDSTAT_UP || _vm->_awayMission.tug.bridgeElasi2Status == GUARDSTAT_UP if (_vm->_awayMission.tug.bridgeElasi1Status == GUARDSTAT_UP || _vm->_awayMission.tug.bridgeElasi2Status == GUARDSTAT_UP
|| _vm->_awayMission.tug.bridgeElasi3Status == GUARDSTAT_UP || _vm->_awayMission.tug.bridgeElasi4Status == GUARDSTAT_UP) || _vm->_awayMission.tug.bridgeElasi3Status == GUARDSTAT_UP || _vm->_awayMission.tug.bridgeElasi4Status == GUARDSTAT_UP)
return; return;
// BUGFIX: if the ship is deorbiting, the mission isn't won yet. // BUGFIX: if the ship is deorbiting, the mission isn't won yet.
if (_vm->_awayMission.tug.orbitalDecayCounter != 0) if (_vm->_awayMission.tug.orbitalDecayCounter != 0)
@ -342,15 +342,13 @@ void Room::tug3TalkToMccoy() {
if (_vm->_awayMission.tug.orbitalDecayCounter >= 10) { if (_vm->_awayMission.tug.orbitalDecayCounter >= 10) {
if (_vm->_awayMission.tug.orbitalDecayCounter < 16) if (_vm->_awayMission.tug.orbitalDecayCounter < 16)
showText(TX_SPEAKER_MCCOY, TX_TUG3_011); showText(TX_SPEAKER_MCCOY, TX_TUG3_011);
} } else if (_vm->_awayMission.tug.orbitalDecayCounter != 0) {
else if (_vm->_awayMission.tug.orbitalDecayCounter != 0) {
// BUGFIX: original game displays a blank textbox. An appropriate audio file // BUGFIX: original game displays a blank textbox. An appropriate audio file
// exists, but the corresponding text was written from scratch for ScummVM. // exists, but the corresponding text was written from scratch for ScummVM.
// TODO: check if original floppy version has text for this. // TODO: check if original floppy version has text for this.
showText(TX_SPEAKER_MCCOY, TX_TUG3_012); showText(TX_SPEAKER_MCCOY, TX_TUG3_012);
} }
} } else
else
showText(TX_SPEAKER_MCCOY, TX_TUG3_013); showText(TX_SPEAKER_MCCOY, TX_TUG3_013);
} }
@ -359,8 +357,7 @@ void Room::tug3TalkToSpock() {
if (_vm->_awayMission.tug.orbitalDecayCounter >= 10) { if (_vm->_awayMission.tug.orbitalDecayCounter >= 10) {
if (_vm->_awayMission.tug.orbitalDecayCounter < 16) if (_vm->_awayMission.tug.orbitalDecayCounter < 16)
showText(TX_SPEAKER_SPOCK, TX_TUG3_008); showText(TX_SPEAKER_SPOCK, TX_TUG3_008);
} } else
else
showText(TX_SPEAKER_SPOCK, TX_TUG3_009); showText(TX_SPEAKER_SPOCK, TX_TUG3_009);
} }
} }
@ -382,15 +379,14 @@ void Room::tug3UseCommunicator() {
// BUGFIX: if still fighting the elasi, the mission isn't done yet. // BUGFIX: if still fighting the elasi, the mission isn't done yet.
_vm->_awayMission.tug.orbitalDecayCounter = 0; _vm->_awayMission.tug.orbitalDecayCounter = 0;
if (!_vm->_awayMission.tug.elasiSurrendered && if (!_vm->_awayMission.tug.elasiSurrendered &&
(_vm->_awayMission.tug.bridgeElasi1Status == GUARDSTAT_UP (_vm->_awayMission.tug.bridgeElasi1Status == GUARDSTAT_UP
|| _vm->_awayMission.tug.bridgeElasi2Status == GUARDSTAT_UP || _vm->_awayMission.tug.bridgeElasi2Status == GUARDSTAT_UP
|| _vm->_awayMission.tug.bridgeElasi3Status == GUARDSTAT_UP || _vm->_awayMission.tug.bridgeElasi3Status == GUARDSTAT_UP
|| _vm->_awayMission.tug.bridgeElasi4Status == GUARDSTAT_UP)) || _vm->_awayMission.tug.bridgeElasi4Status == GUARDSTAT_UP))
return; return;
tug3EndMission(); tug3EndMission();
} } else {
else {
if (_vm->_awayMission.tug.orbitalDecayCounter < 16) { if (_vm->_awayMission.tug.orbitalDecayCounter < 16) {
showText(TX_SPEAKER_KIRK, TX_TUG3_006); showText(TX_SPEAKER_KIRK, TX_TUG3_006);
showText(TX_SPEAKER_SCOTT, TX_TUG3_S07); showText(TX_SPEAKER_SCOTT, TX_TUG3_S07);
@ -429,24 +425,20 @@ void Room::tug3Timer0Expired() {
_vm->_awayMission.redshirtDead = true; _vm->_awayMission.redshirtDead = true;
loadActorAnim2(OBJECT_REDSHIRT, "rkills", -1, -1, 0); loadActorAnim2(OBJECT_REDSHIRT, "rkills", -1, -1, 0);
elasiTarget = OBJECT_REDSHIRT; elasiTarget = OBJECT_REDSHIRT;
} } else if (!_vm->_awayMission.tug.crewmanKilled[OBJECT_KIRK]) {
else if (!_vm->_awayMission.tug.crewmanKilled[OBJECT_KIRK]) {
_vm->_awayMission.tug.crewmanKilled[OBJECT_KIRK] = 2; _vm->_awayMission.tug.crewmanKilled[OBJECT_KIRK] = 2;
_vm->_awayMission.disableInput = true; _vm->_awayMission.disableInput = true;
loadActorAnim2(OBJECT_KIRK, "kkills", -1, -1, 0); loadActorAnim2(OBJECT_KIRK, "kkills", -1, -1, 0);
elasiTarget = OBJECT_KIRK; elasiTarget = OBJECT_KIRK;
} } else if (!_vm->_awayMission.tug.crewmanKilled[OBJECT_SPOCK]) {
else if (!_vm->_awayMission.tug.crewmanKilled[OBJECT_SPOCK]) {
_vm->_awayMission.tug.crewmanKilled[OBJECT_SPOCK] = 2; _vm->_awayMission.tug.crewmanKilled[OBJECT_SPOCK] = 2;
loadActorAnim2(OBJECT_SPOCK, "skills", -1, -1, 0); loadActorAnim2(OBJECT_SPOCK, "skills", -1, -1, 0);
elasiTarget = OBJECT_SPOCK; elasiTarget = OBJECT_SPOCK;
} } else if (!_vm->_awayMission.tug.crewmanKilled[OBJECT_MCCOY]) {
else if (!_vm->_awayMission.tug.crewmanKilled[OBJECT_MCCOY]) {
_vm->_awayMission.tug.crewmanKilled[OBJECT_MCCOY] = 2; _vm->_awayMission.tug.crewmanKilled[OBJECT_MCCOY] = 2;
loadActorAnim2(OBJECT_MCCOY, "mkills", -1, -1, 13); loadActorAnim2(OBJECT_MCCOY, "mkills", -1, -1, 13);
elasiTarget = OBJECT_MCCOY; elasiTarget = OBJECT_MCCOY;
} } else
else
return; return;
playSoundEffectIndex(SND_PHASSHOT); playSoundEffectIndex(SND_PHASSHOT);
@ -465,13 +457,11 @@ void Room::tug3Timer1Expired() {
showText(TX_SPEAKER_SHIPS_COMPUTER, TX_COMPU182); showText(TX_SPEAKER_SHIPS_COMPUTER, TX_COMPU182);
_vm->_awayMission.timers[1] = 100; _vm->_awayMission.timers[1] = 100;
_vm->_awayMission.tug.orbitalDecayCounter++; _vm->_awayMission.tug.orbitalDecayCounter++;
} } else if (_vm->_awayMission.tug.orbitalDecayCounter < 16) { // Decay now unavoidable
else if (_vm->_awayMission.tug.orbitalDecayCounter < 16) { // Decay now unavoidable
showText(TX_SPEAKER_SHIPS_COMPUTER, TX_COMPU181); showText(TX_SPEAKER_SHIPS_COMPUTER, TX_COMPU181);
_vm->_awayMission.timers[1] = 100; _vm->_awayMission.timers[1] = 100;
_vm->_awayMission.tug.orbitalDecayCounter++; _vm->_awayMission.tug.orbitalDecayCounter++;
} } else { // Game over
else { // Game over
showText(TX_TUG3N006); showText(TX_TUG3N006);
showGameOverMenu(); showGameOverMenu();
} }

View file

@ -157,13 +157,11 @@ bool StarTrekEngine::loadGame(int slot) {
a->sprite.setBitmap(loadAnimationFrame(a->bitmapFilename, a->scale)); a->sprite.setBitmap(loadAnimationFrame(a->bitmapFilename, a->scale));
} }
} }
} } else if (_gameMode == -1) {
else if (_gameMode == -1) {
initBridge(true); initBridge(true);
_lastGameMode = GAMEMODE_BRIDGE; _lastGameMode = GAMEMODE_BRIDGE;
// TODO: mode change // TODO: mode change
} } else {
else {
_txtFilename = _missionToLoad; _txtFilename = _missionToLoad;
initBridge(false); initBridge(false);
// TODO: mode change // TODO: mode change
@ -300,8 +298,7 @@ bool StarTrekEngine::saveOrLoadGameData(Common::SeekableReadStream *in, Common::
a.saveLoadWithSerializer(ser); a.saveLoadWithSerializer(ser);
_actionQueue.push(a); _actionQueue.push(a);
} }
} } else { // Saving
else { // Saving
int16 n = _actionQueue.size(); int16 n = _actionQueue.size();
ser.syncAsSint16LE(n); ser.syncAsSint16LE(n);
for (int i = 0; i < n; i++) { for (int i = 0; i < n; i++) {
@ -347,8 +344,7 @@ bool saveOrLoadMetadata(Common::SeekableReadStream *in, Common::WriteStream *out
if (ser.isLoading()) { if (ser.isLoading()) {
if (!::Graphics::loadThumbnail(*in, meta->thumbnail)) if (!::Graphics::loadThumbnail(*in, meta->thumbnail))
meta->thumbnail = nullptr; meta->thumbnail = nullptr;
} } else
else
::Graphics::saveThumbnail(*out); ::Graphics::saveThumbnail(*out);
// Creation date/time // Creation date/time

View file

@ -80,7 +80,7 @@ Sound::~Sound() {
void Sound::clearAllMidiSlots() { void Sound::clearAllMidiSlots() {
for (int i=0; i < NUM_MIDI_SLOTS; i++) { for (int i = 0; i < NUM_MIDI_SLOTS; i++) {
clearMidiSlot(i); clearMidiSlot(i);
} }
} }
@ -235,7 +235,7 @@ void Sound::playSpeech(const Common::String &basename) {
i++; i++;
} }
Common::String filename = "voc/" + Common::String(name.c_str(), name.c_str()+i) + ".voc"; Common::String filename = "voc/" + Common::String(name.c_str(), name.c_str() + i) + ".voc";
debugC(5, kDebugSound, "Playing speech '%s'", filename.c_str()); debugC(5, kDebugSound, "Playing speech '%s'", filename.c_str());
Common::SeekableReadStream *readStream = SearchMan.createReadStreamForMember(filename); Common::SeekableReadStream *readStream = SearchMan.createReadStreamForMember(filename);
if (readStream == nullptr) if (readStream == nullptr)
@ -300,8 +300,7 @@ void Sound::setSfxEnabled(bool enable) {
if (!enable) { if (!enable) {
stopAllVocSounds(); stopAllVocSounds();
} } else if (!_loopingAudioName.empty()) {
else if (!_loopingAudioName.empty()) {
playVoc(_loopingAudioName); playVoc(_loopingAudioName);
} }
} }
@ -319,24 +318,24 @@ void Sound::loadPCMusicFile(const Common::String &baseSoundName) {
soundName += '.'; soundName += '.';
switch (MidiDriver::getMusicType(_midiDevice)) { switch (MidiDriver::getMusicType(_midiDevice)) {
case MT_MT32: case MT_MT32:
if (_vm->getFeatures() & GF_DEMO) if (_vm->getFeatures() & GF_DEMO)
soundName += "ROL"; soundName += "ROL";
else else
soundName += "MT"; soundName += "MT";
break; break;
case MT_PCSPK: case MT_PCSPK:
if (_vm->getFeatures() & GF_DEMO) if (_vm->getFeatures() & GF_DEMO)
return; // Not supported... return; // Not supported...
else else
soundName += "PC"; soundName += "PC";
break; break;
default: default:
if (_vm->getFeatures() & GF_DEMO) if (_vm->getFeatures() & GF_DEMO)
soundName += "ADL"; soundName += "ADL";
else else
soundName += "AD"; soundName += "AD";
break; break;
} }
debugC(5, kDebugSound, "Loading midi \'%s\'\n", soundName.c_str()); debugC(5, kDebugSound, "Loading midi \'%s\'\n", soundName.c_str());
@ -359,7 +358,7 @@ void Sound::clearMidiSlot(int slot) {
// Static callback method // Static callback method
void Sound::midiDriverCallback(void *data) { void Sound::midiDriverCallback(void *data) {
Sound *s = (Sound*)data; Sound *s = (Sound *)data;
for (int i = 0; i < NUM_MIDI_SLOTS; i++) for (int i = 0; i < NUM_MIDI_SLOTS; i++)
s->_midiSlots[i].midiParser->onTimer(); s->_midiSlots[i].midiParser->onTimer();

View file

@ -30,7 +30,7 @@
#include "audio/mixer.h" #include "audio/mixer.h"
namespace Common { namespace Common {
class MacResManager; class MacResManager;
} }
namespace StarTrek { namespace StarTrek {
@ -142,7 +142,7 @@ private:
// MIDI-Related Variables // MIDI-Related Variables
MidiDriver *_midiDriver; MidiDriver *_midiDriver;
MidiPlaybackSlot _midiSlots[NUM_MIDI_SLOTS]; // 0 is for music; 1-7 are for sfx MidiPlaybackSlot _midiSlots[NUM_MIDI_SLOTS]; // 0 is for music; 1-7 are for sfx
Common::List<MidiPlaybackSlot*> _midiSlotList; // Sorts midi slots by most recently used Common::List<MidiPlaybackSlot *> _midiSlotList; // Sorts midi slots by most recently used
byte *loadedSoundData; byte *loadedSoundData;
uint32 _midiDevice; uint32 _midiDevice;

View file

@ -101,7 +101,7 @@ void StarTrekEngine::drawStarfield() {
Point3 point2 = matrixMult(p, _starPositionMatrix); Point3 point2 = matrixMult(p, _starPositionMatrix);
if (point2.z > _flt_50898 && point2.z < 0x3fff if (point2.z > _flt_50898 && point2.z < 0x3fff
&& abs(point2.x) < point2.z && abs(point2.y) < point2.z) { && abs(point2.x) < point2.z && abs(point2.y) < point2.z) {
int16 x = _starfieldXVar1 + scaleSpacePosition(point2.x, point2.z); int16 x = _starfieldXVar1 + scaleSpacePosition(point2.x, point2.z);
int16 y = _starfieldYVar1 - scaleSpacePosition(point2.y, point2.z); int16 y = _starfieldYVar1 - scaleSpacePosition(point2.y, point2.z);

View file

@ -30,7 +30,7 @@ Sprite::Sprite() :
bitmap(), drawMode(0), textColor(0), bitmapChanged(false), bitmap(), drawMode(0), textColor(0), bitmapChanged(false),
rect2Valid(false), isOnScreen(false), field16(false), lastDrawRect(), rect2Valid(false), isOnScreen(false), field16(false), lastDrawRect(),
drawRect(), rectangle2(), drawX(0), drawY(0) drawRect(), rectangle2(), drawX(0), drawY(0)
{} {}
void Sprite::setBitmap(SharedPtr<Bitmap> b) { void Sprite::setBitmap(SharedPtr<Bitmap> b) {
bitmap = b; bitmap = b;

View file

@ -57,7 +57,7 @@ struct Sprite : Common::Serializable {
Common::Rect lastDrawRect; // Rect encompassing the sprite last time it was drawn Common::Rect lastDrawRect; // Rect encompassing the sprite last time it was drawn
Common::Rect drawRect; // Rect encompassing the sprite currently Common::Rect drawRect; // Rect encompassing the sprite currently
Common::Rect rectangle2; Common::Rect rectangle2;
int16 drawX,drawY; int16 drawX, drawY;
Sprite(); Sprite();

View file

@ -454,8 +454,7 @@ void StarTrekEngine::runTransportSequence(const Common::String &name) {
if (_missionToLoad.equalsIgnoreCase("feather") && name[4] == 'b') { if (_missionToLoad.equalsIgnoreCase("feather") && name[4] == 'b') {
loadActorAnim(9, "qteleb", 0x61, 0x79, 1.0); loadActorAnim(9, "qteleb", 0x61, 0x79, 1.0);
} } else if (_missionToLoad.equalsIgnoreCase("trial")) {
else if (_missionToLoad.equalsIgnoreCase("trial")) {
if (name[4] == 'd') { if (name[4] == 'd') {
loadActorAnim(9, "qteled", 0x61, 0x79, 1.0); loadActorAnim(9, "qteled", 0x61, 0x79, 1.0);
} }
@ -548,7 +547,7 @@ void StarTrekEngine::playSoundEffectIndex(int index) {
_sound->playVoc("WARP"); _sound->playVoc("WARP");
break; break;
default: default:
break; break;
} }
} }
@ -585,15 +584,13 @@ int StarTrekEngine::loadActorAnim(int actorIndex, const Common::String &animName
if (actorIndex == -1) { if (actorIndex == -1) {
// TODO // TODO
warning("loadActorAnim: actor == -1"); warning("loadActorAnim: actor == -1");
} } else
else
actor = &_actorList[actorIndex]; actor = &_actorList[actorIndex];
if (actor->spriteDrawn) { if (actor->spriteDrawn) {
releaseAnim(actor); releaseAnim(actor);
drawActorToScreen(actor, animName, x, y, scale, false); drawActorToScreen(actor, animName, x, y, scale, false);
} } else {
else {
drawActorToScreen(actor, animName, x, y, scale, true); drawActorToScreen(actor, animName, x, y, scale, true);
} }
@ -634,8 +631,7 @@ bool StarTrekEngine::actorWalkToPosition(int actorIndex, const Common::String &a
chooseActorDirectionForWalking(actor, srcX, srcY, destX, destY); chooseActorDirectionForWalking(actor, srcX, srcY, destX, destY);
updateActorPositionWhileWalking(actor, (actor->granularPosX + 0.5).toInt(), (actor->granularPosY + 0.5).toInt()); updateActorPositionWhileWalking(actor, (actor->granularPosX + 0.5).toInt(), (actor->granularPosY + 0.5).toInt());
return true; return true;
} } else {
else {
actor->iwSrcPosition = _iwFile->getClosestKeyPosition(srcX, srcY); actor->iwSrcPosition = _iwFile->getClosestKeyPosition(srcX, srcY);
actor->iwDestPosition = _iwFile->getClosestKeyPosition(destX, destY); actor->iwDestPosition = _iwFile->getClosestKeyPosition(destX, destY);
@ -648,8 +644,7 @@ bool StarTrekEngine::actorWalkToPosition(int actorIndex, const Common::String &a
initStandAnim(actorIndex); initStandAnim(actorIndex);
return false; return false;
} } else {
else {
Common::Point iwSrc = _iwFile->_keyPositions[actor->iwSrcPosition]; Common::Point iwSrc = _iwFile->_keyPositions[actor->iwSrcPosition];
chooseActorDirectionForWalking(actor, srcX, srcY, iwSrc.x, iwSrc.y); chooseActorDirectionForWalking(actor, srcX, srcY, iwSrc.x, iwSrc.y);
updateActorPositionWhileWalking(actor, (actor->granularPosX + 0.5).toInt(), (actor->granularPosY + 0.5).toInt()); updateActorPositionWhileWalking(actor, (actor->granularPosX + 0.5).toInt(), (actor->granularPosY + 0.5).toInt());
@ -687,8 +682,7 @@ void StarTrekEngine::updateActorAnimations() {
removeActorFromScreen(i); removeActorFromScreen(i);
else else
initStandAnim(i); initStandAnim(i);
} } else {
else {
Sprite *sprite = &actor->sprite; Sprite *sprite = &actor->sprite;
actor->animFile->seek(actor->animFrame * 22, SEEK_SET); actor->animFile->seek(actor->animFrame * 22, SEEK_SET);
@ -742,8 +736,7 @@ void StarTrekEngine::updateActorAnimations() {
actor->granularPosY = newY; actor->granularPosY = newY;
actor->frameToStartNextAnim = _frameIndex; actor->frameToStartNextAnim = _frameIndex;
} }
} } else { // actor->field90 == 0
else { // actor->field90 == 0
if (actor->iwSrcPosition == -1) { if (actor->iwSrcPosition == -1) {
if (actor->triggerActionWhenAnimFinished) { if (actor->triggerActionWhenAnimFinished) {
actor->triggerActionWhenAnimFinished = false; actor->triggerActionWhenAnimFinished = false;
@ -753,15 +746,13 @@ void StarTrekEngine::updateActorAnimations() {
actor->sprite.bitmap.reset(); actor->sprite.bitmap.reset();
updateActorPositionWhileWalking(actor, (actor->granularPosX + 0.5).toInt(), (actor->granularPosY + 0.5).toInt()); updateActorPositionWhileWalking(actor, (actor->granularPosX + 0.5).toInt(), (actor->granularPosY + 0.5).toInt());
initStandAnim(i); initStandAnim(i);
} } else { // actor->iwSrcPosition != -1
else { // actor->iwSrcPosition != -1
if (actor->iwSrcPosition == actor->iwDestPosition) { if (actor->iwSrcPosition == actor->iwDestPosition) {
actor->animationString2[strlen(actor->animationString2) - 1] = '\0'; actor->animationString2[strlen(actor->animationString2) - 1] = '\0';
actor->iwDestPosition = -1; actor->iwDestPosition = -1;
actor->iwSrcPosition = -1; actor->iwSrcPosition = -1;
chooseActorDirectionForWalking(actor, actor->pos.x, actor->pos.y, actor->dest.x, actor->dest.y); chooseActorDirectionForWalking(actor, actor->pos.x, actor->pos.y, actor->dest.x, actor->dest.y);
} } else {
else {
int index = _iwFile->_iwEntries[actor->iwSrcPosition][actor->iwDestPosition]; int index = _iwFile->_iwEntries[actor->iwSrcPosition][actor->iwDestPosition];
actor->iwSrcPosition = index; actor->iwSrcPosition = index;
Common::Point dest = _iwFile->_keyPositions[actor->iwSrcPosition]; Common::Point dest = _iwFile->_keyPositions[actor->iwSrcPosition];
@ -951,8 +942,7 @@ void StarTrekEngine::chooseActorDirectionForWalking(Actor *actor, int16 srcX, in
actor->speedY = Fixed16(distY) / absDistX; actor->speedY = Fixed16(distY) / absDistX;
} }
} } else {
else {
char d; char d;
if (distY > 0) if (distY > 0)
d = 'S'; d = 'S';
@ -999,8 +989,7 @@ bool StarTrekEngine::directPathExists(int16 srcX, int16 srcY, int16 destX, int16
speedX = 1.0; speedX = 1.0;
else else
speedX = -1.0; speedX = -1.0;
} } else { // absDistX <= absDistY
else { // absDistX <= absDistY
distCounter = absDistY; distCounter = absDistY;
if (distCounter == 0) if (distCounter == 0)
@ -1059,15 +1048,14 @@ int StarTrekEngine::findObjectAt(int x, int y) {
if ((word & actionBit) && isPointInPolygon((int16 *)(_room->_rdfData + offset + 6), x, y)) { if ((word & actionBit) && isPointInPolygon((int16 *)(_room->_rdfData + offset + 6), x, y)) {
int actorIndex = _room->readRdfWord(offset + 6); int actorIndex = _room->readRdfWord(offset + 6);
_objectHasWalkPosition = true; _objectHasWalkPosition = true;
_objectWalkPosition.x = _room->readRdfWord(offset + 2); _objectWalkPosition.x = _room->readRdfWord(offset + 2);
_objectWalkPosition.y = _room->readRdfWord(offset + 4); _objectWalkPosition.y = _room->readRdfWord(offset + 4);
return actorIndex; return actorIndex;
} }
int numVertices = _room->readRdfWord(offset + 8); int numVertices = _room->readRdfWord(offset + 8);
offset = offset + 10 + numVertices * 4; offset = offset + 10 + numVertices * 4;
} } else {
else {
if (isPointInPolygon((int16 *)(_room->_rdfData + offset), x, y)) { if (isPointInPolygon((int16 *)(_room->_rdfData + offset), x, y)) {
int actorIndex = _room->readRdfWord(offset); int actorIndex = _room->readRdfWord(offset);
return actorIndex; return actorIndex;
@ -1090,12 +1078,11 @@ SharedPtr<Bitmap> StarTrekEngine::loadAnimationFrame(const Common::String &filen
char c = filename[0]; char c = filename[0];
if ((strcmp(basename, "stnd") == 0 || strcmp(basename, "tele") == 0) if ((strcmp(basename, "stnd") == 0 || strcmp(basename, "tele") == 0)
&& (c == 'm' || c == 's' || c == 'k' || c == 'r')) { && (c == 'm' || c == 's' || c == 'k' || c == 'r')) {
if (c == 'm') { if (c == 'm') {
// Mccoy has the "base" animations for all crewmen // Mccoy has the "base" animations for all crewmen
bitmapToReturn = _gfx->loadBitmap(filename); bitmapToReturn = _gfx->loadBitmap(filename);
} } else {
else {
// All crewman other than mccoy copy the animation frames from mccoy, change // All crewman other than mccoy copy the animation frames from mccoy, change
// the colors of the uniforms, and load an "xor" file to redraw the face. // the colors of the uniforms, and load an "xor" file to redraw the face.
@ -1131,8 +1118,7 @@ SharedPtr<Bitmap> StarTrekEngine::loadAnimationFrame(const Common::String &filen
if (colorShift == 0) { if (colorShift == 0) {
memcpy(bitmapToReturn->pixels, bitmap->pixels, width * height); memcpy(bitmapToReturn->pixels, bitmap->pixels, width * height);
} } else {
else {
byte *src = bitmap->pixels; byte *src = bitmap->pixels;
byte *dest = bitmapToReturn->pixels; byte *dest = bitmapToReturn->pixels;
byte baseUniformColor = 0xa8; byte baseUniformColor = 0xa8;
@ -1163,8 +1149,7 @@ SharedPtr<Bitmap> StarTrekEngine::loadAnimationFrame(const Common::String &filen
} }
} }
} }
} } else {
else {
// TODO: when loading a bitmap, it passes a different argument than is standard to // TODO: when loading a bitmap, it passes a different argument than is standard to
// the "file loading with cache" function... // the "file loading with cache" function...
bitmapToReturn = _gfx->loadBitmap(filename); bitmapToReturn = _gfx->loadBitmap(filename);
@ -1193,34 +1178,28 @@ int StarTrekEngine::selectObjectForUseAction() {
updateMouseBitmap(); updateMouseBitmap();
_gfx->drawAllSprites(); _gfx->drawAllSprites();
_sound->checkLoopMusic(); _sound->checkLoopMusic();
} } else if (event.type == TREKEVENT_LBUTTONDOWN) {
else if (event.type == TREKEVENT_LBUTTONDOWN) {
removeNextEvent(); removeNextEvent();
break; break;
} } else if (event.type == TREKEVENT_MOUSEMOVE) {
else if (event.type == TREKEVENT_MOUSEMOVE) { } else if (event.type == TREKEVENT_RBUTTONDOWN) {
}
else if (event.type == TREKEVENT_RBUTTONDOWN) {
// Allow this to be processed by main away mission loop // Allow this to be processed by main away mission loop
break; break;
} } else if (event.type == TREKEVENT_KEYDOWN) {
else if (event.type == TREKEVENT_KEYDOWN) {
if (event.kbd.keycode == Common::KEYCODE_ESCAPE if (event.kbd.keycode == Common::KEYCODE_ESCAPE
|| event.kbd.keycode == Common::KEYCODE_w || event.kbd.keycode == Common::KEYCODE_w
|| event.kbd.keycode == Common::KEYCODE_t || event.kbd.keycode == Common::KEYCODE_t
|| event.kbd.keycode == Common::KEYCODE_u || event.kbd.keycode == Common::KEYCODE_u
|| event.kbd.keycode == Common::KEYCODE_g || event.kbd.keycode == Common::KEYCODE_g
|| event.kbd.keycode == Common::KEYCODE_l || event.kbd.keycode == Common::KEYCODE_l
|| event.kbd.keycode == Common::KEYCODE_SPACE || event.kbd.keycode == Common::KEYCODE_SPACE
|| event.kbd.keycode == Common::KEYCODE_F2) { || event.kbd.keycode == Common::KEYCODE_F2) {
// Allow these buttons to be processed by main away mission loop // Allow these buttons to be processed by main away mission loop
break; break;
} } else if (event.kbd.keycode == Common::KEYCODE_i) {
else if (event.kbd.keycode == Common::KEYCODE_i) {
removeNextEvent(); removeNextEvent();
break; break;
} } else if (event.kbd.keycode == Common::KEYCODE_RETURN || event.kbd.keycode == Common::KEYCODE_KP_ENTER || event.kbd.keycode == Common::KEYCODE_F1) {
else if (event.kbd.keycode == Common::KEYCODE_RETURN || event.kbd.keycode == Common::KEYCODE_KP_ENTER || event.kbd.keycode == Common::KEYCODE_F1) {
// Simulate left-click // Simulate left-click
removeNextEvent(); removeNextEvent();
event.type = TREKEVENT_LBUTTONDOWN; event.type = TREKEVENT_LBUTTONDOWN;
@ -1237,8 +1216,7 @@ int StarTrekEngine::selectObjectForUseAction() {
if (clickedObject == -1) if (clickedObject == -1)
continue; continue;
return clickedObject; return clickedObject;
} } else if (event.type == TREKEVENT_LBUTTONDOWN) {
else if (event.type == TREKEVENT_LBUTTONDOWN) {
int clickedObject = findObjectAt(_gfx->getMousePos()); int clickedObject = findObjectAt(_gfx->getMousePos());
hideInventoryIcons(); hideInventoryIcons();
@ -1252,14 +1230,13 @@ int StarTrekEngine::selectObjectForUseAction() {
continue; continue;
else else
return clickedObject; return clickedObject;
} } else if (clickedObject <= OBJECT_REDSHIRT)
else if (clickedObject <= OBJECT_REDSHIRT)
return clickedObject; return clickedObject;
else if (isObjectUnusable(OBJECT_KIRK, ACTION_USE)) else if (isObjectUnusable(OBJECT_KIRK, ACTION_USE))
continue; continue;
else if (_room->actionHasCode(ACTION_USE, OBJECT_KIRK, clickedObject, 0) else if (_room->actionHasCode(ACTION_USE, OBJECT_KIRK, clickedObject, 0)
|| _room->actionHasCode(ACTION_GET, clickedObject, 0, 0) || _room->actionHasCode(ACTION_GET, clickedObject, 0, 0)
|| _room->actionHasCode(ACTION_WALK, clickedObject, 0, 0)) { || _room->actionHasCode(ACTION_WALK, clickedObject, 0, 0)) {
_awayMission.activeObject = OBJECT_KIRK; _awayMission.activeObject = OBJECT_KIRK;
_awayMission.passiveObject = clickedObject; _awayMission.passiveObject = clickedObject;
_awayMission.activeAction = ACTION_USE; _awayMission.activeAction = ACTION_USE;
@ -1267,11 +1244,9 @@ int StarTrekEngine::selectObjectForUseAction() {
if (!walkActiveObjectToHotspot()) if (!walkActiveObjectToHotspot())
addAction(_awayMission.activeAction, _awayMission.activeObject, _awayMission.passiveObject, 0); addAction(_awayMission.activeAction, _awayMission.activeObject, _awayMission.passiveObject, 0);
return clickedObject; return clickedObject;
} } else
else
continue; continue;
} } else {
else {
hideInventoryIcons(); hideInventoryIcons();
return -1; return -1;
} }
@ -1342,8 +1317,7 @@ bool StarTrekEngine::walkActiveObjectToHotspot() {
objectIndex = OBJECT_MCCOY; objectIndex = OBJECT_MCCOY;
else else
objectIndex = OBJECT_KIRK; objectIndex = OBJECT_KIRK;
} } else // This is the original error message...
else // This is the original error message...
error("Jay didn't think about pmcheck"); error("Jay didn't think about pmcheck");
byte finishedAnimActionParam = false; byte finishedAnimActionParam = false;
@ -1381,8 +1355,7 @@ bool StarTrekEngine::walkActiveObjectToHotspot() {
} }
_objectHasWalkPosition = false; _objectHasWalkPosition = false;
return true; return true;
} } else {
else {
_objectHasWalkPosition = false; _objectHasWalkPosition = false;
return false; return false;
} }
@ -1484,8 +1457,7 @@ void StarTrekEngine::updateCrewmanGetupTimers() {
char d; char d;
if (dir == -1) { if (dir == -1) {
d = actor->direction; d = actor->direction;
} } else {
else {
const char *dirs = "nsew"; const char *dirs = "nsew";
Fixed8 scale = getActorScaleAtPosition(actor->sprite.pos.y); Fixed8 scale = getActorScaleAtPosition(actor->sprite.pos.y);
d = dirs[dir]; d = dirs[dir];
@ -1494,8 +1466,7 @@ void StarTrekEngine::updateCrewmanGetupTimers() {
if (d == 'n') { if (d == 'n') {
xOffset = -24; xOffset = -24;
yOffset = -8; yOffset = -8;
} } else if (d == 'w') {
else if (d == 'w') {
xOffset = -35; xOffset = -35;
yOffset = -12; yOffset = -12;
} }
@ -1717,8 +1688,7 @@ SharedPtr<Bitmap> StarTrekEngine::scaleBitmap(SharedPtr<Bitmap> bitmap, Fixed8 s
while (origRow <= origHeight) { while (origRow <= origHeight) {
if (var2e < 0) { if (var2e < 0) {
var2e += var30; var2e += var30;
} } else {
else {
var2e += var32; var2e += var32;
scaleBitmapRow(src, dest, origWidth, scaledWidth); scaleBitmapRow(src, dest, origWidth, scaledWidth);
dest += scaledWidth; dest += scaledWidth;
@ -1727,8 +1697,7 @@ SharedPtr<Bitmap> StarTrekEngine::scaleBitmap(SharedPtr<Bitmap> bitmap, Fixed8 s
src += bitmap->width; src += bitmap->width;
origRow++; origRow++;
} }
} } else {
else {
int16 var2e = (origHeight << 1) - scaledHeight; int16 var2e = (origHeight << 1) - scaledHeight;
uint16 var30 = origHeight << 1; uint16 var30 = origHeight << 1;
uint16 var32 = (origHeight - scaledHeight) << 1; uint16 var32 = (origHeight - scaledHeight) << 1;
@ -1748,8 +1717,7 @@ SharedPtr<Bitmap> StarTrekEngine::scaleBitmap(SharedPtr<Bitmap> bitmap, Fixed8 s
if (var2e < 0) { if (var2e < 0) {
var2e += var30; var2e += var30;
} } else {
else {
var2e += var32; var2e += var32;
src += origWidth; src += origWidth;
srcRowChanged = true; srcRowChanged = true;
@ -1775,8 +1743,7 @@ void StarTrekEngine::scaleBitmapRow(byte *src, byte *dest, uint16 origWidth, uin
while (var8-- != 0) { while (var8-- != 0) {
if (var2 < 0) { if (var2 < 0) {
var2 += var4; var2 += var4;
} } else {
else {
var2 += var6; var2 += var6;
if (di != 0) { if (di != 0) {
if (varE != 0) { if (varE != 0) {
@ -1794,8 +1761,7 @@ void StarTrekEngine::scaleBitmapRow(byte *src, byte *dest, uint16 origWidth, uin
di++; di++;
varA++; varA++;
} }
} } else {
else {
int16 var2 = ((origWidth - 1) << 1) - (scaledWidth - 1); int16 var2 = ((origWidth - 1) << 1) - (scaledWidth - 1);
uint16 var4 = (origWidth - 1) << 1; uint16 var4 = (origWidth - 1) << 1;
uint16 var6 = ((origWidth - 1) - (scaledWidth - 1)) << 1; uint16 var6 = ((origWidth - 1) - (scaledWidth - 1)) << 1;
@ -1836,11 +1802,11 @@ SharedPtr<FileStream> StarTrekEngine::loadFile(Common::String filename, int file
bool bigEndian = getPlatform() == Common::kPlatformAmiga; bool bigEndian = getPlatform() == Common::kPlatformAmiga;
for (int i=filename.size()-1; ; i--) { for (int i = filename.size() - 1; ; i--) {
if (filename[i] == '.') { if (filename[i] == '.') {
basename = filename; basename = filename;
extension = filename; extension = filename;
basename.replace(i, filename.size()-i, ""); basename.replace(i, filename.size() - i, "");
extension.replace(0, i + 1, ""); extension.replace(0, i + 1, "");
break; break;
} }
@ -1926,7 +1892,7 @@ SharedPtr<FileStream> StarTrekEngine::loadFile(Common::String filename, int file
// Files can be accessed "sequentially" if their filenames are the same except for // Files can be accessed "sequentially" if their filenames are the same except for
// the last character being incremented by one. // the last character being incremented by one.
if ((basename.lastChar() >= '1' && basename.lastChar() <= '9') || if ((basename.lastChar() >= '1' && basename.lastChar() <= '9') ||
(basename.lastChar() >= 'B' && basename.lastChar() <= 'Z')) { (basename.lastChar() >= 'B' && basename.lastChar() <= 'Z')) {
basename.setChar(basename.lastChar() - 1, basename.size() - 1); basename.setChar(basename.lastChar() - 1, basename.size() - 1);
return loadFile(basename + "." + extension, fileIndex + 1); return loadFile(basename + "." + extension, fileIndex + 1);
} else } else

View file

@ -54,7 +54,7 @@ using Common::SharedPtr;
using Common::String; using Common::String;
namespace Common { namespace Common {
class MacResManager; class MacResManager;
} }
namespace StarTrek { namespace StarTrek {
@ -62,7 +62,7 @@ namespace StarTrek {
class StarTrekEngine; class StarTrekEngine;
class Room; class Room;
typedef String (StarTrekEngine::*TextGetterFunc)(int, uintptr, String *); typedef String(StarTrekEngine::*TextGetterFunc)(int, uintptr, String *);
const int SAVEGAME_DESCRIPTION_LEN = 30; const int SAVEGAME_DESCRIPTION_LEN = 30;
@ -84,11 +84,21 @@ struct SavegameMetadata {
saveTimeSecs = time.tm_sec & 0xFF; saveTimeSecs = time.tm_sec & 0xFF;
} }
int getDay() { return (saveDate >> 24) & 0xFF; } int getDay() {
int getMonth() { return (saveDate >> 16) & 0xFF; } return (saveDate >> 24) & 0xFF;
int getYear() { return saveDate & 0xFFFF; } }
int getHour() { return (saveTime >> 8) & 0xFF; } int getMonth() {
int getMinute() { return saveTime & 0xFF; } return (saveDate >> 16) & 0xFF;
}
int getYear() {
return saveDate & 0xFFFF;
}
int getHour() {
return (saveTime >> 8) & 0xFF;
}
int getMinute() {
return saveTime & 0xFF;
}
}; };
@ -106,7 +116,7 @@ enum StarTrekGameType {
}; };
enum StarTrekGameFeatures { enum StarTrekGameFeatures {
GF_DEMO = (1 << 0) GF_DEMO = (1 << 0)
}; };
enum kDebugLevels { enum kDebugLevels {
@ -356,7 +366,9 @@ public:
bool directPathExists(int16 srcX, int16 srcY, int16 destX, int16 destY); bool directPathExists(int16 srcX, int16 srcY, int16 destX, int16 destY);
int findObjectAt(int x, int y); int findObjectAt(int x, int y);
int findObjectAt(Common::Point p) { return findObjectAt(p.x, p.y); } int findObjectAt(Common::Point p) {
return findObjectAt(p.x, p.y);
}
/** /**
* Loads a bitmap for the animation frame with the given scale. * Loads a bitmap for the animation frame with the given scale.
*/ */
@ -423,7 +435,9 @@ public:
void updateClockTicks(); void updateClockTicks();
bool checkKeyPressed(); bool checkKeyPressed();
Common::EventManager *getEventMan() { return _eventMan; } Common::EventManager *getEventMan() {
return _eventMan;
}
private: private:
Common::List<TrekEvent> _eventQueue; Common::List<TrekEvent> _eventQueue;
@ -592,7 +606,7 @@ public:
Common::Language getLanguage(); Common::Language getLanguage();
// Resource related functions // Resource related functions
SharedPtr<FileStream> loadFile(Common::String filename, int fileIndex=0); SharedPtr<FileStream> loadFile(Common::String filename, int fileIndex = 0);
/** /**
* TODO: Figure out what the extra parameters are, and if they're important. * TODO: Figure out what the extra parameters are, and if they're important.
*/ */
@ -644,10 +658,10 @@ public:
Item _itemList[NUM_OBJECTS]; Item _itemList[NUM_OBJECTS];
Actor _actorList[NUM_ACTORS]; Actor _actorList[NUM_ACTORS];
Actor * const _kirkActor; Actor *const _kirkActor;
Actor * const _spockActor; Actor *const _spockActor;
Actor * const _mccoyActor; Actor *const _mccoyActor;
Actor * const _redshirtActor; Actor *const _redshirtActor;
SharedPtr<FileStream> _actorBanFiles[NUM_ACTORS / 2]; SharedPtr<FileStream> _actorBanFiles[NUM_ACTORS / 2];
uint16 _actorBanVar2[NUM_ACTORS / 2]; // TODO: initialize? uint16 _actorBanVar2[NUM_ACTORS / 2]; // TODO: initialize?

View file

@ -117,7 +117,7 @@ String StarTrekEngine::readTextFromRdf(int choiceIndex, uintptr data, String *he
if (speakerOffset == 0 || room->_rdfData[speakerOffset] == '\0') if (speakerOffset == 0 || room->_rdfData[speakerOffset] == '\0')
*headerTextOutput = ""; *headerTextOutput = "";
else { else {
char *speakerText = (char*)&room->_rdfData[speakerOffset]; char *speakerText = (char *)&room->_rdfData[speakerOffset];
if (room->readRdfWord(rdfVar + 4) != 0) // Check if there's more than one option if (room->readRdfWord(rdfVar + 4) != 0) // Check if there's more than one option
getTextboxHeader(headerTextOutput, speakerText, choiceIndex + 1); getTextboxHeader(headerTextOutput, speakerText, choiceIndex + 1);
else else
@ -125,7 +125,7 @@ String StarTrekEngine::readTextFromRdf(int choiceIndex, uintptr data, String *he
} }
} }
return (char*)&room->_rdfData[textOffset]; return (char *)&room->_rdfData[textOffset];
} }
void StarTrekEngine::showTextbox(String headerText, const String &mainText, int xoffset, int yoffset, byte textColor, int maxTextLines) { void StarTrekEngine::showTextbox(String headerText, const String &mainText, int xoffset, int yoffset, byte textColor, int maxTextLines) {
@ -202,7 +202,7 @@ int StarTrekEngine::showText(TextGetterFunc textGetter, uintptr var, int xoffset
int numChoices = 0; int numChoices = 0;
String speakerText; String speakerText;
while(true) { while (true) {
String choiceText = (this->*textGetter)(numChoices, var, &speakerText); String choiceText = (this->*textGetter)(numChoices, var, &speakerText);
if (choiceText.empty()) if (choiceText.empty())
break; break;
@ -231,13 +231,13 @@ int StarTrekEngine::showText(TextGetterFunc textGetter, uintptr var, int xoffset
int choiceIndex = 0; int choiceIndex = 0;
int scrollOffset = 0; int scrollOffset = 0;
if (tmpTextDisplayMode != TEXTDISPLAY_WAIT && tmpTextDisplayMode != TEXTDISPLAY_SUBTITLES if (tmpTextDisplayMode != TEXTDISPLAY_WAIT && tmpTextDisplayMode != TEXTDISPLAY_SUBTITLES
&& numChoices == 1 && _sfxEnabled && !_sfxWorking) && numChoices == 1 && _sfxEnabled && !_sfxWorking)
_textboxHasMultipleChoices = false; _textboxHasMultipleChoices = false;
else else
_textboxHasMultipleChoices = true; _textboxHasMultipleChoices = true;
if (tmpTextDisplayMode >= TEXTDISPLAY_WAIT && tmpTextDisplayMode <= TEXTDISPLAY_NONE if (tmpTextDisplayMode >= TEXTDISPLAY_WAIT && tmpTextDisplayMode <= TEXTDISPLAY_NONE
&& _sfxEnabled && !_sfxWorking) && _sfxEnabled && !_sfxWorking)
_textboxVar6 = true; _textboxVar6 = true;
else else
_textboxVar6 = false; _textboxVar6 = false;
@ -286,7 +286,7 @@ int StarTrekEngine::showText(TextGetterFunc textGetter, uintptr var, int xoffset
if (ticksUntilClickingEnabled != 0) if (ticksUntilClickingEnabled != 0)
enableMenuButtons(1 << TEXTBUTTON_CONFIRM); enableMenuButtons(1 << TEXTBUTTON_CONFIRM);
switch(textboxReturnCode) { switch (textboxReturnCode) {
case MENUEVENT_RCLICK_OFFBUTTON: case MENUEVENT_RCLICK_OFFBUTTON:
case MENUEVENT_RCLICK_ONBUTTON: case MENUEVENT_RCLICK_ONBUTTON:
@ -337,20 +337,20 @@ readjustScrollDown:
enableMenuButtons(1 << TEXTBUTTON_SCROLLUP); enableMenuButtons(1 << TEXTBUTTON_SCROLLUP);
if (scrollOffset >= numTextLines) if (scrollOffset >= numTextLines)
scrollOffset -= numTextboxLines; scrollOffset -= numTextboxLines;
if (scrollOffset > numTextLines-1) if (scrollOffset > numTextLines - 1)
scrollOffset = numTextLines-1; scrollOffset = numTextLines - 1;
if (scrollOffset+numTextboxLines >= numTextLines) if (scrollOffset + numTextboxLines >= numTextLines)
disableMenuButtons(1 << TEXTBUTTON_SCROLLDOWN); disableMenuButtons(1 << TEXTBUTTON_SCROLLDOWN);
goto readjustScroll; goto readjustScroll;
readjustScroll: readjustScroll:
textboxSprite.bitmapChanged = true; textboxSprite.bitmapChanged = true;
drawMainText( drawMainText(
textBitmap, textBitmap,
numTextLines-scrollOffset, numTextLines - scrollOffset,
numTextboxLines, numTextboxLines,
lineFormattedText.c_str() + scrollOffset*(TEXTBOX_WIDTH-2), lineFormattedText.c_str() + scrollOffset * (TEXTBOX_WIDTH - 2),
numChoicesWithNames != 0); numChoicesWithNames != 0);
break; break;
case TEXTBUTTON_PREVCHOICE: case TEXTBUTTON_PREVCHOICE:
@ -359,7 +359,7 @@ readjustScroll:
disableMenuButtons(1 << TEXTBUTTON_PREVCHOICE); disableMenuButtons(1 << TEXTBUTTON_PREVCHOICE);
} else { } else {
if (choiceIndex < 0) if (choiceIndex < 0)
choiceIndex = numChoices-1; choiceIndex = numChoices - 1;
} }
enableMenuButtons(1 << TEXTBUTTON_NEXTCHOICE); enableMenuButtons(1 << TEXTBUTTON_NEXTCHOICE);
goto reloadText; goto reloadText;
@ -367,7 +367,7 @@ readjustScroll:
case TEXTBUTTON_NEXTCHOICE: case TEXTBUTTON_NEXTCHOICE:
enableMenuButtons(1 << TEXTBUTTON_PREVCHOICE); enableMenuButtons(1 << TEXTBUTTON_PREVCHOICE);
choiceIndex++; choiceIndex++;
if (!loopChoices && choiceIndex == numChoices-1) { if (!loopChoices && choiceIndex == numChoices - 1) {
disableMenuButtons(1 << TEXTBUTTON_NEXTCHOICE); disableMenuButtons(1 << TEXTBUTTON_NEXTCHOICE);
} else { } else {
choiceIndex %= numChoices; choiceIndex %= numChoices;
@ -380,7 +380,7 @@ reloadText:
if (numTextLines <= numTextboxLines) { if (numTextLines <= numTextboxLines) {
setVisibleMenuButtons((1 << TEXTBUTTON_CONFIRM) | (1 << TEXTBUTTON_PREVCHOICE) | (1 << TEXTBUTTON_NEXTCHOICE)); setVisibleMenuButtons((1 << TEXTBUTTON_CONFIRM) | (1 << TEXTBUTTON_PREVCHOICE) | (1 << TEXTBUTTON_NEXTCHOICE));
} else { } else {
setVisibleMenuButtons((1 << TEXTBUTTON_CONFIRM) | (1 << TEXTBUTTON_SCROLLUP) | (1 << TEXTBUTTON_SCROLLDOWN)| (1 << TEXTBUTTON_PREVCHOICE) | (1 << TEXTBUTTON_NEXTCHOICE)); setVisibleMenuButtons((1 << TEXTBUTTON_CONFIRM) | (1 << TEXTBUTTON_SCROLLUP) | (1 << TEXTBUTTON_SCROLLDOWN) | (1 << TEXTBUTTON_PREVCHOICE) | (1 << TEXTBUTTON_NEXTCHOICE));
} }
enableMenuButtons(1 << TEXTBUTTON_SCROLLDOWN); enableMenuButtons(1 << TEXTBUTTON_SCROLLDOWN);
disableMenuButtons(1 << TEXTBUTTON_SCROLLUP); disableMenuButtons(1 << TEXTBUTTON_SCROLLUP);
@ -424,10 +424,10 @@ int StarTrekEngine::getNumTextboxLines(const String &str) {
int lines = 0; int lines = 0;
while (text != nullptr) { while (text != nullptr) {
text = getNextTextLine(text, line, TEXTBOX_WIDTH-2); text = getNextTextLine(text, line, TEXTBOX_WIDTH - 2);
lines++; lines++;
} }
return lines-1; return lines - 1;
} }
String StarTrekEngine::putTextIntoLines(const String &_text) { String StarTrekEngine::putTextIntoLines(const String &_text) {
@ -436,17 +436,17 @@ String StarTrekEngine::putTextIntoLines(const String &_text) {
const char *text = _text.c_str(); const char *text = _text.c_str();
String output; String output;
text = getNextTextLine(text, line, TEXTBOX_WIDTH-2); text = getNextTextLine(text, line, TEXTBOX_WIDTH - 2);
while (text != nullptr) { while (text != nullptr) {
int len = strlen(line); int len = strlen(line);
while (len != TEXTBOX_WIDTH-2) { while (len != TEXTBOX_WIDTH - 2) {
line[len++] = ' '; line[len++] = ' ';
line[len] = '\0'; line[len] = '\0';
} }
output += line; output += line;
text = getNextTextLine(text, line, TEXTBOX_WIDTH-2); text = getNextTextLine(text, line, TEXTBOX_WIDTH - 2);
} }
return output; return output;
@ -462,7 +462,7 @@ SharedPtr<TextBitmap> StarTrekEngine::initTextSprite(int *xoffsetPtr, int *yoffs
int textHeight = numTextLines + linesBeforeTextStart; int textHeight = numTextLines + linesBeforeTextStart;
SharedPtr<TextBitmap> bitmap(new TextBitmap(TEXTBOX_WIDTH*8, textHeight*8)); SharedPtr<TextBitmap> bitmap(new TextBitmap(TEXTBOX_WIDTH * 8, textHeight * 8));
*sprite = Sprite(); *sprite = Sprite();
sprite->drawPriority = 15; sprite->drawPriority = 15;
@ -470,9 +470,9 @@ SharedPtr<TextBitmap> StarTrekEngine::initTextSprite(int *xoffsetPtr, int *yoffs
sprite->bitmap = bitmap; sprite->bitmap = bitmap;
sprite->textColor = textColor; sprite->textColor = textColor;
memset(bitmap->pixels, ' ', textHeight*TEXTBOX_WIDTH); memset(bitmap->pixels, ' ', textHeight * TEXTBOX_WIDTH);
int varC = SCREEN_WIDTH-1 - xoffset - (bitmap->width + 0x1d) / 2; int varC = SCREEN_WIDTH - 1 - xoffset - (bitmap->width + 0x1d) / 2;
if (varC < 0) if (varC < 0)
xoffset += varC; xoffset += varC;
@ -484,35 +484,35 @@ SharedPtr<TextBitmap> StarTrekEngine::initTextSprite(int *xoffsetPtr, int *yoffs
if (varC < 0) if (varC < 0)
yoffset -= varC; yoffset -= varC;
xoffset -= (bitmap->width + 0x1d)/2; xoffset -= (bitmap->width + 0x1d) / 2;
yoffset -= bitmap->height; yoffset -= bitmap->height;
bitmap->pixels[0] = 0x10; bitmap->pixels[0] = 0x10;
memset(&bitmap->pixels[1], 0x11, TEXTBOX_WIDTH-2); memset(&bitmap->pixels[1], 0x11, TEXTBOX_WIDTH - 2);
bitmap->pixels[TEXTBOX_WIDTH-1] = 0x12; bitmap->pixels[TEXTBOX_WIDTH - 1] = 0x12;
byte *textAddr = bitmap->pixels + TEXTBOX_WIDTH; byte *textAddr = bitmap->pixels + TEXTBOX_WIDTH;
if (withHeader) { if (withHeader) {
textAddr[0] = 0x13; textAddr[0] = 0x13;
textAddr[TEXTBOX_WIDTH-1] = 0x14; textAddr[TEXTBOX_WIDTH - 1] = 0x14;
textAddr += TEXTBOX_WIDTH; textAddr += TEXTBOX_WIDTH;
textAddr[0] = 0x13; textAddr[0] = 0x13;
memset(&textAddr[1], 0x19, TEXTBOX_WIDTH-2); memset(&textAddr[1], 0x19, TEXTBOX_WIDTH - 2);
textAddr[TEXTBOX_WIDTH-1] = 0x14; textAddr[TEXTBOX_WIDTH - 1] = 0x14;
textAddr += TEXTBOX_WIDTH; textAddr += TEXTBOX_WIDTH;
} }
for (int line=0; line<numTextLines; line++) { for (int line = 0; line < numTextLines; line++) {
textAddr[0] = 0x13; textAddr[0] = 0x13;
textAddr[TEXTBOX_WIDTH-1] = 0x14; textAddr[TEXTBOX_WIDTH - 1] = 0x14;
textAddr += TEXTBOX_WIDTH; textAddr += TEXTBOX_WIDTH;
} }
textAddr[0] = 0x15; textAddr[0] = 0x15;
memset(&textAddr[1], 0x16, TEXTBOX_WIDTH-2); memset(&textAddr[1], 0x16, TEXTBOX_WIDTH - 2);
textAddr[TEXTBOX_WIDTH-1] = 0x17; textAddr[TEXTBOX_WIDTH - 1] = 0x17;
_gfx->addSprite(sprite); _gfx->addSprite(sprite);
sprite->drawMode = 3; sprite->drawMode = 3;
@ -562,7 +562,7 @@ String StarTrekEngine::readLineFormattedText(TextGetterFunc textGetter, uintptr
if (oldSize != text.size()) if (oldSize != text.size())
_textboxHasMultipleChoices = true; _textboxHasMultipleChoices = true;
} else if ((_textDisplayMode == TEXTDISPLAY_WAIT || _textDisplayMode == TEXTDISPLAY_SUBTITLES) } else if ((_textDisplayMode == TEXTDISPLAY_WAIT || _textDisplayMode == TEXTDISPLAY_SUBTITLES)
&& _sfxEnabled && _sfxWorking) { && _sfxEnabled && _sfxWorking) {
text = playTextAudio(text); text = playTextAudio(text);
} else { } else {
text = skipTextAudioPrompt(text); text = skipTextAudioPrompt(text);
@ -581,24 +581,6 @@ String StarTrekEngine::readLineFormattedText(TextGetterFunc textGetter, uintptr
return lineFormattedText; return lineFormattedText;
} else } else
return nullptr; return nullptr;
/* Barebones implementation
*numTextLines = 1;
uint numChars = textBitmap->width*textBitmap->height;
String text = (this->*textGetter)(choiceIndex, var, nullptr);
while (text.size() < numChars) text += ' ';
byte *dest = textBitmap->pixels + TEXTBOX_WIDTH + 1;
for (int y=0; y<*numTextLines; y++) {
memcpy(dest, text.c_str(), TEXTBOX_WIDTH-2);
dest += TEXTBOX_WIDTH;
}
return text;
*/
} }
String StarTrekEngine::readTextFromArray(int choiceIndex, uintptr data, String *headerTextOutput) { String StarTrekEngine::readTextFromArray(int choiceIndex, uintptr data, String *headerTextOutput) {

View file

@ -2440,7 +2440,7 @@ enum GameStringIDs {
}; };
// TODO: Move this out of the header file. It's inflating the executable size. // TODO: Move this out of the header file. It's inflating the executable size.
const char * const g_gameStrings[] = { const char *const g_gameStrings[] = {
nullptr, nullptr,
"", "",
"Dialog error", "Dialog error",