]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/main.qc
Merge branch 'master' into Mario/showspecs
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / main.qc
index ded6d5b32a9f2d1d4321dbea3b8b37254533684b..7025b5df159c2ae0293a6c0d4a2e9cdd8d31d310 100644 (file)
@@ -4,7 +4,7 @@
 #include "hud/all.qh"
 #include "mapvoting.qh"
 #include "mutators/events.qh"
-#include "quickmenu.qh"
+#include "hud/panel/quickmenu.qh"
 #include "scoreboard.qh"
 #include "shownames.qh"
 #include <common/t_items.qh>
@@ -213,12 +213,13 @@ void Shutdown()
        }
 
        deactivate_minigame();
-       HUD_MinigameMenu_Close();
+       HUD_MinigameMenu_Close(NULL, NULL, NULL);
 }
 
 .float has_team;
 float SetTeam(entity o, int Team)
 {
+    TC(int, Team);
        devassert_once(Team);
        entity tm;
        if(teamplay)
@@ -289,9 +290,8 @@ float SetTeam(entity o, int Team)
        return false;
 }
 
-void Playerchecker_Think()
+void Playerchecker_Think(entity this)
 {
-       SELFPARAM();
     int i;
        entity e;
        for(i = 0; i < maxclients; ++i)
@@ -336,7 +336,7 @@ void TrueAim_Init();
 void PostInit()
 {
        entity playerchecker = new_pure(playerchecker);
-       playerchecker.think = Playerchecker_Think;
+       setthink(playerchecker, Playerchecker_Think);
        playerchecker.nextthink = time + 0.2;
 
        TrueAim_Init();
@@ -351,8 +351,9 @@ void PostInit()
 // 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.
 // In the case of mouse input after a setcursormode(1) call, nPrimary is xpos, nSecondary is ypos.
-float CSQC_InputEvent(float bInputType, float nPrimary, float nSecondary)
+float CSQC_InputEvent(int bInputType, float nPrimary, float nSecondary)
 {
+    TC(int, bInputType);
        if (HUD_Panel_InputEvent(bInputType, nPrimary, nSecondary))
                return true;
 
@@ -377,19 +378,6 @@ float CSQC_InputEvent(float bInputType, float nPrimary, float nSecondary)
 // --------------------------------------------------------------------------
 // BEGIN OPTIONAL CSQC FUNCTIONS
 
-.void(entity) predraw_qc;
-void PreDraw_self()
-{
-       SELFPARAM();
-       if (this.predraw_qc) this.predraw_qc(this);
-}
-
-void setpredraw(entity this, void(entity) pdfunc)
-{
-       this.predraw = PreDraw_self;
-       this.predraw_qc = pdfunc;
-}
-
 void Ent_Remove(entity this);
 
 void Ent_RemovePlayerScore(entity this)
@@ -528,6 +516,22 @@ NET_HANDLE(ENT_CLIENT_CLIENTDATA, bool isnew)
        else
                angles_held_status = 0;
 
+       if(f & 16)
+       {
+               num_spectators = ReadByte();
+
+               float i, slot;
+
+               for(i = 0; i < MAX_SPECTATORS; ++i)
+                       spectatorlist[i] = 0; // reset list first
+
+               for(i = 0; i < num_spectators; ++i)
+               {
+                       slot = ReadByte();
+                       spectatorlist[i] = slot - 1;
+               }
+       }
+
        return = true;
 
        if(newspectatee_status != spectatee_status)
@@ -535,6 +539,7 @@ NET_HANDLE(ENT_CLIENT_CLIENTDATA, bool isnew)
                // clear race stuff
                race_laptime = 0;
                race_checkpointtime = 0;
+               hud_dynamic_shake_factor = -1;
        }
        if (autocvar_hud_panel_healtharmor_progressbar_gfx)
        {
@@ -792,8 +797,7 @@ NET_HANDLE(ENT_CLIENT_SPAWNEVENT, bool is_new)
 // CSQC_Ent_Update : Called every frame that the server has indicated an update to the SSQC / CSQC entity has occured.
 // The only parameter reflects if the entity is "new" to the client, meaning it just came into the client's PVS.
 void CSQC_Ent_Update(bool isnew)
-{
-       SELFPARAM();
+{ENGINE_EVENT();
        this.sourceLoc = __FILE__ ":" STR(__LINE__);
        int t = ReadByte();
 
@@ -873,8 +877,7 @@ void Ent_Remove(entity this)
 }
 // CSQC_Ent_Remove : Called when the server requests a SSQC / CSQC entity to be removed.  Essentially call remove(this) as well.
 void CSQC_Ent_Remove()
-{
-       SELFPARAM();
+{ENGINE_EVENT();
        if (autocvar_developer_csqcentities) LOG_INFOF("CSQC_Ent_Remove() with this=%i {.entnum=%d, .enttype=%d}\n", this, this.entnum, this.enttype);
        if (wasfreed(this))
        {
@@ -1199,16 +1202,21 @@ string getcommandkey(string text, string command)
        keys = db_get(binddb, command);
        if (keys == "")
        {
+               bool joy_detected = cvar("joy_detected");
                n = tokenize(findkeysforcommand(command, 0)); // uses '...' strings
                for(j = 0; j < n; ++j)
                {
                        k = stof(argv(j));
                        if(k != -1)
                        {
-                               if ("" == keys)
-                                       keys = keynumtostring(k);
+                               string key = keynumtostring(k);
+                               if(!joy_detected && substring(key, 0, 3) == "JOY")
+                                       continue;
+
+                               if (keys == "")
+                                       keys = key;
                                else
-                                       keys = strcat(keys, ", ", keynumtostring(k));
+                                       keys = strcat(keys, ", ", key);
 
                                ++l;
                                if (autocvar_hud_showbinds_limit > 0 && autocvar_hud_showbinds_limit <= l)