]> de.git.xonotic.org Git - voretournament/voretournament.git/commitdiff
Add a message that lets us know we can leave the belly, when it's the case
authorMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Tue, 7 Sep 2010 18:30:14 +0000 (21:30 +0300)
committerMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Tue, 7 Sep 2010 18:30:14 +0000 (21:30 +0300)
data/qcsrc/client/sbar.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 d9223079ffb8859c4cb0a1f67effe61b7120b625..fe6e09ecc7aea1865792612a353cf33629848e0d 100644 (file)
@@ -3075,6 +3075,15 @@ void Sbar_Draw (void)
                        CSQC_ctf_hud();\r
                else if(gametype == GAME_CTS || gametype == GAME_RACE)\r
                        CSQC_race_hud();\r
+\r
+               // draw canleave message\r
+               if(getstati(STAT_VORE_CANLEAVE))\r
+               {\r
+                       s = strcat("^7Press ^3", getcommandkey("secondary fire", "+attack2"), " ^7to exit");\r
+                       pos_x = bottom_x - stringwidth(s, TRUE, '0 0 0') * 16 / 2;\r
+                       pos_y = bottom_y - 120;\r
+                       drawcolorcodedstring(pos, s, '16 16 0', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
+               }\r
        }\r
        return;\r
 }\r
index a6031ba92c8115e7aa53304db9d9438b53dbc028..ff54fb862ac73be76ca39ab575be2d2683cbe020 100644 (file)
@@ -279,6 +279,7 @@ const float STAT_LEADLIMIT = 47;
 const float STAT_VORE_LOAD = 48;\r
 const float STAT_VORE_DIGESTING = 49;\r
 const float STAT_VORE_EATEN = 50;\r
+const float STAT_VORE_CANLEAVE = 51;\r
 const float CTF_STATE_ATTACK = 1;\r
 const float CTF_STATE_DEFEND = 2;\r
 const float CTF_STATE_COMMANDER = 3;\r
index 9f5eb15f8c3f537fc4afcb76266355eca41a1b1a..52a9a412326a0654697b44ae7f697d93ed22bb8a 100644 (file)
@@ -2016,6 +2016,7 @@ void SpectateCopy(entity spectatee) {
        self.stat_eaten = spectatee.stat_eaten;\r
        self.stat_stomachload = spectatee.stat_stomachload;\r
        self.stat_digesting = spectatee.stat_digesting;\r
+       // self.stat_canleave = spectatee.stat_canleave; // don't enable this one, since the notification it's used for does not address spectated players\r
        setorigin(self, spectatee.origin);\r
        setsize(self, spectatee.mins, spectatee.maxs);\r
        SetZoomState(spectatee.zoomstate);\r
index 569236edd2d9fadac371895dd3ba35c5ecb2645f..9e6a63fbf541f1b45287549722ea1e04b11e8339 100644 (file)
@@ -69,7 +69,7 @@ float maxclients;
 .float digesting;\r
 .float stomach_load;\r
 .float weapon_delay;\r
-.float stat_eaten, stat_stomachload, stat_digesting;\r
+.float stat_eaten, stat_stomachload, stat_digesting, stat_canleave;\r
 \r
 // Fields\r
 \r
index d06624c224f7caef85e50437cfb0b82ff27beebf..3c1fb34deda413e4a3a3518c762892c735a0d44d 100644 (file)
@@ -657,6 +657,7 @@ void spawnfunc_worldspawn (void)
        addstat(STAT_VORE_LOAD, AS_INT, stat_stomachload);\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
 \r
        next_pingtime = time + 5;\r
        InitializeEntity(self, cvar_changes_init, INITPRIO_CVARS);\r
index 48ea0c6e8d63ddf3a3a042967f39c5bc44e4a1f1..f6f4165dffedd3c5e7d4fa047cc52f7a4a1911ac 100644 (file)
@@ -56,6 +56,13 @@ float Swallow_condition_check(entity prey)
        return FALSE;\r
 }\r
 \r
+float Vore_PreyCanLeave()\r
+{\r
+       if(teams_matter && self.team == self.eater.team)\r
+               return TRUE;\r
+       return FALSE;\r
+}\r
+\r
 // make the camera smoothly lower itself when we get swallowed\r
 // the target we are going for is from normal view offset to half of the view offset (because half is the best positioning of the view for the stomach model)\r
 .float cameraeffect_current, cameraeffect_target;\r
@@ -266,10 +273,7 @@ void Vore_StomachLeave()
 {\r
        // allows players to get out of their predator at will in some circumstances, such as team mates\r
 \r
-       float canleave;\r
-       canleave = (teams_matter && self.team == self.eater.team); // currently, the only circumstance where you can use this if for team mates\r
-\r
-       if(canleave)\r
+       if(Vore_PreyCanLeave())\r
                Vore_Regurgitate(self);\r
        else if(time > self.complain_swallow)\r
        {\r
@@ -419,5 +423,7 @@ void Vore()
        else if(self.BUTTON_ATCK2)\r
                Vore_StomachLeave();\r
 \r
+       self.stat_canleave = Vore_PreyCanLeave();\r
+\r
        Vore_CameraEffect_Apply();\r
 }
\ No newline at end of file