diff options
author | Eugene Sandulenko | 2016-07-04 19:05:42 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2016-08-03 23:40:36 +0200 |
commit | 7ecc1f8da764f870b033167b5bb68c3a701e2ae7 (patch) | |
tree | 53522748e7b9f330ef436abfa2d9e33a25b28e31 /engines/director/lingo | |
parent | 78555a4d3f77a5e604675416d2d700059faafe9f (diff) | |
download | scummvm-rg350-7ecc1f8da764f870b033167b5bb68c3a701e2ae7.tar.gz scummvm-rg350-7ecc1f8da764f870b033167b5bb68c3a701e2ae7.tar.bz2 scummvm-rg350-7ecc1f8da764f870b033167b5bb68c3a701e2ae7.zip |
DIRECTOR: Lingo: Initial code for processIf()
Diffstat (limited to 'engines/director/lingo')
-rw-r--r-- | engines/director/lingo/lingo-codegen.cpp | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/engines/director/lingo/lingo-codegen.cpp b/engines/director/lingo/lingo-codegen.cpp index 0f47202e9d..47f723f44c 100644 --- a/engines/director/lingo/lingo-codegen.cpp +++ b/engines/director/lingo/lingo-codegen.cpp @@ -188,7 +188,6 @@ void Lingo::codeArg(Common::String *s) { void Lingo::codeArgStore() { while (true) { if (_argstack.empty()) { - warning("Arg stack underflow"); break; } @@ -224,6 +223,30 @@ void Lingo::codeLabel(int label) { } void Lingo::processIf(int endlabel) { + inst ielse1, iend; + int else1 = endlabel; + + WRITE_UINT32(&iend, endlabel); + + while (true) { + if (_labelstack.empty()) { + warning("Label stack underflow"); + break; + } + + int label = _labelstack.back(); + _labelstack.pop_back(); + + // This is beginning of our if() + if (label) + break; + + WRITE_UINT32(&ielse1, else1); + (*_currentScript)[label + 2] = ielse1; /* elsepart */ + (*_currentScript)[label + 3] = iend; /* end, if cond fails */ + + else1 = label; + } } } |