CPointCommentaryNode::UpdateViewThink
0x00648a10 · 2615 bytes · __thiscall
_ZN20CPointCommentaryNode15UpdateViewThinkEv
Decompiled
undefined (1 param)
/* CPointCommentaryNode::UpdateViewThink() */
void __thiscall CPointCommentaryNode::UpdateViewThink(CPointCommentaryNode *this)
{
code *pcVar1;
int iVar2;
CBasePlayer *this_00;
int *piVar3;
undefined4 *puVar4;
float fVar5;
uint uVar6;
QAngle *pQVar7;
float *pfVar8;
float *pfVar9;
uint uVar10;
CBaseEntity *pCVar11;
undefined *puVar12;
undefined4 uVar13;
int iVar14;
int *piVar15;
longdouble lVar16;
longdouble lVar17;
longdouble lVar18;
float afStackY_7c [3];
float *local_54;
undefined4 local_4c;
undefined4 local_48;
float local_40;
float local_3c;
float local_38;
float local_34;
float local_30;
float local_2c;
float local_28;
float local_24;
float local_20;
piVar3 = (int *)&stack0xffffff94;
if (this[0x1488] == (CPointCommentaryNode)0x0) {
return;
}
this_00 = (CBasePlayer *)GetCommentaryPlayer();
if (this_00 == (CBasePlayer *)0x0) {
return;
}
uVar6 = *(uint *)(this + 0x1408);
pfVar8 = (float *)&stack0xffffff94;
if ((((uVar6 == 0xffffffff) ||
(puVar12 = g_pEntityList + (uVar6 & 0xfff) * 0x10, pfVar8 = (float *)&stack0xffffff94,
puVar12 == (undefined *)0xfffffffc)) ||
(pfVar8 = (float *)&stack0xffffff94, *(uint *)(puVar12 + 8) != uVar6 >> 0xc)) ||
(pfVar8 = (float *)&stack0xffffff94, *(int *)(puVar12 + 4) == 0)) goto LAB_00648a6e;
uVar6 = *(uint *)(this + 0x140c);
if (((uVar6 == 0xffffffff) ||
(puVar12 = g_pEntityList + (uVar6 & 0xfff) * 0x10, puVar12 == (undefined *)0xfffffffc)) ||
((*(uint *)(puVar12 + 8) != uVar6 >> 0xc || (*(int *)(puVar12 + 4) == 0)))) {
uVar6 = *(uint *)(this + 0x1418);
if (uVar6 == 0xffffffff) {
LAB_00648d53:
piVar3 = (int *)CreateEntityByName("point_commentary_viewpoint",-1,true);
if (piVar3 == (int *)0x0) {
*(undefined4 *)(this + 0x140c) = 0xffffffff;
}
else {
puVar4 = (undefined4 *)(**(code **)(*piVar3 + 0xc))();
*(undefined4 *)(this + 0x140c) = *puVar4;
}
(**(code **)(*(int *)this_00 + 0x234))();
uVar6 = *(uint *)(this + 0x140c);
pCVar11 = (CBaseEntity *)0x0;
piVar3 = (int *)&stack0xffffff90;
if (((uVar6 != 0xffffffff) &&
(puVar12 = g_pEntityList + (uVar6 & 0xfff) * 0x10, puVar12 != (undefined *)0xfffffffc)) &&
(*(uint *)(puVar12 + 8) == uVar6 >> 0xc)) {
pCVar11 = *(CBaseEntity **)(puVar12 + 4);
}
CBaseEntity::SetAbsOrigin(pCVar11,(Vector *)&local_28);
pCVar11 = (CBaseEntity *)0x0;
pQVar7 = (QAngle *)(**(code **)(*(int *)this_00 + 0x238))();
uVar6 = *(uint *)(this + 0x140c);
if (((uVar6 != 0xffffffff) &&
(puVar12 = g_pEntityList + (uVar6 & 0xfff) * 0x10, puVar12 != (undefined *)0xfffffffc)) &&
(*(uint *)(puVar12 + 8) == uVar6 >> 0xc)) {
pCVar11 = *(CBaseEntity **)(puVar12 + 4);
}
CBaseEntity::SetAbsAngles(pCVar11,pQVar7);
uVar6 = *(uint *)(this + 0x140c);
pCVar11 = (CBaseEntity *)0x0;
if (((uVar6 != 0xffffffff) &&
(puVar12 = g_pEntityList + (uVar6 & 0xfff) * 0x10, puVar12 != (undefined *)0xfffffffc)) &&
(*(uint *)(puVar12 + 8) == uVar6 >> 0xc)) {
pCVar11 = *(CBaseEntity **)(puVar12 + 4);
}
CBasePlayer::SetViewEntity(this_00,pCVar11);
goto LAB_00648e7a;
}
uVar10 = uVar6 & 0xfff;
piVar15 = (int *)(g_pEntityList + uVar10 * 0x10 + 4);
if (((piVar15 == (int *)0x0) || (*(uint *)(g_pEntityList + uVar10 * 0x10 + 8) != uVar6 >> 0xc))
|| (pfVar8 = (float *)&stack0xffffff94, *(int *)(g_pEntityList + uVar10 * 0x10 + 4) == 0))
goto LAB_00648d53;
LAB_00649053:
iVar14 = *piVar15;
piVar3 = (int *)pfVar8;
if (iVar14 == 0) goto LAB_00648eb0;
if ((*(byte *)(iVar14 + 0x14d) & 8) != 0) {
*pfVar8 = (float)iVar14;
pfVar8[-1] = 9.235361e-39;
CBaseEntity::CalcAbsolutePosition((CBaseEntity *)*pfVar8);
uVar6 = *(uint *)(this + 0x1418);
}
local_40 = *(float *)(iVar14 + 0x37c);
local_3c = *(float *)(iVar14 + 0x380);
local_38 = *(float *)(iVar14 + 900);
iVar14 = 0;
if (((uVar6 != 0xffffffff) &&
(puVar12 = g_pEntityList + (uVar6 & 0xfff) * 0x10, puVar12 != (undefined *)0xfffffffc)) &&
(*(uint *)(puVar12 + 8) == uVar6 >> 0xc)) {
iVar14 = *(int *)(puVar12 + 4);
}
if ((*(byte *)(iVar14 + 0x14d) & 8) != 0) {
*pfVar8 = (float)iVar14;
pfVar8[-1] = 9.236115e-39;
CBaseEntity::CalcAbsolutePosition((CBaseEntity *)*pfVar8);
}
uVar6 = *(uint *)(this + 0x1408);
piVar3 = (int *)0x0;
if (((uVar6 != 0xffffffff) &&
(puVar12 = g_pEntityList + (uVar6 & 0xfff) * 0x10, puVar12 != (undefined *)0xfffffffc)) &&
(*(uint *)(puVar12 + 8) == uVar6 >> 0xc)) {
piVar3 = *(int **)(puVar12 + 4);
}
iVar2 = *piVar3;
*pfVar8 = (float)piVar3;
pcVar1 = *(code **)(iVar2 + 0x288);
pfVar8[-1] = 9.235583e-39;
pfVar9 = (float *)(*pcVar1)();
LAB_0064910c:
local_54 = &local_28;
local_28 = *pfVar9 - *(float *)(iVar14 + 0x2e0);
local_24 = pfVar9[1] - *(float *)(iVar14 + 0x2e4);
local_20 = pfVar9[2] - *(float *)(iVar14 + 0x2e8);
pfVar8[1] = (float)&local_4c;
*pfVar8 = (float)local_54;
pfVar8[-1] = 9.235682e-39;
VectorAngles((Vector *)*pfVar8,(QAngle *)pfVar8[1]);
}
else {
LAB_00648e7a:
uVar6 = *(uint *)(this + 0x1418);
if (((uVar6 != 0xffffffff) &&
(piVar15 = (int *)(g_pEntityList + (uVar6 & 0xfff) * 0x10 + 4), piVar15 != (int *)0x0)) &&
(pfVar8 = (float *)piVar3, piVar15[1] == uVar6 >> 0xc)) goto LAB_00649053;
LAB_00648eb0:
local_54 = &local_28;
uVar6 = *(uint *)(this + 0x140c);
if ((((uVar6 != 0xffffffff) &&
(puVar12 = g_pEntityList + (uVar6 & 0xfff) * 0x10, puVar12 != (undefined *)0xfffffffc)) &&
(*(uint *)(puVar12 + 8) == uVar6 >> 0xc)) && (iVar14 = *(int *)(puVar12 + 4), iVar14 != 0))
{
if ((*(byte *)(iVar14 + 0x14d) & 8) != 0) {
*piVar3 = iVar14;
piVar3[-1] = 0x6493b9;
CBaseEntity::CalcAbsolutePosition((CBaseEntity *)*piVar3);
}
local_40 = *(float *)(iVar14 + 0x37c);
local_3c = *(float *)(iVar14 + 0x380);
local_38 = *(float *)(iVar14 + 900);
iVar14 = *(int *)this_00;
piVar3[1] = (int)this_00;
*piVar3 = (int)local_54;
pcVar1 = *(code **)(iVar14 + 0x234);
piVar3[-1] = 0x6493f5;
(*pcVar1)();
uVar6 = *(uint *)(this + 0x140c);
uVar13 = 0;
pfVar8 = (float *)(piVar3 + -1);
if (((uVar6 != 0xffffffff) &&
(puVar12 = g_pEntityList + (uVar6 & 0xfff) * 0x10, puVar12 != (undefined *)0xfffffffc)) &&
(*(uint *)(puVar12 + 8) == uVar6 >> 0xc)) {
uVar13 = *(undefined4 *)(puVar12 + 4);
}
piVar3[-1] = uVar13;
iVar14 = 0;
*piVar3 = (int)local_54;
piVar3[-2] = 0x64943c;
CBaseEntity::SetAbsOrigin((CBaseEntity *)piVar3[-1],(Vector *)*piVar3);
uVar6 = *(uint *)(this + 0x140c);
if (((uVar6 != 0xffffffff) &&
(puVar12 = g_pEntityList + (uVar6 & 0xfff) * 0x10, puVar12 != (undefined *)0xfffffffc)) &&
(*(uint *)(puVar12 + 8) == uVar6 >> 0xc)) {
iVar14 = *(int *)(puVar12 + 4);
}
if ((*(byte *)(iVar14 + 0x14d) & 8) != 0) {
piVar3[-1] = iVar14;
piVar3[-2] = 0x6494b8;
CBaseEntity::CalcAbsolutePosition((CBaseEntity *)piVar3[-1]);
}
uVar6 = *(uint *)(this + 0x1408);
piVar15 = (int *)0x0;
if (((uVar6 != 0xffffffff) &&
(puVar12 = g_pEntityList + (uVar6 & 0xfff) * 0x10, puVar12 != (undefined *)0xfffffffc)) &&
(*(uint *)(puVar12 + 8) == uVar6 >> 0xc)) {
piVar15 = *(int **)(puVar12 + 4);
}
iVar2 = *piVar15;
piVar3[-1] = (int)piVar15;
pcVar1 = *(code **)(iVar2 + 0x288);
piVar3[-2] = 0x6494a6;
pfVar9 = (float *)(*pcVar1)();
goto LAB_0064910c;
}
iVar14 = *(int *)this_00;
*piVar3 = (int)this_00;
pcVar1 = *(code **)(iVar14 + 0x238);
piVar3[-1] = 0x648ee9;
pfVar8 = (float *)(*pcVar1)();
local_40 = *pfVar8;
local_3c = pfVar8[1];
local_38 = pfVar8[2];
iVar14 = *(int *)this_00;
piVar3[1] = (int)this_00;
*piVar3 = (int)local_54;
pcVar1 = *(code **)(iVar14 + 0x234);
piVar3[-1] = 0x648f18;
(*pcVar1)();
uVar6 = *(uint *)(this + 0x1408);
piVar15 = (int *)0x0;
pfVar8 = (float *)(piVar3 + -1);
if (((uVar6 != 0xffffffff) &&
(puVar12 = g_pEntityList + (uVar6 & 0xfff) * 0x10, puVar12 != (undefined *)0xfffffffc)) &&
(*(uint *)(puVar12 + 8) == uVar6 >> 0xc)) {
piVar15 = *(int **)(puVar12 + 4);
}
iVar14 = *piVar15;
piVar3[-1] = (int)piVar15;
pcVar1 = *(code **)(iVar14 + 0x288);
piVar3[-2] = 0x648f59;
pfVar9 = (float *)(*pcVar1)();
local_34 = *pfVar9 - local_28;
local_30 = pfVar9[1] - local_24;
local_2c = pfVar9[2];
*piVar3 = (int)&local_4c;
local_2c = local_2c - local_20;
piVar3[-1] = (int)&local_34;
piVar3[-2] = 0x648f97;
VectorAngles((Vector *)piVar3[-1],(QAngle *)*piVar3);
}
pfVar8[1] = local_40;
*pfVar8 = (float)local_4c;
pfVar8[-1] = 9.235719e-39;
lVar16 = (longdouble)AngleDiff(*pfVar8,pfVar8[1]);
pfVar8[1] = local_3c;
*pfVar8 = (float)local_48;
pfVar8[-1] = 9.235759e-39;
lVar17 = (longdouble)AngleDiff(*pfVar8,pfVar8[1]);
*pfVar8 = *(float *)(gpGlobals + 0x10) * -2.3104906;
pfVar8[-1] = 9.235807e-39;
lVar18 = (longdouble)__expf_finite();
*pfVar8 = (1.0 - (float)lVar18) * (float)lVar16 + local_40;
pfVar8[-1] = 9.23588e-39;
lVar16 = (longdouble)AngleNormalize(*pfVar8);
local_40 = (float)lVar16;
*pfVar8 = (float)lVar17 * (1.0 - (float)lVar18) + local_3c;
pfVar8[-1] = 9.235925e-39;
lVar16 = (longdouble)AngleNormalize(*pfVar8);
uVar6 = *(uint *)(this + 0x1418);
local_3c = (float)lVar16;
if (((uVar6 == 0xffffffff) ||
(puVar12 = g_pEntityList + (uVar6 & 0xfff) * 0x10, puVar12 == (undefined *)0xfffffffc)) ||
((*(uint *)(puVar12 + 8) != uVar6 >> 0xc || (*(int *)(puVar12 + 4) == 0)))) {
uVar6 = *(uint *)(this + 0x140c);
if ((((uVar6 == 0xffffffff) ||
(puVar12 = g_pEntityList + (uVar6 & 0xfff) * 0x10, puVar12 == (undefined *)0xfffffffc)) ||
(*(uint *)(puVar12 + 8) != uVar6 >> 0xc)) || (*(int *)(puVar12 + 4) == 0)) {
pfVar8[1] = (float)&local_40;
*pfVar8 = (float)this_00;
pfVar8[-1] = 9.236091e-39;
CBasePlayer::SnapEyeAngles((CBasePlayer *)*pfVar8,(QAngle *)pfVar8[1]);
}
else {
*pfVar8 = (float)*(int *)(puVar12 + 4);
pfVar8[1] = (float)&local_40;
pfVar8[-1] = 9.236475e-39;
CBaseEntity::SetAbsAngles((CBaseEntity *)*pfVar8,(QAngle *)pfVar8[1]);
pfVar8[1] = (float)&local_40;
*pfVar8 = (float)this_00;
pfVar8[-1] = 9.236496e-39;
CBasePlayer::SnapEyeAngles((CBasePlayer *)*pfVar8,(QAngle *)pfVar8[1]);
}
}
else {
*pfVar8 = (float)*(int *)(puVar12 + 4);
pfVar8[1] = (float)&local_40;
pfVar8[-1] = 9.236168e-39;
CBaseEntity::SetAbsAngles((CBaseEntity *)*pfVar8,(QAngle *)pfVar8[1]);
}
pfVar8[2] = (float)"CommentaryUpdateViewThink";
fVar5 = *(float *)(gpGlobals + 0xc);
*pfVar8 = (float)this;
pfVar8[1] = fVar5;
pfVar8[-1] = 9.236213e-39;
CBaseEntity::SetNextThink((CBaseEntity *)*pfVar8,pfVar8[1],(char *)pfVar8[2]);
LAB_00648a6e:
uVar6 = *(uint *)(this + 0x1414);
if (((uVar6 != 0xffffffff) &&
(puVar12 = g_pEntityList + (uVar6 & 0xfff) * 0x10, puVar12 != (undefined *)0xfffffffc)) &&
((*(uint *)(puVar12 + 8) == uVar6 >> 0xc && (*(int *)(puVar12 + 4) != 0)))) {
uVar10 = *(uint *)(this + 0x1418);
if ((((uVar10 == 0xffffffff) ||
(puVar12 = g_pEntityList + (uVar10 & 0xfff) * 0x10, puVar12 == (undefined *)0xfffffffc)) ||
(*(uint *)(puVar12 + 8) != uVar10 >> 0xc)) || (*(int *)(puVar12 + 4) == 0)) {
pfVar8[2] = 1.4013e-45;
pfVar8[1] = -NAN;
*pfVar8 = (float)"point_commentary_viewpoint";
pfVar8[-1] = 9.233376e-39;
piVar3 = (int *)CreateEntityByName((char *)*pfVar8,(int)pfVar8[1],*(bool *)(pfVar8 + 2));
if (piVar3 == (int *)0x0) {
*(undefined4 *)(this + 0x1418) = 0xffffffff;
}
else {
iVar14 = *piVar3;
*pfVar8 = (float)piVar3;
pcVar1 = *(code **)(iVar14 + 0xc);
pfVar8[-1] = 9.233398e-39;
puVar4 = (undefined4 *)(*pcVar1)();
*(undefined4 *)(this + 0x1418) = *puVar4;
}
uVar13 = 0;
iVar14 = *(int *)this_00;
*pfVar8 = (float)this_00;
pcVar1 = *(code **)(iVar14 + 0x238);
pfVar8[-1] = 9.233432e-39;
fVar5 = (float)(*pcVar1)();
uVar6 = *(uint *)(this + 0x1418);
if (((uVar6 != 0xffffffff) &&
(puVar12 = g_pEntityList + (uVar6 & 0xfff) * 0x10, puVar12 != (undefined *)0xfffffffc)) &&
(*(uint *)(puVar12 + 8) == uVar6 >> 0xc)) {
uVar13 = *(undefined4 *)(puVar12 + 4);
}
pfVar8[1] = fVar5;
*pfVar8 = (float)uVar13;
pfVar8[-1] = 9.233517e-39;
CBaseEntity::SetAbsAngles((CBaseEntity *)*pfVar8,(QAngle *)pfVar8[1]);
uVar6 = *(uint *)(this + 0x1418);
fVar5 = 0.0;
if (((uVar6 != 0xffffffff) &&
(puVar12 = g_pEntityList + (uVar6 & 0xfff) * 0x10, puVar12 != (undefined *)0xfffffffc)) &&
(*(uint *)(puVar12 + 8) == uVar6 >> 0xc)) {
fVar5 = *(float *)(puVar12 + 4);
}
pfVar8[1] = fVar5;
*pfVar8 = (float)this_00;
pfVar8[-1] = 9.23361e-39;
CBasePlayer::SetViewEntity((CBasePlayer *)*pfVar8,(CBaseEntity *)pfVar8[1]);
uVar6 = *(uint *)(this + 0x1414);
}
fVar5 = (*(float *)(gpGlobals + 0xc) - *(float *)(this + 0x148c)) * 0.5;
if (fVar5 <= 1.0) {
if (fVar5 <= 0.0) {
fVar5 = 0.0;
}
}
else {
fVar5 = 1.0;
}
iVar14 = 0;
if (((uVar6 != 0xffffffff) &&
(puVar12 = g_pEntityList + (uVar6 & 0xfff) * 0x10, puVar12 != (undefined *)0xfffffffc)) &&
(*(uint *)(puVar12 + 8) == uVar6 >> 0xc)) {
iVar14 = *(int *)(puVar12 + 4);
}
if ((*(byte *)(iVar14 + 0x14d) & 8) != 0) {
*pfVar8 = (float)iVar14;
pfVar8[-1] = 9.235113e-39;
CBaseEntity::CalcAbsolutePosition((CBaseEntity *)*pfVar8);
}
iVar2 = *(int *)this_00;
pfVar8[1] = (float)this_00;
*pfVar8 = (float)&local_28;
pcVar1 = *(code **)(iVar2 + 0x234);
pfVar8[-1] = 9.233818e-39;
(*pcVar1)();
uVar13 = 0;
uVar6 = *(uint *)(this + 0x1418);
local_34 = (*(float *)(iVar14 + 0x2e0) - local_28) * fVar5 + local_28;
local_30 = (*(float *)(iVar14 + 0x2e4) - local_24) * fVar5 + local_24;
local_2c = (*(float *)(iVar14 + 0x2e8) - local_20) * fVar5 + local_20;
if (((uVar6 != 0xffffffff) &&
(puVar12 = g_pEntityList + (uVar6 & 0xfff) * 0x10, puVar12 != (undefined *)0xfffffffc)) &&
(*(uint *)(puVar12 + 8) == uVar6 >> 0xc)) {
uVar13 = *(undefined4 *)(puVar12 + 4);
}
pfVar8[-1] = (float)uVar13;
*pfVar8 = (float)&local_34;
pfVar8[-2] = 9.234048e-39;
CBaseEntity::SetAbsOrigin((CBaseEntity *)pfVar8[-1],(Vector *)*pfVar8);
pfVar8[1] = (float)"CommentaryUpdateViewThink";
uVar13 = *(undefined4 *)(gpGlobals + 0xc);
pfVar8[-1] = (float)this;
*pfVar8 = (float)uVar13;
pfVar8[-2] = 9.234093e-39;
CBaseEntity::SetNextThink((CBaseEntity *)pfVar8[-1],*pfVar8,(char *)pfVar8[1]);
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.