L L4D2node

CBaseFlex::SetFlexWeight

0x00624300 · 266 bytes · __thiscall

_ZN9CBaseFlex13SetFlexWeightE21LocalFlexController_tf

Decompiled

undefined (3 params)

/* CBaseFlex::SetFlexWeight(LocalFlexController_t, float) */

void __thiscall CBaseFlex::SetFlexWeight(CBaseFlex *this,int param_2,float param_3)

{
  float fVar1;
  float fVar2;
  CBaseEdict *this_00;
  int iVar3;
  int *piVar4;
  
  if ((-1 < param_2) &&
     (iVar3 = CBaseAnimating::GetNumFlexControllers((CBaseAnimating *)this), param_2 < iVar3)) {
    piVar4 = *(int **)(this + 0x13e0);
    if (piVar4 == (int *)0x0) {
      iVar3 = CBaseEntity::GetModel((CBaseEntity *)this);
      if (iVar3 == 0) {
        piVar4 = *(int **)(this + 0x13e0);
      }
      else {
        CBaseAnimating::LockStudioHdr((CBaseAnimating *)this);
        piVar4 = *(int **)(this + 0x13e0);
      }
      if (piVar4 == (int *)0x0) {
        return;
      }
    }
    iVar3 = *piVar4;
    if (iVar3 != 0) {
      iVar3 = iVar3 + *(int *)(iVar3 + 0x110) + param_2 * 0x14;
      fVar1 = *(float *)(iVar3 + 0x10);
      fVar2 = *(float *)(iVar3 + 0xc);
      if (fVar1 != fVar2) {
        param_3 = (param_3 - fVar2) / (fVar1 - fVar2);
        if (param_3 <= 0.0) {
          param_3 = 0.0;
        }
        if (1.0 <= param_3) {
          param_3 = 1.0;
        }
      }
      iVar3 = memcmp(this + param_2 * 4 + 0x15f8,&param_3,4);
      if (iVar3 != 0) {
        if (this[0x6c] == (CBaseFlex)0x0) {
          this_00 = *(CBaseEdict **)(this + 0x30);
          if (this_00 != (CBaseEdict *)0x0) {
            *(uint *)this_00 = *(uint *)this_00 | 0x101;
            iVar3 = CBaseEdict::GetChangeAccessor(this_00);
            *(undefined2 *)(iVar3 + 2) = 0;
          }
        }
        else {
          this[0x70] = (CBaseFlex)((byte)this[0x70] | 1);
        }
        *(float *)(this + param_2 * 4 + 0x15f8) = param_3;
        return;
      }
    }
  }
  return;
}

SourceMod gamedata

paste into addons/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.



        

        

          

Type inference is best-effort from the C signature - sanity-check the DHooks types before shipping.

Return-type handling cheatsheet (DHookReturn)