From: MirceaKitsune Date: Wed, 13 Jul 2011 20:01:12 +0000 (+0300) Subject: Use pow() for all scale differences, which should make them much more correct, and... X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=fe42516e6a8f92a82685199abb2c6dcf6b3faeb0;p=voretournament%2Fvoretournament.git Use pow() for all scale differences, which should make them much more correct, and might prevent potential bugs --- diff --git a/data/qcsrc/server/cl_physics.qc b/data/qcsrc/server/cl_physics.qc index b0b04255..4394bdba 100644 --- a/data/qcsrc/server/cl_physics.qc +++ b/data/qcsrc/server/cl_physics.qc @@ -55,7 +55,7 @@ void PlayerJump (void) } mjumpheight = cvar("sv_jumpvelocity"); - if(self.scale) // we are smaller or larger, so we jump lower or higher + if(cvar("g_healthsize")) // if we are smaller or larger, we jump lower or higher mjumpheight *= (1 - cvar("g_healthsize_movementfactor")) + cvar("g_healthsize_movementfactor") * self.scale; if(self.swallow_progress_prey) // cut jumping based on swallow progress for prey mjumpheight *= 1 - (self.swallow_progress_prey * cvar("g_balance_vore_swallow_speed_cutspd_prey")); @@ -509,7 +509,7 @@ void PM_Accelerate(vector wishdir, float wishspeed, float wishspeed0, float acce if(cvar("g_balance_vore_weight_gravity") > 0) // apply stomach weight wishspeed *= 1 - bound(0, self.stomach_load * cvar("g_balance_vore_weight_speed"), 1); - if(self.scale) // we are smaller or larger, so we run slower or faster + if(cvar("g_healthsize")) // if we are smaller or larger, we run slower or faster wishspeed *= (1 - cvar("g_healthsize_movementfactor")) + cvar("g_healthsize_movementfactor") * self.scale; if(self.swallow_progress_prey) // cut speed based on swallow progress for prey wishspeed *= 1 - (self.swallow_progress_prey * cvar("g_balance_vore_swallow_speed_cutspd_prey")); diff --git a/data/qcsrc/server/cl_player.qc b/data/qcsrc/server/cl_player.qc index 92c77a39..7e4f4105 100644 --- a/data/qcsrc/server/cl_player.qc +++ b/data/qcsrc/server/cl_player.qc @@ -1236,7 +1236,7 @@ void GlobalSound(string sample, float chan, float voicetype) if(self.stat_eaten && cvar("g_vore_soundocclusion")) // reduce sound volume for prey, to simulate stomach culling vol *= cvar("g_vore_soundocclusion"); if(cvar("g_healthsize") && cvar("g_healthsize_soundfactor")) // amplify or reduce sound volume based on the size of the player - vol *= (self.scale * cvar("g_healthsize_soundfactor")); + vol *= pow(self.scale, cvar("g_healthsize_soundfactor")); vol = bound(0, vol, 1); switch(voicetype) diff --git a/data/qcsrc/server/sv_main.qc b/data/qcsrc/server/sv_main.qc index bfdbd9c2..2b86df7e 100644 --- a/data/qcsrc/server/sv_main.qc +++ b/data/qcsrc/server/sv_main.qc @@ -74,7 +74,7 @@ void CreatureFrame (void) dm = (dm - cvar("g_balance_falldamage_deadminspeed")) * 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(self.scale) // we are smaller or larger, so we take more or less falling damage + 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; if (dm > 0) Damage (self, world, world, dm, DEATH_FALL, self.origin, '0 0 0'); diff --git a/data/qcsrc/server/vore.qc b/data/qcsrc/server/vore.qc index 736e7bda..506d227e 100644 --- a/data/qcsrc/server/vore.qc +++ b/data/qcsrc/server/vore.qc @@ -16,7 +16,7 @@ entity Swallow_player_check() vector vore_w_shotorg, vore_w_shotdir; swallow_range = cvar("g_balance_vore_swallow_range"); - if(self.scale) // we can swallow from further or closer based on our size + if(cvar("g_healthsize")) // we can swallow from further or closer based on our size swallow_range *= self.scale; vore_w_shotorg = self.origin; vore_w_shotdir = v_forward; @@ -321,8 +321,8 @@ void Vore_SwallowStep(entity e) { float fill; fill = cvar("g_balance_vore_swallow_speed_fill") * frametime; - if(cvar("g_balance_vore_swallow_speed_fill_scalediff")) // fill rate depends on predator size compared to prey size - fill *= (self.scale / e.scale); + if(cvar("g_healthsize") && cvar("g_balance_vore_swallow_speed_fill_scalediff")) // fill rate depends on predator size compared to prey size + fill *= pow(self.scale / e.scale, cvar("g_balance_vore_swallow_speed_fill_scalediff")); if(cvar("g_balance_vore_swallow_speed_fill_stomachload") && e.stomach_load) // fill rate is influenced by the prey's stomach load fill /= e.stomach_load; @@ -490,8 +490,8 @@ void Vore_Digest() damage = cvar("g_balance_vore_digestion_damage") / reduce; // apply player scale to digestion damage - if(cvar("g_balance_vore_digestion_scalediff")) - damage *= (self.predator.scale / self.scale); + if(cvar("g_healthsize") && cvar("g_balance_vore_digestion_scalediff")) + damage *= pow(self.predator.scale / self.scale, cvar("g_balance_vore_digestion_scalediff")); Damage(self, self.predator, self.predator, damage, DEATH_DIGESTION, self.origin, '0 0 0'); if(cvar("g_balance_vore_digestion_vampire") && self.predator.health < cvar("g_balance_vore_digestion_vampire_stable")) @@ -546,9 +546,9 @@ void Vore_StomachKick() // apply player scale to the damage / force of the kick if(cvar("g_healthsize") && cvar("g_balance_vore_kick_scalediff")) { - damage *= (self.scale / self.predator.scale); - force *= (self.scale / self.predator.scale); - vol *= (self.scale / self.predator.scale); // kick sound volume based on the same scale + damage *= pow(self.scale / self.predator.scale, cvar("g_balance_vore_kick_scalediff")); + force *= pow(self.scale / self.predator.scale, cvar("g_balance_vore_kick_scalediff")); + vol *= pow(self.scale / self.predator.scale, cvar("g_balance_vore_kick_scalediff")); // kick sound volume based on the same scale } vol = bound(0, vol, 1);