diff options
25 files changed, 126 insertions, 50 deletions
| diff --git a/base/commandLine.cpp b/base/commandLine.cpp index 8be2057338..558c147b96 100644 --- a/base/commandLine.cpp +++ b/base/commandLine.cpp @@ -141,6 +141,9 @@ static const char HELP_STRING[] =  #if defined(ENABLE_SCUMM) || defined(ENABLE_GROOVIE)  	"  --demo-mode              Start demo mode of Maniac Mansion or The 7th Guest\n"  #endif +#if defined(ENABLE_DIRECTOR) +	"  --start-movie=NAME       Start movie for Director\n" +#endif  #ifdef ENABLE_SCUMM  	"  --tempo=NUM              Set music tempo (in percent, 50-200) for SCUMM games\n"  	"                           (default: 100)\n" @@ -444,7 +447,7 @@ Common::String parseCommandLine(Common::StringMap &settings, int argc, const cha  			DO_OPTION_BOOL('f', "fullscreen")  			END_OPTION -			 +  			DO_LONG_OPTION_BOOL("filtering")  			END_OPTION @@ -616,6 +619,11 @@ Common::String parseCommandLine(Common::StringMap &settings, int argc, const cha  			END_OPTION  #endif +#if defined(ENABLE_DIRECTOR) +			DO_LONG_OPTION("start-movie") +			END_OPTION +#endif +  unknownOption:  			// If we get till here, the option is unhandled and hence unknown.  			usage("Unrecognized option '%s'", argv[i]); diff --git a/engines/agos/string.cpp b/engines/agos/string.cpp index cc443f2f50..533b04fa30 100644 --- a/engines/agos/string.cpp +++ b/engines/agos/string.cpp @@ -486,6 +486,9 @@ void AGOSEngine::printScreenText(uint vgaSpriteId, uint color, const char *strin  		if (_variableArray[141] == 0)  			_variableArray[141] = 9;  		_variableArray[85] = _variableArray[141] * talkDelay; +		 +		if (_language == Common::HE_ISR) +			_variableArray[85] += talkDelay * 2;  	} else {  		if (_variableArray[86] == 0)  			talkDelay /= 2; diff --git a/engines/bladerunner/actor.cpp b/engines/bladerunner/actor.cpp index c778a6dee0..9a8892cf6c 100644 --- a/engines/bladerunner/actor.cpp +++ b/engines/bladerunner/actor.cpp @@ -868,7 +868,7 @@ void Actor::speechPlay(int sentenceId, bool voiceOver) {  	sprintf(name, "%02d-%04d.AUD", _id, sentenceId); //TODO somewhere here should be also language code  	int balance; -	if (voiceOver || _id == 99) { +	if (voiceOver || _id == VOICEOVER_ACTOR) {  		balance = 0;  	} else {  		// Vector3 pos = _vm->_view->_frameViewMatrix * _position; @@ -910,7 +910,7 @@ void Actor::copyClues(int actorId) {  	for (int i = 0; i < (int)_vm->_gameInfo->getClueCount(); i++) {  		if (hasClue(i) && !_clues->isFlag4(i) && !otherActor->hasClue(i)) {  			int fromActorId = _id; -			if (_id == 99) +			if (_id == VOICEOVER_ACTOR)  				fromActorId = _clues->getFromActorId(i);  			otherActor->acquireClue(i, 0, fromActorId);  		} diff --git a/engines/bladerunner/adq.cpp b/engines/bladerunner/adq.cpp index ca72497b99..d2d3dec6ce 100644 --- a/engines/bladerunner/adq.cpp +++ b/engines/bladerunner/adq.cpp @@ -50,7 +50,7 @@ ADQ::~ADQ() {  }  void ADQ::add(int actorId, int sentenceId, int animationMode) { -	if (actorId == 0 || actorId == 99) { +	if (actorId == 0 || actorId == VOICEOVER_ACTOR) {  		animationMode = -1;  	}  	if (_entries.size() < 25) { diff --git a/engines/bladerunner/ambient_sounds.cpp b/engines/bladerunner/ambient_sounds.cpp index c33deefb80..aaf6c016d3 100644 --- a/engines/bladerunner/ambient_sounds.cpp +++ b/engines/bladerunner/ambient_sounds.cpp @@ -185,6 +185,10 @@ void AmbientSounds::addSoundByName(  		int pan1begin, int pan1end,  		int pan2begin, int pan2end,  		int priority, int unk3) { +	if (strlen(name) > 12) { +		error("AmbientSounds::addSoundByName: Overlong name '%s'", name); +	} +  	int i = findAvailableNonLoopingTrack();  	if (i < 0)  		return; diff --git a/engines/bladerunner/bladerunner.cpp b/engines/bladerunner/bladerunner.cpp index 6fe66d02bc..33110c07de 100644 --- a/engines/bladerunner/bladerunner.cpp +++ b/engines/bladerunner/bladerunner.cpp @@ -236,12 +236,12 @@ bool BladeRunnerEngine::startup(bool hasSavegames) {  	_zBuffer2 = new uint16[640 * 480];  	int actorCount = (int)_gameInfo->getActorCount(); -	assert(actorCount < 99); +	assert(actorCount < ACTORS_COUNT);  	for (int i = 0; i != actorCount; ++i) {  		_actors[i] = new Actor(this, i);  		_actors[i]->setup(i);  	} -	_voiceoverActor = new Actor(this, 99); +	_actors[VOICEOVER_ACTOR] = new Actor(this, VOICEOVER_ACTOR);  	_playerActor = _actors[_gameInfo->getPlayerId()];  	_playerActor->setFPS(15); diff --git a/engines/bladerunner/bladerunner.h b/engines/bladerunner/bladerunner.h index bbef17820d..b0eb4591cd 100644 --- a/engines/bladerunner/bladerunner.h +++ b/engines/bladerunner/bladerunner.h @@ -64,6 +64,9 @@ class TextResource;  class View;  class Waypoints; +#define ACTORS_COUNT 100 +#define VOICEOVER_ACTOR (ACTORS_COUNT - 1) +  class BladeRunnerEngine : public Engine {  public:  	bool      _gameIsRunning; @@ -107,8 +110,7 @@ public:  	Common::Array<Shape*> _shapes; -	Actor *_actors[99]; -	Actor *_voiceoverActor; +	Actor *_actors[ACTORS_COUNT];  	Actor *_playerActor;  	int in_script_counter; diff --git a/engines/bladerunner/movement_track.cpp b/engines/bladerunner/movement_track.cpp index 60a190a9a2..bd74116566 100644 --- a/engines/bladerunner/movement_track.cpp +++ b/engines/bladerunner/movement_track.cpp @@ -50,7 +50,7 @@ int MovementTrack::append(int waypointId, int delay, int running) {  }  int MovementTrack::append(int waypointId, int delay, int angle, int running) { -	if (_lastIndex > ARRAYSIZE(_entries)) +	if (_lastIndex >= ARRAYSIZE(_entries))  		return 0;  	_entries[_lastIndex].waypointId = waypointId; diff --git a/engines/bladerunner/script/script.cpp b/engines/bladerunner/script/script.cpp index 060f8778d4..b0bb638440 100644 --- a/engines/bladerunner/script/script.cpp +++ b/engines/bladerunner/script/script.cpp @@ -432,11 +432,13 @@ void ScriptBase::Actor_Voice_Over(int sentenceId, int actorId) {  #endif  void ScriptBase::Actor_Voice_Over(int sentenceId, int actorId) { +	assert(actorId < ACTORS_COUNT); +  	_vm->gameWaitForActive();  	_vm->loopActorSpeaking();  	_vm->_adq->flush(1, true); -	Actor *actor = (actorId == 99) ? _vm->_voiceoverActor : _vm->_actors[actorId]; +	Actor *actor = _vm->_actors[actorId];  	actor->speechPlay(sentenceId, true);  	Player_Loses_Control(); @@ -458,7 +460,7 @@ void ScriptBase::Actor_Start_Speech_Sample(int actorId, int sentenceId) {  void ScriptBase::Actor_Start_Voice_Over_Sample(int sentenceId) {  	_vm->loopActorSpeaking(); -	_vm->_voiceoverActor->speechPlay(sentenceId, true); +	_vm->_actors[VOICEOVER_ACTOR]->speechPlay(sentenceId, true);  }  int ScriptBase::Actor_Query_Which_Set_In(int actorId) { @@ -646,11 +648,11 @@ bool ScriptBase::Actor_Clue_Query(int actorId, int clueId) {  }  void ScriptBase::Actor_Clues_Transfer_New_To_Mainframe(int actorId) { -	_vm->_actors[actorId]->copyClues(99); +	_vm->_actors[actorId]->copyClues(VOICEOVER_ACTOR);  }  void ScriptBase::Actor_Clues_Transfer_New_From_Mainframe(int actorId) { -	_vm->_voiceoverActor->copyClues(actorId); +	_vm->_actors[VOICEOVER_ACTOR]->copyClues(actorId);  }  void ScriptBase::Actor_Set_Invisible(int actorId, bool isInvisible) { diff --git a/engines/bladerunner/set_effects.cpp b/engines/bladerunner/set_effects.cpp index 8954b6f5db..54894e2a1c 100644 --- a/engines/bladerunner/set_effects.cpp +++ b/engines/bladerunner/set_effects.cpp @@ -69,26 +69,25 @@ void SetEffects::read(Common::ReadStream *stream, int framesCount) {  		}  		if (!fog) {  			//TODO exception, unknown fog type +		} else { +			fog->read(stream, framesCount); +			fog->_next = _fogs; +			_fogs = fog;  		} -		fog->read(stream, framesCount); -		fog->_next = _fogs; -		_fogs = fog;  	}  }  void SetEffects::reset() { -	Fog *fog, *nextFog; +	Fog *nextFog;  	if (!_fogs)  		return;  	do { -		fog = _fogs; -		nextFog = fog->_next; -		delete fog; -		fog = nextFog; +		nextFog = _fogs->_next; +		delete this->_fogs; +		this->_fogs = nextFog;  	} while (nextFog); -  }  void SetEffects::setupFrame(int frame) { @@ -96,7 +95,7 @@ void SetEffects::setupFrame(int frame) {  void SetEffects::setFadeColor(float r, float g, float b) {  	_fadeColor.r = r; -	_fadeColor.r = g; +	_fadeColor.g = g;  	_fadeColor.b = b;  } diff --git a/engines/bladerunner/suspects_database.h b/engines/bladerunner/suspects_database.h index 83e551b1a1..472e340474 100644 --- a/engines/bladerunner/suspects_database.h +++ b/engines/bladerunner/suspects_database.h @@ -35,7 +35,7 @@ class TextResource;  #define NONREPLICANT_CLUES_COUNT 20  #define OTHER_CLUES_COUNT 20  #define IDENTITY_CLUES_COUNT 10 -#define PHOTO_CLUES_COUNT 10 +#define PHOTO_CLUES_COUNT 6  class SuspectDatabaseEntry {  	BladeRunnerEngine *_vm; @@ -48,7 +48,7 @@ class SuspectDatabaseEntry {  	int _nonReplicantClues[NONREPLICANT_CLUES_COUNT];  	int _otherClues[OTHER_CLUES_COUNT];  	int _identityClues[IDENTITY_CLUES_COUNT]; -	int _photoClues[6][3]; +	int _photoClues[PHOTO_CLUES_COUNT][3];  	int _moCluesCount;  	int _whereaboutsCluesCount;  	int _replicantCluesCount; diff --git a/engines/bladerunner/waypoints.cpp b/engines/bladerunner/waypoints.cpp index bd78693328..7f709963df 100644 --- a/engines/bladerunner/waypoints.cpp +++ b/engines/bladerunner/waypoints.cpp @@ -30,6 +30,7 @@ Waypoints::Waypoints(BladeRunnerEngine *vm, int count) {  }  Waypoints::~Waypoints() { +	delete[] _waypoints;  }  void Waypoints::getXYZ(int waypointId, float *x, float *y, float *z) { diff --git a/engines/director/detection.cpp b/engines/director/detection.cpp index 68f2c89326..ca0b5c1515 100644 --- a/engines/director/detection.cpp +++ b/engines/director/detection.cpp @@ -23,6 +23,8 @@  #include "base/plugins.h"  #include "engines/advancedDetector.h" + +#include "common/config-manager.h"  #include "common/savefile.h"  #include "common/system.h"  #include "common/textconsole.h" @@ -55,6 +57,9 @@ Common::Language DirectorEngine::getLanguage() const {  }  Common::String DirectorEngine::getEXEName() const { +	if (ConfMan.hasKey("start_movie")) +		return ConfMan.get("start_movie"); +  	return _gameDescription->desc.filesDescriptions[0].fileName;  } diff --git a/engines/director/detection_tables.h b/engines/director/detection_tables.h index 4b3cfd559c..ae52784f51 100644 --- a/engines/director/detection_tables.h +++ b/engines/director/detection_tables.h @@ -40,11 +40,11 @@ static const DirectorGameDescription gameDescriptions[] = {  		3  	}, -	{ // Generic D3 entry +	{ // Generic D3 Mac entry  		{  			"director",  			"", -			AD_ENTRY1("D3", 0), +			AD_ENTRY1("D3-mac", 0),  			Common::EN_ANY,  			Common::kPlatformMacintosh,  			ADGF_MACRESFORK, @@ -53,6 +53,19 @@ static const DirectorGameDescription gameDescriptions[] = {  		GID_GENERIC,  		3  	}, +	{ // Generic D4 Mac entry +		{ +			"director", +			"", +			AD_ENTRY1("D4-mac", 0), +			Common::EN_ANY, +			Common::kPlatformMacintosh, +			ADGF_MACRESFORK, +			GUIO1(GUIO_NOASPECT) +		}, +		GID_GENERIC, +		4 +	},  	{  		{  			"theapartment", diff --git a/engines/director/director.cpp b/engines/director/director.cpp index 5d646956d0..8c5e456781 100644 --- a/engines/director/director.cpp +++ b/engines/director/director.cpp @@ -122,7 +122,8 @@ Common::Error DirectorEngine::run() {  	_movies = scanMovies(ConfMan.get("path")); -	loadSharedCastsFrom(_sharedCastFile); +	if (!_sharedCastFile.empty()) +		loadSharedCastsFrom(_sharedCastFile);  	loadMainArchive();  	_currentScore = new Score(this, _mainArchive); @@ -160,6 +161,7 @@ Common::HashMap<Common::String, Score *> *DirectorEngine::scanMovies(const Commo  			Archive *arc = createArchive(); +			warning("name: %s", i->getName().c_str());  			arc->openFile(i->getName());  			Score *sc = new Score(this, arc);  			nameMap->setVal(sc->getMacName(), sc); diff --git a/engines/mohawk/detection_tables.h b/engines/mohawk/detection_tables.h index 2636cc4434..9cc52a78b3 100644 --- a/engines/mohawk/detection_tables.h +++ b/engines/mohawk/detection_tables.h @@ -406,6 +406,25 @@ static const MohawkGameDescription gameDescriptions[] = {  		0,  	}, + +	// Riven: The Sequel to Myst +	// Version 1.0J (5CD) - Japanese +	// From sev +	{ +		{ +			"riven", +			"", +			AD_ENTRY1s("a_Data.MHK", "3a2b4764979dc007a0e6ded64e4b7889", 10014314), +			Common::JA_JPN, +			Common::kPlatformWindows, +			ADGF_UNSTABLE, +			GUIO1(GUIO_NOASPECT) +		}, +		GType_RIVEN, +		0, +		0, +	}, +  	// Riven: The Sequel to Myst  	// Version 1.? (DVD, From "Myst 10th Anniversary Edition")  	// From Clone2727 diff --git a/engines/mohawk/riven.cpp b/engines/mohawk/riven.cpp index b7c83c0ff8..a1eef85a69 100644 --- a/engines/mohawk/riven.cpp +++ b/engines/mohawk/riven.cpp @@ -82,6 +82,7 @@ MohawkEngine_Riven::MohawkEngine_Riven(OSystem *syst, const MohawkGameDescriptio  	SearchMan.addSubDirectoryMatching(gameDataDir, "data");  	SearchMan.addSubDirectoryMatching(gameDataDir, "exe");  	SearchMan.addSubDirectoryMatching(gameDataDir, "assets1"); +	SearchMan.addSubDirectoryMatching(gameDataDir, "program");  	g_atrusJournalRect1 = new Common::Rect(295, 402, 313, 426);  	g_atrusJournalRect2 = new Common::Rect(259, 402, 278, 426); diff --git a/engines/titanic/npcs/doorbot.cpp b/engines/titanic/npcs/doorbot.cpp index b9a46426bc..d26f4bb828 100644 --- a/engines/titanic/npcs/doorbot.cpp +++ b/engines/titanic/npcs/doorbot.cpp @@ -81,7 +81,7 @@ void CDoorbot::load(SimpleFile *file) {  }  bool CDoorbot::MovieEndMsg(CMovieEndMsg *msg) { -	if (_npcFlags & NPCFLAG_8000000) { +	if (_npcFlags & NPCFLAG_DOORBOT_INTRO) {  		switch (_field108) {  		case 3:  			startTalking(this, 221482); @@ -121,7 +121,7 @@ bool CDoorbot::MovieEndMsg(CMovieEndMsg *msg) {  			_npcFlags = (_npcFlags & ~NPCFLAG_8) | NPCFLAG_4;  			endTalking(this, false);  			startTalking(this, 221474); -			_npcFlags &= ~NPCFLAG_8000000; +			_npcFlags |= NPCFLAG_DOORBOT_INTRO;  			_field108 = 0;  		} else if (clipExistsByEnd("Cloak On", msg->_endFrame)) {  			petShow(); @@ -226,7 +226,7 @@ bool CDoorbot::DoorbotNeededInElevatorMsg(CDoorbotNeededInElevatorMsg *msg) {  	moveToView("ServiceElevator.Node 1.N");  	setPosition(Point(100, 42)); -	if (_npcFlags & NPCFLAG_8000000) { +	if (_npcFlags & NPCFLAG_DOORBOT_INTRO) {  		_field108 = 7;  		_npcFlags |= NPCFLAG_200000;  		loadFrame(797); @@ -240,7 +240,7 @@ bool CDoorbot::DoorbotNeededInElevatorMsg(CDoorbotNeededInElevatorMsg *msg) {  }  bool CDoorbot::LeaveViewMsg(CLeaveViewMsg *msg) { -	if (!(_npcFlags & NPCFLAG_8000000) && (_npcFlags & NPCFLAG_400000)) { +	if (!(_npcFlags & NPCFLAG_DOORBOT_INTRO) && (_npcFlags & NPCFLAG_400000)) {  		performAction(true);  		_npcFlags &= ~NPCFLAG_4;  	} @@ -251,7 +251,7 @@ bool CDoorbot::LeaveViewMsg(CLeaveViewMsg *msg) {  bool CDoorbot::TimerMsg(CTimerMsg *msg) {  	if (msg->_action == "NPCIdleAnim") {  		return CTrueTalkNPC::TimerMsg(msg); -	} else if (_npcFlags & NPCFLAG_8000000) { +	} else if (_npcFlags & NPCFLAG_DOORBOT_INTRO) {  		switch (msg->_actionVal) {  		case 0:  			startTalking(this, 221475); @@ -362,7 +362,7 @@ bool CDoorbot::NPCPlayIdleAnimationMsg(CNPCPlayIdleAnimationMsg *msg) {  bool CDoorbot::PutBotBackInHisBoxMsg(CPutBotBackInHisBoxMsg *msg) {  	petMoveToHiddenRoom(); -	_npcFlags &= ~(NPCFLAG_4 | NPCFLAG_100000 | NPCFLAG_200000 | NPCFLAG_8000000); +	_npcFlags &= ~(NPCFLAG_4 | NPCFLAG_100000 | NPCFLAG_200000 | NPCFLAG_DOORBOT_INTRO);  	if (msg->_value)  		performAction(true); @@ -402,7 +402,10 @@ bool CDoorbot::MovieFrameMsg(CMovieFrameMsg *msg) {  }  bool CDoorbot::TrueTalkNotifySpeechEndedMsg(CTrueTalkNotifySpeechEndedMsg *msg) { -	if (_npcFlags & NPCFLAG_8000000) { +	CTrueTalkNPC::TrueTalkNotifySpeechEndedMsg(msg); + +	if (_npcFlags & NPCFLAG_DOORBOT_INTRO) { +		// Initial speech by Doorbot in   		switch (msg->_dialogueId) {  		case 10552:  			playClip("SE Try Buttons", MOVIE_NOTIFY_OBJECT); @@ -506,7 +509,7 @@ bool CDoorbot::TrueTalkNotifySpeechEndedMsg(CTrueTalkNotifySpeechEndedMsg *msg)  }  bool CDoorbot::TextInputMsg(CTextInputMsg *msg) { -	if (!(_npcFlags & NPCFLAG_8000000)) +	if (!(_npcFlags & NPCFLAG_DOORBOT_INTRO))  		return CTrueTalkNPC::TextInputMsg(msg);  	if (_field108 == 1) { @@ -529,7 +532,7 @@ bool CDoorbot::TextInputMsg(CTextInputMsg *msg) {  }  bool CDoorbot::EnterViewMsg(CEnterViewMsg *msg) { -	if ((_npcFlags & NPCFLAG_8000000) && _field108 == 7) +	if ((_npcFlags & NPCFLAG_DOORBOT_INTRO) && _field108 == 7)  		playClip("SE Move And Turn", MOVIE_NOTIFY_OBJECT);  	return true; diff --git a/engines/titanic/npcs/true_talk_npc.cpp b/engines/titanic/npcs/true_talk_npc.cpp index ab0401a705..55666a21a9 100644 --- a/engines/titanic/npcs/true_talk_npc.cpp +++ b/engines/titanic/npcs/true_talk_npc.cpp @@ -99,13 +99,15 @@ bool CTrueTalkNPC::TrueTalkNotifySpeechStartedMsg(CTrueTalkNotifySpeechStartedMs  	++_field100;  	if (!(_npcFlags & NPCFLAG_8)) { +		// Stop any previous animation  		if (_speechTimerId) -			stopTimer(_speechTimerId); +			stopAnimTimer(_speechTimerId); +		_speechTimerId = 0;  		_speechDuration = msg->_speechDuration;  		_startTicks = getTicksCount(); -		if (hasActiveMovie() || (_npcFlags & NPCFLAG_2)) { +		if (!hasActiveMovie() || (_npcFlags & NPCFLAG_2)) {  			_npcFlags &= ~NPCFLAG_2;  			stopMovie(); @@ -200,7 +202,7 @@ bool CTrueTalkNPC::NPCPlayAnimationMsg(CNPCPlayAnimationMsg *msg) {  			index = getRandomNumber(count - 1);  		} while (getClipDuration(msg->_names[index]) > msg->_maxDuration && --tries); -		if (tries) { +		if (!tries) {  			// Sequentially go through the clips to find any below the maximum  			index = 0;  			for (int idx = 0; idx < count; ++idx) { @@ -211,9 +213,9 @@ bool CTrueTalkNPC::NPCPlayAnimationMsg(CNPCPlayAnimationMsg *msg) {  			}  		} -		playClip(msg->_names[index], MOVIE_GAMESTATE | MOVIE_NOTIFY_OBJECT); +		playClip(msg->_names[index], MOVIE_NOTIFY_OBJECT);  	} else { -		playClip(msg->_names[getRandomNumber(count - 1)]); +		playClip(msg->_names[getRandomNumber(count - 1)], MOVIE_NOTIFY_OBJECT);  	}  	return true; diff --git a/engines/titanic/npcs/true_talk_npc.h b/engines/titanic/npcs/true_talk_npc.h index 1e06e9c690..3adf055449 100644 --- a/engines/titanic/npcs/true_talk_npc.h +++ b/engines/titanic/npcs/true_talk_npc.h @@ -36,7 +36,7 @@ enum NpcFlag {  	NPCFLAG_100000 = 0x100000, NPCFLAG_200000 = 0x200000,  	NPCFLAG_400000 = 0x400000, NPCFLAG_800000 = 0x800000,  	NPCFLAG_1000000 = 0x1000000, NPCFLAG_2000000 = 0x2000000, -	NPCFLAG_4000000 = 0x4000000, NPCFLAG_8000000 = 0x8000000 +	NPCFLAG_4000000 = 0x4000000, NPCFLAG_DOORBOT_INTRO = 0x8000000  };  class CViewItem; diff --git a/engines/titanic/sound/sound.cpp b/engines/titanic/sound/sound.cpp index a8c4849f2b..e48c8760c5 100644 --- a/engines/titanic/sound/sound.cpp +++ b/engines/titanic/sound/sound.cpp @@ -159,7 +159,7 @@ int CSound::playSound(const CString &name, CProximity &prox) {  	if (!waveFile)  		return -1; -	prox._soundDuration = waveFile->getDuration(); +	prox._soundDuration = waveFile->getDurationTicks();  	if (prox._soundType != Audio::Mixer::kPlainSoundType)  		waveFile->_soundType = prox._soundType; @@ -209,7 +209,7 @@ int CSound::playSpeech(CDialogueFile *dialogueFile, int speechId, CProximity &pr  	if (!waveFile)  		return -1; -	prox._soundDuration = waveFile->getDuration(); +	prox._soundDuration = waveFile->getDurationTicks();  	activateSound(waveFile, prox._disposeAfterUse);  	return _soundManager.playSound(*waveFile, prox); diff --git a/engines/titanic/sound/wave_file.cpp b/engines/titanic/sound/wave_file.cpp index 3f855cd053..ade94aad50 100644 --- a/engines/titanic/sound/wave_file.cpp +++ b/engines/titanic/sound/wave_file.cpp @@ -43,8 +43,17 @@ CWaveFile::~CWaveFile() {  	}  } -uint CWaveFile::getDuration() const { -	return _stream ? _stream->getLength().secs() : 0; +uint CWaveFile::getDurationTicks() const { +	if (!_stream) +		return 0; + +	// FIXME: The original uses acmStreamSize to calculate +	// a desired size. Since I have no idea how the system API +	// method works, for now I'm using a simple ratio of a +	// sample output to input value +	uint size = _size - 0x46; +	double newSize = (double)size * (1475712.0 / 199836.0); +	return newSize * 1000.0 / _stream->getRate();  }  bool CWaveFile::loadSound(const CString &name) { diff --git a/engines/titanic/sound/wave_file.h b/engines/titanic/sound/wave_file.h index 4237f1a203..19d367936f 100644 --- a/engines/titanic/sound/wave_file.h +++ b/engines/titanic/sound/wave_file.h @@ -46,9 +46,11 @@ public:  	~CWaveFile();  	/** -	 * Returns the duration of the wave file in seconds +	 * Returns the duration of the wave file +	 * @returns	Total ticks. Not really sure how ticks +	 * map to real time  	 */ -	uint getDuration() const; +	uint getDurationTicks() const;  	/**  	 * Return the size of the wave file diff --git a/engines/titanic/true_talk/true_talk_manager.cpp b/engines/titanic/true_talk/true_talk_manager.cpp index a3f9523fa2..0e90676eef 100644 --- a/engines/titanic/true_talk/true_talk_manager.cpp +++ b/engines/titanic/true_talk/true_talk_manager.cpp @@ -407,7 +407,7 @@ uint CTrueTalkManager::readDialogueSpeech() {  		CWaveFile *waveFile = _gameManager->_sound.getTrueTalkSound(  			_dialogueFile, _titleEngine._indexes[idx] - _dialogueId);  		if (waveFile) { -			_speechDuration += waveFile->getDuration(); +			_speechDuration += waveFile->getDurationTicks();  		}  	} diff --git a/engines/titanic/true_talk/tt_talker.cpp b/engines/titanic/true_talk/tt_talker.cpp index da7628f483..7e71bfcb77 100644 --- a/engines/titanic/true_talk/tt_talker.cpp +++ b/engines/titanic/true_talk/tt_talker.cpp @@ -27,6 +27,7 @@  namespace Titanic {  void TTtalker::speechStarted(const CString &dialogueStr, uint dialogueId, uint speechHandle) { +	_line = dialogueStr;  	_dialogueId = dialogueId;  	CTrueTalkNotifySpeechStartedMsg msg(speechHandle, dialogueId, 0); | 
