Fix merge conflict.

This commit is contained in:
shavitush 2017-07-28 02:11:30 +03:00
commit 02471700b7
4 changed files with 129 additions and 13 deletions

View File

@ -27,6 +27,7 @@
"speed" "1.0" // Speed multiplier, 1.0 for default. Standard for slowmo styles is 0.5.
"halftime" "0" // Calculation of times will be halved, replays WILL NOT function properly.
"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.
// Mode settings

View File

@ -89,6 +89,7 @@ enum
fSpeedMultiplier,
bHalftime,
fVelocity,
fBonusVelocity,
fMinVelocity,
bBlockW,
bBlockA,

View File

@ -711,6 +711,11 @@ public void Player_Jump(Event event, const char[] name, bool dontBroadcast)
{
RequestFrame(ApplyNewVelocity, GetClientSerial(client));
}
if(view_as<float>(gA_StyleSettings[gBS_Style[client]][fBonusVelocity]) != 0.0)
{
RequestFrame(AddBonusVelocity, GetClientSerial(client));
}
if(view_as<float>(gA_StyleSettings[gBS_Style[client]][fMinVelocity]) != 0.0)
{
@ -732,6 +737,30 @@ void ApplyNewVelocity(int data)
}
}
void AddBonusVelocity(int data)
{
int client = GetClientFromSerial(data);
if(data != 0)
{
float fAbsVelocity[3];
GetEntPropVector(client, Prop_Data, "m_vecAbsVelocity", fAbsVelocity);
float currentspeed = (SquareRoot(Pow(fAbsVelocity[0], 2.0) + Pow(fAbsVelocity[1], 2.0)));
if(currentspeed > 0.0)
{
float fBonus = view_as<float>(gA_StyleSettings[gBS_Style[client]][fBonusVelocity]);
float x = currentspeed / (currentspeed + fBonus);
fAbsVelocity[0] /= x;
fAbsVelocity[1] /= x;
TeleportEntity(client, NULL_VECTOR, NULL_VECTOR, fAbsVelocity);
}
}
}
void MinimumVelocity(int data)
{
int client = GetClientFromSerial(data);
@ -1301,6 +1330,7 @@ bool LoadStyles()
gA_StyleSettings[i][fSpeedMultiplier] = dStyle.GetFloat("speed", 1.0);
gA_StyleSettings[i][bHalftime] = dStyle.GetBool("halftime", false);
gA_StyleSettings[i][fVelocity] = dStyle.GetFloat("velocity", 1.0);
gA_StyleSettings[i][fBonusVelocity] = dStyle.GetFloat("bonus_velocity", 0.0);
gA_StyleSettings[i][fMinVelocity] = dStyle.GetFloat("min_velocity", 0.0);
gA_StyleSettings[i][bBlockW] = dStyle.GetBool("block_w", false);
gA_StyleSettings[i][bBlockA] = dStyle.GetBool("block_a", false);

View File

@ -40,19 +40,10 @@ bool gB_Zones = false;
bool gB_BhopStats = false;
bool gB_Sounds = false;
// zone colors
char gS_StartColors[][] =
{
"ff0000", "ff4000", "ff7f00", "ffbf00", "ffff00", "00ff00", "00ff80", "00ffff", "0080ff", "0000ff"
};
char gS_EndColors[][] =
{
"ff0000", "ff4000", "ff7f00", "ffaa00", "ffd400", "ffff00", "bba24e", "77449c"
};
// cache
int gI_Cycle = 0;
int gI_GradientColors[3];
int gI_GradientDirection = -1;
Handle gH_HUDCookie = null;
int gI_HUDSettings[MAXPLAYERS+1];
@ -66,6 +57,12 @@ bool gB_Late = false;
// hud handle
Handle gH_HUD = null;
// plugin cvars
ConVar gCV_GradientStepSize = null;
// cached cvars
int gI_GradientStepSize = 5;
// timer settings
int gI_Styles = 0;
char gS_StyleStrings[STYLE_LIMIT][STYLESTRINGS_SIZE][128];
@ -119,6 +116,13 @@ public void OnPluginStart()
// HUD handle
gH_HUD = CreateHudSynchronizer();
// plugin convars
gCV_GradientStepSize = CreateConVar("shavit_hud_gradientstepsize", "15", "How fast should the start/end HUD gradient be?\nThe number is the amount of color change per 0.1 seconds.\nThe higher the number the faster the gradient.", 0, true, 1.0, true, 255.0);
gCV_GradientStepSize.AddChangeHook(OnConVarChanged);
AutoExecConfig();
// cron
CreateTimer(0.10, UpdateHUD_Timer, INVALID_HANDLE, TIMER_REPEAT);
@ -141,6 +145,11 @@ public void OnPluginStart()
}
}
public void OnConVarChanged(ConVar convar, const char[] oldValue, const char[] newValue)
{
gI_GradientStepSize = gCV_GradientStepSize.IntValue;
}
public void OnMapStart()
{
if(gB_Late)
@ -370,6 +379,81 @@ public Action UpdateHUD_Timer(Handle Timer)
gI_Cycle = 0;
}
switch(gI_GradientDirection)
{
case 0:
{
gI_GradientColors[2] += gI_GradientStepSize;
if(gI_GradientColors[2] >= 255)
{
gI_GradientColors[2] = 255;
gI_GradientDirection = 1;
}
}
case 1:
{
gI_GradientColors[0] -= gI_GradientStepSize;
if(gI_GradientColors[0] <= 0)
{
gI_GradientColors[0] = 0;
gI_GradientDirection = 2;
}
}
case 2:
{
gI_GradientColors[1] += gI_GradientStepSize;
if(gI_GradientColors[1] >= 255)
{
gI_GradientColors[1] = 255;
gI_GradientDirection = 3;
}
}
case 3:
{
gI_GradientColors[2] -= gI_GradientStepSize;
if(gI_GradientColors[2] <= 0)
{
gI_GradientColors[2] = 0;
gI_GradientDirection = 4;
}
}
case 4:
{
gI_GradientColors[0] += gI_GradientStepSize;
if(gI_GradientColors[0] >= 255)
{
gI_GradientColors[0] = 255;
gI_GradientDirection = 5;
}
}
case 5:
{
gI_GradientColors[1] -= gI_GradientStepSize;
if(gI_GradientColors[1] <= 0)
{
gI_GradientColors[1] = 0;
gI_GradientDirection = 0;
}
}
default:
{
gI_GradientColors[0] = 255;
gI_GradientDirection = 0;
}
}
for(int i = 1; i <= MaxClients; i++)
{
if(!IsValidClient(i) || (gI_HUDSettings[i] & HUD_MASTER) == 0)
@ -437,7 +521,7 @@ void UpdateHUD(int client)
{
if(gEV_Type == Engine_CSGO)
{
FormatEx(sHintText, 64, "<font size=\"45\" color=\"#%s\">%T</font>", gS_StartColors[gI_Cycle % sizeof(gS_StartColors)], "HudStartZone", client);
FormatEx(sHintText, 64, "<font size=\"45\" color=\"#%06X\">%T</font>", ((gI_GradientColors[0] << 16) + (gI_GradientColors[1] << 8) + (gI_GradientColors[2])), "HudStartZone", client);
}
else
@ -450,7 +534,7 @@ void UpdateHUD(int client)
{
if(gEV_Type == Engine_CSGO)
{
FormatEx(sHintText, 64, "<font size=\"45\" color=\"#%s\">%T</font>", gS_EndColors[gI_Cycle % sizeof(gS_EndColors)], "HudEndZone", client);
FormatEx(sHintText, 64, "<font size=\"45\" color=\"#%06X\">%T</font>", ((gI_GradientColors[0] << 16) + (gI_GradientColors[1] << 8) + (gI_GradientColors[2])), "HudEndZone", client);
}
else