]> git.xonotic.org Git - voretournament/voretournament.git/blobdiff - data/qcsrc/client/Main.qc
Get VoreTournament code to compile with gmqcc. To be compiled with the same parameter...
[voretournament/voretournament.git] / data / qcsrc / client / Main.qc
index e01f560fe805dc7b32badaa04a320f30d8f3c63d..84e69a5b35725edc601eeebc405c229620a27633 100644 (file)
@@ -33,9 +33,8 @@ void() menu_show_error =
 // CSQC_Init : Called every time the CSQC code is initialized (essentially at map load)\r
 // Useful for precaching things\r
 \r
-void() menu_sub_null =\r
-{\r
-};\r
+float(float, float, float) menu_sub_null_float = { };\r
+void () menu_sub_null_void  = { };\r
 \r
 #ifdef USE_FTE\r
 float __engine_check;\r
@@ -71,7 +70,7 @@ void CSQC_Init(void)
        drawfont = FONT_USER+1;\r
        menu_visible = FALSE;\r
        menu_show = menu_show_error;\r
-       menu_action = menu_sub_null;\r
+       menu_action = menu_sub_null_float;\r
 \r
        for(i = 0; i < 255; ++i)\r
                if(getplayerkey(i, "viewentity") == "")\r
@@ -177,11 +176,17 @@ void CSQC_Init(void)
                        get_mi_min_max_texcoords(0); // load new texcoords\r
        }\r
 \r
+       precache_pic(strcat("gfx/hud/", cvar_string("hud_style"), "/bg_radar.tga"));\r
+       precache_pic(strcat("gfx/hud/", cvar_string("hud_style"), "/fg_radar.tga"));\r
+       precache_pic(strcat("gfx/hud/", cvar_string("hud_style"), "/fg_radar_team.tga"));\r
+\r
        mi_center = (mi_min + mi_max) * 0.5;\r
        mi_scale = mi_max - mi_min;\r
        minimapname = strzone(minimapname);\r
 \r
        WarpZone_Init();\r
+\r
+       draw_currentSkin = strzone(strcat("gfx/menu/", cvar_string("menu_skin")));\r
 }\r
 \r
 // CSQC_Shutdown : Called every time the CSQC code is shutdown (changing maps, quitting, etc)\r
@@ -208,6 +213,10 @@ 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(calledhooks & HOOK_START)\r
@@ -543,7 +552,7 @@ void GameCommand(string msg)
                cvar_clientsettemp(argv(1), argv(2));\r
        }\r
        else if(cmd == "radar") {\r
-               ons_showmap = !ons_showmap;\r
+               showmap = !showmap;\r
        }\r
        else if(cmd == "sbar_columns_set") {\r
                Cmd_Sbar_SetFields(argc);\r
@@ -653,17 +662,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 = ReadShort();\r
+       if(sf & 16)\r
+               self.armorvalue = ReadShort();\r
+       if(sf & 32)\r
+               self.eaten = ReadByte();\r
+\r
+       entcs_receiver[self.sv_entnum] = self;\r
+       self.entremove = Ent_RemoveEntCS;\r
 \r
        InterpolateOrigin_Note();\r
 }\r
@@ -689,7 +721,7 @@ void Ent_ReadPlayerScore()
        float isNew;\r
        entity o;\r
 \r
-       // damnit -.- don't want to go change every single .sv_entnum in sbar.qc AGAIN\r
+       // damnit -.- don't want to go change every single .sv_entnum in hud.qc AGAIN\r
        // (no I've never heard of M-x replace-string, sed, or anything like that)\r
        isNew = !self.owner; // workaround for DP bug\r
        n = ReadByte()-1;\r
@@ -921,6 +953,7 @@ void(float bIsNewEntity) CSQC_Ent_Update =
                case ENT_CLIENT_WARPZONE: WarpZone_Read(bIsNewEntity); break;\r
                case ENT_CLIENT_WARPZONE_CAMERA: WarpZone_Camera_Read(bIsNewEntity); break;\r
                case ENT_CLIENT_TRIGGER_MUSIC: Ent_ReadTriggerMusic(); break;\r
+               case ENT_CLIENT_PORTRAIT: Ent_ReadPortrait(); break;\r
                default:\r
                        error(strcat("unknown entity type in CSQC_Ent_Update: ", ftos(self.enttype), "\n"));\r
                        break;\r
@@ -938,8 +971,8 @@ void Ent_Remove()
 \r
        self.enttype = 0;\r
        self.classname = "";\r
-       self.draw = menu_sub_null;\r
-       self.entremove = menu_sub_null;\r
+       self.draw = menu_sub_null_void;\r
+       self.entremove = menu_sub_null_void;\r
        // TODO possibly set more stuff to defaults\r
 }\r
 // CSQC_Ent_Remove : Called when the server requests a SSQC / CSQC entity to be removed.  Essentially call remove(self) as well.\r
@@ -1022,14 +1055,23 @@ void Ent_Init()
                strunzone(forcefog);\r
        forcefog = strzone(ReadString());\r
 \r
-       g_campaign = ReadCoord();\r
+       g_campaign = ReadShort();\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_vore = ReadShort();\r
+       g_healthsize_center = ReadShort();\r
+       g_healthsize_min = ReadShort();\r
+       g_healthsize_max = ReadShort();\r
+\r
+       armor_max = ReadCoord();\r
+       teamheal_max = ReadCoord();\r
+\r
+       g_power = ReadShort();\r
+       g_power_reboot = ReadShort();\r
+       g_power_reboot_spawn = ReadByte();\r
 \r
        if(!postinit)\r
                PostInit();\r
@@ -1220,7 +1262,7 @@ void Net_ReadOtherPLReport()
 {\r
        float e, ph, pn;\r
        e = ReadByte();\r
-       ph = ReadByte();\r
+       ph = ReadShort(); // not ReadByte because we show minus health too\r
        pn = ReadByte();\r
        if not(playerslots[e])\r
                return;\r