diff options
author | Eugene Sandulenko | 2016-06-18 15:05:09 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2016-08-03 23:40:36 +0200 |
commit | bb7125620d2f0919fcf671b50644af3acef39cbf (patch) | |
tree | 327a2064be02de88fb8d6ab88f1a1bf3f1b213ef /engines/director/lingo/lingo.cpp | |
parent | 9d72e0137b039b77271ff1f084290d647622c0bd (diff) | |
download | scummvm-rg350-bb7125620d2f0919fcf671b50644af3acef39cbf.tar.gz scummvm-rg350-bb7125620d2f0919fcf671b50644af3acef39cbf.tar.bz2 scummvm-rg350-bb7125620d2f0919fcf671b50644af3acef39cbf.zip |
DIRECTOR: Lingo: Move all functions to compiler
Diffstat (limited to 'engines/director/lingo/lingo.cpp')
-rw-r--r-- | engines/director/lingo/lingo.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp index 8341d5a958..c96e353a52 100644 --- a/engines/director/lingo/lingo.cpp +++ b/engines/director/lingo/lingo.cpp @@ -80,6 +80,22 @@ Lingo::Lingo(DirectorEngine *vm) : _vm(vm) { Lingo::~Lingo() { } +int Lingo::codeString(const char *str) { + int instLen = sizeof(inst); + int numInsts = (strlen(str) + 1 + instLen - 1) % instLen; + + // Allocate needed space in script + _currentScript->push_back(0); + char *start = (char *)(&_currentScript->back()); + + for (int i = 0; i < numInsts - 1; i++) + _currentScript->push_back(0); + + Common::strlcpy(start, str, numInsts * instLen); + + return _currentScript->size(); +} + void Lingo::addCode(Common::String code, ScriptType type, uint16 id) { debug(2, "Add code \"%s\" for type %d with id %d", code.c_str(), type, id); |