mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-26 09:35:28 +00:00
one step toward function filters and end choices.
This commit is contained in:
parent
82c6b0f92a
commit
07d8d654cd
@ -56,12 +56,12 @@ namespace
|
|||||||
{
|
{
|
||||||
switch (comp)
|
switch (comp)
|
||||||
{
|
{
|
||||||
case '0': return value1==value2;
|
case '0': return value1==value2;
|
||||||
case '1': return value1!=value2;
|
case '1': return value1!=value2;
|
||||||
case '2': return value1>value2;
|
case '2': return value1>value2;
|
||||||
case '3': return value1>=value2;
|
case '3': return value1>=value2;
|
||||||
case '4': return value1<value2;
|
case '4': return value1<value2;
|
||||||
case '5': return value1<=value2;
|
case '5': return value1<=value2;
|
||||||
}
|
}
|
||||||
|
|
||||||
throw std::runtime_error ("unknown compare type in dialogue info select");
|
throw std::runtime_error ("unknown compare type in dialogue info select");
|
||||||
@ -107,26 +107,26 @@ namespace
|
|||||||
{
|
{
|
||||||
switch (world.getGlobalVariableType (name))
|
switch (world.getGlobalVariableType (name))
|
||||||
{
|
{
|
||||||
case 's':
|
case 's':
|
||||||
|
|
||||||
return selectCompare (comp, value, world.getGlobalVariable (name).mShort);
|
return selectCompare (comp, value, world.getGlobalVariable (name).mShort);
|
||||||
|
|
||||||
case 'l':
|
case 'l':
|
||||||
|
|
||||||
return selectCompare (comp, value, world.getGlobalVariable (name).mLong);
|
return selectCompare (comp, value, world.getGlobalVariable (name).mLong);
|
||||||
|
|
||||||
case 'f':
|
case 'f':
|
||||||
|
|
||||||
return selectCompare (comp, value, world.getGlobalVariable (name).mFloat);
|
return selectCompare (comp, value, world.getGlobalVariable (name).mFloat);
|
||||||
|
|
||||||
case ' ':
|
case ' ':
|
||||||
|
|
||||||
world.getGlobalVariable (name); // trigger exception
|
world.getGlobalVariable (name); // trigger exception
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
||||||
throw std::runtime_error ("unsupported gobal variable type");
|
throw std::runtime_error ("unsupported gobal variable type");
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -142,6 +142,38 @@ namespace MWDialogue
|
|||||||
return toLower(str).find(toLower(substr),pos);
|
return toLower(str).find(toLower(substr),pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool DialogueManager::functionFilter(const MWWorld::Ptr& actor, const ESM::DialInfo& info)
|
||||||
|
{
|
||||||
|
for (std::vector<ESM::DialInfo::SelectStruct>::const_iterator iter (info.selects.begin());
|
||||||
|
iter != info.selects.end(); ++iter)
|
||||||
|
{
|
||||||
|
ESM::DialInfo::SelectStruct select = *iter;
|
||||||
|
char type = select.selectRule[1];
|
||||||
|
if(type == '1')
|
||||||
|
{
|
||||||
|
char comp = select.selectRule[4];
|
||||||
|
std::string name = select.selectRule.substr (5);
|
||||||
|
std::string function = select.selectRule.substr(1,2);
|
||||||
|
std::cout << function;
|
||||||
|
|
||||||
|
int ifunction;
|
||||||
|
std::istringstream iss(function);
|
||||||
|
iss >> ifunction;
|
||||||
|
|
||||||
|
switch(ifunction)
|
||||||
|
{
|
||||||
|
case 4://choice
|
||||||
|
if(!selectCompare(comp,mChoice,select.i)) return false;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool DialogueManager::isMatching (const MWWorld::Ptr& actor,
|
bool DialogueManager::isMatching (const MWWorld::Ptr& actor,
|
||||||
const ESM::DialInfo::SelectStruct& select) const
|
const ESM::DialInfo::SelectStruct& select) const
|
||||||
@ -152,168 +184,170 @@ namespace MWDialogue
|
|||||||
{
|
{
|
||||||
char comp = select.selectRule[4];
|
char comp = select.selectRule[4];
|
||||||
std::string name = select.selectRule.substr (5);
|
std::string name = select.selectRule.substr (5);
|
||||||
|
std::string function = select.selectRule.substr(1,2);
|
||||||
|
std::cout << function;
|
||||||
|
|
||||||
// TODO types 4, 5, 6, 7, 8, 9, A, B, C
|
// TODO types 4, 5, 6, 7, 8, 9, A, B, C
|
||||||
//new TOTO: 5,6,9
|
//new TOTO: 5,6,9
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case '1': // function
|
case '1': // function
|
||||||
|
|
||||||
return false; // TODO implement functions
|
return false; // TODO implement functions
|
||||||
|
|
||||||
case '2': // global
|
case '2': // global
|
||||||
|
|
||||||
if (select.type==ESM::VT_Short || select.type==ESM::VT_Int ||
|
if (select.type==ESM::VT_Short || select.type==ESM::VT_Int ||
|
||||||
select.type==ESM::VT_Long)
|
select.type==ESM::VT_Long)
|
||||||
|
{
|
||||||
|
if (!checkGlobal (comp, toLower (name), select.i, *mEnvironment.mWorld))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else if (select.type==ESM::VT_Float)
|
||||||
|
{
|
||||||
|
if (!checkGlobal (comp, toLower (name), select.f, *mEnvironment.mWorld))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
throw std::runtime_error (
|
||||||
|
"unsupported variable type in dialogue info select");
|
||||||
|
|
||||||
|
return true;
|
||||||
|
|
||||||
|
case '3': // local
|
||||||
|
|
||||||
|
if (select.type==ESM::VT_Short || select.type==ESM::VT_Int ||
|
||||||
|
select.type==ESM::VT_Long)
|
||||||
|
{
|
||||||
|
if (!checkLocal (comp, toLower (name), select.i, actor,
|
||||||
|
mEnvironment.mWorld->getStore()))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else if (select.type==ESM::VT_Float)
|
||||||
|
{
|
||||||
|
if (!checkLocal (comp, toLower (name), select.f, actor,
|
||||||
|
mEnvironment.mWorld->getStore()))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
throw std::runtime_error (
|
||||||
|
"unsupported variable type in dialogue info select");
|
||||||
|
|
||||||
|
return true;
|
||||||
|
|
||||||
|
case '4'://journal
|
||||||
|
if(select.type==ESM::VT_Int)
|
||||||
|
{
|
||||||
|
//std::cout << "vtint: " << select.i << std::endl;
|
||||||
|
bool isInJournal;
|
||||||
|
if(mEnvironment.mJournal->begin()!=mEnvironment.mJournal->end())
|
||||||
{
|
{
|
||||||
if (!checkGlobal (comp, toLower (name), select.i, *mEnvironment.mWorld))
|
for(std::deque<MWDialogue::StampedJournalEntry>::const_iterator it = mEnvironment.mJournal->begin();it!=mEnvironment.mJournal->end();it++)
|
||||||
return false;
|
|
||||||
}
|
|
||||||
else if (select.type==ESM::VT_Float)
|
|
||||||
{
|
|
||||||
if (!checkGlobal (comp, toLower (name), select.f, *mEnvironment.mWorld))
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
throw std::runtime_error (
|
|
||||||
"unsupported variable type in dialogue info select");
|
|
||||||
|
|
||||||
return true;
|
|
||||||
|
|
||||||
case '3': // local
|
|
||||||
|
|
||||||
if (select.type==ESM::VT_Short || select.type==ESM::VT_Int ||
|
|
||||||
select.type==ESM::VT_Long)
|
|
||||||
{
|
|
||||||
if (!checkLocal (comp, toLower (name), select.i, actor,
|
|
||||||
mEnvironment.mWorld->getStore()))
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
else if (select.type==ESM::VT_Float)
|
|
||||||
{
|
|
||||||
if (!checkLocal (comp, toLower (name), select.f, actor,
|
|
||||||
mEnvironment.mWorld->getStore()))
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
throw std::runtime_error (
|
|
||||||
"unsupported variable type in dialogue info select");
|
|
||||||
|
|
||||||
return true;
|
|
||||||
|
|
||||||
case '4'://journal
|
|
||||||
if(select.type==ESM::VT_Int)
|
|
||||||
{
|
|
||||||
//std::cout << "vtint: " << select.i << std::endl;
|
|
||||||
bool isInJournal;
|
|
||||||
if(mEnvironment.mJournal->begin()!=mEnvironment.mJournal->end())
|
|
||||||
{
|
{
|
||||||
for(std::deque<MWDialogue::StampedJournalEntry>::const_iterator it = mEnvironment.mJournal->begin();it!=mEnvironment.mJournal->end();it++)
|
|
||||||
{
|
|
||||||
|
|
||||||
if(it->mTopic == name) isInJournal = true;
|
if(it->mTopic == name) isInJournal = true;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
isInJournal = false;
|
|
||||||
if(!selectCompare<int,int>(comp,int(isInJournal),select.i)) return false;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
throw std::runtime_error (
|
isInJournal = false;
|
||||||
"unsupported variable type in dialogue info select");
|
if(!selectCompare<int,int>(comp,int(isInJournal),select.i)) return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
throw std::runtime_error (
|
||||||
|
"unsupported variable type in dialogue info select");
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case '7':// not ID
|
case '7':// not ID
|
||||||
if(select.type==ESM::VT_String ||select.type==ESM::VT_Int)//bug in morrowind here? it's not a short, it's a string
|
if(select.type==ESM::VT_String ||select.type==ESM::VT_Int)//bug in morrowind here? it's not a short, it's a string
|
||||||
{
|
{
|
||||||
int isID = int(toLower(name)==toLower(MWWorld::Class::get (actor).getId (actor)));
|
int isID = int(toLower(name)==toLower(MWWorld::Class::get (actor).getId (actor)));
|
||||||
if (selectCompare<int,int>(comp,!isID,select.i)) return false;
|
if (selectCompare<int,int>(comp,!isID,select.i)) return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
throw std::runtime_error (
|
throw std::runtime_error (
|
||||||
"unsupported variable type in dialogue info select");
|
"unsupported variable type in dialogue info select");
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case '8':// not faction
|
case '8':// not faction
|
||||||
if(select.type==ESM::VT_Int)
|
if(select.type==ESM::VT_Int)
|
||||||
{
|
{
|
||||||
ESMS::LiveCellRef<ESM::NPC, MWWorld::RefData>* npc = actor.get<ESM::NPC>();
|
ESMS::LiveCellRef<ESM::NPC, MWWorld::RefData>* npc = actor.get<ESM::NPC>();
|
||||||
int isFaction = int(toLower(npc->base->faction) == toLower(name));
|
int isFaction = int(toLower(npc->base->faction) == toLower(name));
|
||||||
if(selectCompare<int,int>(comp,!isFaction,select.i))
|
if(selectCompare<int,int>(comp,!isFaction,select.i))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
throw std::runtime_error (
|
throw std::runtime_error (
|
||||||
"unsupported variable type in dialogue info select");
|
"unsupported variable type in dialogue info select");
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case '9':// not class
|
case '9':// not class
|
||||||
if(select.type==ESM::VT_Int)
|
if(select.type==ESM::VT_Int)
|
||||||
{
|
{
|
||||||
ESMS::LiveCellRef<ESM::NPC, MWWorld::RefData>* npc = actor.get<ESM::NPC>();
|
ESMS::LiveCellRef<ESM::NPC, MWWorld::RefData>* npc = actor.get<ESM::NPC>();
|
||||||
int isClass = int(toLower(npc->base->cls) == toLower(name));
|
int isClass = int(toLower(npc->base->cls) == toLower(name));
|
||||||
if(selectCompare<int,int>(comp,!isClass,select.i))
|
if(selectCompare<int,int>(comp,!isClass,select.i))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
throw std::runtime_error (
|
throw std::runtime_error (
|
||||||
"unsupported variable type in dialogue info select");
|
"unsupported variable type in dialogue info select");
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case 'A'://not Race
|
case 'A'://not Race
|
||||||
if(select.type==ESM::VT_Int)
|
if(select.type==ESM::VT_Int)
|
||||||
{
|
{
|
||||||
ESMS::LiveCellRef<ESM::NPC, MWWorld::RefData>* npc = actor.get<ESM::NPC>();
|
ESMS::LiveCellRef<ESM::NPC, MWWorld::RefData>* npc = actor.get<ESM::NPC>();
|
||||||
int isRace = int(toLower(npc->base->race) == toLower(name));
|
int isRace = int(toLower(npc->base->race) == toLower(name));
|
||||||
//std::cout << "isRace"<<isRace; mEnvironment.mWorld
|
//std::cout << "isRace"<<isRace; mEnvironment.mWorld
|
||||||
if(selectCompare<int,int>(comp,!isRace,select.i))
|
if(selectCompare<int,int>(comp,!isRace,select.i))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
throw std::runtime_error (
|
throw std::runtime_error (
|
||||||
"unsupported variable type in dialogue info select");
|
"unsupported variable type in dialogue info select");
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case 'B'://not Cell
|
case 'B'://not Cell
|
||||||
if(select.type==ESM::VT_Int)
|
if(select.type==ESM::VT_Int)
|
||||||
{
|
{
|
||||||
int isCell = int(toLower(actor.getCell()->cell->name) == toLower(name));
|
int isCell = int(toLower(actor.getCell()->cell->name) == toLower(name));
|
||||||
if(selectCompare<int,int>(comp,!isCell,select.i))
|
if(selectCompare<int,int>(comp,!isCell,select.i))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
throw std::runtime_error (
|
throw std::runtime_error (
|
||||||
"unsupported variable type in dialogue info select");
|
"unsupported variable type in dialogue info select");
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case 'C'://not local
|
case 'C'://not local
|
||||||
if (select.type==ESM::VT_Short || select.type==ESM::VT_Int ||
|
if (select.type==ESM::VT_Short || select.type==ESM::VT_Int ||
|
||||||
select.type==ESM::VT_Long)
|
select.type==ESM::VT_Long)
|
||||||
{
|
{
|
||||||
if (checkLocal (comp, toLower (name), select.i, actor,
|
if (checkLocal (comp, toLower (name), select.i, actor,
|
||||||
mEnvironment.mWorld->getStore()))
|
mEnvironment.mWorld->getStore()))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else if (select.type==ESM::VT_Float)
|
else if (select.type==ESM::VT_Float)
|
||||||
{
|
{
|
||||||
if (checkLocal (comp, toLower (name), select.f, actor,
|
if (checkLocal (comp, toLower (name), select.f, actor,
|
||||||
mEnvironment.mWorld->getStore()))
|
mEnvironment.mWorld->getStore()))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
throw std::runtime_error (
|
throw std::runtime_error (
|
||||||
"unsupported variable type in dialogue info select");
|
"unsupported variable type in dialogue info select");
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
||||||
std::cout << "unchecked select: " << type << " " << comp << " " << name << std::endl;
|
std::cout << "unchecked select: " << type << " " << comp << " " << name << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -401,12 +435,12 @@ namespace MWDialogue
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
/*std::cout
|
/*std::cout
|
||||||
<< "unchecked entries:" << std::endl
|
<< "unchecked entries:" << std::endl
|
||||||
<< " player faction: " << info.pcFaction << std::endl
|
<< " player faction: " << info.pcFaction << std::endl
|
||||||
<< " disposition: " << info.data.disposition << std::endl
|
<< " disposition: " << info.data.disposition << std::endl
|
||||||
<< " NPC rank: " << static_cast<int> (info.data.rank) << std::endl
|
<< " NPC rank: " << static_cast<int> (info.data.rank) << std::endl
|
||||||
<< " gender: " << static_cast<int> (info.data.gender) << std::endl
|
<< " gender: " << static_cast<int> (info.data.gender) << std::endl
|
||||||
<< " PC rank: " << static_cast<int> (info.data.PCrank) << std::endl;*/
|
<< " PC rank: " << static_cast<int> (info.data.PCrank) << std::endl;*/
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -415,6 +449,7 @@ namespace MWDialogue
|
|||||||
mEnvironment (environment),mCompilerContext (MWScript::CompilerContext::Type_Dialgoue, environment),
|
mEnvironment (environment),mCompilerContext (MWScript::CompilerContext::Type_Dialgoue, environment),
|
||||||
mErrorStream(std::cout.rdbuf()),mErrorHandler(mErrorStream)
|
mErrorStream(std::cout.rdbuf()),mErrorHandler(mErrorStream)
|
||||||
{
|
{
|
||||||
|
mChoice = -1;
|
||||||
mCompilerContext.setExtensions (&extensions);
|
mCompilerContext.setExtensions (&extensions);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -425,24 +460,27 @@ namespace MWDialogue
|
|||||||
|
|
||||||
void DialogueManager::parseText(std::string text)
|
void DialogueManager::parseText(std::string text)
|
||||||
{
|
{
|
||||||
std::map<std::string,ESM::DialInfo>::iterator it;
|
std::map<std::string,std::list<ESM::DialInfo>>::iterator it;
|
||||||
for(it = actorKnownTopics.begin();it != actorKnownTopics.end();it++)
|
for(it = actorKnownTopics.begin();it != actorKnownTopics.end();it++)
|
||||||
{
|
{
|
||||||
MWGui::DialogueWindow* win = mEnvironment.mWindowManager->getDialogueWindow();
|
MWGui::DialogueWindow* win = mEnvironment.mWindowManager->getDialogueWindow();
|
||||||
size_t pos = find_str_ci(text,it->first,0);
|
size_t pos = find_str_ci(text,it->first,0);
|
||||||
if(pos !=std::string::npos)
|
if(pos !=std::string::npos)
|
||||||
{
|
{
|
||||||
if(pos==0)
|
if(!it->second.empty())
|
||||||
{
|
{
|
||||||
//std::cout << "fouuuuuuuuuuund";
|
if(pos==0)
|
||||||
knownTopics[it->first] = true;
|
{
|
||||||
win->addKeyword(it->first,it->second.response);
|
//std::cout << "fouuuuuuuuuuund";
|
||||||
}
|
knownTopics[it->first] = true;
|
||||||
else if(text.substr(pos -1,1) == " ")
|
win->addKeyword(it->first,it->second.front().response);
|
||||||
{
|
}
|
||||||
//std::cout << "fouuuuuuuuuuund";
|
else if(text.substr(pos -1,1) == " ")
|
||||||
knownTopics[it->first] = true;
|
{
|
||||||
win->addKeyword(it->first,it->second.response);
|
//std::cout << "fouuuuuuuuuuund";
|
||||||
|
knownTopics[it->first] = true;
|
||||||
|
win->addKeyword(it->first,it->second.front().response);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -472,14 +510,14 @@ namespace MWDialogue
|
|||||||
{
|
{
|
||||||
if (isMatching (actor, *iter))
|
if (isMatching (actor, *iter))
|
||||||
{
|
{
|
||||||
actorKnownTopics[it->first] = *iter;
|
actorKnownTopics[it->first].push_back(*iter);
|
||||||
if(knownTopics.find(toLower(it->first)) != knownTopics.end())
|
if(knownTopics.find(toLower(it->first)) != knownTopics.end())
|
||||||
{
|
{
|
||||||
MWGui::DialogueWindow* win = mEnvironment.mWindowManager->getDialogueWindow();
|
MWGui::DialogueWindow* win = mEnvironment.mWindowManager->getDialogueWindow();
|
||||||
win->addKeyword(it->first,iter->response);
|
win->addKeyword(it->first,iter->response);
|
||||||
//std::cout << it->first;
|
//std::cout << it->first;
|
||||||
//std::cout << "match found!!";
|
//std::cout << "match found!!";
|
||||||
break;
|
//break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -585,10 +623,21 @@ namespace MWDialogue
|
|||||||
|
|
||||||
void DialogueManager::keywordSelected(std::string keyword)
|
void DialogueManager::keywordSelected(std::string keyword)
|
||||||
{
|
{
|
||||||
std::string text = actorKnownTopics[keyword].response;
|
if(!actorKnownTopics[keyword].empty())
|
||||||
std::string script = actorKnownTopics[keyword].resultScript;
|
{
|
||||||
parseText(text);
|
for(std::list<ESM::DialInfo>::iterator it = actorKnownTopics[keyword].begin(); it != actorKnownTopics[keyword].end();it++)
|
||||||
executeScript(script);
|
{
|
||||||
|
ESM::DialInfo dial = *it;
|
||||||
|
if(functionFilter(mActor,dial))
|
||||||
|
{
|
||||||
|
std::string text = actorKnownTopics[keyword].front().response;
|
||||||
|
std::string script = actorKnownTopics[keyword].front().resultScript;
|
||||||
|
parseText(text);
|
||||||
|
executeScript(script);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DialogueManager::goodbyeSelected()
|
void DialogueManager::goodbyeSelected()
|
||||||
@ -598,7 +647,7 @@ namespace MWDialogue
|
|||||||
|
|
||||||
void DialogueManager::questionAnswered(std::string answere)
|
void DialogueManager::questionAnswered(std::string answere)
|
||||||
{
|
{
|
||||||
std::cout << "and the ansere is..."<< answere;
|
std::cout << "and the ansere is..."<< answere;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DialogueManager::printError(std::string error)
|
void DialogueManager::printError(std::string error)
|
||||||
|
@ -26,10 +26,12 @@ namespace MWDialogue
|
|||||||
|
|
||||||
bool isMatching (const MWWorld::Ptr& actor, const ESM::DialInfo& info) const;
|
bool isMatching (const MWWorld::Ptr& actor, const ESM::DialInfo& info) const;
|
||||||
|
|
||||||
|
bool functionFilter(const MWWorld::Ptr& actor, const ESM::DialInfo& info);
|
||||||
|
|
||||||
void parseText(std::string text);
|
void parseText(std::string text);
|
||||||
|
|
||||||
std::map<std::string,bool> knownTopics;// Those are the topics the player knows.
|
std::map<std::string,bool> knownTopics;// Those are the topics the player knows.
|
||||||
std::map<std::string,ESM::DialInfo> actorKnownTopics;
|
std::map<std::string,std::list<ESM::DialInfo>> actorKnownTopics;
|
||||||
|
|
||||||
MWScript::CompilerContext mCompilerContext;
|
MWScript::CompilerContext mCompilerContext;
|
||||||
std::ostream mErrorStream;
|
std::ostream mErrorStream;
|
||||||
@ -42,6 +44,8 @@ namespace MWDialogue
|
|||||||
|
|
||||||
void printError(std::string error);
|
void printError(std::string error);
|
||||||
|
|
||||||
|
int mChoice;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
DialogueManager (MWWorld::Environment& environment,const Compiler::Extensions& extensions);
|
DialogueManager (MWWorld::Environment& environment,const Compiler::Extensions& extensions);
|
||||||
|
@ -84,8 +84,8 @@ void DialogueWindow::onHistoryClicked(MyGUI::Widget* _sender)
|
|||||||
//std::cout << "Clicked on key: " << key << std::endl;
|
//std::cout << "Clicked on key: " << key << std::endl;
|
||||||
if(color == "#686EBA")
|
if(color == "#686EBA")
|
||||||
{
|
{
|
||||||
mEnvironment.mDialogueManager->keywordSelected(lower_string(key));
|
|
||||||
displayTopicText(lower_string(key));
|
displayTopicText(lower_string(key));
|
||||||
|
mEnvironment.mDialogueManager->keywordSelected(lower_string(key));
|
||||||
}
|
}
|
||||||
if(color == "#572D21")
|
if(color == "#572D21")
|
||||||
{
|
{
|
||||||
@ -117,8 +117,8 @@ void DialogueWindow::onSelectTopic(MyGUI::List* _sender, size_t _index)
|
|||||||
if (_index == MyGUI::ITEM_NONE)
|
if (_index == MyGUI::ITEM_NONE)
|
||||||
return;
|
return;
|
||||||
std::string topic = _sender->getItem(_index);
|
std::string topic = _sender->getItem(_index);
|
||||||
mEnvironment.mDialogueManager->keywordSelected(lower_string(topic));
|
|
||||||
displayTopicText(topic);
|
displayTopicText(topic);
|
||||||
|
mEnvironment.mDialogueManager->keywordSelected(lower_string(topic));
|
||||||
|
|
||||||
//const std::string* theTopic = topicsList->getItemDataAt<std::string>(_index);
|
//const std::string* theTopic = topicsList->getItemDataAt<std::string>(_index);
|
||||||
//std::cout << "Selected: "<< theTopic << std::endl;
|
//std::cout << "Selected: "<< theTopic << std::endl;
|
||||||
|
@ -95,7 +95,8 @@ namespace MWScript
|
|||||||
|
|
||||||
virtual void execute (Interpreter::Runtime& runtime, unsigned int arg0)
|
virtual void execute (Interpreter::Runtime& runtime, unsigned int arg0)
|
||||||
{
|
{
|
||||||
std::cout << "CHOICECHOICEHOCQSCHQSHD";
|
std::cout << "CHOICE" << arg0;
|
||||||
|
arg0 = 4;
|
||||||
MWScript::InterpreterContext& context
|
MWScript::InterpreterContext& context
|
||||||
= static_cast<MWScript::InterpreterContext&> (runtime.getContext());
|
= static_cast<MWScript::InterpreterContext&> (runtime.getContext());
|
||||||
MWDialogue::DialogueManager* dialogue = context.getEnvironment().mDialogueManager;
|
MWDialogue::DialogueManager* dialogue = context.getEnvironment().mDialogueManager;
|
||||||
@ -130,7 +131,7 @@ namespace MWScript
|
|||||||
extensions.registerInstruction ("setjournalindex", "cl", opcodeSetJournalIndex);
|
extensions.registerInstruction ("setjournalindex", "cl", opcodeSetJournalIndex);
|
||||||
extensions.registerFunction ("getjournalindex", 'l', "c", opcodeGetJournalIndex);
|
extensions.registerFunction ("getjournalindex", 'l', "c", opcodeGetJournalIndex);
|
||||||
extensions.registerInstruction ("addtopic", "S" , opcodeAddTopic);
|
extensions.registerInstruction ("addtopic", "S" , opcodeAddTopic);
|
||||||
extensions.registerInstruction ("choice", "clcl", opcodeChoice);
|
extensions.registerInstruction ("choice", "/SlSl", opcodeChoice);
|
||||||
}
|
}
|
||||||
|
|
||||||
void installOpcodes (Interpreter::Interpreter& interpreter)
|
void installOpcodes (Interpreter::Interpreter& interpreter)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user