Opened 19 years ago
Closed 2 months ago
#2536 closed defect (fixed)
SCUMM: MM (NES) - Minor newgame sound glitch
Reported by: | SF/quietust | Owned by: | dwatteau |
---|---|---|---|
Priority: | normal | Component: | Engine: SCUMM |
Version: | Keywords: | NES | |
Cc: | Game: | Maniac Mansion |
Description
Normally, when starting a new game, the "Pickup Item" sound can be heard before the starting room (full moon with all 3 characters) is drawn, immediately followed by Dave's music.
In ScummVM, however, this sound is never played, and the "crickets" sound is played in the room before Dave's music starts playing.
Ticket imported from: #1451721. Ticket imported from: bugs/2536.
Change History (13)
comment:1 by , 19 years ago
Summary: | MMNES - Minor newgame glitch → MANIACNES: Minor newgame glitch |
---|
comment:2 by , 18 years ago
Summary: | MANIACNES: Minor newgame glitch → MANIACNES: Minor newgame sound glitch |
---|
comment:3 by , 17 years ago
comment:4 by , 15 years ago
Owner: | set to |
---|---|
Priority: | normal → high |
comment:5 by , 15 years ago
This bug is nice to get fixed before the release. Raising priority for keeping the track.
comment:6 by , 14 years ago
Confirmed that this is still the behaviour i.e. crickets, no pickup sound; with current master i.e. desc/1.3.0git-3499-gd054280 and Maniac Mansion (Europe).
comment:7 by , 13 years ago
Owner: | removed |
---|
comment:8 by , 12 years ago
Priority: | high → normal |
---|
comment:9 by , 4 years ago
Summary: | MANIACNES: Minor newgame sound glitch → SCUMM: MM (NES) - Minor newgame sound glitch |
---|
comment:10 by , 2 years ago
Some debug output when this part of the game is triggered:
Script 131, offset 0x42: [50] o2_pickupObject() Adding object 49 from room 44 into inventory getResourceAddress(Room,44) _res->createResource(Inventory,0,237) ensureResourceLoaded(Sound,51) loadResource(Sound,51) openRoom(41) openResourceFile(41.LFL) Opening hashed: 41.LFL _res->createResource(Sound,51,19) getResourceAddress(Sound,51) ... getResourceAddress(Costume,3) playSound #51 getResourceAddress(Sound,51) getResourceAddress(Sound,51) playSound #51 getResourceAddress(Sound,51) getResourceAddress(Sound,51) playSound #51 getResourceAddress(Sound,51) getResourceAddress(Sound,51) playSound #38 getResourceAddress(Sound,38) getResourceAddress(Sound,38)
Sound no. 51 is the "Pickup item" sound, while sound no. 38 is the cricket sound (which is part of the background noise when you're outside). The pickup action is automatically triggered by the inventory initialization (one "CD" is given to each kid) at the top of script 44-131.
Playing the pickup sound is not done by the scripts, though; it's hardcoded in the engine:
https://github.com/scummvm/scummvm/blob/v2.6.0/engines/scumm/script_v2.cpp#L1670
void ScummEngine_v2::o2_pickupObject() { ... runInventoryScript(1); if (_game.platform == Common::kPlatformNES) _sound->addSoundToQueue(51); // play 'pickup' sound }
If I do this:
diff --git a/engines/scumm/script_v2.cpp b/engines/scumm/script_v2.cpp index 99db95ce3d1..12daa6b56c4 100644 @@ -1681,7 +1681,7 @@ void ScummEngine_v2::o2_pickupObject() { runInventoryScript(1); if (_game.platform == Common::kPlatformNES) - _sound->addSoundToQueue(51); // play 'pickup' sound + _sound->playSound(51); // play 'pickup' sound } void ScummEngine_v2::o2_cursorCommand() { // TODO: Define the magic numbers
then the pickup sound always takes priority, and the newgame sound now appears to be OK. But I don't know if that's the right way to fix this, and if it's safe to bypass the sound queue.
follow-up: 13 comment:11 by , 2 months ago
I just checked a NES disassembly and the fix above is what our code should do. It immediately calls startSound
, which seems to immediately parse the sound and manipulate the four NES wave channels.
Want to commit it yourself?
comment:13 by , 2 months ago
Keywords: | NES added |
---|---|
Owner: | set to |
Resolution: | → fixed |
Status: | new → closed |
Replying to AndywinXp:
I just checked a NES disassembly and the fix above is what our code should do. It immediately calls
startSound
, which seems to immediately parse the sound and manipulate the four NES wave channels.
Want to commit it yourself?
Thanks! I've just done so, so I'm closing this ticket.
Thanks again for looking at the disasm!
Along that lines, would it be possible/reasonable to put the music and sound effects on different channels? It would allow scummvm to surpass just basic NES emulation by making it so that SFX and BGM don't have to borrow channels from each other when one interferes with the other.