[Scummvm-git-logs] scummvm master -> 44513f457f7eec798db3d0e8650d371c07dbf271

mduggan mgithub at guarana.org
Sat May 9 10:54:54 UTC 2020


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
44513f457f ULTIMA8: Add sound effect and support regret in crusader quit gump


Commit: 44513f457f7eec798db3d0e8650d371c07dbf271
    https://github.com/scummvm/scummvm/commit/44513f457f7eec798db3d0e8650d371c07dbf271
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2020-05-09T19:54:20+09:00

Commit Message:
ULTIMA8: Add sound effect and support regret in crusader quit gump

Changed paths:
    engines/ultima/ultima8/gumps/quit_gump.cpp
    engines/ultima/ultima8/gumps/quit_gump.h


diff --git a/engines/ultima/ultima8/gumps/quit_gump.cpp b/engines/ultima/ultima8/gumps/quit_gump.cpp
index 05acfc9f6a..89e34b4042 100644
--- a/engines/ultima/ultima8/gumps/quit_gump.cpp
+++ b/engines/ultima/ultima8/gumps/quit_gump.cpp
@@ -21,6 +21,7 @@
  */
 
 #include "ultima/ultima8/misc/pent_include.h"
+#include "ultima/ultima8/audio/audio_process.h"
 #include "ultima/ultima8/gumps/quit_gump.h"
 #include "ultima/ultima8/games/game_data.h"
 #include "ultima/ultima8/graphics/gump_shape_archive.h"
@@ -45,7 +46,13 @@ static const int remGumpShape = 21;
 static const int remAskShapeId = 0;
 static const int remYesShapeId = 19;
 static const int remNoShapeId = 20;
+static const int remQuitSound = 0x109;
 
+static const int regGumpShape = 21;
+static const int regAskShapeId = 0;
+static const int regYesShapeId = 19;
+static const int regNoShapeId = 20;
+static const int regQuitSound = 0;  // TODO: Work out what sound id
 
 QuitGump::QuitGump(): ModalGump(0, 0, 5, 5), _yesWidget(0), _noWidget(0) {
 	Mouse *mouse = Mouse::get_instance();
@@ -58,6 +65,7 @@ QuitGump::QuitGump(): ModalGump(0, 0, 5, 5), _yesWidget(0), _noWidget(0) {
 		_noShape = u8NoShapeId;
 		_buttonXOff = 16;
 		_buttonYOff = 38;
+		_playSound = 0;
 	} else if (GAME_IS_REMORSE) {
 		_gumpShape = remGumpShape;
 		_askShape = remAskShapeId;
@@ -65,6 +73,16 @@ QuitGump::QuitGump(): ModalGump(0, 0, 5, 5), _yesWidget(0), _noWidget(0) {
 		_noShape = remNoShapeId;
 		_buttonXOff = 55;
 		_buttonYOff = 47;
+		_playSound = remQuitSound;
+	} else if (GAME_IS_REGRET) {
+		_gumpShape = regGumpShape;
+		_askShape = regAskShapeId;
+		_yesShape = regYesShapeId;
+		_noShape = regNoShapeId;
+		// TODO: These are pretty approximate, need adjusting.
+		_buttonXOff = 50;
+		_buttonYOff = 70;
+		_playSound = regQuitSound;
 	} else {
 		error("unsupported game type");
 	}
@@ -114,6 +132,11 @@ void QuitGump::InitGump(Gump *newparent, bool take_focus) {
 	widget->InitGump(this);
 	widget->setRelativePosition(TOP_RIGHT, -(int)_buttonXOff, _buttonYOff);
 	_noWidget = widget->getObjId();
+
+	if (_playSound) {
+		AudioProcess *audioproc = AudioProcess::get_instance();
+		audioproc->playSFX(_playSound, 0x10, _objId, 1);
+	}
 }
 
 
diff --git a/engines/ultima/ultima8/gumps/quit_gump.h b/engines/ultima/ultima8/gumps/quit_gump.h
index 742899c2c3..57f5e72aa7 100644
--- a/engines/ultima/ultima8/gumps/quit_gump.h
+++ b/engines/ultima/ultima8/gumps/quit_gump.h
@@ -51,12 +51,13 @@ protected:
 	void saveData(Common::WriteStream *ws) override;
 	ObjId _yesWidget, _noWidget;
 
-	uint32 _gumpShape;
-	uint32 _yesShape;
-	uint32 _noShape;
-	uint32 _askShape;
-	uint32 _buttonXOff;
-	uint32 _buttonYOff;
+	uint32 _gumpShape;	//! shape number for the dialog
+	uint32 _yesShape;	//! shape number for "yes" button
+	uint32 _noShape;	//! shape number for "no" button
+	uint32 _askShape;	//! shape number for "are you sure?"
+	uint32 _buttonXOff;	//! x offset from either edge of yes/no  buttons
+	uint32 _buttonYOff;	//! y offset from bottom of yes/no  buttons
+	uint32 _playSound;	//! sound to play on open
 };
 
 } // End of namespace Ultima8




More information about the Scummvm-git-logs mailing list