diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 45052e4d6..136a28fde 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - sm-version: [ '1.10', '1.11' ] #, '1.12' + sm-version: [ '1.11' ] #, '1.12' name: "Build SM ${{ matrix.sm-version }}" steps: @@ -15,7 +15,7 @@ jobs: shell: bash run: echo "GITHUB_SHA_SHORT=${GITHUB_SHA::7}" >> $GITHUB_ENV - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Setup SP uses: rumblefrog/setup-sp@master @@ -45,7 +45,7 @@ jobs: done - name: Upload artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: bhoptimer-${{ github.head_ref || github.ref_name }}-sm${{ matrix.sm-version }}-${{ env.GITHUB_SHA_SHORT }} path: | @@ -64,12 +64,12 @@ jobs: runs-on: ubuntu-latest steps: - name: Download artifacts - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 - name: Archive artifacts shell: bash run: find * -maxdepth 0 -type d -exec zip -rq {}.zip {} \; - + - uses: ncipollo/release-action@v1 with: token: ${{ secrets.GITHUB_TOKEN }} diff --git a/README.md b/README.md index e5a689650..874d5353f 100644 --- a/README.md +++ b/README.md @@ -18,9 +18,8 @@ Includes a records system, map zones (start/end marks etc), bonuses, HUD with us # Requirements: * Steam version of Counter-Strike: Source, Counter-Strike: Global Offensive, or Team Fortress 2. -* [Metamod:Source](https://www.sourcemm.net/downloads.php?branch=stable) and [SourceMod](https://www.sourcemod.net/downloads.php?branch=stable) 1.10 or higher ([1.10](https://www.sourcemod.net/downloads.php?branch=1.10-dev&all=1), [1.11](https://www.sourcemod.net/downloads.php?branch=1.11-dev&all=1), [1.12](https://www.sourcemod.net/downloads.php?branch=1.12-dev&all=1)). +* [Metamod:Source](https://www.sourcemm.net/downloads.php?branch=stable) and [SourceMod](https://www.sourcemod.net/downloads.php?branch=stable) 1.11 or higher. * A MySQL database (preferably locally hosted) if your database is likely to grow big, or if you want to use the rankings plugin. MySQL server version of 5.5.5 or above (MariaDB equivalent works too) is required. -* [DHooks](https://github.com/peace-maker/DHooks2/releases) (included with SourceMod 1.11 and higher). # Optional requirements, for the best experience: * [eventqueuefix](https://github.com/hermansimensen/eventqueue-fix) diff --git a/addons/sourcemod/scripting/include/shavit/core.inc b/addons/sourcemod/scripting/include/shavit/core.inc index e880e9d62..05bf10fa2 100644 --- a/addons/sourcemod/scripting/include/shavit/core.inc +++ b/addons/sourcemod/scripting/include/shavit/core.inc @@ -486,49 +486,6 @@ stock float GetAngleDiff(float current, float previous) return diff - 360.0 * RoundToFloor((diff + 180.0) / 360.0); } -// Steam names are `char[32+1];`. Source engine names are `char[32];` (MAX_PLAYER_NAME_LENGTH). -// This means Source engine names can end up with an invalid unicode sequence at the end. -// This will remove the unicode codepoint if necessary. -/* - Sourcemod 1.11 will strip the invalid codepoint internally (some relevant links below) but it'd still be nice to just retrive the client's `name` convar so we get the full thing or maybe even grab it from whatever SteamGameServer api stuff makes it available if possible. - https://github.com/alliedmodders/sourcemod/pull/545 - https://github.com/alliedmodders/sourcemod/issues/1315 - https://github.com/alliedmodders/sourcemod/pull/1544 -*/ -stock void SanerGetClientName(int client, char[] name) -{ - static EngineVersion ev = Engine_Unknown; - - if (ev == Engine_Unknown) - { - ev = GetEngineVersion(); - } - - GetClientName(client, name, 32+1); - - // CSGO doesn't have this problem because `MAX_PLAYER_NAME_LENGTH` is 128... - if (ev == Engine_CSGO) - { - return; - } - - int len = strlen(name); - - if (len == 31) - { - for (int i = 0; i < 3; i++) - { - static int masks[3] = {0xC0, 0xE0, 0xF0}; - - if ((name[len-i-1] & masks[i]) >= masks[i]) - { - name[len-i-1] = 0; - return; - } - } - } -} - // https://forums.alliedmods.net/showthread.php?t=216841 // Trims display string to specified max possible length, and appends "..." if initial string exceeds that length stock void TrimDisplayString(const char[] str, char[] outstr, int outstrlen, int max_allowed_length) diff --git a/addons/sourcemod/scripting/include/shavit/steamid-stocks.inc b/addons/sourcemod/scripting/include/shavit/steamid-stocks.inc index 9c5bfb44c..a0b55ae63 100644 --- a/addons/sourcemod/scripting/include/shavit/steamid-stocks.inc +++ b/addons/sourcemod/scripting/include/shavit/steamid-stocks.inc @@ -24,15 +24,6 @@ #endif #define _steamid_stocks_included -#if SOURCEMOD_V_MAJOR > 1 || SOURCEMOD_V_MINOR >= 11 -#else -static KeyValues kv = null; -static bool hasi64 = false; - -native int Int64ToString(const int num[2], char[] str, int maxlength); -native int StringToInt64(const char[] str, int result[2], int nBase=10); -#endif - // Retrieves accountid from STEAM_X:Y:Z, [U:1:123], and 765xxxxxxxxxxxxxx stock int SteamIDToAccountID(const char[] sInput) @@ -95,50 +86,12 @@ stock void AccountIDToSteamID3(int accountid, char[] buf, int buflen) stock void SteamID64ToString(const int num[2], char[] buf, int buflen) { -#if SOURCEMOD_V_MAJOR == 1 && SOURCEMOD_V_MINOR >= 11 Int64ToString(num, buf, buflen); -#else - if (kv == null) - { - if (!hasi64) - hasi64 = GetFeatureStatus(FeatureType_Native, "Int64ToString") == FeatureStatus_Available; - - if (hasi64) - { - Int64ToString(num, buf, buflen); - return; - } - - kv = new KeyValues("fuck sourcemod"); - } - - kv.SetUInt64(NULL_STRING, num); - kv.GetString(NULL_STRING, buf, buflen); -#endif } stock int SteamID64ToAccountID(const char[] steamid64) { int num[2]; -#if SOURCEMOD_V_MAJOR == 1 && SOURCEMOD_V_MINOR >= 11 StringToInt64(steamid64, num); -#else - if (kv == null) - { - if (!hasi64) - hasi64 = GetFeatureStatus(FeatureType_Native, "StringToInt64") == FeatureStatus_Available; - - if (hasi64) - { - StringToInt64(steamid64, num); - return num[0]; - } - - kv = new KeyValues("fuck sourcemod"); - } - - kv.SetString(NULL_STRING, steamid64); - kv.GetUInt64(NULL_STRING, num); -#endif return num[0]; } diff --git a/addons/sourcemod/scripting/include/shavit/style-settings.sp b/addons/sourcemod/scripting/include/shavit/style-settings.sp index 181873b7b..404641e38 100644 --- a/addons/sourcemod/scripting/include/shavit/style-settings.sp +++ b/addons/sourcemod/scripting/include/shavit/style-settings.sp @@ -548,7 +548,6 @@ float GetStyleSettingFloat(int style, char[] key) public any Native_HasStyleSetting(Handle handler, int numParams) { - // TODO: replace with sm 1.11 StringMap.ContainsKey int style = GetNativeCell(1); char sKey[SS_KEY_SZ]; @@ -559,8 +558,7 @@ public any Native_HasStyleSetting(Handle handler, int numParams) bool HasStyleSetting(int style, char[] key) { - int value[1]; - return gSM_StyleKeys[style].GetArray(key, value, 1); + return gSM_StyleKeys[style].ContainsKey(key); } bool SetStyleSetting(int style, const char[] key, const char[] value, bool replace=true) diff --git a/addons/sourcemod/scripting/shavit-chat.sp b/addons/sourcemod/scripting/shavit-chat.sp index 2a86d8747..0427eab9e 100644 --- a/addons/sourcemod/scripting/shavit-chat.sp +++ b/addons/sourcemod/scripting/shavit-chat.sp @@ -942,7 +942,7 @@ void PreviewChat(int client, int rank) Format(sTextFormatting, MAXLENGTH_BUFFER, "\x01%s", sTextFormatting); char sOriginalName[MAXLENGTH_NAME]; - SanerGetClientName(client, sOriginalName); + GetClientName(client, sOriginalName, sizeof(sOriginalName)); // remove control characters for(int i = 0; i < sizeof(gS_ControlCharacters); i++) @@ -1375,7 +1375,7 @@ void FormatChat(int client, char[] buffer, int size) ReplaceString(buffer, size, "{wrs}", temp); } - SanerGetClientName(client, temp); + GetClientName(client, temp, sizeof(temp)); ReplaceString(buffer, size, "{name}", temp); } @@ -1567,7 +1567,7 @@ public int Native_GetPlainChatrank(Handle handler, int numParams) char sName[MAX_NAME_LENGTH]; if (includename /* || iChatRank == -1*/) { - SanerGetClientName(client, sName); + GetClientName(client, sName, sizeof(sName)); } ReplaceString(buf, sizeof(buf), "{name}", sName); diff --git a/addons/sourcemod/scripting/shavit-core.sp b/addons/sourcemod/scripting/shavit-core.sp index 87a439d67..242f010b6 100644 --- a/addons/sourcemod/scripting/shavit-core.sp +++ b/addons/sourcemod/scripting/shavit-core.sp @@ -59,9 +59,7 @@ bool gB_Protobuf = false; // hook stuff DynamicHook gH_AcceptInput; // used for hooking player_speedmod's AcceptInput DynamicHook gH_TeleportDhook = null; -#if I_WANT_SM_1_11_THINGS Address gI_TF2PreventBunnyJumpingAddr = Address_Null; -#endif // database handle Database gH_SQL = null; @@ -553,7 +551,6 @@ void LoadDHooks() } else if (gEV_Type == Engine_TF2 && !gB_Linux) { -#if I_WANT_SM_1_11_THINGS gI_TF2PreventBunnyJumpingAddr = gamedataConf.GetMemSig("CTFGameMovement::PreventBunnyJumping"); if (gI_TF2PreventBunnyJumpingAddr == Address_Null) @@ -565,7 +562,6 @@ void LoadDHooks() // Write the original JNZ byte but with updateMemAccess=true so we don't repeatedly page-protect it later. StoreToAddress(gI_TF2PreventBunnyJumpingAddr, 0x75, NumberType_Int8, true); } -#endif } LoadPhysicsUntouch(gamedataConf); @@ -2760,7 +2756,7 @@ public void OnClientAuthorized(int client, const char[] auth) } char sName[MAX_NAME_LENGTH]; - SanerGetClientName(client, sName); + GetClientName(client, sName, sizeof(sName)); ReplaceString(sName, MAX_NAME_LENGTH, "#", "?"); // to avoid this: https://user-images.githubusercontent.com/3672466/28637962-0d324952-724c-11e7-8b27-15ff021f0a59.png int iLength = ((strlen(sName) * 2) + 1); @@ -3085,7 +3081,6 @@ public MRESReturn DHook_ProcessMovement(Handle hParams) int client = DHookGetParam(hParams, 1); gI_ClientProcessingMovement = client; -#if I_WANT_SM_1_11_THINGS if (gI_TF2PreventBunnyJumpingAddr != Address_Null) { if (GetStyleSettingBool(gA_Timers[client].bsStyle, "bunnyhopping")) @@ -3093,7 +3088,6 @@ public MRESReturn DHook_ProcessMovement(Handle hParams) else StoreToAddress(gI_TF2PreventBunnyJumpingAddr, 0x75, NumberType_Int8, false); // jnz } -#endif // Causes client to do zone touching in movement instead of server frames. // From https://github.com/rumourA/End-Touch-Fix diff --git a/addons/sourcemod/scripting/shavit-hud.sp b/addons/sourcemod/scripting/shavit-hud.sp index c35bb5a7d..b2a0ae0d0 100644 --- a/addons/sourcemod/scripting/shavit-hud.sp +++ b/addons/sourcemod/scripting/shavit-hud.sp @@ -2125,7 +2125,7 @@ void UpdateSpectatorList(int client, Panel panel, bool &draw) break; } - SanerGetClientName(iSpectatorClients[i], sName); + GetClientName(iSpectatorClients[i], sName, sizeof(sName)); ReplaceString(sName, sizeof(sName), "#", "?"); TrimDisplayString(sName, sName, sizeof(sName), gCV_SpecNameSymbolLength.IntValue); @@ -2407,7 +2407,7 @@ void UpdateKeyHint(int client) break; } - SanerGetClientName(iSpectatorClients[i], sName); + GetClientName(iSpectatorClients[i], sName, sizeof(sName)); ReplaceString(sName, sizeof(sName), "#", "?"); TrimDisplayString(sName, sName, sizeof(sName), gCV_SpecNameSymbolLength.IntValue); Format(sMessage, 256, "%s\n%s", sMessage, sName); diff --git a/addons/sourcemod/scripting/shavit-mapchooser.sp b/addons/sourcemod/scripting/shavit-mapchooser.sp index 2dc68fcf3..c33819a4c 100644 --- a/addons/sourcemod/scripting/shavit-mapchooser.sp +++ b/addons/sourcemod/scripting/shavit-mapchooser.sp @@ -1849,7 +1849,7 @@ void Nominate(int client, const char mapname[PLATFORM_MAX_PATH]) g_aNominateList.PushString(mapname); g_cNominatedMap[client] = mapname; char name[MAX_NAME_LENGTH]; - SanerGetClientName(client, name); + GetClientName(client, name, sizeof(name)); PrintToChatAll("%s%t", g_cPrefix, "Map Nominated", name, mapname); } @@ -1914,7 +1914,7 @@ int CheckRTV(int client = 0) if(client != 0) { - SanerGetClientName(client, name); + GetClientName(client, name, sizeof(name)); } if(needed > 0) { diff --git a/addons/sourcemod/scripting/shavit-misc.sp b/addons/sourcemod/scripting/shavit-misc.sp index 638ba8c10..0f834044e 100644 --- a/addons/sourcemod/scripting/shavit-misc.sp +++ b/addons/sourcemod/scripting/shavit-misc.sp @@ -1108,7 +1108,7 @@ public Action Timer_Advertisement(Handle timer) } char sName[MAX_NAME_LENGTH]; - SanerGetClientName(i, sName); + GetClientName(i, sName, sizeof(sName)); char sTempTempMessage[256]; sTempTempMessage = sTempMessage; ReplaceString(sTempTempMessage, 256, "{name}", sName); @@ -1762,7 +1762,7 @@ public Action Command_ToggleAdverts(int client, int args) public Action Command_PrintAdverts(int client, int args) { char sName[MAX_NAME_LENGTH]; - SanerGetClientName(client, sName); + GetClientName(client, sName, sizeof(sName)); for (int i = 0; i < gA_Advertisements.Length; i++) { @@ -1820,7 +1820,7 @@ public Action Command_Teleport(int client, int args) IntToString(GetClientSerial(i), serial, 16); char sName[MAX_NAME_LENGTH]; - SanerGetClientName(i, sName); + GetClientName(i, sName, sizeof(sName)); menu.AddItem(serial, sName); } diff --git a/addons/sourcemod/scripting/shavit-replay-recorder.sp b/addons/sourcemod/scripting/shavit-replay-recorder.sp index b9c99fd37..d1170ec81 100644 --- a/addons/sourcemod/scripting/shavit-replay-recorder.sp +++ b/addons/sourcemod/scripting/shavit-replay-recorder.sp @@ -371,7 +371,7 @@ void DoReplaySaverCallbacks(int iSteamID, int client, int style, float time, int } char sName[MAX_NAME_LENGTH]; - SanerGetClientName(client, sName); + GetClientName(client, sName, sizeof(sName)); ReplaceString(sName, MAX_NAME_LENGTH, "#", "?"); int postframes = gI_PlayerFrames[client] - gI_PlayerFinishFrame[client]; diff --git a/addons/sourcemod/scripting/shavit-stats.sp b/addons/sourcemod/scripting/shavit-stats.sp index 7b7f19bc9..eaf86a790 100644 --- a/addons/sourcemod/scripting/shavit-stats.sp +++ b/addons/sourcemod/scripting/shavit-stats.sp @@ -672,7 +672,7 @@ public Action Command_MapsDoneLeft(int client, int args) if (iSteamID == 0) { - SanerGetClientName(target, gS_TargetName[client]); + GetClientName(target, gS_TargetName[client], sizeof(gS_TargetName[client])); iSteamID = GetSteamAccountID(target); } diff --git a/addons/sourcemod/scripting/shavit-wr.sp b/addons/sourcemod/scripting/shavit-wr.sp index f12f36cd3..d7cefba21 100644 --- a/addons/sourcemod/scripting/shavit-wr.sp +++ b/addons/sourcemod/scripting/shavit-wr.sp @@ -2585,7 +2585,7 @@ public void Shavit_OnFinish(int client, int style, float time, int jumps, int st IntToString(iSteamID, sSteamID, sizeof(sSteamID)); char sName[32+1]; - SanerGetClientName(client, sName); + GetClientName(client, sName, sizeof(sName)); ReplaceString(sName, sizeof(sName), "#", "?"); gSM_WRNames.SetString(sSteamID, sName, true); diff --git a/addons/sourcemod/scripting/shavit-zones.sp b/addons/sourcemod/scripting/shavit-zones.sp index 2ec80ef11..a2c23d1de 100644 --- a/addons/sourcemod/scripting/shavit-zones.sp +++ b/addons/sourcemod/scripting/shavit-zones.sp @@ -4526,23 +4526,10 @@ void InsertZone(int client) } DataPack pack = new DataPack(); - // TODO Sourcemod 1.11 pack.WriteCellArray - MyWriteCellArray(pack, c, sizeof(c)); + pack.WriteCellArray(c, sizeof(c)); QueryLog(gH_SQL, SQL_InsertZone_Callback, sQuery, pack); } -void MyWriteCellArray(DataPack pack, any[] array, int size) -{ - for (int i = 0; i < size; i++) - pack.WriteCell(array[i]); -} - -void MyReadCellArray(DataPack pack, any[] array, int size) -{ - for (int i = 0; i < size; i++) - array[i] = pack.ReadCell(); -} - bool MyArrayEquals(any[] a, any[] b, int size) { for (int i = 0; i < size; i++) @@ -4555,7 +4542,7 @@ public void SQL_InsertZone_Callback(Database db, DBResultSet results, const char { zone_cache_t cache; pack.Reset(); - MyReadCellArray(pack, cache, sizeof(cache)); + pack.ReadCellArray(cache, sizeof(cache)); delete pack; if (results == null)