- add a floating point wrapper for USER:Radius.

Changing the variable causes more problems than it solves.
This commit is contained in:
Christoph Oelckers 2022-09-08 17:06:41 +02:00
parent a441e01363
commit 75476d84dd
4 changed files with 11 additions and 10 deletions

View file

@ -982,6 +982,7 @@ struct USER
int16_t BladeDamageTics;
unsigned int Radius; // for distance checking
double fRadius() const { return Radius * inttoworld; }
double OverlapZ; // for z overlap variable
//

View file

@ -6232,7 +6232,7 @@ void DoPlayerDeathCheckKick(PLAYER* pp)
double dist = (itActor->spr.pos.XY() - plActor->spr.pos.XY()).Length();
if (dist < (itActor->user.Radius + 100) * inttoworld)
if (dist < itActor->user.fRadius() + 6.25)
{
pp->KillerActor = itActor;

View file

@ -4353,7 +4353,7 @@ bool SpriteOverlap(DSWActor* actor_a, DSWActor* actor_b)
{
if (!actor_a->hasU() || !actor_b->hasU()) return false;
double dist = (actor_a->spr.pos.XY() - actor_b->spr.pos.XY()).Length();
if (dist > (actor_a->user.Radius + actor_b->user.Radius) * inttoworld)
if (dist > (actor_a->user.fRadius() + actor_b->user.fRadius()))
{
return false;
}
@ -5200,7 +5200,7 @@ int DoGet(DSWActor* actor)
continue;
double dist = (pp->pos.XY() - actor->spr.pos).Length();
if ((unsigned)dist > (plActor->user.Radius * 2 * inttoworld))
if ((unsigned)dist > (plActor->user.fRadius() * 2))
{
continue;
}

View file

@ -7184,7 +7184,7 @@ int DoDamageTest(DSWActor* actor)
{
double dist = (itActor->spr.pos.XY() - actor->spr.pos.XY()).Length();
if (dist > actor->user.Radius * 2 * inttoworld)
if (dist > actor->user.fRadius() * 2)
continue;
if (actor == itActor)
@ -7266,7 +7266,7 @@ int DoFlamesDamageTest(DSWActor* actor)
double dist = (itActor->spr.pos.XY() - actor->spr.pos.XY()).Length();
if (dist > actor->user.Radius * 2 * inttoworld)
if (dist > actor->user.fRadius() * 2)
continue;
if (actor == itActor)
@ -7417,7 +7417,7 @@ int DoExpDamageTest(DSWActor* actor)
{
double dist = (itActor->spr.pos.XY() - actor->spr.pos.XY()).Length();
if (dist > actor->user.Radius * 2 * inttoworld)
if (dist > actor->user.fRadius() * 2)
continue;
if (itActor == actor)
@ -7462,11 +7462,11 @@ int DoExpDamageTest(DSWActor* actor)
{
double dist = (itActor->spr.pos.XY() - actor->spr.pos.XY()).Length();
if (dist > actor->user.Radius * inttoworld)
if (dist > actor->user.fRadius())
continue;
dist = (ActorVectOfMiddle(itActor) - actor->spr.pos).Length();
if (dist > actor->user.Radius * inttoworld)
if (dist > actor->user.fRadius())
continue;
if (!FAFcansee(ActorVectOfMiddle(itActor), itActor->sector(), actor->spr.pos, actor->sector()))
@ -7491,7 +7491,7 @@ int DoExpDamageTest(DSWActor* actor)
{
double dist = (itActor->spr.pos.XY() - actor->spr.pos.XY()).Length();
if (dist > actor->user.Radius * 0.25 * inttoworld)
if (dist > actor->user.fRadius() * 0.25)
continue;
if (TEST_BOOL1(actor))
@ -7542,7 +7542,7 @@ int DoMineExpMine(DSWActor* actor)
{
double dist = (itActor->spr.pos.XY() - actor->spr.pos.XY()).Length();
if (dist > actor->user.Radius * 2 * inttoworld)
if (dist > actor->user.fRadius() * 2)
continue;
if (itActor == actor)