CThrow::UpdateAbility
0x004de3d0 · 4244 bytes · __thiscall
_ZN6CThrow13UpdateAbilityEv
Decompiled
undefined (1 param)
/* CThrow::UpdateAbility() */
void __thiscall CThrow::UpdateAbility(CThrow *this)
{
uint uVar1;
CBaseEntity *this_00;
code *pcVar2;
uint *puVar3;
char cVar4;
mstudioseqdesc_t *pmVar5;
int iVar6;
int *piVar7;
float *pfVar8;
int *piVar9;
undefined4 *puVar10;
float *pfVar11;
float *pfVar12;
int iVar13;
undefined *puVar14;
mstudioseqdesc_t *pmVar15;
byte bVar16;
longdouble lVar17;
longdouble lVar18;
float fVar19;
float local_12c;
CStudioHdr *local_110;
float local_10c;
float local_108;
float local_104;
float local_100;
float local_fc;
float local_f8;
undefined1 local_f4 [12];
undefined4 local_e8;
float local_e4;
undefined4 local_e0;
undefined **local_dc [4];
float local_cc;
float local_c8;
float local_c4;
float local_bc;
float local_b8;
float local_b4;
float local_ac;
float local_a8;
float local_a4;
float local_9c;
float local_98;
float local_94;
undefined4 local_8c;
undefined1 local_88;
undefined1 local_87;
float local_7c;
float local_78;
float local_74;
float local_70;
float local_6c;
float local_68;
float local_50;
int local_30;
bVar16 = 0;
uVar1 = *(uint *)(this + 0x44c);
if (uVar1 == 0xffffffff) {
return;
}
puVar14 = g_pEntityList + (uVar1 & 0xfff) * 0x10;
if (puVar14 == (undefined *)0xfffffffc) {
return;
}
if (*(uint *)(puVar14 + 8) != uVar1 >> 0xc) {
return;
}
this_00 = *(CBaseEntity **)(puVar14 + 4);
if (this_00 == (CBaseEntity *)0x0) {
return;
}
if ((this[0x478] == (CThrow)0x0) ||
((iVar6 = CMultiPlayerAnimState::GetMainActivity(*(CMultiPlayerAnimState **)(this_00 + 0x2910))
, iVar6 != 0x2fa &&
(iVar6 = CMultiPlayerAnimState::GetMainActivity(*(CMultiPlayerAnimState **)(this_00 + 0x2910))
, iVar6 != 0x2f9)))) goto LAB_004de432;
piVar7 = mdlcache;
(**(code **)(*mdlcache + 0x68))();
local_110 = *(CStudioHdr **)(this_00 + 0x13e0);
if (local_110 == (CStudioHdr *)0x0) {
/* try { // try from 004def02 to 004def18 has its CatchHandler @ 004df4b3 */
iVar6 = CBaseEntity::GetModel(this_00);
if (iVar6 != 0) {
CBaseAnimating::LockStudioHdr((CBaseAnimating *)this_00);
}
local_12c = 2.0;
local_110 = *(CStudioHdr **)(this_00 + 0x13e0);
if (local_110 != (CStudioHdr *)0x0) goto LAB_004de563;
}
else {
LAB_004de563:
if (*(int *)local_110 == 0) {
local_12c = 2.0;
}
else {
iVar6 = *(int *)(this_00 + 0x494);
if (iVar6 < 0) {
local_12c = 2.0;
}
else {
/* try { // try from 004de5a0 to 004de6fc has its CatchHandler @ 004df4b3 */
pmVar5 = (mstudioseqdesc_t *)CStudioHdr::pSeqdesc(local_110,iVar6);
pfVar8 = &local_7c;
for (iVar13 = 0x18; iVar13 != 0; iVar13 = iVar13 + -1) {
*pfVar8 = 0.0;
pfVar8 = pfVar8 + (uint)bVar16 * -2 + 1;
}
lVar18 = (longdouble)Studio_CPS(local_110,pmVar5,iVar6,&local_7c);
lVar17 = (longdouble)Studio_Duration(local_110,iVar6,&local_7c);
local_12c = (float)lVar17;
if (0 < *(int *)(pmVar5 + 0x18)) {
iVar6 = 0;
local_110 = (CStudioHdr *)0x0;
do {
pmVar15 = pmVar5 + *(int *)(pmVar5 + 0x1c) + iVar6;
if (*(float *)(pmVar15 + 4) == 7.42688e-44) {
fVar19 = (1.0 / (float)lVar18) * *(float *)pmVar15;
lVar17 = (longdouble)CountdownTimer::Now();
if ((float)lVar17 + fVar19 != *(float *)(this + 0x484)) {
(**(code **)(*(int *)(this + 0x47c) + 4))();
*(float *)(this + 0x484) = (float)lVar17 + fVar19;
}
if (fVar19 != *(float *)(this + 0x480)) {
(**(code **)(*(int *)(this + 0x47c) + 4))();
*(float *)(this + 0x480) = fVar19;
}
}
else if (*(float *)(pmVar15 + 4) == 7.56701e-44) {
fVar19 = (1.0 / (float)lVar18) * *(float *)pmVar15;
/* try { // try from 004de97d to 004dea43 has its CatchHandler @ 004df4b3 */
lVar17 = (longdouble)CountdownTimer::Now();
if ((float)lVar17 + fVar19 != *(float *)(this + 0x490)) {
(**(code **)(*(int *)(this + 0x488) + 4))();
*(float *)(this + 0x490) = (float)lVar17 + fVar19;
}
if (fVar19 != *(float *)(this + 0x48c)) {
(**(code **)(*(int *)(this + 0x488) + 4))();
*(float *)(this + 0x48c) = fVar19;
}
}
local_110 = (CStudioHdr *)((int)local_110 + 1);
iVar6 = iVar6 + 0x50;
} while ((int)local_110 < *(int *)(pmVar5 + 0x18));
}
}
}
}
/* try { // try from 004de901 to 004de905 has its CatchHandler @ 004df4b3 */
lVar18 = (longdouble)CountdownTimer::Now();
if ((float)lVar18 + local_12c != *(float *)(this + 0x468)) {
/* try { // try from 004deeab to 004deead has its CatchHandler @ 004df4b3 */
(**(code **)(*(int *)(this + 0x460) + 4))();
*(float *)(this + 0x468) = (float)lVar18 + local_12c;
}
if (local_12c != *(float *)(this + 0x464)) {
/* try { // try from 004deb33 to 004deb35 has its CatchHandler @ 004df4b3 */
(**(code **)(*(int *)(this + 0x460) + 4))();
*(float *)(this + 0x464) = local_12c;
}
this[0x478] = (CThrow)0x0;
(**(code **)(*piVar7 + 0x6c))();
LAB_004de432:
if (*(float *)(this + 0x468) <= 0.0) {
return;
}
cVar4 = (**(code **)(*(int *)this_00 + 0x7e8))();
if (cVar4 != '\0') {
if (*(float *)(this + 0x474) == -1.0) {
fVar19 = *(float *)(this + 0x484);
}
else {
(**(code **)(*(int *)(this + 0x46c) + 4))();
fVar19 = *(float *)(this + 0x484);
*(undefined4 *)(this + 0x474) = 0xbf800000;
}
if (fVar19 == -1.0) {
fVar19 = *(float *)(this + 0x490);
}
else {
(**(code **)(*(int *)(this + 0x47c) + 4))();
*(undefined4 *)(this + 0x484) = 0xbf800000;
fVar19 = *(float *)(this + 0x490);
}
if (fVar19 != -1.0) {
(**(code **)(*(int *)(this + 0x488) + 4))();
*(undefined4 *)(this + 0x490) = 0xbf800000;
}
uVar1 = *(uint *)(this + 0x494);
if (((uVar1 != 0xffffffff) &&
(puVar14 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar14 != (undefined *)0xfffffffc)) &&
((*(uint *)(puVar14 + 8) == uVar1 >> 0xc &&
(*(CBaseEntity **)(puVar14 + 4) != (CBaseEntity *)0x0)))) {
UTIL_Remove(*(CBaseEntity **)(puVar14 + 4));
*(undefined4 *)(this + 0x494) = 0xffffffff;
}
this[0x478] = (CThrow)0x0;
if (*(float *)(this + 0x468) != -1.0) {
(**(code **)(*(int *)(this + 0x460) + 4))();
*(undefined4 *)(this + 0x468) = 0xbf800000;
return;
}
return;
}
iVar6 = CTerrorPlayer::GetStaggerDir((CTerrorPlayer *)this_00);
if (iVar6 != 0) {
if (*(float *)(this + 0x474) != -1.0) {
(**(code **)(*(int *)(this + 0x46c) + 4))();
*(undefined4 *)(this + 0x474) = 0xbf800000;
}
if (*(float *)(this + 0x484) != -1.0) {
(**(code **)(*(int *)(this + 0x47c) + 4))();
*(undefined4 *)(this + 0x484) = 0xbf800000;
}
if (*(float *)(this + 0x490) != -1.0) {
(**(code **)(*(int *)(this + 0x488) + 4))();
*(undefined4 *)(this + 0x490) = 0xbf800000;
}
uVar1 = *(uint *)(this + 0x494);
if ((((uVar1 != 0xffffffff) &&
(puVar14 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar14 != (undefined *)0xfffffffc)) &&
(*(uint *)(puVar14 + 8) == uVar1 >> 0xc)) &&
(*(CBaseEntity **)(puVar14 + 4) != (CBaseEntity *)0x0)) {
UTIL_Remove(*(CBaseEntity **)(puVar14 + 4));
*(undefined4 *)(this + 0x494) = 0xffffffff;
}
this[0x478] = (CThrow)0x0;
if (*(float *)(this + 0x468) != -1.0) {
(**(code **)(*(int *)(this + 0x460) + 4))();
*(undefined4 *)(this + 0x468) = 0xbf800000;
}
CBaseAbility::StartActivationTimer
((CBaseAbility *)this,*(float *)(ZombieHulkThrowInterval._28_4_ + 0x2c),0.0);
return;
}
if (0.0 < *(float *)(this + 0x474)) {
lVar18 = (longdouble)CountdownTimer::Now();
if (*(float *)(this + 0x474) <= (float)lVar18) {
if (*(float *)(this + 0x474) != -1.0) {
(**(code **)(*(int *)(this + 0x46c) + 4))();
*(undefined4 *)(this + 0x474) = 0xbf800000;
}
piVar7 = (int *)CBaseCombatCharacter::GetActiveWeapon((CBaseCombatCharacter *)this_00);
if (piVar7 != (int *)0x0) {
(**(code **)(*piVar7 + 0x3f0))();
}
}
}
piVar7 = (int *)&stack0xfffffea4;
if (0.0 < *(float *)(this + 0x484)) {
lVar18 = (longdouble)CountdownTimer::Now();
piVar7 = (int *)&stack0xfffffea4;
if (*(float *)(this + 0x484) <= (float)lVar18) {
if (*(float *)(this + 0x484) != -1.0) {
(**(code **)(*(int *)(this + 0x47c) + 4))();
*(undefined4 *)(this + 0x484) = 0xbf800000;
}
(**(code **)(*(int *)this_00 + 0x234))();
piVar7 = (int *)&stack0xfffffea0;
pfVar8 = (float *)(**(code **)(*(int *)this_00 + 0x238))();
local_7c = *pfVar8;
local_78 = pfVar8[1];
local_74 = pfVar8[2];
piVar9 = (int *)CTankRock::Create((Vector *)&local_cc,(QAngle *)&local_7c,
(Vector *)&vec3_origin,(CBaseCombatCharacter *)this_00);
if (piVar9 == (int *)0x0) {
*(undefined4 *)(this + 0x494) = 0xffffffff;
}
else {
puVar10 = (undefined4 *)(**(code **)(*piVar9 + 0xc))();
*(undefined4 *)(this + 0x494) = *puVar10;
piVar7 = (int *)&stack0xfffffea0;
}
}
}
if (0.0 < *(float *)(this + 0x490)) {
*piVar7 = (int)(this + 0x488);
piVar7[-1] = 0x4decc4;
lVar18 = (longdouble)CountdownTimer::Now();
if (*(float *)(this + 0x490) <= (float)lVar18) {
if (*(float *)(this + 0x490) != -1.0) {
iVar6 = *(int *)(this + 0x488);
*piVar7 = (int)(this + 0x488);
piVar7[1] = (int)(this + 0x490);
pcVar2 = *(code **)(iVar6 + 4);
piVar7[-1] = 0x4ded02;
(*pcVar2)();
*(undefined4 *)(this + 0x490) = 0xbf800000;
}
uVar1 = *(uint *)(this + 0x494);
if (((uVar1 == 0xffffffff) ||
(puVar14 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar14 == (undefined *)0xfffffffc)) ||
(*(uint *)(puVar14 + 8) != uVar1 >> 0xc)) {
*(undefined4 *)(this + 0x494) = 0xffffffff;
}
else {
iVar6 = *(int *)(puVar14 + 4);
*(undefined4 *)(this + 0x494) = 0xffffffff;
if (iVar6 != 0) {
piVar7[3] = 0;
piVar7[1] = (int)&local_10c;
piVar7[2] = 0;
*piVar7 = (int)this_00;
piVar7[-1] = 0x4df0c6;
CBasePlayer::EyeVectors
((CBasePlayer *)*piVar7,(Vector *)piVar7[1],(Vector *)piVar7[2],
(Vector *)piVar7[3]);
*piVar7 = (int)this_00;
piVar7[3] = (int)local_f4;
piVar7[2] = (int)&local_100;
piVar7[1] = (int)"debris";
piVar7[-1] = 0x4df0ea;
CBaseAnimating::GetAttachment
((CBaseAnimating *)*piVar7,(char *)piVar7[1],(Vector *)piVar7[2],
(QAngle *)piVar7[3]);
piVar7[1] = (int)this_00;
*piVar7 = (int)local_dc;
piVar7[3] = 0;
piVar7[2] = 0;
piVar7[-1] = 0x4df118;
CTraceFilterSimple::CTraceFilterSimple
((CTraceFilterSimple *)*piVar7,(IHandleEntity *)piVar7[1],piVar7[2],
(_func_bool_IHandleEntity_ptr_int *)piVar7[3]);
iVar13 = *(int *)(iVar6 + 0x194);
*piVar7 = iVar6 + 0x194;
local_dc[0] = &PTR_ShouldHitEntity_00c23c68;
pcVar2 = *(code **)(iVar13 + 8);
piVar7[-1] = 0x4df12e;
pfVar8 = (float *)(*pcVar2)();
iVar13 = *(int *)(iVar6 + 0x194);
*piVar7 = iVar6 + 0x194;
pcVar2 = *(code **)(iVar13 + 4);
piVar7[-1] = 0x4df140;
pfVar11 = (float *)(*pcVar2)();
iVar13 = *(int *)this_00;
*piVar7 = (int)this_00;
pcVar2 = *(code **)(iVar13 + 0x288);
piVar7[-1] = 0x4df153;
pfVar12 = (float *)(*pcVar2)();
local_bc = local_100 - *pfVar12;
local_b8 = local_fc - pfVar12[1];
local_b4 = local_f8 - pfVar12[2];
local_8c = 0;
local_87 = local_bc * local_bc + local_b4 * local_b4 + local_b8 * local_b8 != 0.0;
local_9c = (*pfVar8 - *pfVar11) * 0.5;
local_98 = (pfVar8[1] - pfVar11[1]) * 0.5;
local_94 = (pfVar8[2] - pfVar11[2]) * 0.5;
local_88 = local_98 * local_98 + local_9c * local_9c + local_94 * local_94 < 1e-06;
local_ac = (*pfVar8 + *pfVar11) * 0.5;
local_a8 = (pfVar8[1] + pfVar11[1]) * 0.5;
local_a4 = (pfVar8[2] + pfVar11[2]) * 0.5;
local_cc = *pfVar12 + local_ac;
local_c8 = pfVar12[1] + local_a8;
local_c4 = pfVar12[2] + local_a4;
local_ac = -local_ac;
local_a8 = -local_a8;
local_a4 = -local_a4;
iVar13 = *enginetrace;
piVar7[3] = (int)local_dc;
*piVar7 = (int)enginetrace;
piVar7[4] = (int)&local_7c;
piVar7[2] = 0x200400b;
piVar7[1] = (int)&local_cc;
pcVar2 = *(code **)(iVar13 + 0x14);
piVar7[-1] = 0x4df324;
(*pcVar2)();
if (*(int *)(r_visualizetraces._28_4_ + 0x30) != 0) {
piVar7[6] = -0x40800000;
piVar7[5] = 1;
piVar7[4] = 0;
piVar7[3] = 0xff;
piVar7[2] = 0xff;
piVar7[1] = (int)&local_70;
*piVar7 = (int)&local_7c;
piVar7[-1] = 0x4df36d;
DebugDrawLine((Vector *)*piVar7,(Vector *)piVar7[1],piVar7[2],piVar7[3],piVar7[4],
SUB41(piVar7[5],0),(float)piVar7[6]);
}
if ((local_50 != 1.0) && (local_30 != iVar6)) {
local_100 = local_70;
local_fc = local_6c;
local_f8 = local_68;
}
iVar13 = *random_valve;
piVar7[2] = 0x78;
piVar7[1] = -0x78;
*piVar7 = (int)random_valve;
pcVar2 = *(code **)(iVar13 + 8);
piVar7[-1] = 0x4df3c4;
iVar13 = (*pcVar2)();
local_e8 = 0x42700000;
local_e0 = 0;
local_e4 = (float)iVar13;
if (((byte)this_00[0x14d] & 0x10) != 0) {
*piVar7 = (int)this_00;
piVar7[-1] = 0x4df48e;
CBaseEntity::CalcAbsoluteVelocity((CBaseEntity *)*piVar7);
}
fVar19 = *(float *)(ZombieTankThrowForce._28_4_ + 0x2c);
local_cc = fVar19 * local_10c + *(float *)(this_00 + 0x274);
local_c8 = local_108 * fVar19 + *(float *)(this_00 + 0x278);
local_c4 = local_104 * fVar19 + *(float *)(this_00 + 0x27c);
piVar7[3] = (int)&local_cc;
piVar7[4] = (int)&local_e8;
piVar7[2] = (int)local_f4;
piVar7[1] = (int)&local_100;
*piVar7 = iVar6;
piVar7[-1] = 0x4df481;
CTankRock::OnRelease
((CTankRock *)*piVar7,(Vector *)piVar7[1],(QAngle *)piVar7[2],
(Vector *)piVar7[3],(Vector *)piVar7[4]);
}
}
piVar7[3] = 0;
piVar7[2] = 0;
piVar7[1] = (int)"HulkZombie.Throw";
*piVar7 = (int)this_00;
piVar7[-1] = 0x4ded6d;
CBaseEntity::EmitSound
((CBaseEntity *)*piVar7,(char *)piVar7[1],(float)piVar7[2],(float *)piVar7[3]);
}
}
if (*(float *)(this_00 + 0x2848) != 3000.0) {
if (this_00[0x6c] == (CBaseEntity)0x0) {
puVar3 = *(uint **)(this_00 + 0x30);
if (puVar3 != (uint *)0x0) {
*puVar3 = *puVar3 | 0x101;
*piVar7 = (int)puVar3;
piVar7[-1] = 0x4deede;
iVar6 = CBaseEdict::GetChangeAccessor((CBaseEdict *)*piVar7);
*(undefined2 *)(iVar6 + 2) = 0;
}
}
else {
this_00[0x70] = (CBaseEntity)((byte)this_00[0x70] | 1);
}
*(undefined4 *)(this_00 + 0x2848) = 0x453b8000;
}
*piVar7 = (int)(this + 0x460);
piVar7[-1] = 0x4ded96;
lVar18 = (longdouble)CountdownTimer::Now();
if (*(float *)(this + 0x468) <= (float)lVar18) {
if (*(float *)(this_00 + 0x2848) != 0.0) {
if (this_00[0x6c] == (CBaseEntity)0x0) {
puVar3 = *(uint **)(this_00 + 0x30);
if (puVar3 != (uint *)0x0) {
*puVar3 = *puVar3 | 0x101;
*piVar7 = (int)puVar3;
piVar7[-1] = 0x4defb0;
iVar6 = CBaseEdict::GetChangeAccessor((CBaseEdict *)*piVar7);
*(undefined2 *)(iVar6 + 2) = 0;
}
}
else {
this_00[0x70] = (CBaseEntity)((byte)this_00[0x70] | 1);
}
*(undefined4 *)(this_00 + 0x2848) = 0;
}
if (*(float *)(this + 0x474) != -1.0) {
iVar6 = *(int *)(this + 0x46c);
*piVar7 = (int)(this + 0x46c);
piVar7[1] = (int)(this + 0x474);
pcVar2 = *(code **)(iVar6 + 4);
piVar7[-1] = 0x4df02a;
(*pcVar2)();
*(undefined4 *)(this + 0x474) = 0xbf800000;
}
if (*(float *)(this + 0x484) != -1.0) {
iVar6 = *(int *)(this + 0x47c);
*piVar7 = (int)(this + 0x47c);
piVar7[1] = (int)(this + 0x484);
pcVar2 = *(code **)(iVar6 + 4);
piVar7[-1] = 0x4defef;
(*pcVar2)();
*(undefined4 *)(this + 0x484) = 0xbf800000;
}
if (*(float *)(this + 0x490) != -1.0) {
iVar6 = *(int *)(this + 0x488);
*piVar7 = (int)(this + 0x488);
piVar7[1] = (int)(this + 0x490);
pcVar2 = *(code **)(iVar6 + 4);
piVar7[-1] = 0x4def74;
(*pcVar2)();
*(undefined4 *)(this + 0x490) = 0xbf800000;
}
uVar1 = *(uint *)(this + 0x494);
if ((((uVar1 != 0xffffffff) &&
(puVar14 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar14 != (undefined *)0xfffffffc)) &&
(*(uint *)(puVar14 + 8) == uVar1 >> 0xc)) && (*(int *)(puVar14 + 4) != 0)) {
*piVar7 = *(int *)(puVar14 + 4);
piVar7[-1] = 0x4df072;
UTIL_Remove((CBaseEntity *)*piVar7);
*(undefined4 *)(this + 0x494) = 0xffffffff;
}
this[0x478] = (CThrow)0x0;
if (*(float *)(this + 0x468) != -1.0) {
iVar6 = *(int *)(this + 0x460);
*piVar7 = (int)(this + 0x460);
piVar7[1] = (int)(this + 0x468);
pcVar2 = *(code **)(iVar6 + 4);
piVar7[-1] = 0x4dee51;
(*pcVar2)();
*(undefined4 *)(this + 0x468) = 0xbf800000;
return;
}
return;
}
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.