Major refactoring
This commit is contained in:
1 parent
92ba3f2b60
commit
a1dda3fd50
8 files changed
+75
-487
No files matched your search
+38
-4
@@ -100,6 +100,19 @@ namespace ZL
|
||||
|
||||
scriptEngine.init(this, &inventory);
|
||||
|
||||
|
||||
dialogueSystem.init(renderer, CONST_ZIP_FILE);
|
||||
dialogueSystem.loadDatabase("resources/dialogue/sample_dialogues.json");
|
||||
/*dialogueSystem.addTriggerZone({
|
||||
"ghost_room_trigger",
|
||||
"test_line_dialogue",
|
||||
Eigen::Vector3f(0.0f, 0.0f, -8.5f),
|
||||
2.0f,
|
||||
true,
|
||||
false
|
||||
});*/
|
||||
|
||||
|
||||
}
|
||||
|
||||
void Location::setupNavigation()
|
||||
@@ -475,7 +488,7 @@ namespace ZL
|
||||
{
|
||||
if (player) {
|
||||
player->update(delta);
|
||||
//dialogueSystem.update(static_cast<int>(delta), player->position);
|
||||
dialogueSystem.update(static_cast<int>(delta), player->position);
|
||||
}
|
||||
for (auto& npc : npcs) npc->update(delta);
|
||||
|
||||
@@ -510,13 +523,19 @@ namespace ZL
|
||||
}
|
||||
}
|
||||
|
||||
void Location::handleDown(int64_t fingerId, int mx, int my)
|
||||
void Location::handleDown(int64_t fingerId, int eventX, int eventY, int mx, int my)
|
||||
{
|
||||
// Calculate ray for picking
|
||||
if (dialogueSystem.blocksGameplayInput()) {
|
||||
dialogueSystem.handlePointerReleased(static_cast<float>(mx), Environment::projectionHeight - static_cast<float>(my));
|
||||
return;
|
||||
}
|
||||
|
||||
player->attackTarget = nullptr;
|
||||
|
||||
// Unproject click to ground plane (y=0) for Viola's walk target
|
||||
float ndcX = 2.0f * mx / Environment::width - 1.0f;
|
||||
float ndcY = 1.0f - 2.0f * my / Environment::height;
|
||||
float ndcX = 2.0f * eventX / Environment::width - 1.0f;
|
||||
float ndcY = 1.0f - 2.0f * eventY / Environment::height;
|
||||
float aspect = (float)Environment::width / (float)Environment::height;
|
||||
float tanHalfFov = tan(CAMERA_FOV_Y * 0.5f);
|
||||
|
||||
@@ -616,5 +635,20 @@ namespace ZL
|
||||
}
|
||||
}
|
||||
|
||||
bool Location::requestDialogueStart(const std::string& dialogueId)
|
||||
{
|
||||
return dialogueSystem.startDialogue(dialogueId);
|
||||
}
|
||||
|
||||
void Location::setDialogueFlag(const std::string& flag, int value)
|
||||
{
|
||||
dialogueSystem.setFlag(flag, value);
|
||||
}
|
||||
|
||||
int Location::getDialogueFlag(const std::string& flag) const
|
||||
{
|
||||
return dialogueSystem.getFlag(flag);
|
||||
}
|
||||
|
||||
|
||||
} // namespace ZL
|
||||
Reference in new issue
Block a user