CPropMinigun::FireThink
0x0054a850 · 2740 bytes · __thiscall
_ZN12CPropMinigun9FireThinkEv
Decompiled
undefined (1 param)
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* CPropMinigun::FireThink() */
void __thiscall CPropMinigun::FireThink(CPropMinigun *this)
{
float fVar1;
float fVar2;
float fVar3;
float fVar4;
CBaseCombatCharacter *this_00;
CBaseEdict *pCVar5;
float fVar6;
code *pcVar7;
int iVar8;
int iVar9;
char cVar10;
int iVar11;
int iVar12;
float *pfVar13;
int iVar14;
uint uVar15;
int *piVar16;
undefined *puVar17;
uint uVar18;
undefined *puVar19;
bool bVar20;
longdouble lVar21;
longdouble lVar22;
longdouble lVar23;
float fVar24;
float fVar25;
float fVar26;
float fVar27;
float fVar28;
Vector *local_5c;
int local_48;
undefined1 local_44 [8];
int local_3c;
int local_38;
undefined4 local_34;
undefined4 local_30;
undefined4 local_2c;
QAngle local_28 [24];
puVar17 = g_pEntityList;
uVar18 = *(uint *)(this + 0x15cc);
if (uVar18 == 0xffffffff) {
LAB_0054a892:
if (this[0x15dc] == (CPropMinigun)0x0) {
return;
}
if (this[0x6c] == (CPropMinigun)0x0) {
pCVar5 = *(CBaseEdict **)(this + 0x30);
if (pCVar5 != (CBaseEdict *)0x0) {
*(uint *)pCVar5 = *(uint *)pCVar5 | 0x101;
iVar11 = CBaseEdict::GetChangeAccessor(pCVar5);
*(undefined2 *)(iVar11 + 2) = 0;
}
}
else {
this[0x70] = (CPropMinigun)((byte)this[0x70] | 1);
}
this[0x15dc] = (CPropMinigun)0x0;
return;
}
uVar15 = uVar18 & 0xfff;
piVar16 = (int *)(g_pEntityList + uVar15 * 0x10 + 4);
if (((piVar16 == (int *)0x0) || (*(uint *)(g_pEntityList + uVar15 * 0x10 + 8) != uVar18 >> 0xc))
|| (this_00 = *(CBaseCombatCharacter **)(g_pEntityList + uVar15 * 0x10 + 4),
this_00 == (CBaseCombatCharacter *)0x0)) goto LAB_0054a892;
uVar15 = *(uint *)(this_00 + 0x1d14);
if (((uVar15 != 0xffffffff) &&
(puVar19 = g_pEntityList + (uVar15 & 0xfff) * 0x10, puVar19 != (undefined *)0xfffffffc)) &&
((*(uint *)(puVar19 + 8) == uVar15 >> 0xc && (this == *(CPropMinigun **)(puVar19 + 4))))) {
cVar10 = (**(code **)(*(int *)this_00 + 0x16c))();
if (cVar10 == '\0') goto LAB_0054a892;
local_3c = 0;
local_38 = 0;
if (___atan2f_finite == 0) {
iVar11 = 0;
}
else {
(**(code **)(___atan2f_finite + 0x50))();
iVar11 = ___atan2f_finite;
}
iVar9 = local_38;
iVar8 = local_3c;
iVar14 = _DAT_0105db00;
/* try { // try from 0054aa81 to 0054aa85 has its CatchHandler @ 0054b3d0 */
if (((_DAT_0105d154 != 0) || (DAT_0105d158 == '\0')) &&
(iVar12 = ThreadGetCurrentId(), iVar14 == iVar12)) {
if ((char *)*_DAT_0105d15c != "CPropMinigun::FireThink") {
/* try { // try from 0054ae00 to 0054ae11 has its CatchHandler @ 0054b3d0 */
_DAT_0105d15c =
(int *)CVProfNode::GetSubNode((char *)_DAT_0105d15c,0xc40796,(char *)0x1,0xbfafa1);
}
CVProfNode::EnterScope();
DAT_0105d158 = '\0';
}
/* try { // try from 0054aaca to 0054abde has its CatchHandler @ 0054b3eb */
CBaseEntity::ThinkSet((_func_void *)local_44,(float)this,(char *)FireThink);
pfVar13 = (float *)(**(code **)(*(int *)this_00 + 0x238))();
fVar6 = *pfVar13;
fVar25 = *(float *)(this + 0x15e4);
lVar21 = (longdouble)AngleNormalize(pfVar13[1] - *(float *)(this + 0x15e8));
fVar4 = (float)lVar21;
lVar21 = (longdouble)AngleNormalize(fVar6 - fVar25);
fVar25 = *(float *)(this + 0x15d0);
fVar6 = (float)lVar21;
fVar24 = fVar25;
if ((fVar4 <= fVar25) && (fVar24 = -fVar25, -fVar25 <= fVar4)) {
fVar24 = fVar4;
}
fVar25 = *(float *)(this + 0x15d4);
if ((fVar6 <= *(float *)(this + 0x15d4)) && (fVar25 = fVar6, fVar6 <= *(float *)(this + 0x15d8))
) {
fVar25 = *(float *)(this + 0x15d8);
}
fVar4 = *(float *)(this + 0x15e4);
fVar6 = *(float *)(this + 0x15e8);
fVar1 = *(float *)(this + 0x15ec);
UpdatePoseParameters(this);
if (((byte)this_00[0x1cb0] & 1) == 0) {
*(undefined4 *)(this + 0x15fc) = *(undefined4 *)(gpGlobals + 0xc);
if (this[0x15dc] != (CPropMinigun)0x0) {
if (this[0x6c] == (CPropMinigun)0x0) {
pCVar5 = *(CBaseEdict **)(this + 0x30);
if (pCVar5 != (CBaseEdict *)0x0) {
*(uint *)pCVar5 = *(uint *)pCVar5 | 0x101;
iVar14 = CBaseEdict::GetChangeAccessor(pCVar5);
*(undefined2 *)(iVar14 + 2) = 0;
}
}
else {
this[0x70] = (CPropMinigun)((byte)this[0x70] | 1);
}
this[0x15dc] = (CPropMinigun)0x0;
}
uVar18 = *(uint *)(this_00 + 0x1cb0);
if ((uVar18 & 1) != 0) goto LAB_0054ab94;
}
else {
LAB_0054ab94:
cVar10 = (**(code **)(*(int *)this_00 + 0x840))();
if ((cVar10 != '\0') && (this[0x15dd] == (CPropMinigun)0x0)) {
if (this[0x15dc] != (CPropMinigun)0x1) {
if (this[0x6c] == (CPropMinigun)0x0) {
pCVar5 = *(CBaseEdict **)(this + 0x30);
if (pCVar5 != (CBaseEdict *)0x0) {
*(uint *)pCVar5 = *(uint *)pCVar5 | 0x101;
iVar14 = CBaseEdict::GetChangeAccessor(pCVar5);
*(undefined2 *)(iVar14 + 2) = 0;
}
}
else {
this[0x70] = (CPropMinigun)((byte)this[0x70] | 1);
}
this[0x15dc] = (CPropMinigun)0x1;
}
piVar16 = (int *)&stack0xffffff44;
if ((*(float *)(MinigunFiringSpeed._28_4_ + 0x2c) <= *(float *)(this + 0x1610)) &&
(fVar28 = 60.0 / *(float *)(MinigunRateOfFire._28_4_ + 0x2c),
piVar16 = (int *)&stack0xffffff44,
*(float *)(this + 0x15fc) + fVar28 < *(float *)(gpGlobals + 0xc))) {
/* try { // try from 0054af46 to 0054b168 has its CatchHandler @ 0054b344 */
(**(code **)(*(int *)this_00 + 0x844))();
if (((byte)this[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
}
local_34 = *(undefined4 *)(this + 0x2e0);
local_30 = *(undefined4 *)(this + 0x2e4);
local_2c = *(undefined4 *)(this + 0x2e8);
iVar14 = CBaseAnimating::LookupAttachment((CBaseAnimating *)this,"muzzle_flash");
if (-1 < iVar14) {
CBaseAnimating::GetAttachment
((CBaseAnimating *)this,iVar14,(Vector *)&local_34,local_28);
}
local_5c = (Vector *)local_28;
(**(code **)(*(int *)this_00 + 0x234))();
piVar16 = (int *)(**(code **)(*gameeventmanager + 0x1c))();
if (piVar16 != (int *)0x0) {
pcVar7 = *(code **)(*piVar16 + 0x30);
(**(code **)(*engine + 0x40))();
(*pcVar7)();
(**(code **)(*piVar16 + 0x3c))();
(**(code **)(*piVar16 + 0x30))();
(**(code **)(*gameeventmanager + 0x20))();
}
(**(code **)(*(int *)this_00 + 0x850))();
fVar27 = (*(float *)(gpGlobals + 0xc) - *(float *)(this + 0x15fc)) / fVar28;
local_48 = (int)fVar27;
fVar26 = (float)local_48;
if (fVar27 < fVar26) {
local_48 = local_48 + -1;
fVar26 = (float)local_48;
}
fVar2 = *(float *)(this + 0x1600);
fVar3 = *(float *)(this + 0x1608);
*(float *)(this + 0x15fc) = fVar28 * fVar26 + *(float *)(this + 0x15fc);
lVar21 = (longdouble)AngleNormalize((fVar24 + fVar6) - *(float *)(this + 0x1604));
fVar27 = 1.0 / fVar27;
lVar22 = (longdouble)AngleNormalize((fVar25 + fVar4) - fVar2);
lVar23 = (longdouble)AngleNormalize(fVar1 - fVar3);
fVar28 = cosf(*(float *)(MinigunSpread._28_4_ + 0x2c) * 0.017453292);
iVar12 = IPredictionSystem::g_pPredictionSystems;
for (iVar14 = IPredictionSystem::g_pPredictionSystems; iVar14 != 0;
iVar14 = *(int *)(iVar14 + 4)) {
*(int *)(iVar14 + 0x10) = *(int *)(iVar14 + 0x10) + 1;
}
if (0 < local_48) {
iVar14 = 0;
do {
*(float *)(this + 0x1600) = (float)lVar22 * fVar27 + *(float *)(this + 0x1600);
*(float *)(this + 0x1604) = (float)lVar21 * fVar27 + *(float *)(this + 0x1604);
*(float *)(this + 0x1608) = (float)lVar23 * fVar27 + *(float *)(this + 0x1608);
/* try { // try from 0054b265 to 0054b269 has its CatchHandler @ 0054b3d4 */
MinigunFire((CTerrorPlayer *)this_00,this,local_5c,(Vector *)&local_34,
(QAngle *)(this + 0x1600),1.0 - fVar28,local_48 + -1 == iVar14);
iVar14 = iVar14 + 1;
iVar12 = IPredictionSystem::g_pPredictionSystems;
} while (iVar14 != local_48);
}
for (; piVar16 = (int *)&stack0xffffff40, iVar12 != 0; iVar12 = *(int *)(iVar12 + 4)) {
*(int *)(iVar12 + 0x10) = *(int *)(iVar12 + 0x10) + -1;
}
}
goto LAB_0054ac38;
}
uVar18 = *(uint *)(this_00 + 0x1cb0);
}
if ((uVar18 & 0xe18) != 0) {
uVar18 = *(uint *)(this_00 + 0x1d14);
if ((((uVar18 != 0xffffffff) &&
(puVar17 = g_pEntityList + (uVar18 & 0xfff) * 0x10, puVar17 != (undefined *)0xfffffffc))
&& (*(uint *)(puVar17 + 8) == uVar18 >> 0xc)) && (*(int *)(puVar17 + 4) != 0)) {
if (this_00[0x6c] == (CBaseCombatCharacter)0x0) {
pCVar5 = *(CBaseEdict **)(this_00 + 0x30);
if (pCVar5 != (CBaseEdict *)0x0) {
*(uint *)pCVar5 = *(uint *)pCVar5 | 0x101;
/* try { // try from 0054b2e0 to 0054b328 has its CatchHandler @ 0054b3eb */
iVar14 = CBaseEdict::GetChangeAccessor(pCVar5);
*(undefined2 *)(iVar14 + 2) = 0;
}
}
else {
this_00[0x70] = (CBaseCombatCharacter)((byte)this_00[0x70] | 1);
}
*(undefined4 *)(this_00 + 0x1d14) = 0xffffffff;
}
/* try { // try from 0054ae5c to 0054af16 has its CatchHandler @ 0054b3eb */
(**(code **)(*(int *)this_00 + 0x76c))();
uVar18 = *(uint *)(this + 0x15cc);
if (((uVar18 != 0xffffffff) &&
(puVar17 = g_pEntityList + (uVar18 & 0xfff) * 0x10, puVar17 != (undefined *)0xfffffffc))
&& ((*(uint *)(puVar17 + 8) == uVar18 >> 0xc && (*(int *)(puVar17 + 4) != 0)))) {
if (this[0x6c] == (CPropMinigun)0x0) {
pCVar5 = *(CBaseEdict **)(this + 0x30);
if (pCVar5 != (CBaseEdict *)0x0) {
*(uint *)pCVar5 = *(uint *)pCVar5 | 0x101;
iVar14 = CBaseEdict::GetChangeAccessor(pCVar5);
*(undefined2 *)(iVar14 + 2) = 0;
}
}
else {
this[0x70] = (CPropMinigun)((byte)this[0x70] | 1);
}
*(undefined4 *)(this + 0x15cc) = 0xffffffff;
}
iVar14 = CBaseCombatCharacter::GetActiveWeapon(this_00);
if (iVar14 != 0) {
uVar18 = *(uint *)(this_00 + 0x1a7c) & 0xfffffffe;
if (*(uint *)(this_00 + 0x1a7c) != uVar18) {
(**(code **)(*(int *)(this_00 + 0x1a40) + 4))();
*(uint *)(this_00 + 0x1a7c) = uVar18;
}
piVar16 = (int *)CBaseCombatCharacter::GetActiveWeapon(this_00);
(**(code **)(*piVar16 + 0x424))();
}
}
piVar16 = (int *)&stack0xffffff44;
if (this[0x15dc] != (CPropMinigun)0x0) {
if (this[0x6c] == (CPropMinigun)0x0) {
pCVar5 = *(CBaseEdict **)(this + 0x30);
if (pCVar5 != (CBaseEdict *)0x0) {
*(uint *)pCVar5 = *(uint *)pCVar5 | 0x101;
/* try { // try from 0054ad6a to 0054ad6e has its CatchHandler @ 0054b3eb */
iVar14 = CBaseEdict::GetChangeAccessor(pCVar5);
*(undefined2 *)(iVar14 + 2) = 0;
}
}
else {
this[0x70] = (CPropMinigun)((byte)this[0x70] | 1);
}
this[0x15dc] = (CPropMinigun)0x0;
piVar16 = (int *)&stack0xffffff44;
}
LAB_0054ac38:
bVar20 = DAT_0105d158 == '\0';
*(float *)(this + 0x1600) = fVar25 + fVar4;
*(float *)(this + 0x1604) = fVar24 + fVar6;
*(float *)(this + 0x1608) = fVar1;
iVar14 = _DAT_0105db00;
if ((bVar20) || (_DAT_0105d154 != 0)) {
piVar16[-1] = 0x54ac7d;
iVar12 = ThreadGetCurrentId();
if (iVar14 == iVar12) {
*piVar16 = (int)_DAT_0105d15c;
piVar16[-1] = 0x54ada5;
cVar10 = CVProfNode::ExitScope();
if (cVar10 != '\0') {
_DAT_0105d15c = (int *)_DAT_0105d15c[0x19];
}
DAT_0105d158 = _DAT_0105d15c == (int *)0x105d160;
}
}
if (iVar11 == 0) {
return;
}
piVar16[5] = 0;
piVar16[4] = 0;
piVar16[3] = 0;
*piVar16 = iVar11;
piVar16[1] = iVar8;
piVar16[2] = iVar9;
pcVar7 = *(code **)(iVar11 + 0x54);
piVar16[-1] = 0x54acb9;
(*pcVar7)();
return;
}
if (this[0x15dc] == (CPropMinigun)0x0) goto LAB_0054a8f4;
if (this[0x6c] == (CPropMinigun)0x0) {
pCVar5 = *(CBaseEdict **)(this + 0x30);
if (pCVar5 == (CBaseEdict *)0x0) goto LAB_0054acc4;
*(uint *)pCVar5 = *(uint *)pCVar5 | 0x101;
iVar11 = CBaseEdict::GetChangeAccessor(pCVar5);
*(undefined2 *)(iVar11 + 2) = 0;
uVar18 = *(uint *)(this + 0x15cc);
this[0x15dc] = (CPropMinigun)0x0;
puVar17 = g_pEntityList;
if (uVar18 == 0xffffffff) {
return;
}
}
else {
this[0x70] = (CPropMinigun)((byte)this[0x70] | 1);
LAB_0054acc4:
this[0x15dc] = (CPropMinigun)0x0;
}
piVar16 = (int *)(puVar17 + (uVar18 & 0xfff) * 0x10 + 4);
if (piVar16 == (int *)0x0) {
return;
}
if (piVar16[1] != uVar18 >> 0xc) {
return;
}
LAB_0054a8f4:
if (*piVar16 == 0) {
return;
}
if (this[0x6c] == (CPropMinigun)0x0) {
pCVar5 = *(CBaseEdict **)(this + 0x30);
if (pCVar5 != (CBaseEdict *)0x0) {
*(uint *)pCVar5 = *(uint *)pCVar5 | 0x101;
iVar11 = CBaseEdict::GetChangeAccessor(pCVar5);
*(undefined2 *)(iVar11 + 2) = 0;
}
}
else {
this[0x70] = (CPropMinigun)((byte)this[0x70] | 1);
}
*(undefined4 *)(this + 0x15cc) = 0xffffffff;
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.