From e78999549b1e18ce25de0b315a42ae514d1ffbbd Mon Sep 17 00:00:00 2001 From: Jaime Passos <lazymyuutsu@gmail.com> Date: Wed, 6 Nov 2019 20:41:55 -0300 Subject: [PATCH] Hopefully the last time this week I'll ever touch these files --- src/r_patch.c | 12 ++++++------ src/r_things.c | 4 ++-- src/r_things.h | 2 ++ 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/r_patch.c b/src/r_patch.c index 314c49f056..8545952f7e 100644 --- a/src/r_patch.c +++ b/src/r_patch.c @@ -1096,16 +1096,16 @@ void R_CacheRotSprite(spritenum_t sprnum, UINT8 frame, spriteinfo_t *sprinfo, sp size_t size, size2; INT32 bflip = ((flip != 0x00) ? -1 : 1); -#define SPRITE_XCENTER (width / 2) +#define SPRITE_XCENTER (patch->leftoffset) #define SPRITE_YCENTER (height / 2) #define ROTSPRITE_XCENTER (newwidth / 2) #define ROTSPRITE_YCENTER (newheight / 2) if (!sprframe->rotsprite.cached[rot]) { - INT32 dx,dy; - INT32 px,py; - INT32 width,height; + INT32 dx, dy; + INT32 px, py; + INT32 width, height; fixed_t ca, sa; lumpnum_t lump = sprframe->lumppat[rot]; @@ -1241,12 +1241,12 @@ void R_CacheRotSprite(spritenum_t sprnum, UINT8 frame, spriteinfo_t *sprinfo, sp newpatch = R_FlatToPatch_16bpp(rawdst, newwidth, newheight, &size); newpatch->leftoffset = (newpatch->width / 2) - ((SPRITE_XCENTER - patch->leftoffset) * bflip); newpatch->topoffset = (newpatch->height / 2) - (SPRITE_YCENTER - patch->topoffset); - newpatch->leftoffset += (SPRITE_XCENTER - px); + newpatch->leftoffset += ((width / 2) - px); newpatch->topoffset += (SPRITE_YCENTER - py); //BP: we cannot use special tric in hardware mode because feet in ground caused by z-buffer if (rendermode != render_none) // not for psprite - newpatch->topoffset += 4; + newpatch->topoffset += FEETADJUST>>FRACBITS; // P_PrecacheLevel if (devparm) spritememory += size; diff --git a/src/r_things.c b/src/r_things.c index 4a2f69480c..f9a42bf21f 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -343,12 +343,12 @@ static boolean R_AddSingleSpriteDef(const char *sprname, spritedef_t *spritedef, //BP: we cannot use special tric in hardware mode because feet in ground caused by z-buffer if (rendermode != render_none) // not for psprite - spritecachedinfo[numspritelumps].topoffset += 4<<FRACBITS; + spritecachedinfo[numspritelumps].topoffset += FEETADJUST; // Being selective with this causes bad things. :( Like the special stage tokens breaking apart. /*if (rendermode != render_none // not for psprite && SHORT(patch.topoffset)>0 && SHORT(patch.topoffset)<SHORT(patch.height)) // perfect is patch.height but sometime it is too high - spritecachedinfo[numspritelumps].topoffset = min(SHORT(patch.topoffset)+4,SHORT(patch.height))<<FRACBITS;*/ + spritecachedinfo[numspritelumps].topoffset = min(SHORT(patch.topoffset)+(FEETADJUST>>FRACBITS),SHORT(patch.height))<<FRACBITS;*/ //---------------------------------------------------- diff --git a/src/r_things.h b/src/r_things.h index 76a24c6383..b186a56b59 100644 --- a/src/r_things.h +++ b/src/r_things.h @@ -32,6 +32,8 @@ #define VISSPRITESPERCHUNK (1 << VISSPRITECHUNKBITS) #define VISSPRITEINDEXMASK (VISSPRITESPERCHUNK - 1) +#define FEETADJUST (4<<FRACBITS) // R_AddSingleSpriteDef + // Constant arrays used for psprite clipping // and initializing clipping. extern INT16 negonearray[MAXVIDWIDTH]; -- GitLab