RestoreTransitionedSurvivorBots
0x008f7bb0 · 1191 bytes · unknown
_Z31RestoreTransitionedSurvivorBotsv
Decompiled
undefined (0 params)
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* WARNING: Unknown calling convention -- yet parameter storage is locked */
/* RestoreTransitionedSurvivorBots() */
void RestoreTransitionedSurvivorBots(void)
{
PlayerSaveData *this;
code *pcVar1;
CBaseEdict *pCVar2;
char cVar3;
SurvivorBot SVar4;
int *piVar5;
int iVar6;
undefined4 uVar7;
char *pcVar8;
SurvivorBot *this_00;
uint uVar9;
Checkpoint *pCVar10;
int iVar11;
int iVar12;
double dVar13;
undefined8 in_stack_ffffffb8;
char local_20;
if (DAT_0100e504 == 0) {
return;
}
iVar12 = 0;
dVar13 = (double)CONCAT44((int)((ulonglong)in_stack_ffffffb8 >> 0x20),DAT_0100e504);
UTIL_LogPrintf("Preparing to restore %d survivor bots after map transition...\n",DAT_0100e504);
piVar5 = (int *)GetGlobalTeam(2);
if (0 < DAT_0100e504) {
do {
while ((iVar6 = (**(code **)(*piVar5 + 0x354))(piVar5), 3 < iVar6 ||
(cVar3 = CDirector::NoSurvivorBots(TheDirector), cVar3 != '\0'))) {
LAB_008f7c00:
iVar12 = iVar12 + 1;
if (DAT_0100e504 <= iVar12) goto LAB_008f7de0;
}
this = (PlayerSaveData *)(g_SavedSurvivorBots + iVar12 * 4);
UTIL_LogPrintf("Attempting to spawn a survivor bot\n",dVar13);
dVar13 = 6.39798015506197e-317;
uVar7 = KeyValues::GetInt(*(KeyValues **)this,"character",0);
pcVar8 = (char *)SurvivorCharacterDisplayName(uVar7);
this_00 = NextBotCreatePlayerBot<SurvivorBot>(pcVar8);
if (this_00 == (SurvivorBot *)0x0) goto LAB_008f7c00;
cVar3 = CDirector::IsTransitionScenarioRestart();
if (cVar3 == '\0') {
CDirector::OnPlayerTransitioned(TheDirector);
}
(**(code **)(*(int *)this_00 + 0x8d0))(this_00,1);
uVar9 = KeyValues::GetInt(*(KeyValues **)this,"reportid",0);
CTerrorPlayer::SetPlayerReportID((CTerrorPlayer *)this_00,uVar9);
(**(code **)(*(int *)this_00 + 0x8cc))(this_00,2,uVar7,0);
PlayerSaveData::Restore(this,(CTerrorPlayer *)this_00);
pcVar1 = *(code **)(*engine + 0x15c);
uVar7 = KeyValues::GetString(*(KeyValues **)this,"idealName","");
(*pcVar1)(engine,*(undefined4 *)(this_00 + 0x30),"name",uVar7);
(**(code **)(*(int *)this_00 + 0x8d0))(this_00,0);
cVar3 = CDirector::IsInTransition(TheDirector);
if ((cVar3 != '\0') && (cVar3 = (**(code **)(*(int *)this_00 + 300))(this_00), cVar3 == '\0'))
{
pCVar10 = (Checkpoint *)TerrorNavMesh::GetInitialCheckpoint(TheNavMesh);
CTerrorPlayer::CheckpointRespawn((CTerrorPlayer *)this_00,pCVar10);
iVar6 = KeyValues::GetInt(*(KeyValues **)this,"skin",0);
if (iVar6 != *(int *)(this_00 + 0x458)) {
if (this_00[0x6c] == (SurvivorBot)0x0) {
pCVar2 = *(CBaseEdict **)(this_00 + 0x30);
if (pCVar2 != (CBaseEdict *)0x0) {
*(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
iVar11 = CBaseEdict::GetChangeAccessor(pCVar2);
*(undefined2 *)(iVar11 + 2) = 0;
}
}
else {
this_00[0x70] = (SurvivorBot)((byte)this_00[0x70] | 1);
}
*(int *)(this_00 + 0x458) = iVar6;
}
}
iVar6 = CBaseEntity::GetTeamNumber((CBaseEntity *)this_00);
if ((iVar6 == 2) &&
(cVar3 = CDirectorChallengeMode::HealingGnome
(*(CDirectorChallengeMode **)(TheDirector + 0x648)), cVar3 != '\0')) {
iVar6 = (**(code **)(*(int *)this_00 + 0x1fc))(this_00);
CTerrorPlayer::AddHealthBuffer((CTerrorPlayer *)this_00,100.0,(float)iVar6);
iVar6 = CBaseEntity::GetTeamNumber((CBaseEntity *)this_00);
cVar3 = IsASurvivorTeam(iVar6);
if (cVar3 == '\0') {
local_20 = '\0';
}
else {
local_20 = CTerrorPlayer::IsOnThirdStrike((CTerrorPlayer *)this_00);
}
if (*(int *)(this_00 + 0x2e54) != 0) {
if (this_00[0x6c] == (SurvivorBot)0x0) {
pCVar2 = *(CBaseEdict **)(this_00 + 0x30);
if (pCVar2 != (CBaseEdict *)0x0) {
*(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
iVar6 = CBaseEdict::GetChangeAccessor(pCVar2);
*(undefined2 *)(iVar6 + 2) = 0;
}
}
else {
this_00[0x70] = (SurvivorBot)((byte)this_00[0x70] | 1);
}
*(undefined4 *)(this_00 + 0x2e54) = 0;
}
SVar4 = (SurvivorBot)CTerrorPlayer::IsOnThirdStrike((CTerrorPlayer *)this_00);
if (SVar4 != this_00[0x2e58]) {
if (this_00[0x6c] == (SurvivorBot)0x0) {
pCVar2 = *(CBaseEdict **)(this_00 + 0x30);
if (pCVar2 != (CBaseEdict *)0x0) {
*(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
iVar6 = CBaseEdict::GetChangeAccessor(pCVar2);
*(undefined2 *)(iVar6 + 2) = 0;
}
}
else {
this_00[0x70] = (SurvivorBot)((byte)this_00[0x70] | 1);
}
this_00[0x2e58] = SVar4;
}
cVar3 = CTerrorPlayer::IsOnThirdStrike((CTerrorPlayer *)this_00);
if (cVar3 == '\0') {
if (local_20 != '\0') {
CTerrorPlayer::StopTrackedSound((CTerrorPlayer *)this_00,"Player.Heartbeat");
}
}
else {
CTerrorPlayer::StopTrackedSound((CTerrorPlayer *)this_00,"Player.Heartbeat");
CCSPlayer::EmitPrivateSound((CCSPlayer *)this_00,"Player.Heartbeat");
CTerrorPlayer::TrackSound((CTerrorPlayer *)this_00,"Player.Heartbeat");
}
}
if (((byte)this_00[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this_00);
}
iVar12 = iVar12 + 1;
dVar13 = (double)*(float *)(this_00 + 0x2e0);
UTIL_LogPrintf("Survivor bot restored after map transition at %.0f,%.0f,%.0f!\n",dVar13,
(double)*(float *)(this_00 + 0x2e4),(double)*(float *)(this_00 + 0x2e8));
} while (iVar12 < DAT_0100e504);
}
LAB_008f7de0:
iVar12 = 0;
CUtlVector<SurvivorBotSaveData,CUtlMemory<SurvivorBotSaveData,int>>::RemoveAll
((CUtlVector<SurvivorBotSaveData,CUtlMemory<SurvivorBotSaveData,int>> *)
&g_SavedLevelRestartSurvivorBots);
if (0 < DAT_0100e504) {
do {
iVar6 = iVar12 * 4;
iVar12 = iVar12 + 1;
CUtlVector<SurvivorBotSaveData,CUtlMemory<SurvivorBotSaveData,int>>::InsertBefore
((CUtlVector<SurvivorBotSaveData,CUtlMemory<SurvivorBotSaveData,int>> *)
&g_SavedLevelRestartSurvivorBots,DAT_0100e4f0,
(SurvivorBotSaveData *)(g_SavedSurvivorBots + iVar6));
} while (iVar12 < DAT_0100e504);
}
CUtlVector<SurvivorBotSaveData,CUtlMemory<SurvivorBotSaveData,int>>::RemoveAll
((CUtlVector<SurvivorBotSaveData,CUtlMemory<SurvivorBotSaveData,int>> *)
&g_SavedSurvivorBots);
CUtlMemory<SurvivorBotSaveData,int>::Purge
((CUtlMemory<SurvivorBotSaveData,int> *)&g_SavedSurvivorBots);
_DAT_0100e508 = g_SavedSurvivorBots;
return;
}
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.