CFuncElevator::DrawDebugTextOverlays
0x006bec10 · 1412 bytes · __thiscall
_ZN13CFuncElevator21DrawDebugTextOverlaysEv
Decompiled
undefined (1 param)
/* CFuncElevator::DrawDebugTextOverlays() */
int __thiscall CFuncElevator::DrawDebugTextOverlays(CFuncElevator *this)
{
float *pfVar1;
int iVar2;
float fVar3;
int *piVar4;
int iVar5;
int iVar6;
undefined4 uVar7;
undefined1 *puVar8;
undefined1 *puVar9;
char *pcVar10;
undefined *puVar11;
int in_GS_OFFSET;
double dVar12;
int local_248;
uint local_234 [5];
char local_220 [512];
int local_20;
local_20 = *(int *)(in_GS_OFFSET + 0x14);
iVar5 = CBaseEntity::DrawDebugTextOverlays((CBaseEntity *)this);
if (((byte)this[0x110] & 1) != 0) {
if (*(float *)(this + 0x500) == 0.0) {
iVar6 = GetCurrentFloor(this);
pcVar10 = "unknown";
if ((((-1 < iVar6) && (iVar6 < *(int *)(this + 0x54c))) &&
(iVar2 = *(int *)(this + 0x540) + iVar6 * 0xc, iVar2 != 0)) &&
(pcVar10 = *(char **)(iVar2 + 4), pcVar10 == (char *)0x0)) {
pcVar10 = "";
}
V_snprintf(local_220,0x200,"Currently at floor %d(%s)",iVar6,pcVar10);
CBaseEntity::EntityText((CBaseEntity *)this,iVar5,local_220,0.0,0xff,0xff,0xff,0xff);
}
else {
iVar6 = GetDestinationFloor(this);
pcVar10 = "unknown";
if (((-1 < iVar6) && (iVar6 < *(int *)(this + 0x54c))) &&
((iVar2 = *(int *)(this + 0x540) + iVar6 * 0xc, iVar2 != 0 &&
(pcVar10 = *(char **)(iVar2 + 4), pcVar10 == (char *)0x0)))) {
pcVar10 = "";
}
V_snprintf(local_220,0x200,"Moving at speed %f to floor %d(%s)",
SUB84((double)*(float *)(this + 0x500),0),
(int)((ulonglong)(double)*(float *)(this + 0x500) >> 0x20),iVar6,pcVar10);
CBaseEntity::EntityText((CBaseEntity *)this,iVar5,local_220,0.0,0xff,0xff,0xff,0xff);
}
GetButtonAtCurrentHeight();
if (((local_234[0] == 0xffffffff) ||
(puVar11 = g_pEntityList + (local_234[0] & 0xfff) * 0x10, puVar11 == (undefined *)0xfffffffc
)) || ((*(uint *)(puVar11 + 8) != local_234[0] >> 0xc || (*(int *)(puVar11 + 4) == 0)))) {
CBaseEntity::EntityText
((CBaseEntity *)this,iVar5 + 1,"No nearby buttons",0.0,0xff,0xff,0xff,0xff);
}
else {
puVar9 = *(undefined1 **)(*(int *)(puVar11 + 4) + 0x154);
puVar8 = &DAT_00d539c2;
if (puVar9 != (undefined1 *)0x0) {
puVar8 = puVar9;
}
V_snprintf(local_220,0x200,"Nearby button is %s",puVar8);
CBaseEntity::EntityText((CBaseEntity *)this,iVar5 + 1,local_220,0.0,0xff,0xff,0xff,0xff);
}
local_248 = iVar5 + 2;
iVar5 = local_248;
if (0 < *(int *)(this + 0x54c)) {
iVar6 = 0;
do {
pfVar1 = (float *)(*(int *)(this + 0x540) + iVar6 * 0xc);
puVar9 = (undefined1 *)pfVar1[1];
fVar3 = *pfVar1;
if (puVar9 == (undefined1 *)0x0) {
puVar9 = &DAT_00d539c2;
}
GetButtonForHeight((float)local_234);
if ((((local_234[0] == 0xffffffff) ||
(puVar11 = g_pEntityList + (local_234[0] & 0xfff) * 0x10,
puVar11 == (undefined *)0xfffffffc)) || (*(uint *)(puVar11 + 8) != local_234[0] >> 0xc)
) || (*(int *)(puVar11 + 4) == 0)) {
pcVar10 = "<none>";
}
else {
pcVar10 = *(char **)(*(int *)(puVar11 + 4) + 0x154);
if (pcVar10 == (char *)0x0) {
pcVar10 = "";
}
}
dVar12 = (double)fVar3;
iVar6 = iVar6 + 1;
V_snprintf(local_220,0x200,"Floor %s is at %f, triggered by %s",puVar9,SUB84(dVar12,0),
(int)((ulonglong)dVar12 >> 0x20),pcVar10);
iVar5 = local_248 + 1;
CBaseEntity::EntityText((CBaseEntity *)this,local_248,local_220,0.0,0xff,0xff,0xff,0xff);
local_248 = iVar5;
} while (iVar6 < *(int *)(this + 0x54c));
}
local_234[0] = 0;
local_234[1] = 0;
local_234[2] = 0;
local_234[3] = 0;
local_234[4] = 0;
/* try { // try from 006bef53 to 006befe1 has its CatchHandler @ 006bf1a5 */
FindPlayersOnElevator(this,(CUtlVector *)local_234,0);
if (0 < (int)local_234[3]) {
iVar6 = 0;
do {
piVar4 = *(int **)(local_234[0] + iVar6 * 4);
uVar7 = (**(code **)(*piVar4 + 0xb8))(piVar4);
V_snprintf(local_220,0x200,"Occupant %d: %s",iVar6,uVar7);
CBaseEntity::EntityText((CBaseEntity *)this,iVar5,local_220,0.0,0xff,0xff,0xff,0xff);
iVar6 = iVar6 + 1;
iVar5 = iVar5 + 1;
} while (iVar6 < (int)local_234[3]);
}
local_234[3] = 0;
CUtlMemory<CBasePlayer*,int>::Purge((CUtlMemory<CBasePlayer*,int> *)local_234);
local_234[4] = local_234[0];
CUtlMemory<CBasePlayer*,int>::Purge((CUtlMemory<CBasePlayer*,int> *)local_234);
}
if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {
/* WARNING: Subroutine does not return */
__stack_chk_fail();
}
return iVar5;
}
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.