mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 01:11:29 +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
20
zone/map.cpp
20
zone/map.cpp
@ -31,12 +31,14 @@ Map::~Map() {
|
||||
}
|
||||
|
||||
float Map::FindBestZ(glm::vec3 &start, glm::vec3 *result) const {
|
||||
if (!imp)
|
||||
if (!imp) {
|
||||
return BEST_Z_INVALID;
|
||||
}
|
||||
|
||||
glm::vec3 tmp;
|
||||
if(!result)
|
||||
if (!result) {
|
||||
result = &tmp;
|
||||
}
|
||||
|
||||
start.z += RuleI(Map, FindBestZHeightAdjust);
|
||||
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;
|
||||
|
||||
hit = imp->rm->raycast((const RmReal*)&from, (const RmReal*)&to, (RmReal*)result, nullptr, &hit_distance);
|
||||
if(hit) {
|
||||
if (hit && zone->newzone_data.underworld != 0.0f && result->z < zone->newzone_data.underworld) {
|
||||
hit = false;
|
||||
}
|
||||
|
||||
if (hit) {
|
||||
return result->z;
|
||||
}
|
||||
|
||||
// Find nearest Z above us
|
||||
|
||||
to.z = -BEST_Z_INVALID;
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user