CFlexCycler::Think
0x00627240 · 4210 bytes · __thiscall
_ZN11CFlexCycler5ThinkEv
Decompiled
undefined (1 param)
/* CFlexCycler::Think() */
void __thiscall CFlexCycler::Think(CFlexCycler *this)
{
undefined4 uVar1;
float fVar2;
code *pcVar3;
CBaseEdict *pCVar4;
int iVar5;
char *pcVar6;
int iVar7;
int *piVar8;
long lVar9;
uint uVar10;
uint uVar11;
char cVar12;
uint *puVar13;
uint *puVar14;
int *piVar15;
int *piVar16;
int *piVar17;
undefined4 *puVar18;
char *pcVar19;
char *pcVar20;
int in_GS_OFFSET;
bool bVar21;
byte bVar22;
longdouble lVar23;
float fVar24;
int aiStackY_218 [5];
char *local_1a0;
float local_19c;
float local_198;
float local_194;
float local_190;
float local_18c;
float local_188;
float local_184;
float local_180;
float local_17c;
float local_178;
float local_174;
float local_170;
float local_16c;
float local_168;
float local_164;
undefined **local_160;
float local_15c;
float local_158;
uint local_140 [8];
char local_120 [256];
int local_20;
bVar22 = 0;
piVar16 = (int *)&stack0xfffffe04;
puVar18 = (undefined4 *)&stack0xfffffe04;
local_20 = *(int *)(in_GS_OFFSET + 0x14);
CBaseEntity::SetNextThink((CBaseEntity *)this,*(float *)(gpGlobals + 0xc) + 0.1,(char *)0x0);
(**(code **)(*(int *)this + 0x32c))();
if ((this[0x488] != (CFlexCycler)0x0) && (this[0x489] == (CFlexCycler)0x0)) {
fVar24 = *(float *)(gpGlobals + 0xc);
if (fVar24 != *(float *)(this + 0x90)) {
if (this[0x6c] == (CFlexCycler)0x0) {
pCVar4 = *(CBaseEdict **)(this + 0x30);
if (pCVar4 != (CBaseEdict *)0x0) {
*(uint *)pCVar4 = *(uint *)pCVar4 | 0x101;
iVar5 = CBaseEdict::GetChangeAccessor(pCVar4);
*(undefined2 *)(iVar5 + 2) = 0;
}
}
else {
this[0x70] = (CFlexCycler)((byte)this[0x70] | 1);
}
*(float *)(this + 0x90) = fVar24;
}
if (*(float *)(this + 0x468) != 1.0) {
if (this[0x6c] == (CFlexCycler)0x0) {
pCVar4 = *(CBaseEdict **)(this + 0x30);
if (pCVar4 != (CBaseEdict *)0x0) {
*(uint *)pCVar4 = *(uint *)pCVar4 | 0x101;
iVar5 = CBaseEdict::GetChangeAccessor(pCVar4);
*(undefined2 *)(iVar5 + 2) = 0;
}
}
else {
this[0x70] = (CFlexCycler)((byte)this[0x70] | 1);
}
*(undefined4 *)(this + 0x468) = 0x3f800000;
}
this[0x488] = (CFlexCycler)0x0;
*(undefined4 *)(this + 0x444) = 0;
if (*(float *)(this + 0x490) != 0.0) {
if (this[0x6c] == (CFlexCycler)0x0) {
pCVar4 = *(CBaseEdict **)(this + 0x30);
if (pCVar4 != (CBaseEdict *)0x0) {
*(uint *)pCVar4 = *(uint *)pCVar4 | 0x101;
iVar5 = CBaseEdict::GetChangeAccessor(pCVar4);
*(undefined2 *)(iVar5 + 2) = 0;
}
}
else {
this[0x70] = (CFlexCycler)((byte)this[0x70] | 1);
}
*(undefined4 *)(this + 0x490) = 0;
}
}
iVar5 = CBaseAnimating::GetNumFlexControllers((CBaseAnimating *)this);
if (2 < iVar5) {
pcVar6 = "FCVAR_NEVER_AS_STRING";
if ((flex_expression[0x15] & 0x10) == 0) {
pcVar6 = "";
if (*(char **)(flex_expression._28_4_ + 0x24) != (char *)0x0) {
pcVar6 = *(char **)(flex_expression._28_4_ + 0x24);
}
cVar12 = *pcVar6;
if (cVar12 != '+') goto LAB_006272d2;
bVar21 = true;
if (pcVar6[1] == '\0') goto LAB_006278ac;
lVar9 = strtol(pcVar6 + 1,(char **)0x0,10);
for (iVar5 = 0; iVar7 = CBaseAnimating::GetNumFlexControllers((CBaseAnimating *)this),
iVar5 < iVar7; iVar5 = iVar5 + 1) {
*(undefined4 *)(this + *(int *)(this + 0x17dc) * 4 + 0x17e0) = 0;
}
if (predef_flexcontroller_names != (undefined *)0x0) {
iVar5 = 0;
pcVar6 = predef_flexcontroller_names;
do {
iVar7 = LookupFlex(this,pcVar6);
uVar1 = *(undefined4 *)(predef_flexcontroller_values + iVar5 * 4 + lVar9 * 0x78);
iVar5 = iVar5 + 1;
pcVar6 = (&predef_flexcontroller_names)[iVar5];
*(int *)(this + 0x17dc) = iVar7;
*(undefined4 *)(this + iVar7 * 4 + 0x17e0) = uVar1;
} while (pcVar6 != (char *)0x0);
}
}
else {
cVar12 = 'F';
LAB_006272d2:
if (cVar12 == '1') {
bVar21 = pcVar6[1] == '\0';
iVar5 = 0;
if (!bVar21) goto LAB_006278ac;
while( true ) {
iVar7 = CBaseAnimating::GetNumFlexControllers((CBaseAnimating *)this);
if (iVar7 <= iVar5) break;
*(undefined4 *)(this + (iVar5 + 1) * 4 + 0x17dc) = 0x3f800000;
CBaseFlex::SetFlexWeight();
iVar5 = iVar5 + 1;
}
}
else {
if (cVar12 == '^') {
iVar5 = 0;
if (pcVar6[1] == '\0') {
while( true ) {
iVar7 = CBaseAnimating::GetNumFlexControllers((CBaseAnimating *)this);
if (iVar7 <= iVar5) break;
uVar11 = CBaseAnimating::GetNumFlexControllers((CBaseAnimating *)this);
fVar24 = sinf((float)iVar5 /
((float)(uVar11 >> 0x10) * 65536.0 + (float)(uVar11 & 0xffff)) +
*(float *)(gpGlobals + 0xc));
*(float *)(this + (iVar5 + 1) * 4 + 0x17dc) = (fVar24 + 1.0) * 0.5;
CBaseFlex::SetFlexWeight();
iVar5 = iVar5 + 1;
}
goto LAB_00627303;
}
bVar21 = false;
LAB_006278ac:
iVar5 = 2;
pcVar19 = pcVar6;
pcVar20 = "+";
do {
if (iVar5 == 0) break;
iVar5 = iVar5 + -1;
bVar21 = *pcVar19 == *pcVar20;
pcVar19 = pcVar19 + (uint)bVar22 * -2 + 1;
pcVar20 = pcVar20 + (uint)bVar22 * -2 + 1;
} while (bVar21);
if (!bVar21) {
local_1a0 = local_120;
V_strncpy(local_1a0,pcVar6,0x80);
pcVar6 = local_1a0;
cVar12 = local_120[0];
if (local_120[0] != '\0') {
do {
if (cVar12 == '+') {
*pcVar6 = ' ';
}
pcVar6 = pcVar6 + 1;
cVar12 = *pcVar6;
} while (cVar12 != '\0');
while (local_120[0] != '\0') {
if (local_120[0] != ' ') {
iVar5 = 0;
if (local_120[0] == '-') {
while( true ) {
iVar7 = CBaseAnimating::GetNumFlexControllers((CBaseAnimating *)this);
if (iVar7 <= iVar5) break;
*(undefined4 *)(this + (iVar5 + 1) * 4 + 0x17dc) = 0;
iVar5 = iVar5 + 1;
}
}
else {
iVar5 = 0;
if (local_120[0] == '?') {
while( true ) {
iVar7 = CBaseAnimating::GetNumFlexControllers((CBaseAnimating *)this);
if (iVar7 <= iVar5) break;
CBaseAnimating::GetFlexControllerName();
Msg();
iVar5 = iVar5 + 1;
}
Msg();
ConVar::SetValue(flex_expression);
}
else {
iVar5 = sscanf(local_1a0,"%31s");
if (iVar5 == 1) {
iVar5 = LookupFlex(this,(char *)local_140);
*(int *)(this + 0x17dc) = iVar5;
if ((iVar5 != -1) && (*(float *)(this + iVar5 * 4 + 0x17e0) != 1.0)) {
*(undefined4 *)(this + iVar5 * 4 + 0x17e0) = 0x3f800000;
}
puVar14 = local_140;
do {
puVar13 = puVar14;
uVar10 = *puVar13 + 0xfefefeff & ~*puVar13;
uVar11 = uVar10 & 0x80808080;
puVar14 = puVar13 + 1;
} while (uVar11 == 0);
if ((uVar10 & 0x8080) == 0) {
puVar14 = (uint *)((int)puVar13 + 6);
uVar11 = uVar11 >> 0x10;
}
local_1a0 = local_1a0 +
(int)puVar14 +
((-4 - (uint)CARRY1((byte)uVar11,(byte)uVar11)) - (int)local_140
);
}
}
}
}
local_120[0] = local_1a0[1];
local_1a0 = local_1a0 + 1;
}
}
goto LAB_00627303;
}
}
else {
bVar21 = cVar12 == '\0';
if (!bVar21) goto LAB_006278ac;
}
fVar24 = *(float *)(gpGlobals + 0xc);
if (*(float *)(this + 0x17d8) <= fVar24 && fVar24 != *(float *)(this + 0x17d8)) {
lVar23 = (longdouble)(**(code **)(*random_valve + 4))();
iVar5 = CBaseAnimating::GetNumFlexControllers((CBaseAnimating *)this);
piVar16 = random_valve;
*(float *)(this + 0x17d8) = (30.0 / (float)iVar5) * (float)lVar23 + fVar24;
pcVar3 = *(code **)(*piVar16 + 8);
CBaseAnimating::GetNumFlexControllers((CBaseAnimating *)this);
iVar5 = (*pcVar3)();
*(int *)(this + 0x17dc) = iVar5;
if (*(float *)(this + iVar5 * 4 + 0x17e0) == 1.0) {
*(undefined4 *)(this + iVar5 * 4 + 0x17e0) = 0;
}
else {
pcVar6 = (char *)CBaseAnimating::GetFlexControllerType();
iVar5 = _V_stricmp(pcVar6,"phoneme");
if (iVar5 != 0) {
pcVar6 = (char *)CBaseAnimating::GetFlexControllerName();
pcVar6 = strstr(pcVar6,"upper_raiser");
if (pcVar6 == (char *)0x0) {
CBaseAnimating::GetFlexControllerName();
CBaseAnimating::GetFlexControllerType();
Msg();
SetFlexTarget();
}
}
}
}
}
}
LAB_00627303:
for (iVar5 = 0; iVar7 = CBaseAnimating::GetNumFlexControllers((CBaseAnimating *)this),
iVar5 < iVar7; iVar5 = iVar5 + 1) {
lVar23 = (longdouble)CBaseFlex::GetFlexWeight();
if ((float)lVar23 != *(float *)(this + iVar5 * 4 + 0x17e0)) {
(**(code **)(*random_valve + 4))();
}
CBaseFlex::SetFlexWeight();
}
if (*(int *)(flex_talk._28_4_ + 0x30) == -1) {
*(undefined4 *)(this + 0x18f8) = 1;
*(int *)(this + 0x1904) = *(int *)(this + 0x1904) + 1;
V_snprintf(local_120,0x100,"%s%d");
iVar5 = (**(code **)(*engine + 0x80))();
if (iVar5 < 0) {
*(undefined4 *)(this + 0x1904) = 0;
}
else {
Msg();
(**(code **)(*(int *)this + 0x28c))();
CRecipientFilter::CRecipientFilter((CRecipientFilter *)&local_160);
local_160 = &PTR__CPASFilter_00bfaf28;
/* try { // try from 00627fcc to 00627fd0 has its CatchHandler @ 00628356 */
CRecipientFilter::AddRecipientsByPAS((CRecipientFilter *)&local_160,(Vector *)&local_16c);
local_160 = &PTR__CPASAttenuationFilter_00c08ec8;
/* try { // try from 00627fe4 to 00628000 has its CatchHandler @ 00628354 */
(**(code **)(*(int *)this + 0x28c))();
CPASAttenuationFilter::Filter((CPASAttenuationFilter *)&local_160,(Vector *)&local_16c,0.8);
/* try { // try from 00628071 to 00628075 has its CatchHandler @ 00628372 */
CBaseEntity::EmitSentenceByIndex();
LAB_00627ece:
puVar18 = (undefined4 *)&stack0xfffffdfc;
local_160 = &PTR__CPASFilter_00bfaf28;
CRecipientFilter::~CRecipientFilter((CRecipientFilter *)&local_160);
}
LAB_00627ee0:
puVar18[1] = &DAT_00c09604;
*puVar18 = flex_talk;
puVar18[-1] = 0x627ef4;
ConVar::SetValue((char *)*puVar18);
piVar16 = puVar18;
}
else if ((flex_talk[0x15] & 0x10) == 0) {
pcVar6 = *(char **)(flex_talk._28_4_ + 0x24);
if (pcVar6 == (char *)0x0) {
pcVar6 = "";
goto LAB_00627d90;
}
piVar16 = (int *)&stack0xfffffe04;
if (pcVar6 != "0") goto LAB_00627d90;
}
else {
pcVar6 = "FCVAR_NEVER_AS_STRING";
LAB_00627d90:
iVar5 = _V_stricmp(pcVar6,"0");
piVar16 = (int *)&stack0xfffffe04;
if (iVar5 != 0) {
iVar5 = (**(code **)(*engine + 0x80))();
puVar18 = (undefined4 *)&stack0xfffffe04;
if (-1 < iVar5) {
(**(code **)(*(int *)this + 0x28c))();
CRecipientFilter::CRecipientFilter((CRecipientFilter *)&local_160);
local_160 = &PTR__CPASFilter_00bfaf28;
/* try { // try from 00627e24 to 00627e28 has its CatchHandler @ 00628382 */
CRecipientFilter::AddRecipientsByPAS((CRecipientFilter *)&local_160,(Vector *)&local_16c);
local_160 = &PTR__CPASAttenuationFilter_00c08ec8;
/* try { // try from 00627e3c to 00627e58 has its CatchHandler @ 00628376 */
(**(code **)(*(int *)this + 0x28c))();
CPASAttenuationFilter::Filter
((CPASAttenuationFilter *)&local_160,(Vector *)&local_16c,0.8);
/* try { // try from 00627ec9 to 00627ecd has its CatchHandler @ 00628338 */
CBaseEntity::EmitSentenceByIndex();
goto LAB_00627ece;
}
goto LAB_00627ee0;
}
}
iVar5 = gpGlobals;
fVar24 = *(float *)(gpGlobals + 0xc);
if (*(float *)(this + 0x18e0) <= fVar24 && fVar24 != *(float *)(this + 0x18e0)) {
uVar11 = (uint)(*(uint *)(this + 0x1784) == 0);
if (*(uint *)(this + 0x1784) != uVar11) {
if (this[0x6c] == (CFlexCycler)0x0) {
puVar14 = *(uint **)(this + 0x30);
if (puVar14 != (uint *)0x0) {
*puVar14 = *puVar14 | 0x101;
*piVar16 = (int)puVar14;
piVar16[-1] = 0x627457;
iVar5 = CBaseEdict::GetChangeAccessor((CBaseEdict *)*piVar16);
*(undefined2 *)(iVar5 + 2) = 0;
iVar5 = gpGlobals;
}
}
else {
this[0x70] = (CFlexCycler)((byte)this[0x70] | 1);
}
*(uint *)(this + 0x1784) = uVar11;
fVar24 = *(float *)(iVar5 + 0xc);
}
iVar5 = *random_valve;
piVar16[2] = 0x40900000;
piVar16[1] = 0x3fc00000;
*piVar16 = (int)random_valve;
pcVar3 = *(code **)(iVar5 + 4);
piVar16[-1] = 0x627496;
lVar23 = (longdouble)(*pcVar3)();
*(float *)(this + 0x18e0) = (float)lVar23 + fVar24;
}
}
iVar5 = *(int *)this;
*piVar16 = (int)this;
piVar16[3] = (int)&local_184;
piVar16[2] = (int)&local_190;
piVar16[1] = (int)&local_19c;
pcVar3 = *(code **)(iVar5 + 0x24c);
piVar16[-1] = 0x6274e1;
(*pcVar3)();
piVar16[-1] = 0x6274e6;
piVar8 = (int *)UTIL_GetLocalPlayer();
if (piVar8 == (int *)0x0) goto LAB_00627581;
iVar5 = *piVar8;
piVar16[1] = (int)piVar8;
*piVar16 = (int)&local_178;
/* try { // try from 006274ff to 00627504 has its CatchHandler @ 00628370 */
pcVar3 = *(code **)(iVar5 + 600);
piVar16[-1] = 0x627505;
(*pcVar3)();
piVar15 = piVar16 + -1;
if (SQRT(local_174 * local_174 + local_170 * local_170 + local_178 * local_178) == 0.0) {
LAB_00627555:
piVar16 = piVar15;
if (*(float *)(this + 0x18e4) <= *(float *)(gpGlobals + 0xc) &&
*(float *)(gpGlobals + 0xc) != *(float *)(this + 0x18e4)) {
if (*(int *)(this + 0x18f8) == 0) {
iVar5 = *random_valve;
piVar15[2] = 1;
piVar15[1] = 0;
*piVar15 = (int)random_valve;
pcVar3 = *(code **)(iVar5 + 8);
piVar15[-1] = 0x627add;
iVar5 = (*pcVar3)();
if (iVar5 == 0) {
iVar5 = *random_valve;
*piVar15 = (int)random_valve;
piVar15[2] = 0x42000000;
piVar15[1] = -0x3e000000;
pcVar3 = *(code **)(iVar5 + 4);
piVar15[-1] = 0x627b02;
lVar23 = (longdouble)(*pcVar3)();
fVar24 = (float)lVar23;
iVar5 = *random_valve;
*piVar15 = (int)random_valve;
piVar15[2] = 0x42800000;
piVar15[1] = -0x3d800000;
pcVar3 = *(code **)(iVar5 + 4);
piVar15[-1] = 0x627b65;
lVar23 = (longdouble)(*pcVar3)();
fVar2 = (float)lVar23;
iVar5 = *(int *)this;
*piVar15 = (int)&local_160;
piVar15[1] = (int)this;
pcVar3 = *(code **)(iVar5 + 0x234);
piVar15[-1] = 0x627c04;
(*pcVar3)();
iVar5 = gpGlobals;
*(float *)(this + 0x18ec) =
local_198 * 128.0 + local_15c + local_180 * fVar24 + local_18c * fVar2;
*(float *)(this + 0x18f0) =
local_194 * 128.0 + local_158 + fVar24 * local_17c + local_188 * fVar2;
*(float *)(this + 0x18e8) =
local_19c * 128.0 + (float)local_160 + local_184 * fVar24 + local_190 * fVar2;
fVar24 = *(float *)(iVar5 + 0xc);
iVar5 = *random_valve;
piVar15[-1] = (int)random_valve;
piVar15[1] = 0x3f800000;
*piVar15 = 0x3e99999a;
pcVar3 = *(code **)(iVar5 + 4);
piVar15[-2] = 0x627cae;
lVar23 = (longdouble)(*pcVar3)();
iVar5 = gpGlobals;
*(float *)(this + 0x18e4) = (float)lVar23 + fVar24;
piVar16 = piVar15 + -1;
if ((*(float *)(this + 0x18e0) - 0.5 < *(float *)(iVar5 + 0xc)) &&
(uVar11 = (uint)(*(uint *)(this + 0x1784) == 0), piVar16 = piVar15 + -1,
*(uint *)(this + 0x1784) != uVar11)) {
if (this[0x6c] == (CFlexCycler)0x0) {
puVar14 = *(uint **)(this + 0x30);
if (puVar14 != (uint *)0x0) {
*puVar14 = *puVar14 | 0x101;
piVar15[-1] = (int)puVar14;
piVar15[-2] = 0x627d30;
iVar5 = CBaseEdict::GetChangeAccessor((CBaseEdict *)piVar15[-1]);
*(undefined2 *)(iVar5 + 2) = 0;
}
}
else {
this[0x70] = (CFlexCycler)((byte)this[0x70] | 1);
}
*(uint *)(this + 0x1784) = uVar11;
piVar16 = piVar15 + -1;
}
goto LAB_0062756c;
}
}
iVar5 = *piVar8;
piVar15[1] = (int)piVar8;
*piVar15 = (int)&local_160;
pcVar3 = *(code **)(iVar5 + 0x234);
piVar15[-1] = 0x627693;
(*pcVar3)();
iVar5 = gpGlobals;
piVar17 = piVar15 + -1;
*(undefined ***)(this + 0x18e8) = local_160;
*(float *)(this + 0x18ec) = local_15c;
*(float *)(this + 0x18f0) = local_158;
local_1a0 = *(char **)(iVar5 + 0xc);
iVar5 = *random_valve;
piVar15[1] = 0x40800000;
*piVar15 = 0x3f800000;
goto LAB_006276ef;
}
}
else {
iVar5 = *(int *)this;
*piVar16 = (int)this;
piVar16[-1] = (int)&local_160;
/* try { // try from 006277af to 006277b4 has its CatchHandler @ 00628368 */
pcVar3 = *(code **)(iVar5 + 0x234);
piVar16[-2] = 0x6277b5;
(*pcVar3)();
iVar5 = *piVar8;
piVar16[-1] = (int)piVar8;
piVar16[-2] = (int)&local_16c;
/* try { // try from 006277c7 to 006277cc has its CatchHandler @ 00628374 */
pcVar3 = *(code **)(iVar5 + 0x234);
piVar16[-3] = 0x6277cd;
(*pcVar3)();
piVar15 = piVar16 + -3;
if ((local_168 - local_15c) * local_198 + (local_16c - (float)local_160) * local_19c +
(local_164 - local_158) * local_194 <= 0.5) goto LAB_00627555;
iVar5 = *piVar8;
piVar16[-2] = (int)piVar8;
piVar16[-3] = (int)&local_160;
pcVar3 = *(code **)(iVar5 + 0x234);
piVar16[-4] = 0x62783c;
(*pcVar3)();
iVar5 = gpGlobals;
piVar17 = piVar16 + -4;
*(undefined ***)(this + 0x18e8) = local_160;
*(float *)(this + 0x18ec) = local_15c;
*(float *)(this + 0x18f0) = local_158;
local_1a0 = *(char **)(iVar5 + 0xc);
iVar5 = *random_valve;
piVar16[-2] = 0x40800000;
piVar16[-3] = 0x40000000;
LAB_006276ef:
*piVar17 = (int)random_valve;
pcVar3 = *(code **)(iVar5 + 4);
piVar17[-1] = 0x6276f5;
lVar23 = (longdouble)(*pcVar3)();
*(float *)(this + 0x18e4) = (float)lVar23 + (float)local_1a0;
piVar16 = piVar17;
}
LAB_0062756c:
iVar5 = *(int *)this;
*piVar16 = (int)this;
piVar16[1] = (int)(this + 0x18e8);
pcVar3 = *(code **)(iVar5 + 0x3a4);
piVar16[-1] = 0x627581;
(*pcVar3)();
LAB_00627581:
if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {
/* WARNING: Subroutine does not return */
*(undefined1 **)((int)piVar16 + -4) = &LAB_00628338;
__stack_chk_fail();
}
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.