- final clenaup on animatesprites_d.cpp.

Only the player actor is left, which is also the messiest part...
This commit is contained in:
Christoph Oelckers 2022-12-14 20:27:19 +01:00
parent ce00183707
commit f9e5f2c137
9 changed files with 64 additions and 88 deletions

View file

@ -47,7 +47,7 @@ BEGIN_DUKE_NS
void animatesprites_d(tspriteArray& tsprites, const DVector2& viewVec, DAngle viewang, double interpfrac)
{
int k, p;
int p;
int t1, t3, t4;
tspritetype* t;
DDukeActor* h;
@ -59,7 +59,7 @@ void animatesprites_d(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi
if (!actorflag(h, SFLAG2_FORCESECTORSHADE) && ((t->cstat & CSTAT_SPRITE_ALIGNMENT_WALL)) || (badguypic(t->picnum) && t->extra > 0) || t->statnum == STAT_PLAYER)
{
if (h->sector()->shadedsector == 1 && h->spr.statnum != 1)
if (h->sector()->shadedsector == 1 && h->spr.statnum != STAT_ACTOR)
{
t->shade = 16;
}
@ -121,13 +121,8 @@ void animatesprites_d(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi
t3 = h->temp_data[3];
t4 = h->temp_data[4];
switch (h->spr.picnum)
if (h->spr.picnum == DTILE_APLAYER)
{
case DTILE_GROWSPARK:
t->picnum = DTILE_GROWSPARK + ((PlayClock >> 4) & 3);
break;
case DTILE_APLAYER:
p = h->PlayerIndex();
if (t->pal == 1) t->pos.Z -= 18;
@ -171,7 +166,7 @@ void animatesprites_d(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi
case FREEZE_WEAPON: newtspr->picnum = DTILE_FREEZESPRITE; break;
case FLAMETHROWER_WEAPON: //Twentieth Anniversary World Tour
if (isWorldTour())
newtspr->picnum = DTILE_FLAMETHROWERSPRITE;
newtspr->picnum = DTILE_FLAMETHROWERSPRITE;
break;
case DEVISTATOR_WEAPON: newtspr->picnum = DTILE_DEVISTATORSPRITE; break;
}
@ -191,31 +186,14 @@ void animatesprites_d(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi
if (!h->GetOwner())
{
if (hw_models && modelManager.CheckModel(h->spr.picnum, h->spr.pal))
{
k = 0;
t->cstat &= ~CSTAT_SPRITE_XFLIP;
}
else
{
k = angletorotation1(t->Angles.Yaw, viewang);
if (k > 4)
{
k = 8 - k;
t->cstat |= CSTAT_SPRITE_XFLIP;
}
else t->cstat &= ~CSTAT_SPRITE_XFLIP;
}
applyRotation1(h, t, viewang);
if (t->sectp->lotag == 2) k += 1795 - 1405;
else if ((h->floorz - h->spr.pos.Z) > 64) k += 60;
if (t->sectp->lotag == ST_2_UNDERWATER) t->picnum += DTILE_APLAYERSWIMMING - DTILE_APLAYER;
else if ((h->floorz - h->spr.pos.Z) > 64) t->picnum += DTILE_APLAYERJUMP - DTILE_APLAYER;
t->picnum += k;
t->pal = ps[p].palookup;
goto PALONLY;
continue;
}
if (ps[p].on_crane == nullptr && (h->sector()->lotag & 0x7ff) != 1)
{
double v = h->spr.pos.Z - ps[p].GetActor()->floorz + 3;
@ -240,23 +218,13 @@ void animatesprites_d(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi
continue;
}
PALONLY:
if (sectp->floorpal)
copyfloorpal(t, sectp);
if (!h->GetOwner()) continue;
if (t->pos.Z > h->floorz && t->scale.X < 0.5)
t->pos.Z = h->floorz;
break;
default:
if (sectp->floorpal && !actorflag(h, SFLAG2_NOFLOORPAL))
copyfloorpal(t, sectp);
break;
}
applyanimations(t, h, viewVec, viewang);
@ -271,14 +239,6 @@ void animatesprites_d(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi
}
}
switch (h->spr.picnum)
{
case DTILE_GROWSPARK:
case DTILE_CHAINGUN:
t->shade = -127;
break;
}
h->dispicnum = t->picnum;
if (t->sectp->floortexture == mirrortex)
t->scale = DVector2(0, 0);

View file

@ -121,9 +121,6 @@ void animatesprites_r(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi
switch (h->spr.picnum)
{
case RTILE_CRYSTALAMMO:
t->shade = int(BobVal(PlayClock << 4) * 16);
break;
case RTILE_APLAYER:
p = h->PlayerIndex();
@ -191,30 +188,14 @@ void animatesprites_r(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi
if (!h->GetOwner())
{
if (hw_models && modelManager.CheckModel(h->spr.picnum, h->spr.pal))
{
k = 0;
t->cstat &= ~CSTAT_SPRITE_XFLIP;
} else
{
k = angletorotation1(t->Angles.Yaw, viewang);
if (k > 4)
{
k = 8 - k;
t->cstat |= CSTAT_SPRITE_XFLIP;
}
else t->cstat &= ~CSTAT_SPRITE_XFLIP;
}
applyRotation1(h, t, viewang);
if (t->sectp->lotag == 2) k += 1795 - 1405;
else if ((h->floorz - h->spr.pos.Z) > 64) k += 60;
if (t->sectp->lotag == ST_2_UNDERWATER) t->picnum += RTILE_APLAYERSWIMMING - RTILE_APLAYER;
else if ((h->floorz - h->spr.pos.Z) > 64) t->picnum += RTILE_APLAYERJUMP - RTILE_APLAYER;
t->picnum += k;
t->pal = ps[p].palookup;
goto PALONLY;
continue;
}
if (ps[p].on_crane == nullptr && (h->sector()->lotag & 0x7ff) != 1)
{
double v = h->spr.pos.Z - ps[p].GetActor()->floorz + 3;
@ -239,13 +220,6 @@ void animatesprites_r(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi
continue;
}
PALONLY:
if (sectp->floorpal)
copyfloorpal(t, sectp);
if (!h->GetOwner()) continue;
if (t->pos.Z > h->floorz && t->scale.X < 0.5)
t->pos.Z = h->floorz;
@ -300,12 +274,6 @@ void animatesprites_r(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi
}
break;
default:
if (sectp->floorpal)
copyfloorpal(t, sectp);
break;
}
applyanimations(t, h, viewVec, viewang);
@ -317,6 +285,10 @@ void animatesprites_r(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi
switch (h->spr.picnum)
{
case RTILE_CRYSTALAMMO:
t->shade = int(BobVal(PlayClock << 4) * 16);
break;
case RTILE_SBMOVE:
if (!isRRRA())
t->shade = -127;

View file

@ -445,6 +445,7 @@ x(APLAYERTOP, 1400)
x(APLAYER, 1405)
x(PLAYERONWATER, 1420)
x(PLAYERWALK, 1426)
x(APLAYERJUMP, 1465)
x(DUKELYINGDEAD, 1518)
x(DUKETORSO, 1520)
x(DUKEGUN, 1528)
@ -480,6 +481,7 @@ x(LIZTROOPDUCKING, 1744)
x(HEADJIB1, 1768)
x(ARMJIB1, 1772)
x(LEGJIB1, 1776)
x(APLAYERSWIMMING, 1795)
x(CANNONBALL, 1817)
x(OCTABRAIN, 1820)
x(OCTABRAINSTAYPUT, 1821)
@ -599,6 +601,9 @@ x(F1HELP, 2445)
x(NOTCHON, 2446)
x(NOTCHOFF, 2447)
x(GROWSPARK, 2448)
x(GROWSPARK1, 2440)
x(GROWSPARK2, 2450)
x(GROWSPARK3, 2451)
x(DUKEICON, 2452)
x(BADGUYICON, 2453)
x(FOODICON, 2454)

View file

@ -1097,6 +1097,8 @@ x(APLAYERTOP, 3840)
x(APLAYER, 3845)
x(PLAYERWALK, 3846)
x(PLAYERONWATER, 3860)
x(APLAYERJUMP, 3905)
x(APLAYERSWIMMING, 3845 + 390)
x(DUKELYINGDEAD, 3998)
x(DUKEGUN, 4041)
x(DUKETORSO, 4046)

View file

@ -11,7 +11,8 @@ spawnclasses
9 = DukeRespawnController
10 = DukeGPSpeed
4890 = DukeNaturalLightning
2536 = DukeChaingun
2613 = DukeShotgunShot
2536 = DukeChaingunShot
1221 = DukeCranePole
1222 = DukeCrane
@ -254,6 +255,7 @@ spawnclasses
762 = DukeMike
1518 = DukePlayerLyingDead
1420 = DukePlayerOnWater
2448 = DukeGrowSpark
46 = DukeCrystalAmmo
55 = DukeSteroids

View file

@ -24,7 +24,8 @@ spawnclasses
38 = RedneckJaildoorSound
19 = RedneckGeometryEffect
34 = RedneckKeyinfoSetter
3380 = DukeChaingun
3380 = RedneckChaingunShot
3350 = RedneckShotgunShot
1298 = DukeCranePole
1299 = DukeCrane

View file

@ -1,6 +1,20 @@
// dummy items representing certain weapons
class DukeChaingun : DukeActor
class DukeShotgunShot : DukeActor
{
default
{
pic "SHOTGUN";
}
}
class RedneckShotgunShot : DukeShotgunShot
{
}
class DukeChaingunShot : DukeActor
{
default
{
@ -8,6 +22,10 @@ class DukeChaingun : DukeActor
}
}
class RedneckChaingunShot : DukeChaingunShot
{
}
class DukeSectorEffector : DukeActor
{
//This never gets ticked, the handler goes directly to the native implementations.

View file

@ -261,3 +261,19 @@ class DukeAccessCard : DukeItemBase
}
}
class DukeGrowSpark : DukeActor
{
default
{
spriteset "GROWSPARK", "GROWSPARK1", "GROWSPARK2", "GROWSPARK3";
}
override bool animate(tspritetype t)
{
t.setSpritePic(self, (PlayClock >> 4) & 3);
t.shade = -127;
return true;
}
}

View file

@ -13,7 +13,7 @@ class DukeBreakWalls
sectortype sptr = Raze.updatesector(pos.XY, spr.sector);
if (sptr == nullptr) return;
double scale = spr.isPlayer()? 0.125 : spr is 'DukeChaingun'? 0.25 : 0.5;
double scale = spr.isPlayer()? 0.125 : spr is 'DukeChaingunShot'? 0.25 : 0.5;
let spawned = dlevel.SpawnActor(sptr, pos, 'DukeForceRipple', -127, (scale, scale), 0, 0., 0., spr, DukeActor.STAT_MISC);
if (spawned)
{