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

yuv422 yuv422 at users.noreply.github.com
Sat Feb 29 06:36:31 UTC 2020


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:
05835e2204 DRAGONS: Wired up config for subtitles and audio volume
a478f92f89 DRAGONS: Fixed clipping on scaled flipped sprites


Commit: 05835e2204d86d63d053fa6245e8ca7e002abb25
    https://github.com/scummvm/scummvm/commit/05835e2204d86d63d053fa6245e8ca7e002abb25
Author: Eric Fry (yuv422 at users.noreply.github.com)
Date: 2020-02-29T17:33:07+11:00

Commit Message:
DRAGONS: Wired up config for subtitles and audio volume

Changed paths:
    engines/dragons/dragons.cpp
    engines/dragons/dragons.h
    engines/dragons/minigame3.cpp
    engines/dragons/scriptopcodes.cpp
    engines/dragons/sound.cpp
    engines/dragons/sound.h
    engines/dragons/talk.cpp


diff --git a/engines/dragons/dragons.cpp b/engines/dragons/dragons.cpp
index 3a4ded3692..094764e644 100644
--- a/engines/dragons/dragons.cpp
+++ b/engines/dragons/dragons.cpp
@@ -1156,7 +1156,7 @@ void DragonsEngine::loadScene(uint16 sceneId) {
 	_flags |= 0x26;
 	_unkFlags1 = 0;
 
-	clearFlags(ENGINE_FLAG_1000_TEXT_ENABLED); //TODO wire this up to subtitle config.
+	initSubtitleFlag();
 
 	_scriptOpcodes->_scriptTargetINI = 0; //TODO this should be reset in scriptopcode.
 	_cursor->init(_actorManager, _dragonINIResource);
@@ -1472,6 +1472,15 @@ void DragonsEngine::updateCamera() {
 	}
 }
 
+void DragonsEngine::initSubtitleFlag() {
+	bool showSubtitles = ConfMan.getBool("subtitles");
+	if (showSubtitles) {
+		clearFlags(ENGINE_FLAG_1000_SUBTITLES_DISABLED);
+	} else {
+		setFlags(ENGINE_FLAG_1000_SUBTITLES_DISABLED);
+	}
+}
+
 void (*DragonsEngine::getSceneUpdateFunction())() {
 	return _sceneUpdateFunction;
 }
diff --git a/engines/dragons/dragons.h b/engines/dragons/dragons.h
index 8652e211e6..1a96b02166 100644
--- a/engines/dragons/dragons.h
+++ b/engines/dragons/dragons.h
@@ -67,7 +67,7 @@ enum Flags {
 	ENGINE_FLAG_200 = 0x200,
 	ENGINE_FLAG_400 = 0x400,
 	ENGINE_FLAG_800 = 0x800,
-	ENGINE_FLAG_1000_TEXT_ENABLED = 0x1000,
+	ENGINE_FLAG_1000_SUBTITLES_DISABLED = 0x1000,
 	ENGINE_FLAG_8000     =     0x8000, // speech dialog is playing.
 
 	ENGINE_FLAG_10000    =    0x10000,
@@ -313,6 +313,8 @@ private:
 	void initializeSound();
 
 	void SomeInitSound_fun_8003f64c();
+
+	void initSubtitleFlag();
 };
 
 DragonsEngine *getEngine();
diff --git a/engines/dragons/minigame3.cpp b/engines/dragons/minigame3.cpp
index f52b3c2294..34b3f6934d 100644
--- a/engines/dragons/minigame3.cpp
+++ b/engines/dragons/minigame3.cpp
@@ -192,7 +192,7 @@ void Minigame3::run() {
 	_vm->clearFlags(ENGINE_FLAG_8);
 	_vm->clearFlags(ENGINE_FLAG_1);
 	_vm->setFlags(ENGINE_FLAG_100);
-	_vm->setFlags(ENGINE_FLAG_1000_TEXT_ENABLED);
+	_vm->setFlags(ENGINE_FLAG_1000_SUBTITLES_DISABLED);
 // TODO
 //	memcpy2(auStack1584_palette, scrFileData_maybe, 0x200);
 //	memcpy2(auStack1072_palette, scrFileData_maybe, 0x200);
diff --git a/engines/dragons/scriptopcodes.cpp b/engines/dragons/scriptopcodes.cpp
index 053e0ce2f6..afccc467e5 100644
--- a/engines/dragons/scriptopcodes.cpp
+++ b/engines/dragons/scriptopcodes.cpp
@@ -938,7 +938,7 @@ void ScriptOpcodes::opCodeActorTalk(ScriptOpCall &scriptOpCall) {
 
 	int sVar2 = -1; //TODO findTextToDtSpeechIndex(textIndex);
 
-	if (!_vm->isUnkFlagSet(1) && (!_vm->isFlagSet(ENGINE_FLAG_1000_TEXT_ENABLED) || sVar2 == -1)) {
+	if (!_vm->isUnkFlagSet(1) && (!_vm->isFlagSet(ENGINE_FLAG_1000_SUBTITLES_DISABLED) || sVar2 == -1)) {
 		_vm->_talk->loadText(textIndex, dialog, 2048);
 	}
 
diff --git a/engines/dragons/sound.cpp b/engines/dragons/sound.cpp
index cf4f79f543..491e2854e1 100644
--- a/engines/dragons/sound.cpp
+++ b/engines/dragons/sound.cpp
@@ -23,6 +23,7 @@
 #include "audio/audiostream.h"
 #include "audio/decoders/raw.h"
 #include "audio/decoders/xa.h"
+#include "common/config-manager.h"
 #include "common/file.h"
 #include "common/memstream.h"
 #include "dragons/dragons.h"
@@ -98,7 +99,7 @@ void SoundManager::playSpeech(uint32 textIndex) {
 	fd->close();
 	delete fd;
 	_vm->setFlags(ENGINE_FLAG_8000);
-	_vm->_mixer->playStream(Audio::Mixer::kSpeechSoundType, &_speechHandle, _audioTrack->getAudioStream());
+	_vm->_mixer->playStream(Audio::Mixer::kSpeechSoundType, &_speechHandle, _audioTrack->getAudioStream(), -1, _speechVolume);
 	delete _audioTrack;
 }
 
@@ -259,7 +260,27 @@ SoundManager::SoundManager(DragonsEngine *vm, BigfileArchive *bigFileArchive, Dr
 		  _bigFileArchive(bigFileArchive),
 		  _dragonRMS(dragonRMS) {
 	_dat_8006bb60_sound_related = 0;
-	// TODO: Set volumes
+
+	bool allSoundIsMuted = false;
+	if (ConfMan.hasKey("mute")) {
+		allSoundIsMuted = ConfMan.getBool("mute");
+	}
+	_speechVolume = ConfMan.getInt("speech_volume");
+	_sfxVolume = ConfMan.getInt("sfx_volume");
+	_musicVolume = ConfMan.getInt("music_volume");
+
+	if (ConfMan.hasKey("speech_mute") && !allSoundIsMuted) {
+		_vm->_mixer->muteSoundType(_vm->_mixer->kSpeechSoundType, ConfMan.getBool("speech_mute"));
+	}
+
+	if (ConfMan.hasKey("sfx_mute") && !allSoundIsMuted) {
+		_vm->_mixer->muteSoundType(_vm->_mixer->kSFXSoundType, ConfMan.getBool("sfx_mute"));
+	}
+
+	if (ConfMan.hasKey("music_mute") && !allSoundIsMuted) {
+		_vm->_mixer->muteSoundType(_vm->_mixer->kMusicSoundType, ConfMan.getBool("music_mute"));
+	}
+
 	SomeInitSound_FUN_8003f64c();
 	loadMusAndGlob();
 }
@@ -400,7 +421,7 @@ void SoundManager::playSound(uint16 soundId, uint16 volumeId) {
 
 	Audio::SoundHandle *handle = getVoiceHandle(soundId);
 	if (handle) {
-		_vm->_mixer->playStream(Audio::Mixer::kSFXSoundType, handle, vabSound->getAudioStream(program, key));
+		_vm->_mixer->playStream(Audio::Mixer::kSFXSoundType, handle, vabSound->getAudioStream(program, key), -1, _sfxVolume);
 	}
 }
 
diff --git a/engines/dragons/sound.h b/engines/dragons/sound.h
index 691bf09282..f3b581e6bb 100644
--- a/engines/dragons/sound.h
+++ b/engines/dragons/sound.h
@@ -66,6 +66,10 @@ private:
 	BigfileArchive *_bigFileArchive;
 	DragonRMS *_dragonRMS;
 
+	uint8 _speechVolume;
+	uint8 _sfxVolume;
+	uint8 _musicVolume;
+
 	// SOUND_ARR_DAT_80071f6c
 	uint8 _soundArr[0x780];
 
diff --git a/engines/dragons/talk.cpp b/engines/dragons/talk.cpp
index ad29e95087..77e018afc9 100644
--- a/engines/dragons/talk.cpp
+++ b/engines/dragons/talk.cpp
@@ -352,7 +352,7 @@ uint8 Talk::conversation_related_maybe(uint16 *dialogText, uint16 x, uint16 y, u
 			_dat_8008e848_dialogBox_x2 = (uVar11 + _dat_8008e7e8_dialogBox_x1) - 1;
 			_dat_8008e844_dialogBox_y1 = (uVar19 - sVar4 * _dat_800726f0_tfont_field2) + 1;
 			_dat_8008e874_dialogBox_y2 = _dat_8008e844_dialogBox_y1 + sVar4 * _dat_800726f0_tfont_field2 + 1;
-			if (!_vm->isUnkFlagSet(ENGINE_UNK1_FLAG_1) && ((!_vm->isFlagSet(ENGINE_FLAG_1000_TEXT_ENABLED) || (param_7 != 0)))) {
+			if (!_vm->isUnkFlagSet(ENGINE_UNK1_FLAG_1) && ((!_vm->isFlagSet(ENGINE_FLAG_1000_SUBTITLES_DISABLED) || (param_7 != 0)))) {
 				unaff_s4 = 0;
 				drawDialogBox((uint) _dat_8008e7e8_dialogBox_x1, (uint) _dat_8008e844_dialogBox_y1,
 							  (uint) _dat_8008e848_dialogBox_x2, (uint) _dat_8008e874_dialogBox_y2, 0);
@@ -382,7 +382,7 @@ uint8 Talk::conversation_related_maybe(uint16 *dialogText, uint16 x, uint16 y, u
 				return (uint)returnStatus;
 			}
 			uVar9 = ((int)((int)(short)unaff_s4 * (uint)1 * (int)sVar3) >> 3) * 0x3c;
-			if ((param_7 == 0) && _vm->isFlagSet(ENGINE_FLAG_1000_TEXT_ENABLED)) {
+			if ((param_7 == 0) && _vm->isFlagSet(ENGINE_FLAG_1000_SUBTITLES_DISABLED)) {
 				uVar9 = 0;
 			}
 			do {
@@ -392,7 +392,7 @@ uint8 Talk::conversation_related_maybe(uint16 *dialogText, uint16 x, uint16 y, u
 				if (_vm->_sound->_dat_8006bb60_sound_related != 0) {
 					_vm->_sound->_dat_8006bb60_sound_related = 0;
 					curDialogTextPtr = dialogText;
-					if (!_vm->isFlagSet(ENGINE_FLAG_1000_TEXT_ENABLED)) {
+					if (!_vm->isFlagSet(ENGINE_FLAG_1000_SUBTITLES_DISABLED)) {
 						returnStatus = 1;
 						goto LAB_80032e18;
 					}
@@ -417,7 +417,7 @@ uint8 Talk::conversation_related_maybe(uint16 *dialogText, uint16 x, uint16 y, u
 								(uint) _dat_8008e848_dialogBox_x2, (uint) _dat_8008e874_dialogBox_y2);
 			}
 		} while (!_vm->isUnkFlagSet(ENGINE_UNK1_FLAG_1) &&
-				 (((!_vm->isFlagSet(ENGINE_FLAG_1000_TEXT_ENABLED) || (param_7 != 0)) && (*curDialogTextPtr != 0))));
+				 (((!_vm->isFlagSet(ENGINE_FLAG_1000_SUBTITLES_DISABLED) || (param_7 != 0)) && (*curDialogTextPtr != 0))));
 	}
 	if (param_5 != 0) {
 		if (_vm->isFlagSet(ENGINE_FLAG_8000)) {


Commit: a478f92f89e3cb0043bc2f05b936c039e4bc043b
    https://github.com/scummvm/scummvm/commit/a478f92f89e3cb0043bc2f05b936c039e4bc043b
Author: Eric Fry (yuv422 at users.noreply.github.com)
Date: 2020-02-29T17:35:28+11:00

Commit Message:
DRAGONS: Fixed clipping on scaled flipped sprites

Changed paths:
    engines/dragons/screen.cpp


diff --git a/engines/dragons/screen.cpp b/engines/dragons/screen.cpp
index ca04461255..7c6b0438f8 100644
--- a/engines/dragons/screen.cpp
+++ b/engines/dragons/screen.cpp
@@ -234,7 +234,7 @@ void Screen::drawScaledSprite(Graphics::Surface *destSurface, byte *source, int
 	byte *hsrc = source + sourceWidth * ((yi + 0x8000) >> 16);
 	for (int yc = 0; yc < destHeight; ++yc) {
 		byte *wdst = flipX ? dst + (destWidth - 1) * 2 : dst;
-		int xi = xs * clipX;
+		int xi = flipX ? xs : xs * clipX;
 		byte *wsrc = hsrc + ((xi + 0x8000) >> 16);
 		for (int xc = 0; xc < destWidth; ++xc) {
 			byte colorIndex = *wsrc;
@@ -396,9 +396,9 @@ void Screen::setScreenShakeOffset(int16 x, int16 y) {
 
 void Screen::copyRectToSurface8bppWrappedY(const Graphics::Surface &srcSurface, byte *palette, int yOffset) {
 	byte *dst = (byte *)_backSurface->getBasePtr(0, 0);
-	for (int i = 0; i < 200; i++) {
+	for (int i = 0; i < DRAGONS_SCREEN_HEIGHT; i++) {
 		const byte *src = (const byte *)srcSurface.getPixels() + ((yOffset + i) % srcSurface.h) * srcSurface.pitch;
-		for (int j = 0; j < 320; j++) {
+		for (int j = 0; j < DRAGONS_SCREEN_WIDTH; j++) {
 			uint16 c = READ_LE_UINT16(&palette[src[j] * 2]);
 			if (c != 0) {
 					WRITE_LE_UINT16(&dst[j * 2], c & ~0x8000);




More information about the Scummvm-git-logs mailing list