L L4D2node

CBasePlayer::WaterMove

0x007aced0 · 735 bytes · __thiscall

_ZN11CBasePlayer9WaterMoveEv

Decompiled

undefined (1 param)

/* CBasePlayer::WaterMove() */

void __thiscall CBasePlayer::WaterMove(CBasePlayer *this)

{
  uint uVar1;
  code *pcVar2;
  int *piVar3;
  int iVar4;
  char cVar5;
  int iVar6;
  CBaseEntity *pCVar7;
  CBaseEntity *pCVar8;
  undefined *puVar9;
  byte *pbVar10;
  float fVar11;
  float local_80;
  CTakeDamageInfo local_7c [108];
  
  if ((this[0x186] == (CBasePlayer)0x8) &&
     ((((uVar1 = *(uint *)(this + 0x188), uVar1 == 0xffffffff ||
        (puVar9 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar9 == (undefined *)0xfffffffc)) ||
       (*(uint *)(puVar9 + 8) != uVar1 >> 0xc)) || (*(int *)(puVar9 + 4) == 0)))) {
    *(float *)(this + 0x1f74) = *(float *)(gpGlobals + 0xc) + 12.0;
    return;
  }
  if ((*(int *)(this + 0x100) < 0) ||
     (cVar5 = (**(code **)(*(int *)this + 300))(this), cVar5 == '\0')) goto LAB_007acfa0;
  if ((this[0x253] != (CBasePlayer)0x3) ||
     (cVar5 = (**(code **)(*(int *)this + 0x6d0))(this), cVar5 != '\0')) {
    fVar11 = *(float *)(gpGlobals + 0xc);
    if (*(float *)(this + 0x1f74) <= fVar11 && fVar11 != *(float *)(this + 0x1f74)) {
      CBaseEntity::EmitSound((CBaseEntity *)this,"Player.DrownStart",0.0,(float *)0x0);
      fVar11 = *(float *)(gpGlobals + 0xc);
    }
    *(undefined4 *)(this + 0x202c) = 2;
    *(float *)(this + 0x1f74) = fVar11 + 12.0;
    if (*(int *)(this + 0x1d90) < *(int *)(this + 0x1d8c)) {
      this[0x1da0] = (CBasePlayer)0x0;
      *(uint *)(this + 0x1d54) = *(uint *)(this + 0x1d54) & 0xffffbfff | 0x80000;
    }
    goto LAB_007acfa0;
  }
  uVar1 = *(uint *)(this + 0x1d54);
  this[0x1da0] = (CBasePlayer)0x0;
  *(uint *)(this + 0x1d54) = uVar1 & 0xfff7ffff;
  iVar4 = gpGlobals;
  fVar11 = *(float *)(gpGlobals + 0xc);
  if ((fVar11 < *(float *)(this + 0x1f74) || fVar11 == *(float *)(this + 0x1f74)) ||
     (((byte)this[0x151] & 0x40) != 0)) {
    *(uint *)(this + 0x1d54) = uVar1 & 0xfff7bfff;
    goto LAB_007acfa0;
  }
  if (fVar11 < *(float *)(this + 0x1f78) || fVar11 == *(float *)(this + 0x1f78)) goto LAB_007acfa0;
  iVar6 = *(int *)(this + 0x202c) + 1;
  if (iVar6 < 6) {
    local_80 = (float)iVar6;
    *(int *)(this + 0x202c) = iVar6;
  }
  else {
    *(undefined4 *)(this + 0x202c) = 5;
    local_80 = 5.0;
  }
  pbVar10 = *(byte **)(iVar4 + 0x58);
  pcVar2 = *(code **)(*(int *)this + 0x124);
  if (pbVar10 == (byte *)0x0) {
    pCVar7 = (CBaseEntity *)0x0;
    pCVar8 = (CBaseEntity *)0x0;
  }
  else {
    if (((*pbVar10 & 2) == 0) && (piVar3 = *(int **)(pbVar10 + 0xc), piVar3 != (int *)0x0)) {
      pCVar7 = (CBaseEntity *)(**(code **)(*piVar3 + 0x18))(piVar3);
      pbVar10 = *(byte **)(gpGlobals + 0x58);
      if (pbVar10 != (byte *)0x0) goto LAB_007ad0d2;
    }
    else {
      pCVar7 = (CBaseEntity *)0x0;
LAB_007ad0d2:
      if (((*pbVar10 & 2) == 0) && (piVar3 = *(int **)(pbVar10 + 0xc), piVar3 != (int *)0x0)) {
        pCVar8 = (CBaseEntity *)(**(code **)(*piVar3 + 0x18))(piVar3);
        goto LAB_007ad0ee;
      }
    }
    pCVar8 = (CBaseEntity *)0x0;
  }
LAB_007ad0ee:
  CTakeDamageInfo::CTakeDamageInfo(local_7c,pCVar8,pCVar7,local_80,0x4000,0);
  (*pcVar2)(this,local_7c);
  *(float *)(this + 0x1f78) = *(float *)(gpGlobals + 0xc) + 1.0;
  cVar5 = (**(code **)(*(int *)this + 0x6d4))(this);
  if (cVar5 != '\0') {
    *(int *)(this + 0x1d8c) = *(int *)(this + 0x1d8c) + *(int *)(this + 0x202c);
  }
LAB_007acfa0:
  UpdateUnderwaterState(this);
  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)