]> de.git.xonotic.org Git - voretournament/voretournament.git/blobdiff - data/qcsrc/client/Main.qc
Offset the names for scaled players, to match the proper scale
[voretournament/voretournament.git] / data / qcsrc / client / Main.qc
index ae4ab68ef5586db613f0a9a1b00fc99fa700b4ed..f7b08497e608a85ca1af56dcae63ead97fc968b2 100644 (file)
@@ -68,7 +68,7 @@ void CSQC_Init(void)
        ClientProgsDB = db_load("client.db");\r
        compressShortVector_init();\r
 \r
-       drawfont = 0;\r
+       drawfont = FONT_USER+1;\r
        menu_visible = FALSE;\r
        menu_show = menu_show_error;\r
        menu_action = menu_sub_null;\r
@@ -118,7 +118,7 @@ void CSQC_Init(void)
 \r
        postinit = false;\r
 \r
-       calledgrabbers = 0;\r
+       calledhooks = 0;\r
 \r
        teams = Sort_Spawn();\r
        players = Sort_Spawn();\r
@@ -143,6 +143,9 @@ void CSQC_Init(void)
                cl_announcer_prev = strzone(cvar_string("cl_announcer"));\r
        }\r
 \r
+       if(cvar("cl_reticle_item_normal")) precache_pic("gfx/reticle_normal");\r
+       if(cvar("cl_reticle_item_nex")) precache_pic("gfx/reticle_nex");\r
+\r
 #ifdef UID\r
        {\r
                // find the user ID\r
@@ -161,13 +164,13 @@ void CSQC_Init(void)
 #endif\r
 \r
        get_mi_min_max_texcoords(1); // try the CLEVER way first\r
-       minimapname = strcat("gfx/", mi_shortname, "_radar.tga");\r
+       minimapname = strcat("gfx/radar/", mi_shortname, "_radar.tga");\r
        shortmapname = mi_shortname;\r
 \r
        if(precache_pic(minimapname) == "")\r
        {\r
                // but maybe we have a non-clever minimap\r
-               minimapname = strcat("gfx/", mi_shortname, "_mini.tga");\r
+               minimapname = strcat("gfx/radar/", mi_shortname, "_mini.tga");\r
                if(precache_pic(minimapname) == "")\r
                        minimapname = ""; // FAIL\r
                else\r
@@ -205,12 +208,24 @@ void CSQC_Shutdown(void)
        if(camera_active)\r
                cvar_set("chase_active",ftos(chase_active_backup));\r
 \r
+       // unset the event chasecam's chase_active\r
+       if(cvar("chase_active") < 0)\r
+               cvar_set("chase_active", "0");\r
+\r
        if not(isdemo())\r
        {\r
-               if not(calledgrabbers & GRABBER_START)\r
+               if not(calledhooks & HOOK_START)\r
+               {\r
                        localcmd("\n_cl_hook_gamestart nop;");\r
-               if not(calledgrabbers & GRABBER_END)\r
+                       if(g_campaign) // this is a server cvar used in the client code, but g_campaign is always local, so it should be safe\r
+                               localcmd("\n_cl_hook_campaign_gamestart nop;");\r
+               }\r
+               if not(calledhooks & HOOK_END)\r
+               {\r
                        localcmd("\ncl_hook_gameend;");\r
+                       if(g_campaign)\r
+                               localcmd("\ncl_hook_campaign_gameend;");\r
+               }\r
        }\r
 }\r
 \r
@@ -642,17 +657,40 @@ float CSQC_InputEvent(float bInputType, float nPrimary, float nSecondary)
 \r
 // --------------------------------------------------------------------------\r
 // BEGIN OPTIONAL CSQC FUNCTIONS\r
+void Ent_RemoveEntCS()\r
+{\r
+       entcs_receiver[self.sv_entnum] = world;\r
+}\r
 void Ent_ReadEntCS()\r
 {\r
+       float sf;\r
        InterpolateOrigin_Undo();\r
 \r
        self.classname = "entcs_receiver";\r
-       self.sv_entnum = ReadByte() - 1;\r
-       self.origin_x = ReadShort();\r
-       self.origin_y = ReadShort();\r
-       self.origin_z = ReadShort();\r
-       self.angles_y = ReadByte() * 360.0 / 256;\r
-       self.origin_z = self.angles_x = self.angles_z = 0;\r
+       sf = ReadByte();\r
+\r
+       if(sf & 1)\r
+               self.sv_entnum = ReadByte();\r
+       if(sf & 2)\r
+       {\r
+               self.origin_x = ReadShort();\r
+               self.origin_y = ReadShort();\r
+               self.origin_z = ReadShort();\r
+       }\r
+       if(sf & 4)\r
+       {\r
+               self.angles_y = ReadByte() * 360.0 / 256;\r
+               self.angles_x = self.angles_z = 0;\r
+       }\r
+       if(sf & 8)\r
+               self.healthvalue = ReadByte() * 10;\r
+       if(sf & 16)\r
+               self.armorvalue = ReadByte() * 10;\r
+       if(sf & 32)\r
+               self.predator = ReadByte();\r
+\r
+       entcs_receiver[self.sv_entnum] = self;\r
+       self.entremove = Ent_RemoveEntCS;\r
 \r
        InterpolateOrigin_Note();\r
 }\r
@@ -947,7 +985,9 @@ void Gamemode_Init()
        if not(isdemo())\r
        {\r
                localcmd("\n_cl_hook_gamestart ", GametypeNameFromType(gametype), ";");\r
-               calledgrabbers |= GRABBER_START;\r
+               if(g_campaign)\r
+                       localcmd("\n_cl_hook_campaign_gamestart ", GametypeNameFromType(gametype), ";");\r
+               calledhooks |= HOOK_START;\r
        }\r
 }\r
 // CSQC_Parse_StuffCmd : Provides the stuffcmd string in the first parameter that the server provided.  To execute standard behavior, simply execute localcmd with the string.\r
@@ -1009,11 +1049,17 @@ void Ent_Init()
                strunzone(forcefog);\r
        forcefog = strzone(ReadString());\r
 \r
+       g_campaign = ReadCoord();\r
+\r
        armorblockpercent = ReadByte() / 255.0;\r
 \r
        g_weaponswitchdelay = ReadByte() / 255.0;\r
 \r
+       g_vore = ReadCoord();\r
        g_balance_vore_swallow_limit = ReadCoord();\r
+       g_healthsize = ReadCoord();\r
+\r
+       armor_max = ReadCoord();\r
 \r
        if(!postinit)\r
                PostInit();\r