[Scummvm-git-logs] scummvm master -> 49dcfae910b69aa3885cc8ab2b63cde4bbe16459
sluicebox
noreply at scummvm.org
Sat Nov 16 21:39:53 UTC 2024
This automated email contains information about 9 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
01841ad20e AGI: PREAGI: Fix TROLL menu numbers
fa949720ab AGI: PREAGI: Fix WINNIE keyboard modifier test
99a50c8f0f AGI: PREAGI: Fix menu selection keyboard handling
a9529bed1b AGI: PREAGI: Fix WINNIE drop-object behavior
d936f7e6f7 AGI: PREAGI: Fix WINNIE save game message
58197c4233 AGI: PREAGI: Play correct wind sound in WINNIE
933ba2ffae AGI: Fix SoundGenPCJr not using sound flag on AGIv1
d93ee3937b AGI: Fix SoundGenPCJr incomplete re-initialization
49dcfae910 AGI: Add thread safety to SoundGenPCJr and SoundGenSarien
Commit: 01841ad20e7624671bb6b9f492f88cfdfa12601f
https://github.com/scummvm/scummvm/commit/01841ad20e7624671bb6b9f492f88cfdfa12601f
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2024-11-16T13:38:28-08:00
Commit Message:
AGI: PREAGI: Fix TROLL menu numbers
They are one-based
Changed paths:
engines/agi/preagi/troll.cpp
diff --git a/engines/agi/preagi/troll.cpp b/engines/agi/preagi/troll.cpp
index d7f64b91557..4edb2e202c8 100644
--- a/engines/agi/preagi/troll.cpp
+++ b/engines/agi/preagi/troll.cpp
@@ -453,7 +453,7 @@ int TrollEngine::drawRoom(char *menu) {
for (int i = 0; i < 3; i++) {
if (_roomDescs[_roomPicture - 1].options[i]) {
- strncat(menu, Common::String::format("\n %d.", i).c_str(), 5);
+ strncat(menu, Common::String::format("\n %d.", i + 1).c_str(), 5);
strncat(menu, (char *)_gameData + _options[_roomDescs[_roomPicture - 1].options[i] - 1], 35);
Commit: fa949720aba3dede7b32cebf93299fcced45ca0a
https://github.com/scummvm/scummvm/commit/fa949720aba3dede7b32cebf93299fcced45ca0a
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2024-11-16T13:38:28-08:00
Commit Message:
AGI: PREAGI: Fix WINNIE keyboard modifier test
Fixes help text when number/caps/scroll lock is enabled
Changed paths:
engines/agi/preagi/winnie.cpp
diff --git a/engines/agi/preagi/winnie.cpp b/engines/agi/preagi/winnie.cpp
index a212f9ab442..bed93ac9ae8 100644
--- a/engines/agi/preagi/winnie.cpp
+++ b/engines/agi/preagi/winnie.cpp
@@ -1018,7 +1018,8 @@ void WinnieEngine::getMenuSel(char *szMenu, int *iSel, int fCanSel[]) {
}
break;
default:
- if (!event.kbd.flags) { // if the control/alt/shift keys are not pressed
+ // show help if the control/alt/shift keys are not pressed
+ if (!(event.kbd.flags & Common::KBD_NON_STICKY)) {
keyHelp();
clrMenuSel(iSel, fCanSel);
}
Commit: 99a50c8f0f7adf7884e33ef69fc2a44edbe69a3f
https://github.com/scummvm/scummvm/commit/99a50c8f0f7adf7884e33ef69fc2a44edbe69a3f
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2024-11-16T13:38:29-08:00
Commit Message:
AGI: PREAGI: Fix menu selection keyboard handling
Fixes the default-key handler. It was ignoring all keys that are used
in a different selection mode. For example: 'Y', 'N', space, digits,
and others had no effect when prompted to press any key.
Fixes modifiers being treated as normal keys by the menu selection code.
This did not occur in the original, and it caused common ScummVM hotkeys
to affect in-game behavior.
Changed paths:
engines/agi/preagi/preagi.cpp
diff --git a/engines/agi/preagi/preagi.cpp b/engines/agi/preagi/preagi.cpp
index 8f734eb5966..a6d24be6510 100644
--- a/engines/agi/preagi/preagi.cpp
+++ b/engines/agi/preagi/preagi.cpp
@@ -188,6 +188,9 @@ int PreAgiEngine::getSelection(SelectionTypes type) {
return 1;
break;
case Common::EVENT_KEYDOWN:
+ if (event.kbd.flags & Common::KBD_NON_STICKY) {
+ break;
+ }
switch (event.kbd.keycode) {
case Common::KEYCODE_y:
if (type == kSelYesNo)
@@ -222,15 +225,14 @@ int PreAgiEngine::getSelection(SelectionTypes type) {
return 0;
break;
default:
- if (event.kbd.flags & Common::KBD_CTRL)
- break;
- if (type == kSelYesNo) {
- return 2;
- } else if (type == kSelNumber) {
- return 10;
- } else if (type == kSelAnyKey || type == kSelBackspace) {
- return 1;
- }
+ break;
+ }
+ if (type == kSelYesNo) {
+ return 2;
+ } else if (type == kSelNumber) {
+ return 10;
+ } else if (type == kSelAnyKey || type == kSelBackspace) {
+ return 1;
}
break;
default:
Commit: a9529bed1b254ea49ae7d710b3c38ea3f1c82318
https://github.com/scummvm/scummvm/commit/a9529bed1b254ea49ae7d710b3c38ea3f1c82318
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2024-11-16T13:38:29-08:00
Commit Message:
AGI: PREAGI: Fix WINNIE drop-object behavior
- Removes "Ok." message that the original did not display
- Removes wait-on-keypress that was not in the original
Changed paths:
engines/agi/preagi/winnie.cpp
diff --git a/engines/agi/preagi/winnie.cpp b/engines/agi/preagi/winnie.cpp
index bed93ac9ae8..b7ea1318553 100644
--- a/engines/agi/preagi/winnie.cpp
+++ b/engines/agi/preagi/winnie.cpp
@@ -560,8 +560,6 @@ void WinnieEngine::dropObj(int iRoom) {
if (isRightObj(iRoom, _gameStateWinnie.iObjHave, &iCode)) {
// object has been dropped in the right place
- printStr(IDS_WTP_OK);
- getSelection(kSelAnyKey);
playSound(IDI_WTP_SND_DROP_OK);
printObjStr(_gameStateWinnie.iObjHave, IDI_WTP_OBJ_DROP);
getSelection(kSelAnyKey);
@@ -598,11 +596,12 @@ void WinnieEngine::dropObj(int iRoom) {
// object has been dropped in the wrong place
printStr(IDS_WTP_WRONG_PLACE);
- getSelection(kSelAnyKey);
-
playSound(IDI_WTP_SND_DROP);
- drawRoomPic();
+ // draw the object by redrawing the room and
+ // reprinting the message. the original just
+ // drew the object.
+ drawRoomPic();
printStr(IDS_WTP_WRONG_PLACE);
getSelection(kSelAnyKey);
Commit: d936f7e6f73619e0c5f58d0a3b58f35b9a0a9661
https://github.com/scummvm/scummvm/commit/d936f7e6f73619e0c5f58d0a3b58f35b9a0a9661
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2024-11-16T13:38:30-08:00
Commit Message:
AGI: PREAGI: Fix WINNIE save game message
Changed paths:
engines/agi/preagi/winnie.cpp
diff --git a/engines/agi/preagi/winnie.cpp b/engines/agi/preagi/winnie.cpp
index b7ea1318553..86b33600a3d 100644
--- a/engines/agi/preagi/winnie.cpp
+++ b/engines/agi/preagi/winnie.cpp
@@ -428,6 +428,7 @@ int WinnieEngine::parser(int pc, int index, uint8 *buffer) {
break;
case IDO_WTP_SAVE_GAME:
saveGame();
+ getSelection(kSelAnyKey);
_room = IDI_WTP_ROOM_HOME;
return IDI_WTP_PAR_GOTO;
case IDO_WTP_LOAD_GAME:
Commit: 58197c42332cf7b22faaf15ffc2b53e3d0216e21
https://github.com/scummvm/scummvm/commit/58197c42332cf7b22faaf15ffc2b53e3d0216e21
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2024-11-16T13:38:30-08:00
Commit Message:
AGI: PREAGI: Play correct wind sound in WINNIE
Changed paths:
engines/agi/preagi/winnie.cpp
diff --git a/engines/agi/preagi/winnie.cpp b/engines/agi/preagi/winnie.cpp
index 86b33600a3d..e77f578b045 100644
--- a/engines/agi/preagi/winnie.cpp
+++ b/engines/agi/preagi/winnie.cpp
@@ -648,11 +648,11 @@ void WinnieEngine::wind() {
return;
printStr(IDS_WTP_WIND_0);
- playSound(IDI_WTP_SND_WIND_0);
+ playSound(IDI_WTP_SND_WIND_1); // not a bug, IDI_WTP_SND_WIND_0 isn't used here
getSelection(kSelAnyKey);
printStr(IDS_WTP_WIND_1);
- playSound(IDI_WTP_SND_WIND_0);
+ playSound(IDI_WTP_SND_WIND_1);
getSelection(kSelAnyKey);
dropObjRnd();
Commit: 933ba2ffae325805f0ae6668bb592eeaead8accc
https://github.com/scummvm/scummvm/commit/933ba2ffae325805f0ae6668bb592eeaead8accc
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2024-11-16T13:38:31-08:00
Commit Message:
AGI: Fix SoundGenPCJr not using sound flag on AGIv1
Fixes the in-game sound setting
Changed paths:
engines/agi/sound_pcjr.cpp
diff --git a/engines/agi/sound_pcjr.cpp b/engines/agi/sound_pcjr.cpp
index efba2b4b788..75716348f2a 100644
--- a/engines/agi/sound_pcjr.cpp
+++ b/engines/agi/sound_pcjr.cpp
@@ -296,6 +296,9 @@ int SoundGenPCJr::getNextNote_v1(int ch) {
byte *data = _v1data;
uint32 len = _v1size;
+ if (!_vm->getFlag(VM_FLAG_SOUND_ON))
+ return -1;
+
if (len <= 0 || data == nullptr) {
_channel[ch].avail = 0;
_channel[ch].attenuation = 0x0F;
Commit: d93ee3937b70712c9996a5094d9c160acf0b072c
https://github.com/scummvm/scummvm/commit/d93ee3937b70712c9996a5094d9c160acf0b072c
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2024-11-16T13:38:31-08:00
Commit Message:
AGI: Fix SoundGenPCJr incomplete re-initialization
Fixes incomplete channel re-initialization when playing a sound.
This caused nearly every sound in Winnie the Pooh to randomly
play channels that were supposed to be silent, depending on the
state of the previous sound. The first sound would always play
correctly due to the constructor zeroing out all channel data.
Replaces static variables with class members so that they can be
consistently re-initialized when playing a sound.
Changed paths:
engines/agi/sound_pcjr.cpp
engines/agi/sound_pcjr.h
diff --git a/engines/agi/sound_pcjr.cpp b/engines/agi/sound_pcjr.cpp
index 75716348f2a..d3043282553 100644
--- a/engines/agi/sound_pcjr.cpp
+++ b/engines/agi/sound_pcjr.cpp
@@ -123,10 +123,13 @@ SoundGenPCJr::SoundGenPCJr(AgiBase *vm, Audio::Mixer *pMixer) : SoundGen(vm, pMi
memset(_channel, 0, sizeof(_channel));
memset(_tchannel, 0, sizeof(_tchannel));
- _mixer->playStream(Audio::Mixer::kMusicSoundType, _soundHandle, this, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO, true);
-
_v1data = nullptr;
_v1size = 0;
+ _v1duration = 0;
+
+ _reg = 0;
+
+ _mixer->playStream(Audio::Mixer::kMusicSoundType, _soundHandle, this, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO, true);
}
SoundGenPCJr::~SoundGenPCJr() {
@@ -145,6 +148,8 @@ void SoundGenPCJr::play(int resnum) {
_channel[i].dissolveCount = 0xFFFF;
_channel[i].attenuation = 0;
_channel[i].attenuationCopy = 0;
+ _channel[i].genType = kGenSilence;
+ _channel[i].freqCount = 0;
_tchannel[i].avail = 1;
_tchannel[i].noteCount = 0;
@@ -153,10 +158,18 @@ void SoundGenPCJr::play(int resnum) {
_tchannel[i].atten = 0xF; // silence
_tchannel[i].genType = kGenTone;
_tchannel[i].genTypePrev = -1;
+ _tchannel[i].count = 0;
+ _tchannel[i].scale = 0;
+ _tchannel[i].sign = 0;
+ _tchannel[i].noiseState = 0;
+ _tchannel[i].feedback = 0;
}
_v1data = pcjrSound->getData() + 1;
_v1size = pcjrSound->getLength() - 1;
+ _v1duration = 0;
+
+ _reg = 0;
}
void SoundGenPCJr::stop() {
@@ -291,8 +304,6 @@ int SoundGenPCJr::getNextNote_v2(int ch) {
}
int SoundGenPCJr::getNextNote_v1(int ch) {
- static int duration = 0;
-
byte *data = _v1data;
uint32 len = _v1size;
@@ -307,11 +318,11 @@ int SoundGenPCJr::getNextNote_v1(int ch) {
}
// In the V1 player the default duration for a row is 3 ticks
- if (duration > 0) {
- duration--;
+ if (_v1duration > 0) {
+ _v1duration--;
return 0;
}
- duration = 3 * CHAN_MAX;
+ _v1duration = 3 * CHAN_MAX;
// Otherwise fetch a row of data for all channels
while (*data) {
@@ -329,13 +340,11 @@ int SoundGenPCJr::getNextNote_v1(int ch) {
}
void SoundGenPCJr::writeData(uint8 val) {
- static int reg = 0;
-
debugC(5, kDebugLevelSound, "writeData(%.2X)", val);
if ((val & 0x90) == 0x90) {
- reg = (val >> 5) & 0x3;
- _channel[reg].attenuation = val & 0xF;
+ _reg = (val >> 5) & 0x3;
+ _channel[_reg].attenuation = val & 0xF;
} else if ((val & 0xF0) == 0xE0) {
_channel[3].genType = (val & 0x4) ? kGenWhite : kGenPeriod;
int noiseFreq = val & 0x03;
@@ -356,11 +365,11 @@ void SoundGenPCJr::writeData(uint8 val) {
break;
}
} else if (val & 0x80) {
- reg = (val >> 5) & 0x3;
- _channel[reg].freqCount = val & 0xF;
- _channel[reg].genType = kGenTone;
+ _reg = (val >> 5) & 0x3;
+ _channel[_reg].freqCount = val & 0xF;
+ _channel[_reg].genType = kGenTone;
} else {
- _channel[reg].freqCount |= (val & 0x3F) << 4;
+ _channel[_reg].freqCount |= (val & 0x3F) << 4;
}
}
diff --git a/engines/agi/sound_pcjr.h b/engines/agi/sound_pcjr.h
index b236c266ef9..4ffd1fb2b5c 100644
--- a/engines/agi/sound_pcjr.h
+++ b/engines/agi/sound_pcjr.h
@@ -117,6 +117,9 @@ private:
uint8 *_v1data;
uint32 _v1size;
+ int _v1duration;
+
+ int _reg;
};
} // End of namespace Agi
Commit: 49dcfae910b69aa3885cc8ab2b63cde4bbe16459
https://github.com/scummvm/scummvm/commit/49dcfae910b69aa3885cc8ab2b63cde4bbe16459
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2024-11-16T13:38:31-08:00
Commit Message:
AGI: Add thread safety to SoundGenPCJr and SoundGenSarien
Fixes unsynchronized access to channel data
Changed paths:
engines/agi/sound_pcjr.cpp
engines/agi/sound_pcjr.h
engines/agi/sound_sarien.cpp
engines/agi/sound_sarien.h
diff --git a/engines/agi/sound_pcjr.cpp b/engines/agi/sound_pcjr.cpp
index d3043282553..10faa4416f7 100644
--- a/engines/agi/sound_pcjr.cpp
+++ b/engines/agi/sound_pcjr.cpp
@@ -139,6 +139,8 @@ SoundGenPCJr::~SoundGenPCJr() {
}
void SoundGenPCJr::play(int resnum) {
+ Common::StackLock lock(_mutex);
+
PCjrSound *pcjrSound = (PCjrSound *)_vm->_game.sounds[resnum];
for (int i = 0; i < CHAN_MAX; i++) {
@@ -173,9 +175,9 @@ void SoundGenPCJr::play(int resnum) {
}
void SoundGenPCJr::stop() {
- int i;
+ Common::StackLock lock(_mutex);
- for (i = 0; i < CHAN_MAX; i++) {
+ for (int i = 0; i < CHAN_MAX; i++) {
_channel[i].avail = 0;
_tchannel[i].avail = 0;
}
@@ -545,8 +547,7 @@ int SoundGenPCJr::fillNoise(ToneChan *t, int16 *buf, int len) {
}
int SoundGenPCJr::readBuffer(int16 *stream, const int len) {
- int streamCount;
- int16 *sPtr, *cPtr;
+ Common::StackLock lock(_mutex);
if (_chanAllocated < len) {
free(_chanData);
@@ -563,9 +564,9 @@ int SoundGenPCJr::readBuffer(int16 *stream, const int len) {
// get channel data(chan.userdata)
if (chanGen(i, _chanData, len) == 0) {
// divide by number of channels then add to stream
- streamCount = len;
- sPtr = stream;
- cPtr = _chanData;
+ int streamCount = len;
+ int16 *sPtr = stream;
+ int16 *cPtr = _chanData;
while (streamCount--)
*(sPtr++) += *(cPtr++) / CHAN_MAX;
diff --git a/engines/agi/sound_pcjr.h b/engines/agi/sound_pcjr.h
index 4ffd1fb2b5c..b5bc203d4c5 100644
--- a/engines/agi/sound_pcjr.h
+++ b/engines/agi/sound_pcjr.h
@@ -108,6 +108,8 @@ private:
int fillSquare(ToneChan *t, int16 *buf, int len);
private:
+ Common::Mutex _mutex;
+
SndGenChan _channel[CHAN_MAX];
ToneChan _tchannel[CHAN_MAX];
int16 *_chanData;
diff --git a/engines/agi/sound_sarien.cpp b/engines/agi/sound_sarien.cpp
index 912718830b4..f7575d0c6bf 100644
--- a/engines/agi/sound_sarien.cpp
+++ b/engines/agi/sound_sarien.cpp
@@ -122,15 +122,17 @@ SoundGenSarien::~SoundGenSarien() {
}
int SoundGenSarien::readBuffer(int16 *buffer, const int numSamples) {
+ Common::StackLock lock(_mutex);
+
fillAudio(buffer, numSamples / 2);
return numSamples;
}
void SoundGenSarien::play(int resnum) {
- AgiSoundEmuType type;
+ Common::StackLock lock(_mutex);
- type = (AgiSoundEmuType)_vm->_game.sounds[resnum]->type();
+ AgiSoundEmuType type = (AgiSoundEmuType)_vm->_game.sounds[resnum]->type();
assert(type == AGI_SOUND_4CHN);
@@ -160,6 +162,8 @@ void SoundGenSarien::play(int resnum) {
}
void SoundGenSarien::stop() {
+ Common::StackLock lock(_mutex);
+
_playingSound = -1;
for (int i = 0; i < NUM_CHANNELS; i++)
diff --git a/engines/agi/sound_sarien.h b/engines/agi/sound_sarien.h
index e76071b63e0..1ebae491134 100644
--- a/engines/agi/sound_sarien.h
+++ b/engines/agi/sound_sarien.h
@@ -90,6 +90,8 @@ public:
}
private:
+ Common::Mutex _mutex;
+
ChannelInfo _chn[NUM_CHANNELS];
uint8 _env;
More information about the Scummvm-git-logs
mailing list