ZombieBotBody::SelectAnimationSequence
0x00a4e5f0 · 1228 bytes · __thiscall
_ZNK13ZombieBotBody23SelectAnimationSequenceE8Activity
Decompiled
undefined (2 params)
/* ZombieBotBody::SelectAnimationSequence(Activity) const */
undefined4 __thiscall ZombieBotBody::SelectAnimationSequence(ZombieBotBody *this,int param_2)
{
float fVar1;
float fVar2;
float fVar3;
float fVar4;
float fVar5;
float fVar6;
bool bVar7;
int *piVar8;
int iVar9;
CBaseEntity *pCVar10;
undefined4 uVar11;
CBaseEntity *this_00;
CStudioHdr *pCVar12;
int iVar13;
int iVar14;
CStudioHdr *pCVar15;
int iVar16;
CUtlVector<int,CUtlMemory<int,int>> *local_48;
int local_44;
CStudioHdr *local_40;
int local_34;
float local_30;
float local_2c;
float local_28;
int local_24;
float local_20;
piVar8 = (int *)(**(code **)(*(int *)this + 0xb0))(this);
iVar9 = (**(code **)(*piVar8 + 0xb4))(piVar8);
if (((iVar9 != 0) &&
(pCVar10 = (CBaseEntity *)
__dynamic_cast(iVar9,&CBaseCombatCharacter::typeinfo,&Infected::typeinfo,0),
pCVar10 != (CBaseEntity *)0x0)) && ((param_2 == 0x29b || (param_2 == 0x29d)))) {
this_00 = (CBaseEntity *)(**(code **)(*(int *)pCVar10 + 0x56c))(pCVar10);
if (this_00 == (CBaseEntity *)0x0) {
bVar7 = true;
if (pCVar10[0x1d08] == (CBaseEntity)0x0) goto LAB_00a4e85d;
local_44 = 0x5c;
}
else {
if (((byte)pCVar10[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition(pCVar10);
}
if (((byte)this_00[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition(this_00);
}
fVar1 = *(float *)(this_00 + 0x2e0);
fVar2 = *(float *)(this_00 + 0x2e4);
fVar3 = *(float *)(this_00 + 0x2e8);
fVar4 = *(float *)(pCVar10 + 0x2e0);
fVar5 = *(float *)(pCVar10 + 0x2e4);
fVar6 = *(float *)(pCVar10 + 0x2e8);
(**(code **)(*(int *)pCVar10 + 0x24c))(pCVar10,&local_30,0,0);
bVar7 = 0.0 < (fVar2 - fVar5) * local_2c + (fVar1 - fVar4) * local_30 +
(fVar3 - fVar6) * local_28;
if (pCVar10[0x1d08] == (CBaseEntity)0x0) {
LAB_00a4e85d:
switch(*(undefined4 *)(pCVar10 + 0x1838)) {
default:
goto switchD_00a4e870_caseD_0;
case 1:
if (bVar7) {
local_44 = 0x4a;
}
else {
local_44 = 0x4b;
}
break;
case 2:
if (bVar7) {
local_44 = 0x4d;
}
else {
local_44 = 0x4e;
}
break;
case 3:
if (bVar7) {
local_44 = 0x4c;
}
else {
local_44 = 0x4f;
}
break;
case 4:
if (bVar7) {
local_44 = 0x52;
}
else {
local_44 = 0x53;
}
break;
case 5:
if (bVar7) {
local_44 = 0x50;
}
else {
local_44 = 0x51;
}
break;
case 6:
if (bVar7) {
local_44 = 0x56;
}
else {
local_44 = 0x57;
}
break;
case 7:
if (bVar7) {
local_44 = 0x54;
}
else {
local_44 = 0x55;
}
}
}
else {
local_44 = ((int)((uint)bVar7 << 0x1f) >> 0x1f) + 0x5d;
}
}
local_48 = (CUtlVector<int,CUtlMemory<int,int>> *)&local_30;
local_30 = 0.0;
local_2c = 0.0;
local_28 = 0.0;
pCVar10 = *(CBaseEntity **)(this + 0x14);
local_24 = 0;
local_20 = 0.0;
pCVar12 = *(CStudioHdr **)(pCVar10 + 0x13e0);
if (pCVar12 == (CStudioHdr *)0x0) {
/* try { // try from 00a4e9f2 to 00a4ea02 has its CatchHandler @ 00a4eaa6 */
iVar9 = CBaseEntity::GetModel(pCVar10);
if (iVar9 != 0) {
CBaseAnimating::LockStudioHdr((CBaseAnimating *)pCVar10);
}
pCVar12 = *(CStudioHdr **)(pCVar10 + 0x13e0);
local_40 = (CStudioHdr *)0x0;
if (pCVar12 != (CStudioHdr *)0x0) goto LAB_00a4e7a7;
}
else {
LAB_00a4e7a7:
local_40 = pCVar12;
if (*(int *)pCVar12 == 0) {
local_40 = (CStudioHdr *)0x0;
}
}
local_34 = 0;
/* try { // try from 00a4e7ca to 00a4e85a has its CatchHandler @ 00a4eaa6 */
while (iVar9 = CStudioHdr::GetNumSeq(local_40), local_34 < iVar9) {
iVar9 = GetSequenceActivity(local_40,local_34,(int *)0x0);
if ((param_2 == iVar9) &&
(iVar9 = CStudioHdr::pSeqdesc(local_40,local_34), 0 < *(int *)(iVar9 + 0x18))) {
iVar14 = 0;
iVar16 = 0;
do {
iVar13 = *(int *)(iVar9 + 0x1c) + iVar14 + iVar9;
if (((iVar13 != 0) && ((*(byte *)(iVar13 + 9) & 4) != 0)) &&
(*(int *)(iVar13 + 4) == local_44)) {
CUtlVector<int,CUtlMemory<int,int>>::InsertBefore(local_48,local_24,&local_34);
}
iVar16 = iVar16 + 1;
iVar14 = iVar14 + 0x50;
} while (iVar16 < *(int *)(iVar9 + 0x18));
}
local_34 = local_34 + 1;
}
if (0 < local_24) {
/* try { // try from 00a4e8ae to 00a4e8b2 has its CatchHandler @ 00a4eaa6 */
iVar9 = RandomInt(0,local_24 + -1);
uVar11 = *(undefined4 *)((int)local_30 + iVar9 * 4);
local_24 = 0;
CUtlMemory<int,int>::Purge((CUtlMemory<int,int> *)local_48);
local_20 = local_30;
CUtlMemory<int,int>::Purge((CUtlMemory<int,int> *)local_48);
return uVar11;
}
local_24 = 0;
CUtlMemory<int,int>::Purge((CUtlMemory<int,int> *)local_48);
local_20 = local_30;
CUtlMemory<int,int>::Purge((CUtlMemory<int,int> *)local_48);
}
switchD_00a4e870_caseD_0:
pCVar10 = *(CBaseEntity **)(this + 0x14);
pCVar12 = *(CStudioHdr **)(pCVar10 + 0x13e0);
iVar9 = *(int *)(pCVar10 + 0x494);
if (pCVar12 == (CStudioHdr *)0x0) {
iVar14 = CBaseEntity::GetModel(pCVar10);
if (iVar14 == 0) {
pCVar12 = *(CStudioHdr **)(pCVar10 + 0x13e0);
}
else {
CBaseAnimating::LockStudioHdr((CBaseAnimating *)pCVar10);
pCVar12 = *(CStudioHdr **)(pCVar10 + 0x13e0);
}
pCVar15 = (CStudioHdr *)0x0;
if (pCVar12 == (CStudioHdr *)0x0) goto LAB_00a4e674;
}
pCVar15 = (CStudioHdr *)0x0;
if (*(int *)pCVar12 != 0) {
pCVar15 = pCVar12;
}
LAB_00a4e674:
uVar11 = SelectWeightedSequence(pCVar15,param_2,iVar9);
return uVar11;
}
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.