CSurvivorRescue::AreaScanThink
0x0096bb70 · 1092 bytes · __thiscall
_ZN15CSurvivorRescue13AreaScanThinkEv
Decompiled
undefined (1 param)
/* CSurvivorRescue::AreaScanThink() */
void __thiscall CSurvivorRescue::AreaScanThink(CSurvivorRescue *this)
{
CBasePropDoor *this_00;
undefined4 uVar1;
int iVar2;
CNavArea *pCVar3;
undefined4 *puVar4;
int iVar5;
void *pvVar6;
int iVar7;
char *pcVar8;
int iVar9;
int iVar10;
int in_GS_OFFSET;
double dVar11;
double dVar12;
int local_154 [5];
int local_140 [5];
CFmtStrN<256> local_12c [5];
undefined1 local_127 [263];
int local_20;
local_20 = *(int *)(in_GS_OFFSET + 0x14);
pCVar3 = (CNavArea *)GetRescueNavArea(this);
if (pCVar3 == (CNavArea *)0x0) {
pcVar8 = "failed to find a nav area";
}
else {
pcVar8 = "is in a nav area with a negative flow";
if (0.0 < *(float *)(pCVar3 + 0x154) || *(float *)(pCVar3 + 0x154) == 0.0) {
*(undefined4 *)(this + 0x1950) = 0;
local_154[0] = 0;
local_154[1] = 0;
*(undefined4 *)(this + 0x1930) = *(undefined4 *)(pCVar3 + 0x154);
local_154[2] = 0;
local_154[3] = 0;
local_154[4] = 0;
local_140[0] = 0;
local_140[1] = 0;
local_140[2] = 0;
local_140[3] = 0;
local_140[4] = 0;
/* try { // try from 0096bc59 to 0096bce1 has its CatchHandler @ 0096bfcf */
SearchSurroundingAreas<RescueAreaCollector>
(pCVar3,(Vector *)(pCVar3 + 0x2c),(RescueAreaCollector *)local_154,350.0,0,-1);
if (0 < local_154[3]) {
iVar9 = 0;
do {
TerrorNavArea::SetSpawnAttributes(*(TerrorNavArea **)(local_154[0] + iVar9 * 4),0x10000);
iVar9 = iVar9 + 1;
} while (iVar9 < local_154[3]);
}
iVar9 = 0;
if (0 < local_140[3]) {
LAB_0096bcb7:
do {
this_00 = *(CBasePropDoor **)(local_140[0] + iVar9 * 4);
if (*(int *)(this_00 + 0x15f4) == 0) {
CBasePropDoor::RescueDisable(this_00,true);
puVar4 = (undefined4 *)(**(code **)(*(int *)this_00 + 0xc))(this_00);
uVar1 = *puVar4;
iVar2 = *(int *)(this + 0x1950);
iVar7 = *(int *)(this + 0x1948);
iVar10 = iVar2 + 1;
if (iVar7 < iVar10) {
iVar5 = *(int *)(this + 0x194c);
if (iVar5 < 0) goto LAB_0096bd01;
if (iVar5 == 0) {
if (iVar7 == 0) {
if (iVar10 < 9) {
iVar5 = 8;
goto LAB_0096be87;
}
iVar7 = 8;
}
do {
iVar5 = iVar7 * 2;
if (iVar10 <= iVar5) break;
iVar5 = iVar7 * 4;
iVar7 = iVar5;
} while (iVar5 < iVar10);
}
else {
for (iVar5 = (iVar2 / iVar5 + 1) * iVar5; iVar5 < iVar10;
iVar5 = (iVar5 + iVar10) / 2) {
}
}
LAB_0096be87:
*(int *)(this + 0x1948) = iVar5;
if (*(void **)(this + 0x1944) == (void *)0x0) {
pvVar6 = malloc(iVar5 << 2);
*(void **)(this + 0x1944) = pvVar6;
}
else {
pvVar6 = realloc(*(void **)(this + 0x1944),iVar5 << 2);
*(void **)(this + 0x1944) = pvVar6;
iVar10 = *(int *)(this + 0x1950) + 1;
}
}
else {
LAB_0096bd01:
pvVar6 = *(void **)(this + 0x1944);
}
*(int *)(this + 0x1950) = iVar10;
iVar10 = (iVar10 - iVar2) + -1;
*(void **)(this + 0x1954) = pvVar6;
iVar2 = iVar2 * 4;
if (0 < iVar10) {
/* try { // try from 0096bee5 to 0096bee9 has its CatchHandler @ 0096bfcf */
_V_memmove((void *)((int)pvVar6 + iVar2 + 4),(void *)((int)pvVar6 + iVar2),iVar10 * 4)
;
pvVar6 = *(void **)(this + 0x1944);
}
if ((undefined4 *)(iVar2 + (int)pvVar6) != (undefined4 *)0x0) {
iVar9 = iVar9 + 1;
*(undefined4 *)(iVar2 + (int)pvVar6) = uVar1;
if (local_140[3] <= iVar9) break;
goto LAB_0096bcb7;
}
}
iVar9 = iVar9 + 1;
} while (iVar9 < local_140[3]);
}
local_140[3] = 0;
CUtlMemory<CBasePropDoor*,int>::Purge((CUtlMemory<CBasePropDoor*,int> *)local_140);
local_140[4] = local_140[0];
CUtlMemory<CBasePropDoor*,int>::Purge((CUtlMemory<CBasePropDoor*,int> *)local_140);
local_154[3] = 0;
CUtlMemory<TerrorNavArea*,int>::Purge((CUtlMemory<TerrorNavArea*,int> *)local_154);
local_154[4] = local_154[0];
CUtlMemory<TerrorNavArea*,int>::Purge((CUtlMemory<TerrorNavArea*,int> *)local_154);
goto LAB_0096be25;
}
}
if (((byte)this[0x14d] & 8) == 0) {
dVar12 = (double)*(float *)(this + 0x2e8);
LAB_0096bdcd:
dVar11 = (double)*(float *)(this + 0x2e4);
}
else {
CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
dVar12 = (double)*(float *)(this + 0x2e8);
if (((byte)this[0x14d] & 8) == 0) goto LAB_0096bdcd;
CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
dVar11 = (double)*(float *)(this + 0x2e4);
if (((byte)this[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
}
}
CFmtStrN<256>::CFmtStrN(local_12c,"(%f, %f, %f)",(double)*(float *)(this + 0x2e0),dVar11,dVar12);
DevWarning("info_survivor_rescue at %s %s!\n",local_127,pcVar8);
LAB_0096be25:
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
used as the SourceMod key — change to fit your plugin's convention
SourceMod library name (server / engine / matchmaking)
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.
Gamedata KeyValues
DHooks plugin example
Type inference is best-effort from the C signature - sanity-check the DHooks types before shipping.