From c30b70ea00a107fc81a4219bb4c74069b0f4fa90 Mon Sep 17 00:00:00 2001 From: Denis Pauk Date: Sat, 30 Jan 2021 18:52:45 +0200 Subject: [PATCH] Remove unused varibales MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit src/g_cmds.c:2095:10: warning: unused variable ‘vel’ [-Wunused-variable] src/g_cmds.c:2094:10: warning: unused variable ‘pos’ [-Wunused-variable] src/g_trigger.c:1422:10: warning: unused variable ‘endpos’ [-Wunused-variable] src/p_client.c:1277:15: warning: unused variable ‘nostatus’ [-Wunused-variable] src/p_client.c:2247:10: warning: unused variable ‘weapon’ [-Wunused-variable] --- src/g_cmds.c | 44 +++++++++++++++++------------------- src/g_trigger.c | 1 - src/p_client.c | 60 ++++++++++++++++++++++++------------------------- 3 files changed, 50 insertions(+), 55 deletions(-) diff --git a/src/g_cmds.c b/src/g_cmds.c index 42d2f63..4b511c8 100644 --- a/src/g_cmds.c +++ b/src/g_cmds.c @@ -117,7 +117,7 @@ void RotateAngles(vec3_t in, vec3_t delta, vec3_t out) ytemp = c*Y[1] + s*Y[0]; Y[0] = xtemp; Y[1] = ytemp; } - + out[PITCH] = (180./M_PI) * atan2(X[2],X[0]); if(out[PITCH] != 0) { @@ -359,7 +359,7 @@ void ShiftItem(edict_t *ent, int direction) if(!target) return; ent->client->shift_dir = direction; - + VectorClear(move); VectorCopy(ent->s.origin,start); VectorAdd(target->s.origin,target->origin_offset,end); @@ -1057,7 +1057,7 @@ void Cmd_InvUse_f (edict_t *ent) } } #endif - + it->use (ent, it); } @@ -1390,7 +1390,7 @@ void Cmd_Say_f (edict_t *ent, qboolean team, qboolean arg0) i = cl->flood_whenhead - flood_msgs->value + 1; if (i < 0) i = (sizeof(cl->flood_when)/sizeof(cl->flood_when[0])) + i; - if (cl->flood_when[i] && + if (cl->flood_when[i] && level.time - cl->flood_when[i] < flood_persecond->value) { cl->flood_locktill = level.time + flood_waitdelay->value; gi.cprintf(ent, PRINT_CHAT, "Flood protection: You can't talk for %d seconds.\n", @@ -1699,7 +1699,7 @@ void SpawnForcewall(edict_t *player) edict_t *wall; vec3_t forward, point, start; trace_t tr; - + wall = G_Spawn(); VectorCopy(player->s.origin,start); start[2] += player->viewheight; @@ -1707,19 +1707,19 @@ void SpawnForcewall(edict_t *player) VectorMA(start,8192,forward,point); tr = gi.trace(start,NULL,NULL,point,player,MASK_SOLID); VectorCopy(tr.endpos,wall->s.origin); - + if(fabs(forward[0]) > fabs(forward[1])) { wall->pos1[0] = wall->pos2[0] = wall->s.origin[0]; wall->mins[0] = -1; wall->maxs[0] = 1; - + VectorCopy(wall->s.origin,point); point[1] -= 8192; tr = gi.trace(wall->s.origin,NULL,NULL,point,NULL,MASK_SOLID); wall->pos1[1] = tr.endpos[1]; wall->mins[1] = wall->pos1[1] - wall->s.origin[1]; - + point[1] = wall->s.origin[1] + 8192; tr = gi.trace(wall->s.origin,NULL,NULL,point,NULL,MASK_SOLID); wall->pos2[1] = tr.endpos[1]; @@ -1732,24 +1732,24 @@ void SpawnForcewall(edict_t *player) tr = gi.trace(wall->s.origin,NULL,NULL,point,NULL,MASK_SOLID); wall->pos1[0] = tr.endpos[0]; wall->mins[0] = wall->pos1[0] - wall->s.origin[0]; - + point[0] = wall->s.origin[0] + 8192; tr = gi.trace(wall->s.origin,NULL,NULL,point,NULL,MASK_SOLID); wall->pos2[0] = tr.endpos[0]; wall->maxs[0] = wall->pos2[0] - wall->s.origin[0]; - + wall->pos1[1] = wall->pos2[1] = wall->s.origin[1]; wall->mins[1] = -1; wall->maxs[1] = 1; } wall->mins[2] = 0; - + VectorCopy(wall->s.origin,point); point[2] = wall->s.origin[2] + 8192; tr = gi.trace(wall->s.origin,NULL,NULL,point,NULL,MASK_SOLID); wall->maxs[2] = tr.endpos[2] - wall->s.origin[2]; wall->pos1[2] = wall->pos2[2] = tr.endpos[2]; - + wall->style = 208; // Color from Q2 palette wall->movetype = MOVETYPE_NONE; wall->solid = SOLID_BBOX; @@ -1767,7 +1767,7 @@ void ForcewallOff(edict_t *player) { vec3_t forward, point, start; trace_t tr; - + VectorCopy(player->s.origin,start); start[2] += player->viewheight; AngleVectors(player->client->v_angle,forward,NULL,NULL); @@ -2091,8 +2091,6 @@ void ClientCommand (edict_t *ent) } else if(!Q_stricmp(cmd, "playsound")) { - vec3_t pos = {0, 0, 0}; - vec3_t vel = {0, 0, 0}; if(s_primary->value) { gi.dprintf("target_playback requires s_primary be set to 0.\n" @@ -2131,7 +2129,7 @@ void ClientCommand (edict_t *ent) e = LookingAt(ent,0,NULL,NULL); if(!e) return; - + GameDirRelativePath(parm,filename); strcat(filename,".txt"); f = fopen(filename,"w"); @@ -2314,7 +2312,7 @@ void ClientCommand (edict_t *ent) vec3_t origin; float range; viewing = LookingAt(ent,0,NULL,&range); - if(!viewing) + if(!viewing) return; VectorAdd(viewing->s.origin,viewing->origin_offset,origin); gi.dprintf("classname = %s at %s, velocity = %s\n",viewing->classname,vtos(origin),vtos(viewing->velocity)); @@ -2409,7 +2407,7 @@ void ClientCommand (edict_t *ent) int skinnum; viewing = LookingAt(ent,0,NULL,NULL); - if(!viewing) + if(!viewing) return; if(parm) { @@ -2425,7 +2423,7 @@ void ClientCommand (edict_t *ent) { edict_t *e; vec3_t forward; - + if(!parm) { gi.dprintf("syntax: spawn \n"); @@ -2443,7 +2441,7 @@ void ClientCommand (edict_t *ent) { edict_t *e; vec3_t forward; - + if(gi.argc() < 3) { gi.dprintf("syntax: spawngoodguy \n"); @@ -2471,10 +2469,10 @@ void ClientCommand (edict_t *ent) decoy->classname = "fakeplayer"; memcpy(&decoy->s,&ent->s,sizeof(entity_state_t)); decoy->s.number = decoy-g_edicts; - decoy->s.frame = ent->s.frame; + decoy->s.frame = ent->s.frame; AngleVectors(ent->client->v_angle,forward,NULL,NULL); VectorMA(ent->s.origin,64,forward,decoy->s.origin); - decoy->s.angles[YAW] = ent->s.angles[YAW]; + decoy->s.angles[YAW] = ent->s.angles[YAW]; decoy->takedamage = DAMAGE_AIM; decoy->flags = (ent->flags & FL_NOTARGET); decoy->movetype = MOVETYPE_TOSS; @@ -2491,7 +2489,7 @@ void ClientCommand (edict_t *ent) decoy->nextthink = level.time + FRAMETIME; VectorCopy(ent->mins,decoy->mins); VectorCopy(ent->maxs,decoy->maxs); - gi.linkentity (decoy); + gi.linkentity (decoy); } else if (!Q_stricmp(cmd,"switch")) { extern mmove_t actor_move_switch; diff --git a/src/g_trigger.c b/src/g_trigger.c index 3f1899e..a80e201 100644 --- a/src/g_trigger.c +++ b/src/g_trigger.c @@ -1419,7 +1419,6 @@ void trigger_look_touch (edict_t *self, edict_t *other, cplane_t *plane, csurfac // Then trigger only fires if looking at TARGET, not trigger bbox edict_t *target; int num_triggered=0; - vec3_t endpos; target = G_Find(NULL,FOFS(targetname),self->target); while(target && !num_triggered) diff --git a/src/p_client.c b/src/p_client.c index 6377ab5..80314fe 100644 --- a/src/p_client.c +++ b/src/p_client.c @@ -488,7 +488,7 @@ void LookAtKiller (edict_t *self, edict_t *inflictor, edict_t *attacker) } if (self->client->killer_yaw < 0) self->client->killer_yaw += 360; - + } @@ -645,7 +645,7 @@ void SelectStartWeapon (gclient_t *client, int style) // Lazarus: We allow choice of weapons (or no weapon) at startup // If style is non-zero, first clear player inventory of all // weapons and ammo that might have been passed over through - // target_changelevel or acquired when previously called by + // target_changelevel or acquired when previously called by // InitClientPersistant if(style) { @@ -784,7 +784,7 @@ void InitClientResp (gclient_t *client) ================== SaveClientData -Some information that should be persistant, like health, +Some information that should be persistant, like health, is still stored in the edict structure, so it needs to be mirrored out to the client structure before all the edicts are wiped. @@ -1181,7 +1181,7 @@ void respawn (edict_t *self) gi.AddCommandString ("menu_loadgame\n"); } -/* +/* * only called when pers.spectator changes * note that resp.spectator should be the opposite of pers.spectator here */ @@ -1194,8 +1194,8 @@ void spectator_respawn (edict_t *ent) if (ent->client->pers.spectator) { char *value = Info_ValueForKey (ent->client->pers.userinfo, "spectator"); - if (*spectator_password->string && - strcmp(spectator_password->string, "none") && + if (*spectator_password->string && + strcmp(spectator_password->string, "none") && strcmp(spectator_password->string, value)) { gi.cprintf(ent, PRINT_HIGH, "Spectator password incorrect.\n"); ent->client->pers.spectator = false; @@ -1223,7 +1223,7 @@ void spectator_respawn (edict_t *ent) // he was a spectator and wants to join the game // he must have the right password char *value = Info_ValueForKey (ent->client->pers.userinfo, "password"); - if (*password->string && strcmp(password->string, "none") && + if (*password->string && strcmp(password->string, "none") && strcmp(password->string, value)) { gi.cprintf(ent, PRINT_HIGH, "Password incorrect.\n"); ent->client->pers.spectator = true; @@ -1255,7 +1255,7 @@ void spectator_respawn (edict_t *ent) ent->client->respawn_time = level.time; - if (ent->client->pers.spectator) + if (ent->client->pers.spectator) gi.bprintf (PRINT_HIGH, "%s has moved to the sidelines\n", ent->client->pers.netname); else gi.bprintf (PRINT_HIGH, "%s joined the game\n", ent->client->pers.netname); @@ -1274,7 +1274,6 @@ a deathmatch. */ void PutClientInServer (edict_t *ent) { - extern int nostatus; vec3_t mins = {-16, -16, -24}; vec3_t maxs = {16, 16, 32}; int index; @@ -1545,7 +1544,7 @@ void PutClientInServer (edict_t *ent) ===================== ClientBeginDeathmatch -A client has just connected to the server in +A client has just connected to the server in deathmatch mode, so clear everything out before starting them. ===================== */ @@ -1594,7 +1593,7 @@ void ClientBegin (edict_t *ent) // Lazarus: Set the alias for our alternate attack stuffcmd(ent, "alias +attack2 attack2_on; alias -attack2 attack2_off\n"); - + if (deathmatch->value) { ClientBeginDeathmatch (ent); @@ -1781,8 +1780,8 @@ qboolean ClientConnect (edict_t *ent, char *userinfo) if (deathmatch->value && *value && strcmp(value, "0")) { int i, numspec; - if (*spectator_password->string && - strcmp(spectator_password->string, "none") && + if (*spectator_password->string && + strcmp(spectator_password->string, "none") && strcmp(spectator_password->string, value)) { Info_SetValueForKey(userinfo, "rejmsg", "Spectator password required or incorrect."); return false; @@ -1800,7 +1799,7 @@ qboolean ClientConnect (edict_t *ent, char *userinfo) } else { // check for a password value = Info_ValueForKey (userinfo, "password"); - if (*password->string && strcmp(password->string, "none") && + if (*password->string && strcmp(password->string, "none") && strcmp(password->string, value)) { Info_SetValueForKey(userinfo, "rejmsg", "Password required or incorrect."); return false; @@ -2007,7 +2006,7 @@ void ClientSpycam(edict_t *ent) camera = G_FindNextCamera(camera,client->monitor); else camera = G_FindPrevCamera(camera,client->monitor); - + if(camera) { if(!camera->viewer) @@ -2046,13 +2045,13 @@ void ClientSpycam(edict_t *ent) if((abs(client->ucmd.forwardmove) > 199) && (camera->groundentity)) { // walk/run - + edict_t *thing; vec3_t end; float dist; thing = camera->vehicle; - + VectorMA(camera->s.origin,8192,forward,end); tr = gi.trace(camera->s.origin,camera->mins,camera->maxs,end,camera,MASK_SOLID); if(client->ucmd.forwardmove < 0) @@ -2117,7 +2116,7 @@ void ClientSpycam(edict_t *ent) actor_stand(camera); } } - + if(client->ucmd.upmove) { if((client->ucmd.upmove > 0) && camera->groundentity && !camera->waterlevel) @@ -2244,7 +2243,6 @@ void ClientSpycam(edict_t *ent) } else if(is_actor) { - int weapon = camera->actor_weapon[camera->actor_current_weapon]; if(!camera->enemy) { edict_t *target; @@ -2272,7 +2270,7 @@ void ClientSpycam(edict_t *ent) } } if(client->zoomed) { - camera->touch_debounce_time = + camera->touch_debounce_time = max(camera->touch_debounce_time, level.time + 1.0); } } @@ -2280,7 +2278,7 @@ void ClientSpycam(edict_t *ent) VectorMA(camera->s.origin, camera->move_origin[0],forward,start); VectorMA(start, -camera->move_origin[1],left, start); VectorMA(start, camera->move_origin[2],up, start); - + tr = gi.trace(camera->s.origin, NULL, NULL, start, camera, MASK_SOLID); if(tr.fraction < 1.0) { @@ -2291,16 +2289,16 @@ void ClientSpycam(edict_t *ent) } VectorCopy(start,ent->s.origin); VectorCopy(camera->velocity,ent->velocity); - + client->resp.cmd_angles[0] = SHORT2ANGLE(client->ucmd.angles[0]); client->resp.cmd_angles[1] = SHORT2ANGLE(client->ucmd.angles[1]); client->resp.cmd_angles[2] = SHORT2ANGLE(client->ucmd.angles[2]); - + memset (&pm, 0, sizeof(pm)); pm.s = client->ps.pmove; for (i=0 ; i<3 ; i++) { pm.s.origin[i] = ent->s.origin[i]*8; - client->ps.pmove.delta_angles[i] = + client->ps.pmove.delta_angles[i] = ANGLE2SHORT(client->ps.viewangles[i] - client->resp.cmd_angles[i]); } if (memcmp(&client->old_pmove, &pm.s, sizeof(pm.s))) @@ -2308,15 +2306,15 @@ void ClientSpycam(edict_t *ent) pm.cmd = client->ucmd; pm.trace = PM_trace; // adds default parms pm.pointcontents = gi.pointcontents; - + gi.Pmove (&pm); - + gi.linkentity (ent); // client->old_owner_angles[0] = client->ucmd.angles[0]; // client->old_owner_angles[1] = client->ucmd.angles[1]; - + G_TouchTriggers (ent); // we'll only allow touching trigger_look with "Cam Owner" SF - + } /* ============== @@ -2503,7 +2501,7 @@ void ClientThink (edict_t *ent, usercmd_t *ucmd) camera_off(ent); client->ps.pmove.pm_type = PM_FREEZE; // can exit intermission after five seconds - if (level.time > level.intermissiontime + 5.0 + if (level.time > level.intermissiontime + 5.0 && (ucmd->buttons & BUTTON_ANY) ) level.exitintermission = true; @@ -2752,7 +2750,7 @@ void ClientThink (edict_t *ent, usercmd_t *ucmd) { vec3_t point; vec3_t end; - + vec3_t deltapos, deltavel; float frac; @@ -2774,7 +2772,7 @@ void ClientThink (edict_t *ent, usercmd_t *ucmd) { trace_t tr; float dist; - + VectorCopy(oldorigin,point); point[2] += ent->maxs[2]; end[0] = point[0]; end[1] = point[1]; end[2] = oldorigin[2] + ent->mins[2];