forked from mirror/openmw-tes3mp
parent
df3b4fe6a5
commit
60c67bc327
3 changed files with 17 additions and 14 deletions
|
@ -50,7 +50,7 @@ namespace MWBase
|
||||||
|
|
||||||
virtual void goodbye() = 0;
|
virtual void goodbye() = 0;
|
||||||
|
|
||||||
virtual void say(const MWWorld::Ptr &actor, const std::string &topic) const = 0;
|
virtual void say(const MWWorld::Ptr &actor, const std::string &topic) = 0;
|
||||||
|
|
||||||
//calbacks for the GUI
|
//calbacks for the GUI
|
||||||
virtual void keywordSelected (const std::string& keyword) = 0;
|
virtual void keywordSelected (const std::string& keyword) = 0;
|
||||||
|
|
|
@ -171,7 +171,7 @@ namespace MWDialogue
|
||||||
|
|
||||||
MWScript::InterpreterContext interpreterContext(&mActor.getRefData().getLocals(),mActor);
|
MWScript::InterpreterContext interpreterContext(&mActor.getRefData().getLocals(),mActor);
|
||||||
win->addResponse (Interpreter::fixDefinesDialog(info->mResponse, interpreterContext));
|
win->addResponse (Interpreter::fixDefinesDialog(info->mResponse, interpreterContext));
|
||||||
executeScript (info->mResultScript);
|
executeScript (info->mResultScript, mActor);
|
||||||
mLastTopic = Misc::StringUtils::lowerCase(it->mId);
|
mLastTopic = Misc::StringUtils::lowerCase(it->mId);
|
||||||
|
|
||||||
// update topics again to accommodate changes resulting from executeScript
|
// update topics again to accommodate changes resulting from executeScript
|
||||||
|
@ -190,7 +190,7 @@ namespace MWDialogue
|
||||||
MWBase::Environment::get().getWindowManager()->showCompanionWindow(mActor);
|
MWBase::Environment::get().getWindowManager()->showCompanionWindow(mActor);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DialogueManager::compile (const std::string& cmd,std::vector<Interpreter::Type_Code>& code)
|
bool DialogueManager::compile (const std::string& cmd, std::vector<Interpreter::Type_Code>& code, const MWWorld::Ptr& actor)
|
||||||
{
|
{
|
||||||
bool success = true;
|
bool success = true;
|
||||||
|
|
||||||
|
@ -206,7 +206,7 @@ namespace MWDialogue
|
||||||
|
|
||||||
Compiler::Locals locals;
|
Compiler::Locals locals;
|
||||||
|
|
||||||
std::string actorScript = mActor.getClass().getScript (mActor);
|
std::string actorScript = actor.getClass().getScript (actor);
|
||||||
|
|
||||||
if (!actorScript.empty())
|
if (!actorScript.empty())
|
||||||
{
|
{
|
||||||
|
@ -246,14 +246,14 @@ namespace MWDialogue
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DialogueManager::executeScript (const std::string& script)
|
void DialogueManager::executeScript (const std::string& script, const MWWorld::Ptr& actor)
|
||||||
{
|
{
|
||||||
std::vector<Interpreter::Type_Code> code;
|
std::vector<Interpreter::Type_Code> code;
|
||||||
if(compile(script,code))
|
if(compile(script, code, actor))
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
MWScript::InterpreterContext interpreterContext(&mActor.getRefData().getLocals(),mActor);
|
MWScript::InterpreterContext interpreterContext(&actor.getRefData().getLocals(), actor);
|
||||||
Interpreter::Interpreter interpreter;
|
Interpreter::Interpreter interpreter;
|
||||||
MWScript::installOpcodes (interpreter);
|
MWScript::installOpcodes (interpreter);
|
||||||
interpreter.run (&code[0], code.size(), interpreterContext);
|
interpreter.run (&code[0], code.size(), interpreterContext);
|
||||||
|
@ -317,7 +317,7 @@ namespace MWDialogue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
executeScript (info->mResultScript);
|
executeScript (info->mResultScript, mActor);
|
||||||
|
|
||||||
mLastTopic = topic;
|
mLastTopic = topic;
|
||||||
}
|
}
|
||||||
|
@ -500,7 +500,7 @@ namespace MWDialogue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
executeScript (info->mResultScript);
|
executeScript (info->mResultScript, mActor);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -618,13 +618,13 @@ namespace MWDialogue
|
||||||
win->addResponse (Interpreter::fixDefinesDialog(info->mResponse, interpreterContext),
|
win->addResponse (Interpreter::fixDefinesDialog(info->mResponse, interpreterContext),
|
||||||
gmsts.find ("sServiceRefusal")->getString());
|
gmsts.find ("sServiceRefusal")->getString());
|
||||||
|
|
||||||
executeScript (info->mResultScript);
|
executeScript (info->mResultScript, mActor);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DialogueManager::say(const MWWorld::Ptr &actor, const std::string &topic) const
|
void DialogueManager::say(const MWWorld::Ptr &actor, const std::string &topic)
|
||||||
{
|
{
|
||||||
MWBase::SoundManager *sndMgr = MWBase::Environment::get().getSoundManager();
|
MWBase::SoundManager *sndMgr = MWBase::Environment::get().getSoundManager();
|
||||||
if(!sndMgr->sayDone(actor))
|
if(!sndMgr->sayDone(actor))
|
||||||
|
@ -647,6 +647,9 @@ namespace MWDialogue
|
||||||
if (!info->mSound.empty())
|
if (!info->mSound.empty())
|
||||||
sndMgr->say(actor, info->mSound);
|
sndMgr->say(actor, info->mSound);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!info->mResultScript.empty())
|
||||||
|
executeScript(info->mResultScript, actor);
|
||||||
}
|
}
|
||||||
|
|
||||||
int DialogueManager::countSavedGameRecords() const
|
int DialogueManager::countSavedGameRecords() const
|
||||||
|
|
|
@ -51,8 +51,8 @@ namespace MWDialogue
|
||||||
void updateTopics();
|
void updateTopics();
|
||||||
void updateGlobals();
|
void updateGlobals();
|
||||||
|
|
||||||
bool compile (const std::string& cmd,std::vector<Interpreter::Type_Code>& code);
|
bool compile (const std::string& cmd, std::vector<Interpreter::Type_Code>& code, const MWWorld::Ptr& actor);
|
||||||
void executeScript (const std::string& script);
|
void executeScript (const std::string& script, const MWWorld::Ptr& actor);
|
||||||
|
|
||||||
void executeTopic (const std::string& topic);
|
void executeTopic (const std::string& topic);
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ namespace MWDialogue
|
||||||
|
|
||||||
virtual bool checkServiceRefused ();
|
virtual bool checkServiceRefused ();
|
||||||
|
|
||||||
virtual void say(const MWWorld::Ptr &actor, const std::string &topic) const;
|
virtual void say(const MWWorld::Ptr &actor, const std::string &topic);
|
||||||
|
|
||||||
//calbacks for the GUI
|
//calbacks for the GUI
|
||||||
virtual void keywordSelected (const std::string& keyword);
|
virtual void keywordSelected (const std::string& keyword);
|
||||||
|
|
Loading…
Reference in a new issue