]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/Main.qc
Merge branch 'fruitiex/newpanelhud_stable' into fruitiex/newpanelhud
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / Main.qc
index 4462074503dc3d7e3f33026f9ea61ed58e03b4f4..6609e018dd09e0e4829f5fec88cbc8e034519ea2 100644 (file)
@@ -60,6 +60,10 @@ void CSQC_Init(void)
        
        check_unacceptable_compiler_bugs();
 
+#ifdef WATERMARK
+       print("^4CSQC Build information: ", WATERMARK(), "\n");
+#endif
+
        float i;
        CSQC_CheckEngine();
 
@@ -82,12 +86,15 @@ void CSQC_Init(void)
        // localcmd("alias order \"cmd order $*\""); enable if ctf-command thingy is used
        //registercmd("ctf_menu");
        registercmd("ons_map");
+       registercmd("hud_configure");
+       registercmd("hud_save");
        //registercmd("menu_action");
 
        registercmd("+button3");
        registercmd("-button3");
        registercmd("+button4");
        registercmd("-button4");
+       registercmd("+showscores");registercmd("-showscores");
        registercmd("+showaccuracy");registercmd("-showaccuracy");
 
 #ifndef CAMERATEST
@@ -364,7 +371,18 @@ float CSQC_ConsoleCommand(string strMessage)
        local string strCmd;
        strCmd = argv(0);
 
-       if(strCmd == "+button4") { // zoom
+       if(strCmd == "hud_configure") { // config hud
+               cvar_set("_hud_configure", ftos(!cvar("_hud_configure")));
+               return true;
+       } else if(strCmd == "hud_save") { // save hud config
+               if(argv(1) == "" || argv(2)) {
+                       print("Usage:\n");
+                       print("hud_save configname   (saves to hud_skinname_configname.cfg)\n");
+               }
+               else
+                       HUD_Panel_ExportCfg(argv(1));
+               return true;
+       } else if(strCmd == "+button4") { // zoom
                // return false, because the message shall be sent to the server anyway (for demos/speccing)
                if(ignore_plus_zoom)
                {
@@ -388,16 +406,16 @@ float CSQC_ConsoleCommand(string strMessage)
                button_attack2 = 0;
                return false;
        } else if(strCmd == "+showscores") {
-               sb_showscores = true;
+               scoreboard_showscores = true;
                return true;
        } else if(strCmd == "-showscores") {
-               sb_showscores = false;
+               scoreboard_showscores = false;
                return true;
        } else if(strCmd == "+showaccuracy") {
-               sb_showaccuracy = true;
+               scoreboard_showaccuracy = true;
                return true;
        } else if(strCmd == "-showaccuracy") {
-               sb_showaccuracy = false;
+               scoreboard_showaccuracy = false;
                return true;
        }
 
@@ -505,7 +523,6 @@ void GameCommand(string msg)
        {
                print("Usage: cl_cmd COMMAND..., where possible commands are:\n");
                print("  settemp cvar value\n");
-               print("  radar\n");
                print("  hud_columns_set ...\n");
                print("  hud_columns_help\n");
                GameCommand_Generic("help");
@@ -523,9 +540,6 @@ void GameCommand(string msg)
        else if(cmd == "settemp") {
                cvar_clientsettemp(argv(1), argv(2));
        }
-       else if(cmd == "radar") {
-               ons_showmap = !ons_showmap;
-       }
        else if(cmd == "hud_columns_set") {
                Cmd_HUD_SetFields(argc);
        }
@@ -584,12 +598,16 @@ void GameCommand(string msg)
                localcmd("sv_cmd debug_shotorg\n");
        }
        else if(cmd == "sendcvar") {
-               s = cvar_string(argv(1));
-               if(argv(1) == "cl_weaponpriority")
+               // W_FixWeaponOrder will trash argv, so save what we need.
+               string thiscvar;
+               thiscvar = strzone(argv(1));
+               s = cvar_string(thiscvar);
+               if(thiscvar == "cl_weaponpriority")
                        s = W_FixWeaponOrder(W_NumberWeaponOrder(s), 1);
-               else if(substring(argv(1), 0, 17) == "cl_weaponpriority" && strlen(argv(1)) == 18)
+               else if(substring(thiscvar, 0, 17) == "cl_weaponpriority" && strlen(thiscvar) == 18)
                        s = W_FixWeaponOrder(W_NumberWeaponOrder(s), 0);
-               localcmd("cmd sentcvar ", argv(1), " \"", s, "\"\n");
+               localcmd("cmd sentcvar ", thiscvar, " \"", s, "\"\n");
+               strunzone(thiscvar);
        }
        else if(cmd == "spawn") {
                s = argv(1);
@@ -615,13 +633,12 @@ void GameCommand(string msg)
 // bInputType = 0 is key pressed, 1 is key released, 2 is mouse input.
 // In the case of keyboard input, nPrimary is the ascii code, and nSecondary is 0.
 // In the case of mouse input, nPrimary is xdelta, nSecondary is ydelta.
-float hudconf_active;
 float CSQC_InputEvent(float bInputType, float nPrimary, float nSecondary)
 {
        local float bSkipKey;
        bSkipKey = false;
 
-       if(hudconf_active)
+       if(hud_configure)
                if (HUD_Panel_InputEvent(bInputType, nPrimary, nSecondary))
                        return true;
 
@@ -766,7 +783,7 @@ void Ent_ClientData()
 
        f = ReadByte();
 
-       sb_showscores_force = (f & 1);
+       scoreboard_showscores_force = (f & 1);
 
        if(f & 2)
        {
@@ -946,9 +963,6 @@ void Gamemode_Init()
                precache_pic("gfx/ons-cp-blue.tga");
                precache_pic("gfx/ons-frame.tga");
                precache_pic("gfx/ons-frame-team.tga");
-       } else if(gametype == GAME_KEYHUNT) {
-               precache_pic("gfx/sb_key_carrying");
-               precache_pic("gfx/sb_key_carrying_outline");
        }
 
        if not(isdemo())
@@ -1022,6 +1036,9 @@ void Ent_Init()
 
        g_weaponswitchdelay = ReadByte() / 255.0;
 
+       g_balance_grenadelauncher_secondary_bouncefactor = ReadCoord();
+       g_balance_grenadelauncher_secondary_bouncestop = ReadCoord();
+
        if(!postinit)
                PostInit();
 }
@@ -1223,6 +1240,20 @@ void Net_VoteDialogReset() {
        vote_active = 0;
 }
 
+void Net_Notify() {
+       float type;
+       type = ReadByte();
+
+       if(type == CSQC_KILLNOTIFY)
+       {
+               HUD_KillNotify(ReadString(), ReadString(), ReadString(), ReadByte(), ReadByte());
+       }
+       else if(type == CSQC_CENTERPRINT)
+       {
+               HUD_Centerprint(ReadString(), ReadByte());
+       }
+}
+
 // CSQC_Parse_TempEntity : Handles all temporary entity network data in the CSQC layer.
 // You must ALWAYS first acquire the temporary ID, which is sent as a byte.
 // Return value should be 1 if CSQC handled the temporary entity, otherwise return 0 to have the engine process the event.
@@ -1289,6 +1320,10 @@ float CSQC_Parse_TempEntity()
                        announce_snd = strzone(ReadString());
                        bHandled = true;
                        break;
+               case TE_CSQC_NOTIFY:
+                       Net_Notify();
+                       bHandled = true;
+                       break;
                default:
                        // No special logic for this temporary entity; return 0 so the engine can handle it
                        bHandled = false;