ZombieBotBody::Update
0x00a4d330 · 3764 bytes · __thiscall
_ZN13ZombieBotBody6UpdateEv
Decompiled
undefined (1 param)
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* ZombieBotBody::Update() */
void __thiscall ZombieBotBody::Update(ZombieBotBody *this)
{
uint *puVar1;
CBaseAnimating *pCVar2;
CBaseEdict *pCVar3;
char cVar4;
int *piVar5;
int *piVar6;
float *pfVar7;
Infected *this_00;
CStudioHdr *pCVar8;
CBaseEntity *pCVar9;
int iVar10;
CBaseEntity *pCVar11;
INextBot *this_01;
int iVar12;
CStudioHdr *pCVar13;
longdouble lVar14;
float fVar15;
float fVar16;
float fVar17;
bool local_55;
undefined4 local_54;
undefined4 local_50;
undefined4 local_4c;
undefined4 local_48;
int local_44;
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;
local_54 = 0;
local_50 = 0;
if (_towlower == 0) {
local_44 = 0;
}
else {
(**(code **)(_towlower + 0x50))
(_towlower,&local_54,0,0,0,0,
"/data/src/game/server/terror/zombiebot/zombiebotbody.cpp",0x265,&Update()::tm_fmt,
"(%s)%s","NextBotExpensive","ZombieBotBody::Update");
local_44 = _towlower;
}
iVar12 = _DAT_0105db00;
local_4c = local_54;
local_48 = local_50;
/* try { // try from 00a4d8f6 to 00a4d956 has its CatchHandler @ 00a4e2a2 */
if (((_DAT_0105d154 != 0) || (DAT_0105d158 == '\0')) &&
(iVar10 = ThreadGetCurrentId(), iVar12 == iVar10)) {
if ((char *)*_DAT_0105d15c != "ZombieBotBody::Update") {
_DAT_0105d15c =
(int *)CVProfNode::GetSubNode((char *)_DAT_0105d15c,0xd27e29,(char *)0x0,0xca957e);
}
puVar1 = (uint *)(_DAT_0105d1e8 + 4 + _DAT_0105d15c[0x1c] * 8);
*puVar1 = *puVar1 | 4;
CVProfNode::EnterScope();
DAT_0105d158 = '\0';
}
fVar15 = *(float *)(this + 8);
/* try { // try from 00a4d3f6 to 00a4d43f has its CatchHandler @ 00a4e2a0 */
piVar5 = (int *)(**(code **)(*(int *)this + 0xb0))(this);
piVar5 = (int *)(**(code **)(*piVar5 + 0xc0))(piVar5);
piVar6 = (int *)(**(code **)(*(int *)this + 0xb0))(this);
piVar6 = (int *)(**(code **)(*piVar6 + 0xb4))(piVar6);
if (*(int *)(this + 0x18) != 0) {
lVar14 = (longdouble)CountdownTimer::Now();
if (*(float *)(this + 0x3c) <= (float)lVar14) {
CBaseAnimating::GetAttachment
(*(CBaseAnimating **)(this + 0x14),*(int *)(this + 0x18),(Vector *)(this + 0x1c),
(Vector *)(this + 0x28),(Vector *)0x0,(Vector *)0x0);
pCVar11 = *(CBaseEntity **)(this + 0x14);
if (((byte)pCVar11[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition(pCVar11);
}
*(float *)(this + 0x1c) = *(float *)(this + 0x1c) - *(float *)(pCVar11 + 0x2e0);
*(float *)(this + 0x20) = *(float *)(this + 0x20) - *(float *)(pCVar11 + 0x2e4);
*(float *)(this + 0x24) = *(float *)(this + 0x24) - *(float *)(pCVar11 + 0x2e8);
lVar14 = (longdouble)(**(code **)(*piVar6 + 0x5c0))(piVar6);
fVar16 = (float)lVar14;
lVar14 = (longdouble)CountdownTimer::Now();
if ((float)lVar14 + fVar16 != *(float *)(this + 0x3c)) {
(**(code **)(*(int *)(this + 0x34) + 4))(this + 0x34,this + 0x3c);
*(float *)(this + 0x3c) = (float)lVar14 + fVar16;
}
if (fVar16 != *(float *)(this + 0x38)) {
/* try { // try from 00a4df80 to 00a4e051 has its CatchHandler @ 00a4e2a0 */
(**(code **)(*(int *)(this + 0x34) + 4))(this + 0x34,this + 0x38);
*(float *)(this + 0x38) = fVar16;
}
this_01 = (INextBot *)(**(code **)(*(int *)this + 0xb0))(this);
cVar4 = INextBot::IsDebugging(this_01,2);
if (cVar4 != '\0') {
pfVar7 = (float *)(**(code **)(*piVar5 + 300))(piVar5);
local_34 = *(float *)(this + 0x1c) + *pfVar7;
local_30 = *(float *)(this + 0x20) + pfVar7[1];
local_2c = *(float *)(this + 0x24) + pfVar7[2];
local_24 = *(float *)(this + 0x2c) * 50.0 + local_30;
local_28 = *(float *)(this + 0x28) * 50.0 + local_34;
local_20 = *(float *)(this + 0x30) * 50.0 + local_2c;
NDebugOverlay::Line((Vector *)&local_34,(Vector *)&local_28,0xff,100,0,false,0.1);
}
}
}
cVar4 = (**(code **)(*(int *)this + 0xe8))(this,3);
if (cVar4 != '\0') {
/* try { // try from 00a4d46a to 00a4d46e has its CatchHandler @ 00a4e27f */
cVar4 = CBaseAnimating::GetIntervalMovement
(*(CBaseAnimating **)(this + 0x14),fVar15,&local_55,(Vector *)&local_40,
(QAngle *)&local_34);
if (cVar4 != '\0') {
pCVar11 = *(CBaseEntity **)(this + 0x14);
if (((byte)pCVar11[0x14d] & 8) != 0) {
/* try { // try from 00a4df5b to 00a4df5f has its CatchHandler @ 00a4e27f */
CBaseEntity::CalcAbsolutePosition(pCVar11);
}
fVar15 = 1.0 / fVar15;
local_28 = (local_40 - *(float *)(pCVar11 + 0x2e0)) * fVar15;
local_24 = (local_3c - *(float *)(pCVar11 + 0x2e4)) * fVar15;
local_20 = (local_38 - *(float *)(pCVar11 + 0x2e8)) * fVar15;
/* try { // try from 00a4db64 to 00a4dc6d has its CatchHandler @ 00a4e27f */
cVar4 = (**(code **)(*(int *)this + 0xe8))(this,1);
if (cVar4 == '\0') {
pCVar11 = *(CBaseEntity **)(this + 0x14);
if (((byte)pCVar11[0x14d] & 0x10) == 0) {
local_28 = *(float *)(pCVar11 + 0x274);
pCVar9 = pCVar11;
}
else {
/* try { // try from 00a4e0db to 00a4e11f has its CatchHandler @ 00a4e27f */
CBaseEntity::CalcAbsoluteVelocity(pCVar11);
pCVar9 = *(CBaseEntity **)(this + 0x14);
local_28 = *(float *)(pCVar11 + 0x274);
if ((*(uint *)(pCVar9 + 0x14c) & 0x1000) != 0) {
CBaseEntity::CalcAbsoluteVelocity(pCVar9);
}
}
local_24 = *(float *)(pCVar9 + 0x278);
}
cVar4 = (**(code **)(*(int *)this + 0xe8))(this,2);
if (cVar4 == '\0') {
pCVar9 = *(CBaseEntity **)(this + 0x14);
pCVar11 = pCVar9;
if (((byte)pCVar9[0x14d] & 0x10) != 0) {
CBaseEntity::CalcAbsoluteVelocity(pCVar9);
pCVar11 = *(CBaseEntity **)(this + 0x14);
}
local_20 = *(float *)(pCVar9 + 0x27c);
}
else {
pCVar11 = *(CBaseEntity **)(this + 0x14);
}
CBaseEntity::SetAbsVelocity(pCVar11,(Vector *)&local_28);
CBaseEntity::SetAbsAngles(*(CBaseEntity **)(this + 0x14),(QAngle *)&local_34);
piVar6 = (int *)(**(code **)(*(int *)this + 0xb0))(this);
piVar6 = (int *)(**(code **)(*piVar6 + 0xc0))(piVar6);
if ((piVar6 != (int *)0x0) &&
((((local_28 <= -0.01 || (0.01 <= local_28)) ||
((local_24 <= -0.01 || ((0.01 <= local_24 || (local_20 <= -0.01)))))) ||
(0.01 <= local_20)))) {
this[100] = (ZombieBotBody)0x1;
(**(code **)(*piVar6 + 0xb8))(piVar6,&local_40);
this[100] = (ZombieBotBody)0x0;
}
}
}
/* try { // try from 00a4d47f to 00a4d880 has its CatchHandler @ 00a4e2a0 */
cVar4 = (**(code **)(*piVar5 + 0xf8))(piVar5);
if ((cVar4 == '\0') && (cVar4 = (**(code **)(*piVar5 + 0x114))(piVar5), cVar4 == '\0')) {
pCVar11 = *(CBaseEntity **)(this + 0x14);
if (((byte)pCVar11[0x14d] & 0x10) != 0) {
CBaseEntity::CalcAbsoluteVelocity(pCVar11);
}
if (*(float *)(pCVar11 + 0x27c) <= -5.0 && *(float *)(pCVar11 + 0x27c) != -5.0) {
(**(code **)(*(int *)this + 0xd8))(this,0x29a,0);
}
}
pCVar2 = *(CBaseAnimating **)(this + 0x14);
if ((pCVar2[0x488] != (CBaseAnimating)0x0) && (pCVar2[0x489] == (CBaseAnimating)0x0)) {
iVar12 = *(int *)(this + 0x50);
if (iVar12 - 0x296U < 5) {
*(undefined4 *)(this + 0x50) = 0xffffffff;
*(undefined4 *)(this + 0x54) = 0;
/* try { // try from 00a4dce9 to 00a4df3f has its CatchHandler @ 00a4e2a0 */
(**(code **)(*(int *)this + 0xd8))
(this,*(undefined4 *)(this + 0x5c),*(undefined4 *)(this + 0x60));
}
else {
if (iVar12 == -1) {
iVar12 = CBaseAnimating::GetSequenceActivity(pCVar2,*(int *)(pCVar2 + 0x494));
}
*(undefined4 *)(this + 0x50) = 0xffffffff;
*(undefined4 *)(this + 0x54) = 0;
/* try { // try from 00a4da0e to 00a4daed has its CatchHandler @ 00a4e2a0 */
piVar6 = (int *)(**(code **)(*(int *)this + 0xb0))(this);
(**(code **)(*piVar6 + 0x34))(piVar6,iVar12);
}
if (this[0x48] != (ZombieBotBody)0x0) {
this[0x48] = (ZombieBotBody)0x0;
*(undefined4 *)(this + 0x44) = *(undefined4 *)(this + 0x40);
lVar14 = (longdouble)(**(code **)(*(int *)this + 0x118))(this);
local_2c = 0.0;
fVar15 = (float)lVar14 * 0.5;
local_34 = -fVar15;
local_30 = local_34;
lVar14 = (longdouble)(**(code **)(*(int *)this + 0x11c))(this);
local_20 = (float)lVar14;
local_28 = fVar15;
local_24 = fVar15;
piVar6 = (int *)(**(code **)(*(int *)this + 0xb0))(this);
pCVar11 = (CBaseEntity *)(**(code **)(*piVar6 + 0xb4))(piVar6);
CBaseEntity::SetCollisionBounds(pCVar11,(Vector *)&local_34,(Vector *)&local_28);
if (*(int *)(this + 0x44) == 2) {
/* try { // try from 00a4e165 to 00a4e271 has its CatchHandler @ 00a4e2a0 */
(**(code **)(*(int *)this + 0xd8))(this,0x288,1);
}
else if (*(int *)(this + 0x44) == 4) {
(**(code **)(*(int *)this + 0xd8))(this,0x28d,1);
}
else {
(**(code **)(*(int *)this + 0xd8))(this,0x233);
}
}
}
cVar4 = (**(code **)(*(int *)this + 0xe8))(this,0x10);
if (cVar4 != '\0') {
fVar15 = 0.0;
if (*(int *)(*(int *)(this + 0x14) + 0x30) != 0) {
fVar15 = (float)(*(int *)(*(int *)(this + 0x14) + 0x30) - *(int *)(gpGlobals + 0x58) >> 4);
}
lVar14 = (longdouble)FastCos(fVar15);
iVar12 = *(int *)(this + 0x14);
fVar15 = ((float)lVar14 + 1.0) * 0.100000024 + 0.9;
if (fVar15 != *(float *)(iVar12 + 0x468)) {
if (*(char *)(iVar12 + 0x6c) == '\0') {
pCVar3 = *(CBaseEdict **)(iVar12 + 0x30);
if (pCVar3 != (CBaseEdict *)0x0) {
*(uint *)pCVar3 = *(uint *)pCVar3 | 0x101;
iVar10 = CBaseEdict::GetChangeAccessor(pCVar3);
*(undefined2 *)(iVar10 + 2) = 0;
}
}
else {
*(byte *)(iVar12 + 0x70) = *(byte *)(iVar12 + 0x70) | 1;
}
*(float *)(iVar12 + 0x468) = fVar15;
}
}
if ((((this[0x48] != (ZombieBotBody)0x0) || (*(int *)(this + 0x44) == 2)) ||
(*(int *)(this + 0x44) == 4)) ||
(cVar4 = (**(code **)(*(int *)this + 0xe8))(this,3), cVar4 != '\0')) {
/* try { // try from 00a4d970 to 00a4d987 has its CatchHandler @ 00a4e2a0 */
(**(code **)(**(int **)(this + 0x14) + 0x32c))(*(int **)(this + 0x14));
piVar5 = *(int **)(this + 0x14);
(**(code **)(*piVar5 + 0x364))(piVar5,piVar5);
iVar12 = _DAT_0105db00;
if (((DAT_0105d158 == '\0') || (_DAT_0105d154 != 0)) &&
(iVar10 = ThreadGetCurrentId(), iVar12 == iVar10)) {
cVar4 = CVProfNode::ExitScope();
if (cVar4 != '\0') {
_DAT_0105d15c = (int *)_DAT_0105d15c[0x19];
}
DAT_0105d158 = _DAT_0105d15c == (int *)0x105d160;
}
if (local_44 == 0) {
return;
}
(**(code **)(local_44 + 0x54))(local_44,local_4c,local_48,0,0,0);
return;
}
pfVar7 = (float *)(**(code **)(*piVar5 + 0x128))(piVar5);
pCVar2 = *(CBaseAnimating **)(this + 0x14);
fVar15 = pfVar7[1];
iVar12 = *(int *)(this + 0x78);
pCVar8 = *(CStudioHdr **)(pCVar2 + 0x13e0);
if (pCVar8 == (CStudioHdr *)0x0) {
iVar10 = CBaseEntity::GetModel((CBaseEntity *)pCVar2);
if (iVar10 != 0) {
CBaseAnimating::LockStudioHdr(pCVar2);
}
pCVar8 = *(CStudioHdr **)(pCVar2 + 0x13e0);
if (pCVar8 != (CStudioHdr *)0x0) goto LAB_00a4d595;
pCVar13 = (CStudioHdr *)0x0;
}
else {
LAB_00a4d595:
pCVar13 = (CStudioHdr *)0x0;
if (*(int *)pCVar8 != 0) {
pCVar13 = pCVar8;
}
}
CBaseAnimating::SetPoseParameter(pCVar2,pCVar13,iVar12,fVar15);
iVar12 = *(int *)(this + 0x7c);
pCVar2 = *(CBaseAnimating **)(this + 0x14);
fVar15 = *pfVar7;
pCVar8 = *(CStudioHdr **)(pCVar2 + 0x13e0);
if (pCVar8 == (CStudioHdr *)0x0) {
iVar10 = CBaseEntity::GetModel((CBaseEntity *)pCVar2);
if (iVar10 != 0) {
CBaseAnimating::LockStudioHdr(pCVar2);
}
pCVar8 = *(CStudioHdr **)(pCVar2 + 0x13e0);
pCVar13 = (CStudioHdr *)0x0;
if (pCVar8 != (CStudioHdr *)0x0) goto LAB_00a4d5de;
}
else {
LAB_00a4d5de:
pCVar13 = (CStudioHdr *)0x0;
if (*(int *)pCVar8 != 0) {
pCVar13 = pCVar8;
}
}
CBaseAnimating::SetPoseParameter(pCVar2,pCVar13,iVar12,fVar15);
this_00 = (Infected *)(**(code **)(**(int **)(this + 0x14) + 0x14c))(*(int **)(this + 0x14));
if (this_00 != (Infected *)0x0) {
Infected::SetClientLeanYaw(this_00,pfVar7[1]);
}
(**(code **)(**(int **)(this + 0x14) + 0x24c))
(*(int **)(this + 0x14),&local_40,&local_34,&local_28);
if (-1 < *(int *)(this + 0x68)) {
pCVar11 = *(CBaseEntity **)(this + 0x14);
if (((byte)pCVar11[0x14d] & 0x10) != 0) {
CBaseEntity::CalcAbsoluteVelocity(pCVar11);
}
fVar15 = *(float *)(pCVar11 + 0x278);
fVar16 = *(float *)(pCVar11 + 0x274);
fVar17 = *(float *)(pCVar11 + 0x27c);
lVar14 = (longdouble)(**(code **)(*piVar5 + 0x13c))(piVar5);
pCVar2 = *(CBaseAnimating **)(this + 0x14);
iVar12 = *(int *)(this + 0x68);
pCVar8 = *(CStudioHdr **)(pCVar2 + 0x13e0);
if (pCVar8 == (CStudioHdr *)0x0) {
iVar10 = CBaseEntity::GetModel((CBaseEntity *)pCVar2);
if (iVar10 != 0) {
CBaseAnimating::LockStudioHdr(pCVar2);
}
pCVar8 = *(CStudioHdr **)(pCVar2 + 0x13e0);
pCVar13 = (CStudioHdr *)0x0;
if (pCVar8 != (CStudioHdr *)0x0) goto LAB_00a4d6dd;
}
else {
LAB_00a4d6dd:
pCVar13 = (CStudioHdr *)0x0;
if (*(int *)pCVar8 != 0) {
pCVar13 = pCVar8;
}
}
CBaseAnimating::SetPoseParameter
(pCVar2,pCVar13,iVar12,
(local_38 * fVar17 + local_40 * fVar16 + local_3c * fVar15) / (float)lVar14);
}
if (*(int *)(this + 0x6c) < 0) goto LAB_00a4d7b7;
pCVar11 = *(CBaseEntity **)(this + 0x14);
if (((byte)pCVar11[0x14d] & 0x10) != 0) {
CBaseEntity::CalcAbsoluteVelocity(pCVar11);
}
fVar17 = local_30 * *(float *)(pCVar11 + 0x278);
fVar15 = local_34 * *(float *)(pCVar11 + 0x274);
fVar16 = local_2c * *(float *)(pCVar11 + 0x27c);
lVar14 = (longdouble)(**(code **)(*piVar5 + 0x13c))(piVar5);
pCVar2 = *(CBaseAnimating **)(this + 0x14);
iVar12 = *(int *)(this + 0x6c);
pCVar8 = *(CStudioHdr **)(pCVar2 + 0x13e0);
if (pCVar8 == (CStudioHdr *)0x0) {
iVar10 = CBaseEntity::GetModel((CBaseEntity *)pCVar2);
if (iVar10 != 0) {
CBaseAnimating::LockStudioHdr(pCVar2);
}
pCVar8 = *(CStudioHdr **)(pCVar2 + 0x13e0);
pCVar13 = (CStudioHdr *)0x0;
if (pCVar8 != (CStudioHdr *)0x0) goto LAB_00a4d791;
}
else {
LAB_00a4d791:
pCVar13 = (CStudioHdr *)0x0;
if (*(int *)pCVar8 != 0) {
pCVar13 = pCVar8;
}
}
CBaseAnimating::SetPoseParameter(pCVar2,pCVar13,iVar12,(fVar16 + fVar15 + fVar17) / (float)lVar14)
;
LAB_00a4d7b7:
pCVar11 = *(CBaseEntity **)(this + 0x14);
pCVar9 = pCVar11;
if (((byte)pCVar11[0x14d] & 0x10) != 0) {
CBaseEntity::CalcAbsoluteVelocity(pCVar11);
pCVar9 = *(CBaseEntity **)(this + 0x14);
}
fVar15 = *(float *)(pCVar9 + 0x440);
fVar16 = SQRT(*(float *)(pCVar11 + 0x27c) * *(float *)(pCVar11 + 0x27c) +
*(float *)(pCVar11 + 0x274) * *(float *)(pCVar11 + 0x274) +
*(float *)(pCVar11 + 0x278) * *(float *)(pCVar11 + 0x278));
cVar4 = (**(code **)(*(int *)this + 0xe8))(this,0x10);
if ((cVar4 != '\0') ||
(((cVar4 = (**(code **)(*(int *)this + 0xe8))(this,1), cVar4 == '\0' && (fVar15 < fVar16)) &&
((0.0 < fVar15 && (cVar4 = (**(code **)(*piVar5 + 0xf8))(piVar5), cVar4 != '\0')))))) {
piVar5 = *(int **)(this + 0x14);
fVar16 = fVar16 / fVar15;
if (fVar16 <= -4.0) {
fVar16 = -4.0;
}
if (12.0 <= fVar16) {
fVar16 = 12.0;
}
if (fVar16 != (float)piVar5[0x11a]) {
if ((char)piVar5[0x1b] == '\0') {
pCVar3 = (CBaseEdict *)piVar5[0xc];
if (pCVar3 != (CBaseEdict *)0x0) {
*(uint *)pCVar3 = *(uint *)pCVar3 | 0x101;
/* try { // try from 00a4e0aa to 00a4e0ae has its CatchHandler @ 00a4e2a0 */
iVar12 = CBaseEdict::GetChangeAccessor(pCVar3);
*(undefined2 *)(iVar12 + 2) = 0;
}
}
else {
*(byte *)(piVar5 + 0x1c) = *(byte *)(piVar5 + 0x1c) | 1;
}
piVar5[0x11a] = (int)fVar16;
piVar5 = *(int **)(this + 0x14);
}
}
else {
piVar5 = *(int **)(this + 0x14);
if ((float)piVar5[0x11a] != 1.0) {
if ((char)piVar5[0x1b] == '\0') {
pCVar3 = (CBaseEdict *)piVar5[0xc];
if (pCVar3 != (CBaseEdict *)0x0) {
*(uint *)pCVar3 = *(uint *)pCVar3 | 0x101;
iVar12 = CBaseEdict::GetChangeAccessor(pCVar3);
*(undefined2 *)(iVar12 + 2) = 0;
}
}
else {
*(byte *)(piVar5 + 0x1c) = *(byte *)(piVar5 + 0x1c) | 1;
}
piVar5[0x11a] = 0x3f800000;
piVar5 = *(int **)(this + 0x14);
}
}
(**(code **)(*piVar5 + 0x32c))(piVar5);
piVar5 = *(int **)(this + 0x14);
(**(code **)(*piVar5 + 0x364))(piVar5,piVar5);
iVar12 = _DAT_0105db00;
if (((DAT_0105d158 == '\0') || (_DAT_0105d154 != 0)) &&
(iVar10 = ThreadGetCurrentId(), iVar12 == iVar10)) {
cVar4 = CVProfNode::ExitScope();
if (cVar4 != '\0') {
_DAT_0105d15c = (int *)_DAT_0105d15c[0x19];
}
DAT_0105d158 = _DAT_0105d15c == (int *)0x105d160;
}
if (local_44 == 0) {
return;
}
(**(code **)(local_44 + 0x54))(local_44,local_4c,local_48,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.