From acfbc35412c33aa3dc4192ac68dbe6b16f639370 Mon Sep 17 00:00:00 2001 From: MirceaKitsune Date: Tue, 2 Aug 2011 16:50:16 +0300 Subject: [PATCH] Tweak healthsize cvar functionality, and allow specifying shrink / grow amount --- data/defaultVT.cfg | 7 ++++--- data/qcsrc/client/Main.qc | 2 +- data/qcsrc/client/main.qh | 2 +- data/qcsrc/client/sbar.qc | 2 +- data/qcsrc/client/shownames.qc | 4 ++-- data/qcsrc/server/cl_client.qc | 7 +++++-- 6 files changed, 14 insertions(+), 10 deletions(-) diff --git a/data/defaultVT.cfg b/data/defaultVT.cfg index 6e5b5e14..d59cd9fa 100644 --- a/data/defaultVT.cfg +++ b/data/defaultVT.cfg @@ -1605,15 +1605,16 @@ set g_vore_regurgitatecolor_particles 0.75 "players who are dirty from regurgita set g_vore_neighborprey_distance 8 "Distance by which prey inside the same stomach are positioned away from each other. 0 disables seeing neighboring prey" set g_vore_swallowmodel_range 100 "Distance by which the swallow model oscillates based on swallow progress" -set g_healthsize 100 "Players who are low on health shrink and become smaller, value specifies health at which the player has default size" +set g_healthsize 1 "Players shrink and grow based on health, by this amount" +set g_healthsize_center 100 "Health at which the player has the default size" +set g_healthsize_min 50 "Player size may not drop below this amount of health" +set g_healthsize_max 150 "Player size may not grow past this amount of health" set g_healthsize_movementfactor 0.5 "Amount by which player size affects jumping and running" set g_healthsize_soundfactor 0.5 "The sounds players make are amplified or reduced by this amount based on their size" set g_healthsize_exteriorweapon_scalefactor 1 "Amount by which player size resizes the exterior weapon model" set g_healthsize_weapon_scalefactor 1 "Amount by which player size resizes the view weapon model" set g_healthsize_weapon_scalefactor_pos 10 "Amount by which the view model is moved vertically based on player size" set g_healthsize_vore_shrinkdeadprey 0.25 "Dead prey will be shrunken by this amount, the closer it gets to the digestion limit" -set g_healthsize_min 50 "Player size may not drop below this amount of health" -set g_healthsize_max 150 "Player size may not grow past this amount of health" // part of an ugly hack for the menu audio sliders to work with the cutsound feature seta menu_volume 1 diff --git a/data/qcsrc/client/Main.qc b/data/qcsrc/client/Main.qc index 411b80d1..248074c2 100644 --- a/data/qcsrc/client/Main.qc +++ b/data/qcsrc/client/Main.qc @@ -1054,7 +1054,7 @@ void Ent_Init() g_weaponswitchdelay = ReadByte() / 255.0; g_vore = ReadShort(); - g_healthsize = ReadShort(); + g_healthsize_center = ReadShort(); g_healthsize_min = ReadShort(); g_healthsize_max = ReadShort(); diff --git a/data/qcsrc/client/main.qh b/data/qcsrc/client/main.qh index 245ed886..1d495abf 100644 --- a/data/qcsrc/client/main.qh +++ b/data/qcsrc/client/main.qh @@ -167,7 +167,7 @@ float armorblockpercent; float g_weaponswitchdelay; float g_vore; -float g_healthsize, g_healthsize_min, g_healthsize_max; +float g_healthsize_center, 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 edda2244..56395d20 100644 --- a/data/qcsrc/client/sbar.qc +++ b/data/qcsrc/client/sbar.qc @@ -3139,7 +3139,7 @@ void Sbar_Draw (void) status_pos = bottomleft - '-43 168 0'; status_size = 16; } - else if(g_healthsize) // no point in showing it otherwise + else if(g_healthsize_center >= 0) // no point in showing it otherwise { status_text = strcat(status_color, ftos(stomach_maxload)); status_pos = bottomleft - '-43 170 0'; diff --git a/data/qcsrc/client/shownames.qc b/data/qcsrc/client/shownames.qc index 3da7d347..23e5290b 100644 --- a/data/qcsrc/client/shownames.qc +++ b/data/qcsrc/client/shownames.qc @@ -23,8 +23,8 @@ void Draw_ShowNames(entity ent) ent.origin_z += cvar("hud_shownames_offset"); // offset the name by player scale, decided by health - if(g_healthsize) - ent.origin_z -= (g_healthsize - bound(g_healthsize_min, ent.healthvalue, g_healthsize_max)) * cvar("hud_shownames_offset_healthsize"); + if(g_healthsize_center >= 0) + ent.origin_z -= (g_healthsize_center - bound(g_healthsize_min, ent.healthvalue, g_healthsize_max)) * cvar("hud_shownames_offset_healthsize"); traceline(ent.origin, view_origin, TRUE, ent); diff --git a/data/qcsrc/server/cl_client.qc b/data/qcsrc/server/cl_client.qc index ea780e4a..f426043f 100644 --- a/data/qcsrc/server/cl_client.qc +++ b/data/qcsrc/server/cl_client.qc @@ -1052,7 +1052,10 @@ 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, cvar("g_healthsize")); + if(cvar("g_healthsize")) + WriteShort(MSG_ENTITY, cvar("g_healthsize_center")); + else + WriteShort(MSG_ENTITY, -1); // healthsize is disabled WriteShort(MSG_ENTITY, cvar("g_healthsize_min")); WriteShort(MSG_ENTITY, cvar("g_healthsize_max")); @@ -2319,7 +2322,7 @@ void SetPlayerSize() return; // change player scale based on the amount of health we have - self.scale = bound(cvar("g_healthsize_min"), self.health, cvar("g_healthsize_max")) / cvar("g_healthsize"); + self.scale = pow(bound(cvar("g_healthsize_min"), self.health, cvar("g_healthsize_max")) / cvar("g_healthsize_center"), cvar("g_healthsize")); // The following code sets the bounding box to match the player's size. // It is currently disabled because of issues with engine movement prediction (cl_movement). -- 2.39.2