diff --git a/source/build/include/build.h b/source/build/include/build.h index 79b3b71f2..55e655b2b 100644 --- a/source/build/include/build.h +++ b/source/build/include/build.h @@ -87,11 +87,6 @@ enum { }; #include "maptypes.h" - -using tspriteptr_t = tspritetype *; - - - #include "clip.h" int32_t getwalldist(vec2_t const in, int const wallnum); diff --git a/source/build/include/mdsprite.h b/source/build/include/mdsprite.h index d816a0049..cdda97b71 100644 --- a/source/build/include/mdsprite.h +++ b/source/build/include/mdsprite.h @@ -182,8 +182,8 @@ EXTERN mdmodel_t **models; FGameTexture* mdloadskin(idmodel_t* m, int32_t number, int32_t pal, int32_t surf, bool* exact); void mdinit(void); void freeallmodels(void); -int32_t polymost_mddraw(tspriteptr_t tspr); -EXTERN void md3_vox_calcmat_common(tspriteptr_t tspr, const FVector3 *a0, float f, float mat[16]); +int32_t polymost_mddraw(tspritetype* tspr); +EXTERN void md3_vox_calcmat_common(tspritetype* tspr, const FVector3 *a0, float f, float mat[16]); EXTERN int32_t mdpause; EXTERN int32_t nextmodelid; diff --git a/source/build/src/engine_priv.h b/source/build/src/engine_priv.h index ebcd98d63..c182ee270 100644 --- a/source/build/src/engine_priv.h +++ b/source/build/src/engine_priv.h @@ -32,28 +32,5 @@ extern int32_t hitallsprites; int32_t animateoffs(int tilenum, int fakevar); -inline int32_t bad_tspr(tspriteptr_t tspr) -{ - return (tspr->ownerActor == nullptr || (unsigned)tspr->picnum >= MAXTILES); -} - -inline void set_globalpos(int32_t const x, int32_t const y, int32_t const z) -{ - globalposx = x, fglobalposx = (float)x; - globalposy = y, fglobalposy = (float)y; - globalposz = z, fglobalposz = (float)z; -} - - -inline int widthBits(int num) -{ - return sizeToBits(tileWidth(num)); -} - -inline int heightBits(int num) -{ - return sizeToBits(tileHeight(num)); -} - #endif /* ENGINE_PRIV_H */ diff --git a/source/build/src/mdsprite.cpp b/source/build/src/mdsprite.cpp index 5f79584c1..937800cbc 100644 --- a/source/build/src/mdsprite.cpp +++ b/source/build/src/mdsprite.cpp @@ -30,7 +30,7 @@ static int32_t curextra=MAXTILES; #define MIN_CACHETIME_PRINT 10 using namespace Polymost; -int32_t polymost_voxdraw(voxmodel_t* m, tspriteptr_t const tspr, bool rotate); +int32_t polymost_voxdraw(voxmodel_t* m, tspritetype* const tspr, bool rotate); static int32_t addtileP(int32_t ,int32_t tile,int32_t pallet) { @@ -399,7 +399,7 @@ FGameTexture *mdloadskin(idmodel_t *m, int32_t number, int32_t pal, int32_t surf } //Note: even though it says md2model, it works for both md2model&md3model -static void updateanimation(md2model_t *m, tspriteptr_t tspr, uint8_t lpal) +static void updateanimation(md2model_t *m, tspritetype* tspr, uint8_t lpal) { if (m->numframes < 2) { @@ -1073,7 +1073,7 @@ static void md3postload_common(md3model_t *m) } -void md3_vox_calcmat_common(tspriteptr_t tspr, const FVector3 *a0, float f, float mat[16]) +void md3_vox_calcmat_common(tspritetype* tspr, const FVector3 *a0, float f, float mat[16]) { float k0, k1, k2, k3, k4, k5, k6, k7; @@ -1127,7 +1127,7 @@ static void md3draw_handle_triangles(const md3surf_t *s, uint16_t *indexhandle, GLInterface.Draw(DT_Triangles, data.second, s->numtris *3); } -static int32_t polymost_md3draw(md3model_t *m, tspriteptr_t tspr) +static int32_t polymost_md3draw(md3model_t *m, tspritetype* tspr) { FVector3 m0, m1, a0; md3xyzn_t *v0, *v1; @@ -1508,7 +1508,7 @@ static mdmodel_t *mdload(const char *filnam) } -int32_t polymost_mddraw(tspriteptr_t tspr) +int32_t polymost_mddraw(tspritetype* tspr) { if (maxmodelverts > allocmodelverts) { diff --git a/source/build/src/polymost.cpp b/source/build/src/polymost.cpp index 7f3785a27..82ccf9402 100644 --- a/source/build/src/polymost.cpp +++ b/source/build/src/polymost.cpp @@ -47,12 +47,36 @@ int32_t r_rortexture = 0; int32_t r_rortexturerange = 0; int32_t r_rorphase = 0; +inline int32_t bad_tspr(tspritetype* tspr) +{ + return (tspr->ownerActor == nullptr || (unsigned)tspr->picnum >= MAXTILES); +} + +inline void set_globalpos(int32_t const x, int32_t const y, int32_t const z) +{ + globalposx = x, fglobalposx = (float)x; + globalposy = y, fglobalposy = (float)y; + globalposz = z, fglobalposz = (float)z; +} + + +inline int widthBits(int num) +{ + return sizeToBits(tileWidth(num)); +} + +inline int heightBits(int num) +{ + return sizeToBits(tileHeight(num)); +} + + void calcSlope(const sectortype* sec, float xpos, float ypos, float* pceilz, float* pflorz); int skiptile = -1; FGameTexture* GetSkyTexture(int basetile, int lognumtiles, const int16_t* tilemap, int remap = 0); -int32_t polymost_voxdraw(voxmodel_t* m, tspriteptr_t const tspr, bool rotate); +int32_t polymost_voxdraw(voxmodel_t* m, tspritetype* const tspr, bool rotate); int checkTranslucentReplacement(FTextureID picnum, int pal); @@ -76,7 +100,7 @@ static int16_t bunchfirst[MAXWALLSB], bunchlast[MAXWALLSB]; static int16_t numscans, numbunches; static int16_t maskwall[MAXWALLSB], maskwallcnt; static int16_t sectorborder[256]; -static tspriteptr_t tspriteptr[MAXSPRITESONSCREEN + 1]; +static tspritetype* tspriteptr[MAXSPRITESONSCREEN + 1]; tspritetype pm_tsprite[MAXSPRITESONSCREEN]; int pm_spritesortcnt; @@ -2634,7 +2658,7 @@ static int32_t polymost_lintersect(int32_t x1, int32_t y1, int32_t x2, int32_t y return rv; } -static inline float tspriteGetZOfSlopeFloat(tspriteptr_t const tspr, float dax, float day) +static inline float tspriteGetZOfSlopeFloat(tspritetype* const tspr, float dax, float day) { int16_t const heinum = tspriteGetSlope(tspr); if (heinum == 0) @@ -3787,7 +3811,7 @@ void renderSetAspect(int32_t daxrange, int32_t daaspect) } //Draw voxel model as perfect cubes -int32_t polymost_voxdraw(voxmodel_t* m, tspriteptr_t const tspr, bool rotate) +int32_t polymost_voxdraw(voxmodel_t* m, tspritetype* const tspr, bool rotate) { float f, g, k0, zoff; diff --git a/source/core/coreactor.h b/source/core/coreactor.h index 6ebc9bed2..d0c46e6c3 100644 --- a/source/core/coreactor.h +++ b/source/core/coreactor.h @@ -336,7 +336,7 @@ inline int pushmove(vec3_t* const vect, sectortype** const sect, int32_t const w return res; } -inline tspriteptr_t renderAddTsprite(tspritetype* tsprite, int& spritesortcnt, DCoreActor* actor) +inline tspritetype* renderAddTsprite(tspritetype* tsprite, int& spritesortcnt, DCoreActor* actor) { if (spritesortcnt >= MAXSPRITESONSCREEN) return nullptr; auto tspr = &tsprite[spritesortcnt++];