]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/Main.qc
gradually fade out the "charge" on the nex so if you go fast but hit a wall, you...
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / Main.qc
index a21bea9859e0679e817fa05edbc26934b4569903..28db128b06d52f379c76bf71d989fb58680926a0 100644 (file)
@@ -113,7 +113,7 @@ void CSQC_Init(void)
        }
 #endif
        registercvar("hud_usecsqc", "1");
-       registercvar("hud_columns", "default", CVAR_SAVE);
+       registercvar("scoreboard_columns", "default", CVAR_SAVE);
 
        gametype = 0;
 
@@ -130,14 +130,13 @@ void CSQC_Init(void)
 
        GetTeam(COLOR_SPECTATOR, true); // add specs first
 
-       cvar_clientsettemp("_supports_weaponpriority", "1");
-
        RegisterWeapons();
 
        WaypointSprite_Load();
 
        // precaches
        Projectile_Precache();
+       Hook_Precache();
        GibSplash_Precache();
        Casings_Precache();
        DamageInfo_Precache();
@@ -185,6 +184,7 @@ void CSQC_Init(void)
        minimapname = strzone(minimapname);
 
        WarpZone_Init();
+       hud_configure_prev = -1;
 }
 
 // CSQC_Shutdown : Called every time the CSQC code is shutdown (changing maps, quitting, etc)
@@ -214,9 +214,9 @@ void CSQC_Shutdown(void)
        if not(isdemo())
        {
                if not(calledhooks & HOOK_START)
-                       localcmd("\n_cl_hook_gamestart nop;");
+                       localcmd("\n_cl_hook_gamestart nop\n");
                if not(calledhooks & HOOK_END)
-                       localcmd("\ncl_hook_gameend;");
+                       localcmd("\ncl_hook_gameend\n");
        }
 }
 
@@ -342,7 +342,7 @@ void TrueAim_Init();
 void PostInit(void)
 {
        print(strcat("PostInit\n    maxclients = ", ftos(maxclients), "\n"));
-       localcmd(strcat("\nhud_columns_set ", cvar_string("hud_columns"), ";\n"));
+       localcmd(strcat("\nscoreboard_columns_set ", cvar_string("scoreboard_columns"), ";\n"));
 
        entity playerchecker;
        playerchecker = spawn();
@@ -523,8 +523,8 @@ void GameCommand(string msg)
        {
                print("Usage: cl_cmd COMMAND..., where possible commands are:\n");
                print("  settemp cvar value\n");
-               print("  hud_columns_set ...\n");
-               print("  hud_columns_help\n");
+               print("  scoreboard_columns_set ...\n");
+               print("  scoreboard_columns_help\n");
                GameCommand_Generic("help");
                return;
        }
@@ -540,10 +540,10 @@ void GameCommand(string msg)
        else if(cmd == "settemp") {
                cvar_clientsettemp(argv(1), argv(2));
        }
-       else if(cmd == "hud_columns_set") {
+       else if(cmd == "scoreboard_columns_set") {
                Cmd_HUD_SetFields(argc);
        }
-       else if(cmd == "hud_columns_help") {
+       else if(cmd == "scoreboard_columns_help") {
                Cmd_HUD_Help(argc);
        }
 #ifdef BLURTEST
@@ -638,9 +638,8 @@ float CSQC_InputEvent(float bInputType, float nPrimary, float nSecondary)
        local float bSkipKey;
        bSkipKey = false;
 
-       if(hud_configure)
-               if (HUD_Panel_InputEvent(bInputType, nPrimary, nSecondary))
-                       return true;
+       if (HUD_Panel_InputEvent(bInputType, nPrimary, nSecondary))
+               return true;
 
        if (MapVote_InputEvent(bInputType, nPrimary, nSecondary))
                return true;
@@ -925,6 +924,9 @@ void(float bIsNewEntity) CSQC_Ent_Update =
                case ENT_CLIENT_WARPZONE: WarpZone_Read(bIsNewEntity); break;
                case ENT_CLIENT_WARPZONE_CAMERA: WarpZone_Camera_Read(bIsNewEntity); break;
                case ENT_CLIENT_TRIGGER_MUSIC: Ent_ReadTriggerMusic(); break;
+               case ENT_CLIENT_HOOK: Ent_ReadHook(bIsNewEntity, ENT_CLIENT_HOOK); break;
+               case ENT_CLIENT_LGBEAM: Ent_ReadHook(bIsNewEntity, ENT_CLIENT_LGBEAM); break;
+               case ENT_CLIENT_GAUNTLET: Ent_ReadHook(bIsNewEntity, ENT_CLIENT_GAUNTLET); break;
                default:
                        error(strcat("unknown entity type in CSQC_Ent_Update: ", ftos(self.enttype), "\n"));
                        break;
@@ -967,7 +969,7 @@ void Gamemode_Init()
 
        if not(isdemo())
        {
-               localcmd("\n_cl_hook_gamestart ", GametypeNameFromType(gametype), ";");
+               localcmd("\n_cl_hook_gamestart ", GametypeNameFromType(gametype), "\n");
                calledhooks |= HOOK_START;
        }
 }
@@ -1024,9 +1026,18 @@ void Ent_Init()
 
        nb_pb_period = ReadByte() / 32; //Accuracy of 1/32th
 
-       hook_shotorigin_x = ReadCoord();
-       hook_shotorigin_y = ReadCoord();
-       hook_shotorigin_z = ReadCoord();
+       hook_shotorigin[0] = decompressShotOrigin(ReadInt24_t());
+       hook_shotorigin[1] = decompressShotOrigin(ReadInt24_t());
+       hook_shotorigin[2] = decompressShotOrigin(ReadInt24_t());
+       hook_shotorigin[3] = decompressShotOrigin(ReadInt24_t());
+       electro_shotorigin[0] = decompressShotOrigin(ReadInt24_t());
+       electro_shotorigin[1] = decompressShotOrigin(ReadInt24_t());
+       electro_shotorigin[2] = decompressShotOrigin(ReadInt24_t());
+       electro_shotorigin[3] = decompressShotOrigin(ReadInt24_t());
+       gauntlet_shotorigin[0] = decompressShotOrigin(ReadInt24_t());
+       gauntlet_shotorigin[1] = decompressShotOrigin(ReadInt24_t());
+       gauntlet_shotorigin[2] = decompressShotOrigin(ReadInt24_t());
+       gauntlet_shotorigin[3] = decompressShotOrigin(ReadInt24_t());
 
        if(forcefog)
                strunzone(forcefog);
@@ -1039,6 +1050,9 @@ void Ent_Init()
        g_balance_grenadelauncher_secondary_bouncefactor = ReadCoord();
        g_balance_grenadelauncher_secondary_bouncestop = ReadCoord();
 
+       nex_scope = !ReadByte();
+       campingrifle_scope = !ReadByte();
+
        if(!postinit)
                PostInit();
 }
@@ -1226,13 +1240,13 @@ void Net_ReadPingPLReport()
 
 void Net_VoteDialog(float highlight) {
        if(highlight) {
-               vote_highlighted = ReadShort();
+               vote_highlighted = ReadByte();
                return;
        }
 
-       vote_yescount = ReadShort();
-       vote_nocount = ReadShort();
-       vote_needed = ReadShort();
+       vote_yescount = ReadByte();
+       vote_nocount = ReadByte();
+       vote_needed = ReadByte();
        vote_active = 1;
 }
 
@@ -1250,10 +1264,23 @@ void Net_Notify() {
        }
        else if(type == CSQC_CENTERPRINT)
        {
-               HUD_Centerprint(ReadString(), ReadShort(), ReadByte());
+               HUD_Centerprint(ReadString(), ReadString(), ReadShort(), ReadByte());
        }
 }
 
+void Net_WeaponComplain() {
+       complain_weapon = ReadByte();
+
+       if(complain_weapon_name)
+               strunzone(complain_weapon_name);
+       complain_weapon_name = strzone(ReadString());
+
+       complain_weapon_type = ReadByte();
+
+       complain_weapon_time = time;
+       weapontime = time; // ping the weapon panel
+}
+
 // 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.
@@ -1280,10 +1307,6 @@ float CSQC_Parse_TempEntity()
                        Net_ReadRace();
                        bHandled = true;
                        break;
-               case 13: // TE_BEAM
-                       Net_GrapplingHook();
-                       bHandled = true;
-                       break;
                case TE_CSQC_SPAWN:
                        Net_ReadSpawn();
                        bHandled = true;
@@ -1324,6 +1347,20 @@ float CSQC_Parse_TempEntity()
                        Net_Notify();
                        bHandled = true;
                        break;
+               case TE_CSQC_WEAPONCOMPLAIN:
+                       Net_WeaponComplain();
+                       bHandled = true;
+                       break;
+               case TE_CSQC_NEX_VELOCITY:
+                       nex_minvelocity = ReadShort();
+                       nex_maxvelocity = ReadShort();
+                       nex_speed_falloff_factor = ReadShort()/10000;
+                       bHandled = true;
+                       break;
+               case TE_CSQC_CR_MAXBULLETS:
+                       cr_maxbullets = ReadByte();
+                       bHandled = true;
+                       break;
                default:
                        // No special logic for this temporary entity; return 0 so the engine can handle it
                        bHandled = false;