fix misc errata

master
an 2019-11-25 16:33:54 -05:00
parent 2ebc7fb7dd
commit a24e23f6d7
11 changed files with 57 additions and 38 deletions

View File

@ -189,8 +189,8 @@ typedef struct mnode_s
mplane_t *plane; mplane_t *plane;
struct mnode_s *children[2]; struct mnode_s *children[2];
unsigned int firstsurface; int firstsurface;
unsigned int numsurfaces; int numsurfaces;
} mnode_t; } mnode_t;

View File

@ -76,5 +76,6 @@ char *PL_GetClipboardData (void)
void PL_ErrorDialog (const char *errorMsg) void PL_ErrorDialog (const char *errorMsg)
{ {
(void)errorMsg;
} }

View File

@ -40,7 +40,7 @@ int vis_changed; //if true, force pvs to be refreshed
/* /*
================ ================
R_ClearTextureChains -- ericw R_ClearTextureChains -- ericw
clears texture chains for all textures used by the given model, and also clears texture chains for all textures used by the given model, and also
clears the lightmap chains clears the lightmap chains
@ -54,7 +54,7 @@ void R_ClearTextureChains (qmodel_t *mod, texchain_t chain)
for (i=0 ; i<mod->numtextures ; i++) for (i=0 ; i<mod->numtextures ; i++)
if (mod->textures[i]) if (mod->textures[i])
mod->textures[i]->texturechains[chain] = NULL; mod->textures[i]->texturechains[chain] = NULL;
// clear lightmap chains // clear lightmap chains
memset (lightmap_polys, 0, sizeof(lightmap_polys)); memset (lightmap_polys, 0, sizeof(lightmap_polys));
} }
@ -237,7 +237,7 @@ void R_CullSurfaces (void)
================ ================
R_BuildLightmapChains -- johnfitz -- used for r_lightmap 1 R_BuildLightmapChains -- johnfitz -- used for r_lightmap 1
ericw -- now always used at the start of R_DrawTextureChains for the ericw -- now always used at the start of R_DrawTextureChains for the
mh dynamic lighting speedup mh dynamic lighting speedup
================ ================
*/ */
@ -496,10 +496,10 @@ static void R_BatchSurface (msurface_t *s)
int num_surf_indices; int num_surf_indices;
num_surf_indices = R_NumTriangleIndicesForSurf (s); num_surf_indices = R_NumTriangleIndicesForSurf (s);
if (num_vbo_indices + num_surf_indices > MAX_BATCH_SIZE) if (num_vbo_indices + num_surf_indices > MAX_BATCH_SIZE)
R_FlushBatch(); R_FlushBatch();
R_TriangleIndicesForSurf (s, &vbo_indices[num_vbo_indices]); R_TriangleIndicesForSurf (s, &vbo_indices[num_vbo_indices]);
num_vbo_indices += num_surf_indices; num_vbo_indices += num_surf_indices;
} }
@ -531,10 +531,10 @@ void R_DrawTextureChains_Multitexture (qmodel_t *model, entity_t *ent, texchain_
if (!bound) //only bind once we are sure we need this texture if (!bound) //only bind once we are sure we need this texture
{ {
GL_Bind ((R_TextureAnimation(t, ent != NULL ? ent->frame : 0))->gltexture); GL_Bind ((R_TextureAnimation(t, ent != NULL ? ent->frame : 0))->gltexture);
if (t->texturechains[chain]->flags & SURF_DRAWFENCE) if (t->texturechains[chain]->flags & SURF_DRAWFENCE)
glEnable (GL_ALPHA_TEST); // Flip alpha test back on glEnable (GL_ALPHA_TEST); // Flip alpha test back on
GL_EnableMultitexture(); // selects TEXTURE1 GL_EnableMultitexture(); // selects TEXTURE1
bound = true; bound = true;
} }
@ -621,16 +621,16 @@ void R_DrawTextureChains_TextureOnly (qmodel_t *model, entity_t *ent, texchain_t
if (!bound) //only bind once we are sure we need this texture if (!bound) //only bind once we are sure we need this texture
{ {
GL_Bind ((R_TextureAnimation(t, ent != NULL ? ent->frame : 0))->gltexture); GL_Bind ((R_TextureAnimation(t, ent != NULL ? ent->frame : 0))->gltexture);
if (t->texturechains[chain]->flags & SURF_DRAWFENCE) if (t->texturechains[chain]->flags & SURF_DRAWFENCE)
glEnable (GL_ALPHA_TEST); // Flip alpha test back on glEnable (GL_ALPHA_TEST); // Flip alpha test back on
bound = true; bound = true;
} }
DrawGLPoly (s->polys); DrawGLPoly (s->polys);
rs_brushpasses++; rs_brushpasses++;
} }
if (bound && t->texturechains[chain]->flags & SURF_DRAWFENCE) if (bound && t->texturechains[chain]->flags & SURF_DRAWFENCE)
glDisable (GL_ALPHA_TEST); // Flip alpha test back off glDisable (GL_ALPHA_TEST); // Flip alpha test back off
} }
@ -639,7 +639,7 @@ void R_DrawTextureChains_TextureOnly (qmodel_t *model, entity_t *ent, texchain_t
/* /*
================ ================
GL_WaterAlphaForEntitySurface -- ericw GL_WaterAlphaForEntitySurface -- ericw
Returns the water alpha to use for the entity and surface combination. Returns the water alpha to use for the entity and surface combination.
================ ================
*/ */
@ -824,7 +824,7 @@ void GLWorld_CreateShaders (void)
{ "TexCoords", texCoordsAttrIndex }, { "TexCoords", texCoordsAttrIndex },
{ "LMCoords", LMCoordsAttrIndex } { "LMCoords", LMCoordsAttrIndex }
}; };
const GLchar *vertSource = \ const GLchar *vertSource = \
"#version 110\n" "#version 110\n"
"\n" "\n"
@ -841,7 +841,7 @@ void GLWorld_CreateShaders (void)
" gl_Position = gl_ModelViewProjectionMatrix * vec4(Vert, 1.0);\n" " gl_Position = gl_ModelViewProjectionMatrix * vec4(Vert, 1.0);\n"
" FogFragCoord = gl_Position.w;\n" " FogFragCoord = gl_Position.w;\n"
"}\n"; "}\n";
const GLchar *fragSource = \ const GLchar *fragSource = \
"#version 110\n" "#version 110\n"
"\n" "\n"
@ -872,12 +872,12 @@ void GLWorld_CreateShaders (void)
" result.a = Alpha;\n" // FIXME: This will make almost transparent things cut holes though heavy fog " result.a = Alpha;\n" // FIXME: This will make almost transparent things cut holes though heavy fog
" gl_FragColor = result;\n" " gl_FragColor = result;\n"
"}\n"; "}\n";
if (!gl_glsl_alias_able) if (!gl_glsl_alias_able)
return; return;
r_world_program = GL_CreateProgram (vertSource, fragSource, sizeof(bindings)/sizeof(bindings[0]), bindings); r_world_program = GL_CreateProgram (vertSource, fragSource, sizeof(bindings)/sizeof(bindings[0]), bindings);
if (r_world_program != 0) if (r_world_program != 0)
{ {
// get uniform locations // get uniform locations
@ -910,7 +910,7 @@ void R_DrawTextureChains_GLSL (qmodel_t *model, entity_t *ent, texchain_t chain)
int lastlightmap; int lastlightmap;
gltexture_t *fullbright = NULL; gltexture_t *fullbright = NULL;
float entalpha; float entalpha;
entalpha = (ent != NULL) ? ENTALPHA_DECODE(ent->alpha) : 1.0f; entalpha = (ent != NULL) ? ENTALPHA_DECODE(ent->alpha) : 1.0f;
// enable blending / disable depth writes // enable blending / disable depth writes
@ -919,9 +919,9 @@ void R_DrawTextureChains_GLSL (qmodel_t *model, entity_t *ent, texchain_t chain)
glDepthMask (GL_FALSE); glDepthMask (GL_FALSE);
glEnable (GL_BLEND); glEnable (GL_BLEND);
} }
GL_UseProgramFunc (r_world_program); GL_UseProgramFunc (r_world_program);
// Bind the buffers // Bind the buffers
GL_BindBuffer (GL_ARRAY_BUFFER, gl_bmodel_vbo); GL_BindBuffer (GL_ARRAY_BUFFER, gl_bmodel_vbo);
GL_BindBuffer (GL_ELEMENT_ARRAY_BUFFER, 0); // indices come from client memory! GL_BindBuffer (GL_ELEMENT_ARRAY_BUFFER, 0); // indices come from client memory!
@ -929,11 +929,11 @@ void R_DrawTextureChains_GLSL (qmodel_t *model, entity_t *ent, texchain_t chain)
GL_EnableVertexAttribArrayFunc (vertAttrIndex); GL_EnableVertexAttribArrayFunc (vertAttrIndex);
GL_EnableVertexAttribArrayFunc (texCoordsAttrIndex); GL_EnableVertexAttribArrayFunc (texCoordsAttrIndex);
GL_EnableVertexAttribArrayFunc (LMCoordsAttrIndex); GL_EnableVertexAttribArrayFunc (LMCoordsAttrIndex);
GL_VertexAttribPointerFunc (vertAttrIndex, 3, GL_FLOAT, GL_FALSE, VERTEXSIZE * sizeof(float), ((float *)0)); GL_VertexAttribPointerFunc (vertAttrIndex, 3, GL_FLOAT, GL_FALSE, VERTEXSIZE * sizeof(float), &((float *)NULL)[0]);
GL_VertexAttribPointerFunc (texCoordsAttrIndex, 2, GL_FLOAT, GL_FALSE, VERTEXSIZE * sizeof(float), ((float *)0) + 3); GL_VertexAttribPointerFunc (texCoordsAttrIndex, 2, GL_FLOAT, GL_FALSE, VERTEXSIZE * sizeof(float), &((float *)NULL)[3]);
GL_VertexAttribPointerFunc (LMCoordsAttrIndex, 2, GL_FLOAT, GL_FALSE, VERTEXSIZE * sizeof(float), ((float *)0) + 5); GL_VertexAttribPointerFunc (LMCoordsAttrIndex, 2, GL_FLOAT, GL_FALSE, VERTEXSIZE * sizeof(float), &((float *)NULL)[3 + 2]);
// set uniforms // set uniforms
GL_Uniform1iFunc (texLoc, 0); GL_Uniform1iFunc (texLoc, 0);
GL_Uniform1iFunc (LMTexLoc, 1); GL_Uniform1iFunc (LMTexLoc, 1);
@ -942,7 +942,7 @@ void R_DrawTextureChains_GLSL (qmodel_t *model, entity_t *ent, texchain_t chain)
GL_Uniform1iFunc (useOverbrightLoc, (int)gl_overbright.value); GL_Uniform1iFunc (useOverbrightLoc, (int)gl_overbright.value);
GL_Uniform1iFunc (useAlphaTestLoc, 0); GL_Uniform1iFunc (useAlphaTestLoc, 0);
GL_Uniform1fFunc (alphaLoc, entalpha); GL_Uniform1fFunc (alphaLoc, entalpha);
for (i=0 ; i<model->numtextures ; i++) for (i=0 ; i<model->numtextures ; i++)
{ {
t = model->textures[i]; t = model->textures[i];
@ -972,14 +972,14 @@ void R_DrawTextureChains_GLSL (qmodel_t *model, entity_t *ent, texchain_t chain)
{ {
GL_SelectTexture (GL_TEXTURE0); GL_SelectTexture (GL_TEXTURE0);
GL_Bind ((R_TextureAnimation(t, ent != NULL ? ent->frame : 0))->gltexture); GL_Bind ((R_TextureAnimation(t, ent != NULL ? ent->frame : 0))->gltexture);
if (t->texturechains[chain]->flags & SURF_DRAWFENCE) if (t->texturechains[chain]->flags & SURF_DRAWFENCE)
GL_Uniform1iFunc (useAlphaTestLoc, 1); // Flip alpha test back on GL_Uniform1iFunc (useAlphaTestLoc, 1); // Flip alpha test back on
bound = true; bound = true;
lastlightmap = s->lightmaptexturenum; lastlightmap = s->lightmaptexturenum;
} }
if (s->lightmaptexturenum != lastlightmap) if (s->lightmaptexturenum != lastlightmap)
R_FlushBatch (); R_FlushBatch ();
@ -996,15 +996,15 @@ void R_DrawTextureChains_GLSL (qmodel_t *model, entity_t *ent, texchain_t chain)
if (bound && t->texturechains[chain]->flags & SURF_DRAWFENCE) if (bound && t->texturechains[chain]->flags & SURF_DRAWFENCE)
GL_Uniform1iFunc (useAlphaTestLoc, 0); // Flip alpha test back off GL_Uniform1iFunc (useAlphaTestLoc, 0); // Flip alpha test back off
} }
// clean up // clean up
GL_DisableVertexAttribArrayFunc (vertAttrIndex); GL_DisableVertexAttribArrayFunc (vertAttrIndex);
GL_DisableVertexAttribArrayFunc (texCoordsAttrIndex); GL_DisableVertexAttribArrayFunc (texCoordsAttrIndex);
GL_DisableVertexAttribArrayFunc (LMCoordsAttrIndex); GL_DisableVertexAttribArrayFunc (LMCoordsAttrIndex);
GL_UseProgramFunc (0); GL_UseProgramFunc (0);
GL_SelectTexture (GL_TEXTURE0); GL_SelectTexture (GL_TEXTURE0);
if (entalpha < 1) if (entalpha < 1)
{ {
glDepthMask (GL_TRUE); glDepthMask (GL_TRUE);
@ -1020,7 +1020,7 @@ R_DrawWorld -- johnfitz -- rewritten
void R_DrawTextureChains (qmodel_t *model, entity_t *ent, texchain_t chain) void R_DrawTextureChains (qmodel_t *model, entity_t *ent, texchain_t chain)
{ {
float entalpha; float entalpha;
if (ent != NULL) if (ent != NULL)
entalpha = ENTALPHA_DECODE(ent->alpha); entalpha = ENTALPHA_DECODE(ent->alpha);
else else
@ -1075,7 +1075,7 @@ void R_DrawTextureChains (qmodel_t *model, entity_t *ent, texchain_t chain)
if (r_world_program != 0) if (r_world_program != 0)
{ {
R_EndTransparentDrawing (entalpha); R_EndTransparentDrawing (entalpha);
R_DrawTextureChains_GLSL (model, ent, chain); R_DrawTextureChains_GLSL (model, ent, chain);
return; return;
} }

View File

@ -116,11 +116,13 @@ static void S_SoundInfo_f (void)
static void SND_Callback_sfxvolume (cvar_t *var) static void SND_Callback_sfxvolume (cvar_t *var)
{ {
(void)var;
SND_InitScaletable (); SND_InitScaletable ();
} }
static void SND_Callback_snd_filterquality (cvar_t *var) static void SND_Callback_snd_filterquality (cvar_t *var)
{ {
(void)var;
if (snd_filterquality.value < 1 || snd_filterquality.value > 5) if (snd_filterquality.value < 1 || snd_filterquality.value > 5)
{ {
Con_Printf ("snd_filterquality must be between 1 and 5\n"); Con_Printf ("snd_filterquality must be between 1 and 5\n");
@ -182,7 +184,7 @@ void S_Init (void)
Cvar_RegisterVariable(&sndspeed); Cvar_RegisterVariable(&sndspeed);
Cvar_RegisterVariable(&snd_mixspeed); Cvar_RegisterVariable(&snd_mixspeed);
Cvar_RegisterVariable(&snd_filterquality); Cvar_RegisterVariable(&snd_filterquality);
if (safemode || COM_CheckParm("-nosound")) if (safemode || COM_CheckParm("-nosound"))
return; return;
@ -199,7 +201,7 @@ void S_Init (void)
{ {
Cvar_SetQuick (&sndspeed, com_argv[i+1]); Cvar_SetQuick (&sndspeed, com_argv[i+1]);
} }
i = COM_CheckParm("-mixspeed"); i = COM_CheckParm("-mixspeed");
if (i && i < com_argc-1) if (i && i < com_argc-1)
{ {

View File

@ -80,6 +80,7 @@ static void
flac_error_func (const FLAC__StreamDecoder *decoder, flac_error_func (const FLAC__StreamDecoder *decoder,
FLAC__StreamDecoderErrorStatus status, void *client_data) FLAC__StreamDecoderErrorStatus status, void *client_data)
{ {
(void)decoder;
flacfile_t *ff = (flacfile_t *) client_data; flacfile_t *ff = (flacfile_t *) client_data;
ff->error = -1; ff->error = -1;
Con_Printf ("FLAC: decoder error %i\n", status); Con_Printf ("FLAC: decoder error %i\n", status);
@ -90,6 +91,7 @@ flac_read_func (const FLAC__StreamDecoder *decoder, FLAC__byte buffer[],
FLAC_SIZE_T *bytes, void *client_data) FLAC_SIZE_T *bytes, void *client_data)
{ {
flacfile_t *ff = (flacfile_t *) client_data; flacfile_t *ff = (flacfile_t *) client_data;
(void)decoder;
if (*bytes > 0) if (*bytes > 0)
{ {
*bytes = FS_fread(buffer, 1, *bytes, ff->file); *bytes = FS_fread(buffer, 1, *bytes, ff->file);
@ -107,6 +109,7 @@ flac_seek_func (const FLAC__StreamDecoder *decoder,
FLAC__uint64 absolute_byte_offset, void *client_data) FLAC__uint64 absolute_byte_offset, void *client_data)
{ {
flacfile_t *ff = (flacfile_t *) client_data; flacfile_t *ff = (flacfile_t *) client_data;
(void)decoder;
if (FS_fseek(ff->file, (long)absolute_byte_offset, SEEK_SET) < 0) if (FS_fseek(ff->file, (long)absolute_byte_offset, SEEK_SET) < 0)
return FLAC__STREAM_DECODER_SEEK_STATUS_ERROR; return FLAC__STREAM_DECODER_SEEK_STATUS_ERROR;
return FLAC__STREAM_DECODER_SEEK_STATUS_OK; return FLAC__STREAM_DECODER_SEEK_STATUS_OK;
@ -118,6 +121,7 @@ flac_tell_func (const FLAC__StreamDecoder *decoder,
{ {
flacfile_t *ff = (flacfile_t *) client_data; flacfile_t *ff = (flacfile_t *) client_data;
long pos = FS_ftell (ff->file); long pos = FS_ftell (ff->file);
(void)decoder;
if (pos < 0) return FLAC__STREAM_DECODER_TELL_STATUS_ERROR; if (pos < 0) return FLAC__STREAM_DECODER_TELL_STATUS_ERROR;
*absolute_byte_offset = (FLAC__uint64) pos; *absolute_byte_offset = (FLAC__uint64) pos;
return FLAC__STREAM_DECODER_TELL_STATUS_OK; return FLAC__STREAM_DECODER_TELL_STATUS_OK;
@ -128,6 +132,7 @@ flac_length_func (const FLAC__StreamDecoder *decoder,
FLAC__uint64 *stream_length, void *client_data) FLAC__uint64 *stream_length, void *client_data)
{ {
flacfile_t *ff = (flacfile_t *) client_data; flacfile_t *ff = (flacfile_t *) client_data;
(void)decoder;
*stream_length = (FLAC__uint64) FS_filelength (ff->file); *stream_length = (FLAC__uint64) FS_filelength (ff->file);
return FLAC__STREAM_DECODER_LENGTH_STATUS_OK; return FLAC__STREAM_DECODER_LENGTH_STATUS_OK;
} }
@ -136,6 +141,7 @@ static FLAC__bool
flac_eof_func (const FLAC__StreamDecoder *decoder, void *client_data) flac_eof_func (const FLAC__StreamDecoder *decoder, void *client_data)
{ {
flacfile_t *ff = (flacfile_t *) client_data; flacfile_t *ff = (flacfile_t *) client_data;
(void)decoder;
if (FS_feof (ff->file)) return true; if (FS_feof (ff->file)) return true;
return false; return false;
} }
@ -146,6 +152,7 @@ flac_write_func (const FLAC__StreamDecoder *decoder,
void *client_data) void *client_data)
{ {
flacfile_t *ff = (flacfile_t *) client_data; flacfile_t *ff = (flacfile_t *) client_data;
(void)decoder;
if (!ff->buffer) { if (!ff->buffer) {
ff->buffer = (byte *) malloc (ff->info->blocksize * ff->info->channels * ff->info->width); ff->buffer = (byte *) malloc (ff->info->blocksize * ff->info->channels * ff->info->width);
@ -212,6 +219,7 @@ flac_meta_func (const FLAC__StreamDecoder *decoder,
const FLAC__StreamMetadata *metadata, void *client_data) const FLAC__StreamMetadata *metadata, void *client_data)
{ {
flacfile_t *ff = (flacfile_t *) client_data; flacfile_t *ff = (flacfile_t *) client_data;
(void)decoder;
if (metadata->type == FLAC__METADATA_TYPE_STREAMINFO) if (metadata->type == FLAC__METADATA_TYPE_STREAMINFO)
{ {
ff->info->rate = metadata->data.stream_info.sample_rate; ff->info->rate = metadata->data.stream_info.sample_rate;

View File

@ -36,6 +36,7 @@
static int opc_fclose (void *f) static int opc_fclose (void *f)
{ {
(void)f;
return 0; /* we fclose() elsewhere. */ return 0; /* we fclose() elsewhere. */
} }

View File

@ -34,6 +34,8 @@ static void SDLCALL paint_audio (void *unused, Uint8 *stream, int len)
int pos, tobufend; int pos, tobufend;
int len1, len2; int len1, len2;
(void)unused;
if (!shm) if (!shm)
{ /* shouldn't happen, but just in case */ { /* shouldn't happen, but just in case */
memset(stream, 0, len); memset(stream, 0, len);

View File

@ -375,6 +375,7 @@ static qboolean S_UMX_CodecOpenStream (snd_stream_t *stream)
static int S_UMX_CodecReadStream (snd_stream_t *stream, int bytes, void *buffer) static int S_UMX_CodecReadStream (snd_stream_t *stream, int bytes, void *buffer)
{ {
(void)stream, (void)bytes, (void)buffer;
return -1; return -1;
} }
@ -385,6 +386,7 @@ static void S_UMX_CodecCloseStream (snd_stream_t *stream)
static int S_UMX_CodecRewindStream (snd_stream_t *stream) static int S_UMX_CodecRewindStream (snd_stream_t *stream)
{ {
(void)stream;
return -1; return -1;
} }

View File

@ -47,6 +47,7 @@
static int ovc_fclose (void *f) static int ovc_fclose (void *f)
{ {
(void)f;
return 0; /* we fclose() elsewhere. */ return 0; /* we fclose() elsewhere. */
} }

View File

@ -237,6 +237,7 @@ static int PartialIPAddress (const char *in, struct qsockaddr *hostaddr)
int UDP_Connect (sys_socket_t socketid, struct qsockaddr *addr) int UDP_Connect (sys_socket_t socketid, struct qsockaddr *addr)
{ {
(void)socketid, (void)addr;
return 0; return 0;
} }

View File

@ -246,7 +246,6 @@ static char const *Sys_GetUserDir(void)
static char user_dir[MAX_OSPATH]; static char user_dir[MAX_OSPATH];
static char app_name[] = "AGWQuake"; static char app_name[] = "AGWQuake";
size_t n;
char const *home_dir; char const *home_dir;
#ifdef PLATFORM_OSX #ifdef PLATFORM_OSX
@ -315,6 +314,8 @@ static void Sys_GetBasedir (char *argv0, char *dst, size_t dstsize)
{ {
char *tmp; char *tmp;
(void)argv0;
if (getcwd(dst, dstsize - 1) == NULL) if (getcwd(dst, dstsize - 1) == NULL)
Sys_Error ("Couldn't determine current directory"); Sys_Error ("Couldn't determine current directory");