mirror of
https://github.com/shavitush/bhoptimer.git
synced 2025-12-07 02:18:26 +00:00
add slow motion styles (#73)
This commit is contained in:
parent
6309158bab
commit
6b7b4e77c4
@ -29,7 +29,7 @@
|
||||
|
||||
#define PREFIX "\x04[Timer]\x01"
|
||||
|
||||
#define MAX_STYLES 7
|
||||
#define MAX_STYLES 8
|
||||
#define MAX_ZONES 8
|
||||
|
||||
// game types
|
||||
@ -82,7 +82,9 @@ enum ReplayStatus(+=1)
|
||||
#define STYLE_PRESPEED (1 << 10) // allow prespeeding regardless of the prespeed setting
|
||||
#define STYLE_HSW_ONLY (1 << 11) // force half-sideways
|
||||
#define STYLE_100AA (1 << 12) // force 100 airacclerate for the style
|
||||
#define STYLE_LOWGRAV (1 << 13) // 0.6x gravity
|
||||
#define STYLE_LOWGRAV (1 << 13) // 0.6x gravity (standard for low gravity styles)
|
||||
#define STYLE_SLOWMO (1 << 14) // 0.5x speed (standard for slowmo styles)
|
||||
#define STYLE_SLOWMOTIME (1 << 15) // calculation of times will be halved, replays WILL NOT function properly
|
||||
|
||||
int gI_StyleProperties[MAX_STYLES] =
|
||||
{
|
||||
@ -92,7 +94,8 @@ int gI_StyleProperties[MAX_STYLES] =
|
||||
STYLE_EASYBHOP, // Scroll
|
||||
STYLE_VEL_LIMIT, // 400 Velocity
|
||||
STYLE_AUTOBHOP|STYLE_EASYBHOP|STYLE_HSW_ONLY, // HSW
|
||||
STYLE_AUTOBHOP|STYLE_EASYBHOP|STYLE_LOWGRAV|STYLE_UNRANKED // Low gravity
|
||||
STYLE_AUTOBHOP|STYLE_EASYBHOP|STYLE_LOWGRAV|STYLE_UNRANKED, // Low gravity
|
||||
STYLE_AUTOBHOP|STYLE_EASYBHOP|STYLE_SLOWMO|STYLE_SLOWMOTIME|STYLE_UNRANKED // Slow motion
|
||||
};
|
||||
#endif
|
||||
|
||||
@ -108,7 +111,9 @@ float gF_VelocityLimit[MAX_STYLES] =
|
||||
VELOCITY_UNLIMITED, // W-Only
|
||||
VELOCITY_UNLIMITED, // Scroll
|
||||
400.00, // 400 Velocity
|
||||
VELOCITY_UNLIMITED // HSW
|
||||
VELOCITY_UNLIMITED, // HSW
|
||||
VELOCITY_UNLIMITED, // Low gravity
|
||||
VELOCITY_UNLIMITED, // Slow motion
|
||||
};
|
||||
#endif
|
||||
|
||||
@ -121,7 +126,9 @@ char gS_BhopStyles[MAX_STYLES][] =
|
||||
"W-Only",
|
||||
"Scroll",
|
||||
"400 Velocity",
|
||||
"Half-Sideways"
|
||||
"Half-Sideways",
|
||||
"Low Gravity",
|
||||
"Slow Motion"
|
||||
};
|
||||
#endif
|
||||
|
||||
@ -135,7 +142,8 @@ char gS_StyleHTMLColors[MAX_STYLES][] =
|
||||
"279BC2",
|
||||
"C9BB8B",
|
||||
"B54CBB",
|
||||
"DB88C2"
|
||||
"DB88C2",
|
||||
"C288DB"
|
||||
};
|
||||
#endif
|
||||
|
||||
@ -149,7 +157,8 @@ char gS_ShortBhopStyles[MAX_STYLES][] =
|
||||
"LEGIT",
|
||||
"400VEL",
|
||||
"HSW",
|
||||
"LG"
|
||||
"LG",
|
||||
"SLOW"
|
||||
};
|
||||
#endif
|
||||
|
||||
@ -163,7 +172,8 @@ float gI_RankingMultipliers[MAX_STYLES] =
|
||||
1.30, // Scroll
|
||||
1.50, // 400 Velocity
|
||||
1.20, // HSW
|
||||
0.00 // Low gravity
|
||||
0.00, // Low gravity
|
||||
0.00 // Slow motion
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
@ -547,6 +547,11 @@ public void Player_Jump(Event event, const char[] name, bool dontBroadcast)
|
||||
{
|
||||
SetEntityGravity(client, 0.6);
|
||||
}
|
||||
|
||||
if(gI_StyleProperties[gBS_Style[client]] & STYLE_SLOWMO)
|
||||
{
|
||||
SetEntPropFloat(client, Prop_Data, "m_flLaggedMovementValue", 0.5);
|
||||
}
|
||||
}
|
||||
|
||||
public void Player_Death(Event event, const char[] name, bool dontBroadcast)
|
||||
@ -731,7 +736,7 @@ public void StartTimer(int client)
|
||||
gB_ClientPaused[client] = false;
|
||||
|
||||
SetEntityGravity(client, (gI_StyleProperties[gBS_Style[client]] & STYLE_LOWGRAV)? 0.6:0.0);
|
||||
SetEntPropFloat(client, Prop_Data, "m_flLaggedMovementValue", 1.0);
|
||||
SetEntPropFloat(client, Prop_Data, "m_flLaggedMovementValue", (gI_StyleProperties[gBS_Style[client]] & STYLE_SLOWMO)? 0.5:1.0);
|
||||
}
|
||||
|
||||
public void StopTimer(int client)
|
||||
@ -783,15 +788,24 @@ public void ResumeTimer(int client)
|
||||
|
||||
public float CalculateTime(int client)
|
||||
{
|
||||
float time = 0.0;
|
||||
|
||||
if(!gB_ClientPaused[client])
|
||||
{
|
||||
return (GetEngineTime() - gF_StartTime[client] - gF_PauseTotalTime[client]);
|
||||
time = (GetEngineTime() - gF_StartTime[client] - gF_PauseTotalTime[client]);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
return (gF_PauseStartTime[client] - gF_StartTime[client] - gF_PauseTotalTime[client]);
|
||||
time = (gF_PauseStartTime[client] - gF_StartTime[client] - gF_PauseTotalTime[client]);
|
||||
}
|
||||
|
||||
if(gI_StyleProperties[gBS_Style[client]] & STYLE_SLOWMOTIME)
|
||||
{
|
||||
time /= 2.0;
|
||||
}
|
||||
|
||||
return time;
|
||||
}
|
||||
|
||||
public void OnClientDisconnect(int client)
|
||||
|
||||
@ -427,7 +427,7 @@ public void OnClientPutInServer(int client)
|
||||
{
|
||||
for(int i = 0; i < MAX_STYLES; i++)
|
||||
{
|
||||
if(gI_ReplayBotClient[i] == 0)
|
||||
if(ReplayEnabled(i) && gI_ReplayBotClient[i] == 0)
|
||||
{
|
||||
gI_ReplayBotClient[i] = client;
|
||||
|
||||
@ -697,18 +697,21 @@ public Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float vel[3
|
||||
}
|
||||
}
|
||||
|
||||
else if(gB_Record[client] && ReplayEnabled(Shavit_GetBhopStyle(client)) && Shavit_GetTimerStatus(client) == Timer_Running)
|
||||
else
|
||||
{
|
||||
gA_PlayerFrames[client].Resize(gI_PlayerFrames[client] + 1);
|
||||
if(gB_Record[client] && ReplayEnabled(Shavit_GetBhopStyle(client)) && Shavit_GetTimerStatus(client) == Timer_Running)
|
||||
{
|
||||
gA_PlayerFrames[client].Resize(gI_PlayerFrames[client] + 1);
|
||||
|
||||
gA_PlayerFrames[client].Set(gI_PlayerFrames[client], vecCurrentPosition[0], 0);
|
||||
gA_PlayerFrames[client].Set(gI_PlayerFrames[client], vecCurrentPosition[1], 1);
|
||||
gA_PlayerFrames[client].Set(gI_PlayerFrames[client], vecCurrentPosition[2], 2);
|
||||
gA_PlayerFrames[client].Set(gI_PlayerFrames[client], vecCurrentPosition[0], 0);
|
||||
gA_PlayerFrames[client].Set(gI_PlayerFrames[client], vecCurrentPosition[1], 1);
|
||||
gA_PlayerFrames[client].Set(gI_PlayerFrames[client], vecCurrentPosition[2], 2);
|
||||
|
||||
gA_PlayerFrames[client].Set(gI_PlayerFrames[client], angles[0], 3);
|
||||
gA_PlayerFrames[client].Set(gI_PlayerFrames[client], angles[1], 4);
|
||||
gA_PlayerFrames[client].Set(gI_PlayerFrames[client], angles[0], 3);
|
||||
gA_PlayerFrames[client].Set(gI_PlayerFrames[client], angles[1], 4);
|
||||
|
||||
gI_PlayerFrames[client]++;
|
||||
gI_PlayerFrames[client]++;
|
||||
}
|
||||
}
|
||||
|
||||
return Plugin_Continue;
|
||||
|
||||
@ -144,7 +144,7 @@ public void OnMapStart()
|
||||
delete fFile;
|
||||
}
|
||||
|
||||
public void Shavit_OnFinish(int client, BhopStyle style, float time, int jumps)
|
||||
public void Shavit_OnFinish_Post(int client, BhopStyle style, float time)
|
||||
{
|
||||
float fOldTime = 0.0;
|
||||
Shavit_GetPlayerPB(client, style, fOldTime);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user