Checkpoint::OnRoundRestart
0x0086c1c0 · 1654 bytes · __thiscall
_ZN10Checkpoint14OnRoundRestartEv
Decompiled
undefined (1 param)
/* Checkpoint::OnRoundRestart() */
void __thiscall Checkpoint::OnRoundRestart(Checkpoint *this)
{
undefined4 uVar1;
int iVar2;
int iVar3;
int *piVar4;
Checkpoint CVar5;
char cVar6;
InfoChangelevel *this_00;
CBaseEntity *pCVar7;
undefined4 *puVar8;
int iVar9;
void *pvVar10;
CNavArea *pCVar11;
int iVar12;
int iVar13;
longdouble lVar14;
float fVar15;
float fVar16;
float fVar17;
CNavArea *local_f0;
float local_e8;
Checkpoint *local_d8;
float local_d4;
float local_d0;
float local_cc;
float local_c8;
float local_c4;
float local_c0;
undefined **local_bc;
int *local_b8;
int local_b4;
undefined4 local_b0;
int local_ac [16];
float local_6c;
float local_68;
float local_64;
undefined4 local_5c;
undefined4 local_58;
undefined4 local_54;
float local_4c;
float local_48;
float local_44;
float local_3c;
float local_38;
float local_34;
undefined4 local_2c;
undefined1 local_28;
undefined1 local_27;
this[0x5c] = (Checkpoint)0x0;
this[0x5d] = (Checkpoint)0x1;
this[0x5e] = (Checkpoint)0x0;
*(undefined4 *)(this + 0x54) = 0;
fVar15 = *(float *)(this + 0x2c) - *(float *)(this + 0x20);
fVar17 = *(float *)(this + 0x28) - *(float *)(this + 0x1c);
fVar16 = *(float *)(this + 0x24) - *(float *)(this + 0x18);
local_64 = (*(float *)(this + 0x2c) + *(float *)(this + 0x20)) * 0.5;
local_6c = (*(float *)(this + 0x24) + *(float *)(this + 0x18)) * 0.5;
local_68 = (*(float *)(this + 0x28) + *(float *)(this + 0x1c)) * 0.5;
this_00 = (InfoChangelevel *)
UTIL_FindEntityByClassnameNearest
("info_changelevel",(Vector *)&local_6c,
SQRT(fVar15 * fVar15 + fVar17 * fVar17 + fVar16 * fVar16));
ZombieDebugPrint(1,"Flow Warning: Checkpoint failed to locate nearby info_change_level!\n");
CVar5 = (Checkpoint)0x0;
if (this_00 != (InfoChangelevel *)0x0) {
CVar5 = (Checkpoint)InfoChangelevel::IsValidChangelevel(this_00);
}
this[0x5f] = CVar5;
local_5c = 0;
local_58 = 0;
local_d4 = *(float *)(this + 0x18) - 50.0;
local_54 = 0;
local_d0 = *(float *)(this + 0x1c) - 50.0;
local_2c = 0;
local_cc = *(float *)(this + 0x20) - 50.0;
local_27 = 0;
local_c8 = *(float *)(this + 0x24) + 50.0;
local_c4 = *(float *)(this + 0x28) + 50.0;
local_c0 = *(float *)(this + 0x2c) + 71.0;
local_3c = (local_c8 - local_d4) * 0.5;
local_38 = (local_c4 - local_d0) * 0.5;
local_4c = (local_d4 + local_c8) * 0.5;
local_34 = (local_c0 - local_cc) * 0.5;
local_44 = (local_cc + local_c0) * 0.5;
local_48 = (local_d0 + local_c4) * 0.5;
local_64 = DAT_01053d50 + local_44;
local_28 = local_38 * local_38 + local_3c * local_3c + local_34 * local_34 < 1e-06;
local_6c = vec3_origin + local_4c;
local_68 = DAT_01053d4c + local_48;
local_4c = -local_4c;
local_48 = -local_48;
local_44 = -local_44;
(**(code **)(*g_pGameRules + 0x7c))(g_pGameRules);
(**(code **)(*g_pGameRules + 0x7c))(g_pGameRules);
piVar4 = mdlcache;
local_b8 = local_ac;
local_b4 = 0;
local_b0 = 0x10;
local_bc = &PTR_EnumElement_00cdaba8;
(**(code **)(*mdlcache + 0x68))(mdlcache);
/* try { // try from 0086c4b1 to 0086c59b has its CatchHandler @ 0086c866 */
(**(code **)(*partition + 0x40))(partition,1,(Vector *)&local_6c,0,&local_bc);
if (0 < local_b4) {
iVar12 = 0;
do {
while ((((local_ac[iVar12] != 0 &&
(pCVar7 = (CBaseEntity *)
__dynamic_cast(local_ac[iVar12],&CBaseEntity::typeinfo,
&CBasePropDoor::typeinfo,0), pCVar7 != (CBaseEntity *)0x0))
&& (pCVar7[0x105] == (CBaseEntity)0x1)) &&
((*(char **)(pCVar7 + 0x7c) == "prop_door_rotating_checkpoint" ||
(cVar6 = CBaseEntity::ClassMatchesComplex(pCVar7,"prop_door_rotating_checkpoint"),
cVar6 != '\0'))))) {
puVar8 = (undefined4 *)(**(code **)(*(int *)pCVar7 + 0xc))(pCVar7);
uVar1 = *puVar8;
iVar2 = *(int *)(this + 0x54);
iVar9 = *(int *)(this + 0x4c);
iVar13 = iVar2 + 1;
if (iVar9 < iVar13) {
iVar3 = *(int *)(this + 0x50);
if (iVar3 < 0) goto LAB_0086c561;
if (iVar3 == 0) {
if (iVar9 == 0) {
if (iVar13 < 9) {
iVar9 = 8;
goto LAB_0086c647;
}
iVar9 = 8;
}
do {
iVar9 = iVar9 * 2;
} while (iVar9 < iVar13);
}
else {
for (iVar9 = (iVar2 / iVar3 + 1) * iVar3; iVar9 < iVar13; iVar9 = (iVar9 + iVar13) / 2)
{
}
}
LAB_0086c647:
*(int *)(this + 0x4c) = iVar9;
if (*(void **)(this + 0x48) == (void *)0x0) {
pvVar10 = malloc(iVar9 << 2);
*(void **)(this + 0x48) = pvVar10;
}
else {
pvVar10 = realloc(*(void **)(this + 0x48),iVar9 << 2);
*(void **)(this + 0x48) = pvVar10;
iVar13 = *(int *)(this + 0x54) + 1;
}
}
else {
LAB_0086c561:
pvVar10 = *(void **)(this + 0x48);
}
*(int *)(this + 0x54) = iVar13;
iVar13 = (iVar13 - iVar2) + -1;
*(void **)(this + 0x58) = pvVar10;
iVar2 = iVar2 * 4;
if (0 < iVar13) {
/* try { // try from 0086c5f5 to 0086c7f7 has its CatchHandler @ 0086c866 */
_V_memmove((void *)((int)pvVar10 + iVar2 + 4),(void *)((int)pvVar10 + iVar2),iVar13 * 4);
pvVar10 = *(void **)(this + 0x48);
}
if ((undefined4 *)(iVar2 + (int)pvVar10) != (undefined4 *)0x0) {
*(undefined4 *)(iVar2 + (int)pvVar10) = uVar1;
}
CBasePropDoor::CheckpointDisable((CBasePropDoor *)pCVar7,true);
iVar12 = iVar12 + 1;
if (local_b4 <= iVar12) goto LAB_0086c5ab;
}
iVar12 = iVar12 + 1;
} while (iVar12 < local_b4);
}
LAB_0086c5ab:
*(undefined4 *)(this + 0x3c) = 0;
*(undefined4 *)(this + 0x44) = 0;
if (*(int *)(this + 0xc) == 0) {
(**(code **)(*piVar4 + 0x6c))(piVar4);
return;
}
pCVar11 = (CNavArea *)**(undefined4 **)this;
pCVar7 = (CBaseEntity *)
CGlobalEntityList::FindEntityByClassnameWithin
((CGlobalEntityList *)gEntList,(CBaseEntity *)0x0,"weapon_ammo_spawn",
(Vector *)&local_d4,(Vector *)&local_c8);
local_f0 = pCVar11;
if (pCVar7 == (CBaseEntity *)0x0) {
if (0 < *(int *)(this + 0xc)) {
local_f0 = (CNavArea *)**(int **)this;
if (((byte)local_f0[0x12e] & 4) != 0) {
iVar12 = 0;
do {
iVar12 = iVar12 + 1;
local_f0 = pCVar11;
if (iVar12 == *(int *)(this + 0xc)) break;
local_f0 = (CNavArea *)(*(int **)this)[iVar12];
} while (((byte)local_f0[0x12e] & 4) != 0);
}
}
}
else if (0 < *(int *)(this + 0xc)) {
iVar12 = 0;
local_e8 = 3.4028235e+38;
do {
pCVar11 = *(CNavArea **)(*(int *)this + iVar12 * 4);
if (((byte)pCVar11[0x12e] & 4) == 0) {
if (((byte)pCVar7[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition(pCVar7);
pCVar11 = *(CNavArea **)(*(int *)this + iVar12 * 4);
}
lVar14 = (longdouble)CNavArea::GetDistanceSquaredToPoint(pCVar11,(Vector *)(pCVar7 + 0x2e0))
;
if ((float)lVar14 < local_e8) {
local_f0 = *(CNavArea **)(*(int *)this + iVar12 * 4);
local_e8 = (float)lVar14;
}
}
iVar12 = iVar12 + 1;
} while (iVar12 < *(int *)(this + 0xc));
}
local_d8 = this;
SearchSurroundingAreas<SpawnableCheckpointAreaCollector>
(local_f0,(Vector *)(local_f0 + 0x2c),(SpawnableCheckpointAreaCollector *)&local_d8,-1.0
,0,-1);
(**(code **)(*piVar4 + 0x6c))(piVar4);
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.