Partial port of der's map rewrite, no new azone format yet but it's coming. Will convert legacy map formats on the fly atm.

This commit is contained in:
KimLS
2014-02-23 21:17:28 -08:00
parent eabea6ea16
commit 951c321ba6
17 changed files with 517 additions and 842 deletions
+17 -27
View File
@@ -2933,22 +2933,17 @@ void Mob::SetTarget(Mob* mob) {
float Mob::FindGroundZ(float new_x, float new_y, float z_offset)
{
float ret = -999999;
if (zone->zonemap != 0)
if (zone->zonemap != nullptr)
{
NodeRef pnode = zone->zonemap->SeekNode( zone->zonemap->GetRoot(), new_x, new_y );
if (pnode != NODE_NONE)
Map::Vertex me;
me.x = new_x;
me.y = new_y;
me.z = z_pos+z_offset;
Map::Vertex hit;
float best_z = zone->zonemap->FindBestZ(me, &hit);
if (best_z != -999999)
{
VERTEX me;
me.x = new_x;
me.y = new_y;
me.z = z_pos+z_offset;
VERTEX hit;
FACE *onhit;
float best_z = zone->zonemap->FindBestZ(pnode, me, &hit, &onhit);
if (best_z != -999999)
{
ret = best_z;
}
ret = best_z;
}
}
return ret;
@@ -2960,20 +2955,15 @@ float Mob::GetGroundZ(float new_x, float new_y, float z_offset)
float ret = -999999;
if (zone->zonemap != 0)
{
NodeRef pnode = zone->zonemap->SeekNode( zone->zonemap->GetRoot(), new_x, new_y );
if (pnode != NODE_NONE)
Map::Vertex me;
me.x = new_x;
me.y = new_y;
me.z = z_pos+z_offset;
Map::Vertex hit;
float best_z = zone->zonemap->FindBestZ(me, &hit);
if (best_z != -999999)
{
VERTEX me;
me.x = new_x;
me.y = new_y;
me.z = z_pos+z_offset;
VERTEX hit;
FACE *onhit;
float best_z = zone->zonemap->FindBestZ(pnode, me, &hit, &onhit);
if (best_z != -999999)
{
ret = best_z;
}
ret = best_z;
}
}
return ret;