- Exhumed: Tidy up internals of seq_PlotSequence().

* Renames disassembly variables.
* Removes abusive reuse of arg variables.
This commit is contained in:
Mitchell Richters 2023-04-15 09:05:02 +10:00
parent 27c87b247c
commit 57ffb0e251
2 changed files with 24 additions and 39 deletions

View file

@ -841,58 +841,45 @@ int seq_PlotArrowSequence(int nSprite, int16_t nSeq, int nVal)
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
int seq_PlotSequence(int nSprite, int16_t edx, int16_t nFrame, int16_t ecx) int seq_PlotSequence(int nSprite, int16_t nSeq, int16_t nFrame, int16_t nFlags)
{ {
tspritetype* pTSprite = mytspriteArray->get(nSprite); tspritetype* pTSprite = mytspriteArray->get(nSprite);
int val; int nSeqOffset = 0;
if (ecx & 1) if (!(nFlags & 1))
{
val = 0;
}
else
{ {
DAngle nAngle = (nCamerapos.XY() - pTSprite->pos.XY()).Angle(); DAngle nAngle = (nCamerapos.XY() - pTSprite->pos.XY()).Angle();
val = (((pTSprite->Angles.Yaw + DAngle22_5 - nAngle).Buildang()) & kAngleMask) >> 8; nSeqOffset = (((pTSprite->Angles.Yaw + DAngle22_5 - nAngle).Buildang()) & kAngleMask) >> 8;
} }
int eax = getSeqFrame(edx, nFrame); int nBaseFrame = getSeqFrame(nSeq, nFrame);
int edi = getSeqFrame(edx + val, nFrame); int nOffsetFrame = getSeqFrame(nSeq + nSeqOffset, nFrame);
int16_t nBase = getSeqFrameChunk(edi); int16_t nBase = getSeqFrameChunk(nOffsetFrame);
int16_t nSize = getSeqFrameChunkCount(edi); int16_t nSize = getSeqFrameChunkCount(nOffsetFrame);
int8_t shade = pTSprite->shade; int8_t shade = pTSprite->shade;
if (getSeqFrameFlags(eax) & 4) if (getSeqFrameFlags(nBaseFrame) & 4)
{ {
shade -= 100; shade -= 100;
} }
int16_t nPict = getSeqFrameChunkPicnum(nBase); int16_t nPict = getSeqFrameChunkPicnum(nBase);
if (ecx & 0x100) int nStatOffset = (nFlags & 0x100) ? -3 : 100;
{ int nStat = nSize + 1;
edx = -3; nStat += nStatOffset;
}
else
{
edx = 100;
}
int esi = nSize + 1; int nMinStat = nStatOffset + 1;
esi += edx;
int var_14 = edx + 1;
auto pOwner = pTSprite->ownerActor;
while (1) while (1)
{ {
esi--; nStat--;
nSize--; nSize--;
if (esi < var_14) { if (nStat < nMinStat) {
break; break;
} }
@ -907,7 +894,7 @@ int seq_PlotSequence(int nSprite, int16_t edx, int16_t nFrame, int16_t ecx)
tsp->sectp = pTSprite->sectp; tsp->sectp = pTSprite->sectp;
tsp->cstat = pTSprite->cstat |= CSTAT_SPRITE_YCENTER; tsp->cstat = pTSprite->cstat |= CSTAT_SPRITE_YCENTER;
tsp->clipdist = pTSprite->clipdist; tsp->clipdist = pTSprite->clipdist;
tsp->statnum = esi; tsp->statnum = nStat;
if (getSeqFrameChunkFlags(nBase) & 1) if (getSeqFrameChunkFlags(nBase) & 1)
{ {
@ -925,30 +912,28 @@ int seq_PlotSequence(int nSprite, int16_t edx, int16_t nFrame, int16_t ecx)
nBase++; nBase++;
} }
if (!(pTSprite->cstat & CSTAT_SPRITE_BLOCK_ALL) || (pOwner->spr.statnum == 100 && nNetPlayerCount)) if (!(pTSprite->cstat & CSTAT_SPRITE_BLOCK_ALL) || (pTSprite->ownerActor->spr.statnum == 100 && nNetPlayerCount))
{ {
pTSprite->ownerActor = nullptr; pTSprite->ownerActor = nullptr;
} }
else else
{ {
auto pSector =pTSprite->sectp; const auto pSector = pTSprite->sectp;
double nFloorZ = pSector->floorz; const double nFloorZ = pSector->floorz;
if (nFloorZ <= PlayerList[nLocalPlayer].pActor->viewzoffset + PlayerList[nLocalPlayer].pActor->spr.pos.Z) { if (nFloorZ <= PlayerList[nLocalPlayer].pActor->viewzoffset + PlayerList[nLocalPlayer].pActor->spr.pos.Z)
{
pTSprite->ownerActor = nullptr; pTSprite->ownerActor = nullptr;
} }
else else
{ {
pTSprite->picnum = nShadowPic; pTSprite->picnum = nShadowPic;
edx = ((tileWidth(nPict) << 5) / nShadowWidth) - int16_t((nFloorZ - pTSprite->pos.Z) * 2.); const auto nScale = max(((tileWidth(nPict) << 5) / nShadowWidth) - int16_t((nFloorZ - pTSprite->pos.Z) * 2.), 1) * REPEAT_SCALE;
if (edx < 1) {
edx = 1;
}
pTSprite->cstat = CSTAT_SPRITE_ALIGNMENT_FLOOR | CSTAT_SPRITE_TRANSLUCENT; pTSprite->cstat = CSTAT_SPRITE_ALIGNMENT_FLOOR | CSTAT_SPRITE_TRANSLUCENT;
pTSprite->pos.Z = pSector->floorz; pTSprite->pos.Z = pSector->floorz;
pTSprite->scale = DVector2(edx * REPEAT_SCALE, edx * REPEAT_SCALE); pTSprite->scale = DVector2(nScale, nScale);
pTSprite->statnum = -3; pTSprite->statnum = -3;
pTSprite->pal = 0; pTSprite->pal = 0;
} }

View file

@ -140,7 +140,7 @@ int seq_GetSeqPicnum(int16_t nSeq, int16_t edx, int16_t ebx);
void seq_DrawStatusSequence(int16_t nSequence, uint16_t edx, int16_t ebx); void seq_DrawStatusSequence(int16_t nSequence, uint16_t edx, int16_t ebx);
int seq_DrawGunSequence(int nSeqOffset, int16_t dx, double xOffs, double yOffs, int nShade, int nPal, DAngle angle, bool align = false); int seq_DrawGunSequence(int nSeqOffset, int16_t dx, double xOffs, double yOffs, int nShade, int nPal, DAngle angle, bool align = false);
int seq_PlotSequence(int nSprite, int16_t edx, int16_t nFrame, int16_t ecx); int seq_PlotSequence(int nSprite, int16_t nSeq, int16_t nFrame, int16_t nFlags);
int seq_PlotArrowSequence(int nSprite, int16_t nSeq, int nVal); int seq_PlotArrowSequence(int nSprite, int16_t nSeq, int nVal);
void seq_DrawPilotLightSeq(double xOffset, double yOffset); void seq_DrawPilotLightSeq(double xOffset, double yOffset);