From cf3f253d2e5483385bffedfc24e0868db89cc5ce Mon Sep 17 00:00:00 2001 From: Matthew Duggan Date: Tue, 30 Jun 2020 16:03:57 +0900 Subject: [PATCH] ULTIMA8: Play sounds in keypad --- engines/ultima/ultima8/gumps/keypad_gump.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/engines/ultima/ultima8/gumps/keypad_gump.cpp b/engines/ultima/ultima8/gumps/keypad_gump.cpp index b212ce6371c..ebb3cf96c02 100644 --- a/engines/ultima/ultima8/gumps/keypad_gump.cpp +++ b/engines/ultima/ultima8/gumps/keypad_gump.cpp @@ -96,28 +96,33 @@ bool KeypadGump::OnKeyDown(int key, int mod) { void KeypadGump::ChildNotify(Gump *child, uint32 message) { //ObjId cid = child->getObjId(); if (message == ButtonWidget::BUTTON_CLICK) { + uint16 sfxno = 0; int buttonNo = child->GetIndex(); if (buttonNo < 9) { _value *= 10; _value += buttonNo + 1; + sfxno = 0x3b; } else if (buttonNo == 10) { _value *= 10; + sfxno = 0x3b; } else if (buttonNo == 9) { _value /= 10; + sfxno = 0x3a; } else if (buttonNo == 11) { - AudioProcess *audio = AudioProcess::get_instance(); // TODO: Do something as a result of this other than just play a sound. if (_value == _targetValue) { - if (audio) - audio->playSFX(0x32, 0x10, _objId, 1); + sfxno = 0x32; Close(); + // Note: careful, this is now deleted. } else { // wrong. - if (audio) - audio->playSFX(0x31, 0x10, _objId, 1); + sfxno = 0x31; _value = 0; } } + AudioProcess *audio = AudioProcess::get_instance(); + if (audio && sfxno) + audio->playSFX(sfxno, 0x10, _objId, 1); } }