2012-08-11 12:02:51 +02:00
|
|
|
#ifndef GAME_MWDIALOG_DIALOGUEMANAGERIMP_H
|
2012-08-09 10:35:53 +02:00
|
|
|
#define GAME_MWDIALOG_DIALOGUEMANAGERIMP_H
|
2010-08-06 18:01:34 +02:00
|
|
|
|
2012-08-11 17:30:55 +02:00
|
|
|
#include "../mwbase/dialoguemanager.hpp"
|
|
|
|
|
2012-11-10 14:31:58 +01:00
|
|
|
#include <map>
|
|
|
|
#include <list>
|
2010-08-06 18:01:34 +02:00
|
|
|
|
2012-02-18 12:19:42 +01:00
|
|
|
#include <components/compiler/streamerrorhandler.hpp>
|
2012-12-31 04:15:47 +04:00
|
|
|
#include <components/translation/translation.hpp>
|
2012-02-17 20:20:23 +01:00
|
|
|
|
2010-08-08 13:21:03 +02:00
|
|
|
#include "../mwworld/ptr.hpp"
|
2012-08-09 10:35:53 +02:00
|
|
|
|
2012-11-10 14:31:58 +01:00
|
|
|
#include "../mwscript/compilercontext.hpp"
|
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-08-09 10:35:53 +02:00
|
|
|
class DialogueManager : public MWBase::DialogueManager
|
2010-08-06 18:01:34 +02:00
|
|
|
{
|
2012-11-10 14:31:58 +01:00
|
|
|
std::map<std::string, ESM::Dialogue> mDialogueMap;
|
|
|
|
std::map<std::string, bool> mKnownTopics;// Those are the topics the player knows.
|
2012-07-13 03:51:58 -07:00
|
|
|
std::list<std::string> mActorKnownTopics;
|
2012-02-17 20:20:23 +01:00
|
|
|
|
2012-12-31 04:15:47 +04:00
|
|
|
Translation::Storage& mTranslationDataStorage;
|
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-12-08 14:24:15 +01:00
|
|
|
|
2012-02-17 20:20:23 +01:00
|
|
|
MWWorld::Ptr mActor;
|
2012-11-10 13:31:10 +01:00
|
|
|
bool mTalkedTo;
|
2012-02-17 20:20:23 +01:00
|
|
|
|
2012-03-14 18:47:29 +01:00
|
|
|
int mChoice;
|
2012-03-16 17:30:59 +01:00
|
|
|
std::string mLastTopic;
|
|
|
|
ESM::DialInfo mLastDialogue;
|
|
|
|
bool mIsInChoice;
|
2012-03-14 18:47:29 +01:00
|
|
|
|
2012-11-10 00:29:36 +01:00
|
|
|
float mTemporaryDispositionChange;
|
|
|
|
float mPermanentDispositionChange;
|
2012-11-13 15:35:46 +01:00
|
|
|
bool mScriptVerbose;
|
2012-11-10 00:29:36 +01:00
|
|
|
|
2012-11-10 14:31:58 +01:00
|
|
|
void parseText (const std::string& text);
|
|
|
|
|
|
|
|
void updateTopics();
|
|
|
|
|
|
|
|
bool compile (const std::string& cmd,std::vector<Interpreter::Type_Code>& code);
|
|
|
|
void executeScript (const std::string& script);
|
|
|
|
|
2013-03-14 21:33:00 +01:00
|
|
|
void executeTopic (const std::string& topic, bool randomResponse=false);
|
2012-12-08 14:24:15 +01:00
|
|
|
|
2010-08-06 18:01:34 +02:00
|
|
|
public:
|
|
|
|
|
2012-12-31 04:15:47 +04:00
|
|
|
DialogueManager (const Compiler::Extensions& extensions, bool scriptVerbose, Translation::Storage& translationDataStorage);
|
2010-08-06 18:01:34 +02:00
|
|
|
|
2013-05-15 17:54:18 +02:00
|
|
|
virtual void clear();
|
|
|
|
|
2013-03-31 13:13:46 +02:00
|
|
|
virtual bool isInChoice() const;
|
|
|
|
|
2012-08-09 10:35:53 +02:00
|
|
|
virtual void startDialogue (const MWWorld::Ptr& actor);
|
2010-08-06 18:01:34 +02:00
|
|
|
|
2012-08-09 10:35:53 +02:00
|
|
|
virtual void addTopic (const std::string& topic);
|
2012-02-10 16:09:43 +01:00
|
|
|
|
2012-08-09 10:35:53 +02:00
|
|
|
virtual void askQuestion (const std::string& question,int choice);
|
2012-03-07 18:44:09 +01:00
|
|
|
|
2012-08-09 10:35:53 +02:00
|
|
|
virtual void goodbye();
|
2012-05-11 07:18:41 +02:00
|
|
|
|
2012-11-10 14:31:58 +01:00
|
|
|
virtual MWWorld::Ptr getActor() const;
|
|
|
|
///< Return the actor the player is currently talking to.
|
2012-04-04 22:13:57 +02:00
|
|
|
|
2013-03-16 20:32:21 +01:00
|
|
|
virtual bool checkServiceRefused ();
|
|
|
|
|
2012-02-05 12:25:23 +01:00
|
|
|
//calbacks for the GUI
|
2012-08-09 10:35:53 +02:00
|
|
|
virtual void keywordSelected (const std::string& keyword);
|
|
|
|
virtual void goodbyeSelected();
|
2013-05-04 14:15:47 +02:00
|
|
|
virtual void questionAnswered (int answer);
|
2012-02-05 12:25:23 +01:00
|
|
|
|
2012-11-10 00:29:36 +01:00
|
|
|
virtual void persuade (int type);
|
|
|
|
virtual int getTemporaryDispositionChange () const;
|
2012-11-10 00:38:45 +01:00
|
|
|
virtual void applyTemporaryDispositionChange (int delta);
|
2010-08-06 18:01:34 +02:00
|
|
|
};
|
2012-12-31 04:15:47 +04:00
|
|
|
|
|
|
|
|
|
|
|
struct HyperTextToken
|
|
|
|
{
|
|
|
|
HyperTextToken(const std::string& text, bool link) : mText(text), mLink(link) {}
|
|
|
|
|
|
|
|
std::string mText;
|
|
|
|
bool mLink;
|
|
|
|
};
|
|
|
|
|
|
|
|
// In translations (at least Russian) the links are marked with @#, so
|
|
|
|
// it should be a function to parse it
|
|
|
|
std::vector<HyperTextToken> ParseHyperText(const std::string& text);
|
|
|
|
|
|
|
|
size_t RemovePseudoAsterisks(std::string& phrase);
|
2010-08-06 18:01:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|