From 5e1a561bc85f79219e98790e319d380de2b06330 Mon Sep 17 00:00:00 2001 From: kristus Date: Thu, 29 Apr 2021 19:51:00 +0200 Subject: [PATCH] Fix : Fixed warnings in Linux Compile. --- cl_collision.c | 98 +++++++++++++++++++++++--------------------------- csprogs.c | 6 ++-- snd_ogg.c | 9 ++--- sv_send.c | 9 ++--- 4 files changed, 57 insertions(+), 65 deletions(-) diff --git a/cl_collision.c b/cl_collision.c index 58026c68..32cc749b 100644 --- a/cl_collision.c +++ b/cl_collision.c @@ -209,7 +209,11 @@ trace_t CL_TracePoint(const vec3_t start, int type, prvm_edict_t *passedict, int int i, bodysupercontents; int passedictprog; prvm_edict_t *traceowner, *touch; + entity_render_t *ent; + entity_state_t *ent_fields; trace_t trace; + vec3_t origin, entmins, entmaxs; + matrix4x4_t entmatrix, entinversematrix; // temporary storage because prvm_vec_t may need conversion vec3_t touchmins, touchmaxs; // bounding box of entire move area @@ -287,11 +291,11 @@ trace_t CL_TracePoint(const vec3_t start, int type, prvm_edict_t *passedict, int { for (i = 0;i < cl.num_brushmodel_entities;i++) { - entity_state_t *ent_fields = &cl.entities[cl.brushmodel_entities[i]].state_current; + ent_fields = &cl.entities[cl.brushmodel_entities[i]].state_current; if (ent_fields->solid == SOLID_NOT) continue; - - entity_render_t *ent = &cl.entities[cl.brushmodel_entities[i]].render; + + ent = &cl.entities[cl.brushmodel_entities[i]].render; if (!BoxesOverlap(clipboxmins, clipboxmaxs, ent->mins, ent->maxs)) continue; Collision_ClipPointToGenericEntity(&trace, ent->model, ent->frameblend, ent->skeleton, vec3_origin, vec3_origin, 0, &ent->matrix, &ent->inversematrix, start, hitsupercontentsmask, skipsupercontentsmask, skipmaterialflagsmask); @@ -299,18 +303,13 @@ trace_t CL_TracePoint(const vec3_t start, int type, prvm_edict_t *passedict, int *hitnetworkentity = cl.brushmodel_entities[i]; Collision_CombineTraces(&cliptrace, &trace, NULL, true); } - - - - - vec3_t origin, entmins, entmaxs; - matrix4x4_t entmatrix, entinversematrix; - + + for (i = cl.maxclients + 1;i < cl.num_entities;i++) { - entity_render_t *ent = &cl.entities[i].render; - entity_state_t *ent_fields = &cl.entities[i].state_current; - + ent = &cl.entities[i].render; + ent_fields = &cl.entities[i].state_current; + // don't hit players that don't exist if (!cl.entities_active[i]) continue; @@ -334,8 +333,6 @@ trace_t CL_TracePoint(const vec3_t start, int type, prvm_edict_t *passedict, int // collide against player entities if (hitnetworkplayers) { - vec3_t origin, entmins, entmaxs; - matrix4x4_t entmatrix, entinversematrix; if(IS_OLDNEXUIZ_DERIVED(gamemode)) { @@ -346,13 +343,13 @@ trace_t CL_TracePoint(const vec3_t start, int type, prvm_edict_t *passedict, int for (i = 1;i <= cl.maxclients;i++) { - entity_render_t *ent = &cl.entities[i].render; - entity_state_t *ent_fields = &cl.entities[i].state_current; - + ent = &cl.entities[i].render; + ent_fields = &cl.entities[i].state_current; + // don't hit ourselves if (i == cl.playerentity) continue; - + // don't hit players that don't exist if (!cl.entities_active[i]) continue; @@ -467,6 +464,10 @@ trace_t CL_TraceLine(const vec3_t start, const vec3_t end, int type, prvm_edict_ int passedictprog; prvm_edict_t *traceowner, *touch; trace_t trace; + entity_render_t *ent; + entity_state_t *ent_fields; + vec3_t origin, entmins, entmaxs; + matrix4x4_t entmatrix, entinversematrix; // temporary storage because prvm_vec_t may need conversion vec3_t touchmins, touchmaxs; // bounding box of entire move area @@ -548,11 +549,11 @@ trace_t CL_TraceLine(const vec3_t start, const vec3_t end, int type, prvm_edict_ { for (i = 0;i < cl.num_brushmodel_entities;i++) { - entity_state_t *ent_fields = &cl.entities[cl.brushmodel_entities[i]].state_current; + ent_fields = &cl.entities[cl.brushmodel_entities[i]].state_current; if (ent_fields->solid == SOLID_NOT) continue; - - entity_render_t *ent = &cl.entities[cl.brushmodel_entities[i]].render; + + ent = &cl.entities[cl.brushmodel_entities[i]].render; if (!BoxesOverlap(clipboxmins, clipboxmaxs, ent->mins, ent->maxs)) continue; Collision_ClipLineToGenericEntity(&trace, ent->model, ent->frameblend, ent->skeleton, vec3_origin, vec3_origin, 0, &ent->matrix, &ent->inversematrix, start, end, hitsupercontentsmask, skipsupercontentsmask, skipmaterialflagsmask, extend, hitsurfaces); @@ -560,19 +561,12 @@ trace_t CL_TraceLine(const vec3_t start, const vec3_t end, int type, prvm_edict_ *hitnetworkentity = cl.brushmodel_entities[i]; Collision_CombineTraces(&cliptrace, &trace, NULL, true); } - - - - - - vec3_t origin, entmins, entmaxs; - matrix4x4_t entmatrix, entinversematrix; - + for (i = cl.maxclients + 1;i < cl.num_entities;i++) { - entity_render_t *ent = &cl.entities[i].render; - entity_state_t *ent_fields = &cl.entities[i].state_current; - + ent = &cl.entities[i].render; + ent_fields = &cl.entities[i].state_current; + // don't hit players that don't exist if (!cl.entities_active[i]) continue; @@ -596,8 +590,6 @@ trace_t CL_TraceLine(const vec3_t start, const vec3_t end, int type, prvm_edict_ // collide against player entities if (hitnetworkplayers) { - vec3_t origin, entmins, entmaxs; - matrix4x4_t entmatrix, entinversematrix; if(IS_OLDNEXUIZ_DERIVED(gamemode)) { @@ -608,8 +600,8 @@ trace_t CL_TraceLine(const vec3_t start, const vec3_t end, int type, prvm_edict_ for (i = 1;i <= cl.maxclients;i++) { - entity_render_t *ent = &cl.entities[i].render; - entity_state_t *ent_fields = &cl.entities[i].state_current; + ent = &cl.entities[i].render; + ent_fields = &cl.entities[i].state_current; // don't hit ourselves if (i == cl.playerentity) @@ -731,6 +723,10 @@ trace_t CL_TraceBox(const vec3_t start, const vec3_t mins, const vec3_t maxs, co qbool pointtrace; prvm_edict_t *traceowner, *touch; trace_t trace; + entity_render_t *ent; + entity_state_t *ent_fields; + vec3_t origin, entmins, entmaxs; + matrix4x4_t entmatrix, entinversematrix; // temporary storage because prvm_vec_t may need conversion vec3_t touchmins, touchmaxs; // bounding box of entire move area @@ -837,11 +833,11 @@ trace_t CL_TraceBox(const vec3_t start, const vec3_t mins, const vec3_t maxs, co { for (i = 0;i < cl.num_brushmodel_entities;i++) { - entity_state_t *ent_fields = &cl.entities[cl.brushmodel_entities[i]].state_current; + ent_fields = &cl.entities[cl.brushmodel_entities[i]].state_current; if (ent_fields->solid == SOLID_NOT) continue; - - entity_render_t *ent = &cl.entities[cl.brushmodel_entities[i]].render; + + ent = &cl.entities[cl.brushmodel_entities[i]].render; if (!BoxesOverlap(clipboxmins, clipboxmaxs, ent->mins, ent->maxs)) continue; Collision_ClipToGenericEntity(&trace, ent->model, ent->frameblend, ent->skeleton, vec3_origin, vec3_origin, 0, &ent->matrix, &ent->inversematrix, start, mins, maxs, end, hitsupercontentsmask, skipsupercontentsmask, skipmaterialflagsmask, extend); @@ -849,16 +845,12 @@ trace_t CL_TraceBox(const vec3_t start, const vec3_t mins, const vec3_t maxs, co *hitnetworkentity = cl.brushmodel_entities[i]; Collision_CombineTraces(&cliptrace, &trace, NULL, true); } - - - vec3_t origin, entmins, entmaxs; - matrix4x4_t entmatrix, entinversematrix; - + for (i = cl.maxclients + 1;i < cl.num_entities;i++) { - entity_render_t *ent = &cl.entities[i].render; - entity_state_t *ent_fields = &cl.entities[i].state_current; - + ent = &cl.entities[i].render; + ent_fields = &cl.entities[i].state_current; + // don't hit players that don't exist if (!cl.entities_active[i]) continue; @@ -872,12 +864,12 @@ trace_t CL_TraceBox(const vec3_t start, const vec3_t mins, const vec3_t maxs, co continue; Matrix4x4_CreateTranslate(&entmatrix, origin[0], origin[1], origin[2]); Matrix4x4_CreateTranslate(&entinversematrix, -origin[0], -origin[1], -origin[2]); - + //if (ent_fields->solid == SOLID_BSP) // Collision_ClipToGenericEntity(&trace, ent->model, ent->frameblend, ent->skeleton, vec3_origin, vec3_origin, 0, &entmatrix, &entinversematrix, start, mins, maxs, end, hitsupercontentsmask, skipsupercontentsmask, skipmaterialflagsmask, extend); //else Collision_ClipToGenericEntity(&trace, NULL, NULL, NULL, ent_fields->mins, ent_fields->maxs, SUPERCONTENTS_BODY, &entmatrix, &entinversematrix, start, mins, maxs, end, hitsupercontentsmask, skipsupercontentsmask, skipmaterialflagsmask, extend); - + if (cliptrace.fraction > trace.fraction && hitnetworkentity) *hitnetworkentity = i; Collision_CombineTraces(&cliptrace, &trace, NULL, false); @@ -887,8 +879,6 @@ trace_t CL_TraceBox(const vec3_t start, const vec3_t mins, const vec3_t maxs, co // collide against player entities if (hitnetworkplayers) { - vec3_t origin, entmins, entmaxs; - matrix4x4_t entmatrix, entinversematrix; if(IS_OLDNEXUIZ_DERIVED(gamemode)) { @@ -899,8 +889,8 @@ trace_t CL_TraceBox(const vec3_t start, const vec3_t mins, const vec3_t maxs, co for (i = 1;i <= cl.maxclients;i++) { - entity_render_t *ent = &cl.entities[i].render; - entity_state_t *ent_fields = &cl.entities[i].state_current; + ent = &cl.entities[i].render; + ent_fields = &cl.entities[i].state_current; // don't hit ourselves if (i == cl.playerentity) diff --git a/csprogs.c b/csprogs.c index 95b2247d..cae6dc41 100644 --- a/csprogs.c +++ b/csprogs.c @@ -223,6 +223,7 @@ void CSQC_UpdateNetworkTimes(double newtime, double oldtime) //[515]: set globals before calling R_UpdateView, WEIRD CRAP static void CSQC_SetGlobals (double frametime) { + char temp[128]; vec3_t pmove_org; prvm_prog_t *prog = CLVM_prog; CSQC_BEGIN @@ -254,8 +255,7 @@ static void CSQC_SetGlobals (double frametime) PRVM_clientglobalfloat(maxclients) = cl.maxclients; PRVM_clientglobalfloat(player_localentnum) = cl.viewentity; - - char temp[128]; + InfoString_GetValue(cls.userinfo, "*ip", temp, sizeof(temp)); PRVM_clientglobalstring(server_ip) = PRVM_SetEngineString(prog, temp); //Con_Printf(PRVM_clientglobalstring(server_ip)); @@ -500,7 +500,7 @@ qbool CL_VM_UpdateView (double frametime) /* * This should be fine for now but FTEQW uses flags for keydest * and checks that an array called "eyeoffset" is 0 - * + * * Just a note in case there's compatibility problems later */ PRVM_G_FLOAT(OFS_PARM2) = key_dest == key_game; diff --git a/snd_ogg.c b/snd_ogg.c index f5ea5561..f04d76be 100644 --- a/snd_ogg.c +++ b/snd_ogg.c @@ -555,7 +555,7 @@ static void OGG_DecodeTags(vorbis_comment *vc, unsigned int *start, unsigned int thiscomment = qvorbis_comment_query(vc, "REPLAYGAIN_TRACK_GAIN", 0); if(thiscomment) *gaindb = atof(thiscomment); - + startcomment = qvorbis_comment_query(vc, "LOOP_START", 0); // DarkPlaces, and some Japanese app if(startcomment) { @@ -598,6 +598,7 @@ Load an Ogg Vorbis file into memory qbool OGG_LoadVorbisFile(const char *filename, sfx_t *sfx) { unsigned char *data; + const char *nostream = NULL; fs_offset_t filesize; ov_decode_t ov_decode; OggVorbis_File vf; @@ -649,11 +650,11 @@ qbool OGG_LoadVorbisFile(const char *filename, sfx_t *sfx) sfx->format.width = 2; // We always work with 16 bits samples sfx->total_length = qov_pcm_total(&vf, -1); - + vc = qov_comment(&vf, -1); - const char *nostream = NULL; + nostream = qvorbis_comment_query(vc, "NOSTREAM", 0); - + if (snd_streaming.integer && !atof(nostream) && (snd_streaming.integer >= 2 || sfx->total_length > max(sizeof(ogg_stream_perchannel_t), snd_streaming_length.value * sfx->format.speed))) { // large sounds use the OGG fetcher to decode the file on demand (but the entire file is held in memory) diff --git a/sv_send.c b/sv_send.c index 619b3c83..791c44fd 100644 --- a/sv_send.c +++ b/sv_send.c @@ -394,6 +394,7 @@ static qbool SV_PrepareEntityForSending (prvm_edict_t *ent, entity_state_t *cs, { prvm_prog_t *prog = SVVM_prog; int i; + int csqcflags; unsigned int sendflags; unsigned int version; unsigned int modelindex, effects, flags, glowsize, lightstyle, lightpflags, light[4], specialvisibilityradius; @@ -518,8 +519,8 @@ static qbool SV_PrepareEntityForSending (prvm_edict_t *ent, entity_state_t *cs, cs->tagindex = (unsigned char)PRVM_serveredictfloat(ent, tag_index); cs->glowsize = glowsize; cs->traileffectnum = PRVM_serveredictfloat(ent, traileffectnum); - - int csqcflags = (int)(PRVM_serveredictfloat(ent, csqcflags)); + + csqcflags = (int)(PRVM_serveredictfloat(ent, csqcflags)); if (csqcflags & CSQCFLAG_SOLIDITY) { cs->solid = PRVM_serveredictfloat(ent, solid); @@ -1215,7 +1216,7 @@ void SV_WriteClientdataToMessage (client_t *client, prvm_edict_t *ent, sizebuf_t { statsf[STAT_MOVEVARS_AIRACCEL_QW_STRETCHFACTOR] = sv_airaccel_qw_stretchfactor.value; statsf[STAT_MOVEVARS_AIRCONTROL_PENALTY] = sv_aircontrol_penalty.value; - statsf[STAT_MOVEVARS_AIRSPEEDLIMIT_NONQW] = sv_airspeedlimit_nonqw.value; + statsf[STAT_MOVEVARS_AIRSPEEDLIMIT_NONQW] = sv_airspeedlimit_nonqw.value; statsf[STAT_MOVEVARS_AIRSTRAFEACCEL_QW] = sv_airstrafeaccel_qw.value; statsf[STAT_MOVEVARS_AIRCONTROL_POWER] = sv_aircontrol_power.value; // movement settings for prediction @@ -1236,7 +1237,7 @@ void SV_WriteClientdataToMessage (client_t *client, prvm_edict_t *ent, sizebuf_t statsf[STAT_MOVEVARS_AIRCONTROL] = sv_aircontrol.value; statsf[STAT_FRAGLIMIT] = fraglimit.value; statsf[STAT_TIMELIMIT] = timelimit.value; - statsf[STAT_MOVEVARS_FRICTION] = sv_friction.value; + statsf[STAT_MOVEVARS_FRICTION] = sv_friction.value; statsf[STAT_MOVEVARS_WATERFRICTION] = sv_waterfriction.value >= 0 ? sv_waterfriction.value : sv_friction.value; statsf[STAT_MOVEVARS_TICRATE] = sys_ticrate.value; statsf[STAT_MOVEVARS_TIMESCALE] = host_timescale.value; -- 2.39.2