- repeats in actors_d.cpp and actors_r.cpp

This commit is contained in:
Christoph Oelckers 2022-10-07 19:01:31 +02:00
parent bc26f16ed5
commit 38f7935ee9
3 changed files with 37 additions and 29 deletions

View file

@ -1626,7 +1626,8 @@ static void weaponcommon_d(DDukeActor* proj)
auto spawned = spawn(proj, EXPLOSION2);
if (spawned)
{
spawned->spr.xrepeat = spawned->spr.yrepeat = proj->spr.xrepeat >> 1;
auto scale = proj->spr.ScaleX() * 0.5;
spawned->spr.SetScale(scale,scale);
if (coll.type == kHitSector)
{
if (proj->vel.Z < 0)
@ -1640,7 +1641,11 @@ static void weaponcommon_d(DDukeActor* proj)
if (fireball)
{
auto spawned = spawn(proj, EXPLOSION2);
if (spawned) spawned->spr.xrepeat = spawned->spr.yrepeat = (short)(proj->spr.xrepeat >> 1);
if (spawned)
{
auto scale = proj->spr.ScaleX() * 0.5;
spawned->spr.SetScale(scale,scale);
}
}
}
if (proj->spr.picnum != COOLEXPLOSION1)
@ -2270,8 +2275,8 @@ static void greenslime(DDukeActor *actor)
actor->spr.cstat &= ~CSTAT_SPRITE_YFLIP;
actor->spr.picnum = GREENSLIME + 4;
if (actor->spr.ScaleX() > 0.5 ) actor->spr.xrepeat -= krand() & 7;
if (actor->spr.ScaleY() > 0.25 ) actor->spr.yrepeat -= krand() & 7;
if (actor->spr.ScaleX() > 0.5 ) actor->spr.AddScaleX(-(krand() & 7) * REPEAT_SCALE);
if (actor->spr.ScaleY() > 0.25 ) actor->spr.AddScaleY(-(krand() & 7) * REPEAT_SCALE);
else
{
actor->spr.SetScale(0.625, 0.25);
@ -2294,16 +2299,16 @@ static void greenslime(DDukeActor *actor)
actor->spr.pos = s5->spr.pos + s5->spr.angle.ToVector() * 0.5;
actor->spr.picnum = GREENSLIME + 2 + (global_random & 1);
if (actor->spr.ScaleY() < 1) actor->spr.yrepeat += 2;
if (actor->spr.ScaleY() < 1) actor->spr.AddScaleY(0.03125);
else
{
if (actor->spr.ScaleX() < 0.5) actor->spr.xrepeat += 4;
if (actor->spr.ScaleX() < 0.5) actor->spr.AddScaleY(0.0625);
else
{
actor->temp_data[0] = -1;
double dist = (actor->spr.pos.XY() - s5->spr.pos.XY()).LengthSquared();
if (dist < 48*48) {
s5->spr.xrepeat = 0;
s5->spr.SetScaleX(0);
}
}
}
@ -2373,8 +2378,8 @@ static void greenslime(DDukeActor *actor)
// TJR
}
actor->spr.xrepeat = 36 + BobVal(512 + actor->temp_data[1]) * 8;
actor->spr.yrepeat = 16 + BobVal(actor->temp_data[1]) * 2;
actor->spr.SetScaleX(0.5625 + BobVal(512 + actor->temp_data[1]) * 0.125);
actor->spr.SetScaleY(0.25 + BobVal(actor->temp_data[1]) * 0.03125);
if (rnd(4) && (sectp->ceilingstat & CSTAT_SECTOR_SKY) == 0 &&
abs(actor->floorz - actor->ceilingz) < 192)
@ -2409,8 +2414,8 @@ static void greenslime(DDukeActor *actor)
if (actor->spr.pos.Z > actor->floorz - 8)
{
actor->spr.yrepeat -= 4;
actor->spr.xrepeat += 2;
actor->spr.AddScaleY(-0.0625);
actor->spr.AddScaleX(0.03125);
}
else
{
@ -2453,7 +2458,10 @@ static void flamethrowerflame(DDukeActor *actor)
int ds = actor->temp_data[0] / 6;
if (actor->spr.ScaleX() < 0.1250)
actor->spr.yrepeat = actor->spr.xrepeat += ds;
{
actor->spr.AddScaleX(ds * REPEAT_SCALE);
actor->spr.SetScaleY(actor->spr.ScaleX());
}
actor->clipdist += ds * 0.25;
if (actor->temp_data[0] <= 2)
actor->temp_data[3] = krand() % 10;
@ -2668,9 +2676,9 @@ DETONATEB:
RANDOMSCRAP(actor);
}
if (actor->spr.yrepeat)
if (actor->spr.ScaleY())
{
actor->spr.yrepeat = 0;
actor->spr.SetScaleY(0);
return;
}
@ -2686,7 +2694,7 @@ DETONATEB:
actor->temp_data[2] = gs.respawnitemtime;
spawn(actor, RESPAWNMARKERRED);
actor->spr.cstat = CSTAT_SPRITE_INVISIBLE;
actor->spr.yrepeat = 9;
actor->spr.SetScaleY(0.140625);
return;
}
}
@ -2997,7 +3005,7 @@ void moveexplosions_d(void) // STATNUM 5
if (act->temp_data[0] == 7 * 26) continue;
act->spr.pos.Z += 1 / 16. + krandf(1 / 16.);
act->temp_data[0]++;
if ((act->temp_data[0] % 9) == 0) act->spr.yrepeat++;
if ((act->temp_data[0] % 9) == 0) act->spr.AddScaleY(REPEAT_SCALE);
continue;
case NUKEBUTTON:

View file

@ -543,7 +543,7 @@ int ifhitbyweapon_r(DDukeActor *actor)
else
{
if (actor->hitextra == 0)
if (actor->spr.xrepeat < 24)
if (actor->spr.ScaleX() < 0.375)
return -1;
actor->spr.extra -= actor->hitextra;
@ -1054,9 +1054,9 @@ static bool weaponhitwall(DDukeActor *proj, walltype* wal, const DVector3& oldpo
{
proj->spr.extra >>= 1;
if (proj->spr.ScaleX() > 0.125 )
proj->spr.xrepeat -= 2;
proj->spr.AddScaleX(-0.03125);
if (proj->spr.ScaleY() > 0.125 )
proj->spr.yrepeat -= 2;
proj->spr.AddScaleY(-0.03125);
proj->spr.yint--;
}
@ -1082,7 +1082,7 @@ static bool weaponhitwall(DDukeActor *proj, walltype* wal, const DVector3& oldpo
j->spr.SetScale(0.125, 0.125);
j->spr.cstat = CSTAT_SPRITE_ALIGNMENT_WALL;
j->spr.angle += DAngle90;
j->clipdist = MulScale(proj->spr.xrepeat, tileWidth(proj->spr.picnum), 7) * 0.25;
j->clipdist = proj->spr.ScaleX() * tileWidth(proj->spr.picnum) * 0.125;
}
}
deletesprite(proj);
@ -1138,9 +1138,9 @@ bool weaponhitsector(DDukeActor *proj, const DVector3& oldpos)
ssp(proj, CLIPMASK1);
proj->spr.extra >>= 1;
if (proj->spr.ScaleX() > 0.125 )
proj->spr.xrepeat -= 2;
proj->spr.AddScaleX(-0.03125);
if (proj->spr.ScaleY() > 0.125 )
proj->spr.yrepeat -= 2;
proj->spr.AddScaleY(-0.03125);
proj->spr.yint--;
return true;
}
@ -1280,7 +1280,8 @@ static void weaponcommon_r(DDukeActor *proj)
auto spawned = spawn(proj, 1441);
if (spawned)
{
spawned->spr.xrepeat = spawned->spr.yrepeat = proj->spr.xrepeat >> 1;
auto scale = proj->spr.ScaleX() * 0.5;
spawned->spr.SetScale(scale, scale);
if (coll.type == kHitSector)
{
if (proj->vel.Z < 0)
@ -1853,7 +1854,7 @@ static void rrra_specialstats()
else if (enemysizecheat == 2)
{
act->spr.MultScale(0.5);
act->clipdist = MulScale(act->spr.xrepeat, tileHeight(act->spr.picnum), 7) * 0.25;
act->clipdist = act->spr.ScaleX(), tileHeight(act->spr.picnum) * 0.125;
}
break;
}
@ -2442,9 +2443,9 @@ DETONATEB:
}
}
if (actor->spr.yrepeat)
if (actor->spr.ScaleY())
{
actor->spr.yrepeat = 0;
actor->spr.SetScaleY(0);
return;
}
@ -2906,7 +2907,7 @@ void moveexplosions_r(void) // STATNUM 5
if (act->temp_data[0] == 7 * 26) continue;
act->spr.pos.Z += 1 / 16. + krandf(1 / 16.);
act->temp_data[0]++;
if ((act->temp_data[0] % 9) == 0) act->spr.yrepeat++;
if ((act->temp_data[0] % 9) == 0) act->spr.AddScaleY(REPEAT_SCALE);
continue;

View file

@ -124,8 +124,7 @@ static const char *cheatKfc(int player)
if (spr)
{
spr->spr.pal = 1;
spr->spr.xrepeat = spr->spr.xrepeat << 2;
spr->spr.yrepeat = spr->spr.yrepeat << 2;
spr->spr.MultScale(4);
}
}
return quoteMgr.GetQuote(QUOTE_CHEAT_KFC);