L L4D2node

IsPlayerAbleToLockOrUnlockDoor

0x004992e0 · 809 bytes · __cdecl

_Z30IsPlayerAbleToLockOrUnlockDoorP14CBaseAnimatingP11CBasePlayer

Decompiled

undefined (2 params)

/* IsPlayerAbleToLockOrUnlockDoor(CBaseAnimating*, CBasePlayer*) */

char IsPlayerAbleToLockOrUnlockDoor(CBaseAnimating *param_1,CBasePlayer *param_2)

{
  float fVar1;
  float fVar2;
  float fVar3;
  byte extraout_var;
  byte extraout_var_00;
  undefined4 uVar4;
  int iVar5;
  char cVar6;
  undefined4 uVar7;
  undefined4 local_84;
  float local_70;
  float local_6c;
  float local_68;
  float local_64;
  float local_60;
  float local_5c;
  float local_58;
  float local_54;
  float local_50;
  undefined1 local_4c [12];
  float local_40;
  float local_30;
  float local_20;
  
  CBaseAnimating::LookupBone(param_1,"DoorHandleBone");
  CBaseAnimating::LookupBone(param_1,"DoorHandleBoneLeft");
  cVar6 = -((char)(~extraout_var_00 & ~extraout_var) >> 7);
  if (cVar6 != '\0') {
    local_84 = CBaseAnimating::LookupAttachment(param_1,"RightHandle");
    uVar4 = CBaseAnimating::LookupAttachment(param_1,"LeftHandle");
    iVar5 = CBaseAnimating::FindBodygroupByName(param_1,"handles");
    uVar7 = uVar4;
    if (-1 < iVar5) {
      iVar5 = CBaseAnimating::GetBodygroup(param_1,iVar5);
      if (iVar5 == 0) {
        return '\0';
      }
      if (iVar5 == 2) {
        uVar7 = local_84;
        local_84 = uVar4;
      }
    }
    if (-1 < (char)((byte)((uint)local_84 >> 0x18) | (byte)((uint)uVar7 >> 0x18))) {
      (**(code **)(*(int *)param_1 + 0x370))(param_1,local_84,local_4c);
      fVar3 = local_20;
      fVar2 = local_30;
      fVar1 = local_40;
      (**(code **)(*(int *)param_1 + 0x370))(param_1,uVar7,local_4c);
      if ((((-0.01 < fVar1) && (fVar1 < 0.01)) && (-0.01 < fVar2)) &&
         (((fVar2 < 0.01 && (-0.01 < fVar3)) && (fVar3 < 0.01)))) {
        return '\0';
      }
      if (((-0.01 < local_40) && (local_40 < 0.01)) &&
         ((-0.01 < local_30 && (((local_30 < 0.01 && (-0.01 < local_20)) && (local_20 < 0.01)))))) {
        return '\0';
      }
      CBasePlayer::EyePositionAndVectors
                (param_2,(Vector *)&local_70,(Vector *)&local_64,(Vector *)0x0,(Vector *)0x0);
      local_54 = fVar2 - local_6c;
      local_50 = fVar3 - local_68;
      local_58 = fVar1 - local_70;
      VectorNormalize((Vector *)&local_58);
      if (SQRT((local_20 - local_68) * (local_20 - local_68) +
               (local_30 - local_6c) * (local_30 - local_6c) +
               (local_40 - local_70) * (local_40 - local_70)) <
          SQRT((fVar3 - local_68) * (fVar3 - local_68) + (fVar1 - local_70) * (fVar1 - local_70) +
               (fVar2 - local_6c) * (fVar2 - local_6c))) {
        return '\0';
      }
      if (local_60 * local_54 + local_64 * local_58 + local_5c * local_50 <= 0.0) {
        return '\0';
      }
      return cVar6;
    }
  }
  return '\0';
}

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)