CTerrorPlayerAnimState::Update
0x00516a70 · 3099 bytes · __thiscall
_ZN22CTerrorPlayerAnimState6UpdateEff
Decompiled
undefined (3 params)
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* CTerrorPlayerAnimState::Update(float, float) */
void __thiscall
CTerrorPlayerAnimState::Update(CTerrorPlayerAnimState *this,float param_1,float param_2)
{
CBaseEntity *pCVar1;
CBaseEdict *this_00;
uint uVar2;
CBaseAnimating *pCVar3;
code *pcVar4;
char cVar5;
char cVar6;
undefined4 uVar7;
int iVar8;
CStudioHdr *pCVar9;
char *pcVar10;
int iVar11;
undefined *puVar12;
CBaseEntity *pCVar13;
CStudioHdr *pCVar14;
CTerrorPlayer *this_01;
int iVar15;
bool bVar16;
longdouble lVar17;
float fVar18;
float fVar19;
float local_58;
float local_50;
undefined4 local_4c;
undefined4 local_48;
undefined4 local_40;
undefined4 local_3c;
int local_38;
float local_34;
float local_30;
float local_2c;
float local_28;
float local_24;
float local_20;
local_4c = 0;
local_48 = 0;
if (___atan2f_finite == 0) {
local_38 = 0;
}
else {
(**(code **)(___atan2f_finite + 0x50))
(___atan2f_finite,&local_4c,0,0,0,0,
"/data/src/game/server/../../game/shared/terror/terrorplayeranimstate.cpp",0xa1,
&Update(float,float)::tm_fmt,"(%s)%s","Unaccounted","CMultiPlayerAnimState::Update");
local_38 = ___atan2f_finite;
}
iVar15 = _DAT_0105db00;
local_40 = local_4c;
local_3c = local_48;
/* try { // try from 00516e66 to 00516eb4 has its CatchHandler @ 0051771b */
if (((_DAT_0105d154 != 0) || (DAT_0105d158 == '\0')) &&
(iVar8 = ThreadGetCurrentId(), iVar15 == iVar8)) {
if ((char *)*_DAT_0105d15c != "CMultiPlayerAnimState::Update") {
_DAT_0105d15c =
(int *)CVProfNode::GetSubNode((char *)_DAT_0105d15c,0xc168a1,(char *)0x1,0xbfafa1);
}
CVProfNode::EnterScope();
DAT_0105d158 = '\0';
}
pCVar1 = *(CBaseEntity **)(this + 0x118);
pCVar9 = *(CStudioHdr **)(pCVar1 + 0x13e0);
if (pCVar9 == (CStudioHdr *)0x0) {
iVar15 = CBaseEntity::GetModel(pCVar1);
if (iVar15 != 0) {
CBaseAnimating::LockStudioHdr((CBaseAnimating *)pCVar1);
}
pCVar9 = *(CStudioHdr **)(pCVar1 + 0x13e0);
if (pCVar9 == (CStudioHdr *)0x0) goto LAB_00516ecf;
}
if (*(int *)pCVar9 == 0) {
LAB_00516ecf:
iVar15 = _DAT_0105db00;
if (((DAT_0105d158 == '\0') || (_DAT_0105d154 != 0)) &&
(iVar8 = ThreadGetCurrentId(), iVar15 == iVar8)) {
cVar5 = CVProfNode::ExitScope();
if (cVar5 != '\0') {
_DAT_0105d15c = (int *)_DAT_0105d15c[0x19];
}
DAT_0105d158 = _DAT_0105d15c == (int *)0x105d160;
}
if (local_38 != 0) {
(**(code **)(local_38 + 0x54))(local_38,local_40,local_3c,0,0,0);
}
return;
}
if (*(int *)(*(int *)(this + 0x118) + 0x30) == 0) {
iVar15 = 0;
}
else {
iVar15 = *(int *)(*(int *)(this + 0x118) + 0x30) - *(int *)(gpGlobals + 0x58) >> 4;
}
if (iVar15 == *(int *)(anim_showstate._28_4_ + 0x30)) {
DebugShowAnimState(this,iVar15,pCVar9,true);
}
/* try { // try from 00516b71 to 00516db9 has its CatchHandler @ 00517730 */
cVar5 = CMultiPlayerAnimState::ShouldUpdateAnimState((CMultiPlayerAnimState *)this);
if (cVar5 == '\0') {
/* try { // try from 00516ecd to 00516ece has its CatchHandler @ 00517730 */
(*(code *)**(undefined4 **)this)(this);
goto LAB_00516ecf;
}
cVar5 = ShouldLockEyeYaw(this);
if (cVar5 == '\0') {
lVar17 = (longdouble)AngleNormalize(param_1);
if ((float)lVar17 != *(float *)(this + 0xe4)) {
*(undefined4 *)(this + 0x134) = *(undefined4 *)(gpGlobals + 0xc);
}
*(float *)(this + 0xe4) = (float)lVar17;
lVar17 = (longdouble)AngleNormalize(param_2);
*(float *)(this + 0xe8) = (float)lVar17;
}
(**(code **)(*(int *)this + 0x70))(this,pCVar9);
UpdateFidgeting(this);
cVar5 = CMultiPlayerAnimState::SetupPoseParameters((CMultiPlayerAnimState *)this,pCVar9);
if (cVar5 != '\0') {
(**(code **)(*(int *)this + 0x60))(this,pCVar9);
(**(code **)(*(int *)this + 100))(this,pCVar9);
(**(code **)(*(int *)this + 0x5c))(this,pCVar9);
}
uVar7 = CMultiPlayerAnimState::GetMainActivity((CMultiPlayerAnimState *)this);
cVar5 = CTerrorPlayer::IsMotionControlledXY(*(CTerrorPlayer **)(this + 0x118),uVar7);
if (cVar5 != '\0') {
CBaseEntity::SetMoveType(*(CBaseEntity **)(this + 0x118),0xb,0);
}
uVar7 = CMultiPlayerAnimState::GetMainActivity((CMultiPlayerAnimState *)this);
cVar5 = CTerrorPlayer::IsMotionControlledZ(*(CTerrorPlayer **)(this + 0x118),uVar7);
uVar7 = CMultiPlayerAnimState::GetMainActivity((CMultiPlayerAnimState *)this);
cVar6 = CTerrorPlayer::IsMotionControlledXY(*(CTerrorPlayer **)(this + 0x118),uVar7);
if ((cVar6 == '\0') && (cVar5 == '\0')) {
LAB_00516ca2:
(**(code **)(*(int *)this + 0x7c))(this);
*(undefined4 *)(this + 0x11c) = 0;
iVar8 = *(int *)(this + 0x118);
}
else {
fVar19 = *(float *)(*(int *)(this + 0x118) + 0x490);
iVar8 = *(int *)(*(int *)(this + 0x118) + 0x494);
/* try { // try from 00516f97 to 0051758b has its CatchHandler @ 00517730 */
if ((fVar19 < *(float *)(this + 0x11c)) ||
((iVar8 < 0 || (iVar11 = CStudioHdr::GetNumSeq(pCVar9), iVar11 <= iVar8))))
goto LAB_00516ca2;
local_34 = vec3_origin;
local_30 = DAT_01053d4c;
local_2c = DAT_01053d50;
local_28 = vec3_angle;
local_24 = DAT_01053d40;
local_20 = DAT_01053d44;
CBaseAnimating::GetSequenceMovement
(*(CBaseAnimating **)(this + 0x118),iVar8,*(float *)(this + 0x11c),fVar19,
(Vector *)&local_34,(QAngle *)&local_28);
iVar8 = *(int *)(this + 0x118);
if ((&DAT_000039f1)[iVar8] == '\0') {
VectorYawRotate((Vector *)&local_34,*(float *)(this + 0xe4),(Vector *)&local_34);
iVar8 = *(int *)(this + 0x118);
}
*(float *)(this + 0x11c) = fVar19;
*(float *)(this + 0x120) = *(float *)(this + 0x120) + local_34;
*(float *)(this + 0x124) = *(float *)(this + 0x124) + local_30;
*(float *)(this + 0x128) = *(float *)(this + 0x128) + local_2c;
}
if ((iVar8 == 0) || (*(char *)(iVar8 + 0x186) != '\t')) {
cVar5 = CMultiPlayerAnimState::IsGestureSlotPlaying((CMultiPlayerAnimState *)this,3,0x2cc);
if (cVar5 != '\0') {
/* try { // try from 005175e3 to 00517702 has its CatchHandler @ 00517730 */
CMultiPlayerAnimState::StopGesture((CMultiPlayerAnimState *)this,3,0.0);
}
local_50 = 1.0;
}
else {
CMultiPlayerAnimState::GetOuterAbsVelocity((CMultiPlayerAnimState *)this,(Vector *)&local_28);
lVar17 = (longdouble)CalculateLadderDismount(this);
iVar8 = *(int *)(this + 0x50);
if (-1 < iVar8) {
pCVar1 = *(CBaseEntity **)(this + 0x118);
pCVar9 = *(CStudioHdr **)(pCVar1 + 0x13e0);
if (pCVar9 == (CStudioHdr *)0x0) {
iVar11 = CBaseEntity::GetModel(pCVar1);
if (iVar11 != 0) {
CBaseAnimating::LockStudioHdr((CBaseAnimating *)pCVar1);
}
pCVar9 = *(CStudioHdr **)(pCVar1 + 0x13e0);
pCVar14 = (CStudioHdr *)0x0;
if (pCVar9 != (CStudioHdr *)0x0) goto LAB_005174e8;
}
else {
LAB_005174e8:
pCVar14 = (CStudioHdr *)0x0;
if (*(int *)pCVar9 != 0) {
pCVar14 = pCVar9;
}
}
CBaseAnimating::SetPoseParameter((CBaseAnimating *)pCVar1,pCVar14,iVar8,(float)lVar17);
}
local_50 = ABS(local_20) * 0.01;
iVar8 = CBaseEntity::GetTeamNumber(*(CBaseEntity **)(this + 0x118));
cVar5 = IsASurvivorTeam(iVar8);
if ((cVar5 != '\0') &&
(cVar5 = CMultiPlayerAnimState::IsGestureSlotPlaying((CMultiPlayerAnimState *)this,3,0x2cc),
cVar5 == '\0')) {
CMultiPlayerAnimState::StartGesture((CMultiPlayerAnimState *)this,3,0x2cc,1);
}
}
this_01 = *(CTerrorPlayer **)(this + 0x118);
if (this_01[0x33bc] != (CTerrorPlayer)0x0) {
lVar17 = (longdouble)CTerrorPlayer::GetTimeSinceLastFiredWeapon(this_01);
if ((float)lVar17 < 0.3) {
local_50 = *(float *)(MinigunFireAnimSpeed._28_4_ + 0x2c);
}
this_01 = *(CTerrorPlayer **)(this + 0x118);
}
if (local_50 != *(float *)(this_01 + 0x468)) {
if (this_01[0x6c] == (CTerrorPlayer)0x0) {
this_00 = *(CBaseEdict **)(this_01 + 0x30);
if (this_00 != (CBaseEdict *)0x0) {
*(uint *)this_00 = *(uint *)this_00 | 0x101;
iVar8 = CBaseEdict::GetChangeAccessor(this_00);
*(undefined2 *)(iVar8 + 2) = 0;
}
}
else {
this_01[0x70] = (CTerrorPlayer)((byte)this_01[0x70] | 1);
}
*(float *)(this_01 + 0x468) = local_50;
}
iVar8 = CMultiPlayerAnimState::GetMainActivity((CMultiPlayerAnimState *)this);
if (((iVar8 == 0x2eb) ||
(iVar8 = CMultiPlayerAnimState::GetMainActivity((CMultiPlayerAnimState *)this), iVar8 == 0x2ec
)) || (iVar8 = CMultiPlayerAnimState::GetMainActivity((CMultiPlayerAnimState *)this),
iVar8 == 0x20d)) {
CMultiPlayerAnimState::GetOuterAbsVelocity((CMultiPlayerAnimState *)this,(Vector *)&local_28);
fVar18 = SQRT(local_24 * local_24 + local_28 * local_28);
fVar19 = 10.0;
if (10.0 <= fVar18) {
fVar19 = fVar18;
}
if (600.0 <= fVar19) {
fVar19 = 600.0;
}
fVar18 = (fVar19 + -10.0) * -0.6779661 + 750.0;
if (-fVar18 == fVar18) {
if (local_20 < -fVar18) {
local_58 = 1.0;
}
else {
local_58 = 0.0;
}
}
else {
local_58 = 1.0 - (local_20 + fVar18) / (fVar18 + fVar18);
}
fVar18 = 0.0;
if (0.0 <= fVar19) {
fVar18 = fVar19;
}
iVar8 = *(int *)(this + 0x58);
pCVar3 = *(CBaseAnimating **)(this + 0x118);
fVar19 = 600.0;
if (fVar18 <= 600.0) {
fVar19 = fVar18;
}
pCVar9 = *(CStudioHdr **)(pCVar3 + 0x13e0);
if (pCVar9 == (CStudioHdr *)0x0) {
iVar11 = CBaseEntity::GetModel((CBaseEntity *)pCVar3);
if (iVar11 != 0) {
CBaseAnimating::LockStudioHdr(pCVar3);
}
pCVar9 = *(CStudioHdr **)(pCVar3 + 0x13e0);
pCVar14 = (CStudioHdr *)0x0;
if (pCVar9 != (CStudioHdr *)0x0) goto LAB_00517147;
}
else {
LAB_00517147:
pCVar14 = (CStudioHdr *)0x0;
if (*(int *)pCVar9 != 0) {
pCVar14 = pCVar9;
}
}
CBaseAnimating::SetPoseParameter(pCVar3,pCVar14,iVar8,local_58);
iVar8 = *(int *)(this + 0x5c);
pCVar3 = *(CBaseAnimating **)(this + 0x118);
pCVar9 = *(CStudioHdr **)(pCVar3 + 0x13e0);
if (pCVar9 == (CStudioHdr *)0x0) {
iVar11 = CBaseEntity::GetModel((CBaseEntity *)pCVar3);
if (iVar11 != 0) {
CBaseAnimating::LockStudioHdr(pCVar3);
}
pCVar9 = *(CStudioHdr **)(pCVar3 + 0x13e0);
pCVar14 = (CStudioHdr *)0x0;
if (pCVar9 != (CStudioHdr *)0x0) goto LAB_0051718a;
}
else {
LAB_0051718a:
pCVar14 = (CStudioHdr *)0x0;
if (*(int *)pCVar9 != 0) {
pCVar14 = pCVar9;
}
}
CBaseAnimating::SetPoseParameter(pCVar3,pCVar14,iVar8,fVar19 * 0.002);
}
iVar8 = CMultiPlayerAnimState::GetMainActivity((CMultiPlayerAnimState *)this);
if ((iVar8 != 0x30b) &&
(iVar8 = CMultiPlayerAnimState::GetMainActivity((CMultiPlayerAnimState *)this), iVar8 != 0x307)
) goto LAB_00516daa;
pCVar1 = *(CBaseEntity **)(this + 0x118);
uVar2 = *(uint *)(pCVar1 + 0x33c4);
if ((((uVar2 == 0xffffffff) ||
((puVar12 = g_pEntityList + (uVar2 & 0xfff) * 0x10, puVar12 == (undefined *)0xfffffffc ||
(*(uint *)(puVar12 + 8) != uVar2 >> 0xc)))) || (*(int *)(puVar12 + 4) == 0)) ||
(*(int *)(this + 0x54) < 0)) goto LAB_00516daa;
pCVar13 = pCVar1;
if (((byte)pCVar1[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition(pCVar1);
pCVar13 = *(CBaseEntity **)(this + 0x118);
}
uVar7 = 0;
CTerrorPlayer::GetTongueDestination((CTerrorPlayer *)&local_28,SUB41(pCVar13,0));
local_34 = local_28 - *(float *)(pCVar1 + 0x2e0);
local_30 = local_24 - *(float *)(pCVar1 + 0x2e4);
local_2c = local_20 - *(float *)(pCVar1 + 0x2e8);
iVar8 = (**(code **)(*g_pGameRules + 0x7c))(g_pGameRules,pCVar13,uVar7);
local_2c = *(float *)(iVar8 + 8) * 0.5 + local_2c;
VectorNormalize((Vector *)&local_34);
CMultiPlayerAnimState::GetMainActivity((CMultiPlayerAnimState *)this);
fVar19 = local_2c;
iVar8 = *(int *)(this + 0x54);
pCVar3 = *(CBaseAnimating **)(this + 0x118);
pCVar9 = *(CStudioHdr **)(pCVar3 + 0x13e0);
if (pCVar9 == (CStudioHdr *)0x0) {
iVar11 = CBaseEntity::GetModel((CBaseEntity *)pCVar3);
if (iVar11 != 0) {
CBaseAnimating::LockStudioHdr(pCVar3);
}
pCVar9 = *(CStudioHdr **)(pCVar3 + 0x13e0);
pCVar14 = (CStudioHdr *)0x0;
if (pCVar9 != (CStudioHdr *)0x0) goto LAB_0051735d;
}
else {
LAB_0051735d:
pCVar14 = (CStudioHdr *)0x0;
if (*(int *)pCVar9 != 0) {
pCVar14 = pCVar9;
}
}
CBaseAnimating::SetPoseParameter(pCVar3,pCVar14,iVar8,fVar19);
LAB_00516daa:
cVar5 = CMultiPlayerAnimState::IsGestureSlotActive((CMultiPlayerAnimState *)this,0);
uVar7 = 0x3f800000;
if (cVar5 != '\0') {
uVar7 = 0x40a00000;
}
bVar16 = g_bDumpStateOnNextFrame != '\0';
*(undefined4 *)(this + 0x148) = uVar7;
if (bVar16) {
ForEachTerrorPlayer<DumpAnimState>((DumpAnimState *)&local_34);
g_bDumpStateOnNextFrame = '\0';
}
if (iVar15 == *(int *)(mp_showgestureslots._28_4_ + 0x30)) {
CMultiPlayerAnimState::DebugGestureInfo((CMultiPlayerAnimState *)this);
(**(code **)(*engine + 0xbc))(engine,0x22,"%s","SERVER");
iVar15 = 0;
do {
iVar8 = *(int *)(this + 0x118);
pcVar4 = *(code **)(*engine + 0xbc);
iVar11 = *(int *)(iVar8 + 0x2ae8 + iVar15 * 4);
if (iVar11 == -1) {
pcVar10 = "INVALID";
}
else {
pcVar10 = (char *)ActivityList_NameForIndex(iVar11);
iVar8 = *(int *)(this + 0x118);
}
(*pcVar4)(engine,iVar15 + 0x23,"NetGesture %d : (%1.3f) %s",iVar15,
(double)*(float *)(iVar8 + 0x2b04 + iVar15 * 4),pcVar10);
iVar15 = iVar15 + 1;
} while (iVar15 != 7);
}
iVar15 = _DAT_0105db00;
if (((DAT_0105d158 == '\0') || (_DAT_0105d154 != 0)) &&
(iVar8 = ThreadGetCurrentId(), iVar15 == iVar8)) {
cVar5 = CVProfNode::ExitScope();
if (cVar5 != '\0') {
_DAT_0105d15c = (int *)_DAT_0105d15c[0x19];
}
DAT_0105d158 = _DAT_0105d15c == (int *)0x105d160;
}
if (local_38 == 0) {
return;
}
(**(code **)(local_38 + 0x54))(local_38,local_40,local_3c,0,0,0);
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.