diff --git a/src/r_patch.c b/src/r_patch.c index 314c49f056e1f4a60fef62adc52d64a73c4cbf18..8545952f7e95f74213581c8be815d216b637d2d5 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 4a2f69480cc79603847fff066a940a23ce6073fa..f9a42bf21f1f8d2478c882dd34dc72a2eb06bfae 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 76a24c6383c78bc8c52bdce1f756a2c8c755db89..b186a56b598ea29f42f6976d839138e6f402cea8 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];