From 3240285ed2a6e8c4bf091b5460e4437ed1d49401 Mon Sep 17 00:00:00 2001 From: Nicholas Hastings Date: Sun, 1 Nov 2026 11:38:36 -0500 Subject: [PATCH] Add outbreak build --- core/AMBuilder | 19 +- core/GameHooks.cpp | 2 +- core/HalfLife2.cpp | 59 ++++- core/MenuStyle_Radio.cpp | 12 +- core/PlayerManager.cpp | 19 +- core/PlayerManager.h | 6 +- core/UserMessagePBHelpers.h | 4 + core/UserMessages.cpp | 47 +++- core/UserMessages.h | 9 +- core/concmd_cleaner.cpp | 4 +- core/logic_bridge.cpp | 242 +++++++++--------- core/smn_console.cpp | 48 +++- core/smn_entities.cpp | 4 +- core/smn_hudtext.cpp | 12 +- core/sourcemod.cpp | 20 ++ core/sourcemod.h | 6 + extensions/sdkhooks/extension.cpp | 8 + extensions/sdkhooks/extension.h | 6 +- extensions/sdkhooks/takedamageinfohack.cpp | 5 +- extensions/sdktools/extension.cpp | 14 +- extensions/sdktools/extension.h | 7 +- extensions/sdktools/gamerulesnatives.cpp | 4 +- extensions/sdktools/tempents.cpp | 3 +- extensions/sdktools/vcaller.cpp | 3 +- extensions/sdktools/vhelpers.cpp | 12 + extensions/sdktools/vnatives.cpp | 7 +- extensions/sdktools/vsound.cpp | 106 +++++++- extensions/sdktools/vsound.h | 9 + gamedata/core.games/common.games.txt | 6 + gamedata/core.games/game.l4d2outbreak.txt | 33 +++ gamedata/core.games/master.games.txt | 5 + gamedata/funcommands.games.txt | 1 + gamedata/sdkhooks.games/game.l4d2outbreak.txt | 148 +++++++++++ gamedata/sdkhooks.games/master.games.txt | 4 + gamedata/sdktools.games/game.l4d2outbreak.txt | 214 ++++++++++++++++ gamedata/sdktools.games/master.games.txt | 4 + hl2sdk-manifests | 2 +- loader/loader.cpp | 6 + plugins/basetriggers.sp | 4 +- plugins/include/halflife.inc | 3 + plugins/nextmap.sp | 1 + public/compat_wrappers.h | 6 +- 42 files changed, 931 insertions(+), 203 deletions(-) create mode 100644 gamedata/core.games/game.l4d2outbreak.txt create mode 100644 gamedata/sdkhooks.games/game.l4d2outbreak.txt create mode 100644 gamedata/sdktools.games/game.l4d2outbreak.txt diff --git a/core/AMBuilder b/core/AMBuilder index d53bb32c..8e39156b 100644 --- a/core/AMBuilder +++ b/core/AMBuilder @@ -42,11 +42,12 @@ project.sources += [ 'GameHooks.cpp', ] -# SDK name to shipping gamedir +# SDK name to shipping gamedir, mostly pb_gamedir_map = { 'csgo': 'csgo', 'blade': 'berimbau', 'mcv': 'vietnam', + 'outbreak': 'terror' } # SDK name to source code gamedir @@ -54,6 +55,7 @@ pb_gamesrcdir_map = { 'csgo': 'cstrike15', 'blade': 'berimbau', 'mcv': 'vietnam', + 'outbreak': 'terror', } for sdk_target in SM.sdk_targets: @@ -61,7 +63,7 @@ for sdk_target in SM.sdk_targets: cxx = sdk_target.cxx binary_name = 'sourcemod.' + sdk['extension'] - needs_protobuf = sdk['name'] in ['csgo', 'blade', 'mcv'] + needs_protobuf = sdk['name'] in ['csgo', 'blade', 'mcv', 'outbreak'] binary = SM.HL2Config(project, builder, cxx, binary_name, sdk) SM.ConfigureForExtension(builder, binary.compiler) @@ -76,9 +78,16 @@ for sdk_target in SM.sdk_targets: os.path.join(sdk['path'], 'public', 'engine', 'protobuf'), os.path.join(sdk['path'], 'public', 'game', 'shared', pb_gamedir_map[sdk['name']], 'protobuf') ] + if sdk['name'] == 'outbreak': + compiler.cxxincludes += [ + # Outbreak has "base" usermessages split from the game-specific ones + os.path.join(sdk['path'], 'public', 'game', 'shared', 'protobuf') + ] protobuf_version = "2.5.0" if sdk['name'] == 'mcv': protobuf_version = "3.2.0" + elif sdk['name'] == 'outbreak': + protobuf_version = "3.17.3" compiler.cxxincludes += [ os.path.join(sdk['path'], 'common', 'protobuf-' + protobuf_version, 'src') ] @@ -141,6 +150,12 @@ for sdk_target in SM.sdk_targets: os.path.join(sdk['path'], 'public', 'game', 'shared', pb_gamedir_map[sdk['name']], 'protobuf', pb_gamesrcdir_map[sdk['name']] + '_gcmessages.pb.cc'), os.path.join(sdk['path'], 'public', 'engine', 'protobuf', 'engine_gcmessages.pb.cc'), ] + if sdk['name'] == 'outbreak': + binary.sources += [ + os.path.join(sdk['path'], 'public', 'engine', 'protobuf', 'network_connection.pb.cc'), + os.path.join(sdk['path'], 'public', 'game', 'shared', 'protobuf', 'base_usermessages.pb.cc'), + os.path.join(sdk['path'], 'public', 'game', 'shared', 'protobuf', 'base_usermessage_helpers.cpp'), + ] SM.binaries += builder.Add(project) diff --git a/core/GameHooks.cpp b/core/GameHooks.cpp index 356e764e..5ce62fb7 100644 --- a/core/GameHooks.cpp +++ b/core/GameHooks.cpp @@ -115,7 +115,7 @@ void GameHooks::OnQueryCvarValueFinished(QueryCvarCookie_t cookie, edict_t *pPla const char *cvarName, const char *cvarValue){ int client = IndexOfEdict(pPlayer); -# if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_MCV +# if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_MCV || SOURCE_ENGINE == SE_OUTBREAK if (g_Players.HandleConVarQuery(cookie, client, result, cvarName, cvarValue)) return; # endif diff --git a/core/HalfLife2.cpp b/core/HalfLife2.cpp index a8fb7caf..6ae2a067 100644 --- a/core/HalfLife2.cpp +++ b/core/HalfLife2.cpp @@ -49,6 +49,8 @@ #include #elif SOURCE_ENGINE == SE_MCV #include +#elif SOURCE_ENGINE == SE_OUTBREAK +#include #endif #if SOURCE_ENGINE == SE_TF2 || SOURCE_ENGINE == SE_DODS || SOURCE_ENGINE == SE_HL2DM || SOURCE_ENGINE == SE_CSS @@ -190,7 +192,8 @@ void CHalfLife2::InitLogicalEntData() || SOURCE_ENGINE == SE_BMS \ || SOURCE_ENGINE == SE_BLADE \ || SOURCE_ENGINE == SE_NUCLEARDAWN \ - || SOURCE_ENGINE == SE_PVKII + || SOURCE_ENGINE == SE_PVKII \ + || SOURCE_ENGINE == SE_OUTBREAK if (g_SMAPI->GetServerFactory(false)("VSERVERTOOLS003", nullptr)) { @@ -487,7 +490,11 @@ ServerClass *CHalfLife2::FindEntityServerClass(CBaseEntity *pEntity) return nullptr; } +#if SOURCE_ENGINE == SE_OUTBREAK + return pNetwork->GetServerClassForModify(); +#else return pNetwork->GetServerClass(); +#endif } DataTableInfo *CHalfLife2::_FindServerClass(const char *classname) @@ -641,9 +648,14 @@ bool CHalfLife2::TextMsg(int client, int dest, const char *msg) char buffer[253]; ke::SafeSprintf(buffer, sizeof(buffer), "%s\1\n", msg); -#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_MCV +#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_MCV || SOURCE_ENGINE == SE_OUTBREAK +#if SOURCE_ENGINE == SE_OUTBREAK + CUsrMsg_SayText *pMsg; + if ((pMsg = (CUsrMsg_SayText *)g_UserMsgs.StartProtobufMessage(m_SayTextMsg, players, 1, USERMSG_RELIABLE)) == NULL) +#else CCSUsrMsg_SayText *pMsg; if ((pMsg = (CCSUsrMsg_SayText *)g_UserMsgs.StartProtobufMessage(m_SayTextMsg, players, 1, USERMSG_RELIABLE)) == NULL) +#endif { return false; } @@ -668,9 +680,14 @@ bool CHalfLife2::TextMsg(int client, int dest, const char *msg) } } -#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_MCV +#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_MCV || SOURCE_ENGINE == SE_OUTBREAK +#if SOURCE_ENGINE == SE_OUTBREAK + CUsrMsg_TextMsg *pMsg; + if ((pMsg = (CUsrMsg_TextMsg *)g_UserMsgs.StartProtobufMessage(m_MsgTextMsg, players, 1, USERMSG_RELIABLE)) == NULL) +#else CCSUsrMsg_TextMsg *pMsg; if ((pMsg = (CCSUsrMsg_TextMsg *)g_UserMsgs.StartProtobufMessage(m_MsgTextMsg, players, 1, USERMSG_RELIABLE)) == NULL) +#endif { return false; } @@ -705,9 +722,14 @@ bool CHalfLife2::HintTextMsg(int client, const char *msg) { cell_t players[] = {client}; -#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_MCV +#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_MCV || SOURCE_ENGINE == SE_OUTBREAK +#if SOURCE_ENGINE == SE_OUTBREAK + CUsrMsg_HintText *pMsg; + if ((pMsg = (CUsrMsg_HintText *)g_UserMsgs.StartProtobufMessage(m_HinTextMsg, players, 1, USERMSG_RELIABLE)) == NULL) +#else CCSUsrMsg_HintText *pMsg; if ((pMsg = (CCSUsrMsg_HintText *)g_UserMsgs.StartProtobufMessage(m_HinTextMsg, players, 1, USERMSG_RELIABLE)) == NULL) +#endif { return false; } @@ -735,9 +757,14 @@ bool CHalfLife2::HintTextMsg(int client, const char *msg) bool CHalfLife2::HintTextMsg(cell_t *players, int count, const char *msg) { -#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_MCV +#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_MCV || SOURCE_ENGINE == SE_OUTBREAK +#if SOURCE_ENGINE == SE_OUTBREAK + CUsrMsg_HintText *pMsg; + if ((pMsg = (CUsrMsg_HintText *)g_UserMsgs.StartProtobufMessage(m_HinTextMsg, players, count, USERMSG_RELIABLE)) == NULL) +#else CCSUsrMsg_HintText *pMsg; if ((pMsg = (CCSUsrMsg_HintText *)g_UserMsgs.StartProtobufMessage(m_HinTextMsg, players, count, USERMSG_RELIABLE)) == NULL) +#endif { return false; } @@ -770,9 +797,14 @@ bool CHalfLife2::ShowVGUIMenu(int client, const char *name, KeyValues *data, boo int count = 0; cell_t players[] = {client}; -#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_MCV +#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_MCV || SOURCE_ENGINE == SE_OUTBREAK +#if SOURCE_ENGINE == SE_OUTBREAK + CUsrMsg_VGUIMenu *pMsg; + if ((pMsg = (CUsrMsg_VGUIMenu *)g_UserMsgs.StartProtobufMessage(m_VGUIMenu, players, 1, USERMSG_RELIABLE)) == NULL) +#else CCSUsrMsg_VGUIMenu *pMsg; if ((pMsg = (CCSUsrMsg_VGUIMenu *)g_UserMsgs.StartProtobufMessage(m_VGUIMenu, players, 1, USERMSG_RELIABLE)) == NULL) +#endif { return false; } @@ -795,13 +827,17 @@ bool CHalfLife2::ShowVGUIMenu(int client, const char *name, KeyValues *data, boo SubKey = data->GetFirstSubKey(); } -#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_MCV +#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_MCV || SOURCE_ENGINE == SE_OUTBREAK pMsg->set_name(name); pMsg->set_show(show); while (SubKey) { +#if SOURCE_ENGINE == SE_OUTBREAK + CUsrMsg_VGUIMenu_Subkey *key = pMsg->add_subkeys(); +#else CCSUsrMsg_VGUIMenu_Subkey *key = pMsg->add_subkeys(); +#endif key->set_name(SubKey->GetName()); key->set_str(SubKey->GetString()); SubKey = SubKey->GetNextKey(); @@ -1656,12 +1692,13 @@ uint64_t CHalfLife2::GetServerSteamId64() const || SOURCE_ENGINE == SE_EYE \ || SOURCE_ENGINE == SE_HL2DM \ || SOURCE_ENGINE == SE_INSURGENCY \ - || SOURCE_ENGINE == SE_DOI \ + || SOURCE_ENGINE == SE_DOI \ || SOURCE_ENGINE == SE_SDK2013 \ || SOURCE_ENGINE == SE_ALIENSWARM \ - || SOURCE_ENGINE == SE_TF2 \ - || SOURCE_ENGINE == SE_PVKII \ - || SOURCE_ENGINE == SE_MCV + || SOURCE_ENGINE == SE_TF2 \ + || SOURCE_ENGINE == SE_PVKII \ + || SOURCE_ENGINE == SE_MCV \ + || SOURCE_ENGINE == SE_OUTBREAK const CSteamID *sid = engine->GetGameServerSteamID(); if (sid) { diff --git a/core/MenuStyle_Radio.cpp b/core/MenuStyle_Radio.cpp index 0ca5ebf9..3367fcc9 100644 --- a/core/MenuStyle_Radio.cpp +++ b/core/MenuStyle_Radio.cpp @@ -49,6 +49,8 @@ #include #elif SOURCE_ENGINE == SE_MCV #include +#elif SOURCE_ENGINE == SE_OUTBREAK +#include #endif extern const char *g_RadioNumTable[]; @@ -186,6 +188,8 @@ void CRadioStyle::OnUserMessage(int msg_id, bf_write *bf, IRecipientFilter *pFil #if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_MCV int c = ((CCSUsrMsg_ShowMenu &)msg).display_time(); +#elif SOURCE_ENGINE == SE_OUTBREAK + int c = ((CUsrMsg_ShowMenu &)msg).display_time(); #else bf_read br(bf->GetBasePointer(), 3); @@ -502,9 +506,13 @@ void CRadioMenuPlayer::Radio_Refresh() time = menuHoldTime - (unsigned int)(gpGlobals->curtime - menuStartTime); } -#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_MCV +#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_MCV || SOURCE_ENGINE == SE_OUTBREAK // TODO: find what happens past 240 on CS:GO - CCSUsrMsg_ShowMenu *msg = (CCSUsrMsg_ShowMenu *)g_UserMsgs.StartProtobufMessage(g_ShowMenuId, players, 1, USERMSG_BLOCKHOOKS); +#if SOURCE_ENGINE == SE_OUTBREAK + CUsrMsg_ShowMenu *msg = (CUsrMsg_ShowMenu *)g_UserMsgs.StartProtobufMessage(g_ShowMenuId, players, 1, USERMSG_BLOCKHOOKS); +#else + CCSUsrMsg_ShowMenu *msg = (CCSUsrMsg_ShowMenu *)g_UserMsgs.StartProtobufMessage(g_ShowMenuId, players, 1, USERMSG_BLOCKHOOKS); +#endif if (!msg) { return; diff --git a/core/PlayerManager.cpp b/core/PlayerManager.cpp index cab251a5..ef7b068a 100644 --- a/core/PlayerManager.cpp +++ b/core/PlayerManager.cpp @@ -81,7 +81,7 @@ SH_DECL_HOOK1_void(IServerGameClients, ClientSettingsChanged, SH_NOATTRIB, 0, ed // mock lacks NetworkIDValidated; episode1/darkm (< SE_ORANGEBOX) predate it. #if SOURCE_ENGINE >= SE_ORANGEBOX && SOURCE_ENGINE != SE_MOCK -#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_MCV +#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_MCV || SOURCE_ENGINE == SE_OUTBREAK SH_DECL_HOOK3_void(IServerGameClients, NetworkIDValidated, SH_NOATTRIB, 0, const char *, const char *, CSteamID); #else SH_DECL_HOOK2_void(IServerGameClients, NetworkIDValidated, SH_NOATTRIB, 0, const char *, const char *); @@ -508,7 +508,7 @@ void PlayerManager::RunAuthChecks() } #if defined SM_HAS_NETWORKID_VALIDATED -#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_MCV +#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_MCV || SOURCE_ENGINE == SE_OUTBREAK void PlayerManager::OnNetworkIDValidated(const char *pszUserName, const char *pszNetworkID, CSteamID steamID) #else void PlayerManager::OnNetworkIDValidated(const char *pszUserName, const char *pszNetworkID) @@ -546,7 +546,7 @@ bool PlayerManager::OnClientConnect(edict_t *pEntity, const char *pszName, const /* Get the client's language */ if (m_QueryLang) { -#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_MCV +#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_MCV || SOURCE_ENGINE == SE_OUTBREAK pPlayer->m_LangId = translator->GetServerLanguage(); #else const char *name; @@ -703,7 +703,7 @@ void PlayerManager::OnClientPutInServer(edict_t *pEntity, const char *playername && ((!m_bIsReplayActive && newCount == 1) || (m_bIsReplayActive && newCount == 2)) && (m_SourceTVUserId == userId -#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_MCV +#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_MCV || SOURCE_ENGINE == SE_OUTBREAK // It seems likely that MCV will change this at some point, but it's GOTV at the moment. || strcmp(playername, "GOTV") == 0 #elif SOURCE_ENGINE == SE_BLADE @@ -762,7 +762,7 @@ void PlayerManager::OnClientPutInServer(edict_t *pEntity, const char *playername } pPlayer->Authorize_Post(); } -#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_MCV +#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_MCV || SOURCE_ENGINE == SE_OUTBREAK else if(m_QueryLang) { // Not a bot @@ -826,7 +826,8 @@ void PlayerManager::OnServerHibernationUpdate(bool bHibernating) CPlayer *pPlayer = &m_Players[i]; if (pPlayer->IsConnected() && pPlayer->IsFakeClient()) { -#if SOURCE_ENGINE < SE_LEFT4DEAD || SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_NUCLEARDAWN || SOURCE_ENGINE == SE_MCV +#if SOURCE_ENGINE < SE_LEFT4DEAD || SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_NUCLEARDAWN || \ + SOURCE_ENGINE == SE_MCV || SOURCE_ENGINE == SE_OUTBREAK // These games have the bug fixed where hltv/replay was getting kicked on hibernation if (pPlayer->IsSourceTV() || pPlayer->IsReplay()) continue; @@ -2016,7 +2017,7 @@ void CmdMaxplayersCallback() g_Players.MaxPlayersChanged(); } -#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_MCV +#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_MCV || SOURCE_ENGINE == SE_OUTBREAK bool PlayerManager::HandleConVarQuery(QueryCvarCookie_t cookie, int client, EQueryCvarValueStatus result, const char *cvarName, const char *cvarValue) { for (int i = 1; i <= m_maxClients; i++) @@ -2254,7 +2255,7 @@ void CPlayer::Disconnect() m_bIsSourceTV = false; m_bIsReplay = false; m_Serial.value = -1; -#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_MCV +#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_MCV || SOURCE_ENGINE == SE_OUTBREAK m_LanguageCookie = InvalidQueryCvarCookie; #endif ClearNetchannelQueue(); @@ -2478,6 +2479,8 @@ void CPlayer::Kick(const char *str) { #if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_MCV pClient->Disconnect(str); +#elif SOURCE_ENGINE == SE_OUTBREAK + pClient->Disconnect(NETWORK_DISCONNECT_KICKED); #else pClient->Disconnect("%s", str); #endif diff --git a/core/PlayerManager.h b/core/PlayerManager.h index f8f20fda..8fc71818 100644 --- a/core/PlayerManager.h +++ b/core/PlayerManager.h @@ -151,7 +151,7 @@ private: bool m_bIsReplay = false; serial_t m_Serial; CSteamID m_SteamId; -#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_MCV +#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_MCV || SOURCE_ENGINE == SE_OUTBREAK QueryCvarCookie_t m_LanguageCookie = InvalidQueryCvarCookie; #endif std::deque m_PrintfBuffer; @@ -193,7 +193,7 @@ public: void OnClientSettingsChanged(edict_t *pEntity); //void OnClientSettingsChanged_Pre(edict_t *pEntity); #if SOURCE_ENGINE >= SE_ORANGEBOX && SOURCE_ENGINE != SE_MOCK -#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_MCV +#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_MCV || SOURCE_ENGINE == SE_OUTBREAK void OnNetworkIDValidated(const char *pszUserName, const char *pszNetworkID, CSteamID steamID); #else void OnNetworkIDValidated(const char *pszUserName, const char *pszNetworkID); @@ -243,7 +243,7 @@ public: { return m_bInCCKVHook; } -#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_MCV +#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_MCV || SOURCE_ENGINE == SE_OUTBREAK bool HandleConVarQuery(QueryCvarCookie_t cookie, int client, EQueryCvarValueStatus result, const char *cvarName, const char *cvarValue); #endif private: diff --git a/core/UserMessagePBHelpers.h b/core/UserMessagePBHelpers.h index fcbe554e..86307ee5 100644 --- a/core/UserMessagePBHelpers.h +++ b/core/UserMessagePBHelpers.h @@ -32,6 +32,10 @@ #ifndef _INCLUDE_SOURCEMOD_SMPBMESSAGE_H_ #define _INCLUDE_SOURCEMOD_SMPBMESSAGE_H_ +#ifdef GetMessage +#undef GetMessage +#endif + #include #include #include diff --git a/core/UserMessages.cpp b/core/UserMessages.cpp index ecef9f9d..62cbaee7 100644 --- a/core/UserMessages.cpp +++ b/core/UserMessages.cpp @@ -39,12 +39,15 @@ #include #elif SOURCE_ENGINE == SE_MCV #include +#elif SOURCE_ENGINE == SE_OUTBREAK +#include +#include #endif #include UserMessages g_UserMsgs; -#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_MCV +#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_MCV || SOURCE_ENGINE == SE_OUTBREAK SH_DECL_HOOK3_void(IVEngineServer, SendUserMessage, SH_NOATTRIB, 0, IRecipientFilter &, int, const protobuf::Message &); #else #if SOURCE_ENGINE >= SE_LEFT4DEAD @@ -53,7 +56,7 @@ SH_DECL_HOOK3(IVEngineServer, UserMessageBegin, SH_NOATTRIB, 0, bf_write *, IRec SH_DECL_HOOK2(IVEngineServer, UserMessageBegin, SH_NOATTRIB, 0, bf_write *, IRecipientFilter *, int); #endif SH_DECL_HOOK0_void(IVEngineServer, MessageEnd, SH_NOATTRIB, 0); -#endif // ==SE_CSGO || ==SE_BLADE || ==SE_MCV +#endif // ==SE_CSGO || ==SE_BLADE || ==SE_MCV || ==SE_OUTBREAK UserMessages::UserMessages() #ifndef USE_PROTOBUF_USERMESSAGES @@ -96,7 +99,7 @@ void UserMessages::OnSourceModAllShutdown() { if (m_HookCount) { -#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_MCV +#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_MCV || SOURCE_ENGINE == SE_OUTBREAK SH_REMOVE_HOOK(IVEngineServer, SendUserMessage, engine, SH_MEMBER(this, &UserMessages::OnSendUserMessage_Pre), false); SH_REMOVE_HOOK(IVEngineServer, SendUserMessage, engine, SH_MEMBER(this, &UserMessages::OnSendUserMessage_Post), true); #else @@ -118,6 +121,9 @@ int UserMessages::GetMessageIndex(const char *msg) return g_BerimbauUsermessageHelpers.GetIndex(msg); #elif SOURCE_ENGINE == SE_MCV return g_VietnamUsermessageHelpers.GetIndex(msg); +#elif SOURCE_ENGINE == SE_OUTBREAK + int idx = g_TerrorUsermessageHelpers.GetIndex(msg); + return idx == -1 ? g_BaseUsermessageHelpers.GetIndex(msg) : idx; #else int msgid; @@ -159,6 +165,10 @@ bool UserMessages::GetMessageName(int msgid, char *buffer, size_t maxlength) con const char *pszName = g_BerimbauUsermessageHelpers.GetName(msgid); #elif SOURCE_ENGINE == SE_MCV const char *pszName = g_VietnamUsermessageHelpers.GetName(msgid); +#elif SOURCE_ENGINE == SE_OUTBREAK + const char *pszName = g_TerrorUsermessageHelpers.GetName(msgid); + if (pszName == nullptr) + pszName = g_BaseUsermessageHelpers.GetName(msgid); #endif if (!pszName) return false; @@ -308,7 +318,7 @@ bool UserMessages::EndMessage() return false; } -#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_MCV +#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_MCV || SOURCE_ENGINE == SE_OUTBREAK if (m_CurFlags & USERMSG_BLOCKHOOKS) { ENGINE_CALL(SendUserMessage)(static_cast(m_CellRecFilter), m_CurId, *m_FakeEngineBuffer); @@ -338,7 +348,7 @@ bool UserMessages::EndMessage() } else { engine->MessageEnd(); } -#endif // SE_CSGO || SE_BLADE || SE_MCV +#endif // SE_CSGO || SE_BLADE || SE_MCV || SE_OUTBREAK m_InExec = false; m_CurFlags = 0; @@ -423,7 +433,7 @@ bool UserMessages::InternalHook(int msg_id, IBitBufUserMessageListener *pListene if (!m_HookCount++) { -#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_MCV +#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_MCV || SOURCE_ENGINE == SE_OUTBREAK SH_ADD_HOOK(IVEngineServer, SendUserMessage, engine, SH_MEMBER(this, &UserMessages::OnSendUserMessage_Pre), false); SH_ADD_HOOK(IVEngineServer, SendUserMessage, engine, SH_MEMBER(this, &UserMessages::OnSendUserMessage_Post), true); #else @@ -453,6 +463,11 @@ const protobuf::Message *UserMessages::GetMessagePrototype(int msg_type) return g_BerimbauUsermessageHelpers.GetPrototype(msg_type); #elif SOURCE_ENGINE == SE_MCV return g_VietnamUsermessageHelpers.GetPrototype(msg_type); +#elif SOURCE_ENGINE == SE_OUTBREAK + auto *msg = g_TerrorUsermessageHelpers.GetPrototype(msg_type); + if (msg == nullptr) + msg = g_BaseUsermessageHelpers.GetPrototype(msg_type); + return msg; #endif } #endif @@ -501,7 +516,7 @@ void UserMessages::_DecRefCounter() { if (--m_HookCount == 0) { -#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_MCV +#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_MCV || SOURCE_ENGINE == SE_OUTBREAK SH_REMOVE_HOOK(IVEngineServer, SendUserMessage, engine, SH_MEMBER(this, &UserMessages::OnSendUserMessage_Pre), false); SH_REMOVE_HOOK(IVEngineServer, SendUserMessage, engine, SH_MEMBER(this, &UserMessages::OnSendUserMessage_Post), true); #else @@ -513,7 +528,7 @@ void UserMessages::_DecRefCounter() } } -#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_MCV +#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_MCV || SOURCE_ENGINE == SE_OUTBREAK void UserMessages::OnSendUserMessage_Pre(IRecipientFilter &filter, int msg_type, const protobuf::Message &msg) { #if SOURCE_ENGINE == SE_CSGO @@ -522,6 +537,10 @@ void UserMessages::OnSendUserMessage_Pre(IRecipientFilter &filter, int msg_type, const char *pszName = g_BerimbauUsermessageHelpers.GetName(msg_type); #elif SOURCE_ENGINE == SE_MCV const char *pszName = g_VietnamUsermessageHelpers.GetName(msg_type); +#elif SOURCE_ENGINE == SE_OUTBREAK + const char *pszName = g_TerrorUsermessageHelpers.GetName(msg_type); + if (pszName == nullptr) + pszName = g_BaseUsermessageHelpers.GetName(msg_type); #endif OnStartMessage_Pre(&filter, msg_type, pszName); @@ -570,7 +589,7 @@ void UserMessages::OnSendUserMessage_Post(IRecipientFilter &filter, int msg_type RETURN_META(res) #endif -#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_MCV +#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_MCV || SOURCE_ENGINE == SE_OUTBREAK protobuf::Message *UserMessages::OnStartMessage_Pre(IRecipientFilter *filter, int msg_type, const char *msg_name) #elif SOURCE_ENGINE >= SE_LEFT4DEAD bf_write *UserMessages::OnStartMessage_Pre(IRecipientFilter *filter, int msg_type, const char *msg_name) @@ -610,7 +629,7 @@ bf_write *UserMessages::OnStartMessage_Pre(IRecipientFilter *filter, int msg_typ UM_RETURN_META_VALUE(MRES_IGNORED, NULL); } -#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_MCV +#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_MCV || SOURCE_ENGINE == SE_OUTBREAK protobuf::Message *UserMessages::OnStartMessage_Post(IRecipientFilter *filter, int msg_type, const char *msg_name) #elif SOURCE_ENGINE >= SE_LEFT4DEAD bf_write *UserMessages::OnStartMessage_Post(IRecipientFilter *filter, int msg_type, const char *msg_name) @@ -773,7 +792,7 @@ void UserMessages::OnMessageEnd_Pre() if (!handled && intercepted) { -#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_MCV +#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_MCV || SOURCE_ENGINE == SE_OUTBREAK ENGINE_CALL(SendUserMessage)(static_cast(*m_CurRecFilter), m_CurId, *m_InterceptBuffer); #else bf_write *engine_bfw; @@ -785,11 +804,11 @@ void UserMessages::OnMessageEnd_Pre() m_ReadBuffer.StartReading(m_InterceptBuffer.GetBasePointer(), m_InterceptBuffer.GetNumBytesWritten()); engine_bfw->WriteBitsFromBuffer(&m_ReadBuffer, m_InterceptBuffer.GetNumBitsWritten()); ENGINE_CALL(MessageEnd)(); -#endif // SE_CSGO || SE_BLADE || SE_MCV +#endif // SE_CSGO || SE_BLADE || SE_MCV || SE_OUTBREAK } { -#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_MCV +#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_MCV || SOURCE_ENGINE == SE_OUTBREAK int size = m_OrigBuffer->ByteSize(); uint8 *data = (uint8 *)stackalloc(size); m_OrigBuffer->SerializePartialToArray(data, size); @@ -819,7 +838,7 @@ void UserMessages::OnMessageEnd_Pre() iter++; } -#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_MCV +#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_MCV || SOURCE_ENGINE == SE_OUTBREAK delete pTempMsg; #endif } diff --git a/core/UserMessages.h b/core/UserMessages.h index 02bf9e82..14a058a5 100644 --- a/core/UserMessages.h +++ b/core/UserMessages.h @@ -43,11 +43,14 @@ using namespace SourceMod; -#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_MCV +#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_MCV || SOURCE_ENGINE == SE_OUTBREAK #define USE_PROTOBUF_USERMESSAGES #endif #ifdef USE_PROTOBUF_USERMESSAGES +#ifdef GetMessage +#undef GetMessage +#endif #include #include #include @@ -100,12 +103,12 @@ public: //IUserMessages bool intercept=false); UserMessageType GetUserMessageType() const; public: -#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_MCV +#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_MCV || SOURCE_ENGINE == SE_OUTBREAK void OnSendUserMessage_Pre(IRecipientFilter &filter, int msg_type, const protobuf::Message &msg); void OnSendUserMessage_Post(IRecipientFilter &filter, int msg_type, const protobuf::Message &msg); #endif -#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_MCV +#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_MCV || SOURCE_ENGINE == SE_OUTBREAK protobuf::Message *OnStartMessage_Pre(IRecipientFilter *filter, int msg_type, const char *msg_name); protobuf::Message *OnStartMessage_Post(IRecipientFilter *filter, int msg_type, const char *msg_name); #elif SOURCE_ENGINE >= SE_LEFT4DEAD diff --git a/core/concmd_cleaner.cpp b/core/concmd_cleaner.cpp index 40de83f3..e4542c32 100644 --- a/core/concmd_cleaner.cpp +++ b/core/concmd_cleaner.cpp @@ -36,7 +36,7 @@ #if SOURCE_ENGINE >= SE_ORANGEBOX SH_DECL_HOOK1_void(ICvar, UnregisterConCommand, SH_NOATTRIB, 0, ConCommandBase *); -#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_MCV +#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_MCV || SOURCE_ENGINE == SE_OUTBREAK SH_DECL_HOOK2_void(ICvar, RegisterConCommand, SH_NOATTRIB, 0, ConCommandBase *, bool); #else SH_DECL_HOOK1_void(ICvar, RegisterConCommand, SH_NOATTRIB, 0, ConCommandBase *); @@ -80,7 +80,7 @@ public: #endif } -#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_MCV +#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_MCV || SOURCE_ENGINE == SE_OUTBREAK void LinkConCommandBase(ConCommandBase *pBase, bool unknown) #else void LinkConCommandBase(ConCommandBase *pBase) diff --git a/core/logic_bridge.cpp b/core/logic_bridge.cpp index 4c86d592..8fc3c3ea 100644 --- a/core/logic_bridge.cpp +++ b/core/logic_bridge.cpp @@ -46,11 +46,11 @@ #include "IDBDriver.h" #include "provider.h" #include "sm_convar.h" -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include #include #include @@ -197,9 +197,9 @@ public: { return filesystem->GetSearchPath(pathID, bGetPackFiles, pPath, nMaxLen); } - const char* GetGameBinArchSubdirectory() override + const char* GetGameBinArchSubdirectory() override { -#if defined( KE_ARCH_X64 ) && SOURCE_ENGINE >= SE_BLADE +#if defined( KE_ARCH_X64 ) && SOURCE_ENGINE >= SE_BLADE && SOURCE_ENGINE != SE_OUTBREAK #if defined( PLATFORM_WINDOWS ) #if SOURCE_ENGINE == SE_MCV return "win64" PLATFORM_SEP; @@ -214,112 +214,115 @@ public: #else // Already included in the GameBin path(s), if required return ""; -#endif // defined( KE_ARCH_X64 ) && SOURCE_ENGINE >= SE_BLADE - } - bool SupportsAsync() override - { -#if SOURCE_ENGINE == SE_MOCK - return false; -#else - return true; -#endif - } - int AsyncRead(const char *filename, const char *pathID, SourceMod::AsyncControl_t *control) override - { -#if SOURCE_ENGINE == SE_MOCK - return SourceMod::AsyncStatus_FileOpenError; -#else - auto request = std::make_unique(); - request->request.pszFilename = filename; - request->request.pszPathID = pathID; - request->request.pfnCallback = AsyncReadCallback; - request->request.pContext = request.get(); - FSAsyncControl_t native_control = nullptr; - int status = filesystem->AsyncReadMultiple(&request->request, 1, &native_control); - if (status >= SourceMod::AsyncStatus_Ok && native_control) - async_requests_.emplace(native_control, std::move(request)); - *control = native_control; - return status; -#endif - } - int AsyncWrite(const char *filename, const void *data, int size, bool append, - SourceMod::AsyncControl_t *control) override - { -#if SOURCE_ENGINE == SE_MOCK || SOURCE_ENGINE == SE_DARKMESSIAH - return SourceMod::AsyncStatus_FileOpenError; -#else - return filesystem->AsyncWrite(filename, data, size, false, append, - reinterpret_cast(control)); -#endif - } - int AsyncStatus(SourceMod::AsyncControl_t control) override - { -#if SOURCE_ENGINE == SE_MOCK - return SourceMod::AsyncStatus_FileOpenError; -#else - return filesystem->AsyncStatus(reinterpret_cast(control)); -#endif - } - int AsyncGetResult(SourceMod::AsyncControl_t control, void **data, int *size) override - { -#if SOURCE_ENGINE == SE_MOCK - return SourceMod::AsyncStatus_FileOpenError; -#else - FSAsyncControl_t native_control = reinterpret_cast(control); - void *engine_data; - int engine_size; - int status = filesystem->AsyncGetResult(native_control, &engine_data, &engine_size); - if (status != SourceMod::AsyncStatus_Ok) - return status; - - auto iter = async_requests_.find(native_control); - if (iter == async_requests_.end()) - return SourceMod::AsyncStatus_FileOpenError; - - if (data) - *data = iter->second->contents.empty() ? nullptr : iter->second->contents.data(); - if (size) - *size = static_cast(iter->second->contents.size()); - return status; -#endif - } - void AsyncAbort(SourceMod::AsyncControl_t control) override - { -#if SOURCE_ENGINE != SE_MOCK - filesystem->AsyncAbort(reinterpret_cast(control)); -#endif - } - void AsyncRelease(SourceMod::AsyncControl_t control) override - { -#if SOURCE_ENGINE != SE_MOCK - FSAsyncControl_t native_control = reinterpret_cast(control); - filesystem->AsyncRelease(native_control); - async_requests_.erase(native_control); -#endif - } - -private: -#if SOURCE_ENGINE != SE_MOCK - struct AsyncReadRequest - { - FileAsyncRequest_t request; - std::vector contents; - }; - - static void AsyncReadCallback(const FileAsyncRequest_t &request, int bytes, FSAsyncStatus_t status) - { - auto *async_request = static_cast(request.pContext); - if (status != FSASYNC_OK || bytes < 0 || (bytes && !request.pData)) - return; - - async_request->contents.resize(bytes); - if (bytes) - memcpy(async_request->contents.data(), request.pData, bytes); - } - - std::unordered_map> async_requests_; -#endif -} fs_wrapper; +#endif // defined( KE_ARCH_X64 ) && SOURCE_ENGINE >= SE_BLADE && SOURCE_ENGINE != SE_OUTBREAK + } + bool SupportsAsync() override + { +#if SOURCE_ENGINE == SE_MOCK + return false; +#else + return true; +#endif + } + int AsyncRead(const char *filename, const char *pathID, SourceMod::AsyncControl_t *control) override + { +#if SOURCE_ENGINE == SE_MOCK + return SourceMod::AsyncStatus_FileOpenError; +#else + auto request = std::make_unique(); + request->request.pszFilename = filename; + request->request.pszPathID = pathID; + request->request.pfnCallback = AsyncReadCallback; + request->request.pContext = request.get(); + FSAsyncControl_t native_control = nullptr; + int status = filesystem->AsyncReadMultiple(&request->request, 1, &native_control); + if (status >= SourceMod::AsyncStatus_Ok && native_control) + async_requests_.emplace(native_control, std::move(request)); + *control = native_control; + return status; +#endif + } + int AsyncWrite(const char *filename, const void *data, int size, bool append, + SourceMod::AsyncControl_t *control) override + { +#if SOURCE_ENGINE == SE_MOCK || SOURCE_ENGINE == SE_DARKMESSIAH + return SourceMod::AsyncStatus_FileOpenError; +#elif SOURCE_ENGINE == SE_OUTBREAK + return filesystem->AsyncWrite(filename, "GAME", data, size, false, append, + reinterpret_cast(control)); +#else + return filesystem->AsyncWrite(filename, data, size, false, append, + reinterpret_cast(control)); +#endif + } + int AsyncStatus(SourceMod::AsyncControl_t control) override + { +#if SOURCE_ENGINE == SE_MOCK + return SourceMod::AsyncStatus_FileOpenError; +#else + return filesystem->AsyncStatus(reinterpret_cast(control)); +#endif + } + int AsyncGetResult(SourceMod::AsyncControl_t control, void **data, int *size) override + { +#if SOURCE_ENGINE == SE_MOCK + return SourceMod::AsyncStatus_FileOpenError; +#else + FSAsyncControl_t native_control = reinterpret_cast(control); + void *engine_data; + int engine_size; + int status = filesystem->AsyncGetResult(native_control, &engine_data, &engine_size); + if (status != SourceMod::AsyncStatus_Ok) + return status; + + auto iter = async_requests_.find(native_control); + if (iter == async_requests_.end()) + return SourceMod::AsyncStatus_FileOpenError; + + if (data) + *data = iter->second->contents.empty() ? nullptr : iter->second->contents.data(); + if (size) + *size = static_cast(iter->second->contents.size()); + return status; +#endif + } + void AsyncAbort(SourceMod::AsyncControl_t control) override + { +#if SOURCE_ENGINE != SE_MOCK + filesystem->AsyncAbort(reinterpret_cast(control)); +#endif + } + void AsyncRelease(SourceMod::AsyncControl_t control) override + { +#if SOURCE_ENGINE != SE_MOCK + FSAsyncControl_t native_control = reinterpret_cast(control); + filesystem->AsyncRelease(native_control); + async_requests_.erase(native_control); +#endif + } + +private: +#if SOURCE_ENGINE != SE_MOCK + struct AsyncReadRequest + { + FileAsyncRequest_t request; + std::vector contents; + }; + + static void AsyncReadCallback(const FileAsyncRequest_t &request, int bytes, FSAsyncStatus_t status) + { + auto *async_request = static_cast(request.pContext); + if (status != FSASYNC_OK || bytes < 0 || (bytes && !request.pData)) + return; + + async_request->contents.resize(bytes); + if (bytes) + memcpy(async_request->contents.data(), request.pData, bytes); + } + + std::unordered_map> async_requests_; +#endif +} fs_wrapper; class VPlayerInfo_Logic : public IPlayerInfoBridge { @@ -508,6 +511,8 @@ void UTIL_ConsolePrint(const char *fmt, ...) #define GAMEFIX "2.pvkii" #elif SOURCE_ENGINE == SE_MCV #define GAMEFIX "2.mcv" +#elif SOURCE_ENGINE == SE_OUTBREAK +#define GAMEFIX "2.outbreak" #elif SOURCE_ENGINE == SE_MOCK #define GAMEFIX "2.mock" #else @@ -636,6 +641,8 @@ const char *CoreProviderImpl::GetSourceEngineName() return "pvkii"; #elif SOURCE_ENGINE == SE_MCV return "mcv"; +#elif SOURCE_ENGINE == SE_OUTBREAK + return "outbreak"; #endif } @@ -651,11 +658,12 @@ bool CoreProviderImpl::SymbolsAreHidden() || (SOURCE_ENGINE == SE_NUCLEARDAWN) \ || (SOURCE_ENGINE == SE_LEFT4DEAD2) \ || (SOURCE_ENGINE == SE_INSURGENCY) \ - || (SOURCE_ENGINE == SE_DOI) \ + || (SOURCE_ENGINE == SE_DOI) \ || (SOURCE_ENGINE == SE_BLADE) \ - || (SOURCE_ENGINE == SE_CSGO) \ - || (SOURCE_ENGINE == SE_PVKII) \ - || (SOURCE_ENGINE == SE_MCV) + || (SOURCE_ENGINE == SE_CSGO) \ + || (SOURCE_ENGINE == SE_PVKII) \ + || (SOURCE_ENGINE == SE_MCV) \ + || (SOURCE_ENGINE == SE_OUTBREAK) return true; #else return false; diff --git a/core/smn_console.cpp b/core/smn_console.cpp index 3e3d92ff..384009ab 100644 --- a/core/smn_console.cpp +++ b/core/smn_console.cpp @@ -51,7 +51,10 @@ #include #include -#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_MCV +#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_MCV || SOURCE_ENGINE == SE_OUTBREAK +#ifdef GetMessage +#undef GetMessage +#endif #include #endif @@ -67,6 +70,29 @@ #define NET_SETCONVAR 5 #endif +// SourcePawn exposes command and convar flags as a 32-bit int. Outbreak's +// engine stores the native mask as uint64, so keep the conversion at this API +// boundary and preserve the low 32-bit bit pattern. +static int GetConCommandBaseFlags(const ConCommandBase *cmd) +{ +#if SOURCE_ENGINE == SE_OUTBREAK + return static_cast(static_cast(cmd->GetFlags())); +#else + return cmd->m_nFlags; +#endif +} + +static void SetConCommandBaseFlags(ConCommandBase *cmd, int flags) +{ +#if SOURCE_ENGINE == SE_OUTBREAK + uint64 newFlags = static_cast(flags); + cmd->RemoveFlags(~newFlags); + cmd->AddFlags(newFlags); +#else + cmd->m_nFlags = flags; +#endif +} + enum ConVarBounds { ConVarBound_Upper = 0, @@ -141,14 +167,14 @@ public: if (m_CmdFlags.retrieve(name, &pCmd)) { TrackConCommandBase(pCmd, this); - *flags = pCmd->m_nFlags; + *flags = GetConCommandBaseFlags(pCmd); return true; } else if ((pCmd=FindCommandBase(name))) { m_CmdFlags.insert(name, pCmd); TrackConCommandBase(pCmd, this); - *flags = pCmd->m_nFlags; + *flags = GetConCommandBaseFlags(pCmd); return true; } else @@ -161,14 +187,14 @@ public: ConCommandBase *pCmd; if (m_CmdFlags.retrieve(name, &pCmd)) { - pCmd->m_nFlags = flags; + SetConCommandBaseFlags(pCmd, flags); TrackConCommandBase(pCmd, this); return true; } else if ((pCmd=FindCommandBase(name))) { m_CmdFlags.insert(name, pCmd); - pCmd->m_nFlags = flags; + SetConCommandBaseFlags(pCmd, flags); TrackConCommandBase(pCmd, this); return true; } @@ -550,7 +576,7 @@ static cell_t sm_GetConVarFlags(IPluginContext *pContext, const cell_t *params) return pContext->ThrowNativeError("Invalid convar handle %x (error %d)", hndl, err); } - return pConVar->m_nFlags; + return GetConCommandBaseFlags(pConVar); } static cell_t sm_GetConVarPlugin(IPluginContext *pContext, const cell_t *params) @@ -580,7 +606,7 @@ static cell_t sm_SetConVarFlags(IPluginContext *pContext, const cell_t *params) return pContext->ThrowNativeError("Invalid convar handle %x (error %d)", hndl, err); } - pConVar->m_nFlags = params[2]; + SetConCommandBaseFlags(pConVar, params[2]); return 1; } @@ -1154,7 +1180,7 @@ static cell_t FindFirstConCommand(IPluginContext *pContext, const cell_t *params pContext->StringToLocalUTF8(params[1], params[2], pConCmd->GetName(), NULL); *pIsCmd = pConCmd->IsCommand() ? 1 : 0; - *pFlags = pConCmd->m_nFlags; + *pFlags = GetConCommandBaseFlags(pConCmd); if (params[6]) { @@ -1203,7 +1229,7 @@ static cell_t FindNextConCommand(IPluginContext *pContext, const cell_t *params) pContext->StringToLocalUTF8(params[2], params[3], pConCmd->GetName(), NULL); *pIsCmd = pConCmd->IsCommand() ? 1 : 0; - *pFlags = pConCmd->m_nFlags; + *pFlags = GetConCommandBaseFlags(pConCmd); if (params[7]) { @@ -1232,7 +1258,7 @@ static cell_t SendConVarValue(IPluginContext *pContext, const cell_t *params) char data[256]; bf_write buffer(data, sizeof(data)); -#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_MCV +#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_MCV || SOURCE_ENGINE == SE_OUTBREAK CNETMsg_SetConVar msg; CMsg_CVars_CVar *cvar = msg.mutable_convars()->add_cvars(); @@ -1455,7 +1481,7 @@ static cell_t sm_CommandIteratorConVarFlags(IPluginContext *pContext, const cell } ConCmdInfo *pInfo = (*(iter->iter)); - return pInfo->pCmd->m_nFlags; + return GetConCommandBaseFlags(pInfo->pCmd); } static cell_t sm_CommandIteratorGetDesc(IPluginContext *pContext, const cell_t *params) diff --git a/core/smn_entities.cpp b/core/smn_entities.cpp index 4b7e248f..0bc31680 100644 --- a/core/smn_entities.cpp +++ b/core/smn_entities.cpp @@ -1574,7 +1574,7 @@ static cell_t GetEntProp(IPluginContext *pContext, const cell_t *params) #if SOURCE_ENGINE == SE_CSS || SOURCE_ENGINE == SE_HL2DM || SOURCE_ENGINE == SE_DODS \ || SOURCE_ENGINE == SE_BMS || SOURCE_ENGINE == SE_SDK2013 || SOURCE_ENGINE == SE_TF2 \ || SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_PVKII \ - || SOURCE_ENGINE == SE_MCV + || SOURCE_ENGINE == SE_MCV || SOURCE_ENGINE == SE_OUTBREAK if (pProp->GetFlags() & SPROP_VARINT) { bit_count = sizeof(int) * 8; @@ -1694,7 +1694,7 @@ static cell_t SetEntProp(IPluginContext *pContext, const cell_t *params) #if SOURCE_ENGINE == SE_CSS || SOURCE_ENGINE == SE_HL2DM || SOURCE_ENGINE == SE_DODS \ || SOURCE_ENGINE == SE_BMS || SOURCE_ENGINE == SE_SDK2013 || SOURCE_ENGINE == SE_TF2 \ || SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_PVKII \ - || SOURCE_ENGINE == SE_MCV + || SOURCE_ENGINE == SE_MCV || SOURCE_ENGINE == SE_OUTBREAK if (pProp->GetFlags() & SPROP_VARINT) { bit_count = sizeof(int) * 8; diff --git a/core/smn_hudtext.cpp b/core/smn_hudtext.cpp index 88621d94..6e17f50a 100644 --- a/core/smn_hudtext.cpp +++ b/core/smn_hudtext.cpp @@ -43,6 +43,8 @@ #include #elif SOURCE_ENGINE == SE_MCV #include +#elif SOURCE_ENGINE == SE_OUTBREAK +#include #endif #define MAX_HUD_CHANNELS 6 @@ -323,8 +325,12 @@ void UTIL_SendHudText(int client, const hud_text_parms &textparms, const char *p players[0] = client; -#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_MCV +#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_MCV || SOURCE_ENGINE == SE_OUTBREAK +#if SOURCE_ENGINE == SE_OUTBREAK + CUsrMsg_HudMsg *msg = (CUsrMsg_HudMsg *)g_UserMsgs.StartProtobufMessage(g_HudMsgNum, players, 1, 0); +#else CCSUsrMsg_HudMsg *msg = (CCSUsrMsg_HudMsg *)g_UserMsgs.StartProtobufMessage(g_HudMsgNum, players, 1, 0); +#endif if (!msg) { return; @@ -382,7 +388,7 @@ static cell_t ShowSyncHudText(IPluginContext *pContext, const cell_t *params) Handle_t err; CPlayer *pPlayer; hud_syncobj_t *obj; -#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_MCV +#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_MCV || SOURCE_ENGINE == SE_OUTBREAK char message_buffer[512]; #else char message_buffer[255-36]; @@ -471,7 +477,7 @@ static cell_t ShowHudText(IPluginContext *pContext, const cell_t *params) { int client; CPlayer *pPlayer; -#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_MCV +#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_MCV || SOURCE_ENGINE == SE_OUTBREAK char message_buffer[512]; #else char message_buffer[255-36]; diff --git a/core/sourcemod.cpp b/core/sourcemod.cpp index 8d5c6bf0..daa9666a 100644 --- a/core/sourcemod.cpp +++ b/core/sourcemod.cpp @@ -49,7 +49,11 @@ #include #include +#if SOURCE_ENGINE == SE_OUTBREAK +SH_DECL_HOOK6(IServerGameDLL, LevelInit, SH_NOATTRIB, false, bool, const char *, void *, const char *, const char *, bool, bool); +#else SH_DECL_HOOK6(IServerGameDLL, LevelInit, SH_NOATTRIB, false, bool, const char *, const char *, const char *, const char *, bool, bool); +#endif SH_DECL_HOOK0_void(IServerGameDLL, LevelShutdown, SH_NOATTRIB, false); SH_DECL_HOOK1_void(IServerGameDLL, GameFrame, SH_NOATTRIB, false, bool); SH_DECL_HOOK1_void(IServerGameDLL, Think, SH_NOATTRIB, false, bool); @@ -198,7 +202,9 @@ bool SourceModBase::InitializeSourceMod(char *error, size_t maxlength, bool late /* Hook this now so we can detect startup without calling StartSourceMod() */ SH_ADD_HOOK(IServerGameDLL, LevelInit, gamedll, SH_MEMBER(this, &SourceModBase::LevelInit), false); +#if SOURCE_ENGINE != SE_OUTBREAK SH_ADD_HOOK(IVEngineServer, GetMapEntitiesString, engine, SH_MEMBER(this, &SourceModBase::GetMapEntitiesString), false); +#endif /* Only load if we're not late */ if (!late) @@ -276,7 +282,11 @@ void SourceModBase::StartSourceMod(bool late) } static bool g_LevelEndBarrier = false; +#if SOURCE_ENGINE == SE_OUTBREAK +bool SourceModBase::LevelInit(char const *pMapName, void *pMapEntities, char const *pOldLevel, char const *pLandmarkName, bool loadGame, bool background) +#else bool SourceModBase::LevelInit(char const *pMapName, char const *pMapEntities, char const *pOldLevel, char const *pLandmarkName, bool loadGame, bool background) +#endif { /* Seed rand() globally per map */ srand(time(NULL)); @@ -325,13 +335,16 @@ bool SourceModBase::LevelInit(char const *pMapName, char const *pMapEntities, ch g_LevelEndBarrier = true; +#if SOURCE_ENGINE != SE_OUTBREAK int parseError; size_t position; bool success = logicore.ParseEntityLumpString(pMapEntities, parseError, position); logicore.SetEntityLumpWritable(true); +#endif g_pOnMapInit->PushString(pMapName); g_pOnMapInit->Execute(); +#if SOURCE_ENGINE != SE_OUTBREAK logicore.SetEntityLumpWritable(false); if (!success) @@ -341,8 +354,12 @@ bool SourceModBase::LevelInit(char const *pMapName, char const *pMapEntities, ch } RETURN_META_VALUE_NEWPARAMS(MRES_HANDLED, true, &IServerGameDLL::LevelInit, (pMapName, logicore.GetEntityLumpString(), pOldLevel, pLandmarkName, loadGame, background)); +#else + RETURN_META_VALUE(MRES_IGNORED, true); +#endif } +#if SOURCE_ENGINE != SE_OUTBREAK const char *SourceModBase::GetMapEntitiesString() { const char *pNewMapEntities = logicore.GetEntityLumpString(); @@ -352,6 +369,7 @@ const char *SourceModBase::GetMapEntitiesString() } RETURN_META_VALUE(MRES_IGNORED, NULL); } +#endif void SourceModBase::LevelShutdown() { @@ -465,7 +483,9 @@ void SourceModBase::CloseSourceMod() return; SH_REMOVE_HOOK(IServerGameDLL, LevelInit, gamedll, SH_MEMBER(this, &SourceModBase::LevelInit), false); +#if SOURCE_ENGINE != SE_OUTBREAK SH_REMOVE_HOOK(IVEngineServer, GetMapEntitiesString, engine, SH_MEMBER(this, &SourceModBase::GetMapEntitiesString), false); +#endif if (g_Loaded) { diff --git a/core/sourcemod.h b/core/sourcemod.h index 61176358..d615548f 100644 --- a/core/sourcemod.h +++ b/core/sourcemod.h @@ -77,7 +77,11 @@ public: /** * @brief Map change hook */ +#if SOURCE_ENGINE == SE_OUTBREAK + bool LevelInit(char const *pMapName, void *pMapEntities, char const *pOldLevel, char const *pLandmarkName, bool loadGame, bool background); +#else bool LevelInit(char const *pMapName, char const *pMapEntities, char const *pOldLevel, char const *pLandmarkName, bool loadGame, bool background); +#endif /** * @brief Level shutdown hook @@ -136,7 +140,9 @@ public: // ISourceMod private: void ShutdownServices(); private: +#if SOURCE_ENGINE != SE_OUTBREAK const char* GetMapEntitiesString(); +#endif char m_SMBaseDir[PLATFORM_MAX_PATH]; char m_SMRelDir[PLATFORM_MAX_PATH]; char m_ModDir[32]; diff --git a/extensions/sdkhooks/extension.cpp b/extensions/sdkhooks/extension.cpp index be521479..976c472c 100644 --- a/extensions/sdkhooks/extension.cpp +++ b/extensions/sdkhooks/extension.cpp @@ -154,7 +154,11 @@ CUtlVector *EntListeners() * IServerGameDLL & IVEngineServer Hooks */ SH_DECL_HOOK0_void(IServerGameDLL, LevelShutdown, SH_NOATTRIB, false); +#if SOURCE_ENGINE == SE_OUTBREAK +SH_DECL_HOOK6(IServerGameDLL, LevelInit, SH_NOATTRIB, 0, bool, const char *, void *, const char *, const char *, bool, bool); +#else SH_DECL_HOOK6(IServerGameDLL, LevelInit, SH_NOATTRIB, 0, bool, const char *, const char *, const char *, const char *, bool, bool); +#endif #ifdef GAMEDESC_CAN_CHANGE SH_DECL_HOOK0(IServerGameDLL, GetGameDescription, SH_NOATTRIB, 0, const char *); #endif @@ -964,7 +968,11 @@ const char *SDKHooks::Hook_GetGameDescription() } #endif +#if SOURCE_ENGINE == SE_OUTBREAK +bool SDKHooks::Hook_LevelInit(char const *pMapName, void *pMapEntities, char const *pOldLevel, char const *pLandmarkName, bool loadGame, bool background) +#else bool SDKHooks::Hook_LevelInit(char const *pMapName, char const *pMapEntities, char const *pOldLevel, char const *pLandmarkName, bool loadGame, bool background) +#endif { // Call OnLevelInit forward g_pOnLevelInit->PushString(pMapName); diff --git a/extensions/sdkhooks/extension.h b/extensions/sdkhooks/extension.h index fe2dfcd8..82dc6842 100644 --- a/extensions/sdkhooks/extension.h +++ b/extensions/sdkhooks/extension.h @@ -22,7 +22,7 @@ #endif #if SOURCE_ENGINE != SE_HL2DM && SOURCE_ENGINE != SE_DODS && SOURCE_ENGINE != SE_CSS && SOURCE_ENGINE != SE_TF2 && \ SOURCE_ENGINE != SE_LEFT4DEAD2 && SOURCE_ENGINE != SE_CSGO && SOURCE_ENGINE != SE_NUCLEARDAWN && \ - SOURCE_ENGINE != SE_BLADE && SOURCE_ENGINE != SE_MCV + SOURCE_ENGINE != SE_BLADE && SOURCE_ENGINE != SE_MCV && SOURCE_ENGINE != SE_OUTBREAK #define GAMEDESC_CAN_CHANGE #endif @@ -282,7 +282,11 @@ public: #ifdef GAMEDESC_CAN_CHANGE const char *Hook_GetGameDescription(); #endif +#if SOURCE_ENGINE == SE_OUTBREAK + bool Hook_LevelInit(char const *pMapName, void *pMapEntities, char const *pOldLevel, char const *pLandmarkName, bool loadGame, bool background); +#else bool Hook_LevelInit(char const *pMapName, char const *pMapEntities, char const *pOldLevel, char const *pLandmarkName, bool loadGame, bool background); +#endif /** * CBaseEntity Hook Handlers diff --git a/extensions/sdkhooks/takedamageinfohack.cpp b/extensions/sdkhooks/takedamageinfohack.cpp index 28bf65ee..0670ed10 100644 --- a/extensions/sdkhooks/takedamageinfohack.cpp +++ b/extensions/sdkhooks/takedamageinfohack.cpp @@ -89,14 +89,15 @@ CTakeDamageInfoHack::CTakeDamageInfoHack( CBaseEntity *pInflictor, CBaseEntity * m_flRadius = 0.0f; #endif -#if SOURCE_ENGINE == SE_INSURGENCY || SOURCE_ENGINE == SE_DOI || SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_MCV +#if SOURCE_ENGINE == SE_INSURGENCY || SOURCE_ENGINE == SE_DOI || SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || \ + SOURCE_ENGINE == SE_MCV || SOURCE_ENGINE == SE_OUTBREAK m_iDamagedOtherPlayers = 0; m_iObjectsPenetrated = 0; m_uiBulletID = 0; m_uiRecoilIndex = 0; #endif -#if SOURCE_ENGINE == SE_LEFT4DEAD2 +#if SOURCE_ENGINE == SE_LEFT4DEAD2 || SOURCE_ENGINE == SE_OUTBREAK m_vecDamageDirection.Init(); m_iDamageStats = 0; m_iDamageVictimIndex = 0; diff --git a/extensions/sdktools/extension.cpp b/extensions/sdktools/extension.cpp index a84a9183..93835cdb 100644 --- a/extensions/sdktools/extension.cpp +++ b/extensions/sdktools/extension.cpp @@ -53,7 +53,11 @@ * @brief Implements SDK Tools extension code. */ +#if SOURCE_ENGINE == SE_OUTBREAK +SH_DECL_HOOK6(IServerGameDLL, LevelInit, SH_NOATTRIB, false, bool, const char *, void *, const char *, const char *, bool, bool); +#else SH_DECL_HOOK6(IServerGameDLL, LevelInit, SH_NOATTRIB, false, bool, const char *, const char *, const char *, const char *, bool, bool); +#endif SH_DECL_HOOK0_void(IServerGameDLL, LevelShutdown, SH_NOATTRIB, false); #if SOURCE_ENGINE == SE_CSS || SOURCE_ENGINE == SE_CSGO SH_DECL_HOOK1_void_vafmt(IVEngineServer, ClientCommand, SH_NOATTRIB, 0, edict_t *); @@ -108,7 +112,7 @@ extern sp_nativeinfo_t g_ClientNatives[]; static void InitSDKToolsAPI(); -#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_MCV +#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_MCV || SOURCE_ENGINE == SE_OUTBREAK CDetour *g_WriteBaselinesDetour = NULL; DETOUR_DECL_MEMBER3(CNetworkStringTableContainer__WriteBaselines, void, char const *, mapName, void *, buffer, int, currentTick) @@ -209,7 +213,7 @@ bool SDKTools::SDK_OnLoad(char *error, size_t maxlength, bool late) m_CSGOBadList.add("m_bIsQuestEligible"); #endif -#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_MCV +#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_MCV || SOURCE_ENGINE == SE_OUTBREAK g_WriteBaselinesDetour = DETOUR_CREATE_MEMBER(CNetworkStringTableContainer__WriteBaselines, "WriteBaselines"); if (g_WriteBaselinesDetour) { g_WriteBaselinesDetour->EnableDetour(); @@ -246,7 +250,7 @@ void SDKTools::SDK_OnUnload() g_RegCalls.clear(); ShutdownHelpers(); -#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_MCV +#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_MCV || SOURCE_ENGINE == SE_OUTBREAK if (g_WriteBaselinesDetour) { g_WriteBaselinesDetour->DisableDetour(); g_WriteBaselinesDetour = NULL; @@ -418,7 +422,11 @@ bool SDKTools::RegisterConCommandBase(ConCommandBase *pVar) return g_SMAPI->RegisterConCommandBase(g_PLAPI, pVar); } +#if SOURCE_ENGINE == SE_OUTBREAK +bool SDKTools::LevelInit(char const *pMapName, void *pMapEntities, char const *pOldLevel, char const *pLandmarkName, bool loadGame, bool background) +#else bool SDKTools::LevelInit(char const *pMapName, char const *pMapEntities, char const *pOldLevel, char const *pLandmarkName, bool loadGame, bool background) +#endif { m_bAnyLevelInited = true; diff --git a/extensions/sdktools/extension.h b/extensions/sdktools/extension.h index c985d0d4..87f116a5 100644 --- a/extensions/sdktools/extension.h +++ b/extensions/sdktools/extension.h @@ -62,7 +62,7 @@ #endif #if SOURCE_ENGINE == SE_ALIENSWARM || SOURCE_ENGINE == SE_PORTAL2 || SOURCE_ENGINE == SE_INSURGENCY || SOURCE_ENGINE == SE_DOI \ - || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_MCV + || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_MCV || SOURCE_ENGINE == SE_OUTBREAK #define CLIENTVOICE_HOOK_SUPPORT #else #include @@ -131,7 +131,12 @@ public: //ITimedEvent public: //ICommandTargetProcessor bool ProcessCommandTarget(cmd_target_info_t *info); public: + +#if SOURCE_ENGINE == SE_OUTBREAK + bool LevelInit(char const *pMapName, void *pMapEntities, char const *pOldLevel, char const *pLandmarkName, bool loadGame, bool background); +#else bool LevelInit(char const *pMapName, char const *pMapEntities, char const *pOldLevel, char const *pLandmarkName, bool loadGame, bool background); +#endif void LevelShutdown(); void OnServerActivate(edict_t *pEdictList, int edictCount, int clientMax); public: diff --git a/extensions/sdktools/gamerulesnatives.cpp b/extensions/sdktools/gamerulesnatives.cpp index 2988490d..f524a931 100644 --- a/extensions/sdktools/gamerulesnatives.cpp +++ b/extensions/sdktools/gamerulesnatives.cpp @@ -220,7 +220,7 @@ static cell_t GameRules_GetProp(IPluginContext *pContext, const cell_t *params) // This isn't in CS:S yet, but will be, doesn't hurt to add now, and will save us a build later #if SOURCE_ENGINE == SE_CSS || SOURCE_ENGINE == SE_HL2DM || SOURCE_ENGINE == SE_DODS || SOURCE_ENGINE == SE_TF2 \ || SOURCE_ENGINE == SE_SDK2013 || SOURCE_ENGINE == SE_BMS || SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE \ - || SOURCE_ENGINE == SE_PVKII || SOURCE_ENGINE == SE_MCV + || SOURCE_ENGINE == SE_PVKII || SOURCE_ENGINE == SE_MCV || SOURCE_ENGINE == SE_OUTBREAK if (pProp->GetFlags() & SPROP_VARINT) { bit_count = sizeof(int) * 8; @@ -295,7 +295,7 @@ static cell_t GameRules_SetProp(IPluginContext *pContext, const cell_t *params) #if SOURCE_ENGINE == SE_CSS || SOURCE_ENGINE == SE_HL2DM || SOURCE_ENGINE == SE_DODS || SOURCE_ENGINE == SE_TF2 \ || SOURCE_ENGINE == SE_SDK2013 || SOURCE_ENGINE == SE_BMS || SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE \ - || SOURCE_ENGINE == SE_PVKII || SOURCE_ENGINE == SE_MCV + || SOURCE_ENGINE == SE_PVKII || SOURCE_ENGINE == SE_MCV || SOURCE_ENGINE == SE_OUTBREAK if (pProp->GetFlags() & SPROP_VARINT) { bit_count = sizeof(int) * 8; diff --git a/extensions/sdktools/tempents.cpp b/extensions/sdktools/tempents.cpp index 1de21dd9..8d8df77d 100644 --- a/extensions/sdktools/tempents.cpp +++ b/extensions/sdktools/tempents.cpp @@ -331,7 +331,8 @@ void TempEntityManager::Initialize() || SOURCE_ENGINE == SE_BMS \ || SOURCE_ENGINE == SE_BLADE \ || SOURCE_ENGINE == SE_NUCLEARDAWN \ - || SOURCE_ENGINE == SE_PVKII + || SOURCE_ENGINE == SE_PVKII \ + || SOURCE_ENGINE == SE_OUTBREAK if (g_SMAPI->GetServerFactory(false)("VSERVERTOOLS003", nullptr)) { diff --git a/extensions/sdktools/vcaller.cpp b/extensions/sdktools/vcaller.cpp index cbbe7a1e..fdeb727f 100644 --- a/extensions/sdktools/vcaller.cpp +++ b/extensions/sdktools/vcaller.cpp @@ -155,7 +155,8 @@ static cell_t PrepSDKCall_SetSignature(IPluginContext *pContext, const cell_t *p || SOURCE_ENGINE == SE_DOI \ || SOURCE_ENGINE == SE_CSGO \ || SOURCE_ENGINE == SE_PVKII \ - || SOURCE_ENGINE == SE_MCV + || SOURCE_ENGINE == SE_MCV \ + || SOURCE_ENGINE == SE_OUTBREAK s_call_addr = memutils->ResolveSymbol(handle, &sig[1]); #else s_call_addr = dlsym(handle, &sig[1]); diff --git a/extensions/sdktools/vhelpers.cpp b/extensions/sdktools/vhelpers.cpp index 0dfbc08c..9ba9f052 100644 --- a/extensions/sdktools/vhelpers.cpp +++ b/extensions/sdktools/vhelpers.cpp @@ -834,7 +834,11 @@ CON_COMMAND(sm_dump_classes, "Dumps the class list as a text file") for ( int i = dict->m_Factories.First(); i != dict->m_Factories.InvalidIndex(); i = dict->m_Factories.Next( i ) ) { IServerNetworkable *entity = dict->Create(dict->m_Factories.GetElementName(i)); +#if SOURCE_ENGINE == SE_OUTBREAK + ServerClass *sclass = entity->GetServerClassForModify(); +#else ServerClass *sclass = entity->GetServerClass(); +#endif fprintf(fp,"%s - %s\n",sclass->GetName(), dict->m_Factories.GetElementName(i)); if (!gamehelpers->FindDataMapInfo(gamehelpers->GetDataMap(entity->GetBaseEntity()), "m_iEFlags", &info)) @@ -1010,7 +1014,11 @@ CON_COMMAND(sm_dump_datamaps, "Dumps the data map list as a text file") for ( int i = dict->m_Factories.First(); i != dict->m_Factories.InvalidIndex(); i = dict->m_Factories.Next( i ) ) { IServerNetworkable *entity = dict->Create(dict->m_Factories.GetElementName(i)); +#if SOURCE_ENGINE == SE_OUTBREAK + ServerClass *sclass = entity->GetServerClassForModify(); +#else ServerClass *sclass = entity->GetServerClass(); +#endif datamap_t *pMap = gamehelpers->GetDataMap(entity->GetBaseEntity()); fprintf(fp,"%s - %s\n", sclass->GetName(), dict->m_Factories.GetElementName(i)); @@ -1158,7 +1166,11 @@ CON_COMMAND(sm_dump_datamaps_xml, "Dumps the data map list as an XML file") for (int i = dict->m_Factories.First(); i != dict->m_Factories.InvalidIndex(); i = dict->m_Factories.Next(i)) { IServerNetworkable *entity = dict->Create(dict->m_Factories.GetElementName(i)); +#if SOURCE_ENGINE == SE_OUTBREAK + ServerClass *sclass = entity->GetServerClassForModify(); +#else ServerClass *sclass = entity->GetServerClass(); +#endif datamap_t *pMap = gamehelpers->GetDataMap(entity->GetBaseEntity()); fprintf(fp, " \n", sclass->GetName(), dict->m_Factories.GetElementName(i)); diff --git a/extensions/sdktools/vnatives.cpp b/extensions/sdktools/vnatives.cpp index fdd5a2c3..ce92af3a 100644 --- a/extensions/sdktools/vnatives.cpp +++ b/extensions/sdktools/vnatives.cpp @@ -266,7 +266,7 @@ static cell_t GiveNamedItem(IPluginContext *pContext, const cell_t *params) return gamehelpers->EntityToBCompatRef(pEntity); } -#elif SOURCE_ENGINE == SE_LEFT4DEAD2 +#elif SOURCE_ENGINE == SE_LEFT4DEAD2 || SOURCE_ENGINE == SE_OUTBREAK // CBaseEntity *CTerrorPlayer::GiveNamedItem( const char *pchName, int iSubType, bool bForce, CBaseEntity *pUnk) static cell_t GiveNamedItem(IPluginContext *pContext, const cell_t *params) { @@ -996,7 +996,8 @@ static cell_t FindEntityByClassname(IPluginContext *pContext, const cell_t *para || SOURCE_ENGINE == SE_SDK2013 \ || SOURCE_ENGINE == SE_BLADE \ || SOURCE_ENGINE == SE_NUCLEARDAWN \ - || SOURCE_ENGINE == SE_PVKII + || SOURCE_ENGINE == SE_PVKII \ + || SOURCE_ENGINE == SE_OUTBREAK static bool bHasServerTools3 = !!g_SMAPI->GetServerFactory(false)("VSERVERTOOLS003", nullptr); if (bHasServerTools3) @@ -1090,7 +1091,7 @@ static cell_t CreateEntityByName(IPluginContext *pContext, const cell_t *params) char *classname; pContext->LocalToString(params[1], &classname); -#if SOURCE_ENGINE != SE_CSGO && SOURCE_ENGINE != SE_BLADE && SOURCE_ENGINE != SE_MCV +#if SOURCE_ENGINE != SE_CSGO && SOURCE_ENGINE != SE_BLADE && SOURCE_ENGINE != SE_MCV && SOURCE_ENGINE != SE_OUTBREAK CBaseEntity *pEntity = (CBaseEntity *)servertools->CreateEntityByName(classname); #else CBaseEntity *pEntity = (CBaseEntity *)servertools->CreateItemEntityByName(classname); diff --git a/extensions/sdktools/vsound.cpp b/extensions/sdktools/vsound.cpp index 5020ebb5..170132c1 100644 --- a/extensions/sdktools/vsound.cpp +++ b/extensions/sdktools/vsound.cpp @@ -38,6 +38,9 @@ SH_DECL_HOOK8_void(IVEngineServer, EmitAmbientSound, SH_NOATTRIB, 0, int, const #if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_MCV SH_DECL_HOOK18(IEngineSound, EmitSound, SH_NOATTRIB, 0, int, IRecipientFilter &, int, int, const char *, unsigned int, const char *, float, float, int, int, int, const Vector *, const Vector *, CUtlVector *, bool, float, int, void *); SH_DECL_HOOK18(IEngineSound, EmitSound, SH_NOATTRIB, 1, int, IRecipientFilter &, int, int, const char *, unsigned int, const char *, float, soundlevel_t, int, int, int, const Vector *, const Vector *, CUtlVector *, bool, float, int, void *); +#elif SOURCE_ENGINE == SE_OUTBREAK +SH_DECL_HOOK18(IEngineSound, EmitSound, SH_NOATTRIB, 0, SoundEventGuid_t, IRecipientFilter &, int, int, const char *, unsigned int, const char *, float, float, int, int, int, const Vector *, const Vector *, CUtlVector *, bool, float, int, void *); +SH_DECL_HOOK18(IEngineSound, EmitSound, SH_NOATTRIB, 1, SoundEventGuid_t, IRecipientFilter &, int, int, const char *, unsigned int, const char *, float, soundlevel_t, int, int, int, const Vector *, const Vector *, CUtlVector *, bool, float, int, void *); #elif SOURCE_ENGINE >= SE_PORTAL2 SH_DECL_HOOK17(IEngineSound, EmitSound, SH_NOATTRIB, 0, int, IRecipientFilter &, int, int, const char *, unsigned int, const char *, float, float, int, int, int, const Vector *, const Vector *, CUtlVector *, bool, float, int); SH_DECL_HOOK17(IEngineSound, EmitSound, SH_NOATTRIB, 1, int, IRecipientFilter &, int, int, const char *, unsigned int, const char *, float, soundlevel_t, int, int, int, const Vector *, const Vector *, CUtlVector *, bool, float, int); @@ -360,6 +363,11 @@ int SoundHooks::OnEmitSound(IRecipientFilter &filter, int iEntIndex, int iChanne float flVolume, soundlevel_t iSoundlevel, int nSeed, int iFlags, int iPitch, const Vector *pOrigin, const Vector *pDirection, CUtlVector *pUtlVecOrigins, bool bUpdatePositions, float soundtime, int speakerentity, void *pUnknown) +#elif SOURCE_ENGINE == SE_OUTBREAK +SoundEventGuid_t SoundHooks::OnEmitSound(IRecipientFilter &filter, int iEntIndex, int iChannel, const char *pSoundEntry, unsigned int nSoundEntryHash, const char *pSample, + float flVolume, soundlevel_t iSoundlevel, int nSeed, int iFlags, int iPitch, const Vector *pOrigin, + const Vector *pDirection, CUtlVector *pUtlVecOrigins, bool bUpdatePositions, + float soundtime, int speakerentity, void *pUnknown) #elif SOURCE_ENGINE >= SE_PORTAL2 int SoundHooks::OnEmitSound(IRecipientFilter &filter, int iEntIndex, int iChannel, const char *pSoundEntry, unsigned int nSoundEntryHash, const char *pSample, float flVolume, soundlevel_t iSoundlevel, int nSeed, int iFlags, int iPitch, const Vector *pOrigin, @@ -497,6 +505,16 @@ void SoundHooks::OnEmitSound(IRecipientFilter &filter, int iEntIndex, int iChann static_cast(committed.level), committed.seed, committed.flags, committed.pitch, pOrigin, pDirection, pUtlVecOrigins, bUpdatePositions, soundtime, speakerentity, nullptr) ); +#elif SOURCE_ENGINE == SE_OUTBREAK + RETURN_META_VALUE_NEWPARAMS( + MRES_IGNORED, + -1, + static_cast *, bool, float, int, void *)>(&IEngineSound::EmitSound), + (crf, committed.entity, committed.channel, committed.soundEntry, nSoundEntryHash, committed.sample, committed.volume, + static_cast(committed.level), committed.seed, committed.flags, committed.pitch, pOrigin, + pDirection, pUtlVecOrigins, bUpdatePositions, soundtime, speakerentity, nullptr) + ); #elif SOURCE_ENGINE >= SE_PORTAL2 RETURN_META_VALUE_NEWPARAMS( MRES_IGNORED, @@ -537,6 +555,11 @@ int SoundHooks::OnEmitSound2(IRecipientFilter &filter, int iEntIndex, int iChann float flVolume, float flAttenuation, int nSeed, int iFlags, int iPitch, const Vector *pOrigin, const Vector *pDirection, CUtlVector *pUtlVecOrigins, bool bUpdatePositions, float soundtime, int speakerentity, void *pUnknown) +#elif SOURCE_ENGINE == SE_OUTBREAK +SoundEventGuid_t SoundHooks::OnEmitSound2(IRecipientFilter &filter, int iEntIndex, int iChannel, const char *pSoundEntry, unsigned int nSoundEntryHash, const char *pSample, + float flVolume, float flAttenuation, int nSeed, int iFlags, int iPitch, const Vector *pOrigin, + const Vector *pDirection, CUtlVector *pUtlVecOrigins, bool bUpdatePositions, + float soundtime, int speakerentity, void *pUnknown) #elif SOURCE_ENGINE >= SE_PORTAL2 int SoundHooks::OnEmitSound2(IRecipientFilter &filter, int iEntIndex, int iChannel, const char *pSoundEntry, unsigned int nSoundEntryHash, const char *pSample, float flVolume, float flAttenuation, int nSeed, int iFlags, int iPitch, const Vector *pOrigin, @@ -674,6 +697,16 @@ void SoundHooks::OnEmitSound2(IRecipientFilter &filter, int iEntIndex, int iChan SNDLVL_TO_ATTN(static_cast(committed.level)), committed.seed, committed.flags, committed.pitch, pOrigin, pDirection, pUtlVecOrigins, bUpdatePositions, soundtime, speakerentity, pUnknown) ); +#elif SOURCE_ENGINE == SE_OUTBREAK + RETURN_META_VALUE_NEWPARAMS( + MRES_IGNORED, + -1, + static_cast *, bool, float, int, void *)>(&IEngineSound::EmitSound), + (crf, committed.entity, committed.channel, committed.soundEntry, nSoundEntryHash, committed.sample, committed.volume, + SNDLVL_TO_ATTN(static_cast(committed.level)), committed.seed, committed.flags, committed.pitch, + pOrigin, pDirection, pUtlVecOrigins, bUpdatePositions, soundtime, speakerentity, pUnknown) + ); #elif SOURCE_ENGINE >= SE_PORTAL2 RETURN_META_VALUE_NEWPARAMS( MRES_IGNORED, @@ -714,7 +747,7 @@ bool GetSoundParams(CSoundParameters *soundParams, const char *soundname, cell_t if ( !soundname[0] ) return false; -#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_MCV +#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_MCV || SOURCE_ENGINE == SE_OUTBREAK HSOUNDSCRIPTHASH index = soundemitterbase->HashSoundName(soundname); if(!soundemitterbase->IsValidHash(index)) @@ -727,7 +760,7 @@ bool GetSoundParams(CSoundParameters *soundParams, const char *soundname, cell_t #endif // SOURCE_ENGINE >= SE_PORTAL2 if (!soundemitterbase->IsValidIndex(index)) return false; -#endif // SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_MCV +#endif // SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_MCV || SOURCE_ENGINE == SE_OUTBREAK gender_t gender = GENDER_NONE; @@ -973,9 +1006,34 @@ static cell_t EmitSound(IPluginContext *pContext, const cell_t *params) player[0] = cl_array[i]; crf.Reset(); crf.Initialize(player, 1); -#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_MCV +#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_MCV || SOURCE_ENGINE == SE_OUTBREAK if (g_InSoundHook) { +#if SOURCE_ENGINE == SE_OUTBREAK + SH_CALL(enginesoundPatch, + static_cast *, bool, float, int, void *)> + + (&IEngineSound::EmitSound)) + (crf, + player[0], + channel, + sample, + -1, + sample, + vol, + (soundlevel_t)level, + 0, + flags, + pitch, + pOrigin, + pDir, + pOrigVec, + updatePos, + soundtime, + speakerentity, + nullptr); +#else SH_CALL(enginesoundPatch, static_cast *, bool, float, int, void *)> @@ -999,6 +1057,7 @@ static cell_t EmitSound(IPluginContext *pContext, const cell_t *params) soundtime, speakerentity, nullptr); +#endif } else { @@ -1151,9 +1210,33 @@ static cell_t EmitSound(IPluginContext *pContext, const cell_t *params) #endif } } else { -#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_MCV +#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_MCV || SOURCE_ENGINE == SE_OUTBREAK if (g_InSoundHook) { +#if SOURCE_ENGINE == SE_OUTBREAK + SH_CALL(enginesoundPatch, + static_cast *, bool, float, int, void *)> + (&IEngineSound::EmitSound)) + (crf, + entity, + channel, + sample, + -1, + sample, + vol, + (soundlevel_t)level, + 0, + flags, + pitch, + pOrigin, + pDir, + pOrigVec, + updatePos, + soundtime, + speakerentity, + nullptr); +#else SH_CALL(enginesoundPatch, static_cast *, bool, float, int, void *)> @@ -1176,6 +1259,7 @@ static cell_t EmitSound(IPluginContext *pContext, const cell_t *params) soundtime, speakerentity, nullptr); +#endif } else { @@ -1439,11 +1523,17 @@ static cell_t EmitSoundEntry(IPluginContext *pContext, const cell_t *params) if (g_InSoundHook) { #if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_MCV -SH_CALL(enginesoundPatch, + SH_CALL(enginesoundPatch, static_cast *, bool, float, int, void *)> (&IEngineSound::EmitSound))(crf, player[0], channel, soundEntry, soundEntryHash, sample, vol, (soundlevel_t)level, seed, flags, pitch, pOrigin, pDir, pOrigVec, updatePos, soundtime, speakerentity, nullptr); +#elif SOURCE_ENGINE == SE_OUTBREAK + SH_CALL(enginesoundPatch, + static_cast *, bool, float, int, void *)> + (&IEngineSound::EmitSound))(crf, player[0], channel, soundEntry, soundEntryHash, sample, vol, (soundlevel_t)level, seed, + flags, pitch, pOrigin, pDir, pOrigVec, updatePos, soundtime, speakerentity, nullptr); #else SH_CALL(enginesoundPatch, static_cast *, bool, float, int, void *)> (&IEngineSound::EmitSound))(crf, entity, channel, soundEntry, soundEntryHash, sample, vol, (soundlevel_t)level, seed, flags, pitch, pOrigin, pDir, pOrigVec, updatePos, soundtime, speakerentity, nullptr); +#elif SOURCE_ENGINE == SE_OUTBREAK + SH_CALL(enginesoundPatch, + static_cast *, bool, float, int, void *)> + (&IEngineSound::EmitSound))(crf, entity, channel, soundEntry, soundEntryHash, sample, vol, (soundlevel_t)level, + seed, flags, pitch, pOrigin, pDir, pOrigVec, updatePos, soundtime, speakerentity, nullptr); #else SH_CALL(enginesoundPatch, static_cast *pUtlVecOrigins, bool bUpdatePositions, float soundtime, int speakerentity, void *pUnknown); +#elif SOURCE_ENGINE == SE_OUTBREAK + SoundEventGuid_t OnEmitSound(IRecipientFilter& filter, int iEntIndex, int iChannel, const char *, unsigned int, const char *pSample, float flVolume, + soundlevel_t iSoundlevel, int nSeed, int iFlags, int iPitch, const Vector *pOrigin, + const Vector *pDirection, CUtlVector *pUtlVecOrigins, bool bUpdatePositions, + float soundtime, int speakerentity, void *pUnknown); + SoundEventGuid_t OnEmitSound2(IRecipientFilter &filter, int iEntIndex, int iChannel, const char *pSoundEntry, unsigned int nSoundEntryHash, const char *pSample, + float flVolume, float flAttenuation, int nSeed, int iFlags, int iPitch, const Vector *pOrigin, + const Vector *pDirection, CUtlVector *pUtlVecOrigins, bool bUpdatePositions, + float soundtime, int speakerentity, void *pUnknown); #elif SOURCE_ENGINE >= SE_PORTAL2 int OnEmitSound(IRecipientFilter& filter, int iEntIndex, int iChannel, const char *, unsigned int, const char *pSample, float flVolume, soundlevel_t iSoundlevel, int nSeed, int iFlags, int iPitch, const Vector *pOrigin, diff --git a/gamedata/core.games/common.games.txt b/gamedata/core.games/common.games.txt index 7e0f702a..22769a06 100644 --- a/gamedata/core.games/common.games.txt +++ b/gamedata/core.games/common.games.txt @@ -107,6 +107,7 @@ "engine" "contagion" "engine" "pvkii" "engine" "mcv" + "game" "l4d2outbreak" } "Offsets" @@ -198,6 +199,7 @@ "game" "dystopia" "game" "treason" "game" "tf2classified" + "game" "l4d2outbreak" } "Keys" @@ -256,6 +258,7 @@ "game" "dystopia" "game" "treason" "game" "tf2classified" + "game" "l4d2outbreak" } "Keys" @@ -323,6 +326,7 @@ "game" "dystopia" "game" "treason" "game" "tf2classified" + "game" "l4d2outbreak" } "Keys" @@ -377,6 +381,7 @@ "engine" "insurgency" "engine" "mcv" "engine" "doi" + "engine" "outbreak" } "Keys" @@ -400,6 +405,7 @@ "engine" "left4dead" "engine" "left4dead2" "engine" "nucleardawn" + "engine" "outbreak" } "Keys" diff --git a/gamedata/core.games/game.l4d2outbreak.txt b/gamedata/core.games/game.l4d2outbreak.txt new file mode 100644 index 00000000..29900ffb --- /dev/null +++ b/gamedata/core.games/game.l4d2outbreak.txt @@ -0,0 +1,33 @@ +/** + * Do not edit this file. Any changes will be overwritten by the gamedata + * updater or by upgrading your SourceMod install. + * + * To override data in this file, create a subdirectory named "custom" and + * place your own gamedata file(s) inside of it. Such files will be parsed + * after SM's own. + * + * For more information, see http://wiki.alliedmods.net/Gamedata_Updating_(SourceMod) + */ + +"Games" +{ + "#default" + { + "#supported" + { + "game" "l4d2outbreak" + } + + "Offsets" + { + /* CGlobalEntityList */ + /* L4D2:Outbreak has VSERVERTOOLS003, so we already have gEntList and only need the EntInfo offset from it */ + /* It's the first member after the vtable */ + "EntInfo" + { + "windows64" "8" + "linux64" "8" + } + } + } +} diff --git a/gamedata/core.games/master.games.txt b/gamedata/core.games/master.games.txt index 82719f12..b934f3e7 100644 --- a/gamedata/core.games/master.games.txt +++ b/gamedata/core.games/master.games.txt @@ -110,6 +110,11 @@ { "game" "gmod9" } + + "game.l4d2outbreak.txt" + { + "game" "l4d2outbreak" + } "blocklist.plugins.txt" { diff --git a/gamedata/funcommands.games.txt b/gamedata/funcommands.games.txt index 8c241e8f..6ad18448 100644 --- a/gamedata/funcommands.games.txt +++ b/gamedata/funcommands.games.txt @@ -92,6 +92,7 @@ { "game" "left4dead" "game" "left4dead2" + "game" "l4d2outbreak" } "Keys" diff --git a/gamedata/sdkhooks.games/game.l4d2outbreak.txt b/gamedata/sdkhooks.games/game.l4d2outbreak.txt new file mode 100644 index 00000000..aa40be6b --- /dev/null +++ b/gamedata/sdkhooks.games/game.l4d2outbreak.txt @@ -0,0 +1,148 @@ +/** + * Do not edit this file. Any changes will be overwritten by the gamedata + * updater. + * + * To override data in this file, create a subdirectory named "custom" and + * place your own gamedata file(s) inside of it. Such files will be parsed + * after SM's own. + * + * For more information, see http://wiki.alliedmods.net/Gamedata_Updating_(SourceMod) + */ + + +"Games" +{ + "left4dead2" + { + "Offsets" + { + "Blocked" + { + "windows64" "126" + "linux64" "127" + } + "EndTouch" + { + "windows64" "124" + "linux64" "125" + } + "FireBullets" + { + "windows64" "138" + "linux64" "139" + } + "GetMaxHealth" + { + "windows64" "142" + "linux64" "143" + } + "OnTakeDamage" + { + "windows64" "86" + "linux64" "87" + } + "OnTakeDamage_Alive" + { + "windows64" "327" + "linux64" "228" + } + "PreThink" + { + "windows64" "401" + "linux64" "402" + } + "PostThink" + { + "windows64" "402" + "linux64" "403" + } + "Reload" + { + "windows64" "308" + "linux64" "309" + } + "SetTransmit" + { + "windows64" "26" + "linux64" "27" + } + "ShouldCollide" + { + "windows64" "20" + "linux64" "21" + } + "Spawn" + { + "windows64" "28" + "linux64" "29" + } + "StartTouch" + { + "windows64" "122" + "linux64" "123" + } + "Think" + { + "windows64" "69" + "linux64" "70" + } + "Touch" + { + "windows64" "123" + "linux64" "124" + } + "TraceAttack" + { + "windows64" "84" + "linux64" "85" + } + "Use" + { + "windows64" "121" + "linux64" "122" + } + "VPhysicsUpdate" + { + "windows64" "178" + "linux64" "179" + } + "Weapon_CanSwitchTo" + { + "windows64" "316" + "linux64" "317" + } + "Weapon_CanUse" + { + "windows64" "310" + "linux64" "311" + } + "Weapon_Drop" + { + "windows64" "313" + "linux64" "314" + } + "Weapon_Equip" + { + "windows64" "311" + "linux64" "312" + } + "Weapon_Switch" + { + "windows64" "314" + "linux64" "315" + } + } + } + + "#default" + { + "Offsets" + { + "EntityListeners" + { + "windows64" "786488" + "linux64" "786488" + } + } + } +} diff --git a/gamedata/sdkhooks.games/master.games.txt b/gamedata/sdkhooks.games/master.games.txt index b54206b8..b8882df5 100644 --- a/gamedata/sdkhooks.games/master.games.txt +++ b/gamedata/sdkhooks.games/master.games.txt @@ -235,4 +235,8 @@ { "game" "ship" } + "game.l4d2outbreak.txt" + { + "game" "l4d2outbreak" + } } diff --git a/gamedata/sdktools.games/game.l4d2outbreak.txt b/gamedata/sdktools.games/game.l4d2outbreak.txt new file mode 100644 index 00000000..f3a4580b --- /dev/null +++ b/gamedata/sdktools.games/game.l4d2outbreak.txt @@ -0,0 +1,214 @@ +/** + * Do not edit this file. Any changes will be overwritten by the gamedata + * updater or by upgrading your SourceMod install. + * + * To override data in this file, create a subdirectory named "custom" and + * place your own gamedata file(s) inside of it. Such files will be parsed + * after SM's own. + * + * For more information, see http://wiki.alliedmods.net/Gamedata_Updating_(SourceMod) + */ + +"Games" +{ + /* Sounds */ + "#default" + { + "Keys" + { + "SlapSoundCount" "2" + "SlapSound1" "player/damage1.wav" + "SlapSound2" "player/damage2.wav" + } + } + + /* General Temp Entities */ + "#default" + { + "Offsets" + { + "GetTEName" + { + "windows64" "8" + "linux64" "8" + } + "GetTENext" + { + "windows64" "16" + "linux64" "16" + } + "TE_GetServerClass" + { + "windows64" "0" + "linux64" "0" + } + } + } + + /* CBaseEntityOutput::FireOutput */ + "#default" + { + "Signatures" + { + "FireOutput" + { + "library" "server" + "windows64" "\x48\x8B\xC4\x4C\x89\x40\x18\x48\x89\x50\x10\x48\x89\x48\x08\x57" + } + } + } + + /* SetUserInfo data */ + "#default" + { + "Offsets" + { + /** + * CBaseClient::SetUserCVar(char const*,char const*); + * Linux offset straight from VTable dump. + * Windows offset is crazy. Found the windows SetName function using string "(%d)%-.*s" (aD_S in IDA) + * Cross referenced back to the vtable and counted manually (SetUserCvar is 1 higher, offsets start from 1) + */ + "SetUserCvar" + { + "windows64" "30" + } + /** + * CBaseClient::SetName(char const*); + * Linux offset straight from VTable dump. + * Has string "(%d)%-0.*s" + */ + "SetClientName" + { + "windows64" "31" + } + /** + * Offset into CBaseClient - Used by CBaseServer::UpdateUserSettings to determine when changes have been made. + * Find CBaseClient::UpdateUserSettings (strings "net_maxroutable", "cl_updaterate" etc) and the offset is set to 0 near the end. + * Linux: mov byte ptr [esi+0B0h], 0 + * Win: mov byte ptr [esi+0B0h], 0 + * + * L4D2: This has been moved into CBaseClient::UpdateUserSettings(), rest of the details are still relevant. + */ + "InfoChanged" + { + "windows64" "416" + } + } + } + + "#default" + { + "Signatures" + { + /** + * CNetworkStringTableContainer::WriteBaselines + * "Index error writing string table baseline %s\n" + */ + "WriteBaselines" + { + "library" "engine" + "windows64" "\x48\x8B\xC4\x44\x89\x48\x20\x48\x81\xEC\xE8\x00\x00\x00" + } + } + } + + "#default" + { + "Offsets" + { + "SetOwnerEntity" + { + "windows64" "22" + "linux64" "23" + } + /* CTerrorPlayer::GiveNamedItem(char const*, int, bool, CBaseEntity*) */ + "GiveNamedItem" + { + "windows64" "490" + "linux64" "491" + } + "RemovePlayerItem" + { + "windows64" "325" + "linux64" "326" + } + "Weapon_GetSlot" + { + "windows64" "318" + "linux64" "319" + } + "Ignite" + { + "windows64" "249" + "linux64" "250" + } + "Extinguish" + { + "windows64" "252" + "linux64" "253" + } + "Teleport" + { + "windows64" "134" + "linux64" "135" + } + "CommitSuicide" + { + "windows64" "548" + "linux64" "548" + } + "GetVelocity" + { + "windows64" "162" + "linux64" "163" + } + "EyeAngles" + { + "windows64" "151" + "linux64" "152" + } + "AcceptInput" + { + "windows64" "50" + "linux64" "51" + } + "SetEntityModel" + { + "windows64" "31" + "linux64" "32" + } + "WeaponEquip" + { + "windows64" "311" + "linux64" "312" + } + "Activate" + { + "windows64" "42" + "linux64" "43" + } + "PlayerRunCmd" + { + "windows64" "515" + "linux64" "516" + } + "GiveAmmo" + { + "windows64" "304" + "linux64" "305" + } + "GetAttachment" + { + "windows64" "243" + "linux64" "244" + } + } + + "Keys" + { + "GameRulesProxy" "CTerrorGameRulesProxy" + "GameRulesDataTable" "terror_gamerules_data" + } + } +} diff --git a/gamedata/sdktools.games/master.games.txt b/gamedata/sdktools.games/master.games.txt index 6692f639..254cee9e 100644 --- a/gamedata/sdktools.games/master.games.txt +++ b/gamedata/sdktools.games/master.games.txt @@ -292,4 +292,8 @@ { "game" "tf2classified" } + "game.l4d2outbreak.txt" + { + "game" "l4d2outbreak" + } } diff --git a/hl2sdk-manifests b/hl2sdk-manifests index 931f7aa5..f7f2377c 160000 --- a/hl2sdk-manifests +++ b/hl2sdk-manifests @@ -1 +1 @@ -Subproject commit 931f7aa57823c3bcf34f1867e28d8d12769a8ba7 +Subproject commit f7f2377c7e586344dbfcbb58b4367e43fa4becd9 diff --git a/loader/loader.cpp b/loader/loader.cpp index c65db7d0..8235d880 100644 --- a/loader/loader.cpp +++ b/loader/loader.cpp @@ -88,6 +88,7 @@ #define FILENAME_1_6_MOCK PLATFORM_ARCH_FOLDER "sourcemod.2.mock" PLATFORM_EXT #define FILENAME_1_6_PVKII PLATFORM_ARCH_FOLDER "sourcemod.2.pvkii" PLATFORM_EXT #define FILENAME_1_6_MCV PLATFORM_ARCH_FOLDER "sourcemod.2.mcv" PLATFORM_EXT +#define FILENAME_1_6_OUTBREAK PLATFORM_ARCH_FOLDER "sourcemod.2.outbreak" PLATFORM_EXT HINSTANCE g_hCore = NULL; bool load_attempted = false; @@ -353,6 +354,11 @@ DLL_EXPORT METAMOD_PLUGIN *CreateInterface_MMS(const MetamodVersionInfo *mvi, co filename = FILENAME_1_6_MCV; break; } + case SOURCE_ENGINE_OUTBREAK: + { + filename = FILENAME_1_6_OUTBREAK; + break; + } default: { return NULL; diff --git a/plugins/basetriggers.sp b/plugins/basetriggers.sp index 56fc9adc..66227c1d 100644 --- a/plugins/basetriggers.sp +++ b/plugins/basetriggers.sp @@ -83,7 +83,7 @@ public void OnPluginStart() g_Cvar_TriggerShow = CreateConVar("sm_trigger_show", "0", "Display triggers message to all players? (0 off, 1 on, def. 0)", 0, true, 0.0, true, 1.0); g_Cvar_TimeleftInterval = CreateConVar("sm_timeleft_interval", "0.0", "Display timeleft every x seconds. Default 0.", 0, true, 0.0, true, 1800.0); - if (g_GameEngine == Engine_Left4Dead || g_GameEngine == Engine_Left4Dead2) + if (g_GameEngine == Engine_Left4Dead || g_GameEngine == Engine_Left4Dead2 || g_GameEngine == Engine_Outbreak) { g_Cvar_FriendlyFire = FindConVar("z_difficulty"); } @@ -528,7 +528,7 @@ void ShowFriendlyFire(int client, int who) { if (g_Cvar_FriendlyFire) { - if (g_GameEngine == Engine_Left4Dead || g_GameEngine == Engine_Left4Dead2) + if (g_GameEngine == Engine_Left4Dead || g_GameEngine == Engine_Left4Dead2 || g_GameEngine == Engine_Outbreak) { char buffer[50]; g_Cvar_FriendlyFire.GetString(buffer, sizeof(buffer)); // z_difficulty diff --git a/plugins/include/halflife.inc b/plugins/include/halflife.inc index 670a7be9..56804513 100644 --- a/plugins/include/halflife.inc +++ b/plugins/include/halflife.inc @@ -92,6 +92,9 @@ enum EngineVersion Engine_DOI, /**< Day of Infamy */ Engine_PVKII = 26, /**< Pirates, Vikings, and Knights II */ Engine_MCV, /**< Military Conflict: Vietnam */ + Engine_CS2, /**< Counter-Strike 2 */ + Engine_Deadlock, /**< Deadlock */ + Engine_Outbreak, /**< Outbreak */ }; enum FindMapResult diff --git a/plugins/nextmap.sp b/plugins/nextmap.sp index bbd0efb0..8aa5ebf2 100644 --- a/plugins/nextmap.sp +++ b/plugins/nextmap.sp @@ -63,6 +63,7 @@ public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max || StrEqual(game, "dystopia", false) || StrEqual(game, "synergy", false) || StrEqual(game, "left4dead2", false) + || StrEqual(game, "l4d2outbreak", false) || StrEqual(game, "garrysmod", false) || StrEqual(game, "swarm", false) || StrEqual(game, "reactivedrop", false) diff --git a/public/compat_wrappers.h b/public/compat_wrappers.h index 5eaf232b..aa80ef88 100644 --- a/public/compat_wrappers.h +++ b/public/compat_wrappers.h @@ -42,7 +42,8 @@ typedef int QueryCvarCookie_t; #if SOURCE_ENGINE >= SE_ORANGEBOX #define CONVAR_REGISTER(object) ConVar_Register(0, object) - inline bool IsFlagSet(ConCommandBase *cmd, int flag) + template + inline bool IsFlagSet(ConCommandBase *cmd, FlagType flag) { return cmd->IsFlagSet(flag); } @@ -74,7 +75,8 @@ typedef int QueryCvarCookie_t; static int MaxCommandLength() { return 512; } }; - inline bool IsFlagSet(ConCommandBase *cmd, int flag) + template + inline bool IsFlagSet(ConCommandBase *cmd, FlagType flag) { return cmd->IsBitSet(flag); }