Better handling of tsprites that are duplicated through TROR portals.

Specifically, now also consider the sprite tile's yoffset, and fix an
issue when a tsprite got duplicated 'toward' the viewer. Also add a
couple of tests in trueror1.map.

git-svn-id: https://svn.eduke32.com/eduke32@2004 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2011-09-04 19:44:51 +00:00
parent a3e83fbe0c
commit b3d3fd9a39
5 changed files with 11 additions and 30 deletions

View file

@ -659,7 +659,7 @@ int32_t changespritestat(int16_t spritenum, int16_t newstatnum);
int32_t setsprite(int16_t spritenum, const vec3_t *new) ATTRIBUTE((nonnull(2)));
int32_t setspritez(int16_t spritenum, const vec3_t *new) ATTRIBUTE((nonnull(2)));
void spriteheightofs(int16_t i, int32_t *height, int32_t *zofs);
void spriteheightofs(int16_t i, int32_t *height, int32_t *zofs, int32_t alsotileyofs);
int32_t screencapture(const char *filename, char inverseit, const char *versionstr) ATTRIBUTE((nonnull(1)));

View file

@ -828,7 +828,7 @@ void spriteoncfz(int32_t i, int32_t *czptr, int32_t *fzptr)
int32_t cz,fz, height, zofs;
getzsofslope(sprite[i].sectnum, sprite[i].x,sprite[i].y, &cz, &fz);
spriteheightofs(i, &height, &zofs);
spriteheightofs(i, &height, &zofs, 0);
if (czptr)
*czptr = cz + height - zofs;

View file

@ -665,7 +665,6 @@ static void yax_tweakpicnums(int32_t bunchnum, int32_t cf, int32_t restore)
static void yax_copytsprite(int32_t curbunchnum, int32_t resetsortcnt)
{
int16_t bunchnum;
int32_t i, spritenum, gotthrough, sectnum, cf;
int32_t sortcnt = yax_spritesortcnt[yax_globallev];
const spritetype *spr;
@ -691,9 +690,9 @@ static void yax_copytsprite(int32_t curbunchnum, int32_t resetsortcnt)
if (cf != -1)
{
bunchnum = yax_getbunch(sectnum, cf);
if (yax_globallev != YAX_MAXDRAWS && curbunchnum != bunchnum)
continue;
if ((yax_globallev-YAX_MAXDRAWS)*(-1 + 2*cf) > 0)
if (yax_getbunch(sectnum, cf) != curbunchnum)
continue;
sectnum = yax_getneighborsect(spr->x, spr->y, sectnum, cf, NULL);
if (sectnum < 0)
@ -2206,7 +2205,7 @@ int32_t engine_addtsprite(int16_t z, int16_t sectnum)
if (cb < 0 && fb < 0)
return 0;
spriteheightofs(z, &spheight, &spzofs);
spriteheightofs(z, &spheight, &spzofs, 1);
// TODO: get*zofslope?
if (cb>=0 && spr->z+spzofs-spheight < sector[sectnum].ceilingz)
@ -10370,7 +10369,7 @@ int32_t krecip(int32_t num)
return(krecipasm(num));
}
void spriteheightofs(int16_t i, int32_t *height, int32_t *zofs)
void spriteheightofs(int16_t i, int32_t *height, int32_t *zofs, int32_t alsotileyofs)
{
int32_t hei, flooraligned=((sprite[i].cstat&48)==32);
@ -10389,6 +10388,10 @@ void spriteheightofs(int16_t i, int32_t *height, int32_t *zofs)
{
if (sprite[i].cstat&128)
*zofs = hei>>1;
if (alsotileyofs && (unsigned)sprite[i].picnum < MAXTILES)
if (picanm[sprite[i].picnum]&0x00ff0000)
*zofs -= ((int8_t)((picanm[sprite[i].picnum]>>16)&255))*sprite[i].yrepeat<<2;
}
*height = hei;
}

Binary file not shown.

View file

@ -4294,28 +4294,6 @@ restart:
#undef TMPERRMSG_PRINT
#undef TMPERRMSG_RETURN
#if 0
static int32_t spriteonceilingz(int32_t i)
{
int32_t z = getceilzofslope(searchsector, sprite[i].x,sprite[i].y);
int32_t height, zofs;
spriteheightofs(i, &height, &ofs);
return z + height-ofs;
}
static int32_t spriteongroundz(int32_t i)
{
int32_t z = getflorzofslope(searchsector, sprite[i].x,sprite[i].y);
int32_t zofs;
spriteheightofs(i, NULL, &ofs);
return z - ofs;
}
#endif
#define WIND1X 3
#define WIND1Y 150