mirror of
https://github.com/shavitush/bhoptimer.git
synced 2025-12-07 10:28:26 +00:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
93ae4f4175
@ -23,6 +23,7 @@
|
||||
{
|
||||
"Start"
|
||||
{
|
||||
"visible" "1"
|
||||
"red" "67"
|
||||
"green" "210"
|
||||
"blue" "230"
|
||||
@ -31,23 +32,20 @@
|
||||
|
||||
"End"
|
||||
{
|
||||
"visible" "1"
|
||||
"red" "165"
|
||||
"green" "19"
|
||||
"blue" "194"
|
||||
}
|
||||
|
||||
"Glitch"
|
||||
{
|
||||
"visible" "0"
|
||||
"green" "200"
|
||||
"blue" "0"
|
||||
"width" "2.0"
|
||||
}
|
||||
|
||||
"Glitch_Respawn"
|
||||
{
|
||||
"visible" "0"
|
||||
"red" "255"
|
||||
"green" "200"
|
||||
"blue" "0"
|
||||
"width" "2.0"
|
||||
}
|
||||
|
||||
"Glitch_Stop"
|
||||
@ -55,6 +53,7 @@
|
||||
"visible" "0"
|
||||
"green" "200"
|
||||
"blue" "0"
|
||||
"width" "2.0"
|
||||
}
|
||||
|
||||
"Glitch_Slay"
|
||||
@ -62,28 +61,53 @@
|
||||
"visible" "0"
|
||||
"green" "200"
|
||||
"blue" "0"
|
||||
"width" "2.0"
|
||||
}
|
||||
|
||||
"Freestyle"
|
||||
{
|
||||
"visible" "1"
|
||||
"red" "25"
|
||||
"green" "25"
|
||||
"blue" "255"
|
||||
"alpha" "195"
|
||||
"width" "2.0"
|
||||
}
|
||||
|
||||
"Nolimit"
|
||||
{
|
||||
"visible" "1"
|
||||
"red" "247"
|
||||
"green" "3"
|
||||
"blue" "255"
|
||||
"alpha" "50"
|
||||
"width" "2.0"
|
||||
}
|
||||
|
||||
"Teleport"
|
||||
{
|
||||
"visible" "0"
|
||||
"red" "255"
|
||||
"green" "200"
|
||||
"blue" "0"
|
||||
"alpha" "255"
|
||||
"width" "4.0"
|
||||
}
|
||||
|
||||
// This is unused, ignore it.
|
||||
"SPAWN POINT"
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
"Easybhop"
|
||||
{
|
||||
"visible" "1"
|
||||
"red" "57"
|
||||
"green" "196"
|
||||
"blue" "92"
|
||||
"alpha" "175"
|
||||
"width" "5.5"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -205,6 +205,7 @@ enum(+=1)
|
||||
Zone_NoVelLimit,
|
||||
Zone_Teleport,
|
||||
Zone_CustomSpawn,
|
||||
Zone_Easybhop,
|
||||
ZONETYPES_SIZE
|
||||
};
|
||||
|
||||
@ -285,9 +286,11 @@ stock void FormatSeconds(float time, char[] newtime, int newtimesize, bool preci
|
||||
* @param angles The player's requested viewangles. They will not necessarily be applied as SRCDS itself won't accept every value.
|
||||
* @param status The player's timer status.
|
||||
* @param track The player's timer track.
|
||||
* @param style The player's bhop style.
|
||||
* @param stylesettings An array that contains the player's bhop style's settings.
|
||||
* @return Plugin_Continue to let shavit-core keep doing what it does, Plugin_Changed to pass different values.
|
||||
*/
|
||||
forward Action Shavit_OnUserCmdPre(int client, int &buttons, int &impulse, float vel[3], float angles[3], TimerStatus status, int track);
|
||||
forward Action Shavit_OnUserCmdPre(int client, int &buttons, int &impulse, float vel[3], float angles[3], TimerStatus status, int track, int style, any stylesttings[STYLESETTINGS_SIZE]);
|
||||
|
||||
/**
|
||||
* Called when a player's timer starts.
|
||||
|
||||
@ -193,7 +193,7 @@ public void OnPluginStart()
|
||||
gH_Forwards_OnStyleConfigLoaded = CreateGlobalForward("Shavit_OnStyleConfigLoaded", ET_Event, Param_Cell);
|
||||
gH_Forwards_OnDatabaseLoaded = CreateGlobalForward("Shavit_OnDatabaseLoaded", ET_Event, Param_Cell);
|
||||
gH_Forwards_OnChatConfigLoaded = CreateGlobalForward("Shavit_OnChatConfigLoaded", ET_Event);
|
||||
gH_Forwards_OnUserCmdPre = CreateGlobalForward("Shavit_OnUserCmdPre", ET_Event, Param_Cell, Param_CellByRef, Param_CellByRef, Param_Array, Param_Array, Param_Cell, Param_Cell);
|
||||
gH_Forwards_OnUserCmdPre = CreateGlobalForward("Shavit_OnUserCmdPre", ET_Event, Param_Cell, Param_CellByRef, Param_CellByRef, Param_Array, Param_Array, Param_Cell, Param_Cell, Param_Cell, Param_Array);
|
||||
|
||||
LoadTranslations("shavit-core.phrases");
|
||||
|
||||
@ -796,7 +796,7 @@ public void Player_Jump(Event event, const char[] name, bool dontBroadcast)
|
||||
gI_Jumps[client]++;
|
||||
}
|
||||
|
||||
if(gB_NoStaminaReset && gA_StyleSettings[gBS_Style[client]][bEasybhop])
|
||||
if((gB_NoStaminaReset && gA_StyleSettings[gBS_Style[client]][bEasybhop]) || Shavit_InsideZone(client, Zone_Easybhop, gI_Track[client]))
|
||||
{
|
||||
SetEntPropFloat(client, Prop_Send, "m_flStamina", 0.0);
|
||||
}
|
||||
@ -1747,6 +1747,8 @@ public Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float vel[3
|
||||
Call_PushArrayEx(angles, 3, SM_PARAM_COPYBACK);
|
||||
Call_PushCell(GetTimerStatus(client));
|
||||
Call_PushCell(gI_Track[client]);
|
||||
Call_PushCell(gBS_Style[client]);
|
||||
Call_PushArray(gA_StyleSettings[gBS_Style[client]], STYLESETTINGS_SIZE);
|
||||
Call_Finish(result);
|
||||
|
||||
if(result != Plugin_Continue && result != Plugin_Changed)
|
||||
|
||||
@ -62,6 +62,7 @@ ArrayList gA_Frames[STYLE_LIMIT][TRACKS_SIZE];
|
||||
float gF_StartTick[STYLE_LIMIT];
|
||||
ReplayStatus gRS_ReplayStatus[STYLE_LIMIT];
|
||||
int gI_FrameCount[STYLE_LIMIT][TRACKS_SIZE];
|
||||
bool gB_ForciblyStopped = false;
|
||||
|
||||
bool gB_Button[MAXPLAYERS+1];
|
||||
int gI_PlayerFrames[MAXPLAYERS+1];
|
||||
@ -393,6 +394,8 @@ public void OnMapStart()
|
||||
gA_CentralCache[iCentralReplayStatus] = Replay_Idle;
|
||||
gA_CentralCache[iCentralTrack] = Track_Main;
|
||||
|
||||
gB_ForciblyStopped = false;
|
||||
|
||||
GetCurrentMap(gS_Map, 256);
|
||||
GetMapDisplayName(gS_Map, gS_Map, 256);
|
||||
|
||||
@ -485,7 +488,7 @@ public void OnMapStart()
|
||||
{
|
||||
gI_ReplayTick[i] = 0;
|
||||
gRS_ReplayStatus[i] = Replay_Start;
|
||||
CreateTimer((gF_ReplayDelay / 2.0), StartReplay, i, TIMER_FLAG_NO_MAPCHANGE);
|
||||
CreateTimer((gF_ReplayDelay / 2.0), Timer_StartReplay, i, TIMER_FLAG_NO_MAPCHANGE);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1022,7 +1025,7 @@ public Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float vel[3
|
||||
gI_ReplayTick[style] = 0;
|
||||
gRS_ReplayStatus[style] = gA_CentralCache[iCentralReplayStatus] = Replay_End;
|
||||
|
||||
CreateTimer((gF_ReplayDelay / 2.0), EndReplay, style, TIMER_FLAG_NO_MAPCHANGE);
|
||||
CreateTimer((gF_ReplayDelay / 2.0), Timer_EndReplay, style, TIMER_FLAG_NO_MAPCHANGE);
|
||||
|
||||
SetEntityMoveType(client, MOVETYPE_NOCLIP);
|
||||
|
||||
@ -1084,15 +1087,16 @@ public Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float vel[3
|
||||
return Plugin_Continue;
|
||||
}
|
||||
|
||||
public Action EndReplay(Handle Timer, any data)
|
||||
public Action Timer_EndReplay(Handle Timer, any data)
|
||||
{
|
||||
gB_ForciblyStopped = false;
|
||||
gI_ReplayTick[data] = 0;
|
||||
|
||||
if(gI_ReplayBotClient[data] != gA_CentralCache[iCentralClient])
|
||||
{
|
||||
gRS_ReplayStatus[data] = Replay_Start;
|
||||
|
||||
CreateTimer((gF_ReplayDelay / 2.0), StartReplay, data, TIMER_FLAG_NO_MAPCHANGE);
|
||||
CreateTimer((gF_ReplayDelay / 2.0), Timer_StartReplay, data, TIMER_FLAG_NO_MAPCHANGE);
|
||||
}
|
||||
|
||||
else
|
||||
@ -1104,9 +1108,9 @@ public Action EndReplay(Handle Timer, any data)
|
||||
return Plugin_Stop;
|
||||
}
|
||||
|
||||
public Action StartReplay(Handle Timer, any data)
|
||||
public Action Timer_StartReplay(Handle Timer, any data)
|
||||
{
|
||||
if(gRS_ReplayStatus[data] == Replay_Running)
|
||||
if(gRS_ReplayStatus[data] == Replay_Running || (gB_CentralBot && gB_ForciblyStopped))
|
||||
{
|
||||
return Plugin_Stop;
|
||||
}
|
||||
@ -1577,13 +1581,14 @@ public int MenuHandler_ReplaySubmenu(Menu menu, MenuAction action, int param1, i
|
||||
gI_ReplayBotClient[style] = gA_CentralCache[iCentralClient];
|
||||
gRS_ReplayStatus[style] = gA_CentralCache[iCentralReplayStatus] = Replay_Start;
|
||||
TeleportToStart(gA_CentralCache[iCentralClient], style, gI_Track[param1]);
|
||||
gB_ForciblyStopped = false;
|
||||
|
||||
float time = 0.0;
|
||||
Shavit_GetWRTime(gA_CentralCache[iCentralStyle], time, gI_Track[param1]);
|
||||
|
||||
UpdateReplayInfo(gA_CentralCache[iCentralClient], style, time, gI_Track[param1]);
|
||||
|
||||
CreateTimer((gF_ReplayDelay / 2.0), StartReplay, style, TIMER_FLAG_NO_MAPCHANGE);
|
||||
CreateTimer((gF_ReplayDelay / 2.0), Timer_StartReplay, style, TIMER_FLAG_NO_MAPCHANGE);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1634,6 +1639,7 @@ void StopCentralReplay(int client)
|
||||
gF_StartTick[style] = -65535.0;
|
||||
TeleportToStart(gA_CentralCache[iCentralClient], style, GetReplayTrack(gA_CentralCache[iCentralClient]));
|
||||
gA_CentralCache[iCentralStyle] = 0;
|
||||
gB_ForciblyStopped = true;
|
||||
|
||||
UpdateReplayInfo(client, 0, 0.0, gA_CentralCache[iCentralTrack]);
|
||||
}
|
||||
|
||||
@ -48,7 +48,9 @@ char gS_ZoneNames[][] =
|
||||
"Slay Player", // slays (kills) players which come to this zone
|
||||
"Freestyle Zone", // ignores style physics when at this zone. e.g. WASD when SWing
|
||||
"No Speed Limit", // ignores velocity limit in that zone
|
||||
"Teleport Zone" // teleports to a defined point
|
||||
"Teleport Zone", // teleports to a defined point
|
||||
"SPAWN POINT", // << unused
|
||||
"Easybhop Zone" // forces easybhop whether if the player is in non-easy styles or if the server has different settings
|
||||
};
|
||||
|
||||
enum
|
||||
@ -104,6 +106,7 @@ float gV_MapZones_Visual[MAX_ZONES][8][3];
|
||||
float gV_Destinations[MAX_ZONES][3];
|
||||
float gV_ZoneCenter[MAX_ZONES][3];
|
||||
int gI_EntityZone[4096];
|
||||
bool gB_ZonesCreated = false;
|
||||
|
||||
// beamsprite, used to draw the zone
|
||||
char gS_Sprites[ZONESPRITES_SIZE][PLATFORM_MAX_PATH];
|
||||
@ -574,15 +577,31 @@ void ClearZone(int index)
|
||||
gA_ZoneCache[index][iDatabaseID] = -1;
|
||||
}
|
||||
|
||||
void UnhookEntity(int entity)
|
||||
{
|
||||
SDKUnhook(entity, SDKHook_StartTouchPost, StartTouchPost);
|
||||
SDKUnhook(entity, SDKHook_EndTouchPost, EndTouchPost);
|
||||
SDKUnhook(entity, SDKHook_TouchPost, TouchPost);
|
||||
}
|
||||
|
||||
void KillZoneEntity(int index)
|
||||
{
|
||||
if(IsValidEntity(gA_ZoneCache[index][iEntityID]))
|
||||
int entity = gA_ZoneCache[index][iEntityID];
|
||||
|
||||
if(entity > MaxClients && IsValidEntity(entity))
|
||||
{
|
||||
SDKUnhook(gA_ZoneCache[index][iEntityID], SDKHook_StartTouchPost, StartTouchPost);
|
||||
SDKUnhook(gA_ZoneCache[index][iEntityID], SDKHook_EndTouchPost, EndTouchPost);
|
||||
SDKUnhook(gA_ZoneCache[index][iEntityID], SDKHook_TouchPost, TouchPost);
|
||||
for(int i = 1; i <= MaxClients; i++)
|
||||
{
|
||||
for(int j = 0; j < TRACKS_SIZE; j++)
|
||||
{
|
||||
gB_InsideZone[i][gA_ZoneCache[index][iZoneType]][j] = false;
|
||||
}
|
||||
|
||||
AcceptEntityInput(gA_ZoneCache[index][iEntityID], "Kill");
|
||||
gB_InsideZoneID[i][index] = false;
|
||||
}
|
||||
|
||||
UnhookEntity(entity);
|
||||
AcceptEntityInput(entity, "Kill");
|
||||
}
|
||||
}
|
||||
|
||||
@ -602,27 +621,36 @@ void UnloadZones(int zone)
|
||||
{
|
||||
if(gA_ZoneCache[i][bZoneInitialized])
|
||||
{
|
||||
for(int j = 1; j <= MaxClients; j++)
|
||||
{
|
||||
if(IsValidClient(j))
|
||||
{
|
||||
gB_InsideZone[j][gA_ZoneCache[i][iZoneType]][gA_ZoneCache[i][iZoneTrack]] = false;
|
||||
gB_InsideZoneID[j][gI_EntityZone[i]] = false;
|
||||
}
|
||||
}
|
||||
|
||||
if(gA_ZoneCache[i][iEntityID] != -1)
|
||||
{
|
||||
KillZoneEntity(i);
|
||||
}
|
||||
KillZoneEntity(i);
|
||||
ClearZone(i);
|
||||
}
|
||||
|
||||
ClearZone(i);
|
||||
}
|
||||
}
|
||||
|
||||
ClearCustomSpawn();
|
||||
|
||||
if(zone == 0)
|
||||
{
|
||||
gB_ZonesCreated = false;
|
||||
|
||||
int iMaxEntities = GetMaxEntities();
|
||||
|
||||
char[] sClassname = new char[32];
|
||||
char[] sTargetname = new char[32];
|
||||
|
||||
for(int i = (MaxClients + 1); i < iMaxEntities; i++)
|
||||
{
|
||||
if(!IsValidEntity(i)
|
||||
|| !GetEntityClassname(i, sClassname, 32) || !StrEqual(sClassname, "trigger_multiple")
|
||||
|| GetEntPropString(i, Prop_Data, "m_iName", sTargetname, 32) == 0 || StrContains(sTargetname, "shavit_zones_") == -1)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
AcceptEntityInput(i, "Kill");
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -864,6 +892,11 @@ public Action Command_Zones(int client, int args)
|
||||
|
||||
for(int i = 0; i < sizeof(gS_ZoneNames); i++)
|
||||
{
|
||||
if(i == Zone_CustomSpawn)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
char[] sInfo = new char[8];
|
||||
IntToString(i, sInfo, 8);
|
||||
|
||||
@ -2155,10 +2188,12 @@ public void Player_Spawn(Event event, const char[] name, bool dontBroadcast)
|
||||
|
||||
public void Round_Start(Event event, const char[] name, bool dontBroadcast)
|
||||
{
|
||||
CreateTimer(1.0, Timer_CreateZoneEntities);
|
||||
gB_ZonesCreated = false;
|
||||
|
||||
RequestFrame(Frame_CreateZoneEntities);
|
||||
}
|
||||
|
||||
public Action Timer_CreateZoneEntities(Handle Timer)
|
||||
public void Frame_CreateZoneEntities(any data)
|
||||
{
|
||||
CreateZoneEntities();
|
||||
}
|
||||
@ -2175,6 +2210,11 @@ float Abs(float input)
|
||||
|
||||
public void CreateZoneEntities()
|
||||
{
|
||||
if(gB_ZonesCreated)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for(int i = 0; i < gI_MapZones; i++)
|
||||
{
|
||||
if(gA_ZoneCache[i][iEntityID] != -1)
|
||||
@ -2240,6 +2280,12 @@ public void CreateZoneEntities()
|
||||
|
||||
gI_EntityZone[entity] = i;
|
||||
gA_ZoneCache[i][iEntityID] = entity;
|
||||
|
||||
char[] sTargetname = new char[32];
|
||||
FormatEx(sTargetname, 32, "shavit_zones_%d_%d", gA_ZoneCache[i][iZoneTrack], gA_ZoneCache[i][iZoneType]);
|
||||
DispatchKeyValue(entity, "targetname", sTargetname);
|
||||
|
||||
gB_ZonesCreated = true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2302,19 +2348,23 @@ public void StartTouchPost(int entity, int other)
|
||||
|
||||
public void EndTouchPost(int entity, int other)
|
||||
{
|
||||
if(other < 1 || other > MaxClients || gI_EntityZone[entity] == -1 || IsFakeClient(other))
|
||||
if(other < 1 || other > MaxClients || gI_EntityZone[entity] == -1 || gI_EntityZone[entity] >= sizeof(gA_ZoneCache) || IsFakeClient(other))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
gB_InsideZone[other][gA_ZoneCache[gI_EntityZone[entity]][iZoneType]][gA_ZoneCache[gI_EntityZone[entity]][iZoneTrack]] = false;
|
||||
gB_InsideZoneID[other][gI_EntityZone[entity]] = false;
|
||||
int entityzone = gI_EntityZone[entity];
|
||||
int type = gA_ZoneCache[entityzone][iZoneType];
|
||||
int track = gA_ZoneCache[entityzone][iZoneTrack];
|
||||
|
||||
gB_InsideZone[other][type][track] = false;
|
||||
gB_InsideZoneID[other][entityzone] = false;
|
||||
|
||||
Call_StartForward(gH_Forwards_LeaveZone);
|
||||
Call_PushCell(other);
|
||||
Call_PushCell(gA_ZoneCache[gI_EntityZone[entity]][iZoneType]);
|
||||
Call_PushCell(gA_ZoneCache[gI_EntityZone[entity]][iZoneTrack]);
|
||||
Call_PushCell(gI_EntityZone[entity]);
|
||||
Call_PushCell(type);
|
||||
Call_PushCell(track);
|
||||
Call_PushCell(entityzone);
|
||||
Call_PushCell(entity);
|
||||
Call_Finish();
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user