Skip to content

Commit

Permalink
GOB: Fix footstep sounds in Gob2 CD - bug 15341
Browse files Browse the repository at this point in the history
This is the same workaround as the one done for Gob 3 in a852f30
  • Loading branch information
bluegr committed Nov 6, 2024
1 parent 85ebacf commit e8ddc07
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
3 changes: 3 additions & 0 deletions engines/gob/inter.h
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,9 @@ class Inter_v1 : public Inter {
void o1_initGoblin(OpGobParams &params);

void manipulateMap(int16 xPos, int16 yPos, int16 item);

private:
bool _ignoreSpeakerOff = false;
};

class Inter_Geisha : public Inter_v1 {
Expand Down
23 changes: 21 additions & 2 deletions engines/gob/inter_v1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1438,11 +1438,30 @@ void Inter_v1::o1_renewTimeInVars(OpFuncParams &params) {
}

void Inter_v1::o1_speakerOn(OpFuncParams &params) {
_vm->_sound->speakerOn(_vm->_game->_script->readValExpr(), -1);
int16 frequency = _vm->_game->_script->readValExpr();
int32 length = -1;

_ignoreSpeakerOff = false;

// WORKAROUND: This is the footsteps sound in Gob2 CD.
// We explicitly set a length in this case and ignore the
// next speaker off command. This is the same workaround
// as the one for Goblins 3 in Inter_v3::o3_speakerOn().
// Fixes bug #15341
if (_vm->getGameType() == kGameTypeGob2 && frequency == 50) {
length = 5;

_ignoreSpeakerOff = true;
}

_vm->_sound->speakerOn(frequency, length);
}

void Inter_v1::o1_speakerOff(OpFuncParams &params) {
_vm->_sound->speakerOff();
if (!_ignoreSpeakerOff)
_vm->_sound->speakerOff();

_ignoreSpeakerOff = false;
}

void Inter_v1::o1_putPixel(OpFuncParams &params) {
Expand Down

0 comments on commit e8ddc07

Please sign in to comment.