]> git.rm.cloudns.org Git - voretournament/voretournament.git/commitdiff
Many cosmetic changes and rearrangements in the vore code
authorMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Thu, 9 Sep 2010 01:10:27 +0000 (04:10 +0300)
committerMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Thu, 9 Sep 2010 01:10:27 +0000 (04:10 +0300)
data/effectinfo.txt
data/qcsrc/server/defs.qh
data/qcsrc/server/vore.qc

index 748f17f2b8476fa6b06230ccb9e5080e32308e92..80602e4d099d4fd116660a6b75a14fe6e1729b34 100644 (file)
@@ -4607,6 +4607,8 @@ velocitymultiplier 20
 velocityoffset 0 0 10\r
 airfriction 1\r
 \r
+// regurgitate effect\r
+// used in: vore.qc:   pointparticles(particleeffectnum("regurgitate"), e.predator.origin, '0 0 0', 1)\r
 effect regurgitate\r
 count 30\r
 type blood\r
@@ -4629,4 +4631,4 @@ tex 0 8
 size 25 30\r
 alpha 100 256 400\r
 color 0x000000 0x408000\r
-originjitter 110 110 110
\ No newline at end of file
+originjitter 110 110 110\r
index 92debac882755565a2e2087b450a5f3bd3727a4e..6d316524576a53b26efb63a604ee59e8539f0e68 100644 (file)
@@ -196,8 +196,7 @@ void setanim(entity e, vector anim, float looping, float override, float restart
 .float         killcount;\r
 .float hitsound, typehitsound;\r
 \r
-.float watersound_finished;\r
-.float digestsound_finished;\r
+.float watersound_finished, digestsound_finished, gurglesound_finished;\r
 .float iscreature;\r
 .vector oldvelocity;\r
 \r
index 2034b1cf86c9e70a4435955c354cbfd55f41362f..fdbff4d971d80e0603d17ae216d2f7ec34f33632 100644 (file)
@@ -1,16 +1,17 @@
 .float regurgitate_prepare;\r
-.float system_delay, swallow_delay, digest_button_delay, regurgitate_button_delay;\r
-.float complain_swallow;\r
-const float complain_delay = 1;\r
-const float button_delay = 0.5;\r
-const float steptime = 0.1;\r
-const float system_delay_time = 0.1;\r
-\r
+.float system_delay, swallow_delay, digest_button_delay_time, regurgitate_button_delay_time;\r
+.float complain_vore;\r
 .float vore_oldmovetype, vore_oldsolid, vore_oldstomachload, vore_oldview_ofs_z;\r
 \r
+const float system_delay_time = 0.1;\r
+const float complain_delay_time = 1;\r
+const float button_delay_time = 0.5;\r
+const float steptime = 0.1;\r
+\r
 entity Swallow_distance_check()\r
 {\r
        // check if we can swallow a player instead of firing our weapon\r
+\r
        vector w_shotorg, w_shotdir;\r
        w_shotorg = self.origin + self.view_ofs;\r
        w_shotdir = v_forward;\r
@@ -25,17 +26,18 @@ entity Swallow_distance_check()
 float Swallow_condition_check(entity prey)\r
 {\r
        // checks the necessary conditions for swallowing another player\r
+\r
        if(prey.classname == "player" && prey.predator.classname != "player" && prey.deadflag == DEAD_NO) // we can't swallow someone who's already in someone else's stomach\r
        if(self.classname == "player" && self.predator.classname != "player" && self.deadflag == DEAD_NO) // we can't swallow players while inside someone's stomach ourselves\r
        if not(vlen(self.velocity) > cvar("g_balance_vore_regurgitate_speedcap"))\r
        {\r
                if(self.stomach_load >= cvar("g_balance_vore_swallow_limit"))\r
                {\r
-                       if(time > self.complain_swallow)\r
+                       if(time > self.complain_vore)\r
                        {\r
                                play2(self, "weapons/unavailable.wav");\r
                                sprint(self, strcat("You cannot swallow more than ^2", cvar_string("g_balance_vore_swallow_limit"), "^7 players at a time\n"));\r
-                               self.complain_swallow = time + complain_delay;\r
+                               self.complain_vore = time + complain_delay_time;\r
                        }\r
                        return FALSE;\r
                }\r
@@ -43,20 +45,21 @@ float Swallow_condition_check(entity prey)
                if(cvar("g_vore_biggergut"))\r
                if(prey.stomach_load > self.stomach_load)\r
                {\r
-                       if(time > self.complain_swallow)\r
+                       if(time > self.complain_vore)\r
                        {\r
                                play2(self, "weapons/unavailable.wav");\r
                                sprint(self, "You cannot swallow someone with a bigger stomach than yours\n");\r
-                               self.complain_swallow = time + complain_delay;\r
+                               self.complain_vore = time + complain_delay_time;\r
                        }\r
                        return FALSE;\r
                }\r
+\r
                return TRUE;\r
        }\r
        return FALSE;\r
 }\r
 \r
-float Vore_PreyCanLeave()\r
+float Vore_CanLeave()\r
 {\r
        if(teams_matter && self.team == self.predator.team)\r
                return TRUE;\r
@@ -64,7 +67,7 @@ float Vore_PreyCanLeave()
 }\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
+// our aim is going from the normal view offset to half of the view offset (because half is the best positioning for the stomach model)\r
 .float cameraeffect_current, cameraeffect_target;\r
 void Vore_CameraEffect_Set(entity e)\r
 {\r
@@ -93,14 +96,27 @@ void Vore_CameraEffect_Apply()
        self.view_ofs_z = self.vore_oldview_ofs_z / self.cameraeffect_current;\r
 }\r
 \r
+.float gurgle_oldstomachload;\r
+void Vore_Gurglesound()\r
+{\r
+       if(time > self.gurglesound_finished || self.gurgle_oldstomachload != self.stomach_load)\r
+       {\r
+               GlobalSound(self.playersound_gurgle, CHAN_TRIGGER, VOICETYPE_GURGLE);\r
+\r
+               self.gurglesound_finished = time + 11; // yes, hard coded sound length. I know it's bad but what can I do?\r
+               self.gurgle_oldstomachload = self.stomach_load;\r
+       }\r
+}\r
+\r
 void Vore_Weight_apply(entity e)\r
 {\r
        // apply stomach weight that makes you heavier the more you eat\r
-       // slowing the player is applied in cl_physics.qc\r
+       // slowing the player is done in cl_physics.qc\r
+\r
        if(e.stomach_load != e.vore_oldstomachload)\r
                e.gravity += 1 + (e.stomach_load * cvar("g_balance_vore_weight_gravity") - e.vore_oldstomachload);\r
        if(e.gravity == 0)\r
-               e.gravity = 0.00001; // 0 becomes 1 for .gravity, so do this to allow 0 gravity\r
+               e.gravity = 0.00001; // 0 becomes 1 for gravity, so do this to allow 0 gravity\r
        e.vore_oldstomachload = e.stomach_load;\r
 }\r
 \r
@@ -108,7 +124,8 @@ void Vore_Weight_apply(entity e)
 .float pushltime;\r
 void Vore_Swallow(entity e)\r
 {\r
-       // this player is beening swallowed by another player, apply the proper changes\r
+       // this player is being swallowed by another player, apply the proper changes\r
+\r
        e.vore_oldmovetype = e.movetype;\r
        e.vore_oldsolid = e.solid;\r
        e.vore_oldview_ofs_z = e.view_ofs_z;\r
@@ -118,8 +135,8 @@ void Vore_Swallow(entity e)
        e.velocity = '0 0 0';\r
        e.movetype = MOVETYPE_FOLLOW;\r
        e.solid = SOLID_NOT;\r
-       e.alpha = -1; // best way of hiding / showing the eaten player\r
-       e.aiment = e.predator; // follow the predator. Is automatically unset\r
+       e.alpha = -1; // best way of hiding the eaten player\r
+       e.aiment = e.predator; // follow the predator, automatically unset when regurgitated\r
 \r
        // drop keys (KH) and flags (CTF) when we get swallowed\r
        kh_Key_DropAll(e, FALSE);\r
@@ -131,7 +148,7 @@ void Vore_Swallow(entity e)
        if(stov(cvar_string("g_vore_regurgitatecolor_release")))\r
                e.colormod = stov(cvar_string("g_vore_regurgitatecolor_release"));\r
 \r
-       if(e.team == e.predator.team && teamplay)\r
+       if(teams_matter && e.team == e.predator.team)\r
        {\r
                centerprint(e, "^3You have been swallowed by a team mate, don't kick!");\r
                centerprint(e.predator, "^3You have swallowed a team mate, use caution!");\r
@@ -143,22 +160,23 @@ void Vore_Swallow(entity e)
        e.predator.regurgitate_prepare = 0;\r
        Vore_Weight_apply(e.predator);\r
 \r
-       // block firing for a small amount of time when voring, or we'll be firing the next frame after we swallow\r
-       e.predator.weapon_delay = time + button_delay;\r
+       // block firing for a small amount of time, or we'll be firing the next frame after we swallow\r
+       e.predator.weapon_delay = time + button_delay_time;\r
        e.predator.swallow_delay = time + cvar("g_balance_vore_swallow_delay");\r
        e.system_delay = e.predator.system_delay = time + system_delay_time;\r
 }\r
 \r
 void Vore_Regurgitate(entity e)\r
 {\r
-       // this player is being released from their predator, apply the proper changes\r
+       // this player is being regurgitated by their predator, apply the proper changes\r
+\r
        e.movetype = e.vore_oldmovetype;\r
        if(e.health > 0) // leave SOLID_NOT for dead bodies\r
                e.solid = e.vore_oldsolid;\r
        e.view_ofs_z = e.vore_oldview_ofs_z;\r
-       e.alpha = default_player_alpha; // best way of hiding / showing the eaten player\r
+       e.alpha = default_player_alpha;\r
 \r
-       // velocities\r
+       // apply velocities\r
        local vector oldforward, oldright, oldup;\r
        oldforward = v_forward;\r
        oldright = v_right;\r
@@ -170,7 +188,7 @@ void Vore_Regurgitate(entity e)
        v_right = oldright;\r
        v_up = oldup;\r
 \r
-       e.pusher = e.predator; // so we can frag players by regurgitating them in deadly pits\r
+       e.pusher = e.predator; // allows us to frag players by regurgitating them in deadly pits\r
        e.pushltime = time + cvar("g_maxpushtime");\r
 \r
        PlayerSound(e.predator, playersound_regurgitate, CHAN_PAIN, VOICETYPE_PLAYERSOUND);\r
@@ -181,22 +199,21 @@ void Vore_Regurgitate(entity e)
        e.predator.swallow_delay = time + cvar("g_balance_vore_swallow_delay");\r
        Vore_Weight_apply(e.predator);\r
 \r
-       // block firing for a small amount of time when getting regurgitated, or we'll be firing the next frame\r
-       e.weapon_delay = time + button_delay;\r
+       // block firing for a small amount of time, or we'll be firing the next frame\r
+       e.weapon_delay = time + button_delay_time;\r
        e.system_delay = e.predator.system_delay = time + system_delay_time;\r
        e.predator = world;\r
 }\r
 \r
-void Vore_Gurglesound();\r
 void Vore_Disconnect()\r
 {\r
-       // frees prey from their predators when someone disconnects or goes spectating\r
+       // frees prey from their predators when someone disconnects or goes spectating, or in other circumstances\r
 \r
-       // prey disconnects or goes spectating while inside someone's belly:\r
+       // prey disconnects or goes spectating while inside someone's belly\r
        if(self.predator.classname == "player")\r
                Vore_Regurgitate(self);\r
 \r
-       // pred disconnects or goes spectating with players in their belly:\r
+       // pred disconnects or goes spectating with players in their belly\r
        else if(self.stomach_load > 0)\r
        {\r
                entity head;\r
@@ -213,7 +230,8 @@ void Vore_Disconnect()
 void Vore_Digest()\r
 {\r
        // apply digestion to prey\r
-       if(time > self.predator.digestion_step + steptime)\r
+\r
+       if(time > self.predator.digestion_step)\r
        {\r
                Damage(self, self.predator, self.predator, cvar("g_balance_vore_digestion_damage"), DEATH_DIGESTION, self.origin, '0 0 0');\r
                if(cvar("g_balance_vore_digestion_vampire") && self.predator.health < cvar("g_balance_vore_digestion_vampire_stable"))\r
@@ -221,10 +239,10 @@ void Vore_Digest()
 \r
                if (self.predator.digestsound_finished < time)\r
                {\r
-                       self.predator.digestsound_finished = time + 0.5;\r
                        PlayerSound (self.predator, playersound_digest, CHAN_PLAYER, VOICETYPE_PLAYERSOUND);\r
+                       self.predator.digestsound_finished = time + 0.5;\r
                }\r
-               self.predator.digestion_step = time;\r
+               self.predator.digestion_step = time + steptime;\r
        }\r
 \r
        if(self.health <= 0)\r
@@ -235,11 +253,13 @@ void Vore_Digest()
 .float teamheal_step;\r
 void Vore_Teamheal()\r
 {\r
+       // apply teamheal\r
+\r
        if(cvar("g_balance_vore_teamheal") && self.health < cvar("g_balance_vore_teamheal_stable"))\r
-       if(time > self.teamheal_step + steptime)\r
+       if(time > self.teamheal_step)\r
        {\r
                self.health += cvar("g_balance_vore_teamheal");\r
-               self.teamheal_step = time;\r
+               self.teamheal_step = time + steptime;\r
        }\r
 }\r
 \r
@@ -247,8 +267,6 @@ void Vore_Teamheal()
 void Vore_StomachKick()\r
 {\r
        // allows prey to kick the predator's stomach and do some damage or attempt to escape\r
-       if(self.predator.classname != "player")\r
-               return;\r
 \r
        if(time > self.stomachkick_delay)\r
        {\r
@@ -257,7 +275,7 @@ void Vore_StomachKick()
                Damage(self.predator, self, self, damage, DEATH_STOMACHKICK, self.predator.origin, '0 0 0');\r
                sound(self.predator, CHAN_PROJECTILE, "weapons/stomachkick.ogg", VOL_BASE, ATTN_NORM);\r
 \r
-               if(cvar("g_balance_vore_kick_escapeprobability") >= random())\r
+               if(random() < cvar("g_balance_vore_kick_escapeprobability"))\r
                        Vore_Regurgitate(self);\r
 \r
                self.stomachkick_delay = time + cvar("g_balance_vore_kick_delay");\r
@@ -268,35 +286,25 @@ void Vore_StomachLeave()
 {\r
        // allows players to get out of their predator at will in some circumstances, such as team mates\r
 \r
-       if(Vore_PreyCanLeave())\r
+       if(Vore_CanLeave())\r
                Vore_Regurgitate(self);\r
-       else if(time > self.complain_swallow)\r
+       else if(time > self.complain_vore)\r
        {\r
                play2(self, "weapons/unavailable.wav");\r
                sprint(self, strcat("You cannot get out of ", self.predator.netname, "\n"));\r
-               self.complain_swallow = time + complain_delay;\r
-       }\r
-}\r
-\r
-.float gurglesound_finished, gurglesound_oldstomachload;\r
-void Vore_Gurglesound()\r
-{\r
-       if(time > self.gurglesound_finished || self.gurglesound_oldstomachload != self.stomach_load)\r
-       {\r
-               GlobalSound(self.playersound_gurgle, CHAN_TRIGGER, VOICETYPE_GURGLE);\r
-\r
-               self.gurglesound_finished = time + 11; // yes, hard coded sound length. I know it's bad but what can I do?\r
-               self.gurglesound_oldstomachload = self.stomach_load;\r
+               self.complain_vore = time + complain_delay_time;\r
        }\r
 }\r
 \r
 void Vore()\r
 {\r
-       // if we are free, show our stomach load on the HUD. Otherwise, show the predator's\r
+       // main vore code, this is where it all happens\r
+\r
+       // set all vore related stats\r
        if(self.predator.classname == "player")\r
        {\r
-               self.stat_stomachload = self.predator.stomach_load;\r
-               self.stat_digesting = self.predator.digesting;\r
+               self.stat_stomachload = self.predator.stomach_load; // necessary for the stomach board\r
+               self.stat_digesting = self.predator.digesting; // necessary for the stomach board\r
                self.stat_eaten = num_for_edict(self.predator);\r
        }\r
        else\r
@@ -305,9 +313,10 @@ void Vore()
                self.stat_digesting = self.digesting;\r
                self.stat_eaten = 0;\r
        }\r
+       self.stat_canleave = Vore_CanLeave();\r
 \r
        // skip the vore system under some circumstances\r
-       if(time < game_starttime || (time < warmup && !inWarmupStage))\r
+       if(time < game_starttime || (time < warmup && !inWarmupStage)) // don't allow vore before a round begins\r
        {\r
                Vore_Disconnect();\r
                return;\r
@@ -324,49 +333,49 @@ void Vore()
        entity prey;\r
        prey = Swallow_distance_check();\r
 \r
-       // attempt to swallow our new prey if there's any in range\r
+       // attempt to swallow our new prey if we pressed the attack button, and there's any in range\r
        if(self.BUTTON_ATCK && !self.BUTTON_REGURGITATE && self.swallow_delay < time)\r
        if(Swallow_condition_check(prey))\r
                Vore_Swallow(prey);\r
 \r
-       // start / stop digestion on command, if the player has someone in their stomach\r
+       // toggle digestion, if the player has someone in their stomach\r
        if(self.BUTTON_DIGEST)\r
        {\r
                if(self.stomach_load)\r
                {\r
-                       if(time > self.digest_button_delay)\r
+                       if(time > self.digest_button_delay_time)\r
                        {\r
                                self.digesting = !self.digesting;\r
-                               self.digest_button_delay = time + button_delay;\r
+                               self.digest_button_delay_time = time + button_delay_time;\r
                        }\r
                }\r
-               else if(time > self.complain_swallow)\r
+               else if(time > self.complain_vore)\r
                {\r
                        play2(self, "weapons/unavailable.wav");\r
                        sprint(self, "There is nothing to digest\n");\r
-                       self.complain_swallow = time + complain_delay;\r
+                       self.complain_vore = time + complain_delay_time;\r
                }\r
        }\r
        if(!self.stomach_load)\r
                self.digesting = FALSE;\r
 \r
-       // release players from this player's stomach on command\r
+       // predator wishes to regurgitate his prey\r
        if(self.BUTTON_REGURGITATE)\r
        {\r
                if(self.stomach_load)\r
                {\r
-                       if(time > self.regurgitate_button_delay)\r
+                       if(time > self.regurgitate_button_delay_time)\r
                        {\r
                                self.regurgitate_prepare = time + cvar("g_balance_vore_regurgitate_delay");\r
                                PlayerSound(self, playersound_regurgitate_prepare, CHAN_VOICE, VOICETYPE_PLAYERSOUND);\r
-                               self.regurgitate_button_delay = time + button_delay;\r
+                               self.regurgitate_button_delay_time = time + button_delay_time;\r
                        }\r
                }\r
-               else if(time > self.complain_swallow)\r
+               else if(time > self.complain_vore)\r
                {\r
                        play2(self, "weapons/unavailable.wav");\r
                        sprint(self, "There is nothing to regurgitate\n");\r
-                       self.complain_swallow = time + complain_delay;\r
+                       self.complain_vore = time + complain_delay_time;\r
                }\r
        }\r
 \r
@@ -388,7 +397,7 @@ void Vore()
                target_predator = self.predator.predator;\r
 \r
                Vore_Regurgitate(self);\r
-               if(random() < cvar("g_vore_stealprey"))\r
+               if(random() < cvar("g_vore_stealprey")) // steal our prey's prey if this probability returns true\r
                if not(teams_matter && self.predator.team == target_predator.team) // don't steal a team mate's prey\r
                if(Swallow_condition_check(self))\r
                {\r
@@ -401,25 +410,25 @@ void Vore()
        else if(vlen(self.predator.velocity) > cvar("g_balance_vore_regurgitate_speedcap"))\r
                Vore_Regurgitate(self);\r
 \r
-       // apply delayed regurgitating\r
+       // apply delayed regurgitating if it was scheduled\r
        if(self.predator.regurgitate_prepare && time > self.predator.regurgitate_prepare)\r
        {\r
                self.predator.regurgitate_prepare = 0;\r
-               self.predator.complain_swallow = time + complain_delay;\r
+               self.predator.complain_vore = time + complain_delay_time; // prevent complaining the next frame if this empties our stomach\r
                Vore_Regurgitate(self);\r
        }\r
 \r
+       // execute digesting and team healing\r
        if(self.predator.digesting == TRUE)\r
                Vore_Digest();\r
        if(teams_matter && self.team == self.predator.team)\r
                Vore_Teamheal();\r
 \r
+       // execute prey commands\r
        if(self.BUTTON_ATCK)\r
                Vore_StomachKick();\r
        if(self.BUTTON_JUMP)\r
                Vore_StomachLeave();\r
 \r
-       self.stat_canleave = Vore_PreyCanLeave();\r
-\r
        Vore_CameraEffect_Apply();\r
 }
\ No newline at end of file