- eliminated tspriteptr_t and moved a few polymost-exclusive inlines into polymost.cpp.

This commit is contained in:
Christoph Oelckers 2021-12-30 11:51:33 +01:00
parent 9158796284
commit 50a3089648
6 changed files with 36 additions and 40 deletions

View file

@ -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);

View file

@ -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;

View file

@ -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 */

View file

@ -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)
{

View file

@ -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;

View file

@ -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++];