From: MirceaKitsune Date: Mon, 19 Mar 2012 13:10:37 +0000 (+0200) Subject: Properly calculate falling damage based on player scale. Don't just offset the damage... X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=07eb71508b30944a3608716998047a97f67a94c1;p=voretournament%2Fvoretournament.git Properly calculate falling damage based on player scale. Don't just offset the damage, but also when it happens --- diff --git a/data/defaultVT.cfg b/data/defaultVT.cfg index 68d2bdb6..4f96470a 100644 --- a/data/defaultVT.cfg +++ b/data/defaultVT.cfg @@ -1679,6 +1679,7 @@ set g_healthsize_death 0.25 "Dead players are further shrunken by this amount" set g_healthsize_death_min -100 "Health at which dead players stop being shrunken" set g_healthsize_weight 0.75 "Size affects player gravity by this amount" set g_healthsize_movementfactor 0.5 "Amount by which player size affects jumping and running" +set g_healthsize_falldamagefactor 0.5 "Amount by which player size influences fall damage" set g_healthsize_viewfactor 2 "The view is offset by this amount based on player size" 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" diff --git a/data/qcsrc/server/sv_main.qc b/data/qcsrc/server/sv_main.qc index e49283c6..eb4bb6b4 100644 --- a/data/qcsrc/server/sv_main.qc +++ b/data/qcsrc/server/sv_main.qc @@ -69,13 +69,16 @@ void CreatureFrame (void) // check for falling damage if(!(g_cts && !cvar("g_cts_selfdamage"))) { + // if we are smaller or larger, take more or less falling damage + float scalefac; + scalefac = cvar("g_healthsize") ? pow(self.scale, cvar("g_healthsize_falldamagefactor")) : 1; + dm = vlen(self.oldvelocity) - vlen(self.velocity); // dm is now the velocity DECREASE. Velocity INCREASE should never cause a sound or any damage. if (self.deadflag) - dm = (dm - cvar("g_balance_falldamage_deadminspeed")) * cvar("g_balance_falldamage_factor"); + dm = (dm - cvar("g_balance_falldamage_deadminspeed") * scalefac) * cvar("g_balance_falldamage_factor"); else - dm = min((dm - cvar("g_balance_falldamage_minspeed")) * cvar("g_balance_falldamage_factor"), cvar("g_balance_falldamage_maxdamage")); - if(cvar("g_healthsize")) // if we are smaller or larger, we take more or less falling damage - dm *= (1 + cvar("g_healthsize_movementfactor")) - cvar("g_healthsize_movementfactor") * self.scale; + dm = min((dm - cvar("g_balance_falldamage_minspeed") * scalefac) * cvar("g_balance_falldamage_factor"), cvar("g_balance_falldamage_maxdamage")); + dm /= scalefac; if (dm > 0) Damage (self, world, world, dm, DEATH_FALL, self.origin, '0 0 0'); else if(vlen(self.velocity) > 100000 && cvar("developer")) diff --git a/docs/TODO.txt b/docs/TODO.txt index 8632a533..ceb8eae7 100644 --- a/docs/TODO.txt +++ b/docs/TODO.txt @@ -106,6 +106,8 @@ - 0.8: Does the wind trigger brush need to account scale based gravity? +- 0.8 BUG: Stomach load appeared 101 while my health was 100 + - 0.8: Make some g_healthsize cvars g_balance_healthsize, and move them to balanceVT.cfg - 0.8: Make player fatness depend on frags, using a trick I heard about with shaders