Blood: fix view sprites overflow in ROR code

This commit is contained in:
nukeykt 2021-07-26 14:38:51 +09:00 committed by Mitchell Richters
parent 39547e2df5
commit 557cd7e734

View file

@ -31,68 +31,71 @@ void collectTSpritesForPortal(int x, int y, int i, int interpolation)
int dx = mirror[j].dx; int dx = mirror[j].dx;
int dy = mirror[j].dy; int dy = mirror[j].dy;
int dz = mirror[j].dz; int dz = mirror[j].dz;
tspritetype* pTSprite = &pm_tsprite[pm_spritesortcnt++]; if (pm_spritesortcnt < MAXSPRITESONSCREEN)
*pTSprite = {}; {
pTSprite->type = pSprite->type; tspritetype* pTSprite = &pm_tsprite[pm_spritesortcnt++];
pTSprite->index = pSprite->index; *pTSprite = {};
pTSprite->sectnum = nSector2; pTSprite->type = pSprite->type;
pTSprite->x = pSprite->x + dx; pTSprite->index = pSprite->index;
pTSprite->y = pSprite->y + dy; pTSprite->sectnum = nSector2;
pTSprite->z = pSprite->z + dz; pTSprite->x = pSprite->x + dx;
pTSprite->ang = pSprite->ang; pTSprite->y = pSprite->y + dy;
pTSprite->picnum = pSprite->picnum; pTSprite->z = pSprite->z + dz;
pTSprite->shade = pSprite->shade; pTSprite->ang = pSprite->ang;
pTSprite->pal = pSprite->pal; pTSprite->picnum = pSprite->picnum;
pTSprite->xrepeat = pSprite->xrepeat; pTSprite->shade = pSprite->shade;
pTSprite->yrepeat = pSprite->yrepeat; pTSprite->pal = pSprite->pal;
pTSprite->xoffset = pSprite->xoffset; pTSprite->xrepeat = pSprite->xrepeat;
pTSprite->yoffset = pSprite->yoffset; pTSprite->yrepeat = pSprite->yrepeat;
pTSprite->cstat = pSprite->cstat; pTSprite->xoffset = pSprite->xoffset;
pTSprite->statnum = kStatDecoration; pTSprite->yoffset = pSprite->yoffset;
pTSprite->owner = pSprite->index; pTSprite->cstat = pSprite->cstat;
pTSprite->extra = pSprite->extra; pTSprite->statnum = kStatDecoration;
pTSprite->flags = pSprite->hitag | 0x200; pTSprite->owner = pSprite->index;
pTSprite->x = dx + interpolatedvalue(pSprite->ox, pSprite->x, interpolation); pTSprite->extra = pSprite->extra;
pTSprite->y = dy + interpolatedvalue(pSprite->oy, pSprite->y, interpolation); pTSprite->flags = pSprite->hitag | 0x200;
pTSprite->z = dz + interpolatedvalue(pSprite->oz, pSprite->z, interpolation); pTSprite->x = dx + interpolatedvalue(pSprite->ox, pSprite->x, interpolation);
pTSprite->ang = pSprite->interpolatedang(interpolation); pTSprite->y = dy + interpolatedvalue(pSprite->oy, pSprite->y, interpolation);
pTSprite->z = dz + interpolatedvalue(pSprite->oz, pSprite->z, interpolation);
pTSprite->ang = pSprite->interpolatedang(interpolation);
int nAnim = 0; int nAnim = 0;
switch (picanm[pTSprite->picnum].extra & 7) switch (picanm[pTSprite->picnum].extra & 7)
{
case 1:
{
int dX = x - pTSprite->x;
int dY = y - pTSprite->y;
RotateVector(&dX, &dY, 128 - pTSprite->ang);
nAnim = GetOctant(dX, dY);
if (nAnim <= 4)
{ {
pTSprite->cstat &= ~4; case 1:
}
else
{ {
nAnim = 8 - nAnim; int dX = x - pTSprite->x;
pTSprite->cstat |= 4; int dY = y - pTSprite->y;
RotateVector(&dX, &dY, 128 - pTSprite->ang);
nAnim = GetOctant(dX, dY);
if (nAnim <= 4)
{
pTSprite->cstat &= ~4;
}
else
{
nAnim = 8 - nAnim;
pTSprite->cstat |= 4;
}
break;
}
case 2:
{
int dX = x - pTSprite->x;
int dY = y - pTSprite->y;
RotateVector(&dX, &dY, 128 - pTSprite->ang);
nAnim = GetOctant(dX, dY);
break;
}
}
while (nAnim > 0)
{
pTSprite->picnum += picanm[pTSprite->picnum].num + 1;
nAnim--;
} }
break;
}
case 2:
{
int dX = x - pTSprite->x;
int dY = y - pTSprite->y;
RotateVector(&dX, &dY, 128 - pTSprite->ang);
nAnim = GetOctant(dX, dY);
break;
}
}
while (nAnim > 0)
{
pTSprite->picnum += picanm[pTSprite->picnum].num + 1;
nAnim--;
}
pm_spritesortcnt++; pm_spritesortcnt++;
}
} }
} }