- another set of 2 Utilities prepared for floatification.

This commit is contained in:
Christoph Oelckers 2022-08-21 10:00:08 +02:00
parent 82968f876f
commit 5e14361dd6
16 changed files with 112 additions and 102 deletions

View file

@ -349,7 +349,7 @@ int DoActorSectorDamage(DSWActor* actor)
} }
// note that most squishing is done in vator.c // note that most squishing is done in vator.c
if (actor->user.lo_sectp && actor->user.hi_sectp && abs(actor->user.int_loz() - actor->user.int_hiz()) < (ActorSizeZ(actor) >> 1)) if (actor->user.lo_sectp && actor->user.hi_sectp && abs(actor->user.int_loz() - actor->user.int_hiz()) < (int_ActorSizeZ(actor) >> 1))
{ {
actor->user.Health = 0; actor->user.Health = 0;
if (SpawnShrap(actor, nullptr, WPN_NM_SECTOR_SQUISH)) if (SpawnShrap(actor, nullptr, WPN_NM_SECTOR_SQUISH))

View file

@ -100,9 +100,9 @@ bool ActorFlaming(DSWActor* actor)
{ {
int size; int size;
size = ActorSizeZ(actor) - (ActorSizeZ(actor) >> 2); size = int_ActorSizeZ(actor) - (int_ActorSizeZ(actor) >> 2);
if (ActorSizeZ(flame) > size) if (int_ActorSizeZ(flame) > size)
return true; return true;
} }
@ -219,7 +219,7 @@ bool CanSeePlayer(DSWActor* actor)
// if actor can still see the player // if actor can still see the player
int look_height = int_ActorZOfTop(actor); int look_height = int_ActorZOfTop(actor);
if (actor->user.targetActor && FAFcansee(actor->int_pos().X, actor->int_pos().Y, look_height, actor->sector(), actor->user.targetActor->int_pos().X, actor->user.targetActor->int_pos().Y, ActorUpperZ(actor->user.targetActor), actor->user.targetActor->sector())) if (actor->user.targetActor && FAFcansee(actor->int_pos().X, actor->int_pos().Y, look_height, actor->sector(), actor->user.targetActor->int_pos().X, actor->user.targetActor->int_pos().Y, int_ActorUpperZ(actor->user.targetActor), actor->user.targetActor->sector()))
return true; return true;
else else
return false; return false;
@ -233,7 +233,7 @@ int CanHitPlayer(DSWActor* actor)
// if actor can still see the player // if actor can still see the player
int zhs, zhh; int zhs, zhh;
zhs = actor->int_pos().Z - (ActorSizeZ(actor) >> 1); zhs = actor->int_pos().Z - (int_ActorSizeZ(actor) >> 1);
auto targ = actor->user.targetActor; auto targ = actor->user.targetActor;
@ -246,7 +246,7 @@ int CanHitPlayer(DSWActor* actor)
yvect = bsin(ang); yvect = bsin(ang);
// get zvect // get zvect
zhh = targ->int_pos().Z - (ActorSizeZ(targ) >> 1); zhh = targ->int_pos().Z - (int_ActorSizeZ(targ) >> 1);
if (targ->int_pos().X - actor->int_pos().X != 0) if (targ->int_pos().X - actor->int_pos().X != 0)
zvect = xvect * ((zhh - zhs) / (targ->int_pos().X - actor->int_pos().X)); zvect = xvect * ((zhh - zhs) / (targ->int_pos().X - actor->int_pos().X));
else if (targ->int_pos().Y - actor->int_pos().Y != 0) else if (targ->int_pos().Y - actor->int_pos().Y != 0)
@ -353,7 +353,7 @@ int DoActorPickClosePlayer(DSWActor* actor)
DISTANCE(actor->int_pos().X, actor->int_pos().Y, pp->int_ppos().X, pp->int_ppos().Y, dist, a, b, c); DISTANCE(actor->int_pos().X, actor->int_pos().Y, pp->int_ppos().X, pp->int_ppos().Y, dist, a, b, c);
DSWActor* plActor = pp->actor; DSWActor* plActor = pp->actor;
if (dist < near_dist && FAFcansee(actor->int_pos().X, actor->int_pos().Y, look_height, actor->sector(), plActor->int_pos().X, plActor->int_pos().Y, ActorUpperZ(plActor), plActor->sector())) if (dist < near_dist && FAFcansee(actor->int_pos().X, actor->int_pos().Y, look_height, actor->sector(), plActor->int_pos().X, plActor->int_pos().Y, int_ActorUpperZ(plActor), plActor->sector()))
{ {
near_dist = dist; near_dist = dist;
actor->user.targetActor = pp->actor; actor->user.targetActor = pp->actor;
@ -379,7 +379,7 @@ TARGETACTOR:
DISTANCE(actor->int_pos().X, actor->int_pos().Y, itActor->int_pos().X, itActor->int_pos().Y, dist, a, b, c); DISTANCE(actor->int_pos().X, actor->int_pos().Y, itActor->int_pos().X, itActor->int_pos().Y, dist, a, b, c);
if (dist < near_dist && FAFcansee(actor->int_pos().X, actor->int_pos().Y, look_height, actor->sector(), itActor->int_pos().X, itActor->int_pos().Y, ActorUpperZ(itActor), itActor->sector())) if (dist < near_dist && FAFcansee(actor->int_pos().X, actor->int_pos().Y, look_height, actor->sector(), itActor->int_pos().X, itActor->int_pos().Y, int_ActorUpperZ(itActor), itActor->sector()))
{ {
near_dist = dist; near_dist = dist;
actor->user.targetActor = itActor; actor->user.targetActor = itActor;
@ -433,8 +433,8 @@ int DoActorOperate(DSWActor* actor)
if ((actor->user.WaitTics -= ACTORMOVETICS) > 0) if ((actor->user.WaitTics -= ACTORMOVETICS) > 0)
return false; return false;
z[0] = actor->int_pos().Z - ActorSizeZ(actor) + Z(5); z[0] = actor->int_pos().Z - int_ActorSizeZ(actor) + Z(5);
z[1] = actor->int_pos().Z - (ActorSizeZ(actor) >> 1); z[1] = actor->int_pos().Z - (int_ActorSizeZ(actor) >> 1);
for (i = 0; i < SIZ(z); i++) for (i = 0; i < SIZ(z); i++)
{ {
@ -922,7 +922,7 @@ int FindTrackToPlayer(DSWActor* actor)
BIT(TT_SCAN) BIT(TT_SCAN)
}; };
zdiff = ActorUpperZ(actor->user.targetActor) - (actor->int_pos().Z - ActorSizeZ(actor) + Z(8)); zdiff = int_ActorUpperZ(actor->user.targetActor) - (actor->int_pos().Z - int_ActorSizeZ(actor) + Z(8));
if (abs(zdiff) <= Z(20)) if (abs(zdiff) <= Z(20))
{ {

View file

@ -908,7 +908,7 @@ void DoPickCloseBunny(DSWActor* actor)
if (dist > near_dist) continue; if (dist > near_dist) continue;
ICanSee = FAFcansee(actor->int_pos().X, actor->int_pos().Y, look_height, actor->sector(), itActor->int_pos().X, itActor->int_pos().Y, ActorUpperZ(itActor), itActor->sector()); ICanSee = FAFcansee(actor->int_pos().X, actor->int_pos().Y, look_height, actor->sector(), itActor->int_pos().X, itActor->int_pos().Y, int_ActorUpperZ(itActor), itActor->sector());
if (ICanSee && dist < near_dist && itActor->user.ID == BUNNY_RUN_R0) if (ICanSee && dist < near_dist && itActor->user.ID == BUNNY_RUN_R0)
{ {

View file

@ -411,7 +411,7 @@ void EnemyDefaults(DSWActor* actor, ACTOR_ACTION_SET* action, PERSONALITY* perso
actor->user.lo_step = Z(32); actor->user.lo_step = Z(32);
actor->user.floor_dist = actor->user.zclip - actor->user.lo_step * zinttoworld; actor->user.floor_dist = actor->user.zclip - actor->user.lo_step * zinttoworld;
actor->user.ceiling_dist = ActorSizeZ(actor) * zinttoworld - actor->user.zclip; actor->user.ceiling_dist = int_ActorSizeZ(actor) * zinttoworld - actor->user.zclip;
actor->user.Radius = 400; actor->user.Radius = 400;

View file

@ -1089,7 +1089,7 @@ void CameraView(PLAYER* pp, int *tx, int *ty, int *tz, sectortype** tsect, DAngl
FAFcansee_test = FAFcansee_test =
(FAFcansee(actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z, actor->sector(), *tx, *ty, *tz, pp->cursector) || (FAFcansee(actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z, actor->sector(), *tx, *ty, *tz, pp->cursector) ||
FAFcansee(actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z, actor->sector(), *tx, *ty, *tz + ActorSizeZ(pp->actor), pp->cursector)); FAFcansee(actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z, actor->sector(), *tx, *ty, *tz + int_ActorSizeZ(pp->actor), pp->cursector));
player_in_camera = ang_test && FAFcansee_test; player_in_camera = ang_test && FAFcansee_test;

View file

@ -2134,35 +2134,45 @@ inline double ActorZOfMiddle(DSWActor* actor)
return (int_ActorZOfTop(actor) + int_ActorZOfBottom(actor)) * zinttoworld * 0.5; return (int_ActorZOfTop(actor) + int_ActorZOfBottom(actor)) * zinttoworld * 0.5;
} }
inline int ActorSizeZ(DSWActor* actor) inline int int_ActorSizeZ(DSWActor* actor)
{ {
return (tileHeight(actor->spr.picnum) * actor->spr.yrepeat) << 2; return (tileHeight(actor->spr.picnum) * actor->spr.yrepeat) << 2;
} }
inline int ActorUpperZ(DSWActor* actor) inline double ActorSizeZ(DSWActor* actor)
{ {
return (int_ActorZOfTop(actor) + (ActorSizeZ(actor) >> 2)); return (tileHeight(actor->spr.picnum) * actor->spr.yrepeat) / 64.;
}
inline int int_ActorUpperZ(DSWActor* actor)
{
return (int_ActorZOfTop(actor) + (int_ActorSizeZ(actor) >> 2));
}
inline double ActorUpperZ(DSWActor* actor)
{
return (ActorZOfTop(actor) + (ActorSizeZ(actor) * 0.25));
} }
inline int int_ActorLowerZ(DSWActor* actor) inline int int_ActorLowerZ(DSWActor* actor)
{ {
return (int_ActorZOfBottom(actor) - (ActorSizeZ(actor) >> 2)); return (int_ActorZOfBottom(actor) - (int_ActorSizeZ(actor) >> 2));
} }
inline double ActorLowerZ(DSWActor* actor) inline double ActorLowerZ(DSWActor* actor)
{ {
return (int_ActorZOfBottom(actor) - (ActorSizeZ(actor) * 0.25)) * zinttoworld; return (int_ActorZOfBottom(actor) - (int_ActorSizeZ(actor) * 0.25)) * zinttoworld;
} }
// Z size of top (TOS) and bottom (BOS) part of sprite // Z size of top (TOS) and bottom (BOS) part of sprite
inline int ActorSizeToTop(DSWActor* a) inline int ActorSizeToTop(DSWActor* a)
{ {
return ((ActorSizeZ(a)) + (tileTopOffset(a->spr.picnum) << 8)) >> 1; return ((int_ActorSizeZ(a)) + (tileTopOffset(a->spr.picnum) << 8)) >> 1;
} }
inline int ActorSizeToBottom(DSWActor* a) inline int ActorSizeToBottom(DSWActor* a)
{ {
return ((ActorSizeZ(a)) - (tileTopOffset(a->spr.picnum) << 8)) >> 1; return ((int_ActorSizeZ(a)) - (tileTopOffset(a->spr.picnum) << 8)) >> 1;
} }
inline int ActorSizeX(DSWActor* sp) inline int ActorSizeX(DSWActor* sp)

View file

@ -1432,7 +1432,7 @@ int PlayerInitFlashBomb(PLAYER* pp)
if (!(actor->spr.cstat & CSTAT_SPRITE_BLOCK)) if (!(actor->spr.cstat & CSTAT_SPRITE_BLOCK))
continue; continue;
if (!FAFcansee(itActor->int_pos().X, itActor->int_pos().Y, itActor->int_pos().Z, itActor->sector(), actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z - ActorSizeZ(actor), actor->sector())) if (!FAFcansee(itActor->int_pos().X, itActor->int_pos().Y, itActor->int_pos().Z, itActor->sector(), actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z - int_ActorSizeZ(actor), actor->sector()))
continue; continue;
damage = GetDamage(itActor, pp->actor, DMG_FLASHBOMB); damage = GetDamage(itActor, pp->actor, DMG_FLASHBOMB);
@ -1491,7 +1491,7 @@ int InitFlashBomb(DSWActor* actor)
if (!(actor->spr.cstat & CSTAT_SPRITE_BLOCK)) if (!(actor->spr.cstat & CSTAT_SPRITE_BLOCK))
continue; continue;
if (!FAFcansee(itActor->int_pos().X, itActor->int_pos().Y, itActor->int_pos().Z, itActor->sector(), actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z - ActorSizeZ(actor), actor->sector())) if (!FAFcansee(itActor->int_pos().X, itActor->int_pos().Y, itActor->int_pos().Z, itActor->sector(), actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z - int_ActorSizeZ(actor), actor->sector()))
continue; continue;
damage = GetDamage(itActor, actor, DMG_FLASHBOMB); damage = GetDamage(itActor, actor, DMG_FLASHBOMB);
@ -1541,7 +1541,7 @@ void SpawnFlashBombOnActor(DSWActor* actor)
DSWActor* flameActor = actor->user.flameActor; DSWActor* flameActor = actor->user.flameActor;
if (flameActor != nullptr) if (flameActor != nullptr)
{ {
int sizez = (ActorSizeZ(actor) * 5) >> 2; int sizez = (int_ActorSizeZ(actor) * 5) >> 2;
if (flameActor->user.Counter >= GetRepeatFromHeight(flameActor, sizez)) if (flameActor->user.Counter >= GetRepeatFromHeight(flameActor, sizez))
{ {
@ -1579,7 +1579,7 @@ void SpawnFlashBombOnActor(DSWActor* actor)
if (actor->user.flameActor != nullptr) if (actor->user.flameActor != nullptr)
{ {
actorNew->user.Counter = GetRepeatFromHeight(actorNew, ActorSizeZ(actor) >> 1) * 4; actorNew->user.Counter = GetRepeatFromHeight(actorNew, int_ActorSizeZ(actor) >> 1) * 4;
} }
else else
actorNew->user.Counter = 0; // max flame size actorNew->user.Counter = 0; // max flame size
@ -2070,7 +2070,7 @@ int DoCarryFlagNoDet(DSWActor* actor)
vec3_t pos = { attached->int_pos().X, attached->int_pos().Y, int_ActorZOfMiddle(attached) }; vec3_t pos = { attached->int_pos().X, attached->int_pos().Y, int_ActorZOfMiddle(attached) };
SetActorZ(actor, &pos); SetActorZ(actor, &pos);
actor->set_int_ang(NORM_ANGLE(attached->int_ang() + 1536)); actor->set_int_ang(NORM_ANGLE(attached->int_ang() + 1536));
actor->set_int_z(attached->int_pos().Z - (ActorSizeZ(attached) >> 1)); actor->set_int_z(attached->int_pos().Z - (int_ActorSizeZ(attached) >> 1));
} }
if (!attached->hasU() || attached->user.Health <= 0) if (!attached->hasU() || attached->user.Health <= 0)
@ -2143,7 +2143,7 @@ int DoFlag(DSWActor* actor)
// attach weapon to sprite // attach weapon to sprite
actor->spr.cstat &= ~(CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN); actor->spr.cstat &= ~(CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN);
SetAttach(hitActor, actor); SetAttach(hitActor, actor);
actor->user.pos.Z = hitActor->spr.pos.Z - (ActorSizeZ(hitActor) >> 1) * zinttoworld; actor->user.pos.Z = hitActor->spr.pos.Z - (int_ActorSizeZ(hitActor) >> 1) * zinttoworld;
} }
} }

View file

@ -1188,11 +1188,11 @@ DSWActor* DoPickTarget(DSWActor* actor, uint32_t max_delta_ang, int skip_targets
if (actor->hasU() && actor->user.PlayerP) if (actor->hasU() && actor->user.PlayerP)
zh = actor->user.PlayerP->int_ppos().Z; zh = actor->user.PlayerP->int_ppos().Z;
else else
zh = int_ActorZOfTop(actor) + (ActorSizeZ(actor) >> 2); zh = int_ActorZOfTop(actor) + (int_ActorSizeZ(actor) >> 2);
ezh = int_ActorZOfTop(itActor) + (ActorSizeZ(itActor) >> 2); ezh = int_ActorZOfTop(itActor) + (int_ActorSizeZ(itActor) >> 2);
ezhm = int_ActorZOfTop(itActor) + (ActorSizeZ(itActor) >> 1); ezhm = int_ActorZOfTop(itActor) + (int_ActorSizeZ(itActor) >> 1);
ezhl = int_ActorZOfBottom(itActor) - (ActorSizeZ(itActor) >> 2); ezhl = int_ActorZOfBottom(itActor) - (int_ActorSizeZ(itActor) >> 2);
// If you can't see 'em you can't shoot 'em // If you can't see 'em you can't shoot 'em
if (!FAFcansee(actor->int_pos().X, actor->int_pos().Y, zh, actor->sector(), itActor->int_pos().X, itActor->int_pos().Y, ezh, itActor->sector()) && if (!FAFcansee(actor->int_pos().X, actor->int_pos().Y, zh, actor->sector(), itActor->int_pos().X, itActor->int_pos().Y, ezh, itActor->sector()) &&
@ -5829,7 +5829,7 @@ void DoPlayerDeathCheckKick(PLAYER* pp)
DoPlayerZrange(pp); DoPlayerZrange(pp);
// sector stomper kick // sector stomper kick
if (labs(pp->loz - pp->hiz) < ActorSizeZ(plActor) - Z(8)) if (labs(pp->loz - pp->hiz) < int_ActorSizeZ(plActor) - Z(8))
{ {
plActor->user.slide_ang = RANDOM_P2(2048); plActor->user.slide_ang = RANDOM_P2(2048);
plActor->user.slide_vel = 1000; plActor->user.slide_vel = 1000;

View file

@ -929,7 +929,7 @@ int InitRipperHang(DSWActor* actor)
{ {
tang = NORM_ANGLE(actor->int_ang() + dang); tang = NORM_ANGLE(actor->int_ang() + dang);
FAFhitscan(actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z - ActorSizeZ(actor), actor->sector(), // Start position FAFhitscan(actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z - int_ActorSizeZ(actor), actor->sector(), // Start position
bcos(tang), // X vector of 3D ang bcos(tang), // X vector of 3D ang
bsin(tang), // Y vector of 3D ang bsin(tang), // Y vector of 3D ang
0, // Z vector of 3D ang 0, // Z vector of 3D ang

View file

@ -938,7 +938,7 @@ int InitRipper2Hang(DSWActor* actor)
{ {
tang = NORM_ANGLE(actor->int_ang() + dang); tang = NORM_ANGLE(actor->int_ang() + dang);
FAFhitscan(actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z - ActorSizeZ(actor), actor->sector(), // Start position FAFhitscan(actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z - int_ActorSizeZ(actor), actor->sector(), // Start position
bcos(tang), // X vector of 3D ang bcos(tang), // X vector of 3D ang
bsin(tang), // Y vector of 3D ang bsin(tang), // Y vector of 3D ang
0, // Z vector of 3D ang 0, // Z vector of 3D ang

View file

@ -1385,7 +1385,7 @@ int OperateSprite(DSWActor* actor, short player_is_operating)
{ {
pp = GlobPlayerP; pp = GlobPlayerP;
if (!FAFcansee(pp->int_ppos().X, pp->int_ppos().Y, pp->int_ppos().Z, pp->cursector, actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z - (ActorSizeZ(actor) >> 1), actor->sector())) if (!FAFcansee(pp->int_ppos().X, pp->int_ppos().Y, pp->int_ppos().Z, pp->cursector, actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z - (int_ActorSizeZ(actor) >> 1), actor->sector()))
return false; return false;
} }
@ -2210,7 +2210,7 @@ void PlayerOperateEnv(PLAYER* pp)
int z[3]; int z[3];
DSWActor* plActor = pp->actor; DSWActor* plActor = pp->actor;
z[0] = plActor->int_pos().Z - ActorSizeZ(plActor) - Z(10); z[0] = plActor->int_pos().Z - int_ActorSizeZ(plActor) - Z(10);
z[1] = plActor->int_pos().Z; z[1] = plActor->int_pos().Z;
z[2] = (z[0] + z[1]) >> 1; z[2] = (z[0] + z[1]) >> 1;

View file

@ -738,7 +738,7 @@ int SetupSerp(DSWActor* actor)
actor->user.lo_step = Z(40); actor->user.lo_step = Z(40);
actor->user.floor_dist = actor->user.zclip - actor->user.lo_step * zinttoworld; actor->user.floor_dist = actor->user.zclip - actor->user.lo_step * zinttoworld;
actor->user.ceiling_dist = ActorSizeZ(actor) * zinttoworld - actor->user.zclip; actor->user.ceiling_dist = int_ActorSizeZ(actor) * zinttoworld - actor->user.zclip;
return 0; return 0;
} }

View file

@ -4448,7 +4448,7 @@ void DoActorZrange(DSWActor* actor)
auto save_cstat = actor->spr.cstat & CSTAT_SPRITE_BLOCK; auto save_cstat = actor->spr.cstat & CSTAT_SPRITE_BLOCK;
actor->spr.cstat &= ~(CSTAT_SPRITE_BLOCK); actor->spr.cstat &= ~(CSTAT_SPRITE_BLOCK);
vec3_t pos = actor->int_pos(); vec3_t pos = actor->int_pos();
pos.Z -= (ActorSizeZ(actor) >> 1); pos.Z -= (int_ActorSizeZ(actor) >> 1);
FAFgetzrange(pos, actor->sector(), &actor->user.hiz, &ceilhit, &actor->user.loz, &florhit, (((int) actor->spr.clipdist) << 2) - GETZRANGE_CLIP_ADJ, CLIPMASK_ACTOR); FAFgetzrange(pos, actor->sector(), &actor->user.hiz, &ceilhit, &actor->user.loz, &florhit, (((int) actor->spr.clipdist) << 2) - GETZRANGE_CLIP_ADJ, CLIPMASK_ACTOR);
actor->spr.cstat |= save_cstat; actor->spr.cstat |= save_cstat;
@ -4527,7 +4527,7 @@ bool ActorDrop(DSWActor* actor, int x, int y, int z, sectortype* new_sector, sho
// look only at the center point for a floor sprite // look only at the center point for a floor sprite
auto save_cstat = (actor->spr.cstat & CSTAT_SPRITE_BLOCK); auto save_cstat = (actor->spr.cstat & CSTAT_SPRITE_BLOCK);
actor->spr.cstat &= ~(CSTAT_SPRITE_BLOCK); actor->spr.cstat &= ~(CSTAT_SPRITE_BLOCK);
FAFgetzrangepoint(x, y, z - (ActorSizeZ(actor) >> 1), new_sector, &hiz, &ceilhit, &loz, &florhit); FAFgetzrangepoint(x, y, z - (int_ActorSizeZ(actor) >> 1), new_sector, &hiz, &ceilhit, &loz, &florhit);
actor->spr.cstat |= (save_cstat); actor->spr.cstat |= (save_cstat);
if (florhit.type < 0 || ceilhit.type < 0) if (florhit.type < 0 || ceilhit.type < 0)
@ -5901,7 +5901,7 @@ void AdjustActiveRange(PLAYER* pp, DSWActor* actor, int dist)
// if actor can still see the player // if actor can still see the player
look_height = int_ActorZOfTop(actor); look_height = int_ActorZOfTop(actor);
if (FAFcansee(actor->int_pos().X, actor->int_pos().Y, look_height, actor->sector(), plActor->int_pos().X, plActor->int_pos().Y, ActorUpperZ(plActor), plActor->sector())) if (FAFcansee(actor->int_pos().X, actor->int_pos().Y, look_height, actor->sector(), plActor->int_pos().X, plActor->int_pos().Y, int_ActorUpperZ(plActor), plActor->sector()))
{ {
// Player is visible // Player is visible
// adjust update range of this sprite // adjust update range of this sprite

View file

@ -2129,7 +2129,7 @@ void CallbackSOsink(ANIM* ap, void *data)
continue; continue;
// move sprite WAY down in water // move sprite WAY down in water
ndx = AnimSet(ANIM_Userz, 0, actor, -actor->user.int_upos().Z - ActorSizeZ(actor) - Z(100), ap->vel>>8); ndx = AnimSet(ANIM_Userz, 0, actor, -actor->user.int_upos().Z - int_ActorSizeZ(actor) - Z(100), ap->vel>>8);
AnimSetVelAdj(ndx, ap->vel_adj); AnimSetVelAdj(ndx, ap->vel_adj);
} }
@ -2749,7 +2749,7 @@ void DoAutoTurretObject(SECTOR_OBJECT* sop)
if (sActor->spr.statnum == STAT_SO_SHOOT_POINT) if (sActor->spr.statnum == STAT_SO_SHOOT_POINT)
{ {
if (!FAFcansee(sActor->int_pos().X, sActor->int_pos().Y, sActor->int_pos().Z-Z(4), sActor->sector(), if (!FAFcansee(sActor->int_pos().X, sActor->int_pos().Y, sActor->int_pos().Z-Z(4), sActor->sector(),
actor->user.targetActor->int_pos().X, actor->user.targetActor->int_pos().Y, ActorUpperZ(actor->user.targetActor), actor->user.targetActor->sector())) actor->user.targetActor->int_pos().X, actor->user.targetActor->int_pos().Y, int_ActorUpperZ(actor->user.targetActor), actor->user.targetActor->sector()))
{ {
return; return;
} }
@ -3093,8 +3093,8 @@ bool ActorTrackDecide(TRACK_POINT* tpoint, DSWActor* actor)
actor->set_int_ang(tpoint->ang); actor->set_int_ang(tpoint->ang);
z[0] = actor->int_pos().Z - ActorSizeZ(actor) + Z(5); z[0] = actor->int_pos().Z - int_ActorSizeZ(actor) + Z(5);
z[1] = actor->int_pos().Z - (ActorSizeZ(actor) >> 1); z[1] = actor->int_pos().Z - (int_ActorSizeZ(actor) >> 1);
for (i = 0; i < (int)SIZ(z); i++) for (i = 0; i < (int)SIZ(z); i++)
{ {
@ -3314,7 +3314,7 @@ bool ActorTrackDecide(TRACK_POINT* tpoint, DSWActor* actor)
// Get the z height to climb // Get the z height to climb
// //
neartag({ actor->int_pos().X, actor->int_pos().Y, int_ActorZOfTop(actor) - (ActorSizeZ(actor) >> 1) }, actor->sector(), actor->int_ang(), near, 600, NTAG_SEARCH_LO_HI); neartag({ actor->int_pos().X, actor->int_pos().Y, int_ActorZOfTop(actor) - (int_ActorSizeZ(actor) >> 1) }, actor->sector(), actor->int_ang(), near, 600, NTAG_SEARCH_LO_HI);
if (near.hitWall == nullptr) if (near.hitWall == nullptr)
{ {
@ -3496,7 +3496,7 @@ int ActorFollowTrack(DSWActor* actor, short locktics)
if (actor->user.Flags & (SPR_CLIMBING)) if (actor->user.Flags & (SPR_CLIMBING))
{ {
if (int_ActorZOfTop(actor) + (ActorSizeZ(actor) >> 2) < actor->user.int_upos().Z) if (int_ActorZOfTop(actor) + (int_ActorSizeZ(actor) >> 2) < actor->user.int_upos().Z)
{ {
actor->user.Flags &= ~(SPR_CLIMBING); actor->user.Flags &= ~(SPR_CLIMBING);

View file

@ -456,7 +456,7 @@ int DoVator(DSWActor* actor)
{ {
if (itActor->spr.statnum == STAT_ENEMY) if (itActor->spr.statnum == STAT_ENEMY)
{ {
if (abs(sectp->int_ceilingz() - sectp->int_floorz()) < ActorSizeZ(itActor)) if (abs(sectp->int_ceilingz() - sectp->int_floorz()) < int_ActorSizeZ(itActor))
{ {
InitBloodSpray(itActor, true, -1); InitBloodSpray(itActor, true, -1);
UpdateSinglePlayKills(itActor); UpdateSinglePlayKills(itActor);
@ -502,7 +502,7 @@ int DoVator(DSWActor* actor)
{ {
if (itActor->spr.statnum == STAT_ENEMY) if (itActor->spr.statnum == STAT_ENEMY)
{ {
if (abs(sectp->int_ceilingz() - sectp->int_floorz()) < ActorSizeZ(itActor)) if (abs(sectp->int_ceilingz() - sectp->int_floorz()) < int_ActorSizeZ(itActor))
{ {
InitBloodSpray(itActor, true, -1); InitBloodSpray(itActor, true, -1);
UpdateSinglePlayKills(itActor); UpdateSinglePlayKills(itActor);

View file

@ -4025,7 +4025,7 @@ int SpawnBlood(DSWActor* actor, DSWActor* weapActor, short hit_ang, int hit_x, i
hit_ang = actor->int_ang(); hit_ang = actor->int_ang();
hit_x = actor->int_pos().X; hit_x = actor->int_pos().X;
hit_y = actor->int_pos().Y; hit_y = actor->int_pos().Y;
hit_z = int_ActorZOfTop(weapActor) + (ActorSizeZ(weapActor) >> 4); hit_z = int_ActorZOfTop(weapActor) + (int_ActorSizeZ(weapActor) >> 4);
} }
else else
{ {
@ -4033,7 +4033,7 @@ int SpawnBlood(DSWActor* actor, DSWActor* weapActor, short hit_ang, int hit_x, i
hit_ang = NORM_ANGLE(weapActor->int_ang() + 1024); hit_ang = NORM_ANGLE(weapActor->int_ang() + 1024);
hit_x = actor->int_pos().X; hit_x = actor->int_pos().X;
hit_y = actor->int_pos().Y; hit_y = actor->int_pos().Y;
hit_z = int_ActorZOfTop(weapActor) + (ActorSizeZ(weapActor) >> 2); hit_z = int_ActorZOfTop(weapActor) + (int_ActorSizeZ(weapActor) >> 2);
} }
break; break;
case SERP_RUN_R0: case SERP_RUN_R0:
@ -4041,7 +4041,7 @@ int SpawnBlood(DSWActor* actor, DSWActor* weapActor, short hit_ang, int hit_x, i
hit_ang = NORM_ANGLE(weapActor->int_ang() + 1024); hit_ang = NORM_ANGLE(weapActor->int_ang() + 1024);
hit_x = actor->int_pos().X; hit_x = actor->int_pos().X;
hit_y = actor->int_pos().Y; hit_y = actor->int_pos().Y;
hit_z = int_ActorZOfTop(actor) + (ActorSizeZ(actor) >> 2); hit_z = int_ActorZOfTop(actor) + (int_ActorSizeZ(actor) >> 2);
break; break;
case BLADE1: case BLADE1:
case BLADE2: case BLADE2:
@ -4051,7 +4051,7 @@ int SpawnBlood(DSWActor* actor, DSWActor* weapActor, short hit_ang, int hit_x, i
hit_ang = NORM_ANGLE(AngToSprite(actor, weapActor) + 1024); hit_ang = NORM_ANGLE(AngToSprite(actor, weapActor) + 1024);
hit_x = actor->int_pos().X; hit_x = actor->int_pos().X;
hit_y = actor->int_pos().Y; hit_y = actor->int_pos().Y;
hit_z = weapActor->int_pos().Z - (ActorSizeZ(weapActor) >> 1); hit_z = weapActor->int_pos().Z - (int_ActorSizeZ(weapActor) >> 1);
break; break;
case STAR1: case STAR1:
case CROSSBOLT: case CROSSBOLT:
@ -4066,14 +4066,14 @@ int SpawnBlood(DSWActor* actor, DSWActor* weapActor, short hit_ang, int hit_x, i
hit_ang = weapActor->int_ang(); hit_ang = weapActor->int_ang();
hit_x = actor->int_pos().X; hit_x = actor->int_pos().X;
hit_y = actor->int_pos().Y; hit_y = actor->int_pos().Y;
hit_z = int_ActorZOfTop(actor) + (ActorSizeZ(actor) >> 2); hit_z = int_ActorZOfTop(actor) + (int_ActorSizeZ(actor) >> 2);
break; break;
default: default:
p = SomeBlood; p = SomeBlood;
hit_ang = NORM_ANGLE(weapActor->int_ang() + 1024); hit_ang = NORM_ANGLE(weapActor->int_ang() + 1024);
hit_x = actor->int_pos().X; hit_x = actor->int_pos().X;
hit_y = actor->int_pos().Y; hit_y = actor->int_pos().Y;
hit_z = int_ActorZOfTop(weapActor) + (ActorSizeZ(weapActor) >> 2); hit_z = int_ActorZOfTop(weapActor) + (int_ActorSizeZ(weapActor) >> 2);
break; break;
} }
} }
@ -4317,7 +4317,7 @@ bool WeaponMoveHit(DSWActor* actor)
if ((sectp->ceilingstat & CSTAT_SECTOR_SKY) && sectp->ceilingpicnum != FAF_MIRROR_PIC) if ((sectp->ceilingstat & CSTAT_SECTOR_SKY) && sectp->ceilingpicnum != FAF_MIRROR_PIC)
{ {
if (labs(actor->int_pos().Z - sectp->int_ceilingz()) < ActorSizeZ(actor)) if (labs(actor->int_pos().Z - sectp->int_ceilingz()) < int_ActorSizeZ(actor))
{ {
SetSuicide(actor); SetSuicide(actor);
return true; return true;
@ -7042,7 +7042,7 @@ int DoDamageTest(DSWActor* actor)
// For speed's sake, try limiting check only to radius weapons! // For speed's sake, try limiting check only to radius weapons!
if (actor->user.Radius > 200) if (actor->user.Radius > 200)
{ {
if (!FAFcansee(itActor->int_pos().X,itActor->int_pos().Y, ActorUpperZ(actor), itActor->sector(),actor->int_pos().X,actor->int_pos().Y,actor->int_pos().Z,actor->sector())) if (!FAFcansee(itActor->int_pos().X,itActor->int_pos().Y, int_ActorUpperZ(actor), itActor->sector(),actor->int_pos().X,actor->int_pos().Y,actor->int_pos().Z,actor->sector()))
continue; continue;
} }
@ -7259,7 +7259,7 @@ int DoExpDamageTest(DSWActor* actor)
// Second parameter MUST have blocking bits set or cansee won't work // Second parameter MUST have blocking bits set or cansee won't work
// added second check for FAF water - hitscans were hitting ceiling // added second check for FAF water - hitscans were hitting ceiling
if (!FAFcansee(actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z, actor->sector(), itActor->int_pos().X, itActor->int_pos().Y, ActorUpperZ(actor), itActor->sector()) && if (!FAFcansee(actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z, actor->sector(), itActor->int_pos().X, itActor->int_pos().Y, int_ActorUpperZ(actor), itActor->sector()) &&
!FAFcansee(actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z, actor->sector(), itActor->int_pos().X, itActor->int_pos().Y, int_ActorLowerZ(actor), itActor->sector())) !FAFcansee(actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z, actor->sector(), itActor->int_pos().X, itActor->int_pos().Y, int_ActorLowerZ(actor), itActor->sector()))
continue; continue;
@ -7701,7 +7701,7 @@ int MissileSeek(DSWActor* actor, int16_t delay_tics, int16_t aware_range/*, int1
actor->add_int_ang(-delta_ang); actor->add_int_ang(-delta_ang);
zh = int_ActorZOfTop(actor) + (ActorSizeZ(actor) >> 2); zh = int_ActorZOfTop(actor) + (int_ActorSizeZ(actor) >> 2);
delta_ang = (zh - actor->int_pos().Z)>>1; delta_ang = (zh - actor->int_pos().Z)>>1;
@ -7770,7 +7770,7 @@ int ComboMissileSeek(DSWActor* actor, int16_t delay_tics, int16_t aware_range/*,
actor->user.change.X = MOVEx(actor->spr.xvel, actor->int_ang()); actor->user.change.X = MOVEx(actor->spr.xvel, actor->int_ang());
actor->user.change.Y = MOVEy(actor->spr.xvel, actor->int_ang()); actor->user.change.Y = MOVEy(actor->spr.xvel, actor->int_ang());
zh = int_ActorZOfTop(actor) + (ActorSizeZ(actor) >> 2); zh = int_ActorZOfTop(actor) + (int_ActorSizeZ(actor) >> 2);
dist = ksqrt(SQ(actor->int_pos().X - goal->int_pos().X) + SQ(actor->int_pos().Y - goal->int_pos().Y) + (SQ(actor->int_pos().Z - zh)>>8)); dist = ksqrt(SQ(actor->int_pos().X - goal->int_pos().X) + SQ(actor->int_pos().Y - goal->int_pos().Y) + (SQ(actor->int_pos().Z - zh)>>8));
@ -7835,7 +7835,7 @@ int VectorMissileSeek(DSWActor* actor, int16_t delay_tics, int16_t turn_speed, i
{ {
int ox,oy,oz; int ox,oy,oz;
zh = int_ActorZOfTop(actor) + (ActorSizeZ(actor) >> 2); zh = int_ActorZOfTop(actor) + (int_ActorSizeZ(actor) >> 2);
dist = ksqrt(SQ(actor->int_pos().X - goal->int_pos().X) + SQ(actor->int_pos().Y - goal->int_pos().Y) + (SQ(actor->int_pos().Z - zh)>>8)); dist = ksqrt(SQ(actor->int_pos().X - goal->int_pos().X) + SQ(actor->int_pos().Y - goal->int_pos().Y) + (SQ(actor->int_pos().Z - zh)>>8));
@ -7893,7 +7893,7 @@ int VectorWormSeek(DSWActor* actor, int16_t delay_tics, int16_t aware_range1, in
{ {
int ox,oy,oz; int ox,oy,oz;
zh = int_ActorZOfTop(actor) + (ActorSizeZ(actor) >> 2); zh = int_ActorZOfTop(actor) + (int_ActorSizeZ(actor) >> 2);
dist = ksqrt(SQ(actor->int_pos().X - goal->int_pos().X) + SQ(actor->int_pos().Y - goal->int_pos().Y) + (SQ(actor->int_pos().Z - zh)>>8)); dist = ksqrt(SQ(actor->int_pos().X - goal->int_pos().X) + SQ(actor->int_pos().Y - goal->int_pos().Y) + (SQ(actor->int_pos().Z - zh)>>8));
@ -8605,7 +8605,7 @@ int DoMineRangeTest(DSWActor* actor, int range)
if (dist > range) if (dist > range)
continue; continue;
if (!FAFcansee(itActor->int_pos().X,itActor->int_pos().Y,ActorUpperZ(actor),itActor->sector(),actor->int_pos().X,actor->int_pos().Y,actor->int_pos().Z,actor->sector())) if (!FAFcansee(itActor->int_pos().X,itActor->int_pos().Y,int_ActorUpperZ(actor),itActor->sector(),actor->int_pos().X,actor->int_pos().Y,actor->int_pos().Z,actor->sector()))
continue; continue;
return true; return true;
@ -8635,7 +8635,7 @@ int DoMineStuck(DSWActor* actor)
vec3_t pos = { attachActor->int_pos().X, attachActor->int_pos().Y, attachActor->int_pos().Z - actor->user.int_upos().Z }; vec3_t pos = { attachActor->int_pos().X, attachActor->int_pos().Y, attachActor->int_pos().Z - actor->user.int_upos().Z };
SetActorZ(actor, &pos); SetActorZ(actor, &pos);
actor->set_int_z(attachActor->int_pos().Z - (ActorSizeZ(attachActor) >> 1)); actor->set_int_z(attachActor->int_pos().Z - (int_ActorSizeZ(attachActor) >> 1));
} }
// not activated yet // not activated yet
@ -8820,7 +8820,7 @@ int DoMine(DSWActor* actor)
SetMineStuck(actor); SetMineStuck(actor);
// Set the Z position // Set the Z position
actor->set_int_z(hitActor->int_pos().Z - (ActorSizeZ(hitActor) >> 1)); actor->set_int_z(hitActor->int_pos().Z - (int_ActorSizeZ(hitActor) >> 1));
// If it's not alive, don't stick it // If it's not alive, don't stick it
if (hitActor->hasU() && hitActor->user.Health <= 0) return false; // JBF: added null check if (hitActor->hasU() && hitActor->user.Health <= 0) return false; // JBF: added null check
@ -9686,7 +9686,7 @@ int SpawnCoolieExp(DSWActor* actor)
actor->user.Counter = RandomRange(120); // This is the wait til birth time! actor->user.Counter = RandomRange(120); // This is the wait til birth time!
zh = actor->int_pos().Z - ActorSizeZ(actor) + (ActorSizeZ(actor) >> 2); zh = actor->int_pos().Z - int_ActorSizeZ(actor) + (int_ActorSizeZ(actor) >> 2);
nx = actor->int_pos().X + MOVEx(64, actor->int_ang() + 1024); nx = actor->int_pos().X + MOVEx(64, actor->int_ang() + 1024);
ny = actor->int_pos().Y + MOVEy(64, actor->int_ang() + 1024); ny = actor->int_pos().Y + MOVEy(64, actor->int_ang() + 1024);
@ -9727,7 +9727,7 @@ void SpawnFireballFlames(DSWActor* actor, DSWActor* enemyActor)
auto flameActor = enemyActor->user.flameActor; auto flameActor = enemyActor->user.flameActor;
if (flameActor != nullptr) if (flameActor != nullptr)
{ {
int sizez = ActorSizeZ(enemyActor) + (ActorSizeZ(enemyActor) >> 2); int sizez = int_ActorSizeZ(enemyActor) + (int_ActorSizeZ(enemyActor) >> 2);
if ((enemyActor->spr.extra & SPRX_BURNABLE)) if ((enemyActor->spr.extra & SPRX_BURNABLE))
return; return;
@ -9772,12 +9772,12 @@ void SpawnFireballFlames(DSWActor* actor, DSWActor* enemyActor)
// large flame for trees and such // large flame for trees and such
if ((enemyActor->spr.extra & SPRX_BURNABLE)) if ((enemyActor->spr.extra & SPRX_BURNABLE))
{ {
int sizez = ActorSizeZ(enemyActor) + (ActorSizeZ(enemyActor) >> 2); int sizez = int_ActorSizeZ(enemyActor) + (int_ActorSizeZ(enemyActor) >> 2);
actorNew->user.Counter = GetRepeatFromHeight(actorNew, sizez); actorNew->user.Counter = GetRepeatFromHeight(actorNew, sizez);
} }
else else
{ {
actorNew->user.Counter = GetRepeatFromHeight(actorNew, ActorSizeZ(enemyActor)>>1); actorNew->user.Counter = GetRepeatFromHeight(actorNew, int_ActorSizeZ(enemyActor)>>1);
} }
} }
else else
@ -11201,9 +11201,9 @@ int DoRing(DSWActor* actor)
actor->set_int_z(fz); actor->set_int_z(fz);
} }
if (actor->int_pos().Z < cz + ActorSizeZ(actor)) if (actor->int_pos().Z < cz + int_ActorSizeZ(actor))
{ {
actor->set_int_z(cz + ActorSizeZ(actor)); actor->set_int_z(cz + int_ActorSizeZ(actor));
} }
// Done last - check for damage // Done last - check for damage
@ -11327,9 +11327,9 @@ int DoSerpRing(DSWActor* actor)
actor->set_int_z(fz); actor->set_int_z(fz);
} }
if (actor->int_pos().Z < cz + ActorSizeZ(actor)) if (actor->int_pos().Z < cz + int_ActorSizeZ(actor))
{ {
actor->set_int_z(cz + ActorSizeZ(actor)); actor->set_int_z(cz + int_ActorSizeZ(actor));
} }
if (actor->user.Counter2 > 0) if (actor->user.Counter2 > 0)
@ -11385,7 +11385,7 @@ int InitLavaThrow(DSWActor* actor)
nx = actor->int_pos().X; nx = actor->int_pos().X;
ny = actor->int_pos().Y; ny = actor->int_pos().Y;
nz = int_ActorZOfTop(actor) + (ActorSizeZ(actor) >> 2); nz = int_ActorZOfTop(actor) + (int_ActorSizeZ(actor) >> 2);
// Spawn a shot // Spawn a shot
auto actorNew = SpawnActor(STAT_MISSILE, LAVA_BOULDER, s_LavaBoulder, actor->sector(), auto actorNew = SpawnActor(STAT_MISSILE, LAVA_BOULDER, s_LavaBoulder, actor->sector(),
@ -11420,7 +11420,7 @@ int InitLavaThrow(DSWActor* actor)
dist = DistanceI(actorNew->spr.pos, actor->user.targetActor->spr.pos); dist = DistanceI(actorNew->spr.pos, actor->user.targetActor->spr.pos);
if (dist != 0) if (dist != 0)
actorNew->user.change.Z = actorNew->spr.zvel = (actorNew->spr.xvel * (ActorUpperZ(actor->user.targetActor) - actorNew->int_pos().Z)) / dist; actorNew->user.change.Z = actorNew->spr.zvel = (actorNew->spr.xvel * (int_ActorUpperZ(actor->user.targetActor) - actorNew->int_pos().Z)) / dist;
return 0; return 0;
} }
@ -11463,7 +11463,7 @@ void InitVulcanBoulder(DSWActor* actor)
actorNew->set_int_ang(nang); actorNew->set_int_ang(nang);
actorNew->user.Counter = 0; actorNew->user.Counter = 0;
zsize = ActorSizeZ(actorNew); zsize = int_ActorSizeZ(actorNew);
actorNew->user.Radius = 200; actorNew->user.Radius = 200;
actorNew->spr.cstat |= (CSTAT_SPRITE_YCENTER); actorNew->spr.cstat |= (CSTAT_SPRITE_YCENTER);
@ -11657,7 +11657,7 @@ int InitEnemyNapalm(DSWActor* actor)
for (i = 0; i < SIZ(mp); i++) for (i = 0; i < SIZ(mp); i++)
{ {
auto actorNew = SpawnActor(STAT_MISSILE, FIREBALL1, s_Napalm, actor->sector(), auto actorNew = SpawnActor(STAT_MISSILE, FIREBALL1, s_Napalm, actor->sector(),
actor->int_pos().X, actor->int_pos().Y, int_ActorZOfTop(actor) + (ActorSizeZ(actor) >> 2), actor->int_ang(), NAPALM_VELOCITY); actor->int_pos().X, actor->int_pos().Y, int_ActorZOfTop(actor) + (int_ActorSizeZ(actor) >> 2), actor->int_ang(), NAPALM_VELOCITY);
actorNew->spr.hitag = LUMINOUS; //Always full brightness actorNew->spr.hitag = LUMINOUS; //Always full brightness
if (i==0) // Only attach sound to first projectile if (i==0) // Only attach sound to first projectile
@ -11696,7 +11696,7 @@ int InitEnemyNapalm(DSWActor* actor)
dist = DistanceI(actorNew->spr.pos, actor->user.targetActor->spr.pos); dist = DistanceI(actorNew->spr.pos, actor->user.targetActor->spr.pos);
if (dist != 0) if (dist != 0)
actorNew->spr.zvel = (actorNew->spr.xvel * (ActorUpperZ(actor->user.targetActor) - actorNew->int_pos().Z)) / dist; actorNew->spr.zvel = (actorNew->spr.xvel * (int_ActorUpperZ(actor->user.targetActor) - actorNew->int_pos().Z)) / dist;
actorNew->user.change.X = MOVEx(actorNew->spr.xvel, actorNew->int_ang()); actorNew->user.change.X = MOVEx(actorNew->spr.xvel, actorNew->int_ang());
actorNew->user.change.Y = MOVEy(actorNew->spr.xvel, actorNew->int_ang()); actorNew->user.change.Y = MOVEy(actorNew->spr.xvel, actorNew->int_ang());
@ -11759,7 +11759,7 @@ int InitEnemyMirv(DSWActor* actor)
PlaySound(DIGI_MIRVFIRE, actor, v3df_none); PlaySound(DIGI_MIRVFIRE, actor, v3df_none);
auto actorNew = SpawnActor(STAT_MISSILE, MIRV_METEOR, s_Mirv, actor->sector(), auto actorNew = SpawnActor(STAT_MISSILE, MIRV_METEOR, s_Mirv, actor->sector(),
actor->int_pos().X, actor->int_pos().Y, int_ActorZOfTop(actor) + (ActorSizeZ(actor) >> 2), actor->int_ang(), MIRV_VELOCITY); actor->int_pos().X, actor->int_pos().Y, int_ActorZOfTop(actor) + (int_ActorSizeZ(actor) >> 2), actor->int_ang(), MIRV_VELOCITY);
PlaySound(DIGI_MIRVWIZ, actorNew, v3df_follow); PlaySound(DIGI_MIRVWIZ, actorNew, v3df_follow);
@ -11786,7 +11786,7 @@ int InitEnemyMirv(DSWActor* actor)
dist = DistanceI(actorNew->spr.pos, actor->user.targetActor->spr.pos); dist = DistanceI(actorNew->spr.pos, actor->user.targetActor->spr.pos);
if (dist != 0) if (dist != 0)
actorNew->user.change.Z = actorNew->spr.zvel = (actorNew->spr.xvel * (ActorUpperZ(actor->user.targetActor) - actorNew->int_pos().Z)) / dist; actorNew->user.change.Z = actorNew->spr.zvel = (actorNew->spr.xvel * (int_ActorUpperZ(actor->user.targetActor) - actorNew->int_pos().Z)) / dist;
return 0; return 0;
} }
@ -12216,7 +12216,7 @@ int InitSumoNapalm(DSWActor* actor)
dist = DistanceI(actorNew->spr.pos, actor->user.targetActor->spr.pos); dist = DistanceI(actorNew->spr.pos, actor->user.targetActor->spr.pos);
if (dist != 0) if (dist != 0)
actorNew->spr.zvel = (actorNew->spr.xvel * (ActorUpperZ(actor->user.targetActor) - actorNew->int_pos().Z)) / dist; actorNew->spr.zvel = (actorNew->spr.xvel * (int_ActorUpperZ(actor->user.targetActor) - actorNew->int_pos().Z)) / dist;
actorNew->user.change.X = MOVEx(actorNew->spr.xvel, actorNew->int_ang()); actorNew->user.change.X = MOVEx(actorNew->spr.xvel, actorNew->int_ang());
actorNew->user.change.Y = MOVEy(actorNew->spr.xvel, actorNew->int_ang()); actorNew->user.change.Y = MOVEy(actorNew->spr.xvel, actorNew->int_ang());
@ -12381,7 +12381,7 @@ int WeaponAutoAim(DSWActor* actor, DSWActor* mislActor, short ang, bool test)
tos = int_ActorZOfTop(hitActor); tos = int_ActorZOfTop(hitActor);
diff = mislActor->int_pos().Z - tos; diff = mislActor->int_pos().Z - tos;
siz = ActorSizeZ(hitActor); siz = int_ActorSizeZ(hitActor);
// hit_sprite is below // hit_sprite is below
if (diff < -Z(50)) if (diff < -Z(50))
@ -12437,7 +12437,7 @@ int WeaponAutoAimZvel(DSWActor* actor, DSWActor* missileActor, int *zvel, short
tos = int_ActorZOfTop(hitActor); tos = int_ActorZOfTop(hitActor);
diff = missileActor->int_pos().Z - tos; diff = missileActor->int_pos().Z - tos;
siz = ActorSizeZ(hitActor); siz = int_ActorSizeZ(hitActor);
// hit_sprite is below // hit_sprite is below
if (diff < -Z(50)) if (diff < -Z(50))
@ -12479,7 +12479,7 @@ DSWActor* AimHitscanToTarget(DSWActor* actor, int *z, short *ang, int z_ratio)
if (dist != 0) if (dist != 0)
{ {
zh = ActorUpperZ(hitActor); zh = int_ActorUpperZ(hitActor);
xvect = bcos(*ang); xvect = bcos(*ang);
yvect = bsin(*ang); yvect = bsin(*ang);
@ -12533,7 +12533,7 @@ DSWActor* WeaponAutoAimHitscan(DSWActor* actor, int *z, short *ang, bool test)
if (dist != 0) if (dist != 0)
{ {
zh = int_ActorZOfTop(picked) + (ActorSizeZ(picked) >> 2); zh = int_ActorZOfTop(picked) + (int_ActorSizeZ(picked) >> 2);
xvect = bcos(*ang); xvect = bcos(*ang);
yvect = bsin(*ang); yvect = bsin(*ang);
@ -13732,7 +13732,7 @@ int InitMicro(PLAYER* pp)
if (dist != 0) if (dist != 0)
{ {
int zh; int zh;
zh = int_ActorZOfTop(picked) + (ActorSizeZ(picked) >> 2); zh = int_ActorZOfTop(picked) + (int_ActorSizeZ(picked) >> 2);
actorNew->spr.zvel = (actorNew->spr.xvel * (zh - actorNew->int_pos().Z)) / dist; actorNew->spr.zvel = (actorNew->spr.xvel * (zh - actorNew->int_pos().Z)) / dist;
} }
@ -14074,7 +14074,7 @@ int InitSerpSpell(DSWActor* actor)
// find the distance to the target (player) // find the distance to the target (player)
dist = DistanceI(actorNew->spr.pos, actor->user.targetActor->spr.pos); dist = DistanceI(actorNew->spr.pos, actor->user.targetActor->spr.pos);
if (dist != 0) if (dist != 0)
actorNew->spr.zvel = (actorNew->spr.xvel * (ActorUpperZ(actor->user.targetActor) - actorNew->int_pos().Z)) / dist; actorNew->spr.zvel = (actorNew->spr.xvel * (int_ActorUpperZ(actor->user.targetActor) - actorNew->int_pos().Z)) / dist;
actorNew->set_int_ang(NORM_ANGLE(actorNew->int_ang() + delta_ang[i])); actorNew->set_int_ang(NORM_ANGLE(actorNew->int_ang() + delta_ang[i]));
@ -14172,7 +14172,7 @@ int InitSerpMonstSpell(DSWActor* actor)
// find the distance to the target (player) // find the distance to the target (player)
dist = DistanceI(actorNew->spr.pos, actor->user.targetActor->spr.pos); dist = DistanceI(actorNew->spr.pos, actor->user.targetActor->spr.pos);
if (dist != 0) if (dist != 0)
actorNew->spr.zvel = (actorNew->spr.xvel * (ActorUpperZ(actor->user.targetActor) - actorNew->int_pos().Z)) / dist; actorNew->spr.zvel = (actorNew->spr.xvel * (int_ActorUpperZ(actor->user.targetActor) - actorNew->int_pos().Z)) / dist;
actorNew->set_int_ang(NORM_ANGLE(actorNew->int_ang() + delta_ang[i])); actorNew->set_int_ang(NORM_ANGLE(actorNew->int_ang() + delta_ang[i]));
@ -14210,7 +14210,7 @@ int InitEnemyRocket(DSWActor* actor)
nx = actor->int_pos().X; nx = actor->int_pos().X;
ny = actor->int_pos().Y; ny = actor->int_pos().Y;
nz = actor->int_pos().Z - (ActorSizeZ(actor) >> 1)-Z(8); nz = actor->int_pos().Z - (int_ActorSizeZ(actor) >> 1)-Z(8);
// Spawn a shot // Spawn a shot
auto actorNew = SpawnActor(STAT_MISSILE, BOLT_THINMAN_R2, &s_Rocket[0][0], actor->sector(), auto actorNew = SpawnActor(STAT_MISSILE, BOLT_THINMAN_R2, &s_Rocket[0][0], actor->sector(),
@ -14252,7 +14252,7 @@ int InitEnemyRocket(DSWActor* actor)
dist = DistanceI(actorNew->spr.pos, actor->user.targetActor->spr.pos); dist = DistanceI(actorNew->spr.pos, actor->user.targetActor->spr.pos);
if (dist != 0) if (dist != 0)
actorNew->user.change.Z = actorNew->spr.zvel = (actorNew->spr.xvel * (ActorUpperZ(actor->user.targetActor) - actorNew->int_pos().Z)) / dist; actorNew->user.change.Z = actorNew->spr.zvel = (actorNew->spr.xvel * (int_ActorUpperZ(actor->user.targetActor) - actorNew->int_pos().Z)) / dist;
return 0; return 0;
} }
@ -14289,7 +14289,7 @@ int InitEnemyRail(DSWActor* actor)
nx = actor->int_pos().X; nx = actor->int_pos().X;
ny = actor->int_pos().Y; ny = actor->int_pos().Y;
nz = actor->int_pos().Z - (ActorSizeZ(actor) >> 1)-Z(8); nz = actor->int_pos().Z - (int_ActorSizeZ(actor) >> 1)-Z(8);
// Spawn a shot // Spawn a shot
// Inserting and setting up variables // Inserting and setting up variables
@ -14333,7 +14333,7 @@ int InitEnemyRail(DSWActor* actor)
dist = DistanceI(actorNew->spr.pos, actor->user.targetActor->spr.pos); dist = DistanceI(actorNew->spr.pos, actor->user.targetActor->spr.pos);
if (dist != 0) if (dist != 0)
actorNew->user.change.Z = actorNew->spr.zvel = (actorNew->spr.xvel * (ActorUpperZ(actor->user.targetActor) - actorNew->int_pos().Z)) / dist; actorNew->user.change.Z = actorNew->spr.zvel = (actorNew->spr.xvel * (int_ActorUpperZ(actor->user.targetActor) - actorNew->int_pos().Z)) / dist;
return 0; return 0;
} }
@ -14363,7 +14363,7 @@ int InitZillaRocket(DSWActor* actor)
{ {
nx = actor->int_pos().X; nx = actor->int_pos().X;
ny = actor->int_pos().Y; ny = actor->int_pos().Y;
nz = actor->int_pos().Z - (ActorSizeZ(actor) >> 1)-Z(8); nz = actor->int_pos().Z - (int_ActorSizeZ(actor) >> 1)-Z(8);
// Spawn a shot // Spawn a shot
auto actorNew = SpawnActor(STAT_MISSILE, BOLT_THINMAN_R2, &s_Rocket[0][0], actor->sector(), auto actorNew = SpawnActor(STAT_MISSILE, BOLT_THINMAN_R2, &s_Rocket[0][0], actor->sector(),
@ -14408,7 +14408,7 @@ int InitZillaRocket(DSWActor* actor)
dist = DistanceI(actorNew->spr.pos, actor->user.targetActor->spr.pos); dist = DistanceI(actorNew->spr.pos, actor->user.targetActor->spr.pos);
if (dist != 0) if (dist != 0)
actorNew->user.change.Z = actorNew->spr.zvel = (actorNew->spr.xvel * (ActorUpperZ(actor->user.targetActor) - actorNew->int_pos().Z)) / dist; actorNew->user.change.Z = actorNew->spr.zvel = (actorNew->spr.xvel * (int_ActorUpperZ(actor->user.targetActor) - actorNew->int_pos().Z)) / dist;
} }
return 0; return 0;
@ -14447,7 +14447,7 @@ int InitEnemyStar(DSWActor* actor)
dist = DistanceI(actorNew->spr.pos, actor->user.targetActor->spr.pos); dist = DistanceI(actorNew->spr.pos, actor->user.targetActor->spr.pos);
if (dist != 0) if (dist != 0)
actorNew->user.change.Z = actorNew->spr.zvel = (actorNew->spr.xvel * (ActorUpperZ(actor->user.targetActor) - actorNew->int_pos().Z)) / dist; actorNew->user.change.Z = actorNew->spr.zvel = (actorNew->spr.xvel * (int_ActorUpperZ(actor->user.targetActor) - actorNew->int_pos().Z)) / dist;
PlaySound(DIGI_STAR, actor, v3df_none); PlaySound(DIGI_STAR, actor, v3df_none);
return 0; return 0;
@ -14491,7 +14491,7 @@ int InitEnemyCrossbow(DSWActor* actor)
dist = DistanceI(actorNew->spr.pos, actor->user.targetActor->spr.pos); dist = DistanceI(actorNew->spr.pos, actor->user.targetActor->spr.pos);
if (dist != 0) if (dist != 0)
actorNew->user.change.Z = actorNew->spr.zvel = (actorNew->spr.xvel * (ActorUpperZ(actor->user.targetActor) - actorNew->int_pos().Z)) / dist; actorNew->user.change.Z = actorNew->spr.zvel = (actorNew->spr.xvel * (int_ActorUpperZ(actor->user.targetActor) - actorNew->int_pos().Z)) / dist;
PlaySound(DIGI_STAR, actor, v3df_none); PlaySound(DIGI_STAR, actor, v3df_none);
@ -14510,7 +14510,7 @@ int InitSkelSpell(DSWActor* actor)
nx = actor->int_pos().X; nx = actor->int_pos().X;
ny = actor->int_pos().Y; ny = actor->int_pos().Y;
nz = actor->int_pos().Z - (ActorSizeZ(actor) >> 1); nz = actor->int_pos().Z - (int_ActorSizeZ(actor) >> 1);
// Spawn a shot // Spawn a shot
auto actorNew = SpawnActor(STAT_MISSILE, ELECTRO_ENEMY, s_Electro, actor->sector(), auto actorNew = SpawnActor(STAT_MISSILE, ELECTRO_ENEMY, s_Electro, actor->sector(),
@ -14529,7 +14529,7 @@ int InitSkelSpell(DSWActor* actor)
dist = DistanceI(actorNew->spr.pos, actor->user.targetActor->spr.pos); dist = DistanceI(actorNew->spr.pos, actor->user.targetActor->spr.pos);
if (dist != 0) if (dist != 0)
actorNew->spr.zvel = (actorNew->spr.xvel * (ActorUpperZ(actor->user.targetActor) - nz)) / dist; actorNew->spr.zvel = (actorNew->spr.xvel * (int_ActorUpperZ(actor->user.targetActor) - nz)) / dist;
actorNew->user.change.X = MOVEx(actorNew->spr.xvel, actorNew->int_ang()); actorNew->user.change.X = MOVEx(actorNew->spr.xvel, actorNew->int_ang());
actorNew->user.change.Y = MOVEy(actorNew->spr.xvel, actorNew->int_ang()); actorNew->user.change.Y = MOVEy(actorNew->spr.xvel, actorNew->int_ang());
@ -14584,7 +14584,7 @@ int InitCoolgFire(DSWActor* actor)
if (dist != 0) if (dist != 0)
// (velocity * difference between the target and the throwing star) / // (velocity * difference between the target and the throwing star) /
// distance // distance
actorNew->spr.zvel = (actorNew->spr.xvel * (ActorUpperZ(actor->user.targetActor) - nz)) / dist; actorNew->spr.zvel = (actorNew->spr.xvel * (int_ActorUpperZ(actor->user.targetActor) - nz)) / dist;
actorNew->user.change.X = MOVEx(actorNew->spr.xvel, actorNew->int_ang()); actorNew->user.change.X = MOVEx(actorNew->spr.xvel, actorNew->int_ang());
actorNew->user.change.Y = MOVEy(actorNew->spr.xvel, actorNew->int_ang()); actorNew->user.change.Y = MOVEy(actorNew->spr.xvel, actorNew->int_ang());
@ -14724,7 +14724,7 @@ void InitFireballTrap(DSWActor* actor)
nx = actor->int_pos().X; nx = actor->int_pos().X;
ny = actor->int_pos().Y; ny = actor->int_pos().Y;
nz = actor->int_pos().Z - ActorSizeZ(actor); nz = actor->int_pos().Z - int_ActorSizeZ(actor);
// Spawn a shot // Spawn a shot
auto actorNew = SpawnActor(STAT_MISSILE, FIREBALL, s_Fireball, actor->sector(), nx, ny, nz, auto actorNew = SpawnActor(STAT_MISSILE, FIREBALL, s_Fireball, actor->sector(), nx, ny, nz,
@ -14754,7 +14754,7 @@ void InitBoltTrap(DSWActor* actor)
nx = actor->int_pos().X; nx = actor->int_pos().X;
ny = actor->int_pos().Y; ny = actor->int_pos().Y;
nz = actor->int_pos().Z - ActorSizeZ(actor); nz = actor->int_pos().Z - int_ActorSizeZ(actor);
// Spawn a shot // Spawn a shot
auto actorNew = SpawnActor(STAT_MISSILE, BOLT_THINMAN_R0, &s_Rocket[0][0], actor->sector(), nx, ny, nz, auto actorNew = SpawnActor(STAT_MISSILE, BOLT_THINMAN_R0, &s_Rocket[0][0], actor->sector(), nx, ny, nz,
@ -15412,7 +15412,7 @@ int InitTurretMicro(DSWActor* actor, PLAYER* pp)
if (dist != 0) if (dist != 0)
{ {
int zh; int zh;
zh = int_ActorZOfTop(picked) + (ActorSizeZ(picked) >> 2); zh = int_ActorZOfTop(picked) + (int_ActorSizeZ(picked) >> 2);
actorNew->spr.zvel = (actorNew->spr.xvel * (zh - actorNew->int_pos().Z)) / dist; actorNew->spr.zvel = (actorNew->spr.xvel * (zh - actorNew->int_pos().Z)) / dist;
} }
@ -16134,7 +16134,7 @@ int InitEnemyUzi(DSWActor* actor)
} }
else else
{ {
zh = ActorSizeZ(actor); zh = int_ActorSizeZ(actor);
zh -= (zh >> 2); zh -= (zh >> 2);
} }
daz = actor->int_pos().Z - zh; daz = actor->int_pos().Z - zh;