don't do zone offset stuff on mins/maxs if the offset is bigger than the zone's x/y half-distance

xc_fox_shrine_japan_v1 will crash if i make a 16unit zone at the top (maybe elsewhere too?) so that's why this was added.
This commit is contained in:
rtldg 2021-12-19 10:46:15 +00:00
parent 6952bab715
commit 39c9d96924

View File

@ -3877,15 +3877,30 @@ public void CreateZoneEntities(bool only_create_dead_entities)
float height = ((IsSource2013(gEV_Type))? 62.0:72.0) / 2;
float min[3];
min[0] = -distance_x + gCV_BoxOffset.FloatValue;
min[1] = -distance_y + gCV_BoxOffset.FloatValue;
min[0] = -distance_x;
min[1] = -distance_y;
min[2] = -distance_z + height;
SetEntPropVector(entity, Prop_Send, "m_vecMins", min);
float max[3];
max[0] = distance_x - gCV_BoxOffset.FloatValue;
max[1] = distance_y - gCV_BoxOffset.FloatValue;
max[0] = distance_x;
max[1] = distance_y;
max[2] = distance_z - height;
float offset = gCV_BoxOffset.FloatValue;
if (distance_x > offset)
{
min[0] += offset;
max[0] -= offset;
}
if (distance_y > offset)
{
min[1] += offset;
max[1] -= offset;
}
SetEntPropVector(entity, Prop_Send, "m_vecMins", min);
SetEntPropVector(entity, Prop_Send, "m_vecMaxs", max);
SetEntProp(entity, Prop_Send, "m_nSolidType", 2);