CDirector::ProcessTransitionRestoration
0x00878190 · 1543 bytes · __thiscall
_ZN9CDirector28ProcessTransitionRestorationEv
Decompiled
undefined (1 param)
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* CDirector::ProcessTransitionRestoration() */
CDirector __thiscall CDirector::ProcessTransitionRestoration(CDirector *this)
{
uint *puVar1;
CDirector CVar2;
char cVar3;
int iVar4;
int iVar5;
CBaseEntity *this_00;
undefined4 uVar6;
int local_44;
int local_40;
int local_3c;
int local_38;
int local_34;
undefined4 local_30;
int local_28;
undefined4 local_24;
int local_20;
iVar4 = GetSavedSurvivorBotCount();
if (0 < iVar4) {
TransitionedPlayerCount(&local_34,&local_28,2);
if (((local_34 == 0) || (0 < local_28)) ||
((cVar3 = CTerrorGameRules::HasPlayerControlledZombies(), cVar3 != '\0' &&
((TransitionedPlayerCount(&local_34,&local_28,3), local_34 == 0 || (0 < local_28)))))) {
RestoreTransitionedSurvivorBots();
}
}
if ((this[0x28e] == (CDirector)0x0) && (cVar3 = IsTransitioned(), cVar3 == '\0')) {
return (CDirector)0x0;
}
CVar2 = this[0x28c];
if (CVar2 != (CDirector)0x0) {
TransitionedPlayerCount(&local_44,&local_40,2);
iVar4 = GetActivePlayerCount(this,2,1);
cVar3 = CTerrorGameRules::HasPlayerControlledZombies();
if (cVar3 == '\0') {
local_38 = 0;
iVar5 = 0;
local_3c = 0;
}
else {
TransitionedPlayerCount(&local_3c,&local_38,3);
iVar5 = GetActivePlayerCount(this,3,1);
}
if (((local_40 == local_44) && (local_38 == local_3c)) || ((iVar5 == 4 && (iVar4 == 4)))) {
local_34 = 0;
local_30 = 0;
if (_towlower == 0) {
local_20 = 0;
}
else {
(**(code **)(_towlower + 0x50))
(_towlower,&local_34,0,0,0,0,"/data/src/game/server/terror/director.cpp",0x924,
&ProcessTransitionRestoration()::tm_fmt,"(%s)%s","NPCs",
"Director::ProcessTransitionRestoration - restore");
local_20 = _towlower;
}
iVar4 = _DAT_0105db00;
local_28 = local_34;
local_24 = local_30;
/* try { // try from 008784ab to 008784af has its CatchHandler @ 0087879c */
if (((_DAT_0105d154 != 0) || (DAT_0105d158 == '\0')) &&
(iVar5 = ThreadGetCurrentId(), iVar4 == iVar5)) {
if ((char *)*_DAT_0105d15c != "Director::ProcessTransitionRestoration - restore") {
/* try { // try from 0087876c to 0087878f has its CatchHandler @ 0087879c */
_DAT_0105d15c =
(int *)CVProfNode::GetSubNode((char *)_DAT_0105d15c,0xcdd998,(char *)0x0,0xc8fa6a);
}
puVar1 = (uint *)(_DAT_0105d1e8 + 4 + _DAT_0105d15c[0x1c] * 8);
*puVar1 = *puVar1 | 4;
CVProfNode::EnterScope();
DAT_0105d158 = '\0';
}
this[0x28c] = (CDirector)0x0;
this[0x280] = (CDirector)0x1;
if (this[0x28d] == (CDirector)0x0) {
/* try { // try from 00878705 to 00878707 has its CatchHandler @ 008787c3 */
(**(code **)(*TheNavMesh + 0x4c))(TheNavMesh);
}
if (local_40 == 0) {
local_40 = 1;
}
/* try { // try from 008784e1 to 00878544 has its CatchHandler @ 008787c3 */
cVar3 = IsPressDemoMode();
if ((cVar3 != '\0') && (-1 < *(int *)(gpGlobals + 0x14))) {
iVar4 = 0;
LAB_0087853d:
do {
this_00 = (CBaseEntity *)UTIL_PlayerByIndex(iVar4);
if ((this_00 != (CBaseEntity *)0x0) && (*(int *)(this_00 + 0x30) != 0)) {
if (*(int *)(this_00 + 0x30) - *(int *)(gpGlobals + 0x58) >> 4 == 0) {
iVar4 = iVar4 + 1;
if (*(int *)(gpGlobals + 0x14) < iVar4) break;
goto LAB_0087853d;
}
cVar3 = (**(code **)(*(int *)this_00 + 0x16c))(this_00);
if ((((cVar3 != '\0') && (*(int *)(this_00 + 0x1f6c) != 2)) &&
(iVar5 = CBaseEntity::GetTeamNumber(this_00), iVar5 == 2)) &&
(*(int *)(this_00 + 0x100) != 100)) {
/* try { // try from 008786a4 to 008786a9 has its CatchHandler @ 008787c3 */
(**(code **)(*(int *)this_00 + 0x214))(this_00,this_00 + 0x100);
*(undefined4 *)(this_00 + 0x100) = 100;
}
}
iVar4 = iVar4 + 1;
} while (iVar4 <= *(int *)(gpGlobals + 0x14));
}
iVar4 = _DAT_0105db00;
if (((DAT_0105d158 == '\0') || (_DAT_0105d154 != 0)) &&
(iVar5 = ThreadGetCurrentId(), iVar4 == iVar5)) {
cVar3 = CVProfNode::ExitScope();
if (cVar3 != '\0') {
_DAT_0105d15c = (int *)_DAT_0105d15c[0x19];
}
DAT_0105d158 = _DAT_0105d15c == (int *)0x105d160;
}
if (local_20 != 0) {
(**(code **)(local_20 + 0x54))(local_20,local_28,local_24,0,0,0);
}
}
if ((local_40 != 0) || (local_38 != 0)) {
local_34 = 0;
local_30 = 0;
if (_towlower == 0) {
local_20 = 0;
}
else {
(**(code **)(_towlower + 0x50))
(_towlower,&local_34,0,0,0,0,"/data/src/game/server/terror/director.cpp",0x944,
&ProcessTransitionRestoration()::tm_fmt,"(%s)%s","NPCs",
"Director::ProcessTransitionRestoration - recreate");
local_20 = _towlower;
}
iVar4 = _DAT_0105db00;
local_28 = local_34;
local_24 = local_30;
/* try { // try from 00878322 to 00878326 has its CatchHandler @ 008787b1 */
if (((_DAT_0105d154 != 0) || (DAT_0105d158 == '\0')) &&
(iVar5 = ThreadGetCurrentId(), iVar4 == iVar5)) {
if ((char *)*_DAT_0105d15c != "Director::ProcessTransitionRestoration - recreate") {
/* try { // try from 00878655 to 00878678 has its CatchHandler @ 008787b1 */
_DAT_0105d15c =
(int *)CVProfNode::GetSubNode((char *)_DAT_0105d15c,0xcdd9cc,(char *)0x0,0xc8fa6a);
}
puVar1 = (uint *)(_DAT_0105d1e8 + 4 + _DAT_0105d15c[0x1c] * 8);
*puVar1 = *puVar1 | 4;
CVProfNode::EnterScope();
DAT_0105d158 = '\0';
}
/* try { // try from 0087832f to 00878349 has its CatchHandler @ 008787b3 */
cVar3 = CTerrorGameRules::HasPlayerControlledZombies();
if (cVar3 == '\0') {
/* try { // try from 0087860f to 00878613 has its CatchHandler @ 008787b3 */
RestoreTransitionedEntities();
}
uVar6 = *(undefined4 *)(this + 0x628);
iVar4 = CDirectorTacticalServices::GetRandomSurvivor();
if (iVar4 != 0) {
this[0x28d] = (CDirector)0x1;
}
iVar4 = _DAT_0105db00;
if (((DAT_0105d158 == '\0') || (_DAT_0105d154 != 0)) &&
(iVar5 = ThreadGetCurrentId(uVar6), iVar4 == iVar5)) {
cVar3 = CVProfNode::ExitScope();
if (cVar3 != '\0') {
_DAT_0105d15c = (int *)_DAT_0105d15c[0x19];
}
DAT_0105d158 = _DAT_0105d15c == (int *)0x105d160;
}
if (local_20 != 0) {
(**(code **)(local_20 + 0x54))(local_20,local_28,local_24,0,0,0);
return CVar2;
}
}
}
return CVar2;
}
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.