SurvivorCheckpointReached::Update
0x00917720 · 1489 bytes · __thiscall
_ZN25SurvivorCheckpointReached6UpdateEP11SurvivorBotf
Decompiled
undefined (3 params)
/* SurvivorCheckpointReached::Update(SurvivorBot*, float) */
SurvivorCheckpointReached * __thiscall
SurvivorCheckpointReached::Update
(SurvivorCheckpointReached *this,SurvivorBot *param_1,float param_2)
{
float fVar1;
code *pcVar2;
char cVar3;
TerrorNavArea *pTVar4;
CBaseEntity *pCVar5;
int *piVar6;
undefined4 uVar7;
SurvivorUseObject *this_00;
SurvivorLegsWait *this_01;
Vector *pVVar8;
int iVar9;
SurvivorLegsApproach *this_02;
undefined4 *puVar10;
longdouble lVar11;
Action *local_40;
CAI_Concept local_38 [8];
int local_30;
CBaseEntity *local_2c;
undefined4 local_28;
undefined4 local_24;
undefined4 local_20;
if (*(int *)(param_1 + 0x34) != 0) {
pTVar4 = (TerrorNavArea *)(**(code **)(*(int *)param_2 + 0x52c))(param_2);
cVar3 = Checkpoint::ContainsArea(*(Checkpoint **)(param_1 + 0x34),pTVar4);
if (cVar3 != '\0') {
cVar3 = SurvivorBot::ShouldLeaveSaferoomToHelpTeammates();
if (cVar3 != '\0') {
*(undefined4 *)this = 3;
*(undefined4 *)(this + 4) = 0;
*(char **)(this + 8) = "We\'re leaving the checkpoint to help a teammate";
return this;
}
lVar11 = (longdouble)CountdownTimer::Now();
if (*(float *)(param_1 + 0x40) <= (float)lVar11) {
lVar11 = (longdouble)RandomFloat(0x3f800000,0x40000000);
fVar1 = (float)lVar11;
lVar11 = (longdouble)CountdownTimer::Now();
if ((float)lVar11 + fVar1 != *(float *)(param_1 + 0x40)) {
(**(code **)(*(int *)(param_1 + 0x38) + 4))(param_1 + 0x38,param_1 + 0x40);
*(float *)(param_1 + 0x40) = (float)lVar11 + fVar1;
}
if (fVar1 != *(float *)(param_1 + 0x3c)) {
(**(code **)(*(int *)(param_1 + 0x38) + 4))(param_1 + 0x38,param_1 + 0x3c);
*(float *)(param_1 + 0x3c) = fVar1;
}
pCVar5 = (CBaseEntity *)Checkpoint::GetOpenDoor(*(Checkpoint **)(param_1 + 0x34));
if (pCVar5 != (CBaseEntity *)0x0) {
lVar11 = (longdouble)CountdownTimer::Now();
if (*(float *)(param_1 + 0x4c) <= (float)lVar11) {
fVar1 = *(float *)(SurvivorBotCloseCheckpointDoorInterval._28_4_ + 0x2c);
lVar11 = (longdouble)CountdownTimer::Now();
if ((float)lVar11 + fVar1 != *(float *)(param_1 + 0x4c)) {
(**(code **)(*(int *)(param_1 + 0x44) + 4))(param_1 + 0x44,param_1 + 0x4c);
*(float *)(param_1 + 0x4c) = (float)lVar11 + fVar1;
}
if (fVar1 != *(float *)(param_1 + 0x48)) {
(**(code **)(*(int *)(param_1 + 0x44) + 4))(param_1 + 0x44,param_1 + 0x48);
*(float *)(param_1 + 0x48) = fVar1;
}
local_30 = *(int *)(param_1 + 0x34);
local_28 = CONCAT22(local_28._2_2_,0x101);
local_24 = 0;
local_20 = 0x4cbebc20;
local_2c = pCVar5;
ForEachSurvivor<SealCheckpointCheck>((SealCheckpointCheck *)&local_30);
cVar3 = CDirector::IsAllBotSurvivorTeam();
if ((((cVar3 != '\0') || (local_28._1_1_ != '\0')) && ((char)local_28 != '\0')) &&
(cVar3 = (**(code **)(*(int *)((int)param_2 + 0x4028) + 0xe0))
((int)param_2 + 0x4028,local_24), cVar3 != '\0')) {
pcVar2 = *(code **)(*(int *)param_2 + 0x7b4);
CAI_Concept::CAI_Concept(local_38,"SurvivorBotMovingToCloseCheckpointDoor");
(*pcVar2)(param_2,local_38,1,0,0,0,0);
piVar6 = (int *)(**(code **)(*(int *)param_2 + 0x9a4))(param_2);
pcVar2 = *(code **)(*piVar6 + 0xc0);
uVar7 = (**(code **)(*(int *)pCVar5 + 0x288))(pCVar5);
(*pcVar2)(piVar6,uVar7,3,0x40a00000,0,"Look at door we\'re closing",1,0x3e800000);
this_00 = ::operator_new(0x68);
/* try { // try from 009179f9 to 009179fd has its CatchHandler @ 00917d55 */
SurvivorUseObject::SurvivorUseObject(this_00,pCVar5);
*(undefined4 *)(param_1 + 0x20) = 0;
*(undefined4 *)(param_1 + 0x24) = 0;
*(undefined4 *)(param_1 + 0x28) = 0;
*(undefined4 *)(param_1 + 0x2c) = 0;
*(undefined4 *)this = 2;
*(SurvivorUseObject **)(this + 4) = this_00;
*(char **)(this + 8) = "Closing the checkpoint door";
return this;
}
}
cVar3 = (**(code **)(*(int *)((int)param_2 + 0x4028) + 0x114))
((int *)((int)param_2 + 0x4028),pCVar5,0x43160000);
if (cVar3 == '\0') {
this_01 = ::operator_new(0x44);
/* try { // try from 00917a52 to 00917a56 has its CatchHandler @ 00917d71 */
SurvivorLegsWait::SurvivorLegsWait(this_01,0.0);
iVar9 = (**(code **)(*(int *)param_2 + 0x9a8))(param_2);
piVar6 = *(int **)(iVar9 + 0x20 + *(int *)(iVar9 + 0x60) * 4);
puVar10 = ::operator_new(0x38);
*puVar10 = &PTR__Behavior_00d00308;
puVar10[1] = &PTR__Behavior_00d003d0;
/* try { // try from 00917aa3 to 00917aa7 has its CatchHandler @ 00917d6a */
CFmtStrN<32>::CFmtStrN((CFmtStrN<32> *)(puVar10 + 3),"%s",&DAT_00d539c2);
puVar10[2] = this_01;
*(undefined4 **)(iVar9 + 0x20 + *(int *)(iVar9 + 0x60) * 4) = puVar10;
if (piVar6 != (int *)0x0) {
(**(code **)(*piVar6 + 4))(piVar6);
}
}
else {
pVVar8 = (Vector *)(**(code **)(*(int *)pCVar5 + 0x288))(pCVar5);
iVar9 = Checkpoint::GetAreaFarthestFrom(*(Checkpoint **)(param_1 + 0x34),pVVar8);
if (iVar9 != 0) {
TerrorNavArea::FindRandomSpot();
this_02 = ::operator_new(0x9050);
/* try { // try from 00917c47 to 00917c4b has its CatchHandler @ 00917d40 */
SurvivorLegsApproach::SurvivorLegsApproach(this_02,(Vector *)&local_30);
iVar9 = (**(code **)(*(int *)param_2 + 0x9a8))(param_2);
piVar6 = *(int **)(iVar9 + 0x20 + *(int *)(iVar9 + 0x60) * 4);
puVar10 = ::operator_new(0x38);
*puVar10 = &PTR__Behavior_00d00308;
puVar10[1] = &PTR__Behavior_00d003d0;
/* try { // try from 00917c98 to 00917c9c has its CatchHandler @ 00917d1e */
CFmtStrN<32>::CFmtStrN((CFmtStrN<32> *)(puVar10 + 3),"%s",&DAT_00d539c2);
puVar10[2] = this_02;
*(undefined4 **)(iVar9 + 0x20 + *(int *)(iVar9 + 0x60) * 4) = puVar10;
if (piVar6 != (int *)0x0) {
(**(code **)(*piVar6 + 4))(piVar6);
}
}
}
}
}
local_40 = (Action *)&local_30;
SurvivorBot::SaveFriendsInImmediateTrouble(local_40);
if (((2 < local_30 - 1U) && (SurvivorBot::UseHealingItems(local_40), 2 < local_30 - 1U)) &&
((SurvivorBot::RescueImmobilizedFriends(local_40), 2 < local_30 - 1U &&
(SurvivorBot::ScavengeNearbyItems(local_40), 2 < local_30 - 1U)))) {
*(undefined4 *)this = 0;
*(undefined4 *)(this + 4) = 0;
*(undefined4 *)(this + 8) = 0;
return this;
}
*(int *)this = local_30;
*(CBaseEntity **)(this + 4) = local_2c;
*(undefined4 *)(this + 8) = local_28;
return this;
}
}
*(undefined4 *)this = 3;
*(undefined4 *)(this + 4) = 0;
*(char **)(this + 8) = "We left the checkpoint";
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.