diff --git a/source/build/include/palette.h b/source/build/include/palette.h index cb3cfe02d..1439af39f 100644 --- a/source/build/include/palette.h +++ b/source/build/include/palette.h @@ -53,6 +53,7 @@ void videoFadePalette(uint8_t r, uint8_t g, uint8_t b, uint8_t offset); extern int32_t realmaxshade; extern float frealmaxshade; +extern int32_t globalpal; extern int32_t globalblend; extern uint32_t g_lastpalettesum; extern palette_t paletteGetColor(int32_t col); diff --git a/source/build/include/polymost.h b/source/build/include/polymost.h index 224a0981a..0f5dd5232 100644 --- a/source/build/include/polymost.h +++ b/source/build/include/polymost.h @@ -89,7 +89,6 @@ extern int32_t r_usetileshades; extern int32_t r_npotwallmode; extern int16_t globalpicnum; -extern int32_t globalpal; // Compare with polymer_eligible_for_artmap() static FORCE_INLINE int32_t eligible_for_tileshades(int32_t const picnum, int32_t const pal) diff --git a/source/build/src/build.cpp b/source/build/src/build.cpp index f0dcdc98f..3d09412cf 100644 --- a/source/build/src/build.cpp +++ b/source/build/src/build.cpp @@ -254,7 +254,7 @@ static void initcrc(void); static int32_t menuselect(void); static int32_t menuselect_auto(int, int); //PK -static int32_t insert_sprite_common(int32_t sucksect, int32_t dax, int32_t day); +static int32_t insert_sprite_common(int32_t sectnum, int32_t dax, int32_t day); static void correct_ornamented_sprite(int32_t i, int32_t hitw); static int32_t getfilenames(const char *path, const char *kind); @@ -3065,8 +3065,6 @@ void inflineintersect(int32_t x1, int32_t y1, int32_t x2, int32_t y2, *sign12 = topt < 0 ? -1 : 1; *sign34 = topu < 0 ? -1 : 1; - - return; } static int32_t lineintersect2v(const vec2_t *p1, const vec2_t *p2, // line segment 1 @@ -8927,10 +8925,6 @@ static void deletepoint(int16_t point, int32_t runi) } #endif movewalls(point, -1); - -// checksectorpointer(j, sucksect); - - return; } static int32_t deletesector(int16_t sucksect) diff --git a/source/build/src/cache1d.cpp b/source/build/src/cache1d.cpp index a89467596..bcf2846b5 100644 --- a/source/build/src/cache1d.cpp +++ b/source/build/src/cache1d.cpp @@ -1094,7 +1094,7 @@ int32_t kopen4load(const char *filename, char searchfirst) return h; } -int32_t kread_internal(int32_t handle, void *buffer, int32_t leng, uint8_t *arraygrp, intptr_t *arrayhan, int32_t *arraypos) +int32_t kread_internal(int32_t handle, void *buffer, int32_t leng, const uint8_t *arraygrp, const intptr_t *arrayhan, int32_t *arraypos) { int32_t filenum = arrayhan[handle]; int32_t groupnum = arraygrp[handle]; @@ -1142,7 +1142,7 @@ int32_t kread_internal(int32_t handle, void *buffer, int32_t leng, uint8_t *arra return 0; } -int32_t klseek_internal(int32_t handle, int32_t offset, int32_t whence, uint8_t *arraygrp, intptr_t *arrayhan, int32_t *arraypos) +int32_t klseek_internal(int32_t handle, int32_t offset, int32_t whence, const uint8_t *arraygrp, intptr_t *arrayhan, int32_t *arraypos) { int32_t const groupnum = arraygrp[handle]; @@ -1181,7 +1181,7 @@ int32_t klseek_internal(int32_t handle, int32_t offset, int32_t whence, uint8_t return -1; } -int32_t kfilelength_internal(int32_t handle, uint8_t *arraygrp, intptr_t *arrayhan, int32_t *arraypos) +int32_t kfilelength_internal(int32_t handle, const uint8_t *arraygrp, intptr_t *arrayhan, int32_t *arraypos) { int32_t const groupnum = arraygrp[handle]; if (groupnum == GRP_FILESYSTEM) @@ -1206,7 +1206,7 @@ int32_t kfilelength_internal(int32_t handle, uint8_t *arraygrp, intptr_t *arrayh return gfileoffs[groupnum][i+1]-gfileoffs[groupnum][i]; } -int32_t ktell_internal(int32_t handle, uint8_t *arraygrp, intptr_t *arrayhan, int32_t *arraypos) +int32_t ktell_internal(int32_t handle, const uint8_t *arraygrp, intptr_t *arrayhan, int32_t *arraypos) { int32_t groupnum = arraygrp[handle]; @@ -1229,7 +1229,7 @@ int32_t ktell_internal(int32_t handle, uint8_t *arraygrp, intptr_t *arrayhan, in return -1; } -void kclose_internal(int32_t handle, uint8_t *arraygrp, intptr_t *arrayhan) +void kclose_internal(int32_t handle, const uint8_t *arraygrp, intptr_t *arrayhan) { if (handle < 0) return; if (arraygrp[handle] == GRP_FILESYSTEM) Bclose(arrayhan[handle]); diff --git a/source/build/src/config.cpp b/source/build/src/config.cpp index de0890730..0c2c0bdf2 100644 --- a/source/build/src/config.cpp +++ b/source/build/src/config.cpp @@ -58,11 +58,6 @@ static int32_t readconfig(BFILE *fp, const char *key, char *value, uint32_t len) } extern int16_t brightness; -#ifdef USE_OPENGL -extern int32_t vsync; -#endif -extern char game_executable[BMAX_PATH]; -extern int32_t fullscreen; extern char default_buildkeys[NUMBUILDKEYS]; static char *const keys = default_buildkeys; static int32_t default_grid=9; diff --git a/source/build/src/defs.cpp b/source/build/src/defs.cpp index f4ce48b2a..2b15ddfb9 100644 --- a/source/build/src/defs.cpp +++ b/source/build/src/defs.cpp @@ -126,10 +126,6 @@ static int32_t nextvoxid = 0; static char *faketilebuffer = NULL; static int32_t faketilebuffersiz = 0; -#ifdef USE_OPENGL -extern uint8_t alphahackarray[MAXTILES]; -#endif - static const char *skyfaces[6] = { "front face", "right face", "back face", diff --git a/source/build/src/engine.cpp b/source/build/src/engine.cpp index 25c780059..92ab3b480 100644 --- a/source/build/src/engine.cpp +++ b/source/build/src/engine.cpp @@ -193,22 +193,6 @@ int32_t showfirstwall=0; int32_t showheightindicators=1; int32_t circlewall=-1; -// forward refs -#ifdef __cplusplus -extern "C" { -#endif -void editorSetup2dSideView(void); -int32_t getscreenvdisp(int32_t bz, int32_t zoome); -void editorGet2dScreenCoordinates(int32_t *xres, int32_t *yres, int32_t x, int32_t y, int32_t zoome); -int32_t scalescreeny(int32_t sy); -#ifdef YAX_ENABLE -void yax_tweakpicnums(int32_t bunchnum, int32_t cf, int32_t restore); -#endif -int32_t getinvdisplacement(int32_t *dx, int32_t *dy, int32_t dz); -#ifdef __cplusplus -} -#endif - static void classicScanSector(int16_t startsectnum); static void draw_rainbow_background(void); @@ -8314,11 +8298,8 @@ static inline int32_t sameside(const _equation *eq, const vec2f_t *p1, c // x1, y1: in/out // rest x/y: out -void get_wallspr_points(const uspritetype *spr, int32_t *x1, int32_t *x2, - int32_t *y1, int32_t *y2); -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 *y1, int32_t *y2, int32_t *y3, int32_t *y4); + + #ifdef DEBUG_MASK_DRAWING int32_t g_maskDrawMode = 0; @@ -11157,8 +11138,6 @@ void neartag(int32_t xs, int32_t ys, int32_t zs, int16_t sectnum, int16_t ange, } } while (tempshortcnt < tempshortnum); - - return; } diff --git a/source/build/src/engine_priv.h b/source/build/src/engine_priv.h index 0b6a185d9..3fcc42786 100644 --- a/source/build/src/engine_priv.h +++ b/source/build/src/engine_priv.h @@ -247,9 +247,9 @@ void calc_and_apply_fog(int32_t tile, int32_t shade, int32_t vis, int32_t pal); void calc_and_apply_fog_factor(int32_t tile, int32_t shade, int32_t vis, int32_t pal, float factor); #endif -extern void get_wallspr_points(uspritetype const * const spr, int32_t *x1, int32_t *x2, +extern void get_wallspr_points(uspritetype const * spr, int32_t *x1, int32_t *x2, int32_t *y1, int32_t *y2); -extern void get_floorspr_points(uspritetype const * const spr, int32_t px, int32_t py, +extern void get_floorspr_points(uspritetype const * spr, int32_t px, int32_t py, int32_t *x1, int32_t *x2, int32_t *x3, int32_t *x4, int32_t *y1, int32_t *y2, int32_t *y3, int32_t *y4); @@ -265,7 +265,7 @@ int32_t animateoffs(int const tilenum, int fakevar); if (picanm[Picnum].sf&PICANM_ANIMTYPE_MASK) Picnum += animateoffs(Picnum, Fakevar); \ } while (0) #else -int32_t animateoffs(int const tilenum); +int32_t animateoffs(int tilenum); #define DO_TILE_ANIM(Picnum, Fakevar) do { \ if (picanm[Picnum].sf&PICANM_ANIMTYPE_MASK) Picnum += animateoffs(Picnum); \ } while (0) @@ -290,7 +290,7 @@ static FORCE_INLINE int32_t getpalookupsh(int32_t davis) { return getpalookup(da void dorotspr_handle_bit2(int32_t *sx, int32_t *sy, int32_t *z, int32_t dastat, int32_t cx1_plus_cx2, int32_t cy1_plus_cy2, - int32_t *ret_ouryxaspect, int32_t *ret_ourxyaspect); + int32_t *ret_yxaspect, int32_t *ret_xyaspect); ////// yax'y stuff ////// #ifdef USE_OPENGL diff --git a/source/build/src/kplib.cpp b/source/build/src/kplib.cpp index c0c31cfc3..cfb0e5599 100644 --- a/source/build/src/kplib.cpp +++ b/source/build/src/kplib.cpp @@ -225,7 +225,7 @@ static inline int32_t peekbits(int32_t n) { return (B_LITTLE32(B_UNBUF32(&filptr static inline void suckbits(int32_t n) { bitpos += n; if (bitpos < 0) return; suckbitsnextblock(); } static inline int32_t getbits(int32_t n) { int32_t i = peekbits(n); suckbits(n); return i; } -static int32_t hufgetsym(int32_t *hitab, int32_t *hbmax) +static int32_t hufgetsym(int32_t *hitab, const int32_t *hbmax) { int32_t v, n; @@ -245,7 +245,7 @@ static int32_t hufgetsym(int32_t *hitab, int32_t *hbmax) // return hitab[hbmax[n]+v]; //} -static void qhufgencode(int32_t *hitab, int32_t *hbmax, int32_t *qhval, uint8_t *qhbit, int32_t numbits) +static void qhufgencode(const int32_t *hitab, const int32_t *hbmax, int32_t *qhval, uint8_t *qhbit, int32_t numbits) { int32_t i, j, k, n, r; @@ -293,7 +293,7 @@ static void qhufgencode(int32_t *hitab, int32_t *hbmax, int32_t *qhval, uint8_t //hitab[inum] : Indices from size-ordered list to original symbol //hbmax[0-31] : Highest index (+1) of n-bit symbol -static void hufgencode(int32_t *inbuf, int32_t inum, int32_t *hitab, int32_t *hbmax) +static void hufgencode(const int32_t *inbuf, int32_t inum, int32_t *hitab, int32_t *hbmax) { int32_t i, tbuf[31], *tbufptr, *hbmaxptr; @@ -2342,7 +2342,7 @@ int32_t kprender(const char *buf, int32_t leng, intptr_t frameptr, int32_t bpl, //Given: string i and string j. string j can have wildcards //Returns: 1:matches, 0:doesn't match -extern char toupperlookup[256]; + int32_t wildmatch(const char *match, const char *wild) { diff --git a/source/build/src/lz4.c b/source/build/src/lz4.c index bb6b619ba..5a9177567 100644 --- a/source/build/src/lz4.c +++ b/source/build/src/lz4.c @@ -1873,14 +1873,14 @@ int LZ4_uncompress_unknownOutputSize (const char* source, char* dest, int isize, int LZ4_sizeofStreamState() { return LZ4_STREAMSIZE; } -int LZ4_resetStreamState(void* state, char* inputBuffer) +int LZ4_resetStreamState(void* state, const char* inputBuffer) { (void)inputBuffer; LZ4_resetStream((LZ4_stream_t*)state); return 0; } -void* LZ4_create (char* inputBuffer) +void* LZ4_create (const char* inputBuffer) { (void)inputBuffer; return LZ4_createStream(); diff --git a/source/build/src/mdsprite.cpp b/source/build/src/mdsprite.cpp index 7f5220134..58956de18 100644 --- a/source/build/src/mdsprite.cpp +++ b/source/build/src/mdsprite.cpp @@ -1626,7 +1626,7 @@ static md3model_t *md3load(int32_t fil) } #ifdef POLYMER -static inline void invertmatrix(float *m, float *out) +static inline void invertmatrix(const float *m, float *out) { float det; diff --git a/source/build/src/mmulti_null.cpp b/source/build/src/mmulti_null.cpp index 418ffebd1..313ea1496 100644 --- a/source/build/src/mmulti_null.cpp +++ b/source/build/src/mmulti_null.cpp @@ -71,14 +71,14 @@ void setsocket(int newsocket) UNREFERENCED_PARAMETER(newsocket); } -void sendpacket(int other, unsigned char *bufptr, int messleng) +void sendpacket(int other, const unsigned char *bufptr, int messleng) { UNREFERENCED_PARAMETER(other); UNREFERENCED_PARAMETER(bufptr); UNREFERENCED_PARAMETER(messleng); } -int getpacket (int *other, unsigned char *bufptr) +int getpacket (const int *other, const unsigned char *bufptr) { UNREFERENCED_PARAMETER(other); UNREFERENCED_PARAMETER(bufptr); @@ -90,7 +90,7 @@ void flushpackets(void) { } -void genericmultifunction(int other, unsigned char *bufptr, int messleng, int command) +void genericmultifunction(int other, const unsigned char *bufptr, int messleng, int command) { UNREFERENCED_PARAMETER(other); UNREFERENCED_PARAMETER(bufptr); diff --git a/source/build/src/osd.cpp b/source/build/src/osd.cpp index c53a5516e..5d9bf1ca4 100644 --- a/source/build/src/osd.cpp +++ b/source/build/src/osd.cpp @@ -20,14 +20,6 @@ static osdsymbol_t *osd_addsymbol(const char *name); static osdsymbol_t *osd_findsymbol(const char *pszName, osdsymbol_t *pSymbol); static osdsymbol_t *osd_findexactsymbol(const char *pszName); -// static int32_t _validate_osdlines(void *); - -static int32_t osdfunc_listsymbols(osdfuncparm_t const * const); -static int32_t osdfunc_help(osdfuncparm_t const * const); -static int32_t osdfunc_alias(osdfuncparm_t const * const); -// static int32_t osdfunc_dumpbuildinfo(osdfuncparm_t const * const); -// static int32_t osdfunc_setrendermode(osdfuncparm_t const * const); - static int32_t whiteColorIdx=-1; // colour of white (used by default display routines) static void _internal_drawosdchar(int32_t, int32_t, char, int32_t, int32_t); static void _internal_drawosdstr(int32_t, int32_t, const char *, int32_t, int32_t, int32_t); diff --git a/source/build/src/polymer.cpp b/source/build/src/polymer.cpp index 93eea908e..d4208d179 100644 --- a/source/build/src/polymer.cpp +++ b/source/build/src/polymer.cpp @@ -1435,11 +1435,11 @@ void polymer_postrotatesprite(void) polymer_unbindmaterial(rotatespritematerialbits); } -static void polymer_setupdiffusemodulation(_prplane *plane, GLubyte modulation, GLubyte *data) +static void polymer_setupdiffusemodulation(_prplane *plane, GLubyte modulation, const GLubyte *data) { plane->material.diffusemodulation[0] = modulation; - plane->material.diffusemodulation[1] = ((GLubyte *) data)[0]; - plane->material.diffusemodulation[2] = ((GLubyte *) data)[1]; + plane->material.diffusemodulation[1] = ((GLubyte const *) data)[0]; + plane->material.diffusemodulation[2] = ((GLubyte const *) data)[1]; plane->material.diffusemodulation[3] = 0xFF; } @@ -2123,8 +2123,7 @@ static void polymer_displayrooms(const int16_t dacursectnum) renderDrawMasks(); glEnable(GL_CULL_FACE); } - return; -} + } static void polymer_emptybuckets(void) { @@ -2400,7 +2399,7 @@ static void polymer_drawplane(_prplane* plane) } } -static inline void polymer_inb4mirror(_prvert* buffer, GLfloat* plane) +static inline void polymer_inb4mirror(_prvert* buffer, const GLfloat* plane) { float pv; float reflectionmatrix[16]; @@ -2886,7 +2885,6 @@ void PR_CALLBACK polymer_tessedgeflag(GLenum error) { // Passing an edgeflag callback forces the tesselator to output a triangle list UNREFERENCED_PARAMETER(error); - return; } void PR_CALLBACK polymer_tessvertex(void* vertex, void* sector) @@ -3698,14 +3696,14 @@ static void polymer_computeplane(_prplane* p) (!p->indices && i < p->vertcount)); } -static inline void polymer_crossproduct(GLfloat* in_a, GLfloat* in_b, GLfloat* out) +static inline void polymer_crossproduct(const GLfloat* in_a, const GLfloat* in_b, GLfloat* out) { out[0] = in_a[1] * in_b[2] - in_a[2] * in_b[1]; out[1] = in_a[2] * in_b[0] - in_a[0] * in_b[2]; out[2] = in_a[0] * in_b[1] - in_a[1] * in_b[0]; } -static inline void polymer_transformpoint(const float* inpos, float* pos, float* matrix) +static inline void polymer_transformpoint(const float* inpos, float* pos, const float* matrix) { pos[0] = inpos[0] * matrix[0] + inpos[1] * matrix[4] + @@ -3785,7 +3783,7 @@ static void polymer_extractfrustum(GLfloat* modelview, GLfloat* projecti if (pr_verbosity >= 3) OSD_Printf("PR : Frustum extracted.\n"); } -static inline int32_t polymer_planeinfrustum(_prplane *plane, float* frustum) +static inline int32_t polymer_planeinfrustum(_prplane *plane, const float* frustum) { int32_t i, j, k = -1; i = 4; @@ -4325,8 +4323,6 @@ static void polymer_drawskybox(int16_t tilenum, char palnum, int8_t shad if (pr_vbos > 0) glBindBuffer(GL_ARRAY_BUFFER, 0); - - return; } // MDSPRITES @@ -5065,7 +5061,7 @@ done: return bucketptr; } -static int32_t polymer_bindmaterial(const _prmaterial *material, int16_t* lights, int matlightcount) +static int32_t polymer_bindmaterial(const _prmaterial *material, const int16_t* lights, int matlightcount) { int32_t programbits; int32_t texunit; diff --git a/source/build/src/polymost.cpp b/source/build/src/polymost.cpp index dd6acf2e1..28b925c1e 100644 --- a/source/build/src/polymost.cpp +++ b/source/build/src/polymost.cpp @@ -363,7 +363,7 @@ float glox1, gloy1, glox2, gloy2; static int32_t gltexcacnum = -1; //in-place multiply m0=m0*m1 -static float* multiplyMatrix4f(float m0[4*4], float m1[4*4]) +static float* multiplyMatrix4f(float m0[4*4], const float m1[4*4]) { float mR[4*4]; @@ -1248,7 +1248,6 @@ void polymost_init() } ////////// VISIBILITY FOG ROUTINES ////////// -extern int32_t nofog; // in windows/SDL layers // only for r_usenewshading < 2 (not preferred) static void fogcalc_old(int32_t shade, int32_t vis) @@ -3985,7 +3984,7 @@ void polymost_editorfunc(void) searchit = 0; } -void polymost_scansector(int32_t sectnum); + // variables that are set to ceiling- or floor-members, depending // on which one is processed right now diff --git a/source/build/src/voxmodel.cpp b/source/build/src/voxmodel.cpp index e0d217732..360afb077 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 -uint32_t gloadtex(int32_t *picbuf, int32_t xsiz, int32_t ysiz, int32_t is8bit, int32_t dapal) +uint32_t gloadtex(const int32_t *picbuf, int32_t xsiz, int32_t ysiz, int32_t is8bit, int32_t dapal) { const char *const cptr = &britable[gammabrightness ? 0 : curbrightness][0];