Mostly clean up the codebase in preparation for tspritetype != uspritetype

Remaining exceptions:
SW - ConnectCopySprite
CON and M32Script - pSprite/pUSprite

git-svn-id: https://svn.eduke32.com/eduke32@8519 1a8010ca-5511-0410-912e-c29ae57300e0

# Conflicts:
#	source/build/include/polymer.h
#	source/build/src/engine.cpp
#	source/build/src/engine_priv.h
#	source/build/src/polymer.cpp
#	source/build/src/polymost.cpp
#	source/duke3d/src/astub.cpp
#	source/duke3d/src/game.h
#	source/duke3d/src/m32common.cpp
#	source/duke3d/src/m32exec.cpp
#	source/duke3d/src/m32structures.cpp
#	source/kenbuild/src/bstub.cpp
#	source/kenbuild/src/game.cpp
#	source/sw/src/jnstub.cpp
#	source/sw/src/jsector.cpp
This commit is contained in:
hendricks266 2019-12-26 06:27:48 +00:00 committed by Christoph Oelckers
parent 3bbecf84c2
commit 8e6a54a1e4
10 changed files with 122 additions and 128 deletions

View file

@ -337,7 +337,7 @@ typedef struct {
uint8_t filler; uint8_t filler;
float alpha; float alpha;
// NOTE: keep 'tspr' on an 8-byte boundary: // NOTE: keep 'tspr' on an 8-byte boundary:
uspritetype *tspr; tspriteptr_t tspr;
#if !defined UINTPTR_MAX #if !defined UINTPTR_MAX
# error Need UINTPTR_MAX define to select between 32- and 64-bit structs # error Need UINTPTR_MAX define to select between 32- and 64-bit structs
#endif #endif

View file

@ -39,7 +39,7 @@ void polymost_prepareMirror(int32_t dax, int32_t day, int32_t daz, fix16_t daang
void polymost_completeMirror(); void polymost_completeMirror();
int32_t polymost_maskWallHasTranslucency(uwalltype const * const wall); int32_t polymost_maskWallHasTranslucency(uwalltype const * const wall);
int32_t polymost_spriteHasTranslucency(uspritetype const * const tspr); int32_t polymost_spriteHasTranslucency(tspritetype const * const tspr);
float* multiplyMatrix4f(float m0[4*4], const float m1[4*4]); float* multiplyMatrix4f(float m0[4*4], const float m1[4*4]);

View file

@ -823,7 +823,7 @@ static void yax_copytsprites()
if (spritesortcnt >= maxspritesonscreen) if (spritesortcnt >= maxspritesonscreen)
break; break;
Bmemcpy(&tsprite[spritesortcnt], spr, sizeof(spritetype)); Bmemcpy(&tsprite[spritesortcnt], spr, sizeof(tspritetype));
tsprite[spritesortcnt].owner = spritenum; tsprite[spritesortcnt].owner = spritenum;
tsprite[spritesortcnt].extra = 0; tsprite[spritesortcnt].extra = 0;
tsprite[spritesortcnt].sectnum = sectnum; // potentially tweak sectnum! tsprite[spritesortcnt].sectnum = sectnum; // potentially tweak sectnum!
@ -1478,7 +1478,7 @@ int32_t renderAddTsprite(int16_t z, int16_t sectnum)
if (spritesortcnt >= maxspritesonscreen) if (spritesortcnt >= maxspritesonscreen)
return 1; return 1;
Bmemcpy(&tsprite[spritesortcnt], spr, sizeof(spritetype)); Bmemcpy(&tsprite[spritesortcnt], spr, sizeof(tspritetype));
tsprite[spritesortcnt].extra = 0; tsprite[spritesortcnt].extra = 0;
tsprite[spritesortcnt++].owner = z; tsprite[spritesortcnt++].owner = z;
@ -2051,7 +2051,7 @@ int32_t wallfront(int32_t l1, int32_t l2)
// //
// spritewallfront (internal) // spritewallfront (internal)
// //
static inline int32_t spritewallfront(uspriteptr_t s, int32_t w) static inline int32_t spritewallfront(tspritetype const * const s, int32_t w)
{ {
auto const wal = (uwallptr_t)&wall[w]; auto const wal = (uwallptr_t)&wall[w];
auto const wal2 = (uwallptr_t)&wall[wal->point2]; auto const wal2 = (uwallptr_t)&wall[wal->point2];
@ -8863,7 +8863,7 @@ killsprite:
if ((tspr->cstat & 48) != 16) if ((tspr->cstat & 48) != 16)
tspriteptr[i]->ang = globalang; tspriteptr[i]->ang = globalang;
get_wallspr_points((uspriteptr_t)tspr, &xx[0], &xx[1], &yy[0], &yy[1]); get_wallspr_points(tspr, &xx[0], &xx[1], &yy[0], &yy[1]);
if (!playing_blood? ((tspr->cstat & 48) == 0) : ((tspr->cstat & 48) != 16)) if (!playing_blood? ((tspr->cstat & 48) == 0) : ((tspr->cstat & 48) != 16))
tspriteptr[i]->ang = oang; tspriteptr[i]->ang = oang;
@ -10604,70 +10604,6 @@ add_nextsector:
return 0; return 0;
} }
// x1, y1: in/out
// rest x/y: out
void get_wallspr_points(uspriteptr_t const spr, int32_t *x1, int32_t *x2,
int32_t *y1, int32_t *y2)
{
//These lines get the 2 points of the rotated sprite
//Given: (x1, y1) starts out as the center point
const int32_t tilenum=spr->picnum, ang=spr->ang;
const int32_t xrepeat = spr->xrepeat;
int32_t xoff = picanm[tilenum].xofs + spr->xoffset;
int32_t k, l, dax, day;
if (spr->cstat&4)
xoff = -xoff;
dax = sintable[ang&2047]*xrepeat;
day = sintable[(ang+1536)&2047]*xrepeat;
l = tilesiz[tilenum].x;
k = (l>>1)+xoff;
*x1 -= mulscale16(dax,k);
*x2 = *x1 + mulscale16(dax,l);
*y1 -= mulscale16(day,k);
*y2 = *y1 + mulscale16(day,l);
}
// x1, y1: in/out
// rest x/y: out
void get_floorspr_points(uspriteptr_t const spr, int32_t px, int32_t py,
int32_t *x1, int32_t *x2, int32_t *x3, int32_t *x4,
int32_t *y1, int32_t *y2, int32_t *y3, int32_t *y4)
{
const int32_t tilenum = spr->picnum;
const int32_t cosang = sintable[(spr->ang+512)&2047];
const int32_t sinang = sintable[spr->ang&2047];
vec2_t const span = { tilesiz[tilenum].x, tilesiz[tilenum].y};
vec2_t const repeat = { spr->xrepeat, spr->yrepeat };
vec2_t adjofs = { picanm[tilenum].xofs + spr->xoffset, picanm[tilenum].yofs + spr->yoffset };
if (spr->cstat & 4)
adjofs.x = -adjofs.x;
if (spr->cstat & 8)
adjofs.y = -adjofs.y;
vec2_t const center = { ((span.x >> 1) + adjofs.x) * repeat.x, ((span.y >> 1) + adjofs.y) * repeat.y };
vec2_t const rspan = { span.x * repeat.x, span.y * repeat.y };
vec2_t const ofs = { -mulscale16(cosang, rspan.y), -mulscale16(sinang, rspan.y) };
*x1 += dmulscale16(sinang, center.x, cosang, center.y) - px;
*y1 += dmulscale16(sinang, center.y, -cosang, center.x) - py;
*x2 = *x1 - mulscale16(sinang, rspan.x);
*y2 = *y1 + mulscale16(cosang, rspan.x);
*x3 = *x2 + ofs.x, *x4 = *x1 + ofs.x;
*y3 = *y2 + ofs.y, *y4 = *y1 + ofs.y;
}
// //
// neartag // neartag
// //

View file

@ -132,12 +132,6 @@ extern int16_t bunchp2[MAXWALLSB];
extern int16_t numscans, numbunches; extern int16_t numscans, numbunches;
extern int32_t rxi[8], ryi[8]; extern int32_t rxi[8], ryi[8];
extern void get_wallspr_points(uspriteptr_t spr, int32_t *x1, int32_t *x2,
int32_t *y1, int32_t *y2);
extern void get_floorspr_points(uspriteptr_t spr, int32_t px, int32_t py,
int32_t *x1, int32_t *x2, int32_t *x3, int32_t *x4,
int32_t *y1, int32_t *y2, int32_t *y3, int32_t *y4);
// int32_t wallmost(int16_t *mostbuf, int32_t w, int32_t sectnum, char dastat); // int32_t wallmost(int16_t *mostbuf, int32_t w, int32_t sectnum, char dastat);
int32_t wallfront(int32_t l1, int32_t l2); int32_t wallfront(int32_t l1, int32_t l2);
@ -239,4 +233,70 @@ template <typename T> static FORCE_INLINE void tileUpdatePicnum(T * const tilept
tile = RotTile(tile).newtile; tile = RotTile(tile).newtile;
} }
// x1, y1: in/out
// rest x/y: out
template <typename T>
static inline void get_wallspr_points(T const * const spr, int32_t *x1, int32_t *x2,
int32_t *y1, int32_t *y2)
{
//These lines get the 2 points of the rotated sprite
//Given: (x1, y1) starts out as the center point
const int32_t tilenum=spr->picnum, ang=spr->ang;
const int32_t xrepeat = spr->xrepeat;
int32_t xoff = picanm[tilenum].xofs + spr->xoffset;
int32_t k, l, dax, day;
if (spr->cstat&4)
xoff = -xoff;
dax = sintable[ang&2047]*xrepeat;
day = sintable[(ang+1536)&2047]*xrepeat;
l = tilesiz[tilenum].x;
k = (l>>1)+xoff;
*x1 -= mulscale16(dax,k);
*x2 = *x1 + mulscale16(dax,l);
*y1 -= mulscale16(day,k);
*y2 = *y1 + mulscale16(day,l);
}
// x1, y1: in/out
// rest x/y: out
template <typename T>
static inline void get_floorspr_points(T const * const spr, int32_t px, int32_t py,
int32_t *x1, int32_t *x2, int32_t *x3, int32_t *x4,
int32_t *y1, int32_t *y2, int32_t *y3, int32_t *y4)
{
const int32_t tilenum = spr->picnum;
const int32_t cosang = sintable[(spr->ang+512)&2047];
const int32_t sinang = sintable[spr->ang&2047];
vec2_t const span = { tilesiz[tilenum].x, tilesiz[tilenum].y};
vec2_t const repeat = { spr->xrepeat, spr->yrepeat };
vec2_t adjofs = { picanm[tilenum].xofs + spr->xoffset, picanm[tilenum].yofs + spr->yoffset };
if (spr->cstat & 4)
adjofs.x = -adjofs.x;
if (spr->cstat & 8)
adjofs.y = -adjofs.y;
vec2_t const center = { ((span.x >> 1) + adjofs.x) * repeat.x, ((span.y >> 1) + adjofs.y) * repeat.y };
vec2_t const rspan = { span.x * repeat.x, span.y * repeat.y };
vec2_t const ofs = { -mulscale16(cosang, rspan.y), -mulscale16(sinang, rspan.y) };
*x1 += dmulscale16(sinang, center.x, cosang, center.y) - px;
*y1 += dmulscale16(sinang, center.y, -cosang, center.x) - py;
*x2 = *x1 - mulscale16(sinang, rspan.x);
*y2 = *y1 + mulscale16(cosang, rspan.x);
*x3 = *x2 + ofs.x, *x4 = *x1 + ofs.x;
*y3 = *y2 + ofs.y, *y4 = *y1 + ofs.y;
}
#endif /* ENGINE_PRIV_H */ #endif /* ENGINE_PRIV_H */

View file

@ -416,7 +416,7 @@ int32_t polymost_maskWallHasTranslucency(uwalltype const * const wall)
return tex && tex->GetTranslucency(); return tex && tex->GetTranslucency();
} }
int32_t polymost_spriteHasTranslucency(uspritetype const * const tspr) int32_t polymost_spriteHasTranslucency(tspritetype const * const tspr)
{ {
if ((tspr->cstat & (CSTAT_SPRITE_TRANSLUCENT | CSTAT_SPRITE_RESERVED1)) || if ((tspr->cstat & (CSTAT_SPRITE_TRANSLUCENT | CSTAT_SPRITE_RESERVED1)) ||
((unsigned)tspr->owner < MAXSPRITES && spriteext[tspr->owner].alpha)) ((unsigned)tspr->owner < MAXSPRITES && spriteext[tspr->owner].alpha))
@ -3849,7 +3849,7 @@ void Polymost_prepare_loadboard(void)
Bmemset(wsprinfo, 0, sizeof(wsprinfo)); Bmemset(wsprinfo, 0, sizeof(wsprinfo));
} }
static inline int32_t polymost_findwall(uspriteptr_t const tspr, vec2_t const * const tsiz, int32_t * rd) static inline int32_t polymost_findwall(tspritetype const * const tspr, vec2_t const * const tsiz, int32_t * rd)
{ {
int32_t dist = 4, closest = -1; int32_t dist = 4, closest = -1;
auto const sect = (usectortype * )&sector[tspr->sectnum]; auto const sect = (usectortype * )&sector[tspr->sectnum];
@ -4573,8 +4573,7 @@ void polymost_dorotatespritemodel(int32_t sx, int32_t sy, int32_t z, int16_t a,
vec3f_t vec1; vec3f_t vec1;
uspritetype tspr; tspritetype tspr{};
Bmemset(&tspr, 0, sizeof(spritetype));
hudtyp const * const hud = tile2model[tilenum].hudmem[(dastat&4)>>2]; hudtyp const * const hud = tile2model[tilenum].hudmem[(dastat&4)>>2];

View file

@ -360,7 +360,7 @@ static void G_OROR_DupeSprites(spritetype const *sp)
if (sprite[k].picnum != SECTOREFFECTOR && sprite[k].z >= sp->z) if (sprite[k].picnum != SECTOREFFECTOR && sprite[k].z >= sp->z)
{ {
Bmemcpy(&tsprite[spritesortcnt], &sprite[k], sizeof(spritetype)); Bmemcpy(&tsprite[spritesortcnt], &sprite[k], sizeof(tspritetype));
tsprite[spritesortcnt].x += (refsp->x - sp->x); tsprite[spritesortcnt].x += (refsp->x - sp->x);
tsprite[spritesortcnt].y += (refsp->y - sp->y); tsprite[spritesortcnt].y += (refsp->y - sp->y);
@ -3621,6 +3621,7 @@ void G_DoSpriteAnimations(int32_t ourx, int32_t oury, int32_t ourz, int32_t oura
const int32_t i = t->owner; const int32_t i = t->owner;
// XXX: what's up with the (i < 0) check? // XXX: what's up with the (i < 0) check?
// NOTE: not const spritetype because set at SET_SPRITE_NOT_TSPRITE (see below). // NOTE: not const spritetype because set at SET_SPRITE_NOT_TSPRITE (see below).
EDUKE32_STATIC_ASSERT(sizeof(uspritetype) == sizeof(tspritetype)); // see TSPRITE_SIZE
auto const pSprite = (i < 0) ? (uspriteptr_t)&tsprite[j] : (uspriteptr_t)&sprite[i]; auto const pSprite = (i < 0) ? (uspriteptr_t)&tsprite[j] : (uspriteptr_t)&sprite[i];
#ifndef EDUKE32_STANDALONE #ifndef EDUKE32_STANDALONE
@ -3762,7 +3763,7 @@ void G_DoSpriteAnimations(int32_t ourx, int32_t oury, int32_t ourz, int32_t oura
{ {
auto const newt = &tsprite[spritesortcnt++]; auto const newt = &tsprite[spritesortcnt++];
Bmemcpy(newt, t, sizeof(spritetype)); *newt = *t;
newt->cstat |= 2|512; newt->cstat |= 2|512;
newt->x += (sintable[(newt->ang+512)&2047]>>12); newt->x += (sintable[(newt->ang+512)&2047]>>12);

View file

@ -462,23 +462,6 @@ static inline int G_GetMusicIdx(const char *str)
return (ep * MAXLEVELS) + lev; return (ep * MAXLEVELS) + lev;
} }
static inline int G_GetViewscreenSizeShift(uspriteptr_t const spr)
{
#if VIEWSCREENFACTOR == 0
UNREFERENCED_PARAMETER(spr);
return VIEWSCREENFACTOR;
#else
static const int mask = (1<<VIEWSCREENFACTOR)-1;
const int rem = (spr->xrepeat & mask) | (spr->yrepeat & mask);
for (int i=0; i < VIEWSCREENFACTOR; i++)
if (rem & (1<<i))
return i;
return VIEWSCREENFACTOR;
#endif
}
EXTERN_INLINE_HEADER void G_SetStatusBarScale(int32_t sc); EXTERN_INLINE_HEADER void G_SetStatusBarScale(int32_t sc);
@ -489,6 +472,24 @@ EXTERN_INLINE_HEADER void SetIfGreater(int32_t *variable, int32_t potentialValue
#ifndef ONLY_USERDEFS #ifndef ONLY_USERDEFS
template <typename T>
static inline int G_GetViewscreenSizeShift(T const * spr)
{
#if VIEWSCREENFACTOR == 0
UNREFERENCED_PARAMETER(spr);
return VIEWSCREENFACTOR;
#else
static CONSTEXPR int const mask = (1<<VIEWSCREENFACTOR)-1;
const int rem = (spr->xrepeat & mask) | (spr->yrepeat & mask);
for (int i=0; i < VIEWSCREENFACTOR; i++)
if (rem & (1<<i))
return i;
return VIEWSCREENFACTOR;
#endif
}
#if defined game_c_ || !defined DISABLE_INLINING #if defined game_c_ || !defined DISABLE_INLINING
EXTERN_INLINE void G_SetStatusBarScale(int32_t sc) EXTERN_INLINE void G_SetStatusBarScale(int32_t sc)

View file

@ -81,7 +81,7 @@ void DrawCompass(PLAYERp pp);
#if 1 #if 1
void void
ShadeSprite(uspritetype * tsp) ShadeSprite(tspriteptr_t tsp)
{ {
// set shade of sprite // set shade of sprite
tsp->shade = sector[tsp->sectnum].floorshade - 25; tsp->shade = sector[tsp->sectnum].floorshade - 25;
@ -104,7 +104,7 @@ GetRotation(short tSpriteNum, int viewx, int viewy)
short rotation; short rotation;
extern short screenpeek; extern short screenpeek;
uspritetype * tsp = &tsprite[tSpriteNum]; tspriteptr_t tsp = &tsprite[tSpriteNum];
USERp tu = User[tsp->owner]; USERp tu = User[tsp->owner];
PLAYERp pp = Player + screenpeek; PLAYERp pp = Player + screenpeek;
short angle2; short angle2;
@ -172,7 +172,7 @@ directions was not standardized.
int int
SetActorRotation(short tSpriteNum, int viewx, int viewy) SetActorRotation(short tSpriteNum, int viewx, int viewy)
{ {
uspritetype * tsp = &tsprite[tSpriteNum]; tspriteptr_t tsp = &tsprite[tSpriteNum];
USERp tu = User[tsp->owner]; USERp tu = User[tsp->owner];
short StateOffset, Rotation; short StateOffset, Rotation;
@ -233,7 +233,7 @@ SetActorRotation(short tSpriteNum, int viewx, int viewy)
} }
int int
DoShadowFindGroundPoint(uspritetype * sp) DoShadowFindGroundPoint(tspriteptr_t sp)
{ {
// USES TSPRITE !!!!! // USES TSPRITE !!!!!
USERp u = User[sp->owner]; USERp u = User[sp->owner];
@ -369,9 +369,9 @@ DoVoxelShadow(SPRITEp tspr)
#endif #endif
void void
DoShadows(uspritetype * tsp, int viewz) DoShadows(tspriteptr_t tsp, int viewz)
{ {
uspritetype * New = &tsprite[spritesortcnt]; tspriteptr_t New = &tsprite[spritesortcnt];
USERp tu = User[tsp->owner]; USERp tu = User[tsp->owner];
int ground_dist = 0; int ground_dist = 0;
int view_dist = 0; int view_dist = 0;
@ -396,7 +396,7 @@ DoShadows(uspritetype * tsp, int viewz)
} }
tsp->sectnum = sectnum; tsp->sectnum = sectnum;
memcpy(New, tsp, sizeof(SPRITE)); *New = *tsp;
// shadow is ALWAYS draw last - status is priority // shadow is ALWAYS draw last - status is priority
New->statnum = MAXSTATUS; New->statnum = MAXSTATUS;
New->sectnum = sectnum; New->sectnum = sectnum;
@ -464,9 +464,8 @@ DoShadows(uspritetype * tsp, int viewz)
} }
void void
DoMotionBlur(uspritetype const * tsp) DoMotionBlur(tspritetype const * const tsp)
{ {
uspritetype * New;
USERp tu = User[tsp->owner]; USERp tu = User[tsp->owner];
int nx,ny,nz = 0,dx,dy,dz; int nx,ny,nz = 0,dx,dy,dz;
short i, ang; short i, ang;
@ -537,8 +536,8 @@ DoMotionBlur(uspritetype const * tsp)
for (i = 0; i < tu->motion_blur_num; i++) for (i = 0; i < tu->motion_blur_num; i++)
{ {
New = &tsprite[spritesortcnt]; tspriteptr_t New = &tsprite[spritesortcnt];
memcpy(New, tsp, sizeof(SPRITE)); *New = *tsp;
SET(New->cstat, CSTAT_SPRITE_TRANSLUCENT|CSTAT_SPRITE_TRANSLUCENT_INVERT); SET(New->cstat, CSTAT_SPRITE_TRANSLUCENT|CSTAT_SPRITE_TRANSLUCENT_INVERT);
New->x += dx; New->x += dx;
@ -569,7 +568,6 @@ void SetVoxelSprite(SPRITEp sp, short pic)
void WarpCopySprite(void) void WarpCopySprite(void)
{ {
SPRITEp sp1, sp2, sp; SPRITEp sp1, sp2, sp;
uspritetype * New;
short sn, nsn; short sn, nsn;
short sn2, nsn2; short sn2, nsn2;
short spnum, next_spnum; short spnum, next_spnum;
@ -602,8 +600,8 @@ void WarpCopySprite(void)
if (sprite[spnum].picnum == ST1) if (sprite[spnum].picnum == ST1)
continue; continue;
New = &tsprite[spritesortcnt]; tspriteptr_t New = &tsprite[spritesortcnt];
memcpy(New, &sprite[spnum], sizeof(SPRITE)); memcpy(New, &sprite[spnum], sizeof(tspritetype));
spritesortcnt++; spritesortcnt++;
New->owner = spnum; New->owner = spnum;
New->statnum = 0; New->statnum = 0;
@ -626,8 +624,8 @@ void WarpCopySprite(void)
if (sprite[spnum].picnum == ST1) if (sprite[spnum].picnum == ST1)
continue; continue;
New = &tsprite[spritesortcnt]; tspriteptr_t New = &tsprite[spritesortcnt];
memcpy(New, &sprite[spnum], sizeof(SPRITE)); memcpy(New, &sprite[spnum], sizeof(tspritetype));
spritesortcnt++; spritesortcnt++;
New->owner = spnum; New->owner = spnum;
New->statnum = 0; New->statnum = 0;
@ -646,7 +644,7 @@ void WarpCopySprite(void)
} }
} }
void DoStarView(uspritetype * tsp, USERp tu, int viewz) void DoStarView(tspriteptr_t tsp, USERp tu, int viewz)
{ {
extern STATE s_Star[], s_StarDown[]; extern STATE s_Star[], s_StarDown[];
extern STATE s_StarStuck[], s_StarDownStuck[]; extern STATE s_StarStuck[], s_StarDownStuck[];
@ -675,7 +673,6 @@ analyzesprites(int viewx, int viewy, int viewz, SWBOOL mirror)
int tSpriteNum, j, k; int tSpriteNum, j, k;
short SpriteNum, pnum; short SpriteNum, pnum;
int smr4, smr2; int smr4, smr2;
uspritetype * tsp;
USERp tu; USERp tu;
static int ang = 0; static int ang = 0;
PLAYERp pp = Player + screenpeek; PLAYERp pp = Player + screenpeek;
@ -690,7 +687,7 @@ analyzesprites(int viewx, int viewy, int viewz, SWBOOL mirror)
for (tSpriteNum = spritesortcnt - 1; tSpriteNum >= 0; tSpriteNum--) for (tSpriteNum = spritesortcnt - 1; tSpriteNum >= 0; tSpriteNum--)
{ {
SpriteNum = tsprite[tSpriteNum].owner; SpriteNum = tsprite[tSpriteNum].owner;
tsp = &tsprite[tSpriteNum]; tspriteptr_t tsp = &tsprite[tSpriteNum];
tu = User[SpriteNum]; tu = User[SpriteNum];
//if(tsp->statnum == STAT_GENERIC_QUEUE) //if(tsp->statnum == STAT_GENERIC_QUEUE)
@ -901,7 +898,8 @@ analyzesprites(int viewx, int viewy, int viewz, SWBOOL mirror)
if (OverlapDraw && FAF_ConnectArea(tsp->sectnum) && tsp->owner >= 0) if (OverlapDraw && FAF_ConnectArea(tsp->sectnum) && tsp->owner >= 0)
{ {
ConnectCopySprite(tsp); EDUKE32_STATIC_ASSERT(sizeof(uspritetype) == sizeof(tspritetype)); // see TSPRITE_SIZE
ConnectCopySprite((uspriteptr_t)tsp);
} }
// //
@ -977,8 +975,7 @@ analyzesprites(int viewx, int viewy, int viewz, SWBOOL mirror)
} }
#if 1 #if 1
uspritetype * tspriteptr_t get_tsprite(short SpriteNum)
get_tsprite(short SpriteNum)
{ {
int tSpriteNum; int tSpriteNum;
@ -996,14 +993,13 @@ post_analyzesprites(void)
{ {
int tSpriteNum; int tSpriteNum;
short SpriteNum; short SpriteNum;
uspritetype * tsp;
USERp tu; USERp tu;
for (tSpriteNum = spritesortcnt - 1; tSpriteNum >= 0; tSpriteNum--) for (tSpriteNum = spritesortcnt - 1; tSpriteNum >= 0; tSpriteNum--)
{ {
SpriteNum = tsprite[tSpriteNum].owner; SpriteNum = tsprite[tSpriteNum].owner;
if (SpriteNum < 0) continue; // JBF: verify this is safe if (SpriteNum < 0) continue; // JBF: verify this is safe
tsp = &tsprite[tSpriteNum]; tspriteptr_t tsp = &tsprite[tSpriteNum];
tu = User[SpriteNum]; tu = User[SpriteNum];
if (tu) if (tu)
@ -1011,7 +1007,7 @@ post_analyzesprites(void)
if (tu->ID == FIREBALL_FLAMES && tu->Attach >= 0) if (tu->ID == FIREBALL_FLAMES && tu->Attach >= 0)
{ {
//uspritetype * const atsp = &sprite[tu->Attach]; //uspritetype * const atsp = &sprite[tu->Attach];
uspritetype * const atsp = get_tsprite(tu->Attach); tspriteptr_t const atsp = get_tsprite(tu->Attach);
if (!atsp) if (!atsp)
{ {
@ -1496,7 +1492,7 @@ void SpriteSortList2D(int tx, int ty)
if (dist < 22000) if (dist < 22000)
{ {
memcpy(&tsprite[spritesortcnt], sp, sizeof(SPRITE)); memcpy(&tsprite[spritesortcnt], sp, sizeof(tspritetype));
tsprite[spritesortcnt++].owner = i; tsprite[spritesortcnt++].owner = i;
} }
} }

View file

@ -806,7 +806,7 @@ JS_DrawMirrors(PLAYERp pp, int tx, int ty, int tz, short tpang, int tphoriz)
} }
void void
DoAutoSize(uspritetype * tspr) DoAutoSize(tspriteptr_t tspr)
{ {
short i; short i;
@ -957,7 +957,8 @@ DoAutoSize(uspritetype * tspr)
// Rotation angles for sprites // Rotation angles for sprites
short rotang = 0; short rotang = 0;
void JAnalyzeSprites(uspritetype * tspr) void
JAnalyzeSprites(tspriteptr_t tspr)
{ {
int i, currsprite; int i, currsprite;

View file

@ -70,7 +70,7 @@ extern short floormirrorsector[MAXMIRRORS];
extern SWBOOL mirrorinview; extern SWBOOL mirrorinview;
extern short NormalVisibility; extern short NormalVisibility;
void JAnalyzeSprites(uspritetype * tspr); void JAnalyzeSprites(tspriteptr_t tspr);
void JS_DrawMirrors(PLAYERp pp,int tx,int ty,int tz,short tpang,int tphoriz); void JS_DrawMirrors(PLAYERp pp,int tx,int ty,int tz,short tpang,int tphoriz);
void JS_InitMirrors(void); void JS_InitMirrors(void);
void JS_InitLockouts(void); void JS_InitLockouts(void);