CBasePlayer::SetAnimation
0x007ac070 · 979 bytes · __thiscall
_ZN11CBasePlayer12SetAnimationE11PLAYER_ANIM
Decompiled
undefined (2 params)
/* CBasePlayer::SetAnimation(PLAYER_ANIM) */
void __thiscall CBasePlayer::SetAnimation(CBasePlayer *this,uint param_2)
{
CBaseEdict *pCVar1;
char cVar2;
int iVar3;
int iVar4;
uint uVar5;
int in_GS_OFFSET;
float fVar6;
char local_50 [64];
int local_10;
local_10 = *(int *)(in_GS_OFFSET + 0x14);
if (((byte)this[0x14d] & 0x10) != 0) {
CBaseEntity::CalcAbsoluteVelocity((CBaseEntity *)this);
}
uVar5 = *(uint *)(this + 0x150);
fVar6 = SQRT(*(float *)(this + 0x274) * *(float *)(this + 0x274) +
*(float *)(this + 0x278) * *(float *)(this + 0x278));
if ((uVar5 & 0x60) == 0) {
if (param_2 == 2) {
iVar4 = *(int *)(this + 0x1cf8);
iVar3 = 0x1e;
goto LAB_007ac0df;
}
if (param_2 == 3) {
iVar4 = *(int *)(this + 0x1cf8);
iVar3 = 0x1f;
goto LAB_007ac0df;
}
if (param_2 == 4) {
if (this[0x104] == (CBasePlayer)0x0) {
iVar3 = (**(code **)(*(int *)this + 0x4b8))(this);
LAB_007ac2b8:
if (iVar3 != 0x10) goto LAB_007ac47b;
uVar5 = *(uint *)(this + 0x150);
goto LAB_007ac2c7;
}
LAB_007ac146:
iVar4 = *(int *)(this + 0x1cf8);
goto LAB_007ac156;
}
if (param_2 != 5) {
if (param_2 < 2) goto LAB_007ac243;
goto LAB_007ac146;
}
iVar3 = *(int *)(this + 0x1cf8);
if ((iVar3 == 0x1c) || (iVar3 == 0x1a)) goto LAB_007ac2b8;
if ((iVar3 - 0x1eU < 2) || (iVar3 == 0x14)) goto LAB_007ac220;
LAB_007ac2c7:
if ((uVar5 & 2) == 0) {
V_strncpy(local_50,"ref_shoot_",0x40);
}
else {
V_strncpy(local_50,"crouch_shoot_",0x40);
}
V_strncat(local_50,(char *)(this + 0x1cc9),0x40,-1);
iVar3 = CBaseAnimating::LookupSequence((CBaseAnimating *)this,local_50);
if (iVar3 == -1) {
iVar3 = 0;
}
if (((iVar3 != *(int *)(this + 0x494)) || (this[0x489] == (CBasePlayer)0x0)) &&
(*(float *)(this + 0x490) != 0.0)) {
if (this[0x6c] == (CBasePlayer)0x0) {
pCVar1 = *(CBaseEdict **)(this + 0x30);
if (pCVar1 != (CBaseEdict *)0x0) {
*(uint *)pCVar1 = *(uint *)pCVar1 | 0x101;
iVar4 = CBaseEdict::GetChangeAccessor(pCVar1);
*(undefined2 *)(iVar4 + 2) = 0;
}
}
else {
this[0x70] = (CBasePlayer)((byte)this[0x70] | 1);
}
*(undefined4 *)(this + 0x490) = 0;
}
*(undefined4 *)(this + 0x1cf8) = 0x10;
CBaseAnimating::ResetSequence((CBaseAnimating *)this,iVar3);
LAB_007ac1cc:
if (iVar3 == *(int *)(this + 0x494)) goto LAB_007ac220;
}
else {
fVar6 = 0.0;
LAB_007ac243:
if ((uVar5 & 1) == 0) {
iVar3 = *(int *)(this + 0x1cf8);
iVar4 = iVar3;
if (iVar3 - 0x1eU < 2) {
LAB_007ac47b:
iVar4 = *(int *)(this + 0x1cf8);
goto LAB_007ac0df;
}
}
else {
iVar4 = *(int *)(this + 0x1cf8);
}
if ((byte)this[0x253] < 2) {
iVar3 = 6;
}
else {
iVar3 = (uint)(fVar6 != 0.0) * 2 + 0x1a;
}
LAB_007ac0df:
if (iVar3 == 6) {
LAB_007ac156:
if ((iVar4 == 0x10) && (cVar2 = (**(code **)(*(int *)this + 0x338))(this), cVar2 == '\0'))
goto LAB_007ac220;
if (((byte)this[0x150] & 2) == 0) {
V_strncpy(local_50,"ref_aim_",0x40);
}
else {
V_strncpy(local_50,"crouch_aim_",0x40);
}
V_strncat(local_50,(char *)(this + 0x1cc9),0x40,-1);
iVar3 = CBaseAnimating::LookupSequence((CBaseAnimating *)this,local_50);
*(undefined4 *)(this + 0x1cf8) = 6;
if (iVar3 == -1) {
iVar3 = 0;
}
goto LAB_007ac1cc;
}
if (iVar4 == iVar3) goto LAB_007ac220;
*(int *)(this + 0x1cf8) = iVar3;
iVar3 = (**(code **)(*(int *)this + 0x340))(this,iVar3);
if (iVar3 == *(int *)(this + 0x494)) goto LAB_007ac220;
}
CBaseAnimating::ResetSequence((CBaseAnimating *)this,iVar3);
if (*(float *)(this + 0x490) != 0.0) {
if (this[0x6c] == (CBasePlayer)0x0) {
pCVar1 = *(CBaseEdict **)(this + 0x30);
if (pCVar1 != (CBaseEdict *)0x0) {
*(uint *)pCVar1 = *(uint *)pCVar1 | 0x101;
iVar3 = CBaseEdict::GetChangeAccessor(pCVar1);
*(undefined2 *)(iVar3 + 2) = 0;
}
}
else {
this[0x70] = (CBasePlayer)((byte)this[0x70] | 1);
}
*(undefined4 *)(this + 0x490) = 0;
}
LAB_007ac220:
if (local_10 == *(int *)(in_GS_OFFSET + 0x14)) {
return;
}
/* WARNING: Subroutine does not return */
__stack_chk_fail();
}
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.