Opened 17 years ago

Last modified 3 days ago

#2536 new defect

SCUMM: MM (NES) - Minor newgame sound glitch

Reported by: SF/quietust Owned by:
Priority: normal Component: Engine: SCUMM
Version: Keywords:
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 (10)

comment:1 by Kirben, 17 years ago

Summary: MMNES - Minor newgame glitchMANIACNES: Minor newgame glitch

comment:2 by fingolfin, 16 years ago

Summary: MANIACNES: Minor newgame glitchMANIACNES: Minor newgame sound glitch

comment:3 by SF/saturnyne, 15 years ago

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.

comment:4 by sev-, 13 years ago

Owner: set to sev-
Priority: normalhigh

comment:5 by sev-, 13 years ago

This bug is nice to get fixed before the release. Raising priority for keeping the track.

comment:6 by digitall, 12 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 sev-, 11 years ago

Owner: sev- removed

comment:8 by sev-, 10 years ago

Priority: highnormal

comment:9 by raziel-, 2 years ago

Summary: MANIACNES: Minor newgame sound glitchSCUMM: MM (NES) - Minor newgame sound glitch

comment:10 by dwatteau, 3 days 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.

Note: See TracTickets for help on using tickets.