mirror of
https://github.com/shavitush/bhoptimer.git
synced 2025-12-06 18:08:26 +00:00
Add jump multiplier and jump bonus to shavit-styles.cfg
This commit is contained in:
parent
94693fc6d8
commit
d590934324
@ -34,6 +34,8 @@
|
||||
"velocity" "1.0" // % of horizontal velocity to keep per jump. a value 0.9 will make the player lose 10% of their velocity per jump. Likewise, values above 1 will result in speed gains.
|
||||
"bonus_velocity" "0.0" // Bonus velocity to gain per jump. If set to e.g. 100.0, the player will gain 100 bonus velocity per jump.
|
||||
"min_velocity" "0.0" // Minimum amount of horizontal velocity to keep per jump. If set to 600.0, the player can't have less than 600 velocity per jump.
|
||||
"jump_multiplier" "0.0" // Mulitplier for the vertical velocity per jump. 0.0 for disabled.
|
||||
"jump_bonus" "0.0" // Bonus vertical velocity to gain per jump. If set to e.g. 100.0, the player will gain 100 bonus vertial velocity per jump.
|
||||
|
||||
// Mode settings
|
||||
"block_w" "0" // Block +forward (W).
|
||||
|
||||
@ -188,6 +188,8 @@ enum struct stylesettings_t
|
||||
int iEnabled;
|
||||
bool bKZCheckpoints;
|
||||
bool bForceKeysOnGround;
|
||||
float fJumpMultiplier;
|
||||
float fJumpBonus;
|
||||
}
|
||||
|
||||
enum struct chatstrings_t
|
||||
|
||||
@ -1231,34 +1231,46 @@ void VelocityChanges(int data)
|
||||
|
||||
float fSpeed = (SquareRoot(Pow(fAbsVelocity[0], 2.0) + Pow(fAbsVelocity[1], 2.0)));
|
||||
|
||||
if(fSpeed == 0.0)
|
||||
if(fSpeed != 0.0)
|
||||
{
|
||||
return;
|
||||
float fVelocityMultiplier = view_as<float>(gA_StyleSettings[gA_Timers[client].iStyle].fVelocity);
|
||||
float fVelocityBonus = view_as<float>(gA_StyleSettings[gA_Timers[client].iStyle].fBonusVelocity);
|
||||
float fMin = view_as<float>(gA_StyleSettings[gA_Timers[client].iStyle].fMinVelocity);
|
||||
|
||||
if(fVelocityMultiplier != 0.0)
|
||||
{
|
||||
fAbsVelocity[0] *= fVelocityMultiplier;
|
||||
fAbsVelocity[1] *= fVelocityMultiplier;
|
||||
}
|
||||
|
||||
if(fVelocityBonus != 0.0)
|
||||
{
|
||||
float x = fSpeed / (fSpeed + fVelocityBonus);
|
||||
fAbsVelocity[0] /= x;
|
||||
fAbsVelocity[1] /= x;
|
||||
}
|
||||
|
||||
if(fMin != 0.0 && fSpeed < fMin)
|
||||
{
|
||||
float x = (fSpeed / fMin);
|
||||
fAbsVelocity[0] /= x;
|
||||
fAbsVelocity[1] /= x;
|
||||
}
|
||||
}
|
||||
|
||||
float fVelocityMultiplier = view_as<float>(gA_StyleSettings[gA_Timers[client].iStyle].fVelocity);
|
||||
float fVelocityBonus = view_as<float>(gA_StyleSettings[gA_Timers[client].iStyle].fBonusVelocity);
|
||||
float fMin = view_as<float>(gA_StyleSettings[gA_Timers[client].iStyle].fMinVelocity);
|
||||
float fJumpMultiplier = gA_StyleSettings[gA_Timers[client].iStyle].fJumpMultiplier;
|
||||
float fJumpBonus = gA_StyleSettings[gA_Timers[client].iStyle].fJumpBonus;
|
||||
|
||||
if(fVelocityMultiplier != 0.0)
|
||||
if(fJumpMultiplier != 0.0)
|
||||
{
|
||||
fAbsVelocity[0] *= fVelocityMultiplier;
|
||||
fAbsVelocity[1] *= fVelocityMultiplier;
|
||||
fAbsVelocity[2] *= fJumpMultiplier;
|
||||
}
|
||||
|
||||
if(fVelocityBonus != 0.0)
|
||||
if(fJumpBonus != 0.0)
|
||||
{
|
||||
float x = fSpeed / (fSpeed + fVelocityBonus);
|
||||
fAbsVelocity[0] /= x;
|
||||
fAbsVelocity[1] /= x;
|
||||
fAbsVelocity[2] += fJumpBonus;
|
||||
}
|
||||
|
||||
if(fMin != 0.0 && fSpeed < fMin)
|
||||
{
|
||||
float x = (fSpeed / fMin);
|
||||
fAbsVelocity[0] /= x;
|
||||
fAbsVelocity[1] /= x;
|
||||
}
|
||||
|
||||
if(!gCV_VelocityTeleport.BoolValue)
|
||||
{
|
||||
@ -2105,6 +2117,8 @@ bool LoadStyles()
|
||||
gA_StyleSettings[i].fVelocity = kv.GetFloat("velocity", 1.0);
|
||||
gA_StyleSettings[i].fBonusVelocity = kv.GetFloat("bonus_velocity", 0.0);
|
||||
gA_StyleSettings[i].fMinVelocity = kv.GetFloat("min_velocity", 0.0);
|
||||
gA_StyleSettings[i].fJumpMultiplier = kv.GetFloat("jump_multiplier", 0.0);
|
||||
gA_StyleSettings[i].fJumpBonus = kv.GetFloat("jump_bonus", 0.0);
|
||||
gA_StyleSettings[i].bBlockW = view_as<bool>(kv.GetNum("block_w", 0));
|
||||
gA_StyleSettings[i].bBlockA = view_as<bool>(kv.GetNum("block_a", 0));
|
||||
gA_StyleSettings[i].bBlockS = view_as<bool>(kv.GetNum("block_s", 0));
|
||||
|
||||
Loading…
Reference in New Issue
Block a user