From 3fa16ea5cda8372fe0490a36c156087c654e5767 Mon Sep 17 00:00:00 2001 From: ciscon Date: Mon, 23 Oct 2023 13:35:11 -0400 Subject: [PATCH] CLEANUP: remove unused vars --- src/EX_browser_sources.c | 4 ---- src/console.c | 2 -- src/glc_aliasmodel.c | 4 ---- src/glm_texture_arrays.c | 2 -- src/hud_gamesummary.c | 2 -- src/pr2_cmds.c | 7 ++----- src/r_brushmodel.c | 4 ---- src/r_lightmaps.c | 2 -- src/r_texture_load.c | 7 +------ src/sbar.c | 7 +++---- src/sv_demo_qtv.c | 4 ---- src/zone.c | 5 +---- 12 files changed, 7 insertions(+), 43 deletions(-) diff --git a/src/EX_browser_sources.c b/src/EX_browser_sources.c index 85cdde723..2a6acb58a 100644 --- a/src/EX_browser_sources.c +++ b/src/EX_browser_sources.c @@ -987,7 +987,6 @@ int rebuild_servers_list = 0; void Rebuild_Servers_List(void) { int i; - int suppressed_servers = 0; int server_limit = sizeof(servers) / sizeof(servers[0]); serversn = 0; @@ -1020,9 +1019,6 @@ void Rebuild_Servers_List(void) if (serversn < server_limit) { servers[serversn++] = sources[i]->servers[j]; } - else { - ++suppressed_servers; - } } } } diff --git a/src/console.c b/src/console.c index 541426b91..7fb107976 100644 --- a/src/console.c +++ b/src/console.c @@ -778,7 +778,6 @@ static qbool Con_NotifyMessageLine(float posX, float posY, float width, float he strlcpy(dest, IRC_GetCurrentChan(), sizeof(dest)); strlcat(dest, ":", sizeof(dest)); - indent += Draw_SString(posX, v + bound(0, con_shift.value, 8), dest, scale, proportional); } #endif else if (chat_team == chat_qtvtogame) { @@ -846,7 +845,6 @@ void SCR_DrawNotify(int posX, int posY, float scale, int notifyTime, int notifyL int v, i, idx; float time; float timeout = bound (0, notifyTime, MAX_NOTIFICATION_TIME); - float indent = 0; notifyCols = bound(10, notifyCols, con_linewidth); diff --git a/src/glc_aliasmodel.c b/src/glc_aliasmodel.c index 5f8a3a8c2..c97421583 100644 --- a/src/glc_aliasmodel.c +++ b/src/glc_aliasmodel.c @@ -117,7 +117,6 @@ void GLC_AllocateAliasPoseBuffer(void) if (!gl_program_aliasmodels.integer) { int max_verts = 0; int i; - int total_verts = 0; for (i = 1; i < MAX_MODELS; ++i) { model_t* mod = cl.model_precache[i]; @@ -127,7 +126,6 @@ void GLC_AllocateAliasPoseBuffer(void) if (hdr) { max_verts = max(max_verts, hdr->vertsPerPose); - total_verts += hdr->vertsPerPose * hdr->numposes; } } } @@ -140,7 +138,6 @@ void GLC_AllocateAliasPoseBuffer(void) if (hdr) { max_verts = max(max_verts, hdr->vertsPerPose); - total_verts += hdr->vertsPerPose * hdr->numposes; } } } @@ -153,7 +150,6 @@ void GLC_AllocateAliasPoseBuffer(void) if (hdr) { max_verts = max(max_verts, hdr->vertsPerPose); - total_verts += hdr->vertsPerPose * hdr->numposes; } } } diff --git a/src/glm_texture_arrays.c b/src/glm_texture_arrays.c index 0e7cbf91f..03b4568da 100644 --- a/src/glm_texture_arrays.c +++ b/src/glm_texture_arrays.c @@ -220,7 +220,6 @@ static void GL_FlagTexturesForModel(model_t* mod) case mod_sprite: { msprite2_t* psprite = (msprite2_t*)Mod_Extradata(mod); - int count = 0; for (j = 0; j < psprite->numframes; ++j) { int offset = psprite->frames[j].offset; @@ -235,7 +234,6 @@ static void GL_FlagTexturesForModel(model_t* mod) if (R_TextureReferenceIsValid(frame->gl_texturenum)) { texture_flags[frame->gl_texturenum.index].flags |= (1 << TEXTURETYPES_SPRITES); } - ++count; } break; } diff --git a/src/hud_gamesummary.c b/src/hud_gamesummary.c index 4dea2050d..09bd6d75e 100644 --- a/src/hud_gamesummary.c +++ b/src/hud_gamesummary.c @@ -173,10 +173,8 @@ static void SCR_Hud_GameSummary(hud_t* hud) { char buffer[10]; - int text_size; snprintf(buffer, sizeof(buffer), "%d", value); - text_size = Draw_StringLength(buffer, -1, hud_gamesummary_scale->value, hud_gamesummary_proportional->integer); if (hud_gamesummary_circles->integer && background_color) { float half_width = icon_size * 0.5f * hud_gamesummary_scale->value; diff --git a/src/pr2_cmds.c b/src/pr2_cmds.c index 2553d058d..dec94ea73 100644 --- a/src/pr2_cmds.c +++ b/src/pr2_cmds.c @@ -2437,7 +2437,7 @@ void PF2_Add_Bot( byte * base, uintptr_t mask, pr2val_t * stack, pr2val_t * retv int topcolor = stack[2]._int; char *skin = (char *) VM_POINTER( base, mask, stack[3].string ); int edictnum; - int clients, spectators, i; + int clients, i; extern char *shortinfotbl[]; char *s; edict_t *ent; @@ -2447,14 +2447,11 @@ void PF2_Add_Bot( byte * base, uintptr_t mask, pr2val_t * stack, pr2val_t * retv // count up the clients and spectators clients = 0; - spectators = 0; for ( i = 0, cl = svs.clients; i < MAX_CLIENTS; i++, cl++ ) { if ( cl->state == cs_free ) continue; - if ( cl->spectator ) - spectators++; - else + if ( !cl->spectator ) clients++; } diff --git a/src/r_brushmodel.c b/src/r_brushmodel.c index 5560e59da..a0410444f 100644 --- a/src/r_brushmodel.c +++ b/src/r_brushmodel.c @@ -177,8 +177,6 @@ static int R_BrushModelPopulateVBO(model_t* m, void* vbo_buffer, int vbo_pos) // Order vertices in the VBO by texture & lightmap for (i = 0; i < m->numtextures; ++i) { - int length = 0; - int surface_count = 0; qbool has_fb = false, has_luma = false; if (!m->textures[i]) { @@ -215,8 +213,6 @@ static int R_BrushModelPopulateVBO(model_t* m, void* vbo_buffer, int vbo_pos) vbo_pos = renderer.BrushModelCopyVertToBuffer(m, vbo_buffer, vbo_pos, poly->verts[k], lightmap, material, scaleS, scaleT, surf, has_fb, has_luma); } - length += poly->numverts; - ++surface_count; } } } diff --git a/src/r_lightmaps.c b/src/r_lightmaps.c index 957fb7217..f04fd7dc4 100644 --- a/src/r_lightmaps.c +++ b/src/r_lightmaps.c @@ -73,7 +73,6 @@ static void R_BuildDlightList (msurface_t *surf) { float dist; vec3_t impact; - mtexinfo_t *tex; int lnum, i, smax, tmax, irad, iminlight, local[2], tdmin, sdmin, distmin; unsigned int dlightbits; dlightinfo_t *light; @@ -82,7 +81,6 @@ static void R_BuildDlightList (msurface_t *surf) smax = (surf->extents[0] >> surf->lmshift) + 1; tmax = (surf->extents[1] >> surf->lmshift) + 1; - tex = surf->texinfo; dlightbits = surf->dlightbits; for (lnum = 0; lnum < MAX_DLIGHTS && dlightbits; lnum++) { diff --git a/src/r_texture_load.c b/src/r_texture_load.c index 1fd87e166..29e2010a0 100644 --- a/src/r_texture_load.c +++ b/src/r_texture_load.c @@ -484,7 +484,7 @@ static void R_Upload32(gltexture_t* glt, unsigned *data, int width, int height, { // Tell OpenGL the texnum of the texture before uploading it. extern cvar_t gl_lerpimages, gl_wicked_luma_level; - int tempwidth, tempheight, levels; + int tempwidth, tempheight; byte *newdata; R_TextureSizeRoundUp(width, height, &tempwidth, &tempheight); @@ -528,15 +528,10 @@ static void R_Upload32(gltexture_t* glt, unsigned *data, int width, int height, if (mode & TEX_MIPMAP) { int largest = max(width, height); - levels = 0; while (largest) { - ++levels; largest /= 2; } } - else { - levels = 1; - } if (mode & TEX_BRIGHTEN) { R_TextureUtil_Brighten32(newdata, width * height * 4); diff --git a/src/sbar.c b/src/sbar.c index 1ce45e254..5435e4aed 100644 --- a/src/sbar.c +++ b/src/sbar.c @@ -1256,7 +1256,7 @@ static qbool Sbar_ShowTeamKills(void) static void Sbar_DeathmatchOverlay(int start) { - int stats_basic, stats_team, stats_touches, stats_caps, playerstats[7]; + int stats_team, stats_touches, stats_caps, playerstats[7]; int scoreboardsize, colors_thickness, statswidth, stats_xoffset = 0; int i, k, x, y, xofs, total, p, skip = 10, fragsint; int rank_width, leftover, startx, tempx, mynum; @@ -1302,11 +1302,10 @@ static void Sbar_DeathmatchOverlay(int start) rank_width = (cl.teamplay ? RANK_WIDTH_TEAM : RANK_WIDTH_DM); statswidth = 0; - stats_basic = stats_team = stats_touches = stats_caps = 0; + stats_team = stats_touches = stats_caps = 0; if (scr_scoreboard_showfrags.value && Stats_IsActive()) { if (rank_width + statswidth + RANK_WIDTH_BASICSTATS < vid.width - 16) { statswidth += RANK_WIDTH_BASICSTATS; - stats_basic++; if (cl.teamplay) { if (rank_width + statswidth + RANK_WIDTH_TEAMSTATS < vid.width - 16) { if (Sbar_ShowTeamKills()) { @@ -2436,4 +2435,4 @@ static const char* JSON_readstring(json_t* json) return json_string_value(json); } return ""; -} \ No newline at end of file +} diff --git a/src/sv_demo_qtv.c b/src/sv_demo_qtv.c index 11c5bbd8f..89d0e7194 100644 --- a/src/sv_demo_qtv.c +++ b/src/sv_demo_qtv.c @@ -695,7 +695,6 @@ void QTVcmd_Say_f(mvddest_t *d) int j; char *p; char text[1024], text2[1024], *cmd; - int sent_to = 0; if (Cmd_Argc () < 2) return; @@ -744,9 +743,6 @@ void QTVcmd_Say_f(mvddest_t *d) continue; // game started, don't send QTV chat to players, specs still get QTV chat SV_ClientPrintf2(client, PRINT_CHAT, "%s", text); - if (!client->spectator) { - sent_to |= (1 << j); - } } if (sv.mvdrecording) { diff --git a/src/zone.c b/src/zone.c index 00fcbb229..dc572a956 100644 --- a/src/zone.c +++ b/src/zone.c @@ -85,12 +85,11 @@ Otherwise, allocations with the same name will be totaled up before printing. void Hunk_Print(qbool all) { hunk_t *h, *next, *endlow, *starthigh, *endhigh; - int count, sum; + int sum; int totalblocks; char name[9]; name[8] = 0; - count = 0; sum = 0; totalblocks = 0; @@ -125,7 +124,6 @@ void Hunk_Print(qbool all) } next = (hunk_t *)((byte *)h + h->size); - count++; totalblocks++; sum += h->size; @@ -140,7 +138,6 @@ void Hunk_Print(qbool all) if (!all) { Con_Printf(" :%8ikb %8s (TOTAL)\n", sum / 1024, name); } - count = 0; sum = 0; }