diff options
author | Matthew Stewart | 2018-07-23 22:53:10 -0400 |
---|---|---|
committer | Eugene Sandulenko | 2018-08-09 08:37:30 +0200 |
commit | fe98dbb69d1f8222eeb391111f59670658b0daad (patch) | |
tree | fdd8c33cb65529082f698e08e9d1a86d7cdc05e8 /engines | |
parent | aa68655742c94026c701dafc1ef6efb032774434 (diff) | |
download | scummvm-rg350-fe98dbb69d1f8222eeb391111f59670658b0daad.tar.gz scummvm-rg350-fe98dbb69d1f8222eeb391111f59670658b0daad.tar.bz2 scummvm-rg350-fe98dbb69d1f8222eeb391111f59670658b0daad.zip |
STARTREK: Reformat with artistic style
Diffstat (limited to 'engines')
52 files changed, 446 insertions, 546 deletions
diff --git a/engines/startrek/action.h b/engines/startrek/action.h index 3ae507e836..4b8409e718 100644 --- a/engines/startrek/action.h +++ b/engines/startrek/action.h @@ -60,8 +60,12 @@ struct Action { byte b3; // ACTION_USE, ACTION_GET, ACTION_LOOK, ACTION_TALK - byte activeObject() const { return b1; } - byte passiveObject() const { return b2; } + byte activeObject() const { + return b1; + } + byte passiveObject() const { + return b2; + } bool operator==(const Action &a) const { return type == a.type && b1 == a.b1 && b2 == a.b2 && b3 == a.b3; diff --git a/engines/startrek/awaymission.cpp b/engines/startrek/awaymission.cpp index 63a0458ed4..41533d7bb7 100644 --- a/engines/startrek/awaymission.cpp +++ b/engines/startrek/awaymission.cpp @@ -404,7 +404,7 @@ void StarTrekEngine::awayMissionUseObject(int16 clickedObject) { tryWalkToHotspot = true; else if (_awayMission.activeObject == OBJECT_MCCOY && _room->actionHasCode(ACTION_USE, OBJECT_IMEDKIT, _awayMission.passiveObject, 0)) 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; if (!tryWalkToHotspot) { @@ -694,7 +694,7 @@ void StarTrekEngine::checkTouchedLoadingZone(int16 x, int16 y) { int16 offset = _room->getFirstDoorPolygonOffset(); 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); if (_activeDoorWarpHotspot != var) { _activeDoorWarpHotspot = var; @@ -712,7 +712,7 @@ void StarTrekEngine::checkTouchedLoadingZone(int16 x, int16 y) { offset = _room->getFirstWarpPolygonOffset(); 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); if (_activeWarpHotspot != var) { _activeWarpHotspot = var; diff --git a/engines/startrek/bitmap.cpp b/engines/startrek/bitmap.cpp index 2e6eb78d92..812b61a723 100644 --- a/engines/startrek/bitmap.cpp +++ b/engines/startrek/bitmap.cpp @@ -46,7 +46,7 @@ Bitmap::Bitmap(const Bitmap &bitmap) { } 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() { diff --git a/engines/startrek/common.cpp b/engines/startrek/common.cpp index a742860c32..211a2f72bd 100644 --- a/engines/startrek/common.cpp +++ b/engines/startrek/common.cpp @@ -32,7 +32,7 @@ Common::Rect getRectEncompassing(Common::Rect r1, Common::Rect r2) { uint16 r = max(r1.right, r2.right); 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) { diff --git a/engines/startrek/common.h b/engines/startrek/common.h index 290772f4a1..126736494c 100644 --- a/engines/startrek/common.h +++ b/engines/startrek/common.h @@ -33,10 +33,14 @@ class Serializer; namespace StarTrek { 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> -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); void serializeRect(Common::Rect rect, Common::Serializer &ser); diff --git a/engines/startrek/detection.cpp b/engines/startrek/detection.cpp index ebeb30aa16..0cdc0ef4a4 100644 --- a/engines/startrek/detection.cpp +++ b/engines/startrek/detection.cpp @@ -92,7 +92,7 @@ static const StarTrekGameDescription gameDescriptions[] = { 0, 0, }, - + { { "st25", @@ -107,7 +107,7 @@ static const StarTrekGameDescription gameDescriptions[] = { 0, 0, }, - + { { "st25", @@ -122,7 +122,7 @@ static const StarTrekGameDescription gameDescriptions[] = { 0, 0, }, - + { { "st25", @@ -137,7 +137,7 @@ static const StarTrekGameDescription gameDescriptions[] = { 0, 0, }, - + { { "st25", @@ -152,7 +152,7 @@ static const StarTrekGameDescription gameDescriptions[] = { 0, 0, }, - + { { "st25", @@ -167,7 +167,7 @@ static const StarTrekGameDescription gameDescriptions[] = { 0, 0, }, - + { { "st25", @@ -197,7 +197,7 @@ static const StarTrekGameDescription gameDescriptions[] = { GF_DEMO, 0, }, - + { { "stjr", @@ -211,8 +211,8 @@ static const StarTrekGameDescription gameDescriptions[] = { GType_STJR, 0, 0, - }, - + }, + { AD_TABLE_END_MARKER, 0, 0, 0 } }; @@ -250,14 +250,14 @@ bool StarTrekMetaEngine::hasFeature(MetaEngineFeature f) const { (f == kSavesSupportThumbnail) || (f == kSavesSupportCreationDate) || (f == kSavesSupportPlayTime) || - (f == kSimpleSavesNames); + (f == kSimpleSavesNames); } bool StarTrekMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const { const StarTrek::StarTrekGameDescription *gd = (const StarTrek::StarTrekGameDescription *)desc; - + *engine = new StarTrek::StarTrekEngine(syst, gd); - + return (gd != 0); } @@ -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 { 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) - REGISTER_PLUGIN_DYNAMIC(STARTREK, PLUGIN_TYPE_ENGINE, StarTrekMetaEngine); +REGISTER_PLUGIN_DYNAMIC(STARTREK, PLUGIN_TYPE_ENGINE, StarTrekMetaEngine); #else - REGISTER_PLUGIN_STATIC(STARTREK, PLUGIN_TYPE_ENGINE, StarTrekMetaEngine); +REGISTER_PLUGIN_STATIC(STARTREK, PLUGIN_TYPE_ENGINE, StarTrekMetaEngine); #endif diff --git a/engines/startrek/events.cpp b/engines/startrek/events.cpp index 6315899efc..a78a4177e4 100644 --- a/engines/startrek/events.cpp +++ b/engines/startrek/events.cpp @@ -161,7 +161,7 @@ bool StarTrekEngine::popNextEvent(TrekEvent *e, bool poll) { void StarTrekEngine::addEventToQueue(const TrekEvent &e) { if (e.type == TREKEVENT_MOUSEMOVE && _mouseMoveEventInQueue) { // 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) { *i = e; return; diff --git a/engines/startrek/filestream.cpp b/engines/startrek/filestream.cpp index ed54744fd8..faae962ed5 100644 --- a/engines/startrek/filestream.cpp +++ b/engines/startrek/filestream.cpp @@ -18,7 +18,7 @@ FileStream::~FileStream() { // ReadStream functions -uint32 FileStream::read(void* dataPtr, uint32 dataSize) { +uint32 FileStream::read(void *dataPtr, uint32 dataSize) { if (_pos + dataSize > (uint32)size()) dataSize = size() - _pos; memcpy(dataPtr, _data + _pos, dataSize); diff --git a/engines/startrek/font.h b/engines/startrek/font.h index 62a354c10a..1353acc2e5 100644 --- a/engines/startrek/font.h +++ b/engines/startrek/font.h @@ -25,9 +25,9 @@ #ifndef STARTREK_FONT_H #define STARTREK_FONT_H - + #include "startrek/startrek.h" - + namespace StarTrek { class StarTrekEngine; @@ -38,7 +38,7 @@ public: ~Font(); byte *getCharData(int i); - + private: StarTrekEngine *_vm; @@ -48,6 +48,6 @@ private: }; -} +} #endif diff --git a/engines/startrek/graphics.cpp b/engines/startrek/graphics.cpp index c58f16f47e..6e8c97f902 100644 --- a/engines/startrek/graphics.cpp +++ b/engines/startrek/graphics.cpp @@ -79,7 +79,7 @@ void Graphics::setBackgroundImage(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 *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 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. void Graphics::drawSprite(const Sprite &sprite, ::Graphics::Surface *surface, const Common::Rect &rect) { 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(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 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 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) 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 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 drawHeight = rectangle1.height(); - dest = (byte*)surface->getPixels() + sprite.drawY*SCREEN_WIDTH + sprite.drawX - + rectangle1.top*8*SCREEN_WIDTH + rectangle1.left*8; + dest = (byte *)surface->getPixels() + sprite.drawY * SCREEN_WIDTH + sprite.drawX + + rectangle1.top * 8 * SCREEN_WIDTH + rectangle1.left * 8; byte *src = sprite.bitmap->pixels + rectangle1.top * sprite.bitmap->width / 8 + rectangle1.left; - for (int y=0; y < drawHeight; y++) { - for (int x=0; x < drawWidth; x++) { + for (int y = 0; y < drawHeight; y++) { + for (int x = 0; x < drawWidth; x++) { byte c = *src; int textColor; @@ -456,7 +456,7 @@ void Graphics::drawAllSprites(bool updateScreen) { Common::sort(_sprites, _sprites + _numSprites, &compareSpritesByLayer); // Update sprite rectangles - for (int i=0; i<_numSprites; i++) { + for (int i = 0; i < _numSprites; i++) { Sprite *spr = _sprites[i]; Common::Rect rect; @@ -483,15 +483,13 @@ void Graphics::drawAllSprites(bool updateScreen) { spr->rectangle2 = getRectEncompassing(spr->drawRect, spr->lastDrawRect); spr->rect2Valid = 1; } - } - else { + } else { spr->rectangle2 = spr->drawRect; spr->rect2Valid = 1; } spr->isOnScreen = 1; - } - else { // Off-screen + } else { // Off-screen spr->rect2Valid = 0; spr->isOnScreen = 0; } @@ -508,13 +506,11 @@ void Graphics::drawAllSprites(bool updateScreen) { if (spr->isOnScreen) { if (spr->rect2Valid) { dirtyRects[numDirtyRects++] = spr->rectangle2; - } - else { + } else { dirtyRects[numDirtyRects++] = spr->drawRect; dirtyRects[numDirtyRects++] = spr->lastDrawRect; } - } - else { + } else { dirtyRects[numDirtyRects++] = spr->lastDrawRect; } } @@ -584,8 +580,7 @@ void Graphics::drawAllSprites(bool updateScreen) { if (_mouseToBeShown) { CursorMan.showMouse(true); _mouseToBeShown = false; - } - else if (_mouseToBeHidden) { + } else if (_mouseToBeHidden) { CursorMan.showMouse(false); _mouseToBeHidden = false; } @@ -650,7 +645,7 @@ void Graphics::addSprite(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]) continue; diff --git a/engines/startrek/graphics.h b/engines/startrek/graphics.h index bea8b8939a..ecef5fc9ea 100644 --- a/engines/startrek/graphics.h +++ b/engines/startrek/graphics.h @@ -50,7 +50,7 @@ class Graphics { public: Graphics(StarTrekEngine *vm); ~Graphics(); - + void setBackgroundImage(SharedPtr<Bitmap> bitmap); /** * @param origRect The rectangle containing the original bitmap (must contain the @@ -104,20 +104,22 @@ public: 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, const Common::Rect &rect); - void drawAllSprites(bool updateScreen=true); + void drawAllSprites(bool updateScreen = true); /** * 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). */ 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 delSprite(Sprite *sprite); - + // Save/load the current state of sprites. Can only push once for now. void pushSprites(); void popSprites(); @@ -126,11 +128,11 @@ public: void drawDirectToScreen(SharedPtr<Bitmap> bitmap); void loadEGAData(const char *egaFile); void drawBackgroundImage(const char *filename); - + private: StarTrekEngine *_vm; Font *_font; - + bool _egaMode; byte *_egaData; byte *_palData; diff --git a/engines/startrek/iwfile.h b/engines/startrek/iwfile.h index 16291ad4c1..3f230ffb2b 100644 --- a/engines/startrek/iwfile.h +++ b/engines/startrek/iwfile.h @@ -38,7 +38,9 @@ class IWFile { public: 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 * (in a straight line) from a given position. diff --git a/engines/startrek/lzss.cpp b/engines/startrek/lzss.cpp index 2e04d08d38..bc7e8898b6 100644 --- a/engines/startrek/lzss.cpp +++ b/engines/startrek/lzss.cpp @@ -73,7 +73,7 @@ Common::SeekableReadStream *decodeLZSS(Common::SeekableReadStream *indata, uint3 } } - delete[] histbuff; + delete[] histbuff; if (outstreampos != uncompressedSize) error("Size mismatch in LZSS decompression; expected %d bytes, got %d bytes", uncompressedSize, outstreampos); diff --git a/engines/startrek/lzss.h b/engines/startrek/lzss.h index 293a6894db..15998121c2 100644 --- a/engines/startrek/lzss.h +++ b/engines/startrek/lzss.h @@ -32,24 +32,24 @@ Common::SeekableReadStream *decodeLZSS(Common::SeekableReadStream *indata, uint3 /* class LzssReadStream : public Common::SeekableReadStream { private: - uint8 *_outLzssBufData; - uint32 _size; - uint32 _pos; + uint8 *_outLzssBufData; + uint32 _size; + uint32 _pos; - uint32 decodeLZSS(Common::ReadStream *in, uint8 lengthmask, uint8 lengthbits); + uint32 decodeLZSS(Common::ReadStream *in, uint8 lengthmask, uint8 lengthbits); public: - LzssReadStream(Common::ReadStream *indata, uint8 lengthmask, uint8 lengthbits); - ~LzssReadStream(); - - bool eos() const; - uint32 read(void *buf, uint32 length); - int32 pos() const { return _pos; } - int32 size() const { return _size; } - bool seek(int32 offset, int whence) { - // TODO - return false; - } + LzssReadStream(Common::ReadStream *indata, uint8 lengthmask, uint8 lengthbits); + ~LzssReadStream(); + + bool eos() const; + uint32 read(void *buf, uint32 length); + int32 pos() const { return _pos; } + int32 size() const { return _size; } + bool seek(int32 offset, int whence) { + // TODO + return false; + } }; */ diff --git a/engines/startrek/menu.cpp b/engines/startrek/menu.cpp index e9cebca6a5..2251588616 100644 --- a/engines/startrek/menu.cpp +++ b/engines/startrek/menu.cpp @@ -62,7 +62,7 @@ void StarTrekEngine::chooseMousePositionFromSprites(Sprite *sprites, int numSpri Common::Rect rect = sprites[containMouseSprite].getRect(); 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.y = (rect.top + rect.bottom) / 2; } @@ -80,14 +80,14 @@ void StarTrekEngine::chooseMousePositionFromSprites(Sprite *sprites, int numSpri int vCenter = (rect.top + rect.bottom) / 2; // Choose which sprite is closest based on certain criteria? - switch(mode) { + switch (mode) { case 0: // Choose topmost, leftmost sprite that's below the cursor if (((vCenter == mousePos.y && hCenter > mousePos.x) || vCenter > mousePos.y) - && (vCenter < mouseY1 || (vCenter == mouseY1 && hCenter < mouseX1))) { + && (vCenter < mouseY1 || (vCenter == mouseY1 && hCenter < mouseX1))) { mouseX1 = hCenter; mouseY1 = vCenter; } - // fall through + // fall through case 4: // Choose topmost, leftmost sprite 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 if (((vCenter == mousePos.y && hCenter < mousePos.x) || vCenter < mousePos.y) - && (mouseY1 == 0x7fff || vCenter > mouseY1 - || (vCenter == mouseY1 && hCenter > mouseX1))) { + && (mouseY1 == 0x7fff || vCenter > mouseY1 + || (vCenter == mouseY1 && hCenter > mouseX1))) { mouseX1 = hCenter; mouseY1 = vCenter; } - // fall through + // fall through case 5: // Choose bottommost, rightmost sprite if (mouseY2 == 0x7fff || vCenter > mouseY2 - || (vCenter == mouseY2 && hCenter > mouseX2)) { + || (vCenter == mouseY2 && hCenter > mouseX2)) { mouseX2 = hCenter; mouseY2 = vCenter; } @@ -116,12 +116,12 @@ void StarTrekEngine::chooseMousePositionFromSprites(Sprite *sprites, int numSpri case 2: // This seems broken... OR condition on first line has no affect on the logic... if ((vCenter < mousePos.y || (vCenter == mouseY1 && hCenter == mousePos.x)) - && (mouseX1 == 0x7fff || vCenter >= mouseY1)) { + && (mouseX1 == 0x7fff || vCenter >= mouseY1)) { mouseX1 = hCenter; mouseY1 = vCenter; } if (mouseX2 == 0x7fff || vCenter > mouseY2 - || (hCenter == mouseX2 && vCenter == mouseY2)) { + || (hCenter == mouseX2 && vCenter == mouseY2)) { mouseX2 = hCenter; mouseY2 = vCenter; } @@ -130,12 +130,12 @@ void StarTrekEngine::chooseMousePositionFromSprites(Sprite *sprites, int numSpri case 3: // Similar to above... if ((vCenter > mousePos.y || (vCenter == mouseY1 && hCenter == mousePos.x)) - && (mouseX1 == 0x7fff || vCenter <= mouseY1)) { + && (mouseX1 == 0x7fff || vCenter <= mouseY1)) { mouseX1 = hCenter; mouseY1 = vCenter; } if (mouseX2 == 0x7fff || vCenter < mouseY2 - || (hCenter == mouseX2 && vCenter == mouseY2)) { + || (hCenter == mouseX2 && vCenter == mouseY2)) { mouseX2 = hCenter; 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 // indices... - switch(event) { + switch (event) { case 0: // Save showSaveMenu(); break; @@ -342,8 +342,7 @@ selectAndExit: break; case TREKEVENT_MOUSEMOVE: -mousePosChanged: - { +mousePosChanged: { Common::Point mouse = _gfx->getMousePos(); 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) { _activeMenu->disabledButtons |= bits; if (_activeMenu->selectedButton != -1 - && (_activeMenu->disabledButtons & (1 << _activeMenu->selectedButton))) { + && (_activeMenu->disabledButtons & (1 << _activeMenu->selectedButton))) { Sprite *sprite = &_activeMenu->sprites[_activeMenu->selectedButton]; drawMenuButtonOutline(sprite->bitmap, 0x00); @@ -606,13 +605,13 @@ int StarTrekEngine::handleMenuEvents(uint32 ticksUntilClickingEnabled, bool inTe while (true) { TrekEvent event; while (popNextEvent(&event)) { - switch(event.type) { + switch (event.type) { case TREKEVENT_TICK: { Common::Point mousePos = _gfx->getMousePos(); int buttonIndex = getMenuButtonAt(_activeMenu->sprites, _activeMenu->numButtons, mousePos.x, mousePos.y); if (buttonIndex != -1) { - if (_activeMenu->disabledButtons & (1<<buttonIndex)) + if (_activeMenu->disabledButtons & (1 << buttonIndex)) buttonIndex = -1; } @@ -689,7 +688,7 @@ rclick: case Common::KEYCODE_SPACE: if (!(_activeMenu->disabledButtons & (1 << TEXTBUTTON_NEXTCHOICE)) - && _activeMenu->sprites[TEXTBUTTON_NEXTCHOICE].drawMode == 2) { + && _activeMenu->sprites[TEXTBUTTON_NEXTCHOICE].drawMode == 2) { playSoundEffectIndex(SND_SELECTION); return TEXTBUTTON_NEXTCHOICE; } @@ -698,7 +697,7 @@ rclick: case Common::KEYCODE_HOME: case Common::KEYCODE_KP7: if (!(_activeMenu->disabledButtons & (1 << TEXTBUTTON_SCROLLUP)) - && _activeMenu->sprites[TEXTBUTTON_SCROLLUP].drawMode == 2) { + && _activeMenu->sprites[TEXTBUTTON_SCROLLUP].drawMode == 2) { playSoundEffectIndex(SND_SELECTION); return TEXTBUTTON_GOTO_TOP; } @@ -707,7 +706,7 @@ rclick: case Common::KEYCODE_UP: case Common::KEYCODE_KP8: if (!(_activeMenu->disabledButtons & (1 << TEXTBUTTON_SCROLLUP)) - && _activeMenu->sprites[TEXTBUTTON_SCROLLUP].drawMode == 2) { + && _activeMenu->sprites[TEXTBUTTON_SCROLLUP].drawMode == 2) { playSoundEffectIndex(SND_SELECTION); return TEXTBUTTON_SCROLLUP_ONELINE; } @@ -716,7 +715,7 @@ rclick: case Common::KEYCODE_PAGEUP: case Common::KEYCODE_KP9: if (!(_activeMenu->disabledButtons & (1 << TEXTBUTTON_SCROLLUP)) - && _activeMenu->sprites[TEXTBUTTON_SCROLLUP].drawMode == 2) { + && _activeMenu->sprites[TEXTBUTTON_SCROLLUP].drawMode == 2) { playSoundEffectIndex(SND_SELECTION); return TEXTBUTTON_SCROLLUP; } @@ -725,7 +724,7 @@ rclick: case Common::KEYCODE_LEFT: case Common::KEYCODE_KP4: if (!(_activeMenu->disabledButtons & (1 << TEXTBUTTON_PREVCHOICE)) - && _activeMenu->sprites[TEXTBUTTON_PREVCHOICE].drawMode == 2) { + && _activeMenu->sprites[TEXTBUTTON_PREVCHOICE].drawMode == 2) { playSoundEffectIndex(SND_SELECTION); return TEXTBUTTON_PREVCHOICE; } @@ -734,7 +733,7 @@ rclick: case Common::KEYCODE_RIGHT: case Common::KEYCODE_KP6: if (!(_activeMenu->disabledButtons & (1 << TEXTBUTTON_NEXTCHOICE)) - && _activeMenu->sprites[TEXTBUTTON_NEXTCHOICE].drawMode == 2) { + && _activeMenu->sprites[TEXTBUTTON_NEXTCHOICE].drawMode == 2) { playSoundEffectIndex(SND_SELECTION); return TEXTBUTTON_NEXTCHOICE; } @@ -743,7 +742,7 @@ rclick: case Common::KEYCODE_END: case Common::KEYCODE_KP1: if (!(_activeMenu->disabledButtons & (1 << TEXTBUTTON_SCROLLDOWN)) - && _activeMenu->sprites[TEXTBUTTON_SCROLLDOWN].drawMode == 2) { + && _activeMenu->sprites[TEXTBUTTON_SCROLLDOWN].drawMode == 2) { playSoundEffectIndex(SND_SELECTION); return TEXTBUTTON_GOTO_BOTTOM; } @@ -752,7 +751,7 @@ rclick: case Common::KEYCODE_DOWN: case Common::KEYCODE_KP2: if (!(_activeMenu->disabledButtons & (1 << TEXTBUTTON_SCROLLDOWN)) - && _activeMenu->sprites[TEXTBUTTON_SCROLLDOWN].drawMode == 2) { + && _activeMenu->sprites[TEXTBUTTON_SCROLLDOWN].drawMode == 2) { playSoundEffectIndex(SND_SELECTION); return TEXTBUTTON_SCROLLDOWN_ONELINE; } @@ -761,7 +760,7 @@ rclick: case Common::KEYCODE_PAGEDOWN: case Common::KEYCODE_KP3: if (!(_activeMenu->disabledButtons & (1 << TEXTBUTTON_SCROLLDOWN)) - && _activeMenu->sprites[TEXTBUTTON_SCROLLDOWN].drawMode == 2) { + && _activeMenu->sprites[TEXTBUTTON_SCROLLDOWN].drawMode == 2) { playSoundEffectIndex(SND_SELECTION); return TEXTBUTTON_SCROLLDOWN; } @@ -986,7 +985,7 @@ void StarTrekEngine::showTextConfigurationMenu(bool fromOptionMenu) { saveTextDisplayMode(val); } - switch(val) { + switch (val) { case 0: _textDisplayMode = TEXTDISPLAY_SUBTITLES; break; diff --git a/engines/startrek/object.h b/engines/startrek/object.h index 4d3b270a02..d412b8e6c1 100644 --- a/engines/startrek/object.h +++ b/engines/startrek/object.h @@ -171,13 +171,12 @@ public: fielda2(), fielda4(), - fielda6() - { - memset(animFilename, 0, sizeof(animFilename)); - memset(bitmapFilename, 0, sizeof(bitmapFilename)); - memset(animationString2, 0, sizeof(animationString2)); - memset(animationString, 0, sizeof(animationString)); - } + fielda6() { + memset(animFilename, 0, sizeof(animFilename)); + memset(bitmapFilename, 0, sizeof(bitmapFilename)); + memset(animationString2, 0, sizeof(animationString2)); + memset(animationString, 0, sizeof(animationString)); + } }; diff --git a/engines/startrek/room.cpp b/engines/startrek/room.cpp index fae52503af..daf8e09512 100644 --- a/engines/startrek/room.cpp +++ b/engines/startrek/room.cpp @@ -30,18 +30,18 @@ // TODO: Delete this macro, replacing it with the next one. // New "[roomName]NumActions" variables need to be made before that. #define ADD_ROOM_OLD(ROOM) {\ - if (name.equalsIgnoreCase(#ROOM)) {\ - _roomActionList = ROOM##ActionList;\ - _numRoomActions = sizeof(ROOM##ActionList) / sizeof(RoomAction);\ - }\ -} + if (name.equalsIgnoreCase(#ROOM)) {\ + _roomActionList = ROOM##ActionList;\ + _numRoomActions = sizeof(ROOM##ActionList) / sizeof(RoomAction);\ + }\ + } #define ADD_ROOM(ROOM) {\ - if (name.equalsIgnoreCase(#ROOM)) {\ - _roomActionList = ROOM##ActionList;\ - _numRoomActions = ROOM##NumActions;\ - }\ -} + if (name.equalsIgnoreCase(#ROOM)) {\ + _roomActionList = ROOM##ActionList;\ + _numRoomActions = ROOM##NumActions;\ + }\ + } namespace StarTrek { @@ -277,8 +277,7 @@ int Room::showRoomSpecificText(const char **array) { textColor = TEXTCOLOR_RED; else textColor = TEXTCOLOR_GREY; - } - else + } else textColor = TEXTCOLOR_YELLOW; return _vm->showText(&StarTrekEngine::readTextFromArrayWithChoices, (uintptr)array, 20, 20, textColor, true, false, false); diff --git a/engines/startrek/room.h b/engines/startrek/room.h index b8d5145c85..484613ad88 100644 --- a/engines/startrek/room.h +++ b/engines/startrek/room.h @@ -64,10 +64,18 @@ public: * "minimum" scale; that value rises to the "max scale" value by the time they reach * the "max Y" value. */ - uint16 getMaxY() { return readRdfWord(0x06); } - uint16 getMinY() { return readRdfWord(0x08); } - Fixed8 getMinScale() { return Fixed8::fromRaw(readRdfWord(0x0a)); } - Fixed8 getMaxScale() { return Fixed8::fromRaw(readRdfWord(0x0c)); } + uint16 getMaxY() { + return readRdfWord(0x06); + } + 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. @@ -87,14 +95,26 @@ public: bool handleActionWithBitmask(const Action &action); bool handleActionWithBitmask(byte type, byte b1, byte b2, byte b3); - uint16 getFirstHotspot() { return readRdfWord(0x12); } - uint16 getHotspotEnd() { return readRdfWord(0x14); } + uint16 getFirstHotspot() { + return readRdfWord(0x12); + } + uint16 getHotspotEnd() { + return readRdfWord(0x14); + } // Warp-related stuff - uint16 getFirstWarpPolygonOffset() { return readRdfWord(0x16); } - uint16 getWarpPolygonEndOffset() { return readRdfWord(0x18); } - uint16 getFirstDoorPolygonOffset() { return readRdfWord(0x1a); } - uint16 getDoorPolygonEndOffset() { return readRdfWord(0x1c); } + uint16 getFirstWarpPolygonOffset() { + return readRdfWord(0x16); + } + 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 diff --git a/engines/startrek/rooms/demon0.cpp b/engines/startrek/rooms/demon0.cpp index 9adb2eb307..e16e88427c 100644 --- a/engines/startrek/rooms/demon0.cpp +++ b/engines/startrek/rooms/demon0.cpp @@ -280,8 +280,7 @@ void Room::demon0TalkToMcCoy() { showText(TX_SPEAKER_SPOCK, TX_DEM0_029); if (!_vm->_awayMission.redshirtDead) showText(TX_SPEAKER_EVERTS, TX_DEM0_041); - } - else { + } else { showText(TX_SPEAKER_MCCOY, TX_DEM0_019); if (!_vm->_awayMission.demon.askedPrelateAboutSightings) { demon0AskPrelateAboutSightings(); diff --git a/engines/startrek/rooms/demon1.cpp b/engines/startrek/rooms/demon1.cpp index 3bd3e7caed..a30b5cc9ea 100644 --- a/engines/startrek/rooms/demon1.cpp +++ b/engines/startrek/rooms/demon1.cpp @@ -37,8 +37,7 @@ void Room::demon1Tick1() { _vm->_awayMission.crewDirectionsAfterWalk[OBJECT_SPOCK] = DIR_N; _vm->_awayMission.crewDirectionsAfterWalk[OBJECT_MCCOY] = 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_SPOCK] = DIR_S; _vm->_awayMission.crewDirectionsAfterWalk[OBJECT_MCCOY] = DIR_S; @@ -48,8 +47,7 @@ void Room::demon1Tick1() { if (!_vm->_awayMission.demon.beatKlingons) { _vm->_awayMission.disableWalking = true; _vm->_awayMission.timers[2] = 50; - } - else { + } else { loadActorAnim(8, "klg1d2", 0x120, 0x82, 0); if (!_vm->_awayMission.demon.tookKlingonHand) loadActorAnim(13, "klghnd", 0x10b, 0x8e, 0); @@ -126,8 +124,7 @@ void Room::demon1Timer1Expired() { // TODO return; } - } - else if (_rdfData[0xcb] != 1) { + } else if (_rdfData[0xcb] != 1) { anim = "klg2f"; shooter = 9; switch (_roomVar.demon1.attackIndex) { @@ -147,8 +144,7 @@ void Room::demon1Timer1Expired() { // TODO return; } - } - else { + } else { anim = "klg3f"; shooter = 10; switch (_roomVar.demon1.attackIndex) { @@ -182,16 +178,13 @@ void Room::demon1KlingonFinishedAimingWeapon() { if (_roomVar.demon1.attackIndex == 1) { loadActorAnim2(OBJECT_REDSHIRT, "rstunn", -1, -1, 0); crewman = OBJECT_REDSHIRT; - } - else if (_roomVar.demon1.attackIndex == 2) { + } else if (_roomVar.demon1.attackIndex == 2) { loadActorAnim2(OBJECT_SPOCK, "sstunn", -1, -1, 0); crewman = OBJECT_SPOCK; - } - else if (_roomVar.demon1.attackIndex == 3) { + } else if (_roomVar.demon1.attackIndex == 3) { loadActorAnim2(OBJECT_MCCOY, "mstune", -1, -1, 0); crewman = OBJECT_MCCOY; - } - else if (_roomVar.demon1.attackIndex == 4) { + } else if (_roomVar.demon1.attackIndex == 4) { loadActorAnim2(OBJECT_KIRK, "kstunn", -1, -1, 1); crewman = OBJECT_KIRK; } @@ -221,8 +214,7 @@ void Room::demon1UsePhaserOnKlingon1() { if (_roomVar.demon1.kirkShooting) { demon1ShootKlingon1(); - } - else { + } else { loadActorAnim2(OBJECT_KIRK, "kfiren", -1, -1, 3); _roomVar.demon1.kirkShooting = true; } @@ -270,8 +262,7 @@ void Room::demon1UsePhaserOnKlingon2() { if (_roomVar.demon1.kirkShooting) { demon1ShootKlingon2(); - } - else { + } else { loadActorAnim2(OBJECT_KIRK, "kfiren", -1, -1, 4); _roomVar.demon1.kirkShooting = true; } @@ -300,8 +291,7 @@ void Room::demon1UsePhaserOnKlingon3() { if (_roomVar.demon1.kirkShooting) { demon1ShootKlingon3(); - } - else { + } else { loadActorAnim2(OBJECT_KIRK, "kfiren", -1, -1, 5); _roomVar.demon1.kirkShooting = true; } @@ -390,8 +380,7 @@ void Room::demon1UseSTricorderOnKlingon1() { if (_roomVar.demon1.numKlingonsKilled == 3 && !_vm->_awayMission.demon.tookKlingonHand && _rdfData[0xcf] != 1) { showText(TX_SPEAKER_SPOCK, TX_DEM1_018); _rdfData[0xcf] = 1; - } - else { + } else { showText(TX_SPEAKER_SPOCK, TX_DEM1_019); } } diff --git a/engines/startrek/rooms/demon3.cpp b/engines/startrek/rooms/demon3.cpp index 689882d512..8584465070 100644 --- a/engines/startrek/rooms/demon3.cpp +++ b/engines/startrek/rooms/demon3.cpp @@ -45,8 +45,7 @@ void Room::demon3Tick1() { if (_vm->_awayMission.demon.doorOpened) { loadActorAnim(14, "door2", 0x82, 0x0c, 0); - } - else { + } else { loadMapFile("demon3a"); } @@ -91,8 +90,7 @@ void Room::demon3Timer3Expired() { loadMapFile("demon3"); _vm->_awayMission.demon.doorOpened = true; _vm->_awayMission.demon.missionScore += 2; - } - else { + } else { showText(TX_DEM3N007); } } @@ -237,8 +235,7 @@ void Room::demon3UsePhaserOnBoulder3() { _roomVar.demon3.boulderBeingShot = 3; strcpy(_roomVar.demon3.boulderAnim, "s0r3s1"); demon3BoulderCommon(); - } - else { + } else { showText(TX_SPEAKER_SPOCK, TX_DEM3_006); } } @@ -253,8 +250,7 @@ void Room::demon3UsePhaserOnBoulder4() { strcpy(_roomVar.demon3.boulderAnim, "s0r3s4"); _vm->_awayMission.demon.foundMiner = true; demon3BoulderCommon(); - } - else { + } else { // BUGFIX: In the original, the audio didn't play, despite the file existing (and // despite it being used for the boulder on the left). showText(TX_SPEAKER_SPOCK, TX_DEM3_006); @@ -271,8 +267,7 @@ void Room::demon3BoulderCommon() { if (_roomVar.demon3.inFiringPosition) { demon3PullOutPhaserAndFireAtBoulder(); - } - else { + } else { showText(TX_SPEAKER_KIRK, TX_DEM3_001); walkCrewman(OBJECT_KIRK, 0x79, 0xa0, 1); @@ -348,8 +343,7 @@ void Room::demon3RedshirtUsedPanel() { playSoundEffectIndex(0x06); _vm->_awayMission.redshirtDead = true; _vm->_awayMission.demon.field45 = true; - } - else { + } else { const int textTable[] = { TX_DEM3N005, TX_DEM3_033, @@ -404,8 +398,7 @@ void Room::demon3UseHandOnPanel() { if (_vm->_awayMission.demon.doorOpened) return; walkCrewman(OBJECT_KIRK, 0xd8, 0x70, 7); - } - else { + } else { showText(TX_SPEAKER_SPOCK, TX_DEM3_005); } } @@ -428,8 +421,7 @@ void Room::demon3UseMTricorderOnMiner() { if (_vm->_awayMission.demon.minerDead) { showText(TX_SPEAKER_MCCOY, TX_DEM3_022); - } - else { + } else { showText(TX_SPEAKER_MCCOY, TX_DEM3_023); } } @@ -437,8 +429,7 @@ void Room::demon3UseMTricorderOnMiner() { void Room::demon3UseMedkitOnMiner() { if (_vm->_awayMission.demon.healedMiner) { showText(TX_SPEAKER_MCCOY, TX_DEM3_015); - } - else { + } else { walkCrewman(OBJECT_MCCOY, 0xe6, 0x7b, 6); _roomVar.demon3.inFiringPosition = false; _roomVar.demon3.kirkPhaserOut = false; @@ -452,8 +443,7 @@ void Room::demon3McCoyReachedMiner() { void Room::demon3McCoyFinishedHealingMiner() { if (_vm->_awayMission.demon.minerDead) { showText(TX_SPEAKER_MCCOY, TX_DEM3_022); - } - else { + } else { showText(TX_SPEAKER_MCCOY, TX_DEM3_021); _vm->_awayMission.demon.healedMiner = true; loadActorAnim2(13, "drmine", 0xda, 0x6c, 0); @@ -485,8 +475,7 @@ void Room::demon3TalkToSpock() { void Room::demon3TalkToMccoy() { if (_vm->_awayMission.redshirtDead) { showText(TX_SPEAKER_MCCOY, TX_DEM3_014); - } - else { + } else { showText(TX_SPEAKER_MCCOY, TX_DEM3_025); showText(TX_SPEAKER_KIRK, TX_DEM3_003); showText(TX_SPEAKER_MCCOY, TX_DEM3_024); @@ -517,8 +506,7 @@ void Room::demon3LookAtRedshirt() { if (_vm->_awayMission.redshirtDead) { showText(TX_DEM3N017); // NOTE: there's an alternate string that isn't used? (TX_DEM3N018) - } - else { + } else { showText(TX_DEM3N003); } } @@ -530,8 +518,7 @@ void Room::demon3LookAnywhere() { void Room::demon3LookAtMiner() { if (_vm->_awayMission.demon.healedMiner) { showText(TX_DEM3N000); - } - else { + } else { showText(TX_DEM3N006); } } @@ -559,8 +546,7 @@ void Room::demon3LookAtStructure() { void Room::demon3LookAtDoor() { if (_vm->_awayMission.demon.doorOpened) { showText(TX_DEM3N014); - } - else { + } else { showText(TX_DEM3N012); } } diff --git a/engines/startrek/rooms/demon4.cpp b/engines/startrek/rooms/demon4.cpp index b42eb80f28..d70c5fb1be 100644 --- a/engines/startrek/rooms/demon4.cpp +++ b/engines/startrek/rooms/demon4.cpp @@ -140,8 +140,7 @@ void Room::demon4UsePhaserOnNauian() { if (!_roomVar.demon4.triedToShootNauian) { // Lenient the first time showText(TX_SPEAKER_NAUIAN, TX_DEM4_033); _roomVar.demon4.triedToShootNauian = true; - } - else { // Murdery the second time + } else { // Murdery the second time showText(TX_SPEAKER_NAUIAN, TX_DEM4_032); loadActorAnim2(10, "bxfire", 0, 0, 2); playVoc("V0SPOCKT"); @@ -279,12 +278,10 @@ void Room::demon4TalkToNauian() { _vm->_awayMission.disableInput = true; _vm->_awayMission.demon.missionScore += 5; _vm->_awayMission.timers[1] = 20; - } - else { + } else { showText(TX_SPEAKER_NAUIAN, TX_DEM4_038); } - } - else { + } else { showText(TX_SPEAKER_NAUIAN, TX_DEM4_031); } } @@ -367,8 +364,7 @@ void Room::demon4CrewmanReachedPanel() { loadActorAnim(9, "ctrl", 0, 0, 0); _vm->_awayMission.demon.missionScore += 3; _vm->_awayMission.timers[0] = 10; - } - else + } else showText(TX_DEM4N013); walkCrewman(_roomVar.demon4.crewmanUsingPanel, 0xae, 0x93, 0); diff --git a/engines/startrek/rooms/demon5.cpp b/engines/startrek/rooms/demon5.cpp index 010b90c666..7227dd0cc1 100644 --- a/engines/startrek/rooms/demon5.cpp +++ b/engines/startrek/rooms/demon5.cpp @@ -158,8 +158,7 @@ void Room::demon5TalkToRoberts() { _roomVar.demon5.numTalkedTo++; demon5CheckCompletedStudy(); } - } - else { + } else { showText(TX_DEM5N010); } } @@ -177,8 +176,7 @@ void Room::demon5TalkToChub() { _roomVar.demon5.numTalkedTo++; demon5CheckCompletedStudy(); } - } - else { + } else { showText(TX_DEM5N013); } } @@ -195,8 +193,7 @@ void Room::demon5TalkToGrisnash() { _roomVar.demon5.numTalkedTo++; demon5CheckCompletedStudy(); } - } - else { + } else { showText(TX_DEM5N011); } } @@ -214,21 +211,16 @@ void Room::demon5TalkToStephen() { _roomVar.demon5.numTalkedTo++; demon5CheckCompletedStudy(); } - } - else if (!_vm->_awayMission.demon.knowAboutHypoDytoxin) { + } else if (!_vm->_awayMission.demon.knowAboutHypoDytoxin) { 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); - } - else if (_vm->_awayMission.demon.gotBerries) { + } else if (_vm->_awayMission.demon.gotBerries) { showText(TX_SPEAKER_ROBERTS, TX_DEM5_032); _vm->_awayMission.demon.field3e = false; - } - else if (_vm->_awayMission.demon.field3e) { + } else if (_vm->_awayMission.demon.field3e) { showText(TX_SPEAKER_ROBERTS, TX_DEM5_038); - } - else { + } else { showText(TX_SPEAKER_ROBERTS, TX_DEM5_034); } } @@ -258,8 +250,7 @@ void Room::demon5TalkToMccoy() { showText(TX_SPEAKER_SPOCK, TX_DEM5_026); showText(TX_SPEAKER_MCCOY, TX_DEM5_019); } - } - else { + } else { showText(TX_SPEAKER_MCCOY, TX_DEM5_017); } } @@ -287,8 +278,7 @@ void Room::demon5UseMTricorderOnChub() { _roomVar.demon5.scannedChub = true; _roomVar.demon5.numScanned++; demon5CheckCompletedStudy(); - } - else { + } else { if (_vm->_awayMission.demon.field3e) showText(TX_SPEAKER_MCCOY, TX_DEM5_010); else { diff --git a/engines/startrek/rooms/demon6.cpp b/engines/startrek/rooms/demon6.cpp index ca0c1a008f..a4cd58e5aa 100644 --- a/engines/startrek/rooms/demon6.cpp +++ b/engines/startrek/rooms/demon6.cpp @@ -174,8 +174,7 @@ void Room::demon6TalkToStephen() { void Room::demon6UseBerryOnStephen() { if (_vm->_awayMission.demon.knowAboutHypoDytoxin) { showText(TX_SPEAKER_STEPHEN, TX_DEM6_027); - } - else { + } else { showText(TX_SPEAKER_STEPHEN, TX_DEM6_026); } } @@ -209,8 +208,7 @@ void Room::demon6FinishedMakingHypoDytoxin() { void Room::demon6UseHandOnWorkspace() { if (_vm->_awayMission.demon.repairedHand) { showText(TX_SPEAKER_SPOCK, TX_DEM6N018); // FIXME - } - else { + } else { _vm->_awayMission.disableInput = true; showText(TX_SPEAKER_KIRK, TX_DEM6_005); walkCrewman(OBJECT_SPOCK, 0xb3, 0xbb, 2); @@ -247,8 +245,7 @@ insult: showText(TX_SPEAKER_STEPHEN, TX_DEM6_030); _roomVar.demon6.insultedStephenRecently = true; _vm->_awayMission.demon.insultedStephen = true; - } - else if (choice == 1) { + } else if (choice == 1) { showText(TX_SPEAKER_STEPHEN, TX_DEM6_034); explain: while (true) { @@ -280,8 +277,7 @@ explain: goto error; } } - } - else if (choice == 2) { + } else if (choice == 2) { showText(TX_SPEAKER_STEPHEN, TX_DEM6_031); int choices3[] = {TX_SPEAKER_KIRK, TX_DEM6_001, TX_DEM6_006, TX_BLANK}; choice = showText(choices3); @@ -292,13 +288,11 @@ explain: goto explain; else goto error; - } - else { + } else { error: showText(TX_DIALOG_ERROR); } - } - else { + } else { showText(TX_DEM6N012); showText(TX_SPEAKER_MCCOY, TX_DEM6_019); } diff --git a/engines/startrek/rooms/feather1.cpp b/engines/startrek/rooms/feather1.cpp index c5f7307c74..667608a7ff 100644 --- a/engines/startrek/rooms/feather1.cpp +++ b/engines/startrek/rooms/feather1.cpp @@ -475,10 +475,10 @@ void Room::feather1CrewmanClimbVine() { _vm->_awayMission.disableInput = true; if (_roomVar.feather.crewEscaped[_roomVar.feather.crewmanClimbingVine]) walkCrewmanC(_roomVar.feather.crewmanClimbingVine, VINE_TOP_X, VINE_TOP_Y, - &Room::feather1ReachedVineToClimbDown); + &Room::feather1ReachedVineToClimbDown); else walkCrewmanC(_roomVar.feather.crewmanClimbingVine, VINE_BOT_X, VINE_BOT_Y, - &Room::feather1ReachedVineToClimbUp); + &Room::feather1ReachedVineToClimbUp); } void Room::feather1ReachedVineToClimbUp() { diff --git a/engines/startrek/rooms/feather3.cpp b/engines/startrek/rooms/feather3.cpp index fd87c81d2f..ebdf48abf7 100644 --- a/engines/startrek/rooms/feather3.cpp +++ b/engines/startrek/rooms/feather3.cpp @@ -68,9 +68,9 @@ extern const RoomAction feather3ActionList[] = { { {ACTION_TALK, OBJECT_REDSHIRT, 0, 0}, &Room::feather3TalkToRedshirt }, { {ACTION_TALK, OBJECT_TLAOXAC, 0, 0}, &Room::feather3TalkToTlaoxac }, { {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_REDSHIRT, 0},&Room::feather3UseMedkitOnRedshirt }, + { {ACTION_USE, OBJECT_IMEDKIT, OBJECT_REDSHIRT, 0}, &Room::feather3UseMedkitOnRedshirt }, { {ACTION_USE, OBJECT_IMEDKIT, 0xff, 0}, &Room::feather3UseMedkitAnywhere }, { {ACTION_USE, OBJECT_IMTRICOR, HOTSPOT_LIGHT_1, 0}, &Room::feather3UseMTricorderOnLight }, { {ACTION_USE, OBJECT_IMTRICOR, HOTSPOT_LIGHT_2, 0}, &Room::feather3UseMTricorderOnLight }, diff --git a/engines/startrek/rooms/feather4.cpp b/engines/startrek/rooms/feather4.cpp index 69d3f37842..2c18155403 100644 --- a/engines/startrek/rooms/feather4.cpp +++ b/engines/startrek/rooms/feather4.cpp @@ -39,13 +39,13 @@ extern const RoomAction feather4ActionList[] = { { {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_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, 0xff, 0}, &Room::feather4UseSTricorderAnywhere }, { {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_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_IMEDKIT, 0xff, 0}, &Room::feather4UseMedkitAnywhere }, { {ACTION_TALK, OBJECT_MCCOY, 0, 0}, &Room::feather4TalkToMccoy }, diff --git a/engines/startrek/rooms/feather5.cpp b/engines/startrek/rooms/feather5.cpp index 843604d65c..a8ca002aa2 100644 --- a/engines/startrek/rooms/feather5.cpp +++ b/engines/startrek/rooms/feather5.cpp @@ -81,7 +81,7 @@ extern const RoomAction feather5ActionList[] = { { {ACTION_USE, OBJECT_IROCK, OBJECT_REDSHIRT, 0}, &Room::feather5UseRockOnRedshirt }, { {ACTION_USE, OBJECT_SPOCK, 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_MCCOY, OBJECT_MONSTER, 0}, &Room::feather5UseMccoyOnMonster }, { {ACTION_USE, OBJECT_REDSHIRT, OBJECT_MONSTER, 0}, &Room::feather5UseRedshirtOnMonster }, diff --git a/engines/startrek/rooms/feather6.cpp b/engines/startrek/rooms/feather6.cpp index 5b86a146b8..204d349459 100644 --- a/engines/startrek/rooms/feather6.cpp +++ b/engines/startrek/rooms/feather6.cpp @@ -55,7 +55,7 @@ extern const RoomAction feather6ActionList[] = { { {ACTION_USE, OBJECT_IROCK, HOTSPOT_STALAGMITES, 0}, &Room::feather6UseRockOnStalagmites }, { {ACTION_USE, OBJECT_IROCK, HOTSPOT_EAST_EXIT, 0}, &Room::feather6UseRockOnStalagmites }, { {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, OBJECT_MCCOY, 0}, &Room::feather6UseKnifeOnMccoy }, { {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_REDSHIRT, 0, 0}, &Room::feather6TalkToRedshirt }, { {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_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, HOTSPOT_ROCKS, 0}, &Room::feather6UseSTricorderOnRocks }, { {ACTION_USE, OBJECT_ISTRICOR, OBJECT_CRYSTALS, 0}, &Room::feather6UseSTricorderOnCrystals }, - { {ACTION_USE, OBJECT_ISTRICOR, HOTSPOT_STALACTITES, 0},&Room::feather6UseSTricorderOnStalactites }, - { {ACTION_USE, OBJECT_ISTRICOR, HOTSPOT_STALAGMITES, 0},&Room::feather6UseSTricorderOnStalagmites }, + { {ACTION_USE, OBJECT_ISTRICOR, HOTSPOT_STALACTITES, 0}, &Room::feather6UseSTricorderOnStalactites }, + { {ACTION_USE, OBJECT_ISTRICOR, HOTSPOT_STALAGMITES, 0}, &Room::feather6UseSTricorderOnStalagmites }, { {ACTION_GET, OBJECT_CRYSTALS, 0, 0}, &Room::feather6GetCrystals }, { {ACTION_USE, OBJECT_IKNIFE, OBJECT_CRYSTALS, 0}, &Room::feather6UseKnifeOnCrystals }, diff --git a/engines/startrek/rooms/love1.cpp b/engines/startrek/rooms/love1.cpp index 23a6e2a242..612cd8cd8c 100644 --- a/engines/startrek/rooms/love1.cpp +++ b/engines/startrek/rooms/love1.cpp @@ -77,7 +77,7 @@ void Room::love1Tick1() { common: loadActorAnim(OBJECT_BOTTLE, _roomVar.love.bottleAnimation, 0xa3, 0x72, 0); - // fall through + // fall through case BOTTLETYPE_NONE: break; @@ -308,8 +308,8 @@ void Room::love1KirkGotCureSample() { giveItem(OBJECT_ISAMPLE); showText(TX_LOV1N035); - // BUGFIX: after removing the cure, unset this variable. - // Otherwise, any normal dish inserted afterward automagically becomes a cure. + // BUGFIX: after removing the cure, unset this variable. + // Otherwise, any normal dish inserted afterward automagically becomes a cure. _vm->_awayMission.love.chamberHasCure = false; } else { giveItem(OBJECT_IDISHES); diff --git a/engines/startrek/rooms/love3.cpp b/engines/startrek/rooms/love3.cpp index f7d4af4eef..03ae5840b7 100644 --- a/engines/startrek/rooms/love3.cpp +++ b/engines/startrek/rooms/love3.cpp @@ -225,8 +225,7 @@ void Room::love3OpenedOrClosedServicePanel() { showText(TX_LOV3N023); else showText(TX_LOV3N022); - } - else + } else showText(TX_LOV3N020); } @@ -246,8 +245,7 @@ void Room::love3ScrewedOrUnscrewedGasTank() { if (!_vm->_awayMission.redshirtDead) showText(TX_SPEAKER_FERRIS, TX_LOV3_022); _vm->_awayMission.love.gasTankUnscrewed = true; - } - else { + } else { showText(TX_LOV3N015); _vm->_awayMission.love.gasTankUnscrewed = false; } @@ -351,8 +349,7 @@ void Room::love3OpenedOrClosedGrate() { _vm->_awayMission.love.gotPointsForOpeningGrate = true; _vm->_awayMission.love.missionScore++; } - } - else { + } else { loadActorAnim(OBJECT_GRATE, "s3r4g1", 0x116, 0x8f, 0); _vm->_awayMission.love.grateRemoved = false; showText(TX_LOV3N032); @@ -452,8 +449,7 @@ void Room::love3PouredRomulanLaughingGasDownShaft() { if (_vm->_awayMission.love.romulansUnconsciousFromVirus) { showText(TX_LOV3NA08); _vm->_awayMission.love.romulansUnconsciousFromLaughingGas = false; - } - else { + } else { showText(TX_LOV3NA09); playVoc("ROMULANL"); } @@ -500,8 +496,7 @@ void Room::love3ReachedGasTankUsingAntigrav() { if (_vm->_awayMission.love.gasTankUnscrewed) { loadActorAnimC(OBJECT_KIRK, "kusehe", -1, -1, &Room::love3PickedUpGasTank); playVoc("SE3PLBAT"); - } - else { + } else { showText(TX_LOV3N010); showText(TX_SPEAKER_SPOCK, TX_LOV3_015); } diff --git a/engines/startrek/rooms/love4.cpp b/engines/startrek/rooms/love4.cpp index cc05f72b5d..447f763928 100644 --- a/engines/startrek/rooms/love4.cpp +++ b/engines/startrek/rooms/love4.cpp @@ -41,8 +41,7 @@ void Room::love4Tick1() { loadActorAnim2(OBJECT_ROMULAN_2, "s3r5r2b", 0xb9, 0xbb, 0); loadActorAnim2(OBJECT_ROMULAN_3, "s3r5r3b", 0xef, 0xc4, 0); loadActorAnim2(OBJECT_ROMULAN_4, "s3r5r4b", 0x12a, 0xaa, 0); - } - else { + } else { loadActorAnim2(OBJECT_ROMULAN_1, "s3r5r1a", 0x36, 0xb3, 0); loadActorAnim2(OBJECT_ROMULAN_2, "s3r5r2a", 0xb9, 0xbb, 0); loadActorAnim2(OBJECT_ROMULAN_3, "s3r5r3a", 0xef, 0xc4, 0); diff --git a/engines/startrek/rooms/love5.cpp b/engines/startrek/rooms/love5.cpp index 4bb9cb6dad..fdad4a3a8b 100644 --- a/engines/startrek/rooms/love5.cpp +++ b/engines/startrek/rooms/love5.cpp @@ -40,8 +40,7 @@ void Room::love5Tick1() { if (_vm->_awayMission.love.freedMarcusAndCheever) { loadActorAnim(OBJECT_MARCUS, "marcusst", 0x28, 0xa6); loadActorAnim(OBJECT_CHEEVER, "s3gtupst", 0x49, 0xac); - } - else { + } else { loadActorAnim(OBJECT_MARCUS, "marcus2", 0x28, 0xa6); loadActorAnim(OBJECT_CHEEVER, "s3gtup2", 0x49, 0xac); } @@ -172,7 +171,7 @@ void Room::love5TalkToPreax() { switch (choice) { case 1: showText(TX_SPEAKER_MARCUS, TX_LOV5_043); - // fall through + // fall through case 0: showText(TX_SPEAKER_PREAX, TX_LOV5_061); showText(TX_SPEAKER_KIRK, TX_LOV5_010); @@ -199,8 +198,7 @@ void Room::love5TalkToPreax() { if (!_vm->_awayMission.love.spockCured) { showText(TX_SPEAKER_MCCOY, TX_LOV5_021); walkCrewmanC(OBJECT_MCCOY, 0x87, 0xc3, &Room::love5MccoyReachedSpockToCure); - } - else + } else love5EndMission(); } } else @@ -326,14 +324,12 @@ void Room::love5UseWaterOnPreax() { _vm->_awayMission.love.missionScore++; } loseItem(OBJECT_IH2O); - } - else { + } else { if (_vm->_awayMission.love.romulansUnconsciousFromVirus) { showText(TX_SPEAKER_MCCOY, TX_LOV5_013); // 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. - } - else { + } else { showText(TX_LOV5N017); if (!_vm->_awayMission.redshirtDead) { showText(TX_SPEAKER_FERRIS, TX_LOV5_053); diff --git a/engines/startrek/rooms/lovea.cpp b/engines/startrek/rooms/lovea.cpp index 9805123394..e4e9f1c158 100644 --- a/engines/startrek/rooms/lovea.cpp +++ b/engines/startrek/rooms/lovea.cpp @@ -67,8 +67,7 @@ void Room::loveaTimer0Expired() { if (randomVal == 0 || _vm->_awayMission.redshirtDead) { speaker = TX_SPEAKER_MCCOY; textTable = mccoyText; - } - else { + } else { speaker = TX_SPEAKER_FERRIS; textTable = ferrisText; } @@ -122,8 +121,7 @@ void Room::loveaUseCureSampleOnSpock() { if (_vm->_awayMission.love.spockCured) { walkCrewman(OBJECT_SPOCK, _roomVar.love.cmnXPosToCureSpock, _roomVar.love.cmnYPosToCureSpock, 99); walkCrewman(OBJECT_MCCOY, _roomVar.love.cmnXPosToCureSpock, _roomVar.love.cmnYPosToCureSpock + 10, 99); - } - else + } else showText(TX_SPEAKER_MCCOY, TX_LOVA_F55); } @@ -162,20 +160,16 @@ void Room::loveaTimer2Expired() { playMidiMusicTracks(2, -1); // FIXME: assembly had no second parameter...? showText(TX_GENER004); showGameOverMenu(); - } - else if (_vm->_awayMission.love.spockInfectionCounter == 15) { + } else if (_vm->_awayMission.love.spockInfectionCounter == 15) { showText(TX_SPEAKER_SPOCK, TX_SPOKCOFF); _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); _vm->_awayMission.love.spockInfectionCounter++; - } - else if (_vm->_awayMission.love.spockInfectionCounter == 45) { + } else if (_vm->_awayMission.love.spockInfectionCounter == 45) { showText(TX_SPEAKER_SPOCK, TX_SPOKCOFF); _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); _vm->_awayMission.love.romulansUnconsciousFromVirus = true; _vm->_awayMission.love.spockInfectionCounter++; diff --git a/engines/startrek/rooms/mudd0.cpp b/engines/startrek/rooms/mudd0.cpp index 9105c01e25..0b450e08fb 100644 --- a/engines/startrek/rooms/mudd0.cpp +++ b/engines/startrek/rooms/mudd0.cpp @@ -42,10 +42,10 @@ namespace StarTrek { void Room::mudd0Tick1() { playVoc("MUD0LOOP"); - // 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 - // supposed to be in the medbay. - // TODO: verify this matches with floppy version's code + // 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 + // supposed to be in the medbay. + // TODO: verify this matches with floppy version's code if (_vm->_awayMission.mudd.muddFirstRoomState != 0) _vm->_awayMission.mudd.muddFirstRoomState = 2; else { @@ -292,8 +292,7 @@ void Room::mudd0TalkToRedshirt() { if (_vm->_awayMission.mudd.muddFirstRoomState == 2) { showText(TX_SPEAKER_BUCHERT, TX_MUD0_039); showText(TX_SPEAKER_KIRK, TX_MUD0_008); - } - else { + } else { showText(TX_SPEAKER_BUCHERT, TX_MUD0_040); showText(TX_SPEAKER_MUDD, TX_MUD0_030); showText(TX_SPEAKER_BUCHERT, TX_MUD0_041); diff --git a/engines/startrek/rooms/mudd1.cpp b/engines/startrek/rooms/mudd1.cpp index a2baf71eb6..d741478f6d 100644 --- a/engines/startrek/rooms/mudd1.cpp +++ b/engines/startrek/rooms/mudd1.cpp @@ -174,7 +174,7 @@ void Room::mudd1SpockPressedRedButton() { case 1: showText(TX_SPEAKER_KIRK, TX_MUD1_007); - // fall through + // fall through case 2: _vm->_awayMission.mudd.torpedoStatus = 1; diff --git a/engines/startrek/rooms/mudd2.cpp b/engines/startrek/rooms/mudd2.cpp index 3a3ba81d14..ef1ec6afb5 100644 --- a/engines/startrek/rooms/mudd2.cpp +++ b/engines/startrek/rooms/mudd2.cpp @@ -301,8 +301,7 @@ void Room::mudd2UseMedkitOnMudd() { showText(TX_SPEAKER_MCCOY, TX_MUD2_021); else 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); } diff --git a/engines/startrek/rooms/mudd4.cpp b/engines/startrek/rooms/mudd4.cpp index 2905fb3e0a..90bdf1dcee 100644 --- a/engines/startrek/rooms/mudd4.cpp +++ b/engines/startrek/rooms/mudd4.cpp @@ -190,8 +190,7 @@ void Room::mudd4UseKirkOnConsole() { _vm->_awayMission.crewDirectionsAfterWalk[OBJECT_SPOCK] = DIR_N; walkCrewmanC(OBJECT_SPOCK, 0x6d, 0x9a, &Room::mudd4FinishedWalking3); _vm->_awayMission.disableInput = true; - } - else { + } else { if (!_roomVar.mudd.kirkUsingRightConsole) showText(TX_SPEAKER_KIRK, TX_MUD4_049); _vm->_awayMission.crewDirectionsAfterWalk[OBJECT_KIRK] = DIR_N; @@ -257,8 +256,7 @@ void Room::mudd4KirkUsedViewScreen() { _vm->_awayMission.mudd.gotPointsForEnablingViewscreen = true; _vm->_awayMission.mudd.missionScore++; } - } - else { + } else { _vm->_awayMission.mudd.viewScreenEnabled = false; loadActorAnim(OBJECT_VIEWSCREEN, "s4crvf", 0xa5, 0x76); _vm->_awayMission.timers[3] = 5; @@ -356,9 +354,9 @@ void Room::mudd4KirkReachedPositionToTalkToMudd() { _vm->_awayMission.disableInput = false; if (_vm->_awayMission.mudd.discoveredLenseAndDegrimerFunction - || _vm->_awayMission.mudd.muddErasedDatabase - || _vm->_awayMission.mudd.databaseDestroyed - || !_vm->_awayMission.mudd.accessedAlienDatabase) { // NOTE: why this last line? Test this... + || _vm->_awayMission.mudd.muddErasedDatabase + || _vm->_awayMission.mudd.databaseDestroyed + || !_vm->_awayMission.mudd.accessedAlienDatabase) { // NOTE: why this last line? Test this... const int choices[] = { TX_SPEAKER_KIRK, TX_MUD4_009, @@ -399,8 +397,7 @@ void Room::mudd4KirkReachedPositionToTalkToMudd() { showText(TX_SPEAKER_KIRK, TX_MUD4_036); showText(TX_SPEAKER_SPOCK, TX_MUD4_029); showText(TX_SPEAKER_KIRK, TX_MUD4_030); - } - else { + } else { // Mudd is forced to agree to give samples to a university. showText(TX_SPEAKER_MUDD, TX_MUD4_064); showText(TX_SPEAKER_KIRK, TX_MUD4_012); @@ -420,8 +417,7 @@ void Room::mudd4KirkReachedPositionToTalkToMudd() { endMission(_vm->_awayMission.mudd.missionScore, 0x1b, _vm->_awayMission.mudd.torpedoStatus); } - } - else { + } else { const int choices[] = { TX_SPEAKER_KIRK, TX_MUD4_014, diff --git a/engines/startrek/rooms/mudda.cpp b/engines/startrek/rooms/mudda.cpp index 03f71f9974..78c562958f 100644 --- a/engines/startrek/rooms/mudda.cpp +++ b/engines/startrek/rooms/mudda.cpp @@ -119,12 +119,12 @@ void Room::muddaTick() { /* // Unused: The positions to they originally walked to before collapsing. const Common::Point deathPositions[][4] = { - { 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(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(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(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(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(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) }, }; */ diff --git a/engines/startrek/rooms/trial5.cpp b/engines/startrek/rooms/trial5.cpp index a71d413545..ecc3c64c2e 100644 --- a/engines/startrek/rooms/trial5.cpp +++ b/engines/startrek/rooms/trial5.cpp @@ -461,7 +461,7 @@ void Room::trial5ReachedHoleToPutGem() { Common::Point(0x22, 0x95), Common::Point(0x3c, 0x95), }; - const char * const gemAnims[] = { + const char *const gemAnims[] = { "RedGem1", "RedGem2", "RedGem3", "GrnGem1", "GrnGem2", "GrnGem3", "BluGem1", "BluGem2", "BluGem3", diff --git a/engines/startrek/rooms/tug2.cpp b/engines/startrek/rooms/tug2.cpp index 8c24a36ac4..e3229c156c 100644 --- a/engines/startrek/rooms/tug2.cpp +++ b/engines/startrek/rooms/tug2.cpp @@ -139,8 +139,7 @@ void Room::tug2GetBomb() { _vm->_awayMission.disableInput = true; _vm->_awayMission.crewDirectionsAfterWalk[OBJECT_KIRK] = DIR_N; walkCrewman(OBJECT_KIRK, 0xc9, 0xa0, 12); - } - else + } else showText(TX_TUG2N024); } @@ -297,8 +296,7 @@ void Room::tug2KirkGotWires() { _vm->_awayMission.tug.gotWires = true; _vm->_awayMission.disableInput = false; _vm->_awayMission.tug.missionScore += 3; - } - else { + } else { loadActorStandAnim(OBJECT_WIRE); giveItem(OBJECT_IWIRING); _vm->_awayMission.tug.gotWires = true; @@ -368,8 +366,7 @@ void Room::tug2TurnedOffForceField() { loadActorAnim2(OBJECT_BOMB, "t2bbo", -3, 1, 0); // FIXME: doesn't play "PHASSHOT" sound effect like when kirk removes wires? _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; loadActorAnim2(OBJECT_BRIG, "fld10", 0, 0, 2); _vm->_awayMission.tug.missionScore += 6; @@ -459,7 +456,7 @@ void Room::tug2UseStunPhaserOnGuard2() { } 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); _vm->_awayMission.tug.guard2Status = GUARDSTAT_STUNNED; playSoundEffectIndex(SND_PHASSHOT); @@ -487,7 +484,7 @@ void Room::tug2UseKillPhaserOnGuard1() { } 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); _vm->_awayMission.tug.guard1Status = GUARDSTAT_DEAD; playSoundEffectIndex(SND_PHASSHOT); @@ -515,7 +512,7 @@ void Room::tug2UseKillPhaserOnGuard2() { } 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); _vm->_awayMission.tug.guard2Status = GUARDSTAT_DEAD; playSoundEffectIndex(SND_PHASSHOT); @@ -688,8 +685,7 @@ void Room::tug2Timer0Expired() { _roomVar.tug2.shootingTarget = OBJECT_SPOCK; _vm->_awayMission.timers[2] = 40; tug2GuardShootsCrewman(); - } - else if (_roomVar.tug2.shootKirkOverride) { + } else if (_roomVar.tug2.shootKirkOverride) { tug2DetermineElasiShooter(); _roomVar.tug2.shootingTarget = OBJECT_KIRK; _vm->_awayMission.timers[2] = 40; // TODO @@ -738,8 +734,7 @@ void Room::tug2GuardShootsCrewman() { bitmapArray = g1ShotsOnKill; else bitmapArray = g2ShotsOnKill; - } - else { + } else { anim = "_stune"; if (_roomVar.tug2.shootingObject == OBJECT_GUARD_1) bitmapArray = g1ShotsOnStun; diff --git a/engines/startrek/rooms/tug3.cpp b/engines/startrek/rooms/tug3.cpp index 6c1b67409d..c0a0b97263 100644 --- a/engines/startrek/rooms/tug3.cpp +++ b/engines/startrek/rooms/tug3.cpp @@ -208,8 +208,8 @@ void Room::tug3ElasiStunnedOrKilled() { if (_vm->_awayMission.tug.bridgeWinMethod == 1) return; 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) - return; + || _vm->_awayMission.tug.bridgeElasi3Status == GUARDSTAT_UP || _vm->_awayMission.tug.bridgeElasi4Status == GUARDSTAT_UP) + return; // BUGFIX: if the ship is deorbiting, the mission isn't won yet. if (_vm->_awayMission.tug.orbitalDecayCounter != 0) @@ -342,15 +342,13 @@ void Room::tug3TalkToMccoy() { if (_vm->_awayMission.tug.orbitalDecayCounter >= 10) { if (_vm->_awayMission.tug.orbitalDecayCounter < 16) 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 // exists, but the corresponding text was written from scratch for ScummVM. // TODO: check if original floppy version has text for this. showText(TX_SPEAKER_MCCOY, TX_TUG3_012); } - } - else + } else 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 < 16) showText(TX_SPEAKER_SPOCK, TX_TUG3_008); - } - else + } else 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. _vm->_awayMission.tug.orbitalDecayCounter = 0; if (!_vm->_awayMission.tug.elasiSurrendered && - (_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.bridgeElasi1Status == GUARDSTAT_UP + || _vm->_awayMission.tug.bridgeElasi2Status == GUARDSTAT_UP + || _vm->_awayMission.tug.bridgeElasi3Status == GUARDSTAT_UP + || _vm->_awayMission.tug.bridgeElasi4Status == GUARDSTAT_UP)) return; tug3EndMission(); - } - else { + } else { if (_vm->_awayMission.tug.orbitalDecayCounter < 16) { showText(TX_SPEAKER_KIRK, TX_TUG3_006); showText(TX_SPEAKER_SCOTT, TX_TUG3_S07); @@ -429,24 +425,20 @@ void Room::tug3Timer0Expired() { _vm->_awayMission.redshirtDead = true; loadActorAnim2(OBJECT_REDSHIRT, "rkills", -1, -1, 0); 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.disableInput = true; loadActorAnim2(OBJECT_KIRK, "kkills", -1, -1, 0); 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; loadActorAnim2(OBJECT_SPOCK, "skills", -1, -1, 0); 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; loadActorAnim2(OBJECT_MCCOY, "mkills", -1, -1, 13); elasiTarget = OBJECT_MCCOY; - } - else + } else return; playSoundEffectIndex(SND_PHASSHOT); @@ -465,13 +457,11 @@ void Room::tug3Timer1Expired() { showText(TX_SPEAKER_SHIPS_COMPUTER, TX_COMPU182); _vm->_awayMission.timers[1] = 100; _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); _vm->_awayMission.timers[1] = 100; _vm->_awayMission.tug.orbitalDecayCounter++; - } - else { // Game over + } else { // Game over showText(TX_TUG3N006); showGameOverMenu(); } diff --git a/engines/startrek/saveload.cpp b/engines/startrek/saveload.cpp index 87f5a8a27a..4c98667b07 100644 --- a/engines/startrek/saveload.cpp +++ b/engines/startrek/saveload.cpp @@ -157,13 +157,11 @@ bool StarTrekEngine::loadGame(int slot) { a->sprite.setBitmap(loadAnimationFrame(a->bitmapFilename, a->scale)); } } - } - else if (_gameMode == -1) { + } else if (_gameMode == -1) { initBridge(true); _lastGameMode = GAMEMODE_BRIDGE; // TODO: mode change - } - else { + } else { _txtFilename = _missionToLoad; initBridge(false); // TODO: mode change @@ -300,8 +298,7 @@ bool StarTrekEngine::saveOrLoadGameData(Common::SeekableReadStream *in, Common:: a.saveLoadWithSerializer(ser); _actionQueue.push(a); } - } - else { // Saving + } else { // Saving int16 n = _actionQueue.size(); ser.syncAsSint16LE(n); for (int i = 0; i < n; i++) { @@ -347,8 +344,7 @@ bool saveOrLoadMetadata(Common::SeekableReadStream *in, Common::WriteStream *out if (ser.isLoading()) { if (!::Graphics::loadThumbnail(*in, meta->thumbnail)) meta->thumbnail = nullptr; - } - else + } else ::Graphics::saveThumbnail(*out); // Creation date/time diff --git a/engines/startrek/sound.cpp b/engines/startrek/sound.cpp index 9db92f87a6..7ce3e51017 100644 --- a/engines/startrek/sound.cpp +++ b/engines/startrek/sound.cpp @@ -19,7 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * */ - + #include "startrek/sound.h" #include "common/file.h" @@ -80,7 +80,7 @@ Sound::~Sound() { void Sound::clearAllMidiSlots() { - for (int i=0; i < NUM_MIDI_SLOTS; i++) { + for (int i = 0; i < NUM_MIDI_SLOTS; i++) { clearMidiSlot(i); } } @@ -235,7 +235,7 @@ void Sound::playSpeech(const Common::String &basename) { 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()); Common::SeekableReadStream *readStream = SearchMan.createReadStreamForMember(filename); if (readStream == nullptr) @@ -300,8 +300,7 @@ void Sound::setSfxEnabled(bool enable) { if (!enable) { stopAllVocSounds(); - } - else if (!_loopingAudioName.empty()) { + } else if (!_loopingAudioName.empty()) { playVoc(_loopingAudioName); } } @@ -315,33 +314,33 @@ void Sound::checkLoopMusic() { // XMIDI or SM sound void Sound::loadPCMusicFile(const Common::String &baseSoundName) { Common::String soundName = baseSoundName; - + soundName += '.'; - + switch (MidiDriver::getMusicType(_midiDevice)) { - case MT_MT32: - if (_vm->getFeatures() & GF_DEMO) - soundName += "ROL"; - else - soundName += "MT"; - break; - case MT_PCSPK: - if (_vm->getFeatures() & GF_DEMO) - return; // Not supported... - else - soundName += "PC"; - break; - default: - if (_vm->getFeatures() & GF_DEMO) - soundName += "ADL"; - else - soundName += "AD"; - break; + case MT_MT32: + if (_vm->getFeatures() & GF_DEMO) + soundName += "ROL"; + else + soundName += "MT"; + break; + case MT_PCSPK: + if (_vm->getFeatures() & GF_DEMO) + return; // Not supported... + else + soundName += "PC"; + break; + default: + if (_vm->getFeatures() & GF_DEMO) + soundName += "ADL"; + else + soundName += "AD"; + break; } - + debugC(5, kDebugSound, "Loading midi \'%s\'\n", soundName.c_str()); SharedPtr<FileStream> soundStream = _vm->loadFile(soundName.c_str()); - + if (loadedSoundData != nullptr) delete[] loadedSoundData; loadedSoundData = new byte[soundStream->size()]; @@ -359,7 +358,7 @@ void Sound::clearMidiSlot(int slot) { // Static callback method void Sound::midiDriverCallback(void *data) { - Sound *s = (Sound*)data; + Sound *s = (Sound *)data; for (int i = 0; i < NUM_MIDI_SLOTS; i++) s->_midiSlots[i].midiParser->onTimer(); diff --git a/engines/startrek/sound.h b/engines/startrek/sound.h index 37100b467c..5354d92fd9 100644 --- a/engines/startrek/sound.h +++ b/engines/startrek/sound.h @@ -30,7 +30,7 @@ #include "audio/mixer.h" namespace Common { - class MacResManager; +class MacResManager; } namespace StarTrek { @@ -114,7 +114,7 @@ class Sound { public: Sound(StarTrekEngine *vm); ~Sound(); - + void clearAllMidiSlots(); /** * Plays a midi track as a sound effect (one of midi slots 1-7) @@ -131,21 +131,21 @@ public: void setMusicEnabled(bool enable); void setSfxEnabled(bool enable); void checkLoopMusic(); - + private: StarTrekEngine *_vm; Audio::SoundHandle *_soundHandle; - + void loadPCMusicFile(const Common::String &baseSoundName); void clearMidiSlot(int slot); - + // MIDI-Related Variables MidiDriver *_midiDriver; 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; - uint32 _midiDevice; + uint32 _midiDevice; // VOC-related variables Audio::SoundHandle _sfxHandles[MAX_SFX_PLAYING]; diff --git a/engines/startrek/space.cpp b/engines/startrek/space.cpp index 2f5981abbb..f549d4a5b7 100644 --- a/engines/startrek/space.cpp +++ b/engines/startrek/space.cpp @@ -101,7 +101,7 @@ void StarTrekEngine::drawStarfield() { Point3 point2 = matrixMult(p, _starPositionMatrix); 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 y = _starfieldYVar1 - scaleSpacePosition(point2.y, point2.z); diff --git a/engines/startrek/sprite.cpp b/engines/startrek/sprite.cpp index 61ff6a5174..821a78ed00 100644 --- a/engines/startrek/sprite.cpp +++ b/engines/startrek/sprite.cpp @@ -30,7 +30,7 @@ Sprite::Sprite() : bitmap(), drawMode(0), textColor(0), bitmapChanged(false), rect2Valid(false), isOnScreen(false), field16(false), lastDrawRect(), drawRect(), rectangle2(), drawX(0), drawY(0) - {} +{} void Sprite::setBitmap(SharedPtr<Bitmap> b) { bitmap = b; diff --git a/engines/startrek/sprite.h b/engines/startrek/sprite.h index d498c18f63..b91e2f2c21 100644 --- a/engines/startrek/sprite.h +++ b/engines/startrek/sprite.h @@ -57,7 +57,7 @@ struct Sprite : Common::Serializable { Common::Rect lastDrawRect; // Rect encompassing the sprite last time it was drawn Common::Rect drawRect; // Rect encompassing the sprite currently Common::Rect rectangle2; - int16 drawX,drawY; + int16 drawX, drawY; Sprite(); diff --git a/engines/startrek/startrek.cpp b/engines/startrek/startrek.cpp index f678d21a3d..a0eada7327 100644 --- a/engines/startrek/startrek.cpp +++ b/engines/startrek/startrek.cpp @@ -454,8 +454,7 @@ void StarTrekEngine::runTransportSequence(const Common::String &name) { if (_missionToLoad.equalsIgnoreCase("feather") && name[4] == 'b') { loadActorAnim(9, "qteleb", 0x61, 0x79, 1.0); - } - else if (_missionToLoad.equalsIgnoreCase("trial")) { + } else if (_missionToLoad.equalsIgnoreCase("trial")) { if (name[4] == 'd') { loadActorAnim(9, "qteled", 0x61, 0x79, 1.0); } @@ -548,7 +547,7 @@ void StarTrekEngine::playSoundEffectIndex(int index) { _sound->playVoc("WARP"); break; default: - break; + break; } } @@ -585,15 +584,13 @@ int StarTrekEngine::loadActorAnim(int actorIndex, const Common::String &animName if (actorIndex == -1) { // TODO warning("loadActorAnim: actor == -1"); - } - else + } else actor = &_actorList[actorIndex]; if (actor->spriteDrawn) { releaseAnim(actor); drawActorToScreen(actor, animName, x, y, scale, false); - } - else { + } else { 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); updateActorPositionWhileWalking(actor, (actor->granularPosX + 0.5).toInt(), (actor->granularPosY + 0.5).toInt()); return true; - } - else { + } else { actor->iwSrcPosition = _iwFile->getClosestKeyPosition(srcX, srcY); actor->iwDestPosition = _iwFile->getClosestKeyPosition(destX, destY); @@ -648,8 +644,7 @@ bool StarTrekEngine::actorWalkToPosition(int actorIndex, const Common::String &a initStandAnim(actorIndex); return false; - } - else { + } else { Common::Point iwSrc = _iwFile->_keyPositions[actor->iwSrcPosition]; chooseActorDirectionForWalking(actor, srcX, srcY, iwSrc.x, iwSrc.y); updateActorPositionWhileWalking(actor, (actor->granularPosX + 0.5).toInt(), (actor->granularPosY + 0.5).toInt()); @@ -687,8 +682,7 @@ void StarTrekEngine::updateActorAnimations() { removeActorFromScreen(i); else initStandAnim(i); - } - else { + } else { Sprite *sprite = &actor->sprite; actor->animFile->seek(actor->animFrame * 22, SEEK_SET); @@ -742,8 +736,7 @@ void StarTrekEngine::updateActorAnimations() { actor->granularPosY = newY; actor->frameToStartNextAnim = _frameIndex; } - } - else { // actor->field90 == 0 + } else { // actor->field90 == 0 if (actor->iwSrcPosition == -1) { if (actor->triggerActionWhenAnimFinished) { actor->triggerActionWhenAnimFinished = false; @@ -753,15 +746,13 @@ void StarTrekEngine::updateActorAnimations() { actor->sprite.bitmap.reset(); updateActorPositionWhileWalking(actor, (actor->granularPosX + 0.5).toInt(), (actor->granularPosY + 0.5).toInt()); initStandAnim(i); - } - else { // actor->iwSrcPosition != -1 + } else { // actor->iwSrcPosition != -1 if (actor->iwSrcPosition == actor->iwDestPosition) { actor->animationString2[strlen(actor->animationString2) - 1] = '\0'; actor->iwDestPosition = -1; actor->iwSrcPosition = -1; chooseActorDirectionForWalking(actor, actor->pos.x, actor->pos.y, actor->dest.x, actor->dest.y); - } - else { + } else { int index = _iwFile->_iwEntries[actor->iwSrcPosition][actor->iwDestPosition]; actor->iwSrcPosition = index; Common::Point dest = _iwFile->_keyPositions[actor->iwSrcPosition]; @@ -951,8 +942,7 @@ void StarTrekEngine::chooseActorDirectionForWalking(Actor *actor, int16 srcX, in actor->speedY = Fixed16(distY) / absDistX; } - } - else { + } else { char d; if (distY > 0) d = 'S'; @@ -999,8 +989,7 @@ bool StarTrekEngine::directPathExists(int16 srcX, int16 srcY, int16 destX, int16 speedX = 1.0; else speedX = -1.0; - } - else { // absDistX <= absDistY + } else { // absDistX <= absDistY distCounter = absDistY; 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)) { int actorIndex = _room->readRdfWord(offset + 6); _objectHasWalkPosition = true; - _objectWalkPosition.x = _room->readRdfWord(offset + 2); - _objectWalkPosition.y = _room->readRdfWord(offset + 4); + _objectWalkPosition.x = _room->readRdfWord(offset + 2); + _objectWalkPosition.y = _room->readRdfWord(offset + 4); return actorIndex; } int numVertices = _room->readRdfWord(offset + 8); offset = offset + 10 + numVertices * 4; - } - else { + } else { if (isPointInPolygon((int16 *)(_room->_rdfData + offset), x, y)) { int actorIndex = _room->readRdfWord(offset); return actorIndex; @@ -1090,12 +1078,11 @@ SharedPtr<Bitmap> StarTrekEngine::loadAnimationFrame(const Common::String &filen char c = filename[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') { // Mccoy has the "base" animations for all crewmen bitmapToReturn = _gfx->loadBitmap(filename); - } - else { + } else { // 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. @@ -1131,8 +1118,7 @@ SharedPtr<Bitmap> StarTrekEngine::loadAnimationFrame(const Common::String &filen if (colorShift == 0) { memcpy(bitmapToReturn->pixels, bitmap->pixels, width * height); - } - else { + } else { byte *src = bitmap->pixels; byte *dest = bitmapToReturn->pixels; 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 // the "file loading with cache" function... bitmapToReturn = _gfx->loadBitmap(filename); @@ -1193,34 +1178,28 @@ int StarTrekEngine::selectObjectForUseAction() { updateMouseBitmap(); _gfx->drawAllSprites(); _sound->checkLoopMusic(); - } - else if (event.type == TREKEVENT_LBUTTONDOWN) { + } else if (event.type == TREKEVENT_LBUTTONDOWN) { removeNextEvent(); break; - } - else if (event.type == TREKEVENT_MOUSEMOVE) { - } - else if (event.type == TREKEVENT_RBUTTONDOWN) { + } else if (event.type == TREKEVENT_MOUSEMOVE) { + } else if (event.type == TREKEVENT_RBUTTONDOWN) { // Allow this to be processed by main away mission loop break; - } - else if (event.type == TREKEVENT_KEYDOWN) { + } else if (event.type == TREKEVENT_KEYDOWN) { if (event.kbd.keycode == Common::KEYCODE_ESCAPE - || event.kbd.keycode == Common::KEYCODE_w - || event.kbd.keycode == Common::KEYCODE_t - || event.kbd.keycode == Common::KEYCODE_u - || event.kbd.keycode == Common::KEYCODE_g - || event.kbd.keycode == Common::KEYCODE_l - || event.kbd.keycode == Common::KEYCODE_SPACE - || event.kbd.keycode == Common::KEYCODE_F2) { + || event.kbd.keycode == Common::KEYCODE_w + || event.kbd.keycode == Common::KEYCODE_t + || event.kbd.keycode == Common::KEYCODE_u + || event.kbd.keycode == Common::KEYCODE_g + || event.kbd.keycode == Common::KEYCODE_l + || event.kbd.keycode == Common::KEYCODE_SPACE + || event.kbd.keycode == Common::KEYCODE_F2) { // Allow these buttons to be processed by main away mission loop break; - } - else if (event.kbd.keycode == Common::KEYCODE_i) { + } else if (event.kbd.keycode == Common::KEYCODE_i) { removeNextEvent(); 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 removeNextEvent(); event.type = TREKEVENT_LBUTTONDOWN; @@ -1237,8 +1216,7 @@ int StarTrekEngine::selectObjectForUseAction() { if (clickedObject == -1) continue; return clickedObject; - } - else if (event.type == TREKEVENT_LBUTTONDOWN) { + } else if (event.type == TREKEVENT_LBUTTONDOWN) { int clickedObject = findObjectAt(_gfx->getMousePos()); hideInventoryIcons(); @@ -1252,14 +1230,13 @@ int StarTrekEngine::selectObjectForUseAction() { continue; else return clickedObject; - } - else if (clickedObject <= OBJECT_REDSHIRT) + } else if (clickedObject <= OBJECT_REDSHIRT) return clickedObject; else if (isObjectUnusable(OBJECT_KIRK, ACTION_USE)) continue; else if (_room->actionHasCode(ACTION_USE, OBJECT_KIRK, clickedObject, 0) - || _room->actionHasCode(ACTION_GET, clickedObject, 0, 0) - || _room->actionHasCode(ACTION_WALK, clickedObject, 0, 0)) { + || _room->actionHasCode(ACTION_GET, clickedObject, 0, 0) + || _room->actionHasCode(ACTION_WALK, clickedObject, 0, 0)) { _awayMission.activeObject = OBJECT_KIRK; _awayMission.passiveObject = clickedObject; _awayMission.activeAction = ACTION_USE; @@ -1267,11 +1244,9 @@ int StarTrekEngine::selectObjectForUseAction() { if (!walkActiveObjectToHotspot()) addAction(_awayMission.activeAction, _awayMission.activeObject, _awayMission.passiveObject, 0); return clickedObject; - } - else + } else continue; - } - else { + } else { hideInventoryIcons(); return -1; } @@ -1342,8 +1317,7 @@ bool StarTrekEngine::walkActiveObjectToHotspot() { objectIndex = OBJECT_MCCOY; else objectIndex = OBJECT_KIRK; - } - else // This is the original error message... + } else // This is the original error message... error("Jay didn't think about pmcheck"); byte finishedAnimActionParam = false; @@ -1381,8 +1355,7 @@ bool StarTrekEngine::walkActiveObjectToHotspot() { } _objectHasWalkPosition = false; return true; - } - else { + } else { _objectHasWalkPosition = false; return false; } @@ -1484,8 +1457,7 @@ void StarTrekEngine::updateCrewmanGetupTimers() { char d; if (dir == -1) { d = actor->direction; - } - else { + } else { const char *dirs = "nsew"; Fixed8 scale = getActorScaleAtPosition(actor->sprite.pos.y); d = dirs[dir]; @@ -1494,8 +1466,7 @@ void StarTrekEngine::updateCrewmanGetupTimers() { if (d == 'n') { xOffset = -24; yOffset = -8; - } - else if (d == 'w') { + } else if (d == 'w') { xOffset = -35; yOffset = -12; } @@ -1717,8 +1688,7 @@ SharedPtr<Bitmap> StarTrekEngine::scaleBitmap(SharedPtr<Bitmap> bitmap, Fixed8 s while (origRow <= origHeight) { if (var2e < 0) { var2e += var30; - } - else { + } else { var2e += var32; scaleBitmapRow(src, dest, origWidth, scaledWidth); dest += scaledWidth; @@ -1727,8 +1697,7 @@ SharedPtr<Bitmap> StarTrekEngine::scaleBitmap(SharedPtr<Bitmap> bitmap, Fixed8 s src += bitmap->width; origRow++; } - } - else { + } else { int16 var2e = (origHeight << 1) - scaledHeight; uint16 var30 = origHeight << 1; uint16 var32 = (origHeight - scaledHeight) << 1; @@ -1748,8 +1717,7 @@ SharedPtr<Bitmap> StarTrekEngine::scaleBitmap(SharedPtr<Bitmap> bitmap, Fixed8 s if (var2e < 0) { var2e += var30; - } - else { + } else { var2e += var32; src += origWidth; srcRowChanged = true; @@ -1775,8 +1743,7 @@ void StarTrekEngine::scaleBitmapRow(byte *src, byte *dest, uint16 origWidth, uin while (var8-- != 0) { if (var2 < 0) { var2 += var4; - } - else { + } else { var2 += var6; if (di != 0) { if (varE != 0) { @@ -1794,8 +1761,7 @@ void StarTrekEngine::scaleBitmapRow(byte *src, byte *dest, uint16 origWidth, uin di++; varA++; } - } - else { + } else { int16 var2 = ((origWidth - 1) << 1) - (scaledWidth - 1); uint16 var4 = (origWidth - 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; - for (int i=filename.size()-1; ; i--) { + for (int i = filename.size() - 1; ; i--) { if (filename[i] == '.') { basename = filename; extension = filename; - basename.replace(i, filename.size()-i, ""); + basename.replace(i, filename.size() - i, ""); extension.replace(0, i + 1, ""); break; } @@ -1876,12 +1842,12 @@ SharedPtr<FileStream> StarTrekEngine::loadFile(Common::String filename, int file if (!indexFile) error("Could not open data.dir"); } - + uint32 indexOffset = 0; bool foundData = false; uint16 fileCount = 1; uint16 uncompressedSize = 0; - + while (!indexFile->eos() && !indexFile->err()) { Common::String testfile; for (byte i = 0; i < 8; i++) { @@ -1901,10 +1867,10 @@ SharedPtr<FileStream> StarTrekEngine::loadFile(Common::String filename, int file uncompressedSize = indexFile->readUint16LE(); } else { if (getPlatform() == Common::kPlatformAmiga) - indexOffset = (indexFile->readByte() << 16) + (indexFile->readByte() << 8) + indexFile->readByte(); - else + indexOffset = (indexFile->readByte() << 16) + (indexFile->readByte() << 8) + indexFile->readByte(); + else indexOffset = indexFile->readByte() + (indexFile->readByte() << 8) + (indexFile->readByte() << 16); - + if (indexOffset & (1 << 23)) { fileCount = (indexOffset >> 16) & 0x7F; indexOffset = indexOffset & 0xFFFF; @@ -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 // the last character being incremented by one. 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); return loadFile(basename + "." + extension, fileIndex + 1); } else diff --git a/engines/startrek/startrek.h b/engines/startrek/startrek.h index 312942a27d..b6b72150de 100644 --- a/engines/startrek/startrek.h +++ b/engines/startrek/startrek.h @@ -54,7 +54,7 @@ using Common::SharedPtr; using Common::String; namespace Common { - class MacResManager; +class MacResManager; } namespace StarTrek { @@ -62,7 +62,7 @@ namespace StarTrek { class StarTrekEngine; class Room; -typedef String (StarTrekEngine::*TextGetterFunc)(int, uintptr, String *); +typedef String(StarTrekEngine::*TextGetterFunc)(int, uintptr, String *); const int SAVEGAME_DESCRIPTION_LEN = 30; @@ -84,11 +84,21 @@ struct SavegameMetadata { saveTimeSecs = time.tm_sec & 0xFF; } - int getDay() { return (saveDate >> 24) & 0xFF; } - int getMonth() { return (saveDate >> 16) & 0xFF; } - int getYear() { return saveDate & 0xFFFF; } - int getHour() { return (saveTime >> 8) & 0xFF; } - int getMinute() { return saveTime & 0xFF; } + int getDay() { + return (saveDate >> 24) & 0xFF; + } + int getMonth() { + 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 { - GF_DEMO = (1 << 0) + GF_DEMO = (1 << 0) }; enum kDebugLevels { @@ -356,7 +366,9 @@ public: bool directPathExists(int16 srcX, int16 srcY, int16 destX, int16 destY); 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. */ @@ -423,7 +435,9 @@ public: void updateClockTicks(); bool checkKeyPressed(); - Common::EventManager *getEventMan() { return _eventMan; } + Common::EventManager *getEventMan() { + return _eventMan; + } private: Common::List<TrekEvent> _eventQueue; @@ -592,7 +606,7 @@ public: Common::Language getLanguage(); // 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. */ @@ -644,10 +658,10 @@ public: Item _itemList[NUM_OBJECTS]; Actor _actorList[NUM_ACTORS]; - Actor * const _kirkActor; - Actor * const _spockActor; - Actor * const _mccoyActor; - Actor * const _redshirtActor; + Actor *const _kirkActor; + Actor *const _spockActor; + Actor *const _mccoyActor; + Actor *const _redshirtActor; SharedPtr<FileStream> _actorBanFiles[NUM_ACTORS / 2]; uint16 _actorBanVar2[NUM_ACTORS / 2]; // TODO: initialize? @@ -705,7 +719,7 @@ public: Matrix _starPositionMatrix; Matrix _someMatrix; float _flt_50898; - + Graphics *_gfx; Sound *_sound; SharedPtr<IWFile> _iwFile; diff --git a/engines/startrek/text.cpp b/engines/startrek/text.cpp index b53b0b903b..e2f271548c 100644 --- a/engines/startrek/text.cpp +++ b/engines/startrek/text.cpp @@ -117,7 +117,7 @@ String StarTrekEngine::readTextFromRdf(int choiceIndex, uintptr data, String *he if (speakerOffset == 0 || room->_rdfData[speakerOffset] == '\0') *headerTextOutput = ""; 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 getTextboxHeader(headerTextOutput, speakerText, choiceIndex + 1); 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) { @@ -202,7 +202,7 @@ int StarTrekEngine::showText(TextGetterFunc textGetter, uintptr var, int xoffset int numChoices = 0; String speakerText; - while(true) { + while (true) { String choiceText = (this->*textGetter)(numChoices, var, &speakerText); if (choiceText.empty()) break; @@ -231,13 +231,13 @@ int StarTrekEngine::showText(TextGetterFunc textGetter, uintptr var, int xoffset int choiceIndex = 0; int scrollOffset = 0; if (tmpTextDisplayMode != TEXTDISPLAY_WAIT && tmpTextDisplayMode != TEXTDISPLAY_SUBTITLES - && numChoices == 1 && _sfxEnabled && !_sfxWorking) + && numChoices == 1 && _sfxEnabled && !_sfxWorking) _textboxHasMultipleChoices = false; else _textboxHasMultipleChoices = true; if (tmpTextDisplayMode >= TEXTDISPLAY_WAIT && tmpTextDisplayMode <= TEXTDISPLAY_NONE - && _sfxEnabled && !_sfxWorking) + && _sfxEnabled && !_sfxWorking) _textboxVar6 = true; else _textboxVar6 = false; @@ -286,7 +286,7 @@ int StarTrekEngine::showText(TextGetterFunc textGetter, uintptr var, int xoffset if (ticksUntilClickingEnabled != 0) enableMenuButtons(1 << TEXTBUTTON_CONFIRM); - switch(textboxReturnCode) { + switch (textboxReturnCode) { case MENUEVENT_RCLICK_OFFBUTTON: case MENUEVENT_RCLICK_ONBUTTON: @@ -337,20 +337,20 @@ readjustScrollDown: enableMenuButtons(1 << TEXTBUTTON_SCROLLUP); if (scrollOffset >= numTextLines) scrollOffset -= numTextboxLines; - if (scrollOffset > numTextLines-1) - scrollOffset = numTextLines-1; - if (scrollOffset+numTextboxLines >= numTextLines) + if (scrollOffset > numTextLines - 1) + scrollOffset = numTextLines - 1; + if (scrollOffset + numTextboxLines >= numTextLines) disableMenuButtons(1 << TEXTBUTTON_SCROLLDOWN); goto readjustScroll; readjustScroll: textboxSprite.bitmapChanged = true; drawMainText( - textBitmap, - numTextLines-scrollOffset, - numTextboxLines, - lineFormattedText.c_str() + scrollOffset*(TEXTBOX_WIDTH-2), - numChoicesWithNames != 0); + textBitmap, + numTextLines - scrollOffset, + numTextboxLines, + lineFormattedText.c_str() + scrollOffset * (TEXTBOX_WIDTH - 2), + numChoicesWithNames != 0); break; case TEXTBUTTON_PREVCHOICE: @@ -359,7 +359,7 @@ readjustScroll: disableMenuButtons(1 << TEXTBUTTON_PREVCHOICE); } else { if (choiceIndex < 0) - choiceIndex = numChoices-1; + choiceIndex = numChoices - 1; } enableMenuButtons(1 << TEXTBUTTON_NEXTCHOICE); goto reloadText; @@ -367,7 +367,7 @@ readjustScroll: case TEXTBUTTON_NEXTCHOICE: enableMenuButtons(1 << TEXTBUTTON_PREVCHOICE); choiceIndex++; - if (!loopChoices && choiceIndex == numChoices-1) { + if (!loopChoices && choiceIndex == numChoices - 1) { disableMenuButtons(1 << TEXTBUTTON_NEXTCHOICE); } else { choiceIndex %= numChoices; @@ -380,7 +380,7 @@ reloadText: if (numTextLines <= numTextboxLines) { setVisibleMenuButtons((1 << TEXTBUTTON_CONFIRM) | (1 << TEXTBUTTON_PREVCHOICE) | (1 << TEXTBUTTON_NEXTCHOICE)); } 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); disableMenuButtons(1 << TEXTBUTTON_SCROLLUP); @@ -424,10 +424,10 @@ int StarTrekEngine::getNumTextboxLines(const String &str) { int lines = 0; while (text != nullptr) { - text = getNextTextLine(text, line, TEXTBOX_WIDTH-2); + text = getNextTextLine(text, line, TEXTBOX_WIDTH - 2); lines++; } - return lines-1; + return lines - 1; } String StarTrekEngine::putTextIntoLines(const String &_text) { @@ -436,17 +436,17 @@ String StarTrekEngine::putTextIntoLines(const String &_text) { const char *text = _text.c_str(); String output; - text = getNextTextLine(text, line, TEXTBOX_WIDTH-2); + text = getNextTextLine(text, line, TEXTBOX_WIDTH - 2); while (text != nullptr) { int len = strlen(line); - while (len != TEXTBOX_WIDTH-2) { + while (len != TEXTBOX_WIDTH - 2) { line[len++] = ' '; line[len] = '\0'; } output += line; - text = getNextTextLine(text, line, TEXTBOX_WIDTH-2); + text = getNextTextLine(text, line, TEXTBOX_WIDTH - 2); } return output; @@ -462,7 +462,7 @@ SharedPtr<TextBitmap> StarTrekEngine::initTextSprite(int *xoffsetPtr, int *yoffs 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->drawPriority = 15; @@ -470,9 +470,9 @@ SharedPtr<TextBitmap> StarTrekEngine::initTextSprite(int *xoffsetPtr, int *yoffs sprite->bitmap = bitmap; 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) xoffset += varC; @@ -484,35 +484,35 @@ SharedPtr<TextBitmap> StarTrekEngine::initTextSprite(int *xoffsetPtr, int *yoffs if (varC < 0) yoffset -= varC; - xoffset -= (bitmap->width + 0x1d)/2; + xoffset -= (bitmap->width + 0x1d) / 2; yoffset -= bitmap->height; bitmap->pixels[0] = 0x10; - memset(&bitmap->pixels[1], 0x11, TEXTBOX_WIDTH-2); - bitmap->pixels[TEXTBOX_WIDTH-1] = 0x12; + memset(&bitmap->pixels[1], 0x11, TEXTBOX_WIDTH - 2); + bitmap->pixels[TEXTBOX_WIDTH - 1] = 0x12; byte *textAddr = bitmap->pixels + TEXTBOX_WIDTH; if (withHeader) { textAddr[0] = 0x13; - textAddr[TEXTBOX_WIDTH-1] = 0x14; + textAddr[TEXTBOX_WIDTH - 1] = 0x14; textAddr += TEXTBOX_WIDTH; textAddr[0] = 0x13; - memset(&textAddr[1], 0x19, TEXTBOX_WIDTH-2); - textAddr[TEXTBOX_WIDTH-1] = 0x14; + memset(&textAddr[1], 0x19, TEXTBOX_WIDTH - 2); + textAddr[TEXTBOX_WIDTH - 1] = 0x14; textAddr += TEXTBOX_WIDTH; } - for (int line=0; line<numTextLines; line++) { + for (int line = 0; line < numTextLines; line++) { textAddr[0] = 0x13; - textAddr[TEXTBOX_WIDTH-1] = 0x14; + textAddr[TEXTBOX_WIDTH - 1] = 0x14; textAddr += TEXTBOX_WIDTH; } textAddr[0] = 0x15; - memset(&textAddr[1], 0x16, TEXTBOX_WIDTH-2); - textAddr[TEXTBOX_WIDTH-1] = 0x17; + memset(&textAddr[1], 0x16, TEXTBOX_WIDTH - 2); + textAddr[TEXTBOX_WIDTH - 1] = 0x17; _gfx->addSprite(sprite); sprite->drawMode = 3; @@ -562,7 +562,7 @@ String StarTrekEngine::readLineFormattedText(TextGetterFunc textGetter, uintptr if (oldSize != text.size()) _textboxHasMultipleChoices = true; } else if ((_textDisplayMode == TEXTDISPLAY_WAIT || _textDisplayMode == TEXTDISPLAY_SUBTITLES) - && _sfxEnabled && _sfxWorking) { + && _sfxEnabled && _sfxWorking) { text = playTextAudio(text); } else { text = skipTextAudioPrompt(text); @@ -581,24 +581,6 @@ String StarTrekEngine::readLineFormattedText(TextGetterFunc textGetter, uintptr return lineFormattedText; } else 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) { diff --git a/engines/startrek/text.h b/engines/startrek/text.h index a5d38bdfad..b4a7598a9b 100644 --- a/engines/startrek/text.h +++ b/engines/startrek/text.h @@ -2440,7 +2440,7 @@ enum GameStringIDs { }; // 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, "", "Dialog error", |