mirror of
https://github.com/OpenMW/openmw.git
synced 2025-03-03 21:39:41 +00:00
added support for targeted scripts to script compiler
This commit is contained in:
parent
75ab8de3d2
commit
e8322da663
3 changed files with 19 additions and 12 deletions
|
@ -300,9 +300,9 @@ namespace
|
||||||
code.push_back (Compiler::Generator::segment5 (46));
|
code.push_back (Compiler::Generator::segment5 (46));
|
||||||
}
|
}
|
||||||
|
|
||||||
void opStartScript (Compiler::Generator::CodeContainer& code)
|
void opStartScript (Compiler::Generator::CodeContainer& code, bool targeted)
|
||||||
{
|
{
|
||||||
code.push_back (Compiler::Generator::segment5 (47));
|
code.push_back (Compiler::Generator::segment5 (targeted ? 71 : 47));
|
||||||
}
|
}
|
||||||
|
|
||||||
void opStopScript (Compiler::Generator::CodeContainer& code)
|
void opStopScript (Compiler::Generator::CodeContainer& code)
|
||||||
|
@ -830,9 +830,16 @@ namespace Compiler
|
||||||
opScriptRunning (code);
|
opScriptRunning (code);
|
||||||
}
|
}
|
||||||
|
|
||||||
void startScript (CodeContainer& code)
|
void startScript (CodeContainer& code, Literals& literals, const std::string& id)
|
||||||
{
|
{
|
||||||
opStartScript (code);
|
if (id.empty())
|
||||||
|
opStartScript (code, false);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int index = literals.addString (id);
|
||||||
|
opPushInt (code, index);
|
||||||
|
opStartScript (code, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void stopScript (CodeContainer& code)
|
void stopScript (CodeContainer& code)
|
||||||
|
|
|
@ -113,7 +113,7 @@ namespace Compiler
|
||||||
|
|
||||||
void scriptRunning (CodeContainer& code);
|
void scriptRunning (CodeContainer& code);
|
||||||
|
|
||||||
void startScript (CodeContainer& code);
|
void startScript (CodeContainer& code, Literals& literals, const std::string& id);
|
||||||
|
|
||||||
void stopScript (CodeContainer& code);
|
void stopScript (CodeContainer& code);
|
||||||
|
|
||||||
|
|
|
@ -262,6 +262,13 @@ namespace Compiler
|
||||||
Generator::disable (mCode, mLiterals, mExplicit);
|
Generator::disable (mCode, mLiterals, mExplicit);
|
||||||
mState = PotentialEndState;
|
mState = PotentialEndState;
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
case Scanner::K_startscript:
|
||||||
|
|
||||||
|
mExprParser.parseArguments ("c", scanner, mCode);
|
||||||
|
Generator::startScript (mCode, mLiterals, mExplicit);
|
||||||
|
mState = EndState;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// check for custom extensions
|
// check for custom extensions
|
||||||
|
@ -361,13 +368,6 @@ namespace Compiler
|
||||||
mState = EndState;
|
mState = EndState;
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case Scanner::K_startscript:
|
|
||||||
|
|
||||||
mExprParser.parseArguments ("c", scanner, mCode);
|
|
||||||
Generator::startScript (mCode);
|
|
||||||
mState = EndState;
|
|
||||||
return true;
|
|
||||||
|
|
||||||
case Scanner::K_stopscript:
|
case Scanner::K_stopscript:
|
||||||
|
|
||||||
mExprParser.parseArguments ("c", scanner, mCode);
|
mExprParser.parseArguments ("c", scanner, mCode);
|
||||||
|
|
Loading…
Reference in a new issue