CBaseCSGrenade::PrimaryAttack
0x0043e600 · 753 bytes · __thiscall
_ZN14CBaseCSGrenade13PrimaryAttackEv
Decompiled
undefined (1 param)
/* CBaseCSGrenade::PrimaryAttack() */
void __thiscall CBaseCSGrenade::PrimaryAttack(CBaseCSGrenade *this)
{
CBaseEdict *pCVar1;
code *pcVar2;
int *piVar3;
char cVar4;
CBaseCombatCharacter *this_00;
int iVar5;
undefined4 uVar6;
Checkpoint *this_01;
int in_GS_OFFSET;
float fVar7;
CAI_Concept local_134 [8];
CFmtStrN<256> local_12c [5];
undefined1 local_127 [263];
int local_20;
local_20 = *(int *)(in_GS_OFFSET + 0x14);
if ((((this[0x17dc] == (CBaseCSGrenade)0x0) && (this[0x17dd] == (CBaseCSGrenade)0x0)) &&
(this[0x17e4] == (CBaseCSGrenade)0x0)) && (*(float *)(this + 0x17e0) <= 0.0)) {
this_00 = (CBaseCombatCharacter *)CTerrorWeapon::GetPlayerOwner((CTerrorWeapon *)this);
if (this_00 != (CBaseCombatCharacter *)0x0) {
cVar4 = (**(code **)(*(int *)this_00 + 0x16c))(this_00);
if (cVar4 != '\0') {
iVar5 = CBaseCombatCharacter::GetAmmoCount(this_00,*(int *)(this + 0x1418));
if (0 < iVar5) {
cVar4 = (**(code **)(*(int *)this_00 + 0x840))(this_00);
if (cVar4 != '\0') {
cVar4 = CTerrorWeapon::HelpingHandPrimaryAttack((CTerrorWeapon *)this);
if (cVar4 == '\0') {
cVar4 = CDirector::IsMissionStartMap(TheDirector);
if (cVar4 == '\0') {
cVar4 = CDirector::HasAnySurvivorLeftSafeArea(TheDirector);
if (cVar4 == '\0') {
this_01 = (Checkpoint *)TerrorNavMesh::GetInitialCheckpoint(TheNavMesh);
if (this_01 != (Checkpoint *)0x0) {
iVar5 = Checkpoint::GetOpenDoor(this_01);
if (iVar5 == 0) {
CBaseCombatCharacter::SwitchToNextBestWeapon(this_00,(CBaseCombatWeapon *)0x0)
;
goto LAB_0043e62c;
}
}
}
}
(**(code **)(*(int *)this + 0x3f0))(this,0xbe);
if (this[0x17dd] != (CBaseCSGrenade)0x1) {
if (this[0x6c] == (CBaseCSGrenade)0x0) {
pCVar1 = *(CBaseEdict **)(this + 0x30);
if (pCVar1 != (CBaseEdict *)0x0) {
*(uint *)pCVar1 = *(uint *)pCVar1 | 0x101;
iVar5 = CBaseEdict::GetChangeAccessor(pCVar1);
*(undefined2 *)(iVar5 + 2) = 0;
}
}
else {
this[0x70] = (CBaseCSGrenade)((byte)this[0x70] | 1);
}
this[0x17dd] = (CBaseCSGrenade)0x1;
}
if (this[0x17de] != (CBaseCSGrenade)0x0) {
CServerNetworkProperty::NetworkStateChanged((short)this + 0x24);
this[0x17de] = (CBaseCSGrenade)0x0;
}
if (this[0x17e4] != (CBaseCSGrenade)0x0) {
CServerNetworkProperty::NetworkStateChanged((short)this + 0x24);
this[0x17e4] = (CBaseCSGrenade)0x0;
}
(**(code **)(*(int *)this_00 + 0x7fc))(this_00,0x3b,0);
piVar3 = mdlcache;
(**(code **)(*mdlcache + 0x68))(mdlcache);
/* try { // try from 0043e775 to 0043e85e has its CatchHandler @ 0043e8fa */
(**(code **)(*(int *)this + 0x404))(this,*(float *)(gpGlobals + 0xc) + 0.5);
fVar7 = *(float *)(gpGlobals + 0xc) + 0.5;
if (fVar7 != *(float *)(this + 0x13fc)) {
if (this[0x6c] == (CBaseCSGrenade)0x0) {
pCVar1 = *(CBaseEdict **)(this + 0x30);
if (pCVar1 != (CBaseEdict *)0x0) {
*(uint *)pCVar1 = *(uint *)pCVar1 | 0x101;
iVar5 = CBaseEdict::GetChangeAccessor(pCVar1);
*(undefined2 *)(iVar5 + 2) = 0;
}
}
else {
this[0x70] = (CBaseCSGrenade)((byte)this[0x70] | 1);
}
*(float *)(this + 0x13fc) = fVar7;
}
uVar6 = (**(code **)(*(int *)this + 0x6c8))(this);
CFmtStrN<256>::CFmtStrN(local_12c,"GrenadeType:%s",uVar6);
pcVar2 = *(code **)(*(int *)this_00 + 0x7b4);
CAI_Concept::CAI_Concept(local_134,"ThrewGrenade");
(*pcVar2)(this_00,local_134,1,local_127,0,0,0);
(**(code **)(*piVar3 + 0x6c))(piVar3);
}
}
}
}
}
}
LAB_0043e62c:
if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {
return;
}
/* WARNING: Subroutine does not return */
__stack_chk_fail();
}
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.