Add missing set of CBaseEntity::Teleport param on newer games (#1894)

* Add setting of missing CBaseEntity::Teleport param on newer games

* Rearrange SOURCE_ENGINE defines of games between Portal 2 and CS:GO.
This commit is contained in:
Nicholas Hastings 2022-12-27 14:29:22 -05:00 committed by GitHub
parent 4320d7b17a
commit 775d4f04f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 5 deletions

View File

@ -66,11 +66,11 @@ SDKMap = {
'mcv': SDK('HL2SDKMCV', '2.mcv', '22', 'MCV', WinOnly, 'mcv'),
'csgo': SDK('HL2SDKCSGO', '2.csgo', '23', 'CSGO', CSGO, 'csgo'),
'portal2': SDK('HL2SDKPORTAL2', '2.portal2', '18', 'PORTAL2', [], 'portal2'),
'blade': SDK('HL2SDKBLADE', '2.blade', '19', 'BLADE', Blade, 'blade'),
'insurgency': SDK('HL2SDKINSURGENCY', '2.insurgency', '20', 'INSURGENCY', WinLinuxMac, 'insurgency'),
'blade': SDK('HL2SDKBLADE', '2.blade', '21', 'BLADE', Blade, 'blade'),
'insurgency': SDK('HL2SDKINSURGENCY', '2.insurgency', '19', 'INSURGENCY', WinLinuxMac, 'insurgency'),
'contagion': SDK('HL2SDKCONTAGION', '2.contagion', '15', 'CONTAGION', WinOnly, 'contagion'),
'bms': SDK('HL2SDKBMS', '2.bms', '11', 'BMS', WinLinux, 'bms'),
'doi': SDK('HL2SDKDOI', '2.doi', '21', 'DOI', WinLinuxMac, 'doi'),
'doi': SDK('HL2SDKDOI', '2.doi', '20', 'DOI', WinLinuxMac, 'doi'),
'mock': SDK('HL2SDK-MOCK', '2.mock', '999', 'MOCK', Mock, 'mock'),
'pvkii': SDK('HL2SDKPVKII', '2.pvkii', '10', 'PVKII', WinLinux, 'pvkii'),
}

View File

@ -476,11 +476,19 @@ static cell_t TeleportEntity(IPluginContext *pContext, const cell_t *params)
static ValveCall *pCall = NULL;
if (!pCall)
{
ValvePassInfo pass[3];
#if SOURCE_ENGINE >= SE_PORTAL2
constexpr size_t paramCount = 4;
#else
constexpr size_t paramCount = 3;
#endif
ValvePassInfo pass[paramCount];
InitPass(pass[0], Valve_Vector, PassType_Basic, PASSFLAG_BYVAL, VDECODE_FLAG_ALLOWNULL);
InitPass(pass[1], Valve_QAngle, PassType_Basic, PASSFLAG_BYVAL, VDECODE_FLAG_ALLOWNULL);
InitPass(pass[2], Valve_Vector, PassType_Basic, PASSFLAG_BYVAL, VDECODE_FLAG_ALLOWNULL);
if (!CreateBaseCall("Teleport", ValveCall_Entity, NULL, pass, 3, &pCall))
#if SOURCE_ENGINE >= SE_PORTAL2
InitPass(pass[3], Valve_Bool, PassType_Basic, PASSFLAG_BYVAL);
#endif
if (!CreateBaseCall("Teleport", ValveCall_Entity, NULL, pass, paramCount, &pCall))
{
return pContext->ThrowNativeError("\"Teleport\" not supported by this mod");
} else if (!pCall) {
@ -493,6 +501,11 @@ static cell_t TeleportEntity(IPluginContext *pContext, const cell_t *params)
DECODE_VALVE_PARAM(2, vparams, 0);
DECODE_VALVE_PARAM(3, vparams, 1);
DECODE_VALVE_PARAM(4, vparams, 2);
#if SOURCE_ENGINE >= SE_PORTAL2
*(bool *)(vptr + pCall->vparams[3].offset) = true;
#endif
FINISH_CALL_SIMPLE(NULL);
return 1;