CMolotovProjectile::Create
0x0054d3a0 · 993 bytes · __cdecl
_ZN18CMolotovProjectile6CreateERK6VectorRK6QAngleS2_S2_P20CBaseCombatCharacter
Decompiled
undefined (5 params)
/* CMolotovProjectile::Create(Vector const&, QAngle const&, Vector const&, Vector const&,
CBaseCombatCharacter*) */
CBaseCSGrenadeProjectile *
CMolotovProjectile::Create
(Vector *param_1,QAngle *param_2,Vector *param_3,Vector *param_4,
CBaseCombatCharacter *param_5)
{
code *pcVar1;
CBaseEdict *pCVar2;
char cVar3;
CBaseCSGrenadeProjectile *this;
undefined4 uVar4;
int *piVar5;
int iVar6;
CBaseCombatCharacter *pCVar7;
undefined1 local_24 [20];
this = (CBaseCSGrenadeProjectile *)
CBaseEntity::Create("molotov_projectile",param_1,param_2,(CBaseEntity *)param_5);
UTIL_LogPrintf("Molotov projectile spawned at %f %f %f, velocity %f %f %f\n",
(double)*(float *)param_1,(double)*(float *)(param_1 + 4),
(double)*(float *)(param_1 + 8),(double)*(float *)param_3,
(double)*(float *)(param_3 + 4),(double)*(float *)(param_3 + 8));
CBaseCSGrenadeProjectile::SetDetonateTimerLength(this,1.5);
CBaseEntity::SetAbsVelocity((CBaseEntity *)this,param_3);
CBaseCSGrenadeProjectile::SetupInitialTransmittedGrenadeVelocity(this,param_3);
CBaseGrenade::SetThrower((CBaseGrenade *)this,param_5);
*(undefined4 *)(this + 0x2c0) = 0x3ecccccd;
CBaseEntity::SetFriction((CBaseEntity *)this,0.2);
if (*(float *)(this + 0x2c8) != 0.45) {
if (this[0x6c] == (CBaseCSGrenadeProjectile)0x0) {
pCVar2 = *(CBaseEdict **)(this + 0x30);
if (pCVar2 != (CBaseEdict *)0x0) {
*(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
iVar6 = CBaseEdict::GetChangeAccessor(pCVar2);
*(undefined2 *)(iVar6 + 2) = 0;
}
}
else {
this[0x70] = (CBaseCSGrenadeProjectile)((byte)this[0x70] | 1);
}
*(undefined4 *)(this + 0x2c8) = 0x3ee66666;
}
*(undefined4 *)(this + 0xd8) = 0x569;
*(undefined4 *)(this + 0xdc) = 0;
CBaseEntity::ThinkSet((_func_void *)local_24,(float)this,(char *)DetonateThink);
CBaseEntity::SetNextThink((CBaseEntity *)this,*(float *)(gpGlobals + 0xc) + 2.0,(char *)0x0);
if (*(float *)(this + 0x1a50) != 200.0) {
if (this[0x6c] == (CBaseCSGrenadeProjectile)0x0) {
pCVar2 = *(CBaseEdict **)(this + 0x30);
if (pCVar2 != (CBaseEdict *)0x0) {
*(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
iVar6 = CBaseEdict::GetChangeAccessor(pCVar2);
*(undefined2 *)(iVar6 + 2) = 0;
}
}
else {
this[0x70] = (CBaseCSGrenadeProjectile)((byte)this[0x70] | 1);
}
*(undefined4 *)(this + 0x1a50) = 0x43480000;
}
if (*(float *)(this + 0x1a44) == 300.0) {
pcVar1 = *(code **)(*(int *)this + 0x194);
}
else {
if (this[0x6c] == (CBaseCSGrenadeProjectile)0x0) {
pCVar2 = *(CBaseEdict **)(this + 0x30);
if (pCVar2 != (CBaseEdict *)0x0) {
*(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
iVar6 = CBaseEdict::GetChangeAccessor(pCVar2);
*(undefined2 *)(iVar6 + 2) = 0;
}
}
else {
this[0x70] = (CBaseCSGrenadeProjectile)((byte)this[0x70] | 1);
}
*(undefined4 *)(this + 0x1a44) = 0x43960000;
pcVar1 = *(code **)(*(int *)this + 0x194);
}
if (param_5 == (CBaseCombatCharacter *)0x0) {
(*pcVar1)(this,2);
CBaseEntity::ApplyLocalAngularVelocityImpulse((CBaseEntity *)this,param_4);
CBaseEntity::EmitSound((CBaseEntity *)this,"Molotov.Throw",0.0,(float *)0x0);
CBaseEntity::EmitSound((CBaseEntity *)this,"Molotov.Loop",0.0,(float *)0x0);
(**(code **)(*gameeventmanager + 0x1c))(gameeventmanager,"molotov_thrown",0,0);
}
else {
uVar4 = CBaseEntity::GetTeamNumber((CBaseEntity *)param_5);
(*pcVar1)(this,uVar4);
CBaseEntity::ApplyLocalAngularVelocityImpulse((CBaseEntity *)this,param_4);
CBaseEntity::EmitSound((CBaseEntity *)this,"Molotov.Throw",0.0,(float *)0x0);
CBaseEntity::EmitSound((CBaseEntity *)this,"Molotov.Loop",0.0,(float *)0x0);
piVar5 = (int *)(**(code **)(*gameeventmanager + 0x1c))(gameeventmanager,"molotov_thrown",0,0);
if ((piVar5 != (int *)0x0) &&
(cVar3 = (**(code **)(*(int *)param_5 + 0x16c))(param_5), cVar3 != '\0')) {
pcVar1 = *(code **)(*piVar5 + 0x30);
cVar3 = (**(code **)(*(int *)param_5 + 0x16c))(param_5);
pCVar7 = (CBaseCombatCharacter *)0x0;
if (cVar3 != '\0') {
pCVar7 = param_5;
}
uVar4 = (**(code **)(*engine + 0x40))(engine,*(undefined4 *)(pCVar7 + 0x30));
(*pcVar1)(piVar5,"userid",uVar4);
(**(code **)(*gameeventmanager + 0x20))(gameeventmanager,piVar5,0);
return this;
}
}
return this;
}
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.