L L4D2node

CPhysMagnet::VPhysicsCollision

0x007a1540 · 1588 bytes · __thiscall

_ZN11CPhysMagnet17VPhysicsCollisionEiP21gamevcollisionevent_t

Decompiled

undefined (3 params)

/* CPhysMagnet::VPhysicsCollision(int, gamevcollisionevent_t*) */

void __thiscall
CPhysMagnet::VPhysicsCollision(CPhysMagnet *this,int param_1,gamevcollisionevent_t *param_2)

{
  gamevcollisionevent_t *pgVar1;
  CBaseEntity *this_00;
  int *piVar2;
  uint uVar3;
  undefined4 uVar4;
  CBaseEdict *this_01;
  char cVar5;
  undefined1 *puVar6;
  CBaseEntity *this_02;
  char *pcVar7;
  undefined4 *puVar8;
  int *piVar9;
  CStudioHdr *pCVar10;
  undefined *puVar11;
  int iVar12;
  CStudioHdr *pCVar13;
  longdouble lVar14;
  matrix3x4_t *local_ec;
  matrix3x4_t local_dc [48];
  matrix3x4_t local_ac [48];
  undefined4 local_7c;
  undefined4 local_78;
  undefined4 local_74;
  undefined4 local_70;
  undefined4 local_6c;
  undefined4 local_68;
  undefined4 local_64;
  float local_60;
  float local_5c;
  undefined4 local_58;
  undefined4 local_54;
  undefined1 local_50;
  undefined4 local_4c;
  float local_48;
  float local_44;
  undefined4 local_40;
  undefined4 local_3c;
  undefined1 local_38;
  
  pgVar1 = param_2 + (uint)(param_1 == 0) * 4;
  this_00 = *(CBaseEntity **)(pgVar1 + 0x68);
  if (((byte)this_00[0x1b4] & 4) != 0) {
    return;
  }
  this[0x1451] = (CPhysMagnet)0x1;
  DoMagnetSuck(this,*(CBaseEntity **)(pgVar1 + 0x68));
  if (this[0x1450] == (CPhysMagnet)0x0) {
    return;
  }
  if ((*(int *)(this + 0x1460) != 0) && (*(int *)(this + 0x1460) <= *(int *)(this + 0x1444))) {
    return;
  }
  if (((((byte)this[0x148] & 0x10) != 0) && (*(char **)(this_00 + 0x7c) != "prop_vehicle_jeep")) &&
     (cVar5 = CBaseEntity::ClassMatchesComplex(this_00,"prop_vehicle_jeep"), cVar5 == '\0')) {
    if (1 < (byte)this_00[0x105]) {
      CTakeDamageInfo::CTakeDamageInfo
                ((CTakeDamageInfo *)&local_7c,(CBaseEntity *)this,(CBaseEntity *)this,
                 (float)*(int *)(this_00 + 0x100),0x800,0);
      CBaseEntity::TakeDamage(this_00,(CTakeDamageInfo *)&local_7c);
      return;
    }
    cVar5 = (**(code **)(**(int **)pgVar1 + 0x2c))(*(int **)pgVar1);
    if (cVar5 == '\0') {
      if (*(int *)(this_00 + 0x30) == 0) {
        iVar12 = 0;
      }
      else {
        iVar12 = *(int *)(this_00 + 0x30) - *(int *)(gpGlobals + 0x58) >> 4;
      }
      puVar6 = &DAT_00d539c2;
      if (*(undefined1 **)(this_00 + 0x7c) != (undefined1 *)0x0) {
        puVar6 = *(undefined1 **)(this_00 + 0x7c);
      }
      Warning("CPhysMagnet %s:%d blocking magnet\n",puVar6,iVar12);
      return;
    }
    UTIL_Remove(this_00);
    return;
  }
  iVar12 = (**(code **)(*physprops + 0x18))(physprops,*(undefined4 *)(pgVar1 + 8));
  if ((*(char *)(iVar12 + 0x4c) == 'P') || (*(char *)(iVar12 + 0x4c) == 'M')) goto LAB_007a1678;
  iVar12 = (**(code **)(*(int *)this_00 + 0xf0))(this_00);
  if (iVar12 == 0) {
    return;
  }
  this_02 = (CBaseEntity *)(**(code **)(*(int *)this_00 + 0xf0))(this_00);
  pCVar10 = *(CStudioHdr **)(this_02 + 0x13e0);
  if (pCVar10 == (CStudioHdr *)0x0) {
    iVar12 = CBaseEntity::GetModel(this_02);
    if (iVar12 == 0) {
      pCVar10 = *(CStudioHdr **)(this_02 + 0x13e0);
    }
    else {
      CBaseAnimating::LockStudioHdr((CBaseAnimating *)this_02);
      pCVar10 = *(CStudioHdr **)(this_02 + 0x13e0);
    }
    pCVar13 = (CStudioHdr *)0x0;
    if (pCVar10 != (CStudioHdr *)0x0) goto LAB_007a175e;
  }
  else {
LAB_007a175e:
    pCVar13 = (CStudioHdr *)0x0;
    if (*(int *)pCVar10 != 0) {
      pCVar13 = pCVar10;
    }
  }
  pcVar7 = (char *)Studio_GetDefaultSurfaceProps(pCVar13);
  iVar12 = V_strncmp(pcVar7,"metal",5);
  if (iVar12 != 0) {
    return;
  }
LAB_007a1678:
  piVar2 = *(int **)(this_00 + 0x238);
  if (((piVar2 != (int *)0x0) && (this_00[0x186] == (CBaseEntity)0x6)) &&
     (cVar5 = (**(code **)(*piVar2 + 0x2c))(piVar2), cVar5 != '\0')) {
    if (0 < *(int *)(this + 0x1444)) {
      iVar12 = 0;
      do {
        uVar3 = *(uint *)(*(int *)(this + 0x1438) + 4 + iVar12 * 8);
        if ((((uVar3 != 0xffffffff) &&
             (puVar11 = g_pEntityList + (uVar3 & 0xfff) * 0x10, puVar11 != (undefined *)0xfffffffc))
            && (*(uint *)(puVar11 + 8) == uVar3 >> 0xc)) &&
           (this_00 == *(CBaseEntity **)(puVar11 + 4))) {
          return;
        }
        iVar12 = iVar12 + 1;
      } while (iVar12 != *(int *)(this + 0x1444));
    }
    if (*(float *)(this_00 + 0x240) != 2048.0) {
      if (this_00[0x6c] == (CBaseEntity)0x0) {
        this_01 = *(CBaseEdict **)(this_00 + 0x30);
        if (this_01 != (CBaseEdict *)0x0) {
          *(uint *)this_01 = *(uint *)this_01 | 0x101;
          iVar12 = CBaseEdict::GetChangeAccessor(this_01);
          *(undefined2 *)(iVar12 + 2) = 0;
        }
      }
      else {
        this_00[0x70] = (CBaseEntity)((byte)this_00[0x70] | 1);
      }
      *(undefined4 *)(this_00 + 0x240) = 0x45000000;
    }
    piVar9 = *(int **)(this + 0x238);
    puVar8 = (undefined4 *)(**(code **)(*(int *)this_00 + 0xc))(this_00);
    uVar4 = *puVar8;
    if (((byte)this[0x148] & 8) == 0) {
      SetIdentityMatrix((matrix3x4_t *)&local_7c);
      local_38 = 1;
      local_48 = 0.0;
      local_44 = 0.0;
      local_4c = 0x3f800000;
      local_40 = 0x3f800000;
      local_3c = 0x3f800000;
      if (piVar9 == (int *)0x0) {
        SetIdentityMatrix(local_dc);
      }
      else {
        (**(code **)(*piVar9 + 200))(piVar9,local_ac);
        MatrixInvert(local_ac,local_dc);
      }
      local_ec = local_dc;
      (**(code **)(*piVar2 + 200))(piVar2,local_ac);
      ConcatTransforms(local_ec,local_ac,(matrix3x4_t *)&local_7c);
      local_4c = 0x3f800000;
      local_40 = 0x3f800000;
      local_48 = *(float *)(this + 0x1430) * 0.45454544;
      local_38 = 1;
      local_44 = *(float *)(this + 0x1434) * 0.45454544;
      local_3c = 0x3f800000;
      piVar9 = (int *)(**(code **)(*physenv + 0x48))(physenv,piVar9,piVar2,0,&local_7c);
    }
    else {
      local_64 = 0x3f800000;
      local_58 = 0x3f800000;
      local_54 = 0x3f800000;
      local_50 = 1;
      local_60 = *(float *)(this + 0x1430) * 0.45454544;
      local_7c = 0;
      local_5c = *(float *)(this + 0x1434) * 0.45454544;
      local_78 = 0;
      local_74 = 0;
      local_70 = 0;
      local_6c = 0;
      local_68 = 0;
      (**(code **)(**(int **)(param_2 + 0x1c) + 4))(*(int **)(param_2 + 0x1c),local_ac);
      (**(code **)(*piVar9 + 0xe8))(piVar9,&local_7c,local_ac);
      (**(code **)(*piVar2 + 0xe8))(piVar2,&local_70,local_ac);
      piVar9 = (int *)(**(code **)(*physenv + 0x50))(physenv,piVar9,piVar2,0,&local_7c);
    }
    (**(code **)(*piVar9 + 0x10))(piVar9,this);
    iVar12 = *(int *)(this + 0x1444);
    CUtlVector<magnetted_objects_t,CUtlMemory<magnetted_objects_t,int>>::GrowVector
              ((CUtlVector<magnetted_objects_t,CUtlMemory<magnetted_objects_t,int>> *)
               (this + 0x1438),1);
    CUtlVector<magnetted_objects_t,CUtlMemory<magnetted_objects_t,int>>::ShiftElementsRight
              ((CUtlVector<magnetted_objects_t,CUtlMemory<magnetted_objects_t,int>> *)
               (this + 0x1438),iVar12,1);
    puVar8 = (undefined4 *)(*(int *)(this + 0x1438) + iVar12 * 8);
    if (puVar8 != (undefined4 *)0x0) {
      *puVar8 = piVar9;
      puVar8[1] = uVar4;
    }
    lVar14 = (longdouble)(**(code **)(*piVar2 + 0x78))(piVar2);
    *(float *)(this + 0x1454) = (float)lVar14 + *(float *)(this + 0x1454);
  }
  DoMagnetSuck(this,this_00);
  COutputEvent::FireOutput
            ((COutputEvent *)(this + 0x13f8),(CBaseEntity *)this,(CBaseEntity *)this,0.0);
  CBaseEntity::VPhysicsCollision((CBaseEntity *)this,param_1,param_2);
  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)