GetPlayerViewOffset
0x004f4500 · 592 bytes · __cdecl
_Z19GetPlayerViewOffsetP13CTerrorPlayerb
Decompiled
undefined (2 params)
/* GetPlayerViewOffset(CTerrorPlayer*, bool) */
undefined1 * GetPlayerViewOffset(CTerrorPlayer *param_1,bool param_2)
{
float fVar1;
float fVar2;
char cVar3;
undefined4 *puVar4;
int iVar5;
longdouble lVar6;
if ((GetPlayerViewOffset(CTerrorPlayer*,bool)::crouchedView == '\0') &&
(iVar5 = __cxa_guard_acquire(&GetPlayerViewOffset(CTerrorPlayer*,bool)::crouchedView),
iVar5 != 0)) {
__cxa_guard_release(&GetPlayerViewOffset(CTerrorPlayer*,bool)::crouchedView);
}
if ((GetPlayerViewOffset(CTerrorPlayer*,bool)::standingView == '\0') &&
(iVar5 = __cxa_guard_acquire(&GetPlayerViewOffset(CTerrorPlayer*,bool)::standingView),
iVar5 != 0)) {
__cxa_guard_release(&GetPlayerViewOffset(CTerrorPlayer*,bool)::standingView);
}
if (param_1[0x33bd] == (CTerrorPlayer)0x0) {
if ((param_2) && (cVar3 = (**(code **)(*(int *)param_1 + 0x7e8))(param_1), cVar3 == '\0')) {
puVar4 = (undefined4 *)(**(code **)(*(int *)param_1 + 0x250))(param_1);
GetPlayerViewOffset(CTerrorPlayer*,bool)::crouchedView._0_4_ = *puVar4;
GetPlayerViewOffset(CTerrorPlayer*,bool)::crouchedView._4_4_ = puVar4[1];
GetPlayerViewOffset(CTerrorPlayer*,bool)::crouchedView._8_4_ = puVar4[2];
iVar5 = (**(code **)(*g_pGameRules + 0x7c))(g_pGameRules);
GetPlayerViewOffset(CTerrorPlayer*,bool)::crouchedView._8_4_ = *(undefined4 *)(iVar5 + 0x44);
return GetPlayerViewOffset(CTerrorPlayer*,bool)::crouchedView;
}
puVar4 = (undefined4 *)(**(code **)(*(int *)param_1 + 0x250))(param_1);
GetPlayerViewOffset(CTerrorPlayer*,bool)::standingView._0_4_ = *puVar4;
GetPlayerViewOffset(CTerrorPlayer*,bool)::standingView._4_4_ = puVar4[1];
GetPlayerViewOffset(CTerrorPlayer*,bool)::standingView._8_4_ = puVar4[2];
cVar3 = (**(code **)(*(int *)param_1 + 0x7e8))(param_1);
if (((cVar3 == '\0') || (param_1[0x39f1] != (CTerrorPlayer)0x0)) ||
(param_1[0x33dc] != (CTerrorPlayer)0x0)) {
iVar5 = (**(code **)(*g_pGameRules + 0x7c))(g_pGameRules);
GetPlayerViewOffset(CTerrorPlayer*,bool)::standingView._8_4_ = *(undefined4 *)(iVar5 + 8);
return GetPlayerViewOffset(CTerrorPlayer*,bool)::standingView;
}
fVar1 = *(float *)(SurvivorIncapacitatedEyeHeight._28_4_ + 0x2c);
iVar5 = (**(code **)(*g_pGameRules + 0x7c))(g_pGameRules);
fVar2 = *(float *)(iVar5 + 0x44);
lVar6 = (longdouble)CTerrorPlayer::GetProgressBarPercent(param_1);
GetPlayerViewOffset(CTerrorPlayer*,bool)::standingView._8_4_ =
(1.0 - (float)lVar6) * fVar1 + (float)lVar6 * fVar2;
}
else {
if (param_2) {
puVar4 = (undefined4 *)(**(code **)(*(int *)param_1 + 0x250))(param_1);
GetPlayerViewOffset(CTerrorPlayer*,bool)::crouchedView._0_4_ = *puVar4;
GetPlayerViewOffset(CTerrorPlayer*,bool)::crouchedView._4_4_ = puVar4[1];
GetPlayerViewOffset(CTerrorPlayer*,bool)::crouchedView._8_4_ = puVar4[2];
return GetPlayerViewOffset(CTerrorPlayer*,bool)::crouchedView;
}
puVar4 = (undefined4 *)(**(code **)(*(int *)param_1 + 0x250))();
GetPlayerViewOffset(CTerrorPlayer*,bool)::standingView._0_4_ = *puVar4;
GetPlayerViewOffset(CTerrorPlayer*,bool)::standingView._4_4_ = puVar4[1];
GetPlayerViewOffset(CTerrorPlayer*,bool)::standingView._8_4_ = puVar4[2];
}
return GetPlayerViewOffset(CTerrorPlayer*,bool)::standingView;
}
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.