CBasePlayer::SetObserverTarget
0x007ab0f0 · 1110 bytes · __thiscall
_ZN11CBasePlayer17SetObserverTargetEP11CBaseEntity
Decompiled
undefined (2 params)
/* CBasePlayer::SetObserverTarget(CBaseEntity*) */
undefined4 __thiscall CBasePlayer::SetObserverTarget(CBasePlayer *this,CBaseEntity *param_1)
{
uint uVar1;
CBaseEdict *this_00;
code *pcVar2;
int *piVar3;
undefined4 uVar4;
int iVar5;
undefined4 *puVar6;
QAngle *pQVar7;
int iVar8;
undefined4 uVar9;
CBaseEntity *pCVar10;
undefined *puVar11;
float fVar12;
float fVar13;
float fVar14;
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;
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;
Vector local_70 [12];
Vector local_64 [84];
uVar4 = (**(code **)(*(int *)this + 0x664))(this,param_1);
if ((char)uVar4 != '\0') {
uVar1 = *(uint *)(this + 0x1d7c);
pCVar10 = (CBaseEntity *)0x0;
if (((uVar1 != 0xffffffff) &&
(puVar11 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar11 != (undefined *)0xfffffffc)) &&
(*(uint *)(puVar11 + 8) == uVar1 >> 0xc)) {
pCVar10 = *(CBaseEntity **)(puVar11 + 4);
}
if (param_1 != pCVar10) {
if (this[0x6c] == (CBasePlayer)0x0) {
this_00 = *(CBaseEdict **)(this + 0x30);
if (this_00 != (CBaseEdict *)0x0) {
*(uint *)this_00 = *(uint *)this_00 | 0x101;
iVar5 = CBaseEdict::GetChangeAccessor(this_00);
*(undefined2 *)(iVar5 + 2) = 0;
}
}
else {
this[0x70] = (CBasePlayer)((byte)this[0x70] | 1);
}
if (param_1 == (CBaseEntity *)0x0) {
*(undefined4 *)(this + 0x1d7c) = 0xffffffff;
}
else {
puVar6 = (undefined4 *)(**(code **)(*(int *)param_1 + 0xc))(param_1);
*(undefined4 *)(this + 0x1d7c) = *puVar6;
}
}
SetFOV(this,(CBaseEntity *)this,0,0.0,0);
if (*(int *)(this + 0x1d64) == 6) {
(**(code **)(*(int *)param_1 + 0x234))(&local_e8,param_1);
pQVar7 = (QAngle *)(**(code **)(*(int *)param_1 + 0x238))(param_1);
AngleVectors(pQVar7,(Vector *)&local_f4);
VectorNormalize((Vector *)&local_f4);
fVar14 = local_f4 * -64.0;
fVar12 = local_f0 * -64.0;
fVar13 = local_ec * -64.0;
iVar5 = (**(code **)(*g_pGameRules + 0x7c))(g_pGameRules);
iVar8 = (**(code **)(*g_pGameRules + 0x7c))(g_pGameRules);
piVar3 = mdlcache;
local_8c = 0;
local_87 = fVar12 * fVar12 + fVar14 * fVar14 + fVar13 * fVar13 != 0.0;
local_9c = (*(float *)(iVar5 + 0x30) - *(float *)(iVar8 + 0x24)) * 0.5;
local_98 = (*(float *)(iVar5 + 0x34) - *(float *)(iVar8 + 0x28)) * 0.5;
local_94 = (*(float *)(iVar5 + 0x38) - *(float *)(iVar8 + 0x2c)) * 0.5;
local_88 = local_98 * local_98 + local_9c * local_9c + local_94 * local_94 < 1e-06;
local_ac = (*(float *)(iVar5 + 0x30) + *(float *)(iVar8 + 0x24)) * 0.5;
local_a8 = (*(float *)(iVar5 + 0x34) + *(float *)(iVar8 + 0x28)) * 0.5;
local_a4 = (*(float *)(iVar5 + 0x38) + *(float *)(iVar8 + 0x2c)) * 0.5;
local_cc = local_e8 + local_ac;
local_c8 = local_e4 + local_a8;
local_c4 = local_e0 + local_a4;
local_ac = -local_ac;
local_a8 = -local_a8;
local_a4 = -local_a4;
local_bc = fVar14;
local_b8 = fVar12;
local_b4 = fVar13;
(**(code **)(*mdlcache + 0x68))(mdlcache);
/* try { // try from 007ab436 to 007ab4da has its CatchHandler @ 007ab55f */
uVar9 = (**(code **)(*(int *)this + 0x7a0))(this,0);
CTraceFilterSimple::CTraceFilterSimple
(local_dc,(IHandleEntity *)param_1,8,(_func_bool_IHandleEntity_ptr_int *)0x0);
(**(code **)(*enginetrace + 0x14))(enginetrace,&local_cc,uVar9,local_dc,local_70);
if (*(int *)(r_visualizetraces._28_4_ + 0x30) != 0) {
/* try { // try from 007ab555 to 007ab559 has its CatchHandler @ 007ab55f */
DebugDrawLine(local_70,local_64,0xff,0,0,true,-1.0);
}
pcVar2 = *(code **)(*(int *)this + 0x66c);
uVar9 = (**(code **)(*(int *)param_1 + 0x238))(param_1);
(*pcVar2)(this,local_64,uVar9);
(**(code **)(*piVar3 + 0x6c))(piVar3);
}
}
return uVar4;
}
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.