L L4D2node

TankBehavior::OnContact

0x00aeeb70 · 1454 bytes · __cdecl

_ZN12TankBehavior9OnContactEP4TankP11CBaseEntityP10CGameTrace

Decompiled

undefined (3 params)

/* TankBehavior::OnContact(Tank*, CBaseEntity*, CGameTrace*) */

Tank * TankBehavior::OnContact(Tank *param_1,CBaseEntity *param_2,CGameTrace *param_3)

{
  code *pcVar1;
  uint uVar2;
  char cVar3;
  int iVar4;
  int *piVar5;
  undefined4 uVar6;
  undefined *puVar7;
  bool bVar8;
  longdouble lVar9;
  CBaseEntity *in_stack_00000010;
  int in_stack_00000014;
  pointer_____offset_0x8___ *ppuVar10;
  pointer_____offset_0x8___ *ppuVar11;
  CPhysicsProp *local_40;
  float local_34;
  float local_30;
  float local_2c;
  float local_28;
  float local_24;
  float local_20;
  
  if (in_stack_00000010 != (CBaseEntity *)0x0) {
    iVar4 = CBaseEntity::GetTeamNumber((CBaseEntity *)param_3);
    bVar8 = false;
    if (iVar4 == 3) {
      iVar4 = (**(code **)(*(int *)param_3 + 0x544))(param_3);
      bVar8 = iVar4 == 8;
    }
    cVar3 = IsBreakableEntity(in_stack_00000010,bVar8,true,(CTakeDamageInfo *)0x0);
    if ((cVar3 == '\0') && (*(char **)(in_stack_00000010 + 0x7c) != "prop_door*")) {
      cVar3 = CBaseEntity::ClassMatchesComplex(in_stack_00000010,"prop_door*");
      if ((cVar3 == '\0') && (*(char **)(in_stack_00000010 + 0x7c) != "func_door*")) {
        cVar3 = CBaseEntity::ClassMatchesComplex(in_stack_00000010,"func_door*");
        if (cVar3 == '\0') {
          uVar6 = 0;
          ppuVar11 = &CPhysicsProp::typeinfo;
          ppuVar10 = &CBaseEntity::typeinfo;
          local_40 = (CPhysicsProp *)__dynamic_cast();
          if (local_40 == (CPhysicsProp *)0x0) {
            uVar6 = 0;
            ppuVar11 = &CDynamicProp::typeinfo;
            ppuVar10 = &CBaseEntity::typeinfo;
            iVar4 = __dynamic_cast();
            if (iVar4 != 0) {
              uVar2 = *(uint *)(in_stack_00000010 + 0x180);
              if ((((uVar2 != 0xffffffff) &&
                   (puVar7 = g_pEntityList + (uVar2 & 0xfff) * 0x10,
                   puVar7 != (undefined *)0xfffffffc)) && (*(uint *)(puVar7 + 8) == uVar2 >> 0xc))
                 && (*(int *)(puVar7 + 4) != 0)) {
                uVar6 = 0;
                ppuVar11 = &CPhysicsProp::typeinfo;
                ppuVar10 = &CBaseEntity::typeinfo;
                local_40 = (CPhysicsProp *)
                           __dynamic_cast(*(int *)(puVar7 + 4),&CBaseEntity::typeinfo,
                                          &CPhysicsProp::typeinfo,0);
              }
            }
          }
          iVar4 = CBaseEntity::GetTeamNumber((CBaseEntity *)param_3);
          if (iVar4 == 3) {
            iVar4 = (**(code **)(*(int *)param_3 + 0x544))(param_3,ppuVar10,ppuVar11,uVar6);
            if ((iVar4 == 8) && (local_40 != (CPhysicsProp *)0x0)) {
              lVar9 = (longdouble)CPhysicsProp::GetMass(local_40);
              if (25.0 <= (float)lVar9) {
                (**(code **)(*(int *)param_3 + 0x938))(param_3,0xbf800000);
              }
              else {
                piVar5 = *(int **)(local_40 + 0x238);
                if (piVar5 != (int *)0x0) {
                  if (((byte)param_3[0x14d] & 8) != 0) {
                    CBaseEntity::CalcAbsolutePosition((CBaseEntity *)param_3);
                  }
                  if (((byte)in_stack_00000010[0x14d] & 8) != 0) {
                    CBaseEntity::CalcAbsolutePosition(in_stack_00000010);
                  }
                  local_2c = 0.0;
                  local_34 = *(float *)(in_stack_00000010 + 0x2e0) - *(float *)(param_3 + 0x2e0);
                  local_30 = *(float *)(in_stack_00000010 + 0x2e4) - *(float *)(param_3 + 0x2e4);
                  VectorNormalize((Vector *)&local_34);
                  local_2c = (float)lVar9 * 4000.0;
                  local_34 = local_34 * local_2c;
                  local_30 = local_30 * local_2c;
                  local_2c = local_2c * 0.4;
                  (**(code **)(*piVar5 + 0xf4))(piVar5,(Vector *)&local_34);
                  iVar4 = rand();
                  local_28 = (float)iVar4 * 6.103702e-05 - 1.0;
                  iVar4 = rand();
                  local_24 = (float)iVar4 * 6.103702e-05 - 1.0;
                  iVar4 = rand();
                  local_20 = (float)iVar4 * 6.103702e-05 - 1.0;
                  VectorNormalize((Vector *)&local_28);
                  local_28 = local_28 * 1000.0;
                  local_24 = local_24 * 1000.0;
                  local_20 = local_20 * 1000.0;
                  CBaseEntity::ApplyLocalAngularVelocityImpulse
                            ((CBaseEntity *)local_40,(Vector *)&local_28);
                }
              }
              goto LAB_00aeec40;
            }
          }
          cVar3 = CBasePlayer::IsOnLadder((CBasePlayer *)param_3);
          if (cVar3 == '\0') {
            iVar4 = (**(code **)(*(int *)in_stack_00000010 + 0x144))();
            if (iVar4 != 0) {
              piVar5 = (int *)(**(code **)(*(int *)param_3 + 0x9b4))(param_3);
              pcVar1 = *(code **)(*piVar5 + 0xc0);
              uVar6 = (**(code **)(*(int *)in_stack_00000010 + 0x288))();
              (*pcVar1)(piVar5,uVar6,2,0x3f800000,
                        &OnContact(Tank*,CBaseEntity*,CGameTrace*)::pressFireButton,
                        "Looking at actor I\'m trying to attack",1,0x3e800000);
            }
          }
          else {
            cVar3 = (**(code **)(*(int *)in_stack_00000010 + 0x16c))();
            if (cVar3 != '\0') {
              cVar3 = CTerrorPlayer::IsDominatedBySpecialInfected
                                ((CTerrorPlayer *)in_stack_00000010);
              if ((cVar3 == '\0') && (((byte)in_stack_00000010[0x150] & 0x60) == 0)) {
                if (((byte)param_3[0x14d] & 8) != 0) {
                  CBaseEntity::CalcAbsolutePosition((CBaseEntity *)param_3);
                }
                if (((byte)in_stack_00000010[0x14d] & 8) != 0) {
                  CBaseEntity::CalcAbsolutePosition(in_stack_00000010);
                }
                local_28 = *(float *)(in_stack_00000010 + 0x2e0) - *(float *)(param_3 + 0x2e0);
                local_24 = *(float *)(in_stack_00000010 + 0x2e4) - *(float *)(param_3 + 0x2e4);
                local_20 = *(float *)(in_stack_00000010 + 0x2e8) - *(float *)(param_3 + 0x2e8);
                if (in_stack_00000010[0x186] == (CBaseEntity)0x9) {
                  CBaseEntity::SetMoveType();
                  local_28 = *(float *)(in_stack_00000010 + 0x2000);
                  local_24 = *(float *)(in_stack_00000010 + 0x2004);
                }
                local_20 = 0.0;
                VectorNormalize((Vector *)&local_28);
                local_20 = 160.0;
                local_28 = local_28 * 400.0;
                local_24 = local_24 * 400.0;
                CBaseEntity::SetAbsVelocity(in_stack_00000010,(Vector *)&local_28);
              }
            }
          }
          goto LAB_00aeec40;
        }
      }
    }
    if ((in_stack_00000014 == 0) ||
       (*(float *)(in_stack_00000014 + 0x20) <= 0.8 && *(float *)(in_stack_00000014 + 0x20) != 0.8))
    {
      piVar5 = (int *)(**(code **)(*(int *)param_3 + 0x9b4))(param_3);
      pcVar1 = *(code **)(*piVar5 + 0xc0);
      uVar6 = (**(code **)(*(int *)in_stack_00000010 + 0x288))();
      (*pcVar1)(piVar5,uVar6,3,0x3f800000,
                &OnContact(Tank*,CBaseEntity*,CGameTrace*)::pressFireButton,
                "Looking at door I\'m trying to break",1,0x3e800000);
    }
  }
LAB_00aeec40:
  *(undefined4 *)param_1 = 0;
  *(undefined4 *)(param_1 + 4) = 0;
  *(undefined4 *)(param_1 + 8) = 0;
  *(undefined4 *)(param_1 + 0xc) = 1;
  return param_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)