DIRECTOR: Unify dumpScript() signature

This commit is contained in:
Eugene Sandulenko 2016-07-10 13:55:51 +02:00
parent 9c8848b8ff
commit bb7e9b64b6
3 changed files with 7 additions and 9 deletions

View File

@ -101,8 +101,6 @@ Lingo::~Lingo() {
} }
void Lingo::addCode(const char *code, ScriptType type, uint16 id) { 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); debug(2, "Add code \"%s\" for type %d with id %d", code, type, id);
if (_scripts[type].contains(id)) { if (_scripts[type].contains(id)) {

View File

@ -342,7 +342,7 @@ void Score::loadActions(Common::SeekableSubReadStreamEndian &stream) {
if (ConfMan.getBool("dump_scripts")) if (ConfMan.getBool("dump_scripts"))
for (j = _actions.begin(); j != _actions.end(); ++j) { for (j = _actions.begin(); j != _actions.end(); ++j) {
if (!j->_value.empty()) 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) 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")) if (!script.empty() && ConfMan.getBool("dump_scripts"))
dumpScript(_movieScriptCount, kMovieScript, script); dumpScript(script.c_str(), kMovieScript, _movieScriptCount);
if (!script.empty()) if (!script.empty())
_lingo->addCode(script.c_str(), kMovieScript, _movieScriptCount); _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()); 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::DumpFile out;
Common::String typeName; Common::String typeName;
char buf[256]; char buf[256];
@ -411,7 +411,7 @@ void Score::dumpScript(uint16 id, ScriptType type, Common::String script) {
return; return;
} }
out.writeString(script); out.write(script, strlen(script));
out.flush(); out.flush();
out.close(); out.close();
@ -425,7 +425,7 @@ void Score::loadCastInfo(Common::SeekableSubReadStreamEndian &stream, uint16 id)
ci->script = castStrings[0]; ci->script = castStrings[0];
if (!ci->script.empty() && ConfMan.getBool("dump_scripts")) if (!ci->script.empty() && ConfMan.getBool("dump_scripts"))
dumpScript(id, kSpriteScript, ci->script); dumpScript(ci->script.c_str(), kSpriteScript, id);
if (!ci->script.empty()) if (!ci->script.empty())
_lingo->addCode(ci->script.c_str(), kSpriteScript, id); _lingo->addCode(ci->script.c_str(), kSpriteScript, id);
@ -521,7 +521,7 @@ void Score::loadFileInfo(Common::SeekableSubReadStreamEndian &stream) {
_script = fileInfoStrings[0]; _script = fileInfoStrings[0];
if (!_script.empty() && ConfMan.getBool("dump_scripts")) if (!_script.empty() && ConfMan.getBool("dump_scripts"))
dumpScript(_movieScriptCount, kMovieScript, _script); dumpScript(_script.c_str(), kMovieScript, _movieScriptCount);
if (!_script.empty()) if (!_script.empty())
_lingo->addCode(_script.c_str(), kMovieScript, _movieScriptCount); _lingo->addCode(_script.c_str(), kMovieScript, _movieScriptCount);

View File

@ -375,7 +375,7 @@ private:
void loadScriptText(Common::SeekableSubReadStreamEndian &stream); void loadScriptText(Common::SeekableSubReadStreamEndian &stream);
void loadFileInfo(Common::SeekableSubReadStreamEndian &stream); void loadFileInfo(Common::SeekableSubReadStreamEndian &stream);
void loadFontMap(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::String getString(Common::String str);
Common::Array<Common::String> loadStrings(Common::SeekableSubReadStreamEndian &stream, uint32 &entryType, bool hasHeader = true); Common::Array<Common::String> loadStrings(Common::SeekableSubReadStreamEndian &stream, uint32 &entryType, bool hasHeader = true);