added loca 2
This commit is contained in:
parent
01be8852c6
commit
8191db025f
@ -10,18 +10,108 @@
|
||||
"polygon": [
|
||||
[-15, 15],
|
||||
[15, 15],
|
||||
[15, 2],
|
||||
[-15, 2]
|
||||
[15, 2.2],
|
||||
[-15, 2.2]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "main_corridor0000",
|
||||
"name": "main_corridor1",
|
||||
"available": true,
|
||||
"polygon": [
|
||||
[5, 2],
|
||||
[0, 2],
|
||||
[0, -10],
|
||||
[5, -10]
|
||||
[15, 2.2],
|
||||
[2.9, 2.2],
|
||||
[2.9, -25],
|
||||
[15, -25]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "main_corridor2",
|
||||
"available": true,
|
||||
"polygon": [
|
||||
[-15, 5],
|
||||
[-9.9, 5],
|
||||
[-9.9, -25],
|
||||
[-15, -25]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "main_corridor3",
|
||||
"available": true,
|
||||
"polygon": [
|
||||
[-15, -5.5],
|
||||
[9.7, -5.5],
|
||||
[9.7, -8.6],
|
||||
[-15, -8.6]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "main_corridor4",
|
||||
"available": true,
|
||||
"polygon": [
|
||||
[-15, -25],
|
||||
[-8.7, -25],
|
||||
[-8.7, -8.6],
|
||||
[-15, -8.6]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "main_corridor5",
|
||||
"available": true,
|
||||
"polygon": [
|
||||
[15, -25],
|
||||
[2.11, -25],
|
||||
[2.11, -8.6],
|
||||
[15, -8.6]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "main_corridor6",
|
||||
"available": true,
|
||||
"polygon": [
|
||||
[15, -25],
|
||||
[-15, -25],
|
||||
[-15, -13.5],
|
||||
[15, -13.5]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "main_corridor7",
|
||||
"available": true,
|
||||
"polygon": [
|
||||
[0.1, -25],
|
||||
[-7, -25],
|
||||
[-7, -8.5],
|
||||
[0.1, -8.5]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "main_corridor8",
|
||||
"available": true,
|
||||
"polygon": [
|
||||
[-9.3, 1.7],
|
||||
[2.5, 1.7],
|
||||
[2.5, -5],
|
||||
[-9.3, -5]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "main_corridor9",
|
||||
"available": true,
|
||||
"polygon": [
|
||||
[3, -1.2],
|
||||
[1, -1.2],
|
||||
[1, 0],
|
||||
[3, 0]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "main_corridor10",
|
||||
"available": true,
|
||||
"polygon": [
|
||||
[-0.2, -3],
|
||||
[1, -3],
|
||||
[1, -5.5],
|
||||
[-0.2, -5.5]
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
@ -24,6 +24,7 @@ namespace ZL
|
||||
: renderer(iRenderer)
|
||||
, inventory(iInventory)
|
||||
, locationId(locId)
|
||||
, roofObjectKey("")
|
||||
{
|
||||
|
||||
}
|
||||
@ -228,7 +229,7 @@ void Location::setup()
|
||||
std::vector<ModelAsset> models = {
|
||||
{"resources/out/AzsBase001.txt", "resources/ghost_avatar.png", {0.0f, 2.0f, 0.0f}, 2.0f},
|
||||
{"resources/out/AzsRoof001.txt", "resources/ghost_avatar.png", {0.0f, 2.0f, 0.0f}, 2.0f},
|
||||
{"resources/out/floor001.txt", "resources/ghost_avatar.png", {0.0f, 2.0f, 0.0f}, 2.0f},
|
||||
{"resources/out/floor001.txt", "resources/ghost_avatar.png", {0.0f, -1.97f, 0.0f}, 2.0f},
|
||||
{"resources/out/roof001.txt", "resources/ghost_avatar.png", {0.0f, 2.0f, 0.0f}, 2.0f},
|
||||
{"resources/out/Walls001.txt", "resources/ghost_avatar.png", {0.0f, 2.0f, 0.0f}, 2.0f},
|
||||
{"resources/out/Price001.txt", "resources/w/blue.png", {0.0f, 1.0f, 5.0f}, 2.0f}
|
||||
@ -242,7 +243,16 @@ void Location::setup()
|
||||
obj.mesh.data.Move(m.position);
|
||||
obj.mesh.RefreshVBO();
|
||||
obj.texture = std::make_shared<Texture>(CreateTextureDataFromPng(m.texPath, CONST_ZIP_FILE));
|
||||
gameObjects["forest_model_" + std::to_string(i)] = std::move(obj);
|
||||
//gameObjects["forest_model_" + std::to_string(i)] = std::move(obj);
|
||||
roofHideZones.clear();
|
||||
roofHideZones.emplace_back(Eigen::Vector2f(-9.3f, -5.0f), Eigen::Vector2f(2.5f, 1.7f));
|
||||
if (i == 3) {
|
||||
gameObjects["roof"] = std::move(obj);
|
||||
roofObjectKey = "roof";
|
||||
}
|
||||
else {
|
||||
gameObjects["forest_model_" + std::to_string(i)] = std::move(obj);
|
||||
}
|
||||
}
|
||||
|
||||
auto playerTexture = std::make_shared<Texture>(CreateTextureDataFromPng("resources/w/gg/IMG_20260413_182354_992.png", CONST_ZIP_FILE));
|
||||
@ -516,6 +526,9 @@ void Location::setup()
|
||||
renderer.DrawVertexRenderStruct(roomMesh);
|
||||
|
||||
for (auto& [name, gameObj] : gameObjects) {
|
||||
if (name == roofObjectKey && !roofVisible) {
|
||||
continue;
|
||||
}
|
||||
glBindTexture(GL_TEXTURE_2D, gameObj.texture->getTexID());
|
||||
renderer.DrawVertexRenderStruct(gameObj.mesh);
|
||||
}
|
||||
@ -594,6 +607,9 @@ void Location::setup()
|
||||
renderer.DrawVertexRenderStruct(roomMesh);
|
||||
|
||||
for (auto& [name, gameObj] : gameObjects) {
|
||||
if (name == roofObjectKey && !roofVisible) {
|
||||
continue;
|
||||
}
|
||||
renderer.DrawVertexRenderStruct(gameObj.mesh);
|
||||
}
|
||||
|
||||
@ -680,6 +696,9 @@ void Location::setup()
|
||||
|
||||
CheckGlError(__FILE__, __LINE__);
|
||||
for (auto& [name, gameObj] : gameObjects) {
|
||||
if (name == roofObjectKey && !roofVisible) {
|
||||
continue;
|
||||
}
|
||||
glBindTexture(GL_TEXTURE_2D, gameObj.texture->getTexID());
|
||||
renderer.DrawVertexRenderStruct(gameObj.mesh);
|
||||
}
|
||||
@ -725,6 +744,18 @@ void Location::setup()
|
||||
if (player) {
|
||||
player->update(delta);
|
||||
dialogueSystem.update(static_cast<int>(delta), player->position);
|
||||
if (!roofObjectKey.empty()) {
|
||||
bool insideAnyZone = false;
|
||||
const Eigen::Vector2f playerPos2d(player->position.x(), player->position.z());
|
||||
for (const auto& zone : roofHideZones) {
|
||||
if (zone.contains(playerPos2d)) {
|
||||
insideAnyZone = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
const float maxHeightForHide = 3.0f;
|
||||
roofVisible = !(insideAnyZone && player->position.y() < maxHeightForHide);
|
||||
}
|
||||
}
|
||||
for (auto& npc : npcs) npc->update(delta);
|
||||
|
||||
|
||||
@ -82,6 +82,9 @@ namespace ZL
|
||||
|
||||
private:
|
||||
std::string locationId;
|
||||
std::string roofObjectKey;
|
||||
bool roofVisible = true;
|
||||
std::vector<Eigen::AlignedBox<float, 2>> roofHideZones;
|
||||
};
|
||||
|
||||
} // namespace ZL
|
||||
Loading…
Reference in New Issue
Block a user