Skip to content

Commit efac0cc

Browse files
committed
Add r_drawviewmodel_invisible
This variable controls whether or not to draw the weapon when invisible. It needs to be used in conjunction with r_drawviewmodel > 0
1 parent ef3d7c7 commit efac0cc

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

help_variables.json

+16
Original file line numberDiff line numberDiff line change
@@ -15531,6 +15531,22 @@
1553115531
}
1553215532
]
1553315533
},
15534+
"r_drawviewmodel_invisible": {
15535+
"default": "0",
15536+
"desc": "This command controls whether or not to draw the weapon when invisible. It needs to be used in conjunction with r_drawviewmodel > 0.",
15537+
"group-id": "54",
15538+
"type": "boolean",
15539+
"values": [
15540+
{
15541+
"description": "Don't display the weapon when invisible.",
15542+
"name": "0"
15543+
},
15544+
{
15545+
"description": "Display the weapon when invisible.",
15546+
"name": "1"
15547+
}
15548+
]
15549+
},
1553415550
"r_drawvweps": {
1553515551
"default": "1",
1553615552
"desc": "Whether to draw vweps (other players' weapon models).",

src/cl_view.c

+7-2
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ cvar_t v_gunkick = {"v_gunkick", "0"};
5858
cvar_t v_viewheight = {"v_viewheight", "0"};
5959

6060
cvar_t cl_drawgun = {"r_drawviewmodel", "1"};
61+
cvar_t cl_drawgun_invisible = {"r_drawviewmodel_invisible", "0"};
6162
cvar_t r_nearclip = {"r_nearclip", "2", CVAR_RULESET_MAX | CVAR_RULESET_MIN, NULL, R_MINIMUM_NEARCLIP, R_MAXIMUM_FARCLIP, R_MINIMUM_NEARCLIP };
6263
cvar_t r_viewmodelsize = {"r_viewmodelSize", "1"};
6364
cvar_t r_viewmodeloffset = {"r_viewmodeloffset", ""};
@@ -868,9 +869,12 @@ static void V_AddViewWeapon(float bob)
868869
cent = CL_WeaponModelForView();
869870
TP_ParseWeaponModel(cl.model_precache[gunmodel]);
870871

871-
if (!cl_drawgun.value || (cl_drawgun.value == 2 && scr_fov.value > 90)
872+
if (!cl_drawgun.value
873+
|| (cl_drawgun.value == 2 && scr_fov.value > 90)
872874
|| ((view_message.flags & (PF_GIB | PF_DEAD)))
873-
|| cl.stats[STAT_ITEMS] & IT_INVISIBILITY || cl.stats[STAT_HEALTH] <= 0 || !Cam_DrawViewModel()) {
875+
|| (!cl_drawgun_invisible.value && cl.stats[STAT_ITEMS] & IT_INVISIBILITY)
876+
|| cl.stats[STAT_HEALTH] <= 0
877+
|| !Cam_DrawViewModel()) {
874878
cent->current.modelindex = 0; //no model
875879
return;
876880
}
@@ -1156,6 +1160,7 @@ void V_Init (void) {
11561160
Cvar_Register(&cl_bobhead);
11571161

11581162
Cvar_Register(&cl_drawgun);
1163+
Cvar_Register(&cl_drawgun_invisible);
11591164
Cvar_Register(&r_viewmodelsize);
11601165
Cvar_Register(&r_viewmodeloffset);
11611166
Cvar_Register(&r_viewpreselgun);

0 commit comments

Comments
 (0)