Canswallow indicator for crosshair. When enabled, the crosshair will turn into a...
authorMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Mon, 28 Feb 2011 18:24:49 +0000 (20:24 +0200)
committerMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Mon, 28 Feb 2011 18:24:49 +0000 (20:24 +0200)
data/defaultVoretournament.cfg
data/qcsrc/client/View.qc
data/qcsrc/common/constants.qh
data/qcsrc/server/cl_client.qc
data/qcsrc/server/defs.qh
data/qcsrc/server/g_world.qc
data/qcsrc/server/vore.qc

index ef386e39a75d0d9ec9f0352285c0fd39210da4ca..df15ab56df7fb69f33d2cc7383eb74d9ea2e7240 100644 (file)
@@ -112,6 +112,8 @@ seta crosshair_pickup 1
 seta crosshair_pickup_speed 4\r
 seta crosshair_ring_alpha 0.5\r
 seta crosshair_ring_size 3\r
+seta crosshair_swallowindicator 1\r
+seta crosshair_swallowindicator_size 4\r
 seta crosshair_effect_speed 0.25 "how fast (in seconds) some crosshair effects should take place, 0 = instant, -1 = 2x weapon switch time"\r
 seta crosshair_effect_scalefade 1 "use scaling and fading for crosshair effects"\r
 seta crosshair_hittest 1.25 "do a crosshair hit evaluation; also, the crosshair is scaled by the given number when aiming at an enemy, and blurred when aiming at a team mate"\r
index dec78f340977807bb2b6b4bff61e974d3e9a1a89..1daa4cb4bde22f8d8ed81e8aefb85ef8b0612b16 100644 (file)
@@ -892,6 +892,12 @@ void CSQC_UpdateView(float w, float h)
                Sbar_DrawCenterPrint(); // draw centerprint messages even if viewsize >= 120\r
        }\r
 \r
+       float weapon_clipload, weapon_clipsize, ring_scale;\r
+\r
+       float swallow_indicator;\r
+       if(cvar("crosshair_swallowindicator"))\r
+               swallow_indicator = getstati(STAT_VORE_CANSWALLOW);\r
+\r
        float hud;\r
        hud = getstati(STAT_HUD);\r
 \r
@@ -909,6 +915,7 @@ void CSQC_UpdateView(float w, float h)
                        wcross_origin = project_3d_to_2d(view_origin + MAX_SHOT_DISTANCE * view_forward);\r
                        wcross_origin_z = 0;\r
                        if(cvar("crosshair_hittest"))\r
+                       if(!swallow_indicator)\r
                        {\r
                                vector wcross_oldorigin;\r
                                wcross_oldorigin = wcross_origin;\r
@@ -927,10 +934,14 @@ void CSQC_UpdateView(float w, float h)
                        else\r
                                shottype = SHOTTYPE_HITWORLD;\r
 \r
-                       float weapon_clipload, weapon_clipsize, ring_scale;\r
-\r
                        string wcross_style;\r
-                       wcross_style = cvar_string("crosshair");\r
+\r
+                       if(swallow_indicator  > 1)\r
+                               wcross_style = "_canswallow_team.tga";\r
+                       else if(swallow_indicator > 0)\r
+                               wcross_style = "_canswallow.tga";\r
+                       else\r
+                               wcross_style = cvar_string("crosshair");\r
 \r
                        if (wcross_style != "0") {\r
                                vector wcross_color, wcross_size;\r
@@ -1061,10 +1072,14 @@ void CSQC_UpdateView(float w, float h)
                                CROSSHAIR_DRAW(wcross_resolution, wcross_name, wcross_alpha * f);\r
                                wcross_name_alpha_goal_prev = f;\r
 \r
+                               if(swallow_indicator)\r
+                                       wcross_size *= cvar("crosshair_swallowindicator_size");\r
+\r
                                // ring around crosshair representing bullets left in weapon clip\r
                                weapon_clipload = getstati(STAT_WEAPON_CLIPLOAD);\r
                                a = cvar("crosshair_ring_alpha");\r
                                if (weapon_clipload && a)\r
+                               if (!swallow_indicator)\r
                                {\r
                                        weapon_clipsize = getstati(STAT_WEAPON_CLIPSIZE);\r
                                        ring_scale = cvar("crosshair_ring_size");\r
index c0e402d87daf6fad2870d9ce61bf4d4be3528648..a01cafdaa92cefc08936ad42e4ed86d4bbeec819 100644 (file)
@@ -284,11 +284,12 @@ const float STAT_VORE_LOAD = 52;
 const float STAT_VORE_DIGESTING = 53;\r
 const float STAT_VORE_EATEN = 54;\r
 const float STAT_VORE_CANLEAVE = 55;\r
+const float STAT_VORE_CANSWALLOW = 56;\r
 const float CTF_STATE_ATTACK = 1;\r
 const float CTF_STATE_DEFEND = 2;\r
 const float CTF_STATE_COMMANDER = 3;\r
 \r
-const float STAT_HUD = 56;\r
+const float STAT_HUD = 57;\r
 const float HUD_NORMAL = 0;\r
 \r
 // moved that here so the client knows the max.\r
index 937a73d66778ae84e2eb8da446aeedd525af48a6..845ad8be39b9168449b16a4a7bb8b66373046902 100644 (file)
@@ -2056,6 +2056,7 @@ void SpectateCopy(entity spectatee) {
        self.stat_stomachload = spectatee.stat_stomachload;\r
        self.stat_digesting = spectatee.stat_digesting;\r
        self.stat_canleave = spectatee.stat_canleave;\r
+       self.stat_canswallow = spectatee.stat_canswallow;\r
        setorigin(self, spectatee.origin);\r
        setsize(self, spectatee.mins, spectatee.maxs);\r
        SetZoomState(spectatee.zoomstate);\r
index 64025012c2a6fcda57180edb5a08941f21ed7f44..7bba8ff338b9c8314730713de662f47658605430 100644 (file)
@@ -71,7 +71,7 @@ float maxclients;
 .float stomach_load;\r
 .float weapon_delay;\r
 .float fakeprey;\r
-.float stat_eaten, stat_stomachload, stat_digesting, stat_canleave;\r
+.float stat_eaten, stat_stomachload, stat_digesting, stat_canleave, stat_canswallow;\r
 \r
 // Fields\r
 \r
index e1174dd24f16dcb962c673b5d06f57fb96e5e95b..7a065d43dc6c056c5e2b1d96d9c1ceb5e9d0f83c 100644 (file)
@@ -659,6 +659,7 @@ void spawnfunc_worldspawn (void)
        addstat(STAT_LAST_PICKUP, AS_FLOAT, last_pickup);\r
        addstat(STAT_WINNING, AS_FLOAT, winning);\r
        addstat(STAT_VORE_LOAD, AS_INT, stat_stomachload);\r
+       addstat(STAT_VORE_CANSWALLOW, AS_INT, stat_canswallow);\r
        addstat(STAT_VORE_DIGESTING, AS_INT, stat_digesting);\r
        addstat(STAT_VORE_EATEN, AS_INT, stat_eaten);\r
        addstat(STAT_VORE_CANLEAVE, AS_INT, stat_canleave);\r
index ae066df94c19120f4d181323e7204d363d1bdd71..3f80c6054b7904359362c8e44ddb82997c4c6e4b 100644 (file)
@@ -534,9 +534,18 @@ void Vore()
        prey = Swallow_player_check();\r
 \r
        // attempt to swallow our new prey if we pressed the attack button, and there's any in range\r
-       if(self.BUTTON_ATCK)\r
+       self.stat_canswallow = 0;\r
        if(Swallow_condition_check(prey))\r
-               Vore_Swallow(prey);\r
+       {\r
+               // canswallow stat, used by the HUD\r
+               if(teams_matter && prey.team == self.team)\r
+                       self.stat_canswallow = 2;\r
+               else\r
+                       self.stat_canswallow = 1;\r
+\r
+               if(self.BUTTON_ATCK)\r
+                       Vore_Swallow(prey);\r
+       }\r
 \r
        // toggle digestion, if the player has someone in their stomach\r
        if(self.BUTTON_DIGEST && cvar("g_vore_digestion"))\r