From 0a38ef831f436e6a11a717d5518c7157f1959441 Mon Sep 17 00:00:00 2001 From: Steve Dudenhoeffer Date: Wed, 7 May 2008 05:17:21 +0000 Subject: [PATCH] Fix for amb1647: brush origin retrieval was wrong --- plugins/include/engine_stocks.inc | 8 +++++--- plugins/include/fakemeta_util.inc | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/plugins/include/engine_stocks.inc b/plugins/include/engine_stocks.inc index bd96dd98..6d80700c 100755 --- a/plugins/include/engine_stocks.inc +++ b/plugins/include/engine_stocks.inc @@ -90,12 +90,14 @@ stock get_grenade(id) stock get_brush_entity_origin(ent, Float:orig[3]) { new Float:Min[3], Float:Max[3]; + + entity_get_vector(ent, EV_VEC_origin, orig); entity_get_vector(ent, EV_VEC_mins, Min); entity_get_vector(ent, EV_VEC_maxs, Max); - orig[0] = (Min[0] + Max[0]) * 0.5; - orig[1] = (Min[1] + Max[1]) * 0.5; - orig[2] = (Min[2] + Max[2]) * 0.5; + orig[0] += (Min[0] + Max[0]) * 0.5; + orig[1] += (Min[1] + Max[1]) * 0.5; + orig[2] += (Min[2] + Max[2]) * 0.5; return 1; } diff --git a/plugins/include/fakemeta_util.inc b/plugins/include/fakemeta_util.inc index c9ba3872..bc4300ff 100644 --- a/plugins/include/fakemeta_util.inc +++ b/plugins/include/fakemeta_util.inc @@ -302,12 +302,14 @@ stock fm_fakedamage(victim, const classname[], Float:takedmgdamage, damagetype) // optimization idea by Orangutanz stock fm_get_brush_entity_origin(index, Float:origin[3]) { new Float:mins[3], Float:maxs[3]; + + pev(index, pev_origin, origin); pev(index, pev_mins, mins); pev(index, pev_maxs, maxs); - origin[0] = (mins[0] + maxs[0]) * 0.5; - origin[1] = (mins[1] + maxs[1]) * 0.5; - origin[2] = (mins[2] + maxs[2]) * 0.5; + origin[0] += (mins[0] + maxs[0]) * 0.5; + origin[1] += (mins[1] + maxs[1]) * 0.5; + origin[2] += (mins[2] + maxs[2]) * 0.5; return 1; }