This commit is contained in:
Christoph Oelckers 2020-01-29 22:06:48 +01:00
commit cec7b006ca
11 changed files with 51 additions and 66 deletions

View file

@ -1092,7 +1092,6 @@ void renderSetRollAngle(int32_t rolla);
void tileInvalidate(int16_t tilenume, int32_t pal, int32_t how); void tileInvalidate(int16_t tilenume, int32_t pal, int32_t how);
void polymost_glreset(void); void polymost_glreset(void);
void polymost_precache(int32_t dapicnum, int32_t dapalnum, int32_t datype);
void PrecacheHardwareTextures(int nTile); void PrecacheHardwareTextures(int nTile);
void Polymost_Startup(); void Polymost_Startup();
@ -1125,7 +1124,6 @@ EXTERN_CVAR(Bool, hw_useindexedcolortextures)
EXTERN_CVAR(Bool, hw_parallaxskypanning) EXTERN_CVAR(Bool, hw_parallaxskypanning)
EXTERN_CVAR(Bool, r_voxels) EXTERN_CVAR(Bool, r_voxels)
extern int32_t r_parallaxskyclamping;
extern int32_t r_downsize; extern int32_t r_downsize;
extern int32_t mdtims, omdtims; extern int32_t mdtims, omdtims;
extern int32_t glrendmode; extern int32_t glrendmode;

View file

@ -199,7 +199,6 @@ struct voxmodel_t : public mdmodel_t
EXTERN mdmodel_t **models; EXTERN mdmodel_t **models;
void updateanimation(md2model_t *m, tspriteptr_t tspr, uint8_t lpal);
FTexture* mdloadskin(idmodel_t* m, int32_t number, int32_t pal, int32_t surf, bool* exact); FTexture* mdloadskin(idmodel_t* m, int32_t number, int32_t pal, int32_t surf, bool* exact);
void mdinit(void); void mdinit(void);
void freeallmodels(void); void freeallmodels(void);

View file

@ -14,12 +14,10 @@ typedef struct { float r, g, b, a; } coltypef;
extern bool playing_rr; extern bool playing_rr;
extern int32_t rendmode; extern int32_t rendmode;
extern float gtang; extern float gtang;
extern float glox1, gloy1; extern float glox1;
extern double gxyaspect; extern double gxyaspect;
extern float grhalfxdown10x; extern float grhalfxdown10x;
extern float gcosang, gsinang, gcosang2, gsinang2; extern float gcosang, gsinang, gcosang2, gsinang2;
extern float gchang, gshang, gctang, gstang;
extern float gvrcorrection;
extern void Polymost_prepare_loadboard(void); extern void Polymost_prepare_loadboard(void);
@ -40,9 +38,6 @@ void polymost_completeMirror();
int32_t polymost_maskWallHasTranslucency(uwalltype const * const wall); int32_t polymost_maskWallHasTranslucency(uwalltype const * const wall);
int32_t polymost_spriteHasTranslucency(tspritetype const * const tspr); int32_t polymost_spriteHasTranslucency(tspritetype const * const tspr);
float* multiplyMatrix4f(float m0[4*4], const float m1[4*4]);
void polymost_glinit(void);
void polymost_glreset(void); void polymost_glreset(void);
enum { enum {
@ -117,14 +112,7 @@ enum {
#define DAMETH_NARROW_MASKPROPS(dameth) (((dameth)&(~DAMETH_TRANS1))|(((dameth)&DAMETH_TRANS1)>>1)) #define DAMETH_NARROW_MASKPROPS(dameth) (((dameth)&(~DAMETH_TRANS1))|(((dameth)&DAMETH_TRANS1)>>1))
EDUKE32_STATIC_ASSERT(DAMETH_NARROW_MASKPROPS(DAMETH_MASKPROPS) == DAMETH_MASK); EDUKE32_STATIC_ASSERT(DAMETH_NARROW_MASKPROPS(DAMETH_MASKPROPS) == DAMETH_MASK);
extern int32_t globalnoeffect;
extern int32_t drawingskybox;
extern int32_t hicprecaching;
extern float fcosglobalang, fsinglobalang; extern float fcosglobalang, fsinglobalang;
extern float fxdim, fydim, fydimen, fviewingrange; extern float fxdim, fydim, fydimen, fviewingrange;
extern char ptempbuf[MAXWALLSB<<1];
extern hitdata_t polymost_hitdata;
#endif #endif

View file

@ -87,6 +87,21 @@ static FORCE_INLINE int32_t oldnonpow2(void)
#endif #endif
} }
bool playing_rr;
bool playing_blood;
int32_t rendmode=0;
int32_t glrendmode = REND_POLYMOST;
int32_t r_scenebrightness = 0;
int32_t r_rortexture = 0;
int32_t r_rortexturerange = 0;
int32_t r_rorphase = 0;
int32_t mdtims, omdtims;
uint8_t alphahackarray[MAXTILES];
int32_t polymostcenterhoriz = 100;
float fcosglobalang, fsinglobalang;
float fxdim, fydim, fydimen, fviewingrange;
uint8_t globalr = 255, globalg = 255, globalb = 255; uint8_t globalr = 255, globalg = 255, globalb = 255;
int16_t pskybits_override = -1; int16_t pskybits_override = -1;

View file

@ -89,7 +89,7 @@ static int32_t tribufverts = 0;
static mdmodel_t *mdload(const char *); static mdmodel_t *mdload(const char *);
static void mdfree(mdmodel_t *); static void mdfree(mdmodel_t *);
int32_t globalnoeffect=0; static int32_t globalnoeffect=0;
void freeallmodels() void freeallmodels()
{ {
@ -507,7 +507,7 @@ FTexture *mdloadskin(idmodel_t *m, int32_t number, int32_t pal, int32_t surf, bo
} }
//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, tspriteptr_t tspr, uint8_t lpal) static void updateanimation(md2model_t *m, tspriteptr_t tspr, uint8_t lpal)
{ {
if (m->numframes < 2) if (m->numframes < 2)
{ {
@ -904,7 +904,7 @@ static md2model_t *md2load(FileReader & fil, const char *filnam)
//---------------------------------------- MD2 LIBRARY ENDS ---------------------------------------- //---------------------------------------- MD2 LIBRARY ENDS ----------------------------------------
// DICHOTOMIC RECURSIVE SORTING - USED BY MD3DRAW // DICHOTOMIC RECURSIVE SORTING - USED BY MD3DRAW
int32_t partition(uint16_t *indexes, float *depths, int32_t f, int32_t l) static int32_t partition(uint16_t *indexes, float *depths, int32_t f, int32_t l)
{ {
int32_t up = f, down = l; int32_t up = f, down = l;
float piv = depths[f]; float piv = depths[f];
@ -1842,7 +1842,7 @@ static void md3free(md3model_t *m)
//---------------------------------------- MD3 LIBRARY ENDS ---------------------------------------- //---------------------------------------- MD3 LIBRARY ENDS ----------------------------------------
//--------------------------------------- MD LIBRARY BEGINS --------------------------------------- //--------------------------------------- MD LIBRARY BEGINS ---------------------------------------
mdmodel_t *mdload(const char *filnam) static mdmodel_t *mdload(const char *filnam)
{ {
mdmodel_t *vm; mdmodel_t *vm;
int32_t i; int32_t i;
@ -1905,7 +1905,7 @@ int32_t polymost_mddraw(tspriteptr_t tspr)
return 0; return 0;
} }
void mdfree(mdmodel_t *vm) static void mdfree(mdmodel_t *vm)
{ {
if (vm->mdnum == 1) { voxfree((voxmodel_t *)vm); return; } if (vm->mdnum == 1) { voxfree((voxmodel_t *)vm); return; }
if (vm->mdnum == 2 || vm->mdnum == 3) { md3free((md3model_t *)vm); return; } if (vm->mdnum == 2 || vm->mdnum == 3) { md3free((md3model_t *)vm); return; }

View file

@ -63,18 +63,12 @@ CUSTOM_CVARD(Int, hw_anisotropy, 4, CVAR_ARCHIVE | CVAR_GLOBALCONFIG, "changes t
// For testing - will be removed later. // For testing - will be removed later.
CVAR(Int, skytile, 0, 0) CVAR(Int, skytile, 0, 0)
bool playing_rr;
bool playing_blood;
int32_t rendmode=0;
typedef struct { float x, cy[2], fy[2]; int32_t tag; int16_t n, p, ctag, ftag; } vsptyp; typedef struct { float x, cy[2], fy[2]; int32_t tag; int16_t n, p, ctag, ftag; } vsptyp;
#define VSPMAX 2048 //<- careful! #define VSPMAX 2048 //<- careful!
static vsptyp vsp[VSPMAX]; static vsptyp vsp[VSPMAX];
static int32_t gtag, viewportNodeCount; static int32_t gtag, viewportNodeCount;
static float xbl, xbr, xbt, xbb; static float xbl, xbr, xbt, xbb;
int32_t domost_rejectcount; static int32_t domost_rejectcount;
#ifdef YAX_ENABLE #ifdef YAX_ENABLE
typedef struct { float x, cy[2]; int32_t tag; int16_t n, p, ctag; } yax_vsptyp; typedef struct { float x, cy[2]; int32_t tag; int16_t n, p, ctag; } yax_vsptyp;
static yax_vsptyp yax_vsp[YAX_MAXBUNCHES*2][VSPMAX]; static yax_vsptyp yax_vsp[YAX_MAXBUNCHES*2][VSPMAX];
@ -92,8 +86,7 @@ static float dxb1[MAXWALLSB], dxb2[MAXWALLSB];
#define SOFTROTMAT 0 #define SOFTROTMAT 0
int32_t r_pogoDebug = 0; static int32_t r_pogoDebug = 0;
int32_t polymostcenterhoriz = 100;
static float gviewxrange; static float gviewxrange;
static float ghoriz, ghoriz2; static float ghoriz, ghoriz2;
@ -103,16 +96,13 @@ float gyxscale, ghalfx, grhalfxdown10, grhalfxdown10x, ghalfy;
float gcosang, gsinang, gcosang2, gsinang2; float gcosang, gsinang, gcosang2, gsinang2;
float gtang = 0.f; float gtang = 0.f;
float gchang = 0, gshang = 0, gctang = 0, gstang = 0; static float gchang = 0, gshang = 0, gctang = 0, gstang = 0;
float gvrcorrection = 1.f; static float gvrcorrection = 1.f;
static vec3d_t xtex, ytex, otex, xtex2, ytex2, otex2; static vec3d_t xtex, ytex, otex, xtex2, ytex2, otex2;
float fcosglobalang, fsinglobalang; static float fsearchx, fsearchy, fsearchz;
float fxdim, fydim, fydimen, fviewingrange; static int psectnum, pwallnum, pbottomwall, pisbottomwall, psearchstat;
float fsearchx, fsearchy, fsearchz;
int psectnum, pwallnum, pbottomwall, pisbottomwall, psearchstat;
static int32_t drawpoly_srepeat = 0, drawpoly_trepeat = 0; static int32_t drawpoly_srepeat = 0, drawpoly_trepeat = 0;
#define MAX_DRAWPOLY_VERTS 8 #define MAX_DRAWPOLY_VERTS 8
@ -120,23 +110,16 @@ static int32_t drawpoly_srepeat = 0, drawpoly_trepeat = 0;
static int32_t lastglpolygonmode = 0; //FUK static int32_t lastglpolygonmode = 0; //FUK
static FHardwareTexture *polymosttext = 0; static FHardwareTexture *polymosttext = 0;
int32_t glrendmode = REND_POLYMOST;
int32_t r_scenebrightness = 0; static int32_t r_yshearing = 0;
int32_t r_rortexture = 0;
int32_t r_rortexturerange = 0;
int32_t r_rorphase = 0;
int32_t r_yshearing = 0;
// used for fogcalc // used for fogcalc
static float fogresult, fogresult2; static float fogresult, fogresult2;
char ptempbuf[MAXWALLSB<<1]; static char ptempbuf[MAXWALLSB<<1];
// polymost ART sky control // polymost ART sky control
int32_t r_parallaxskyclamping = 1; static int32_t r_parallaxskyclamping = 1;
#define MIN_CACHETIME_PRINT 10 #define MIN_CACHETIME_PRINT 10
@ -144,12 +127,10 @@ int32_t r_parallaxskyclamping = 1;
#define Bfabsf fabsf #define Bfabsf fabsf
int32_t mdtims, omdtims; static int32_t drawingskybox = 0;
uint8_t alphahackarray[MAXTILES]; static int32_t hicprecaching = 0;
int32_t drawingskybox = 0;
int32_t hicprecaching = 0;
hitdata_t polymost_hitdata; static hitdata_t polymost_hitdata;
void polymost_outputGLDebugMessage(uint8_t severity, const char* format, ...) void polymost_outputGLDebugMessage(uint8_t severity, const char* format, ...)
{ {
@ -172,13 +153,14 @@ void gltexapplyprops(void)
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
float glox1, gloy1, glox2, gloy2, gloyxscale, gloxyaspect, glohoriz2, glohorizcorrect, glotang; float glox1;
static float gloy1, glox2, gloy2, gloyxscale, gloxyaspect, glohoriz2, glohorizcorrect, glotang;
//Use this for both initialization and uninitialization of OpenGL. //Use this for both initialization and uninitialization of OpenGL.
static int32_t gltexcacnum = -1; static int32_t gltexcacnum = -1;
//in-place multiply m0=m0*m1 //in-place multiply m0=m0*m1
float* multiplyMatrix4f(float m0[4*4], const float m1[4*4]) static float* multiplyMatrix4f(float m0[4*4], const float m1[4*4])
{ {
float mR[4*4]; float mR[4*4];
@ -242,7 +224,7 @@ void polymost_glreset()
FileReader GetBaseResource(const char* fn); FileReader GetBaseResource(const char* fn);
// one-time initialization of OpenGL for polymost // one-time initialization of OpenGL for polymost
void polymost_glinit() static void polymost_glinit()
{ {
for (int basepalnum = 0; basepalnum < MAXBASEPALS; ++basepalnum) for (int basepalnum = 0; basepalnum < MAXBASEPALS; ++basepalnum)
{ {
@ -1831,7 +1813,7 @@ static inline int polymost_getclosestpointonwall(vec2_t const * const pos, int32
return 0; return 0;
} }
float fgetceilzofslope(usectorptr_t sec, float dax, float day) static float fgetceilzofslope(usectorptr_t sec, float dax, float day)
{ {
if (!(sec->ceilingstat&2)) if (!(sec->ceilingstat&2))
return float(sec->ceilingz); return float(sec->ceilingz);
@ -1849,7 +1831,7 @@ float fgetceilzofslope(usectorptr_t sec, float dax, float day)
return float(sec->ceilingz) + (sec->ceilingheinum*j)/i; return float(sec->ceilingz) + (sec->ceilingheinum*j)/i;
} }
float fgetflorzofslope(usectorptr_t sec, float dax, float day) static float fgetflorzofslope(usectorptr_t sec, float dax, float day)
{ {
if (!(sec->floorstat&2)) if (!(sec->floorstat&2))
return float(sec->floorz); return float(sec->floorz);
@ -1867,7 +1849,7 @@ float fgetflorzofslope(usectorptr_t sec, float dax, float day)
return float(sec->floorz) + (sec->floorheinum*j)/i; return float(sec->floorz) + (sec->floorheinum*j)/i;
} }
void fgetzsofslope(usectorptr_t sec, float dax, float day, float* ceilz, float *florz) static void fgetzsofslope(usectorptr_t sec, float dax, float day, float* ceilz, float *florz)
{ {
*ceilz = float(sec->ceilingz); *florz = float(sec->floorz); *ceilz = float(sec->ceilingz); *florz = float(sec->floorz);
@ -3741,7 +3723,7 @@ typedef struct
int8_t filler; int8_t filler;
} wallspriteinfo_t; } wallspriteinfo_t;
wallspriteinfo_t wsprinfo[MAXSPRITES]; static wallspriteinfo_t wsprinfo[MAXSPRITES];
void Polymost_prepare_loadboard(void) void Polymost_prepare_loadboard(void)
{ {
@ -3774,7 +3756,7 @@ static inline int32_t polymost_findwall(tspritetype const * const tspr, vec2_t c
return closest; return closest;
} }
int32_t polymost_lintersect(int32_t x1, int32_t y1, int32_t x2, int32_t y2, static int32_t polymost_lintersect(int32_t x1, int32_t y1, int32_t x2, int32_t y2,
int32_t x3, int32_t y3, int32_t x4, int32_t y4) int32_t x3, int32_t y3, int32_t x4, int32_t y4)
{ {
// p1 to p2 is a line segment // p1 to p2 is a line segment
@ -4626,7 +4608,7 @@ void polymost_initosdfuncs(void)
{ {
} }
void polymost_precache(int32_t dapicnum, int32_t dapalnum, int32_t datype) static void polymost_precache(int32_t dapicnum, int32_t dapalnum, int32_t datype)
{ {
// dapicnum and dapalnum are like you'd expect // dapicnum and dapalnum are like you'd expect
// datype is 0 for a wall/floor/ceiling and 1 for a sprite // datype is 0 for a wall/floor/ceiling and 1 for a sprite

View file

@ -35,7 +35,7 @@ static voxmodel_t *gvox;
//pitch must equal xsiz*4 //pitch must equal xsiz*4
FHardwareTexture *gloadtex(const int32_t *picbuf, int32_t xsiz, int32_t ysiz, int32_t is8bit, int32_t dapal) static FHardwareTexture *gloadtex(const int32_t *picbuf, int32_t xsiz, int32_t ysiz, int32_t is8bit, int32_t dapal)
{ {
// Correct for GL's RGB order; also apply gamma here: // Correct for GL's RGB order; also apply gamma here:
const coltype *const pic = (const coltype *)picbuf; const coltype *const pic = (const coltype *)picbuf;

View file

@ -162,7 +162,7 @@ void CollectSubdirectories(TArray<FString> &searchpath, const char *dirmatch)
{ {
findstate_t findstate; findstate_t findstate;
void* handle; void* handle;
if ((handle = I_FindFirst(AbsPath + "/*.*", &findstate)) != (void*)-1) if ((handle = I_FindFirst(AbsPath + "/*", &findstate)) != (void*)-1)
{ {
do do
{ {

View file

@ -180,6 +180,7 @@ void* I_FindFirst(const char* const filespec, findstate_t* const fileinfo)
{ {
pattern = slash+1; pattern = slash+1;
dir = FString(filespec, slash - filespec + 1); dir = FString(filespec, slash - filespec + 1);
fileinfo->path = dir;
} }
else else
{ {
@ -234,7 +235,7 @@ int I_FindAttr(findstate_t* const fileinfo)
dirent* const ent = fileinfo->namelist[fileinfo->current]; dirent* const ent = fileinfo->namelist[fileinfo->current];
bool isdir; bool isdir;
if (DirEntryExists(ent->d_name, &isdir)) if (DirEntryExists(fileinfo->path + ent->d_name, &isdir))
{ {
return isdir ? FA_DIREC : 0; return isdir ? FA_DIREC : 0;
} }

View file

@ -73,9 +73,10 @@ bool I_SetCursor(FTexture *);
struct findstate_t struct findstate_t
{ {
private: private:
int count; FString path;
struct dirent **namelist; struct dirent **namelist;
int current; int current;
int count;
friend void *I_FindFirst(const char *filespec, findstate_t *fileinfo); friend void *I_FindFirst(const char *filespec, findstate_t *fileinfo);
friend int I_FindNext(void *handle, findstate_t *fileinfo); friend int I_FindNext(void *handle, findstate_t *fileinfo);

View file

@ -304,6 +304,7 @@ void *I_FindFirst (const char *filespec, findstate_t *fileinfo)
{ {
pattern = slash+1; pattern = slash+1;
dir = FString(filespec, slash-filespec+1); dir = FString(filespec, slash-filespec+1);
fileinfo->path = dir;
} }
else else
{ {
@ -350,7 +351,7 @@ int I_FindAttr(findstate_t* const fileinfo)
dirent* const ent = fileinfo->namelist[fileinfo->current]; dirent* const ent = fileinfo->namelist[fileinfo->current];
bool isdir; bool isdir;
if (DirEntryExists(ent->d_name, &isdir)) if (DirEntryExists(fileinfo->path + ent->d_name, &isdir))
{ {
return isdir ? FA_DIREC : 0; return isdir ? FA_DIREC : 0;
} }