CWeaponSpawnConfigurable::MakeWeaponSelection
0x008da2c0 · 1428 bytes · __thiscall
_ZN24CWeaponSpawnConfigurable19MakeWeaponSelectionEP18EntityLocationInfoI7CHandleIS_EE
Decompiled
undefined (2 params)
/* CWeaponSpawnConfigurable::MakeWeaponSelection(EntityLocationInfo<CHandle<CWeaponSpawnConfigurable>
>*) */
void __thiscall
CWeaponSpawnConfigurable::MakeWeaponSelection
(CWeaponSpawnConfigurable *this,EntityLocationInfo *param_1)
{
uint uVar1;
CWeaponSpawnConfigurable *this_00;
code *pcVar2;
CBaseEdict *this_01;
float fVar3;
char cVar4;
CCSWeaponInfo *pCVar5;
undefined4 uVar6;
float *pfVar7;
int iVar8;
int iVar9;
undefined *puVar10;
EntityLocationInfo *pEVar11;
int in_GS_OFFSET;
CUtlMemory<CSWeaponID,int> *local_98;
int local_94;
float local_8c;
float *local_88;
undefined4 local_84;
undefined4 local_80;
int local_7c;
float *local_78;
float local_74;
float local_70;
float local_6c;
int local_68;
float local_64;
char local_60 [64];
int local_20;
local_20 = *(int *)(in_GS_OFFSET + 0x14);
if (*(int *)(this + 0x146c) == 0) {
local_84 = 0;
local_88 = (float *)0x0;
local_80 = 0;
local_7c = 0;
local_78 = (float *)0x0;
if (param_1 == (EntityLocationInfo *)0x0) {
local_94 = 0;
}
else {
local_94 = 0;
pEVar11 = param_1;
do {
uVar1 = *(uint *)(pEVar11 + 0x1c);
/* try { // try from 008da415 to 008da490 has its CatchHandler @ 008da844 */
if (((((uVar1 == 0xffffffff) ||
(puVar10 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar10 == (undefined *)0xfffffffc)
) || (*(uint *)(puVar10 + 8) != uVar1 >> 0xc)) ||
((this_00 = *(CWeaponSpawnConfigurable **)(puVar10 + 4),
this_00 == (CWeaponSpawnConfigurable *)0x0 ||
(local_74 = (float)(**(code **)(*(int *)this_00 + 0x3cc))(this_00), local_74 == 0.0))))
|| (this_00[0x1464] != (CWeaponSpawnConfigurable)0x0)) {
LAB_008da3c8:
pEVar11 = *(EntityLocationInfo **)(pEVar11 + 0x18);
}
else {
iVar8 = GetWeaponTier(this_00);
iVar9 = local_94;
if ((iVar8 != 0) && (iVar9 = iVar8, local_94 != 0)) {
iVar9 = local_94;
}
local_94 = iVar9;
if (0 < local_7c) {
if (*local_88 != local_74) {
iVar9 = 0;
do {
iVar9 = iVar9 + 1;
if (iVar9 == local_7c) goto LAB_008da478;
} while (local_74 != local_88[iVar9]);
if (iVar9 == -1) goto LAB_008da478;
}
goto LAB_008da3c8;
}
LAB_008da478:
CUtlVector<CSWeaponID,CUtlMemory<CSWeaponID,int>>::InsertBefore
((CUtlVector<CSWeaponID,CUtlMemory<CSWeaponID,int>> *)&local_88,local_7c,
(CSWeaponID *)&local_74);
pEVar11 = *(EntityLocationInfo **)(pEVar11 + 0x18);
}
} while ((param_1 != pEVar11) && (pEVar11 != (EntityLocationInfo *)0x0));
}
local_98 = (CUtlMemory<CSWeaponID,int> *)&local_88;
local_64 = 0.0;
local_68 = 0;
local_6c = 0.0;
local_70 = 0.0;
local_74 = 0.0;
local_8c = 1.4013e-45;
do {
fVar3 = local_8c;
/* try { // try from 008da523 to 008da655 has its CatchHandler @ 008da879 */
if ((((((this[0x1481] == (CWeaponSpawnConfigurable)0x0) || (3 < (int)local_8c - 0x21U)) &&
(cVar4 = CDirectorItemManager::IsWeaponAllowedToExist
(*(CDirectorItemManager **)(TheDirector + 0x62c),local_8c,0),
cVar4 != '\0')) &&
(((cVar4 = CDirectorChallengeMode::AllowWeaponSpawn
(*(CDirectorChallengeMode **)(TheDirector + 0x648),fVar3),
cVar4 != '\0' &&
(pCVar5 = (CCSWeaponInfo *)GetWeaponInfo(fVar3), pCVar5 != (CCSWeaponInfo *)0x0)) &&
((*(uint *)(pCVar5 + 0x158) < 2 && ((1 < (int)fVar3 - 0x14U && (fVar3 != 5.1848e-44)))))
))) && (((*(int *)(pCVar5 + 0x898) == 2 &&
((*(uint *)(this + 0x1478) == 0xffffffff ||
(*(uint *)(pCVar5 + 0x158) == *(uint *)(this + 0x1478))))) &&
(((*(int *)(this + 0x1470) == 0 ||
(*(int *)(this + 0x1470) == *(int *)(pCVar5 + 0xbe8))) &&
((local_94 == 0 || (*(int *)(pCVar5 + 0xbe8) == local_94)))))))) &&
(((*(int *)(this + 0x1474) == 0x10 || (*(int *)(this + 0x1474) == *(int *)(pCVar5 + 0x894))
) && (cVar4 = IsWeaponAllowedToSpawn(this,pCVar5), cVar4 != '\0')))) {
if (local_7c < 1) {
LAB_008da8a5:
/* try { // try from 008da8b9 to 008da8bd has its CatchHandler @ 008da879 */
CUtlVector<int,CUtlMemory<int,int>>::InsertBefore
((CUtlVector<int,CUtlMemory<int,int>> *)&local_74,local_68,(int *)&local_8c);
}
else if (local_8c != *local_88) {
iVar9 = 0;
do {
iVar9 = iVar9 + 1;
if (iVar9 == local_7c) goto LAB_008da8a5;
} while (local_8c != local_88[iVar9]);
if (iVar9 == -1) goto LAB_008da8a5;
}
}
local_8c = (float)((int)local_8c + 1);
} while ((int)local_8c < 0x38);
if (local_68 < 1) {
iVar9 = 0;
}
else {
iVar9 = RandomInt(0,local_68 + -1);
iVar9 = *(int *)((int)local_74 + iVar9 * 4);
}
local_68 = 0;
CUtlMemory<int,int>::Purge((CUtlMemory<int,int> *)&local_74);
local_64 = local_74;
CUtlMemory<int,int>::Purge((CUtlMemory<int,int> *)&local_74);
local_7c = 0;
CUtlMemory<CSWeaponID,int>::Purge(local_98);
local_78 = local_88;
CUtlMemory<CSWeaponID,int>::Purge(local_98);
}
else {
cVar4 = SpawnOnlyIfPrecached(*(int *)(this + 0x146c));
if (cVar4 == '\0') goto LAB_008da356;
iVar9 = *(int *)(this + 0x146c);
}
cVar4 = CDirectorChallengeMode::ConvertWeaponSpawn
(*(CDirectorChallengeMode **)(TheDirector + 0x648),iVar9,local_60,0x40);
if (cVar4 != '\0') {
iVar9 = SpawnNameToWeaponID(local_60);
if (iVar9 == 0) {
iVar9 = ClassnameToWeaponID(local_60);
}
this[0x1464] = (CWeaponSpawnConfigurable)0x1;
}
(**(code **)(*(int *)this + 0x3d8))(this,iVar9);
if (*(int *)(this + 0x1458) == 0) {
UTIL_Remove((CBaseEntity *)this);
}
else {
pcVar2 = *(code **)(*(int *)this + 0x70);
uVar6 = (**(code **)(*(int *)this + 0x3c8))(this);
(*pcVar2)(this,uVar6);
iVar9 = *(int *)this;
pcVar2 = *(code **)(iVar9 + 0x254);
if (((byte)this[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
iVar9 = *(int *)this;
}
pfVar7 = (float *)(**(code **)(iVar9 + 0x288))(this);
local_74 = *pfVar7 - *(float *)(this + 0x2e0);
local_70 = pfVar7[1] - *(float *)(this + 0x2e4);
local_6c = pfVar7[2] - *(float *)(this + 0x2e8);
(*pcVar2)(this,&local_74);
iVar9 = *(int *)(this + 0x1450);
if ((-1 < iVar9) && (iVar9 != *(int *)(this + 0x458))) {
if (this[0x6c] == (CWeaponSpawnConfigurable)0x0) {
this_01 = *(CBaseEdict **)(this + 0x30);
if (this_01 != (CBaseEdict *)0x0) {
*(uint *)this_01 = *(uint *)this_01 | 0x101;
iVar8 = CBaseEdict::GetChangeAccessor(this_01);
*(undefined2 *)(iVar8 + 2) = 0;
}
}
else {
this[0x70] = (CWeaponSpawnConfigurable)((byte)this[0x70] | 1);
}
*(int *)(this + 0x458) = iVar9;
}
VisibilityMonitor_AddEntity
((CBaseEntity *)this,400.0,CWeaponSpawn::WeaponSpawnVisibilityMonitorCallback,
CTerrorPlayer::DualWieldingFilter);
(**(code **)(*(int *)this + 0x3bc))(this);
if (((byte)this[0x148] & 0x10) != 0) {
CItem::ConstrainItem((CItem *)this);
}
}
LAB_008da356:
if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {
return;
}
/* WARNING: Subroutine does not return */
__stack_chk_fail();
}
SourceMod gamedata
paste intoaddons/sourcemod/gamedata/<your_plugin>.txt
Just a Signatures{} block, ready to drop into a gamedata
file. Wire it up in your plugin however you like - SDKCall, DHooks,
raw memory ops, or anything else.
Signatures + Functions block. The plugin uses
DHookCreateFromConf - DHooks reads return type, this-type,
calling convention, and argument types straight from the gamedata. Less
boilerplate in the plugin, types travel with the gamedata.
Type inference is best-effort from the C signature - sanity-check the DHooks types before shipping.