SurvivorCheckpointLeaving::Update
0x0090a400 · 1987 bytes · __thiscall
_ZN25SurvivorCheckpointLeaving6UpdateEP11SurvivorBotf
Decompiled
undefined (3 params)
/* SurvivorCheckpointLeaving::Update(SurvivorBot*, float) */
SurvivorCheckpointLeaving * __thiscall
SurvivorCheckpointLeaving::Update
(SurvivorCheckpointLeaving *this,SurvivorBot *param_1,float param_2)
{
code *pcVar1;
CNavArea *pCVar2;
char cVar3;
int iVar4;
uint uVar5;
int *piVar6;
SurvivorLegsApproach *this_00;
SurvivorIntention *pSVar7;
CBaseEntity *this_01;
float *pfVar8;
CNavArea *this_02;
undefined4 uVar9;
TerrorNavArea *this_03;
uint uVar10;
undefined4 *puVar11;
longdouble lVar12;
longdouble lVar13;
SurvivorLegsWait *this_04;
SurvivorBot *pSVar14;
undefined1 local_34 [8];
undefined4 local_2c;
float local_28;
float local_24;
float local_20;
lVar12 = (longdouble)CountdownTimer::Now();
if ((float)lVar12 < *(float *)(param_1 + 0x48)) goto LAB_0090a428;
*(undefined1 *)((int)&__DT_REL[0x1194].r_offset + (int)param_2 + 2) = 0;
SurvivorBot::SaveFriendsInImmediateTrouble((Action *)&local_28);
if (((((int)local_28 - 1U < 3) ||
(SurvivorBot::UseHealingItems((Action *)&local_28), (int)local_28 - 1U < 3)) ||
(SurvivorBot::RescueImmobilizedFriends((Action *)&local_28), (int)local_28 - 1U < 3)) ||
(pSVar14 = param_1, SurvivorBot::ScavengeNearbyItems((Action *)&local_28),
(int)local_28 - 1U < 3)) {
LAB_0090a47b:
*(float *)this = local_28;
*(float *)(this + 4) = local_24;
*(float *)(this + 8) = local_20;
return this;
}
cVar3 = SurvivorBot::IsAvailable((SurvivorBot *)param_2);
if (((cVar3 != '\0') && (iVar4 = GetDifficulty(), iVar4 != 3)) &&
(((float)*(int *)((int)param_2 + 0x100) < 75.0 &&
(iVar4 = CTerrorPlayer::GetTerrorWeapon((CTerrorPlayer *)param_2,0xc,pSVar14), iVar4 != 0))))
{
puVar11 = ::operator_new(0x40);
*(undefined4 *)this = 2;
puVar11[8] = 0;
puVar11[9] = 0;
puVar11[10] = 0;
puVar11[3] = 0;
puVar11[4] = 0;
puVar11[5] = 0;
puVar11[6] = 0;
puVar11[7] = 0;
puVar11[2] = 0;
*(undefined1 *)(puVar11 + 0xc) = 0;
*(undefined1 *)((int)puVar11 + 0x31) = 0;
puVar11[0xb] = 0;
*puVar11 = &PTR__SurvivorHealSelf_00d06c28;
puVar11[1] = &PTR__SurvivorHealSelf_00d06d8c;
puVar11[0xd] = &PTR_NetworkStateChanged_00c0b6e0;
puVar11[0xe] = 0;
puVar11[0xf] = 0xbf800000;
*(undefined4 **)(this + 4) = puVar11;
*(undefined4 *)(param_1 + 0x20) = 0;
*(undefined4 *)(param_1 + 0x24) = 0;
*(undefined4 *)(param_1 + 0x28) = 0;
*(undefined4 *)(param_1 + 0x2c) = 0;
*(undefined4 *)(this + 8) = 0;
return this;
}
cVar3 = SurvivorBot::CheckIfReadyToLeaveCheckpoint((SurvivorBot *)param_2);
if (cVar3 != '\0') {
*(undefined1 *)((int)&__DT_REL[0x1194].r_offset + (int)param_2 + 2) = 1;
}
pSVar14 = param_1;
SurvivorBot::TryLeaveCheckpoint((SurvivorBot *)&local_28,(Action *)param_2);
if ((int)local_28 - 1U < 3) goto LAB_0090a47b;
if (*(char *)((int)param_2 + 0x39e4) != '\0') {
*(undefined4 *)this = 3;
*(undefined4 *)(this + 4) = 0;
*(char **)(this + 8) = "I\'ve walked out of the checkpoint";
return this;
}
cVar3 = CDirector::HasAnySurvivorLeftSafeArea(TheDirector);
if (cVar3 != '\0') {
pcVar1 = *(code **)(*(int *)param_2 + 0x7b4);
CAI_Concept::CAI_Concept((CAI_Concept *)&local_28,"SurvivorBotLeavingCheckpoint");
(*pcVar1)(param_2,(Action *)&local_28,1,0,0,0,0);
*(undefined4 *)this = 3;
*(undefined4 *)(this + 4) = 0;
*(char **)(this + 8) = "Someone has left the safe area, time to go!";
return this;
}
iVar4 = SurvivorBot::GetTeamSituation((SurvivorBot *)param_2);
this_04 = (SurvivorLegsWait *)0xbf800000;
(**(code **)(*(int *)param_2 + 0x988))(param_2,0xbf800000,pSVar14);
uVar10 = *(uint *)(iVar4 + 0x28);
if (uVar10 != 0xffffffff) {
uVar5 = uVar10 & 0xfff;
puVar11 = (undefined4 *)(g_pEntityList + uVar5 * 0x10 + 4);
if (((puVar11 != (undefined4 *)0x0) &&
(*(uint *)(g_pEntityList + uVar5 * 0x10 + 8) == uVar10 >> 0xc)) &&
(*(int *)(g_pEntityList + uVar5 * 0x10 + 4) != 0)) {
if ((*(byte *)((int)param_2 + 0x14d) & 8) == 0) {
LAB_0090a886:
if (puVar11[1] != uVar10 >> 0xc) goto LAB_0090a894;
this_01 = (CBaseEntity *)*puVar11;
}
else {
CBaseEntity::CalcAbsolutePosition((CBaseEntity *)param_2);
uVar10 = *(uint *)(iVar4 + 0x28);
if ((uVar10 != 0xffffffff) &&
(puVar11 = (undefined4 *)(g_pEntityList + (uVar10 & 0xfff) * 0x10 + 4),
puVar11 != (undefined4 *)0x0)) goto LAB_0090a886;
LAB_0090a894:
this_01 = (CBaseEntity *)0x0;
}
if (((byte)this_01[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition(this_01);
}
local_28 = *(float *)(this_01 + 0x2e0) - *(float *)((int)param_2 + 0x2e0);
local_24 = *(float *)(this_01 + 0x2e4) - *(float *)((int)param_2 + 0x2e4);
local_20 = *(float *)(this_01 + 0x2e8) - *(float *)((int)param_2 + 0x2e8);
lVar12 = (longdouble)VectorNormalize((Vector *)&local_28);
if ((float)lVar12 < 50.0) {
piVar6 = (int *)(**(code **)(*(int *)param_2 + 0x9a4))(param_2);
pfVar8 = (float *)(**(code **)(*piVar6 + 0xbc))(piVar6);
if (0.5 < local_24 * pfVar8[1] + local_28 * *pfVar8 + local_20 * pfVar8[2]) {
*(undefined4 *)(param_1 + 0x4c) = 0;
lVar12 = (longdouble)RandomFloat(0x3f800000,0x40400000);
CountdownTimer::Start((CountdownTimer *)(param_1 + 0x34),(float)lVar12);
this_04 = ::operator_new(0x44);
/* try { // try from 0090a9ac to 0090a9b0 has its CatchHandler @ 0090abe3 */
SurvivorLegsWait::SurvivorLegsWait(this_04,0.0);
pSVar7 = (SurvivorIntention *)(**(code **)(*(int *)param_2 + 0x9a8))(param_2);
SurvivorIntention::ChangeLegs(pSVar7,(Action *)this_04);
}
}
}
}
if (*(int *)(param_1 + 0x4c) == 0) {
if (0.0 < *(float *)(param_1 + 0x3c)) {
this_04 = (SurvivorLegsWait *)(param_1 + 0x50);
cVar3 = (**(code **)(*(int *)((int)param_2 + 0x4028) + 0x118))
((int)param_2 + 0x4028,this_04,0x41a00000);
if (cVar3 != '\0') {
this_04 = ::operator_new(0x44);
/* try { // try from 0090aa8b to 0090aa8f has its CatchHandler @ 0090ab24 */
SurvivorLegsWait::SurvivorLegsWait(this_04,0.0);
pSVar7 = (SurvivorIntention *)(**(code **)(*(int *)param_2 + 0x9a8))(param_2);
SurvivorIntention::ChangeLegs(pSVar7,(Action *)this_04);
}
}
lVar12 = (longdouble)CountdownTimer::Now();
if (((float)lVar12 < *(float *)(param_1 + 0x3c)) ||
(this_02 = (CNavArea *)(**(code **)(*(int *)param_2 + 0x52c))(param_2),
this_02 == (CNavArea *)0x0)) {
LAB_0090aa62:
if (*(int *)(param_1 + 0x4c) == 0) goto LAB_0090a428;
}
else if ((*(CNavArea **)(param_1 + 0x4c) == (CNavArea *)0x0) ||
(this_02 == *(CNavArea **)(param_1 + 0x4c))) {
uVar9 = RandomInt(0,3);
this_03 = (TerrorNavArea *)CNavArea::GetRandomAdjacentArea(this_02,uVar9);
*(TerrorNavArea **)(param_1 + 0x4c) = this_03;
if (this_03 == (TerrorNavArea *)0x0) goto LAB_0090a428;
iVar4 = TerrorNavArea::GetDoor(this_03);
if ((((iVar4 == 0) && (((byte)this_03[0x12d] & 8) != 0)) &&
(pCVar2 = *(CNavArea **)(param_1 + 0x4c), pCVar2 != (CNavArea *)0x0)) &&
(pCVar2[0x38] == (CNavArea)0x0)) {
lVar12 = (longdouble)CNavArea::ComputeHeightChange(this_02,pCVar2);
piVar6 = (int *)(**(code **)(*(int *)param_2 + 0x9a0))(param_2);
lVar13 = (longdouble)(**(code **)(*piVar6 + 0x130))(piVar6);
if (ABS((float)lVar12) < (float)lVar13 * 0.5) {
this_04 = *(SurvivorLegsWait **)(param_1 + 0x4c);
TerrorNavArea::FindRandomSpot();
*(float *)(param_1 + 0x50) = local_28;
*(float *)(param_1 + 0x54) = local_24;
*(float *)(param_1 + 0x58) = local_20;
goto LAB_0090aa62;
}
}
*(undefined4 *)(param_1 + 0x4c) = 0;
goto LAB_0090a428;
}
}
piVar6 = (int *)(**(code **)(*(int *)param_2 + 0x9a4))(param_2,this_04);
pcVar1 = *(code **)(*piVar6 + 0xc0);
(**(code **)(*(int *)param_2 + 0x234))(local_34,param_2);
local_24 = *(float *)(param_1 + 0x54);
local_28 = *(float *)(param_1 + 0x50);
local_20 = (float)local_2c;
(*pcVar1)(piVar6,(Action *)&local_28,1,0x3f800000,0,"Looking towards next wander spot",1,
0x3e800000);
piVar6 = (int *)(**(code **)(*(int *)param_2 + 0x9a4))(param_2);
cVar3 = (**(code **)(*piVar6 + 200))(piVar6);
if (cVar3 != '\0') {
this_00 = ::operator_new(0x9050);
/* try { // try from 0090a7a9 to 0090a7ad has its CatchHandler @ 0090abe8 */
SurvivorLegsApproach::SurvivorLegsApproach(this_00,(Vector *)(param_1 + 0x50));
pSVar7 = (SurvivorIntention *)(**(code **)(*(int *)param_2 + 0x9a8))(param_2);
SurvivorIntention::ChangeLegs(pSVar7,(Action *)this_00);
*(undefined4 *)(param_1 + 0x4c) = 0;
lVar12 = (longdouble)RandomFloat(0x40400000,0x41a00000);
CountdownTimer::Start((CountdownTimer *)(param_1 + 0x34),(float)lVar12);
}
LAB_0090a428:
*(undefined4 *)this = 0;
*(undefined4 *)(this + 4) = 0;
*(undefined4 *)(this + 8) = 0;
return this;
}
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.