From: Samual Lenks Date: Thu, 13 Dec 2012 03:53:41 +0000 (-0500) Subject: Merge remote-tracking branch 'origin/master' into samual/notification_rewrite X-Git-Tag: xonotic-v0.7.0~62^2~23^2~368 X-Git-Url: http://git.xonotic.org/?a=commitdiff_plain;h=e1326a2cccc2d471cd11161ab7eda42dfe4d5d2f;hp=74cb317eb10d44a2f21bd16c352092da742f880f;p=xonotic%2Fxonotic-data.pk3dir.git Merge remote-tracking branch 'origin/master' into samual/notification_rewrite --- diff --git a/_hud_common.cfg b/_hud_common.cfg index f246ab7bc..5179bb2ab 100644 --- a/_hud_common.cfg +++ b/_hud_common.cfg @@ -28,9 +28,9 @@ seta hud_panel_engineinfo_framecounter_exponentialmovingaverage_instantupdate_ch // 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" diff --git a/qcsrc/client/View.qc b/qcsrc/client/View.qc index 086728bcb..84c54ecb2 100644 --- a/qcsrc/client/View.qc +++ b/qcsrc/client/View.qc @@ -442,7 +442,7 @@ void CSQC_UpdateView(float w, float h) { // 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) @@ -473,6 +473,13 @@ void CSQC_UpdateView(float w, float h) 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))) @@ -539,8 +546,8 @@ void CSQC_UpdateView(float w, float h) calledhooks |= HOOK_END; } } - - Announcer(); + + Announcer(); fov = autocvar_fov; if(fov <= 59.5) diff --git a/qcsrc/client/command/cl_cmd.qc b/qcsrc/client/command/cl_cmd.qc index 23b9b8c70..acac8b312 100644 --- a/qcsrc/client/command/cl_cmd.qc +++ b/qcsrc/client/command/cl_cmd.qc @@ -214,7 +214,10 @@ void LocalCommand_hud(float request, float argc) 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; } } diff --git a/qcsrc/client/scoreboard.qc b/qcsrc/client/scoreboard.qc index aa2d7259f..0984f7ce1 100644 --- a/qcsrc/client/scoreboard.qc +++ b/qcsrc/client/scoreboard.qc @@ -311,15 +311,15 @@ void Cmd_HUD_SetFields(float argc) // 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; @@ -334,17 +334,17 @@ void Cmd_HUD_SetFields(float argc) 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); diff --git a/qcsrc/common/command/generic.qc b/qcsrc/common/command/generic.qc index 2e00ff03a..b7954e338 100644 --- a/qcsrc/common/command/generic.qc +++ b/qcsrc/common/command/generic.qc @@ -84,7 +84,7 @@ void GenericCommand_addtolist(float request, float argc) 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; @@ -341,7 +341,7 @@ void GenericCommand_maplist(float request, float argc) 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"); @@ -363,7 +363,7 @@ void GenericCommand_nextframe(float request, float arguments, string command) 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; } @@ -401,7 +401,7 @@ void GenericCommand_removefromlist(float request, float argc) 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; @@ -417,15 +417,17 @@ void GenericCommand_settemp(float request, float argc) { 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: diff --git a/qcsrc/common/util.qc b/qcsrc/common/util.qc index 53c14cfb0..afd7f1c5c 100644 --- a/qcsrc/common/util.qc +++ b/qcsrc/common/util.qc @@ -865,31 +865,37 @@ float cvar_settemp(string tmp_cvar, string tmp_value) 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; } @@ -897,12 +903,18 @@ float cvar_settemp_restore() { 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; } diff --git a/qcsrc/menu/command/menu_cmd.qc b/qcsrc/menu/command/menu_cmd.qc index f6312931f..2835d522d 100644 --- a/qcsrc/menu/command/menu_cmd.qc +++ b/qcsrc/menu/command/menu_cmd.qc @@ -35,7 +35,10 @@ void GameCommand(string theCommand) 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; } @@ -48,18 +51,37 @@ void GameCommand(string theCommand) 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; } diff --git a/qcsrc/server/command/sv_cmd.qc b/qcsrc/server/command/sv_cmd.qc index 0d1e22871..58644726e 100644 --- a/qcsrc/server/command/sv_cmd.qc +++ b/qcsrc/server/command/sv_cmd.qc @@ -1689,8 +1689,9 @@ void GameCommand_warp(float request, float argc) 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; } } diff --git a/qcsrc/server/g_world.qc b/qcsrc/server/g_world.qc index dfef41e7b..5bd1c86e3 100644 --- a/qcsrc/server/g_world.qc +++ b/qcsrc/server/g_world.qc @@ -830,18 +830,18 @@ void spawnfunc_worldspawn (void) 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: "; @@ -854,18 +854,18 @@ void spawnfunc_worldspawn (void) 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")); @@ -888,9 +888,11 @@ void spawnfunc_worldspawn (void) 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()); @@ -1349,10 +1351,10 @@ float mapvote_initialized; 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)) ) {