]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge remote-tracking branch 'origin/master' into samual/notification_rewrite
authorSamual Lenks <samual@xonotic.org>
Thu, 13 Dec 2012 03:53:41 +0000 (22:53 -0500)
committerSamual Lenks <samual@xonotic.org>
Thu, 13 Dec 2012 03:53:41 +0000 (22:53 -0500)
_hud_common.cfg
qcsrc/client/View.qc
qcsrc/client/command/cl_cmd.qc
qcsrc/client/scoreboard.qc
qcsrc/common/command/generic.qc
qcsrc/common/util.qc
qcsrc/menu/command/menu_cmd.qc
qcsrc/server/command/sv_cmd.qc
qcsrc/server/g_world.qc

index f246ab7bc014a29188a3341232813a9e9631f7ae..5179bb2abfcddf226f547c457d0877e39d78f5b7 100644 (file)
@@ -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"
index 086728bcbc3a9d440f664c55e22d5256b47ea2fa..84c54ecb299896038a63b29ab3525ead2f8f957b 100644 (file)
@@ -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)
index 23b9b8c70a5b7ee2486a7a7497f13f0751396237..acac8b3121574d22a2ec706a9f78849b5a404712 100644 (file)
@@ -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;
                                }
                        }
index aa2d7259f7b0ea4d2b89d269c8598e24a14d1ee9..0984f7ce1a512b4b8cd24729a30ddbca24caeae2 100644 (file)
@@ -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);
index 2e00ff03a105af7a8a91b38b46d811d54f078ad0..b7954e338f79ae9952581f3e061ff8520055b423 100644 (file)
@@ -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:
index 53c14cfb0cd1798a706bb96cb36bce8afd924ba8..afd7f1c5ce25ea2bad16b2d3dda0c58c30d4ddad 100644 (file)
@@ -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;
 }
 
index f6312931f6a11c4117c159433c2361c949ec22c0..2835d522da0e528fc19a9c0388d95114556fc94c 100644 (file)
@@ -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;
        }
 
index 0d1e228714691f02c3dab54143850fc87147289d..58644726ee1770f447764c1195d42c58396ed421 100644 (file)
@@ -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;
                }
        }
index dfef41e7bd1e79c71021336e3cd473bee3652a66..5bd1c86e32a52bd1fa37659162290e8b3c22b9ed 100644 (file)
@@ -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)) )
        {