[Scummvm-git-logs] scummvm master -> 196df87402a088162badea52715161ddcf3d3fbc

OMGPizzaGuy 48367439+OMGPizzaGuy at users.noreply.github.com
Sun Feb 14 01:16:03 UTC 2021


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

Summary:
c0ec9d7514 ULTIMA8: Pass relevant values to TTFRenderedText in place of pointer to prevent possible error
072c1d9ee3 ULTIMA8: Move variable assignment from config to allow options to be dynamically set
62114ff9e8 ULTIMA8: Add GUI options to dynamic options menu
196df87402 ULTIMA8: Apply game settings after loading game files to fix font override initialization


Commit: c0ec9d75147137b0804010bd384c7e404daab40d
    https://github.com/scummvm/scummvm/commit/c0ec9d75147137b0804010bd384c7e404daab40d
Author: Matthew Jimenez (matthew.jimenez at outlook.com)
Date: 2021-02-13T19:10:02-06:00

Commit Message:
ULTIMA8: Pass relevant values to TTFRenderedText in place of pointer to prevent possible error

Changed paths:
    engines/ultima/ultima8/graphics/fonts/tt_font.cpp
    engines/ultima/ultima8/graphics/fonts/ttf_rendered_text.cpp
    engines/ultima/ultima8/graphics/fonts/ttf_rendered_text.h


diff --git a/engines/ultima/ultima8/graphics/fonts/tt_font.cpp b/engines/ultima/ultima8/graphics/fonts/tt_font.cpp
index c2a20dd248..4d58255e48 100644
--- a/engines/ultima/ultima8/graphics/fonts/tt_font.cpp
+++ b/engines/ultima/ultima8/graphics/fonts/tt_font.cpp
@@ -267,7 +267,7 @@ RenderedText *TTFont::renderText(const Std::string &text, unsigned int &remainin
 	}
 
 	return new TTFRenderedText(texture, resultWidth, resultHeight,
-		getBaselineSkip() - getHeight(), this);
+		getBaselineSkip() - getHeight(), getBaseline(), isAntialiased());
 }
 
 } // End of namespace Ultima8
diff --git a/engines/ultima/ultima8/graphics/fonts/ttf_rendered_text.cpp b/engines/ultima/ultima8/graphics/fonts/ttf_rendered_text.cpp
index 7ba39448c3..2ab2450c76 100644
--- a/engines/ultima/ultima8/graphics/fonts/ttf_rendered_text.cpp
+++ b/engines/ultima/ultima8/graphics/fonts/ttf_rendered_text.cpp
@@ -29,7 +29,7 @@ namespace Ultima {
 namespace Ultima8 {
 
 TTFRenderedText::TTFRenderedText(Graphics::ManagedSurface *texture, int width, int height,
-		int vLead, TTFont *font) : _texture(texture), _font(font) {
+		int vLead, int baseline, bool antiAliased) : _texture(texture), _baseline(baseline), _antiAliased(antiAliased) {
 	_width = width;
 	_height = height;
 	_vLead = vLead;
@@ -43,21 +43,21 @@ void TTFRenderedText::draw(RenderSurface *surface, int x, int y, bool destmasked
 	if (!_width)
 		return;
 	if (!destmasked)
-		surface->Blit(_texture, 0, 0, _width, _height, x, y - _font->getBaseline(),
-			_font->isAntialiased());
+		surface->Blit(_texture, 0, 0, _width, _height, x, y - _baseline,
+			_antiAliased);
 	else
 		surface->MaskedBlit(_texture, 0, 0, _width, _height,
-			x, y - _font->getBaseline(), 0, _font->isAntialiased());
+			x, y - _baseline, 0, _antiAliased);
 }
 
 void TTFRenderedText::drawBlended(RenderSurface *surface, int x, int y,
 		uint32 col, bool destmasked) {
 	if (!destmasked)
 		surface->FadedBlit(_texture, 0, 0, _width, _height,
-			x, y - _font->getBaseline(), col, _font->isAntialiased());
+			x, y - _baseline, col, _antiAliased);
 	else
 		surface->MaskedBlit(_texture, 0, 0, _width, _height,
-			x, y - _font->getBaseline(), col, _font->isAntialiased());
+			x, y - _baseline, col, _antiAliased);
 }
 
 } // End of namespace Ultima8
diff --git a/engines/ultima/ultima8/graphics/fonts/ttf_rendered_text.h b/engines/ultima/ultima8/graphics/fonts/ttf_rendered_text.h
index 521ada4dad..783ce72833 100644
--- a/engines/ultima/ultima8/graphics/fonts/ttf_rendered_text.h
+++ b/engines/ultima/ultima8/graphics/fonts/ttf_rendered_text.h
@@ -36,7 +36,7 @@ class Texture;
 class TTFRenderedText : public RenderedText {
 public:
 	TTFRenderedText(Graphics::ManagedSurface *texture, int width, int height, int vlead,
-	                TTFont *font);
+	                int baseline, bool antiAliased);
 	~TTFRenderedText() override;
 
 	void draw(RenderSurface *surface, int x, int y,
@@ -46,7 +46,8 @@ public:
 
 protected:
 	Graphics::ManagedSurface *_texture;
-	TTFont *_font;
+	int _baseline;
+	bool _antiAliased;
 };
 
 } // End of namespace Ultima8


Commit: 072c1d9ee384275ac3e0f076354324b2508c50de
    https://github.com/scummvm/scummvm/commit/072c1d9ee384275ac3e0f076354324b2508c50de
Author: Matthew Jimenez (matthew.jimenez at outlook.com)
Date: 2021-02-13T19:10:02-06:00

Commit Message:
ULTIMA8: Move variable assignment from config to allow options to be dynamically set

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


diff --git a/engines/ultima/ultima8/ultima8.cpp b/engines/ultima/ultima8/ultima8.cpp
index d0950b1e47..e98c4c40c2 100644
--- a/engines/ultima/ultima8/ultima8.cpp
+++ b/engines/ultima/ultima8/ultima8.cpp
@@ -116,16 +116,16 @@ Ultima8Engine *Ultima8Engine::_instance = nullptr;
 
 Ultima8Engine::Ultima8Engine(OSystem *syst, const Ultima::UltimaGameDescription *gameDesc) :
 		Shared::UltimaEngine(syst, gameDesc),
-	    _isRunning(false),  _gameInfo(nullptr), _fileSystem(nullptr),
-	    _configFileMan(nullptr), _saveCount(0), _game(nullptr),
+		_isRunning(false),  _gameInfo(nullptr), _fileSystem(nullptr),
+		_configFileMan(nullptr), _saveCount(0), _game(nullptr),
 		_kernel(nullptr), _objectManager(nullptr), _mouse(nullptr), _ucMachine(nullptr),
 		_screen(nullptr), _fontManager(nullptr), _paletteManager(nullptr), _gameData(nullptr),
 		_world(nullptr), _desktopGump(nullptr), _gameMapGump(nullptr), _avatarMoverProcess(nullptr),
 		_frameSkip(false), _frameLimit(true), _interpolate(true), _animationRate(100),
 		_avatarInStasis(false), _paintEditorItems(false), _inversion(0),
 		_showTouching(false), _timeOffset(0), _hasCheated(false), _cheatsEnabled(false),
-		_ttfOverrides(false), _audioMixer(0), _inverterGump(nullptr), _lerpFactor(256),
-		_inBetweenFrame(false), _unkCrusaderFlag(false), _moveKeyFrame(0) {
+		_fontOverride(false), _fontAntialiasing(false), _audioMixer(0), _inverterGump(nullptr),
+	    _lerpFactor(256), _inBetweenFrame(false), _unkCrusaderFlag(false), _moveKeyFrame(0) {
 	_instance = this;
 }
 
@@ -371,24 +371,17 @@ bool Ultima8Engine::startupGame() {
 	_game = Game::createGame(getGameInfo());
 
 	ConfMan.registerDefault("font_override", false);
-	_ttfOverrides = ConfMan.getBool("font_override");
-
+	ConfMan.registerDefault("font_antialiasing", true);
 	ConfMan.registerDefault("frameSkip", false);
-	_frameSkip = ConfMan.getBool("frameSkip");
-
 	ConfMan.registerDefault("frameLimit", true);
-	_frameLimit = ConfMan.getBool("frameLimit");
-
 	ConfMan.registerDefault("interpolate", true);
-	_interpolate = ConfMan.getBool("interpolate");
-
 	ConfMan.registerDefault("cheat", false);
-	_cheatsEnabled = ConfMan.getBool("cheat");
+
+	applyGameSettings();
 
 	bool loaded = _game->loadFiles();
 	if (!loaded)
 		return false;
-	_gameData->setupFontOverrides();
 
 	// Create Midi Driver for Ultima 8
 	if (getGameInfo()->_type == GameInfo::GAME_U8)
@@ -658,18 +651,8 @@ void Ultima8Engine::GraphicSysInit() {
 		showSplashScreen();
 	}
 
-	ConfMan.registerDefault("font_antialiasing", true);
-	bool font_antialiasing = ConfMan.getBool("font_antialiasing");
-
-	_fontManager = new FontManager(font_antialiasing);
 	_paletteManager = new PaletteManager(new_screen);
 
-	// TODO: assign names to these fontnumbers somehow
-	_fontManager->loadTTFont(0, "Vera.ttf", 18, 0xFFFFFF, 0);
-	_fontManager->loadTTFont(1, "VeraBd.ttf", 12, 0xFFFFFF, 0);
-	// GameWidget's version number information:
-	_fontManager->loadTTFont(2, "Vera.ttf", 8, 0xA0A0A0, 0);
-
 	ConfMan.registerDefault("fadedModal", true);
 	bool faded_modal = ConfMan.getBool("fadedModal");
 	DesktopGump::SetFadedModal(faded_modal);
@@ -1161,7 +1144,33 @@ void Ultima8Engine::syncSoundSettings() {
 void Ultima8Engine::applyGameSettings() {
 	UltimaEngine::applyGameSettings();
 
-	// TODO: handle dynamic option changes when implemented
+	bool fontOverride = ConfMan.getBool("font_override");
+	bool fontAntialiasing = ConfMan.getBool("font_antialiasing");
+
+	if (!_fontManager || _fontOverride != fontOverride || _fontAntialiasing != fontAntialiasing) {
+		_fontOverride = fontOverride;
+		_fontAntialiasing = fontAntialiasing;
+
+		// TODO - update font manager to just need reset here.
+		if (_fontManager) {
+			FORGET_OBJECT(_fontManager);
+		}
+
+		_fontManager = new FontManager(_fontAntialiasing);
+		// TODO: assign names to these fontnumbers somehow
+		_fontManager->loadTTFont(0, "Vera.ttf", 18, 0xFFFFFF, 0);
+		_fontManager->loadTTFont(1, "VeraBd.ttf", 12, 0xFFFFFF, 0);
+		// GameWidget's version number information:
+		_fontManager->loadTTFont(2, "Vera.ttf", 8, 0xA0A0A0, 0);
+
+		_gameData->setupFontOverrides();
+	}
+
+	_frameSkip = ConfMan.getBool("frameSkip");
+	_frameLimit = ConfMan.getBool("frameLimit");
+	_interpolate = ConfMan.getBool("interpolate");
+	_cheatsEnabled = ConfMan.getBool("cheat");
+
 }
 
 void Ultima8Engine::openConfigDialog() {
@@ -1340,7 +1349,7 @@ void Ultima8Engine::addGump(Gump *gump) {
 
 	if (dynamic_cast<ShapeViewerGump *>(gump) || dynamic_cast<MiniMapGump *>(gump) ||
 		dynamic_cast<MessageBoxGump *>(gump)// ||
-		//(_ttfOverrides && (dynamic_cast<BarkGump *>(gump) ||
+		//(_fontOverrides && (dynamic_cast<BarkGump *>(gump) ||
 		//                dynamic_cast<AskGump *>(gump)))
 		) {
 		_desktopGump->AddChild(gump);
diff --git a/engines/ultima/ultima8/ultima8.h b/engines/ultima/ultima8/ultima8.h
index b83b4cc9ed..7783b7df47 100644
--- a/engines/ultima/ultima8/ultima8.h
+++ b/engines/ultima/ultima8/ultima8.h
@@ -75,7 +75,8 @@ private:
 	static Ultima8Engine *_instance;
 
 	Std::list<ObjId> _textModes;      //!< Gumps that want text mode
-	bool _ttfOverrides;
+	bool _fontOverride;
+	bool _fontAntialiasing;
 	// Audio Mixer
 	AudioMixer *_audioMixer;
 	uint32 _saveCount;


Commit: 62114ff9e8e7758d473616e68f46e9091a650e4e
    https://github.com/scummvm/scummvm/commit/62114ff9e8e7758d473616e68f46e9091a650e4e
Author: Matthew Jimenez (matthew.jimenez at outlook.com)
Date: 2021-02-13T19:10:02-06:00

Commit Message:
ULTIMA8: Add GUI options to dynamic options menu

Changed paths:
    engines/ultima/ultima8/meta_engine.cpp


diff --git a/engines/ultima/ultima8/meta_engine.cpp b/engines/ultima/ultima8/meta_engine.cpp
index 208f154578..febbe39a13 100644
--- a/engines/ultima/ultima8/meta_engine.cpp
+++ b/engines/ultima/ultima8/meta_engine.cpp
@@ -123,10 +123,58 @@ static const KeybindingRecord DEBUG_KEYS[] = {
 #endif
 
 static const ExtraGuiOption COMMON_OPTIONS[] = {
+	{
+		_s("Enable frame skipping"),
+		_s("Allow the game to skip animation frames when running too slow."),
+		"frameSkip",
+		false
+	},
+	{
+		_s("Enable frame limiting"),
+		_s("Limits the speed of the game to prevent running too fast."),
+		"frameLimit",
+		true
+	},
 	{ nullptr, nullptr, nullptr, false }
 };
 
 static const ExtraGuiOption U8_OPTIONS[] = {
+	{
+		_s("Play foot step sounds"),
+		_s("Plays sound when the player moves."),
+		"footsteps",
+		true
+	},
+	{
+		_s("Enable jump to mouse position"),
+		_s("Jumping while not moving targets the mouse cursor rather than direction only."),
+		"targetedjump",
+		true
+	},
+	{
+		_s("Enable cheats"),
+		_s("Allow cheats by commands and a menu when player is clicked."),
+		"cheat",
+		false
+	},
+	{
+		_s("Use original save/load screens"),
+		_s("Use the original save/load screens instead of the ScummVM ones"),
+		"originalsaveload",
+		false
+	},
+	{
+		_s("Enable font replacement"),
+		_s("Replaces game fonts with rendered fonts"),
+		"font_override",
+		false
+	},
+	{
+		_s("Enable font anti-aliasing"),
+		_s("When font anti-aliasing is enabled, the text is smoother."),
+		"font_antialiasing",
+		false
+	},
 	{ nullptr, nullptr, nullptr, false }
 };
 
@@ -234,6 +282,11 @@ const ExtraGuiOptions MetaEngine::getExtraGuiOptions(const Common::String& targe
 		options.push_back(*o);
 	}
 
+	// TODO - Limited how many options are allowed, need fix
+	if (options.size() > 7) {
+		warning("More extra game options registered than currently allowed.");
+		options.resize(7);
+	}
 	return options;
 }
 


Commit: 196df87402a088162badea52715161ddcf3d3fbc
    https://github.com/scummvm/scummvm/commit/196df87402a088162badea52715161ddcf3d3fbc
Author: Matthew Jimenez (matthew.jimenez at outlook.com)
Date: 2021-02-13T19:10:02-06:00

Commit Message:
ULTIMA8: Apply game settings after loading game files to fix font override initialization

Changed paths:
    engines/ultima/ultima8/ultima8.cpp


diff --git a/engines/ultima/ultima8/ultima8.cpp b/engines/ultima/ultima8/ultima8.cpp
index e98c4c40c2..8c48cd9696 100644
--- a/engines/ultima/ultima8/ultima8.cpp
+++ b/engines/ultima/ultima8/ultima8.cpp
@@ -377,12 +377,12 @@ bool Ultima8Engine::startupGame() {
 	ConfMan.registerDefault("interpolate", true);
 	ConfMan.registerDefault("cheat", false);
 
-	applyGameSettings();
-
 	bool loaded = _game->loadFiles();
 	if (!loaded)
 		return false;
 
+	applyGameSettings();
+
 	// Create Midi Driver for Ultima 8
 	if (getGameInfo()->_type == GameInfo::GAME_U8)
 		_audioMixer->openMidiOutput();




More information about the Scummvm-git-logs mailing list