- use ActorVect… functions in a few more places

This commit is contained in:
Christoph Oelckers 2022-10-11 00:21:49 +02:00
parent 3f2d970b4f
commit 0c8a76dc9c
6 changed files with 20 additions and 17 deletions

View file

@ -1977,6 +1977,11 @@ inline double ActorZOfBottom(DSWActor* actor)
return GetSpriteZOfBottom(&actor->spr);
}
inline DVector3 ActorVectOfBottom(DSWActor* actor)
{
return DVector3(actor->spr.pos.XY(), ActorZOfBottom(actor));
}
inline double ActorZOfMiddle(DSWActor* actor)
{
return (ActorZOfTop(actor) + ActorZOfBottom(actor)) * 0.5;

View file

@ -302,8 +302,7 @@ int DoWallBloodDrip(DSWActor* actor)
void SpawnMidSplash(DSWActor* actor)
{
auto actorNew = SpawnActor(STAT_MISSILE, GOREDrip, s_GoreSplash, actor->sector(),
DVector3(actor->spr.pos.XY(), ActorZOfMiddle(actor)), actor->spr.angle);
auto actorNew = SpawnActor(STAT_MISSILE, GOREDrip, s_GoreSplash, actor->sector(), ActorVectOfMiddle(actor), actor->spr.angle);
actorNew->spr.shade = -12;
actorNew->spr.scale.X = ((70 - RandomRange(20)) * REPEAT_SCALE);
@ -1915,7 +1914,7 @@ int DoCarryFlag(DSWActor* actor)
// if no Owner then die
if (attached != nullptr)
{
DVector3 pos(attached->spr.pos.XY(), ActorZOfMiddle(attached));
DVector3 pos = ActorVectOfMiddle(attached);
SetActorZ(actor, pos);
actor->spr.angle = attached->spr.angle + DAngle270;
}
@ -2070,7 +2069,7 @@ int DoCarryFlagNoDet(DSWActor* actor)
// if no Owner then die
if (attached != nullptr)
{
SetActorZ(actor, DVector3(attached->spr.pos.XY(), ActorZOfMiddle(attached)));
SetActorZ(actor, ActorVectOfMiddle(attached));
actor->spr.angle = attached->spr.angle + DAngle270;
actor->spr.pos.Z = attached->spr.pos.Z - (ActorSizeZ(attached) * 0.5);
}

View file

@ -3120,7 +3120,7 @@ void StackedWaterSplash(PLAYER* pp)
{
auto sect = pp->cursector;
updatesectorz(DVector3(pp->pos.XY(), ActorZOfBottom(pp->actor)), &sect);
updatesectorz(ActorVectOfBottom(pp->actor), &sect);
if (SectorIsUnderwaterArea(sect))
{
@ -4024,7 +4024,7 @@ int PlayerCanDiveNoWarp(PLAYER* pp)
{
auto sect = pp->cursector;
updatesectorz(DVector3(pp->pos.XY(), ActorZOfBottom(pp->actor)), &sect);
updatesectorz(ActorVectOfBottom(pp->actor), &sect);
if (SectorIsUnderwaterArea(sect))
{

View file

@ -3592,7 +3592,7 @@ int ActorCoughItem(DSWActor* actor)
actorNew = insertActor(actor->sector(), STAT_SPAWN_ITEMS);
actorNew->spr.cstat = 0;
actorNew->spr.extra = 0;
actorNew->spr.pos = { actor->spr.pos.XY(), ActorZOfMiddle(actor) };
actorNew->spr.pos = ActorVectOfMiddle(actor);
actorNew->spr.angle = nullAngle;
actorNew->spr.extra = 0;
@ -3631,7 +3631,7 @@ int ActorCoughItem(DSWActor* actor)
actorNew = insertActor(actor->sector(), STAT_SPAWN_ITEMS);
actorNew->spr.cstat = 0;
actorNew->spr.extra = 0;
actorNew->spr.pos = { actor->spr.pos.XY(), ActorZOfMiddle(actor) };
actorNew->spr.pos = ActorVectOfMiddle(actor);
actorNew->spr.angle = nullAngle;
actorNew->spr.extra = 0;
@ -3657,7 +3657,7 @@ int ActorCoughItem(DSWActor* actor)
actorNew = insertActor(actor->sector(), STAT_SPAWN_ITEMS);
actorNew->spr.cstat = 0;
actorNew->spr.extra = 0;
actorNew->spr.pos = { actor->spr.pos.XY(), ActorZOfMiddle(actor) };
actorNew->spr.pos = ActorVectOfMiddle(actor);
actorNew->spr.angle = nullAngle;
actorNew->spr.extra = 0;
@ -3686,7 +3686,7 @@ int ActorCoughItem(DSWActor* actor)
actorNew = insertActor(actor->sector(), STAT_SPAWN_ITEMS);
actorNew->spr.cstat = 0;
actorNew->spr.extra = 0;
actorNew->spr.pos = { actor->spr.pos.XY(), ActorZOfMiddle(actor) };
actorNew->spr.pos = ActorVectOfMiddle(actor);
actorNew->spr.angle = nullAngle;
actorNew->spr.extra = 0;
@ -3746,7 +3746,7 @@ int ActorCoughItem(DSWActor* actor)
actorNew = insertActor(actor->sector(), STAT_SPAWN_ITEMS);
actorNew->spr.cstat = 0;
actorNew->spr.extra = 0;
actorNew->spr.pos = { actor->spr.pos.XY(), ActorZOfMiddle(actor) };
actorNew->spr.pos = ActorVectOfMiddle(actor);
actorNew->spr.angle = nullAngle;
actorNew->spr.extra = 0;

View file

@ -797,7 +797,7 @@ void BossHealthMeter(void)
DSWActor* actor = BossSpriteNum[i];
if (actor != nullptr && !bosswasseen[i])
{
if (cansee(DVector3(actor->spr.pos.XY(), ActorZOfTop(actor)), actor->sector(), pp->pos.plusZ(-40), pp->cursector))
if (cansee(ActorVectOfTop(actor), actor->sector(), pp->pos.plusZ(-40), pp->cursector))
{
if (i == 0 && !bosswasseen[0])
{

View file

@ -4535,7 +4535,7 @@ int DoFireballFlames(DSWActor* actor)
DSWActor* attach = actor->user.attachActor;
if (attach != nullptr)
{
actor->spr.pos = DVector3(attach->spr.pos.XY(), ActorZOfMiddle(attach));
actor->spr.pos = ActorVectOfMiddle(attach);
if ((attach->spr.extra & SPRX_BURNABLE))
{
@ -8061,8 +8061,7 @@ int DoBlurExtend(DSWActor* actor, int16_t interval, int16_t blur_num)
int InitPlasmaFountain(DSWActor* wActor, DSWActor* sActor)
{
auto actorNew = SpawnActor(STAT_MISSILE, PLASMA_FOUNTAIN, s_PlasmaFountain, sActor->sector(),
DVector3(sActor->spr.pos.XY(), ActorZOfBottom(sActor)), sActor->spr.angle, 0);
auto actorNew = SpawnActor(STAT_MISSILE, PLASMA_FOUNTAIN, s_PlasmaFountain, sActor->sector(), ActorVectOfBottom(sActor), sActor->spr.angle, 0);
actorNew->spr.shade = -40;
if (wActor)
@ -12621,7 +12620,7 @@ int InitSumoSkull(DSWActor* actor)
PlaySound(DIGI_SERPSUMMONHEADS, actor, v3df_none);
auto actorNew = SpawnActor(STAT_ENEMY, SKULL_R0, &s_SkullWait[0][0], actor->sector(), DVector3(actor->spr.pos, ActorZOfMiddle(actor)), actor->spr.angle, 0);
auto actorNew = SpawnActor(STAT_ENEMY, SKULL_R0, &s_SkullWait[0][0], actor->sector(), ActorVectOfMiddle(actor), actor->spr.angle, 0);
actorNew->vel.X = 31.25;
SetOwner(actor, actorNew);
@ -14505,7 +14504,7 @@ int SpawnDemonFist(DSWActor* actor)
if (actor->user.Flags & (SPR_SUICIDE))
return -1;
auto expActor = SpawnActor(STAT_MISSILE, 0, s_TeleportEffect, actor->sector(), DVector3(actor->spr.pos.XY(), ActorZOfMiddle(actor)), actor->spr.angle, 0);
auto expActor = SpawnActor(STAT_MISSILE, 0, s_TeleportEffect, actor->sector(), ActorVectOfMiddle(actor), actor->spr.angle, 0);
expActor->spr.hitag = LUMINOUS; //Always full brightness
expActor->spr.shade = -40;