Working on quest system

This commit is contained in:
Vladislav Khorev committed 2026-06-03 14:37:09 +03:00
1 parent aaae368a07
commit e7ae148ead
22 files changed
+357 -103

No files matched your search

+13 -11
View File
@@ -8,11 +8,10 @@ namespace ZL {
static int questStatusPriority(Quest::QuestStatus status) {
switch (status) {
case Quest::QuestStatus::Active: return 0;
case Quest::QuestStatus::Available: return 1;
case Quest::QuestStatus::Completed: return 2;
case Quest::QuestStatus::Failed: return 3;
default: return 4;
case Quest::QuestStatus::Available: return 0;
case Quest::QuestStatus::Completed: return 1;
case Quest::QuestStatus::Failed: return 2;
default: return 3;
}
}
@@ -58,8 +57,7 @@ namespace ZL {
switch (status) {
case Quest::QuestStatus::Completed: return { 0.25f, 0.95f, 0.35f, 1.0f };
case Quest::QuestStatus::Failed: return { 1.0f, 0.25f, 0.25f, 1.0f };
case Quest::QuestStatus::Active: return { 1.0f, 1.0f, 1.0f, 1.0f };
case Quest::QuestStatus::Available: return { 0.86f, 0.86f, 0.86f, 1.0f };
case Quest::QuestStatus::Available: return { 1.0f, 1.0f, 1.0f, 1.0f };
default: return { 0.45f, 0.45f, 0.45f, 1.0f };
}
}
@@ -468,7 +466,7 @@ namespace ZL {
const int pa = questStatusPriority(a->status);
const int pb = questStatusPriority(b->status);
if (pa != pb) return pa < pb;
return a->orderIndex > b->orderIndex;
return a->orderIndex < b->orderIndex;
});
static const char* kItemNames[9] = {
@@ -540,10 +538,14 @@ namespace ZL {
static const char* kCheckboxes[3] = { "objective1checkbox", "objective2checkbox", "objective3checkbox" };
static const char* kObjNames[3] = { "objective1name", "objective2name", "objective3name" };
std::vector<const Quest::QuestObjective*> visibleObjs;
for (const auto& obj : def.objectives)
if (obj.visible) visibleObjs.push_back(&obj);
for (int i = 0; i < 3; ++i) {
if (i < static_cast<int>(def.objectives.size())) {
const auto& obj = def.objectives[i];
const bool isActive = (i == quest->activeObjectiveIndex);
if (i < static_cast<int>(visibleObjs.size())) {
const auto& obj = *visibleObjs[i];
const bool isActive = (&obj - def.objectives.data() == quest->activeObjectiveIndex);
auto img = uiManager.findStaticImage(kCheckboxes[i]);
if (img) img->texture = obj.completed ? texObjectiveCompleted_ : texObjectiveBlank_;