add prespeed_type, blockprejump, nozaxisspeed, and restrictnoclip as available style settings

This commit is contained in:
rtldg 2021-12-21 00:18:02 +00:00
parent 7ca35b908b
commit 396f2017c5
4 changed files with 60 additions and 12 deletions

View File

@ -25,6 +25,12 @@
"velocity_limit" "0.0" // Velocity limit: set to 0.0 for unlimited, 400.00 for 400vel styles etc.
"bunnyhopping" "1" // Per-style sv_enablebunnyhopping. Leave as 1 if you want bunnyhopping to maintain player speed. This setting will override _strafe map settings.
// Convar overrides
"prespeed_type" "-1" // Set the specific value of shavit_misc_prespeed to use for this style. -1 will use the current shavit_misc_prespeed value. Requires "prespeed" to be 0.
"blockprejump" "-1" // Set the specific value of shavit_core_blockprejump to use for this style. -1 will use the current shavit_core_blockprejump value.
"nozaxisspeed" "-1" // Set the specific value of shavit_core_nozaxisspeed to use for this style. -1 will use the current shavit_core_nozaxisspeed value.
"restrictnoclip" "-1" // Set the specific value of shavit_misc_restrictnoclip to use for this style. -1 will use the current shavit_misc_restrictnoclip value.
// Physics
"airaccelerate" "1000.0" // sv_airaccelerate value for the style.
"runspeed" "260.00" // Running speed. Requires DHooks, shavit-misc and shavit_misc_staticprestrafe set to 1.

View File

@ -149,8 +149,14 @@ public SMCResult OnStyleEnterSection(SMCParser smc, const char[] name, bool opt_
SetStyleSettingInt (gI_CurrentParserIndex, "easybhop", 1);
SetStyleSettingInt (gI_CurrentParserIndex, "prespeed", 0);
SetStyleSettingFloat(gI_CurrentParserIndex, "velocity_limit", 0.0);
SetStyleSettingFloat(gI_CurrentParserIndex, "airaccelerate", 1000.0);
SetStyleSettingInt (gI_CurrentParserIndex, "bunnyhopping", 1);
SetStyleSettingInt (gI_CurrentParserIndex, "prespeed_type", -1);
SetStyleSettingInt (gI_CurrentParserIndex, "blockprejump", -1);
SetStyleSettingInt (gI_CurrentParserIndex, "nozaxisspeed", -1);
SetStyleSettingInt (gI_CurrentParserIndex, "restrictnoclip", -1);
SetStyleSettingFloat(gI_CurrentParserIndex, "airaccelerate", 1000.0);
SetStyleSettingFloat(gI_CurrentParserIndex, "runspeed", 260.00);
SetStyleSettingFloat(gI_CurrentParserIndex, "gravity", 1.0);
SetStyleSettingFloat(gI_CurrentParserIndex, "speed", 1.0);
@ -242,7 +248,7 @@ public SMCResult OnStyleLeaveSection(SMCParser smc)
}
#endif
if (GetStyleSettingInt(gI_CurrentParserIndex, "prespeed") > 0)
if (GetStyleSettingInt(gI_CurrentParserIndex, "prespeed") > 0 || GetStyleSettingInt(gI_CurrentParserIndex, "prespeed_type") > 0)
{
bool value;

View File

@ -2066,7 +2066,14 @@ void StartTimer(int client, int track)
GetEntPropVector(client, Prop_Data, "m_vecVelocity", fSpeed);
float curVel = SquareRoot(Pow(fSpeed[0], 2.0) + Pow(fSpeed[1], 2.0));
if (!gCV_NoZAxisSpeed.BoolValue ||
int nozaxisspeed = GetStyleSettingInt(gA_Timers[client].bsStyle, "nozaxisspeed");
if (nozaxisspeed < 0)
{
nozaxisspeed = gCV_NoZAxisSpeed.BoolValue;
}
if (!nozaxisspeed ||
GetStyleSettingInt(gA_Timers[client].bsStyle, "prespeed") == 1 ||
(fSpeed[2] == 0.0 && (GetStyleSettingInt(gA_Timers[client].bsStyle, "prespeed") == 2 || curVel <= 290.0)))
{
@ -2488,7 +2495,14 @@ public void PostThinkPost(int client)
float fVel[3];
GetEntPropVector(client, Prop_Data, "m_vecVelocity", fVel);
if(!gCV_NoZAxisSpeed.BoolValue)
int nozaxisspeed = GetStyleSettingInt(gA_Timers[client].bsStyle, "nozaxisspeed");
if (nozaxisspeed < 0)
{
nozaxisspeed = gCV_NoZAxisSpeed.BoolValue;
}
if (!nozaxisspeed)
{
if(fVel[2] == 0.0)
{
@ -2957,7 +2971,14 @@ public Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float vel[3
}
}
if (bInStart && gCV_BlockPreJump.BoolValue && GetStyleSettingInt(gA_Timers[client].bsStyle, "prespeed") == 0 && (vel[2] > 0 || (buttons & IN_JUMP) > 0))
int blockprejump = GetStyleSettingInt(gA_Timers[client].bsStyle, "blockprejump");
if (blockprejump < 0)
{
blockprejump = gCV_BlockPreJump.BoolValue;
}
if (bInStart && blockprejump && GetStyleSettingInt(gA_Timers[client].bsStyle, "prespeed") == 0 && (vel[2] > 0 || (buttons & IN_JUMP) > 0))
{
vel[2] = 0.0;
buttons &= ~IN_JUMP;

View File

@ -1205,16 +1205,24 @@ public Action Shavit_OnUserCmdPre(int client, int &buttons, int &impulse, float
{
Shavit_StopTimer(client);
}
if(bInStart && gCV_RestrictNoclip.BoolValue)
if (bInStart)
{
if(gCV_RestrictNoclip.IntValue == 1)
int restrictnoclip = Shavit_GetStyleSettingInt(gI_Style[client], "restrictnoclip");
if (restrictnoclip == -1)
{
restrictnoclip = gCV_RestrictNoclip.IntValue;
}
if (restrictnoclip == 1)
{
float fSpeed[3];
GetEntPropVector(client, Prop_Data, "m_vecAbsVelocity", fSpeed);
fSpeed[2] = 0.0;
DumbSetVelocity(client, fSpeed);
}
else if(gCV_RestrictNoclip.IntValue == 2)
else if (restrictnoclip == 2)
{
SetEntityMoveType(client, MOVETYPE_ISOMETRIC);
}
@ -1226,12 +1234,19 @@ public Action Shavit_OnUserCmdPre(int client, int &buttons, int &impulse, float
// prespeed
if(!bNoclip && Shavit_GetStyleSettingInt(gI_Style[client], "prespeed") == 0 && bInStart)
{
int prespeed_type = Shavit_GetStyleSettingInt(gI_Style[client], "prespeed_type");
if (prespeed_type == -1)
{
prespeed_type = gCV_PreSpeed.IntValue;
}
int iPrevGroundEntity = (gI_GroundEntity[client] != -1) ? EntRefToEntIndex(gI_GroundEntity[client]) : -1;
if((gCV_PreSpeed.IntValue == 2 || gCV_PreSpeed.IntValue == 3) && iPrevGroundEntity == -1 && iGroundEntity != -1 && (buttons & IN_JUMP) > 0)
if ((prespeed_type == 2 || prespeed_type == 3) && iPrevGroundEntity == -1 && iGroundEntity != -1 && (buttons & IN_JUMP) > 0)
{
DumbSetVelocity(client, view_as<float>({0.0, 0.0, 0.0}));
}
else if(gCV_PreSpeed.IntValue == 1 || gCV_PreSpeed.IntValue >= 3)
else if (prespeed_type == 1 || prespeed_type >= 3)
{
float fSpeed[3];
GetEntPropVector(client, Prop_Data, "m_vecAbsVelocity", fSpeed);
@ -1240,7 +1255,7 @@ public Action Shavit_OnUserCmdPre(int client, int &buttons, int &impulse, float
// if trying to jump, add a very low limit to stop prespeeding in an elegant way
// otherwise, make sure nothing weird is happening (such as sliding at ridiculous speeds, at zone enter)
if(gCV_PreSpeed.IntValue < 4 && fSpeed[2] > 0.0)
if (prespeed_type < 4 && fSpeed[2] > 0.0)
{
fLimit /= 3.0;
}
@ -1250,7 +1265,7 @@ public Action Shavit_OnUserCmdPre(int client, int &buttons, int &impulse, float
if(fScale < 1.0)
{
if(gCV_PreSpeed.IntValue == 5)
if (prespeed_type == 5)
{
float zSpeed = fSpeed[2];
fSpeed[2] = 0.0;