Refactored ScriptThread::EventPointsWithinDist for more clarity

This commit is contained in:
smallmodel 2024-04-21 19:39:32 +02:00
parent 054201bea9
commit 06dab5d8b0
No known key found for this signature in database
GPG key ID: 9F2D623CEDF08512

View file

@ -4183,12 +4183,16 @@ void ScriptThread::EventAIsCloserThanBToC(Event *ev)
void ScriptThread::EventPointsWithinDist(Event *ev)
{
Vector delta;
float dist = ev->GetFloat(3);
delta = ev->GetVector(1) - ev->GetVector(2);
Vector v1, v2;
float fDistance;
v1 = ev->GetVector(1);
v2 = ev->GetVector(2);
fDistance = ev->GetFloat(3);
delta = v1 - v2;
// check squared distance
ev->AddInteger(((delta * delta) < (dist * dist)));
ev->AddInteger(delta.lengthSquared() < Square(fDistance));
}
bool ScriptThread::CanScriptTracePrint(void)