- Blood: Floatify GetSpriteExtents().

This commit is contained in:
Mitchell Richters 2022-09-18 22:43:32 +10:00 committed by Christoph Oelckers
parent f2be65777b
commit 9c67110722
3 changed files with 10 additions and 18 deletions

View file

@ -618,7 +618,7 @@ void viewProcessSprites(tspriteArray& tsprites, const DVector3& cPos, DAngle cA,
}
else
{
int top, bottom;
double top, bottom;
GetSpriteExtents(pTSprite, &top, &bottom);
if (getflorzofslopeptr(pTSprite->sectp, pTSprite->pos) > bottom)
nAnim = 1;

View file

@ -150,15 +150,15 @@ using BloodSpriteIterator = TSpriteIterator<DBloodActor>;
inline void GetActorExtents(DBloodActor* actor, int* top, int* bottom)
{
GetSpriteExtents(&actor->spr, top, bottom);
double t, b;
GetSpriteExtents(&actor->spr, &t, &b);
*top = t * zworldtoint;
*bottom = b * zworldtoint;
}
inline void GetActorExtents(DBloodActor* actor, double* top, double* bottom)
{
int t, b;
GetSpriteExtents(&actor->spr, &t, &b);
*top = t * zinttoworld;
*bottom = b * zinttoworld;
GetSpriteExtents(&actor->spr, top, bottom);
}
inline bool CheckSector(const BitArray& bits, DBloodActor* act)

View file

@ -80,26 +80,18 @@ extern const char* gAmmoText[];
extern const char* gWeaponText[];
extern int gSkyCount;
void GetSpriteExtents(spritetypebase const* const pSprite, int* top, int* bottom)
void GetSpriteExtents(spritetypebase const* const pSprite, double* top, double* bottom)
{
*top = *bottom = pSprite->int_pos().Z;
*top = *bottom = pSprite->pos.Z;
if ((pSprite->cstat & CSTAT_SPRITE_ALIGNMENT_MASK) != CSTAT_SPRITE_ALIGNMENT_FLOOR)
{
int height = tileHeight(pSprite->picnum);
int center = height / 2 + tileTopOffset(pSprite->picnum);
*top -= (pSprite->yrepeat << 2) * center;
*bottom += (pSprite->yrepeat << 2) * (height - center);
*top -= pSprite->yrepeat * REPEAT_SCALE * center;
*bottom += pSprite->yrepeat * REPEAT_SCALE * (height - center);
}
}
inline void GetSpriteExtents(spritetypebase const* const actor, double* top, double* bottom)
{
int t, b;
GetSpriteExtents(actor, &t, &b);
*top = t * zinttoworld;
*bottom = b * zinttoworld;
}
struct BloodSpawnSpriteDef : public SpawnSpriteDef
{
TArray<XSPRITE> xspr;