From 717dd123e5323d8436fbfdc4a3b2d5057efa55fd Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 31 Dec 2021 10:55:55 +0100 Subject: [PATCH] - fixed slope sprite flag getting cleared by some leftover code. Also merged copyfrom into the one single function that called it. --- source/core/coreactor.h | 11 +--------- source/core/gamefuncs.cpp | 45 +++++++++++++++++++++++++++++++++++++++ source/core/maptypes.h | 35 ------------------------------ 3 files changed, 46 insertions(+), 45 deletions(-) diff --git a/source/core/coreactor.h b/source/core/coreactor.h index bc30643ca..217fdb14c 100644 --- a/source/core/coreactor.h +++ b/source/core/coreactor.h @@ -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); diff --git a/source/core/gamefuncs.cpp b/source/core/gamefuncs.cpp index 4d30bacdb..ed3bf57eb 100644 --- a/source/core/gamefuncs.cpp +++ b/source/core/gamefuncs.cpp @@ -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 diff --git a/source/core/maptypes.h b/source/core/maptypes.h index 3bd87961d..971b07618 100644 --- a/source/core/maptypes.h +++ b/source/core/maptypes.h @@ -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 sector;