mirror of
https://github.com/OpenMW/openmw.git
synced 2025-06-20 21:11:33 +00:00
Merge remote branch 'gus/DialogueSystem' into dialogue
This commit is contained in:
commit
d9945a976d
15 changed files with 500 additions and 53 deletions
|
@ -9,6 +9,7 @@
|
||||||
|
|
||||||
#include <components/esm_store/store.hpp>
|
#include <components/esm_store/store.hpp>
|
||||||
|
|
||||||
|
|
||||||
#include "../mwworld/class.hpp"
|
#include "../mwworld/class.hpp"
|
||||||
#include "../mwworld/environment.hpp"
|
#include "../mwworld/environment.hpp"
|
||||||
#include "../mwworld/world.hpp"
|
#include "../mwworld/world.hpp"
|
||||||
|
@ -16,6 +17,10 @@
|
||||||
#include "../mwworld/player.hpp"
|
#include "../mwworld/player.hpp"
|
||||||
|
|
||||||
#include "../mwinput/inputmanager.hpp"
|
#include "../mwinput/inputmanager.hpp"
|
||||||
|
#include "../mwgui/dialogue.hpp"
|
||||||
|
#include "../mwgui/window_manager.hpp"
|
||||||
|
|
||||||
|
#include "journal.hpp"
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
|
@ -31,6 +36,7 @@ namespace
|
||||||
return lowerCase;
|
return lowerCase;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<typename T1, typename T2>
|
template<typename T1, typename T2>
|
||||||
bool selectCompare (char comp, T1 value1, T2 value2)
|
bool selectCompare (char comp, T1 value1, T2 value2)
|
||||||
{
|
{
|
||||||
|
@ -115,6 +121,14 @@ namespace
|
||||||
|
|
||||||
namespace MWDialogue
|
namespace MWDialogue
|
||||||
{
|
{
|
||||||
|
|
||||||
|
//helper function
|
||||||
|
std::string::size_type find_str_ci(const std::string& str, const std::string& substr,size_t pos)
|
||||||
|
{
|
||||||
|
return toLower(str).find(toLower(substr),pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
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
|
||||||
{
|
{
|
||||||
|
@ -126,7 +140,7 @@ namespace MWDialogue
|
||||||
std::string name = select.selectRule.substr (5);
|
std::string name = select.selectRule.substr (5);
|
||||||
|
|
||||||
// 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
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case '1': // function
|
case '1': // function
|
||||||
|
@ -173,6 +187,116 @@ namespace MWDialogue
|
||||||
|
|
||||||
return true;
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
isInJournal = false;
|
||||||
|
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;
|
||||||
|
|
||||||
|
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
|
||||||
|
{
|
||||||
|
int isID = int(toLower(name)==toLower(MWWorld::Class::get (actor).getId (actor)));
|
||||||
|
if (selectCompare<int,int>(comp,!isID,select.i)) return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
throw std::runtime_error (
|
||||||
|
"unsupported variable type in dialogue info select");
|
||||||
|
|
||||||
|
return true;
|
||||||
|
|
||||||
|
case '8':// not faction
|
||||||
|
if(select.type==ESM::VT_Int)
|
||||||
|
{
|
||||||
|
ESMS::LiveCellRef<ESM::NPC, MWWorld::RefData>* npc = actor.get<ESM::NPC>();
|
||||||
|
int isFaction = int(toLower(npc->base->faction) == toLower(name));
|
||||||
|
if(selectCompare<int,int>(comp,!isFaction,select.i))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
throw std::runtime_error (
|
||||||
|
"unsupported variable type in dialogue info select");
|
||||||
|
|
||||||
|
return true;
|
||||||
|
|
||||||
|
case '9':// not class
|
||||||
|
if(select.type==ESM::VT_Int)
|
||||||
|
{
|
||||||
|
ESMS::LiveCellRef<ESM::NPC, MWWorld::RefData>* npc = actor.get<ESM::NPC>();
|
||||||
|
int isClass = int(toLower(npc->base->cls) == toLower(name));
|
||||||
|
if(selectCompare<int,int>(comp,!isClass,select.i))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
throw std::runtime_error (
|
||||||
|
"unsupported variable type in dialogue info select");
|
||||||
|
|
||||||
|
return true;
|
||||||
|
|
||||||
|
case 'A'://not Race
|
||||||
|
if(select.type==ESM::VT_Int)
|
||||||
|
{
|
||||||
|
ESMS::LiveCellRef<ESM::NPC, MWWorld::RefData>* npc = actor.get<ESM::NPC>();
|
||||||
|
int isRace = int(toLower(npc->base->race) == toLower(name));
|
||||||
|
//std::cout << "isRace"<<isRace; mEnvironment.mWorld
|
||||||
|
if(selectCompare<int,int>(comp,!isRace,select.i))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
throw std::runtime_error (
|
||||||
|
"unsupported variable type in dialogue info select");
|
||||||
|
|
||||||
|
return true;
|
||||||
|
|
||||||
|
case 'B'://not Cell
|
||||||
|
if(select.type==ESM::VT_Int)
|
||||||
|
{
|
||||||
|
int isCell = int(toLower(actor.getCell()->cell->name) == toLower(name));
|
||||||
|
if(selectCompare<int,int>(comp,!isCell,select.i))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
throw std::runtime_error (
|
||||||
|
"unsupported variable type in dialogue info select");
|
||||||
|
return true;
|
||||||
|
|
||||||
|
case 'C'://not 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;
|
||||||
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
||||||
std::cout << "unchecked select: " << type << " " << comp << " " << name << std::endl;
|
std::cout << "unchecked select: " << type << " " << comp << " " << name << std::endl;
|
||||||
|
@ -184,11 +308,13 @@ namespace MWDialogue
|
||||||
|
|
||||||
bool DialogueManager::isMatching (const MWWorld::Ptr& actor, const ESM::DialInfo& info) const
|
bool DialogueManager::isMatching (const MWWorld::Ptr& actor, const ESM::DialInfo& info) const
|
||||||
{
|
{
|
||||||
|
//bool return true;//does the actor knows the topic?
|
||||||
// actor id
|
// actor id
|
||||||
if (!info.actor.empty())
|
if (!info.actor.empty())
|
||||||
if (toLower (info.actor)!=MWWorld::Class::get (actor).getId (actor))
|
if (toLower (info.actor)!=MWWorld::Class::get (actor).getId (actor))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
//NPC race
|
||||||
if (!info.race.empty())
|
if (!info.race.empty())
|
||||||
{
|
{
|
||||||
ESMS::LiveCellRef<ESM::NPC, MWWorld::RefData> *cellRef = actor.get<ESM::NPC>();
|
ESMS::LiveCellRef<ESM::NPC, MWWorld::RefData> *cellRef = actor.get<ESM::NPC>();
|
||||||
|
@ -200,6 +326,7 @@ namespace MWDialogue
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//NPC class
|
||||||
if (!info.clas.empty())
|
if (!info.clas.empty())
|
||||||
{
|
{
|
||||||
ESMS::LiveCellRef<ESM::NPC, MWWorld::RefData> *cellRef = actor.get<ESM::NPC>();
|
ESMS::LiveCellRef<ESM::NPC, MWWorld::RefData> *cellRef = actor.get<ESM::NPC>();
|
||||||
|
@ -211,6 +338,7 @@ namespace MWDialogue
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//NPC faction
|
||||||
if (!info.npcFaction.empty())
|
if (!info.npcFaction.empty())
|
||||||
{
|
{
|
||||||
ESMS::LiveCellRef<ESM::NPC, MWWorld::RefData> *cellRef = actor.get<ESM::NPC>();
|
ESMS::LiveCellRef<ESM::NPC, MWWorld::RefData> *cellRef = actor.get<ESM::NPC>();
|
||||||
|
@ -220,10 +348,32 @@ namespace MWDialogue
|
||||||
|
|
||||||
if (toLower (info.npcFaction)!=toLower (cellRef->base->faction))
|
if (toLower (info.npcFaction)!=toLower (cellRef->base->faction))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
//check NPC rank
|
||||||
|
if(cellRef->base->npdt52.gold != -10)
|
||||||
|
{
|
||||||
|
if(cellRef->base->npdt52.rank < info.data.rank) return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(cellRef->base->npdt12.rank < info.data.rank) return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO check player faction
|
// TODO check player faction
|
||||||
|
|
||||||
|
//check gender
|
||||||
|
ESMS::LiveCellRef<ESM::NPC, MWWorld::RefData>* npc = actor.get<ESM::NPC>();
|
||||||
|
if(npc->base->flags&npc->base->Female)
|
||||||
|
{
|
||||||
|
if(static_cast<int> (info.data.gender)==0) return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(static_cast<int> (info.data.gender)==1) return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// check cell
|
// check cell
|
||||||
if (!info.cell.empty())
|
if (!info.cell.empty())
|
||||||
if (mEnvironment.mWorld->getPlayer().getPlayer().getCell()->cell->name != info.cell)
|
if (mEnvironment.mWorld->getPlayer().getPlayer().getCell()->cell->name != info.cell)
|
||||||
|
@ -236,35 +386,72 @@ namespace MWDialogue
|
||||||
if (!isMatching (actor, *iter))
|
if (!isMatching (actor, *iter))
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
DialogueManager::DialogueManager (MWWorld::Environment& environment) : mEnvironment (environment) {}
|
DialogueManager::DialogueManager (MWWorld::Environment& environment) : mEnvironment (environment) {}
|
||||||
|
|
||||||
|
void DialogueManager::addTopic(std::string topic)
|
||||||
|
{
|
||||||
|
knownTopics[toLower(topic)] = true;
|
||||||
|
}
|
||||||
|
|
||||||
void DialogueManager::startDialogue (const MWWorld::Ptr& actor)
|
void DialogueManager::startDialogue (const MWWorld::Ptr& actor)
|
||||||
{
|
{
|
||||||
std::cout << "talking with " << MWWorld::Class::get (actor).getName (actor) << std::endl;
|
std::cout << "talking with " << MWWorld::Class::get (actor).getName (actor) << std::endl;
|
||||||
|
|
||||||
const ESM::Dialogue *dialogue = mEnvironment.mWorld->getStore().dialogs.find ("hello");
|
//initialise the GUI
|
||||||
|
mEnvironment.mInputManager->setGuiMode(MWGui::GM_Dialogue);
|
||||||
|
MWGui::DialogueWindow* win = mEnvironment.mWindowManager->getDialogueWindow();
|
||||||
|
win->startDialogue(MWWorld::Class::get (actor).getName (actor));
|
||||||
|
|
||||||
for (std::vector<ESM::DialInfo>::const_iterator iter (dialogue->mInfo.begin());
|
actorKnownTopics.clear();
|
||||||
iter!=dialogue->mInfo.end(); ++iter)
|
ESMS::RecListT<ESM::Dialogue>::MapType dialogueList = mEnvironment.mWorld->getStore().dialogs.list;
|
||||||
|
for(ESMS::RecListT<ESM::Dialogue>::MapType::iterator it = dialogueList.begin(); it!=dialogueList.end();it++)
|
||||||
|
{
|
||||||
|
ESM::Dialogue ndialogue = it->second;
|
||||||
|
if(ndialogue.type == ESM::Dialogue::Type::Topic)
|
||||||
|
{
|
||||||
|
for (std::vector<ESM::DialInfo>::const_iterator iter (it->second.mInfo.begin());
|
||||||
|
iter!=it->second.mInfo.end(); ++iter)
|
||||||
{
|
{
|
||||||
if (isMatching (actor, *iter))
|
if (isMatching (actor, *iter))
|
||||||
{
|
{
|
||||||
// start dialogue
|
actorKnownTopics[it->first] = iter->response;
|
||||||
std::cout << "found matching info record" << std::endl;
|
if(knownTopics.find(toLower(it->first)) != knownTopics.end())
|
||||||
|
{
|
||||||
std::cout << "response: " << iter->response << std::endl;
|
MWGui::DialogueWindow* win = mEnvironment.mWindowManager->getDialogueWindow();
|
||||||
|
win->addKeyword(it->first,iter->response);
|
||||||
|
//std::cout << it->first;
|
||||||
|
//std::cout << "match found!!";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//ESMS::RecListT<ESM::Dialogue>::MapType dialogueList = mEnvironment.mWorld->getStore().dialogs.list;
|
||||||
|
|
||||||
|
bool greetingFound = false;
|
||||||
|
for(ESMS::RecListT<ESM::Dialogue>::MapType::iterator it = dialogueList.begin(); it!=dialogueList.end();it++)
|
||||||
|
{
|
||||||
|
ESM::Dialogue ndialogue = it->second;
|
||||||
|
if(ndialogue.type == ESM::Dialogue::Type::Greeting)
|
||||||
|
{
|
||||||
|
if (greetingFound) break;
|
||||||
|
for (std::vector<ESM::DialInfo>::const_iterator iter (it->second.mInfo.begin());
|
||||||
|
iter!=it->second.mInfo.end(); ++iter)
|
||||||
|
{
|
||||||
|
if (isMatching (actor, *iter))
|
||||||
|
{
|
||||||
if (!iter->sound.empty())
|
if (!iter->sound.empty())
|
||||||
{
|
{
|
||||||
// TODO play sound
|
// TODO play sound
|
||||||
|
@ -272,14 +459,53 @@ namespace MWDialogue
|
||||||
|
|
||||||
if (!iter->resultScript.empty())
|
if (!iter->resultScript.empty())
|
||||||
{
|
{
|
||||||
std::cout << "script: " << iter->resultScript << std::endl;
|
//std::cout << "script: " << iter->resultScript << std::endl;
|
||||||
// TODO execute script
|
// TODO execute script
|
||||||
}
|
}
|
||||||
|
std::string text = iter->response;
|
||||||
mEnvironment.mInputManager->setGuiMode(MWGui::GM_Dialogue);
|
std::map<std::string,std::string>::iterator it;
|
||||||
|
for(it = actorKnownTopics.begin();it != actorKnownTopics.end();it++)
|
||||||
|
{
|
||||||
|
if(find_str_ci(text,it->first,0) !=std::string::npos)
|
||||||
|
{
|
||||||
|
//std::cout << "fouuuuuuuuuuund";
|
||||||
|
knownTopics[it->first] = true;
|
||||||
|
MWGui::DialogueWindow* win2 = mEnvironment.mWindowManager->getDialogueWindow();
|
||||||
|
win2->addKeyword(it->first,it->second);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
win->addText(iter->response);
|
||||||
|
greetingFound = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void DialogueManager::keywordSelected(std::string keyword)
|
||||||
|
{
|
||||||
|
std::string text = actorKnownTopics[keyword];
|
||||||
|
std::map<std::string,std::string>::iterator it;
|
||||||
|
for(it = actorKnownTopics.begin();it != actorKnownTopics.end();it++)
|
||||||
|
{
|
||||||
|
if(find_str_ci(text,it->first,0) !=std::string::npos)
|
||||||
|
{
|
||||||
|
knownTopics[it->first] = true;
|
||||||
|
MWGui::DialogueWindow* win = mEnvironment.mWindowManager->getDialogueWindow();
|
||||||
|
win->addKeyword(it->first,it->second);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void DialogueManager::goodbyeSelected()
|
||||||
|
{
|
||||||
|
mEnvironment.mInputManager->setGuiMode(MWGui::GM_Game);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DialogueManager::questionAnswered(std::string answere)
|
||||||
|
{
|
||||||
|
std::cout << "and the ansere is..."<< answere;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#include <components/esm/loadinfo.hpp>
|
#include <components/esm/loadinfo.hpp>
|
||||||
|
|
||||||
#include "../mwworld/ptr.hpp"
|
#include "../mwworld/ptr.hpp"
|
||||||
|
#include <map>
|
||||||
|
|
||||||
namespace MWWorld
|
namespace MWWorld
|
||||||
{
|
{
|
||||||
|
@ -20,12 +21,22 @@ namespace MWDialogue
|
||||||
|
|
||||||
bool isMatching (const MWWorld::Ptr& actor, const ESM::DialInfo& info) const;
|
bool isMatching (const MWWorld::Ptr& actor, const ESM::DialInfo& info) const;
|
||||||
|
|
||||||
|
std::map<std::string,bool> knownTopics;// Those are the topics the player knows.
|
||||||
|
std::map<std::string,std::string> actorKnownTopics;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
DialogueManager (MWWorld::Environment& environment);
|
DialogueManager (MWWorld::Environment& environment);
|
||||||
|
|
||||||
void startDialogue (const MWWorld::Ptr& actor);
|
void startDialogue (const MWWorld::Ptr& actor);
|
||||||
|
|
||||||
|
void addTopic(std::string topic);
|
||||||
|
|
||||||
|
//calbacks for the GUI
|
||||||
|
void keywordSelected(std::string keyword);
|
||||||
|
void goodbyeSelected();
|
||||||
|
void questionAnswered(std::string answere);
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
#include "window_manager.hpp"
|
#include "window_manager.hpp"
|
||||||
#include "widgets.hpp"
|
#include "widgets.hpp"
|
||||||
#include "components/esm_store/store.hpp"
|
#include "components/esm_store/store.hpp"
|
||||||
|
#include "../mwworld/environment.hpp"
|
||||||
|
#include "../mwdialogue/dialoguemanager.hpp"
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
@ -14,8 +16,29 @@
|
||||||
using namespace MWGui;
|
using namespace MWGui;
|
||||||
using namespace Widgets;
|
using namespace Widgets;
|
||||||
|
|
||||||
DialogueWindow::DialogueWindow(WindowManager& parWindowManager)
|
/**
|
||||||
: WindowBase("openmw_dialogue_window_layout.xml", parWindowManager)
|
*Copied from the internet.
|
||||||
|
*/
|
||||||
|
|
||||||
|
std::string lower_string(const std::string& str)
|
||||||
|
{
|
||||||
|
std::string lowerCase;
|
||||||
|
|
||||||
|
std::transform (str.begin(), str.end(), std::back_inserter (lowerCase),
|
||||||
|
(int(*)(int)) std::tolower);
|
||||||
|
|
||||||
|
return lowerCase;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string::size_type find_str_ci(const std::string& str, const std::string& substr,size_t pos)
|
||||||
|
{
|
||||||
|
return lower_string(str).find(lower_string(substr),pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
DialogueWindow::DialogueWindow(WindowManager& parWindowManager,MWWorld::Environment& environment)
|
||||||
|
: WindowBase("openmw_dialogue_window_layout.xml", parWindowManager),
|
||||||
|
mEnvironment(environment)
|
||||||
{
|
{
|
||||||
// Centre dialog
|
// Centre dialog
|
||||||
center();
|
center();
|
||||||
|
@ -27,19 +50,21 @@ DialogueWindow::DialogueWindow(WindowManager& parWindowManager)
|
||||||
getWidget(history, "History");
|
getWidget(history, "History");
|
||||||
history->setOverflowToTheLeft(true);
|
history->setOverflowToTheLeft(true);
|
||||||
history->getClient()->eventMouseButtonClick = MyGUI::newDelegate(this, &DialogueWindow::onHistoryClicked);
|
history->getClient()->eventMouseButtonClick = MyGUI::newDelegate(this, &DialogueWindow::onHistoryClicked);
|
||||||
|
history->setMaxTextLength(1000000);
|
||||||
//Topics list
|
//Topics list
|
||||||
getWidget(topicsList, "TopicsList");
|
getWidget(topicsList, "TopicsList");
|
||||||
topicsList->setScrollVisible(true);
|
topicsList->setScrollVisible(true);
|
||||||
topicsList->eventListSelectAccept = MyGUI::newDelegate(this, &DialogueWindow::onSelectTopic);
|
//topicsList->eventListSelectAccept = MyGUI::newDelegate(this, &DialogueWindow::onSelectTopic);
|
||||||
topicsList->eventListMouseItemActivate = MyGUI::newDelegate(this, &DialogueWindow::onSelectTopic);
|
topicsList->eventListMouseItemActivate = MyGUI::newDelegate(this, &DialogueWindow::onSelectTopic);
|
||||||
topicsList->eventListChangePosition = MyGUI::newDelegate(this, &DialogueWindow::onSelectTopic);
|
//topicsList->eventListChangePosition = MyGUI::newDelegate(this, &DialogueWindow::onSelectTopic);
|
||||||
|
|
||||||
MyGUI::ButtonPtr byeButton;
|
MyGUI::ButtonPtr byeButton;
|
||||||
getWidget(byeButton, "ByeButton");
|
getWidget(byeButton, "ByeButton");
|
||||||
byeButton->eventMouseButtonClick = MyGUI::newDelegate(this, &DialogueWindow::onByeClicked);
|
byeButton->eventMouseButtonClick = MyGUI::newDelegate(this, &DialogueWindow::onByeClicked);
|
||||||
|
|
||||||
updateOptions();
|
getWidget(pDispositionBar, "Disposition");
|
||||||
|
getWidget(pDispositionText,"DispositionText");
|
||||||
|
std::cout << "creation dialogue";
|
||||||
}
|
}
|
||||||
|
|
||||||
void DialogueWindow::onHistoryClicked(MyGUI::Widget* _sender)
|
void DialogueWindow::onHistoryClicked(MyGUI::Widget* _sender)
|
||||||
|
@ -51,50 +76,160 @@ void DialogueWindow::onHistoryClicked(MyGUI::Widget* _sender)
|
||||||
const IntPoint& lastPressed = InputManager::getInstance().getLastLeftPressed();
|
const IntPoint& lastPressed = InputManager::getInstance().getLastLeftPressed();
|
||||||
|
|
||||||
size_t cursorPosition = t->getCursorPosition(lastPressed);
|
size_t cursorPosition = t->getCursorPosition(lastPressed);
|
||||||
if(history->getColorAtPos(cursorPosition) != "#FFFFFF")
|
MyGUI::UString color = history->getColorAtPos(cursorPosition);
|
||||||
|
if(color != "#B29154")
|
||||||
{
|
{
|
||||||
UString key = history->getColorTextAt(cursorPosition);
|
UString key = history->getColorTextAt(cursorPosition);
|
||||||
std::cout << "Clicked on key: " << key << std::endl;
|
|
||||||
//eventTopicSelected(key);
|
//std::cout << "Clicked on key: " << key << std::endl;
|
||||||
|
if(color == "#686EBA")
|
||||||
|
{
|
||||||
|
mEnvironment.mDialogueManager->keywordSelected(lower_string(key));
|
||||||
|
displayTopicText(lower_string(key));
|
||||||
|
}
|
||||||
|
if(color == "#572D21")
|
||||||
|
{
|
||||||
|
//TODO: send back the answere to the question!
|
||||||
|
mEnvironment.mDialogueManager->questionAnswered(key);
|
||||||
|
//std::cout << "and the ansere is..."<< key;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DialogueWindow::open()
|
void DialogueWindow::open()
|
||||||
{
|
{
|
||||||
|
//updateOptions();
|
||||||
|
topicsList->removeAllItems();
|
||||||
|
pTopicsText.clear();
|
||||||
|
history->eraseText(0,history->getTextLength());
|
||||||
updateOptions();
|
updateOptions();
|
||||||
setVisible(true);
|
setVisible(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DialogueWindow::onByeClicked(MyGUI::Widget* _sender)
|
void DialogueWindow::onByeClicked(MyGUI::Widget* _sender)
|
||||||
{
|
{
|
||||||
eventBye();
|
//eventBye();
|
||||||
|
mEnvironment.mDialogueManager->goodbyeSelected();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DialogueWindow::onSelectTopic(MyGUI::List* _sender, size_t _index)
|
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);
|
||||||
|
mEnvironment.mDialogueManager->keywordSelected(lower_string(topic));
|
||||||
|
displayTopicText(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;
|
||||||
//eventTopicSelected(key);
|
//eventTopicSelected(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DialogueWindow::startDialogue(std::string npcName)
|
||||||
|
{
|
||||||
|
setText("NpcName", npcName);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DialogueWindow::addKeyword(std::string keyWord,std::string topicText)
|
||||||
|
{
|
||||||
|
if(topicsList->findItemIndexWith(keyWord) == MyGUI::ITEM_NONE)
|
||||||
|
{
|
||||||
|
topicsList->addItem(keyWord);
|
||||||
|
pTopicsText[keyWord] = topicText;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void DialogueWindow::removeKeyword(std::string keyWord)
|
||||||
|
{
|
||||||
|
if(topicsList->findItemIndexWith(keyWord) != MyGUI::ITEM_NONE)
|
||||||
|
{
|
||||||
|
std::cout << topicsList->findItem(keyWord);
|
||||||
|
topicsList->removeItemAt(topicsList->findItem(keyWord));
|
||||||
|
pTopicsText.erase(keyWord);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void addColorInString(std::string& str, const std::string& keyword,std::string color1, std::string color2)
|
||||||
|
{
|
||||||
|
size_t pos = 0;
|
||||||
|
while((pos = find_str_ci(str,keyword, pos)) != std::string::npos)
|
||||||
|
{
|
||||||
|
//str.replace(pos, oldStr.length(), "#686EBA"+str.get);
|
||||||
|
str.insert(pos,color1);
|
||||||
|
pos += color1.length();
|
||||||
|
pos += keyword.length();
|
||||||
|
str.insert(pos,color2);
|
||||||
|
pos+= color2.length();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string DialogueWindow::parseText(std::string text)
|
||||||
|
{
|
||||||
|
//topicsList->geti
|
||||||
|
for(int i = 0;i<topicsList->getItemCount();i++)
|
||||||
|
{
|
||||||
|
std::string keyWord = topicsList->getItem(i);
|
||||||
|
//std::string newKeyWord = "#686EBA"+keyWord+"#B29154";
|
||||||
|
addColorInString(text,keyWord,"#686EBA","#B29154");
|
||||||
|
}
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DialogueWindow::displayTopicText(std::string topic)
|
||||||
|
{
|
||||||
|
if(topicsList->findItemIndexWith(topic) != MyGUI::ITEM_NONE)
|
||||||
|
{
|
||||||
|
history->addDialogHeading(topic);
|
||||||
|
history->addDialogText(parseText(pTopicsText[topic]));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::cout << "topic not found!";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void DialogueWindow::addText(std::string text)
|
||||||
|
{
|
||||||
|
history->addDialogText(parseText(text));
|
||||||
|
}
|
||||||
|
|
||||||
|
void DialogueWindow::askQuestion(std::string question,std::list<std::string> answers)
|
||||||
|
{
|
||||||
|
history->addDialogText(parseText(question));
|
||||||
|
for(std::list<std::string>::iterator it = answers.begin();it!=answers.end();it++)
|
||||||
|
{
|
||||||
|
history->addDialogText("#572D21"+(*it)+"#B29154"+" ");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void DialogueWindow::updateOptions()
|
void DialogueWindow::updateOptions()
|
||||||
{
|
{
|
||||||
//FIXME Add this properly
|
//FIXME Add this properly
|
||||||
history->addDialogText("Through the translucent surface of the orb, you see shifting images of distant locations...");
|
/*history->addDialogText("Through the translucent surface of the orb, you see shifting images of distant locations...");
|
||||||
for(int z = 0; z < 10; z++)
|
for(int z = 0; z < 10; z++)
|
||||||
{
|
{
|
||||||
history->addDialogHeading("Fort Frostmoth");
|
history->addDialogHeading("Fort Frostmoth");
|
||||||
history->addDialogText("The image in the orb flickers, and you see.... The cold courtyard of #FF0000Fort Frostmoth#FFFFFF, battered bu werewolf attack, but still standing, still projecting Imperial might even to this distant and cold corner of the world.");
|
history->addDialogText("The image in the orb flickers, and you see.... The cold courtyard of #FF0000Fort Frostmoth#FFFFFF, battered bu werewolf attack, but still standing, still projecting Imperial might even to this distant and cold corner of the world.");
|
||||||
}
|
}*/
|
||||||
|
|
||||||
//Clear the list of topics
|
//Clear the list of topics
|
||||||
topicsList->removeAllItems();
|
topicsList->removeAllItems();
|
||||||
int i = 0;
|
pTopicsText.clear();
|
||||||
topicsList->addItem("Ald'ruhn", i++);
|
history->eraseText(0,history->getTextLength());
|
||||||
|
|
||||||
|
/*addKeyword("gus","gus is working on the dialogue system");
|
||||||
|
displayTopicText("gus");*/
|
||||||
|
|
||||||
|
pDispositionBar->setProgressRange(100);
|
||||||
|
pDispositionBar->setProgressPosition(40);
|
||||||
|
pDispositionText->eraseText(0,pDispositionText->getTextLength());
|
||||||
|
pDispositionText->addText("#B29154"+std::string("40/100")+"#B29154");
|
||||||
|
|
||||||
|
/*std::list<std::string> test;
|
||||||
|
test.push_back("option 1");
|
||||||
|
test.push_back("option 2");
|
||||||
|
askQuestion("is gus cooking?",test);*/
|
||||||
|
/*topicsList->addItem("Ald'ruhn", i++);
|
||||||
topicsList->addItem("Balmora", i++);
|
topicsList->addItem("Balmora", i++);
|
||||||
topicsList->addItem("Sadrith Mora", i++);
|
topicsList->addItem("Sadrith Mora", i++);
|
||||||
topicsList->addItem("Vivec", i++);
|
topicsList->addItem("Vivec", i++);
|
||||||
|
@ -115,6 +250,6 @@ void DialogueWindow::updateOptions()
|
||||||
topicsList->addItem("Tel Fyr", i++);
|
topicsList->addItem("Tel Fyr", i++);
|
||||||
topicsList->addItem("Tel Mora", i++);
|
topicsList->addItem("Tel Mora", i++);
|
||||||
topicsList->addItem("Tel Vos", i++);
|
topicsList->addItem("Tel Vos", i++);
|
||||||
topicsList->addItem("Vos", i++);
|
topicsList->addItem("Vos", i++);*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,11 @@ namespace MWGui
|
||||||
class WindowManager;
|
class WindowManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace MWWorld
|
||||||
|
{
|
||||||
|
class Environment;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
This file contains the dialouge window
|
This file contains the dialouge window
|
||||||
Layout is defined by resources/mygui/openmw_dialogue_window_layout.xml.
|
Layout is defined by resources/mygui/openmw_dialogue_window_layout.xml.
|
||||||
|
@ -23,7 +28,7 @@ namespace MWGui
|
||||||
class DialogueWindow: public WindowBase
|
class DialogueWindow: public WindowBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
DialogueWindow(WindowManager& parWindowManager);
|
DialogueWindow(WindowManager& parWindowManager,MWWorld::Environment& environment);
|
||||||
|
|
||||||
void open();
|
void open();
|
||||||
|
|
||||||
|
@ -35,6 +40,13 @@ namespace MWGui
|
||||||
*/
|
*/
|
||||||
EventHandle_Void eventBye;
|
EventHandle_Void eventBye;
|
||||||
|
|
||||||
|
void startDialogue(std::string npcName);
|
||||||
|
void stopDialogue();
|
||||||
|
void addKeyword(std::string keyWord,std::string topicText);
|
||||||
|
void removeKeyword(std::string keyWord);
|
||||||
|
void addText(std::string text);
|
||||||
|
void askQuestion(std::string question,std::list<std::string> answers);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void onSelectTopic(MyGUI::List* _sender, size_t _index);
|
void onSelectTopic(MyGUI::List* _sender, size_t _index);
|
||||||
void onByeClicked(MyGUI::Widget* _sender);
|
void onByeClicked(MyGUI::Widget* _sender);
|
||||||
|
@ -42,9 +54,19 @@ namespace MWGui
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void updateOptions();
|
void updateOptions();
|
||||||
|
/**
|
||||||
|
*Helper function that add topic keyword in blue in a text.
|
||||||
|
*/
|
||||||
|
std::string parseText(std::string text);
|
||||||
|
void displayTopicText(std::string topic);
|
||||||
|
|
||||||
DialogeHistory* history;
|
DialogeHistory* history;
|
||||||
MyGUI::ListPtr topicsList;
|
MyGUI::ListPtr topicsList;
|
||||||
|
MyGUI::ProgressPtr pDispositionBar;
|
||||||
|
MyGUI::EditPtr pDispositionText;
|
||||||
|
std::map<std::string,std::string> pTopicsText;// this map links keyword and "real" text.
|
||||||
|
|
||||||
|
MWWorld::Environment& mEnvironment;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -61,9 +61,9 @@ UString DialogeHistory::getColorTextAt(size_t _pos)
|
||||||
|
|
||||||
void DialogeHistory::addDialogHeading(const UString& parText)
|
void DialogeHistory::addDialogHeading(const UString& parText)
|
||||||
{
|
{
|
||||||
UString head("\n#00FF00");
|
UString head("\n#D8C09A");
|
||||||
head.append(parText);
|
head.append(parText);
|
||||||
head.append("#FFFFFF\n");
|
head.append("#B29154\n");
|
||||||
addText(head);
|
addText(head);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,6 +51,7 @@ WindowManager::WindowManager(MWWorld::Environment& environment,
|
||||||
console = new Console(w,h, environment, extensions);
|
console = new Console(w,h, environment, extensions);
|
||||||
mJournal = new JournalWindow(*this);
|
mJournal = new JournalWindow(*this);
|
||||||
mMessageBoxManager = new MessageBoxManager(this);
|
mMessageBoxManager = new MessageBoxManager(this);
|
||||||
|
dialogueWindow = new DialogueWindow(*this,environment);
|
||||||
|
|
||||||
// The HUD is always on
|
// The HUD is always on
|
||||||
hud->setVisible(true);
|
hud->setVisible(true);
|
||||||
|
@ -149,6 +150,7 @@ void WindowManager::updateVisible()
|
||||||
stats->setVisible(false);
|
stats->setVisible(false);
|
||||||
console->disable();
|
console->disable();
|
||||||
mJournal->setVisible(false);
|
mJournal->setVisible(false);
|
||||||
|
dialogueWindow->setVisible(false);
|
||||||
|
|
||||||
// Mouse is visible whenever we're not in game mode
|
// Mouse is visible whenever we're not in game mode
|
||||||
gui->setVisiblePointer(isGuiMode());
|
gui->setVisiblePointer(isGuiMode());
|
||||||
|
@ -195,11 +197,6 @@ void WindowManager::updateVisible()
|
||||||
|
|
||||||
if (mode == GM_Dialogue)
|
if (mode == GM_Dialogue)
|
||||||
{
|
{
|
||||||
if (!dialogueWindow)
|
|
||||||
{
|
|
||||||
dialogueWindow = new DialogueWindow(*this);
|
|
||||||
dialogueWindow->eventBye = MyGUI::newDelegate(this, &WindowManager::onDialogueWindowBye);
|
|
||||||
}
|
|
||||||
dialogueWindow->open();
|
dialogueWindow->open();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -349,6 +346,7 @@ void WindowManager::updateSkillArea()
|
||||||
|
|
||||||
void WindowManager::removeDialog(OEngine::GUI::Layout*dialog)
|
void WindowManager::removeDialog(OEngine::GUI::Layout*dialog)
|
||||||
{
|
{
|
||||||
|
std::cout << "dialogue a la poubelle";
|
||||||
assert(dialog);
|
assert(dialog);
|
||||||
if (!dialog)
|
if (!dialog)
|
||||||
return;
|
return;
|
||||||
|
@ -387,7 +385,8 @@ void WindowManager::onDialogueWindowBye()
|
||||||
if (dialogueWindow)
|
if (dialogueWindow)
|
||||||
{
|
{
|
||||||
//FIXME set some state and stuff?
|
//FIXME set some state and stuff?
|
||||||
removeDialog(dialogueWindow);
|
//removeDialog(dialogueWindow);
|
||||||
|
dialogueWindow->setVisible(false);
|
||||||
}
|
}
|
||||||
setGuiMode(GM_Game);
|
setGuiMode(GM_Game);
|
||||||
}
|
}
|
||||||
|
|
|
@ -124,6 +124,8 @@ namespace MWGui
|
||||||
updateVisible();
|
updateVisible();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MWGui::DialogueWindow* getDialogueWindow() {return dialogueWindow;}
|
||||||
|
|
||||||
MyGUI::Gui* getGui() const { return gui; }
|
MyGUI::Gui* getGui() const { return gui; }
|
||||||
|
|
||||||
void wmUpdateFps(float fps, size_t triangleCount, size_t batchCount)
|
void wmUpdateFps(float fps, size_t triangleCount, size_t batchCount)
|
||||||
|
|
|
@ -52,10 +52,12 @@ RenderingManager::RenderingManager (OEngine::Render::OgreRenderer& _rend, const
|
||||||
cameraPitchNode->attachObject(mRendering.getCamera());
|
cameraPitchNode->attachObject(mRendering.getCamera());
|
||||||
|
|
||||||
mPlayer = new MWRender::Player (mRendering.getCamera(), playerNode);
|
mPlayer = new MWRender::Player (mRendering.getCamera(), playerNode);
|
||||||
|
mSun = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderingManager::~RenderingManager ()
|
RenderingManager::~RenderingManager ()
|
||||||
{
|
{
|
||||||
|
//TODO: destroy mSun?
|
||||||
delete mPlayer;
|
delete mPlayer;
|
||||||
delete mSkyManager;
|
delete mSkyManager;
|
||||||
}
|
}
|
||||||
|
@ -202,12 +204,15 @@ void RenderingManager::configureAmbient(ESMS::CellStore<MWWorld::RefData> &mCell
|
||||||
|
|
||||||
// Create a "sun" that shines light downwards. It doesn't look
|
// Create a "sun" that shines light downwards. It doesn't look
|
||||||
// completely right, but leave it for now.
|
// completely right, but leave it for now.
|
||||||
Ogre::Light *light = mRendering.getScene()->createLight();
|
if(!mSun)
|
||||||
|
{
|
||||||
|
mSun = mRendering.getScene()->createLight();
|
||||||
|
}
|
||||||
Ogre::ColourValue colour;
|
Ogre::ColourValue colour;
|
||||||
colour.setAsABGR (mCell.cell->ambi.sunlight);
|
colour.setAsABGR (mCell.cell->ambi.sunlight);
|
||||||
light->setDiffuseColour (colour);
|
mSun->setDiffuseColour (colour);
|
||||||
light->setType(Ogre::Light::LT_DIRECTIONAL);
|
mSun->setType(Ogre::Light::LT_DIRECTIONAL);
|
||||||
light->setDirection(0,-1,0);
|
mSun->setDirection(0,-1,0);
|
||||||
}
|
}
|
||||||
// Switch through lighting modes.
|
// Switch through lighting modes.
|
||||||
|
|
||||||
|
|
|
@ -118,6 +118,7 @@ class RenderingManager: private RenderingInterface {
|
||||||
int mAmbientMode;
|
int mAmbientMode;
|
||||||
|
|
||||||
Ogre::ColourValue mAmbientColor;
|
Ogre::ColourValue mAmbientColor;
|
||||||
|
Ogre::Light* mSun;
|
||||||
|
|
||||||
/// Root node for all objects added to the scene. This is rotated so
|
/// Root node for all objects added to the scene. This is rotated so
|
||||||
/// that the OGRE coordinate system matches that used internally in
|
/// that the OGRE coordinate system matches that used internally in
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#include <components/interpreter/opcodes.hpp>
|
#include <components/interpreter/opcodes.hpp>
|
||||||
|
|
||||||
#include "../mwdialogue/journal.hpp"
|
#include "../mwdialogue/journal.hpp"
|
||||||
|
#include "../mwdialogue/dialoguemanager.hpp"
|
||||||
|
|
||||||
#include "interpretercontext.hpp"
|
#include "interpretercontext.hpp"
|
||||||
|
|
||||||
|
@ -72,15 +73,33 @@ namespace MWScript
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class OpAddTopic : public Interpreter::Opcode0
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
virtual void execute (Interpreter::Runtime& runtime)
|
||||||
|
{
|
||||||
|
MWScript::InterpreterContext& context
|
||||||
|
= static_cast<MWScript::InterpreterContext&> (runtime.getContext());
|
||||||
|
|
||||||
|
std::string topic = runtime.getStringLiteral (runtime[0].mInteger);
|
||||||
|
runtime.pop();
|
||||||
|
|
||||||
|
context.getEnvironment().mDialogueManager->addTopic(topic);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const int opcodeJournal = 0x2000133;
|
const int opcodeJournal = 0x2000133;
|
||||||
const int opcodeSetJournalIndex = 0x2000134;
|
const int opcodeSetJournalIndex = 0x2000134;
|
||||||
const int opcodeGetJournalIndex = 0x2000135;
|
const int opcodeGetJournalIndex = 0x2000135;
|
||||||
|
const int opcodeAddTopic = 0x200013a;
|
||||||
|
|
||||||
void registerExtensions (Compiler::Extensions& extensions)
|
void registerExtensions (Compiler::Extensions& extensions)
|
||||||
{
|
{
|
||||||
extensions.registerInstruction ("journal", "cl", opcodeJournal);
|
extensions.registerInstruction ("journal", "cl", opcodeJournal);
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
void installOpcodes (Interpreter::Interpreter& interpreter)
|
void installOpcodes (Interpreter::Interpreter& interpreter)
|
||||||
|
@ -88,6 +107,7 @@ namespace MWScript
|
||||||
interpreter.installSegment5 (opcodeJournal, new OpJournal);
|
interpreter.installSegment5 (opcodeJournal, new OpJournal);
|
||||||
interpreter.installSegment5 (opcodeSetJournalIndex, new OpSetJournalIndex);
|
interpreter.installSegment5 (opcodeSetJournalIndex, new OpSetJournalIndex);
|
||||||
interpreter.installSegment5 (opcodeGetJournalIndex, new OpGetJournalIndex);
|
interpreter.installSegment5 (opcodeGetJournalIndex, new OpGetJournalIndex);
|
||||||
|
interpreter.installSegment5 (opcodeAddTopic, new OpAddTopic);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -115,4 +115,5 @@ op 0x2000136: GetPCCell
|
||||||
op 0x2000137: GetButtonPressed
|
op 0x2000137: GetButtonPressed
|
||||||
op 0x2000138: SkipAnim
|
op 0x2000138: SkipAnim
|
||||||
op 0x2000139: SkipAnim, expplicit reference
|
op 0x2000139: SkipAnim, expplicit reference
|
||||||
opcodes 0x200013a-0x3ffffff unused
|
op 0x200013a: AddTopic
|
||||||
|
opcodes 0x200013b-0x3ffffff unused
|
||||||
|
|
1
extern/mygui_3.0.1/CMakeLists.txt
vendored
1
extern/mygui_3.0.1/CMakeLists.txt
vendored
|
@ -54,6 +54,7 @@ configure_file("${SDIR}/openmw_chargen_class_description_layout.xml" "${DDIR}/op
|
||||||
configure_file("${SDIR}/openmw_chargen_birth_layout.xml" "${DDIR}/openmw_chargen_birth_layout.xml" COPYONLY)
|
configure_file("${SDIR}/openmw_chargen_birth_layout.xml" "${DDIR}/openmw_chargen_birth_layout.xml" COPYONLY)
|
||||||
configure_file("${SDIR}/openmw_chargen_review_layout.xml" "${DDIR}/openmw_chargen_review_layout.xml" COPYONLY)
|
configure_file("${SDIR}/openmw_chargen_review_layout.xml" "${DDIR}/openmw_chargen_review_layout.xml" COPYONLY)
|
||||||
configure_file("${SDIR}/openmw_dialogue_window_layout.xml" "${DDIR}/openmw_dialogue_window_layout.xml" COPYONLY)
|
configure_file("${SDIR}/openmw_dialogue_window_layout.xml" "${DDIR}/openmw_dialogue_window_layout.xml" COPYONLY)
|
||||||
|
configure_file("${SDIR}/openmw_dialogue_window_skin.xml" "${DDIR}/openmw_dialogue_window_skin.xml" COPYONLY)
|
||||||
configure_file("${SDIR}/openmw_inventory_window_layout.xml" "${DDIR}/openmw_inventory_window_layout.xml" COPYONLY)
|
configure_file("${SDIR}/openmw_inventory_window_layout.xml" "${DDIR}/openmw_inventory_window_layout.xml" COPYONLY)
|
||||||
configure_file("${SDIR}/openmw_layers.xml" "${DDIR}/openmw_layers.xml" COPYONLY)
|
configure_file("${SDIR}/openmw_layers.xml" "${DDIR}/openmw_layers.xml" COPYONLY)
|
||||||
configure_file("${SDIR}/openmw_mainmenu_layout.xml" "${DDIR}/openmw_mainmenu_layout.xml" COPYONLY)
|
configure_file("${SDIR}/openmw_mainmenu_layout.xml" "${DDIR}/openmw_mainmenu_layout.xml" COPYONLY)
|
||||||
|
|
1
extern/mygui_3.0.1/openmw_resources/core.xml
vendored
1
extern/mygui_3.0.1/openmw_resources/core.xml
vendored
|
@ -20,6 +20,7 @@
|
||||||
<List file="openmw_mainmenu_skin.xml" group="General"/>
|
<List file="openmw_mainmenu_skin.xml" group="General"/>
|
||||||
<List file="openmw_console.skin.xml" group="General"/>
|
<List file="openmw_console.skin.xml" group="General"/>
|
||||||
<List file="openmw_journal_skin.xml" group="General"/>
|
<List file="openmw_journal_skin.xml" group="General"/>
|
||||||
|
<List file="openmw_dialogue_window_skin.xml" group="General"/>
|
||||||
</MyGUI>
|
</MyGUI>
|
||||||
|
|
||||||
</MyGUI>
|
</MyGUI>
|
||||||
|
|
|
@ -17,8 +17,13 @@
|
||||||
<Property key="Edit_VisibleVScroll" value="1" />
|
<Property key="Edit_VisibleVScroll" value="1" />
|
||||||
</Widget>
|
</Widget>
|
||||||
|
|
||||||
|
<!-- The disposition bar-->
|
||||||
|
<Widget type="Progress" skin="MW_EnergyBar_Blue" position="432 39 132 18"
|
||||||
|
align="Right Top" name="Disposition">
|
||||||
|
<Widget type="Edit" skin="MW_DispositionEdit" position_real = "0.25 0 0.5 1" name = "DispositionText"/>
|
||||||
|
</Widget>
|
||||||
<!-- The list of topics -->
|
<!-- The list of topics -->
|
||||||
<Widget type="List" skin="MW_List" position="432 39 132 341" name="TopicsList">
|
<Widget type="List" skin="MW_List" position="432 62 132 318" name="TopicsList">
|
||||||
</Widget>
|
</Widget>
|
||||||
|
|
||||||
<!-- The Goodbye button -->
|
<!-- The Goodbye button -->
|
||||||
|
|
18
extern/mygui_3.0.1/openmw_resources/openmw_dialogue_window_skin.xml
vendored
Normal file
18
extern/mygui_3.0.1/openmw_resources/openmw_dialogue_window_skin.xml
vendored
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<MyGUI type="Skin">
|
||||||
|
|
||||||
|
<Skin name = "MW_DispEdit" size = "10 10">
|
||||||
|
<Property key="FontName" value = "MonoFont" />
|
||||||
|
<Property key="AlignText" value = "Left Top" />
|
||||||
|
<Property key="Colour" value = "0000FF" />
|
||||||
|
<!--Property key="Pointer" value = "beam" /-->
|
||||||
|
<BasisSkin type="EditText" offset = "0 0 10 10" align = "Stretch"/>
|
||||||
|
</Skin>
|
||||||
|
|
||||||
|
<Skin name="MW_DispositionEdit" size="0 0 50 50">
|
||||||
|
<Property key="WordWrap" value = "true" />
|
||||||
|
<Child type="Widget" skin="MW_DispEdit" offset="0 0 35 10" align = "ALIGN_STRETCH" name = "Client"/>
|
||||||
|
<!--Child type="VScroll" skin="VScroll" offset = "35 0 15 50" align = "Right VStretch" name = "VScroll"/-->
|
||||||
|
</Skin>
|
||||||
|
</MyGUI>
|
Loading…
Reference in a new issue