diff --git a/source/build/include/build.h b/source/build/include/build.h index 9bb875be1..301bc51bf 100644 --- a/source/build/include/build.h +++ b/source/build/include/build.h @@ -1092,7 +1092,6 @@ void renderSetRollAngle(int32_t rolla); void tileInvalidate(int16_t tilenume, int32_t pal, int32_t how); void polymost_glreset(void); -void polymost_precache(int32_t dapicnum, int32_t dapalnum, int32_t datype); void PrecacheHardwareTextures(int nTile); void Polymost_Startup(); @@ -1125,7 +1124,6 @@ EXTERN_CVAR(Bool, hw_useindexedcolortextures) EXTERN_CVAR(Bool, hw_parallaxskypanning) EXTERN_CVAR(Bool, r_voxels) -extern int32_t r_parallaxskyclamping; extern int32_t r_downsize; extern int32_t mdtims, omdtims; extern int32_t glrendmode; diff --git a/source/build/include/mdsprite.h b/source/build/include/mdsprite.h index a6ab29fbd..454f953cc 100644 --- a/source/build/include/mdsprite.h +++ b/source/build/include/mdsprite.h @@ -199,7 +199,6 @@ struct voxmodel_t : public mdmodel_t 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); void mdinit(void); void freeallmodels(void); diff --git a/source/build/include/polymost.h b/source/build/include/polymost.h index 4b5153abf..7ed08e9d9 100644 --- a/source/build/include/polymost.h +++ b/source/build/include/polymost.h @@ -14,12 +14,10 @@ typedef struct { float r, g, b, a; } coltypef; extern bool playing_rr; extern int32_t rendmode; extern float gtang; -extern float glox1, gloy1; +extern float glox1; extern double gxyaspect; extern float grhalfxdown10x; extern float gcosang, gsinang, gcosang2, gsinang2; -extern float gchang, gshang, gctang, gstang; -extern float gvrcorrection; extern void Polymost_prepare_loadboard(void); @@ -40,9 +38,6 @@ void polymost_completeMirror(); int32_t polymost_maskWallHasTranslucency(uwalltype const * const wall); 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); enum { @@ -117,14 +112,7 @@ enum { #define DAMETH_NARROW_MASKPROPS(dameth) (((dameth)&(~DAMETH_TRANS1))|(((dameth)&DAMETH_TRANS1)>>1)) 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 fxdim, fydim, fydimen, fviewingrange; -extern char ptempbuf[MAXWALLSB<<1]; - -extern hitdata_t polymost_hitdata; - #endif diff --git a/source/build/src/engine.cpp b/source/build/src/engine.cpp index 84a413145..479328933 100644 --- a/source/build/src/engine.cpp +++ b/source/build/src/engine.cpp @@ -87,6 +87,21 @@ static FORCE_INLINE int32_t oldnonpow2(void) #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; int16_t pskybits_override = -1; diff --git a/source/build/src/mdsprite.cpp b/source/build/src/mdsprite.cpp index 5414a9ed9..470e9fe56 100644 --- a/source/build/src/mdsprite.cpp +++ b/source/build/src/mdsprite.cpp @@ -89,7 +89,7 @@ static int32_t tribufverts = 0; static mdmodel_t *mdload(const char *); static void mdfree(mdmodel_t *); -int32_t globalnoeffect=0; +static int32_t globalnoeffect=0; 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 -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) { @@ -904,7 +904,7 @@ static md2model_t *md2load(FileReader & fil, const char *filnam) //---------------------------------------- MD2 LIBRARY ENDS ---------------------------------------- // 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; float piv = depths[f]; @@ -1842,7 +1842,7 @@ static void md3free(md3model_t *m) //---------------------------------------- MD3 LIBRARY ENDS ---------------------------------------- //--------------------------------------- MD LIBRARY BEGINS --------------------------------------- -mdmodel_t *mdload(const char *filnam) +static mdmodel_t *mdload(const char *filnam) { mdmodel_t *vm; int32_t i; @@ -1905,7 +1905,7 @@ int32_t polymost_mddraw(tspriteptr_t tspr) 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 == 2 || vm->mdnum == 3) { md3free((md3model_t *)vm); return; } diff --git a/source/build/src/polymost.cpp b/source/build/src/polymost.cpp index 1690ae282..7c98d5c96 100644 --- a/source/build/src/polymost.cpp +++ b/source/build/src/polymost.cpp @@ -63,18 +63,12 @@ CUSTOM_CVARD(Int, hw_anisotropy, 4, CVAR_ARCHIVE | CVAR_GLOBALCONFIG, "changes t // For testing - will be removed later. 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; #define VSPMAX 2048 //<- careful! static vsptyp vsp[VSPMAX]; static int32_t gtag, viewportNodeCount; static float xbl, xbr, xbt, xbb; -int32_t domost_rejectcount; +static int32_t domost_rejectcount; #ifdef YAX_ENABLE 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]; @@ -92,8 +86,7 @@ static float dxb1[MAXWALLSB], dxb2[MAXWALLSB]; #define SOFTROTMAT 0 -int32_t r_pogoDebug = 0; -int32_t polymostcenterhoriz = 100; +static int32_t r_pogoDebug = 0; static float gviewxrange; static float ghoriz, ghoriz2; @@ -103,16 +96,13 @@ float gyxscale, ghalfx, grhalfxdown10, grhalfxdown10x, ghalfy; float gcosang, gsinang, gcosang2, gsinang2; float gtang = 0.f; -float gchang = 0, gshang = 0, gctang = 0, gstang = 0; -float gvrcorrection = 1.f; +static float gchang = 0, gshang = 0, gctang = 0, gstang = 0; +static float gvrcorrection = 1.f; static vec3d_t xtex, ytex, otex, xtex2, ytex2, otex2; -float fcosglobalang, fsinglobalang; -float fxdim, fydim, fydimen, fviewingrange; - -float fsearchx, fsearchy, fsearchz; -int psectnum, pwallnum, pbottomwall, pisbottomwall, psearchstat; +static float fsearchx, fsearchy, fsearchz; +static int psectnum, pwallnum, pbottomwall, pisbottomwall, psearchstat; static int32_t drawpoly_srepeat = 0, drawpoly_trepeat = 0; #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 FHardwareTexture *polymosttext = 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 r_yshearing = 0; +static int32_t r_yshearing = 0; // used for fogcalc static float fogresult, fogresult2; -char ptempbuf[MAXWALLSB<<1]; +static char ptempbuf[MAXWALLSB<<1]; // polymost ART sky control -int32_t r_parallaxskyclamping = 1; +static int32_t r_parallaxskyclamping = 1; #define MIN_CACHETIME_PRINT 10 @@ -144,12 +127,10 @@ int32_t r_parallaxskyclamping = 1; #define Bfabsf fabsf -int32_t mdtims, omdtims; -uint8_t alphahackarray[MAXTILES]; -int32_t drawingskybox = 0; -int32_t hicprecaching = 0; +static int32_t drawingskybox = 0; +static int32_t hicprecaching = 0; -hitdata_t polymost_hitdata; +static hitdata_t polymost_hitdata; 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. static int32_t gltexcacnum = -1; //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]; @@ -242,7 +224,7 @@ void polymost_glreset() FileReader GetBaseResource(const char* fn); // one-time initialization of OpenGL for polymost -void polymost_glinit() +static void polymost_glinit() { for (int basepalnum = 0; basepalnum < MAXBASEPALS; ++basepalnum) { @@ -1831,7 +1813,7 @@ static inline int polymost_getclosestpointonwall(vec2_t const * const pos, int32 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)) 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; } -float fgetflorzofslope(usectorptr_t sec, float dax, float day) +static float fgetflorzofslope(usectorptr_t sec, float dax, float day) { if (!(sec->floorstat&2)) 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; } -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); @@ -3741,7 +3723,7 @@ typedef struct int8_t filler; } wallspriteinfo_t; -wallspriteinfo_t wsprinfo[MAXSPRITES]; +static wallspriteinfo_t wsprinfo[MAXSPRITES]; void Polymost_prepare_loadboard(void) { @@ -3774,7 +3756,7 @@ static inline int32_t polymost_findwall(tspritetype const * const tspr, vec2_t c 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) { // 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 // datype is 0 for a wall/floor/ceiling and 1 for a sprite diff --git a/source/build/src/voxmodel.cpp b/source/build/src/voxmodel.cpp index 33483ca9b..827a14673 100644 --- a/source/build/src/voxmodel.cpp +++ b/source/build/src/voxmodel.cpp @@ -35,7 +35,7 @@ static voxmodel_t *gvox; //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: const coltype *const pic = (const coltype *)picbuf; diff --git a/source/common/searchpaths.cpp b/source/common/searchpaths.cpp index 56b1b8c09..2e24a76f4 100644 --- a/source/common/searchpaths.cpp +++ b/source/common/searchpaths.cpp @@ -162,7 +162,7 @@ void CollectSubdirectories(TArray &searchpath, const char *dirmatch) { findstate_t findstate; void* handle; - if ((handle = I_FindFirst(AbsPath + "/*.*", &findstate)) != (void*)-1) + if ((handle = I_FindFirst(AbsPath + "/*", &findstate)) != (void*)-1) { do { diff --git a/source/platform/posix/cocoa/i_system.mm b/source/platform/posix/cocoa/i_system.mm index 3fa59cf37..9038893a0 100644 --- a/source/platform/posix/cocoa/i_system.mm +++ b/source/platform/posix/cocoa/i_system.mm @@ -180,6 +180,7 @@ void* I_FindFirst(const char* const filespec, findstate_t* const fileinfo) { pattern = slash+1; dir = FString(filespec, slash - filespec + 1); + fileinfo->path = dir; } else { @@ -234,7 +235,7 @@ int I_FindAttr(findstate_t* const fileinfo) dirent* const ent = fileinfo->namelist[fileinfo->current]; bool isdir; - if (DirEntryExists(ent->d_name, &isdir)) + if (DirEntryExists(fileinfo->path + ent->d_name, &isdir)) { return isdir ? FA_DIREC : 0; } diff --git a/source/platform/posix/i_system.h b/source/platform/posix/i_system.h index 48c365af2..21b5c0f6b 100644 --- a/source/platform/posix/i_system.h +++ b/source/platform/posix/i_system.h @@ -73,9 +73,10 @@ bool I_SetCursor(FTexture *); struct findstate_t { private: - int count; + FString path; struct dirent **namelist; int current; + int count; friend void *I_FindFirst(const char *filespec, findstate_t *fileinfo); friend int I_FindNext(void *handle, findstate_t *fileinfo); diff --git a/source/platform/posix/sdl/i_system.cpp b/source/platform/posix/sdl/i_system.cpp index 7dd138ea2..60d4aa005 100644 --- a/source/platform/posix/sdl/i_system.cpp +++ b/source/platform/posix/sdl/i_system.cpp @@ -304,6 +304,7 @@ void *I_FindFirst (const char *filespec, findstate_t *fileinfo) { pattern = slash+1; dir = FString(filespec, slash-filespec+1); + fileinfo->path = dir; } else { @@ -350,7 +351,7 @@ int I_FindAttr(findstate_t* const fileinfo) dirent* const ent = fileinfo->namelist[fileinfo->current]; bool isdir; - if (DirEntryExists(ent->d_name, &isdir)) + if (DirEntryExists(fileinfo->path + ent->d_name, &isdir)) { return isdir ? FA_DIREC : 0; }