- parts of draw.cpp.

This commit is contained in:
Christoph Oelckers 2021-12-24 21:44:57 +01:00
parent c61e4de409
commit 3b26c634db

View file

@ -532,34 +532,29 @@ void DoStarView(tspriteptr_t tsp, USERp tu, int viewz)
template<class sprt> template<class sprt>
DSWActor* CopySprite(sprt const* tsp, sectortype* newsector) DSWActor* CopySprite(sprt const* tsp, sectortype* newsector)
{ {
SPRITEp sp;
auto actorNew = insertActor(newsector, STAT_FAF_COPY); auto actorNew = insertActor(newsector, STAT_FAF_COPY);
sp = &actorNew->s();
sp->pos.X = tsp->pos.X; actorNew->spr.pos = tsp->pos;
sp->pos.Y = tsp->pos.Y; actorNew->spr.cstat = tsp->cstat;
sp->pos.Z = tsp->pos.Z; actorNew->spr.picnum = tsp->picnum;
sp->cstat = tsp->cstat; actorNew->spr.pal = tsp->pal;
sp->picnum = tsp->picnum; actorNew->spr.xrepeat = tsp->xrepeat;
sp->pal = tsp->pal; actorNew->spr.yrepeat = tsp->yrepeat;
sp->xrepeat = tsp->xrepeat; actorNew->spr.xoffset = tsp->xoffset;
sp->yrepeat = tsp->yrepeat; actorNew->spr.yoffset = tsp->yoffset;
sp->xoffset = tsp->xoffset; actorNew->spr.ang = tsp->ang;
sp->yoffset = tsp->yoffset; actorNew->spr.xvel = tsp->xvel;
sp->ang = tsp->ang; actorNew->spr.yvel = tsp->yvel;
sp->xvel = tsp->xvel; actorNew->spr.zvel = tsp->zvel;
sp->yvel = tsp->yvel; actorNew->spr.shade = tsp->shade;
sp->zvel = tsp->zvel;
sp->shade = tsp->shade;
RESET(sp->cstat, CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN); RESET(actorNew->spr.cstat, CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN);
return actorNew; return actorNew;
} }
template<class sprt> DSWActor* ConnectCopySprite(spritetypebase const* tsp)
DSWActor* ConnectCopySprite(sprt const* tsp)
{ {
sectortype* newsector; sectortype* newsector;
int testz; int testz;
@ -665,9 +660,8 @@ void analyzesprites(tspritetype* tsprite, int& spritesortcnt, int viewx, int vie
// workaround for mines and floor decals beneath the floor // workaround for mines and floor decals beneath the floor
if (tsp->picnum == BETTY_R0 || tsp->picnum == FLOORBLOOD1) if (tsp->picnum == BETTY_R0 || tsp->picnum == FLOORBLOOD1)
{ {
auto sp = &tActor->s(); int32_t const floorz = getflorzofslopeptr(tActor->spr.sector(), tActor->spr.pos.X, tActor->spr.pos.Y);
int32_t const floorz = getflorzofslopeptr(sp->sector(), sp->pos.X, sp->pos.Y); if (tActor->spr.pos.Z > floorz)
if (sp->pos.Z > floorz)
tsp->pos.Z = floorz; tsp->pos.Z = floorz;
} }
@ -973,7 +967,8 @@ void CircleCamera(int *nx, int *ny, int *nz, sectortype** vsect, binangle *nang,
vz = q16horiz >> 8; vz = q16horiz >> 8;
// Player sprite of current view // Player sprite of current view
sp = &pp->Actor()->s(); DSWActor* actor = pp->actor;
sp = &actor->s();
auto bakcstat = sp->cstat; auto bakcstat = sp->cstat;
RESET(sp->cstat, CSTAT_SPRITE_BLOCK|CSTAT_SPRITE_BLOCK_HITSCAN); RESET(sp->cstat, CSTAT_SPRITE_BLOCK|CSTAT_SPRITE_BLOCK_HITSCAN);
@ -1273,19 +1268,18 @@ void PreDrawStackedWater(void)
{ {
if (itActor2->hasU()) if (itActor2->hasU())
{ {
auto sp = &itActor2->s();
auto u = itActor2->u(); auto u = itActor2->u();
if (sp->statnum == STAT_ITEM) if (itActor2->spr.statnum == STAT_ITEM)
continue; continue;
if (sp->statnum <= STAT_DEFAULT || sp->statnum > STAT_PLAYER0 + MAX_SW_PLAYERS) if (itActor2->spr.statnum <= STAT_DEFAULT || itActor2->spr.statnum > STAT_PLAYER0 + MAX_SW_PLAYERS)
continue; continue;
// code so that a copied sprite will not make another copy // code so that a copied sprite will not make another copy
if (u->xchange == -989898) if (u->xchange == -989898)
continue; continue;
auto actorNew = ConnectCopySprite(sp); auto actorNew = ConnectCopySprite(&itActor2->spr);
if (actorNew != nullptr) if (actorNew != nullptr)
{ {
// spawn a user // spawn a user
@ -1347,8 +1341,7 @@ void UpdateWallPortalState()
DSWActor* cam = mirror[i].cameraActor; DSWActor* cam = mirror[i].cameraActor;
if (cam) if (cam)
{ {
auto sp = &cam->s(); if (!TEST_BOOL1(cam))
if (!TEST_BOOL1(sp))
{ {
wal->portalflags = PORTAL_WALL_TO_SPRITE; wal->portalflags = PORTAL_WALL_TO_SPRITE;
wal->portalnum = i; wal->portalnum = i;