[Scummvm-git-logs] scummvm master -> fa0dc616eac0debb00ab77a9a0f94fa29770baa3

scemino noreply at scummvm.org
Sun Apr 21 07:57:20 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:
7a9946c6db TWP: Fix dialog shutup in dialog (bug #15070)
fa0dc616ea TWP: Fix incorrect text color during dialog


Commit: 7a9946c6db67bb9df74ac2b2d122a1ec13ab72b8
    https://github.com/scummvm/scummvm/commit/7a9946c6db67bb9df74ac2b2d122a1ec13ab72b8
Author: scemino (scemino74 at gmail.com)
Date: 2024-04-21T08:14:44+02:00

Commit Message:
TWP: Fix dialog shutup in dialog (bug #15070)

Changed paths:
    engines/twp/dialog.cpp
    engines/twp/dialog.h
    engines/twp/syslib.cpp
    engines/twp/twp.cpp
    engines/twp/twp.h


diff --git a/engines/twp/dialog.cpp b/engines/twp/dialog.cpp
index 44d616fd83e..f4de2989aa1 100644
--- a/engines/twp/dialog.cpp
+++ b/engines/twp/dialog.cpp
@@ -206,9 +206,7 @@ void Dialog::choose(DialogSlot *slot) {
 		YChoice *choice = getChoice(slot);
 		if (slot->_dlg->_context.parrot) {
 			slot->_dlg->_state = DialogState::Active;
-			slot->_dlg->_action = Common::SharedPtr<SerialMotors>(new SerialMotors(
-				{slot->_dlg->_tgt->say(slot->_dlg->_context.actor, choice->_text),
-				 Common::SharedPtr<SelectLabelMotor>(new SelectLabelMotor(slot->_dlg, choice->_goto->_line, choice->_goto->_name))}));
+			slot->_dlg->_action = Common::SharedPtr<SelectLabelMotor>(new SelectLabelMotor(slot->_dlg, choice->_goto->_line, choice->_goto->_name));
 			slot->_dlg->clearSlots();
 		} else {
 			slot->_dlg->selectLabel(choice->_goto->_line, choice->_goto->_name);
@@ -415,6 +413,11 @@ void Dialog::running(float dt) {
 				_action->update(dt);
 				return;
 			} else {
+				IsShutup isShutup;
+				statmt->_exp->accept(isShutup);
+				if (g_twp->isSomeoneTalking() && !isShutup._isShutup) {
+					break;
+				}
 				run(statmt);
 				if (_lbl && (_currentStatement == _lbl->_stmts.size()))
 					gotoNextLabel();
diff --git a/engines/twp/dialog.h b/engines/twp/dialog.h
index 64f5e8c2e0b..4f56efce516 100644
--- a/engines/twp/dialog.h
+++ b/engines/twp/dialog.h
@@ -131,6 +131,15 @@ public:
 	bool _isChoice = false;
 };
 
+class IsShutup : public YackVisitor {
+public:
+	virtual ~IsShutup() override {}
+	void visit(const YShutup &node) override { _isShutup = true; }
+
+public:
+	bool _isShutup = false;
+};
+
 class ExpVisitor : public YackVisitor {
 public:
 	explicit ExpVisitor(Dialog *dialog);
diff --git a/engines/twp/syslib.cpp b/engines/twp/syslib.cpp
index 2e320645d9f..0a7ccad26ca 100644
--- a/engines/twp/syslib.cpp
+++ b/engines/twp/syslib.cpp
@@ -348,31 +348,9 @@ static SQInteger breakwhilerunning(HSQUIRRELVM v) {
 		v, [id] { return sqthread(id) != nullptr; }, "breakwhilerunning(%d)", id);
 }
 
-// Returns true if at least 1 actor is talking.
-static bool isSomeoneTalking() {
-	for (auto it = g_twp->_actors.begin(); it != g_twp->_actors.end(); it++) {
-		Common::SharedPtr<Object> obj = *it;
-		if (obj->_room != g_twp->_room)
-			continue;
-		if (obj->getTalking() && obj->getTalking()->isEnabled())
-			return true;
-	}
-	for (auto it = g_twp->_room->_layers.begin(); it != g_twp->_room->_layers.end(); it++) {
-		Common::SharedPtr<Layer> layer = *it;
-		for (auto it2 = layer->_objects.begin(); it2 != layer->_objects.end(); it2++) {
-			Common::SharedPtr<Object> obj = *it2;
-			if (obj->_room != g_twp->_room)
-				continue;
-			if (obj->getTalking() && obj->getTalking()->isEnabled())
-				return true;
-		}
-	}
-	return false;
-}
-
 struct SomeoneTalking {
 	bool operator()() {
-		return isSomeoneTalking();
+		return g_twp->isSomeoneTalking();
 	}
 };
 
diff --git a/engines/twp/twp.cpp b/engines/twp/twp.cpp
index 552bdaaf59d..fc9e3f809b1 100644
--- a/engines/twp/twp.cpp
+++ b/engines/twp/twp.cpp
@@ -1769,6 +1769,29 @@ void TwpEngine::stopTalking() {
 	}
 }
 
+bool TwpEngine::isSomeoneTalking() const {
+	if (!_room)
+		return false;
+	for (auto it = _actors.begin(); it != _actors.end(); it++) {
+		Common::SharedPtr<Object> obj = *it;
+		if (obj->_room != _room)
+			continue;
+		if (obj->getTalking() && obj->getTalking()->isEnabled())
+			return true;
+	}
+	for (auto it = _room->_layers.begin(); it != _room->_layers.end(); it++) {
+		Common::SharedPtr<Layer> layer = *it;
+		for (auto it2 = layer->_objects.begin(); it2 != layer->_objects.end(); it2++) {
+			Common::SharedPtr<Object> obj = *it2;
+			if (obj->_room != _room)
+				continue;
+			if (obj->getTalking() && obj->getTalking()->isEnabled())
+				return true;
+		}
+	}
+	return false;
+}
+
 float TwpEngine::getRandom() const {
 	return g_twp->getRandomSource().getRandomNumber(RAND_MAX) / (float)RAND_MAX;
 }
diff --git a/engines/twp/twp.h b/engines/twp/twp.h
index 68d4c0fd3a5..35635813e7f 100644
--- a/engines/twp/twp.h
+++ b/engines/twp/twp.h
@@ -139,6 +139,7 @@ public:
 	Common::SharedPtr<Object> objAt(const Math::Vector2d &pos);
 	void flashSelectableActor(int flash);
 	void stopTalking();
+	bool isSomeoneTalking() const;
 	void walkFast(bool state = true);
 
 	void actorEnter(Common::SharedPtr<Object> actor);


Commit: fa0dc616eac0debb00ab77a9a0f94fa29770baa3
    https://github.com/scummvm/scummvm/commit/fa0dc616eac0debb00ab77a9a0f94fa29770baa3
Author: scemino (scemino74 at gmail.com)
Date: 2024-04-21T08:47:48+02:00

Commit Message:
TWP: Fix incorrect text color during dialog

Changed paths:
    engines/twp/motor.cpp
    engines/twp/motor.h
    engines/twp/object.cpp


diff --git a/engines/twp/motor.cpp b/engines/twp/motor.cpp
index 6b257a07895..86e323f8579 100644
--- a/engines/twp/motor.cpp
+++ b/engines/twp/motor.cpp
@@ -314,7 +314,8 @@ Talking::Talking(Common::SharedPtr<Object> obj, const Common::StringArray &texts
 	say(texts[0]);
 }
 
-void Talking::append(const Common::StringArray &texts) {
+void Talking::append(const Common::StringArray &texts, const Color &color) {
+	_color = color;
 	_texts.push_back(texts);
 	_enabled = !_texts.empty();
 }
diff --git a/engines/twp/motor.h b/engines/twp/motor.h
index 60e1c4de899..86594b9d2a1 100644
--- a/engines/twp/motor.h
+++ b/engines/twp/motor.h
@@ -251,7 +251,7 @@ public:
 	Talking(Common::SharedPtr<Object> obj, const Common::StringArray &texts, const Color &color);
 	virtual ~Talking() {}
 
-	void append(const Common::StringArray &texts);
+	void append(const Common::StringArray &texts, const Color &color);
 
 	virtual void onUpdate(float elapsed) override;
 	virtual void disable() override;
diff --git a/engines/twp/object.cpp b/engines/twp/object.cpp
index 5e8ae103324..3ea740f8f14 100644
--- a/engines/twp/object.cpp
+++ b/engines/twp/object.cpp
@@ -908,7 +908,7 @@ void TalkingState::say(const Common::StringArray &texts, Common::SharedPtr<Objec
 	if (!talking) {
 		obj->setTalking(Common::SharedPtr<Talking>(new Talking(obj, texts, _color)));
 	} else {
-		talking->append(texts);
+		talking->append(texts, _color);
 	}
 }
 




More information about the Scummvm-git-logs mailing list