[Scummvm-git-logs] scummvm master -> 88d8577cb3a1634bd23ead85ccfec8375d293aed

moralrecordings code at moral.net.au
Sat Mar 28 08:23:57 UTC 2020


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

Summary:
ed1c750f50 DIRECTOR: Add generic Windows target
4a918a1fcd DIRECTOR: LINGO: Add more debug messages
88d8577cb3 DIRECTOR: Add flexible number of sound channels


Commit: ed1c750f503bd4076fa18fef1c3428080c1cd7c5
    https://github.com/scummvm/scummvm/commit/ed1c750f503bd4076fa18fef1c3428080c1cd7c5
Author: Scott Percival (code at moral.net.au)
Date: 2020-03-28T16:15:15+08:00

Commit Message:
DIRECTOR: Add generic Windows target

Changed paths:
    engines/director/detection_tables.h
    engines/director/resource.cpp


diff --git a/engines/director/detection_tables.h b/engines/director/detection_tables.h
index 8ca09a45f6..c397c63f69 100644
--- a/engines/director/detection_tables.h
+++ b/engines/director/detection_tables.h
@@ -67,6 +67,10 @@ static const DirectorGameDescription gameDescriptions[] = {
 	MACGAME("director", "", "D3-mac", 0, -1, 3),
 	// Generic D4 Mac entry
 	MACGAME("director", "", "D4-mac", 0, -1, 4),
+	// Generic D3 Win entry
+	WINGAME("director", "", "D3-win", 0, -1, 3),
+	// Generic D4 Win entry
+	WINGAME("director", "", "D4-win", 0, -1, 4),
 
 	MACGAME("theapartment", "D2", "Main Menu", "fc56c179cb8c6d4938e61ee61fd0032c", 48325, 2), // Original name is "•Main Menu"
 	MACGAME("theapartment", "D3", "Main Menu", "9e838fe1a6af7992d656ca325e38dee5", 47911, 3), // Original name is "•Main Menu"
diff --git a/engines/director/resource.cpp b/engines/director/resource.cpp
index c21c69ef6f..985419e03d 100644
--- a/engines/director/resource.cpp
+++ b/engines/director/resource.cpp
@@ -89,7 +89,7 @@ void DirectorEngine::loadEXE(const Common::String movie) {
 	_lingo->processEvent(kEventStart);
 
 	uint32 initialTag = exeStream->readUint32LE();
-	if (initialTag == MKTAG('R', 'I', 'F', 'X')) {
+	if (initialTag == MKTAG('R', 'I', 'F', 'X') || initialTag == MKTAG('X', 'F', 'I', 'R')) {
 		// we've encountered a movie saved from Director, not a projector.
 		loadEXERIFX(exeStream, 0);
 	} else if (initialTag == MKTAG('R', 'I', 'F', 'F') || initialTag == MKTAG('F', 'F', 'I', 'R')) { // This is just a normal movie


Commit: 4a918a1fcd18d4b1e3a83ff290a18176d9d5f175
    https://github.com/scummvm/scummvm/commit/4a918a1fcd18d4b1e3a83ff290a18176d9d5f175
Author: Scott Percival (code at moral.net.au)
Date: 2020-03-28T16:15:15+08:00

Commit Message:
DIRECTOR: LINGO: Add more debug messages

Changed paths:
    engines/director/lingo/lingo-bytecode.cpp
    engines/director/lingo/lingo-the.cpp


diff --git a/engines/director/lingo/lingo-bytecode.cpp b/engines/director/lingo/lingo-bytecode.cpp
index 190d1e1622..7eaf32920a 100644
--- a/engines/director/lingo/lingo-bytecode.cpp
+++ b/engines/director/lingo/lingo-bytecode.cpp
@@ -350,16 +350,17 @@ void LC::cb_globalpush() {
 
 	Symbol *s = g_lingo->lookupVar(name.c_str(), false);
 	if (!s) {
-		warning("Variable %s not found", name.c_str());
+		warning("cb_globalpush: variable %s not found", name.c_str());
 		g_lingo->push(result);
 		return;
 	} else if (s && !s->global) {
-		warning("Variable %s is local, not global", name.c_str());
+		warning("cb_globalpush: variable %s is local, not global", name.c_str());
 	}
 
 	Datum target;
 	target.type = VAR;
 	target.u.sym = s;
+	debugC(3, kDebugLingoExec, "cb_globalpush: pushing %s to stack", name.c_str());
 	result = g_lingo->varFetch(target);
 	g_lingo->push(result);
 }
@@ -377,12 +378,13 @@ void LC::cb_globalassign() {
 		s = g_lingo->lookupVar(name.c_str(), true, true);
 	}
 	if (s && !s->global) {
-		warning("Variable %s is local, not global", name.c_str());
+		warning("cb_globalassign: variable %s is local, not global", name.c_str());
 	}
 
 	Datum target;
 	target.type = VAR;
 	target.u.sym = s;
+	debugC(3, kDebugLingoExec, "cb_globalassign: assigning to %s", name.c_str());
 	Datum source = g_lingo->pop();
 	g_lingo->varAssign(target, source);
 }
@@ -406,16 +408,17 @@ void LC::cb_varpush() {
 
 	Symbol *s = g_lingo->lookupVar(name.c_str(), false);
 	if (!s) {
-		warning("Variable %s not found", name.c_str());
+		warning("cb_varpush: variable %s not found", name.c_str());
 		g_lingo->push(result);
 		return;
 	} else if (s && s->global) {
-		warning("Variable %s is global, not local", name.c_str());
+		warning("cb_varpush: variable %s is global, not local", name.c_str());
 	}
 
 	Datum target;
 	target.type = VAR;
 	target.u.sym = s;
+	debugC(3, kDebugLingoExec, "cb_varpush: pushing %s to stack", name.c_str());
 	result = g_lingo->varFetch(target);
 	g_lingo->push(result);
 }
@@ -427,16 +430,17 @@ void LC::cb_varassign() {
 
 	Symbol *s = g_lingo->lookupVar(name.c_str(), false);
 	if (!s) {
-		warning("Variable %s not found", name.c_str());
+		warning("cb_varassign: variable %s not found", name.c_str());
 		g_lingo->pop();
 		return;
 	} else if (s && s->global) {
-		warning("Variable %s is global, not local", name.c_str());
+		warning("cb_varassign: variable %s is global, not local", name.c_str());
 	}
 
 	Datum target;
 	target.type = VAR;
 	target.u.sym = s;
+	debugC(3, kDebugLingoExec, "cb_varassign: assigning to %s", name.c_str());
 	Datum source = g_lingo->pop();
 	g_lingo->varAssign(target, source);
 }
diff --git a/engines/director/lingo/lingo-the.cpp b/engines/director/lingo/lingo-the.cpp
index 279f045f34..244f6ceb08 100644
--- a/engines/director/lingo/lingo-the.cpp
+++ b/engines/director/lingo/lingo-the.cpp
@@ -435,6 +435,14 @@ Datum Lingo::getTheEntity(int entity, Datum &id, int field) {
 }
 
 void Lingo::setTheEntity(int entity, Datum &id, int field, Datum &d) {
+	if (debugChannelSet(3, kDebugLingoExec)) {
+		Datum idCopy = id;
+		Datum dCopy = d;
+		idCopy.toString();
+		dCopy.toString();
+		debugC(3, kDebugLingoExec, "Lingo::setTheEntity(\"%s\", %s, \"%s\", %s)", field2str(field), idCopy.u.s->c_str(), entity2str(entity), dCopy.u.s->c_str());
+	}
+
 	switch (entity) {
 	case kTheCast:
 		setTheCast(id, field, d);


Commit: 88d8577cb3a1634bd23ead85ccfec8375d293aed
    https://github.com/scummvm/scummvm/commit/88d8577cb3a1634bd23ead85ccfec8375d293aed
Author: Scott Percival (code at moral.net.au)
Date: 2020-03-28T16:15:15+08:00

Commit Message:
DIRECTOR: Add flexible number of sound channels

Changed paths:
    engines/director/lingo/lingo-builtins.cpp
    engines/director/sound.cpp
    engines/director/sound.h


diff --git a/engines/director/lingo/lingo-builtins.cpp b/engines/director/lingo/lingo-builtins.cpp
index a048b6df53..d43ed117b5 100644
--- a/engines/director/lingo/lingo-builtins.cpp
+++ b/engines/director/lingo/lingo-builtins.cpp
@@ -32,6 +32,7 @@
 #include "director/sound.h"
 #include "director/sprite.h"
 #include "director/stxt.h"
+#include "director/util.h"
 
 #include "graphics/macgui/macwindowmanager.h"
 #include "graphics/macgui/macmenu.h"
@@ -1800,7 +1801,7 @@ void LB::b_soundPlayFile(int nargs) {
 		return;
 	}
 
-	sound->playFile(*whichFile.u.s, whichChannel.u.i);
+	sound->playFile(pathMakeRelative(*whichFile.u.s), whichChannel.u.i);
 }
 
 void LB::b_soundStop(int nargs) {
diff --git a/engines/director/sound.cpp b/engines/director/sound.cpp
index a612bfb291..1c5b3a73b6 100644
--- a/engines/director/sound.cpp
+++ b/engines/director/sound.cpp
@@ -35,8 +35,15 @@
 namespace Director {
 
 DirectorSound::DirectorSound() {
-	_sound1 = new Audio::SoundHandle();
-	_sound2 = new Audio::SoundHandle();
+	uint numChannels = 2;
+	if (g_director->getVersion() >= 4) {
+		numChannels = 4;
+	}
+
+	for (uint i = 0; i < numChannels; i++) {
+		_channels.push_back(new Audio::SoundHandle());
+	}
+
 	_scriptSound = new Audio::SoundHandle();
 	_mixer = g_system->getMixer();
 
@@ -47,8 +54,9 @@ DirectorSound::DirectorSound() {
 }
 
 DirectorSound::~DirectorSound() {
-	delete _sound1;
-	delete _sound2;
+	for (uint i = 0; i < _channels.size(); i++) {
+		delete _channels[i];
+	}
 	delete _scriptSound;
 }
 
@@ -82,6 +90,11 @@ void DirectorSound::playFile(Common::String filename, uint8 soundChannel) {
 void DirectorSound::playWAV(Common::String filename, uint8 soundChannel) {
 	Common::File *file = new Common::File();
 
+	if (soundChannel == 0 || soundChannel > _channels.size()) {
+		warning("Invalid sound channel %d", soundChannel);
+		return;
+	}
+
 	if (!file->open(filename)) {
 		warning("Failed to open %s", filename.c_str());
 
@@ -92,15 +105,17 @@ void DirectorSound::playWAV(Common::String filename, uint8 soundChannel) {
 
 	Audio::RewindableAudioStream *sound = Audio::makeWAVStream(file, DisposeAfterUse::YES);
 
-	if (soundChannel == 1)
-		_mixer->playStream(Audio::Mixer::kSFXSoundType, _sound1, sound);
-	else
-		_mixer->playStream(Audio::Mixer::kSFXSoundType, _sound2, sound);
+	_mixer->playStream(Audio::Mixer::kSFXSoundType, _channels[soundChannel - 1], sound);
 }
 
 void DirectorSound::playAIFF(Common::String filename, uint8 soundChannel) {
 	Common::File *file = new Common::File();
 
+	if (soundChannel == 0 || soundChannel > _channels.size()) {
+		warning("Invalid sound channel %d", soundChannel);
+		return;
+	}
+
 	if (!file->open(filename)) {
 		warning("Failed to open %s", filename.c_str());
 		delete file;
@@ -109,10 +124,7 @@ void DirectorSound::playAIFF(Common::String filename, uint8 soundChannel) {
 
 	Audio::RewindableAudioStream *sound = Audio::makeAIFFStream(file, DisposeAfterUse::YES);
 
-	if (soundChannel == 1)
-		_mixer->playStream(Audio::Mixer::kSFXSoundType, _sound1, sound);
-	else
-		_mixer->playStream(Audio::Mixer::kSFXSoundType, _sound2, sound);
+	_mixer->playStream(Audio::Mixer::kSFXSoundType, _channels[soundChannel - 1], sound);
 }
 
 void DirectorSound::playMCI(Audio::AudioStream &stream, uint32 from, uint32 to) {
@@ -128,36 +140,38 @@ void DirectorSound::playStream(Audio::AudioStream &stream, uint8 soundChannel) {
 }
 
 void DirectorSound::playStream(Audio::SeekableAudioStream &stream, uint8 soundChannel) {
-	if (soundChannel == 1)
-		_mixer->playStream(Audio::Mixer::kSFXSoundType, _sound1, &stream);
-	else
-		_mixer->playStream(Audio::Mixer::kSFXSoundType, _sound2, &stream);
+	if (soundChannel == 0 || soundChannel > _channels.size()) {
+		warning("Invalid sound channel %d", soundChannel);
+		return;
+	}
+
+	_mixer->playStream(Audio::Mixer::kSFXSoundType, _channels[soundChannel - 1], &stream);
 }
 
-bool DirectorSound::isChannelActive(uint8 channelID) {
-	if (channelID == 1) {
-		return _mixer->isSoundHandleActive(*_sound1);
-	} else if (channelID == 2) {
-		return _mixer->isSoundHandleActive(*_sound2);
+bool DirectorSound::isChannelActive(uint8 soundChannel) {
+	if (soundChannel == 0 || soundChannel > _channels.size()) {
+		warning("Invalid sound channel %d", soundChannel);
+		return false;
 	}
 
-	error("Incorrect sound channel");
-
-	return false;
+	return _mixer->isSoundHandleActive(*_channels[soundChannel - 1]);
 }
 
-void DirectorSound::stopSound(uint8 channelID) {
-	if (channelID == 1) {
-		_mixer->stopHandle(*_sound1);
-	} else if (channelID == 2) {
-		_mixer->stopHandle(*_sound2);
+void DirectorSound::stopSound(uint8 soundChannel) {
+	if (soundChannel == 0 || soundChannel > _channels.size()) {
+		warning("Invalid sound channel %d", soundChannel);
+		return;
 	}
+
+	_mixer->stopHandle(*_channels[soundChannel - 1]);
 	return;
 }
 
 void DirectorSound::stopSound() {
-	_mixer->stopHandle(*_sound1);
-	_mixer->stopHandle(*_sound2);
+	for (uint i = 0; i < _channels.size(); i++) {
+		_mixer->stopHandle(*_channels[i]);
+	}
+	_mixer->stopHandle(*_scriptSound);
 	_mixer->stopHandle(*_pcSpeakerHandle);
 }
 
@@ -179,7 +193,6 @@ SNDDecoder::~SNDDecoder() {
 	}
 }
 
-
 bool SNDDecoder::loadStream(Common::SeekableSubReadStreamEndian &stream) {
 	if (_data) {
 		free(_data);
diff --git a/engines/director/sound.h b/engines/director/sound.h
index 107d76d9e1..663d17578d 100644
--- a/engines/director/sound.h
+++ b/engines/director/sound.h
@@ -35,8 +35,7 @@ namespace Director {
 class DirectorSound {
 
 private:
-	Audio::SoundHandle *_sound1;
-	Audio::SoundHandle *_sound2;
+	Common::Array<Audio::SoundHandle *> _channels;
 	Audio::SoundHandle *_scriptSound;
 	Audio::Mixer *_mixer;
 	Audio::PCSpeaker *_speaker;
@@ -46,15 +45,15 @@ public:
 	DirectorSound();
 	~DirectorSound();
 
-	void playWAV(Common::String filename, uint8 channelID);
-	void playAIFF(Common::String filename, uint8 channelID);
-	void playFile(Common::String filename, uint8 channelID);
+	void playWAV(Common::String filename, uint8 soundChannel);
+	void playAIFF(Common::String filename, uint8 soundChannel);
+	void playFile(Common::String filename, uint8 soundChannel);
 	void playMCI(Audio::AudioStream &stream, uint32 from, uint32 to);
 	void playStream(Audio::AudioStream &stream, uint8 soundChannel);
 	void playStream(Audio::SeekableAudioStream &stream, uint8 soundChannel);
 	void systemBeep();
-	bool isChannelActive(uint8 channelID);
-	void stopSound(uint8 channelID);
+	bool isChannelActive(uint8 soundChannel);
+	void stopSound(uint8 soundChannel);
 	void stopSound();
 };
 




More information about the Scummvm-git-logs mailing list