Enable more CS:GO engine logic for Blade Symphony.

This commit is contained in:
Nick Hastings
2023-08-30 22:08:45 +02:00
committed by Your Name
parent ed5713b3fd
commit a3fbbe41f2
7 changed files with 53 additions and 13 deletions
+4 -2
View File
@@ -107,7 +107,7 @@ extern sp_nativeinfo_t g_ClientNatives[];
static void InitSDKToolsAPI();
#if SOURCE_ENGINE == SE_CSGO
#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE
CDetour *g_WriteBaselinesDetour = NULL;
DETOUR_DECL_MEMBER3(CNetworkStringTableContainer__WriteBaselines, void, char const *, mapName, void *, buffer, int, currentTick)
@@ -205,7 +205,9 @@ bool SDKTools::SDK_OnLoad(char *error, size_t maxlength, bool late)
m_CSGOBadList.init();
m_CSGOBadList.add("m_bIsValveDS");
m_CSGOBadList.add("m_bIsQuestEligible");
#endif
#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE
g_WriteBaselinesDetour = DETOUR_CREATE_MEMBER(CNetworkStringTableContainer__WriteBaselines, "WriteBaselines");
if (g_WriteBaselinesDetour) {
g_WriteBaselinesDetour->EnableDetour();
@@ -243,7 +245,7 @@ void SDKTools::SDK_OnUnload()
g_RegCalls.clear();
ShutdownHelpers();
#if SOURCE_ENGINE == SE_CSGO
#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE
if (g_WriteBaselinesDetour) {
g_WriteBaselinesDetour->DisableDetour();
g_WriteBaselinesDetour = NULL;
+33 -1
View File
@@ -197,6 +197,38 @@ static cell_t GiveNamedItem(IPluginContext *pContext, const cell_t *params)
return gamehelpers->EntityToBCompatRef(pEntity);
}
#elif SOURCE_ENGINE == SE_BLADE
class CEconItemView;
static cell_t GiveNamedItem(IPluginContext *pContext, const cell_t *params)
{
static ValveCall *pCall = NULL;
if (!pCall)
{
ValvePassInfo pass[5];
InitPass(pass[0], Valve_String, PassType_Basic, PASSFLAG_BYVAL);
InitPass(pass[1], Valve_POD, PassType_Basic, PASSFLAG_BYVAL);
InitPass(pass[2], Valve_POD, PassType_Basic, PASSFLAG_BYVAL);
InitPass(pass[3], Valve_Bool, PassType_Basic, PASSFLAG_BYVAL);
InitPass(pass[4], Valve_CBaseEntity, PassType_Basic, PASSFLAG_BYVAL);
if (!CreateBaseCall("GiveNamedItem", ValveCall_Player, &pass[4], pass, 4, &pCall))
{
return pContext->ThrowNativeError("\"GiveNamedItem\" not supported by this mod");
} else if (!pCall) {
return pContext->ThrowNativeError("\"GiveNamedItem\" wrapper failed to initialize");
}
}
CBaseEntity *pEntity = NULL;
START_CALL();
DECODE_VALVE_PARAM(1, thisinfo, 0);
DECODE_VALVE_PARAM(2, vparams, 0);
DECODE_VALVE_PARAM(3, vparams, 1);
*(CEconItemView **)(vptr + 12) = NULL;
*(bool *)(vptr + 16) = false;
FINISH_CALL_SIMPLE(&pEntity);
return gamehelpers->EntityToBCompatRef(pEntity);
}
#elif SOURCE_ENGINE == SE_BMS
// CBaseEntity *GiveNamedItem( const char *szName, int iSubType = 0, int iPrimaryAmmo = -1, int iSecondaryAmmo = -1 )
static cell_t GiveNamedItem(IPluginContext *pContext, const cell_t *params)
@@ -972,7 +1004,7 @@ static cell_t CreateEntityByName(IPluginContext *pContext, const cell_t *params)
char *classname;
pContext->LocalToString(params[1], &classname);
#if SOURCE_ENGINE != SE_CSGO
#if SOURCE_ENGINE != SE_CSGO && SOURCE_ENGINE != SE_BLADE
CBaseEntity *pEntity = (CBaseEntity *)servertools->CreateEntityByName(classname);
#else
CBaseEntity *pEntity = (CBaseEntity *)servertools->CreateItemEntityByName(classname);