L L4D2node

CPointTemplate::AddTemplate

0x007e0e30 · 451 bytes · __thiscall

_ZN14CPointTemplate11AddTemplateEP11CBaseEntityPKci

Decompiled

undefined (4 params)

/* CPointTemplate::AddTemplate(CBaseEntity*, char const*, int) */

void __thiscall
CPointTemplate::AddTemplate(CPointTemplate *this,CBaseEntity *param_1,char *param_2,int param_3)

{
  int *piVar1;
  undefined1 *puVar2;
  int iVar3;
  int *piVar4;
  byte bVar5;
  VMatrix local_160 [64];
  VMatrix local_120 [64];
  VMatrix local_e0 [64];
  VMatrix local_a0 [64];
  int local_60;
  VMatrix local_5c [76];
  
  bVar5 = 0;
  local_60 = Templates_Add(param_1,param_2,param_3,-1);
  if (local_60 != -1) {
    if (((byte)this[0x14d] & 8) != 0) {
      CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
      if (((byte)this[0x14d] & 8) != 0) {
        CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
      }
    }
    VMatrix::SetupMatrixOrgAngles(local_160,(Vector *)(this + 0x2e0),(QAngle *)(this + 0x37c));
    VMatrix::InverseTR(local_160,local_120);
    if (((byte)param_1[0x14d] & 8) != 0) {
      CBaseEntity::CalcAbsolutePosition(param_1);
      if (((byte)param_1[0x14d] & 8) != 0) {
        CBaseEntity::CalcAbsolutePosition(param_1);
      }
    }
    VMatrix::SetupMatrixOrgAngles(local_e0,(Vector *)(param_1 + 0x2e0),(QAngle *)(param_1 + 0x37c));
    MatrixMultiply(local_120,local_e0,local_a0);
    VMatrix::operator=(local_5c,local_a0);
    iVar3 = *(int *)(this + 0x4a0);
    CUtlVector<template_t,CUtlMemory<template_t,int>>::GrowVector
              ((CUtlVector<template_t,CUtlMemory<template_t,int>> *)(this + 0x494),1);
    CUtlVector<template_t,CUtlMemory<template_t,int>>::ShiftElementsRight
              ((CUtlVector<template_t,CUtlMemory<template_t,int>> *)(this + 0x494),iVar3,1);
    piVar1 = (int *)(iVar3 * 0x44 + *(int *)(this + 0x494));
    if (piVar1 != (int *)0x0) {
      piVar4 = &local_60;
      for (iVar3 = 0x11; iVar3 != 0; iVar3 = iVar3 + -1) {
        *piVar1 = *piVar4;
        piVar4 = piVar4 + (uint)bVar5 * -2 + 1;
        piVar1 = piVar1 + (uint)bVar5 * -2 + 1;
      }
    }
    return;
  }
  puVar2 = &DAT_00d539c2;
  if (*(undefined1 **)(this + 0x154) != (undefined1 *)0x0) {
    puVar2 = *(undefined1 **)(this + 0x154);
  }
  Warning("point_template %s failed to add template.\n",puVar2);
  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)