L L4D2node

CBaseAchievement::EnsureComponentBitSetAndEvaluate

0x003fd430 · 328 bytes · __thiscall

_ZN16CBaseAchievement32EnsureComponentBitSetAndEvaluateEi

Decompiled

undefined (2 params)

/* CBaseAchievement::EnsureComponentBitSetAndEvaluate(int) */

void __thiscall
CBaseAchievement::EnsureComponentBitSetAndEvaluate(CBaseAchievement *this,int param_1)

{
  char cVar1;
  undefined4 uVar2;
  int iVar3;
  uint uVar4;
  uint uVar5;
  
  cVar1 = (**(code **)(*(int *)this + 0x50))(this);
  if (cVar1 == '\0') {
    uVar4 = (uint)param_1 >> 5 & 1;
    uVar5 = uVar4 << ((byte)param_1 & 0x1f);
    uVar4 = (uVar4 ^ 1) << ((byte)param_1 & 0x1f);
    if ((*(uint *)(this + 0x6c) & uVar5) == 0 && (*(uint *)(this + 0x68) & uVar4) == 0) {
      cVar1 = (**(code **)(*(int *)this + 0xa0))(this);
      if (cVar1 == '\0') {
        (**(code **)(*(int *)this + 0x20))(this);
        Msg();
        return;
      }
      uVar4 = *(uint *)(this + 0x68) | uVar4;
      *(uint *)(this + 0x68) = uVar4;
      uVar5 = *(uint *)(this + 0x6c) | uVar5;
      *(uint *)(this + 0x6c) = uVar5;
      iVar3 = 0;
      if (uVar5 != 0 || uVar4 != 0) {
        do {
          iVar3 = (iVar3 + 1) - (uint)((uVar4 & 1) == 0);
          uVar4 = uVar4 >> 1 | uVar5 << 0x1f;
          uVar5 = uVar5 >> 1;
        } while (uVar5 != 0 || uVar4 != 0);
      }
      *(int *)(this + 0x60) = iVar3;
      if (*(int *)(this + 0x1c) != iVar3) {
        *(undefined1 *)(*(int *)(this + 0x70) + 0x2ac + *(int *)(this + 0x74)) = 1;
        if (*(int *)(cc_achievement_debug._28_4_ + 0x30) != 0) {
          uVar2 = (**(code **)(*(int *)this + 0x20))(this);
          Msg("Component %d for achievement %s found\n",param_1,uVar2);
        }
        ShowProgressNotification(this);
        return;
      }
      AwardAchievement(this);
      return;
    }
    if (*(int *)(cc_achievement_debug._28_4_ + 0x30) != 0) {
      uVar2 = (**(code **)(*(int *)this + 0x20))(this);
      Msg("Component %d for achievement %s found, but already had that component\n",param_1,uVar2);
      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)