[Scummvm-tracker] [ScummVM :: Bugs] #2536: SCUMM: MM (NES) - Minor newgame sound glitch

ScummVM :: Bugs trac at scummvm.org
Thu Sep 29 19:52:22 UTC 2022


#2536: SCUMM: MM (NES) - Minor newgame sound glitch
------------------------+-----------------------------
Reporter:  SF/quietust  |       Owner:  (none)
    Type:  defect       |      Status:  new
Priority:  normal       |   Component:  Engine: SCUMM
 Version:               |  Resolution:
Keywords:               |        Game:  Maniac Mansion
------------------------+-----------------------------
Comment (by dwatteau):

 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.
-- 
Ticket URL: <https://bugs.scummvm.org/ticket/2536#comment:10>
ScummVM :: Bugs <https://bugs.scummvm.org>
ScummVM


More information about the Scummvm-tracker mailing list