]> code.bitgloo.com Git - clyne/gamedev.git/commitdiff
fade fixes
authorClyne Sullivan <tullivan99@gmail.com>
Wed, 4 May 2016 12:48:24 +0000 (08:48 -0400)
committerClyne Sullivan <tullivan99@gmail.com>
Wed, 4 May 2016 12:48:24 +0000 (08:48 -0400)
Changelog
include/brice.hpp [new file with mode: 0644]
main.cpp
src/entities.cpp
src/ui.cpp

index a604032288d5d55844c8a28221fa6e2eb7c2834e..458634d66679e6d790fe9fd6f2fbea5dd57b40a3 100644 (file)
--- a/Changelog
+++ b/Changelog
        - 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 (file)
index 0000000..60fcec8
--- /dev/null
@@ -0,0 +1,48 @@
+#ifndef BRICE_H_
+#define BRICE_H_
+
+#include <unordered_map>
+#include <string>
+#include <istream>
+#include <fstream>
+
+#include <common.hpp>
+
+class Brice {
+private:
+       std::unordered_map<std::string, std::string> 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_
index cc6d5eb6a2817e7a516485273e977f01e4871941..a40bf4d2350803ec8ebb814b90a8e850e6c4af6b 100644 (file)
--- a/main.cpp
+++ b/main.cpp
@@ -6,6 +6,8 @@
 ** Includes section
 ** --------------------------------------------------------------------------*/
 
+#include <brice.hpp>
+
 // local library includes
 #include <tinyxml2.h>
 using namespace tinyxml2;
index 216d9efb71171149e94f7bd8194721581dd83c4e..5198c014355922340442731d598a3e1654c1b64b 100644 (file)
@@ -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)
index 234837552634fa75921bfd8ada1819c3334336fc..c75e3ff2c77135a61a12c4a9d4217f2c64ec565a 100644 (file)
@@ -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.size();i++) {
                        if (mouse.x > dialogOptText[i].second.x &&