Merge branch 'escape001' of gitea.fishrungames.com:salmon-engine-projects/space-game001 into escape001
This commit is contained in:
commit
66da012d5a
@ -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]
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
@ -25,6 +25,7 @@ namespace ZL
|
||||
: renderer(iRenderer)
|
||||
, inventory(iInventory)
|
||||
, locationId(locId)
|
||||
, roofObjectKey("")
|
||||
{
|
||||
|
||||
}
|
||||
@ -105,7 +106,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}
|
||||
@ -119,8 +120,17 @@ 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);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
shadowMap = std::make_unique<ShadowMap>(2048, 40.0f, 0.1f, 100.0f);
|
||||
@ -409,6 +419,9 @@ void Location::setup()
|
||||
}
|
||||
|
||||
for (auto& [name, gameObj] : gameObjects) {
|
||||
if (name == roofObjectKey && !roofVisible) {
|
||||
continue;
|
||||
}
|
||||
glBindTexture(GL_TEXTURE_2D, gameObj.texture->getTexID());
|
||||
renderer.DrawVertexRenderStruct(gameObj.mesh);
|
||||
}
|
||||
@ -518,6 +531,9 @@ void Location::setup()
|
||||
renderer.DrawVertexRenderStruct(roomMesh);
|
||||
|
||||
for (auto& [name, gameObj] : gameObjects) {
|
||||
if (name == roofObjectKey && !roofVisible) {
|
||||
continue;
|
||||
}
|
||||
renderer.DrawVertexRenderStruct(gameObj.mesh);
|
||||
}
|
||||
|
||||
@ -610,6 +626,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);
|
||||
}
|
||||
@ -655,6 +674,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);
|
||||
}
|
||||
}
|
||||
|
||||
if (girlfriend)
|
||||
|
||||
@ -112,6 +112,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