[Scummvm-git-logs] scummvm master -> 2a1072c2f835acad40d64cada8a659a8ed117478

sev- noreply at scummvm.org
Sat Oct 4 22:59:49 UTC 2025


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

Summary:
a688f44180 WAGE: Added sound-related debug output
93861044cc WAGE: Make sure we do not play sounds simultaneously
2a1072c2f8 WAGE: Implement another comparison condition


Commit: a688f44180da54ded192119a7d75d19e7cc8a09a
    https://github.com/scummvm/scummvm/commit/a688f44180da54ded192119a7d75d19e7cc8a09a
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2025-10-05T00:30:37+02:00

Commit Message:
WAGE: Added sound-related debug output

Changed paths:
    engines/wage/combat.cpp
    engines/wage/detection.cpp
    engines/wage/script.cpp
    engines/wage/sound.cpp
    engines/wage/wage.cpp
    engines/wage/wage.h


diff --git a/engines/wage/combat.cpp b/engines/wage/combat.cpp
index bc548464115..73aa96dc13d 100644
--- a/engines/wage/combat.cpp
+++ b/engines/wage/combat.cpp
@@ -214,6 +214,8 @@ void WageEngine::performAttack(Chr *attacker, Chr *victim, Obj *weapon) {
 		appendText(buf);
 	}
 
+	debugC(1, kDebugSound, "** Weapon sound: %s", weapon->_sound.c_str());
+
 	playSound(weapon->_sound);
 
 	bool usesDecremented = false;
@@ -271,8 +273,10 @@ bool WageEngine::attackHit(Chr *attacker, Chr *victim, Obj *weapon, int targetIn
 			snprintf(buf, 512, "A hit to the %s!", targets[targetIndex]);
 			appendText(buf);
 		}
+		debugC(1, kDebugSound, "** Attacker hit sound: %s", attacker->_scoresHitSound.c_str());
 		playSound(attacker->_scoresHitSound);
 		appendText(attacker->_scoresHitComment.c_str());
+		debugC(1, kDebugSound, "** Victim receives sound: %s", victim->_receivesHitSound.c_str());
 		playSound(victim->_receivesHitSound);
 		appendText(victim->_receivesHitComment.c_str());
 		receivedHitTextPrinted = true;
@@ -303,6 +307,7 @@ bool WageEngine::attackHit(Chr *attacker, Chr *victim, Obj *weapon, int targetIn
 		usesDecremented = true;
 
 		if (victim->_context._statVariables[PHYS_HIT_CUR] < 0) {
+			debugC(1, kDebugSound, "** Victim dying sound: %s", victim->_dyingSound.c_str());
 			playSound(victim->_dyingSound);
 			appendText(victim->_dyingWords.c_str());
 			snprintf(buf, 512, "%s%s is dead!", victim->getDefiniteArticle(true), victim->_name.c_str());
@@ -379,6 +384,7 @@ void WageEngine::performHealingMagic(Chr *chr, Obj *magicalObject) {
 		if (type == Obj::HEALS_SPIRITUAL_DAMAGE || type == Obj::HEALS_PHYSICAL_AND_SPIRITUAL_DAMAGE)
 			chr->_context._statVariables[SPIR_HIT_CUR] += magicalObject->_damage;
 
+		debugC(1, kDebugSound, "** Magical object sound: %s", magicalObject->_sound.c_str());
 		playSound(magicalObject->_sound);
 		appendText(magicalObject->_useMessage.c_str());
 
diff --git a/engines/wage/detection.cpp b/engines/wage/detection.cpp
index 7d597ca4c4f..05e6712cc66 100644
--- a/engines/wage/detection.cpp
+++ b/engines/wage/detection.cpp
@@ -46,6 +46,7 @@ static const PlainGameDescriptor wageGames[] = {
 
 static const DebugChannelDef debugFlagList[] = {
 	{Wage::kDebugImGui, "imgui", "Show ImGui debug window (if available)"},
+	{Wage::kDebugSound, "sound", "Show sound debug information	"},
 	DEBUG_CHANNEL_END
 };
 
diff --git a/engines/wage/script.cpp b/engines/wage/script.cpp
index 548000d97bb..ad429d901c5 100644
--- a/engines/wage/script.cpp
+++ b/engines/wage/script.cpp
@@ -243,6 +243,7 @@ bool Script::execute(World *world, int loopCount, Common::String *inputText, Des
 				Operand *op = readOperand();
 				// TODO check op type is string.
 				_handled = true;
+				debugC(2, kDebugSound, "** Script sound '%s'", op->toString().c_str());
 				_engine->playSound(op->toString());
 				delete op;
 				byte d = _data->readByte();
diff --git a/engines/wage/sound.cpp b/engines/wage/sound.cpp
index 7eb3631aa39..5cf3257cd74 100644
--- a/engines/wage/sound.cpp
+++ b/engines/wage/sound.cpp
@@ -65,6 +65,8 @@ Sound::Sound(Common::String name, Common::SeekableReadStream *data) : _name(name
 	_size = data->size() - 20;
 	_data = (byte *)calloc(2 * _size, 1);
 
+	debugC(1, kDebugSound, "Sound::Sound: loading sound '%s', size %d", name.c_str(), _size);
+
 	data->skip(20); // Skip header
 
 	byte value = 0x80;
@@ -89,6 +91,8 @@ void WageEngine::playSound(Common::String soundName, bool blocking) {
 		return;
 	}
 
+	debugC(1, kDebugSound, "WageEngine::playSound: playing sound '%s'%s", soundName.c_str(), blocking ? " blocking" : "");
+
 	Sound *s = _world->_sounds[soundName];
 
 	Audio::AudioStream *stream = Audio::makeRawStream(s->_data, 2 * s->_size, 11000, Audio::FLAG_UNSIGNED);
@@ -142,9 +146,15 @@ static void soundTimer(void *refCon) {
 
 			uint32 nextRun = 60000 / scene->_soundFrequency;
 			g_system->getTimerManager()->installTimerProc(&soundTimer, nextRun * 1000, scene, "WageEngine::soundTimer");
+
+			debugC(1, kDebugSound, "soundTimer: enqueuing next periodic sound in %d ms (%s)", nextRun, scene->_soundName.c_str());
 		} else if (scene->_soundType == Scene::RANDOM) {
-			for (int i = 0; i < scene->_soundFrequency * 5; i++)
-				engine->_soundQueue.push_back(g_system->getMillis() + engine->_rnd->getRandomNumber(60000));
+			for (int i = 0; i < scene->_soundFrequency * 5; i++) {
+				uint32 nextRun = g_system->getMillis() + engine->_rnd->getRandomNumber(60000);
+				engine->_soundQueue.push_back(nextRun);
+
+				debugC(1, kDebugSound, "soundTimer: enqueuing next random sound in %d ms (%s)", nextRun, scene->_soundName.c_str());
+			}
 
 			Common::sort(engine->_soundQueue.begin(), engine->_soundQueue.end());
 
@@ -162,6 +172,8 @@ static void soundTimer(void *refCon) {
 		g_system->getTimerManager()->installTimerProc(&soundTimer, (nextRun - g_system->getMillis()) * 1000, scene, "WageEngine::soundTimer");
 
 		engine->_soundToPlay = scene->_soundName; // We cannot play sound here because that goes recursively
+
+		debugC(1, kDebugSound, "soundTimer: preparing next sound in %d ms (%s)", nextRun - g_system->getMillis(), scene->_soundName.c_str());
 	}
 }
 
diff --git a/engines/wage/wage.cpp b/engines/wage/wage.cpp
index fc9e9667971..5b871005c22 100644
--- a/engines/wage/wage.cpp
+++ b/engines/wage/wage.cpp
@@ -194,6 +194,7 @@ Common::Error WageEngine::run() {
 		g_system->delayMillis(50);
 
 		if (!_soundToPlay.empty()) {
+			debugC(1, kDebugSound, "** Sound from queue: %s", _soundToPlay.c_str());
 			playSound(_soundToPlay, false); // Do not block input
 			_soundToPlay.clear();
 		}
diff --git a/engines/wage/wage.h b/engines/wage/wage.h
index 58297160f70..20364f3988e 100644
--- a/engines/wage/wage.h
+++ b/engines/wage/wage.h
@@ -93,6 +93,7 @@ typedef Common::List<Chr *> ChrList;
 
 enum {
 	kDebugImGui = 1,
+	kDebugSound,
 };
 
 enum OperandType {
@@ -113,14 +114,6 @@ enum Directions {
 	WEST = 3
 };
 
-// our engine debug levels
-enum {
-	kWageDebugExample = 1 << 0,
-	kWageDebugExample2 = 1 << 1
-	// next new level must be 1 << 2 (4)
-	// the current limitation is 32 debug levels (1 << 31 is the last one)
-};
-
 enum Resolution {
 	GF_RES800  =	1 << 0,
 	GF_RES1024 =	1 << 1


Commit: 93861044cc644f728bb0e87ba8b7ff963a8ee2f7
    https://github.com/scummvm/scummvm/commit/93861044cc644f728bb0e87ba8b7ff963a8ee2f7
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2025-10-05T00:50:39+02:00

Commit Message:
WAGE: Make sure we do not play sounds simultaneously

Changed paths:
    engines/wage/sound.cpp
    engines/wage/wage.cpp


diff --git a/engines/wage/sound.cpp b/engines/wage/sound.cpp
index 5cf3257cd74..6f5064e3e1d 100644
--- a/engines/wage/sound.cpp
+++ b/engines/wage/sound.cpp
@@ -140,7 +140,7 @@ static void soundTimer(void *refCon) {
 	if (engine->_world->_player->_currentScene != scene)
 		return;
 
-	if (engine->_soundQueue.empty()) {
+	if (engine->_soundQueue.empty() && engine->_soundToPlay.empty()) {
 		if (scene->_soundType == Scene::PERIODIC) {
 			engine->_soundToPlay = scene->_soundName; // We cannot play sound here because that goes recursively
 
@@ -149,7 +149,7 @@ static void soundTimer(void *refCon) {
 
 			debugC(1, kDebugSound, "soundTimer: enqueuing next periodic sound in %d ms (%s)", nextRun, scene->_soundName.c_str());
 		} else if (scene->_soundType == Scene::RANDOM) {
-			for (int i = 0; i < scene->_soundFrequency * 5; i++) {
+			for (int i = 0; i < scene->_soundFrequency; i++) {
 				uint32 nextRun = g_system->getMillis() + engine->_rnd->getRandomNumber(60000);
 				engine->_soundQueue.push_back(nextRun);
 
@@ -166,6 +166,12 @@ static void soundTimer(void *refCon) {
 			warning("updateSoundTimerForScene: Unknown sound type %d", scene->_soundType);
 		}
 	} else {
+		// Do not play sound if another is still playing
+		if (!engine->_soundToPlay.empty()) {
+			g_system->getTimerManager()->installTimerProc(&soundTimer, g_system->getMillis() + 100, scene, "WageEngine::soundTimer");
+			return;
+		}
+
 		int nextRun = engine->_soundQueue.front();
 		engine->_soundQueue.pop_front();
 
diff --git a/engines/wage/wage.cpp b/engines/wage/wage.cpp
index 5b871005c22..ccd08ed3955 100644
--- a/engines/wage/wage.cpp
+++ b/engines/wage/wage.cpp
@@ -193,7 +193,7 @@ Common::Error WageEngine::run() {
 		g_system->updateScreen();
 		g_system->delayMillis(50);
 
-		if (!_soundToPlay.empty()) {
+		if (!_soundToPlay.empty() && !_mixer->isSoundHandleActive(_soundHandle)) {
 			debugC(1, kDebugSound, "** Sound from queue: %s", _soundToPlay.c_str());
 			playSound(_soundToPlay, false); // Do not block input
 			_soundToPlay.clear();


Commit: 2a1072c2f835acad40d64cada8a659a8ed117478
    https://github.com/scummvm/scummvm/commit/2a1072c2f835acad40d64cada8a659a8ed117478
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2025-10-05T00:59:05+02:00

Commit Message:
WAGE: Implement another comparison condition

Changed paths:
    engines/wage/script.cpp


diff --git a/engines/wage/script.cpp b/engines/wage/script.cpp
index ad429d901c5..99647d7a26c 100644
--- a/engines/wage/script.cpp
+++ b/engines/wage/script.cpp
@@ -644,6 +644,7 @@ enum {
 	kCompEqTextInputString,
 	kCompEqNumberTextInput,
 	kCompEqTextInputNumber,
+	kCompEqStringChr,
 	kCompLtNumNum,
 	kCompLtStringTextInput,
 	kCompLtTextInputString,
@@ -692,6 +693,7 @@ struct Comparator {
 	{ '=', STRING, STRING, kCompEqStringString },
 	{ '=', NUMBER, TEXT_INPUT, kCompEqNumberTextInput },
 	{ '=', TEXT_INPUT, NUMBER, kCompEqTextInputNumber },
+	{ '=', STRING, CHR, kCompEqStringChr },
 
 	{ '<', NUMBER, NUMBER, kCompLtNumNum },
 	{ '<', STRING, TEXT_INPUT, kCompLtStringTextInput },
@@ -759,6 +761,15 @@ bool Script::compare(Operand *o1, Operand *o2, int comparator) {
 					return true;
 		}
 		return false;
+	case kCompEqStringChr:
+		if (o2->_value.chr == NULL) {
+			debug(1, "%s() o2->_value.chr is null", __func__);
+		} else {
+			for (const auto &obj : o2->_value.chr->_inventory)
+				if (obj->_name.equalsIgnoreCase(*o1->_value.string))
+					return true;
+		}
+		return false;
 	case kCompEqChrChr:
 		return o1->_value.chr == o2->_value.chr;
 	case kCompEqSceneScene:




More information about the Scummvm-git-logs mailing list