diff options
author | Robert Göffringmann | 2003-08-20 12:12:11 +0000 |
---|---|---|
committer | Robert Göffringmann | 2003-08-20 12:12:11 +0000 |
commit | af17c1ac5161b261c4c8c41e360dd5d11b7859d7 (patch) | |
tree | 4c5b3a0dcda7056175951a0a747f303b3318e721 /sky | |
parent | 123af301474cac28e53f96b5f23f229429d32eaa (diff) | |
download | scummvm-rg350-af17c1ac5161b261c4c8c41e360dd5d11b7859d7.tar.gz scummvm-rg350-af17c1ac5161b261c4c8c41e360dd5d11b7859d7.tar.bz2 scummvm-rg350-af17c1ac5161b261c4c8c41e360dd5d11b7859d7.zip |
copied some fixes which only were in 0.5.1 branch.
svn-id: r9799
Diffstat (limited to 'sky')
-rw-r--r-- | sky/autoroute.cpp | 2 | ||||
-rw-r--r-- | sky/logic.cpp | 3 | ||||
-rw-r--r-- | sky/music/gmchannel.cpp | 19 | ||||
-rw-r--r-- | sky/music/gmchannel.h | 1 | ||||
-rw-r--r-- | sky/music/gmmusic.cpp | 1 | ||||
-rw-r--r-- | sky/sky.cpp | 2 | ||||
-rw-r--r-- | sky/sound.cpp | 6 | ||||
-rw-r--r-- | sky/sound.h | 3 |
8 files changed, 22 insertions, 15 deletions
diff --git a/sky/autoroute.cpp b/sky/autoroute.cpp index 760e3640d8..31d2aec140 100644 --- a/sky/autoroute.cpp +++ b/sky/autoroute.cpp @@ -236,7 +236,7 @@ uint16 SkyAutoRoute::autoRoute(Compact *cpt) { clipCoordX(cpt->extCompact->arTargetX, destX, initDestX); clipCoordY(cpt->extCompact->arTargetY, destY, initDestY); - ((uint16*)cpt->extCompact->animScratch)[0] = 0; + memset(cpt->extCompact->animScratch, 0, 64); if ((startX == destX) && (startY == destY)) return 2; diff --git a/sky/logic.cpp b/sky/logic.cpp index 3083b2c8af..846227fede 100644 --- a/sky/logic.cpp +++ b/sky/logic.cpp @@ -146,11 +146,10 @@ void SkyLogic::logicScript() { void SkyLogic::autoRoute() { _compact->downFlag = _skyAutoRoute->autoRoute(_compact); - if (!_compact->downFlag) { // route ok + if (_compact->downFlag != 1) { // route ok _compact->grafixProg.pos = 0; _compact->grafixProg.ptrTarget = 0; _compact->grafixProg.ptrType = AUTOROUTE; - //_compact->grafixProg = (uint16*)_compact->extCompact->animScratch; } _compact->logic = L_SCRIPT; // continue the script diff --git a/sky/music/gmchannel.cpp b/sky/music/gmchannel.cpp index 31c5e97847..7442b171c9 100644 --- a/sky/music/gmchannel.cpp +++ b/sky/music/gmchannel.cpp @@ -21,11 +21,6 @@ #include "gmchannel.h" -// the MT32 is a lot more sensitive to velocities than most general midi devices, -// so we need to boost them a little - - - SkyGmChannel::SkyGmChannel(uint8 *pMusicData, uint16 startOfData, MidiDriver *pMidiDrv, byte *pInstMap, uint8 *veloTab) { _musicData = pMusicData; @@ -38,7 +33,8 @@ SkyGmChannel::SkyGmChannel(uint8 *pMusicData, uint16 startOfData, MidiDriver *pM _mt32_to_gm = pInstMap; _veloTab = veloTab; - _musicVolume = 0x100; + _musicVolume = 0x7F; + _lastVolume = 0xFF; } bool SkyGmChannel::isActive(void) { @@ -49,6 +45,12 @@ bool SkyGmChannel::isActive(void) { void SkyGmChannel::updateVolume(uint16 pVolume) { _musicVolume = pVolume; + if (_musicVolume > 0) + _musicVolume = (_musicVolume * 2) / 3 + 43; + if (_lastVolume < 0xFF) { + uint8 newVol = (_lastVolume * _musicVolume) >> 7; + _midiDrv->send((0xB0 | _channelData.midiChannelNumber) | 0x700 | (newVol << 16)); + } } void SkyGmChannel::stopNote(void) { @@ -166,8 +168,9 @@ void SkyGmChannel::com90_getPitch(void) { void SkyGmChannel::com90_getChannelVolume(void) { - _midiDrv->send((0xB0 | _channelData.midiChannelNumber) | 0x700 | (_musicData[_channelData.eventDataPtr] << 16)); - _channelData.eventDataPtr++; + _lastVolume = _musicData[_channelData.eventDataPtr]; + uint8 newVol = (uint8)((_musicData[_channelData.eventDataPtr++] * _musicVolume) >> 7); + _midiDrv->send((0xB0 | _channelData.midiChannelNumber) | 0x700 | (newVol << 16)); } void SkyGmChannel::com90_rewindMusic(void) { diff --git a/sky/music/gmchannel.h b/sky/music/gmchannel.h index 4684678c45..1cf2e02177 100644 --- a/sky/music/gmchannel.h +++ b/sky/music/gmchannel.h @@ -50,6 +50,7 @@ private: uint8 *_musicData; uint16 _musicVolume; MidiChannelType _channelData; + uint8 _lastVolume; //- normal subs void setRegister(uint8 regNum, uint8 value); int32 getNextEventTime(void); diff --git a/sky/music/gmmusic.cpp b/sky/music/gmmusic.cpp index f274be95db..b4fdeeb510 100644 --- a/sky/music/gmmusic.cpp +++ b/sky/music/gmmusic.cpp @@ -86,6 +86,7 @@ void SkyGmMusic::setupChannels(uint8 *channelData) { for (uint8 cnt = 0; cnt < _numberOfChannels; cnt++) { uint16 chDataStart = ((channelData[(cnt << 1) | 1] << 8) | channelData[cnt << 1]) + _musicDataLoc; _channels[cnt] = new SkyGmChannel(_musicData, chDataStart, _midiDrv, _mt32_to_gm, _veloTab); + _channels[cnt]->updateVolume(_musicVolume); } } diff --git a/sky/sky.cpp b/sky/sky.cpp index b90ea00ff0..310803c0f0 100644 --- a/sky/sky.cpp +++ b/sky/sky.cpp @@ -235,7 +235,7 @@ void SkyState::initialise(void) { OSystem::Property prop; _skyDisk = new SkyDisk(_gameDataPath); - _skySound = new SkySound(_mixer, _skyDisk); + _skySound = new SkySound(_mixer, _skyDisk, _detector->_sfx_volume); _systemVars.gameVersion = _skyDisk->determineGameVersion(); diff --git a/sky/sound.cpp b/sky/sound.cpp index acad413f9a..0488557506 100644 --- a/sky/sound.cpp +++ b/sky/sound.cpp @@ -1012,7 +1012,7 @@ SfxQueue SkySound::_sfxQueue[MAX_QUEUED_FX] = { { 0, 0, 0, 0} }; -SkySound::SkySound(SoundMixer *mixer, SkyDisk *pDisk) { +SkySound::SkySound(SoundMixer *mixer, SkyDisk *pDisk, uint8 pVolume) { _skyDisk = pDisk; _soundData = NULL; _mixer = mixer; @@ -1022,6 +1022,7 @@ SkySound::SkySound(SoundMixer *mixer, SkyDisk *pDisk) { _ingameSpeech = 0; _ingameSound0 = _ingameSound1 = 0; _saveSounds[0] = _saveSounds[1] = 0xFFFF; + _mainSfxVolume = pVolume; } SkySound::~SkySound(void) { @@ -1159,7 +1160,7 @@ void SkySound::fnStartFx(uint32 sound, uint8 channel) { // get fx volume - uint8 volume = 0x40; // start with max vol + uint8 volume = _mainSfxVolume; // start with standard vol if (!SkyState::isCDVersion()) { // as long as we can't set the volume for sfx without changing the speech volume, @@ -1168,6 +1169,7 @@ void SkySound::fnStartFx(uint32 sound, uint8 channel) { volume = roomList[i].adlibVolume; if (SkyState::_systemVars.systemFlags & SF_ROLAND) volume = roomList[i].rolandVolume; + volume = (volume * _mainSfxVolume) >> 8; } // Check the flags, the sound may come on after a delay. diff --git a/sky/sound.h b/sky/sound.h index d2a824b4bf..3938632af7 100644 --- a/sky/sound.h +++ b/sky/sound.h @@ -58,7 +58,7 @@ protected: int playSound(uint32 id, byte *sound, uint32 size, PlayingSoundHandle *handle); public: - SkySound(SoundMixer *mixer, SkyDisk *pDisk); + SkySound(SoundMixer *mixer, SkyDisk *pDisk, uint8 pVolume); ~SkySound(void); int playVoice(byte *sound, uint32 size); int playBgSound(byte *sound, uint32 size); @@ -81,6 +81,7 @@ private: uint16 _sfxBaseOfs; uint8 *_soundData; uint8 *_sampleRates, *_sfxInfo; + uint8 _mainSfxVolume; static uint16 _speechConvertTable[8]; static SfxQueue _sfxQueue[MAX_QUEUED_FX]; |