CBaseButton::Spawn
0x00636700 · 1622 bytes · __thiscall
_ZN11CBaseButton5SpawnEv
Decompiled
undefined (1 param)
/* WARNING: Removing unreachable block (ram,0x0063689b) */
/* WARNING: Removing unreachable block (ram,0x00636d9b) */
/* CBaseButton::Spawn() */
void __thiscall CBaseButton::Spawn(CBaseButton *this)
{
float fVar1;
float fVar2;
float fVar3;
float fVar4;
float fVar5;
code *pcVar6;
CBaseEdict *pCVar7;
uint uVar8;
char *pcVar9;
int *piVar10;
uint *puVar11;
undefined *puVar12;
int iVar13;
int iVar14;
uint uVar15;
bool bVar16;
float fVar17;
float fVar18;
float fVar19;
undefined1 local_3c [12];
char *local_30 [2];
undefined4 local_28;
undefined4 local_24;
undefined4 local_20;
if (*(int *)(this + 0x4f8) == 0) {
*(undefined4 *)(this + 0x504) = 0;
}
else {
MakeButtonSound((int)local_30);
*(char **)(this + 0x504) = local_30[0];
pcVar9 = "";
if (local_30[0] != (char *)0x0) {
pcVar9 = local_30[0];
}
CBaseEntity::PrecacheScriptSound(pcVar9);
}
(**(code **)(*(int *)this + 0x6c))(this);
if (((byte)this[0x149] & 0x10) != 0) {
CBaseEntity::ThinkSet((_func_void *)local_3c,(float)this,(char *)ButtonSpark);
CBaseEntity::SetNextThink((CBaseEntity *)this,*(float *)(gpGlobals + 0xc) + 0.5,(char *)0x0);
}
local_20 = *(undefined4 *)(this + 0x4c0);
local_24 = *(undefined4 *)(this + 0x4bc);
local_28 = *(undefined4 *)(this + 0x4b8);
AngleVectors((QAngle *)&local_28,(Vector *)(this + 0x4b8));
CBaseEntity::SetMoveType((CBaseEntity *)this,7,0);
CCollisionProperty::SetSolid((CCollisionProperty *)(this + 0x194),1);
pcVar6 = *(code **)(*(int *)this + 0x70);
(**(code **)(*(int *)this + 0x20))(local_30,this);
pcVar9 = "";
if (local_30[0] != (char *)0x0) {
pcVar9 = local_30[0];
}
(*pcVar6)(this,pcVar9);
if (*(float *)(this + 0x11c) == 0.0) {
*(undefined4 *)(this + 0x11c) = 0x42200000;
}
if (this[0x105] != (CBaseButton)0x2) {
(**(code **)(*(int *)this + 0x224))(this,this + 0x105);
this[0x105] = (CBaseButton)0x2;
}
if (*(float *)(this + 0x448) == 0.0) {
*(undefined4 *)(this + 0x448) = 0x3f800000;
}
if (*(float *)(this + 0x44c) == 0.0) {
*(undefined4 *)(this + 0x44c) = 0x40800000;
}
*(undefined4 *)(this + 0x440) = 1;
bVar16 = AllocTempVector()::s_vecTemp == '\0';
*(undefined4 *)(this + 0x454) = *(undefined4 *)(this + 0x39c);
*(undefined4 *)(this + 0x458) = *(undefined4 *)(this + 0x3a0);
*(undefined4 *)(this + 0x45c) = *(undefined4 *)(this + 0x3a4);
if ((bVar16) && (iVar14 = __cxa_guard_acquire(&AllocTempVector()::s_vecTemp), iVar14 != 0)) {
__cxa_guard_release(&AllocTempVector()::s_vecTemp);
}
if ((AllocTempVector()::s_nIndex == '\0') &&
(iVar14 = __cxa_guard_acquire(&AllocTempVector()::s_nIndex), iVar14 != 0)) {
AllocTempVector()::s_nIndex = 0;
__cxa_guard_release(&AllocTempVector()::s_nIndex);
}
AllocTempVector()::s_nIndex = AllocTempVector()::s_nIndex + 0x10001 & 0x7f;
LOCK();
UNLOCK();
fVar1 = *(float *)(this + 0x1a8);
iVar14 = AllocTempVector()::s_nIndex * 0xc;
fVar17 = *(float *)(this + 0x19c);
*(float *)(AllocTempVector()::s_vecTemp + iVar14) = fVar1 - fVar17;
fVar18 = *(float *)(this + 0x1ac);
fVar19 = *(float *)(this + 0x1a0);
*(float *)(AllocTempVector()::s_vecTemp + iVar14 + 4) = fVar18 - fVar19;
fVar2 = *(float *)(this + 0x1b0);
fVar3 = *(float *)(this + 0x1a4);
*(float *)(AllocTempVector()::s_vecTemp + iVar14 + 8) = fVar2 - fVar3;
fVar4 = *(float *)(this + 0x454);
fVar5 = *(float *)(this + 0x458);
uVar15 = *(uint *)(this + 0x148);
fVar18 = ((ABS(((fVar1 - fVar17) + -2.0) * *(float *)(this + 0x4b8)) +
ABS(((fVar18 - fVar19) + -2.0) * *(float *)(this + 0x4bc))) - *(float *)(this + 0x44c))
+ ABS(((fVar2 - fVar3) + -2.0) * *(float *)(this + 0x4c0));
fVar1 = *(float *)(this + 0x45c);
fVar19 = *(float *)(this + 0x4b8) * fVar18 + fVar4;
fVar17 = *(float *)(this + 0x4bc) * fVar18 + fVar5;
fVar18 = fVar18 * *(float *)(this + 0x4c0) + fVar1;
*(float *)(this + 0x460) = fVar19;
fVar19 = fVar19 - fVar4;
*(float *)(this + 0x464) = fVar17;
fVar17 = fVar17 - fVar5;
*(float *)(this + 0x468) = fVar18;
fVar18 = fVar18 - fVar1;
if ((SQRT(fVar17 * fVar17 + fVar18 * fVar18 + fVar19 * fVar19) < 1.0) || ((uVar15 & 1) != 0)) {
*(float *)(this + 0x460) = fVar4;
*(float *)(this + 0x464) = fVar5;
*(float *)(this + 0x468) = fVar1;
}
this[0x4c5] = (CBaseButton)0x0;
this[0x4c4] = (CBaseButton)(*(float *)(this + 0x448) == -1.0);
if ((uVar15 & 0x800) != 0) {
this[0x4f4] = (CBaseButton)0x1;
}
if ((uVar15 & 0x400) == 0) {
*(undefined4 *)(this + 0xe0) = 0;
*(undefined4 *)(this + 0xe4) = 0;
if (this[0x58c] != (CBaseButton)0x0) {
if (this[0x6c] == (CBaseButton)0x0) {
pCVar7 = *(CBaseEdict **)(this + 0x30);
if (pCVar7 != (CBaseEdict *)0x0) {
*(uint *)pCVar7 = *(uint *)pCVar7 | 0x101;
iVar14 = CBaseEdict::GetChangeAccessor(pCVar7);
*(undefined2 *)(iVar14 + 2) = 0;
uVar15 = *(uint *)(this + 0x148);
}
}
else {
this[0x70] = (CBaseButton)((byte)this[0x70] | 1);
}
this[0x58c] = (CBaseButton)0x0;
}
}
else {
*(code **)(this + 0xe0) = ButtonUse;
*(undefined4 *)(this + 0xe4) = 0;
if (this[0x58c] != (CBaseButton)0x1) {
if (this[0x6c] == (CBaseButton)0x0) {
pCVar7 = *(CBaseEdict **)(this + 0x30);
if (pCVar7 != (CBaseEdict *)0x0) {
*(uint *)pCVar7 = *(uint *)pCVar7 | 0x101;
iVar14 = CBaseEdict::GetChangeAccessor(pCVar7);
*(undefined2 *)(iVar14 + 2) = 0;
uVar15 = *(uint *)(this + 0x148);
}
}
else {
this[0x70] = (CBaseButton)((byte)this[0x70] | 1);
}
this[0x58c] = (CBaseButton)0x1;
}
}
if ((uVar15 & 0x100) == 0) {
*(undefined4 *)(this + 0xd8) = 0;
*(undefined4 *)(this + 0xdc) = 0;
}
else {
*(code **)(this + 0xd8) = ButtonTouch;
*(undefined4 *)(this + 0xdc) = 0;
}
pcVar9 = "";
if (*(char **)(this + 0x584) != (char *)0x0) {
pcVar9 = *(char **)(this + 0x584);
}
piVar10 = (int *)CGlobalEntityList::FindEntityByName
((CGlobalEntityList *)gEntList,(CBaseEntity *)0x0,pcVar9,
(CBaseEntity *)0x0,(CBaseEntity *)0x0,(CBaseEntity *)0x0,
(IEntityFindFilter *)0x0);
if (piVar10 == (int *)0x0) {
uVar15 = 0xffffffff;
iVar14 = 0;
}
else {
puVar11 = (uint *)(**(code **)(*piVar10 + 0xc))(piVar10);
uVar15 = *puVar11;
if (((uVar15 == 0xffffffff) ||
(puVar12 = g_pEntityList + (uVar15 & 0xfff) * 0x10, puVar12 == (undefined *)0xfffffffc)) ||
(*(uint *)(puVar12 + 8) != uVar15 >> 0xc)) {
iVar14 = 0;
}
else {
iVar14 = *(int *)(puVar12 + 4);
}
}
uVar8 = *(uint *)(this + 0x588);
if (((uVar8 == 0xffffffff) ||
(puVar12 = g_pEntityList + (uVar8 & 0xfff) * 0x10, puVar12 == (undefined *)0xfffffffc)) ||
(*(uint *)(puVar12 + 8) != uVar8 >> 0xc)) {
iVar13 = 0;
}
else {
iVar13 = *(int *)(puVar12 + 4);
}
if (iVar14 != iVar13) {
if (this[0x6c] == (CBaseButton)0x0) {
pCVar7 = *(CBaseEdict **)(this + 0x30);
if (pCVar7 != (CBaseEdict *)0x0) {
*(uint *)pCVar7 = *(uint *)pCVar7 | 0x101;
iVar14 = CBaseEdict::GetChangeAccessor(pCVar7);
*(undefined2 *)(iVar14 + 2) = 0;
}
*(uint *)(this + 0x588) = uVar15;
}
else {
this[0x70] = (CBaseButton)((byte)this[0x70] | 1);
*(uint *)(this + 0x588) = uVar15;
}
}
(**(code **)(*(int *)this + 0x290))(this);
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.