CMomentaryRotButton::Spawn
0x00636f60 · 1295 bytes · __thiscall
_ZN19CMomentaryRotButton5SpawnEv
Decompiled
undefined (1 param)
/* CMomentaryRotButton::Spawn() */
void __thiscall CMomentaryRotButton::Spawn(CMomentaryRotButton *this)
{
CCollisionProperty *this_00;
code *pcVar1;
CBaseEdict *pCVar2;
uint uVar3;
undefined4 uVar4;
int iVar5;
char *pcVar6;
int *piVar7;
uint *puVar8;
undefined *puVar9;
int iVar10;
uint uVar11;
float fVar12;
float fVar13;
float fVar14;
float fVar15;
float fVar16;
float fVar17;
char *local_20 [4];
CBaseToggle::AxisDir((CBaseToggle *)this);
this[0x62c] = (CMomentaryRotButton)0x1;
if (*(float *)(this + 0x11c) == 0.0) {
*(undefined4 *)(this + 0x11c) = 0x42c80000;
}
fVar12 = *(float *)(this + 0x638);
if ((fVar12 < 0.0) || (1.0 < fVar12)) {
uVar4 = CBaseEntity::GetDebugName((CBaseEntity *)this);
Warning("WARNING: Momentary door (%s) start position not between 0 and 1. Clamping.\n",uVar4);
fVar12 = *(float *)(this + 0x624);
if (*(float *)(this + 0x624) <= 0.0) {
fVar12 = 0.0;
}
if (1.0 <= fVar12) {
fVar12 = 1.0;
}
*(float *)(this + 0x638) = fVar12;
}
if ((*(int *)(this + 0x630) != -1) && (*(int *)(this + 0x630) != 1)) {
*(undefined4 *)(this + 0x630) = 1;
}
fVar17 = *(float *)(this + 0x444);
fVar14 = *(float *)(this + 0x46c);
if (fVar17 < 0.0) {
fVar14 = -fVar14;
fVar17 = -fVar17;
fVar16 = -*(float *)(this + 0x470);
*(float *)(this + 0x46c) = fVar14;
fVar15 = -*(float *)(this + 0x474);
*(float *)(this + 0x470) = fVar16;
*(float *)(this + 0x474) = fVar15;
*(float *)(this + 0x444) = fVar17;
}
else {
fVar16 = *(float *)(this + 0x470);
fVar15 = *(float *)(this + 0x474);
}
*(float *)(this + 0x624) = fVar12;
*(float *)(this + 0x60c) = *(float *)(this + 0x3a8) - fVar14 * fVar17 * fVar12;
*(float *)(this + 0x610) = *(float *)(this + 0x3ac) - fVar16 * fVar17 * fVar12;
fVar13 = 1.0 - fVar12;
*(float *)(this + 0x614) = *(float *)(this + 0x3b0) - fVar15 * fVar17 * fVar12;
*(float *)(this + 0x61c) = fVar16 * fVar17 * fVar13 + *(float *)(this + 0x3ac);
*(float *)(this + 0x618) = fVar14 * fVar17 * fVar13 + *(float *)(this + 0x3a8);
*(float *)(this + 0x620) = fVar13 * fVar15 * fVar17 + *(float *)(this + 0x3b0);
if (fVar12 == 0.0) {
*(undefined4 *)(this + 0x630) = 0xffffffff;
}
else if (fVar12 == 1.0) {
*(undefined4 *)(this + 0x630) = 1;
}
if ((*(uint *)(this + 0x148) & 0x800) != 0) {
this[0x4f4] = (CMomentaryRotButton)0x1;
}
if ((*(uint *)(this + 0x148) & 0x400) != 0) {
if (*(int *)(this + 0x4f8) == 0) {
*(undefined4 *)(this + 0x628) = 0;
}
else {
MakeButtonSound((int)local_20);
*(char **)(this + 0x628) = local_20[0];
pcVar6 = "";
if (local_20[0] != (char *)0x0) {
pcVar6 = local_20[0];
}
CBaseEntity::PrecacheScriptSound(pcVar6);
}
*(undefined4 *)(this + 0x608) = 0;
if (this[0x62c] != (CMomentaryRotButton)0x0) {
UpdateTarget((float)this,(CBaseEntity *)this);
}
}
this_00 = (CCollisionProperty *)(this + 0x194);
CCollisionProperty::SetSolid(this_00,6);
if (((byte)this[0x148] & 1) != 0) {
*(uint *)(this + 0x14c) = *(uint *)(this + 0x14c) | 0x40000;
CCollisionProperty::SetSolidFlags(this_00,(uint)(*(ushort *)(this + 0x1b4) | 4));
}
CBaseEntity::SetMoveType((CBaseEntity *)this,7,0);
pcVar1 = *(code **)(*(int *)this + 0x70);
(**(code **)(*(int *)this + 0x20))(local_20,this);
pcVar6 = "";
if (local_20[0] != (char *)0x0) {
pcVar6 = local_20[0];
}
(*pcVar1)(this,pcVar6);
(**(code **)(*(int *)this + 0x290))(this);
if (this[0x500] != (CMomentaryRotButton)0x0) {
CCollisionProperty::SetSolid(this_00,1);
}
this[0x58d] = (CMomentaryRotButton)0x0;
if (((byte)this[0x149] & 4) == 0) {
if (this[0x58c] != (CMomentaryRotButton)0x0) {
if (this[0x6c] == (CMomentaryRotButton)0x0) {
pCVar2 = *(CBaseEdict **)(this + 0x30);
if (pCVar2 != (CBaseEdict *)0x0) {
*(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
iVar5 = CBaseEdict::GetChangeAccessor(pCVar2);
*(undefined2 *)(iVar5 + 2) = 0;
}
}
else {
this[0x70] = (CMomentaryRotButton)((byte)this[0x70] | 1);
}
this[0x58c] = (CMomentaryRotButton)0x0;
}
}
else if (this[0x58c] != (CMomentaryRotButton)0x1) {
if (this[0x6c] == (CMomentaryRotButton)0x0) {
pCVar2 = *(CBaseEdict **)(this + 0x30);
if (pCVar2 != (CBaseEdict *)0x0) {
*(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
iVar5 = CBaseEdict::GetChangeAccessor(pCVar2);
*(undefined2 *)(iVar5 + 2) = 0;
}
}
else {
this[0x70] = (CMomentaryRotButton)((byte)this[0x70] | 1);
}
this[0x58c] = (CMomentaryRotButton)0x1;
}
pcVar6 = "";
if (*(char **)(this + 0x584) != (char *)0x0) {
pcVar6 = *(char **)(this + 0x584);
}
piVar7 = (int *)CGlobalEntityList::FindEntityByName
((CGlobalEntityList *)gEntList,(CBaseEntity *)0x0,pcVar6,
(CBaseEntity *)0x0,(CBaseEntity *)0x0,(CBaseEntity *)0x0,
(IEntityFindFilter *)0x0);
if (piVar7 == (int *)0x0) {
uVar11 = 0xffffffff;
iVar5 = 0;
}
else {
puVar8 = (uint *)(**(code **)(*piVar7 + 0xc))(piVar7);
uVar11 = *puVar8;
if (((uVar11 == 0xffffffff) ||
(puVar9 = g_pEntityList + (uVar11 & 0xfff) * 0x10, puVar9 == (undefined *)0xfffffffc)) ||
(*(uint *)(puVar9 + 8) != uVar11 >> 0xc)) {
iVar5 = 0;
}
else {
iVar5 = *(int *)(puVar9 + 4);
}
}
uVar3 = *(uint *)(this + 0x588);
if (((uVar3 == 0xffffffff) ||
(puVar9 = g_pEntityList + (uVar3 & 0xfff) * 0x10, puVar9 == (undefined *)0xfffffffc)) ||
(*(uint *)(puVar9 + 8) != uVar3 >> 0xc)) {
iVar10 = 0;
}
else {
iVar10 = *(int *)(puVar9 + 4);
}
if (iVar5 == iVar10) {
return;
}
if (this[0x6c] == (CMomentaryRotButton)0x0) {
pCVar2 = *(CBaseEdict **)(this + 0x30);
if (pCVar2 != (CBaseEdict *)0x0) {
*(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
iVar5 = CBaseEdict::GetChangeAccessor(pCVar2);
*(undefined2 *)(iVar5 + 2) = 0;
}
*(uint *)(this + 0x588) = uVar11;
}
else {
this[0x70] = (CMomentaryRotButton)((byte)this[0x70] | 1);
*(uint *)(this + 0x588) = uVar11;
}
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.