tsectortype -> usectortype

twalltype -> uwalltype
tspritetype -> uspritetype

No other changes.

git-svn-id: https://svn.eduke32.com/eduke32@5796 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2016-06-21 00:33:58 +00:00
parent 0562de125f
commit 5800cd588c
32 changed files with 327 additions and 327 deletions

View file

@ -503,9 +503,9 @@ static inline void inplace_vx_tweak_wall(walltypevx *vxwal, int32_t yaxp)
typedef sectortypevx sectortype; typedef sectortypevx sectortype;
typedef walltypevx walltype; typedef walltypevx walltype;
typedef sectortype tsectortype; typedef sectortype usectortype;
typedef walltype twalltype; typedef walltype uwalltype;
typedef spritetype tspritetype; typedef spritetype uspritetype;
//////////////////// END Lunatic new-generation map format //////////////// //////////////////// END Lunatic new-generation map format ////////////////
#else #else
typedef sectortypev7 sectortype; typedef sectortypev7 sectortype;
@ -522,7 +522,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:
tspritetype *tspr; uspritetype *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
@ -570,7 +570,7 @@ EXTERN spritesmooth_t *spritesmooth;
EXTERN sectortype *sector; EXTERN sectortype *sector;
EXTERN walltype *wall; EXTERN walltype *wall;
EXTERN spritetype *sprite; EXTERN spritetype *sprite;
EXTERN tspritetype *tsprite; EXTERN uspritetype *tsprite;
#else #else
EXTERN spriteext_t spriteext[MAXSPRITES+MAXUNIQHUDID]; EXTERN spriteext_t spriteext[MAXSPRITES+MAXUNIQHUDID];
EXTERN spritesmooth_t spritesmooth[MAXSPRITES+MAXUNIQHUDID]; EXTERN spritesmooth_t spritesmooth[MAXSPRITES+MAXUNIQHUDID];
@ -578,7 +578,7 @@ EXTERN spritesmooth_t spritesmooth[MAXSPRITES+MAXUNIQHUDID];
EXTERN sectortype sector[MAXSECTORS + M32_FIXME_SECTORS]; EXTERN sectortype sector[MAXSECTORS + M32_FIXME_SECTORS];
EXTERN walltype wall[MAXWALLS + M32_FIXME_WALLS]; EXTERN walltype wall[MAXWALLS + M32_FIXME_WALLS];
EXTERN spritetype sprite[MAXSPRITES]; EXTERN spritetype sprite[MAXSPRITES];
EXTERN tspritetype tsprite[MAXSPRITESONSCREEN]; EXTERN uspritetype tsprite[MAXSPRITESONSCREEN];
#endif #endif
EXTERN uint32_t sectorchanged[MAXSECTORS + M32_FIXME_SECTORS]; EXTERN uint32_t sectorchanged[MAXSECTORS + M32_FIXME_SECTORS];
@ -644,7 +644,7 @@ FORCE_INLINE void sprite_tracker_hook(uintptr_t address)
EXTERN int16_t maskwall[MAXWALLSB], maskwallcnt; EXTERN int16_t maskwall[MAXWALLSB], maskwallcnt;
EXTERN int16_t thewall[MAXWALLSB]; EXTERN int16_t thewall[MAXWALLSB];
EXTERN tspritetype *tspriteptr[MAXSPRITESONSCREEN + 1]; EXTERN uspritetype *tspriteptr[MAXSPRITESONSCREEN + 1];
EXTERN int32_t wx1, wy1, wx2, wy2; EXTERN int32_t wx1, wy1, wx2, wy2;
EXTERN int32_t xdim, ydim, numpages; EXTERN int32_t xdim, ydim, numpages;
@ -1178,7 +1178,7 @@ FORCE_INLINE void getzsofslope(int16_t sectnum, int32_t dax, int32_t day, int32_
// Is <wal> a red wall in a safe fashion, i.e. only if consistency invariant // Is <wal> a red wall in a safe fashion, i.e. only if consistency invariant
// ".nextsector >= 0 iff .nextwall >= 0" holds. // ".nextsector >= 0 iff .nextwall >= 0" holds.
FORCE_INLINE int32_t redwallp(const twalltype *wal) FORCE_INLINE int32_t redwallp(const uwalltype *wal)
{ {
return (wal->nextwall >= 0 && wal->nextsector >= 0); return (wal->nextwall >= 0 && wal->nextsector >= 0);
} }

View file

@ -9,9 +9,9 @@
#define StructTracker(tracker, type) type #define StructTracker(tracker, type) type
#define WALLTYPE twalltype #define WALLTYPE uwalltype
#define SECTORTYPE tsectortype #define SECTORTYPE usectortype
#define SPRITETYPE tspritetype #define SPRITETYPE uspritetype
#else #else

View file

@ -45,8 +45,8 @@ extern clipinfo_t clipinfo[CM_MAX];
typedef struct typedef struct
{ {
int16_t numsectors, numwalls; int16_t numsectors, numwalls;
tsectortype *sector; usectortype *sector;
twalltype *wall; uwalltype *wall;
} mapinfo_t; } mapinfo_t;
extern mapinfo_t origmapinfo, clipmapinfo; extern mapinfo_t origmapinfo, clipmapinfo;

View file

@ -204,13 +204,13 @@ typedef struct
EXTERN mdmodel_t **models; EXTERN mdmodel_t **models;
void updateanimation(md2model_t *m, const tspritetype *tspr, uint8_t lpal); void updateanimation(md2model_t *m, const uspritetype *tspr, uint8_t lpal);
int32_t mdloadskin(md2model_t *m, int32_t number, int32_t pal, int32_t surf); int32_t mdloadskin(md2model_t *m, int32_t number, int32_t pal, int32_t surf);
void mdinit(void); void mdinit(void);
void freeallmodels(void); void freeallmodels(void);
void clearskins(int32_t type); void clearskins(int32_t type);
int32_t polymost_mddraw(const tspritetype *tspr); int32_t polymost_mddraw(const uspritetype *tspr);
EXTERN void md3_vox_calcmat_common(const tspritetype *tspr, const vec3f_t *a0, float f, float mat[16]); EXTERN void md3_vox_calcmat_common(const uspritetype *tspr, const vec3f_t *a0, float f, float mat[16]);
EXTERN int32_t mdpause; EXTERN int32_t mdpause;
EXTERN int32_t nextmodelid; EXTERN int32_t nextmodelid;
@ -218,7 +218,7 @@ EXTERN voxmodel_t *voxmodels[MAXVOXELS];
void voxfree(voxmodel_t *m); void voxfree(voxmodel_t *m);
voxmodel_t *voxload(const char *filnam); voxmodel_t *voxload(const char *filnam);
int32_t polymost_voxdraw(voxmodel_t *m, const tspritetype *tspr); int32_t polymost_voxdraw(voxmodel_t *m, const uspritetype *tspr);
int md3postload_polymer(md3model_t* m); int md3postload_polymer(md3model_t* m);
//int32_t md_thinoutmodel(int32_t modelid, uint8_t *usedframebitmap); //int32_t md_thinoutmodel(int32_t modelid, uint8_t *usedframebitmap);

View file

@ -421,7 +421,7 @@ static inline void polymer_normalize(float* vec);
static inline void polymer_pokesector(int16_t sectnum); static inline void polymer_pokesector(int16_t sectnum);
static void polymer_extractfrustum(GLfloat* modelview, GLfloat* projection, float* frustum); static void polymer_extractfrustum(GLfloat* modelview, GLfloat* projection, float* frustum);
static inline int32_t polymer_planeinfrustum(_prplane *plane, float* frustum); static inline int32_t polymer_planeinfrustum(_prplane *plane, float* frustum);
static inline void polymer_scansprites(int16_t sectnum, tspritetype* tsprite, int32_t* spritesortcnt); static inline void polymer_scansprites(int16_t sectnum, uspritetype* tsprite, int32_t* spritesortcnt);
static void polymer_updatesprite(int32_t snum); static void polymer_updatesprite(int32_t snum);
// SKIES // SKIES
static void polymer_getsky(void); static void polymer_getsky(void);
@ -431,7 +431,7 @@ static void polymer_drawartsky(int16_t tilenum, char palnum, int8_t shad
static void polymer_drawartskyquad(int32_t p1, int32_t p2, GLfloat height); static void polymer_drawartskyquad(int32_t p1, int32_t p2, GLfloat height);
static void polymer_drawskybox(int16_t tilenum, char palnum, int8_t shade); static void polymer_drawskybox(int16_t tilenum, char palnum, int8_t shade);
// MDSPRITES // MDSPRITES
static void polymer_drawmdsprite(tspritetype *tspr); static void polymer_drawmdsprite(uspritetype *tspr);
static void polymer_loadmodelvbos(md3model_t* m); static void polymer_loadmodelvbos(md3model_t* m);
// MATERIALS // MATERIALS
static void polymer_getscratchmaterial(_prmaterial* material); static void polymer_getscratchmaterial(_prmaterial* material);

View file

@ -87,15 +87,15 @@ static inline float getshadefactor(int32_t const shade)
#define POLYMOST_CHOOSE_FOG_PAL(fogpal, pal) \ #define POLYMOST_CHOOSE_FOG_PAL(fogpal, pal) \
((fogpal) ? (fogpal) : (pal)) ((fogpal) ? (fogpal) : (pal))
static inline int32_t get_floor_fogpal(tsectortype const * const sec) static inline int32_t get_floor_fogpal(usectortype const * const sec)
{ {
return POLYMOST_CHOOSE_FOG_PAL(sec->fogpal, sec->floorpal); return POLYMOST_CHOOSE_FOG_PAL(sec->fogpal, sec->floorpal);
} }
static inline int32_t get_ceiling_fogpal(tsectortype const * const sec) static inline int32_t get_ceiling_fogpal(usectortype const * const sec)
{ {
return POLYMOST_CHOOSE_FOG_PAL(sec->fogpal, sec->ceilingpal); return POLYMOST_CHOOSE_FOG_PAL(sec->fogpal, sec->ceilingpal);
} }
static inline int32_t fogpal_shade(tsectortype const * const sec, int32_t const shade) static inline int32_t fogpal_shade(usectortype const * const sec, int32_t const shade)
{ {
// When fogging is due to sector[].fogpal, don't make the fog parameters // When fogging is due to sector[].fogpal, don't make the fog parameters
// depend on the shade of the object. // depend on the shade of the object.

View file

@ -199,9 +199,9 @@ typedef struct
int16_t *bunchnum; // [numsectors][2] int16_t *bunchnum; // [numsectors][2]
int16_t *ynextwall; // [numwalls][2] int16_t *ynextwall; // [numwalls][2]
#endif #endif
tsectortype *sector; usectortype *sector;
twalltype *wall; uwalltype *wall;
tspritetype *sprite; uspritetype *sprite;
} mapinfofull_t; } mapinfofull_t;
int32_t g_doScreenShot; int32_t g_doScreenShot;
@ -1720,8 +1720,8 @@ static int32_t backup_highlighted_map(mapinfofull_t *mapinfo)
} }
// allocate temp storage // allocate temp storage
mapinfo->sector = (tsectortype *)Xmalloc(highlightsectorcnt * sizeof(sectortype)); mapinfo->sector = (usectortype *)Xmalloc(highlightsectorcnt * sizeof(sectortype));
mapinfo->wall = (twalltype *)Xmalloc(tmpnumwalls * sizeof(walltype)); mapinfo->wall = (uwalltype *)Xmalloc(tmpnumwalls * sizeof(walltype));
#ifdef YAX_ENABLE #ifdef YAX_ENABLE
if (mapinfo->numyaxbunches > 0) if (mapinfo->numyaxbunches > 0)
@ -1737,7 +1737,7 @@ static int32_t backup_highlighted_map(mapinfofull_t *mapinfo)
if (tmpnumsprites>0) if (tmpnumsprites>0)
{ {
mapinfo->sprite = (tspritetype *)Xmalloc(tmpnumsprites * sizeof(spritetype)); mapinfo->sprite = (uspritetype *)Xmalloc(tmpnumsprites * sizeof(spritetype));
} }
else else
{ {
@ -1772,7 +1772,7 @@ static int32_t backup_highlighted_map(mapinfofull_t *mapinfo)
if (obn >= 0 && nbn < 0) if (obn >= 0 && nbn < 0)
{ {
// A bunch was discarded. // A bunch was discarded.
tsectortype *const sec = &mapinfo->sector[i]; usectortype *const sec = &mapinfo->sector[i];
# if !defined NEW_MAP_FORMAT # if !defined NEW_MAP_FORMAT
uint16_t *const cs = j==YAX_CEILING ? &sec->ceilingstat : &sec->floorstat; uint16_t *const cs = j==YAX_CEILING ? &sec->ceilingstat : &sec->floorstat;
uint8_t *const xp = j==YAX_CEILING ? &sec->ceilingxpanning : &sec->floorxpanning; uint8_t *const xp = j==YAX_CEILING ? &sec->ceilingxpanning : &sec->floorxpanning;
@ -1954,7 +1954,7 @@ static int32_t restore_highlighted_map(mapinfofull_t *mapinfo, int32_t forreal)
// insert sprites // insert sprites
for (i=0; i<mapinfo->numsprites; i++) for (i=0; i<mapinfo->numsprites; i++)
{ {
const tspritetype *srcspr = &mapinfo->sprite[i]; const uspritetype *srcspr = &mapinfo->sprite[i];
int32_t sect = onumsectors + srcspr->sectnum; int32_t sect = onumsectors + srcspr->sectnum;
j = insertsprite(sect, srcspr->statnum); j = insertsprite(sect, srcspr->statnum);
@ -2361,9 +2361,9 @@ void fade_editor_screen(int32_t keepcol)
static void copy_some_wall_members(int16_t dst, int16_t src, int32_t reset_some) static void copy_some_wall_members(int16_t dst, int16_t src, int32_t reset_some)
{ {
static twalltype nullwall; static uwalltype nullwall;
walltype * const dstwal = &wall[dst]; walltype * const dstwal = &wall[dst];
const twalltype *srcwal = src >= 0 ? (twalltype *)&wall[src] : &nullwall; const uwalltype *srcwal = src >= 0 ? (uwalltype *)&wall[src] : &nullwall;
memset(&nullwall, 0, sizeof(nullwall)); memset(&nullwall, 0, sizeof(nullwall));
nullwall.yrepeat = 8; nullwall.yrepeat = 8;
@ -2588,7 +2588,7 @@ static int32_t trace_loop(int32_t j, uint8_t *visitedwall, int16_t *ignore_ret,
// Context that needs special treatment: suckwall, splitsect, splitstartwall // Context that needs special treatment: suckwall, splitsect, splitstartwall
static int32_t backup_drawn_walls(int32_t restore) static int32_t backup_drawn_walls(int32_t restore)
{ {
static twalltype *tmpwall; static uwalltype *tmpwall;
// back up // back up
if (restore==0) if (restore==0)
@ -2601,7 +2601,7 @@ static int32_t backup_drawn_walls(int32_t restore)
return 2; return 2;
Bfree(tmpwall); Bfree(tmpwall);
tmpwall = (twalltype *)Xmalloc((newnumwalls-numwalls) * sizeof(walltype)); tmpwall = (uwalltype *)Xmalloc((newnumwalls-numwalls) * sizeof(walltype));
ovh.bak_wallsdrawn = newnumwalls-numwalls; ovh.bak_wallsdrawn = newnumwalls-numwalls;
@ -2751,8 +2751,8 @@ static int32_t sectors_components(int16_t hlsectcnt, const int16_t *hlsector, in
static int cmpgeomwal1(const void *w1, const void *w2) static int cmpgeomwal1(const void *w1, const void *w2)
{ {
twalltype const * const wal1 = (twalltype *)&wall[B_UNBUF16(w1)]; uwalltype const * const wal1 = (uwalltype *)&wall[B_UNBUF16(w1)];
twalltype const * const wal2 = (twalltype *)&wall[B_UNBUF16(w2)]; uwalltype const * const wal2 = (uwalltype *)&wall[B_UNBUF16(w2)];
if (wal1->x == wal2->x) if (wal1->x == wal2->x)
return wal1->y - wal2->y; return wal1->y - wal2->y;
@ -3294,7 +3294,7 @@ static void drawspritelabel(int i)
return; return;
// KEEPINSYNC drawscreen_drawsprite() // KEEPINSYNC drawscreen_drawsprite()
tspritetype const * s = (tspritetype *)&sprite[i]; uspritetype const * s = (uspritetype *)&sprite[i];
uint8_t const spritecol = spritecol2d[s->picnum][(s->cstat&1)]; uint8_t const spritecol = spritecol2d[s->picnum][(s->cstat&1)];
int col = spritecol ? editorcolors[spritecol] : getspritecol(i); int col = spritecol ? editorcolors[spritecol] : getspritecol(i);
int const blocking = s->cstat & 1; int const blocking = s->cstat & 1;
@ -4034,7 +4034,7 @@ void overheadeditor(void)
int32_t startofloop, endofloop; int32_t startofloop, endofloop;
int32_t numtoswap = -1; int32_t numtoswap = -1;
int32_t w=0; int32_t w=0;
twalltype tempwall; uwalltype tempwall;
startofloop = startwall = sector[highlightsector[i]].wallptr; startofloop = startwall = sector[highlightsector[i]].wallptr;
endofloop = endwall = startwall+sector[highlightsector[i]].wallnum-1; endofloop = endwall = startwall+sector[highlightsector[i]].wallnum-1;
@ -5303,7 +5303,7 @@ end_yax: ;
sector[refsect].wallnum += n; sector[refsect].wallnum += n;
if (refsect != numsectors-1) if (refsect != numsectors-1)
{ {
twalltype *tmpwall = (twalltype *)Xmalloc(n * sizeof(walltype)); uwalltype *tmpwall = (uwalltype *)Xmalloc(n * sizeof(walltype));
int16_t *tmponw = (int16_t *)Xmalloc(n * sizeof(int16_t)); int16_t *tmponw = (int16_t *)Xmalloc(n * sizeof(int16_t));
for (m=0; m<numwalls; m++) for (m=0; m<numwalls; m++)
@ -6082,7 +6082,7 @@ end_point_dragging:
int32_t numouterwalls[2] = {0,0}, numowals; int32_t numouterwalls[2] = {0,0}, numowals;
static int16_t outerwall[2][MAXWALLS]; static int16_t outerwall[2][MAXWALLS];
const twalltype *wal0, *wal1, *wal0p2, *wal1p2; const uwalltype *wal0, *wal1, *wal0p2, *wal1p2;
// join sector ceilings/floors to a new bunch // join sector ceilings/floors to a new bunch
if (numyaxbunches==YAX_MAXBUNCHES) if (numyaxbunches==YAX_MAXBUNCHES)
@ -6176,11 +6176,11 @@ end_point_dragging:
for (k=0; k<numowals; k++) for (k=0; k<numowals; k++)
{ {
wal0 = (twalltype *)&wall[outerwall[0][k]]; wal0 = (uwalltype *)&wall[outerwall[0][k]];
wal1 = (twalltype *)&wall[outerwall[1][k]]; wal1 = (uwalltype *)&wall[outerwall[1][k]];
wal0p2 = (twalltype *)&wall[wal0->point2]; wal0p2 = (uwalltype *)&wall[wal0->point2];
wal1p2 = (twalltype *)&wall[wal1->point2]; wal1p2 = (uwalltype *)&wall[wal1->point2];
if (k==0) if (k==0)
{ {
@ -6193,13 +6193,13 @@ end_point_dragging:
{ {
pos.x = wal0->x + (wal0p2->x - wal0->x)/4; pos.x = wal0->x + (wal0p2->x - wal0->x)/4;
pos.y = wal0->y + (wal0p2->y - wal0->y)/4; pos.y = wal0->y + (wal0p2->y - wal0->y)/4;
pos.z = getflorzofslope(sectorofwall(wal0-(twalltype *)wall), pos.x, pos.y); pos.z = getflorzofslope(sectorofwall(wal0-(uwalltype *)wall), pos.x, pos.y);
if (!delayerr) if (!delayerr)
message("Outer wall coordinates must coincide for both components"); message("Outer wall coordinates must coincide for both components");
OSD_Printf("wal0:%d (%d,%d)--(%d,%d)\n",(int)(wal0-(twalltype *)wall), OSD_Printf("wal0:%d (%d,%d)--(%d,%d)\n",(int)(wal0-(uwalltype *)wall),
wal0->x,wal0->y, wal0p2->x,wal0p2->y); wal0->x,wal0->y, wal0p2->x,wal0p2->y);
OSD_Printf("wal1:%d (%d,%d)--(%d,%d)\n",(int)(wal1-(twalltype *)wall), OSD_Printf("wal1:%d (%d,%d)--(%d,%d)\n",(int)(wal1-(uwalltype *)wall),
wal1->x,wal1->y, wal1p2->x,wal1p2->y); wal1->x,wal1->y, wal1p2->x,wal1p2->y);
goto end_join_sectors; goto end_join_sectors;

View file

@ -18,8 +18,8 @@ void mapinfo_set(mapinfo_t *bak, mapinfo_t *newmap)
{ {
bak->numsectors = numsectors; bak->numsectors = numsectors;
bak->numwalls = numwalls; bak->numwalls = numwalls;
bak->sector = (tsectortype *) sector; bak->sector = (usectortype *) sector;
bak->wall = (twalltype *) wall; bak->wall = (uwalltype *) wall;
} }
if (newmap) if (newmap)
@ -43,9 +43,9 @@ int16_t *sectq; // [numsectors]
int16_t pictoidx[MAXTILES]; // maps tile num to clipinfo[] index int16_t pictoidx[MAXTILES]; // maps tile num to clipinfo[] index
static int16_t *tempictoidx; static int16_t *tempictoidx;
static tsectortype *loadsector; static usectortype *loadsector;
static twalltype *loadwall, *loadwallinv; static uwalltype *loadwall, *loadwallinv;
static tspritetype *loadsprite; static uspritetype *loadsprite;
void clipmapinfo_init() void clipmapinfo_init()
@ -85,9 +85,9 @@ int32_t clipmapinfo_load(void)
clipmapinfo_init(); clipmapinfo_init();
loadsector = (tsectortype *) Xmalloc(MAXSECTORS * sizeof(sectortype)); loadsector = (usectortype *) Xmalloc(MAXSECTORS * sizeof(sectortype));
loadwall = (twalltype *) Xmalloc(MAXWALLS * sizeof(walltype)); loadwall = (uwalltype *) Xmalloc(MAXWALLS * sizeof(walltype));
loadsprite = (tspritetype *) Xmalloc(MAXSPRITES * sizeof(spritetype)); loadsprite = (uspritetype *) Xmalloc(MAXSPRITES * sizeof(spritetype));
if (g_clipMapFilesNum) if (g_clipMapFilesNum)
fisec = (int32_t *) Xcalloc(g_clipMapFilesNum, sizeof(int32_t)); fisec = (int32_t *) Xcalloc(g_clipMapFilesNum, sizeof(int32_t));
@ -155,8 +155,8 @@ int32_t clipmapinfo_load(void)
} }
// shrink // shrink
loadsector = (tsectortype *) Xrealloc(loadsector, ournumsectors*sizeof(sectortype)); loadsector = (usectortype *) Xrealloc(loadsector, ournumsectors*sizeof(sectortype));
loadwall = (twalltype *) Xrealloc(loadwall, ournumwalls*sizeof(walltype)); loadwall = (uwalltype *) Xrealloc(loadwall, ournumwalls*sizeof(walltype));
Bmemcpy(sector, loadsector, ournumsectors*sizeof(sectortype)); Bmemcpy(sector, loadsector, ournumsectors*sizeof(sectortype));
Bmemcpy(wall, loadwall, ournumwalls*sizeof(walltype)); Bmemcpy(wall, loadwall, ournumwalls*sizeof(walltype));
@ -431,7 +431,7 @@ int32_t clipmapinfo_load(void)
Bmemcpy(loadwall, wall, ournumwalls*sizeof(walltype)); Bmemcpy(loadwall, wall, ournumwalls*sizeof(walltype));
// loadwallinv will contain all walls with inverted orientation for x/y-flip handling // loadwallinv will contain all walls with inverted orientation for x/y-flip handling
loadwallinv = (twalltype *) Xmalloc(ournumwalls*sizeof(walltype)); loadwallinv = (uwalltype *) Xmalloc(ournumwalls*sizeof(walltype));
{ {
int32_t j, loopstart, loopend, numloopwalls; int32_t j, loopstart, loopend, numloopwalls;
@ -536,9 +536,9 @@ int32_t clipmoveboxtracenum = 3;
int32_t clipinsidebox(vec2_t *vect, int16_t wallnum, int32_t walldist) int32_t clipinsidebox(vec2_t *vect, int16_t wallnum, int32_t walldist)
{ {
int32_t const r = walldist<<1; int32_t const r = walldist<<1;
twalltype const *wal = (twalltype *) &wall[wallnum]; uwalltype const *wal = (uwalltype *) &wall[wallnum];
vec2_t const v1 ={ wal->x + walldist - vect->x, wal->y + walldist - vect->y }; vec2_t const v1 ={ wal->x + walldist - vect->x, wal->y + walldist - vect->y };
wal = (twalltype *) &wall[wal->point2]; wal = (uwalltype *) &wall[wal->point2];
vec2_t v2 ={ wal->x + walldist - vect->x, wal->y + walldist - vect->y }; vec2_t v2 ={ wal->x + walldist - vect->x, wal->y + walldist - vect->y };
if (((v1.x < 0) && (v2.x < 0)) || ((v1.y < 0) && (v2.y < 0)) || if (((v1.x < 0) && (v2.x < 0)) || ((v1.y < 0) && (v2.y < 0)) ||
@ -681,17 +681,17 @@ int32_t clipsprite_initindex(int32_t curidx, spritetype *curspr, int32_t *clipse
for (k=clipinfo[curidx].qbeg; k<=clipinfo[curidx].qend; k++) for (k=clipinfo[curidx].qbeg; k<=clipinfo[curidx].qend; k++)
{ {
const int32_t j = sectq[k]; const int32_t j = sectq[k];
tsectortype *const sec = (tsectortype *)&sector[j]; usectortype *const sec = (usectortype *)&sector[j];
const int32_t startwall = sec->wallptr, endwall = startwall+sec->wallnum; const int32_t startwall = sec->wallptr, endwall = startwall+sec->wallnum;
int32_t w; int32_t w;
twalltype *wal; uwalltype *wal;
sec->floorz = daz + mulscale22(scalez, CM_FLOORZ(j)); sec->floorz = daz + mulscale22(scalez, CM_FLOORZ(j));
sec->ceilingz = daz + mulscale22(scalez, CM_CEILINGZ(j)); sec->ceilingz = daz + mulscale22(scalez, CM_CEILINGZ(j));
//initprintf("sec %d: f=%d, c=%d\n", j, sec->floorz, sec->ceilingz); //initprintf("sec %d: f=%d, c=%d\n", j, sec->floorz, sec->ceilingz);
for (w=startwall, wal=(twalltype *)&wall[startwall]; w<endwall; w++, wal++) for (w=startwall, wal=(uwalltype *)&wall[startwall]; w<endwall; w++, wal++)
{ {
wal->x = mulscale22(scalex, CM_WALL_X(w)); wal->x = mulscale22(scalex, CM_WALL_X(w));
wal->y = mulscale22(scaley, CM_WALL_Y(w)); wal->y = mulscale22(scaley, CM_WALL_Y(w));
@ -754,7 +754,7 @@ FORCE_INLINE void clipmove_tweak_pos(const vec3_t *pos, int32_t gx, int32_t gy,
static int32_t check_floor_curb(int32_t dasect, int32_t nextsect, int32_t flordist, int32_t posz, static int32_t check_floor_curb(int32_t dasect, int32_t nextsect, int32_t flordist, int32_t posz,
int32_t dax, int32_t day) int32_t dax, int32_t day)
{ {
tsectortype const * const sec2 = (tsectortype *)&sector[nextsect]; usectortype const * const sec2 = (usectortype *)&sector[nextsect];
int32_t const daz2 = getflorzofslope(nextsect, dax, day); int32_t const daz2 = getflorzofslope(nextsect, dax, day);
return ((sec2->floorstat&1) == 0 && // parallaxed floor curbs don't clip return ((sec2->floorstat&1) == 0 && // parallaxed floor curbs don't clip
@ -896,8 +896,8 @@ int32_t clipmove(vec3_t *pos, int16_t *sectnum,
clipspritecnt = 0; clipspritenum = 0; clipspritecnt = 0; clipspritenum = 0;
do do
{ {
const twalltype *wal; const uwalltype *wal;
const tsectortype *sec; const usectortype *sec;
int32_t dasect, startwall, endwall; int32_t dasect, startwall, endwall;
#ifdef HAVE_CLIPSHAPE_FEATURE #ifdef HAVE_CLIPSHAPE_FEATURE
@ -936,12 +936,12 @@ int32_t clipmove(vec3_t *pos, int16_t *sectnum,
////////// Walls ////////// ////////// Walls //////////
sec = (tsectortype *)&sector[dasect]; sec = (usectortype *)&sector[dasect];
startwall = sec->wallptr; endwall = startwall + sec->wallnum; startwall = sec->wallptr; endwall = startwall + sec->wallnum;
for (j=startwall, wal=(twalltype *)&wall[startwall]; j<endwall; j++, wal++) for (j=startwall, wal=(uwalltype *)&wall[startwall]; j<endwall; j++, wal++)
{ {
int32_t clipyou = 0, dx, dy; int32_t clipyou = 0, dx, dy;
const twalltype *const wal2 = (twalltype *)&wall[wal->point2]; const uwalltype *const wal2 = (uwalltype *)&wall[wal->point2];
if ((wal->x < xmin && wal2->x < xmin) || (wal->x > xmax && wal2->x > xmax) || if ((wal->x < xmin && wal2->x < xmin) || (wal->x > xmax && wal2->x > xmax) ||
(wal->y < ymin && wal2->y < ymin) || (wal->y > ymax && wal2->y > ymax)) (wal->y < ymin && wal2->y < ymin) || (wal->y > ymax && wal2->y > ymax))
@ -961,7 +961,7 @@ int32_t clipmove(vec3_t *pos, int16_t *sectnum,
{ {
if (wal->nextsector>=0) if (wal->nextsector>=0)
{ {
const tsectortype *sec2 = (tsectortype *)&sector[wal->nextsector]; const usectortype *sec2 = (usectortype *)&sector[wal->nextsector];
clipmove_tweak_pos(pos, gx, gy, x1, y1, x2, y2, &dax, &day); clipmove_tweak_pos(pos, gx, gy, x1, y1, x2, y2, &dax, &day);
@ -1012,7 +1012,7 @@ int32_t clipmove(vec3_t *pos, int16_t *sectnum,
if (clipyou == 0) if (clipyou == 0)
{ {
const tsectortype *sec2 = (tsectortype *)&sector[wal->nextsector]; const usectortype *sec2 = (usectortype *)&sector[wal->nextsector];
int32_t daz2 = getceilzofslope(wal->nextsector, dax, day); int32_t daz2 = getceilzofslope(wal->nextsector, dax, day);
clipyou = ((sec2->ceilingstat&1) == 0 && clipyou = ((sec2->ceilingstat&1) == 0 &&
@ -1135,7 +1135,7 @@ int32_t clipmove(vec3_t *pos, int16_t *sectnum,
rxi[0] = x1; rxi[0] = x1;
ryi[0] = y1; ryi[0] = y1;
get_floorspr_points((tspritetype const *) spr, 0, 0, &rxi[0], &rxi[1], &rxi[2], &rxi[3], get_floorspr_points((uspritetype const *) spr, 0, 0, &rxi[0], &rxi[1], &rxi[2], &rxi[3],
&ryi[0], &ryi[1], &ryi[2], &ryi[3]); &ryi[0], &ryi[1], &ryi[2], &ryi[3]);
dax = mulscale14(sintable[(spr->ang-256+512)&2047], walldist); dax = mulscale14(sintable[(spr->ang-256+512)&2047], walldist);
@ -1308,8 +1308,8 @@ int32_t pushmove(vec3_t *vect, int16_t *sectnum,
clipsectcnt = 0; clipsectnum = 1; clipsectcnt = 0; clipsectnum = 1;
do do
{ {
const twalltype *wal; const uwalltype *wal;
const tsectortype *sec; const usectortype *sec;
int32_t startwall, endwall; int32_t startwall, endwall;
#if 0 #if 0
// Push FACE sprites // Push FACE sprites
@ -1344,13 +1344,13 @@ int32_t pushmove(vec3_t *vect, int16_t *sectnum,
} }
} }
#endif #endif
sec = (tsectortype *)&sector[clipsectorlist[clipsectcnt]]; sec = (usectortype *)&sector[clipsectorlist[clipsectcnt]];
if (dir > 0) if (dir > 0)
startwall = sec->wallptr, endwall = startwall + sec->wallnum; startwall = sec->wallptr, endwall = startwall + sec->wallnum;
else else
endwall = sec->wallptr, startwall = endwall + sec->wallnum; endwall = sec->wallptr, startwall = endwall + sec->wallnum;
for (i=startwall, wal=(twalltype *)&wall[startwall]; i!=endwall; i+=dir, wal+=dir) for (i=startwall, wal=(uwalltype *)&wall[startwall]; i!=endwall; i+=dir, wal+=dir)
if (clipinsidebox((vec2_t *)vect, i, walldist-4) == 1) if (clipinsidebox((vec2_t *)vect, i, walldist-4) == 1)
{ {
j = 0; j = 0;
@ -1358,7 +1358,7 @@ int32_t pushmove(vec3_t *vect, int16_t *sectnum,
if (wal->cstat&dawalclipmask) j = 1; if (wal->cstat&dawalclipmask) j = 1;
if (j == 0) if (j == 0)
{ {
const tsectortype *const sec2 = (tsectortype *)&sector[wal->nextsector]; const usectortype *const sec2 = (usectortype *)&sector[wal->nextsector];
int32_t daz2; int32_t daz2;
//Find closest point on wall (dax, day) to (vect->x, vect->y) //Find closest point on wall (dax, day) to (vect->x, vect->y)

View file

@ -189,15 +189,15 @@ int32_t maybe_append_ext(char *wbuf, int32_t wbufsiz, const char *fn, const char
int32_t ldist(const void *s1, const void *s2) int32_t ldist(const void *s1, const void *s2)
{ {
tspritetype const *const sp1 = (tspritetype const *)s1; uspritetype const *const sp1 = (uspritetype const *)s1;
tspritetype const *const sp2 = (tspritetype const *)s2; uspritetype const *const sp2 = (uspritetype const *)s2;
return sepldist(sp1->x - sp2->x, sp1->y - sp2->y); return sepldist(sp1->x - sp2->x, sp1->y - sp2->y);
} }
int32_t dist(const void *s1, const void *s2) int32_t dist(const void *s1, const void *s2)
{ {
tspritetype const *const sp1 = (tspritetype const *)s1; uspritetype const *const sp1 = (uspritetype const *)s1;
tspritetype const *const sp2 = (tspritetype const *)s2; uspritetype const *const sp2 = (uspritetype const *)s2;
return sepdist(sp1->x - sp2->x, sp1->y - sp2->y, sp1->z - sp2->z); return sepdist(sp1->x - sp2->x, sp1->y - sp2->y, sp1->z - sp2->z);
} }

View file

@ -845,7 +845,7 @@ static void yax_copytsprites()
{ {
int32_t i, spritenum, gotthrough, sectnum; int32_t i, spritenum, gotthrough, sectnum;
int32_t sortcnt = yax_spritesortcnt[yax_globallev]; int32_t sortcnt = yax_spritesortcnt[yax_globallev];
const tspritetype *spr; const uspritetype *spr;
for (i=0; i<sortcnt; i++) for (i=0; i<sortcnt; i++)
{ {
@ -854,7 +854,7 @@ static void yax_copytsprites()
gotthrough = spritenum&(MAXSPRITES|(MAXSPRITES<<1)); gotthrough = spritenum&(MAXSPRITES|(MAXSPRITES<<1));
spritenum &= MAXSPRITES-1; spritenum &= MAXSPRITES-1;
spr = (tspritetype *)&sprite[spritenum]; spr = (uspritetype *)&sprite[spritenum];
sectnum = spr->sectnum; sectnum = spr->sectnum;
if (gotthrough == (MAXSPRITES|(MAXSPRITES<<1))) if (gotthrough == (MAXSPRITES|(MAXSPRITES<<1)))
@ -1535,7 +1535,7 @@ char apptitle[256] = "Build Engine";
// 1=break out of sprite collecting; // 1=break out of sprite collecting;
int32_t engine_addtsprite(int16_t z, int16_t sectnum) int32_t engine_addtsprite(int16_t z, int16_t sectnum)
{ {
tspritetype *spr = (tspritetype *)&sprite[z]; uspritetype *spr = (uspritetype *)&sprite[z];
#ifdef YAX_ENABLE #ifdef YAX_ENABLE
if (g_nodraw==0) if (g_nodraw==0)
{ {
@ -1711,7 +1711,7 @@ static void scansector(int16_t startsectnum)
#endif #endif
for (int32_t i=headspritesect[sectnum]; i>=0; i=nextspritesect[i]) for (int32_t i=headspritesect[sectnum]; i>=0; i=nextspritesect[i])
{ {
const tspritetype *const spr = (tspritetype *)&sprite[i]; const uspritetype *const spr = (uspritetype *)&sprite[i];
if (((spr->cstat&0x8000) == 0 || showinvisibility) && if (((spr->cstat&0x8000) == 0 || showinvisibility) &&
spr->xrepeat > 0 && spr->yrepeat > 0) spr->xrepeat > 0 && spr->yrepeat > 0)
@ -1738,9 +1738,9 @@ static void scansector(int16_t startsectnum)
for (int32_t w=startwall; w<endwall; w++) for (int32_t w=startwall; w<endwall; w++)
{ {
const twalltype *const wal = (twalltype *)&wall[w]; const uwalltype *const wal = (uwalltype *)&wall[w];
const int32_t nextsectnum = wal->nextsector; const int32_t nextsectnum = wal->nextsector;
const twalltype *const wal2 = (twalltype *)&wall[wal->point2]; const uwalltype *const wal2 = (uwalltype *)&wall[wal->point2];
const int32_t x1 = wal->x-globalposx, y1 = wal->y-globalposy; const int32_t x1 = wal->x-globalposx, y1 = wal->y-globalposy;
const int32_t x2 = wal2->x-globalposx, y2 = wal2->y-globalposy; const int32_t x2 = wal2->x-globalposx, y2 = wal2->y-globalposy;
@ -2120,10 +2120,10 @@ int32_t wallfront(int32_t l1, int32_t l2)
// //
// spritewallfront (internal) // spritewallfront (internal)
// //
static inline int32_t spritewallfront(const tspritetype *s, int32_t w) static inline int32_t spritewallfront(const uspritetype *s, int32_t w)
{ {
const twalltype *const wal = (twalltype *)&wall[w]; const uwalltype *const wal = (uwalltype *)&wall[w];
const twalltype *wal2 = (twalltype *)&wall[wal->point2]; const uwalltype *wal2 = (uwalltype *)&wall[wal->point2];
const vec2_t v = { wal->x, wal->y }; const vec2_t v = { wal->x, wal->y };
return dmulscale32(wal2->x - v.x, s->y - v.y, -(s->x - v.x), wal2->y - v.y) >= 0; return dmulscale32(wal2->x - v.x, s->y - v.y, -(s->x - v.x), wal2->y - v.y) >= 0;
@ -2253,7 +2253,7 @@ static inline void slowhline(int32_t xr, int32_t yp)
// //
// prepwall (internal) // prepwall (internal)
// //
static void prepwall(int32_t z, const twalltype *wal) static void prepwall(int32_t z, const uwalltype *wal)
{ {
int32_t l=0, ol=0, x; int32_t l=0, ol=0, x;
@ -2538,7 +2538,7 @@ static int32_t wallmost(int16_t *mostbuf, int32_t w, int32_t sectnum, char dasta
if (wi == sector[sectnum].wallptr) if (wi == sector[sectnum].wallptr)
return owallmost(mostbuf,w,z); return owallmost(mostbuf,w,z);
const twalltype *const wal = (twalltype *)&wall[wi]; const uwalltype *const wal = (uwalltype *)&wall[wi];
const int32_t x1 = wal->x, x2 = wall[wal->point2].x-x1; const int32_t x1 = wal->x, x2 = wall[wal->point2].x-x1;
const int32_t y1 = wal->y, y2 = wall[wal->point2].y-y1; const int32_t y1 = wal->y, y2 = wall[wal->point2].y-y1;
@ -2665,7 +2665,7 @@ static void calc_globalshifts(void)
if (globalyshift > 31) globalyshift=0; if (globalyshift > 31) globalyshift=0;
} }
static int32_t setup_globals_cf1(const tsectortype *sec, int32_t pal, int32_t zd, static int32_t setup_globals_cf1(const usectortype *sec, int32_t pal, int32_t zd,
int32_t picnum, int32_t shade, int32_t stat, int32_t picnum, int32_t shade, int32_t stat,
int32_t xpanning, int32_t ypanning, int32_t x1) int32_t xpanning, int32_t ypanning, int32_t x1)
{ {
@ -2760,7 +2760,7 @@ static int32_t setup_globals_cf1(const tsectortype *sec, int32_t pal, int32_t zd
static void ceilscan(int32_t x1, int32_t x2, int32_t sectnum) static void ceilscan(int32_t x1, int32_t x2, int32_t sectnum)
{ {
int32_t x, y1, y2; int32_t x, y1, y2;
const tsectortype *const sec = (tsectortype *)&sector[sectnum]; const usectortype *const sec = (usectortype *)&sector[sectnum];
if (setup_globals_cf1(sec, sec->ceilingpal, sec->ceilingz-globalposz, if (setup_globals_cf1(sec, sec->ceilingpal, sec->ceilingz-globalposz,
sec->ceilingpicnum, sec->ceilingshade, sec->ceilingstat, sec->ceilingpicnum, sec->ceilingshade, sec->ceilingstat,
@ -2858,7 +2858,7 @@ static void ceilscan(int32_t x1, int32_t x2, int32_t sectnum)
static void florscan(int32_t x1, int32_t x2, int32_t sectnum) static void florscan(int32_t x1, int32_t x2, int32_t sectnum)
{ {
int32_t x, y1, y2; int32_t x, y1, y2;
const tsectortype *const sec = (tsectortype *)&sector[sectnum]; const usectortype *const sec = (usectortype *)&sector[sectnum];
if (setup_globals_cf1(sec, sec->floorpal, globalposz-sec->floorz, if (setup_globals_cf1(sec, sec->floorpal, globalposz-sec->floorz,
sec->floorpicnum, sec->floorshade, sec->floorstat, sec->floorpicnum, sec->floorshade, sec->floorstat,
@ -3451,8 +3451,8 @@ static void grouscan(int32_t dax1, int32_t dax2, int32_t sectnum, char dastat)
// Er, yes, they're not global anymore: // Er, yes, they're not global anymore:
int32_t globalx, globaly, globalz, globalzx; int32_t globalx, globaly, globalz, globalzx;
const tsectortype *const sec = (tsectortype *)&sector[sectnum]; const usectortype *const sec = (usectortype *)&sector[sectnum];
const twalltype *wal; const uwalltype *wal;
if (dastat == 0) if (dastat == 0)
{ {
@ -3482,7 +3482,7 @@ static void grouscan(int32_t dax1, int32_t dax2, int32_t sectnum, char dastat)
if ((tilesiz[globalpicnum].x <= 0) || (tilesiz[globalpicnum].y <= 0)) return; if ((tilesiz[globalpicnum].x <= 0) || (tilesiz[globalpicnum].y <= 0)) return;
if (waloff[globalpicnum] == 0) loadtile(globalpicnum); if (waloff[globalpicnum] == 0) loadtile(globalpicnum);
wal = (twalltype *)&wall[sec->wallptr]; wal = (uwalltype *)&wall[sec->wallptr];
wx = wall[wal->point2].x - wal->x; wx = wall[wal->point2].x - wal->x;
wy = wall[wal->point2].y - wal->y; wy = wall[wal->point2].y - wal->y;
dasqr = krecipasm(nsqrtasm(uhypsq(wx,wy))); dasqr = krecipasm(nsqrtasm(uhypsq(wx,wy)));
@ -3619,7 +3619,7 @@ static void grouscan(int32_t dax1, int32_t dax2, int32_t sectnum, char dastat)
// //
static void parascan(int32_t dax1, int32_t dax2, int32_t sectnum, char dastat, int32_t bunch) static void parascan(int32_t dax1, int32_t dax2, int32_t sectnum, char dastat, int32_t bunch)
{ {
tsectortype *sec; usectortype *sec;
int32_t j, k, l, m, n, x, z, wallnum, nextsectnum, globalhorizbak; int32_t j, k, l, m, n, x, z, wallnum, nextsectnum, globalhorizbak;
int16_t *topptr, *botptr; int16_t *topptr, *botptr;
@ -3631,7 +3631,7 @@ static void parascan(int32_t dax1, int32_t dax2, int32_t sectnum, char dastat, i
UNREFERENCED_PARAMETER(dax1); UNREFERENCED_PARAMETER(dax1);
UNREFERENCED_PARAMETER(dax2); UNREFERENCED_PARAMETER(dax2);
sectnum = thesector[bunchfirst[bunch]]; sec = (tsectortype *)&sector[sectnum]; sectnum = thesector[bunchfirst[bunch]]; sec = (usectortype *)&sector[sectnum];
globalhorizbak = globalhoriz; globalhorizbak = globalhoriz;
globvis = globalpisibility; globvis = globalpisibility;
@ -3806,7 +3806,7 @@ static void parascan(int32_t dax1, int32_t dax2, int32_t sectnum, char dastat, i
// set orientation, panning, shade, pal; picnum // set orientation, panning, shade, pal; picnum
static void setup_globals_wall1(const twalltype *wal, int32_t dapicnum) static void setup_globals_wall1(const uwalltype *wal, int32_t dapicnum)
{ {
globalorientation = wal->cstat; globalorientation = wal->cstat;
@ -3822,7 +3822,7 @@ static void setup_globals_wall1(const twalltype *wal, int32_t dapicnum)
if (palookup[globalpal] == NULL) globalpal = 0; // JBF: fixes crash if (palookup[globalpal] == NULL) globalpal = 0; // JBF: fixes crash
} }
static void setup_globals_wall2(const twalltype *wal, uint8_t secvisibility, int32_t topzref, int32_t botzref) static void setup_globals_wall2(const uwalltype *wal, uint8_t secvisibility, int32_t topzref, int32_t botzref)
{ {
const int32_t logtilesizy = (picsiz[globalpicnum]>>4); const int32_t logtilesizy = (picsiz[globalpicnum]>>4);
const int32_t tsizy = tilesiz[globalpicnum].y; const int32_t tsizy = tilesiz[globalpicnum].y;
@ -3925,7 +3925,7 @@ static void drawalls(int32_t bunch)
int32_t z = bunchfirst[bunch]; int32_t z = bunchfirst[bunch];
const int32_t sectnum = thesector[z]; const int32_t sectnum = thesector[z];
const tsectortype *const sec = (tsectortype *)&sector[sectnum]; const usectortype *const sec = (usectortype *)&sector[sectnum];
uint8_t andwstat1 = 0xff, andwstat2 = 0xff; uint8_t andwstat1 = 0xff, andwstat2 = 0xff;
@ -4052,10 +4052,10 @@ static void drawalls(int32_t bunch)
} }
const int32_t wallnum = thewall[z]; const int32_t wallnum = thewall[z];
const twalltype *const wal = (twalltype *)&wall[wallnum]; const uwalltype *const wal = (uwalltype *)&wall[wallnum];
const int32_t nextsectnum = wal->nextsector; const int32_t nextsectnum = wal->nextsector;
const tsectortype *const nextsec = nextsectnum>=0 ? (tsectortype *)&sector[nextsectnum] : NULL; const usectortype *const nextsec = nextsectnum>=0 ? (usectortype *)&sector[nextsectnum] : NULL;
int32_t gotswall = 0; int32_t gotswall = 0;
@ -4225,7 +4225,7 @@ static void drawalls(int32_t bunch)
searchstat = 0; searchit = 1; searchstat = 0; searchit = 1;
} }
const twalltype *twal = (wal->cstat&2) ? (twalltype *)&wall[wal->nextwall] : wal; const uwalltype *twal = (wal->cstat&2) ? (uwalltype *)&wall[wal->nextwall] : wal;
setup_globals_wall1(twal, twal->picnum); setup_globals_wall1(twal, twal->picnum);
setup_globals_wall2(wal, sec->visibility, nextsec->floorz, sec->ceilingz); setup_globals_wall2(wal, sec->visibility, nextsec->floorz, sec->ceilingz);
@ -4705,7 +4705,7 @@ static void drawvox(int32_t dasprx, int32_t daspry, int32_t dasprz, int32_t dasp
} }
static void setup_globals_sprite1(const tspritetype *tspr, const tsectortype *sec, static void setup_globals_sprite1(const uspritetype *tspr, const usectortype *sec,
int32_t yspan, int32_t yoff, int32_t tilenum, int32_t yspan, int32_t yoff, int32_t tilenum,
int32_t cstat, int32_t *z1ptr, int32_t *z2ptr) int32_t cstat, int32_t *z1ptr, int32_t *z2ptr)
{ {
@ -4797,7 +4797,7 @@ FORCE_INLINE int32_t mulscale_triple30(int32_t a, int32_t b, int32_t c)
static void drawsprite_classic(int32_t snum) static void drawsprite_classic(int32_t snum)
{ {
tspritetype *const tspr = tspriteptr[snum]; uspritetype *const tspr = tspriteptr[snum];
const int32_t sectnum = tspr->sectnum; const int32_t sectnum = tspr->sectnum;
if (sectnum < 0 || bad_tspr(tspr)) if (sectnum < 0 || bad_tspr(tspr))
@ -4816,7 +4816,7 @@ static void drawsprite_classic(int32_t snum)
const int32_t spritenum = tspr->owner; const int32_t spritenum = tspr->owner;
const float alpha = spriteext[spritenum].alpha; const float alpha = spriteext[spritenum].alpha;
const tsectortype *const sec = (tsectortype *)&sector[sectnum]; const usectortype *const sec = (usectortype *)&sector[sectnum];
int32_t cstat=tspr->cstat, tilenum; int32_t cstat=tspr->cstat, tilenum;
@ -5900,10 +5900,10 @@ static void drawmaskwall(int16_t damaskwallcnt)
//============================================================================= //POLYMOST ENDS //============================================================================= //POLYMOST ENDS
int32_t z = maskwall[damaskwallcnt]; int32_t z = maskwall[damaskwallcnt];
twalltype *wal = (twalltype *)&wall[thewall[z]]; uwalltype *wal = (uwalltype *)&wall[thewall[z]];
int32_t sectnum = thesector[z]; int32_t sectnum = thesector[z];
tsectortype *sec = (tsectortype *)&sector[sectnum]; usectortype *sec = (usectortype *)&sector[sectnum];
tsectortype *nsec = (tsectortype *)&sector[wal->nextsector]; usectortype *nsec = (usectortype *)&sector[wal->nextsector];
int32_t z1 = max(nsec->ceilingz,sec->ceilingz); int32_t z1 = max(nsec->ceilingz,sec->ceilingz);
int32_t z2 = min(nsec->floorz,sec->floorz); int32_t z2 = min(nsec->floorz,sec->floorz);
@ -7627,7 +7627,7 @@ static spritesmooth_t spritesmooth_s[MAXSPRITES+MAXUNIQHUDID];
static sectortype sector_s[MAXSECTORS + M32_FIXME_SECTORS]; static sectortype sector_s[MAXSECTORS + M32_FIXME_SECTORS];
static walltype wall_s[MAXWALLS + M32_FIXME_WALLS]; static walltype wall_s[MAXWALLS + M32_FIXME_WALLS];
static spritetype sprite_s[MAXSPRITES]; static spritetype sprite_s[MAXSPRITES];
static tspritetype tsprite_s[MAXSPRITESONSCREEN]; static uspritetype tsprite_s[MAXSPRITESONSCREEN];
#endif #endif
int32_t preinitengine(void) int32_t preinitengine(void)
@ -8189,8 +8189,8 @@ static inline _equation equation(float x1, float y1, float x2, float y2)
int32_t wallvisible(int32_t x, int32_t y, int16_t wallnum) int32_t wallvisible(int32_t x, int32_t y, int16_t wallnum)
{ {
// 1 if wall is in front of player 0 otherwise // 1 if wall is in front of player 0 otherwise
twalltype *w1 = (twalltype *)&wall[wallnum]; uwalltype *w1 = (uwalltype *)&wall[wallnum];
twalltype *w2 = (twalltype *)&wall[w1->point2]; uwalltype *w2 = (uwalltype *)&wall[w1->point2];
int32_t a1 = getangle(w1->x - x, w1->y - y); int32_t a1 = getangle(w1->x - x, w1->y - y);
int32_t a2 = getangle(w2->x - x, w2->y - y); int32_t a2 = getangle(w2->x - x, w2->y - y);
@ -8280,7 +8280,7 @@ static inline int32_t sameside(const _equation *eq, const vec2f_t *p1, c
// rest x/y: out // rest x/y: out
void get_wallspr_points(const spritetype *spr, int32_t *x1, int32_t *x2, void get_wallspr_points(const spritetype *spr, int32_t *x1, int32_t *x2,
int32_t *y1, int32_t *y2); int32_t *y1, int32_t *y2);
void get_floorspr_points(const tspritetype *spr, int32_t px, int32_t py, void get_floorspr_points(const uspritetype *spr, int32_t px, int32_t py,
int32_t *x1, int32_t *x2, int32_t *x3, int32_t *x4, 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 *y1, int32_t *y2, int32_t *y3, int32_t *y4);
@ -8380,7 +8380,7 @@ killsprite:
{ {
for (int32_t k=i; k<j; k++) for (int32_t k=i; k<j; k++)
{ {
const tspritetype *const s = tspriteptr[k]; const uspritetype *const s = tspriteptr[k];
spritesxyz[k].z = s->z; spritesxyz[k].z = s->z;
if ((s->cstat&48) != 32) if ((s->cstat&48) != 32)
@ -8488,7 +8488,7 @@ killsprite:
)) ))
{ {
vec2f_t spr; vec2f_t spr;
const tspritetype *tspr = tspriteptr[i]; const uspritetype *tspr = tspriteptr[i];
spr.x = (float)tspr->x; spr.x = (float)tspr->x;
spr.y = (float)tspr->y; spr.y = (float)tspr->y;
@ -8677,9 +8677,9 @@ void drawmapview(int32_t dax, int32_t day, int32_t zoome, int16_t ang)
begindrawing(); //{{{ begindrawing(); //{{{
tsectortype *sec; usectortype *sec;
for (s=0,sec=(tsectortype *)&sector[s]; s<numsectors; s++,sec++) for (s=0,sec=(usectortype *)&sector[s]; s<numsectors; s++,sec++)
if (show2dsector[s>>3]&pow2char[s&7]) if (show2dsector[s>>3]&pow2char[s&7])
{ {
#ifdef YAX_ENABLE #ifdef YAX_ENABLE
@ -8702,9 +8702,9 @@ void drawmapview(int32_t dax, int32_t day, int32_t zoome, int16_t ang)
} }
#else #else
j = startwall; l = 0; j = startwall; l = 0;
twalltype *wal; uwalltype *wal;
int32_t w; int32_t w;
for (w=sec->wallnum,wal=(twalltype *)&wall[startwall]; w>0; w--,wal++,j++) for (w=sec->wallnum,wal=(uwalltype *)&wall[startwall]; w>0; w--,wal++,j++)
{ {
k = lastwall(j); k = lastwall(j);
if ((k > j) && (npoints > 0)) { xb1[npoints-1] = l; l = npoints; } //overwrite point2 if ((k > j) && (npoints > 0)) { xb1[npoints-1] = l; l = npoints; } //overwrite point2
@ -8828,7 +8828,7 @@ void drawmapview(int32_t dax, int32_t day, int32_t zoome, int16_t ang)
for (s=sortnum-1; s>=0; s--) for (s=sortnum-1; s>=0; s--)
{ {
tspritetype * const spr = (tspritetype * )&sprite[tsprite[s].owner]; uspritetype * const spr = (uspritetype * )&sprite[tsprite[s].owner];
if ((spr->cstat&48) == 32) if ((spr->cstat&48) == 32)
{ {
const int32_t xspan = tilesiz[spr->picnum].x; const int32_t xspan = tilesiz[spr->picnum].x;
@ -10726,7 +10726,7 @@ int32_t inside(int32_t x, int32_t y, int16_t sectnum)
if (sectnum >= 0 && sectnum < numsectors) if (sectnum >= 0 && sectnum < numsectors)
{ {
uint32_t cnt1 = 0, cnt2 = 0; uint32_t cnt1 = 0, cnt2 = 0;
twalltype const * wal = (twalltype *) &wall[sector[sectnum].wallptr]; uwalltype const * wal = (uwalltype *) &wall[sector[sectnum].wallptr];
int32_t i = sector[sectnum].wallnum; int32_t i = sector[sectnum].wallnum;
do do
@ -10881,7 +10881,7 @@ int32_t nextsectorneighborz(int16_t sectnum, int32_t refz, int16_t topbottom, in
int32_t nextz = (direction==1) ? INT32_MAX : INT32_MIN; int32_t nextz = (direction==1) ? INT32_MAX : INT32_MIN;
int32_t sectortouse = -1; int32_t sectortouse = -1;
const twalltype *wal = (twalltype *)&wall[sector[sectnum].wallptr]; const uwalltype *wal = (uwalltype *)&wall[sector[sectnum].wallptr];
int32_t i = sector[sectnum].wallnum; int32_t i = sector[sectnum].wallnum;
do do
@ -10950,8 +10950,8 @@ restart_grand:
for (dacnt=0; dacnt<danum; dacnt++) for (dacnt=0; dacnt<danum; dacnt++)
{ {
const int32_t dasectnum = clipsectorlist[dacnt]; const int32_t dasectnum = clipsectorlist[dacnt];
const tsectortype *const sec = (tsectortype *)&sector[dasectnum]; const usectortype *const sec = (usectortype *)&sector[dasectnum];
const twalltype *wal; const uwalltype *wal;
int32_t cnt; int32_t cnt;
#ifdef YAX_ENABLE #ifdef YAX_ENABLE
int32_t cfz1[2], cfz2[2]; // both wrt dasectnum int32_t cfz1[2], cfz2[2]; // both wrt dasectnum
@ -10961,9 +10961,9 @@ restart_grand:
getzsofslope(dasectnum, x1,y1, &cfz1[0], &cfz1[1]); getzsofslope(dasectnum, x1,y1, &cfz1[0], &cfz1[1]);
getzsofslope(dasectnum, x2,y2, &cfz2[0], &cfz2[1]); getzsofslope(dasectnum, x2,y2, &cfz2[0], &cfz2[1]);
#endif #endif
for (cnt=sec->wallnum,wal=(twalltype *)&wall[sec->wallptr]; cnt>0; cnt--,wal++) for (cnt=sec->wallnum,wal=(uwalltype *)&wall[sec->wallptr]; cnt>0; cnt--,wal++)
{ {
const twalltype *const wal2 = (twalltype *)&wall[wal->point2]; const uwalltype *const wal2 = (uwalltype *)&wall[wal->point2];
const int32_t x31 = wal->x-x1, x34 = wal->x-wal2->x; const int32_t x31 = wal->x-x1, x34 = wal->x-wal2->x;
const int32_t y31 = wal->y-y1, y34 = wal->y-wal2->y; const int32_t y31 = wal->y-y1, y34 = wal->y-wal2->y;
@ -11109,7 +11109,7 @@ static int32_t hitscan_hitsectcf=-1;
// stat, heinum, z: either ceiling- or floor- // stat, heinum, z: either ceiling- or floor-
// how: -1: behave like ceiling, 1: behave like floor // how: -1: behave like ceiling, 1: behave like floor
static int32_t hitscan_trysector(const vec3_t *sv, const tsectortype *sec, hitdata_t *hit, static int32_t hitscan_trysector(const vec3_t *sv, const usectortype *sec, hitdata_t *hit,
int32_t vx, int32_t vy, int32_t vz, int32_t vx, int32_t vy, int32_t vz,
uint16_t stat, int16_t heinum, int32_t z, int32_t how, const intptr_t *tmp) uint16_t stat, int16_t heinum, int32_t z, int32_t how, const intptr_t *tmp)
{ {
@ -11118,8 +11118,8 @@ static int32_t hitscan_trysector(const vec3_t *sv, const tsectortype *sec, hitda
if (stat&2) if (stat&2)
{ {
const twalltype *const wal = (twalltype *)&wall[sec->wallptr]; const uwalltype *const wal = (uwalltype *)&wall[sec->wallptr];
const twalltype *const wal2 = (twalltype *)&wall[wal->point2]; const uwalltype *const wal2 = (uwalltype *)&wall[wal->point2];
int32_t j, dax=wal2->x-wal->x, day=wal2->y-wal->y; int32_t j, dax=wal2->x-wal->x, day=wal2->y-wal->y;
i = nsqrtasm(uhypsq(dax,day)); if (i == 0) return 1; //continue; i = nsqrtasm(uhypsq(dax,day)); if (i == 0) return 1; //continue;
@ -11154,9 +11154,9 @@ static int32_t hitscan_trysector(const vec3_t *sv, const tsectortype *sec, hitda
{ {
if (tmp==NULL) if (tmp==NULL)
{ {
if (inside(x1,y1,sec-(tsectortype *)sector) == 1) if (inside(x1,y1,sec-(usectortype *)sector) == 1)
{ {
hit_set(hit, sec-(tsectortype *)sector, -1, -1, x1, y1, z1); hit_set(hit, sec-(usectortype *)sector, -1, -1, x1, y1, z1);
hitscan_hitsectcf = (how+1)>>1; hitscan_hitsectcf = (how+1)>>1;
} }
} }
@ -11168,7 +11168,7 @@ static int32_t hitscan_trysector(const vec3_t *sv, const tsectortype *sec, hitda
if (!thislastsec) if (!thislastsec)
{ {
if (inside(x1,y1,sec-(tsectortype *)sector) == 1) if (inside(x1,y1,sec-(usectortype *)sector) == 1)
hit_set(hit, curspr->sectnum, -1, curspr-sprite, x1, y1, z1); hit_set(hit, curspr->sectnum, -1, curspr-sprite, x1, y1, z1);
} }
#ifdef HAVE_CLIPSHAPE_FEATURE #ifdef HAVE_CLIPSHAPE_FEATURE
@ -11221,7 +11221,7 @@ void get_wallspr_points(const spritetype *spr, int32_t *x1, int32_t *x2,
// x1, y1: in/out // x1, y1: in/out
// rest x/y: out // rest x/y: out
void get_floorspr_points(const tspritetype *spr, int32_t px, int32_t py, void get_floorspr_points(const uspritetype *spr, int32_t px, int32_t py,
int32_t *x1, int32_t *x2, int32_t *x3, int32_t *x4, 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 *y1, int32_t *y2, int32_t *y3, int32_t *y4)
{ {
@ -11371,8 +11371,8 @@ restart_grand:
clipspritecnt = clipspritenum = 0; clipspritecnt = clipspritenum = 0;
do do
{ {
const tsectortype *sec; const usectortype *sec;
const twalltype *wal; const uwalltype *wal;
int32_t dasector, z, startwall, endwall; int32_t dasector, z, startwall, endwall;
#ifdef HAVE_CLIPSHAPE_FEATURE #ifdef HAVE_CLIPSHAPE_FEATURE
@ -11400,7 +11400,7 @@ restart_grand:
tempshortcnt = 0; tempshortcnt = 0;
} }
#endif #endif
dasector = clipsectorlist[tempshortcnt]; sec = (tsectortype *)&sector[dasector]; dasector = clipsectorlist[tempshortcnt]; sec = (usectortype *)&sector[dasector];
i = 1; i = 1;
#ifdef HAVE_CLIPSHAPE_FEATURE #ifdef HAVE_CLIPSHAPE_FEATURE
@ -11422,10 +11422,10 @@ restart_grand:
////////// Walls ////////// ////////// Walls //////////
startwall = sec->wallptr; endwall = startwall + sec->wallnum; startwall = sec->wallptr; endwall = startwall + sec->wallnum;
for (z=startwall,wal=(twalltype *)&wall[startwall]; z<endwall; z++,wal++) for (z=startwall,wal=(uwalltype *)&wall[startwall]; z<endwall; z++,wal++)
{ {
const int32_t nextsector = wal->nextsector; const int32_t nextsector = wal->nextsector;
const twalltype *const wal2 = (twalltype *)&wall[wal->point2]; const uwalltype *const wal2 = (uwalltype *)&wall[wal->point2];
int32_t daz2, zz; int32_t daz2, zz;
if (curspr && nextsector<0) continue; if (curspr && nextsector<0) continue;
@ -11594,7 +11594,7 @@ restart_grand:
if (klabs(intx-sv->x)+klabs(inty-sv->y) > klabs((hit->pos.x)-sv->x)+klabs((hit->pos.y)-sv->y)) if (klabs(intx-sv->x)+klabs(inty-sv->y) > klabs((hit->pos.x)-sv->x)+klabs((hit->pos.y)-sv->y))
continue; continue;
get_floorspr_points((tspritetype const *)spr, intx, inty, &x1, &x2, &x3, &x4, get_floorspr_points((uspritetype const *)spr, intx, inty, &x1, &x2, &x3, &x4,
&y1, &y2, &y3, &y4); &y1, &y2, &y3, &y4);
if (get_floorspr_clipyou(x1, x2, x3, x4, y1, y2, y3, y4)) if (get_floorspr_clipyou(x1, x2, x3, x4, y1, y2, y3, y4))
@ -11690,12 +11690,12 @@ void neartag(int32_t xs, int32_t ys, int32_t zs, int16_t sectnum, int16_t ange,
const int32_t startwall = sector[dasector].wallptr; const int32_t startwall = sector[dasector].wallptr;
const int32_t endwall = startwall + sector[dasector].wallnum - 1; const int32_t endwall = startwall + sector[dasector].wallnum - 1;
const twalltype *wal; const uwalltype *wal;
int32_t z; int32_t z;
for (z=startwall,wal=(twalltype *)&wall[startwall]; z<=endwall; z++,wal++) for (z=startwall,wal=(uwalltype *)&wall[startwall]; z<=endwall; z++,wal++)
{ {
const twalltype *const wal2 = (twalltype *)&wall[wal->point2]; const uwalltype *const wal2 = (uwalltype *)&wall[wal->point2];
const int32_t nextsector = wal->nextsector; const int32_t nextsector = wal->nextsector;
const int32_t x1=wal->x, y1=wal->y, x2=wal2->x, y2=wal2->y; const int32_t x1=wal->x, y1=wal->y, x2=wal2->x, y2=wal2->y;
@ -12006,7 +12006,7 @@ void updatesector(int32_t x, int32_t y, int16_t *sectnum)
if ((unsigned)*sectnum < (unsigned)numsectors) if ((unsigned)*sectnum < (unsigned)numsectors)
{ {
const twalltype *wal = (twalltype *)&wall[sector[*sectnum].wallptr]; const uwalltype *wal = (uwalltype *)&wall[sector[*sectnum].wallptr];
int32_t j = sector[*sectnum].wallnum; int32_t j = sector[*sectnum].wallnum;
do do
@ -12066,7 +12066,7 @@ void updatesectorexclude(int32_t x, int32_t y, int16_t *sectnum, const uint8_t *
if (*sectnum >= 0 && *sectnum < numsectors) if (*sectnum >= 0 && *sectnum < numsectors)
{ {
const twalltype *wal = (twalltype *)&wall[sector[*sectnum].wallptr]; const uwalltype *wal = (uwalltype *)&wall[sector[*sectnum].wallptr];
int32_t j = sector[*sectnum].wallnum; int32_t j = sector[*sectnum].wallnum;
do do
@ -12096,7 +12096,7 @@ void updatesectorz(int32_t x, int32_t y, int32_t z, int16_t *sectnum)
if ((uint32_t)(*sectnum) < 2*MAXSECTORS) if ((uint32_t)(*sectnum) < 2*MAXSECTORS)
{ {
const twalltype *wal; const uwalltype *wal;
int32_t j, cz, fz; int32_t j, cz, fz;
int32_t nofirstzcheck = 0; int32_t nofirstzcheck = 0;
@ -12129,7 +12129,7 @@ void updatesectorz(int32_t x, int32_t y, int32_t z, int16_t *sectnum)
if (inside_p(x, y, *sectnum)) if (inside_p(x, y, *sectnum))
return; return;
wal = (twalltype *)&wall[sector[*sectnum].wallptr]; wal = (uwalltype *)&wall[sector[*sectnum].wallptr];
j = sector[*sectnum].wallnum; j = sector[*sectnum].wallnum;
do do
{ {
@ -12519,7 +12519,7 @@ restart_grand:
if ((pos->z > daz) == ((cstat&8)==0)) if ((pos->z > daz) == ((cstat&8)==0))
continue; continue;
get_floorspr_points((tspritetype const *) &sprite[j], pos->x, pos->y, &x1, &x2, &x3, &x4, get_floorspr_points((uspritetype const *) &sprite[j], pos->x, pos->y, &x1, &x2, &x3, &x4,
&y1, &y2, &y3, &y4); &y1, &y2, &y3, &y4);
vec2_t const da = { mulscale14(sintable[(sprite[j].ang - 256 + 512) & 2047], walldist + 4), vec2_t const da = { mulscale14(sintable[(sprite[j].ang - 256 + 512) & 2047], walldist + 4),
@ -13155,7 +13155,7 @@ int32_t getceilzofslopeptr(const sectortype *sec, int32_t dax, int32_t day)
if (!(sec->ceilingstat&2)) if (!(sec->ceilingstat&2))
return sec->ceilingz; return sec->ceilingz;
twalltype const *wal = (twalltype *)&wall[sec->wallptr]; uwalltype const *wal = (uwalltype *)&wall[sec->wallptr];
// floor(sqrt(2**31-1)) == 46340 // floor(sqrt(2**31-1)) == 46340
vec2_t const w = *(vec2_t *) wal; vec2_t const w = *(vec2_t *) wal;
@ -13173,7 +13173,7 @@ int32_t getflorzofslopeptr(const sectortype *sec, int32_t dax, int32_t day)
if (!(sec->floorstat&2)) if (!(sec->floorstat&2))
return sec->floorz; return sec->floorz;
twalltype const *wal = (twalltype *) &wall[sec->wallptr]; uwalltype const *wal = (uwalltype *) &wall[sec->wallptr];
vec2_t const w = *(vec2_t *) wal; vec2_t const w = *(vec2_t *) wal;
vec2_t const d ={ wall[wal->point2].x-w.x , wall[wal->point2].y-w.y }; vec2_t const d ={ wall[wal->point2].x-w.x , wall[wal->point2].y-w.y };
@ -13192,8 +13192,8 @@ void getzsofslopeptr(const sectortype *sec, int32_t dax, int32_t day, int32_t *c
if (((sec->ceilingstat|sec->floorstat)&2) != 2) if (((sec->ceilingstat|sec->floorstat)&2) != 2)
return; return;
twalltype const *wal = (twalltype *) &wall[sec->wallptr]; uwalltype const *wal = (uwalltype *) &wall[sec->wallptr];
twalltype const *wal2 = (twalltype *) &wall[wal->point2]; uwalltype const *wal2 = (uwalltype *) &wall[wal->point2];
const vec2_t d ={ wal2->x-wal->x, wal2->y-wal->y }; const vec2_t d ={ wal2->x-wal->x, wal2->y-wal->y };
int32_t const i = nsqrtasm(uhypsq(d.x,d.y))<<5; int32_t const i = nsqrtasm(uhypsq(d.x,d.y))<<5;
@ -13212,7 +13212,7 @@ void getzsofslopeptr(const sectortype *sec, int32_t dax, int32_t day, int32_t *c
// //
void alignceilslope(int16_t dasect, int32_t x, int32_t y, int32_t z) void alignceilslope(int16_t dasect, int32_t x, int32_t y, int32_t z)
{ {
const twalltype *const wal = (twalltype *)&wall[sector[dasect].wallptr]; const uwalltype *const wal = (uwalltype *)&wall[sector[dasect].wallptr];
const int32_t dax = wall[wal->point2].x-wal->x; const int32_t dax = wall[wal->point2].x-wal->x;
const int32_t day = wall[wal->point2].y-wal->y; const int32_t day = wall[wal->point2].y-wal->y;
@ -13233,7 +13233,7 @@ void alignceilslope(int16_t dasect, int32_t x, int32_t y, int32_t z)
// //
void alignflorslope(int16_t dasect, int32_t x, int32_t y, int32_t z) void alignflorslope(int16_t dasect, int32_t x, int32_t y, int32_t z)
{ {
const twalltype *const wal = (twalltype *)&wall[sector[dasect].wallptr]; const uwalltype *const wal = (uwalltype *)&wall[sector[dasect].wallptr];
const int32_t dax = wall[wal->point2].x-wal->x; const int32_t dax = wall[wal->point2].x-wal->x;
const int32_t day = wall[wal->point2].y-wal->y; const int32_t day = wall[wal->point2].y-wal->y;
@ -13278,7 +13278,7 @@ void setfirstwall(int16_t sectnum, int16_t newfirstwall)
{ {
int32_t i, j, numwallsofloop; int32_t i, j, numwallsofloop;
int32_t dagoalloop; int32_t dagoalloop;
twalltype *tmpwall; uwalltype *tmpwall;
const int32_t startwall = sector[sectnum].wallptr; const int32_t startwall = sector[sectnum].wallptr;
const int32_t danumwalls = sector[sectnum].wallnum; const int32_t danumwalls = sector[sectnum].wallnum;
@ -13287,7 +13287,7 @@ void setfirstwall(int16_t sectnum, int16_t newfirstwall)
if (newfirstwall < startwall || newfirstwall >= startwall+danumwalls) if (newfirstwall < startwall || newfirstwall >= startwall+danumwalls)
return; return;
tmpwall = (twalltype *)Xmalloc(danumwalls * sizeof(walltype)); tmpwall = (uwalltype *)Xmalloc(danumwalls * sizeof(walltype));
Bmemcpy(tmpwall, &wall[startwall], danumwalls*sizeof(walltype)); Bmemcpy(tmpwall, &wall[startwall], danumwalls*sizeof(walltype));

View file

@ -270,7 +270,7 @@ extern uint16_t ATTRIBUTE((used)) sqrtable[4096], ATTRIBUTE((used)) shlookup[409
extern int16_t thesector[MAXWALLSB], thewall[MAXWALLSB]; extern int16_t thesector[MAXWALLSB], thewall[MAXWALLSB];
extern int16_t bunchfirst[MAXWALLSB], bunchlast[MAXWALLSB]; extern int16_t bunchfirst[MAXWALLSB], bunchlast[MAXWALLSB];
extern int16_t maskwall[MAXWALLSB], maskwallcnt; extern int16_t maskwall[MAXWALLSB], maskwallcnt;
extern tspritetype *tspriteptr[MAXSPRITESONSCREEN + 1]; extern uspritetype *tspriteptr[MAXSPRITESONSCREEN + 1];
extern int32_t xdimen, xdimenrecip, halfxdimen, xdimenscale, xdimscale, ydimen; extern int32_t xdimen, xdimenrecip, halfxdimen, xdimenscale, xdimscale, ydimen;
extern float fxdimen; extern float fxdimen;
extern intptr_t frameoffset; extern intptr_t frameoffset;
@ -318,7 +318,7 @@ void calc_and_apply_fog_factor(int32_t tile, int32_t shade, int32_t vis, int32_t
extern void get_wallspr_points(const spritetype *spr, int32_t *x1, int32_t *x2, extern void get_wallspr_points(const spritetype *spr, int32_t *x1, int32_t *x2,
int32_t *y1, int32_t *y2); int32_t *y1, int32_t *y2);
extern void get_floorspr_points(const tspritetype *spr, int32_t px, int32_t py, extern void get_floorspr_points(const uspritetype *spr, int32_t px, int32_t py,
int32_t *x1, int32_t *x2, int32_t *x3, int32_t *x4, 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 *y1, int32_t *y2, int32_t *y3, int32_t *y4);
@ -340,7 +340,7 @@ int32_t animateoffs(int const tilenum);
} while (0) } while (0)
#endif #endif
FORCE_INLINE int32_t bad_tspr(const tspritetype *tspr) FORCE_INLINE int32_t bad_tspr(const uspritetype *tspr)
{ {
// NOTE: tspr->owner >= MAXSPRITES (could be model) has to be handled by // NOTE: tspr->owner >= MAXSPRITES (could be model) has to be handled by
// caller. // caller.

View file

@ -1004,7 +1004,7 @@ int32_t mdloadskin(md2model_t *m, int32_t number, int32_t pal, int32_t surf)
} }
//Note: even though it says md2model, it works for both md2model&md3model //Note: even though it says md2model, it works for both md2model&md3model
void updateanimation(md2model_t *m, const tspritetype *tspr, uint8_t lpal) void updateanimation(md2model_t *m, const uspritetype *tspr, uint8_t lpal)
{ {
const mdanim_t *anim; const mdanim_t *anim;
int32_t i, j, k; int32_t i, j, k;
@ -1972,7 +1972,7 @@ int md3postload_polymer(md3model_t *m)
} }
void md3_vox_calcmat_common(const tspritetype *tspr, const vec3f_t *a0, float f, float mat[16]) void md3_vox_calcmat_common(const uspritetype *tspr, const vec3f_t *a0, float f, float mat[16])
{ {
float g; float g;
float k0, k1, k2, k3, k4, k5, k6, k7; float k0, k1, k2, k3, k4, k5, k6, k7;
@ -2060,7 +2060,7 @@ static void md3draw_handle_triangles(const md3surf_t *s, uint16_t *indexhandle,
#endif #endif
} }
static int32_t polymost_md3draw(md3model_t *m, const tspritetype *tspr) static int32_t polymost_md3draw(md3model_t *m, const uspritetype *tspr)
{ {
vec3f_t m0, m1, a0; vec3f_t m0, m1, a0;
md3xyzn_t *v0, *v1; md3xyzn_t *v0, *v1;
@ -2690,7 +2690,7 @@ void md_allocvbos(void)
} }
#endif #endif
int32_t polymost_mddraw(const tspritetype *tspr) int32_t polymost_mddraw(const uspritetype *tspr)
{ {
#ifdef USE_GLEXT #ifdef USE_GLEXT
if (r_vbos && (r_vbocount > allocvbos)) if (r_vbos && (r_vbocount > allocvbos))

View file

@ -1460,14 +1460,14 @@ static void polymer_drawsearchplane(_prplane *plane, GLubyte *oldcolor,
void polymer_drawmaskwall(int32_t damaskwallcnt) void polymer_drawmaskwall(int32_t damaskwallcnt)
{ {
tsectortype *sec; usectortype *sec;
walltype *wal; walltype *wal;
_prwall *w; _prwall *w;
GLubyte oldcolor[4]; GLubyte oldcolor[4];
if (pr_verbosity >= 3) OSD_Printf("PR : Masked wall %i...\n", damaskwallcnt); if (pr_verbosity >= 3) OSD_Printf("PR : Masked wall %i...\n", damaskwallcnt);
sec = (tsectortype *)&sector[sectorofwall(maskwall[damaskwallcnt])]; sec = (usectortype *)&sector[sectorofwall(maskwall[damaskwallcnt])];
wal = &wall[maskwall[damaskwallcnt]]; wal = &wall[maskwall[damaskwallcnt]];
w = prwalls[maskwall[damaskwallcnt]]; w = prwalls[maskwall[damaskwallcnt]];
@ -1488,8 +1488,8 @@ void polymer_drawsprite(int32_t snum)
int32_t i, j, cs; int32_t i, j, cs;
_prsprite *s; _prsprite *s;
tspritetype *const tspr = tspriteptr[snum]; uspritetype *const tspr = tspriteptr[snum];
const tsectortype *sec; const usectortype *sec;
if (pr_verbosity >= 3) OSD_Printf("PR : Sprite %i...\n", snum); if (pr_verbosity >= 3) OSD_Printf("PR : Sprite %i...\n", snum);
@ -1504,9 +1504,9 @@ void polymer_drawsprite(int32_t snum)
DO_TILE_ANIM(tspr->picnum, tspr->owner+32768); DO_TILE_ANIM(tspr->picnum, tspr->owner+32768);
sec = (tsectortype *)&sector[tspr->sectnum]; sec = (usectortype *)&sector[tspr->sectnum];
calc_and_apply_fog(tspr->picnum, fogpal_shade(sec, tspr->shade), sec->visibility, calc_and_apply_fog(tspr->picnum, fogpal_shade(sec, tspr->shade), sec->visibility,
get_floor_fogpal((tsectortype *)&sector[tspr->sectnum])); get_floor_fogpal((usectortype *)&sector[tspr->sectnum]));
if (usemodels && tile2model[Ptile2tile(tspr->picnum,tspr->pal)].modelid >= 0 && if (usemodels && tile2model[Ptile2tile(tspr->picnum,tspr->pal)].modelid >= 0 &&
tile2model[Ptile2tile(tspr->picnum,tspr->pal)].framenum >= 0 && tile2model[Ptile2tile(tspr->picnum,tspr->pal)].framenum >= 0 &&
@ -1757,7 +1757,7 @@ int32_t polymer_havehighpalookup(int32_t basepalnum, int32_t palnum)
// CORE // CORE
static void polymer_displayrooms(const int16_t dacursectnum) static void polymer_displayrooms(const int16_t dacursectnum)
{ {
tsectortype *sec; usectortype *sec;
int32_t i; int32_t i;
int16_t bunchnum; int16_t bunchnum;
int16_t ns; int16_t ns;
@ -1770,7 +1770,7 @@ static void polymer_displayrooms(const int16_t dacursectnum)
GLfloat localprojectionmatrix[16]; GLfloat localprojectionmatrix[16];
float frustum[5 * 4]; float frustum[5 * 4];
int32_t localspritesortcnt; int32_t localspritesortcnt;
tspritetype localtsprite[MAXSPRITESONSCREEN]; uspritetype localtsprite[MAXSPRITESONSCREEN];
int16_t localmaskwall[MAXWALLSB]; int16_t localmaskwall[MAXWALLSB];
int16_t localmaskwallcnt; int16_t localmaskwallcnt;
_prmirror mirrorlist[10]; _prmirror mirrorlist[10];
@ -1817,7 +1817,7 @@ static void polymer_displayrooms(const int16_t dacursectnum)
while (front != back) while (front != back)
{ {
sec = (tsectortype *)&sector[sectorqueue[front]]; sec = (usectortype *)&sector[sectorqueue[front]];
polymer_pokesector(sectorqueue[front]); polymer_pokesector(sectorqueue[front]);
polymer_drawsector(sectorqueue[front], FALSE); polymer_drawsector(sectorqueue[front], FALSE);
@ -2542,12 +2542,12 @@ static void polymer_freeboard(void)
// SECTORS // SECTORS
static int32_t polymer_initsector(int16_t sectnum) static int32_t polymer_initsector(int16_t sectnum)
{ {
tsectortype *sec; usectortype *sec;
_prsector* s; _prsector* s;
if (pr_verbosity >= 2) OSD_Printf("PR : Initializing sector %i...\n", sectnum); if (pr_verbosity >= 2) OSD_Printf("PR : Initializing sector %i...\n", sectnum);
sec = (tsectortype *)&sector[sectnum]; sec = (usectortype *)&sector[sectnum];
s = (_prsector *)Xcalloc(1, sizeof(_prsector)); s = (_prsector *)Xcalloc(1, sizeof(_prsector));
s->verts = (GLdouble *)Xcalloc(sec->wallnum, sizeof(GLdouble) * 3); s->verts = (GLdouble *)Xcalloc(sec->wallnum, sizeof(GLdouble) * 3);
@ -2581,7 +2581,7 @@ static int32_t polymer_initsector(int16_t sectnum)
static int32_t polymer_updatesector(int16_t sectnum) static int32_t polymer_updatesector(int16_t sectnum)
{ {
_prsector* s; _prsector* s;
tsectortype *sec; usectortype *sec;
walltype *wal; walltype *wal;
int32_t i, j; int32_t i, j;
int32_t ceilz, florz; int32_t ceilz, florz;
@ -2595,7 +2595,7 @@ static int32_t polymer_updatesector(int16_t sectnum)
if (pr_nullrender >= 3) return 0; if (pr_nullrender >= 3) return 0;
s = prsectors[sectnum]; s = prsectors[sectnum];
sec = (tsectortype *)&sector[sectnum]; sec = (usectortype *)&sector[sectnum];
secangcos = secangsin = 2; secangcos = secangsin = 2;
@ -2914,13 +2914,13 @@ static int32_t polymer_buildfloor(int16_t sectnum)
{ {
// This function tesselates the floor/ceiling of a sector and stores the triangles in a display list. // This function tesselates the floor/ceiling of a sector and stores the triangles in a display list.
_prsector* s; _prsector* s;
tsectortype *sec; usectortype *sec;
intptr_t i; intptr_t i;
if (pr_verbosity >= 2) OSD_Printf("PR : Tesselating floor of sector %i...\n", sectnum); if (pr_verbosity >= 2) OSD_Printf("PR : Tesselating floor of sector %i...\n", sectnum);
s = prsectors[sectnum]; s = prsectors[sectnum];
sec = (tsectortype *)&sector[sectnum]; sec = (usectortype *)&sector[sectnum];
if (s == NULL) if (s == NULL)
return (-1); return (-1);
@ -2973,7 +2973,7 @@ static int32_t polymer_buildfloor(int16_t sectnum)
static void polymer_drawsector(int16_t sectnum, int32_t domasks) static void polymer_drawsector(int16_t sectnum, int32_t domasks)
{ {
tsectortype *sec; usectortype *sec;
_prsector* s; _prsector* s;
GLubyte oldcolor[4]; GLubyte oldcolor[4];
int32_t draw; int32_t draw;
@ -2981,7 +2981,7 @@ static void polymer_drawsector(int16_t sectnum, int32_t domasks)
if (pr_verbosity >= 3) OSD_Printf("PR : Drawing sector %i...\n", sectnum); if (pr_verbosity >= 3) OSD_Printf("PR : Drawing sector %i...\n", sectnum);
sec = (tsectortype *)&sector[sectnum]; sec = (usectortype *)&sector[sectnum];
s = prsectors[sectnum]; s = prsectors[sectnum];
queuedmask = FALSE; queuedmask = FALSE;
@ -3549,7 +3549,7 @@ static void polymer_updatewall(int16_t wallnum)
static void polymer_drawwall(int16_t sectnum, int16_t wallnum) static void polymer_drawwall(int16_t sectnum, int16_t wallnum)
{ {
tsectortype *sec; usectortype *sec;
walltype *wal; walltype *wal;
_prwall *w; _prwall *w;
GLubyte oldcolor[4]; GLubyte oldcolor[4];
@ -3557,7 +3557,7 @@ static void polymer_drawwall(int16_t sectnum, int16_t wallnum)
if (pr_verbosity >= 3) OSD_Printf("PR : Drawing wall %i...\n", wallnum); if (pr_verbosity >= 3) OSD_Printf("PR : Drawing wall %i...\n", wallnum);
sec = (tsectortype *)&sector[sectnum]; sec = (usectortype *)&sector[sectnum];
wal = &wall[wallnum]; wal = &wall[wallnum];
w = prwalls[wallnum]; w = prwalls[wallnum];
@ -3817,7 +3817,7 @@ static inline int32_t polymer_planeinfrustum(_prplane *plane, float* frustum)
return 1; return 1;
} }
static inline void polymer_scansprites(int16_t sectnum, tspritetype* localtsprite, int32_t* localspritesortcnt) static inline void polymer_scansprites(int16_t sectnum, uspritetype* localtsprite, int32_t* localspritesortcnt)
{ {
int32_t i; int32_t i;
spritetype *spr; spritetype *spr;
@ -3842,7 +3842,7 @@ void polymer_updatesprite(int32_t snum)
{ {
int32_t xsize, ysize, i, j; int32_t xsize, ysize, i, j;
int32_t tilexoff, tileyoff, xoff, yoff, centeryoff=0; int32_t tilexoff, tileyoff, xoff, yoff, centeryoff=0;
tspritetype *tspr = tspriteptr[snum]; uspritetype *tspr = tspriteptr[snum];
float xratio, yratio, ang; float xratio, yratio, ang;
float spos[3]; float spos[3];
const _prvert *inbuffer; const _prvert *inbuffer;
@ -4328,7 +4328,7 @@ static void polymer_drawskybox(int16_t tilenum, char palnum, int8_t shad
} }
// MDSPRITES // MDSPRITES
static void polymer_drawmdsprite(tspritetype *tspr) static void polymer_drawmdsprite(uspritetype *tspr)
{ {
md3model_t* m; md3model_t* m;
mdskinmap_t* sk; mdskinmap_t* sk;

View file

@ -2464,7 +2464,7 @@ void polymost_editorfunc(void)
if (spritesortcnt == MAXSPRITESONSCREEN) if (spritesortcnt == MAXSPRITESONSCREEN)
spritesortcnt--; spritesortcnt--;
tspritetype *tsp = &tsprite[spritesortcnt]; uspritetype *tsp = &tsprite[spritesortcnt];
double dadist, x, y, z; double dadist, x, y, z;
Bmemcpy(tsp, &hit->pos, sizeof(vec3_t)); Bmemcpy(tsp, &hit->pos, sizeof(vec3_t));
x = tsp->x-globalposx; y=tsp->y-globalposy; z=(tsp->z-globalposz)/16.0; x = tsp->x-globalposx; y=tsp->y-globalposy; z=(tsp->z-globalposz)/16.0;
@ -2592,7 +2592,7 @@ static void polymost_internal_nonparallaxed(vec2f_t n0, vec2f_t n1, float ryp0,
{ {
int const have_floor = sectnum & MAXSECTORS; int const have_floor = sectnum & MAXSECTORS;
sectnum &= ~MAXSECTORS; sectnum &= ~MAXSECTORS;
tsectortype const * const sec = (tsectortype *)&sector[sectnum]; usectortype const * const sec = (usectortype *)&sector[sectnum];
// comments from floor code: // comments from floor code:
//(singlobalang/-16384*(sx-ghalfx) + 0*(sy-ghoriz) + (cosviewingrangeglobalang/16384)*ghalfx)*d + globalposx = u*16 //(singlobalang/-16384*(sx-ghalfx) + 0*(sy-ghoriz) + (cosviewingrangeglobalang/16384)*ghalfx)*d + globalposx = u*16
@ -2839,7 +2839,7 @@ static void polymost_drawalls(int32_t const bunch)
drawpoly_alpha = 0.f; drawpoly_alpha = 0.f;
int32_t const sectnum = thesector[bunchfirst[bunch]]; int32_t const sectnum = thesector[bunchfirst[bunch]];
tsectortype const * const sec = (tsectortype *)&sector[sectnum]; usectortype const * const sec = (usectortype *)&sector[sectnum];
//DRAW WALLS SECTION! //DRAW WALLS SECTION!
for (int z=bunchfirst[bunch]; z>=0; z=bunchp2[z]) for (int z=bunchfirst[bunch]; z>=0; z=bunchp2[z])
@ -2851,9 +2851,9 @@ static void polymost_drawalls(int32_t const bunch)
continue; continue;
#endif #endif
twalltype * const wal = (twalltype *)&wall[wallnum], *wal2 = (twalltype *)&wall[wal->point2]; uwalltype * const wal = (uwalltype *)&wall[wallnum], *wal2 = (uwalltype *)&wall[wal->point2];
int32_t const nextsectnum = wal->nextsector; int32_t const nextsectnum = wal->nextsector;
tsectortype * const nextsec = nextsectnum>=0 ? (tsectortype *)&sector[nextsectnum] : NULL; usectortype * const nextsec = nextsectnum>=0 ? (usectortype *)&sector[nextsectnum] : NULL;
//Offset&Rotate 3D coordinates to screen 3D space //Offset&Rotate 3D coordinates to screen 3D space
vec2f_t walpos = { (float)(wal->x-globalposx), (float)(wal->y-globalposy) }; vec2f_t walpos = { (float)(wal->x-globalposx), (float)(wal->y-globalposy) };
@ -3544,12 +3544,12 @@ static void polymost_drawalls(int32_t const bunch)
} }
if (((ofy0 < fy0) || (ofy1 < fy1)) && (!((sec->floorstat&sector[nextsectnum].floorstat)&1))) if (((ofy0 < fy0) || (ofy1 < fy1)) && (!((sec->floorstat&sector[nextsectnum].floorstat)&1)))
{ {
twalltype *nwal; uwalltype *nwal;
if (!(wal->cstat&2)) nwal = wal; if (!(wal->cstat&2)) nwal = wal;
else else
{ {
nwal = (twalltype *)&wall[wal->nextwall]; nwal = (uwalltype *)&wall[wal->nextwall];
otex.u += (float)(nwal->xpanning - wal->xpanning) * otex.d; otex.u += (float)(nwal->xpanning - wal->xpanning) * otex.d;
xtex.u += (float)(nwal->xpanning - wal->xpanning) * xtex.d; xtex.u += (float)(nwal->xpanning - wal->xpanning) * xtex.d;
ytex.u += (float)(nwal->xpanning - wal->xpanning) * ytex.d; ytex.u += (float)(nwal->xpanning - wal->xpanning) * ytex.d;
@ -3672,7 +3672,7 @@ void polymost_scansector(int32_t sectnum)
for (int z=headspritesect[sectnum]; z>=0; z=nextspritesect[z]) for (int z=headspritesect[sectnum]; z>=0; z=nextspritesect[z])
{ {
tspritetype const * const spr = (tspritetype *)&sprite[z]; uspritetype const * const spr = (uspritetype *)&sprite[z];
if ((((spr->cstat&0x8000) == 0) || (showinvisibility)) && (spr->xrepeat > 0) && (spr->yrepeat > 0)) if ((((spr->cstat&0x8000) == 0) || (showinvisibility)) && (spr->xrepeat > 0) && (spr->yrepeat > 0))
{ {
@ -3697,12 +3697,12 @@ void polymost_scansector(int32_t sectnum)
int scanfirst = numscans; int scanfirst = numscans;
vec2f_t p2 = { 0, 0 }; vec2f_t p2 = { 0, 0 };
twalltype *wal; uwalltype *wal;
int z; int z;
for (z=startwall,wal=(twalltype *)&wall[z]; z<endwall; z++,wal++) for (z=startwall,wal=(uwalltype *)&wall[z]; z<endwall; z++,wal++)
{ {
twalltype const * const wal2 = (twalltype *)&wall[wal->point2]; uwalltype const * const wal2 = (uwalltype *)&wall[wal->point2];
vec2f_t const fp1 = { (float)(wal->x-globalposx), (float)(wal->y-globalposy) }; vec2f_t const fp1 = { (float)(wal->x-globalposx), (float)(wal->y-globalposy) };
vec2f_t const fp2 = { (float)(wal2->x-globalposx), (float)(wal2->y-globalposy) }; vec2f_t const fp2 = { (float)(wal2->x-globalposx), (float)(wal2->y-globalposy) };
@ -4059,15 +4059,15 @@ void polymost_drawrooms()
void polymost_drawmaskwall(int32_t damaskwallcnt) void polymost_drawmaskwall(int32_t damaskwallcnt)
{ {
int const z = maskwall[damaskwallcnt]; int const z = maskwall[damaskwallcnt];
twalltype const * const wal = (twalltype *)&wall[thewall[z]], *wal2 = (twalltype *)&wall[wal->point2]; uwalltype const * const wal = (uwalltype *)&wall[thewall[z]], *wal2 = (uwalltype *)&wall[wal->point2];
int32_t const sectnum = thesector[z]; int32_t const sectnum = thesector[z];
tsectortype const * const sec = (tsectortype *)&sector[sectnum]; usectortype const * const sec = (usectortype *)&sector[sectnum];
// if (wal->nextsector < 0) return; // if (wal->nextsector < 0) return;
// Without MASKWALL_BAD_ACCESS fix: // Without MASKWALL_BAD_ACCESS fix:
// wal->nextsector is -1, WGR2 SVN Lochwood Hollow (Til' Death L1) (or trueror1.map) // wal->nextsector is -1, WGR2 SVN Lochwood Hollow (Til' Death L1) (or trueror1.map)
tsectortype const * const nsec = (tsectortype *)&sector[wal->nextsector]; usectortype const * const nsec = (usectortype *)&sector[wal->nextsector];
globalpicnum = wal->overpicnum; globalpicnum = wal->overpicnum;
if ((uint32_t)globalpicnum >= MAXTILES) if ((uint32_t)globalpicnum >= MAXTILES)
@ -4264,10 +4264,10 @@ typedef struct
wallspriteinfo_t wsprinfo[MAXSPRITES]; wallspriteinfo_t wsprinfo[MAXSPRITES];
static inline int32_t polymost_findwall(tspritetype const * const tspr, vec2_t const * const tsiz, int32_t * rd) static inline int32_t polymost_findwall(uspritetype const * const tspr, vec2_t const * const tsiz, int32_t * rd)
{ {
int32_t dist = 4, closest = -1; int32_t dist = 4, closest = -1;
tsectortype const * const sect = (tsectortype * )&sector[tspr->sectnum]; usectortype const * const sect = (usectortype * )&sector[tspr->sectnum];
vec2_t n; vec2_t n;
for (int i=sect->wallptr; i<sect->wallptr + sect->wallnum; i++) for (int i=sect->wallptr; i<sect->wallptr + sect->wallnum; i++)
@ -4336,12 +4336,12 @@ int32_t polymost_lintersect(int32_t x1, int32_t y1, int32_t x2, int32_t y2,
void polymost_drawsprite(int32_t snum) void polymost_drawsprite(int32_t snum)
{ {
tspritetype *const tspr = tspriteptr[snum]; uspritetype *const tspr = tspriteptr[snum];
if (EDUKE32_PREDICT_FALSE(bad_tspr(tspr))) if (EDUKE32_PREDICT_FALSE(bad_tspr(tspr)))
return; return;
const tsectortype *sec; const usectortype *sec;
int32_t spritenum = tspr->owner; int32_t spritenum = tspr->owner;
@ -4372,7 +4372,7 @@ void polymost_drawsprite(int32_t snum)
drawpoly_alpha = spriteext[spritenum].alpha; drawpoly_alpha = spriteext[spritenum].alpha;
sec = (tsectortype *)&sector[tspr->sectnum]; sec = (usectortype *)&sector[tspr->sectnum];
calc_and_apply_fog(tspr->picnum, fogpal_shade(sec, globalshade), sec->visibility, get_floor_fogpal(sec)); calc_and_apply_fog(tspr->picnum, fogpal_shade(sec, globalshade), sec->visibility, get_floor_fogpal(sec));
@ -4969,7 +4969,7 @@ void polymost_dorotatespritemodel(int32_t sx, int32_t sy, int32_t z, int16_t a,
vec3f_t vec1; vec3f_t vec1;
tspritetype tspr; uspritetype tspr;
Bmemset(&tspr, 0, sizeof(spritetype)); 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

@ -896,7 +896,7 @@ voxmodel_t *voxload(const char *filnam)
} }
//Draw voxel model as perfect cubes //Draw voxel model as perfect cubes
int32_t polymost_voxdraw(voxmodel_t *m, const tspritetype *tspr) int32_t polymost_voxdraw(voxmodel_t *m, const uspritetype *tspr)
{ {
// float clut[6] = {1.02,1.02,0.94,1.06,0.98,0.98}; // float clut[6] = {1.02,1.02,0.94,1.06,0.98,0.98};
float f, g, k0; float f, g, k0;

View file

@ -99,7 +99,7 @@ void G_ClearCameraView(DukePlayer_t *ps)
} }
// Manhattan distance between wall-point and sprite. // Manhattan distance between wall-point and sprite.
static inline int32_t G_WallSpriteDist(const twalltype * const wal, const tspritetype * const spr) static inline int32_t G_WallSpriteDist(const uwalltype * const wal, const uspritetype * const spr)
{ {
return klabs(wal->x - spr->x) + klabs(wal->y - spr->y); return klabs(wal->x - spr->x) + klabs(wal->y - spr->y);
} }
@ -107,7 +107,7 @@ static inline int32_t G_WallSpriteDist(const twalltype * const wal, const tsprit
void A_RadiusDamage(int32_t i, int32_t r, int32_t hp1, int32_t hp2, int32_t hp3, int32_t hp4) void A_RadiusDamage(int32_t i, int32_t r, int32_t hp1, int32_t hp2, int32_t hp3, int32_t hp4)
{ {
int32_t d, q, stati; int32_t d, q, stati;
tspritetype const *const s = (tspritetype *)&sprite[i]; uspritetype const *const s = (uspritetype *)&sprite[i];
static const int32_t statlist[] = { static const int32_t statlist[] = {
STAT_DEFAULT, STAT_ACTOR, STAT_STANDABLE, STAT_DEFAULT, STAT_ACTOR, STAT_STANDABLE,
@ -130,7 +130,7 @@ void A_RadiusDamage(int32_t i, int32_t r, int32_t hp1, int32_t hp2, int32_t hp3,
do do
{ {
const twalltype *wal; const uwalltype *wal;
const int32_t dasect = sectorlist[sectcnt++]; const int32_t dasect = sectorlist[sectcnt++];
const int32_t startwall = sector[dasect].wallptr; const int32_t startwall = sector[dasect].wallptr;
const int32_t endwall = startwall+sector[dasect].wallnum; const int32_t endwall = startwall+sector[dasect].wallnum;
@ -140,8 +140,8 @@ void A_RadiusDamage(int32_t i, int32_t r, int32_t hp1, int32_t hp2, int32_t hp3,
// Check if "hit" 1st or 3rd wall-point. This mainly makes sense // Check if "hit" 1st or 3rd wall-point. This mainly makes sense
// for rectangular "ceiling light"-style sectors. // for rectangular "ceiling light"-style sectors.
if (G_WallSpriteDist((twalltype *)&wall[startwall], s) < r || if (G_WallSpriteDist((uwalltype *)&wall[startwall], s) < r ||
G_WallSpriteDist((twalltype *)&wall[wall[w2].point2], s) < r) G_WallSpriteDist((uwalltype *)&wall[wall[w2].point2], s) < r)
{ {
if (((sector[dasect].ceilingz-s->z)>>8) < r) if (((sector[dasect].ceilingz-s->z)>>8) < r)
Sect_DamageCeilingOrFloor(0, dasect); Sect_DamageCeilingOrFloor(0, dasect);
@ -149,7 +149,7 @@ void A_RadiusDamage(int32_t i, int32_t r, int32_t hp1, int32_t hp2, int32_t hp3,
Sect_DamageCeilingOrFloor(1, dasect); Sect_DamageCeilingOrFloor(1, dasect);
} }
for (w=startwall,wal=(twalltype *)&wall[startwall]; w<endwall; w++,wal++) for (w=startwall,wal=(uwalltype *)&wall[startwall]; w<endwall; w++,wal++)
if (G_WallSpriteDist(wal, s) < r) if (G_WallSpriteDist(wal, s) < r)
{ {
int16_t sect = -1; int16_t sect = -1;
@ -205,12 +205,12 @@ SKIPWALLCHECK:
if (s->picnum != SHRINKSPARK || (sj->cstat&257)) if (s->picnum != SHRINKSPARK || (sj->cstat&257))
if (dist(s, sj) < r) if (dist(s, sj) < r)
{ {
if (A_CheckEnemySprite((tspritetype *)sj) && !cansee(sj->x, sj->y,sj->z+q, sj->sectnum, s->x, s->y, s->z+q, s->sectnum)) if (A_CheckEnemySprite((uspritetype *)sj) && !cansee(sj->x, sj->y,sj->z+q, sj->sectnum, s->x, s->y, s->z+q, s->sectnum))
goto BOLT; goto BOLT;
A_DamageObject(j, i); A_DamageObject(j, i);
} }
} }
else if (sj->extra >= 0 && (tspritetype *)sj != s && (sj->picnum == TRIPBOMB || A_CheckEnemySprite((tspritetype *)sj) || sj->picnum == QUEBALL || sj->picnum == STRIPEBALL || (sj->cstat&257) || sj->picnum == DUKELYINGDEAD)) else if (sj->extra >= 0 && (uspritetype *)sj != s && (sj->picnum == TRIPBOMB || A_CheckEnemySprite((uspritetype *)sj) || sj->picnum == QUEBALL || sj->picnum == STRIPEBALL || (sj->cstat&257) || sj->picnum == DUKELYINGDEAD))
{ {
if (s->picnum == SHRINKSPARK && sj->picnum != SHARK && (j == s->owner || sj->xrepeat < 24)) if (s->picnum == SHRINKSPARK && sj->picnum != SHARK && (j == s->owner || sj->xrepeat < 24))
{ {
@ -304,13 +304,13 @@ BOLT:
// <spritenum>: the projectile // <spritenum>: the projectile
// <i>: the SE7 // <i>: the SE7
// <fromunderp>: below->above change? // <fromunderp>: below->above change?
static int32_t Proj_MaybeDoTransport(int32_t spritenum, const tspritetype * const effector, int32_t fromunderp, int32_t daz) static int32_t Proj_MaybeDoTransport(int32_t spritenum, const uspritetype * const effector, int32_t fromunderp, int32_t daz)
{ {
if (totalclock <= actor[spritenum].lasttransport) if (totalclock <= actor[spritenum].lasttransport)
return 0; return 0;
spritetype *const spr = &sprite[spritenum]; spritetype *const spr = &sprite[spritenum];
const tspritetype *const otherse = (tspritetype *)&sprite[effector->owner]; const uspritetype *const otherse = (uspritetype *)&sprite[effector->owner];
actor[spritenum].lasttransport = totalclock + (TICSPERFRAME<<2); actor[spritenum].lasttransport = totalclock + (TICSPERFRAME<<2);
@ -401,7 +401,7 @@ static int32_t A_CheckNeedZUpdate(int32_t spritenum, int32_t changez, int32_t *d
int32_t A_MoveSpriteClipdist(int32_t spritenum, const vec3_t *change, uint32_t cliptype, int32_t clipdist) int32_t A_MoveSpriteClipdist(int32_t spritenum, const vec3_t *change, uint32_t cliptype, int32_t clipdist)
{ {
spritetype *const spr = &sprite[spritenum]; spritetype *const spr = &sprite[spritenum];
const int32_t badguy = A_CheckEnemySprite((tspritetype *)spr); const int32_t badguy = A_CheckEnemySprite((uspritetype *)spr);
const int32_t oldx = spr->x, oldy = spr->y; const int32_t oldx = spr->x, oldy = spr->y;
if (spr->statnum == STAT_MISC || (badguy && spr->xrepeat < 4)) if (spr->statnum == STAT_MISC || (badguy && spr->xrepeat < 4))
@ -540,12 +540,12 @@ int32_t A_MoveSpriteClipdist(int32_t spritenum, const vec3_t *change, uint32_t c
if (lotag == ST_1_ABOVE_WATER) if (lotag == ST_1_ABOVE_WATER)
if (daz >= actor[spritenum].floorz) if (daz >= actor[spritenum].floorz)
if (Proj_MaybeDoTransport(spritenum, (tspritetype *)&sprite[i], 0, daz)) if (Proj_MaybeDoTransport(spritenum, (uspritetype *)&sprite[i], 0, daz))
return 0; return 0;
if (lotag == ST_2_UNDERWATER) if (lotag == ST_2_UNDERWATER)
if (daz <= actor[spritenum].ceilingz) if (daz <= actor[spritenum].ceilingz)
if (Proj_MaybeDoTransport(spritenum, (tspritetype *)&sprite[i], 1, daz)) if (Proj_MaybeDoTransport(spritenum, (uspritetype *)&sprite[i], 1, daz))
return 0; return 0;
} }
} }
@ -641,7 +641,7 @@ void A_DoGuts(int32_t sp, int32_t gtype, int32_t n)
int32_t gutz,floorz; int32_t gutz,floorz;
int32_t i,a,j,sx = 32,sy = 32; int32_t i,a,j,sx = 32,sy = 32;
tspritetype const * const s = (tspritetype *)&sprite[sp]; uspritetype const * const s = (uspritetype *)&sprite[sp];
if (A_CheckEnemySprite(s) && s->xrepeat < 16) if (A_CheckEnemySprite(s) && s->xrepeat < 16)
sx = sy = 8; sx = sy = 8;
@ -673,7 +673,7 @@ void A_DoGutsDir(int32_t sp, int32_t gtype, int32_t n)
{ {
int32_t gutz,floorz; int32_t gutz,floorz;
int32_t i,a,j,sx = 32,sy = 32; int32_t i,a,j,sx = 32,sy = 32;
tspritetype const * const s = (tspritetype *)&sprite[sp]; uspritetype const * const s = (uspritetype *)&sprite[sp];
if (A_CheckEnemySprite(s) && s->xrepeat < 16) if (A_CheckEnemySprite(s) && s->xrepeat < 16)
sx = sy = 8; sx = sy = 8;
@ -876,7 +876,7 @@ ACTOR_STATIC void G_MoveZombieActors(void)
actor[i].timetosleep++; actor[i].timetosleep++;
if (actor[i].timetosleep >= (x>>8)) if (actor[i].timetosleep >= (x>>8))
{ {
if (A_CheckEnemySprite((tspritetype *)s)) if (A_CheckEnemySprite((uspritetype *)s))
{ {
const int32_t px = g_player[p].ps->opos.x+64-(krand()&127); const int32_t px = g_player[p].ps->opos.x+64-(krand()&127);
const int32_t py = g_player[p].ps->opos.y+64-(krand()&127); const int32_t py = g_player[p].ps->opos.y+64-(krand()&127);
@ -947,7 +947,7 @@ ACTOR_STATIC void G_MoveZombieActors(void)
} }
} }
if (A_CheckEnemySprite((tspritetype *)s) && A_CheckSpriteFlags(i,SFLAG_NOSHADE) == 0) if (A_CheckEnemySprite((uspritetype *)s) && A_CheckSpriteFlags(i,SFLAG_NOSHADE) == 0)
{ {
if (sector[s->sectnum].ceilingstat&1) if (sector[s->sectnum].ceilingstat&1)
s->shade = sector[s->sectnum].ceilingshade; s->shade = sector[s->sectnum].ceilingshade;
@ -3064,7 +3064,7 @@ ACTOR_STATIC void G_MoveWeapons(void)
j &= (MAXSPRITES-1); j &= (MAXSPRITES-1);
if (s->picnum == FREEZEBLAST && sprite[j].pal == 1) if (s->picnum == FREEZEBLAST && sprite[j].pal == 1)
if (A_CheckEnemySprite((tspritetype *)&sprite[j]) || sprite[j].picnum == APLAYER) if (A_CheckEnemySprite((uspritetype *)&sprite[j]) || sprite[j].picnum == APLAYER)
{ {
j = A_Spawn(i, TRANSPORTERSTAR); j = A_Spawn(i, TRANSPORTERSTAR);
sprite[j].pal = 1; sprite[j].pal = 1;
@ -4913,7 +4913,7 @@ DETONATEB:
goto BOLT; goto BOLT;
} }
if (!g_netServer && ud.multimode < 2 && A_CheckEnemySprite((tspritetype *)s)) if (!g_netServer && ud.multimode < 2 && A_CheckEnemySprite((uspritetype *)s))
{ {
if (g_noEnemies == 1) if (g_noEnemies == 1)
{ {
@ -5598,7 +5598,7 @@ static void MaybeTrainKillEnemies(int32_t i, int32_t numguts)
{ {
const int32_t nextj = nextspritesect[j]; const int32_t nextj = nextspritesect[j];
if (sprite[j].extra >= 0 && sprite[j].statnum == STAT_ACTOR && A_CheckEnemySprite((tspritetype *)&sprite[j])) if (sprite[j].extra >= 0 && sprite[j].statnum == STAT_ACTOR && A_CheckEnemySprite((uspritetype *)&sprite[j]))
{ {
int16_t k = sprite[j].sectnum; int16_t k = sprite[j].sectnum;
@ -6564,7 +6564,7 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3
{ {
for (SPRITES_OF(STAT_ACTOR, k)) for (SPRITES_OF(STAT_ACTOR, k))
{ {
if (sprite[k].extra > 0 && A_CheckEnemySprite((tspritetype *)&sprite[k]) if (sprite[k].extra > 0 && A_CheckEnemySprite((uspritetype *)&sprite[k])
&& clipinsidebox((vec2_t *)&sprite[k], j, 256) == 1) && clipinsidebox((vec2_t *)&sprite[k], j, 256) == 1)
goto BOLT; goto BOLT;
} }
@ -7756,7 +7756,7 @@ BOLT:
if (s->lotag == SE_29_WAVES) if (s->lotag == SE_29_WAVES)
{ {
tsectortype const *const sc = (tsectortype *)&sector[s->sectnum]; usectortype const *const sc = (usectortype *)&sector[s->sectnum];
if (sc->wallnum == 4) if (sc->wallnum == 4)
{ {

View file

@ -347,7 +347,7 @@ ACTOR_INLINE_HEADER int32_t A_MoveSprite(int32_t spritenum, const vec3_t *change
EXTERN_INLINE_HEADER int32_t G_CheckForSpaceCeiling(int32_t sectnum); EXTERN_INLINE_HEADER int32_t G_CheckForSpaceCeiling(int32_t sectnum);
EXTERN_INLINE_HEADER int32_t G_CheckForSpaceFloor(int32_t sectnum); EXTERN_INLINE_HEADER int32_t G_CheckForSpaceFloor(int32_t sectnum);
EXTERN_INLINE_HEADER int32_t A_CheckEnemySprite(tspritetype const * const s); EXTERN_INLINE_HEADER int32_t A_CheckEnemySprite(uspritetype const * const s);
#ifdef __cplusplus #ifdef __cplusplus
} }
@ -392,7 +392,7 @@ EXTERN_INLINE int32_t G_CheckForSpaceFloor(int32_t sectnum)
(sector[sectnum].floorpicnum==MOONSKY1 || sector[sectnum].floorpicnum==BIGORBIT1)); (sector[sectnum].floorpicnum==MOONSKY1 || sector[sectnum].floorpicnum==BIGORBIT1));
} }
EXTERN_INLINE int32_t A_CheckEnemySprite(tspritetype const * const s) EXTERN_INLINE int32_t A_CheckEnemySprite(uspritetype const * const s)
{ {
return A_CheckEnemyTile(s->picnum); return A_CheckEnemyTile(s->picnum);
} }

View file

@ -9022,7 +9022,7 @@ static int32_t osdcmd_do(const osdfuncparm_t *parm)
if (in3dmode() && AIMING_AT_SPRITE) if (in3dmode() && AIMING_AT_SPRITE)
{ {
vm.g_i = searchwall; vm.g_i = searchwall;
vm.g_sp = (tspritetype *)&sprite[vm.g_i]; vm.g_sp = (uspritetype *)&sprite[vm.g_i];
} }
// If OSD is down, that would interfere with user input, so don't consider // If OSD is down, that would interfere with user input, so don't consider
@ -10402,7 +10402,7 @@ void ExtPreCheckKeys(void) // just before drawrooms
void ExtAnalyzeSprites(int32_t ourx, int32_t oury, int32_t oura, int32_t smoothr) void ExtAnalyzeSprites(int32_t ourx, int32_t oury, int32_t oura, int32_t smoothr)
{ {
int32_t i, k; int32_t i, k;
tspritetype *tspr; uspritetype *tspr;
int32_t frames=0, sh; int32_t frames=0, sh;
UNREFERENCED_PARAMETER(ourx); UNREFERENCED_PARAMETER(ourx);

View file

@ -1302,7 +1302,7 @@ int32_t A_InsertSprite(int16_t whatsect,int32_t s_x,int32_t s_y,int32_t s_z,int1
G_GameExit("Too many sprites spawned."); G_GameExit("Too many sprites spawned.");
} }
tspritetype spr_temp = { s_x, s_y, s_z, 0, s_pn, s_s, 0, 0, 0, s_xr, s_yr, 0, uspritetype spr_temp = { s_x, s_y, s_z, 0, s_pn, s_s, 0, 0, 0, s_xr, s_yr, 0,
0, whatsect, s_ss, s_a, s_ow, s_ve, 0, s_zv, 0, 0, 0 }; 0, whatsect, s_ss, s_a, s_ow, s_ve, 0, s_zv, 0, 0, 0 };
#ifdef DEBUGGINGAIDS #ifdef DEBUGGINGAIDS
@ -1633,7 +1633,7 @@ int32_t A_Spawn(int32_t j, int32_t pn)
{ {
sp->xrepeat = 48; sp->xrepeat = 48;
sp->yrepeat = 64; sp->yrepeat = 64;
if (sprite[j].statnum == STAT_PLAYER || A_CheckEnemySprite((tspritetype *)&sprite[j])) if (sprite[j].statnum == STAT_PLAYER || A_CheckEnemySprite((uspritetype *)&sprite[j]))
sp->z -= (32<<8); sp->z -= (32<<8);
} }
} }
@ -3345,7 +3345,7 @@ SPAWN_END:
return i; return i;
} }
static int32_t G_MaybeTakeOnFloorPal(tspritetype *datspr, int32_t sect) static int32_t G_MaybeTakeOnFloorPal(uspritetype *datspr, int32_t sect)
{ {
int32_t dapal = sector[sect].floorpal; int32_t dapal = sector[sect].floorpal;
@ -3359,7 +3359,7 @@ static int32_t G_MaybeTakeOnFloorPal(tspritetype *datspr, int32_t sect)
return 0; return 0;
} }
static int32_t getofs_viewtype5(const tspritetype *s, tspritetype *t, int32_t a, uint8_t invertp) static int32_t getofs_viewtype5(const uspritetype *s, uspritetype *t, int32_t a, uint8_t invertp)
{ {
int32_t angdif = invertp ? a-s->ang : s->ang-a; int32_t angdif = invertp ? a-s->ang : s->ang-a;
int32_t k = (((angdif+3072+128)&2047)>>8)&7; int32_t k = (((angdif+3072+128)&2047)>>8)&7;
@ -3374,7 +3374,7 @@ static int32_t getofs_viewtype5(const tspritetype *s, tspritetype *t, int32_t a,
return k; return k;
} }
static int32_t getofs_viewtype7(const tspritetype *s, tspritetype *t, int32_t a, uint8_t invertp) static int32_t getofs_viewtype7(const uspritetype *s, uspritetype *t, int32_t a, uint8_t invertp)
{ {
int32_t angdif = invertp ? a-s->ang : s->ang-a; int32_t angdif = invertp ? a-s->ang : s->ang-a;
int32_t k = ((angdif+3072+128)&2047)/170; int32_t k = ((angdif+3072+128)&2047)/170;
@ -3489,7 +3489,7 @@ void G_DoSpriteAnimations(int32_t ourx, int32_t oury, int32_t oura, int32_t smoo
#endif #endif
for (j=spritesortcnt-1; j>=0; j--) for (j=spritesortcnt-1; j>=0; j--)
{ {
tspritetype *const t = &tsprite[j]; uspritetype *const t = &tsprite[j];
const int32_t i = t->owner; const int32_t i = t->owner;
const spritetype *const s = &sprite[i]; const spritetype *const s = &sprite[i];
@ -3518,7 +3518,7 @@ void G_DoSpriteAnimations(int32_t ourx, int32_t oury, int32_t oura, int32_t smoo
for (j=spritesortcnt-1; j>=0; j--) for (j=spritesortcnt-1; j>=0; j--)
{ {
tspritetype *const t = &tsprite[j]; uspritetype *const t = &tsprite[j];
const int32_t i = t->owner; const int32_t i = t->owner;
const spritetype *const s = &sprite[i]; const spritetype *const s = &sprite[i];
@ -3576,7 +3576,7 @@ void G_DoSpriteAnimations(int32_t ourx, int32_t oury, int32_t oura, int32_t smoo
continue; continue;
default: default:
// NOTE: wall-aligned sprites will never take on ceiling/floor shade... // NOTE: wall-aligned sprites will never take on ceiling/floor shade...
if ((t->cstat&16) || (A_CheckEnemySprite((tspritetype *)t) && if ((t->cstat&16) || (A_CheckEnemySprite((uspritetype *)t) &&
(unsigned)t->owner < MAXSPRITES && sprite[t->owner].extra > 0) || t->statnum == STAT_PLAYER) (unsigned)t->owner < MAXSPRITES && sprite[t->owner].extra > 0) || t->statnum == STAT_PLAYER)
continue; continue;
} }
@ -3608,11 +3608,11 @@ void G_DoSpriteAnimations(int32_t ourx, int32_t oury, int32_t oura, int32_t smoo
int32_t startframe, viewtype; int32_t startframe, viewtype;
#endif #endif
//is the perfect time to animate sprites //is the perfect time to animate sprites
tspritetype *const t = &tsprite[j]; uspritetype *const t = &tsprite[j];
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).
tspritetype *const s = (i < 0) ? &tsprite[j] : (tspritetype *)&sprite[i]; uspritetype *const s = (i < 0) ? &tsprite[j] : (uspritetype *)&sprite[i];
if (ud.lockout && G_CheckAdultTile(DYNAMICTILEMAP(s->picnum))) if (ud.lockout && G_CheckAdultTile(DYNAMICTILEMAP(s->picnum)))
{ {
@ -3857,7 +3857,7 @@ void G_DoSpriteAnimations(int32_t ourx, int32_t oury, int32_t oura, int32_t smoo
if (ud.showweapons && sprite[g_player[p].ps->i].extra > 0 && g_player[p].ps->curr_weapon > 0 if (ud.showweapons && sprite[g_player[p].ps->i].extra > 0 && g_player[p].ps->curr_weapon > 0
&& spritesortcnt < MAXSPRITESONSCREEN) && spritesortcnt < MAXSPRITESONSCREEN)
{ {
tspritetype *const newt = &tsprite[spritesortcnt]; uspritetype *const newt = &tsprite[spritesortcnt];
int32_t curweap = g_player[p].ps->curr_weapon; int32_t curweap = g_player[p].ps->curr_weapon;
Bmemcpy(newt, t, sizeof(spritetype)); Bmemcpy(newt, t, sizeof(spritetype));
@ -3887,7 +3887,7 @@ void G_DoSpriteAnimations(int32_t ourx, int32_t oury, int32_t oura, int32_t smoo
if (g_player[p].sync->extbits & (1<<7) && !ud.pause_on && spritesortcnt<MAXSPRITESONSCREEN) if (g_player[p].sync->extbits & (1<<7) && !ud.pause_on && spritesortcnt<MAXSPRITESONSCREEN)
{ {
tspritetype *const newt = &tsprite[spritesortcnt]; uspritetype *const newt = &tsprite[spritesortcnt];
Bmemcpy(newt, t, sizeof(spritetype)); Bmemcpy(newt, t, sizeof(spritetype));
@ -4126,14 +4126,14 @@ skip:
// player has nightvision on. We should pass stuff like "from which player is this view // player has nightvision on. We should pass stuff like "from which player is this view
// supposed to be" as parameters ("drawing context") instead of relying on globals. // supposed to be" as parameters ("drawing context") instead of relying on globals.
if (g_player[screenpeek].ps->inv_amount[GET_HEATS] > 0 && g_player[screenpeek].ps->heat_on && if (g_player[screenpeek].ps->inv_amount[GET_HEATS] > 0 && g_player[screenpeek].ps->heat_on &&
(A_CheckEnemySprite((tspritetype *)s) || A_CheckSpriteFlags(t->owner,SFLAG_NVG) || s->picnum == APLAYER || s->statnum == STAT_DUMMYPLAYER)) (A_CheckEnemySprite((uspritetype *)s) || A_CheckSpriteFlags(t->owner,SFLAG_NVG) || s->picnum == APLAYER || s->statnum == STAT_DUMMYPLAYER))
{ {
t->pal = 6; t->pal = 6;
t->shade = 0; t->shade = 0;
} }
// Fake floor shadow, implemented by inserting a new tsprite. // Fake floor shadow, implemented by inserting a new tsprite.
if (s->statnum == STAT_DUMMYPLAYER || A_CheckEnemySprite((tspritetype *)s) || A_CheckSpriteFlags(t->owner,SFLAG_SHADOW) || (s->picnum == APLAYER && s->owner >= 0)) if (s->statnum == STAT_DUMMYPLAYER || A_CheckEnemySprite((uspritetype *)s) || A_CheckSpriteFlags(t->owner,SFLAG_SHADOW) || (s->picnum == APLAYER && s->owner >= 0))
if (t->statnum != TSPR_TEMP && s->picnum != EXPLOSION2 && s->picnum != HANGLIGHT && s->picnum != DOMELITE && s->picnum != HOTMEAT) if (t->statnum != TSPR_TEMP && s->picnum != EXPLOSION2 && s->picnum != HANGLIGHT && s->picnum != DOMELITE && s->picnum != HOTMEAT)
{ {
if (actor[i].dispicnum < 0) if (actor[i].dispicnum < 0)
@ -4162,7 +4162,7 @@ skip:
if ((s->z-daz) < (8<<8) && g_player[screenpeek].ps->pos.z < daz) if ((s->z-daz) < (8<<8) && g_player[screenpeek].ps->pos.z < daz)
{ {
tspritetype *const newt = &tsprite[spritesortcnt]; uspritetype *const newt = &tsprite[spritesortcnt];
Bmemcpy(newt, t, sizeof(spritetype)); Bmemcpy(newt, t, sizeof(spritetype));

View file

@ -493,7 +493,7 @@ static inline int32_t G_GetMusicIdx(const char *str)
return (ep * MAXLEVELS) + lev; return (ep * MAXLEVELS) + lev;
} }
static inline int G_GetViewscreenSizeShift(const tspritetype *tspr) static inline int G_GetViewscreenSizeShift(const uspritetype *tspr)
{ {
#if VIEWSCREENFACTOR == 0 #if VIEWSCREENFACTOR == 0
UNREFERENCED_PARAMETER(tspr); UNREFERENCED_PARAMETER(tspr);

View file

@ -260,7 +260,7 @@ static int32_t VM_CheckSquished(void)
P_DoQuote(QUOTE_SQUISHED, vm.g_pp); P_DoQuote(QUOTE_SQUISHED, vm.g_pp);
if (A_CheckEnemySprite((tspritetype *)vm.g_sp)) if (A_CheckEnemySprite((uspritetype *)vm.g_sp))
vm.g_sp->xvel = 0; vm.g_sp->xvel = 0;
if (EDUKE32_PREDICT_FALSE(vm.g_sp->pal == 1)) // frozen if (EDUKE32_PREDICT_FALSE(vm.g_sp->pal == 1)) // frozen
@ -290,7 +290,7 @@ int32_t A_Dodge(spritetype *s)
const int32_t mxvect = sintable[(s->ang+512)&2047]; const int32_t mxvect = sintable[(s->ang+512)&2047];
const int32_t myvect = sintable[s->ang&2047]; const int32_t myvect = sintable[s->ang&2047];
if (A_CheckEnemySprite((tspritetype *)s) && s->extra <= 0) // hack if (A_CheckEnemySprite((uspritetype *)s) && s->extra <= 0) // hack
return 0; return 0;
for (int32_t i=headspritestat[STAT_PROJECTILE]; i>=0; i=nextspritestat[i]) //weapons list for (int32_t i=headspritestat[STAT_PROJECTILE]; i>=0; i=nextspritestat[i]) //weapons list
@ -348,7 +348,7 @@ int32_t A_GetFurthestAngle(int32_t iActor, int32_t angs)
return furthest_angle&2047; return furthest_angle&2047;
} }
int32_t A_FurthestVisiblePoint(int32_t iActor, tspritetype * const ts, int32_t *dax, int32_t *day) int32_t A_FurthestVisiblePoint(int32_t iActor, uspritetype * const ts, int32_t *dax, int32_t *day)
{ {
if (AC_COUNT(actor[iActor].t_data)&63) if (AC_COUNT(actor[iActor].t_data)&63)
return -1; return -1;
@ -417,13 +417,13 @@ void A_GetZLimits(int32_t iActor)
if ((florhit&49152) == 49152 && (sprite[florhit&(MAXSPRITES-1)].cstat&48) == 0) if ((florhit&49152) == 49152 && (sprite[florhit&(MAXSPRITES-1)].cstat&48) == 0)
{ {
tspritetype const * const hitspr = (tspritetype *)&sprite[florhit&(MAXSPRITES-1)]; uspritetype const * const hitspr = (uspritetype *)&sprite[florhit&(MAXSPRITES-1)];
florhit &= (MAXSPRITES-1); florhit &= (MAXSPRITES-1);
// If a non-projectile would fall onto non-frozen enemy OR an enemy onto a player... // If a non-projectile would fall onto non-frozen enemy OR an enemy onto a player...
if ((A_CheckEnemySprite(hitspr) && hitspr->pal != 1 && s->statnum != STAT_PROJECTILE) if ((A_CheckEnemySprite(hitspr) && hitspr->pal != 1 && s->statnum != STAT_PROJECTILE)
|| (hitspr->picnum == APLAYER && A_CheckEnemySprite((tspritetype *)s))) || (hitspr->picnum == APLAYER && A_CheckEnemySprite((uspritetype *)s)))
{ {
actor[iActor].flags |= SFLAG_NOFLOORSHADOW; // No shadows on actors actor[iActor].flags |= SFLAG_NOFLOORSHADOW; // No shadows on actors
s->xvel = -256; // SLIDE_ABOVE_ENEMY s->xvel = -256; // SLIDE_ABOVE_ENEMY
@ -528,7 +528,7 @@ GAMEEXEC_STATIC void VM_AlterAng(int32_t movflags)
vm.g_sp->zvel += ((actor[vm.g_i].mv.vvel<<4) - vm.g_sp->zvel)/5; vm.g_sp->zvel += ((actor[vm.g_i].mv.vvel<<4) - vm.g_sp->zvel)/5;
#endif #endif
if (A_CheckEnemySprite((tspritetype *)vm.g_sp) && vm.g_sp->extra <= 0) // hack if (A_CheckEnemySprite((uspritetype *)vm.g_sp) && vm.g_sp->extra <= 0) // hack
return; return;
if (movflags&seekplayer) if (movflags&seekplayer)
@ -653,7 +653,7 @@ GAMEEXEC_STATIC void VM_Move(void)
// XXX: Does it break anything? Where are movflags with all bits set created? // XXX: Does it break anything? Where are movflags with all bits set created?
const uint16_t *movflagsptr = &AC_MOVFLAGS(vm.g_sp, &actor[vm.g_i]); const uint16_t *movflagsptr = &AC_MOVFLAGS(vm.g_sp, &actor[vm.g_i]);
const int32_t movflags = /*(*movflagsptr==-1) ? 0 :*/ *movflagsptr; const int32_t movflags = /*(*movflagsptr==-1) ? 0 :*/ *movflagsptr;
const int32_t deadflag = (A_CheckEnemySprite((tspritetype *)vm.g_sp) && vm.g_sp->extra <= 0); const int32_t deadflag = (A_CheckEnemySprite((uspritetype *)vm.g_sp) && vm.g_sp->extra <= 0);
AC_COUNT(vm.g_t)++; AC_COUNT(vm.g_t)++;
@ -721,7 +721,7 @@ dead:
if (vm.g_sp->xvel > -6 && vm.g_sp->xvel < 6) if (vm.g_sp->xvel > -6 && vm.g_sp->xvel < 6)
vm.g_sp->xvel = 0; vm.g_sp->xvel = 0;
int badguyp = A_CheckEnemySprite((tspritetype *)vm.g_sp); int badguyp = A_CheckEnemySprite((uspritetype *)vm.g_sp);
if (vm.g_sp->xvel || vm.g_sp->zvel) if (vm.g_sp->xvel || vm.g_sp->zvel)
{ {
@ -983,7 +983,7 @@ static void VM_Fall(int32_t g_i, spritetype *g_sp)
// Preliminary new z position of the actor. // Preliminary new z position of the actor.
int32_t z = actor[g_i].floorz - ZOFFSET; int32_t z = actor[g_i].floorz - ZOFFSET;
if (A_CheckEnemySprite((tspritetype *)g_sp) || (g_sp->picnum == APLAYER && g_sp->owner >= 0)) if (A_CheckEnemySprite((uspritetype *)g_sp) || (g_sp->picnum == APLAYER && g_sp->owner >= 0))
{ {
if (g_sp->zvel > 3084 && g_sp->extra <= 1) if (g_sp->zvel > 3084 && g_sp->extra <= 1)
{ {
@ -1292,7 +1292,7 @@ skip_check:
int32_t sclip = 768, angdif = 16; int32_t sclip = 768, angdif = 16;
if (A_CheckEnemySprite((tspritetype *)vm.g_sp) && vm.g_sp->xrepeat > 56) if (A_CheckEnemySprite((uspritetype *)vm.g_sp) && vm.g_sp->xrepeat > 56)
{ {
sclip = 3084; sclip = 3084;
angdif = 48; angdif = 48;
@ -1338,14 +1338,14 @@ skip_check:
case CON_IFCANSEE: case CON_IFCANSEE:
{ {
tspritetype * s = (tspritetype *)&sprite[ps->i]; uspritetype * s = (uspritetype *)&sprite[ps->i];
// select sprite for monster to target // select sprite for monster to target
// if holoduke is on, let them target holoduke first. // if holoduke is on, let them target holoduke first.
// //
if (ps->holoduke_on >= 0) if (ps->holoduke_on >= 0)
{ {
s = (tspritetype *)&sprite[ps->holoduke_on]; s = (uspritetype *)&sprite[ps->holoduke_on];
tw = cansee(vm.g_sp->x,vm.g_sp->y,vm.g_sp->z-(krand()&((32<<8)-1)),vm.g_sp->sectnum, tw = cansee(vm.g_sp->x,vm.g_sp->y,vm.g_sp->z-(krand()&((32<<8)-1)),vm.g_sp->sectnum,
s->x,s->y,s->z,s->sectnum); s->x,s->y,s->z,s->sectnum);
@ -1353,7 +1353,7 @@ skip_check:
{ {
// they can't see player's holoduke // they can't see player's holoduke
// check for player... // check for player...
s = (tspritetype *)&sprite[ps->i]; s = (uspritetype *)&sprite[ps->i];
} }
} }
@ -1413,7 +1413,7 @@ skip_check:
AC_COUNT(vm.g_t) = AC_ACTION_COUNT(vm.g_t) = AC_CURFRAME(vm.g_t) = 0; AC_COUNT(vm.g_t) = AC_ACTION_COUNT(vm.g_t) = AC_CURFRAME(vm.g_t) = 0;
if (!A_CheckEnemySprite((tspritetype *)vm.g_sp) || vm.g_sp->extra > 0) // hack if (!A_CheckEnemySprite((uspritetype *)vm.g_sp) || vm.g_sp->extra > 0) // hack
if (vm.g_sp->hitag&random_angle) if (vm.g_sp->hitag&random_angle)
vm.g_sp->ang = krand()&2047; vm.g_sp->ang = krand()&2047;
continue; continue;
@ -1813,7 +1813,7 @@ skip_check:
AC_COUNT(vm.g_t) = 0; AC_COUNT(vm.g_t) = 0;
AC_MOVE_ID(vm.g_t) = *insptr++; AC_MOVE_ID(vm.g_t) = *insptr++;
vm.g_sp->hitag = *insptr++; vm.g_sp->hitag = *insptr++;
if (A_CheckEnemySprite((tspritetype *)vm.g_sp) && vm.g_sp->extra <= 0) // hack if (A_CheckEnemySprite((uspritetype *)vm.g_sp) && vm.g_sp->extra <= 0) // hack
continue; continue;
if (vm.g_sp->hitag&random_angle) if (vm.g_sp->hitag&random_angle)
vm.g_sp->ang = krand()&2047; vm.g_sp->ang = krand()&2047;
@ -3725,7 +3725,7 @@ nullquote:
continue; continue;
case CON_IFRESPAWN: case CON_IFRESPAWN:
if (A_CheckEnemySprite((tspritetype *)vm.g_sp)) VM_CONDITIONAL(ud.respawn_monsters) if (A_CheckEnemySprite((uspritetype *)vm.g_sp)) VM_CONDITIONAL(ud.respawn_monsters)
else if (A_CheckInventorySprite(vm.g_sp)) VM_CONDITIONAL(ud.respawn_inventory) else if (A_CheckInventorySprite(vm.g_sp)) VM_CONDITIONAL(ud.respawn_inventory)
else VM_CONDITIONAL(ud.respawn_items) else VM_CONDITIONAL(ud.respawn_items)
continue; continue;
@ -5280,19 +5280,19 @@ finish_qsprintf:
case ITER_DRAWNSPRITES: case ITER_DRAWNSPRITES:
{ {
/* /*
tspritetype lastSpriteBackup; uspritetype lastSpriteBackup;
tspritetype *const lastSpritePtr = (tspritetype *) &sprite[MAXSPRITES-1]; uspritetype *const lastSpritePtr = (uspritetype *) &sprite[MAXSPRITES-1];
*/ */
// Back up sprite MAXSPRITES-1. // Back up sprite MAXSPRITES-1.
/* /*
Bmemcpy(&lastSpriteBackup, lastSpritePtr, sizeof(tspritetype)); Bmemcpy(&lastSpriteBackup, lastSpritePtr, sizeof(uspritetype));
*/ */
for (int ii=0; ii<spritesortcnt; ii++) for (int ii=0; ii<spritesortcnt; ii++)
{ {
/* /*
Bmemcpy(lastSpritePtr, &tsprite[ii], sizeof(tspritetype)); Bmemcpy(lastSpritePtr, &tsprite[ii], sizeof(uspritetype));
*/ */
Gv_SetVarX(var, ii); Gv_SetVarX(var, ii);
insptr = beg; insptr = beg;
@ -5300,13 +5300,13 @@ finish_qsprintf:
// Copy over potentially altered tsprite. // Copy over potentially altered tsprite.
/* /*
Bmemcpy(&tsprite[ii], lastSpritePtr, sizeof(tspritetype)); Bmemcpy(&tsprite[ii], lastSpritePtr, sizeof(uspritetype));
*/ */
} }
// Restore sprite MAXSPRITES-1. // Restore sprite MAXSPRITES-1.
/* /*
Bmemcpy(lastSpritePtr, &lastSpriteBackup, sizeof(tspritetype)); Bmemcpy(lastSpritePtr, &lastSpriteBackup, sizeof(uspritetype));
*/ */
break; break;
} }
@ -5701,7 +5701,7 @@ void A_Execute(int32_t iActor, int32_t iPlayer, int32_t lDist)
if (EDUKE32_PREDICT_FALSE((unsigned)vm.g_sp->sectnum >= MAXSECTORS)) if (EDUKE32_PREDICT_FALSE((unsigned)vm.g_sp->sectnum >= MAXSECTORS))
{ {
if (A_CheckEnemySprite((tspritetype *)vm.g_sp)) if (A_CheckEnemySprite((uspritetype *)vm.g_sp))
vm.g_pp->actors_killed++; vm.g_pp->actors_killed++;
A_DeleteSprite(vm.g_i); A_DeleteSprite(vm.g_i);
@ -5798,7 +5798,7 @@ void A_Execute(int32_t iActor, int32_t iPlayer, int32_t lDist)
return; return;
} }
if (A_CheckEnemySprite((tspritetype *)vm.g_sp)) if (A_CheckEnemySprite((uspritetype *)vm.g_sp))
{ {
if (vm.g_sp->xrepeat > 60 || (ud.respawn_monsters == 1 && vm.g_sp->extra <= 0)) if (vm.g_sp->xrepeat > 60 || (ud.respawn_monsters == 1 && vm.g_sp->extra <= 0))
return; return;

View file

@ -49,7 +49,7 @@ void A_LoadActor(int32_t iActor);
void A_Execute(int32_t iActor, int32_t iPlayer, int32_t lDist); void A_Execute(int32_t iActor, int32_t iPlayer, int32_t lDist);
void A_Fall(int32_t iActor); void A_Fall(int32_t iActor);
int32_t A_FurthestVisiblePoint(int32_t iActor,tspritetype * const ts,int32_t *dax,int32_t *day); int32_t A_FurthestVisiblePoint(int32_t iActor,uspritetype * const ts,int32_t *dax,int32_t *day);
int32_t A_GetFurthestAngle(int32_t iActor,int32_t angs); int32_t A_GetFurthestAngle(int32_t iActor,int32_t angs);
void A_GetZLimits(int32_t iActor); void A_GetZLimits(int32_t iActor);
int32_t G_GetAngleDelta(int32_t a,int32_t na); int32_t G_GetAngleDelta(int32_t a,int32_t na);

View file

@ -1167,7 +1167,7 @@ int32_t __fastcall VM_GetTsprite(register int32_t const iActor, register int32_t
return -1; return -1;
} }
tspritetype * const tspr = spriteext[iActor].tspr; uspritetype * const tspr = spriteext[iActor].tspr;
if (EDUKE32_PREDICT_FALSE(!tspr)) if (EDUKE32_PREDICT_FALSE(!tspr))
{ {
@ -1216,7 +1216,7 @@ void __fastcall VM_SetTsprite(register int32_t const iActor, register int32_t co
return; return;
} }
tspritetype * const tspr = spriteext[iActor].tspr; uspritetype * const tspr = spriteext[iActor].tspr;
if (EDUKE32_PREDICT_FALSE(!tspr)) if (EDUKE32_PREDICT_FALSE(!tspr))
{ {

View file

@ -254,9 +254,9 @@ struct {
ffi.cdef([[ ffi.cdef([[
typedef $ sectortype; typedef $ sectortype;
typedef $ walltype; typedef $ walltype;
// NOTE: spritetype and tspritetype are different types with the same data members. // NOTE: spritetype and uspritetype are different types with the same data members.
typedef $ spritetype; typedef $ spritetype;
typedef struct { spritetype; } tspritetype; typedef struct { spritetype; } uspritetype;
typedef struct { typedef struct {
int32_t x, y; int32_t x, y;
@ -326,7 +326,7 @@ if (ffiC.engine_main_arrays_are_static ~= 0) then
sectortype sector[]; sectortype sector[];
walltype wall[]; walltype wall[];
spritetype sprite[]; spritetype sprite[];
tspritetype tsprite[]; uspritetype tsprite[];
spriteext_t spriteext[]; spriteext_t spriteext[];
]] ]]
else else
@ -334,7 +334,7 @@ else
sectortype *sector; sectortype *sector;
walltype *wall; walltype *wall;
spritetype *sprite; spritetype *sprite;
tspritetype *tsprite; uspritetype *tsprite;
spriteext_t *spriteext; spriteext_t *spriteext;
]] ]]
end end
@ -673,8 +673,8 @@ local spriteext_mt = {
ffi.metatype("spriteext_t", spriteext_mt) ffi.metatype("spriteext_t", spriteext_mt)
local spritetype_ptr_ct = ffi.typeof("$ *", ffi.typeof(strip_const(SPRITE_STRUCT))) local spritetype_ptr_ct = ffi.typeof("$ *", ffi.typeof(strip_const(SPRITE_STRUCT)))
-- NOTE: this is the *protected* tspritetype pointer. -- NOTE: this is the *protected* uspritetype pointer.
local tspritetype_ptr_ct = ffi.typeof("$ *", ffi.typeof("tspritetype")) local tspritetype_ptr_ct = ffi.typeof("$ *", ffi.typeof("uspritetype"))
local intarg = ffi.new("int32_t[1]") local intarg = ffi.new("int32_t[1]")
@ -841,7 +841,7 @@ function finish_spritetype(mt_index)
tspritetype_mt.__index[name] = func tspritetype_mt.__index[name] = func
end end
ffi.metatype("spritetype", spritetype_mt) ffi.metatype("spritetype", spritetype_mt)
ffi.metatype("tspritetype", tspritetype_mt) ffi.metatype("uspritetype", tspritetype_mt)
end end

View file

@ -111,7 +111,7 @@ typedef struct {
// VM state: either ==0 (top-level), >=1 and < MAXEVENTS+1 (event), // VM state: either ==0 (top-level), >=1 and < MAXEVENTS+1 (event),
// or >= MAXEVENTS+1 and < MAXEVENTS+1+g_stateCount (state) // or >= MAXEVENTS+1 and < MAXEVENTS+1+g_stateCount (state)
int32_t g_st; int32_t g_st;
tspritetype *g_sp; uspritetype *g_sp;
uint32_t flags; //g_errorFlag, g_returnFlag; uint32_t flags; //g_errorFlag, g_returnFlag;
// 1:updatehighlight, 2:updatehighlightsector, 4:interactive (from menu)? // 1:updatehighlight, 2:updatehighlightsector, 4:interactive (from menu)?

View file

@ -157,7 +157,7 @@ void VM_OnEvent(register int32_t iEventID, register int32_t iActor)
vm.g_i = iActor; // current sprite ID vm.g_i = iActor; // current sprite ID
if (vm.g_i >= 0) if (vm.g_i >= 0)
vm.g_sp = (tspritetype *)&sprite[vm.g_i]; vm.g_sp = (uspritetype *)&sprite[vm.g_i];
vm.g_st = 1+iEventID; vm.g_st = 1+iEventID;
@ -241,7 +241,7 @@ static int X_DoSort(const void *lv, const void *rv)
// in interactive execution, allow the current sprite index to be the aimed-at sprite (in 3d mode) // in interactive execution, allow the current sprite index to be the aimed-at sprite (in 3d mode)
#define X_ERROR_INVALIDCI() \ #define X_ERROR_INVALIDCI() \
if ((vm.g_i < 0 || vm.g_i >= MAXSPRITES) && \ if ((vm.g_i < 0 || vm.g_i >= MAXSPRITES) && \
(vm.g_st != 0 || searchstat != 3 || (vm.g_i = searchwall, vm.g_sp = (tspritetype *)&sprite[vm.g_i], 0))) \ (vm.g_st != 0 || searchstat != 3 || (vm.g_i = searchwall, vm.g_sp = (uspritetype *)&sprite[vm.g_i], 0))) \
{ \ { \
M32_ERROR("Current sprite index invalid!"); \ M32_ERROR("Current sprite index invalid!"); \
continue; \ continue; \
@ -262,7 +262,7 @@ static int X_DoSort(const void *lv, const void *rv)
} }
#define X_ERROR_INVALIDSP() \ #define X_ERROR_INVALIDSP() \
if (!vm.g_sp && (vm.g_st != 0 || searchstat != 3 || (vm.g_sp = (tspritetype *)&sprite[searchwall], 0))) \ if (!vm.g_sp && (vm.g_st != 0 || searchstat != 3 || (vm.g_sp = (uspritetype *)&sprite[searchwall], 0))) \
{ \ { \
M32_ERROR("Current sprite invalid!"); \ M32_ERROR("Current sprite invalid!"); \
continue; \ continue; \
@ -1271,7 +1271,7 @@ skip_check:
const int32_t parm2 = how<=ITER_DRAWNSPRITES ? 0 : Gv_GetVarX(*insptr++); const int32_t parm2 = how<=ITER_DRAWNSPRITES ? 0 : Gv_GetVarX(*insptr++);
instype *const end = insptr + *insptr, *const beg = ++insptr; instype *const end = insptr + *insptr, *const beg = ++insptr;
const int32_t vm_i_bak = vm.g_i; const int32_t vm_i_bak = vm.g_i;
tspritetype *const vm_sp_bak = vm.g_sp; uspritetype *const vm_sp_bak = vm.g_sp;
if (vm.flags&VMFLAG_ERROR) if (vm.flags&VMFLAG_ERROR)
continue; continue;
@ -1285,7 +1285,7 @@ skip_check:
continue; continue;
Gv_SetVarX(var, jj); Gv_SetVarX(var, jj);
vm.g_i = jj; vm.g_i = jj;
vm.g_sp = (tspritetype *)&sprite[jj]; vm.g_sp = (uspritetype *)&sprite[jj];
insptr = beg; insptr = beg;
VM_Execute(1); VM_Execute(1);
} }
@ -1331,7 +1331,7 @@ skip_check:
jj &= (MAXSPRITES-1); jj &= (MAXSPRITES-1);
Gv_SetVarX(var, jj); Gv_SetVarX(var, jj);
vm.g_i = jj; vm.g_i = jj;
vm.g_sp = (tspritetype *)&sprite[jj]; vm.g_sp = (uspritetype *)&sprite[jj];
insptr = beg; insptr = beg;
VM_Execute(1); VM_Execute(1);
} }
@ -1359,27 +1359,27 @@ skip_check:
break; break;
case ITER_DRAWNSPRITES: case ITER_DRAWNSPRITES:
{ {
tspritetype lastSpriteBackup; uspritetype lastSpriteBackup;
tspritetype *const lastSpritePtr = (tspritetype *)&sprite[MAXSPRITES-1]; uspritetype *const lastSpritePtr = (uspritetype *)&sprite[MAXSPRITES-1];
// Back up sprite MAXSPRITES-1. // Back up sprite MAXSPRITES-1.
Bmemcpy(&lastSpriteBackup, lastSpritePtr, sizeof(tspritetype)); Bmemcpy(&lastSpriteBackup, lastSpritePtr, sizeof(uspritetype));
for (int ii=0; ii<spritesortcnt && !vm.flags; ii++) for (int ii=0; ii<spritesortcnt && !vm.flags; ii++)
{ {
vm.g_sp = lastSpritePtr; vm.g_sp = lastSpritePtr;
Bmemcpy(lastSpritePtr, &tsprite[ii], sizeof(tspritetype)); Bmemcpy(lastSpritePtr, &tsprite[ii], sizeof(uspritetype));
Gv_SetVarX(var, ii); Gv_SetVarX(var, ii);
insptr = beg; insptr = beg;
VM_Execute(1); VM_Execute(1);
// Copy over potentially altered tsprite. // Copy over potentially altered tsprite.
Bmemcpy(&tsprite[ii], lastSpritePtr, sizeof(tspritetype)); Bmemcpy(&tsprite[ii], lastSpritePtr, sizeof(uspritetype));
} }
// Restore sprite MAXSPRITES-1. // Restore sprite MAXSPRITES-1.
Bmemcpy(lastSpritePtr, &lastSpriteBackup, sizeof(tspritetype)); Bmemcpy(lastSpritePtr, &lastSpriteBackup, sizeof(uspritetype));
break; break;
} }
case ITER_SPRITESOFSECTOR: case ITER_SPRITESOFSECTOR:
@ -1389,7 +1389,7 @@ skip_check:
{ {
Gv_SetVarX(var, jj); Gv_SetVarX(var, jj);
vm.g_i = jj; vm.g_i = jj;
vm.g_sp = (tspritetype *)&sprite[jj]; vm.g_sp = (uspritetype *)&sprite[jj];
insptr = beg; insptr = beg;
VM_Execute(1); VM_Execute(1);
} }
@ -1701,7 +1701,7 @@ badindex:
ret = insertsprite(dasectnum, 0); ret = insertsprite(dasectnum, 0);
vm.g_i = ret; vm.g_i = ret;
vm.g_sp = (tspritetype *)&sprite[ret]; vm.g_sp = (uspritetype *)&sprite[ret];
} }
continue; continue;
@ -1736,7 +1736,7 @@ badindex:
Bmemcpy(&sprite[nspritenum], &sprite[ospritenum], sizeof(spritetype)); Bmemcpy(&sprite[nspritenum], &sprite[ospritenum], sizeof(spritetype));
vm.g_i = nspritenum; vm.g_i = nspritenum;
vm.g_sp = (tspritetype *)&sprite[nspritenum]; vm.g_sp = (uspritetype *)&sprite[nspritenum];
} }
else else
{ {
@ -2833,7 +2833,7 @@ dodefault:
newcurspritei = Gv_GetVarX(*insptr++); newcurspritei = Gv_GetVarX(*insptr++);
X_ERROR_INVALIDSPRI(newcurspritei); X_ERROR_INVALIDSPRI(newcurspritei);
vm.g_i = newcurspritei; vm.g_i = newcurspritei;
vm.g_sp = (tspritetype *)&sprite[vm.g_i]; vm.g_sp = (uspritetype *)&sprite[vm.g_i];
continue; continue;
} }

View file

@ -388,7 +388,7 @@ static int32_t __fastcall VM_AccessTsprite(int32_t how, int32_t lVar1, int32_t l
{ {
int32_t lightp = (lLabelID >= LIGHT_X); int32_t lightp = (lLabelID >= LIGHT_X);
int32_t i = (how&ACCESS_USEVARS) ? vm.g_i : lVar1; int32_t i = (how&ACCESS_USEVARS) ? vm.g_i : lVar1;
tspritetype *datspr = NULL; uspritetype *datspr = NULL;
const memberlabel_t *dalabel = lightp ? &LightLabels[lLabelID-LIGHT_X] : &SpriteLabels[lLabelID]; const memberlabel_t *dalabel = lightp ? &LightLabels[lLabelID-LIGHT_X] : &SpriteLabels[lLabelID];
if ((how&ACCESS_USEVARS) && lVar1 != M32_THISACTOR_VAR_ID) if ((how&ACCESS_USEVARS) && lVar1 != M32_THISACTOR_VAR_ID)

View file

@ -258,9 +258,9 @@ static int32_t A_FindTargetSprite(const spritetype *s, int32_t aang, int32_t atw
break; break;
for (i=headspritestat[aimstats[k]]; i >= 0; i=nextspritestat[i]) for (i=headspritestat[aimstats[k]]; i >= 0; i=nextspritestat[i])
if (sprite[i].xrepeat > 0 && sprite[i].extra >= 0 && (sprite[i].cstat&(257+32768)) == 257) if (sprite[i].xrepeat > 0 && sprite[i].extra >= 0 && (sprite[i].cstat&(257+32768)) == 257)
if (A_CheckEnemySprite((tspritetype *)&sprite[i]) || k < 2) if (A_CheckEnemySprite((uspritetype *)&sprite[i]) || k < 2)
{ {
if (A_CheckEnemySprite((tspritetype *)&sprite[i]) || PN == APLAYER || PN == SHARK) if (A_CheckEnemySprite((uspritetype *)&sprite[i]) || PN == APLAYER || PN == SHARK)
{ {
if (PN == APLAYER && s->picnum == APLAYER && s != &sprite[i] && if (PN == APLAYER && s->picnum == APLAYER && s != &sprite[i] &&
// ud.ffire == 0 && // ud.ffire == 0 &&
@ -602,7 +602,7 @@ static int32_t SectorContainsSE13(int32_t sectnum)
// (in that case walltype *hitwal may be stale) // (in that case walltype *hitwal may be stale)
static inline void HandleHitWall(hitdata_t *hit) static inline void HandleHitWall(hitdata_t *hit)
{ {
twalltype const * const hitwal = (twalltype *)&wall[hit->wall]; uwalltype const * const hitwal = (uwalltype *)&wall[hit->wall];
if ((hitwal->cstat&2) && redwallp(hitwal)) if ((hitwal->cstat&2) && redwallp(hitwal))
if (hit->pos.z >= sector[hitwal->nextsector].floorz) if (hit->pos.z >= sector[hitwal->nextsector].floorz)
@ -692,7 +692,7 @@ static int32_t P_PostFireHitscan(int32_t p, int32_t k, hitdata_t *hit, int32_t i
} }
else if (hit->wall >= 0) else if (hit->wall >= 0)
{ {
twalltype const * const hitwal = (twalltype *)&wall[hit->wall]; uwalltype const * const hitwal = (uwalltype *)&wall[hit->wall];
Proj_MaybeSpawn(k, spawnatimpacttile, hit); Proj_MaybeSpawn(k, spawnatimpacttile, hit);
@ -800,7 +800,7 @@ static int32_t Proj_CheckBlood(const vec3_t *srcvect, const hitdata_t *hit,
if (hit->wall < 0 || hit->sect < 0) if (hit->wall < 0 || hit->sect < 0)
return 0; return 0;
twalltype const * const hitwal = (twalltype *)&wall[hit->wall]; uwalltype const * const hitwal = (uwalltype *)&wall[hit->wall];
if (FindDistance2D(srcvect->x-hit->pos.x, srcvect->y-hit->pos.y) < projrange) if (FindDistance2D(srcvect->x-hit->pos.x, srcvect->y-hit->pos.y) < projrange)
if (hitwal->overpicnum != BIGFORCE && (hitwal->cstat&16) == 0) if (hitwal->overpicnum != BIGFORCE && (hitwal->cstat&16) == 0)
@ -978,7 +978,7 @@ static int32_t A_ShootCustom(const int32_t i, const int32_t atwith, int16_t sa,
l = safeldist(g_player[j].ps->i, s); l = safeldist(g_player[j].ps->i, s);
zvel = tabledivide32_noinline((g_player[j].ps->opos.z - srcvect->z)*vel, l); zvel = tabledivide32_noinline((g_player[j].ps->opos.z - srcvect->z)*vel, l);
if (A_CheckEnemySprite((tspritetype *)s) && (AC_MOVFLAGS(s, &actor[i]) & face_player_smart)) if (A_CheckEnemySprite((uspritetype *)s) && (AC_MOVFLAGS(s, &actor[i]) & face_player_smart))
sa = s->ang + (krand() & 31) - 16; sa = s->ang + (krand() & 31) - 16;
} }
} }
@ -1067,7 +1067,7 @@ static int32_t A_ShootCustom(const int32_t i, const int32_t atwith, int16_t sa,
if (Proj_CheckBlood(srcvect, &hit, proj->range, if (Proj_CheckBlood(srcvect, &hit, proj->range,
mulscale3(proj->yrepeat, tilesiz[proj->decal].y) << 8)) mulscale3(proj->yrepeat, tilesiz[proj->decal].y) << 8))
{ {
const twalltype *const hitwal = (twalltype *)&wall[hit.wall]; const uwalltype *const hitwal = (uwalltype *)&wall[hit.wall];
if (FindDistance2D(hitwal->x - wall[hitwal->point2].x, hitwal->y - wall[hitwal->point2].y) > if (FindDistance2D(hitwal->x - wall[hitwal->point2].x, hitwal->y - wall[hitwal->point2].y) >
(mulscale3(proj->xrepeat + 8, tilesiz[proj->decal].x))) (mulscale3(proj->xrepeat + 8, tilesiz[proj->decal].x)))
@ -1162,7 +1162,7 @@ static int32_t A_ShootHardcoded(int32_t i, int32_t atwith, int16_t sa, vec3_t sr
{ {
if (Proj_CheckBlood(&srcvect, &hit, 1024, 16<<8)) if (Proj_CheckBlood(&srcvect, &hit, 1024, 16<<8))
{ {
const twalltype *const hitwal = (twalltype *)&wall[hit.wall]; const uwalltype *const hitwal = (uwalltype *)&wall[hit.wall];
if (SectorContainsSE13(hitwal->nextsector)) if (SectorContainsSE13(hitwal->nextsector))
return -1; return -1;
@ -1386,7 +1386,7 @@ static int32_t A_ShootHardcoded(int32_t i, int32_t atwith, int16_t sa, vec3_t sr
l = safeldist(g_player[j].ps->i, s); l = safeldist(g_player[j].ps->i, s);
zvel = tabledivide32_noinline((g_player[j].ps->opos.z - srcvect.z)*vel, l); zvel = tabledivide32_noinline((g_player[j].ps->opos.z - srcvect.z)*vel, l);
if (A_CheckEnemySprite((tspritetype *)s) && (AC_MOVFLAGS(s, &actor[i]) & face_player_smart)) if (A_CheckEnemySprite((uspritetype *)s) && (AC_MOVFLAGS(s, &actor[i]) & face_player_smart))
sa = s->ang+(krand()&31)-16; sa = s->ang+(krand()&31)-16;
} }
@ -1636,7 +1636,7 @@ int32_t A_ShootWithZvel(int32_t i, int32_t atwith, int32_t override_zvel)
{ {
srcvect.z -= (7<<8); srcvect.z -= (7<<8);
if (A_CheckEnemySprite((tspritetype *)s) && PN != COMMANDER) if (A_CheckEnemySprite((uspritetype *)s) && PN != COMMANDER)
{ {
srcvect.x += (sintable[(sa+1024+96)&2047]>>7); srcvect.x += (sintable[(sa+1024+96)&2047]>>7);
srcvect.y += (sintable[(sa+512+96)&2047]>>7); srcvect.y += (sintable[(sa+512+96)&2047]>>7);
@ -4587,7 +4587,7 @@ void P_ProcessInput(int32_t snum)
p->sbs = j; p->sbs = j;
} }
} }
else if (A_CheckEnemySprite((tspritetype *)&sprite[j]) && sprite[j].xrepeat > 24 && klabs(s->z-sprite[j].z) < (84<<8)) else if (A_CheckEnemySprite((uspritetype *)&sprite[j]) && sprite[j].xrepeat > 24 && klabs(s->z-sprite[j].z) < (84<<8))
{ {
// TX: I think this is what makes the player slide off enemies... might // TX: I think this is what makes the player slide off enemies... might
// be a good sprite flag to add later. // be a good sprite flag to add later.
@ -5567,7 +5567,7 @@ HORIZONLY:
break; break;
} }
default: default:
if (A_CheckEnemySprite((tspritetype *)&sprite[p->actorsqu])) if (A_CheckEnemySprite((uspritetype *)&sprite[p->actorsqu]))
p->actors_killed++; p->actors_killed++;
A_DeleteSprite(p->actorsqu); A_DeleteSprite(p->actorsqu);
break; break;

View file

@ -71,7 +71,7 @@ static void G_CacheSpriteNum(int32_t i)
char maxc; char maxc;
int32_t j; int32_t j;
if (ud.monsters_off && A_CheckEnemySprite((tspritetype *)&sprite[i])) return; if (ud.monsters_off && A_CheckEnemySprite((uspritetype *)&sprite[i])) return;
maxc = 1; maxc = 1;

View file

@ -315,7 +315,7 @@ static void G_DrawOverheadMap(int32_t cposx, int32_t cposy, int32_t czoom, int16
int32_t xvect, yvect, xvect2, yvect2; int32_t xvect, yvect, xvect2, yvect2;
int16_t p; int16_t p;
char col; char col;
twalltype *wal, *wal2; uwalltype *wal, *wal2;
spritetype *spr; spritetype *spr;
int32_t tmpydim = (xdim*5)/8; int32_t tmpydim = (xdim*5)/8;
@ -340,7 +340,7 @@ static void G_DrawOverheadMap(int32_t cposx, int32_t cposy, int32_t czoom, int16
z1 = sector[i].ceilingz; z1 = sector[i].ceilingz;
z2 = sector[i].floorz; z2 = sector[i].floorz;
for (j=startwall, wal=(twalltype *)&wall[startwall]; j<endwall; j++, wal++) for (j=startwall, wal=(uwalltype *)&wall[startwall]; j<endwall; j++, wal++)
{ {
k = wal->nextwall; k = wal->nextwall;
if (k < 0) continue; if (k < 0) continue;
@ -361,7 +361,7 @@ static void G_DrawOverheadMap(int32_t cposx, int32_t cposy, int32_t czoom, int16
x1 = dmulscale16(ox, xvect, -oy, yvect)+(xdim<<11); x1 = dmulscale16(ox, xvect, -oy, yvect)+(xdim<<11);
y1 = dmulscale16(oy, xvect2, ox, yvect2)+(ydim<<11); y1 = dmulscale16(oy, xvect2, ox, yvect2)+(ydim<<11);
wal2 = (twalltype *)&wall[wal->point2]; wal2 = (uwalltype *)&wall[wal->point2];
ox = wal2->x-cposx; ox = wal2->x-cposx;
oy = wal2->y-cposy; oy = wal2->y-cposy;
x2 = dmulscale16(ox, xvect, -oy, yvect)+(xdim<<11); x2 = dmulscale16(ox, xvect, -oy, yvect)+(xdim<<11);
@ -529,7 +529,7 @@ static void G_DrawOverheadMap(int32_t cposx, int32_t cposy, int32_t czoom, int16
endwall = sector[i].wallptr + sector[i].wallnum; endwall = sector[i].wallptr + sector[i].wallnum;
k = -1; k = -1;
for (j=startwall, wal=(twalltype *)&wall[startwall]; j<endwall; j++, wal++) for (j=startwall, wal=(uwalltype *)&wall[startwall]; j<endwall; j++, wal++)
{ {
if (wal->nextwall >= 0) continue; if (wal->nextwall >= 0) continue;
@ -550,7 +550,7 @@ static void G_DrawOverheadMap(int32_t cposx, int32_t cposy, int32_t czoom, int16
} }
k = wal->point2; k = wal->point2;
wal2 = (twalltype *)&wall[k]; wal2 = (uwalltype *)&wall[k];
ox = wal2->x-cposx; ox = wal2->x-cposx;
oy = wal2->y-cposy; oy = wal2->y-cposy;
x2 = dmulscale16(ox, xvect, -oy, yvect)+(xdim<<11); x2 = dmulscale16(ox, xvect, -oy, yvect)+(xdim<<11);

View file

@ -400,7 +400,7 @@ void G_AnimateCamSprite(int32_t smoothratio)
if (OW >= 0 && dist(&sprite[ps->i], &sprite[i]) < VIEWSCREEN_ACTIVE_DISTANCE) if (OW >= 0 && dist(&sprite[ps->i], &sprite[i]) < VIEWSCREEN_ACTIVE_DISTANCE)
{ {
const int viewscrShift = G_GetViewscreenSizeShift((const tspritetype *)&sprite[i]); const int viewscrShift = G_GetViewscreenSizeShift((const uspritetype *)&sprite[i]);
const int viewscrTile = TILE_VIEWSCR-viewscrShift; const int viewscrTile = TILE_VIEWSCR-viewscrShift;
if (waloff[viewscrTile] == 0) if (waloff[viewscrTile] == 0)
@ -2260,7 +2260,7 @@ void A_DamageObject(int32_t i,int32_t sn)
if ((sprite[sn].picnum == FREEZEBLAST || sprite[sn].owner != i) && sprite[i].statnum != STAT_PROJECTILE) if ((sprite[sn].picnum == FREEZEBLAST || sprite[sn].owner != i) && sprite[i].statnum != STAT_PROJECTILE)
{ {
if (A_CheckEnemySprite((tspritetype *)&sprite[i]) == 1) if (A_CheckEnemySprite((uspritetype *)&sprite[i]) == 1)
{ {
if (sprite[sn].picnum == RPG) if (sprite[sn].picnum == RPG)
sprite[sn].extra <<= 1; sprite[sn].extra <<= 1;
@ -2877,7 +2877,7 @@ int32_t A_CheckHitSprite(int32_t i, int16_t *hitsp)
hitdata_t hit; hitdata_t hit;
int32_t zoff = 0; int32_t zoff = 0;
if (A_CheckEnemySprite((tspritetype *) &sprite[i])) if (A_CheckEnemySprite((uspritetype *) &sprite[i]))
zoff = (42<<8); zoff = (42<<8);
else if (PN == APLAYER) else if (PN == APLAYER)
zoff = (39<<8); zoff = (39<<8);
@ -2892,7 +2892,7 @@ int32_t A_CheckHitSprite(int32_t i, int16_t *hitsp)
if (hitsp) if (hitsp)
*hitsp = hit.sprite; *hitsp = hit.sprite;
if (hit.wall >= 0 && (wall[hit.wall].cstat&16) && A_CheckEnemySprite((tspritetype *) &sprite[i])) if (hit.wall >= 0 && (wall[hit.wall].cstat&16) && A_CheckEnemySprite((uspritetype *) &sprite[i]))
return 1<<30; return 1<<30;
return FindDistance2D(hit.pos.x-SX,hit.pos.y-SY); return FindDistance2D(hit.pos.x-SX,hit.pos.y-SY);

View file

@ -80,10 +80,10 @@ typedef struct {
actor_t actor[MAXSPRITES]; actor_t actor[MAXSPRITES];
playerspawn_t g_playerSpawnPoints[MAXPLAYERS]; playerspawn_t g_playerSpawnPoints[MAXPLAYERS];
animwalltype animwall[MAXANIMWALLS]; animwalltype animwall[MAXANIMWALLS];
tsectortype sector[MAXSECTORS]; usectortype sector[MAXSECTORS];
spriteext_t spriteext[MAXSPRITES]; spriteext_t spriteext[MAXSPRITES];
tspritetype sprite[MAXSPRITES]; uspritetype sprite[MAXSPRITES];
twalltype wall[MAXWALLS]; uwalltype wall[MAXWALLS];
#if !defined LUNATIC #if !defined LUNATIC
intptr_t *vars[MAXGAMEVARS]; intptr_t *vars[MAXGAMEVARS];
intptr_t *arrays[MAXGAMEARRAYS]; intptr_t *arrays[MAXGAMEARRAYS];