L L4D2node

CNarrowEscapeAwardTemplate::FireGameEvent

0x0085a360 · 837 bytes · __thiscall

_ZN26CNarrowEscapeAwardTemplate13FireGameEventEP10IGameEvent

Decompiled

undefined (2 params)

/* CNarrowEscapeAwardTemplate::FireGameEvent(IGameEvent*) */

void __thiscall
CNarrowEscapeAwardTemplate::FireGameEvent(CNarrowEscapeAwardTemplate *this,IGameEvent *param_1)

{
  char cVar1;
  char *pcVar2;
  CBaseEntity *this_00;
  int iVar3;
  CBaseEntity *pCVar4;
  int iVar5;
  uint uVar6;
  Infected *pIVar7;
  int *piVar8;
  longdouble lVar9;
  int local_34;
  int local_30;
  int local_28;
  char local_24;
  int local_20;
  
  pcVar2 = (char *)(**(code **)(*(int *)param_1 + 8))(param_1);
  if ((((pcVar2 != (char *)0x0) &&
       (this_00 = (CBaseEntity *)CAwardTemplate::GetOwner((CAwardTemplate *)this),
       this_00 != (CBaseEntity *)0x0)) && (iVar3 = CBaseEntity::GetTeamNumber(this_00), iVar3 == 2))
     && ((pcVar2 == "map_transition" || (iVar3 = _V_stricmp(pcVar2,"map_transition"), iVar3 == 0))))
  {
    local_28 = 100;
    local_24 = '\0';
    local_20 = 99999;
    ForEachSurvivor<NarrowEscapeSurvivorConsideration>
              ((NarrowEscapeSurvivorConsideration *)&local_28);
    if (local_28 < *(int *)(SurvivorLimpHealth._28_4_ + 0x30)) {
      local_34 = 0;
      local_30 = 0;
      if (0 < *(int *)(gpGlobals + 0x14)) {
        iVar3 = 1;
        do {
          pCVar4 = (CBaseEntity *)UTIL_PlayerByIndex(iVar3);
          if ((((pCVar4 != (CBaseEntity *)0x0) && (*(int *)(pCVar4 + 0x30) != 0)) &&
              ((*(int *)(pCVar4 + 0x30) - *(int *)(gpGlobals + 0x58) >> 4 != 0 &&
               (((cVar1 = (**(code **)(*(int *)pCVar4 + 0x16c))(pCVar4), cVar1 != '\0' &&
                 (*(int *)(pCVar4 + 0x1f6c) != 2)) &&
                (iVar5 = (**(code **)(*(int *)pCVar4 + 0x148))(pCVar4), iVar5 == 0)))))) &&
             (iVar5 = CBaseEntity::GetTeamNumber(pCVar4), iVar5 == 3)) {
            cVar1 = (**(code **)(*(int *)pCVar4 + 0x16c))(pCVar4);
            if (cVar1 == '\0') {
              pIVar7 = (Infected *)
                       __dynamic_cast(pCVar4,&CBaseCombatCharacter::typeinfo,&Infected::typeinfo,0);
              if (pIVar7 != (Infected *)0x0) {
                piVar8 = (int *)(**(code **)(*(int *)pIVar7 + 0x594))(pIVar7);
                iVar5 = (**(code **)(*piVar8 + 0x110))(piVar8);
                if (iVar5 == 2) {
                  local_30 = local_30 + 1;
                  lVar9 = (longdouble)Infected::GetFlowDistance(pIVar7);
                  if ((float)local_34 < (float)lVar9) {
                    lVar9 = (longdouble)Infected::GetFlowDistance(pIVar7);
                    local_34 = (int)lVar9;
                  }
                }
              }
            }
            else {
              local_30 = local_30 + 1;
            }
          }
          iVar3 = iVar3 + 1;
        } while (iVar3 <= *(int *)(gpGlobals + 0x14));
      }
      iVar3 = TheNextBots();
      uVar6 = (uint)*(ushort *)(iVar3 + 0x10);
      if (uVar6 != 0xffff) {
        iVar5 = *(int *)(iVar3 + 4);
        do {
          piVar8 = *(int **)(iVar5 + uVar6 * 8);
          pCVar4 = (CBaseEntity *)(**(code **)(*piVar8 + 0xb4))(piVar8);
          iVar5 = CBaseEntity::GetTeamNumber(pCVar4);
          if ((iVar5 == 3) && (pCVar4 != (CBaseEntity *)0x0)) {
            cVar1 = (**(code **)(*(int *)pCVar4 + 0x16c))(pCVar4);
            if (cVar1 == '\0') {
              pIVar7 = (Infected *)
                       __dynamic_cast(pCVar4,&CBaseCombatCharacter::typeinfo,&Infected::typeinfo,0);
              if (pIVar7 != (Infected *)0x0) {
                piVar8 = (int *)(**(code **)(*(int *)pIVar7 + 0x594))(pIVar7);
                iVar5 = (**(code **)(*piVar8 + 0x110))(piVar8);
                if (iVar5 == 2) {
                  local_30 = local_30 + 1;
                  lVar9 = (longdouble)Infected::GetFlowDistance(pIVar7);
                  if ((float)local_34 < (float)lVar9) {
                    lVar9 = (longdouble)Infected::GetFlowDistance(pIVar7);
                    local_34 = (int)lVar9;
                  }
                }
              }
            }
            else {
              local_30 = local_30 + 1;
            }
          }
          iVar5 = *(int *)(iVar3 + 4);
          uVar6 = (uint)*(ushort *)(iVar5 + 6 + uVar6 * 8);
        } while (uVar6 != 0xffff);
      }
      if ((4 < local_30) && (local_20 - local_34 < 0xfb)) {
        if (local_24 != '\0') {
          cVar1 = (**(code **)(*(int *)this_00 + 300))(this_00);
          if (cVar1 != '\0') {
            (**(code **)(*(int *)this + 0x14))(this,0x19,0);
            return;
          }
          if (local_24 != '\0') {
            return;
          }
        }
        (**(code **)(*(int *)this + 0x14))(this,0x4d,0);
      }
    }
  }
  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)