From cd0ac8cefda12d4a5d5808dca19af9ed3922c11e Mon Sep 17 00:00:00 2001 From: MirceaKitsune Date: Mon, 18 Jul 2011 13:23:40 +0300 Subject: [PATCH] First part of a mass based swallowing system. Swallow limit will no longer be a player count, but a mass difference, that will account player size as well. --- data/balanceVT.cfg | 2 +- data/qcsrc/client/Main.qc | 1 - data/qcsrc/client/main.qh | 1 - data/qcsrc/client/sbar.qc | 7 ++++--- data/qcsrc/common/constants.qh | 22 +++++++++++----------- data/qcsrc/server/cl_client.qc | 6 +++--- data/qcsrc/server/cl_player.qc | 2 +- data/qcsrc/server/defs.qh | 3 +-- data/qcsrc/server/g_world.qc | 1 + data/qcsrc/server/miscfunctions.qc | 1 - data/qcsrc/server/vore.qc | 12 ++++++++++-- 11 files changed, 32 insertions(+), 26 deletions(-) diff --git a/data/balanceVT.cfg b/data/balanceVT.cfg index d644c044..2643e00f 100644 --- a/data/balanceVT.cfg +++ b/data/balanceVT.cfg @@ -185,8 +185,8 @@ set g_balance_grabber_reload_time 2 // }}} // {{{ stomach +set g_balance_vore_load_capacity 100 "capacity percent a player's stomach has, influenced by player size" set g_balance_vore_swallow_range 140 "distance below which you can swallow another player when facing them" -set g_balance_vore_swallow_limit 3 "how many players can fit in the stomach at a time, may range between 1 and 9" set g_balance_vore_swallow_speed_fill 2.5 "how long it takes to swallow a player, 0 is instant" set g_balance_vore_swallow_speed_fill_scalediff 0.5 "fill rate depends on predator size compared to prey size by this amount" set g_balance_vore_swallow_speed_fill_stomachload 1 "fill rate is influenced by the prey's stomach load" diff --git a/data/qcsrc/client/Main.qc b/data/qcsrc/client/Main.qc index 90dce734..d9449353 100644 --- a/data/qcsrc/client/Main.qc +++ b/data/qcsrc/client/Main.qc @@ -1054,7 +1054,6 @@ void Ent_Init() g_weaponswitchdelay = ReadByte() / 255.0; g_vore = ReadShort(); - g_balance_vore_swallow_limit = ReadShort(); g_healthsize = ReadShort(); g_healthsize_min = ReadShort(); g_healthsize_max = ReadShort(); diff --git a/data/qcsrc/client/main.qh b/data/qcsrc/client/main.qh index b5801490..245ed886 100644 --- a/data/qcsrc/client/main.qh +++ b/data/qcsrc/client/main.qh @@ -167,7 +167,6 @@ float armorblockpercent; float g_weaponswitchdelay; float g_vore; -float g_balance_vore_swallow_limit; float g_healthsize, g_healthsize_min, g_healthsize_max; float armor_max; float teamheal_max; diff --git a/data/qcsrc/client/sbar.qc b/data/qcsrc/client/sbar.qc index 6aec0e8e..d4053718 100644 --- a/data/qcsrc/client/sbar.qc +++ b/data/qcsrc/client/sbar.qc @@ -3027,12 +3027,13 @@ void Sbar_Draw (void) drawpic(bottomleft - '0 256 0', "gfx/hud/bg_stomach_status", '256 256 0', StomachStatus_ColorFade(hl_color), cvar("sbar_stomachboard_status_alpha") * sbar_alpha_fg, DRAWFLAG_NORMAL); drawstring(bottomleft - '-80 173 0', hl_string, '11 11 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL); - float stomach_load; - stomach_load = getstati(STAT_VORE_LOAD); // shows the predator's stomach load when we are eaten, and ours otherwise + float stomach_load, stomach_maxload; // shows the predator's stomach load when we are eaten, and ours otherwise + stomach_load = getstati(STAT_VORE_LOAD); + stomach_maxload = getstati(STAT_VORE_MAXLOAD); vector status_pos; string status_text; - status_text = strcat(ftos(bound(0, stomach_load, 9)), "/", ftos(bound(0, g_balance_vore_swallow_limit, 9))); + status_text = strcat(ftos(stomach_load), "/", ftos(stomach_maxload)); status_pos = bottomleft - '-44 171 0'; status_pos -= '1 0 0' * stringwidth(status_text, FALSE, '22 22 0') * 0.5; drawstring(status_pos, status_text, '22 22 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL); diff --git a/data/qcsrc/common/constants.qh b/data/qcsrc/common/constants.qh index 44f19165..ea23f861 100644 --- a/data/qcsrc/common/constants.qh +++ b/data/qcsrc/common/constants.qh @@ -281,21 +281,21 @@ const float STAT_WEAPON_CLIPLOAD = 49; const float STAT_WEAPON_CLIPSIZE = 50; const float STAT_LAST_PICKUP = 51; const float STAT_VORE_LOAD = 52; -const float STAT_VORE_DIGESTING = 53; -const float STAT_VORE_EATEN = 54; -const float STAT_VORE_CANLEAVE = 55; -const float STAT_VORE_CANSWALLOW = 56; -const float STAT_SBRING1_TYPE = 57; -const float STAT_SBRING1_CLIP = 58; -const float STAT_SBRING2_TYPE = 59; -const float STAT_SBRING2_CLIP = 60; +const float STAT_VORE_MAXLOAD = 53; +const float STAT_VORE_DIGESTING = 54; +const float STAT_VORE_EATEN = 55; +const float STAT_VORE_CANLEAVE = 56; +const float STAT_VORE_CANSWALLOW = 57; +const float STAT_SBRING1_TYPE = 58; +const float STAT_SBRING1_CLIP = 59; +const float STAT_SBRING2_TYPE = 60; +const float STAT_SBRING2_CLIP = 61; +const float STAT_HUD = 62; +const float HUD_NORMAL = 0; const float CTF_STATE_ATTACK = 1; const float CTF_STATE_DEFEND = 2; const float CTF_STATE_COMMANDER = 3; -const float STAT_HUD = 61; -const float HUD_NORMAL = 0; - // moved that here so the client knows the max. // # of maps, I'll use arrays for them :P #define MAPVOTE_COUNT 10 diff --git a/data/qcsrc/server/cl_client.qc b/data/qcsrc/server/cl_client.qc index 2503070e..eaa93cf8 100644 --- a/data/qcsrc/server/cl_client.qc +++ b/data/qcsrc/server/cl_client.qc @@ -436,9 +436,9 @@ string setmodel_state() newmodel_extension = substring(self.playermodel, strlen(self.playermodel) - 4, 4); float vore_state; - if(self.stomach_load > ceil(g_balance_vore_swallow_limit * 0.6)) + if(self.stomach_load > self.stat_stomachmaxload * 0.6) vore_state = 3; - else if(self.stomach_load > ceil(g_balance_vore_swallow_limit * 0.3)) + else if(self.stomach_load > self.stat_stomachmaxload * 0.3) vore_state = 2; else if(self.stomach_load) vore_state = 1; @@ -1053,7 +1053,6 @@ float ClientInit_SendEntity(entity to, float sf) WriteByte(MSG_ENTITY, cvar("g_balance_weaponswitchdelay") * 255.0); WriteShort(MSG_ENTITY, cvar("g_vore")); - WriteShort(MSG_ENTITY, g_balance_vore_swallow_limit); WriteShort(MSG_ENTITY, cvar("g_healthsize")); WriteShort(MSG_ENTITY, cvar("g_healthsize_min")); WriteShort(MSG_ENTITY, cvar("g_healthsize_max")); @@ -2107,6 +2106,7 @@ void SpectateCopy(entity spectatee) { self.stomach_load = spectatee.stomach_load; self.stat_eaten = spectatee.stat_eaten; self.stat_stomachload = spectatee.stat_stomachload; + self.stat_stomachmaxload = spectatee.stat_stomachmaxload; self.stat_digesting = spectatee.stat_digesting; self.stat_canleave = spectatee.stat_canleave; self.stat_canswallow = spectatee.stat_canswallow; diff --git a/data/qcsrc/server/cl_player.qc b/data/qcsrc/server/cl_player.qc index 829a6501..abc50c15 100644 --- a/data/qcsrc/server/cl_player.qc +++ b/data/qcsrc/server/cl_player.qc @@ -1332,7 +1332,7 @@ void GlobalSound(string sample, float chan, float voicetype) break; case VOICETYPE_GURGLE: if(self.stomach_load) - sound(self, chan, sample, vol * self.stomach_load / g_balance_vore_swallow_limit, ATTN_NORM); + sound(self, chan, sample, bound(0, vol * (self.stomach_load / self.stat_stomachmaxload), 1), ATTN_NORM); else stopsound(self, chan); break; diff --git a/data/qcsrc/server/defs.qh b/data/qcsrc/server/defs.qh index 364e2fcc..70b421ef 100644 --- a/data/qcsrc/server/defs.qh +++ b/data/qcsrc/server/defs.qh @@ -21,7 +21,6 @@ float ctf_score_value(string parameter); float g_dm, g_domination, g_ctf, g_tdm, g_keyhunt, g_onslaught, g_assault, g_arena, g_ca, g_lms, g_race, g_cts, g_rpg; float g_cloaked, g_footsteps, g_jump_grunt, g_midair, g_norecoil, g_vampire, g_bloodloss; -float g_balance_vore_swallow_limit; float g_warmup_limit; float g_warmup_allguns; float g_warmup_allow_timeout; @@ -73,7 +72,7 @@ float maxclients; .float stomach_load; .float weapon_delay; .float fakeprey; -.float stat_eaten, stat_stomachload, stat_digesting, stat_canleave, stat_canswallow; +.float stat_eaten, stat_stomachload, stat_stomachmaxload, stat_digesting, stat_canleave, stat_canswallow; .float dropweapon_check; // Fields diff --git a/data/qcsrc/server/g_world.qc b/data/qcsrc/server/g_world.qc index ababcf93..d96b63e7 100644 --- a/data/qcsrc/server/g_world.qc +++ b/data/qcsrc/server/g_world.qc @@ -659,6 +659,7 @@ void spawnfunc_worldspawn (void) addstat(STAT_LAST_PICKUP, AS_FLOAT, last_pickup); addstat(STAT_WINNING, AS_FLOAT, winning); addstat(STAT_VORE_LOAD, AS_INT, stat_stomachload); + addstat(STAT_VORE_MAXLOAD, AS_INT, stat_stomachmaxload); addstat(STAT_VORE_CANSWALLOW, AS_INT, stat_canswallow); addstat(STAT_VORE_DIGESTING, AS_INT, stat_digesting); addstat(STAT_VORE_EATEN, AS_INT, stat_eaten); diff --git a/data/qcsrc/server/miscfunctions.qc b/data/qcsrc/server/miscfunctions.qc index 2f36d607..d8c72f49 100644 --- a/data/qcsrc/server/miscfunctions.qc +++ b/data/qcsrc/server/miscfunctions.qc @@ -1017,7 +1017,6 @@ void readlevelcvars(void) g_norecoil = cvar("g_norecoil"); g_vampire = cvar("g_vampire"); g_bloodloss = cvar("g_bloodloss"); - g_balance_vore_swallow_limit = bound(1, cvar("g_balance_vore_swallow_limit"), 9); // may only range between 1 and 9 sv_maxidle = cvar("sv_maxidle"); sv_maxidle_spectatorsareidle = cvar("sv_maxidle_spectatorsareidle"); sv_pogostick = cvar("sv_pogostick"); diff --git a/data/qcsrc/server/vore.qc b/data/qcsrc/server/vore.qc index 90b0bfae..98393a8f 100644 --- a/data/qcsrc/server/vore.qc +++ b/data/qcsrc/server/vore.qc @@ -47,8 +47,8 @@ float Swallow_condition_check(entity prey) swallow_complain = "You cannot swallow your team mates\n"; else if(!cvar("g_vore_spawnshield") && prey.spawnshieldtime > time) swallow_complain = "You cannot swallow someone protected by the spawn shield\n"; - else if(self.stomach_load >= g_balance_vore_swallow_limit) - swallow_complain = strcat("You cannot swallow more than ^2", ftos(g_balance_vore_swallow_limit), "^7 players at a time\n"); + else if(self.stomach_load >= self.stat_stomachmaxload) + swallow_complain = "You do not have any more room to swallow this player.\n"; else if(cvar("g_vore_biggergut") && prey.stomach_load > self.stomach_load) swallow_complain = "You cannot swallow someone with a bigger stomach than yours\n"; else if(cvar("g_vore_biggersize") && prey.scale > self.scale) @@ -707,12 +707,20 @@ void Vore() else if(self.predator.classname == "player") { self.stat_stomachload = self.predator.stomach_load; // necessary for the stomach board + self.stat_stomachmaxload = self.predator.stat_stomachmaxload; // necessary for the stomach board self.stat_digesting = self.predator.digesting; // necessary for the stomach board self.stat_eaten = num_for_edict(self.predator); } else { + float vore_capacity; + vore_capacity = cvar("g_balance_vore_load_capacity"); + if(cvar("g_healthsize")) + vore_capacity *= self.scale; + vore_capacity = ceil(vore_capacity); + self.stat_stomachload = self.stomach_load; + self.stat_stomachmaxload = vore_capacity; self.stat_digesting = self.digesting; self.stat_eaten = 0; } -- 2.39.2