added toggling music on/off

svn-id: r8884
This commit is contained in:
Robert Göffringmann 2003-07-09 18:12:58 +00:00
parent 2c065bcffe
commit 5f9845b2cb
5 changed files with 25 additions and 3 deletions

View File

@ -556,7 +556,9 @@ uint16 SkyControl::handleClick(SkyConResource *pButton) {
return toggleFx(pButton);
case TOGGLE_MS:
return 0;
animClick(pButton);
toggleMusic();
return TOGGLED;
case TOGGLE_TEXT:
animClick(pButton);
@ -734,6 +736,19 @@ uint16 SkyControl::toggleText(void) {
return TOGGLED;
}
void SkyControl::toggleMusic(void) {
if (SkyState::_systemVars.systemFlags & SF_MUS_OFF) {
SkyState::_systemVars.systemFlags &= ~SF_MUS_OFF;
_skyMusic->startMusic(SkyState::_systemVars.currentMusic);
_statusBar->setToText(0x7000 + 88);
} else {
SkyState::_systemVars.systemFlags |= SF_MUS_OFF;
_skyMusic->startMusic(0);
_statusBar->setToText(0x7000 + 89);
}
}
uint16 SkyControl::shiftDown(uint8 speed) {
if (speed == SLOW) {

View File

@ -188,6 +188,7 @@ private:
uint16 doSpeedSlide(void);
uint16 toggleFx(SkyConResource *pButton);
uint16 toggleText(void);
void toggleMusic(void);
uint16 shiftDown(uint8 speed);
uint16 shiftUp(uint8 speed);
void drawTextCross(uint32 flags);

View File

@ -2235,6 +2235,7 @@ bool SkyLogic::fnEnterSection(uint32 sectionNo, uint32 b, uint32 c) {
error("End of demo");
_scriptVariables[CUR_SECTION] = sectionNo;
SkyState::_systemVars.currentMusic = 0;
if (sectionNo == 5) //linc section - has different mouse icons
_skyMouse->replaceMouseCursors(60302);
@ -2380,12 +2381,15 @@ bool SkyLogic::fnStopFx(uint32 a, uint32 b, uint32 c) {
}
bool SkyLogic::fnStartMusic(uint32 a, uint32 b, uint32 c) {
_skyMusic->startMusic((uint16)a);
if (!(SkyState::_systemVars.systemFlags & SF_MUS_OFF))
_skyMusic->startMusic((uint16)a);
SkyState::_systemVars.currentMusic = (uint16)a;
return true;
}
bool SkyLogic::fnStopMusic(uint32 a, uint32 b, uint32 c) {
_skyMusic->startMusic(0);
SkyState::_systemVars.currentMusic = 0;
return true;
}

View File

@ -71,7 +71,7 @@ Engine *Engine_SKY_create(GameDetector *detector, OSystem *syst) {
void **SkyState::_itemList[300];
SystemVars SkyState::_systemVars = {0, 0, 0, 0, 4316, 0, false, false };
SystemVars SkyState::_systemVars = {0, 0, 0, 0, 4316, 0, 0, false, false };
SkyState::SkyState(GameDetector *detector, OSystem *syst)
: Engine(detector, syst) {
@ -245,6 +245,7 @@ void SkyState::loadBase0(void) {
_skyLogic->fnEnterSection(0, 0, 0);
_skyMusic->startMusic(2);
_systemVars.currentMusic = 2;
}
void SkyState::loadFixedItems(void) {

View File

@ -47,6 +47,7 @@ struct SystemVars {
uint16 language;
uint32 currentPalette;
uint16 gameSpeed;
uint16 currentMusic;
bool pastIntro;
bool quitting;
};