From 095293277dbca80e91c4f25b05923b7cb3a79396 Mon Sep 17 00:00:00 2001 From: Clyne Sullivan Date: Wed, 4 May 2016 08:48:24 -0400 Subject: fade fixes --- Changelog | 9 +++++++++ include/brice.hpp | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ main.cpp | 2 ++ src/entities.cpp | 2 +- src/ui.cpp | 6 +++--- 5 files changed, 63 insertions(+), 4 deletions(-) create mode 100644 include/brice.hpp diff --git a/Changelog b/Changelog index a604032..458634d 100644 --- a/Changelog +++ b/Changelog @@ -968,3 +968,12 @@ - found segfault when exiting game - made string tokenizer for tokenizing strings - messed with HLINE scaling, it's bad + +5/4/2016: +========= + + - began implementing event saving thing + - fixed fade transitions + - re-added click to speed up dialogs + - almost ready to add new draw stuff + diff --git a/include/brice.hpp b/include/brice.hpp new file mode 100644 index 0000000..60fcec8 --- /dev/null +++ b/include/brice.hpp @@ -0,0 +1,48 @@ +#ifndef BRICE_H_ +#define BRICE_H_ + +#include +#include +#include +#include + +#include + +class Brice { +private: + std::unordered_map ice; +public: + Brice(void){} + ~Brice(void){} + + std::string getValue(const std::string& id) const { + auto item = ice.find(id); + return (item == std::end(ice)) ? "" : item->second; + } + + void addValue(const std::string &id, const std::string& value) { + ice.emplace(std::make_pair(id, value)); + } + + void save(void) const { + std::ofstream out ("brice.dat", std::ios::out | std::ios::binary); + std::string data = std::to_string(ice.size()) + '\n'; + + if (!out.is_open()) + UserError("Cannot open brice data file"); + + for (const auto& i : ice) { + data.append(i.first + ',' ); + data.append(i.second + '\n'); + } + + out.write(data.data(), data.size()); + out.close(); + } + + void load(void) { + const std::string data = readFile("brice.dat"); + } +}; + +#endif // BRICE_H_ diff --git a/main.cpp b/main.cpp index cc6d5eb..a40bf4d 100644 --- a/main.cpp +++ b/main.cpp @@ -6,6 +6,8 @@ ** Includes section ** --------------------------------------------------------------------------*/ +#include + // local library includes #include using namespace tinyxml2; diff --git a/src/entities.cpp b/src/entities.cpp index 216d9ef..5198c01 100644 --- a/src/entities.cpp +++ b/src/entities.cpp @@ -546,7 +546,7 @@ COMMONAIFUNC: } while ((oxml = oxml->NextSiblingElement())); // run the dialog stuff - ui::dialogBox(name, optstr, false, exml->GetText() + 1); + ui::dialogBox(name, optstr, false, exml->GetText() + 2); ui::waitForDialog(); if (ui::dialogOptChosen) diff --git a/src/ui.cpp b/src/ui.cpp index 2348375..c75e3ff 100644 --- a/src/ui.cpp +++ b/src/ui.cpp @@ -76,7 +76,7 @@ extern void mainLoop(void); static bool fadeEnable = false; static bool fadeWhite = false; static bool fadeFast = false; -static unsigned int fadeIntensity = 0; +static int fadeIntensity = 0; bool inBattle = false; Mix_Chunk *battleStart; @@ -865,10 +865,10 @@ namespace ui { return; } - /*if (!typeOutDone) { + if (!typeOutDone) { typeOutDone = true; return; - }*/ + } for(i=0;i dialogOptText[i].second.x && -- cgit v1.2.3