Skip to content

Commit

Permalink
constifications
Browse files Browse the repository at this point in the history
  • Loading branch information
sezero committed Sep 30, 2023
1 parent 8485184 commit e44ee51
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 23 deletions.
4 changes: 2 additions & 2 deletions Quake/cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ Cmd_Exec_f
*/
void Cmd_Exec_f (void)
{
char *f;
const char *f;
int mark;

if (Cmd_Argc () != 2)
Expand All @@ -270,7 +270,7 @@ void Cmd_Exec_f (void)
}

mark = Hunk_LowMark ();
f = (char *)COM_LoadHunkFile (Cmd_Argv(1), NULL);
f = (const char *)COM_LoadHunkFile (Cmd_Argv(1), NULL);
if (!f && !strcmp(Cmd_Argv(1), "default.cfg")) {
f = default_cfg; /* see above.. */
}
Expand Down
2 changes: 1 addition & 1 deletion Quake/crc.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define CRC_INIT_VALUE 0xffff
#define CRC_XOR_VALUE 0x0000

static unsigned short crctable[256] =
static const unsigned short crctable[256] =
{
0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50a5, 0x60c6, 0x70e7,
0x8108, 0x9129, 0xa14a, 0xb16b, 0xc18c, 0xd1ad, 0xe1ce, 0xf1ef,
Expand Down
2 changes: 1 addition & 1 deletion Quake/default_cfg.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// keep in sync with Misc/qs_pak/default.cfg

static char default_cfg[] =
static const char default_cfg[] =
"unbindall\n"

"bind ALT +strafe\n"
Expand Down
19 changes: 8 additions & 11 deletions Quake/gl_mesh.c
Original file line number Diff line number Diff line change
Expand Up @@ -434,9 +434,6 @@ static void GL_MakeAliasModelDisplayLists_VBO (qmodel_t *aliasmodel, aliashdr_t
GLMesh_LoadVertexBuffer (aliasmodel, pheader);
}

#define NUMVERTEXNORMALS 162
extern float r_avertexnormals[NUMVERTEXNORMALS][3];

/*
================
GLMesh_LoadVertexBuffer
Expand All @@ -457,23 +454,23 @@ static void GLMesh_LoadVertexBuffer (qmodel_t *m, const aliashdr_t *hdr)

if (!gl_glsl_alias_able)
return;

// count the sizes we need

// ericw -- RMQEngine stored these vbo*ofs values in aliashdr_t, but we must not
// mutate Mod_Extradata since it might be reloaded from disk, so I moved them to qmodel_t
// (test case: roman1.bsp from arwop, 64mb heap)
m->vboindexofs = 0;

m->vboxyzofs = 0;
totalvbosize += (hdr->numposes * hdr->numverts_vbo * sizeof (meshxyz_t)); // ericw -- what RMQEngine called nummeshframes is called numposes in QuakeSpasm

m->vbostofs = totalvbosize;
totalvbosize += (hdr->numverts_vbo * sizeof (meshst_t));

if (!hdr->numindexes) return;
if (!totalvbosize) return;

// grab the pointers to data in the extradata

desc = (aliasmesh_t *) ((byte *) hdr + hdr->meshdesc);
Expand Down Expand Up @@ -563,7 +560,7 @@ void GLMesh_LoadVertexBuffers (void)

if (!gl_glsl_alias_able)
return;

for (j = 1; j < MAX_MODELS; j++)
{
if (!(m = cl.model_precache[j])) break;
Expand All @@ -589,7 +586,7 @@ void GLMesh_DeleteVertexBuffers (void)

if (!gl_glsl_alias_able)
return;

for (j = 1; j < MAX_MODELS; j++)
{
if (!(m = cl.model_precache[j])) break;
Expand All @@ -601,6 +598,6 @@ void GLMesh_DeleteVertexBuffers (void)
GL_DeleteBuffersFunc (1, &m->meshindexesvbo);
m->meshindexesvbo = 0;
}

GL_ClearBufferBindings ();
}
3 changes: 1 addition & 2 deletions Quake/gl_warp.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ cvar_t r_waterwarp = {"r_waterwarp", "1", CVAR_NONE};
int gl_warpimagesize;
float load_subdivide_size; //johnfitz -- remember what subdivide_size value was when this map was loaded

float turbsin[] =
{
static const float turbsin[] = {
#include "gl_warp_sin.h"
};

Expand Down
3 changes: 3 additions & 0 deletions Quake/glquake.h
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,9 @@ typedef struct glsl_attrib_binding_s {

extern float map_wateralpha, map_lavaalpha, map_telealpha, map_slimealpha; //ericw

#define NUMVERTEXNORMALS 162
extern const float r_avertexnormals[NUMVERTEXNORMALS][3];

//johnfitz -- fog functions called from outside gl_fog.c
void Fog_ParseServerMessage (void);
float *Fog_GetColor (void);
Expand Down
7 changes: 3 additions & 4 deletions Quake/r_alias.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,22 +30,21 @@ extern cvar_t scr_fov, cl_gun_fovscale;
//up to 16 color translated skins
gltexture_t *playertextures[MAX_SCOREBOARD]; //johnfitz -- changed to an array of pointers

#define NUMVERTEXNORMALS 162
float r_avertexnormals[NUMVERTEXNORMALS][3] = {
const float r_avertexnormals[NUMVERTEXNORMALS][3] = {
#include "anorms.h"
};

extern vec3_t lightcolor; //johnfitz -- replaces "float shadelight" for lit support

// precalculated dot products for quantized angles
#define SHADEDOT_QUANT 16
static float r_avertexnormal_dots[SHADEDOT_QUANT][256] = {
static const float r_avertexnormal_dots[SHADEDOT_QUANT][256] = {
#include "anorm_dots.h"
};

extern vec3_t lightspot;

static float *shadedots = r_avertexnormal_dots[0];
static const float *shadedots = r_avertexnormal_dots[0];
static vec3_t shadevector;

static float entalpha; //johnfitz
Expand Down
2 changes: 0 additions & 2 deletions Quake/r_part.c
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,6 @@ void R_InitParticles (void)
R_EntityParticles
===============
*/
#define NUMVERTEXNORMALS 162
extern float r_avertexnormals[NUMVERTEXNORMALS][3];
static vec3_t avelocities[NUMVERTEXNORMALS];
static float beamlength = 16;

Expand Down

0 comments on commit e44ee51

Please sign in to comment.