Opened 2 years ago

Last modified 8 months ago

#15341 new defect

GOB: Goblins 2 - Missing footsteps sound effect in Floppy version

Reported by: DisizDream Owned by: bluegr
Priority: normal Component: Engine: Gob
Version: Keywords:
Cc: DisizDream Game: Gobliins 2

Description

ScummVM version:
ScummVM 2.8.1 (Mar 16 2024 13:01:03)

Bug details:
Hi, I have noticed that the footsteps are not playing correctly in Gobliins 2. With the multilingual PC DOS CD version (CD v2.01, 24a6b32757752ccb1917ce92fd7c2a04) the footsteps can be heard but very rarely. If you walk from the far left to the far right of the screen, you will be lucky to hear up to 2 footsteps.
With the PC DOS Floppy version (b45b984ee8017efd6ea965b9becd4d66) you can't hear any footsteps at all.
When playing the same version in DOSBox, you can hear every footsteps in both the floppy and CD version.
I have tried very old version of ScummVM (0.12.0) to see if it was a regression, and it seems this bug was there since a long time.

Language of game: any

Version of game: PC DOS Floppy and PC DOS CD

Your OS: Windows 10 Home 10.0.19045 Build 19045

Attachments (1)

code.patch (14.2 KB ) - added by Florian-Simon-RedArtGames 8 months ago.
Patch that fixes footsteps in our temporary fork of the gob engine

Download all attachments as: .zip

Change History (22)

comment:1 by Antonin-Carette-RedArtGames, 2 years ago

Hi,

The issue is maybe related to the fact that a delay can be NULL (0), in the function

void PCSpeaker::stop(int32 delay)

which can disable the stacked foot sound effect.

Maybe increasing the delay variable (like max(1, delay)) might solve the problem, I will check on my side.

comment:2 by BJNFNE, 2 years ago

Owner: set to Antonin-Carette-RedArtGames
Resolution: fixed
Status: newclosed

comment:3 by tag2015, 2 years ago

Resolution: fixed
Status: closednew

This is not fixed. Using latest master I can reproduce the issue.

AFAIK the recent PR addressed background music, not sound effects.

comment:4 by Antonin-Carette-RedArtGames, 2 years ago

Hi,

Thanks @tag2015 for reopening the ticket.
My previous PR did not solve this issue, indeed.

So, I have a fix for the CD-Rom version, but not for the Floppy version yet.
I will continue to work on it and keep you updated.

I don't know if I can submit the fix for the CD-Rom now and update later for the Floppy, or if the community prefers to receive the full PR only.

comment:5 by tag2015, 22 months ago

If you have a fix for the CD version maybe you could open a PR, the next ScummVM release is approaching and it'd be nice to include it :)

comment:6 by Antonin-Carette-RedArtGames, 22 months ago

Hi tag2015,

I have submitted it here: https://github.com/scummvm/scummvm/pull/6222

comment:7 by Filippos Karapetis <bluegr@…>, 22 months ago

In e8ddc077:

GOB: Fix footstep sounds in Gob2 CD - bug 15341

This is the same workaround as the one done for Gob 3 in a852f30fb272c4b6adec898a09f3fe8c1f631b90

comment:8 by bluegr, 22 months ago

Owner: changed from Antonin-Carette-RedArtGames to bluegr
Resolution: fixed
Status: newclosed

comment:9 by Antonin-Carette-RedArtGames, 21 months ago

This ticket should be closed as the issue is not fixed.

This ticket actually describes two issues:

  1. No footsteps sound for CD-Rom version
  2. No footsteps sound for Floppy-Disc version.

The fix actually solves the CD-Rom version but not the Floppy-Disc one.

I am currently working on getting footsteps for the Floppy-Disc version, but I would like some help from the community.

This is my research on that subject: the CD-Rom & Floppy-Disc versions do not run the same "code" (functions) when a Goblin is walking.

The CD-Rom version is interpreted like this:

`
Debug: GOB01.TOT:00006540: opcodeFunc 0.0 [0x0.0x0] (o1_callSub)
Debug: tot = "GOB01.TOT", offset = 6063
Debug: GOB01.TOT:00006068: opcodeFunc 0.8 [0x0.0x8] (o1_if)
Debug: cmd = 0
Debug: GOB01.TOT:00006246: opcodeFunc 0.8 [0x0.0x8] (o1_if)
Debug: cmd = 0
Debug: GOB01.TOT:00006543: opcodeFunc 0.0 [0x0.0x0] (o1_callSub)
Debug: tot = "GOB01.TOT", offset = 16653
Debug: GOB01.TOT:00016658: opcodeFunc 0.8 [0x0.0x8] (o1_if)
Debug: cmd = 0
Debug: GOB01.TOT:00016679: opcodeFunc 0.9 [0x0.0x9] (o2_assign)
Debug: var parse = 23
Debug: oper = 21

<------------- CALLSUB IS DONE HERE !

Debug: GOB01.TOT:00016686: opcodeFunc 0.0 [0x0.0x0] (o1_callSub)
Debug: tot = "GOB01.TOT", offset = 13676
Debug: GOB01.TOT:00013681: opcodeFunc 0.8 [0x0.0x8] (o1_if)
Debug: GOB01.TOT:00013708: opcodeFunc 0.9 [0x0.0x9] (o2_assign)
Debug: var parse = 23
Debug: oper = 3346
Debug: GOB01.TOT:00013716: opcodeFunc 0.9 [0x0.0x9] (o2_assign)
Debug: var parse = 23
Debug: oper = 3602
Debug: GOB01.TOT:00013724: opcodeFunc 0.9 [0x0.0x9] (o2_assign)
Debug: var parse = 23
Debug: oper = 21
Debug: GOB01.TOT:00013731: opcodeFunc 0.8 [0x0.0x8] (o1_if)
Debug: GOB01.TOT:00013750: opcodeFunc 0.8 [0x0.0x8] (o1_if)
Debug: GOB01.TOT:00013769: opcodeFunc 2.2 [0x2.0x2] (o1_speakerOn) o1_speakerOn is done -> footstep sound !!!!
`

As you can see the o1_speakerOn function is called in through a subroutine at 00016686.

In the Floppy-Disc version, we don't have this subroutine call:

`
Debug: gob01.TOT:00006282: opcodeFunc 0.0 [0x0.0x0] (o1_callSub)
Debug: tot = "gob01.TOT", offset = 5965
Debug: gob01.TOT:00005970: opcodeFunc 0.8 [0x0.0x8] (o1_if)
Debug: cmd = 0
Debug: gob01.TOT:00006046: opcodeFunc 0.8 [0x0.0x8] (o1_if)
Debug: cmd = 0
Debug: gob01.TOT:00006285: opcodeFunc 0.0 [0x0.0x0] (o1_callSub)
Debug: tot = "gob01.TOT", offset = 16000
Debug: gob01.TOT:00016005: opcodeFunc 0.8 [0x0.0x8] (o1_if)
Debug: cmd = 0
Debug: gob01.TOT:00016026: opcodeFunc 0.9 [0x0.0x9] (o2_assign)
Debug: var parse = 23
Debug: oper = 21

<------ MISSING CALLSUB !!!!

Debug: gob01.TOT:00016033: opcodeFunc 0.8 [0x0.0x8] (o1_if)
Debug: cmd = 0
Debug: gob01.TOT:00016494: opcodeFunc 0.8 [0x0.0x8] (o1_if)
Debug: cmd = 0
Debug: gob01.TOT:00016526: opcodeFunc 2.5 [0x2.0x5] (o2_goblinFunc)
Debug: opcodeGoblin 100 [0x64] (o2_handleGoblins)
`

If the footstep sound is really performed in the o1_speakerOn function as I expect, then I think there is a bug with the interpretation of the game for the Floppy-Disc version only.

comment:10 by tag2015, 21 months ago

Priority: highnormal
Summary: GOB2: footsteps sound issuesGOB2: Missing footsteps sound effect in Floppy version

comment:11 by tag2015, 21 months ago

Resolution: fixed
Status: closednew

comment:12 by tag2015, 21 months ago

Summary: GOB2: Missing footsteps sound effect in Floppy versionGOB: Goblins 2 - Missing footsteps sound effect in Floppy version

comment:13 by bluegr, 20 months ago

As far as I know, there is no footstep sound in the Gob 2 floppy version. Check this video:
https://www.youtube.com/watch?v=5MyZhbvGreA

@Antonin-Carette-RedArtGames are you sure that there was ever such a sound in the floppy version? Does this bug really apply to the floppy version?

comment:14 by DisizDream, 20 months ago

@bluegr I have tried to run the DOS floppy version in DOSBox and I can hear footsteps sounds. Here’s a video I found where you can hear it: https://youtu.be/a8ci4IgBuvs

The video you sent shows the Amiga version, maybe it’s normal for the Amiga version to not have footsteps sounds. I never tested this version myself.

comment:15 by Antonin-Carette-RedArtGames, 20 months ago

Hi @bluegr,
As far as I tested I have the footsteps sounds in the Floppy version using Dosbox, so we should have it using ScummVM normally.

I did not tested the AMIGA version either.

comment:16 by Jerome-Labbe-RedArtGames, 20 months ago

Fun fact: In Gob2 floppy DOS in latest ScummVM version, if you disable the music in-game, and you move from one scene to another: you might hear footsteps when entering the new scene. Sometimes you hear one, sometimes two, sometimes none at all.

comment:17 by Florian-Simon-RedArtGames, 8 months ago

I've had some luck in the first level of Gob2 (floppy) with the attached patch.

Our QA pass on the fix is still pending (holidays coming soon), but I would like to submit this patch if it proves to be working. Would you suggest another approach?

For context: I noticed while comparing scripts of the CD edition with the floppy edition's that a procedure call to play footsteps was missing, and manually reimplemented that procedure whenever we reach specific script positions.

I'm not a big fan of incurring performance penalties on all assignments in games running the inter_v2 opcodes, so I'm open to better suggestions.

by Florian-Simon-RedArtGames, 8 months ago

Attachment: code.patch added

Patch that fixes footsteps in our temporary fork of the gob engine

comment:18 by BJNFNE, 8 months ago

@sdelamarre could you check that?

comment:19 by BJNFNE, 8 months ago

@Florian-Simon-RedArtGames Could you please contact me on Discord? I would ask you some questions. My Discord is: BJNFNE

comment:20 by sdelamarre, 8 months ago

We often use that kind of hack of injecting a particular behavior when reaching a specific script offset, but generally as a workaround to bugs in the original engine, or to implement some improvements e.g. skipping copy protection screens.

Here it is different, since the footsteps are played in the original. So we would first try to understand why ScummVM is behaving differently here.

You mention that a opcode "o1_speakerOn" is not called in the floppy version. Maybe it is actually behind a "o1_if", whose condition is not fulfilled in ScummVM for some reason... This could be verified in a decompilation of this GOB1.TOT script. You can use our "extact_gob_stk" tool (to extract the TOT file out of a .STK archive) and "degob" tool (to decompile the TOT file into a human readable text file) from the scummvm-tools project :
https://wiki.scummvm.org/index.php?title=ScummVM_Tools#degob

Otherwise, to be merged to ScummVM those changes would need to comply our coding conventions (https://wiki.scummvm.org/index.php/Coding_Conventions), in particular no STL and stick to C++11 (so for example std::optional cannot be used).

comment:21 by Florian-Simon-RedArtGames, 8 months ago

I'll propose a patch following the coding standard you sent me after fully validating the fix actually works beyond the first level of the game.

Regarding the fix, I decompiled the scripts with Boozook and noticed the call to what seems to be the footsteps procedure simply wasn't there at all in the floppy version when compared to the CD version (the line with the call to the footsteps procedure is removed), and adding it seemed to fix the issue in the first level, which is the only one I've tested so far. It's quite clear if you compare versions side by side at the offsets listed in the patch, and compare the number of calls to the footsteps procedure in the scripts for any level in the floppy vs the CD version.

You're right when you say that it must work differently in the floppy version, but I haven't found what that difference could be, so I decided to just introduce a hack in our version rather than spending too much time understanding the root cause of the issue.

Thanks for your time!

Note: See TracTickets for help on using tickets.