L L4D2node

CBreakable::UpdateHealth

0x006b3340 · 409 bytes · __thiscall

_ZN10CBreakable12UpdateHealthEiP11CBaseEntity

Decompiled

undefined (3 params)

/* CBreakable::UpdateHealth(int, CBaseEntity*) */

undefined4 __thiscall CBreakable::UpdateHealth(CBreakable *this,int param_1,CBaseEntity *param_2)

{
  float local_24;
  undefined4 local_20;
  undefined4 local_1c;
  undefined4 local_18;
  undefined4 local_14;
  undefined4 local_10;
  
  if (*(int *)(this + 0x100) != param_1) {
    (**(code **)(*(int *)this + 0x214))(this,this + 0x100);
    *(int *)(this + 0x100) = param_1;
    if (*(int *)(this + 0xfc) == 0) {
      (**(code **)(*(int *)this + 0x20c))(this,this + 0xfc);
      local_24 = 1.0;
      *(undefined4 *)(this + 0xfc) = 1;
      param_1 = *(int *)(this + 0x100);
    }
    else {
      local_24 = (float)*(int *)(this + 0xfc);
    }
    local_24 = (float)param_1 / local_24;
    if (local_24 <= 0.0) {
      local_24 = 0.0;
    }
    if (1.0 <= local_24) {
      local_24 = 1.0;
    }
    variant_t::Set((variant_t *)(this + 0x4a4),1,&local_24);
    local_20 = *(undefined4 *)(this + 0x4a4);
    local_1c = *(undefined4 *)(this + 0x4a8);
    local_18 = *(undefined4 *)(this + 0x4ac);
    local_14 = *(undefined4 *)(this + 0x4b0);
    local_10 = *(undefined4 *)(this + 0x4b4);
    CBaseEntityOutput::FireOutput((CBaseEntityOutput *)(this + 0x4a4),&local_20,param_2,this,0);
    if (*(int *)(this + 0x100) < 1) {
      Break(this,param_2);
      return 0;
    }
    if (((byte)this[0x148] & 1) == 0) {
      if (this[0x105] != (CBreakable)0x2) {
        (**(code **)(*(int *)this + 0x224))(this,this + 0x105);
        this[0x105] = (CBreakable)0x2;
      }
    }
    else if (this[0x105] != (CBreakable)0x0) {
      (**(code **)(*(int *)this + 0x224))(this,this + 0x105);
      this[0x105] = (CBreakable)0x0;
      return 1;
    }
  }
  return 1;
}

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)