CBasePlayer::CheatImpulseCommands
0x007b0f50 · 2780 bytes · __thiscall
_ZN11CBasePlayer20CheatImpulseCommandsEi
Decompiled
undefined (2 params)
/* CBasePlayer::CheatImpulseCommands(int) */
void __thiscall CBasePlayer::CheatImpulseCommands(CBasePlayer *this,int param_1)
{
int *piVar1;
undefined1 *puVar2;
CBaseEntity *pCVar3;
int iVar4;
Vector *pVVar5;
undefined1 *local_110 [4];
float local_100;
float local_fc;
float local_f8;
float local_f4;
float local_f0;
float local_ec;
float local_e8;
float local_e4;
float local_e0;
CTraceFilterSimple local_dc [16];
float local_cc;
float local_c8;
float local_c4;
float local_bc;
float local_b8;
float local_b4;
undefined4 local_ac;
undefined4 local_a8;
undefined4 local_a4;
undefined4 local_9c;
undefined4 local_98;
undefined4 local_94;
undefined4 local_8c;
undefined1 local_88;
undefined1 local_87;
float local_70;
float local_6c;
float local_68;
Vector local_64 [32];
float local_44;
int local_34;
if (*(int *)(*(int *)(sv_cheats + 0x1c) + 0x30) != 0) {
switch(param_1) {
case 0x4c:
if (giPrecacheGrunt == 0) {
giPrecacheGrunt = 1;
Msg("You must now restart to use Grunt-o-matic.\n");
}
else {
(**(code **)(*(int *)this + 0x238))(this);
UTIL_YawToVector((float)&local_cc);
local_6c = local_c8 * 128.0 + *(float *)(this + 0x3a0);
local_68 = local_c4 * 128.0 + *(float *)(this + 0x3a4);
local_70 = local_cc * 128.0 + *(float *)(this + 0x39c);
CBaseEntity::Create("NPC_human_grunt",(Vector *)&local_70,(QAngle *)(this + 0x3a8),
(CBaseEntity *)0x0);
}
break;
case 0x51:
(**(code **)(*(int *)this + 0x6c0))(this,"weapon_cubemap",0,1,0);
break;
case 0x52:
CreateJeep(this);
break;
case 0x53:
CreateAirboat(this);
break;
case 0x65:
gEvilImpulse101 = 1;
(**(code **)(*(int *)this + 0x764))(this,1);
CBaseCombatCharacter::GiveAmmo((int)this,(char *)0xff,true);
CBaseCombatCharacter::GiveAmmo((int)this,(char *)0xff,true);
CBaseCombatCharacter::GiveAmmo((int)this,(char *)0x5,true);
CBaseCombatCharacter::GiveAmmo((int)this,(char *)0xff,true);
CBaseCombatCharacter::GiveAmmo((int)this,(char *)0xff,true);
CBaseCombatCharacter::GiveAmmo((int)this,(char *)0x3,true);
CBaseCombatCharacter::GiveAmmo((int)this,(char *)0x3,true);
CBaseCombatCharacter::GiveAmmo((int)this,(char *)0x5,true);
CBaseCombatCharacter::GiveAmmo((int)this,(char *)0x20,true);
CBaseCombatCharacter::GiveAmmo((int)this,(char *)0x10,true);
(**(code **)(*(int *)this + 0x6c0))(this,"weapon_smg1",0,1,0);
(**(code **)(*(int *)this + 0x6c0))(this,"weapon_frag",0,1,0);
(**(code **)(*(int *)this + 0x6c0))(this,"weapon_crowbar",0,1,0);
(**(code **)(*(int *)this + 0x6c0))(this,"weapon_pistol",0,1,0);
(**(code **)(*(int *)this + 0x6c0))(this,"weapon_ar2",0,1,0);
(**(code **)(*(int *)this + 0x6c0))(this,"weapon_shotgun",0,1,0);
(**(code **)(*(int *)this + 0x6c0))(this,"weapon_physcannon",0,1,0);
(**(code **)(*(int *)this + 0x6c0))(this,"weapon_bugbait",0,1,0);
(**(code **)(*(int *)this + 0x6c0))(this,"weapon_rpg",0,1,0);
(**(code **)(*(int *)this + 0x6c0))(this,"weapon_357",0,1,0);
(**(code **)(*(int *)this + 0x6c0))(this,"weapon_crossbow",0,1,0);
if (*(int *)(this + 0x100) < 100) {
(**(code **)(*(int *)this + 0x128))(this,0x41c80000,0);
}
gEvilImpulse101 = 0;
break;
case 0x66:
CGib::SpawnRandomGibs(this,1,0);
break;
case 0x67:
iVar4 = FindEntityForward(this,true);
if ((iVar4 != 0) && (piVar1 = (int *)CBaseEntity::MyNPCPointer(), piVar1 != (int *)0x0)) {
(**(code **)(*piVar1 + 0x984))(piVar1);
}
break;
case 0x6a:
piVar1 = (int *)FindEntityForward(this,true);
if (piVar1 != (int *)0x0) {
puVar2 = &DAT_00d539c2;
if ((undefined1 *)piVar1[0x1f] != (undefined1 *)0x0) {
puVar2 = (undefined1 *)piVar1[0x1f];
}
Msg("Classname: %s",puVar2);
if (piVar1[0x55] == 0) {
Msg(" - Name: No Targetname\n",puVar2);
}
else {
Msg(" - Name: %s\n",piVar1[0x55]);
}
if (piVar1[0x21] != 0) {
Msg("Parent: %s\n",piVar1[0x21]);
}
(**(code **)(*piVar1 + 0x20))(local_110,piVar1);
puVar2 = &DAT_00d539c2;
if (local_110[0] != (undefined1 *)0x0) {
puVar2 = local_110[0];
}
Msg("Model: %s\n",puVar2);
if (piVar1[0x20] != 0) {
Msg("Globalname: %s\n",piVar1[0x20]);
}
}
break;
case 0x6b:
(**(code **)(*(int *)this + 0x234))(&local_f4,this);
EyeVectors(this,(Vector *)&local_e8,(Vector *)0x0,(Vector *)0x0);
local_bc = local_e8 * 1024.0;
local_b8 = local_e4 * 1024.0;
local_88 = 1;
local_b4 = local_e0 * 1024.0;
local_8c = 0;
local_94 = 0;
local_98 = 0;
local_9c = 0;
local_87 = local_b8 * local_b8 + local_bc * local_bc + local_b4 * local_b4 != 0.0;
local_a4 = 0;
local_a8 = 0;
local_ac = 0;
local_cc = local_f4;
local_c8 = local_f0;
local_c4 = local_ec;
CTraceFilterSimple::CTraceFilterSimple
(local_dc,(IHandleEntity *)this,0,(_func_bool_IHandleEntity_ptr_int *)0x0);
(**(code **)(*enginetrace + 0x14))(enginetrace,&local_cc,0x400b,local_dc,(Vector *)&local_70);
if (*(int *)(r_visualizetraces._28_4_ + 0x30) != 0) {
DebugDrawLine((Vector *)&local_70,local_64,0xff,0,0,true,-1.0);
}
if (local_34 != 0) {
Msg("Texture: %s\n",local_34);
}
break;
case 0x6c:
Warning("BaseNPCs do not exist in Left4Dead.\n");
break;
case 0xc3:
CBaseEntity::Create("node_viewer_fly",(Vector *)(this + 0x39c),(QAngle *)(this + 0x3a8),
(CBaseEntity *)0x0);
break;
case 0xc4:
CBaseEntity::Create("node_viewer_large",(Vector *)(this + 0x39c),(QAngle *)(this + 0x3a8),
(CBaseEntity *)0x0);
break;
case 0xc5:
CBaseEntity::Create("node_viewer_human",(Vector *)(this + 0x39c),(QAngle *)(this + 0x3a8),
(CBaseEntity *)0x0);
break;
case 0xca:
EyeVectors(this,(Vector *)&local_100,(Vector *)0x0,(Vector *)0x0);
(**(code **)(*(int *)this + 0x234))(&local_e8,this);
(**(code **)(*(int *)this + 0x234))(&local_f4,this);
local_8c = 0;
local_88 = 1;
local_cc = local_f4;
local_bc = (local_100 * 128.0 - local_f4) + local_e8;
local_c8 = local_f0;
local_c4 = local_ec;
local_b4 = (local_f8 * 128.0 - local_ec) + local_e0;
local_b8 = (local_fc * 128.0 - local_f0) + local_e4;
local_94 = 0;
local_98 = 0;
local_9c = 0;
local_87 = local_bc * local_bc + local_b4 * local_b4 + local_b8 * local_b8 != 0.0;
local_a4 = 0;
local_a8 = 0;
local_ac = 0;
CTraceFilterSimple::CTraceFilterSimple
(local_dc,(IHandleEntity *)this,0,(_func_bool_IHandleEntity_ptr_int *)0x0);
pVVar5 = (Vector *)&local_cc;
(**(code **)(*enginetrace + 0x14))(enginetrace,pVVar5,0x400b,local_dc,(Vector *)&local_70);
if (*(int *)(r_visualizetraces._28_4_ + 0x30) != 0) {
pVVar5 = local_64;
DebugDrawLine((Vector *)&local_70,pVVar5,0xff,0,0,true,-1.0);
}
if (local_44 != 1.0) {
pCVar3 = CBaseEntity::operator_new((CBaseEntity *)0x440,(uint)pVVar5);
/* try { // try from 007b197a to 007b197e has its CatchHandler @ 007b1a78 */
CBaseEntity::CBaseEntity(pCVar3,false);
*(undefined ***)pCVar3 = &PTR__CBloodSplat_00cbae28;
CBaseEntity::PostConstructor(pCVar3,"bloodsplat");
CBloodSplat::Spawn((CBloodSplat *)pCVar3,(CBaseEntity *)this);
}
break;
case 0xcb:
pCVar3 = (CBaseEntity *)FindEntityForward(this,true);
if (pCVar3 != (CBaseEntity *)0x0) {
UTIL_Remove(pCVar3);
}
}
}
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.