Merge remote-tracking branch 'upstream/very_good_yes' into delete_replay

This commit is contained in:
deadw1nter 2021-02-24 10:44:29 +08:00
commit 32336e5ab6
13 changed files with 772 additions and 374 deletions

View File

@ -31,6 +31,7 @@
"gravity" "1.0" // Gravity setting, 1.0 for default. Standard for low gravity styles is 0.6.
"speed" "1.0" // Speed multiplier, 1.0 for default. Standard for slowmo styles is 0.5.
"timescale" "1.0" // Timing will scale with this setting.
"force_timescale" "0" // Force the timescale every jump? Default is 0 for normal timescales.
"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.

View File

@ -23,7 +23,7 @@
#endif
#define _shavit_included
#define SHAVIT_VERSION "2.6.0"
#define SHAVIT_VERSION "2.6.0.DEV"
#define STYLE_LIMIT 256
#define MAX_ZONES 64
#define MAX_NAME_LENGTH_SQL 32
@ -71,7 +71,8 @@ enum
CPR_ByConVar = (1 << 0),
CPR_NoTimer = (1 << 1),
CPR_InStartZone = (1 << 2),
CPR_NotOnGround = (1 << 3)
CPR_NotOnGround = (1 << 3),
CPR_Moving = (1 << 4)
};
enum
@ -113,6 +114,7 @@ enum
{
Track_Main,
Track_Bonus,
Track_Bonus_Last = 8,
TRACKS_SIZE
};
@ -150,6 +152,7 @@ enum struct stylestrings_t
char sStylePermission[64];
}
//TODO:REMOVE IN 3.0
enum struct stylesettings_t
{
bool bAutobhop;
@ -451,6 +454,16 @@ stock bool GuessBestMapName(ArrayList maps, const char[] input, char[] output, i
return false;
}
stock void GetTrackName(int client, int track, char[] output, int size)
{
if (track == Track_Main)
FormatEx(output, size, "%T", "Track_Main", client, track);
else if (track >= Track_Bonus)
FormatEx(output, size, "%T", "Track_Bonus", client, track);
else //if (track < Track_Main)
FormatEx(output, size, "%T", "Track_Unknown", client);
}
/**
* Called before shavit-core processes the client's usercmd.
* Before this is called, safety checks (fake/dead clients) happen.
@ -734,6 +747,17 @@ forward void Shavit_OnEnterZone(int client, int type, int track, int id, int ent
*/
forward void Shavit_OnLeaveZone(int client, int type, int track, int id, int entity, int data);
/**
* Called when a player leaves a zone.
*
* @param client Client index.
* @param stageNumber Stage number.
* @param message The stage time message that will be printed.
* @param maxlen The buffer size of message.
* @return Plugin_Handled to block the timer from printing msg to the client. Plugin_Continue to let the timer print msg.
*/
forward Action Shavit_OnStageMessage(int client, int stageNumber, char[] message, int maxlen);
/**
* Called when a player gets the worst record in the server for the style.
* Note: Will be only called for ranked styles.
@ -1510,6 +1534,67 @@ native void Shavit_OpenStatsMenu(int client, int steamid);
*/
native int Shavit_GetWRCount(int client);
/*
* Gets a value from the style config for the given style
* e.g. Shavit_GetStyleSetting(Shavit_GetBhopStyle(client), "TAS", sBuffer, 2);
*
* @param style Style index.
* @param key Style key to retreive.
* @param value Value buffer to store the return value in.
* @param maxlength Max length of the value buffer, cannot exceed 256.
*
* @return True if key was found, false otherwise.
*/
native bool Shavit_GetStyleSetting(int style, const char[] key, char[] value, int maxlength);
/*
* Gets an int value from the style config for the given style. Returns 0 if key is not found.
* e.g. Shavit_GetStyleSettingInt(Shavit_GetBhopStyle(client), "TAS");
*
* @param style Style index.
* @param key Style key to retreive.
*
* @return Integer value if found, 0 if key is missing.
*/
native int Shavit_GetStyleSettingInt(int style, const char[] key);
/*
* Gets the bool value from the style config for the given style. Returns false if key is not found.
* e.g. if(Shavit_GetStyleSettingBool(Shavit_GetBhopStyle(client), "TAS"))
*
* @param style Style index.
* @param key Style key to retreive.
*
* @return bool value if found, false if key is missing.
*/
native bool Shavit_GetStyleSettingBool(int style, const char[] key);
/*
* Gets a float value from the style config for the given style. Returns 0.0 if key is not found
* e.g. Shavit_GetStyleSettingFloat(Shavit_GetBhopStyle(client), "speed");
*
* @param style Style index.
* @param key Style key to retreive.
*
* @return Float value if found, 0.0 if key is missing.
*/
native float Shavit_GetStyleSettingFloat(int style, const char[] key);
/*
* Checks if the given key exists for that style
* e.g. Shavit_HasStyleSetting(Shavit_GetBhopStyle(client), "tas");
*
* @param style Style index.
* @param key Style key to retreive.
*
* @return True if found.
*/
native bool Shavit_HasStyleSetting(int style, const char[] key);
/**
* Saves the style settings on `any` references.
*
@ -1518,6 +1603,7 @@ native int Shavit_GetWRCount(int client);
* @param size Size of the StyleSettings buffer, e.g sizeof(stylesettings_t)
* @return SP_ERROR_NONE on success, anything else on failure.
*/
#pragma deprecated Use different natives or Shavit_GetStyleSetting instead.
native int Shavit_GetStyleSettings(int style, any[] StyleSettings, int size = sizeof(stylesettings_t));
/**
@ -1987,6 +2073,10 @@ public void __pl_shavit_SetNTVOptional()
MarkNativeAsOptional("Shavit_GetStageZone");
MarkNativeAsOptional("Shavit_GetStrafeCount");
MarkNativeAsOptional("Shavit_GetStyleCount");
MarkNativeAsOptional("Shavit_GetStyleSetting");
MarkNativeAsOptional("Shavit_GetStyleSettingInt");
MarkNativeAsOptional("Shavit_GetStyleSettingFloat");
MarkNativeAsOptional("Shavit_HasStyleSetting");
MarkNativeAsOptional("Shavit_GetStyleSettings");
MarkNativeAsOptional("Shavit_GetStyleStrings");
MarkNativeAsOptional("Shavit_GetSync");

View File

@ -157,8 +157,9 @@ ConVar sv_enablebunnyhopping = null;
bool gB_Registered = false;
int gI_Styles = 0;
int gI_OrderedStyles[STYLE_LIMIT];
stylestrings_t gS_StyleStrings[STYLE_LIMIT];
stylesettings_t gA_StyleSettings[STYLE_LIMIT];
StringMap gSM_StyleKeys[STYLE_LIMIT];
int gI_CurrentParserIndex = 0;
// chat settings
chatstrings_t gS_ChatStrings;
@ -207,6 +208,11 @@ public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max
CreateNative("Shavit_GetPerfectJumps", Native_GetPerfectJumps);
CreateNative("Shavit_GetStrafeCount", Native_GetStrafeCount);
CreateNative("Shavit_GetStyleCount", Native_GetStyleCount);
CreateNative("Shavit_GetStyleSetting", Native_GetStyleSetting);
CreateNative("Shavit_GetStyleSettingInt", Native_GetStyleSettingInt);
CreateNative("Shavit_GetStyleSettingBool", Native_GetStyleSettingBool);
CreateNative("Shavit_GetStyleSettingFloat", Native_GetStyleSettingFloat);
CreateNative("Shavit_HasStyleSetting", Native_HasStyleSetting);
CreateNative("Shavit_GetStyleSettings", Native_GetStyleSettings);
CreateNative("Shavit_GetStyleStrings", Native_GetStyleStrings);
CreateNative("Shavit_GetSync", Native_GetSync);
@ -563,9 +569,23 @@ public Action Command_StartTimer(int client, int args)
int track = Track_Main;
if(StrContains(sCommand, "sm_b", false) == 0)
{
if (args < 1)
{
track = Shavit_GetClientTrack(client);
}
else
{
char arg[6];
GetCmdArg(1, arg, sizeof(arg));
track = StringToInt(arg);
}
if (track < Track_Bonus || track > Track_Bonus_Last)
{
track = Track_Bonus;
}
}
if(gCV_AllowTimerWithoutZone.BoolValue || (gB_Zones && (Shavit_ZoneExists(Zone_Start, track) || gB_KZMap)))
{
@ -609,9 +629,23 @@ public Action Command_TeleportEnd(int client, int args)
int track = Track_Main;
if(StrContains(sCommand, "sm_b", false) == 0)
{
if (args < 1)
{
track = Shavit_GetClientTrack(client);
}
else
{
char arg[6];
GetCmdArg(1, arg, sizeof(arg));
track = StringToInt(arg);
}
if (track < Track_Bonus || track > Track_Bonus_Last)
{
track = Track_Bonus;
}
}
if(gB_Zones && (Shavit_ZoneExists(Zone_End, track) || gB_KZMap))
{
@ -675,13 +709,6 @@ public Action Command_TogglePause(int client, int args)
return Plugin_Handled;
}
if((iFlags & CPR_NotOnGround) > 0)
{
Shavit_PrintToChat(client, "%T", "PauseNotOnGround", client, gS_ChatStrings.sWarning, gS_ChatStrings.sText);
return Plugin_Handled;
}
if(gA_Timers[client].bPaused)
{
TeleportEntity(client, gF_PauseOrigin[client], gF_PauseAngles[client], gF_PauseVelocity[client]);
@ -692,6 +719,20 @@ public Action Command_TogglePause(int client, int args)
else
{
if((iFlags & CPR_NotOnGround) > 0)
{
Shavit_PrintToChat(client, "%T", "PauseNotOnGround", client, gS_ChatStrings.sWarning, gS_ChatStrings.sText);
return Plugin_Handled;
}
if((iFlags & CPR_Moving) > 0)
{
Shavit_PrintToChat(client, "%T", "PauseMoving", client, gS_ChatStrings.sWarning, gS_ChatStrings.sText);
return Plugin_Handled;
}
GetClientAbsOrigin(client, gF_PauseOrigin[client]);
GetClientEyeAngles(client, gF_PauseAngles[client]);
GetEntPropVector(client, Prop_Data, "m_vecAbsVelocity", gF_PauseVelocity[client]);
@ -1096,8 +1137,8 @@ public Action Command_Style(int client, int args)
// this logic will prevent the style from showing in !style menu if it's specifically inaccessible
// or just completely disabled
if((gA_StyleSettings[iStyle].bInaccessible && gA_StyleSettings[iStyle].iEnabled == 1) ||
gA_StyleSettings[iStyle].iEnabled == -1)
if((GetStyleSettingBool(iStyle, "inaccessible") && GetStyleSettingInt(iStyle, "enabled") == 1) ||
GetStyleSettingInt(iStyle, "enabled") == -1)
{
continue;
}
@ -1107,9 +1148,11 @@ public Action Command_Style(int client, int args)
char sDisplay[64];
if(gA_StyleSettings[iStyle].bUnranked)
if(GetStyleSettingBool(iStyle, "unranked"))
{
FormatEx(sDisplay, 64, "%T %s", "StyleUnranked", client, gS_StyleStrings[iStyle].sStyleName);
char sName[64];
gSM_StyleKeys[iStyle].GetString("name", sName, 64);
FormatEx(sDisplay, 64, "%T %s", "StyleUnranked", client, sName);
}
else
@ -1129,17 +1172,19 @@ public Action Command_Style(int client, int args)
char sWR[8];
strcopy(sWR, 8, "WR");
if(gA_Timers[client].iTrack == Track_Bonus)
if(gA_Timers[client].iTrack >= Track_Bonus)
{
strcopy(sWR, 8, "BWR");
}
FormatEx(sDisplay, 64, "%s - %s: %s", gS_StyleStrings[iStyle].sStyleName, sWR, sTime);
char sName[64];
gSM_StyleKeys[iStyle].GetString("name", sName, 64);
FormatEx(sDisplay, 64, "%s - %s: %s", sName, sWR, sTime);
}
else
{
strcopy(sDisplay, 64, gS_StyleStrings[iStyle].sStyleName);
gSM_StyleKeys[iStyle].GetString("name", sDisplay, 64);
}
}
@ -1251,16 +1296,19 @@ void ChangeClientStyle(int client, int style, bool manual)
return;
}
Shavit_PrintToChat(client, "%T", "StyleSelection", client, gS_ChatStrings.sStyle, gS_StyleStrings[style].sStyleName, gS_ChatStrings.sText);
char sName[64];
gSM_StyleKeys[style].GetString("name", sName, 64);
Shavit_PrintToChat(client, "%T", "StyleSelection", client, gS_ChatStrings.sStyle, sName, gS_ChatStrings.sText);
}
if(gA_StyleSettings[style].bUnranked)
if(GetStyleSettingBool(style, "unranked"))
{
Shavit_PrintToChat(client, "%T", "UnrankedWarning", client, gS_ChatStrings.sWarning, gS_ChatStrings.sText);
}
int aa_old = RoundToZero(gA_StyleSettings[gA_Timers[client].iStyle].fAiraccelerate);
int aa_new = RoundToZero(gA_StyleSettings[style].fAiraccelerate);
int aa_old = RoundToZero(GetStyleSettingFloat(gA_Timers[client].iStyle, "airaccelerate"));
int aa_new = RoundToZero(GetStyleSettingFloat(style, "airaccelerate"));
if(aa_old != aa_new)
{
@ -1311,7 +1359,7 @@ void DoJump(int client)
}
// TF2 doesn't use stamina
if(gEV_Type != Engine_TF2 && (gA_StyleSettings[gA_Timers[client].iStyle].bEasybhop) || Shavit_InsideZone(client, Zone_Easybhop, gA_Timers[client].iTrack))
if(gEV_Type != Engine_TF2 && (GetStyleSettingBool(gA_Timers[client].iStyle, "easybhop")) || Shavit_InsideZone(client, Zone_Easybhop, gA_Timers[client].iTrack))
{
SetEntPropFloat(client, Prop_Send, "m_flStamina", 0.0);
}
@ -1328,14 +1376,19 @@ void VelocityChanges(int data)
return;
}
int style = gA_Timers[client].iStyle;
if(GetStyleSettingBool(style, "force_timescale"))
{
if(gA_Timers[client].fTimescale != -1.0)
{
SetEntPropFloat(client, Prop_Data, "m_flLaggedMovementValue", view_as<float>(gA_Timers[client].fTimescale));
SetEntPropFloat(client, Prop_Data, "m_flLaggedMovementValue", gA_Timers[client].fTimescale);
}
else
else if(GetStyleSettingFloat(style, "speed") != 1.0)
{
SetEntPropFloat(client, Prop_Data, "m_flLaggedMovementValue", view_as<float>(gA_StyleSettings[gA_Timers[client].iStyle].fSpeedMultiplier));
SetEntPropFloat(client, Prop_Data, "m_flLaggedMovementValue", GetStyleSettingFloat(style, "speed"));
}
}
float fAbsVelocity[3];
@ -1345,9 +1398,9 @@ void VelocityChanges(int data)
if(fSpeed != 0.0)
{
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 fVelocityMultiplier = GetStyleSettingFloat(style, "velocity");
float fVelocityBonus = GetStyleSettingFloat(style, "bonus_velocity");
float fMin = GetStyleSettingFloat(style, "min_velocity");
if(fVelocityMultiplier != 0.0)
{
@ -1370,8 +1423,8 @@ void VelocityChanges(int data)
}
}
float fJumpMultiplier = gA_StyleSettings[gA_Timers[client].iStyle].fJumpMultiplier;
float fJumpBonus = gA_StyleSettings[gA_Timers[client].iStyle].fJumpBonus;
float fJumpMultiplier = GetStyleSettingFloat(style, "jump_multiplier");
float fJumpBonus = GetStyleSettingFloat(style, "jump_bonus");
if(fJumpMultiplier != 0.0)
{
@ -1464,7 +1517,7 @@ public int Native_HasStyleAccess(Handle handler, int numParams)
{
int style = GetNativeCell(2);
if(gA_StyleSettings[style].bInaccessible || gA_StyleSettings[style].iEnabled <= 0)
if(GetStyleSettingBool(style, "inaccessible") || GetStyleSettingInt(style, "enabled") <= 0)
{
return false;
}
@ -1536,6 +1589,13 @@ public int Native_CanPause(Handle handler, int numParams)
iFlags |= CPR_NotOnGround;
}
float vel[3];
GetEntPropVector(client, Prop_Data, "m_vecVelocity", vel);
if (vel[0] != 0.0 || vel[1] != 0.0 || vel[2] != 0.0)
{
iFlags |= CPR_Moving;
}
return iFlags;
}
@ -1637,7 +1697,8 @@ public int Native_FinishMap(Handle handler, int numParams)
Call_PushCell(gA_Timers[client].fTimer);
Call_PushCell(gA_Timers[client].iJumps);
Call_PushCell(gA_Timers[client].iStrafes);
Call_PushCell((gA_StyleSettings[gA_Timers[client].iStyle].bSync)? (gA_Timers[client].iGoodGains == 0)? 0.0:(gA_Timers[client].iGoodGains / float(gA_Timers[client].iTotalMeasures) * 100.0):-1.0);
//gross
Call_PushCell((GetStyleSettingBool(gA_Timers[client].iStyle, "sync"))? (gA_Timers[client].iGoodGains == 0)? 0.0:(gA_Timers[client].iGoodGains / float(gA_Timers[client].iTotalMeasures) * 100.0):-1.0);
Call_PushCell(track = gA_Timers[client].iTrack);
perfs = (gA_Timers[client].iMeasuredJumps == 0)? 100.0:(gA_Timers[client].iPerfectJumps / float(gA_Timers[client].iMeasuredJumps) * 100.0);
}
@ -1648,7 +1709,8 @@ public int Native_FinishMap(Handle handler, int numParams)
Call_PushCell(snapshot.fCurrentTime);
Call_PushCell(snapshot.iJumps);
Call_PushCell(snapshot.iStrafes);
Call_PushCell((gA_StyleSettings[snapshot.bsStyle].bSync)? (snapshot.iGoodGains == 0)? 0.0:(snapshot.iGoodGains / float(snapshot.iTotalMeasures) * 100.0):-1.0);
// gross
Call_PushCell((GetStyleSettingBool(snapshot.bsStyle, "sync"))? (snapshot.iGoodGains == 0)? 0.0:(snapshot.iGoodGains / float(snapshot.iTotalMeasures) * 100.0):-1.0);
Call_PushCell(track = snapshot.iTimerTrack);
perfs = (snapshot.iMeasuredJumps == 0)? 100.0:(snapshot.iPerfectJumps / float(snapshot.iMeasuredJumps) * 100.0);
}
@ -1807,7 +1869,7 @@ public int Native_GetSync(Handle handler, int numParams)
{
int client = GetNativeCell(1);
return view_as<int>((gA_StyleSettings[gA_Timers[client].iStyle].bSync)? (gA_Timers[client].iGoodGains == 0)? 0.0:(gA_Timers[client].iGoodGains / float(gA_Timers[client].iTotalMeasures) * 100.0):-1.0);
return view_as<int>((GetStyleSettingBool(gA_Timers[client].iStyle, "sync")? (gA_Timers[client].iGoodGains == 0)? 0.0:(gA_Timers[client].iGoodGains / float(gA_Timers[client].iTotalMeasures) * 100.0):-1.0));
}
public int Native_GetStyleCount(Handle handler, int numParams)
@ -1817,11 +1879,14 @@ public int Native_GetStyleCount(Handle handler, int numParams)
public int Native_GetStyleSettings(Handle handler, int numParams)
{
LogError("Shavit_GetStyleSettings is deprecated and will be removed in 3.0. Use Shavit_GetStyleSetting instead");
if(GetNativeCell(3) != sizeof(stylesettings_t))
{
return ThrowNativeError(200, "stylesettings_t does not match latest(got %i expected %i). Please update your includes and recompile your plugins",
GetNativeCell(3), sizeof(stylesettings_t));
}
return SetNativeArray(2, gA_StyleSettings[GetNativeCell(1)], sizeof(stylesettings_t));
}
@ -1830,16 +1895,52 @@ public int Native_GetStyleStrings(Handle handler, int numParams)
int style = GetNativeCell(1);
int type = GetNativeCell(2);
int size = GetNativeCell(4);
char sValue[128];
switch(type)
{
case sStyleName: return SetNativeString(3, gS_StyleStrings[style].sStyleName, size);
case sShortName: return SetNativeString(3, gS_StyleStrings[style].sShortName, size);
case sHTMLColor: return SetNativeString(3, gS_StyleStrings[style].sHTMLColor, size);
case sChangeCommand: return SetNativeString(3, gS_StyleStrings[style].sChangeCommand, size);
case sClanTag: return SetNativeString(3, gS_StyleStrings[style].sClanTag, size);
case sSpecialString: return SetNativeString(3, gS_StyleStrings[style].sSpecialString, size);
case sStylePermission: return SetNativeString(3, gS_StyleStrings[style].sStylePermission, size);
case sStyleName:
{
gSM_StyleKeys[style].GetString("name", sValue, size);
return SetNativeString(3, sValue, size);
}
case sShortName:
{
gSM_StyleKeys[style].GetString("shortname", sValue, size);
return SetNativeString(3, sValue, size);
}
case sHTMLColor:
{
gSM_StyleKeys[style].GetString("htmlcolor", sValue, size);
return SetNativeString(3, sValue, size);
}
case sChangeCommand:
{
gSM_StyleKeys[style].GetString("command", sValue, size);
return SetNativeString(3, sValue, size);
}
case sClanTag:
{
gSM_StyleKeys[style].GetString("clantag", sValue, size);
return SetNativeString(3, sValue, size);
}
case sSpecialString:
{
gSM_StyleKeys[style].GetString("specialstring", sValue, size);
return SetNativeString(3, sValue, size);
}
case sStylePermission:
{
gSM_StyleKeys[style].GetString("permission", sValue, size);
return SetNativeString(3, sValue, size);
}
}
return -1;
@ -2002,6 +2103,90 @@ public int Native_SetClientTimescale(Handle handler, int numParams)
}
}
public int Native_GetStyleSetting(Handle handler, int numParams)
{
int style = GetNativeCell(1);
char sKey[256];
GetNativeString(2, sKey, 256);
int maxlength = GetNativeCell(4);
char sValue[256];
bool ret = gSM_StyleKeys[style].GetString(sKey, sValue, maxlength);
SetNativeString(3, sValue, maxlength);
return ret;
}
public int Native_GetStyleSettingInt(Handle handler, int numParams)
{
int style = GetNativeCell(1);
char sKey[256];
GetNativeString(2, sKey, 256);
return GetStyleSettingInt(style, sKey);
}
int GetStyleSettingInt(int style, char[] key)
{
char sValue[16];
gSM_StyleKeys[style].GetString(key, sValue, 16);
return StringToInt(sValue);
}
public int Native_GetStyleSettingBool(Handle handler, int numParams)
{
int style = GetNativeCell(1);
char sKey[256];
GetNativeString(2, sKey, 256);
return GetStyleSettingBool(style, sKey);
}
bool GetStyleSettingBool(int style, char[] key)
{
return GetStyleSettingInt(style, key) != 0;
}
public any Native_GetStyleSettingFloat(Handle handler, int numParams)
{
int style = GetNativeCell(1);
char sKey[256];
GetNativeString(2, sKey, 256);
return GetStyleSettingFloat(style, sKey);
}
float GetStyleSettingFloat(int style, char[] key)
{
char sValue[16];
gSM_StyleKeys[style].GetString(key, sValue, 16);
return StringToFloat(sValue);
}
public any Native_HasStyleSetting(Handle handler, int numParams)
{
// TODO: replace with sm 1.11 StringMap.ContainsKey
int style = GetNativeCell(1);
char sKey[256];
GetNativeString(2, sKey, 256);
return HasStyleSetting(style, sKey);
}
bool HasStyleSetting(int style, char[] key)
{
char sValue[1];
gSM_StyleKeys[style].GetString(key, sValue, 1);
return gSM_StyleKeys[style].GetString(key, sValue, 1);
}
int GetTimerStatus(int client)
{
if(!gA_Timers[client].bEnabled)
@ -2028,8 +2213,8 @@ void StartTimer(int client, int track)
GetEntPropVector(client, Prop_Data, "m_vecVelocity", fSpeed);
if(!gCV_NoZAxisSpeed.BoolValue ||
gA_StyleSettings[gA_Timers[client].iStyle].iPrespeed == 1 ||
(fSpeed[2] == 0.0 && (gA_StyleSettings[gA_Timers[client].iStyle].iPrespeed == 2 || SquareRoot(Pow(fSpeed[0], 2.0) + Pow(fSpeed[1], 2.0)) <= 290.0)))
GetStyleSettingInt(gA_Timers[client].iStyle, "prespeed") == 1 ||
(fSpeed[2] == 0.0 && (GetStyleSettingInt(gA_Timers[client].iStyle, "prespeed") == 2 || SquareRoot(Pow(fSpeed[0], 2.0) + Pow(fSpeed[1], 2.0)) <= 290.0)))
{
Action result = Plugin_Continue;
Call_StartForward(gH_Forwards_Start);
@ -2076,10 +2261,10 @@ void StartTimer(int client, int track)
else
{
SetEntPropFloat(client, Prop_Data, "m_flLaggedMovementValue", view_as<float>(gA_StyleSettings[gA_Timers[client].iStyle].fSpeedMultiplier));
SetEntPropFloat(client, Prop_Data, "m_flLaggedMovementValue", GetStyleSettingFloat(gA_Timers[client].iStyle, "speed"));
}
SetEntityGravity(client, view_as<float>(gA_StyleSettings[gA_Timers[client].iStyle].fGravityMultiplier));
SetEntityGravity(client, GetStyleSettingFloat(gA_Timers[client].iStyle, "gravity"));
}
else if(result == Plugin_Handled || result == Plugin_Stop)
@ -2283,9 +2468,25 @@ public void SQL_InsertUser_Callback(Database db, DBResultSet results, const char
bool LoadStyles()
{
for(int i = 0; i < STYLE_LIMIT; i++)
{
delete gSM_StyleKeys[i];
}
char sPath[PLATFORM_MAX_PATH];
BuildPath(Path_SM, sPath, PLATFORM_MAX_PATH, "configs/shavit-styles.cfg");
SMCParser parser = new SMCParser();
parser.OnEnterSection = OnStyleEnterSection;
parser.OnLeaveSection = OnStyleLeaveSection;
parser.OnKeyValue = OnStyleKeyValue;
parser.ParseFile(sPath);
delete parser;
// TODO: REMOVE IN 3.0
// These are being left in as a backwards compatibility for the forwards using the style settings struct.
// Forwards seem to be fairly safe but will eventually be deprecated in favor of removing enum struct api usage.
KeyValues kv = new KeyValues("shavit-styles");
if(!kv.ImportFromFile(sPath) || !kv.GotoFirstSubKey())
@ -2299,14 +2500,6 @@ bool LoadStyles()
do
{
kv.GetString("name", gS_StyleStrings[i].sStyleName, sizeof(stylestrings_t::sStyleName), "<MISSING STYLE NAME>");
kv.GetString("shortname", gS_StyleStrings[i].sShortName, sizeof(stylestrings_t::sShortName), "<MISSING SHORT STYLE NAME>");
kv.GetString("htmlcolor", gS_StyleStrings[i].sHTMLColor, sizeof(stylestrings_t::sHTMLColor), "<MISSING STYLE HTML COLOR>");
kv.GetString("command", gS_StyleStrings[i].sChangeCommand, sizeof(stylestrings_t::sChangeCommand), "");
kv.GetString("clantag", gS_StyleStrings[i].sClanTag, sizeof(stylestrings_t::sClanTag), "<MISSING STYLE CLAN TAG>");
kv.GetString("specialstring", gS_StyleStrings[i].sSpecialString, sizeof(stylestrings_t::sSpecialString), "");
kv.GetString("permission", gS_StyleStrings[i].sStylePermission, sizeof(stylestrings_t::sStylePermission), "");
gA_StyleSettings[i].bAutobhop = view_as<bool>(kv.GetNum("autobhop", 1));
gA_StyleSettings[i].bEasybhop = view_as<bool>(kv.GetNum("easybhop", 1));
gA_StyleSettings[i].iPrespeed = view_as<bool>(kv.GetNum("prespeed", 0));
@ -2353,62 +2546,12 @@ bool LoadStyles()
gA_StyleSettings[i].fRankingMultiplier = 0.0;
gA_StyleSettings[i].bInaccessible = true;
}
if(!gB_Registered && strlen(gS_StyleStrings[i].sChangeCommand) > 0 && !gA_StyleSettings[i].bInaccessible)
{
char sStyleCommands[32][32];
int iCommands = ExplodeString(gS_StyleStrings[i].sChangeCommand, ";", sStyleCommands, 32, 32, false);
char sDescription[128];
FormatEx(sDescription, 128, "Change style to %s.", gS_StyleStrings[i].sStyleName);
for(int x = 0; x < iCommands; x++)
{
TrimString(sStyleCommands[x]);
StripQuotes(sStyleCommands[x]);
char sCommand[32];
FormatEx(sCommand, 32, "sm_%s", sStyleCommands[x]);
gSM_StyleCommands.SetValue(sCommand, i);
RegConsoleCmd(sCommand, Command_StyleChange, sDescription);
}
}
if(StrContains(gS_StyleStrings[i].sStylePermission, ";") != -1)
{
char sText[2][32];
int iCount = ExplodeString(gS_StyleStrings[i].sStylePermission, ";", sText, 2, 32);
AdminFlag flag = Admin_Reservation;
if(FindFlagByChar(sText[0][0], flag))
{
gI_StyleFlag[i] = FlagToBit(flag);
}
strcopy(gS_StyleOverride[i], 32, (iCount >= 2)? sText[1]:"");
}
else if(strlen(gS_StyleStrings[i].sStylePermission) > 0)
{
AdminFlag flag = Admin_Reservation;
if(FindFlagByChar(gS_StyleStrings[i].sStylePermission[0], flag))
{
gI_StyleFlag[i] = FlagToBit(flag);
}
}
gI_OrderedStyles[i] = i++;
}
while(kv.GotoNextKey());
delete kv;
gI_Styles = i;
gB_Registered = true;
SortCustom1D(gI_OrderedStyles, gI_Styles, SortAscending_StyleOrder);
@ -2420,10 +2563,175 @@ bool LoadStyles()
return true;
}
public SMCResult OnStyleEnterSection(SMCParser smc, const char[] name, bool opt_quotes)
{
// styles key
if(!IsCharNumeric(name[0]))
{
return SMCParse_Continue;
}
gI_CurrentParserIndex = StringToInt(name);
if(gI_Styles <= gI_CurrentParserIndex)
{
gI_Styles = gI_CurrentParserIndex + 1;
}
delete gSM_StyleKeys[gI_CurrentParserIndex];
gSM_StyleKeys[gI_CurrentParserIndex] = new StringMap();
gSM_StyleKeys[gI_CurrentParserIndex].SetString("name", "<MISSING STYLE NAME>");
gSM_StyleKeys[gI_CurrentParserIndex].SetString("shortname", "<MISSING SHORT STYLE NAME>");
gSM_StyleKeys[gI_CurrentParserIndex].SetString("htmlcolor", "<MISSING STYLE HTML COLOR>");
gSM_StyleKeys[gI_CurrentParserIndex].SetString("command", "");
gSM_StyleKeys[gI_CurrentParserIndex].SetString("clantag", "<MISSING STYLE CLAN TAG>");
gSM_StyleKeys[gI_CurrentParserIndex].SetString("specialstring", "");
gSM_StyleKeys[gI_CurrentParserIndex].SetString("permission", "");
gSM_StyleKeys[gI_CurrentParserIndex].SetString("autobhop", "1");
gSM_StyleKeys[gI_CurrentParserIndex].SetString("easybhop", "1");
gSM_StyleKeys[gI_CurrentParserIndex].SetString("prespeed", "0");
gSM_StyleKeys[gI_CurrentParserIndex].SetString("velocity_limit", "0.0");
gSM_StyleKeys[gI_CurrentParserIndex].SetString("airaccelerate", "1000.0");
gSM_StyleKeys[gI_CurrentParserIndex].SetString("bunnyhopping", "1");
gSM_StyleKeys[gI_CurrentParserIndex].SetString("runspeed", "260.00");
gSM_StyleKeys[gI_CurrentParserIndex].SetString("gravity", "1.0");
gSM_StyleKeys[gI_CurrentParserIndex].SetString("speed", "1.0");
gSM_StyleKeys[gI_CurrentParserIndex].SetString("halftime", "0");
gSM_StyleKeys[gI_CurrentParserIndex].SetString("timescale", "1.0");
gSM_StyleKeys[gI_CurrentParserIndex].SetString("velocity", "1.0");
gSM_StyleKeys[gI_CurrentParserIndex].SetString("bonus_velocity", "0.0");
gSM_StyleKeys[gI_CurrentParserIndex].SetString("min_velocity", "0.0");
gSM_StyleKeys[gI_CurrentParserIndex].SetString("jump_multiplier", "0.0");
gSM_StyleKeys[gI_CurrentParserIndex].SetString("jump_bonus", "0.0");
gSM_StyleKeys[gI_CurrentParserIndex].SetString("block_w", "0");
gSM_StyleKeys[gI_CurrentParserIndex].SetString("block_a", "0");
gSM_StyleKeys[gI_CurrentParserIndex].SetString("block_s", "0");
gSM_StyleKeys[gI_CurrentParserIndex].SetString("block_d", "0");
gSM_StyleKeys[gI_CurrentParserIndex].SetString("block_use", "0");
gSM_StyleKeys[gI_CurrentParserIndex].SetString("force_hsw", "0");
gSM_StyleKeys[gI_CurrentParserIndex].SetString("block_pleft", "0");
gSM_StyleKeys[gI_CurrentParserIndex].SetString("block_pright", "0");
gSM_StyleKeys[gI_CurrentParserIndex].SetString("block_pstrafe", "0");
gSM_StyleKeys[gI_CurrentParserIndex].SetString("unranked", "0");
gSM_StyleKeys[gI_CurrentParserIndex].SetString("noreplay", "0");
gSM_StyleKeys[gI_CurrentParserIndex].SetString("sync", "1");
gSM_StyleKeys[gI_CurrentParserIndex].SetString("strafe_count_w", "0");
gSM_StyleKeys[gI_CurrentParserIndex].SetString("strafe_count_a", "1");
gSM_StyleKeys[gI_CurrentParserIndex].SetString("strafe_count_s", "0");
gSM_StyleKeys[gI_CurrentParserIndex].SetString("strafe_count_d", "1");
gSM_StyleKeys[gI_CurrentParserIndex].SetString("rankingmultiplier", "1.00");
gSM_StyleKeys[gI_CurrentParserIndex].SetString("special", "0");
char sOrder[4];
IntToString(gI_CurrentParserIndex, sOrder, 4);
gSM_StyleKeys[gI_CurrentParserIndex].SetString("ordering", sOrder);
gSM_StyleKeys[gI_CurrentParserIndex].SetString("inaccessible", "0");
gSM_StyleKeys[gI_CurrentParserIndex].SetString("enabled", "1");
gSM_StyleKeys[gI_CurrentParserIndex].SetString("kzcheckpoints", "0");
gSM_StyleKeys[gI_CurrentParserIndex].SetString("force_groundkeys", "0");
gI_OrderedStyles[gI_CurrentParserIndex] = gI_CurrentParserIndex;
return SMCParse_Continue;
}
public SMCResult OnStyleLeaveSection(SMCParser smc)
{
// if this style is disabled, we will force certain settings
if(GetStyleSettingInt(gI_CurrentParserIndex, "enabled") <= 0)
{
gSM_StyleKeys[gI_CurrentParserIndex].SetString("noreplay", "1");
gSM_StyleKeys[gI_CurrentParserIndex].SetString("rankingmultiplier", "0");
gSM_StyleKeys[gI_CurrentParserIndex].SetString("inaccessible", "1");
}
if(GetStyleSettingBool(gI_CurrentParserIndex, "halftime"))
{
gSM_StyleKeys[gI_CurrentParserIndex].SetString("timescale", "0.5");
}
// Setting it here so that we can reference the timescale setting.
if(!HasStyleSetting(gI_CurrentParserIndex, "force_timescale"))
{
if(GetStyleSettingFloat(gI_CurrentParserIndex, "timescale") == 1.0)
{
gSM_StyleKeys[gI_CurrentParserIndex].SetString("force_timescale", "0");
}
else
{
gSM_StyleKeys[gI_CurrentParserIndex].SetString("force_timescale", "1");
}
}
char sStyleCommand[128];
gSM_StyleKeys[gI_CurrentParserIndex].GetString("command", sStyleCommand, 128);
char sName[64];
gSM_StyleKeys[gI_CurrentParserIndex].GetString("name", sName, 64);
if(!gB_Registered && strlen(sStyleCommand) > 0 && !gA_StyleSettings[gI_CurrentParserIndex].bInaccessible)
{
char sStyleCommands[32][32];
int iCommands = ExplodeString(sStyleCommand, ";", sStyleCommands, 32, 32, false);
char sDescription[128];
FormatEx(sDescription, 128, "Change style to %s.", sName);
for(int x = 0; x < iCommands; x++)
{
TrimString(sStyleCommands[x]);
StripQuotes(sStyleCommands[x]);
char sCommand[32];
FormatEx(sCommand, 32, "sm_%s", sStyleCommands[x]);
gSM_StyleCommands.SetValue(sCommand, gI_CurrentParserIndex);
RegConsoleCmd(sCommand, Command_StyleChange, sDescription);
}
}
char sPermission[64];
gSM_StyleKeys[gI_CurrentParserIndex].GetString("permission", sPermission, 64);
if(StrContains(sPermission, ";") != -1)
{
char sText[2][32];
int iCount = ExplodeString(sPermission, ";", sText, 2, 32);
AdminFlag flag = Admin_Reservation;
if(FindFlagByChar(sText[0][0], flag))
{
gI_StyleFlag[gI_CurrentParserIndex] = FlagToBit(flag);
}
strcopy(gS_StyleOverride[gI_CurrentParserIndex], 32, (iCount >= 2)? sText[1]:"");
}
else if(strlen(sPermission) > 0)
{
AdminFlag flag = Admin_Reservation;
if(FindFlagByChar(sPermission[0], flag))
{
gI_StyleFlag[gI_CurrentParserIndex] = FlagToBit(flag);
}
}
}
public SMCResult OnStyleKeyValue(SMCParser smc, const char[] key, const char[] value, bool key_quotes, bool value_quotes)
{
gSM_StyleKeys[gI_CurrentParserIndex].SetString(key, value);
}
public int SortAscending_StyleOrder(int index1, int index2, const int[] array, any hndl)
{
int iOrder1 = gA_StyleSettings[index1].iOrdering;
int iOrder2 = gA_StyleSettings[index2].iOrdering;
int iOrder1 = GetStyleSettingInt(index1, "ordering");
int iOrder2 = GetStyleSettingInt(index2, "ordering");
if(iOrder1 < iOrder2)
{
@ -2896,7 +3204,7 @@ public void Shavit_OnLeaveZone(int client, int type, int track, int id, int enti
{
if(type == Zone_Airaccelerate)
{
UpdateAiraccelerate(client, view_as<float>(gA_StyleSettings[gA_Timers[client].iStyle].fAiraccelerate));
UpdateAiraccelerate(client, GetStyleSettingFloat(gA_Timers[client].iStyle, "airaccelerate"));
}
}
@ -2906,7 +3214,7 @@ public void PreThinkPost(int client)
{
if(!gB_Zones || !Shavit_InsideZone(client, Zone_Airaccelerate, -1))
{
sv_airaccelerate.FloatValue = view_as<float>(gA_StyleSettings[gA_Timers[client].iStyle].fAiraccelerate);
sv_airaccelerate.FloatValue = GetStyleSettingFloat(gA_Timers[client].iStyle, "airaccelerate");
}
else
@ -2916,16 +3224,16 @@ public void PreThinkPost(int client)
if(sv_enablebunnyhopping != null)
{
sv_enablebunnyhopping.BoolValue = view_as<bool>(gA_StyleSettings[gA_Timers[client].iStyle].bEnableBunnyhopping);
sv_enablebunnyhopping.BoolValue = GetStyleSettingBool(gA_Timers[client].iStyle, "bunnyhopping");
}
MoveType mtMoveType = GetEntityMoveType(client);
if(view_as<float>(gA_StyleSettings[gA_Timers[client].iStyle].fGravityMultiplier) != 1.0 &&
if(GetStyleSettingFloat(gA_Timers[client].iStyle, "gravity") != 1.0 &&
(mtMoveType == MOVETYPE_WALK || mtMoveType == MOVETYPE_ISOMETRIC) &&
(gA_Timers[client].iMoveType == MOVETYPE_LADDER || GetEntityGravity(client) == 1.0))
{
SetEntityGravity(client, view_as<float>(gA_StyleSettings[gA_Timers[client].iStyle].fGravityMultiplier));
SetEntityGravity(client, GetStyleSettingFloat(gA_Timers[client].iStyle, "gravity"));
}
gA_Timers[client].iMoveType = mtMoveType;
@ -3000,7 +3308,7 @@ public MRESReturn DHook_ProcessMovementPost(Handle hParams)
else
{
time = frametime * view_as<float>(gA_StyleSettings[gA_Timers[client].iStyle].fTimescale);
time = frametime * GetStyleSettingFloat(gA_Timers[client].iStyle, "timescale");
}
gA_Timers[client].iZoneIncrement++;
@ -3024,7 +3332,9 @@ public MRESReturn DHook_ProcessMovementPost(Handle hParams)
Call_PushCell(client);
Call_PushArray(snapshot, sizeof(timer_snapshot_t));
Call_PushCellRef(time);
//TODO:REMOVE IN 3.0
Call_PushArray(gA_StyleSettings[gA_Timers[client].iStyle], sizeof(stylesettings_t));
// Call_PushArray(NULL_VECTOR, sizeof(NULL_VECTOR));
Call_Finish();
gA_Timers[client].fTimer += time;
@ -3032,6 +3342,8 @@ public MRESReturn DHook_ProcessMovementPost(Handle hParams)
Call_StartForward(gH_Forwards_OnTimerIncrementPost);
Call_PushCell(client);
Call_PushCell(time);
//TODO:REMOVE IN 3.0
// Call_PushArray(NULL_VECTOR, sizeof(NULL_VECTOR));
Call_PushArray(gA_StyleSettings[gA_Timers[client].iStyle], sizeof(stylesettings_t));
Call_Finish();
@ -3144,7 +3456,9 @@ public Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float vel[3
Call_PushCell(GetTimerStatus(client));
Call_PushCell(gA_Timers[client].iTrack);
Call_PushCell(gA_Timers[client].iStyle);
//TODO:REMOVE IN 3.0
Call_PushArray(gA_StyleSettings[gA_Timers[client].iStyle], sizeof(stylesettings_t));
// Call_PushArray(NULL_VECTOR, sizeof(NULL_VECTOR));
Call_PushArrayEx(mouse, 2, SM_PARAM_COPYBACK);
Call_Finish(result);
@ -3159,13 +3473,13 @@ public Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float vel[3
if(gA_Timers[client].bEnabled && !gA_Timers[client].bPaused)
{
// +left/right block
if(!gB_Zones || (!bInStart && ((gA_StyleSettings[gA_Timers[client].iStyle].iBlockPLeft > 0 &&
(buttons & IN_LEFT) > 0) || (gA_StyleSettings[gA_Timers[client].iStyle].iBlockPRight > 0 && (buttons & IN_RIGHT) > 0))))
if(!gB_Zones || (!bInStart && ((GetStyleSettingInt(gA_Timers[client].iStyle, "block_pleft") > 0 &&
(buttons & IN_LEFT) > 0) || (GetStyleSettingInt(gA_Timers[client].iStyle, "block_pright") > 0 && (buttons & IN_RIGHT) > 0))))
{
vel[0] = 0.0;
vel[1] = 0.0;
if(gA_StyleSettings[gA_Timers[client].iStyle].iBlockPRight >= 2)
if(GetStyleSettingInt(gA_Timers[client].iStyle, "block_pright") >= 2)
{
char sCheatDetected[64];
FormatEx(sCheatDetected, 64, "%T", "LeftRightCheat", client);
@ -3174,13 +3488,13 @@ public Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float vel[3
}
// +strafe block
if(gA_StyleSettings[gA_Timers[client].iStyle].iBlockPStrafe > 0 &&
if(GetStyleSettingInt(gA_Timers[client].iStyle, "block_pstrafe") > 0 &&
((vel[0] > 0.0 && (buttons & IN_FORWARD) == 0) || (vel[0] < 0.0 && (buttons & IN_BACK) == 0) ||
(vel[1] > 0.0 && (buttons & IN_MOVERIGHT) == 0) || (vel[1] < 0.0 && (buttons & IN_MOVELEFT) == 0)))
{
if(gA_Timers[client].fStrafeWarning < gA_Timers[client].fTimer)
{
if(gA_StyleSettings[gA_Timers[client].iStyle].iBlockPStrafe >= 2)
if(GetStyleSettingInt(gA_Timers[client].iStyle, "block_pstrafe") >= 2)
{
char sCheatDetected[64];
FormatEx(sCheatDetected, 64, "%T", "Inconsistencies", client);
@ -3209,26 +3523,26 @@ public Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float vel[3
int iPButtons = buttons;
if(gA_StyleSettings[gA_Timers[client].iStyle].bStrafeCountW && !gA_StyleSettings[gA_Timers[client].iStyle].bBlockW &&
if(GetStyleSettingBool(gA_Timers[client].iStyle, "strafe_count_w") && !GetStyleSettingBool(gA_Timers[client].iStyle, "block_w") &&
(gA_Timers[client].iLastButtons & IN_FORWARD) == 0 && (buttons & IN_FORWARD) > 0)
{
gA_Timers[client].iStrafes++;
}
if(gA_StyleSettings[gA_Timers[client].iStyle].bStrafeCountA && !gA_StyleSettings[gA_Timers[client].iStyle].bBlockA && (gA_Timers[client].iLastButtons & IN_MOVELEFT) == 0 &&
(buttons & IN_MOVELEFT) > 0 && (gA_StyleSettings[gA_Timers[client].iStyle].iForceHSW > 0 || ((buttons & IN_FORWARD) == 0 && (buttons & IN_BACK) == 0)))
if(GetStyleSettingBool(gA_Timers[client].iStyle, "strafe_count_a") && !GetStyleSettingBool(gA_Timers[client].iStyle, "block_a") && (gA_Timers[client].iLastButtons & IN_MOVELEFT) == 0 &&
(buttons & IN_MOVELEFT) > 0 && (GetStyleSettingInt(gA_Timers[client].iStyle, "force_hsw") > 0 || ((buttons & IN_FORWARD) == 0 && (buttons & IN_BACK) == 0)))
{
gA_Timers[client].iStrafes++;
}
if(gA_StyleSettings[gA_Timers[client].iStyle].bStrafeCountS && !gA_StyleSettings[gA_Timers[client].iStyle].bBlockS &&
if(GetStyleSettingBool(gA_Timers[client].iStyle, "strafe_count_s") && !GetStyleSettingBool(gA_Timers[client].iStyle, "block_s") &&
(gA_Timers[client].iLastButtons & IN_BACK) == 0 && (buttons & IN_BACK) > 0)
{
gA_Timers[client].iStrafes++;
}
if(gA_StyleSettings[gA_Timers[client].iStyle].bStrafeCountD && !gA_StyleSettings[gA_Timers[client].iStyle].bBlockD && (gA_Timers[client].iLastButtons & IN_MOVERIGHT) == 0 &&
(buttons & IN_MOVERIGHT) > 0 && (gA_StyleSettings[gA_Timers[client].iStyle].iForceHSW > 0 || ((buttons & IN_FORWARD) == 0 && (buttons & IN_BACK) == 0)))
if(GetStyleSettingBool(gA_Timers[client].iStyle, "strafe_count_d") && !GetStyleSettingBool(gA_Timers[client].iStyle, "block_d") && (gA_Timers[client].iLastButtons & IN_MOVERIGHT) == 0 &&
(buttons & IN_MOVERIGHT) > 0 && (GetStyleSettingInt(gA_Timers[client].iStyle, "force_hsw") > 0 || ((buttons & IN_FORWARD) == 0 && (buttons & IN_BACK) == 0)))
{
gA_Timers[client].iStrafes++;
}
@ -3249,32 +3563,32 @@ public Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float vel[3
if(!gA_Timers[client].bCanUseAllKeys && mtMoveType != MOVETYPE_NOCLIP && mtMoveType != MOVETYPE_LADDER && !Shavit_InsideZone(client, Zone_Freestyle, -1))
{
// block E
if(gA_StyleSettings[gA_Timers[client].iStyle].bBlockUse && (buttons & IN_USE) > 0)
if(GetStyleSettingBool(gA_Timers[client].iStyle, "block_use") && (buttons & IN_USE) > 0)
{
buttons &= ~IN_USE;
}
if(iGroundEntity == -1 || gA_StyleSettings[gA_Timers[client].iStyle].bForceKeysOnGround)
if(iGroundEntity == -1 || GetStyleSettingBool(gA_Timers[client].iStyle, "force_groundkeys"))
{
if(gA_StyleSettings[gA_Timers[client].iStyle].bBlockW && ((buttons & IN_FORWARD) > 0 || vel[0] > 0.0))
if(GetStyleSettingBool(gA_Timers[client].iStyle, "block_w") && ((buttons & IN_FORWARD) > 0 || vel[0] > 0.0))
{
vel[0] = 0.0;
buttons &= ~IN_FORWARD;
}
if(gA_StyleSettings[gA_Timers[client].iStyle].bBlockA && ((buttons & IN_MOVELEFT) > 0 || vel[1] < 0.0))
if(GetStyleSettingBool(gA_Timers[client].iStyle, "block_a") && ((buttons & IN_MOVELEFT) > 0 || vel[1] < 0.0))
{
vel[1] = 0.0;
buttons &= ~IN_MOVELEFT;
}
if(gA_StyleSettings[gA_Timers[client].iStyle].bBlockS && ((buttons & IN_BACK) > 0 || vel[0] < 0.0))
if(GetStyleSettingBool(gA_Timers[client].iStyle, "block_s") && ((buttons & IN_BACK) > 0 || vel[0] < 0.0))
{
vel[0] = 0.0;
buttons &= ~IN_BACK;
}
if(gA_StyleSettings[gA_Timers[client].iStyle].bBlockD && ((buttons & IN_MOVERIGHT) > 0 || vel[1] > 0.0))
if(GetStyleSettingBool(gA_Timers[client].iStyle, "block_d") && ((buttons & IN_MOVERIGHT) > 0 || vel[1] > 0.0))
{
vel[1] = 0.0;
buttons &= ~IN_MOVERIGHT;
@ -3284,9 +3598,9 @@ public Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float vel[3
// Theory about blocking non-HSW strafes while playing HSW:
// Block S and W without A or D.
// Block A and D without S or W.
if(gA_StyleSettings[gA_Timers[client].iStyle].iForceHSW > 0)
if(GetStyleSettingInt(gA_Timers[client].iStyle, "force_hsw") > 0)
{
bool bSHSW = (gA_StyleSettings[gA_Timers[client].iStyle].iForceHSW == 2) && !bInStart; // don't decide on the first valid input until out of start zone!
bool bSHSW = (GetStyleSettingInt(gA_Timers[client].iStyle, "force_hsw") == 2) && !bInStart; // don't decide on the first valid input until out of start zone!
int iCombination = -1;
bool bForward = ((buttons & IN_FORWARD) > 0 && vel[0] >= 100.0);
@ -3362,7 +3676,7 @@ public Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float vel[3
bool bInWater = (GetEntProp(client, Prop_Send, "m_nWaterLevel") >= 2);
// enable duck-jumping/bhop in tf2
if(gEV_Type == Engine_TF2 && gA_StyleSettings[gA_Timers[client].iStyle].bEnableBunnyhopping && (buttons & IN_JUMP) > 0 && iGroundEntity != -1)
if(gEV_Type == Engine_TF2 && GetStyleSettingBool(gA_Timers[client].iStyle, "bunnyhopping") && (buttons & IN_JUMP) > 0 && iGroundEntity != -1)
{
float fSpeed[3];
GetEntPropVector(client, Prop_Data, "m_vecAbsVelocity", fSpeed);
@ -3371,7 +3685,7 @@ public Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float vel[3
SetEntPropVector(client, Prop_Data, "m_vecAbsVelocity", fSpeed);
}
if(gA_StyleSettings[gA_Timers[client].iStyle].bAutobhop && gA_Timers[client].bAuto && (buttons & IN_JUMP) > 0 && mtMoveType == MOVETYPE_WALK && !bInWater)
if(GetStyleSettingBool(gA_Timers[client].iStyle, "autobhop") && gA_Timers[client].bAuto && (buttons & IN_JUMP) > 0 && mtMoveType == MOVETYPE_WALK && !bInWater)
{
int iOldButtons = GetEntProp(client, Prop_Data, "m_nOldButtons");
SetEntProp(client, Prop_Data, "m_nOldButtons", (iOldButtons & ~IN_JUMP));
@ -3400,16 +3714,16 @@ public Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float vel[3
}
}
if(bInStart && gCV_BlockPreJump.BoolValue && gA_StyleSettings[gA_Timers[client].iStyle].iPrespeed == 0 && (vel[2] > 0 || (buttons & IN_JUMP) > 0))
if(bInStart && gCV_BlockPreJump.BoolValue && GetStyleSettingInt(gA_Timers[client].iStyle, "prespeed") == 0 && (vel[2] > 0 || (buttons & IN_JUMP) > 0))
{
vel[2] = 0.0;
buttons &= ~IN_JUMP;
}
// velocity limit
if(iGroundEntity != -1 && view_as<float>(gA_StyleSettings[gA_Timers[client].iStyle].fVelocityLimit > 0.0))
if(iGroundEntity != -1 && GetStyleSettingFloat(gA_Timers[client].iStyle, "velocity_limit") > 0.0)
{
float fSpeedLimit = view_as<float>(gA_StyleSettings[gA_Timers[client].iStyle].fVelocityLimit);
float fSpeedLimit = GetStyleSettingFloat(gA_Timers[client].iStyle, "velocity_limit");
if(gB_Zones && Shavit_InsideZone(client, Zone_CustomSpeedLimit, -1))
{
@ -3532,29 +3846,15 @@ void UpdateStyleSettings(int client)
{
if(sv_autobunnyhopping != null)
{
sv_autobunnyhopping.ReplicateToClient(client, (gA_StyleSettings[gA_Timers[client].iStyle].bAutobhop && gA_Timers[client].bAuto)? "1":"0");
sv_autobunnyhopping.ReplicateToClient(client, (GetStyleSettingBool(gA_Timers[client].iStyle, "autobhop") && gA_Timers[client].bAuto)? "1":"0");
}
if(sv_enablebunnyhopping != null)
{
sv_enablebunnyhopping.ReplicateToClient(client, (gA_StyleSettings[gA_Timers[client].iStyle].bEnableBunnyhopping)? "1":"0");
sv_enablebunnyhopping.ReplicateToClient(client, (GetStyleSettingBool(gA_Timers[client].iStyle, "bunnyhopping"))? "1":"0");
}
UpdateAiraccelerate(client, view_as<float>(gA_StyleSettings[gA_Timers[client].iStyle].fAiraccelerate));
UpdateAiraccelerate(client, GetStyleSettingFloat(gA_Timers[client].iStyle, "airaccelerate"));
SetEntityGravity(client, view_as<float>(gA_StyleSettings[gA_Timers[client].iStyle].fGravityMultiplier));
}
void GetTrackName(int client, int track, char[] output, int size)
{
if(track < 0 || track >= TRACKS_SIZE)
{
FormatEx(output, size, "%T", "Track_Unknown", client);
return;
}
static char sTrack[16];
FormatEx(sTrack, 16, "Track_%d", track);
FormatEx(output, size, "%T", sTrack, client);
SetEntityGravity(client, GetStyleSettingFloat(gA_Timers[client].iStyle, "gravity"));
}

View File

@ -133,7 +133,6 @@ Convar gCV_EnableDynamicTimeDifference = null;
// timer settings
stylestrings_t gS_StyleStrings[STYLE_LIMIT];
stylesettings_t gA_StyleSettings[STYLE_LIMIT];
chatstrings_t gS_ChatStrings;
public Plugin myinfo =
@ -365,7 +364,6 @@ public void Shavit_OnStyleConfigLoaded(int styles)
for(int i = 0; i < styles; i++)
{
Shavit_GetStyleSettings(i, gA_StyleSettings[i]);
Shavit_GetStyleStrings(i, sStyleName, gS_StyleStrings[i].sStyleName, sizeof(stylestrings_t::sStyleName));
Shavit_GetStyleStrings(i, sHTMLColor, gS_StyleStrings[i].sHTMLColor, sizeof(stylestrings_t::sHTMLColor));
}
@ -1162,7 +1160,9 @@ int AddHUDToBuffer_Source2013(int client, huddata_t data, char[] buffer, int max
AddHUDLine(buffer, maxlen, sLine, iLines);
iLines++;
if(gA_StyleSettings[data.iStyle].fVelocityLimit > 0.0 && Shavit_InsideZone(data.iTarget, Zone_CustomSpeedLimit, -1))
char limit[16];
Shavit_GetStyleSetting(data.iStyle, "velocity_limit", limit, 16);
if(StringToFloat(limit) > 0.0 && Shavit_InsideZone(data.iTarget, Zone_CustomSpeedLimit, -1))
{
if(gI_ZoneSpeedLimit[data.iTarget] == 0)
{
@ -1312,9 +1312,20 @@ int AddHUDToBuffer_CSGO(int client, huddata_t data, char[] buffer, int maxlen)
{
int iColor = 0xFF0000; // red, worse than both pb and wr
if(data.iTimerStatus == Timer_Paused) iColor = 0xA9C5E8; // blue sky
else if(data.fTime < data.fWR || data.fWR == 0.0) iColor = GetGradient(0x00FF00, 0x96172C, RoundToZero((data.fTime / data.fWR) * 100));
else if(data.fPB != 0.0 && data.fTime < data.fPB) iColor = 0xFFA500; // orange
if(data.iTimerStatus == Timer_Paused)
{
iColor = 0xA9C5E8; // blue sky
}
else if(data.fTime < data.fWR || data.fWR == 0.0)
{
iColor = GetGradient(0x00FF00, 0x96172C, RoundToZero((data.fTime / data.fWR) * 100));
}
else if(data.fPB != 0.0 && data.fTime < data.fPB)
{
iColor = 0xFFA500; // orange
}
char sTime[32];
FormatSeconds(data.fTime, sTime, 32, false);
@ -1445,9 +1456,12 @@ void UpdateMainHUD(int client)
fReplayTime = Shavit_GetReplayTime(iReplayStyle, iReplayTrack);
fReplayLength = Shavit_GetReplayLength(iReplayStyle, iReplayTrack);
if(gA_StyleSettings[iReplayStyle].fSpeedMultiplier != 1.0)
char sSpeed[16];
Shavit_GetStyleSetting(iReplayStyle, "speed", sSpeed, 16);
float fSpeed2 = StringToFloat(sSpeed);
if(fSpeed2 != 1.0)
{
fSpeedHUD /= gA_StyleSettings[iReplayStyle].fSpeedMultiplier;
fSpeedHUD /= fSpeed2;
}
}
}
@ -1523,8 +1537,10 @@ void UpdateKeyOverlay(int client, Panel panel, bool &draw)
}
char sPanelLine[128];
char autobhop[4];
Shavit_GetStyleSetting(style, "autobhop", autobhop, 4);
if(gB_BhopStats && !gA_StyleSettings[style].bAutobhop)
if(gB_BhopStats && !StringToInt(autobhop))
{
FormatEx(sPanelLine, 64, " %d%s%d\n", gI_ScrollCount[target], (gI_ScrollCount[target] > 9)? " ":" ", gI_LastScrollCount[target]);
}
@ -1580,7 +1596,10 @@ void UpdateCenterKeys(int client)
style = 0;
}
if(gB_BhopStats && !gA_StyleSettings[style].bAutobhop)
char autobhop[4];
Shavit_GetStyleSetting(style, "autobhop", autobhop, 4);
if(gB_BhopStats && !StringToInt(autobhop))
{
Format(sCenterText, 64, "%s\n  %d %d", sCenterText, gI_ScrollCount[target], gI_LastScrollCount[target]);
}
@ -1771,11 +1790,17 @@ void UpdateKeyHint(int client)
{
int style = Shavit_GetBhopStyle(target);
if((gI_HUDSettings[client] & HUD_SYNC) > 0 && Shavit_GetTimerStatus(target) == Timer_Running && gA_StyleSettings[style].bSync && !IsFakeClient(target) && (!gB_Zones || !Shavit_InsideZone(target, Zone_Start, -1)))
char sync[4];
Shavit_GetStyleSetting(style, "sync", sync, 4);
char autobhop[4];
Shavit_GetStyleSetting(style, "autobhop", autobhop, 4);
if((gI_HUDSettings[client] & HUD_SYNC) > 0 && Shavit_GetTimerStatus(target) == Timer_Running && StringToInt(sync) && !IsFakeClient(target) && (!gB_Zones || !Shavit_InsideZone(target, Zone_Start, -1)))
{
Format(sMessage, 256, "%s%s%T: %.01f", sMessage, (strlen(sMessage) > 0)? "\n\n":"", "HudSync", client, Shavit_GetSync(target));
if(!gA_StyleSettings[style].bAutobhop && (gI_HUD2Settings[client] & HUD2_PERFS) == 0)
if(!StringToInt(autobhop) && (gI_HUD2Settings[client] & HUD2_PERFS) == 0)
{
Format(sMessage, 256, "%s\n%T: %.1f", sMessage, "HudPerfs", client, Shavit_GetPerfectJumps(target));
}
@ -1923,20 +1948,6 @@ public int Native_GetHUDSettings(Handle handler, int numParams)
return gI_HUDSettings[client];
}
void GetTrackName(int client, int track, char[] output, int size)
{
if(track < 0 || track >= TRACKS_SIZE)
{
FormatEx(output, size, "%T", "Track_Unknown", client);
return;
}
static char sTrack[16];
FormatEx(sTrack, 16, "Track_%d", track);
FormatEx(output, size, "%T", sTrack, client);
}
void PrintCSGOHUDText(int client, const char[] format, any ...)
{
char buff[MAX_HINT_SIZE];
@ -1980,3 +1991,4 @@ void TrimPlayerName(const char[] name, char[] outname, int len)
if(count > gCV_SpecNameSymbolLength.IntValue)
Format(outname, len, "%s...", outname);
}

View File

@ -175,7 +175,6 @@ bool gB_Zones = false;
// timer settings
stylestrings_t gS_StyleStrings[STYLE_LIMIT];
stylesettings_t gA_StyleSettings[STYLE_LIMIT];
// chat settings
chatstrings_t gS_ChatStrings;
@ -447,7 +446,6 @@ public void Shavit_OnStyleConfigLoaded(int styles)
for(int i = 0; i < styles; i++)
{
Shavit_GetStyleSettings(i, gA_StyleSettings[i]);
Shavit_GetStyleStrings(i, sStyleName, gS_StyleStrings[i].sStyleName, sizeof(stylestrings_t::sStyleName));
Shavit_GetStyleStrings(i, sClanTag, gS_StyleStrings[i].sClanTag, sizeof(stylestrings_t::sClanTag));
Shavit_GetStyleStrings(i, sSpecialString, gS_StyleStrings[i].sSpecialString, sizeof(stylestrings_t::sSpecialString));
@ -780,7 +778,7 @@ public MRESReturn CCSPlayer__GetPlayerMaxSpeed(int pThis, Handle hReturn)
return MRES_Ignored;
}
DHookSetReturn(hReturn, view_as<float>(gA_StyleSettings[gI_Style[pThis]].fRunspeed));
DHookSetReturn(hReturn, Shavit_GetStyleSettingFloat(gI_Style[pThis], "runspeed"));
return MRES_Override;
}
@ -826,7 +824,7 @@ public Action Timer_PersistKZCP(Handle Timer)
for(int i = 1; i <= MaxClients; i++)
{
if(!gB_ClosedKZCP[i] &&
gA_StyleSettings[gI_Style[i]].bKZCheckpoints
Shavit_GetStyleSettingInt(gI_Style[i], "kzcheckpoints")
&& GetClientMenu(i) == MenuSource_None &&
IsClientInGame(i) && IsPlayerAlive(i))
{
@ -986,11 +984,15 @@ void UpdateClanTag(int client)
}
int track = Shavit_GetClientTrack(client);
char sTrack[3];
char sTrack[4];
if(track != Track_Main)
{
GetTrackName(client, track, sTrack, 3);
sTrack[0] = 'B';
if (track > Track_Bonus)
{
FormatEx(sTrack, sizeof(sTrack), "B%d", track);
}
}
char sRank[8];
@ -1070,7 +1072,7 @@ public Action Shavit_OnUserCmdPre(int client, int &buttons, int &impulse, float
int iGroundEntity = GetEntPropEnt(client, Prop_Send, "m_hGroundEntity");
// prespeed
if(!bNoclip && gA_StyleSettings[gI_Style[client]].iPrespeed == 0 && bInStart)
if(!bNoclip && Shavit_GetStyleSettingInt(gI_Style[client], "prespeed") == 0 && bInStart)
{
if((gCV_PreSpeed.IntValue == 2 || gCV_PreSpeed.IntValue == 3) && gI_GroundEntity[client] == -1 && iGroundEntity != -1 && (buttons & IN_JUMP) > 0)
{
@ -1087,7 +1089,7 @@ public Action Shavit_OnUserCmdPre(int client, int &buttons, int &impulse, float
float fSpeed[3];
GetEntPropVector(client, Prop_Data, "m_vecAbsVelocity", fSpeed);
float fLimit = (gA_StyleSettings[gI_Style[client]].fRunspeed + gCV_PrestrafeLimit.FloatValue);
float fLimit = (Shavit_GetStyleSettingFloat(gI_Style[client], "runspeed") + gCV_PrestrafeLimit.FloatValue);
// 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)
@ -1438,7 +1440,7 @@ public void OnPreThink(int client)
if(IsPlayerAlive(client))
{
// not the best method, but only one i found for tf2
SetEntPropFloat(client, Prop_Send, "m_flMaxspeed", gA_StyleSettings[gI_Style[client]].fRunspeed);
SetEntPropFloat(client, Prop_Send, "m_flMaxspeed", Shavit_GetStyleSettingFloat(gI_Style[client], "runspeed"));
}
}
@ -1630,13 +1632,6 @@ bool Teleport(int client, int targetserial)
int iTarget = GetClientFromSerial(targetserial);
if(Shavit_InsideZone(client, Zone_Start, -1) || Shavit_InsideZone(client, Zone_End, -1))
{
Shavit_PrintToChat(client, "%T", "TeleportInZone", client, gS_ChatStrings.sWarning, gS_ChatStrings.sText, gS_ChatStrings.sVariable, gS_ChatStrings.sText);
return false;
}
if(iTarget == 0)
{
Shavit_PrintToChat(client, "%T", "TeleportInvalidTarget", client);
@ -1736,7 +1731,7 @@ public Action Command_Checkpoints(int client, int args)
return Plugin_Handled;
}
if(gA_StyleSettings[gI_Style[client]].bKZCheckpoints)
if(Shavit_GetStyleSettingInt(gI_Style[client], "kzcheckpoints"))
{
gB_ClosedKZCP[client] = false;
}
@ -1834,7 +1829,7 @@ public Action Command_Tele(int client, int args)
public Action OpenCheckpointsMenu(int client)
{
if(gA_StyleSettings[gI_Style[client]].bKZCheckpoints)
if(Shavit_GetStyleSettingInt(gI_Style[client], "kzcheckpoints"))
{
OpenKZCPMenu(client);
}
@ -1895,7 +1890,7 @@ public int MenuHandler_KZCheckpoints(Menu menu, MenuAction action, int param1, i
{
if(action == MenuAction_Select)
{
if(CanSegment(param1) || !gA_StyleSettings[gI_Style[param1]].bKZCheckpoints)
if(CanSegment(param1) || !Shavit_GetStyleSettingInt(gI_Style[param1], "kzcheckpoints"))
{
return 0;
}
@ -2247,7 +2242,7 @@ bool SaveCheckpoint(int client, int index, bool overflow = false)
return false;
}
if(gA_StyleSettings[gI_Style[client]].bKZCheckpoints)
if(Shavit_GetStyleSettingInt(gI_Style[client], "kzcheckpoints"))
{
if((iFlags & FL_ONGROUND) == 0 || client != target)
{
@ -2464,7 +2459,7 @@ void TeleportToCheckpoint(int client, int index, bool suppressMessage)
timer_snapshot_t snapshot;
CopyArray(cpcache.aSnapshot, snapshot, sizeof(timer_snapshot_t));
if(gA_StyleSettings[gI_Style[client]].bKZCheckpoints != gA_StyleSettings[snapshot.bsStyle].bKZCheckpoints)
if(Shavit_GetStyleSettingInt(gI_Style[client], "kzcheckpoints") != Shavit_GetStyleSettingInt(snapshot.bsStyle, "kzcheckpoints"))
{
Shavit_PrintToChat(client, "%T", "CommandTeleCPInvalid", client);
@ -2535,7 +2530,7 @@ void TeleportToCheckpoint(int client, int index, bool suppressMessage)
CopyArray(cpcache.fAngles, ang, 3);
// this is basically the same as normal checkpoints except much less data is used
if(gA_StyleSettings[gI_Style[client]].bKZCheckpoints)
if(Shavit_GetStyleSettingInt(gI_Style[client], "kzcheckpoints"))
{
TeleportEntity(client, pos, ang, view_as<float>({ 0.0, 0.0, 0.0 }));
@ -2868,7 +2863,7 @@ public Action Command_Specs(int client, int args)
public Action Shavit_OnStart(int client)
{
if(gA_StyleSettings[gI_Style[client]].iPrespeed == 0 && GetEntityMoveType(client) == MOVETYPE_NOCLIP)
if(Shavit_GetStyleSettingInt(gI_Style[client], "prespeed") == 0 && GetEntityMoveType(client) == MOVETYPE_NOCLIP)
{
return Plugin_Stop;
}
@ -2879,7 +2874,7 @@ public Action Shavit_OnStart(int client)
SetEntPropString(client, Prop_Data, "m_iClassname", "player");
}
if(gA_StyleSettings[gI_Style[client]].bKZCheckpoints)
if(Shavit_GetStyleSettingInt(gI_Style[client], "kzcheckpoints"))
{
ResetCheckpoints(client);
}
@ -2887,20 +2882,6 @@ public Action Shavit_OnStart(int client)
return Plugin_Continue;
}
void GetTrackName(int client, int track, char[] output, int size)
{
if(track < 0 || track >= TRACKS_SIZE)
{
FormatEx(output, size, "%T", "Track_Unknown", client);
return;
}
static char sTrack[16];
FormatEx(sTrack, 16, "Track_%d", track);
FormatEx(output, size, "%T", sTrack, client);
}
public void Shavit_OnWorldRecord(int client, int style, float time, int jumps, int strafes, float sync, int track)
{
char sUpperCase[64];
@ -2939,7 +2920,7 @@ public void Shavit_OnRestart(int client, int track)
}
if(!gB_ClosedKZCP[client] &&
gA_StyleSettings[gI_Style[client]].bKZCheckpoints &&
Shavit_GetStyleSettingInt(gI_Style[client], "kzcheckpoints") &&
GetClientMenu(client, null) == MenuSource_None &&
IsPlayerAlive(client) && GetClientTeam(client) >= 2)
{
@ -3066,7 +3047,7 @@ public void Player_Spawn(Event event, const char[] name, bool dontBroadcast)
// refreshes kz cp menu if there is nothing open
if(!gB_ClosedKZCP[client] &&
gA_StyleSettings[gI_Style[client]].bKZCheckpoints &&
Shavit_GetStyleSettingInt(gI_Style[client], "kzcheckpoints") &&
GetClientMenu(client, null) == MenuSource_None &&
IsPlayerAlive(client) && GetClientTeam(client) >= 2)
{

View File

@ -85,9 +85,6 @@ Handle gH_Forwards_OnRankAssigned = null;
// Timer settings.
chatstrings_t gS_ChatStrings;
int gI_Styles = 0;
stylesettings_t gA_StyleSettings[STYLE_LIMIT];
char gS_StyleNames[STYLE_LIMIT][64];
char gS_TrackNames[TRACKS_SIZE][32];
public Plugin myinfo =
{
@ -159,11 +156,6 @@ public void OnPluginStart()
Shavit_OnChatConfigLoaded();
}
for(int i = 0; i < TRACKS_SIZE; i++)
{
GetTrackName(LANG_SERVER, i, gS_TrackNames[i], 32);
}
SQL_DBConnect();
}
@ -183,12 +175,6 @@ public void Shavit_OnStyleConfigLoaded(int styles)
{
gI_Styles = Shavit_GetStyleCount();
}
for(int i = 0; i < gI_Styles; i++)
{
Shavit_GetStyleSettings(i, gA_StyleSettings[i]);
Shavit_GetStyleStrings(i, sStyleName, gS_StyleNames[i], 64);
}
}
public void OnLibraryAdded(const char[] name)
@ -591,14 +577,21 @@ public Action Command_RecalcAll(int client, int args)
{
char sQuery[192];
if(gA_StyleSettings[i].bUnranked || gA_StyleSettings[i].fRankingMultiplier == 0.0)
char unranked[4];
Shavit_GetStyleSetting(i, "unranked", unranked, 16);
char multiplier[16];
Shavit_GetStyleSetting(i, "rankingmultiplier", multiplier, 16);
float fMultiplier = StringToFloat(multiplier);
if(StringToInt(unranked) || fMultiplier == 0.0)
{
FormatEx(sQuery, 192, "UPDATE %splayertimes SET points = 0 WHERE style = %d;", gS_MySQLPrefix, i);
}
else
{
FormatEx(sQuery, 192, "UPDATE %splayertimes SET points = GetRecordPoints(%d, track, time, map, %.1f, %.3f) WHERE style = %d;", gS_MySQLPrefix, i, gCV_PointsPerTier.FloatValue, gA_StyleSettings[i].fRankingMultiplier, i);
FormatEx(sQuery, 192, "UPDATE %splayertimes SET points = GetRecordPoints(%d, track, time, map, %.1f, %.3f) WHERE style = %d;", gS_MySQLPrefix, i, gCV_PointsPerTier.FloatValue, fMultiplier, i);
}
trans.AddQuery(sQuery);
@ -645,16 +638,18 @@ void RecalculateAll(const char[] map)
LogError("DEBUG: 5 (RecalculateAll)");
#endif
for(int i = 0; i < TRACKS_SIZE; i++)
for(int i = 0; i < 3; i++)
{
for(int j = 0; j < gI_Styles; j++)
{
if(gA_StyleSettings[j].bUnranked)
char unranked[4];
Shavit_GetStyleSetting(j, "unranked", unranked, 4);
if(StringToInt(unranked))
{
continue;
}
RecalculateMap(map, i, j);
RecalculateMap(map, i, j, (i > Track_Bonus));
}
}
}
@ -664,15 +659,25 @@ public void Shavit_OnFinish_Post(int client, int style, float time, int jumps, i
RecalculateMap(gS_Map, track, style);
}
void RecalculateMap(const char[] map, const int track, const int style)
void RecalculateMap(const char[] map, const int track, const int style, bool restOfTheBonuses=false)
{
#if defined DEBUG
PrintToServer("Recalculating points. (%s, %d, %d)", map, track, style);
#endif
char sQuery[256];
char multiplier[16];
Shavit_GetStyleSetting(style, "rankingmultiplier", multiplier, 16);
if (restOfTheBonuses)
{
FormatEx(sQuery, 256, "UPDATE %splayertimes SET points = GetRecordPoints(%d, track, time, '%s', %.1f, %.3f) WHERE style = %d AND track > 1 AND map = '%s';",
gS_MySQLPrefix, style, map, gCV_PointsPerTier.FloatValue, StringToFloat(multiplier), style, map);
}
else
{
FormatEx(sQuery, 256, "UPDATE %splayertimes SET points = GetRecordPoints(%d, %d, time, '%s', %.1f, %.3f) WHERE style = %d AND track = %d AND map = '%s';",
gS_MySQLPrefix, style, track, map, gCV_PointsPerTier.FloatValue, gA_StyleSettings[style].fRankingMultiplier, style, track, map);
gS_MySQLPrefix, style, track, map, gCV_PointsPerTier.FloatValue, StringToFloat(multiplier), style, track, map);
}
gH_SQL.Query(SQL_Recalculate_Callback, sQuery, 0, DBPrio_High);
@ -872,20 +877,6 @@ public void SQL_UpdateTop100_Callback(Database db, DBResultSet results, const ch
gH_Top100Menu.ExitButton = true;
}
void GetTrackName(int client, int track, char[] output, int size)
{
if(track < 0 || track >= TRACKS_SIZE)
{
FormatEx(output, size, "%T", "Track_Unknown", client);
return;
}
static char sTrack[16];
FormatEx(sTrack, 16, "Track_%d", track);
FormatEx(output, size, "%T", sTrack, client);
}
public int Native_GetMapTier(Handle handler, int numParams)
{
int tier = 0;

View File

@ -162,7 +162,6 @@ Convar gCV_DynamicTimeCheap = null;
// timer settings
int gI_Styles = 0;
stylestrings_t gS_StyleStrings[STYLE_LIMIT];
stylesettings_t gA_StyleSettings[STYLE_LIMIT];
// chat settings
chatstrings_t gS_ChatStrings;
@ -718,7 +717,7 @@ public any Native_GetReplayTime(Handle handler, int numParams)
int style = GetNativeCell(1);
int track = GetNativeCell(2);
if(style < 0 || track < 0)
if(style < 0 || track < 0 || track >= TRACKS_SIZE)
{
return ThrowNativeError(200, "Style/Track out of range");
}
@ -736,7 +735,10 @@ public any Native_GetReplayTime(Handle handler, int numParams)
return GetReplayLength(Track_Main, track);
}
return float(gI_ReplayTick[style] - gA_FrameCache[style][track].iPreFrames) / gF_Tickrate * gA_StyleSettings[style].fTimescale;
char sSpeed[16];
Shavit_GetStyleSetting(style, "speed", sSpeed, 16);
return float(gI_ReplayTick[style] - gA_FrameCache[style][track].iPreFrames) / gF_Tickrate * StringToFloat(sSpeed);
}
public int Native_HijackAngles(Handle handler, int numParams)
@ -1036,7 +1038,6 @@ public void Shavit_OnStyleConfigLoaded(int styles)
for(int i = 0; i < styles; i++)
{
Shavit_GetStyleSettings(i, gA_StyleSettings[i]);
Shavit_GetStyleStrings(i, sClanTag, gS_StyleStrings[i].sClanTag, sizeof(stylestrings_t::sClanTag));
Shavit_GetStyleStrings(i, sStyleName, gS_StyleStrings[i].sStyleName, sizeof(stylestrings_t::sStyleName));
Shavit_GetStyleStrings(i, sShortName, gS_StyleStrings[i].sShortName, sizeof(stylestrings_t::sShortName));
@ -1714,7 +1715,11 @@ public void DeleteFrames(int client)
public Action Shavit_OnStart(int client)
{
gI_PlayerPrerunFrames[client] = gA_PlayerFrames[client].Length - RoundToFloor(gCV_PlaybackPreRunTime.FloatValue * gF_Tickrate / gA_StyleSettings[Shavit_GetBhopStyle(client)].fTimescale);
char sSpeed[16];
Shavit_GetStyleSetting(Shavit_GetBhopStyle(client), "speed", sSpeed, 16);
float fSpeed = StringToFloat(sSpeed);
gI_PlayerPrerunFrames[client] = gA_PlayerFrames[client].Length - RoundToFloor(gCV_PlaybackPreRunTime.FloatValue * gF_Tickrate / fSpeed);
if(gI_PlayerPrerunFrames[client] < 0)
{
gI_PlayerPrerunFrames[client] = 0;
@ -1732,7 +1737,8 @@ public Action Shavit_OnStart(int client)
else
{
if(gA_PlayerFrames[client].Length >= RoundToFloor(gCV_PlaybackPreRunTime.FloatValue * gF_Tickrate / gA_StyleSettings[Shavit_GetBhopStyle(client)].fTimescale))
if(gA_PlayerFrames[client].Length >= RoundToFloor(gCV_PlaybackPreRunTime.FloatValue * gF_Tickrate / fSpeed))
{
gA_PlayerFrames[client].Erase(0);
gI_PlayerFrames[client]--;
@ -1839,14 +1845,14 @@ public void Shavit_OnFinish(int client, int style, float time, int jumps, int st
void ApplyFlags(int &flags1, int flags2, int flag)
{
if((flags2 & flag) > 0)
if((flags2 & flag) != 0)
{
flags1 |= flag;
}
else
{
flags2 &= ~flag;
flags1 &= ~flag;
}
}
@ -2162,7 +2168,11 @@ public Action Timer_StartReplay(Handle Timer, any data)
bool ReplayEnabled(any style)
{
return (!gA_StyleSettings[style].bUnranked && !gA_StyleSettings[style].bNoReplay);
char unranked[4];
char noreplay[4];
Shavit_GetStyleSetting(style, "unranked", unranked, 4);
Shavit_GetStyleSetting(style, "noreplay", noreplay, 4);
return (!StringToInt(unranked) && !StringToInt(noreplay));
}
public void Player_Event(Event event, const char[] name, bool dontBroadcast)
@ -2782,20 +2792,6 @@ int GetSpectatorTarget(int client)
return target;
}
void GetTrackName(int client, int track, char[] output, int size)
{
if(track < 0 || track >= TRACKS_SIZE)
{
FormatEx(output, size, "%T", "Track_Unknown", client);
return;
}
static char sTrack[16];
FormatEx(sTrack, 16, "Track_%d", track);
FormatEx(output, size, "%T", sTrack, client);
}
float GetReplayLength(int style, int track)
{
if(gA_FrameCache[style][track].iFrameCount == 0)
@ -2809,7 +2805,11 @@ float GetReplayLength(int style, int track)
return gA_FrameCache[style][track].fTime;
}
return Shavit_GetWorldRecord(style, track) * gA_StyleSettings[style].fTimescale;
char speed[16];
Shavit_GetStyleSetting(style, "speed", speed, 16);
return Shavit_GetWorldRecord(style, track) * StringToFloat(speed);
}
void GetReplayName(int style, int track, char[] buffer, int length)

View File

@ -61,7 +61,6 @@ Convar gCV_MVPRankOnes_Main = null;
// timer settings
int gI_Styles = 0;
stylestrings_t gS_StyleStrings[STYLE_LIMIT];
stylesettings_t gA_StyleSettings[STYLE_LIMIT];
// chat settings
chatstrings_t gS_ChatStrings;
@ -157,7 +156,6 @@ public void Shavit_OnStyleConfigLoaded(int styles)
for(int i = 0; i < styles; i++)
{
Shavit_GetStyleSettings(i, gA_StyleSettings[i]);
Shavit_GetStyleStrings(i, sStyleName, gS_StyleStrings[i].sStyleName, sizeof(stylestrings_t::sStyleName));
Shavit_GetStyleStrings(i, sShortName, gS_StyleStrings[i].sShortName, sizeof(stylestrings_t::sShortName));
}
@ -323,7 +321,7 @@ public Action Command_MapsDoneLeft(int client, int args)
{
int iStyle = styles[i];
if(gA_StyleSettings[iStyle].bUnranked || gA_StyleSettings[iStyle].iEnabled == -1)
if(Shavit_GetStyleSettingInt(iStyle, "unranked") || Shavit_GetStyleSettingInt(iStyle, "enabled") == -1)
{
continue;
}
@ -539,7 +537,7 @@ public void OpenStatsMenuCallback(Database db, DBResultSet results, const char[]
{
int iStyle = styles[i];
if(gA_StyleSettings[iStyle].bUnranked || gA_StyleSettings[iStyle].iEnabled <= 0)
if(Shavit_GetStyleSettingInt(iStyle, "unranked") || Shavit_GetStyleSettingInt(iStyle, "enabled") <= 0)
{
continue;
}
@ -935,17 +933,3 @@ public int Native_GetWRCount(Handle handler, int numParams)
{
return gI_WRAmount[GetNativeCell(1)];
}
void GetTrackName(int client, int track, char[] output, int size)
{
if(track < 0 || track >= TRACKS_SIZE)
{
FormatEx(output, size, "%T", "Track_Unknown", client);
return;
}
static char sTrack[16];
FormatEx(sTrack, 16, "Track_%d", track);
FormatEx(output, size, "%T", sTrack, client);
}

View File

@ -83,7 +83,6 @@ Convar gCV_RecentLimit = null;
// timer settings
int gI_Styles = 0;
stylestrings_t gS_StyleStrings[STYLE_LIMIT];
stylesettings_t gA_StyleSettings[STYLE_LIMIT];
// chat settings
chatstrings_t gS_ChatStrings;
@ -144,9 +143,9 @@ public void OnPluginStart()
RegConsoleCmd("sm_wr", Command_WorldRecord, "View the leaderboard of a map. Usage: sm_wr [map]");
RegConsoleCmd("sm_worldrecord", Command_WorldRecord, "View the leaderboard of a map. Usage: sm_worldrecord [map]");
RegConsoleCmd("sm_bwr", Command_WorldRecord, "View the leaderboard of a map. Usage: sm_bwr [map]");
RegConsoleCmd("sm_bworldrecord", Command_WorldRecord, "View the leaderboard of a map. Usage: sm_bworldrecord [map]");
RegConsoleCmd("sm_bonusworldrecord", Command_WorldRecord, "View the leaderboard of a map. Usage: sm_bonusworldrecord [map]");
RegConsoleCmd("sm_bwr", Command_WorldRecord, "View the leaderboard of a map. Usage: sm_bwr [map] [bonus number]");
RegConsoleCmd("sm_bworldrecord", Command_WorldRecord, "View the leaderboard of a map. Usage: sm_bworldrecord [map] [bonus number]");
RegConsoleCmd("sm_bonusworldrecord", Command_WorldRecord, "View the leaderboard of a map. Usage: sm_bonusworldrecord [map] [bonus number]");
RegConsoleCmd("sm_recent", Command_RecentRecords, "View the recent #1 times set.");
RegConsoleCmd("sm_recentrecords", Command_RecentRecords, "View the recent #1 times set.");
@ -373,7 +372,6 @@ public void Shavit_OnStyleConfigLoaded(int styles)
for(int i = 0; i < styles; i++)
{
Shavit_GetStyleSettings(i, gA_StyleSettings[i]);
Shavit_GetStyleStrings(i, sStyleName, gS_StyleStrings[i].sStyleName, sizeof(stylestrings_t::sStyleName));
Shavit_GetStyleStrings(i, sShortName, gS_StyleStrings[i].sShortName, sizeof(stylestrings_t::sShortName));
}
@ -532,7 +530,7 @@ public void SQL_UpdateWRCache_Callback(Database db, DBResultSet results, const c
int iStyle = results.FetchInt(1);
int iTrack = results.FetchInt(2);
if(iStyle >= gI_Styles || iStyle < 0 || gA_StyleSettings[iStyle].bUnranked)
if(iStyle >= gI_Styles || iStyle < 0 || Shavit_GetStyleSettingInt(iStyle, "unranked"))
{
continue;
}
@ -778,7 +776,7 @@ void DeleteSubmenu(int client)
{
int iStyle = styles[i];
if(gA_StyleSettings[iStyle].iEnabled == -1)
if(Shavit_GetStyleSettingInt(iStyle, "enabled") == -1)
{
continue;
}
@ -851,7 +849,7 @@ public int MenuHandler_DeleteAll_First(Menu menu, MenuAction action, int param1,
{
int iStyle = styles[i];
if(gA_StyleSettings[iStyle].iEnabled == -1)
if(Shavit_GetStyleSettingInt(iStyle, "enabled") == -1)
{
continue;
}
@ -1315,14 +1313,46 @@ public Action Command_WorldRecord(int client, int args)
return Plugin_Handled;
}
if(args == 0)
char sCommand[16];
GetCmdArg(0, sCommand, 16);
int track = Track_Main;
bool havemap = false;
if(StrContains(sCommand, "sm_b", false) == 0)
{
if (args >= 1)
{
char arg[6];
GetCmdArg((args > 1) ? 2 : 1, arg, sizeof(arg));
track = StringToInt(arg);
// if the track doesn't fit in the bonus track range then assume it's a map name
if (args > 1 || (track < Track_Bonus || track > Track_Bonus_Last))
{
havemap = true;
}
}
if (track < Track_Bonus || track > Track_Bonus_Last)
{
track = Track_Bonus;
}
}
else
{
havemap = (args >= 1);
}
if(!havemap)
{
strcopy(gA_WRCache[client].sClientMap, 128, gS_Map);
}
else
{
GetCmdArgString(gA_WRCache[client].sClientMap, 128);
GetCmdArg(1, gA_WRCache[client].sClientMap, 128);
if (!GuessBestMapName(gA_ValidMaps, gA_WRCache[client].sClientMap, gA_WRCache[client].sClientMap, 128))
{
Shavit_PrintToChat(client, "%t", "Map was not found", gA_WRCache[client].sClientMap);
@ -1330,16 +1360,6 @@ public Action Command_WorldRecord(int client, int args)
}
}
char sCommand[16];
GetCmdArg(0, sCommand, 16);
int track = Track_Main;
if(StrContains(sCommand, "sm_b", false) == 0)
{
track = Track_Bonus;
}
return ShowWRStyleMenu(client, track);
}
@ -1357,7 +1377,7 @@ Action ShowWRStyleMenu(int client, int track)
{
int iStyle = styles[i];
if(gA_StyleSettings[iStyle].bUnranked || gA_StyleSettings[iStyle].iEnabled == -1)
if(Shavit_GetStyleSettingInt(iStyle, "unranked") || Shavit_GetStyleSettingInt(iStyle, "enabled") == -1)
{
continue;
}
@ -1648,8 +1668,7 @@ public void SQL_RR_Callback(Database db, DBResultSet results, const char[] error
FormatSeconds(fTime, sTime, 16);
int iStyle = results.FetchInt(4);
if(iStyle >= gI_Styles || iStyle < 0 || gA_StyleSettings[iStyle].bUnranked)
if(iStyle >= gI_Styles || iStyle < 0 || Shavit_GetStyleSettingInt(iStyle, "unranked"))
{
continue;
}
@ -1770,7 +1789,7 @@ public void SQL_SubMenu_Callback(Database db, DBResultSet results, const char[]
int iJumps = results.FetchInt(2);
float fPerfs = results.FetchFloat(9);
if(gA_StyleSettings[iStyle].bAutobhop)
if(Shavit_GetStyleSettingInt(iStyle, "autobhop"))
{
FormatEx(sDisplay, 128, "%T: %d", "WRJumps", client, iJumps);
}
@ -1979,7 +1998,7 @@ public void Shavit_OnFinish(int client, int style, float time, int jumps, int st
bool bIncrementCompletions = true;
int iOverwrite = 0;
if(gA_StyleSettings[style].bUnranked || Shavit_IsPracticeMode(client))
if(Shavit_GetStyleSettingInt(style, "unranked") || Shavit_IsPracticeMode(client))
{
iOverwrite = 0; // ugly way of not writing to database
bIncrementCompletions = false;
@ -2105,7 +2124,7 @@ public void Shavit_OnFinish(int client, int style, float time, int jumps, int st
gI_PlayerCompletion[client][style][track]++;
if(iOverwrite == 0 && !gA_StyleSettings[style].bUnranked)
if(iOverwrite == 0 && !Shavit_GetStyleSettingInt(style, "unranked"))
{
FormatEx(sMessage, 255, "%s[%s]%s %T",
gS_ChatStrings.sVariable, sTrack, gS_ChatStrings.sText, "WorseTime", client, gS_ChatStrings.sStyle, gS_StyleStrings[style].sStyleName, gS_ChatStrings.sText, gS_ChatStrings.sVariable2, sTime, gS_ChatStrings.sText, jumps, strafes, sSync, gS_ChatStrings.sText, sDifference);
@ -2211,7 +2230,7 @@ public void SQL_UpdateLeaderboards_Callback(Database db, DBResultSet results, co
int style = results.FetchInt(0);
int track = results.FetchInt(1);
if(style >= gI_Styles || gA_StyleSettings[style].bUnranked || track >= TRACKS_SIZE)
if(style >= gI_Styles || Shavit_GetStyleSettingInt(style, "unranked") || track >= TRACKS_SIZE)
{
continue;
}
@ -2221,7 +2240,7 @@ public void SQL_UpdateLeaderboards_Callback(Database db, DBResultSet results, co
for(int i = 0; i < gI_Styles; i++)
{
if(i >= gI_Styles || gA_StyleSettings[i].bUnranked)
if(i >= gI_Styles || Shavit_GetStyleSettingInt(i, "unranked"))
{
continue;
}
@ -2265,17 +2284,3 @@ int GetRankForTime(int style, float time, int track)
return (iRecords + 1);
}
void GetTrackName(int client, int track, char[] output, int size)
{
if(track < 0 || track >= TRACKS_SIZE)
{
FormatEx(output, size, "%T", "Track_Unknown", client);
return;
}
static char sTrack[16];
FormatEx(sTrack, 16, "Track_%d", track);
FormatEx(output, size, "%T", sTrack, client);
}

View File

@ -127,6 +127,7 @@ float gV_ZoneCenter[MAX_ZONES][3];
int gI_StageZoneID[MAX_ZONES];
int gI_EntityZone[4096];
bool gB_ZonesCreated = false;
int gI_LastStage[MAXPLAYERS+1];
char gS_BeamSprite[PLATFORM_MAX_PATH];
int gI_BeamSprite = -1;
@ -803,6 +804,11 @@ public void Frame_HookTrigger(any data)
return;
}
if (StrContains(sName, "checkpoint") != -1)
{
return; // TODO
}
int zone = -1;
int track = Track_Main;
@ -818,7 +824,16 @@ public void Frame_HookTrigger(any data)
if(StrContains(sName, "bonus") != -1)
{
track = Track_Bonus;
// Parse out the X in mod_zone_bonus_X_start and mod_zone_bonus_X_end
char sections[8][8];
ExplodeString(sName, "_", sections, 8, 8, false);
track = StringToInt(sections[3]); // 0 on failure to parse. 0 is less than Track_Bonus
if (track < Track_Bonus || track > Track_Bonus_Last)
{
// Just ignore because there's either too many bonuses or X can be 0 and nobody told me
return;
}
}
if(zone != -1)
@ -2198,20 +2213,6 @@ public Action OnClientSayCommand(int client, const char[] command, const char[]
return Plugin_Continue;
}
void GetTrackName(int client, int track, char[] output, int size)
{
if(track < 0 || track >= TRACKS_SIZE)
{
FormatEx(output, size, "%T", "Track_Unknown", client);
return;
}
static char sTrack[16];
FormatEx(sTrack, 16, "Track_%d", track);
FormatEx(output, size, "%T", sTrack, client);
}
void UpdateTeleportZone(int client)
{
float vTeleport[3];
@ -2743,6 +2744,8 @@ public void SQL_CreateTable_Callback(Database db, DBResultSet results, const cha
public void Shavit_OnRestart(int client, int track)
{
gI_LastStage[client] = 0;
if(gCV_TeleportToStart.BoolValue)
{
int iIndex = -1;
@ -3001,18 +3004,23 @@ public void StartTouchPost(int entity, int other)
case Zone_Stage:
{
if(status != Timer_Stopped && Shavit_GetClientTrack(other) == gA_ZoneCache[gI_EntityZone[entity]].iZoneTrack)
int num = gA_ZoneCache[gI_EntityZone[entity]].iZoneData;
char special[sizeof(stylestrings_t::sSpecialString)];
Shavit_GetStyleStrings(Shavit_GetBhopStyle(other), sSpecialString, special, sizeof(special));
if(status != Timer_Stopped && Shavit_GetClientTrack(other) == gA_ZoneCache[gI_EntityZone[entity]].iZoneTrack && (num > gI_LastStage[other] || StrContains(special, "segments") != -1))
{
gI_LastStage[other] = num;
char sTime[32];
FormatSeconds(Shavit_GetClientTime(other), sTime, 32, true);
char sMessage[255];
FormatEx(sMessage, 255, "%T", "ZoneStageEnter", other, gS_ChatStrings.sText, gS_ChatStrings.sVariable2, gA_ZoneCache[gI_EntityZone[entity]].iZoneData, gS_ChatStrings.sText, gS_ChatStrings.sVariable2, sTime, gS_ChatStrings.sText);
FormatEx(sMessage, 255, "%T", "ZoneStageEnter", other, gS_ChatStrings.sText, gS_ChatStrings.sVariable2, num, gS_ChatStrings.sText, gS_ChatStrings.sVariable2, sTime, gS_ChatStrings.sText);
Action aResult = Plugin_Continue;
Call_StartForward(gH_Forwards_StageMessage);
Call_PushCell(other);
Call_PushCell(gA_ZoneCache[gI_EntityZone[entity]].iZoneData);
Call_PushCell(num);
Call_PushStringEx(sMessage, 255, SM_PARAM_STRING_COPY, SM_PARAM_COPYBACK);
Call_PushCell(255);
Call_Finish(aResult);
@ -3087,6 +3095,31 @@ public void TouchPost(int entity, int other)
Shavit_StartTimer(other, Track_Main);
}
}
case Zone_Respawn:
{
CS_RespawnPlayer(other);
}
case Zone_Teleport:
{
TeleportEntity(other, gV_Destinations[gI_EntityZone[entity]], NULL_VECTOR, NULL_VECTOR);
}
case Zone_Slay:
{
Shavit_StopTimer(other);
ForcePlayerSuicide(other);
Shavit_PrintToChat(other, "%T", "ZoneSlayEnter", other, gS_ChatStrings.sWarning, gS_ChatStrings.sVariable2, gS_ChatStrings.sWarning);
}
case Zone_Stop:
{
if(Shavit_GetTimerStatus(other) != Timer_Stopped)
{
Shavit_StopTimer(other);
Shavit_PrintToChat(other, "%T", "ZoneStopEnter", other, gS_ChatStrings.sWarning, gS_ChatStrings.sVariable2, gS_ChatStrings.sWarning);
}
}
}
}

View File

@ -9,13 +9,14 @@
{
"en" "UNKNOWN TRACK"
}
"Track_0"
"Track_Main"
{
"en" "Main"
}
"Track_1"
"Track_Bonus"
{
"en" "Bonus"
"#format" "{1:d}"
"en" "Bonus #{1}"
}
// ---------- Commands ---------- //
"NoCommandAccess"

View File

@ -100,6 +100,11 @@
"#format" "{1:s},{2:s},{3:s},{4:s},{5:s}"
"en" "{1}You {2}cannot{3} pause in the {4}start zone{5}."
}
"PauseMoving"
{
"#format" "{1:s},{2:s}"
"en" "You {1}are not{2} allowed to pause while moving."
}
"TimerUnpaused"
{
"#format" "{1:s},{2:s}"

View File

@ -76,11 +76,6 @@
{
"en" "You can teleport only if you are alive."
}
"TeleportInZone"
{
"#format" "{1:s},{2:s},{3:s},{4:s}"
"en" "You {1}cannot teleport{2} inside the {3}start/end zones{4}."
}
"TeleportInvalidTarget"
{
"en" "Invalid target."