- floatified SpriteOverlap and user.OverlayZ

This commit is contained in:
Christoph Oelckers 2022-08-31 00:59:03 +02:00
parent 6d91838ae5
commit a5d6cbaa57
3 changed files with 9 additions and 13 deletions

View file

@ -1035,7 +1035,7 @@ struct USER
int16_t BladeDamageTics;
unsigned int Radius; // for distance checking
int OverlapZ; // for z overlap variable
double OverlapZ; // for z overlap variable
//
// Only have a place for actors

View file

@ -329,7 +329,7 @@ int DoSkullBeginDeath(DSWActor* actor)
actor->user.Tics = 0;
actor->user.ID = SKULL_R0;
actor->user.Radius = DamageData[DMG_SKULL_EXP].radius; //*DamageRadiusSkull;
actor->user.OverlapZ = Z(64);
actor->user.OverlapZ = 64;
change_actor_stat(actor, STAT_DEAD_ACTOR);
actor->spr.shade = -40;
@ -698,7 +698,7 @@ int DoBettyBeginDeath(DSWActor* actor)
actor->user.Tics = 0;
actor->user.ID = BETTY_R0;
actor->user.Radius = DamageData[DMG_SKULL_EXP].radius; //*DamageRadiusBetty;
actor->user.OverlapZ = Z(64);
actor->user.OverlapZ = 64;
change_actor_stat(actor, STAT_DEAD_ACTOR);
actor->spr.shade = -40;

View file

@ -843,7 +843,7 @@ void SpawnUser(DSWActor* actor, short id, STATE* state)
actor->user.Radius = 220;
actor->user.Sibling = -1;
actor->user.WaitTics = 0;
actor->user.OverlapZ = Z(4);
actor->user.OverlapZ = 4;
actor->user.bounce = 0;
actor->user.motion_blur_num = 0;
@ -4255,22 +4255,18 @@ int NewStateGroup(DSWActor* actor, STATE* StateGroup[])
bool SpriteOverlap(DSWActor* actor_a, DSWActor* actor_b)
{
int spa_tos, spa_bos, spb_tos, spb_bos, overlap_z;
if (!actor_a->hasU() || !actor_b->hasU()) return false;
if ((unsigned)DistanceI(actor_a->spr.pos, actor_b->spr.pos) > actor_a->user.Radius + actor_b->user.Radius)
{
return false;
}
spa_tos = int_ActorZOfTop(actor_a);
spa_bos = int_ActorZOfBottom(actor_a);
double spa_tos = ActorZOfTop(actor_a);
double spa_bos = ActorZOfBottom(actor_a);
double spb_tos = ActorZOfTop(actor_b);
double spb_bos = ActorZOfBottom(actor_b);
spb_tos = int_ActorZOfTop(actor_b);
spb_bos = int_ActorZOfBottom(actor_b);
overlap_z = actor_a->user.OverlapZ + actor_b->user.OverlapZ;
double overlap_z = actor_a->user.OverlapZ + actor_b->user.OverlapZ;
// if the top of sprite a is below the bottom of b
if (spa_tos - overlap_z > spb_bos)