[Scummvm-git-logs] scummvm master -> 41319331251d39156521300f24a03a3c5d37a603

sev- noreply at scummvm.org
Sun Nov 24 18:26:55 UTC 2024


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:
0623b6a6cf QDENGINE: Get rid of g_runtime in TextManager in adv minigames
4131933125 LURE: Fix talking to strangers in Russian fan-translation


Commit: 0623b6a6cf7a0b4130a265bd3696a1021a8cacc6
    https://github.com/scummvm/scummvm/commit/0623b6a6cf7a0b4130a265bd3696a1021a8cacc6
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2024-11-24T19:26:47+01:00

Commit Message:
QDENGINE: Get rid of g_runtime in TextManager in adv minigames

Changed paths:
    engines/qdengine/minigames/adv/RunTime.cpp
    engines/qdengine/minigames/adv/TextManager.cpp
    engines/qdengine/minigames/adv/TextManager.h


diff --git a/engines/qdengine/minigames/adv/RunTime.cpp b/engines/qdengine/minigames/adv/RunTime.cpp
index eada4c937f1..22d0a8c0347 100644
--- a/engines/qdengine/minigames/adv/RunTime.cpp
+++ b/engines/qdengine/minigames/adv/RunTime.cpp
@@ -177,7 +177,7 @@ bool MinigameManager::createGame() {
 	HoldData<TimeManagerData> timeData(_currentGameInfo ? &_currentGameInfo->_timeManagerData : 0, !_currentGameInfo || _currentGameInfo->_empty);
 	_timeManager = new TimeManager(timeData, this);
 
-	_textManager = new TextManager();
+	_textManager = new TextManager(this);
 
 	_eventManager = new EventManager(this);
 
diff --git a/engines/qdengine/minigames/adv/TextManager.cpp b/engines/qdengine/minigames/adv/TextManager.cpp
index 509b5e527ad..b3458b9ba1b 100644
--- a/engines/qdengine/minigames/adv/TextManager.cpp
+++ b/engines/qdengine/minigames/adv/TextManager.cpp
@@ -29,12 +29,14 @@
 
 namespace QDEngine {
 
-TextManager::TextManager() {
+TextManager::TextManager(MinigameManager *runtime) {
 	char str_cache[256];
 
+	_runtime = runtime;
+
 	for (int idx = 0;; ++idx) {
 		snprintf(str_cache, 127, "register_font_%d", idx);
-		if (const char *descr = g_runtime->parameter(str_cache, false)) {
+		if (const char *descr = _runtime->parameter(str_cache, false)) {
 			sscanf(descr, "%255s", str_cache);
 			Font digit;
 			if (!digit.pool.load(str_cache))
@@ -43,14 +45,14 @@ TextManager::TextManager() {
 			debugCN(2, kDebugMinigames, "TextManager(): %d character set \"%s\" loaded, ", idx, str_cache);
 
 			snprintf(str_cache, 127, "font_size_%d", idx);
-			if ((descr = g_runtime->parameter(str_cache, false))) {
+			if ((descr = _runtime->parameter(str_cache, false))) {
 				int read = sscanf(descr, "%f %f", &digit.size.x, &digit.size.y);
 				if (read != 2)
 					warning("TextManager(): incorrect font size definition in [%s]", str_cache);
 			} else {
 				QDObject obj = digit.pool.getObject();
 				obj.setState("0");
-				digit.size = g_runtime->getSize(obj);
+				digit.size = _runtime->getSize(obj);
 				digit.pool.releaseObject(obj);
 			}
 			debugC(2, kDebugMinigames, "set size to (%5.1f, %5.1f)\n", digit.size.x, digit.size.y);
@@ -61,7 +63,7 @@ TextManager::TextManager() {
 
 	for (int idx = 0;; ++idx) {
 		snprintf(str_cache, 127, "register_particle_escape_%d", idx);
-		if (const char *descr = g_runtime->parameter(str_cache, false)) {
+		if (const char *descr = _runtime->parameter(str_cache, false)) {
 			Escape escape;
 			int read = sscanf(descr, "%d (%f><%f, %f><%f) (%f><%f, %f><%f) %f '%15s",
 			                  &escape.depth,
@@ -97,7 +99,7 @@ TextManager::TextManager() {
 }
 
 bool TextManager::getStaticPreset(StaticTextPreset& preset, const char *name) const {
-	if (const char *descr = g_runtime->parameter(name, false)) {
+	if (const char *descr = _runtime->parameter(name, false)) {
 		int align = 0;
 		char str[64];
 		str[63] = 0;
@@ -132,9 +134,9 @@ bool TextManager::getStaticPreset(StaticTextPreset& preset, const char *name) co
 			break;
 		}
 
-		if (QDObject obj = g_runtime->getObject(pos_obj)) {
-			preset.pos = g_runtime->world2game(obj);
-			g_runtime->release(obj);
+		if (QDObject obj = _runtime->getObject(pos_obj)) {
+			preset.pos = _runtime->world2game(obj);
+			_runtime->release(obj);
 		} else
 			return false;
 	} else
@@ -157,7 +159,7 @@ TextManager::~TextManager() {
 int TextManager::createStaticText(const mgVect3f& pos, int fontID, TextAlign align) {
 	assert(fontID >= 0 && fontID < (int)_fonts.size());
 
-	StaticMessage msg(&_fonts[fontID]);
+	StaticMessage msg(_runtime, &_fonts[fontID]);
 
 	msg._align = align;
 	msg._depth = pos.z;
@@ -179,7 +181,7 @@ void TextManager::showText(const char *txt, const mgVect2f& pos, int fontID, int
 
 	Escape& es = _escapes[escapeID];
 
-	Message msg(&_fonts[fontID]);
+	Message msg(_runtime, &_fonts[fontID]);
 
 	msg.setText(txt);
 	if (msg.empty())
@@ -190,10 +192,10 @@ void TextManager::showText(const char *txt, const mgVect2f& pos, int fontID, int
 	msg._depth = es.depth;
 	msg._pos = pos;
 
-	msg._vel.x = g_runtime->rnd(es.vel_min.x, es.vel_max.x);
-	msg._vel.y = g_runtime->rnd(es.vel_min.y, es.vel_max.y);
-	msg._accel.x = g_runtime->rnd(es.accel_min.x, es.accel_max.x);
-	msg._accel.y = g_runtime->rnd(es.accel_min.y, es.accel_max.y);
+	msg._vel.x = _runtime->rnd(es.vel_min.x, es.vel_max.x);
+	msg._vel.y = _runtime->rnd(es.vel_min.y, es.vel_max.y);
+	msg._accel.x = _runtime->rnd(es.accel_min.x, es.accel_max.x);
+	msg._accel.y = _runtime->rnd(es.accel_min.y, es.accel_max.y);
 
 	_flowMsgs.push_back(msg);
 }
@@ -222,10 +224,11 @@ TextManager::StaticTextPreset::StaticTextPreset() {
 	textID = 0;
 }
 
-TextManager::StaticMessage::StaticMessage(Font *font, TextAlign align) {
+TextManager::StaticMessage::StaticMessage(MinigameManager *runtime, Font *font, TextAlign align) {
 	_font = font;
 	_align = align;
 	_depth = 0.f;
+	_runtime = runtime;
 }
 
 void TextManager::StaticMessage::release() {
@@ -291,21 +294,21 @@ void TextManager::StaticMessage::update() {
 	default:
 		break;
 	}
-	if (y < -_font->size.y || y > g_runtime->screenSize().y + _font->size.y
-	        || x < -2 * width || x > g_runtime->screenSize().x + 2 * width) {
+	if (y < -_font->size.y || y > _runtime->screenSize().y + _font->size.y
+	        || x < -2 * width || x > _runtime->screenSize().x + 2 * width) {
 		release();
 		return;
 	}
 
 	for (auto &it : _objects) {
 		if (it)
-			it->set_R(g_runtime->game2world(mgVect2f(x, y), _depth));
+			it->set_R(_runtime->game2world(mgVect2f(x, y), _depth));
 		x += _font->size.x;
 	}
 }
 
-TextManager::Message::Message(Font *font)
-	: StaticMessage(font) {
+TextManager::Message::Message(MinigameManager *runtime, Font *font)
+	: StaticMessage(runtime, font) {
 	_time = 0.f;
 }
 
@@ -341,7 +344,7 @@ void TextManager::quant(float dt) {
 	}
 
 	if (_show_scores.textID >= 0) {
-		if (_scoreUpdateTimer >= 0.f && _scoreUpdateTimer <= g_runtime->getTime()) {
+		if (_scoreUpdateTimer >= 0.f && _scoreUpdateTimer <= _runtime->getTime()) {
 			int sgn = _targetScore - _currentScore < 0 ? -1 : 1;
 			int mod = abs(_currentScore - _targetScore);
 			_currentScore += sgn * (mod / 10 + 1);
@@ -351,7 +354,7 @@ void TextManager::quant(float dt) {
 			snprintf(buf, 15, _show_scores.format, _currentScore);
 			updateStaticText(_show_scores.textID, buf);
 
-			_scoreUpdateTimer = _currentScore != _targetScore ? g_runtime->getTime() + _scoreUpdateTime : -1.f;
+			_scoreUpdateTimer = _currentScore != _targetScore ? _runtime->getTime() + _scoreUpdateTime : -1.f;
 		}
 	}
 }
@@ -359,7 +362,7 @@ void TextManager::quant(float dt) {
 void TextManager::updateScore(int score) {
 	_targetScore = score;
 	if (_scoreUpdateTimer < 0.f)
-		_scoreUpdateTimer = g_runtime->getTime();
+		_scoreUpdateTimer = _runtime->getTime();
 }
 
 void TextManager::updateTime(int seconds) {
diff --git a/engines/qdengine/minigames/adv/TextManager.h b/engines/qdengine/minigames/adv/TextManager.h
index 7527b2c5e4d..6843d24e711 100644
--- a/engines/qdengine/minigames/adv/TextManager.h
+++ b/engines/qdengine/minigames/adv/TextManager.h
@@ -34,7 +34,7 @@ enum TextAlign {
 
 class TextManager {
 public:
-	TextManager();
+	TextManager(MinigameManager *runtime);
 	~TextManager();
 
 	int createStaticText(const mgVect3f& screen_pos, int fontID, TextAlign align);
@@ -77,7 +77,7 @@ private:
 	bool getStaticPreset(StaticTextPreset& preset, const char *name) const;
 
 	struct StaticMessage {
-		StaticMessage(Font *font = 0, TextAlign _align = ALIGN_CENTER);
+		StaticMessage(MinigameManager *runtime, Font *font = 0, TextAlign _align = ALIGN_CENTER);
 		void release();
 
 		bool empty() const {
@@ -100,11 +100,13 @@ private:
 		Font *_font;
 
 		QDObjects _objects;
+
+		MinigameManager *_runtime;
 	};
 	typedef Std::vector<StaticMessage> StaticMessages;
 
 	struct Message : public StaticMessage {
-		Message(Font *font = 0);
+		Message(MinigameManager *runtime, Font *font = 0);
 		void release();
 
 		void quant(float dt);
@@ -112,7 +114,6 @@ private:
 		float _time;
 		mgVect2f _vel;
 		mgVect2f _accel;
-
 	};
 	typedef Std::vector<Message> Messages;
 
@@ -127,6 +128,8 @@ private:
 	int _currentScore;
 	float _scoreUpdateTime;
 	float _scoreUpdateTimer;
+
+	MinigameManager *_runtime;
 };
 
 } // namespace QDEngine


Commit: 41319331251d39156521300f24a03a3c5d37a603
    https://github.com/scummvm/scummvm/commit/41319331251d39156521300f24a03a3c5d37a603
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2024-11-24T19:26:47+01:00

Commit Message:
LURE: Fix talking to strangers in Russian fan-translation

Changed paths:
    engines/lure/hotspots.cpp


diff --git a/engines/lure/hotspots.cpp b/engines/lure/hotspots.cpp
index ab49eb3089c..e9db3f13f42 100644
--- a/engines/lure/hotspots.cpp
+++ b/engines/lure/hotspots.cpp
@@ -2269,7 +2269,8 @@ uint16 Hotspot::getTalkId(HotspotData *charHotspot) {
 	Resources &res = Resources::getReference();
 	uint16 talkIndex;
 	TalkHeaderData *headerEntry;
-	bool isEnglish = LureEngine::getReference().getLanguage() == Common::EN_ANY;
+	bool isEnglish = LureEngine::getReference().getLanguage() == Common::EN_ANY ||
+		LureEngine::getReference().getLanguage() == Common::RU_RUS; // Russian version is based on English one, same logic applies
 
 	// If the hotspot has a talk data override, return it
 	if (charHotspot->talkOverride != 0) {




More information about the Scummvm-git-logs mailing list