AddEmptyMesh
0x0013aad0 · 1921 bytes · __cdecl
_Z12AddEmptyMeshP7model_tP10CDispGroupPK11ddispinfo_tPiiii
Decompiled
undefined (7 params)
/* AddEmptyMesh(model_t*, CDispGroup*, ddispinfo_t const*, int*, int, int, int) */
void AddEmptyMesh(model_t *param_1,CDispGroup *param_2,ddispinfo_t *param_3,int *param_4,int param_5
,int param_6,int param_7)
{
CUtlVector<CDispInfo*,CUtlMemory<CDispInfo*,int>> *pCVar1;
ushort *puVar2;
int iVar3;
int iVar4;
void *pvVar5;
CGroupMesh *pCVar6;
char cVar7;
int *piVar8;
int iVar9;
undefined4 *puVar10;
undefined4 *puVar11;
int iVar12;
int *piVar13;
int *piVar14;
int iVar15;
byte bVar16;
undefined8 uVar17;
int local_22c;
int local_220;
CGroupMesh *local_210;
int local_20c;
int local_208;
int local_204 [39];
int local_168;
int local_164;
int local_160;
int local_154;
int *local_150;
undefined4 local_14c;
char local_148;
int local_144;
int local_138;
int *local_134;
int local_130;
int local_12c;
int local_128;
int local_124;
undefined4 local_120;
undefined4 local_11c;
undefined4 local_118;
undefined1 local_114;
int local_110 [3];
int local_104;
int local_100;
int local_f8;
int local_f4;
int local_f0;
int local_ec;
int local_e8;
int local_e4;
int local_e0;
int local_dc;
undefined4 local_c4;
uint local_c0;
int local_bc;
int local_b0;
int local_ac;
undefined4 local_a4 [8];
undefined4 local_84 [6];
int *local_6c;
undefined1 local_68;
int local_64;
int local_60;
int local_5c;
int local_58;
int local_54;
int local_50;
int local_4c [8];
undefined4 local_2c;
int local_28;
int local_24;
bVar16 = 0;
piVar8 = (int *)(**(code **)(*materials + 0x180))(materials);
if (piVar8 != (int *)0x0) {
/* try { // try from 0013ab01 to 0013ab03 has its CatchHandler @ 0013b2c1 */
(**(code **)(*piVar8 + 8))(piVar8);
}
/* try { // try from 0013ab0b to 0013abe5 has its CatchHandler @ 0013b2bd */
local_210 = operator_new(0x48);
*(int *)(local_210 + 4) = 0;
*(int *)(local_210 + 8) = 0;
*(int *)(local_210 + 0xc) = 0;
*(int *)(local_210 + 0x10) = 0;
*(int *)(local_210 + 0x14) = 0;
*(int *)(local_210 + 0x18) = 0;
*(int *)(local_210 + 0x1c) = 0;
*(int *)(local_210 + 0x20) = 0;
*(int *)(local_210 + 0x24) = 0;
*(int *)(local_210 + 0x28) = 0;
*(int *)(local_210 + 0x2c) = 0;
*(int *)(local_210 + 0x30) = 0;
*(int *)(local_210 + 0x34) = 0;
*(int *)(local_210 + 0x38) = 0;
*(int *)(local_210 + 0x3c) = 0;
CUtlVector<CGroupMesh*,CUtlMemory<CGroupMesh*,int>>::InsertBefore
((CUtlVector<CGroupMesh*,CUtlMemory<CGroupMesh*,int>> *)(param_2 + 8),
*(int *)(param_2 + 0x14),&local_210);
uVar17 = (**(code **)(**(int **)(param_2 + 4) + 0x50))(*(int **)(param_2 + 4));
pCVar6 = local_210;
iVar9 = (**(code **)(*piVar8 + 0xe0))
(piVar8,(uint)uVar17 & 0xfffffbff,(int)((ulonglong)uVar17 >> 0x20),
"Displacement Verts",0,0);
*(int *)pCVar6 = iVar9;
*(CDispGroup **)(local_210 + 0x44) = param_2;
*(int *)(local_210 + 0x40) = 0;
local_148 = '\0';
local_134 = (int *)0x0;
local_130 = 0;
local_12c = 0;
local_124 = 0;
local_120 = 0;
local_11c = 0xffffffff;
local_118 = 0;
local_6c = (int *)0x0;
local_28 = -1;
local_24 = 0;
local_60 = 0;
local_5c = 0;
local_64 = 0;
local_2c = 0;
local_c4 = 0xffffffff;
piVar13 = *(int **)local_210;
local_14c = 2;
/* try { // try from 0013acaf to 0013aebc has its CatchHandler @ 0013b263 */
local_150 = piVar13;
(**(code **)(*piVar13 + 0x30))(piVar13,2);
(**(code **)(*local_150 + 0x4c))(local_150,param_6,param_7,local_204);
local_6c = piVar13;
local_134 = piVar13 + 1;
local_12c = 0;
local_114 = 0;
local_124 = 0;
local_130 = param_7;
local_64 = param_6;
local_60 = 0;
local_68 = 0;
local_128 = local_168;
local_144 = local_160;
local_138 = local_154;
piVar13 = local_204;
piVar14 = local_110;
for (iVar9 = 0x29; iVar9 != 0; iVar9 = iVar9 + -1) {
*piVar14 = *piVar13;
piVar13 = piVar13 + (uint)bVar16 * -2 + 1;
piVar14 = piVar14 + (uint)bVar16 * -2 + 1;
}
local_c0 = ~-(uint)(local_c0 == 0) & 2;
if (local_28 == -1) {
local_2c = 0;
local_28 = local_164;
local_24 = local_168;
}
local_5c = 0;
local_58 = local_bc;
local_54 = local_b0;
puVar10 = local_a4;
do {
puVar11 = puVar10 + 1;
puVar10[0x16] = *puVar10;
puVar10 = puVar11;
} while (puVar11 != local_84);
local_22c = local_154 * param_7;
if (0 < local_22c) {
local_12c = local_22c;
}
local_5c = param_6;
iVar9 = 0;
if (0 < param_6) {
local_60 = param_6;
iVar9 = param_6;
}
local_58 = local_bc + local_110[0] * param_6;
local_54 = local_b0 + local_104 * param_6;
local_4c[0] = local_4c[0] + local_f8 * param_6;
local_4c[1] = local_4c[1] + local_f4 * param_6;
local_4c[2] = local_4c[2] + local_f0 * param_6;
local_4c[3] = local_4c[3] + local_ec * param_6;
local_4c[4] = local_4c[4] + local_e8 * param_6;
local_4c[5] = local_4c[5] + local_e4 * param_6;
local_4c[6] = local_4c[6] + local_e0 * param_6;
local_4c[7] = local_4c[7] + local_dc * param_6;
local_50 = param_6 * local_100 + local_ac;
local_124 = local_22c;
if (local_148 == '\0') goto LAB_0013ae9d;
switch(local_14c) {
case 4:
iVar15 = iVar9 * 2 + -2;
break;
case 5:
iVar15 = iVar9 * 2;
break;
case 6:
iVar15 = iVar9 * 3 + -6;
break;
case 7:
iVar15 = iVar9 * 6 >> 2;
break;
default:
iVar15 = iVar9;
break;
case 9:
iVar15 = 0;
}
if (local_154 == 0) goto LAB_0013ae9d;
if (param_7 - local_22c < iVar15) {
iVar15 = param_7 - local_22c;
}
if (iVar15 == 0) goto LAB_0013ae9d;
puVar2 = (ushort *)(local_160 + local_22c * 2);
switch(local_14c) {
case 0:
case 9:
goto switchD_0013b143_caseD_0;
default:
GenerateSequentialIndexBuffer(puVar2,iVar15,local_168);
break;
case 4:
GenerateLineStripIndexBuffer(puVar2,iVar15,local_168);
break;
case 5:
GenerateLineLoopIndexBuffer(puVar2,iVar15,local_168);
break;
case 6:
GeneratePolygonIndexBuffer(puVar2,(int)puVar2,iVar15);
break;
case 7:
GenerateQuadIndexBuffer(puVar2,iVar15,local_168);
}
local_22c = local_124;
iVar9 = local_60;
switchD_0013b143_caseD_0:
local_124 = local_138 * iVar15 + local_22c;
if (local_12c < local_124) {
local_12c = local_124;
}
LAB_0013ae9d:
(**(code **)(*local_150 + 0x58))(local_150,iVar9,local_12c,local_204);
local_134 = (int *)0x0;
local_64 = 0;
local_130 = 0;
local_6c = (int *)0x0;
local_c4 = 0xffffffff;
local_150 = (int *)0x0;
*(int *)(local_210 + 0x10) = 0;
if (param_5 == 0) {
*(int *)(local_210 + 0x38) = 0;
*(int *)(local_210 + 0x24) = 0;
}
else {
pCVar1 = (CUtlVector<CDispInfo*,CUtlMemory<CDispInfo*,int>> *)(local_210 + 4);
CUtlVector<CDispInfo*,CUtlMemory<CDispInfo*,int>>::GrowVector(pCVar1,param_5);
/* try { // try from 0013afc4 to 0013b25d has its CatchHandler @ 0013b263 */
CUtlVector<CDispInfo*,CUtlMemory<CDispInfo*,int>>::ShiftElementsRight(pCVar1,0,param_5);
pCVar6 = local_210;
*(int *)(local_210 + 0x38) = 0;
CUtlVector<CPrimList,CUtlMemory<CPrimList,int>>::GrowVector
((CUtlVector<CPrimList,CUtlMemory<CPrimList,int>> *)(local_210 + 0x2c),param_5);
iVar9 = *(int *)(pCVar6 + 0x38) - param_5;
if ((0 < iVar9) && (0 < param_5)) {
pvVar5 = *(void **)(pCVar6 + 0x2c);
_V_memmove((void *)((int)pvVar5 + param_5 * 8),pvVar5,iVar9 * 8);
}
*(int *)(local_210 + 0x24) = 0;
pCVar1 = (CUtlVector<CDispInfo*,CUtlMemory<CDispInfo*,int>> *)(local_210 + 0x18);
CUtlVector<CDispInfo*,CUtlMemory<CDispInfo*,int>>::GrowVector(pCVar1,param_5);
CUtlVector<CDispInfo*,CUtlMemory<CDispInfo*,int>>::ShiftElementsRight(pCVar1,0,param_5);
if (0 < param_5) {
local_220 = 0;
iVar9 = 0;
iVar15 = 0;
do {
iVar3 = iVar9 * 4;
iVar12 = DispInfo_IndexArray(*(void **)(*(int *)(param_1 + 0x134) + 0x6c),param_4[iVar9]);
iVar4 = param_4[iVar9];
*(int *)(iVar12 + 0x24) = iVar15;
*(CGroupMesh **)(iVar12 + 0x28) = local_210;
*(int *)(iVar12 + 0x2c) = local_220;
CalcMaxNumVertsAndIndices(*(int *)(param_3 + iVar4 * 0xb0 + 0x14),&local_20c,&local_208);
iVar9 = iVar9 + 1;
iVar15 = iVar15 + local_208;
local_220 = local_220 + local_20c;
*(int *)(*(int *)(local_210 + 4) + iVar3) = iVar12;
} while (iVar9 != param_5);
}
}
if ((local_6c != (int *)0x0) && (cVar7 = (**(code **)(*local_6c + 0x10))(local_6c), cVar7 != '\0')
) {
(**(code **)(*local_6c + 0x18))(local_6c);
}
if ((local_134 != (int *)0x0) &&
(cVar7 = (**(code **)(*local_134 + 0x10))(local_134), cVar7 != '\0')) {
(**(code **)(*local_134 + 0x18))(local_134);
}
if ((piVar8 != (int *)0x0) && ((**(code **)(*piVar8 + 0xc))(piVar8), piVar8 != (int *)0x0)) {
(**(code **)(*piVar8 + 4))(piVar8);
}
return;
}
SourceMod gamedata
paste intoaddons/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.
Signatures + Functions block. The plugin uses
DHookCreateFromConf - DHooks reads return type, this-type,
calling convention, and argument types straight from the gamedata. Less
boilerplate in the plugin, types travel with the gamedata.
Gamedata KeyValues
DHooks plugin example
Type inference is best-effort from the C signature - sanity-check the DHooks types before shipping.