Skip to content

Commit

Permalink
Added cvar cl_afkTimeUnfocused, Added Cvar/Cmd descriptions
Browse files Browse the repository at this point in the history
This will allow you to set the amount of minutes to autorename to afk while the jka window is unfocused or minimized. The default is 1 minute.
  • Loading branch information
eternalcodes committed Apr 23, 2016
1 parent 66e142d commit c780a5f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion codemp/client/cl_input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1349,7 +1349,7 @@ usercmd_t CL_CreateCmd( void ) {
CL_Afk_f();
}
}
else if ((cl_unfocusedTime && cls.realtime - cl_unfocusedTime >= 30000) ||
else if ((cl_unfocusedTime && cls.realtime - cl_unfocusedTime >= cl_afkTimeUnfocused->value * 60000) ||
cls.realtime - cls.afkTime >= cl_afkTime->integer * 60000) {
if (!cl_afkName && cls.realtime - cl_nameModifiedTime > 5000) {
CL_Afk_f();
Expand Down
16 changes: 9 additions & 7 deletions codemp/client/cl_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ cvar_t *cl_colorStringCount;
cvar_t *cl_colorStringRandom;

cvar_t *cl_afkTime;
cvar_t *cl_afkTimeUnfocused;

cvar_t *cl_logChat;

Expand Down Expand Up @@ -3081,14 +3082,15 @@ void CL_Init( void ) {
// cgame might not be initialized before menu is used
Cvar_Get ("cg_viewsize", "100", CVAR_ARCHIVE );

cl_afkTime = Cvar_Get("cl_afkTime", "5", CVAR_ARCHIVE);
cl_afkTime = Cvar_Get("cl_afkTime", "5", CVAR_ARCHIVE, "Minutes to autorename to afk, 0 to disable");
cl_afkTimeUnfocused = Cvar_Get("cl_afkTimeUnfocused", "1", CVAR_ARCHIVE, "Minutes to autorename to afk while unfocused/minimized");
cl_unfocusedTime = 0;

cl_colorString = Cvar_Get("cl_colorString", "0", CVAR_ARCHIVE);
cl_colorString = Cvar_Get("cl_colorString", "0", CVAR_ARCHIVE, "Bit value of selected colors in colorString");
cl_colorStringCount = Cvar_Get("cl_colorStringCount", "0", CVAR_INTERNAL | CVAR_ROM | CVAR_ARCHIVE);
cl_colorStringRandom = Cvar_Get("cl_colorStringRandom", "2", CVAR_ARCHIVE);
cl_colorStringRandom = Cvar_Get("cl_colorStringRandom", "2", CVAR_ARCHIVE, "Randomness of the colors changing, higher numbers are less random");

cl_logChat = Cvar_Get("cl_logChat", "1", CVAR_ARCHIVE);
cl_logChat = Cvar_Get("cl_logChat", "1", CVAR_ARCHIVE, "Toggle chat logs");

//
// register our commands
Expand Down Expand Up @@ -3121,9 +3123,9 @@ void CL_Init( void ) {
Cmd_AddCommand ("video", CL_Video_f, "Record demo to avi" );
Cmd_AddCommand ("stopvideo", CL_StopVideo_f, "Stop avi recording" );

Cmd_AddCommand("afk", CL_Afk_f);
Cmd_AddCommand("colorstring", CL_ColorString_f);
Cmd_AddCommand("colorname", CL_ColorName_f);
Cmd_AddCommand("afk", CL_Afk_f, "Rename to or from afk");
Cmd_AddCommand("colorstring", CL_ColorString_f, "Color say text");
Cmd_AddCommand("colorname", CL_ColorName_f, "Color name");

CL_InitRef();

Expand Down
1 change: 1 addition & 0 deletions codemp/client/client.h
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,7 @@ extern cvar_t *cl_colorStringRandom;
extern cvar_t *cl_logChat;

extern cvar_t *cl_afkTime;
extern cvar_t *cl_afkTimeUnfocused;

//=================================================

Expand Down

0 comments on commit c780a5f

Please sign in to comment.