From bb7e9b64b6e8eeeff90b5496a465f62f1bd8e705 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sun, 10 Jul 2016 13:55:51 +0200 Subject: DIRECTOR: Unify dumpScript() signature --- engines/director/lingo/lingo.cpp | 2 -- engines/director/score.cpp | 12 ++++++------ engines/director/score.h | 2 +- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp index a7362d18b9..b9a7488952 100644 --- a/engines/director/lingo/lingo.cpp +++ b/engines/director/lingo/lingo.cpp @@ -101,8 +101,6 @@ Lingo::~Lingo() { } void Lingo::addCode(const char *code, ScriptType type, uint16 id) { - code += '\n'; - debug(2, "Add code \"%s\" for type %d with id %d", code, type, id); if (_scripts[type].contains(id)) { diff --git a/engines/director/score.cpp b/engines/director/score.cpp index 80c7fd7850..6352e432fb 100644 --- a/engines/director/score.cpp +++ b/engines/director/score.cpp @@ -342,7 +342,7 @@ void Score::loadActions(Common::SeekableSubReadStreamEndian &stream) { if (ConfMan.getBool("dump_scripts")) for (j = _actions.begin(); j != _actions.end(); ++j) { if (!j->_value.empty()) - dumpScript(j->_key, kFrameScript, j->_value); + dumpScript(j->_value.c_str(), kFrameScript, j->_key); } for (j = _actions.begin(); j != _actions.end(); ++j) @@ -367,7 +367,7 @@ void Score::loadScriptText(Common::SeekableSubReadStreamEndian &stream) { } if (!script.empty() && ConfMan.getBool("dump_scripts")) - dumpScript(_movieScriptCount, kMovieScript, script); + dumpScript(script.c_str(), kMovieScript, _movieScriptCount); if (!script.empty()) _lingo->addCode(script.c_str(), kMovieScript, _movieScriptCount); @@ -387,7 +387,7 @@ void Score::setStartToLabel(Common::String label) { warning("Label %s not found", label.c_str()); } -void Score::dumpScript(uint16 id, ScriptType type, Common::String script) { +void Score::dumpScript(const char *script, ScriptType type, uint16 id) { Common::DumpFile out; Common::String typeName; char buf[256]; @@ -411,7 +411,7 @@ void Score::dumpScript(uint16 id, ScriptType type, Common::String script) { return; } - out.writeString(script); + out.write(script, strlen(script)); out.flush(); out.close(); @@ -425,7 +425,7 @@ void Score::loadCastInfo(Common::SeekableSubReadStreamEndian &stream, uint16 id) ci->script = castStrings[0]; if (!ci->script.empty() && ConfMan.getBool("dump_scripts")) - dumpScript(id, kSpriteScript, ci->script); + dumpScript(ci->script.c_str(), kSpriteScript, id); if (!ci->script.empty()) _lingo->addCode(ci->script.c_str(), kSpriteScript, id); @@ -521,7 +521,7 @@ void Score::loadFileInfo(Common::SeekableSubReadStreamEndian &stream) { _script = fileInfoStrings[0]; if (!_script.empty() && ConfMan.getBool("dump_scripts")) - dumpScript(_movieScriptCount, kMovieScript, _script); + dumpScript(_script.c_str(), kMovieScript, _movieScriptCount); if (!_script.empty()) _lingo->addCode(_script.c_str(), kMovieScript, _movieScriptCount); diff --git a/engines/director/score.h b/engines/director/score.h index b0164edb86..005e6f82b6 100644 --- a/engines/director/score.h +++ b/engines/director/score.h @@ -375,7 +375,7 @@ private: void loadScriptText(Common::SeekableSubReadStreamEndian &stream); void loadFileInfo(Common::SeekableSubReadStreamEndian &stream); void loadFontMap(Common::SeekableSubReadStreamEndian &stream); - void dumpScript(uint16 id, ScriptType type, Common::String script); + void dumpScript(const char *script, ScriptType type, uint16 id); Common::String getString(Common::String str); Common::Array loadStrings(Common::SeekableSubReadStreamEndian &stream, uint32 &entryType, bool hasHeader = true); -- cgit v1.2.3