- fixed slope sprite flag getting cleared by some leftover code.

Also merged copyfrom into the one single function that called it.
This commit is contained in:
Christoph Oelckers 2021-12-31 10:55:55 +01:00
parent 0cba0e19b5
commit 717dd123e5
3 changed files with 46 additions and 45 deletions

View file

@ -426,13 +426,4 @@ inline int pushmove(vec3_t* const vect, sectortype** const sect, int32_t const w
return res;
}
inline tspritetype* renderAddTsprite(tspritetype* tsprite, int& spritesortcnt, DCoreActor* actor)
{
if (spritesortcnt >= MAXSPRITESONSCREEN) return nullptr;
auto tspr = &tsprite[spritesortcnt++];
tspr->copyfrom(&actor->spr);
tspr->clipdist = 0;
tspr->ownerActor = actor;
return tspr;
}
tspritetype* renderAddTsprite(tspritetype* tsprite, int& spritesortcnt, DCoreActor* actor);

View file

@ -400,6 +400,51 @@ void dragpoint(walltype* startwall, int newx, int newy)
});
}
//==========================================================================
//
//
//
//==========================================================================
tspritetype* renderAddTsprite(tspritetype* tsprite, int& spritesortcnt, DCoreActor* actor)
{
if (spritesortcnt >= MAXSPRITESONSCREEN) return nullptr;
auto tspr = &tsprite[spritesortcnt++];
tspr->pos = actor->spr.pos;
tspr->cstat = actor->spr.cstat;
tspr->picnum = actor->spr.picnum;
tspr->shade = actor->spr.shade;
tspr->pal = actor->spr.pal;
tspr->clipdist = 0;
tspr->blend = actor->spr.blend;
tspr->xrepeat = actor->spr.xrepeat;
tspr->yrepeat = actor->spr.yrepeat;
tspr->xoffset = actor->spr.xoffset;
tspr->yoffset = actor->spr.yoffset;
tspr->sectp = actor->spr.sectp;
tspr->statnum = actor->spr.statnum;
tspr->ang = actor->spr.ang;
tspr->xvel = actor->spr.xvel;
tspr->yvel = actor->spr.yvel;
tspr->zvel = actor->spr.zvel;
tspr->lotag = actor->spr.lotag;
tspr->hitag = actor->spr.hitag;
tspr->extra = actor->spr.extra;
tspr->time = actor->spr.time;
tspr->ownerActor = actor;
// need to copy the slope sprite flag around because for tsprites the bit combination means 'voxel'.
if ((tspr->cstat & CSTAT_SPRITE_ALIGNMENT_MASK) == CSTAT_SPRITE_ALIGNMENT_SLOPE)
{
tspr->cstat &= ~CSTAT_SPRITE_ALIGNMENT_WALL;
tspr->clipdist |= TSPR_SLOPESPRITE;
}
return tspr;
}
//==========================================================================
//
// vector serializers

View file

@ -470,41 +470,6 @@ struct spritetype : public spritetypebase
struct tspritetype : public spritetypebase
{
DCoreActor* ownerActor;
void copyfrom(spritetype* spr)
{
pos = spr->pos;
cstat = spr->cstat;
picnum = spr->picnum;
shade = spr->shade;
pal = spr->pal;
clipdist = 0;
blend = spr->blend;
xrepeat = spr->xrepeat;
yrepeat = spr->yrepeat;
xoffset = spr->xoffset;
yoffset = spr->yoffset;
sectp = spr->sectp;
statnum = spr->statnum;
ang = spr->ang;
xvel = spr->xvel;
yvel = spr->yvel;
zvel = spr->zvel;
lotag = spr->lotag;
hitag = spr->hitag;
extra = spr->extra;
time = spr->time;
ownerActor = nullptr;
// need to copy the slope sprite flag around because for tsprites the bit combination means 'voxel'.
if ((cstat & CSTAT_SPRITE_ALIGNMENT_MASK) == CSTAT_SPRITE_ALIGNMENT_SLOPE)
{
cstat &= ~CSTAT_SPRITE_ALIGNMENT_WALL;
clipdist |= TSPR_SLOPESPRITE;
}
}
};
extern TArray<sectortype> sector;