- all nu not referring to actorNew->u()

This commit is contained in:
Christoph Oelckers 2021-12-25 19:53:06 +01:00
parent b49e3201ae
commit 38224f05b7
3 changed files with 38 additions and 45 deletions

View file

@ -1269,23 +1269,23 @@ void PreDrawStackedWater(void)
if (actorNew != nullptr)
{
// spawn a user
auto nu = actorNew->allocUser();
actorNew->allocUser();
nu->xchange = -989898;
actorNew->user.xchange = -989898;
// copy everything reasonable from the user that
// analyzesprites() needs to draw the image
nu->State = u->State;
nu->Rot = u->Rot;
nu->StateStart = u->StateStart;
nu->StateEnd = u->StateEnd;
nu->Flags = u->Flags;
nu->Flags2 = u->Flags2;
nu->RotNum = u->RotNum;
nu->ID = u->ID;
actorNew->user.State = u->State;
actorNew->user.Rot = u->Rot;
actorNew->user.StateStart = u->StateStart;
actorNew->user.StateEnd = u->StateEnd;
actorNew->user.Flags = u->Flags;
actorNew->user.Flags2 = u->Flags2;
actorNew->user.RotNum = u->RotNum;
actorNew->user.ID = u->ID;
nu->PlayerP = u->PlayerP;
nu->spal = u->spal;
actorNew->user.PlayerP = u->PlayerP;
actorNew->user.spal = u->spal;
}
}
}

View file

@ -1608,29 +1608,26 @@ void SpawnFlashBombOnActor(DSWActor* actor)
{
int sizez = (ActorSizeZ(actor) * 5) >> 2;
auto nu = flameActor->u();
if (nu->Counter >= GetRepeatFromHeight(flameActor, sizez))
if (flameActor->user.Counter >= GetRepeatFromHeight(flameActor, sizez))
{
// keep flame only slightly bigger than the enemy itself
nu->Counter = GetRepeatFromHeight(flameActor, sizez) * 2;
flameActor->user.Counter = GetRepeatFromHeight(flameActor, sizez) * 2;
}
else
{
// increase max size
nu->Counter += GetRepeatFromHeight(flameActor, 8 << 8) * 2;
flameActor->user.Counter += GetRepeatFromHeight(flameActor, 8 << 8) * 2;
}
// Counter is max size
if (nu->Counter >= 230)
if (flameActor->user.Counter >= 230)
{
// this is far too big
nu->Counter = 230;
flameActor->user.Counter = 230;
}
if (nu->WaitTics < 2 * 120)
nu->WaitTics = 2 * 120; // allow it to grow again
if (flameActor->user.WaitTics < 2 * 120)
flameActor->user.WaitTics = 2 * 120; // allow it to grow again
return;
}

View file

@ -9958,31 +9958,30 @@ void SpawnFireballFlames(DSWActor* actor, DSWActor* enemyActor)
if (flameActor != nullptr)
{
int sizez = ActorSizeZ(enemyActor) + (ActorSizeZ(enemyActor) >> 2);
auto nu = flameActor->u();
if (TEST(enemyActor->spr.extra, SPRX_BURNABLE))
return;
if (nu->Counter >= GetRepeatFromHeight(flameActor, sizez))
if (flameActor->user.Counter >= GetRepeatFromHeight(flameActor, sizez))
{
// keep flame only slightly bigger than the enemy itself
nu->Counter = GetRepeatFromHeight(flameActor, sizez);
flameActor->user.Counter = GetRepeatFromHeight(flameActor, sizez);
}
else
{
//increase max size
nu->Counter += GetRepeatFromHeight(flameActor, 8<<8);
flameActor->user.Counter += GetRepeatFromHeight(flameActor, 8<<8);
}
// Counter is max size
if (nu->Counter >= 230)
if (flameActor->user.Counter >= 230)
{
// this is far too big
nu->Counter = 230;
flameActor->user.Counter = 230;
}
if (nu->WaitTics < 2*120)
nu->WaitTics = 2*120; // allow it to grow again
if (flameActor->user.WaitTics < 2*120)
flameActor->user.WaitTics = 2*120; // allow it to grow again
return;
}
@ -13095,7 +13094,6 @@ int InitStar(PLAYERp pp)
for (size_t i = 0; i < countof(dang); i++)
{
auto actorNew2 = SpawnActor(STAT_MISSILE, STAR1, s_Star, pp->cursector, nx, ny, nz, NORM_ANGLE(actorNew->spr.ang + dang[i]), actorNew->spr.xvel);
nu = actorNew2->u();
SetOwner(GetOwner(actorNew), actorNew2);
actorNew2->spr.yrepeat = actorNew2->spr.xrepeat = STAR_REPEAT;
@ -13103,14 +13101,14 @@ int InitStar(PLAYERp pp)
actorNew2->spr.extra = actorNew->spr.extra;
actorNew2->spr.clipdist = actorNew->spr.clipdist;
nu->WeaponNum = wu->WeaponNum;
nu->Radius = wu->Radius;
nu->ceiling_dist = wu->ceiling_dist;
nu->floor_dist = wu->floor_dist;
nu->Flags2 = wu->Flags2 & ~(SPR2_FLAMEDIE); // mask out any new flags here for safety.
actorNew2->user.WeaponNum = wu->WeaponNum;
actorNew2->user.Radius = wu->Radius;
actorNew2->user.ceiling_dist = wu->ceiling_dist;
actorNew2->user.floor_dist = wu->floor_dist;
actorNew2->user.Flags2 = wu->Flags2 & ~(SPR2_FLAMEDIE); // mask out any new flags here for safety.
if (TEST(pp->Flags, PF_DIVING) || SpriteInUnderwaterArea(actorNew2))
SET(nu->Flags, SPR_UNDERWATER);
SET(actorNew2->user.Flags, SPR_UNDERWATER);
zvel = -MulScale(pp->horizon.horiz.asq16(), HORIZ_MULT+STAR_HORIZ_ADJ, 16);
actorNew2->spr.zvel = zvel >> 1;
@ -13124,9 +13122,9 @@ int InitStar(PLAYERp pp)
// move the same as middle star
zvel = wu->zchange;
nu->xchange = MOVEx(actorNew2->spr.xvel, actorNew2->spr.ang);
nu->ychange = MOVEy(actorNew2->spr.xvel, actorNew2->spr.ang);
nu->zchange = zvel;
actorNew2->user.xchange = MOVEx(actorNew2->spr.xvel, actorNew2->spr.ang);
actorNew2->user.ychange = MOVEy(actorNew2->spr.xvel, actorNew2->spr.ang);
actorNew2->user.zchange = zvel;
actorNew2->spr.backuppos();
}
@ -18230,7 +18228,6 @@ int QueueFootPrint(DSWActor* actor)
{
DSWActor* spawnedActor;
USERp u = actor->u();
USERp nu;
short rnd_num=0;
bool Found=false;
SECTORp sectp = actor->spr.sector();
@ -18286,7 +18283,6 @@ int QueueFootPrint(DSWActor* actor)
u->PlayerP->NumFootPrints--;
nu = spawnedActor->u();
spawnedActor->spr.hitag = 0;
spawnedActor->spr.xrepeat = 48;
spawnedActor->spr.yrepeat = 54;
@ -18298,14 +18294,14 @@ int QueueFootPrint(DSWActor* actor)
spawnedActor->spr.xoffset = spawnedActor->spr.yoffset = 0;
spawnedActor->spr.pos = actor->spr.pos;
spawnedActor->spr.ang = actor->spr.ang;
RESET(nu->Flags, SPR_SHADOW);
RESET(spawnedActor->user.Flags, SPR_SHADOW);
switch (FootMode)
{
case BLOOD_FOOT:
nu->spal = spawnedActor->spr.pal = PALETTE_PLAYER3; // Turn blue to blood red
spawnedActor->user.spal = spawnedActor->spr.pal = PALETTE_PLAYER3; // Turn blue to blood red
break;
default:
nu->spal = spawnedActor->spr.pal = PALETTE_PLAYER1; // Gray water
spawnedActor->user.spal = spawnedActor->spr.pal = PALETTE_PLAYER1; // Gray water
break;
}