]> git.xonotic.org Git - voretournament/voretournament.git/commitdiff
Randomize the position of prey in the stomach, now that there is no hard coded limit...
authorMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Mon, 18 Jul 2011 14:36:06 +0000 (17:36 +0300)
committerMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Mon, 18 Jul 2011 14:36:06 +0000 (17:36 +0300)
data/balanceVT.cfg
data/qcsrc/server/vore.qc

index e3ea3576a2d3bed23ed51ba33759d4d64d7857ce..0cba3cb2b7967547aabb5f552fb260a5ccb37f70 100644 (file)
@@ -185,6 +185,7 @@ set g_balance_grabber_reload_time 2
 // }}}\r
 \r
 // {{{ stomach\r
+set g_balance_vore_action_delay 1 "how many seconds must pass before you can swallow or regurgitate again, after swallowing or regurgitating another player"\r
 set g_balance_vore_load_pred_capacity 100 "capacity percent a player's stomach has, influenced by player size"\r
 set g_balance_vore_load_pred_weight 1 "you get this heavier the more you eat, at 1 a full belly makes you two times heavier"\r
 set g_balance_vore_load_pred_speed 1 "you get this slower the more you eat, at 1 a full belly makes you two times slower"\r
@@ -207,7 +208,6 @@ set g_balance_vore_regurgitate_force 600 "regurgitated players rocket out at thi
 set g_balance_vore_regurgitate_predatorforce 450 "players are pushed back by this amount when regurgitating someone, opposite of the direction they are facing"\r
 set g_balance_vore_regurgitate_delay 0.5 "regurgitation delay"\r
 set g_balance_vore_regurgitate_punchangle 12 "your view gets tilted by this amount when regurgitating someone"\r
-set g_balance_vore_action_delay 1 "how many seconds must pass before you can swallow or regurgitate again, after swallowing or regurgitating another player"\r
 set g_balance_vore_digestion_damage 4 "amount of damage applied to victims during digestion"\r
 set g_balance_vore_digestion_vampire 1 "amount of health you gain from digestion"\r
 set g_balance_vore_digestion_vampire_stable 150 "maximum amount of health you can gain from digestion (best kept equal or less than g_balance_health_rotstable)"\r
index 37d620745734cab110511a26f95e5df569a9b1dd..fa499430e88dc48dac6ec494188688a666af3f6a 100644 (file)
@@ -99,65 +99,31 @@ float Vore_CanLeave()
 }\r
 \r
 // position the camera properly for prey\r
-void Vore_SetPreyPositions()\r
+void Vore_SetPreyPositions(entity pred)\r
 {\r
-       // self is the predator and head is the prey\r
+       // pred is the predator and head is the prey\r
 \r
        local entity head;\r
        local vector origin_apply;\r
-       local float position_counter;\r
 \r
        // In order to allow prey to see each other in the stomach, we must position each occupant differently,\r
-       // else all players overlap in the center. To do this, we run a loop on all players in the same stomach.\r
-       // For each player, the origin is updated, then a new origin is used for the next player.\r
-       // This requires that no more than 9 players may be in the stomach at a time!\r
+       // else all players overlap in the center. To do this, we use a random origin on all players in the same stomach.\r
        FOR_EACH_PLAYER(head)\r
        {\r
-               if(head.predator == self)\r
+               if(head.predator == pred)\r
                {\r
-                       switch(position_counter)\r
-                       {\r
-                               case 0:\r
-                                       origin_apply = '0 0 0'; // first occupant sits in the middle\r
-                                       break;\r
-                               case 1:\r
-                                       origin_apply = '1 0 0'; // second occupant sits in the front\r
-                                       break;\r
-                               case 2:\r
-                                       origin_apply = '-1 0 0'; // third occupant sits in the back\r
-                                       break;\r
-                               case 3:\r
-                                       origin_apply = '0 1 0'; // fourth occupant sits in the right\r
-                                       break;\r
-                               case 4:\r
-                                       origin_apply = '0 -1 0'; // fifth occupant sits in the left\r
-                                       break;\r
-                               case 5:\r
-                                       origin_apply = '1 1 0'; // sixth occupant sits in the front-right\r
-                                       break;\r
-                               case 6:\r
-                                       origin_apply = '-1 1 0'; // seventh occupant sits in the back-right\r
-                                       break;\r
-                               case 7:\r
-                                       origin_apply = '1 -1 0'; // eigth occupant sits in the front-left\r
-                                       break;\r
-                               case 8:\r
-                                       origin_apply = '-1 -1 0'; // ninth occupant sits in the back-left\r
-                                       break;\r
-                               default:\r
-                                       break;\r
-                       }\r
+                       origin_apply_x = PL_PREY_VIEW_OFS_x + crandom() * cvar("g_vore_neighborprey_distance");\r
+                       origin_apply_y = PL_PREY_VIEW_OFS_y + crandom() * cvar("g_vore_neighborprey_distance");\r
+                       origin_apply_z = PL_PREY_VIEW_OFS_z;\r
 \r
                        // since prey have their predators set as an aiment, view_ofs will specify the real origin of prey, not just the view offset\r
-                       head.view_ofs = PL_PREY_VIEW_OFS + origin_apply * cvar("g_vore_neighborprey_distance");\r
-                       head.view_ofs_z *= self.scale; // stomach center depends on predator scale\r
+                       head.view_ofs = origin_apply;\r
+                       head.view_ofs_z *= pred.scale; // stomach center depends on predator scale\r
 \r
                        // change prey height based on scale\r
                        float prey_height;\r
-                               prey_height = (head.scale - self.scale) * cvar("g_healthsize_vore_pos");\r
+                               prey_height = (head.scale - pred.scale) * cvar("g_healthsize_vore_pos");\r
                        head.view_ofs_z += prey_height;\r
-\r
-                       position_counter += 1;\r
                }\r
        }\r
 }\r
@@ -333,6 +299,7 @@ void Vore_Swallow(entity e)
        e.predator.spawnshieldtime = 0; // lose spawn shield when we vore\r
        e.predator.hitsound += 1; // play this for team mates too, as we could be swallowing them to heal them\r
        Vore_AutoDigest(e.predator);\r
+       Vore_SetPreyPositions(e.predator);\r
 \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
@@ -420,6 +387,7 @@ void Vore_Regurgitate(entity e)
        e.predator.punchangle_x += cvar("g_balance_vore_regurgitate_punchangle");\r
        e.predator.regurgitate_prepare = 0;\r
        e.predator.action_delay = time + cvar("g_balance_vore_action_delay");\r
+       Vore_SetPreyPositions(e.predator);\r
 \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
@@ -437,6 +405,7 @@ void Vore_DeadPrey_Configure(entity e)
        // this entity is like e.predator but for dead prey, to avoid conflicts\r
        e.fakepredator = e.predator;\r
        e.fakeprey = TRUE;\r
+       Vore_SetPreyPositions(e.predator);\r
 \r
        // first release the prey from the predator, as dead prey needs to be attached differently\r
        // the predator's stomach load is also decreased, as dead prey doesn't count any more\r
@@ -863,8 +832,6 @@ void Vore()
 // Code that addresses the prey:\r
 // --------------------------------\r
 \r
-       Vore_SetPreyPositions();\r
-\r
        // keepdeadprey - detach dead prey if their predator died or got swallowed\r
        if(self.fakeprey)\r
        if(self.fakepredator.deadflag != DEAD_NO || self.fakepredator.stat_eaten)\r