[Scummvm-git-logs] scummvm master -> 007b6662eb493ee6a6d94d9d4242163051702366

OMGPizzaGuy 48367439+OMGPizzaGuy at users.noreply.github.com
Sun Feb 7 01:09:43 UTC 2021


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

Summary:
774e6a5e34 ULTIMA8: Add start and stop commands for highlight items
007b6662eb ULTIMA8: Implement speech and subtitle options


Commit: 774e6a5e34814b654efa583d14aaf517c5c41d21
    https://github.com/scummvm/scummvm/commit/774e6a5e34814b654efa583d14aaf517c5c41d21
Author: Matthew Jimenez (matthew.jimenez at outlook.com)
Date: 2021-02-06T18:40:31-06:00

Commit Message:
ULTIMA8: Add start and stop commands for highlight items

The key binding was attached to toggle highlight items for both press and release TAB. This could lead to a state where items are constantly highlighted when TAB is not pressed if binding is ignored on release. Toggle is still a valid option, so the command is still allowed

Changed paths:
    engines/ultima/ultima8/meta_engine.cpp
    engines/ultima/ultima8/misc/debugger.cpp
    engines/ultima/ultima8/misc/debugger.h


diff --git a/engines/ultima/ultima8/meta_engine.cpp b/engines/ultima/ultima8/meta_engine.cpp
index cff32d3ded..6a77732d88 100644
--- a/engines/ultima/ultima8/meta_engine.cpp
+++ b/engines/ultima/ultima8/meta_engine.cpp
@@ -50,8 +50,7 @@ static const KeybindingRecord COMMON_KEYS[] = {
 	{ ACTION_LOAD, "LOAD", "Load Game", "GUIApp::loadGame", nullptr, "F7", nullptr, 0 },
 	{ ACTION_COMBAT, "COMBAT", "Combat", "MainActor::toggleCombat", nullptr, "c", "JOY_X", 0 },
 	{ ACTION_MENU, "MENU", "Game Menu", "MenuGump::showMenu", nullptr, "ESCAPE", "JOY_Y", FLAG_MENU_ENABLED },
-	{ ACTION_HIGHLIGHT_ITEMS, "HIGHLIGHT_ITEMS", "Show Highlight Items", "GameMapGump::toggleHighlightItems",
-		"GameMapGump::toggleHighlightItems", "TAB", nullptr, 0 },
+	{ ACTION_HIGHLIGHT_ITEMS, "HIGHLIGHT_ITEMS", "Show Highlight Items", "GameMapGump::startHighlightItems", "GameMapGump::stopHighlightItems", "TAB", nullptr, 0 },
 	{ ACTION_TOGGLE_TOUCHING, "TOUCHING", "Show Touching Items", "GUIApp::toggleShowTouchingItems", nullptr, "h", nullptr, 0 },
 	{ ACTION_TURN_LEFT, "TURN_LEFT", "Turn Left", "AvatarMoverProcess::startTurnLeft", "AvatarMoverProcess::stopTurnLeft", "LEFT", nullptr, FLAG_MENU_ENABLED },
 	{ ACTION_TURN_RIGHT, "TURN_RIGHT", "Turn Right", "AvatarMoverProcess::startTurnRight", "AvatarMoverProcess::stopTurnRight", "RIGHT", nullptr, FLAG_MENU_ENABLED },
diff --git a/engines/ultima/ultima8/misc/debugger.cpp b/engines/ultima/ultima8/misc/debugger.cpp
index 4bc6f1566c..9fd4bc0fe7 100644
--- a/engines/ultima/ultima8/misc/debugger.cpp
+++ b/engines/ultima/ultima8/misc/debugger.cpp
@@ -127,6 +127,8 @@ Debugger::Debugger() : Shared::Debugger() {
 	registerCmd("Cheat::items", WRAP_METHOD(Debugger, cmdCheatItems));
 	registerCmd("Cheat::equip", WRAP_METHOD(Debugger, cmdCheatEquip));
 
+	registerCmd("GameMapGump::startHighlightItems", WRAP_METHOD(Debugger, cmdStartHighlightItems));
+	registerCmd("GameMapGump::stopHighlightItems", WRAP_METHOD(Debugger, cmdStopHighlightItems));
 	registerCmd("GameMapGump::toggleHighlightItems", WRAP_METHOD(Debugger, cmdToggleHighlightItems));
 	registerCmd("GameMapGump::dumpMap", WRAP_METHOD(Debugger, cmdDumpMap));
 	registerCmd("GameMapGump::incrementSortOrder", WRAP_METHOD(Debugger, cmdIncrementSortOrder));
@@ -631,6 +633,14 @@ bool Debugger::cmdToggleInvincibility(int argc, const char **argv) {
 }
 
 
+bool Debugger::cmdStartHighlightItems(int argc, const char **argv) {
+	GameMapGump::Set_highlightItems(true);
+	return false;
+}
+bool Debugger::cmdStopHighlightItems(int argc, const char **argv) {
+	GameMapGump::Set_highlightItems(false);
+	return false;
+}
 bool Debugger::cmdToggleHighlightItems(int argc, const char **argv) {
 	GameMapGump::Set_highlightItems(!GameMapGump::is_highlightItems());
 	return false;
diff --git a/engines/ultima/ultima8/misc/debugger.h b/engines/ultima/ultima8/misc/debugger.h
index 85b57e24d1..7ae8c902ac 100644
--- a/engines/ultima/ultima8/misc/debugger.h
+++ b/engines/ultima/ultima8/misc/debugger.h
@@ -192,6 +192,8 @@ private:
 	bool cmdToggleInvincibility(int argc, const char **argv);
 
 	// Game Map Gump
+	bool cmdStartHighlightItems(int argc, const char **argv);
+	bool cmdStopHighlightItems(int argc, const char **argv);
 	bool cmdToggleHighlightItems(int argc, const char **argv);
 	bool cmdDumpMap(int argc, const char **argvv);
 	bool cmdIncrementSortOrder(int argc, const char **argv);


Commit: 007b6662eb493ee6a6d94d9d4242163051702366
    https://github.com/scummvm/scummvm/commit/007b6662eb493ee6a6d94d9d4242163051702366
Author: Matthew Jimenez (matthew.jimenez at outlook.com)
Date: 2021-02-06T18:40:31-06:00

Commit Message:
ULTIMA8: Implement speech and subtitle options

This replaces "textdelay" option with "talkspeed" and the new defaults should behave the same as the old value.
Text speed behavior stills need improvement but seems to work well

Changed paths:
    engines/ultima/shared/engine/ultima.cpp
    engines/ultima/ultima8/games/remorse_game.cpp
    engines/ultima/ultima8/games/u8_game.cpp
    engines/ultima/ultima8/graphics/skf_player.cpp
    engines/ultima/ultima8/gumps/bark_gump.cpp
    engines/ultima/ultima8/gumps/bark_gump.h


diff --git a/engines/ultima/shared/engine/ultima.cpp b/engines/ultima/shared/engine/ultima.cpp
index 60fdb729b2..e35d2364fe 100644
--- a/engines/ultima/shared/engine/ultima.cpp
+++ b/engines/ultima/shared/engine/ultima.cpp
@@ -74,6 +74,7 @@ void UltimaEngine::GUIError(const Common::U32String &msg) {
 
 bool UltimaEngine::hasFeature(EngineFeature f) const {
 	return
+		(f == kSupportsSubtitleOptions) ||
 		(f == kSupportsReturnToLauncher) ||
 		(f == kSupportsLoadingDuringRuntime) ||
 		(f == kSupportsSavingDuringRuntime);
diff --git a/engines/ultima/ultima8/games/remorse_game.cpp b/engines/ultima/ultima8/games/remorse_game.cpp
index 8b8f54f760..086a2dd6e5 100644
--- a/engines/ultima/ultima8/games/remorse_game.cpp
+++ b/engines/ultima/ultima8/games/remorse_game.cpp
@@ -45,7 +45,9 @@ RemorseGame::RemorseGame() : Game() {
 	// Set some defaults for gameplay-related settings
 	ConfMan.registerDefault("endgame", true);
 	ConfMan.registerDefault("footsteps", true);
-	ConfMan.registerDefault("textdelay", 5);
+	ConfMan.registerDefault("talkspeed", 96);
+	ConfMan.registerDefault("subtitles", true);
+	ConfMan.registerDefault("speech_mute", false);
 }
 
 RemorseGame::~RemorseGame() {
diff --git a/engines/ultima/ultima8/games/u8_game.cpp b/engines/ultima/ultima8/games/u8_game.cpp
index 0a6f1856ac..b692941347 100644
--- a/engines/ultima/ultima8/games/u8_game.cpp
+++ b/engines/ultima/ultima8/games/u8_game.cpp
@@ -54,12 +54,14 @@ U8Game::U8Game() : Game() {
 	ConfMan.registerDefault("quotes", false);
 	ConfMan.registerDefault("footsteps", true);
 	ConfMan.registerDefault("targetedjump", true);
+	ConfMan.registerDefault("subtitles", true);
+	ConfMan.registerDefault("speech_mute", false);
 
 	const GameInfo *info = Ultima8Engine::get_instance()->getGameInfo();
 	if (info->_language == GameInfo::GAMELANG_JAPANESE) {
-		ConfMan.registerDefault("textdelay", 20);
+		ConfMan.registerDefault("talkspeed", 24);
 	} else {
-		ConfMan.registerDefault("textdelay", 8);
+		ConfMan.registerDefault("talkspeed", 60);
 	}
 }
 
diff --git a/engines/ultima/ultima8/graphics/skf_player.cpp b/engines/ultima/ultima8/graphics/skf_player.cpp
index c944149d91..0cd3b0ade7 100644
--- a/engines/ultima/ultima8/graphics/skf_player.cpp
+++ b/engines/ultima/ultima8/graphics/skf_player.cpp
@@ -35,6 +35,7 @@
 #include "ultima/ultima8/graphics/fonts/font.h"
 #include "ultima/ultima8/graphics/fonts/font_manager.h"
 #include "ultima/ultima8/graphics/fonts/rendered_text.h"
+#include "common/config-manager.h"
 #include "common/system.h"
 
 namespace Ultima {
@@ -172,6 +173,9 @@ void SKFPlayer::run() {
 	MusicProcess *musicproc = MusicProcess::get_instance();
 	AudioProcess *audioproc = AudioProcess::get_instance();
 
+	bool subtitles = ConfMan.getBool("subtitles");
+	bool speechMute = ConfMan.getBool("speech_mute");
+
 	// handle _events for the current frame
 	while (_curEvent < _events.size() && _events[_curEvent]->_frame <= _curFrame) {
 //		pout << "event " << _curEvent << Std::endl;
@@ -221,7 +225,7 @@ void SKFPlayer::run() {
 		case SKF_PlaySound: {
 //			pout << "PlaySound " << _events[_curEvent]->_data << Std::endl;
 
-			if (audioproc) {
+			if (!speechMute && audioproc) {
 				uint8 *buf = _skf->get_object(_events[_curEvent]->_data);
 				uint32 bufsize = _skf->get_size(_events[_curEvent]->_data);
 				AudioSample *s;
@@ -237,7 +241,7 @@ void SKFPlayer::run() {
 			char *textbuf = reinterpret_cast<char *>(
 			                    _skf->get_object(_events[_curEvent]->_data - 1));
 			uint32 textsize = _skf->get_size(_events[_curEvent]->_data - 1);
-			if (textsize > 7) {
+			if (subtitles && textsize > 7) {
 				Std::string subtitle = (textbuf + 6);
 				delete _subs;
 				_subtitleY = textbuf[4] + (textbuf[5] << 8);
diff --git a/engines/ultima/ultima8/gumps/bark_gump.cpp b/engines/ultima/ultima8/gumps/bark_gump.cpp
index ef63f96d81..5fbcb9ce6d 100644
--- a/engines/ultima/ultima8/gumps/bark_gump.cpp
+++ b/engines/ultima/ultima8/gumps/bark_gump.cpp
@@ -31,20 +31,29 @@
 namespace Ultima {
 namespace Ultima8 {
 
+static const int INT_MAX_VALUE = 0x7fffffff;
+static const int NO_SPEECH_LENGTH = 480;
+
 DEFINE_RUNTIME_CLASSTYPE_CODE(BarkGump)
 
 // TODO: Remove all the hacks
 
 BarkGump::BarkGump() : ItemRelativeGump(), _counter(0), _textWidget(0),
 		_speechShapeNum(0), _speechLength(0), _totalTextHeight(0),
-		_textDelay(20) {
+		_subtitles(false), _speechMute(false), _talkSpeed(0) {
+	_subtitles = ConfMan.getBool("subtitles");
+	_speechMute = ConfMan.getBool("speech_mute");
+	_talkSpeed = ConfMan.getInt("talkspeed");
 }
 
 BarkGump::BarkGump(uint16 owner, const Std::string &msg, uint32 speechShapeNum) :
 	ItemRelativeGump(0, 0, 100, 100, owner, FLAG_KEEP_VISIBLE, LAYER_ABOVE_NORMAL),
 	_barked(msg), _counter(100), _speechShapeNum(speechShapeNum),
-	_speechLength(0), _totalTextHeight(0), _textWidget(0), _textDelay(20) {
-	_textDelay = ConfMan.getInt("textdelay");
+	_speechLength(0), _totalTextHeight(0), _textWidget(0),
+	_subtitles(false), _speechMute(false), _talkSpeed(0) {
+	_subtitles = ConfMan.getBool("subtitles");
+	_speechMute = ConfMan.getBool("speech_mute");
+	_talkSpeed = ConfMan.getInt("talkspeed");
 }
 
 BarkGump::~BarkGump(void) {
@@ -81,7 +90,7 @@ void BarkGump::InitGump(Gump *newparent, bool take_focus) {
 	// see if we need to play speech
 	AudioProcess *ap = AudioProcess::get_instance();
 	_speechLength = 0;
-	if (_speechShapeNum && ap) {
+	if (!_speechMute && _speechShapeNum && ap) {
 		if (ap->playSpeech(_barked, _speechShapeNum, _owner)) {
 			_speechLength = ap->getSpeechLength(_barked, _speechShapeNum) / 33;
 			if (_speechLength == 0) _speechLength = 1;
@@ -96,6 +105,10 @@ void BarkGump::InitGump(Gump *newparent, bool take_focus) {
 				_totalTextHeight += d.height();
 			}
 			widget->rewind();
+
+			if (!_subtitles) {
+				widget->SetVisibility(false);
+			}
 		}
 	}
 
@@ -104,8 +117,11 @@ void BarkGump::InitGump(Gump *newparent, bool take_focus) {
 	widget->GetDims(d);
 	if (_speechLength && _totalTextHeight) {
 		_counter = (d.height() * _speechLength) / _totalTextHeight;
-	} else {
-		_counter = d.height() * _textDelay;
+	} else if (_talkSpeed) {
+		_counter = (d.height() * NO_SPEECH_LENGTH) / _talkSpeed;
+	}
+	else {
+		_counter = INT_MAX_VALUE;
 	}
 	_dims.setHeight(d.height());
 	_dims.setWidth(d.width());
@@ -123,8 +139,11 @@ bool BarkGump::NextText() {
 		widget->GetDims(d);
 		if (_speechLength && _totalTextHeight) {
 			_counter = (d.height() * _speechLength) / _totalTextHeight;
-		} else {
-			_counter = d.height() * _textDelay;
+		} else if (_talkSpeed) {
+			_counter = (d.height() * NO_SPEECH_LENGTH) / _talkSpeed;
+		}
+		else {
+			_counter = INT_MAX_VALUE;
 		}
 		_dims.setHeight(d.height());
 		_dims.setWidth(d.width());
@@ -144,7 +163,7 @@ void BarkGump::run() {
 			bool done = !NextText();
 			if (done) {
 				bool speechplaying = false;
-				if (_speechLength) {
+				if (!_speechMute && _speechLength) {
 					// waiting for speech to finish?
 					AudioProcess *ap = AudioProcess::get_instance();
 					if (ap)
@@ -155,8 +174,10 @@ void BarkGump::run() {
 				// if speech done too, close
 				if (!speechplaying)
 					Close();
+				else if (_talkSpeed)
+					_counter = NO_SPEECH_LENGTH / _talkSpeed;
 				else
-					_counter = _textDelay;
+					_counter = INT_MAX_VALUE;
 			}
 		}
 	}
@@ -168,7 +189,7 @@ Gump *BarkGump::onMouseDown(int button, int32 mx, int32 my) {
 
 	// Scroll to next text, if possible
 	if (!NextText()) {
-		if (_speechLength) {
+		if (!_speechMute && _speechLength) {
 			AudioProcess *ap = AudioProcess::get_instance();
 			if (ap) ap->stopSpeech(_barked, _speechShapeNum, _owner);
 		}
@@ -213,15 +234,20 @@ bool BarkGump::loadData(Common::ReadStream *rs, uint32 version) {
 	if (!widget)
 		return false;
 
-	_textDelay = ConfMan.getInt("textdelay");
-
 	// This is just a hack
 	Rect d;
 	widget->GetDims(d);
-	_counter = d.height() * _textDelay;
 	_dims.setHeight(d.height());
 	_dims.setWidth(d.width());
 
+	_subtitles = ConfMan.getBool("subtitles");
+	_speechMute = ConfMan.getBool("speech_mute");
+	_talkSpeed = ConfMan.getInt("talkspeed");
+	if (_talkSpeed)
+		_counter = (d.height() * NO_SPEECH_LENGTH) / _talkSpeed;
+	else
+		_counter = INT_MAX_VALUE;
+
 	return true;
 }
 
diff --git a/engines/ultima/ultima8/gumps/bark_gump.h b/engines/ultima/ultima8/gumps/bark_gump.h
index e877840e5d..cb627a4222 100644
--- a/engines/ultima/ultima8/gumps/bark_gump.h
+++ b/engines/ultima/ultima8/gumps/bark_gump.h
@@ -65,7 +65,9 @@ protected:
 	//! returns false if no more text available
 	bool NextText();
 
-	int _textDelay;
+	bool _subtitles;
+	bool _speechMute;
+	int _talkSpeed;
 
 public:
 	bool loadData(Common::ReadStream *rs, uint32 version);




More information about the Scummvm-git-logs mailing list