2010-08-06 19:16:44 +02:00
|
|
|
#ifndef GAME_MMDIALOG_DIALOGUEMANAGER_H
|
|
|
|
#define GAME_MWDIALOG_DIALOGUEMANAGER_H
|
2010-08-06 18:01:34 +02:00
|
|
|
|
2010-08-08 13:21:03 +02:00
|
|
|
#include <components/esm/loadinfo.hpp>
|
2010-08-06 18:01:34 +02:00
|
|
|
|
2012-02-18 12:19:42 +01:00
|
|
|
#include <components/compiler/streamerrorhandler.hpp>
|
2012-02-17 20:20:23 +01:00
|
|
|
#include "../mwscript/compilercontext.hpp"
|
|
|
|
#include "../mwscript/interpretercontext.hpp"
|
|
|
|
#include <components/compiler/output.hpp>
|
|
|
|
|
2010-08-08 13:21:03 +02:00
|
|
|
#include "../mwworld/ptr.hpp"
|
2012-02-09 19:27:15 +01:00
|
|
|
#include <map>
|
2010-08-08 11:34:03 +02:00
|
|
|
|
2010-08-06 19:16:44 +02:00
|
|
|
namespace MWDialogue
|
2010-08-06 18:01:34 +02:00
|
|
|
{
|
2012-02-18 12:19:42 +01:00
|
|
|
class DialogueManager
|
2010-08-06 18:01:34 +02:00
|
|
|
{
|
2010-08-08 13:21:03 +02:00
|
|
|
bool isMatching (const MWWorld::Ptr& actor, const ESM::DialInfo::SelectStruct& select) const;
|
|
|
|
|
2010-08-08 11:34:03 +02:00
|
|
|
bool isMatching (const MWWorld::Ptr& actor, const ESM::DialInfo& info) const;
|
|
|
|
|
2012-03-16 17:30:59 +01:00
|
|
|
bool functionFilter(const MWWorld::Ptr& actor, const ESM::DialInfo& info,bool choice);
|
2012-03-14 18:47:29 +01:00
|
|
|
|
2012-02-15 13:23:59 +01:00
|
|
|
void parseText(std::string text);
|
|
|
|
|
2012-03-19 00:19:58 +01:00
|
|
|
void updateTopics();
|
|
|
|
|
|
|
|
std::map<std::string,ESM::Dialogue> mDialogueMap;
|
2012-07-13 03:51:58 -07:00
|
|
|
std::map<std::string,bool> mKnownTopics;// Those are the topics the player knows.
|
|
|
|
std::list<std::string> mActorKnownTopics;
|
2012-02-17 20:20:23 +01:00
|
|
|
|
|
|
|
MWScript::CompilerContext mCompilerContext;
|
2012-02-18 12:19:42 +01:00
|
|
|
std::ostream mErrorStream;
|
|
|
|
Compiler::StreamErrorHandler mErrorHandler;
|
2012-04-23 15:27:03 +02:00
|
|
|
|
2012-02-17 20:20:23 +01:00
|
|
|
|
2012-02-18 12:19:42 +01:00
|
|
|
bool compile (const std::string& cmd,std::vector<Interpreter::Type_Code>& code);
|
2012-02-17 20:20:23 +01:00
|
|
|
void executeScript(std::string script);
|
|
|
|
MWWorld::Ptr mActor;
|
|
|
|
|
|
|
|
void printError(std::string error);
|
2012-02-09 19:27:15 +01:00
|
|
|
|
2012-03-14 18:47:29 +01:00
|
|
|
int mChoice;
|
2012-03-16 17:30:59 +01:00
|
|
|
std::map<std::string,int> mChoiceMap;
|
|
|
|
std::string mLastTopic;
|
|
|
|
ESM::DialInfo mLastDialogue;
|
|
|
|
bool mIsInChoice;
|
2012-03-14 18:47:29 +01:00
|
|
|
|
2010-08-06 18:01:34 +02:00
|
|
|
public:
|
|
|
|
|
2012-04-23 15:27:03 +02:00
|
|
|
DialogueManager (const Compiler::Extensions& extensions);
|
2010-08-06 18:01:34 +02:00
|
|
|
|
2010-08-06 19:16:44 +02:00
|
|
|
void startDialogue (const MWWorld::Ptr& actor);
|
2010-08-06 18:01:34 +02:00
|
|
|
|
2012-02-10 16:09:43 +01:00
|
|
|
void addTopic(std::string topic);
|
|
|
|
|
2012-03-07 18:44:09 +01:00
|
|
|
void askQuestion(std::string question,int choice);
|
|
|
|
|
2012-05-11 07:18:41 +02:00
|
|
|
void goodbye();
|
|
|
|
|
2012-04-04 22:13:57 +02:00
|
|
|
///get the faction of the actor you are talking with
|
|
|
|
std::string getFaction();
|
|
|
|
|
2012-02-05 12:25:23 +01:00
|
|
|
//calbacks for the GUI
|
|
|
|
void keywordSelected(std::string keyword);
|
|
|
|
void goodbyeSelected();
|
|
|
|
void questionAnswered(std::string answere);
|
|
|
|
|
2010-08-06 18:01:34 +02:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|