mirror of
https://github.com/alliedmodders/sourcemod.git
synced 2025-12-14 09:38:30 +00:00
Add support for TF2 conditions up to 127 (holdover)
Only until the BitVec stuff makes its way to 1.6 (if ever).
This commit is contained in:
parent
24d8e8047d
commit
9d3ef1d19f
@ -49,6 +49,7 @@ IForward *g_removeCondForward = NULL;
|
||||
int playerCondOffset = -1;
|
||||
int playerCondExOffset = -1;
|
||||
int playerCondEx2Offset = -1;
|
||||
int playerCondEx3Offset = -1;
|
||||
int conditionBitsOffset = -1;
|
||||
|
||||
bool g_bIgnoreRemove;
|
||||
@ -62,12 +63,15 @@ inline condflags_t GetPlayerConds(CBaseEntity *pPlayer)
|
||||
uint32_t condBits = *(uint32_t *)((intptr_t)pPlayer + conditionBitsOffset);
|
||||
uint32_t playerCondEx = *(uint32_t *)((intptr_t)pPlayer + playerCondExOffset);
|
||||
uint32_t playerCondEx2 = *(uint32_t *)((intptr_t)pPlayer + playerCondEx2Offset);
|
||||
uint32_t playerCondEx3 = *(uint32_t *)((intptr_t)pPlayer + playerCondEx3Offset);
|
||||
|
||||
uint64_t playerCondExAdj = playerCondEx;
|
||||
playerCondExAdj <<= 32;
|
||||
uint64_t playerCondEx3Adj = playerCondEx3;
|
||||
playerCondEx3Adj <<= 32;
|
||||
|
||||
result.lower = playerCond|condBits|playerCondExAdj;
|
||||
result.upper = playerCondEx2;
|
||||
result.upper = playerCondEx2|playerCondEx3Adj;
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -181,7 +185,15 @@ bool InitialiseConditionChecks()
|
||||
|
||||
playerCondEx2Offset = prop.actual_offset;
|
||||
|
||||
if (playerCondOffset == -1 || playerCondExOffset == -1 || conditionBitsOffset == -1 || playerCondEx2Offset == -1)
|
||||
if (!gamehelpers->FindSendPropInfo("CTFPlayer", "m_nPlayerCondEx3", &prop))
|
||||
{
|
||||
g_pSM->LogError(myself, "Failed to find m_nPlayerCondEx3 prop offset");
|
||||
return false;
|
||||
}
|
||||
|
||||
playerCondEx3Offset = prop.actual_offset;
|
||||
|
||||
if (playerCondOffset == -1 || playerCondExOffset == -1 || conditionBitsOffset == -1 || playerCondEx2Offset == -1 || playerCondEx3Offset == -1)
|
||||
return false;
|
||||
|
||||
int maxClients = gpGlobals->maxClients;
|
||||
|
||||
@ -512,7 +512,7 @@ stock bool:TF2_IsPlayerInCondition(client, TFCond:cond)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
else if (_:cond < 96)
|
||||
{
|
||||
new bit = (1 << (_:cond - 64));
|
||||
if ((GetEntProp(client, Prop_Send, "m_nPlayerCondEx2") & bit) == bit)
|
||||
@ -520,6 +520,14 @@ stock bool:TF2_IsPlayerInCondition(client, TFCond:cond)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
new bit = (1 << (_:cond - 96));
|
||||
if ((GetEntProp(client, Prop_Send, "m_nPlayerCondEx3") & bit) == bit)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user