From 95888e34602b7444871ee3b12330afd985bede6b Mon Sep 17 00:00:00 2001 From: Mario Date: Tue, 18 Sep 2018 12:56:10 +1000 Subject: [PATCH] Some more minor code cleanup --- qcsrc/client/weapons/projectile.qc | 8 ++++---- qcsrc/common/animdecide.qc | 8 +++----- qcsrc/common/monsters/monster/spider.qc | 2 +- qcsrc/common/vehicles/vehicle/bumblebee.qc | 2 +- qcsrc/server/teamplay.qc | 16 ++++++++-------- 5 files changed, 17 insertions(+), 19 deletions(-) diff --git a/qcsrc/client/weapons/projectile.qc b/qcsrc/client/weapons/projectile.qc index f4871e7fc..067c0badb 100644 --- a/qcsrc/client/weapons/projectile.qc +++ b/qcsrc/client/weapons/projectile.qc @@ -265,19 +265,19 @@ NET_HANDLE(ENT_CLIENT_PROJECTILE, bool isnew) this.fade_rate = 0; } - int myteam = ReadByte(); - this.team = myteam - 1; + int proj_team = ReadByte(); + this.team = proj_team - 1; if(teamplay) { - if(myteam) + if(proj_team) this.colormap = (this.team) * 0x11; // note: team - 1 on server (client uses different numbers) else this.colormap = 0x00; this.colormap |= BIT(10); // RENDER_COLORMAPPED } else - this.colormap = myteam; + this.colormap = proj_team; // TODO: projectiles use glowmaps for their color, not teams #if 0 if(this.colormap > 0) diff --git a/qcsrc/common/animdecide.qc b/qcsrc/common/animdecide.qc index b53a9ba0e..69fe45826 100644 --- a/qcsrc/common/animdecide.qc +++ b/qcsrc/common/animdecide.qc @@ -210,9 +210,8 @@ vector animdecide_getloweranim(entity e) return vec3(e.anim_duckwalkbackright.x, t, ANIMPRIO_CROUCH); case ANIMIMPLICITSTATE_BACKWARDS | ANIMIMPLICITSTATE_LEFT: return vec3(e.anim_duckwalkbackleft.x, t, ANIMPRIO_CROUCH); - default: - return vec3(e.anim_duckidle.x, t, ANIMPRIO_CROUCH); } + return vec3(e.anim_duckidle.x, t, ANIMPRIO_CROUCH); } else { @@ -236,12 +235,11 @@ vector animdecide_getloweranim(entity e) return vec3(e.anim_backright.x, t, ANIMPRIO_ACTIVE); case ANIMIMPLICITSTATE_BACKWARDS | ANIMIMPLICITSTATE_LEFT: return vec3(e.anim_backleft.x, t, ANIMPRIO_ACTIVE); - default: - return vec3(e.anim_idle.x, t, ANIMPRIO_IDLE); } + return vec3(e.anim_idle.x, t, ANIMPRIO_IDLE); } // can't get here - return vec3(e.anim_idle.x, t, ANIMPRIO_IDLE); + //return vec3(e.anim_idle.x, t, ANIMPRIO_IDLE); } void animdecide_setimplicitstate(entity e, float onground) diff --git a/qcsrc/common/monsters/monster/spider.qc b/qcsrc/common/monsters/monster/spider.qc index 5e2cc0513..d847cf4e6 100644 --- a/qcsrc/common/monsters/monster/spider.qc +++ b/qcsrc/common/monsters/monster/spider.qc @@ -168,9 +168,9 @@ void M_Spider_Attack_Web(entity this) bool M_Spider_Attack(int attack_type, entity actor, entity targ, .entity weaponentity) { + Weapon wep = WEP_SPIDER_ATTACK; switch(attack_type) { - Weapon wep = WEP_SPIDER_ATTACK; case MONSTER_ATTACK_MELEE: { wep.wr_think(wep, actor, weaponentity, 2); diff --git a/qcsrc/common/vehicles/vehicle/bumblebee.qc b/qcsrc/common/vehicles/vehicle/bumblebee.qc index 5780d6657..84f5e144b 100644 --- a/qcsrc/common/vehicles/vehicle/bumblebee.qc +++ b/qcsrc/common/vehicles/vehicle/bumblebee.qc @@ -938,7 +938,7 @@ METHOD(Bumblebee, vr_hud, void(Bumblebee thisveh)) float hudAlpha = autocvar_hud_panel_fg_alpha; float blinkValue = 0.55 + sin(time * 7) * 0.45; vector tmpPos = '0 0 0'; - vector tmpSize = '1 1 1' * hud_fontsize; + vector tmpSize = hud_fontsize; tmpPos.x = vehicleHud_Pos.x + vehicleHud_Size.x * (520/768); if(!AuxiliaryXhair[1].draw2d) diff --git a/qcsrc/server/teamplay.qc b/qcsrc/server/teamplay.qc index abc5df1d7..23e1ea356 100644 --- a/qcsrc/server/teamplay.qc +++ b/qcsrc/server/teamplay.qc @@ -881,16 +881,16 @@ void TeamBalance_AutoBalanceBots() { continue; } - int player_count = TeamBalanceTeam_GetNumberOfPlayers(team_); + int playercount = TeamBalanceTeam_GetNumberOfPlayers(team_); if (smallest_team_index == 0) { smallest_team_index = i; - smallest_team_player_count = player_count; + smallest_team_player_count = playercount; } - else if (player_count < smallest_team_player_count) + else if (playercount < smallest_team_player_count) { smallest_team_index = i; - smallest_team_player_count = player_count; + smallest_team_player_count = playercount; } } //PrintToChatAll(sprintf("Smallest team: %f", smallest_team_index)); @@ -949,16 +949,16 @@ int TeamBalance_GetLargestTeamIndex(entity balance, int teams) { continue; } - int player_count = TeamBalanceTeam_GetNumberOfPlayers(team_); + int playercount = TeamBalanceTeam_GetNumberOfPlayers(team_); if (largest_team_index == 0) { largest_team_index = i; - largest_team_player_count = player_count; + largest_team_player_count = playercount; } - else if (player_count > largest_team_player_count) + else if (playercount > largest_team_player_count) { largest_team_index = i; - largest_team_player_count = player_count; + largest_team_player_count = playercount; } } return largest_team_index; -- 2.39.2