mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 17:51:28 +00:00
[Bug] FindBestZ selecting false zone floor as bestz - Results in roambox failures (#4504)
Added underworld checks per the EQMac project
This commit is contained in:
parent
7a1d69d0d4
commit
9ac306fe67
18
zone/map.cpp
18
zone/map.cpp
@ -31,12 +31,14 @@ Map::~Map() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
float Map::FindBestZ(glm::vec3 &start, glm::vec3 *result) const {
|
float Map::FindBestZ(glm::vec3 &start, glm::vec3 *result) const {
|
||||||
if (!imp)
|
if (!imp) {
|
||||||
return BEST_Z_INVALID;
|
return BEST_Z_INVALID;
|
||||||
|
}
|
||||||
|
|
||||||
glm::vec3 tmp;
|
glm::vec3 tmp;
|
||||||
if(!result)
|
if (!result) {
|
||||||
result = &tmp;
|
result = &tmp;
|
||||||
|
}
|
||||||
|
|
||||||
start.z += RuleI(Map, FindBestZHeightAdjust);
|
start.z += RuleI(Map, FindBestZHeightAdjust);
|
||||||
glm::vec3 from(start.x, start.y, start.z);
|
glm::vec3 from(start.x, start.y, start.z);
|
||||||
@ -45,16 +47,22 @@ float Map::FindBestZ(glm::vec3 &start, glm::vec3 *result) const {
|
|||||||
bool hit = false;
|
bool hit = false;
|
||||||
|
|
||||||
hit = imp->rm->raycast((const RmReal*)&from, (const RmReal*)&to, (RmReal*)result, nullptr, &hit_distance);
|
hit = imp->rm->raycast((const RmReal*)&from, (const RmReal*)&to, (RmReal*)result, nullptr, &hit_distance);
|
||||||
|
if (hit && zone->newzone_data.underworld != 0.0f && result->z < zone->newzone_data.underworld) {
|
||||||
|
hit = false;
|
||||||
|
}
|
||||||
|
|
||||||
if (hit) {
|
if (hit) {
|
||||||
return result->z;
|
return result->z;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find nearest Z above us
|
// Find nearest Z above us
|
||||||
|
|
||||||
to.z = -BEST_Z_INVALID;
|
to.z = -BEST_Z_INVALID;
|
||||||
hit = imp->rm->raycast((const RmReal*)&from, (const RmReal*)&to, (RmReal*)result, nullptr, &hit_distance);
|
hit = imp->rm->raycast((const RmReal*)&from, (const RmReal*)&to, (RmReal*)result, nullptr, &hit_distance);
|
||||||
if (hit)
|
if (zone->newzone_data.max_z != 0.0f && result->z > zone->newzone_data.max_z) {
|
||||||
{
|
hit = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hit) {
|
||||||
return result->z;
|
return result->z;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user