Added startup scripts

This commit is contained in:
Vladislav Khorev committed 2026-05-09 14:14:04 +03:00
1 parent a479fa4ac1
commit 13ef92160d
26 files changed
+117164 -150

No files matched your search

+1 -25
View File
@@ -11,23 +11,7 @@ bool DialogueSystem::loadDatabase(const std::string& path) {
return database.loadFromFile(path);
}
void DialogueSystem::update(int deltaMs, const Eigen::Vector3f& playerPosition) {
if (!runtime.isActive()) {
for (TriggerZone& zone : triggerZones) {
if (zone.once && zone.triggered) {
continue;
}
const Eigen::Vector3f diff = playerPosition - zone.center;
if (diff.norm() <= zone.radius) {
if (startDialogue(zone.dialogueId)) {
zone.triggered = true;
break;
}
}
}
}
void DialogueSystem::update(int deltaMs) {
runtime.update(deltaMs);
overlay.update(runtime.getPresentation(), deltaMs);
if (overlay.consumeSkipRequested()) {
@@ -139,12 +123,4 @@ void DialogueSystem::stopDialogue() {
runtime.stop();
}
void DialogueSystem::addTriggerZone(const TriggerZone& zone) {
triggerZones.push_back(zone);
}
void DialogueSystem::clearTriggerZones() {
triggerZones.clear();
}
} // namespace ZL::Dialogue
+1 -16
View File
@@ -2,28 +2,17 @@
#include "dialogue/DialogueOverlay.h"
#include "dialogue/DialogueRuntime.h"
#include <Eigen/Dense>
#include <SDL.h>
#include <string>
#include <vector>
namespace ZL::Dialogue {
struct TriggerZone {
std::string id;
std::string dialogueId;
Eigen::Vector3f center = Eigen::Vector3f::Zero();
float radius = 1.5f;
bool once = true;
bool triggered = false;
};
class DialogueSystem {
public:
bool init(Renderer& renderer, const std::string& zipFile = "");
bool loadDatabase(const std::string& path);
void update(int deltaMs, const Eigen::Vector3f& playerPosition);
void update(int deltaMs);
void draw(Renderer& renderer);
bool handleKeyDown(SDL_Keycode key);
@@ -40,14 +29,10 @@ public:
void setFlag(const std::string& name, int value) { runtime.setFlag(name, value); }
int getFlag(const std::string& name) const { return runtime.getFlag(name); }
void addTriggerZone(const TriggerZone& zone);
void clearTriggerZones();
private:
DialogueDatabase database;
DialogueRuntime runtime;
DialogueOverlay overlay;
std::vector<TriggerZone> triggerZones;
};
} // namespace ZL::Dialogue