// hud panel aliases
alias hud_panel_radar_rotate "toggle hud_panel_radar_rotation 0 1 2 3 4"
-alias +hud_panel_radar_maximized "cl_cmd hud_panel_radar_maximized 1"
-alias -hud_panel_radar_maximized "cl_cmd hud_panel_radar_maximized 0"
-alias hud_panel_radar_maximized "cl_cmd hud_panel_radar_maximized"
+alias +hud_panel_radar_maximized "cl_cmd hud radar 1"
+alias -hud_panel_radar_maximized "cl_cmd hud radar 0"
+alias hud_panel_radar_maximized "cl_cmd hud radar"
// other hud cvars
seta hud_showbinds 1 "what to show in the HUD to indicate certain keys to press: 0 display commands, 1 bound keys, 2 both"
{
// make special vector since we can't use view_origin (It is one frame old as of this code, it gets set later with the results this code makes.)
vector current_view_origin = getpropertyvec(VF_ORIGIN);
-
+
// We must enable chase_active to get a third person view (weapon viewmodel hidden and own player model showing).
// Ideally, there should be another way to enable third person cameras, such as through setproperty()
if(!autocvar_chase_active)
eventchase_current_distance = 0; // start from 0 next time
}
}
+ // workaround for camera stuck between player's legs when using chase_active 1
+ // because the engine stops updating the chase_active camera when the game ends
+ else if(intermission)
+ {
+ cvar_settemp("chase_active", "-1");
+ eventchase_current_distance = 0;
+ }
// do lockview after event chase camera so that it still applies whenever necessary.
if(autocvar_cl_lockview || (!autocvar_hud_cursormode && (autocvar__hud_configure && spectatee_status <= 0 || intermission > 1)))
calledhooks |= HOOK_END;
}
}
-
- Announcer();
+
+ Announcer();
fov = autocvar_fov;
if(fov <= 59.5)
case "radar":
{
- hud_panel_radar_maximized = (argv(2) ? InterpretBoolean(argv(2)) : !hud_panel_radar_maximized);
+ if(argv(2))
+ hud_panel_radar_maximized = InterpretBoolean(argv(2));
+ else
+ hud_panel_radar_maximized = !hud_panel_radar_maximized;
return;
}
}
// TODO: re enable with gametype dependant cvars?
if(argc < 3) // no arguments provided
- argc = tokenizebyseparator(strcat("x ", autocvar_scoreboard_columns), " ");
+ argc = tokenizebyseparator(strcat("0 1 ", autocvar_scoreboard_columns), " ");
if(argc < 3)
- argc = tokenizebyseparator(strcat("x ", HUD_DefaultColumnLayout()), " ");
+ argc = tokenizebyseparator(strcat("0 1 ", HUD_DefaultColumnLayout()), " ");
if(argc == 3)
{
if(argv(2) == "default")
- argc = tokenizebyseparator(strcat("x ", HUD_DefaultColumnLayout()), " ");
+ argc = tokenizebyseparator(strcat("0 1 ", HUD_DefaultColumnLayout()), " ");
else if(argv(2) == "all")
{
string s;
if(ps_secondary != ps_primary)
s = strcat(s, " ", scores_label[ps_secondary]);
s = strcat(s, " ", scores_label[ps_primary]);
- argc = tokenizebyseparator(strcat("x ", s), " ");
+ argc = tokenizebyseparator(strcat("0 1 ", s), " ");
}
}
hud_num_fields = 0;
- hud_fontsize = HUD_GetFontsize("hud_fontsize");
+ hud_fontsize = HUD_GetFontsize("hud_fontsize");
draw_beginBoldFont();
- for(i = 0; i < argc - 1; ++i)
+ for(i = 1; i < argc - 1; ++i)
{
float nocomplain;
str = argv(i+1);
print("Incorrect parameters for ^2addtolist^7\n");
case CMD_REQUEST_USAGE:
{
- print(strcat("\nUsage:^3 ", GetProgramCommandPrefix(), " addtolist variable value"));
+ print(strcat("\nUsage:^3 ", GetProgramCommandPrefix(), " addtolist variable value\n"));
print(" Where 'variable' is what to add 'value' to.\n");
print("See also: ^2removefromlist^7\n");
return;
print("Incorrect parameters for ^2maplist^7\n");
case CMD_REQUEST_USAGE:
{
- print(strcat("\nUsage:^3 ", GetProgramCommandPrefix(), " maplist action [map]"));
+ print(strcat("\nUsage:^3 ", GetProgramCommandPrefix(), " maplist action [map]\n"));
print(" Where 'action' is the command to complete,\n");
print(" and 'map' is what it acts upon (if required).\n");
print(" Full list of commands here: \"add, cleanup, remove, shuffle.\"\n");
default:
case CMD_REQUEST_USAGE:
{
- print(strcat("\nUsage:^3 ", GetProgramCommandPrefix(), " nextframe command..."));
+ print(strcat("\nUsage:^3 ", GetProgramCommandPrefix(), " nextframe command...\n"));
print(" Where command will be executed next frame of this VM\n");
return;
}
print("Incorrect parameters for ^2removefromlist^7\n");
case CMD_REQUEST_USAGE:
{
- print(strcat("\nUsage:^3 ", GetProgramCommandPrefix(), " removefromlist variable value"));
+ print(strcat("\nUsage:^3 ", GetProgramCommandPrefix(), " removefromlist variable value\n"));
print(" Where 'variable' is what cvar to remove 'value' from.\n");
print("See also: ^2addtolist^7\n");
return;
{
if(argc >= 3)
{
- if(cvar_settemp(argv(1), argv(2)))
+ float f = cvar_settemp(argv(1), argv(2));
+ if(f == 1)
dprint("Creating new settemp tracker for ", argv(1), " and setting it to \"", argv(2), "\" temporarily.\n");
- else
+ else if(f == -1)
dprint("Already had a tracker for ", argv(1), ", updating it to \"", argv(2), "\".\n");
-
+ // else cvar_settemp itself errors out
+
return;
}
}
-
+
default:
print("Incorrect parameters for ^2settemp^7\n");
case CMD_REQUEST_USAGE:
float created_saved_value;
entity e;
- created_saved_value = FALSE;
-
+ created_saved_value = 0;
+
if not(tmp_cvar || tmp_value)
{
dprint("Error: Invalid usage of cvar_settemp(string, string); !\n");
- return FALSE;
+ return 0;
}
-
+
+ if(!cvar_type(tmp_cvar))
+ {
+ print(sprintf("Error: cvar %s doesn't exist!\n", tmp_cvar));
+ return 0;
+ }
+
for(e = world; (e = find(e, classname, "saved_cvar_value")); )
if(e.netname == tmp_cvar)
- goto saved; // skip creation
-
- // creating a new entity to keep track of this cvar
- e = spawn();
- e.classname = "saved_cvar_value";
- e.netname = strzone(tmp_cvar);
- e.message = strzone(cvar_string(tmp_cvar));
- created_saved_value = TRUE;
-
- // an entity for this cvar already exists
- :saved
-
+ created_saved_value = -1; // skip creation
+
+ if(created_saved_value != -1)
+ {
+ // creating a new entity to keep track of this cvar
+ e = spawn();
+ e.classname = "saved_cvar_value";
+ e.netname = strzone(tmp_cvar);
+ e.message = strzone(cvar_string(tmp_cvar));
+ created_saved_value = 1;
+ }
+
// update the cvar to the value given
cvar_set(tmp_cvar, tmp_value);
-
+
return created_saved_value;
}
{
float i;
entity e;
- while((e = find(world, classname, "saved_cvar_value")))
+ while((e = find(e, classname, "saved_cvar_value")))
{
- cvar_set(e.netname, e.message);
- remove(e);
+ if(cvar_type(e.netname))
+ {
+ cvar_set(e.netname, e.message);
+ remove(e);
+ ++i;
+ }
+ else
+ print(sprintf("Error: cvar %s doesn't exist anymore! It can still be restored once it's manually recreated.\n", e.netname));
}
-
+
return i;
}
print(_("Usage: menu_cmd command..., where possible commands are:\n"));
print(_(" sync - reloads all cvars on the current menu page\n"));
print(_(" directmenu ITEM - select a menu item as main item\n"));
- GenericCommand("help");
+
+ print("\nGeneric commands shared by all programs:\n");
+ GenericCommand_macro_help();
+
return;
}
return;
}
- if(argv(0) == "directmenu") if(argc == 2)
+ if(argv(0) == "directmenu" || argv(0) == "directpanelhudmenu")
{
- // switch to a menu item
- if(!isdemo()) // don't allow this command in demos
- m_goto(argv(1));
- return;
- }
+ string filter;
+ if(argv(0) == "directpanelhudmenu")
+ filter = strzone("HUD");
- if(argv(0) == "directpanelhudmenu")
- {
- // switch to a menu item
- m_goto(strcat("HUD", argv(1)));
+ if(argc == 1)
+ {
+ print(_("Available options:\n"));
+ float i;
+ entity e;
+ string s;
+
+ for(i = 0, e = world; (e = nextent(e)); )
+ if(e.classname != "vtbl" && e.name != "")
+ {
+ s = e.name;
+ if(filter)
+ {
+ if(substring(s, 0, strlen(filter)) != filter)
+ continue;
+ s = substring(s, strlen(filter), strlen(s) - strlen(filter));
+ }
+ print(strcat(" ", s ,"\n"));
+ ++i;
+ }
+ }
+ else if(argc == 2 && !isdemo()) // don't allow this command in demos
+ m_goto(strcat(filter, argv(1))); // switch to a menu item
+ if(filter)
+ strunzone(filter);
return;
}
default:
case CMD_REQUEST_USAGE:
{
- print("\nUsage:^3 sv_cmd level\n");
+ print("\nUsage:^3 sv_cmd warp [level]\n");
print(" 'level' is the level to change campaign mode to.\n");
+ print(" if 'level' is not provided it will change to the next level.\n");
return;
}
}
addstat(STAT_MOVEVARS_MAXSPEED, AS_FLOAT, stat_sv_maxspeed);
addstat(STAT_MOVEVARS_AIRACCEL_QW, AS_FLOAT, stat_sv_airaccel_qw);
addstat(STAT_MOVEVARS_AIRSTRAFEACCEL_QW, AS_FLOAT, stat_sv_airstrafeaccel_qw);
-
+
// secrets
addstat(STAT_SECRETS_TOTAL, AS_FLOAT, stat_secrets_total);
addstat(STAT_SECRETS_FOUND, AS_FLOAT, stat_secrets_found);
// misc
addstat(STAT_RESPAWN_TIME, AS_FLOAT, stat_respawn_time);
-
+
next_pingtime = time + 5;
detect_maptype();
-
+
// set up information replies for clients and server to use
lsmaps_reply = "^7Maps available: ";
lsnewmaps_reply = "^7Maps without a record set: ";
col = "^2";
else
col = "^3";
-
+
++j;
-
+
lsmaps_reply = strcat(lsmaps_reply, col, MapInfo_Map_bspname, " ");
-
+
if(g_race && !stof(db_get(ServerProgsDB, strcat(MapInfo_Map_bspname, RACE_RECORD, "time"))))
lsnewmaps_reply = strcat(lsnewmaps_reply, col, MapInfo_Map_bspname, " ");
else if(g_cts && !stof(db_get(ServerProgsDB, strcat(MapInfo_Map_bspname, CTS_RECORD, "time"))))
lsnewmaps_reply = strcat(lsnewmaps_reply, col, MapInfo_Map_bspname, " ");
}
}
-
+
lsmaps_reply = strzone(strcat(lsmaps_reply, "\n"));
lsnewmaps_reply = strzone(strcat(((!g_race && !g_cts) ? "Need to be playing race or CTS for lsnewmaps to work." : lsnewmaps_reply), "\n"));
for(i = 0; i < 10; ++i)
{
- records_reply[i] = strzone(getrecords(i));
+ s = getrecords(i);
+ if (s)
+ records_reply[i] = strzone(s);
}
-
+
ladder_reply = strzone(getladder());
rankings_reply = strzone(getrankings());
void IntermissionThink()
{
FixIntermissionClient(self);
-
+
float server_screenshot = (autocvar_sv_autoscreenshot && self.cvar_cl_autoscreenshot);
float client_screenshot = (self.cvar_cl_autoscreenshot == 2);
-
+
if( (server_screenshot || client_screenshot)
&& ((self.autoscreenshot > 0) && (time > self.autoscreenshot)) )
{