Permalink
Browse files

STARTREK: Options menu

  • Loading branch information...
Drenn1 authored and sev- committed May 9, 2018
1 parent e206d8e commit d37e2aba0e932c3d9c082823caf526fcb415fd50
@@ -383,7 +383,7 @@ void Graphics::drawAllSprites() {
for (int i=0; i<_numSprites; i++) {
Sprite *spr = _sprites[i];

if (spr->field16 == 0 && spr->isOnScreen) {
if (!spr->field16 && spr->isOnScreen) {
bool mustRedrawSprite = false;
Common::Rect rect2;

@@ -403,7 +403,7 @@ void Graphics::drawAllSprites() {
drawSprite(*spr, rect2);
}

spr->field16 = 0;
spr->field16 = false;
spr->bitmapChanged = 0;
spr->lastDrawRect = spr->drawRect;
}
@@ -418,7 +418,7 @@ void Graphics::addSprite(Sprite *sprite) {
// Initialize some fields
sprite->drawMode = 0;
sprite->field8 = 0;
sprite->field16 = 0;
sprite->field16 = false;

sprite->lastDrawRect.top = -1;
sprite->lastDrawRect.left = -1;
@@ -44,7 +44,7 @@ const int SCREEN_WIDTH = 320;
const int SCREEN_HEIGHT = 200;

const int MAX_SPRITES = 32;
const int MAX_MENUBUTTONS = 16; // This is arbitrary, the original game has no such limit
const int MAX_MENUBUTTONS = 32;

const int TEXTBOX_WIDTH = 26;
const int MAX_TEXTBOX_LINES = 12;
@@ -59,8 +59,6 @@ struct Menu {
uint16 numButtons;
int16 selectedButton;
SharedPtr<Menu> nextMenu;

Menu() : nextMenu(SharedPtr<Menu>()) {}
};

class Graphics;
@@ -122,7 +120,7 @@ class Graphics {
String readTextFromArray(int choiceIndex, uintptr data, String *headerTextOutput);

private:
int handleTextboxEvents(uint32 ticksUntilClickingEnabled, bool arg4);
int handleMenuEvents(uint32 ticksUntilClickingEnabled, bool arg4);

SharedPtr<TextBitmap> initTextSprite(int *xoffsetPtr, int *yoffsetPtr, byte textColor, int numTextLines, bool withHeader, Sprite *sprite);
void drawMainText(SharedPtr<TextBitmap> bitmap, int numTextLines, int numTextboxLines, const String &text, bool withHeader);
@@ -140,11 +138,13 @@ class Graphics {
int getMenuButtonAt(const Menu &menu, int x, int y);
void drawMenuButtonOutline(SharedPtr<Bitmap> bitmap, byte color);
void loadMenuButtons(String mnuFilename, int xpos, int ypos);
void disableMenuButton(uint32 bits);
void enableMenuButton(uint32 bits);
void unloadMenuButtons();
void disableMenuButtons(uint32 bits);
void enableMenuButtons(uint32 bits);

public:
void openTextConfigurationMenu(bool fromOptionMenu);
void showOptionsMenu(int x, int y);
void showTextConfigurationMenu(bool fromOptionMenu);
int loadTextDisplayMode();
void saveTextDisplayMode(int value);

@@ -153,12 +153,12 @@ class Graphics {
uint32 _textboxVar2;
uint32 _textboxVar3;
uint16 _textboxVar6;
uint16 _textboxVar7;
bool _textboxHasMultipleChoices;

SharedPtr<Menu> _activeMenu;

uint16 _textboxButtonVar4;
// Saved value of StarTrekEngine::_keyboardControlsMouse when menus are up
bool _keyboardControlsMouseOutsideMenu;
};

}
@@ -79,12 +79,8 @@ Sound::~Sound() {


void Sound::playMidiTrack(int track) {
if (!_vm->_musicEnabled)
if (!_vm->_musicEnabled || !_vm->_musicWorking)
return;
/*
if (!_vm->_word_467a8)
return;
*/

assert(loadedSoundData != NULL);

@@ -137,7 +133,7 @@ void Sound::playSoundEffect(const char *baseSoundName) {
if (scumm_stricmp(baseSoundName+4, "loop") == 0)
_loopingAudioName = Common::String(baseSoundName);

if (!_vm->_sfxEnabled || !_vm->_audioEnabled)
if (!_vm->_sfxEnabled || !_vm->_sfxWorking)
return;

/*
@@ -54,7 +54,7 @@ struct Sprite {
bool bitmapChanged;
bool rect2Valid;
bool isOnScreen;
uint16 field16; // When set, sprite isn't drawn next refresh? (Gets reset to 0 after)
bool field16; // When set, sprite isn't drawn next refresh? (Gets reset to 0 after)
Common::Rect lastDrawRect; // Rect encompassing the sprite last time it was drawn
Common::Rect drawRect; // Rect encompassing the sprite currently
Common::Rect rectangle2;
@@ -47,9 +47,17 @@ StarTrekEngine::StarTrekEngine(OSystem *syst, const StarTrekGameDescription *gam
_macResFork = nullptr;
_room = nullptr;

_audioEnabled = true;
_clockTicks = 0;

_musicEnabled = true;
_sfxEnabled = true;
_word_467a6 = true;
_musicWorking = true;
_sfxWorking = true;
_finishedPlayingSpeech = false;

_mouseControllingShip = false;
_keyboardControlsMouse = true;
}

StarTrekEngine::~StarTrekEngine() {
@@ -139,7 +147,9 @@ Common::Error StarTrekEngine::run() {
*/


_gfx->openTextConfigurationMenu(false);
while (true) {
_gfx->showOptionsMenu(0, 0);
}
_gfx->showText(&Graphics::readTextFromRdf, 0x2220, 150, 160, 0xb3, 0, 10, 0);

while (!shouldQuit()) {
@@ -150,10 +150,17 @@ class StarTrekEngine : public ::Engine {
bool _musicEnabled;
bool _sfxEnabled;
uint16 _word_467a6;
uint16 _word_467a8;
bool _audioEnabled;
uint16 _musicWorking;
bool _sfxWorking;
bool _finishedPlayingSpeech;

bool _mouseControllingShip;

// TODO: make this work.
// When false, the keyboard generally acts in a more specific way (ie. move mouse
// between items in a menu).
bool _keyboardControlsMouse;


private:
Graphics *_gfx;
Oops, something went wrong.

0 comments on commit d37e2ab

Please sign in to comment.