Working on save-load system and UI

This commit is contained in:
Vladislav Khorev committed 2026-06-20 21:41:07 +03:00
1 parent 901142385d
commit d7db0faea3
29 files changed
+708 -180

No files matched your search

+4 -3
View File
@@ -3,6 +3,7 @@
#include "dialogue/DialogueDatabase.h"
#include "quest/QuestJournal.h"
#include "external/nlohmann/json.hpp"
#include "ISaveable.h"
#include <functional>
#include <string>
#include <unordered_map>
@@ -11,7 +12,7 @@
namespace ZL::Dialogue {
class DialogueRuntime {
class DialogueRuntime : public ZL::ISaveable {
public:
void setDatabase(const DialogueDatabase* value);
@@ -43,10 +44,10 @@ public:
// Saves whether a dialogue is active, its id, and current node.
// Cutscene state is not saved.
void save(nlohmann::json& out) const;
void save(nlohmann::json& out) const override;
// Restores saved dialogue state. Text reveal snaps to completion so the
// typing animation doesn't replay. No callbacks are fired on restore.
void load(const nlohmann::json& in);
void load(const nlohmann::json& in) override;
private:
enum class Mode {
+5 -1
View File
@@ -7,13 +7,14 @@
#include "cutscene/CutsceneOverlay.h"
#include "cutscene/CutsceneRuntime.h"
#include "quest/QuestJournal.h"
#include "ISaveable.h"
#include <SDL.h>
#include <functional>
#include <string>
namespace ZL::Dialogue {
class DialogueSystem {
class DialogueSystem : public ZL::ISaveable {
public:
bool init(Renderer& renderer, const std::string& zipFile = "");
@@ -45,6 +46,9 @@ public:
void saveDialogueState(nlohmann::json& out) const { dialogueRuntime.save(out); }
void loadDialogueState(const nlohmann::json& in) { dialogueRuntime.load(in); }
void save(nlohmann::json& out) const override { saveDialogueState(out); }
void load(const nlohmann::json& in) override { loadDialogueState(in); }
bool isActive() const { return dialogueRuntime.isActive() || cutsceneRuntime.isActive(); }
bool blocksGameplayInput() const { return isActive(); }