record and replay dialog choices
This commit is contained in:
@@ -14,6 +14,8 @@
|
||||
#include <locale>
|
||||
#include <codecvt>
|
||||
#include <string>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include "render_shapes.hpp"
|
||||
|
||||
using base64 = cppcodec::base64_rfc4648;
|
||||
|
||||
@@ -217,4 +219,31 @@ cKey key_from_action(Element& action) {
|
||||
key.mod = static_cast<eKeyMod>(enum_v);
|
||||
|
||||
return key;
|
||||
}
|
||||
|
||||
word_rect_t word_rect_from_action(Element& action) {
|
||||
auto info = info_from_action(action);
|
||||
|
||||
std::string word = info["word"];
|
||||
rectangle rect = boost::lexical_cast<rectangle>(info["rect"]);
|
||||
|
||||
word_rect_t word_rect(word, rect);
|
||||
|
||||
word_rect.node = boost::lexical_cast<int>(info["node"]);
|
||||
|
||||
bool preset = boost::lexical_cast<bool>(info["preset"]);
|
||||
word_rect.on = preset ? PRESET_WORD_ON : CUSTOM_WORD_ON;
|
||||
word_rect.off = preset ? PRESET_WORD_OFF : CUSTOM_WORD_OFF;
|
||||
return word_rect;
|
||||
}
|
||||
|
||||
void record_click_talk_rect(word_rect_t word_rect, bool preset) {
|
||||
std::map<std::string,std::string> info;
|
||||
|
||||
info["word"] = word_rect.word;
|
||||
info["rect"] = boost::lexical_cast<std::string>(word_rect.rect);
|
||||
info["node"] = boost::lexical_cast<std::string>(word_rect.node);
|
||||
info["preset"] = boost::lexical_cast<std::string>(preset);
|
||||
|
||||
record_action("click_talk_rect", info);
|
||||
}
|
@@ -7,11 +7,14 @@
|
||||
#include <boost/filesystem.hpp>
|
||||
#include "location.hpp"
|
||||
#include "dialogxml/keycodes.hpp"
|
||||
#include "boe.newgraph.hpp"
|
||||
|
||||
// Input recording system
|
||||
namespace ticpp { class Element; }
|
||||
using ticpp::Element;
|
||||
|
||||
struct word_rect_t;
|
||||
|
||||
extern bool recording;
|
||||
extern bool replaying;
|
||||
|
||||
@@ -28,5 +31,7 @@ extern void decode_file(std::string data, fs::path file);
|
||||
extern location location_from_action(Element& action);
|
||||
extern short short_from_action(Element& action);
|
||||
extern cKey key_from_action(Element& action);
|
||||
extern word_rect_t word_rect_from_action(Element& action);
|
||||
extern void record_click_talk_rect(word_rect_t word_rect, bool preset);
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user