Skip to content

Commit 69ee6e0

Browse files
authored
entity_info: allow to see the exact origin of the brush entities (#276)
* entity_info: allow to see the exact origin of the entities * entity_info: apply that fix only for brush entities * entity_info: checking to bsp flags instead of func_ classname
1 parent 984a32e commit 69ee6e0

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

BunnymodXT/hud_custom.cpp

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -777,9 +777,17 @@ namespace CustomHud
777777
{
778778
out << "Yaw: " << ent->v.angles[1] << '\n';
779779

780-
out << "X: " << ent->v.origin.x << '\n';
781-
out << "Y: " << ent->v.origin.y << '\n';
782-
out << "Z: " << ent->v.origin.z << '\n';
780+
// Borrowed from https://github.com/SNMetamorph/goldsrc-monitor/blob/08c368e246d09996b2d85e4367d4d8cc1e507712/sources/library/displaymode_entityreport.cpp#L45
781+
Vector origin;
782+
783+
if (ent->v.solid == SOLID_BSP || ent->v.movetype == MOVETYPE_PUSHSTEP)
784+
origin = ent->v.origin + ((ent->v.mins + ent->v.maxs) / 2.f);
785+
else
786+
origin = ent->v.origin;
787+
788+
out << "X: " << origin.x << '\n';
789+
out << "Y: " << origin.y << '\n';
790+
out << "Z: " << origin.z << '\n';
783791

784792
out << "X Vel: " << ent->v.velocity.x << '\n';
785793
out << "Y Vel: " << ent->v.velocity.y << '\n';

0 commit comments

Comments
 (0)