diff options
author | Robert Göffringmann | 2003-07-09 18:12:58 +0000 |
---|---|---|
committer | Robert Göffringmann | 2003-07-09 18:12:58 +0000 |
commit | 5f9845b2cb3f3bbe2ac5eccc919139114a9edd3a (patch) | |
tree | eb28562e1f99c5c5b3a9f908da376330e7b770c7 | |
parent | 2c065bcffebed70b3e7e30b31b6dd22c1f441abc (diff) | |
download | scummvm-rg350-5f9845b2cb3f3bbe2ac5eccc919139114a9edd3a.tar.gz scummvm-rg350-5f9845b2cb3f3bbe2ac5eccc919139114a9edd3a.tar.bz2 scummvm-rg350-5f9845b2cb3f3bbe2ac5eccc919139114a9edd3a.zip |
added toggling music on/off
svn-id: r8884
-rw-r--r-- | sky/control.cpp | 17 | ||||
-rw-r--r-- | sky/control.h | 1 | ||||
-rw-r--r-- | sky/logic.cpp | 6 | ||||
-rw-r--r-- | sky/sky.cpp | 3 | ||||
-rw-r--r-- | sky/sky.h | 1 |
5 files changed, 25 insertions, 3 deletions
diff --git a/sky/control.cpp b/sky/control.cpp index 6c8758355a..cf721989d2 100644 --- a/sky/control.cpp +++ b/sky/control.cpp @@ -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) { diff --git a/sky/control.h b/sky/control.h index 944a67f492..cd26be244a 100644 --- a/sky/control.h +++ b/sky/control.h @@ -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); diff --git a/sky/logic.cpp b/sky/logic.cpp index 8ab4d3fb0d..138207d8f5 100644 --- a/sky/logic.cpp +++ b/sky/logic.cpp @@ -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; } diff --git a/sky/sky.cpp b/sky/sky.cpp index 988eef268a..049788de06 100644 --- a/sky/sky.cpp +++ b/sky/sky.cpp @@ -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) { @@ -47,6 +47,7 @@ struct SystemVars { uint16 language; uint32 currentPalette; uint16 gameSpeed; + uint16 currentMusic; bool pastIntro; bool quitting; }; |