Hopefully the last time this week I'll ever touch these files

This commit is contained in:
Jaime Passos 2019-11-06 20:41:55 -03:00
parent 7ad997543d
commit e78999549b
3 changed files with 10 additions and 8 deletions

View File

@ -1096,16 +1096,16 @@ void R_CacheRotSprite(spritenum_t sprnum, UINT8 frame, spriteinfo_t *sprinfo, sp
size_t size, size2; size_t size, size2;
INT32 bflip = ((flip != 0x00) ? -1 : 1); INT32 bflip = ((flip != 0x00) ? -1 : 1);
#define SPRITE_XCENTER (width / 2) #define SPRITE_XCENTER (patch->leftoffset)
#define SPRITE_YCENTER (height / 2) #define SPRITE_YCENTER (height / 2)
#define ROTSPRITE_XCENTER (newwidth / 2) #define ROTSPRITE_XCENTER (newwidth / 2)
#define ROTSPRITE_YCENTER (newheight / 2) #define ROTSPRITE_YCENTER (newheight / 2)
if (!sprframe->rotsprite.cached[rot]) if (!sprframe->rotsprite.cached[rot])
{ {
INT32 dx,dy; INT32 dx, dy;
INT32 px,py; INT32 px, py;
INT32 width,height; INT32 width, height;
fixed_t ca, sa; fixed_t ca, sa;
lumpnum_t lump = sprframe->lumppat[rot]; 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 = R_FlatToPatch_16bpp(rawdst, newwidth, newheight, &size);
newpatch->leftoffset = (newpatch->width / 2) - ((SPRITE_XCENTER - patch->leftoffset) * bflip); newpatch->leftoffset = (newpatch->width / 2) - ((SPRITE_XCENTER - patch->leftoffset) * bflip);
newpatch->topoffset = (newpatch->height / 2) - (SPRITE_YCENTER - patch->topoffset); newpatch->topoffset = (newpatch->height / 2) - (SPRITE_YCENTER - patch->topoffset);
newpatch->leftoffset += (SPRITE_XCENTER - px); newpatch->leftoffset += ((width / 2) - px);
newpatch->topoffset += (SPRITE_YCENTER - py); newpatch->topoffset += (SPRITE_YCENTER - py);
//BP: we cannot use special tric in hardware mode because feet in ground caused by z-buffer //BP: we cannot use special tric in hardware mode because feet in ground caused by z-buffer
if (rendermode != render_none) // not for psprite if (rendermode != render_none) // not for psprite
newpatch->topoffset += 4; newpatch->topoffset += FEETADJUST>>FRACBITS;
// P_PrecacheLevel // P_PrecacheLevel
if (devparm) spritememory += size; if (devparm) spritememory += size;

View File

@ -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 //BP: we cannot use special tric in hardware mode because feet in ground caused by z-buffer
if (rendermode != render_none) // not for psprite 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. // Being selective with this causes bad things. :( Like the special stage tokens breaking apart.
/*if (rendermode != render_none // not for psprite /*if (rendermode != render_none // not for psprite
&& SHORT(patch.topoffset)>0 && SHORT(patch.topoffset)<SHORT(patch.height)) && SHORT(patch.topoffset)>0 && SHORT(patch.topoffset)<SHORT(patch.height))
// perfect is patch.height but sometime it is too high // 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;*/
//---------------------------------------------------- //----------------------------------------------------

View File

@ -32,6 +32,8 @@
#define VISSPRITESPERCHUNK (1 << VISSPRITECHUNKBITS) #define VISSPRITESPERCHUNK (1 << VISSPRITECHUNKBITS)
#define VISSPRITEINDEXMASK (VISSPRITESPERCHUNK - 1) #define VISSPRITEINDEXMASK (VISSPRITESPERCHUNK - 1)
#define FEETADJUST (4<<FRACBITS) // R_AddSingleSpriteDef
// Constant arrays used for psprite clipping // Constant arrays used for psprite clipping
// and initializing clipping. // and initializing clipping.
extern INT16 negonearray[MAXVIDWIDTH]; extern INT16 negonearray[MAXVIDWIDTH];