CDirector::InitScripts
0x0087e080 · 2201 bytes · __thiscall
_ZN9CDirector11InitScriptsEv
Decompiled
undefined (1 param)
/* CDirector::InitScripts() */
undefined4 __thiscall CDirector::InitScripts(CDirector *this)
{
int iVar1;
HSCRIPT__ *pHVar2;
undefined4 uVar3;
CDirector *pCVar4;
int iVar5;
CBaseEntity *this_00;
undefined1 *local_28 [2];
undefined2 local_20;
ushort local_1e;
if (*(float *)(this + 0x4dc) != -1.0) {
(**(code **)(*(int *)(this + 0x4d4) + 4))(this + 0x4d4,this + 0x4dc);
*(undefined4 *)(this + 0x4dc) = 0xbf800000;
}
if (g_pScriptVM == (int *)0x0) {
iVar5 = 0;
pCVar4 = this;
do {
*(undefined4 *)(pCVar4 + 0x488) = 0xffffffff;
*(undefined4 *)(pCVar4 + 0x48c) = 0;
if (*(undefined4 **)(this + (int)(pCVar4 + (0x490 - (int)this))) !=
&CUtlVectorUltraConservative<HSCRIPT__**,CUtlVectorUltraConservativeAllocator>::
StaticData()::staticData) {
free(*(undefined4 **)(this + (int)(pCVar4 + (0x490 - (int)this))));
*(undefined4 **)(this + (int)(pCVar4 + (0x490 - (int)this))) =
&CUtlVectorUltraConservative<HSCRIPT__**,CUtlVectorUltraConservativeAllocator>::
StaticData()::staticData;
}
*(undefined4 *)(this + iVar5 * 4 + 0x4c4) = 0;
iVar5 = iVar5 + 1;
pCVar4 = pCVar4 + 0xc;
} while (iVar5 != 4);
*(undefined4 *)(this + 0x4b8) = 0xffffffff;
uVar3 = 0;
*(undefined4 *)(this + 0x4bc) = 0;
if (*(undefined4 **)(this + 0x4c0) !=
&CUtlVectorUltraConservative<HSCRIPT__**,CUtlVectorUltraConservativeAllocator>::StaticData()
::staticData) {
free(*(undefined4 **)(this + 0x4c0));
*(undefined4 **)(this + 0x4c0) =
&CUtlVectorUltraConservative<HSCRIPT__**,CUtlVectorUltraConservativeAllocator>::
StaticData()::staticData;
return 0;
}
}
else {
pCVar4 = this + 0x488;
iVar5 = 1;
TermScripts(this);
if (*(int *)pCVar4 == -1) goto LAB_0087e0d7;
while (iVar5 != 3) {
while( true ) {
pCVar4 = pCVar4 + 0xc;
iVar5 = iVar5 + 1;
if (*(int *)pCVar4 != -1) break;
LAB_0087e0d7:
if (iVar5 == 1) {
iVar1 = (**(code **)(*g_pScriptVM + 0x3c))(g_pScriptVM,"DirectorScript",0);
*(int *)pCVar4 = iVar1;
}
else {
iVar1 = 0;
if (*(int *)(pCVar4 + -0xc) != -1) {
iVar1 = *(int *)(pCVar4 + -0xc);
}
iVar1 = (**(code **)(*g_pScriptVM + 0x3c))
(g_pScriptVM,(&PTR_s_c1m1_hotel_00ce0fa4)[iVar5],iVar1);
*(int *)pCVar4 = iVar1;
if (iVar5 == 3) goto LAB_0087e118;
}
}
}
LAB_0087e118:
local_20 = 5;
local_1e = 0;
local_28[0] = &DAT_ffffffff;
/* try { // try from 0087e151 to 0087e153 has its CatchHandler @ 0087e942 */
(**(code **)(*g_pScriptVM + 0x78))
(g_pScriptVM,*(undefined4 *)(this + 0x488),"SPAWN_NO_PREFERENCE",local_28);
if ((local_1e & 1) != 0) {
free(local_28[0]);
}
local_28[0] = (undefined1 *)0x0;
local_20 = 5;
local_1e = 0;
/* try { // try from 0087e194 to 0087e196 has its CatchHandler @ 0087e93b */
(**(code **)(*g_pScriptVM + 0x78))
(g_pScriptVM,*(undefined4 *)(this + 0x488),"SPAWN_ANYWHERE",local_28);
if ((local_1e & 1) != 0) {
free(local_28[0]);
}
local_28[0] = (undefined1 *)0x1;
local_20 = 5;
local_1e = 0;
/* try { // try from 0087e1d7 to 0087e1d9 has its CatchHandler @ 0087e939 */
(**(code **)(*g_pScriptVM + 0x78))
(g_pScriptVM,*(undefined4 *)(this + 0x488),"SPAWN_BEHIND_SURVIVORS",local_28);
if ((local_1e & 1) != 0) {
free(local_28[0]);
}
local_28[0] = (undefined1 *)0x2;
local_20 = 5;
local_1e = 0;
/* try { // try from 0087e21a to 0087e21c has its CatchHandler @ 0087e927 */
(**(code **)(*g_pScriptVM + 0x78))
(g_pScriptVM,*(undefined4 *)(this + 0x488),"SPAWN_NEAR_IT_VICTIM",local_28);
if ((local_1e & 1) != 0) {
free(local_28[0]);
}
local_28[0] = (undefined1 *)0x3;
local_1e = 0;
local_20 = 5;
/* try { // try from 0087e25d to 0087e25f has its CatchHandler @ 0087e982 */
(**(code **)(*g_pScriptVM + 0x78))
(g_pScriptVM,*(undefined4 *)(this + 0x488),"SPAWN_SPECIALS_IN_FRONT_OF_SURVIVORS",
local_28);
if ((local_1e & 1) != 0) {
free(local_28[0]);
}
local_1e = 0;
local_20 = 5;
local_28[0] = (undefined1 *)0x4;
/* try { // try from 0087e2a0 to 0087e2a2 has its CatchHandler @ 0087e976 */
(**(code **)(*g_pScriptVM + 0x78))
(g_pScriptVM,*(undefined4 *)(this + 0x488),"SPAWN_SPECIALS_ANYWHERE",local_28);
if ((local_1e & 1) != 0) {
free(local_28[0]);
}
local_28[0] = (undefined1 *)0x5;
local_20 = 5;
local_1e = 0;
/* try { // try from 0087e2e3 to 0087e2e5 has its CatchHandler @ 0087e974 */
(**(code **)(*g_pScriptVM + 0x78))
(g_pScriptVM,*(undefined4 *)(this + 0x488),"SPAWN_FAR_AWAY_FROM_SURVIVORS",local_28);
if ((local_1e & 1) != 0) {
free(local_28[0]);
}
local_28[0] = (undefined1 *)0x6;
local_20 = 5;
local_1e = 0;
/* try { // try from 0087e326 to 0087e328 has its CatchHandler @ 0087e972 */
(**(code **)(*g_pScriptVM + 0x78))
(g_pScriptVM,*(undefined4 *)(this + 0x488),"SPAWN_ABOVE_SURVIVORS",local_28);
if ((local_1e & 1) != 0) {
free(local_28[0]);
}
local_28[0] = (undefined1 *)0x7;
local_20 = 5;
local_1e = 0;
/* try { // try from 0087e369 to 0087e36b has its CatchHandler @ 0087e994 */
(**(code **)(*g_pScriptVM + 0x78))
(g_pScriptVM,*(undefined4 *)(this + 0x488),"SPAWN_IN_FRONT_OF_SURVIVORS",local_28);
if ((local_1e & 1) != 0) {
free(local_28[0]);
}
local_20 = 5;
local_1e = 0;
local_28[0] = (undefined1 *)0x8;
/* try { // try from 0087e3ac to 0087e3ae has its CatchHandler @ 0087e992 */
(**(code **)(*g_pScriptVM + 0x78))
(g_pScriptVM,*(undefined4 *)(this + 0x488),"SPAWN_VERSUS_FINALE_DISTANCE",local_28);
if ((local_1e & 1) != 0) {
free(local_28[0]);
}
local_28[0] = (undefined1 *)0x9;
local_20 = 5;
local_1e = 0;
/* try { // try from 0087e3ef to 0087e3f1 has its CatchHandler @ 0087e986 */
(**(code **)(*g_pScriptVM + 0x78))
(g_pScriptVM,*(undefined4 *)(this + 0x488),"SPAWN_LARGE_VOLUME",local_28);
if ((local_1e & 1) != 0) {
free(local_28[0]);
}
local_28[0] = (undefined1 *)0xa;
local_20 = 5;
local_1e = 0;
/* try { // try from 0087e432 to 0087e434 has its CatchHandler @ 0087e984 */
(**(code **)(*g_pScriptVM + 0x78))
(g_pScriptVM,*(undefined4 *)(this + 0x488),"SPAWN_NEAR_POSITION",local_28);
if ((local_1e & 1) != 0) {
free(local_28[0]);
}
local_28[0] = (undefined1 *)0x7;
local_20 = 5;
local_1e = 0;
/* try { // try from 0087e475 to 0087e477 has its CatchHandler @ 0087e954 */
(**(code **)(*g_pScriptVM + 0x78))
(g_pScriptVM,*(undefined4 *)(this + 0x488),"ZOMBIE_WITCH",local_28);
if ((local_1e & 1) != 0) {
free(local_28[0]);
}
local_28[0] = (undefined1 *)0x8;
local_1e = 0;
local_20 = 5;
/* try { // try from 0087e4b8 to 0087e4ba has its CatchHandler @ 0087e952 */
(**(code **)(*g_pScriptVM + 0x78))
(g_pScriptVM,*(undefined4 *)(this + 0x488),"ZOMBIE_TANK",local_28);
if ((local_1e & 1) != 0) {
free(local_28[0]);
}
local_1e = 0;
local_20 = 5;
local_28[0] = (undefined1 *)0x0;
/* try { // try from 0087e4fb to 0087e4fd has its CatchHandler @ 0087e946 */
(**(code **)(*g_pScriptVM + 0x78))
(g_pScriptVM,*(undefined4 *)(this + 0x488),"LADDER_UP",local_28);
if ((local_1e & 1) != 0) {
free(local_28[0]);
}
local_28[0] = (undefined1 *)0x1;
local_20 = 5;
local_1e = 0;
/* try { // try from 0087e53e to 0087e540 has its CatchHandler @ 0087e944 */
(**(code **)(*g_pScriptVM + 0x78))
(g_pScriptVM,*(undefined4 *)(this + 0x488),"LADDER_DOWN",local_28);
if ((local_1e & 1) != 0) {
free(local_28[0]);
}
local_28[0] = (undefined1 *)0x0;
local_20 = 5;
local_1e = 0;
/* try { // try from 0087e581 to 0087e583 has its CatchHandler @ 0087e966 */
(**(code **)(*g_pScriptVM + 0x78))
(g_pScriptVM,*(undefined4 *)(this + 0x488),"NAV_NORTH",local_28);
if ((local_1e & 1) != 0) {
free(local_28[0]);
}
local_28[0] = (undefined1 *)0x1;
local_20 = 5;
local_1e = 0;
/* try { // try from 0087e5c4 to 0087e5c6 has its CatchHandler @ 0087e964 */
(**(code **)(*g_pScriptVM + 0x78))
(g_pScriptVM,*(undefined4 *)(this + 0x488),"NAV_EAST",local_28);
if ((local_1e & 1) != 0) {
free(local_28[0]);
}
local_20 = 5;
local_1e = 0;
local_28[0] = (undefined1 *)0x2;
/* try { // try from 0087e607 to 0087e609 has its CatchHandler @ 0087e962 */
(**(code **)(*g_pScriptVM + 0x78))
(g_pScriptVM,*(undefined4 *)(this + 0x488),"NAV_SOUTH",local_28);
if ((local_1e & 1) != 0) {
free(local_28[0]);
}
local_28[0] = (undefined1 *)0x3;
local_20 = 5;
local_1e = 0;
/* try { // try from 0087e64a to 0087e64c has its CatchHandler @ 0087e956 */
(**(code **)(*g_pScriptVM + 0x78))
(g_pScriptVM,*(undefined4 *)(this + 0x488),"NAV_WEST",local_28);
if ((local_1e & 1) != 0) {
free(local_28[0]);
}
CDirectorScriptedEventManager::InitScriptsNonVirtual();
CDirectorChallengeMode::InitScriptsNonVirtual(*(CDirectorChallengeMode **)(this + 0x648));
RunScript(this,"director_base",0,1);
this_00 = (CBaseEntity *)0x0;
while (this_00 = (CBaseEntity *)
CGlobalEntityList::NextEnt((CGlobalEntityList *)gEntList,this_00),
this_00 != (CBaseEntity *)0x0) {
if (*(int *)(this_00 + 1000) != -1) {
pHVar2 = (HSCRIPT__ *)CBaseEntity::GetScriptScope(this_00);
CollectGameEventCallbacksInScope(pHVar2);
}
}
uVar3 = 1;
}
return uVar3;
}
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.