Rename smcore to bridge, and use it as a pointer.
This commit is contained in:
parent
a2dac43833
commit
3d5c9f0e21
@ -328,7 +328,7 @@ void AdminCache::AddCommandOverride(const char *cmd, OverrideType type, FlagBits
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
map->insert(cmd, flags);
|
map->insert(cmd, flags);
|
||||||
smcore.UpdateAdminCmdFlags(cmd, type, flags, false);
|
bridge->UpdateAdminCmdFlags(cmd, type, flags, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AdminCache::GetCommandOverride(const char *cmd, OverrideType type, FlagBits *pFlags)
|
bool AdminCache::GetCommandOverride(const char *cmd, OverrideType type, FlagBits *pFlags)
|
||||||
@ -357,13 +357,13 @@ void AdminCache::UnsetCommandOverride(const char *cmd, OverrideType type)
|
|||||||
void AdminCache::_UnsetCommandGroupOverride(const char *group)
|
void AdminCache::_UnsetCommandGroupOverride(const char *group)
|
||||||
{
|
{
|
||||||
m_CmdGrpOverrides.remove(group);
|
m_CmdGrpOverrides.remove(group);
|
||||||
smcore.UpdateAdminCmdFlags(group, Override_CommandGroup, 0, true);
|
bridge->UpdateAdminCmdFlags(group, Override_CommandGroup, 0, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AdminCache::_UnsetCommandOverride(const char *cmd)
|
void AdminCache::_UnsetCommandOverride(const char *cmd)
|
||||||
{
|
{
|
||||||
m_CmdOverrides.remove(cmd);
|
m_CmdOverrides.remove(cmd);
|
||||||
smcore.UpdateAdminCmdFlags(cmd, Override_Command, 0, true);
|
bridge->UpdateAdminCmdFlags(cmd, Override_Command, 0, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AdminCache::DumpCommandOverrideCache(OverrideType type)
|
void AdminCache::DumpCommandOverrideCache(OverrideType type)
|
||||||
@ -1516,7 +1516,7 @@ bool AdminCache::CanAdminTarget(AdminId id, AdminId target)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Fourth, if the targeted admin is immune from targeting admin. */
|
/** Fourth, if the targeted admin is immune from targeting admin. */
|
||||||
int mode = smcore.GetImmunityMode();
|
int mode = bridge->GetImmunityMode();
|
||||||
switch (mode)
|
switch (mode)
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
@ -1653,7 +1653,7 @@ bool AdminCache::CanAdminUseCommand(int client, const char *cmd)
|
|||||||
cmd++;
|
cmd++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!smcore.LookForCommandAdminFlags(cmd, &bits))
|
if (!bridge->LookForCommandAdminFlags(cmd, &bits))
|
||||||
{
|
{
|
||||||
if (!GetCommandOverride(cmd, otype, &bits))
|
if (!GetCommandOverride(cmd, otype, &bits))
|
||||||
{
|
{
|
||||||
@ -1728,7 +1728,7 @@ bool AdminCache::CheckAccess(int client, const char *cmd, FlagBits flags, bool o
|
|||||||
bool found_command = false;
|
bool found_command = false;
|
||||||
if (!override_only)
|
if (!override_only)
|
||||||
{
|
{
|
||||||
found_command = smcore.LookForCommandAdminFlags(cmd, &bits);
|
found_command = bridge->LookForCommandAdminFlags(cmd, &bits);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!found_command)
|
if (!found_command)
|
||||||
|
@ -79,7 +79,7 @@ CLocalExtension::CLocalExtension(const char *filename)
|
|||||||
PLATFORM_MAX_PATH,
|
PLATFORM_MAX_PATH,
|
||||||
"extensions/%s.%s." PLATFORM_LIB_EXT,
|
"extensions/%s.%s." PLATFORM_LIB_EXT,
|
||||||
filename,
|
filename,
|
||||||
smcore.gamesuffix);
|
bridge->gamesuffix);
|
||||||
|
|
||||||
if (libsys->IsPathFile(path))
|
if (libsys->IsPathFile(path))
|
||||||
{
|
{
|
||||||
@ -87,9 +87,9 @@ CLocalExtension::CLocalExtension(const char *filename)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* COMPAT HACK: One-halfth, if ep2v, see if there is an engine specific build in the new place with old naming */
|
/* COMPAT HACK: One-halfth, if ep2v, see if there is an engine specific build in the new place with old naming */
|
||||||
if (strcmp(smcore.gamesuffix, "2.tf2") == 0
|
if (strcmp(bridge->gamesuffix, "2.tf2") == 0
|
||||||
|| strcmp(smcore.gamesuffix, "2.dods") == 0
|
|| strcmp(bridge->gamesuffix, "2.dods") == 0
|
||||||
|| strcmp(smcore.gamesuffix, "2.hl2dm") == 0
|
|| strcmp(bridge->gamesuffix, "2.hl2dm") == 0
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
g_pSM->BuildPath(Path_SM,
|
g_pSM->BuildPath(Path_SM,
|
||||||
@ -103,7 +103,7 @@ CLocalExtension::CLocalExtension(const char *filename)
|
|||||||
goto found;
|
goto found;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (strcmp(smcore.gamesuffix, "2.nd") == 0)
|
else if (strcmp(bridge->gamesuffix, "2.nd") == 0)
|
||||||
{
|
{
|
||||||
g_pSM->BuildPath(Path_SM,
|
g_pSM->BuildPath(Path_SM,
|
||||||
path,
|
path,
|
||||||
@ -123,7 +123,7 @@ CLocalExtension::CLocalExtension(const char *filename)
|
|||||||
PLATFORM_MAX_PATH,
|
PLATFORM_MAX_PATH,
|
||||||
"extensions/auto.%s/%s." PLATFORM_LIB_EXT,
|
"extensions/auto.%s/%s." PLATFORM_LIB_EXT,
|
||||||
filename,
|
filename,
|
||||||
smcore.gamesuffix);
|
bridge->gamesuffix);
|
||||||
|
|
||||||
/* Try the "normal" version */
|
/* Try the "normal" version */
|
||||||
if (!libsys->IsPathFile(path))
|
if (!libsys->IsPathFile(path))
|
||||||
@ -192,7 +192,7 @@ bool CLocalExtension::Load(char *error, size_t maxlength)
|
|||||||
if (m_pAPI->IsMetamodExtension())
|
if (m_pAPI->IsMetamodExtension())
|
||||||
{
|
{
|
||||||
bool ok;
|
bool ok;
|
||||||
m_PlId = smcore.LoadMMSPlugin(m_Path.c_str(), &ok, error, maxlength);
|
m_PlId = bridge->LoadMMSPlugin(m_Path.c_str(), &ok, error, maxlength);
|
||||||
|
|
||||||
if (!m_PlId || !ok)
|
if (!m_PlId || !ok)
|
||||||
{
|
{
|
||||||
@ -209,7 +209,7 @@ bool CLocalExtension::Load(char *error, size_t maxlength)
|
|||||||
{
|
{
|
||||||
if (m_PlId)
|
if (m_PlId)
|
||||||
{
|
{
|
||||||
smcore.UnloadMMSPlugin(m_PlId);
|
bridge->UnloadMMSPlugin(m_PlId);
|
||||||
m_PlId = 0;
|
m_PlId = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -230,7 +230,7 @@ void CLocalExtension::Unload()
|
|||||||
{
|
{
|
||||||
if (m_pAPI != NULL && m_PlId)
|
if (m_pAPI != NULL && m_PlId)
|
||||||
{
|
{
|
||||||
smcore.UnloadMMSPlugin(m_PlId);
|
bridge->UnloadMMSPlugin(m_PlId);
|
||||||
m_PlId = 0;
|
m_PlId = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -293,7 +293,7 @@ bool CExtension::PerformAPICheck(char *error, size_t maxlength)
|
|||||||
bool CExtension::Load(char *error, size_t maxlength)
|
bool CExtension::Load(char *error, size_t maxlength)
|
||||||
{
|
{
|
||||||
CreateIdentity();
|
CreateIdentity();
|
||||||
if (!m_pAPI->OnExtensionLoad(this, &g_ShareSys, error, maxlength, !smcore.IsMapLoading()))
|
if (!m_pAPI->OnExtensionLoad(this, &g_ShareSys, error, maxlength, !bridge->IsMapLoading()))
|
||||||
{
|
{
|
||||||
DestroyIdentity();
|
DestroyIdentity();
|
||||||
return false;
|
return false;
|
||||||
@ -301,7 +301,7 @@ bool CExtension::Load(char *error, size_t maxlength)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Check if we're past load time */
|
/* Check if we're past load time */
|
||||||
if (!smcore.IsMapLoading())
|
if (!bridge->IsMapLoading())
|
||||||
{
|
{
|
||||||
m_pAPI->OnExtensionsAllLoaded();
|
m_pAPI->OnExtensionsAllLoaded();
|
||||||
}
|
}
|
||||||
|
@ -151,7 +151,7 @@ CGameConfig::CGameConfig(const char *file, const char *engine)
|
|||||||
m_CustomHandler = NULL;
|
m_CustomHandler = NULL;
|
||||||
|
|
||||||
if (!engine)
|
if (!engine)
|
||||||
m_pEngine = smcore.GetSourceEngineName();
|
m_pEngine = bridge->GetSourceEngineName();
|
||||||
else
|
else
|
||||||
m_pEngine = engine;
|
m_pEngine = engine;
|
||||||
|
|
||||||
@ -548,11 +548,11 @@ SMCResult CGameConfig::ReadSMC_LeavingSection(const SMCStates *states)
|
|||||||
void *addrInBase = NULL;
|
void *addrInBase = NULL;
|
||||||
if (strcmp(s_TempSig.library, "server") == 0)
|
if (strcmp(s_TempSig.library, "server") == 0)
|
||||||
{
|
{
|
||||||
addrInBase = smcore.serverFactory;
|
addrInBase = bridge->serverFactory;
|
||||||
} else if (strcmp(s_TempSig.library, "engine") == 0) {
|
} else if (strcmp(s_TempSig.library, "engine") == 0) {
|
||||||
addrInBase = smcore.engineFactory;
|
addrInBase = bridge->engineFactory;
|
||||||
} else if (strcmp(s_TempSig.library, "matchmaking_ds") == 0) {
|
} else if (strcmp(s_TempSig.library, "matchmaking_ds") == 0) {
|
||||||
addrInBase = smcore.matchmakingDSFactory;
|
addrInBase = bridge->matchmakingDSFactory;
|
||||||
}
|
}
|
||||||
void *final_addr = NULL;
|
void *final_addr = NULL;
|
||||||
if (addrInBase == NULL)
|
if (addrInBase == NULL)
|
||||||
@ -580,7 +580,7 @@ SMCResult CGameConfig::ReadSMC_LeavingSection(const SMCStates *states)
|
|||||||
void *handle = dlopen(info.dli_fname, RTLD_NOW);
|
void *handle = dlopen(info.dli_fname, RTLD_NOW);
|
||||||
if (handle)
|
if (handle)
|
||||||
{
|
{
|
||||||
if (smcore.SymbolsAreHidden())
|
if (bridge->SymbolsAreHidden())
|
||||||
final_addr = g_MemUtils.ResolveSymbol(handle, &s_TempSig.sig[1]);
|
final_addr = g_MemUtils.ResolveSymbol(handle, &s_TempSig.sig[1]);
|
||||||
else
|
else
|
||||||
final_addr = dlsym(handle, &s_TempSig.sig[1]);
|
final_addr = dlsym(handle, &s_TempSig.sig[1]);
|
||||||
@ -1039,8 +1039,8 @@ void GameConfigManager::OnSourceModStartup(bool late)
|
|||||||
LoadGameConfigFile("core.games", &g_pGameConf, NULL, 0);
|
LoadGameConfigFile("core.games", &g_pGameConf, NULL, 0);
|
||||||
|
|
||||||
strncopy(g_Game, g_pSM->GetGameFolderName(), sizeof(g_Game));
|
strncopy(g_Game, g_pSM->GetGameFolderName(), sizeof(g_Game));
|
||||||
strncopy(g_GameDesc + 1, smcore.GetGameDescription(), sizeof(g_GameDesc) - 1);
|
strncopy(g_GameDesc + 1, bridge->GetGameDescription(), sizeof(g_GameDesc) - 1);
|
||||||
smcore.GetGameName(g_GameName + 1, sizeof(g_GameName) - 1);
|
bridge->GetGameName(g_GameName + 1, sizeof(g_GameName) - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameConfigManager::OnSourceModAllInitialized()
|
void GameConfigManager::OnSourceModAllInitialized()
|
||||||
|
@ -262,7 +262,7 @@ void Logger::LogToOpenFileEx(FILE *fp, const char *msg, va_list ap)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ConVar *sv_logecho = smcore.FindConVar("sv_logecho");
|
static ConVar *sv_logecho = bridge->FindConVar("sv_logecho");
|
||||||
|
|
||||||
char buffer[3072];
|
char buffer[3072];
|
||||||
ke::SafeVsprintf(buffer, sizeof(buffer), msg, ap);
|
ke::SafeVsprintf(buffer, sizeof(buffer), msg, ap);
|
||||||
@ -274,11 +274,11 @@ void Logger::LogToOpenFileEx(FILE *fp, const char *msg, va_list ap)
|
|||||||
|
|
||||||
fprintf(fp, "L %s: %s\n", date, buffer);
|
fprintf(fp, "L %s: %s\n", date, buffer);
|
||||||
|
|
||||||
if (!sv_logecho || smcore.GetCvarBool(sv_logecho))
|
if (!sv_logecho || bridge->GetCvarBool(sv_logecho))
|
||||||
{
|
{
|
||||||
static char conBuffer[4096];
|
static char conBuffer[4096];
|
||||||
ke::SafeSprintf(conBuffer, sizeof(conBuffer), "L %s: %s\n", date, buffer);
|
ke::SafeSprintf(conBuffer, sizeof(conBuffer), "L %s: %s\n", date, buffer);
|
||||||
smcore.ConPrint(conBuffer);
|
bridge->ConPrint(conBuffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -475,7 +475,7 @@ void Logger::_PrintToGameLog(const char *fmt, va_list ap)
|
|||||||
msg[len++] = '\n';
|
msg[len++] = '\n';
|
||||||
msg[len] = '\0';
|
msg[len] = '\0';
|
||||||
|
|
||||||
smcore.LogToGame(msg);
|
bridge->LogToGame(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *Logger::GetLogFileName(LogType type) const
|
const char *Logger::GetLogFileName(LogType type) const
|
||||||
|
@ -374,7 +374,7 @@ void CPlugin::Call_OnAllPluginsLoaded()
|
|||||||
pFunction->Execute(&result);
|
pFunction->Execute(&result);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (smcore.IsMapRunning())
|
if (bridge->IsMapRunning())
|
||||||
{
|
{
|
||||||
if ((pFunction = m_pRuntime->GetFunctionByName("OnMapStart")) != NULL)
|
if ((pFunction = m_pRuntime->GetFunctionByName("OnMapStart")) != NULL)
|
||||||
{
|
{
|
||||||
@ -382,9 +382,9 @@ void CPlugin::Call_OnAllPluginsLoaded()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (smcore.AreConfigsExecuted())
|
if (bridge->AreConfigsExecuted())
|
||||||
{
|
{
|
||||||
smcore.ExecuteConfigs(GetBaseContext());
|
bridge->ExecuteConfigs(GetBaseContext());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1801,7 +1801,7 @@ bool CPluginManager::TestAliasMatch(const char *alias, const char *localpath)
|
|||||||
|
|
||||||
bool CPluginManager::IsLateLoadTime() const
|
bool CPluginManager::IsLateLoadTime() const
|
||||||
{
|
{
|
||||||
return (m_AllPluginsLoaded || !smcore.IsMapLoading());
|
return (m_AllPluginsLoaded || !bridge->IsMapLoading());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPluginManager::OnSourceModAllInitialized()
|
void CPluginManager::OnSourceModAllInitialized()
|
||||||
@ -2275,7 +2275,7 @@ void CPluginManager::OnRootConsoleCommand(const char *cmdname, const ICommandArg
|
|||||||
else if (strcmp(cmd, "refresh") == 0)
|
else if (strcmp(cmd, "refresh") == 0)
|
||||||
{
|
{
|
||||||
RefreshAll();
|
RefreshAll();
|
||||||
smcore.DoGlobalPluginLoads();
|
bridge->DoGlobalPluginLoads();
|
||||||
rootmenu->ConsolePrint("[SM] The plugin list has been refreshed and reloaded.");
|
rootmenu->ConsolePrint("[SM] The plugin list has been refreshed and reloaded.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -65,7 +65,7 @@ void RootConsoleMenu::ConsolePrint(const char *fmt, ...)
|
|||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
smcore.ConsolePrintVa(fmt, ap);
|
bridge->ConsolePrintVa(fmt, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -737,7 +737,7 @@ void Translator::OnSourceModAllInitialized()
|
|||||||
{
|
{
|
||||||
AddLanguage("en", "English");
|
AddLanguage("en", "English");
|
||||||
|
|
||||||
const char* lang = smcore.GetCoreConfigValue("ServerLang");
|
const char* lang = bridge->GetCoreConfigValue("ServerLang");
|
||||||
if (lang)
|
if (lang)
|
||||||
{
|
{
|
||||||
strncpy(m_InitialLang, lang, sizeof(m_InitialLang));
|
strncpy(m_InitialLang, lang, sizeof(m_InitialLang));
|
||||||
|
@ -55,30 +55,32 @@
|
|||||||
#include "LibrarySys.h"
|
#include "LibrarySys.h"
|
||||||
#include "RootConsoleMenu.h"
|
#include "RootConsoleMenu.h"
|
||||||
|
|
||||||
sm_core_t smcore;
|
|
||||||
IHandleSys *handlesys = &g_HandleSys;
|
|
||||||
IdentityToken_t *g_pCoreIdent;
|
|
||||||
SMGlobalClass *SMGlobalClass::head = NULL;
|
SMGlobalClass *SMGlobalClass::head = NULL;
|
||||||
ISourceMod *g_pSM;
|
|
||||||
|
CoreProvider *bridge = nullptr;
|
||||||
|
ISourceMod *g_pSM = nullptr;
|
||||||
|
IVEngineServer *engine = nullptr;
|
||||||
|
IdentityToken_t *g_pCoreIdent = nullptr;
|
||||||
|
ITimerSystem *timersys = nullptr;
|
||||||
|
IGameHelpers *gamehelpers = nullptr;
|
||||||
|
IMenuManager *menus = nullptr;
|
||||||
|
IPlayerManager *playerhelpers = nullptr;
|
||||||
|
|
||||||
|
IHandleSys *handlesys = &g_HandleSys;
|
||||||
ILibrarySys *libsys = &g_LibSys;
|
ILibrarySys *libsys = &g_LibSys;
|
||||||
ITextParsers *textparser = &g_TextParser;
|
ITextParsers *textparser = &g_TextParser;
|
||||||
IVEngineServer *engine;
|
|
||||||
IShareSys *sharesys = &g_ShareSys;
|
IShareSys *sharesys = &g_ShareSys;
|
||||||
IRootConsole *rootmenu = &g_RootMenu;
|
IRootConsole *rootmenu = &g_RootMenu;
|
||||||
IPluginManager *pluginsys = g_PluginSys.GetOldAPI();
|
IPluginManager *pluginsys = g_PluginSys.GetOldAPI();
|
||||||
IForwardManager *forwardsys = &g_Forwards;
|
IForwardManager *forwardsys = &g_Forwards;
|
||||||
ITimerSystem *timersys;
|
|
||||||
ServerGlobals serverGlobals;
|
ServerGlobals serverGlobals;
|
||||||
IPlayerManager *playerhelpers;
|
|
||||||
IAdminSystem *adminsys = &g_Admins;
|
IAdminSystem *adminsys = &g_Admins;
|
||||||
IGameHelpers *gamehelpers;
|
|
||||||
ISourcePawnEngine *g_pSourcePawn;
|
ISourcePawnEngine *g_pSourcePawn;
|
||||||
ISourcePawnEngine2 *g_pSourcePawn2;
|
ISourcePawnEngine2 *g_pSourcePawn2;
|
||||||
CNativeOwner g_CoreNatives;
|
|
||||||
IScriptManager *scripts = &g_PluginSys;
|
IScriptManager *scripts = &g_PluginSys;
|
||||||
IExtensionSys *extsys = &g_Extensions;
|
IExtensionSys *extsys = &g_Extensions;
|
||||||
ILogger *logger = &g_Logger;
|
ILogger *logger = &g_Logger;
|
||||||
IMenuManager *menus;
|
CNativeOwner g_CoreNatives;
|
||||||
|
|
||||||
static void AddCorePhraseFile(const char *filename)
|
static void AddCorePhraseFile(const char *filename)
|
||||||
{
|
{
|
||||||
@ -159,11 +161,11 @@ static sm_logic_t logic =
|
|||||||
-1.0f
|
-1.0f
|
||||||
};
|
};
|
||||||
|
|
||||||
static void logic_init(const sm_core_t* core, sm_logic_t* _logic)
|
static void logic_init(CoreProvider* core, sm_logic_t* _logic)
|
||||||
{
|
{
|
||||||
logic.head = SMGlobalClass::head;
|
logic.head = SMGlobalClass::head;
|
||||||
|
|
||||||
memcpy(&smcore, core, sizeof(sm_core_t));
|
bridge = core;
|
||||||
memcpy(_logic, &logic, sizeof(sm_logic_t));
|
memcpy(_logic, &logic, sizeof(sm_logic_t));
|
||||||
memcpy(&serverGlobals, core->serverGlobals, sizeof(ServerGlobals));
|
memcpy(&serverGlobals, core->serverGlobals, sizeof(ServerGlobals));
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
#include "../sm_globals.h"
|
#include "../sm_globals.h"
|
||||||
#include "intercom.h"
|
#include "intercom.h"
|
||||||
|
|
||||||
extern sm_core_t smcore;
|
extern CoreProvider *bridge;
|
||||||
extern IHandleSys *handlesys;
|
extern IHandleSys *handlesys;
|
||||||
extern ISourceMod *g_pSM;
|
extern ISourceMod *g_pSM;
|
||||||
extern ILibrarySys *libsys;
|
extern ILibrarySys *libsys;
|
||||||
|
@ -52,7 +52,7 @@ using namespace SourceHook;
|
|||||||
* Add 1 to the RHS of this expression to bump the intercom file
|
* Add 1 to the RHS of this expression to bump the intercom file
|
||||||
* This is to prevent mismatching core/logic binaries
|
* This is to prevent mismatching core/logic binaries
|
||||||
*/
|
*/
|
||||||
#define SM_LOGIC_MAGIC (0x0F47C0DE - 39)
|
#define SM_LOGIC_MAGIC (0x0F47C0DE - 40)
|
||||||
|
|
||||||
#if defined SM_LOGIC
|
#if defined SM_LOGIC
|
||||||
class IVEngineServer
|
class IVEngineServer
|
||||||
@ -275,8 +275,9 @@ private:
|
|||||||
const CVector<IExtension *> *list_;
|
const CVector<IExtension *> *list_;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct sm_core_t
|
class CoreProvider
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
/* Objects */
|
/* Objects */
|
||||||
ISourceMod *sm;
|
ISourceMod *sm;
|
||||||
IVEngineServer *engine;
|
IVEngineServer *engine;
|
||||||
@ -357,7 +358,7 @@ struct sm_logic_t
|
|||||||
float sentinel;
|
float sentinel;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef void (*LogicInitFunction)(const sm_core_t *core, sm_logic_t *logic);
|
typedef void (*LogicInitFunction)(CoreProvider *core, sm_logic_t *logic);
|
||||||
typedef LogicInitFunction (*LogicLoadFunction)(uint32_t magic);
|
typedef LogicInitFunction (*LogicLoadFunction)(uint32_t magic);
|
||||||
typedef ITextParsers *(*GetITextParsers)();
|
typedef ITextParsers *(*GetITextParsers)();
|
||||||
|
|
||||||
|
@ -271,7 +271,7 @@ static cell_t BanClient(IPluginContext *pContext, const cell_t *params)
|
|||||||
ban_source = params[7];
|
ban_source = params[7];
|
||||||
|
|
||||||
/* Check how we should ban the player */
|
/* Check how we should ban the player */
|
||||||
if (!strcmp(smcore.GetSourceEngineName(), "darkmessiah"))
|
if (!strcmp(bridge->GetSourceEngineName(), "darkmessiah"))
|
||||||
{
|
{
|
||||||
/* Dark Messiah doesn't have Steam IDs so there is only one ban method to choose */
|
/* Dark Messiah doesn't have Steam IDs so there is only one ban method to choose */
|
||||||
ban_flags |= BANFLAG_IP;
|
ban_flags |= BANFLAG_IP;
|
||||||
|
@ -52,7 +52,7 @@ static cell_t CheckCommandAccess(IPluginContext *pContext, const cell_t *params)
|
|||||||
bool found_command = false;
|
bool found_command = false;
|
||||||
if (params[0] < 4 || !params[4])
|
if (params[0] < 4 || !params[4])
|
||||||
{
|
{
|
||||||
found_command = smcore.LookForCommandAdminFlags(cmd, &bits);
|
found_command = bridge->LookForCommandAdminFlags(cmd, &bits);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!found_command)
|
if (!found_command)
|
||||||
@ -73,7 +73,7 @@ static cell_t CheckAccess(IPluginContext *pContext, const cell_t *params)
|
|||||||
bool found_command = false;
|
bool found_command = false;
|
||||||
if (params[0] < 4 || !params[4])
|
if (params[0] < 4 || !params[4])
|
||||||
{
|
{
|
||||||
found_command = smcore.LookForCommandAdminFlags(cmd, &bits);
|
found_command = bridge->LookForCommandAdminFlags(cmd, &bits);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!found_command)
|
if (!found_command)
|
||||||
@ -96,7 +96,7 @@ static cell_t sm_PrintToServer(IPluginContext *pCtx, const cell_t *params)
|
|||||||
buffer[res++] = '\n';
|
buffer[res++] = '\n';
|
||||||
buffer[res] = '\0';
|
buffer[res] = '\0';
|
||||||
|
|
||||||
smcore.ConPrint(buffer);
|
bridge->ConPrint(buffer);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -140,7 +140,7 @@ static cell_t sm_PrintToConsole(IPluginContext *pCtx, const cell_t *params)
|
|||||||
pPlayer->PrintToConsole(buffer);
|
pPlayer->PrintToConsole(buffer);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
smcore.ConPrint(buffer);
|
bridge->ConPrint(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
@ -277,7 +277,7 @@ static cell_t ReplyToCommand(IPluginContext *pContext, const cell_t *params)
|
|||||||
/* Print */
|
/* Print */
|
||||||
buffer[len++] = '\n';
|
buffer[len++] = '\n';
|
||||||
buffer[len] = '\0';
|
buffer[len] = '\0';
|
||||||
smcore.ConPrint(buffer);
|
bridge->ConPrint(buffer);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ public:
|
|||||||
Param_Cell,
|
Param_Cell,
|
||||||
Param_String);
|
Param_String);
|
||||||
|
|
||||||
sm_datetime_format = smcore.FindConVar("sm_datetime_format");
|
sm_datetime_format = bridge->FindConVar("sm_datetime_format");
|
||||||
}
|
}
|
||||||
void OnHandleDestroy(HandleType_t type, void *object)
|
void OnHandleDestroy(HandleType_t type, void *object)
|
||||||
{
|
{
|
||||||
@ -173,7 +173,7 @@ static cell_t FormatTime(IPluginContext *pContext, const cell_t *params)
|
|||||||
|
|
||||||
if (format == NULL)
|
if (format == NULL)
|
||||||
{
|
{
|
||||||
format = const_cast<char *>(smcore.GetCvarString(sm_datetime_format));
|
format = const_cast<char *>(bridge->GetCvarString(sm_datetime_format));
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined SUBPLATFORM_SECURECRT
|
#if defined SUBPLATFORM_SECURECRT
|
||||||
|
@ -1405,7 +1405,7 @@ static cell_t SQL_ConnectCustom(IPluginContext *pContext, const cell_t *params)
|
|||||||
err);
|
err);
|
||||||
}
|
}
|
||||||
|
|
||||||
DatabaseInfo info = smcore.GetDBInfoFromKeyValues(kv);
|
DatabaseInfo info = bridge->GetDBInfoFromKeyValues(kv);
|
||||||
|
|
||||||
IDBDriver *driver;
|
IDBDriver *driver;
|
||||||
if (info.driver[0] == '\0' || strcmp(info.driver, "default") == 0)
|
if (info.driver[0] == '\0' || strcmp(info.driver, "default") == 0)
|
||||||
|
@ -99,54 +99,54 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
static ValveFile *Open(const char *filename, const char *mode, const char *pathID) {
|
static ValveFile *Open(const char *filename, const char *mode, const char *pathID) {
|
||||||
FileHandle_t handle = smcore.filesystem->Open(filename, mode, pathID);
|
FileHandle_t handle = bridge->filesystem->Open(filename, mode, pathID);
|
||||||
if (!handle)
|
if (!handle)
|
||||||
return NULL;
|
return NULL;
|
||||||
return new ValveFile(handle);
|
return new ValveFile(handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool Delete(const char *filename, const char *pathID) {
|
static bool Delete(const char *filename, const char *pathID) {
|
||||||
if (!smcore.filesystem->FileExists(filename, pathID))
|
if (!bridge->filesystem->FileExists(filename, pathID))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
smcore.filesystem->RemoveFile(filename, pathID);
|
bridge->filesystem->RemoveFile(filename, pathID);
|
||||||
|
|
||||||
if (smcore.filesystem->FileExists(filename, pathID))
|
if (bridge->filesystem->FileExists(filename, pathID))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t Read(void *pOut, int size) override {
|
size_t Read(void *pOut, int size) override {
|
||||||
return (size_t)smcore.filesystem->Read(pOut, size, handle_);
|
return (size_t)bridge->filesystem->Read(pOut, size, handle_);
|
||||||
}
|
}
|
||||||
char *ReadLine(char *pOut, int size) override {
|
char *ReadLine(char *pOut, int size) override {
|
||||||
return smcore.filesystem->ReadLine(pOut, size, handle_);
|
return bridge->filesystem->ReadLine(pOut, size, handle_);
|
||||||
}
|
}
|
||||||
size_t Write(const void *pData, int size) override {
|
size_t Write(const void *pData, int size) override {
|
||||||
return (size_t)smcore.filesystem->Write(pData, size, handle_);
|
return (size_t)bridge->filesystem->Write(pData, size, handle_);
|
||||||
}
|
}
|
||||||
bool Seek(int pos, int seek_type) override {
|
bool Seek(int pos, int seek_type) override {
|
||||||
smcore.filesystem->Seek(handle_, pos, seek_type);
|
bridge->filesystem->Seek(handle_, pos, seek_type);
|
||||||
return !HasError();
|
return !HasError();
|
||||||
}
|
}
|
||||||
int Tell() override {
|
int Tell() override {
|
||||||
return smcore.filesystem->Tell(handle_);
|
return bridge->filesystem->Tell(handle_);
|
||||||
}
|
}
|
||||||
bool HasError() override {
|
bool HasError() override {
|
||||||
return !handle_ || !smcore.filesystem->IsOk(handle_);
|
return !handle_ || !bridge->filesystem->IsOk(handle_);
|
||||||
}
|
}
|
||||||
bool Flush() override {
|
bool Flush() override {
|
||||||
smcore.filesystem->Flush(handle_);
|
bridge->filesystem->Flush(handle_);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
bool EndOfFile() override {
|
bool EndOfFile() override {
|
||||||
return smcore.filesystem->EndOfFile(handle_);
|
return bridge->filesystem->EndOfFile(handle_);
|
||||||
}
|
}
|
||||||
void Close() override {
|
void Close() override {
|
||||||
if (!handle_)
|
if (!handle_)
|
||||||
return;
|
return;
|
||||||
smcore.filesystem->Close(handle_);
|
bridge->filesystem->Close(handle_);
|
||||||
handle_ = NULL;
|
handle_ = NULL;
|
||||||
}
|
}
|
||||||
virtual ValveFile *AsValveFile() {
|
virtual ValveFile *AsValveFile() {
|
||||||
@ -272,7 +272,7 @@ public:
|
|||||||
else if (type == g_ValveDirType)
|
else if (type == g_ValveDirType)
|
||||||
{
|
{
|
||||||
ValveDirectory *valveDir = (ValveDirectory *)object;
|
ValveDirectory *valveDir = (ValveDirectory *)object;
|
||||||
smcore.filesystem->FindClose(valveDir->hndl);
|
bridge->filesystem->FindClose(valveDir->hndl);
|
||||||
delete valveDir;
|
delete valveDir;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -330,7 +330,7 @@ static cell_t sm_OpenDirectory(IPluginContext *pContext, const cell_t *params)
|
|||||||
|
|
||||||
ValveDirectory *valveDir = new ValveDirectory;
|
ValveDirectory *valveDir = new ValveDirectory;
|
||||||
|
|
||||||
const char *pFirst = smcore.filesystem->FindFirstEx(wildcardedPath, pathID, &valveDir->hndl);
|
const char *pFirst = bridge->filesystem->FindFirstEx(wildcardedPath, pathID, &valveDir->hndl);
|
||||||
if (!pFirst)
|
if (!pFirst)
|
||||||
{
|
{
|
||||||
delete valveDir;
|
delete valveDir;
|
||||||
@ -419,7 +419,7 @@ static cell_t sm_ReadDirEntry(IPluginContext *pContext, const cell_t *params)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pEntry = smcore.filesystem->FindNext(valveDir->hndl);
|
pEntry = bridge->filesystem->FindNext(valveDir->hndl);
|
||||||
}
|
}
|
||||||
|
|
||||||
valveDir->bHandledFirstPath = true;
|
valveDir->bHandledFirstPath = true;
|
||||||
@ -443,7 +443,7 @@ static cell_t sm_ReadDirEntry(IPluginContext *pContext, const cell_t *params)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (smcore.filesystem->FindIsDirectory(valveDir->hndl))
|
if (bridge->filesystem->FindIsDirectory(valveDir->hndl))
|
||||||
{
|
{
|
||||||
*filetype = 1;
|
*filetype = 1;
|
||||||
} else {
|
} else {
|
||||||
@ -557,7 +557,7 @@ static cell_t sm_FileExists(IPluginContext *pContext, const cell_t *params)
|
|||||||
if (params[0] >= 3)
|
if (params[0] >= 3)
|
||||||
pContext->LocalToStringNULL(params[3], &pathID);
|
pContext->LocalToStringNULL(params[3], &pathID);
|
||||||
|
|
||||||
return smcore.filesystem->FileExists(name, pathID) ? 1 : 0;
|
return bridge->filesystem->FileExists(name, pathID) ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
char realpath[PLATFORM_MAX_PATH];
|
char realpath[PLATFORM_MAX_PATH];
|
||||||
@ -598,7 +598,7 @@ static cell_t sm_RenameFile(IPluginContext *pContext, const cell_t *params)
|
|||||||
char *pathID;
|
char *pathID;
|
||||||
pContext->LocalToStringNULL(params[4], &pathID);
|
pContext->LocalToStringNULL(params[4], &pathID);
|
||||||
|
|
||||||
smcore.filesystem->RenameFile(oldpath, newpath, pathID);
|
bridge->filesystem->RenameFile(oldpath, newpath, pathID);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -629,7 +629,7 @@ static cell_t sm_DirExists(IPluginContext *pContext, const cell_t *params)
|
|||||||
char *pathID;
|
char *pathID;
|
||||||
pContext->LocalToStringNULL(params[3], &pathID);
|
pContext->LocalToStringNULL(params[3], &pathID);
|
||||||
|
|
||||||
return smcore.filesystem->IsDirectory(name, pathID) ? 1 : 0;
|
return bridge->filesystem->IsDirectory(name, pathID) ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
char realpath[PLATFORM_MAX_PATH];
|
char realpath[PLATFORM_MAX_PATH];
|
||||||
@ -671,9 +671,9 @@ static cell_t sm_FileSize(IPluginContext *pContext, const cell_t *params)
|
|||||||
if (params[0] >= 3)
|
if (params[0] >= 3)
|
||||||
pContext->LocalToStringNULL(params[3], &pathID);
|
pContext->LocalToStringNULL(params[3], &pathID);
|
||||||
|
|
||||||
if (!smcore.filesystem->FileExists(name, pathID))
|
if (!bridge->filesystem->FileExists(name, pathID))
|
||||||
return -1;
|
return -1;
|
||||||
return smcore.filesystem->Size(name, pathID);
|
return bridge->filesystem->Size(name, pathID);
|
||||||
}
|
}
|
||||||
|
|
||||||
char realpath[PLATFORM_MAX_PATH];
|
char realpath[PLATFORM_MAX_PATH];
|
||||||
@ -730,12 +730,12 @@ static cell_t sm_CreateDirectory(IPluginContext *pContext, const cell_t *params)
|
|||||||
char *pathID;
|
char *pathID;
|
||||||
pContext->LocalToStringNULL(params[4], &pathID);
|
pContext->LocalToStringNULL(params[4], &pathID);
|
||||||
|
|
||||||
if (smcore.filesystem->IsDirectory(name, pathID))
|
if (bridge->filesystem->IsDirectory(name, pathID))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
smcore.filesystem->CreateDirHierarchy(name, pathID);
|
bridge->filesystem->CreateDirHierarchy(name, pathID);
|
||||||
|
|
||||||
if (smcore.filesystem->IsDirectory(name, pathID))
|
if (bridge->filesystem->IsDirectory(name, pathID))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -783,8 +783,8 @@ static cell_t sm_WriteFileLine(IPluginContext *pContext, const cell_t *params)
|
|||||||
if (SystemFile *sysfile = file->AsSystemFile()) {
|
if (SystemFile *sysfile = file->AsSystemFile()) {
|
||||||
fprintf(sysfile->fp(), "%s\n", buffer);
|
fprintf(sysfile->fp(), "%s\n", buffer);
|
||||||
} else if (ValveFile *vfile = file->AsValveFile()) {
|
} else if (ValveFile *vfile = file->AsValveFile()) {
|
||||||
smcore.filesystem->FPrint(vfile->handle(), buffer);
|
bridge->filesystem->FPrint(vfile->handle(), buffer);
|
||||||
smcore.filesystem->FPrint(vfile->handle(), "\n");
|
bridge->filesystem->FPrint(vfile->handle(), "\n");
|
||||||
} else {
|
} else {
|
||||||
assert(false);
|
assert(false);
|
||||||
}
|
}
|
||||||
@ -840,7 +840,7 @@ static cell_t sm_LogToGame(IPluginContext *pContext, const cell_t *params)
|
|||||||
buffer[len] = '\0';
|
buffer[len] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
smcore.LogToGame(buffer);
|
bridge->LogToGame(buffer);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -87,13 +87,13 @@ public:
|
|||||||
}
|
}
|
||||||
void GetMapCycleFilePath(char *pBuffer, int maxlen)
|
void GetMapCycleFilePath(char *pBuffer, int maxlen)
|
||||||
{
|
{
|
||||||
const char *pMapCycleFileName = m_pMapCycleFile ? smcore.GetCvarString(m_pMapCycleFile) : "mapcycle.txt";
|
const char *pMapCycleFileName = m_pMapCycleFile ? bridge->GetCvarString(m_pMapCycleFile) : "mapcycle.txt";
|
||||||
|
|
||||||
g_pSM->Format(pBuffer, maxlen, "cfg/%s", pMapCycleFileName);
|
g_pSM->Format(pBuffer, maxlen, "cfg/%s", pMapCycleFileName);
|
||||||
if (!smcore.filesystem->FileExists(pBuffer, "GAME"))
|
if (!bridge->filesystem->FileExists(pBuffer, "GAME"))
|
||||||
{
|
{
|
||||||
g_pSM->Format(pBuffer, maxlen, "%s", pMapCycleFileName);
|
g_pSM->Format(pBuffer, maxlen, "%s", pMapCycleFileName);
|
||||||
if (!smcore.filesystem->FileExists(pBuffer, "GAME"))
|
if (!bridge->filesystem->FileExists(pBuffer, "GAME"))
|
||||||
{
|
{
|
||||||
g_pSM->Format(pBuffer, maxlen, "cfg/mapcycle_default.txt");
|
g_pSM->Format(pBuffer, maxlen, "cfg/mapcycle_default.txt");
|
||||||
}
|
}
|
||||||
@ -158,7 +158,7 @@ public:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_pMapCycleFile = smcore.FindConVar("mapcyclefile");
|
m_pMapCycleFile = bridge->FindConVar("mapcyclefile");
|
||||||
|
|
||||||
/* Dump everything we know about. */
|
/* Dump everything we know about. */
|
||||||
List<maplist_info_t *> compat;
|
List<maplist_info_t *> compat;
|
||||||
@ -363,7 +363,7 @@ public:
|
|||||||
cell_t *blk;
|
cell_t *blk;
|
||||||
|
|
||||||
FileFindHandle_t findHandle;
|
FileFindHandle_t findHandle;
|
||||||
const char *fileName = smcore.filesystem->FindFirstEx("maps/*.bsp", "GAME", &findHandle);
|
const char *fileName = bridge->filesystem->FindFirstEx("maps/*.bsp", "GAME", &findHandle);
|
||||||
|
|
||||||
while (fileName)
|
while (fileName)
|
||||||
{
|
{
|
||||||
@ -373,22 +373,22 @@ public:
|
|||||||
|
|
||||||
if (!gamehelpers->IsMapValid(buffer))
|
if (!gamehelpers->IsMapValid(buffer))
|
||||||
{
|
{
|
||||||
fileName = smcore.filesystem->FindNext(findHandle);
|
fileName = bridge->filesystem->FindNext(findHandle);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((blk = pNewArray->push()) == NULL)
|
if ((blk = pNewArray->push()) == NULL)
|
||||||
{
|
{
|
||||||
fileName = smcore.filesystem->FindNext(findHandle);
|
fileName = bridge->filesystem->FindNext(findHandle);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
strncopy((char *)blk, buffer, 255);
|
strncopy((char *)blk, buffer, 255);
|
||||||
|
|
||||||
fileName = smcore.filesystem->FindNext(findHandle);
|
fileName = bridge->filesystem->FindNext(findHandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
smcore.filesystem->FindClose(findHandle);
|
bridge->filesystem->FindClose(findHandle);
|
||||||
|
|
||||||
/* Remove the array if there were no items. */
|
/* Remove the array if there were no items. */
|
||||||
if (pNewArray->size() == 0)
|
if (pNewArray->size() == 0)
|
||||||
@ -493,7 +493,7 @@ private:
|
|||||||
cell_t *blk;
|
cell_t *blk;
|
||||||
char buffer[255];
|
char buffer[255];
|
||||||
|
|
||||||
if ((fp = smcore.filesystem->Open(pMapList->path, "rt", "GAME")) == NULL)
|
if ((fp = bridge->filesystem->Open(pMapList->path, "rt", "GAME")) == NULL)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -501,7 +501,7 @@ private:
|
|||||||
delete pMapList->pArray;
|
delete pMapList->pArray;
|
||||||
pMapList->pArray = new CellArray(64);
|
pMapList->pArray = new CellArray(64);
|
||||||
|
|
||||||
while (!smcore.filesystem->EndOfFile(fp) && smcore.filesystem->ReadLine(buffer, sizeof(buffer), fp) != NULL)
|
while (!bridge->filesystem->EndOfFile(fp) && bridge->filesystem->ReadLine(buffer, sizeof(buffer), fp) != NULL)
|
||||||
{
|
{
|
||||||
size_t len = strlen(buffer);
|
size_t len = strlen(buffer);
|
||||||
char *ptr = UTIL_TrimWhitespace(buffer, len);
|
char *ptr = UTIL_TrimWhitespace(buffer, len);
|
||||||
@ -512,7 +512,7 @@ private:
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strcmp(smcore.GetSourceEngineName(), "insurgency") == 0)
|
if (strcmp(bridge->GetSourceEngineName(), "insurgency") == 0)
|
||||||
{
|
{
|
||||||
// Insurgency (presumably?) doesn't allow spaces in map names
|
// Insurgency (presumably?) doesn't allow spaces in map names
|
||||||
// and does use a space to delimit the map name from the map mode
|
// and does use a space to delimit the map name from the map mode
|
||||||
@ -539,7 +539,7 @@ private:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
smcore.filesystem->Close(fp);
|
bridge->filesystem->Close(fp);
|
||||||
|
|
||||||
pMapList->last_modified_time = last_time;
|
pMapList->last_modified_time = last_time;
|
||||||
pMapList->serial = ++m_nSerialChange;
|
pMapList->serial = ++m_nSerialChange;
|
||||||
|
@ -281,13 +281,13 @@ static cell_t sm_GetClientName(IPluginContext *pCtx, const cell_t *params)
|
|||||||
static ConVar *hostname = NULL;
|
static ConVar *hostname = NULL;
|
||||||
if (!hostname)
|
if (!hostname)
|
||||||
{
|
{
|
||||||
hostname = smcore.FindConVar("hostname");
|
hostname = bridge->FindConVar("hostname");
|
||||||
if (!hostname)
|
if (!hostname)
|
||||||
{
|
{
|
||||||
return pCtx->ThrowNativeError("Could not find \"hostname\" cvar");
|
return pCtx->ThrowNativeError("Could not find \"hostname\" cvar");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pCtx->StringToLocalUTF8(params[2], static_cast<size_t>(params[3]), smcore.GetCvarString(hostname), NULL);
|
pCtx->StringToLocalUTF8(params[2], static_cast<size_t>(params[3]), bridge->GetCvarString(hostname), NULL);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -763,7 +763,7 @@ static cell_t IsClientObserver(IPluginContext *pContext, const cell_t *params)
|
|||||||
return pContext->ThrowNativeError("IPlayerInfo not supported by game");
|
return pContext->ThrowNativeError("IPlayerInfo not supported by game");
|
||||||
}
|
}
|
||||||
|
|
||||||
return smcore.playerInfo->IsObserver(pInfo) ? 1 : 0;
|
return bridge->playerInfo->IsObserver(pInfo) ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static cell_t GetClientTeam(IPluginContext *pContext, const cell_t *params)
|
static cell_t GetClientTeam(IPluginContext *pContext, const cell_t *params)
|
||||||
@ -785,7 +785,7 @@ static cell_t GetClientTeam(IPluginContext *pContext, const cell_t *params)
|
|||||||
return pContext->ThrowNativeError("IPlayerInfo not supported by game");
|
return pContext->ThrowNativeError("IPlayerInfo not supported by game");
|
||||||
}
|
}
|
||||||
|
|
||||||
return smcore.playerInfo->GetTeamIndex(pInfo);
|
return bridge->playerInfo->GetTeamIndex(pInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
static cell_t GetFragCount(IPluginContext *pContext, const cell_t *params)
|
static cell_t GetFragCount(IPluginContext *pContext, const cell_t *params)
|
||||||
@ -807,7 +807,7 @@ static cell_t GetFragCount(IPluginContext *pContext, const cell_t *params)
|
|||||||
return pContext->ThrowNativeError("IPlayerInfo not supported by game");
|
return pContext->ThrowNativeError("IPlayerInfo not supported by game");
|
||||||
}
|
}
|
||||||
|
|
||||||
return smcore.playerInfo->GetFragCount(pInfo);
|
return bridge->playerInfo->GetFragCount(pInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
static cell_t GetDeathCount(IPluginContext *pContext, const cell_t *params)
|
static cell_t GetDeathCount(IPluginContext *pContext, const cell_t *params)
|
||||||
@ -829,7 +829,7 @@ static cell_t GetDeathCount(IPluginContext *pContext, const cell_t *params)
|
|||||||
return pContext->ThrowNativeError("IPlayerInfo not supported by game");
|
return pContext->ThrowNativeError("IPlayerInfo not supported by game");
|
||||||
}
|
}
|
||||||
|
|
||||||
return smcore.playerInfo->GetDeathCount(pInfo);
|
return bridge->playerInfo->GetDeathCount(pInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
static cell_t GetArmorValue(IPluginContext *pContext, const cell_t *params)
|
static cell_t GetArmorValue(IPluginContext *pContext, const cell_t *params)
|
||||||
@ -851,7 +851,7 @@ static cell_t GetArmorValue(IPluginContext *pContext, const cell_t *params)
|
|||||||
return pContext->ThrowNativeError("IPlayerInfo not supported by game");
|
return pContext->ThrowNativeError("IPlayerInfo not supported by game");
|
||||||
}
|
}
|
||||||
|
|
||||||
return smcore.playerInfo->GetArmorValue(pInfo);
|
return bridge->playerInfo->GetArmorValue(pInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
static cell_t GetAbsOrigin(IPluginContext *pContext, const cell_t *params)
|
static cell_t GetAbsOrigin(IPluginContext *pContext, const cell_t *params)
|
||||||
@ -877,7 +877,7 @@ static cell_t GetAbsOrigin(IPluginContext *pContext, const cell_t *params)
|
|||||||
pContext->LocalToPhysAddr(params[2], &pVec);
|
pContext->LocalToPhysAddr(params[2], &pVec);
|
||||||
|
|
||||||
float x, y, z;
|
float x, y, z;
|
||||||
smcore.playerInfo->GetAbsOrigin(pInfo, &x, &y, &z);
|
bridge->playerInfo->GetAbsOrigin(pInfo, &x, &y, &z);
|
||||||
pVec[0] = sp_ftoc(x);
|
pVec[0] = sp_ftoc(x);
|
||||||
pVec[1] = sp_ftoc(y);
|
pVec[1] = sp_ftoc(y);
|
||||||
pVec[2] = sp_ftoc(z);
|
pVec[2] = sp_ftoc(z);
|
||||||
@ -908,7 +908,7 @@ static cell_t GetAbsAngles(IPluginContext *pContext, const cell_t *params)
|
|||||||
pContext->LocalToPhysAddr(params[2], &pAng);
|
pContext->LocalToPhysAddr(params[2], &pAng);
|
||||||
|
|
||||||
float x, y, z;
|
float x, y, z;
|
||||||
smcore.playerInfo->GetAbsAngles(pInfo, &x, &y, &z);
|
bridge->playerInfo->GetAbsAngles(pInfo, &x, &y, &z);
|
||||||
pAng[0] = sp_ftoc(x);
|
pAng[0] = sp_ftoc(x);
|
||||||
pAng[1] = sp_ftoc(y);
|
pAng[1] = sp_ftoc(y);
|
||||||
pAng[2] = sp_ftoc(z);
|
pAng[2] = sp_ftoc(z);
|
||||||
@ -939,7 +939,7 @@ static cell_t GetPlayerMins(IPluginContext *pContext, const cell_t *params)
|
|||||||
pContext->LocalToPhysAddr(params[2], &pVec);
|
pContext->LocalToPhysAddr(params[2], &pVec);
|
||||||
|
|
||||||
float x, y, z;
|
float x, y, z;
|
||||||
smcore.playerInfo->GetPlayerMins(pInfo, &x, &y, &z);
|
bridge->playerInfo->GetPlayerMins(pInfo, &x, &y, &z);
|
||||||
pVec[0] = sp_ftoc(x);
|
pVec[0] = sp_ftoc(x);
|
||||||
pVec[1] = sp_ftoc(y);
|
pVec[1] = sp_ftoc(y);
|
||||||
pVec[2] = sp_ftoc(z);
|
pVec[2] = sp_ftoc(z);
|
||||||
@ -970,7 +970,7 @@ static cell_t GetPlayerMaxs(IPluginContext *pContext, const cell_t *params)
|
|||||||
pContext->LocalToPhysAddr(params[2], &pVec);
|
pContext->LocalToPhysAddr(params[2], &pVec);
|
||||||
|
|
||||||
float x, y, z;
|
float x, y, z;
|
||||||
smcore.playerInfo->GetPlayerMaxs(pInfo, &x, &y, &z);
|
bridge->playerInfo->GetPlayerMaxs(pInfo, &x, &y, &z);
|
||||||
pVec[0] = sp_ftoc(x);
|
pVec[0] = sp_ftoc(x);
|
||||||
pVec[1] = sp_ftoc(y);
|
pVec[1] = sp_ftoc(y);
|
||||||
pVec[2] = sp_ftoc(z);
|
pVec[2] = sp_ftoc(z);
|
||||||
@ -997,7 +997,7 @@ static cell_t GetWeaponName(IPluginContext *pContext, const cell_t *params)
|
|||||||
return pContext->ThrowNativeError("IPlayerInfo not supported by game");
|
return pContext->ThrowNativeError("IPlayerInfo not supported by game");
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *weapon = smcore.playerInfo->GetWeaponName(pInfo);
|
const char *weapon = bridge->playerInfo->GetWeaponName(pInfo);
|
||||||
pContext->StringToLocalUTF8(params[2], static_cast<size_t>(params[3]), weapon ? weapon : "", NULL);
|
pContext->StringToLocalUTF8(params[2], static_cast<size_t>(params[3]), weapon ? weapon : "", NULL);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
@ -1022,7 +1022,7 @@ static cell_t GetModelName(IPluginContext *pContext, const cell_t *params)
|
|||||||
return pContext->ThrowNativeError("IPlayerInfo not supported by game");
|
return pContext->ThrowNativeError("IPlayerInfo not supported by game");
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *model = smcore.playerInfo->GetModelName(pInfo);
|
const char *model = bridge->playerInfo->GetModelName(pInfo);
|
||||||
pContext->StringToLocalUTF8(params[2], static_cast<size_t>(params[3]), model ? model : "", NULL);
|
pContext->StringToLocalUTF8(params[2], static_cast<size_t>(params[3]), model ? model : "", NULL);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
@ -1047,7 +1047,7 @@ static cell_t GetHealth(IPluginContext *pContext, const cell_t *params)
|
|||||||
return pContext->ThrowNativeError("IPlayerInfo not supported by game");
|
return pContext->ThrowNativeError("IPlayerInfo not supported by game");
|
||||||
}
|
}
|
||||||
|
|
||||||
return smcore.playerInfo->GetHealth(pInfo);
|
return bridge->playerInfo->GetHealth(pInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
static cell_t GetClientOfUserId(IPluginContext *pContext, const cell_t *params)
|
static cell_t GetClientOfUserId(IPluginContext *pContext, const cell_t *params)
|
||||||
@ -1062,7 +1062,7 @@ static cell_t _ShowActivity(IPluginContext *pContext,
|
|||||||
{
|
{
|
||||||
char message[255];
|
char message[255];
|
||||||
char buffer[255];
|
char buffer[255];
|
||||||
int value = smcore.GetActivityFlags();
|
int value = bridge->GetActivityFlags();
|
||||||
unsigned int replyto = playerhelpers->GetReplyTo();
|
unsigned int replyto = playerhelpers->GetReplyTo();
|
||||||
int client = params[1];
|
int client = params[1];
|
||||||
|
|
||||||
@ -1113,7 +1113,7 @@ static cell_t _ShowActivity(IPluginContext *pContext,
|
|||||||
}
|
}
|
||||||
|
|
||||||
g_pSM->Format(message, sizeof(message), "%s%s\n", tag, buffer);
|
g_pSM->Format(message, sizeof(message), "%s%s\n", tag, buffer);
|
||||||
smcore.ConPrint(message);
|
bridge->ConPrint(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (value == kActivityNone)
|
if (value == kActivityNone)
|
||||||
@ -1193,7 +1193,7 @@ static cell_t _ShowActivity2(IPluginContext *pContext,
|
|||||||
{
|
{
|
||||||
char message[255];
|
char message[255];
|
||||||
char buffer[255];
|
char buffer[255];
|
||||||
int value = smcore.GetActivityFlags();
|
int value = bridge->GetActivityFlags();
|
||||||
unsigned int replyto = playerhelpers->GetReplyTo();
|
unsigned int replyto = playerhelpers->GetReplyTo();
|
||||||
int client = params[1];
|
int client = params[1];
|
||||||
|
|
||||||
@ -1240,7 +1240,7 @@ static cell_t _ShowActivity2(IPluginContext *pContext,
|
|||||||
}
|
}
|
||||||
|
|
||||||
g_pSM->Format(message, sizeof(message), "%s%s\n", tag, buffer);
|
g_pSM->Format(message, sizeof(message), "%s%s\n", tag, buffer);
|
||||||
smcore.ConPrint(message);
|
bridge->ConPrint(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (value == kActivityNone)
|
if (value == kActivityNone)
|
||||||
@ -1426,7 +1426,7 @@ static cell_t ChangeClientTeam(IPluginContext *pContext, const cell_t *params)
|
|||||||
return pContext->ThrowNativeError("IPlayerInfo not supported by game");
|
return pContext->ThrowNativeError("IPlayerInfo not supported by game");
|
||||||
}
|
}
|
||||||
|
|
||||||
smcore.playerInfo->ChangeTeam(pInfo, params[2]);
|
bridge->playerInfo->ChangeTeam(pInfo, params[2]);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -1528,7 +1528,7 @@ static cell_t FormatActivitySource(IPluginContext *pContext, const cell_t *param
|
|||||||
return pContext->ThrowNativeError("Client %d not connected", target);
|
return pContext->ThrowNativeError("Client %d not connected", target);
|
||||||
}
|
}
|
||||||
|
|
||||||
value = smcore.GetActivityFlags();
|
value = bridge->GetActivityFlags();
|
||||||
|
|
||||||
if (client != 0)
|
if (client != 0)
|
||||||
{
|
{
|
||||||
|
@ -78,7 +78,7 @@ try_serverlang:
|
|||||||
{
|
{
|
||||||
langid = g_Translator.GetServerLanguage();
|
langid = g_Translator.GetServerLanguage();
|
||||||
}
|
}
|
||||||
else if ((target >= 1) && (target <= smcore.MaxClients()))
|
else if ((target >= 1) && (target <= bridge->MaxClients()))
|
||||||
{
|
{
|
||||||
langid = g_Translator.GetClientLanguage(target);
|
langid = g_Translator.GetClientLanguage(target);
|
||||||
}
|
}
|
||||||
@ -794,7 +794,7 @@ try_again:
|
|||||||
{
|
{
|
||||||
lang_id = g_Translator.GetServerLanguage();
|
lang_id = g_Translator.GetServerLanguage();
|
||||||
}
|
}
|
||||||
else if (target >= 1 && target <= smcore.MaxClients())
|
else if (target >= 1 && target <= bridge->MaxClients())
|
||||||
{
|
{
|
||||||
lang_id = g_Translator.GetClientLanguage(target);
|
lang_id = g_Translator.GetClientLanguage(target);
|
||||||
}
|
}
|
||||||
@ -1123,7 +1123,7 @@ reswitch:
|
|||||||
const char *name;
|
const char *name;
|
||||||
const char *auth;
|
const char *auth;
|
||||||
int userid;
|
int userid;
|
||||||
if (!smcore.DescribePlayer(*value, &name, &auth, &userid))
|
if (!bridge->DescribePlayer(*value, &name, &auth, &userid))
|
||||||
return pCtx->ThrowNativeError("Client index %d is invalid", *value);
|
return pCtx->ThrowNativeError("Client index %d is invalid", *value);
|
||||||
ke::SafeSprintf(buffer,
|
ke::SafeSprintf(buffer,
|
||||||
sizeof(buffer),
|
sizeof(buffer),
|
||||||
@ -1150,7 +1150,7 @@ reswitch:
|
|||||||
|
|
||||||
const char *name = "Console";
|
const char *name = "Console";
|
||||||
if (*value) {
|
if (*value) {
|
||||||
if (!smcore.DescribePlayer(*value, &name, nullptr, nullptr))
|
if (!bridge->DescribePlayer(*value, &name, nullptr, nullptr))
|
||||||
return pCtx->ThrowNativeError("Client index %d is invalid", *value);
|
return pCtx->ThrowNativeError("Client index %d is invalid", *value);
|
||||||
}
|
}
|
||||||
AddString(&buf_p, llen, name, width, prec);
|
AddString(&buf_p, llen, name, width, prec);
|
||||||
@ -1190,7 +1190,7 @@ reswitch:
|
|||||||
char *key;
|
char *key;
|
||||||
bool error;
|
bool error;
|
||||||
size_t res;
|
size_t res;
|
||||||
cell_t target = smcore.GetGlobalTarget();
|
cell_t target = bridge->GetGlobalTarget();
|
||||||
pCtx->LocalToString(params[arg++], &key);
|
pCtx->LocalToString(params[arg++], &key);
|
||||||
res = Translate(buf_p, llen, pCtx, key, target, params, &arg, &error);
|
res = Translate(buf_p, llen, pCtx, key, target, params, &arg, &error);
|
||||||
if (error)
|
if (error)
|
||||||
|
@ -608,7 +608,7 @@ void UTIL_ConsolePrint(const char *fmt, ...)
|
|||||||
|
|
||||||
static ServerGlobals serverGlobals;
|
static ServerGlobals serverGlobals;
|
||||||
|
|
||||||
static sm_core_t core_bridge =
|
static CoreProvider core_bridge =
|
||||||
{
|
{
|
||||||
/* Objects */
|
/* Objects */
|
||||||
&g_SourceMod,
|
&g_SourceMod,
|
||||||
|
Loading…
Reference in New Issue
Block a user