Added hp and attack actions, and labels

This commit is contained in:
Vladislav Khorev committed 2026-04-25 12:07:52 +03:00
1 parent 393ebcd831
commit 44cc0fba67
8 files changed
+166 -9

No files matched your search

+32
View File
@@ -119,6 +119,7 @@ namespace ZL
npc02->loadBinaryAnimation(AnimationState::DEATH_IDLE, "resources/w/default_float001_cut.anim", CONST_ZIP_FILE);
npc02->npcId = "ghost_01x";
npc02->npcName = "Evil Ghost";
npc02->setTexture(ghostTexture);
npc02->walkSpeed = 1.5f;
npc02->rotationSpeed = 8.0f;
@@ -147,6 +148,12 @@ namespace ZL
dialogueSystem.init(renderer, CONST_ZIP_FILE);
dialogueSystem.loadDatabase("resources/dialogue/sample_dialogues.json");
npcNameText = std::make_unique<TextRenderer>();
if (!npcNameText->init(renderer, "resources/fonts/DroidSans.ttf", 24, CONST_ZIP_FILE)) {
std::cerr << "Failed to init NPC name TextRenderer" << std::endl;
npcNameText.reset();
}
/*dialogueSystem.addTriggerZone({
"ghost_room_trigger",
"test_line_dialogue",
@@ -362,6 +369,18 @@ namespace ZL
renderer.shaderManager.PopShader();
if (npcNameText) {
Eigen::Matrix4f proj = MakePerspectiveMatrix(1.0f / 1.5f,
static_cast<float>(Environment::width) / static_cast<float>(Environment::height),
Environment::CONST_Z_NEAR, Environment::CONST_Z_FAR);
for (auto& npc : npcs) {
if (npc) npc->drawName(*npcNameText, currentView, proj);
}
if (player) player->drawHealthBar(renderer, currentView, proj);
for (auto& npc : npcs) {
if (npc) npc->drawHealthBar(renderer, currentView, proj);
}
}
}
void Location::drawShadowDepthPass()
@@ -534,6 +553,19 @@ namespace ZL
renderer.PopMatrix();
renderer.PopProjectionMatrix();
renderer.shaderManager.PopShader();
if (npcNameText) {
Eigen::Matrix4f proj = MakePerspectiveMatrix(1.0f / 1.5f,
static_cast<float>(Environment::width) / static_cast<float>(Environment::height),
Environment::CONST_Z_NEAR, Environment::CONST_Z_FAR);
for (auto& npc : npcs) {
if (npc) npc->drawName(*npcNameText, cameraViewMatrix, proj);
}
if (player) player->drawHealthBar(renderer, cameraViewMatrix, proj);
for (auto& npc : npcs) {
if (npc) npc->drawHealthBar(renderer, cameraViewMatrix, proj);
}
}
}
bool Location::setNavigationAreaAvailable(const std::string& areaName, bool available)