diff --git a/README.md b/README.md index a920f5c8..f63201c8 100644 --- a/README.md +++ b/README.md @@ -85,6 +85,7 @@ Core - [x] Add unranked styles. - [x] Add a setting to not start timer if Z axis velocity is a thing (non-prespeed styles). - [x] Add speed reset at timer start. +- [x] Add support for 100AA styles. - [ ] Measure strafe count/sync, also have it in the Shavit_OnFinish forward. - [ ] Add a native that will execute threaded MySQL queries and allow callbacks. - [ ] Add bonus timer. @@ -159,6 +160,7 @@ Rankings **(NEW!)** - [x] Add natives. `float Shavit_GetPoints(int client)` `int Shavit_GetRank(int client)` `void Shavit_GetMapValues(float &points, float &idealtime)` - [x] Add native that checks the total amount of players with over 0 points. - [ ] Find a way to update newly calculated points for all records on a map with the least amount of queries possible. +- [ ] Implement map tiers or remove idealtime and use the WR time for each style instead. - [ ] Remove deleted records from `playerpoints`. Web Interface diff --git a/scripting/include/shavit.inc b/scripting/include/shavit.inc index a2ac55c3..d13c5725 100644 --- a/scripting/include/shavit.inc +++ b/scripting/include/shavit.inc @@ -78,9 +78,10 @@ enum ReplayStatus(+=1) #define STYLE_VEL_LIMIT (1 << 6) // allow velocity limits #define STYLE_BLOCK_USE (1 << 7) // block +use #define STYLE_UNRANKED (1 << 8) // unranked style. no ranking points and no records. (UNTESTED: REPORT ISSUES!) -#define STYLE_NOREPLAY (1 << 9) // disable replay bot for this style. don't use for unranked styles. +#define STYLE_NOREPLAY (1 << 9) // disable replay bot for this style. don't use for unranked styles #define STYLE_PRESPEED (1 << 10) // allow prespeeding regardless of the prespeed setting #define STYLE_HSW_ONLY (1 << 11) // force half-sideways +#define STYLE_100AA (1 << 12) // force 100 airacclerate for the style int gI_StyleProperties[MAX_STYLES] = { @@ -88,7 +89,7 @@ int gI_StyleProperties[MAX_STYLES] = STYLE_AUTOBHOP|STYLE_EASYBHOP|STYLE_BLOCK_A|STYLE_BLOCK_D, // Sideways STYLE_AUTOBHOP|STYLE_EASYBHOP|STYLE_BLOCK_A|STYLE_BLOCK_D|STYLE_BLOCK_S, // W-Only STYLE_EASYBHOP, // Scroll - STYLE_VEL_LIMIT, // 400 Velocity + STYLE_VEL_LIMIT|STYLE_100AA, // 400 Velocity STYLE_AUTOBHOP|STYLE_EASYBHOP|STYLE_HSW_ONLY // HSW }; #endif diff --git a/scripting/shavit-core.sp b/scripting/shavit-core.sp index be8a01b2..44a9b98c 100644 --- a/scripting/shavit-core.sp +++ b/scripting/shavit-core.sp @@ -19,6 +19,7 @@ */ #include +#include #include #include @@ -80,10 +81,15 @@ ConVar gCV_NoStaminaReset = null; ConVar gCV_AllowTimerWithoutZone = null; ConVar gCV_BlockPreJump = null; ConVar gCV_NoZAxisSpeed = null; +ConVar gCV_DefaultAA = null; // table prefix char gS_MySQLPrefix[32]; +// server side +int gI_CachedDefaultAA = 2000; +ConVar sv_airaccelerate = null; + public Plugin myinfo = { name = "[shavit] Core", @@ -207,9 +213,14 @@ public void OnPluginStart() gCV_AllowTimerWithoutZone = CreateConVar("shavit_core_timernozone", "0", "Allow the timer to start if there's no start zone?", 0, true, 0.0, true, 1.0); gCV_BlockPreJump = CreateConVar("shavit_core_blockprejump", "1", "Prevents jumping in the start zone.", 0, true, 0.0, true, 1.0); gCV_NoZAxisSpeed = CreateConVar("shavit_core_nozaxisspeed", "1", "Don't start timer if vertical speed exists (btimes style).", 0, true, 0.0, true, 1.0); + gCV_DefaultAA = CreateConVar("shavit_core_defaultaa", "2000", "Airaccelerate value to use for non-100AA styles, overrides sv_airaccelerate.\nRestart the server after you change this value to not cause issues."); AutoExecConfig(); + sv_airaccelerate = FindConVar("sv_airaccelerate"); + sv_airaccelerate.IntValue = gI_CachedDefaultAA = gCV_DefaultAA.IntValue; + sv_airaccelerate.Flags &= ~FCVAR_NOTIFY; + // late if(gB_Late) { @@ -691,7 +702,7 @@ public void StartTimer(int client) gF_PauseTotalTime[client] = 0.0; gB_ClientPaused[client] = false; - SetEntityGravity(client, 1.0); + SetEntityGravity(client, 0.0); SetEntPropFloat(client, Prop_Data, "m_flLaggedMovementValue", 1.0); } @@ -770,7 +781,8 @@ public void OnClientPutInServer(int client) return; } - // SteamID3 is cool, 2015 B O Y S + SDKHook(client, SDKHook_PreThink, PreThink); + char[] sAuthID3 = new char[32]; GetClientAuthId(client, AuthId_Steam3, sAuthID3, 32); @@ -889,6 +901,11 @@ public void SQL_CreateTable_Callback(Database db, DBResultSet results, const cha } } +public void PreThink(int client) +{ + sv_airaccelerate.IntValue = (gI_StyleProperties[gBS_Style[client]] & STYLE_100AA)? 100:gI_CachedDefaultAA; +} + public Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float vel[3]) { if(!IsPlayerAlive(client) || IsFakeClient(client)) diff --git a/scripting/shavit-wr.sp b/scripting/shavit-wr.sp index 10fab91f..40710e09 100644 --- a/scripting/shavit-wr.sp +++ b/scripting/shavit-wr.sp @@ -601,7 +601,7 @@ public void SQL_OpenDelete_Callback(Database db, DBResultSet results, const char int iJumps = results.FetchInt(3); char[] sDisplay = new char[128]; - FormatEx(sDisplay, 128, "#%d - %s - %s (%d Jumps)", iCount, sName, sTime, iJumps); + FormatEx(sDisplay, 128, "#%d - %s - %s (%d jump%s)", iCount, sName, sTime, iJumps, (iJumps != 1)? "s":""); m.AddItem(sID, sDisplay); } @@ -911,7 +911,7 @@ public void SQL_WR_Callback(Database db, DBResultSet results, const char[] error int iJumps = results.FetchInt(3); char[] sDisplay = new char[128]; - FormatEx(sDisplay, 128, "#%d - %s - %s (%d Jumps)", iCount, sName, sTime, iJumps); + FormatEx(sDisplay, 128, "#%d - %s - %s (%d jump%s)", iCount, sName, sTime, iJumps, (iJumps != 1)? "s":""); m.AddItem(sID, sDisplay); } @@ -947,7 +947,7 @@ public void SQL_WR_Callback(Database db, DBResultSet results, const char[] error if(gF_PlayerRecord[client][gBS_LastWR[client]] == 0.0) { - FormatEx(sRanks, 32, "(%d record%s)", iRecords, iRecords == 1? "":"s"); + FormatEx(sRanks, 32, "(%d record%s)", iRecords, (iRecords != 1)? "s":""); } else @@ -1020,7 +1020,7 @@ public void SQL_RR_Callback(Database db, DBResultSet results, const char[] error } Menu m = new Menu(RRMenu_Handler); - m.SetTitle("Recent %d record%s:", gCV_RecentLimit.IntValue, gCV_RecentLimit.IntValue > 1? "s":""); + m.SetTitle("Recent %d record%s:", gCV_RecentLimit.IntValue, (gCV_RecentLimit.IntValue != 1)? "s":""); while(results.FetchRow()) { @@ -1059,7 +1059,7 @@ public void SQL_RR_Callback(Database db, DBResultSet results, const char[] error if(!bPoints) { - FormatEx(sDisplay, 192, "[%s] %s - %s @ %s (%d jumps)", gS_ShortBhopStyles[bsStyle], sDisplayMap, sName, sTime, iJumps); + FormatEx(sDisplay, 192, "[%s] %s - %s @ %s (%d jump%s)", gS_ShortBhopStyles[bsStyle], sDisplayMap, sName, sTime, iJumps, (iJumps != 1)? "s":""); } char[] sInfo = new char[192]; @@ -1353,12 +1353,12 @@ public void Shavit_OnFinish(int client, BhopStyle style, float time, int jumps) { if(sGame == Game_CSS) { - Shavit_PrintToChatAll("\x03%N\x01 finished (%s) in \x07D490CF%s\x01 (\x077585E0#%d\x01) with %d jumps.", client, gS_BhopStyles[style], sTime, GetRankForTime(style, time), jumps); + Shavit_PrintToChatAll("\x03%N\x01 finished (%s) in \x07D490CF%s\x01 (\x077585E0#%d\x01) with %d jump%s.", client, gS_BhopStyles[style], sTime, GetRankForTime(style, time), jumps, (jumps != 1)? "s":""); } else { - Shavit_PrintToChatAll("\x03%N\x01 finished (%s) in \x07%s\x01 (\x05#%d\x01) with %d jumps.", client, gS_BhopStyles[style], sTime, GetRankForTime(style, time), jumps); + Shavit_PrintToChatAll("\x03%N\x01 finished (%s) in \x07%s\x01 (\x05#%d\x01) with %d jump%s.", client, gS_BhopStyles[style], sTime, GetRankForTime(style, time), jumps, (jumps != 1)? "s":""); } // prevent duplicate records in case there's a long enough lag for the mysql server between two map finishes @@ -1375,12 +1375,12 @@ public void Shavit_OnFinish(int client, BhopStyle style, float time, int jumps) { if(sGame == Game_CSS) { - Shavit_PrintToChatAll("\x03%N\x01 finished (%s) in \x07D490CF%s\x01 (\x077585E0#%d\x01) with %d jumps. \x07AD3BA6(%s)", client, gS_BhopStyles[style], sTime, GetRankForTime(style, time), jumps, sDifference); + Shavit_PrintToChatAll("\x03%N\x01 finished (%s) in \x07D490CF%s\x01 (\x077585E0#%d\x01) with %d jump%s. \x07AD3BA6(%s)", client, gS_BhopStyles[style], sTime, GetRankForTime(style, time), jumps, (jumps != 1)? "s":"", sDifference); } else { - Shavit_PrintToChatAll("\x03%N\x01 finished (%s) in \x07%s\x01 (\x05#%d\x01) with %d jumps. \x0C(%s)", client, gS_BhopStyles[style], sTime, GetRankForTime(style, time), jumps, sDifference); + Shavit_PrintToChatAll("\x03%N\x01 finished (%s) in \x07%s\x01 (\x05#%d\x01) with %d jump%s. \x0C(%s)", client, gS_BhopStyles[style], sTime, GetRankForTime(style, time), jumps, (jumps != 1)? "s":"", sDifference); } FormatEx(sQuery, 512, "UPDATE %splayertimes SET time = '%.03f', jumps = '%d', date = %d WHERE map = '%s' AND auth = '%s' AND style = '%d';", gS_MySQLPrefix, time, jumps, GetTime(), gS_Map, sAuthID, style); @@ -1407,12 +1407,12 @@ public void Shavit_OnFinish(int client, BhopStyle style, float time, int jumps) { if(sGame == Game_CSS) { - Shavit_PrintToChat(client, "You have finished (%s) in \x07D490CF%s\x01 with %d jumps. \x07CCCCCC(+%s)", gS_BhopStyles[style], sTime, jumps, sDifference); + Shavit_PrintToChat(client, "You have finished (%s) in \x07D490CF%s\x01 with %d jump%s. \x07CCCCCC(+%s)", gS_BhopStyles[style], sTime, jumps, (jumps != 1)? "s":"", sDifference); } else { - Shavit_PrintToChat(client, "You have finished (%s) in \x07%s\x01 with %d jumps. \x08(+%s)", gS_BhopStyles[style], sTime, jumps, sDifference); + Shavit_PrintToChat(client, "You have finished (%s) in \x07%s\x01 with %d jump%s. \x08(+%s)", gS_BhopStyles[style], sTime, jumps, (jumps != 1)? "s":"", sDifference); } } @@ -1420,12 +1420,12 @@ public void Shavit_OnFinish(int client, BhopStyle style, float time, int jumps) { if(sGame == Game_CSS) { - Shavit_PrintToChat(client, "You have finished (%s) in \x07D490CF%s\x01 with %d jumps.", gS_BhopStyles[style], sTime, jumps); + Shavit_PrintToChat(client, "You have finished (%s) in \x07D490CF%s\x01 with %d jump%s.", gS_BhopStyles[style], sTime, jumps, (jumps != 1)? "s":""); } else { - Shavit_PrintToChat(client, "You have finished (%s) in \x07%s\x01 with %d jumps.", gS_BhopStyles[style], sTime, jumps); + Shavit_PrintToChat(client, "You have finished (%s) in \x07%s\x01 with %d jump%s.", gS_BhopStyles[style], sTime, jumps, (jumps != 1)? "s":""); } } }