L L4D2node

SavedWeapon::SavedWeapon

0x00868a50 · 789 bytes · __thiscall

_ZN11SavedWeaponC1EP13CWeaponCSBase

Decompiled

undefined (2 params)

/* SavedWeapon::SavedWeapon(CWeaponCSBase*) */

void __thiscall SavedWeapon::SavedWeapon(SavedWeapon *this,CWeaponCSBase *param_1)

{
  KeyValues *this_00;
  char *pcVar1;
  int in_GS_OFFSET;
  uint in_stack_ffffff98;
  Color local_24;
  undefined1 local_23;
  undefined1 local_22;
  undefined1 local_21;
  int local_20;
  
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  *(undefined ***)this = &PTR__SavedEntity_00cda8a0;
  this_00 = KeyValues::operator_new((KeyValues *)0x2c,in_stack_ffffff98);
                    /* try { // try from 00868a99 to 00868a9d has its CatchHandler @ 00868d75 */
  KeyValues::KeyValues(this_00,"item",(IKeyValuesSystem *)0x0,false);
  *(KeyValues **)(this + 4) = this_00;
  pcVar1 = "";
  if (*(char **)(param_1 + 0x7c) != (char *)0x0) {
    pcVar1 = *(char **)(param_1 + 0x7c);
  }
  KeyValues::SetString(this_00,"classname",pcVar1);
  if (((byte)param_1[0x14d] & 8) != 0) {
    CBaseEntity::CalcAbsolutePosition((CBaseEntity *)param_1);
  }
  pcVar1 = (char *)UTIL_VarArgs("%f %f %f",(double)*(float *)(param_1 + 0x2e0),
                                (double)*(float *)(param_1 + 0x2e4),
                                (double)*(float *)(param_1 + 0x2e8));
  KeyValues::SetString(*(KeyValues **)(this + 4),"pos",pcVar1);
  if (((byte)param_1[0x14d] & 8) != 0) {
    CBaseEntity::CalcAbsolutePosition((CBaseEntity *)param_1);
  }
  pcVar1 = (char *)UTIL_VarArgs("%f %f %f",(double)*(float *)(param_1 + 0x37c),
                                (double)*(float *)(param_1 + 0x380),
                                (double)*(float *)(param_1 + 900));
  KeyValues::SetString(*(KeyValues **)(this + 4),"angles",pcVar1);
  if (((byte)param_1[0x14d] & 0x10) != 0) {
    CBaseEntity::CalcAbsoluteVelocity((CBaseEntity *)param_1);
  }
  pcVar1 = (char *)UTIL_VarArgs("%f %f %f",(double)*(float *)(param_1 + 0x274),
                                (double)*(float *)(param_1 + 0x278),
                                (double)*(float *)(param_1 + 0x27c));
  KeyValues::SetString(*(KeyValues **)(this + 4),"vel",pcVar1);
  *(undefined ***)this = &PTR__SavedWeapon_00cda8e8;
                    /* try { // try from 00868d03 to 00868d51 has its CatchHandler @ 00868d87 */
  if (((((byte)param_1[0x14d] & 8) != 0) &&
      (CBaseEntity::CalcAbsolutePosition((CBaseEntity *)param_1), ((byte)param_1[0x14d] & 8) != 0))
     && (CBaseEntity::CalcAbsolutePosition((CBaseEntity *)param_1), ((byte)param_1[0x14d] & 8) != 0)
     ) {
    CBaseEntity::CalcAbsolutePosition((CBaseEntity *)param_1);
  }
  local_24 = 0;
  local_23 = 0xff;
  local_22 = 0xc0;
  local_21 = 0xff;
                    /* try { // try from 00868c78 to 00868cd3 has its CatchHandler @ 00868d87 */
  ConColorMsg(&local_24,"Saving %s at %.0f, %.0f, %.0f\n");
  KeyValues::SetInt(*(KeyValues **)(this + 4),"currentMagazine",*(int *)(param_1 + 0x1420));
  KeyValues::SetInt(*(KeyValues **)(this + 4),"extraAmmo",*(int *)(param_1 + 0x14fc));
  KeyValues::SetInt(*(KeyValues **)(this + 4),"weaponskin",*(int *)(param_1 + 0x458));
  if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {
    return;
  }
                    /* WARNING: Subroutine does not return */
  __stack_chk_fail();
}

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)