Map_VisMark
0x001a1090 · 2596 bytes · __cdecl
_Z11Map_VisMarkbP7model_t
Decompiled
undefined (2 params)
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* Map_VisMark(bool, model_t*) */
void Map_VisMark(bool param_1,model_t *param_2)
{
ushort uVar1;
bool bVar2;
undefined4 uVar3;
undefined4 uVar4;
char cVar5;
int iVar6;
int iVar7;
int iVar8;
int *piVar9;
int iVar10;
int *piVar11;
ushort *puVar12;
ushort *puVar13;
int iVar14;
uint uVar15;
ushort *puVar16;
int *piVar17;
int in_GS_OFFSET;
int local_2058;
int local_204c;
int local_2048;
int *local_2044;
int local_2040;
ushort local_2030;
ushort local_202e;
undefined4 local_202c;
undefined4 local_2028;
uint local_2020 [2048];
int local_20;
local_202c = 0;
local_2028 = 0;
local_20 = *(int *)(in_GS_OFFSET + 0x14);
if (_exit == 0) {
local_204c = 0;
}
else {
(**(code **)(_exit + 0x50))
(_exit,&local_202c,0,0,0,0,"/data/src/engine/./mod_vis.cpp",0xef,
&Map_VisMark(bool,model_t*)::tm_fmt,"(%s)%s","Unaccounted","Map_VisMark");
local_204c = _exit;
}
uVar4 = local_2028;
uVar3 = local_202c;
iVar8 = _DAT_0040b9d4;
/* try { // try from 001a1175 to 001a1179 has its CatchHandler @ 001a1ac9 */
if (((_DAT_0040b028 != 0) || (DAT_0040b02c == '\0')) &&
(iVar6 = ThreadGetCurrentId(), iVar8 == iVar6)) {
if ((char *)*_DAT_0040b030 != "Map_VisMark") {
/* try { // try from 001a1789 to 001a179a has its CatchHandler @ 001a1ac9 */
_DAT_0040b030 =
(int *)CVProfNode::GetSubNode((char *)_DAT_0040b030,0x2b929a,&DAT_00000001,0x2a054b);
}
CVProfNode::EnterScope();
DAT_0040b02c = '\0';
}
iVar8 = vis;
if (*(int *)(r_lockpvs._28_4_ + 0x30) == 0) {
local_2044 = &vis;
local_2040 = 1;
if (vis < 2) {
if (0 < vis) goto LAB_001a1224;
LAB_001a125d:
if ((!param_1) && (DAT_003a8f44 == iVar8)) goto LAB_001a15f5;
iVar6 = r_visframecount + 1;
DAT_003a8f44 = iVar8;
r_visframecount = iVar6;
if (0 < iVar8) goto LAB_001a128d;
LAB_001a12c9:
bVar2 = false;
}
else {
do {
iVar6 = local_2044[10];
iVar10 = local_2044[5];
piVar17 = local_2044;
iVar14 = local_2040;
while (iVar6 < iVar10) {
iVar7 = iVar14 + -1;
(&DAT_003a8f54)[iVar14 * 5] = iVar10;
iVar14 = iVar7;
if (iVar7 == 0) break;
iVar10 = *piVar17;
piVar17 = piVar17 + -5;
}
local_2040 = local_2040 + 1;
local_2044 = local_2044 + 5;
(&DAT_003a8f54)[iVar14 * 5] = iVar6;
} while (local_2040 != iVar8);
LAB_001a1224:
if (DAT_003a8f54 == DAT_003a8f58) {
iVar6 = 0;
piVar17 = &DAT_003a8f68;
do {
iVar6 = iVar6 + 1;
if (iVar6 == iVar8) goto LAB_001a125d;
iVar10 = *piVar17;
piVar11 = piVar17 + 1;
piVar17 = piVar17 + 5;
} while (iVar10 == *piVar11);
}
iVar6 = r_visframecount + 1;
LAB_001a128d:
DAT_003a8f44 = iVar8;
DAT_003a8f58 = DAT_003a8f54;
r_visframecount = iVar6;
if (DAT_003a8f54 != -1) {
iVar10 = 0;
piVar17 = &DAT_003a8f68;
do {
iVar10 = iVar10 + 1;
if (iVar10 == iVar8) goto LAB_001a12c9;
piVar17[1] = *piVar17;
iVar14 = *piVar17;
piVar17 = piVar17 + 5;
} while (iVar14 != -1);
}
bVar2 = true;
}
if (((*(int *)(r_novis._28_4_ + 0x30) == 0) && (!param_1)) && (!bVar2)) {
/* try { // try from 001a1310 to 001a1365 has its CatchHandler @ 001a1b0f */
CM_Vis((uchar *)&DAT_003a91c8,0x2000,DAT_003a8f54,0);
iVar6 = CM_NumClusters();
iVar8 = iVar6 + 0x3e;
if (-1 < iVar6 + 0x1f) {
iVar8 = iVar6 + 0x1f;
}
if (1 < vis) {
local_2040 = 1;
piVar17 = &DAT_003a8f68;
do {
CM_Vis((uchar *)local_2020,0x2000,*piVar17,0);
iVar6 = 0;
if (0 < iVar8 >> 5) {
do {
(&DAT_003a91c8)[iVar6] = (&DAT_003a91c8)[iVar6] | local_2020[iVar6];
iVar6 = iVar6 + 1;
} while (iVar6 != iVar8 >> 5);
}
local_2040 = local_2040 + 1;
piVar17 = piVar17 + 5;
} while (local_2040 < vis);
}
uVar15 = (uint)DAT_003a8f24;
if (uVar15 != 0xffff) {
LAB_001a13d2:
piVar17 = (int *)(uVar15 * 0xb0 + viscache);
if (vis != *piVar17) goto LAB_001a13bf;
if (0 < vis) {
if (piVar17[1] == DAT_003a8f54) {
piVar11 = &DAT_003a8f68;
iVar8 = 0;
do {
if (iVar8 + 1 == vis) goto LAB_001a1419;
iVar6 = *piVar11;
iVar10 = iVar8 + 2;
piVar11 = piVar11 + 5;
iVar8 = iVar8 + 1;
} while (piVar17[iVar10] == iVar6);
}
goto LAB_001a13bf;
}
LAB_001a1419:
CUtlLinkedList<VisCacheEntry,unsigned_short,false,unsigned_short,CUtlMemory<UtlLinkedListElem_t<VisCacheEntry,unsigned_short>,unsigned_short>>
::LinkAfter((CUtlLinkedList<VisCacheEntry,unsigned_short,false,unsigned_short,CUtlMemory<UtlLinkedListElem_t<VisCacheEntry,unsigned_short>,unsigned_short>>
*)&viscache,0xffff,(ushort)uVar15);
iVar10 = r_visframecount;
iVar8 = piVar17[0x24];
puVar16 = (ushort *)piVar17[0x21];
iVar6 = *(int *)(param_2 + 0x134);
if (7 < iVar8) {
uVar15 = iVar8 - 8U >> 3;
puVar13 = puVar16;
do {
puVar12 = puVar13 + 8;
*(int *)((uint)*puVar13 * 0x40 + *(int *)(iVar6 + 0x10) + 4) = iVar10;
*(int *)((uint)puVar13[1] * 0x40 + *(int *)(iVar6 + 0x10) + 4) = iVar10;
*(int *)((uint)puVar13[2] * 0x40 + *(int *)(iVar6 + 0x10) + 4) = iVar10;
*(int *)((uint)puVar13[3] * 0x40 + *(int *)(iVar6 + 0x10) + 4) = iVar10;
*(int *)((uint)puVar13[4] * 0x40 + *(int *)(iVar6 + 0x10) + 4) = iVar10;
*(int *)((uint)puVar13[5] * 0x40 + *(int *)(iVar6 + 0x10) + 4) = iVar10;
*(int *)((uint)puVar13[6] * 0x40 + *(int *)(iVar6 + 0x10) + 4) = iVar10;
*(int *)((uint)puVar13[7] * 0x40 + *(int *)(iVar6 + 0x10) + 4) = iVar10;
puVar13 = puVar12;
} while (puVar12 != puVar16 + uVar15 * 8 + 8);
puVar16 = puVar16 + (uVar15 + 1) * 8;
iVar8 = (iVar8 - 8U) + uVar15 * -8;
}
puVar13 = puVar16 + iVar8;
if (iVar8 != 0) {
do {
uVar1 = *puVar16;
puVar16 = puVar16 + 1;
*(int *)((uint)uVar1 * 0x40 + *(int *)(iVar6 + 0x10) + 4) = iVar10;
} while (puVar16 != puVar13);
}
iVar8 = piVar17[0x29];
puVar16 = (ushort *)piVar17[0x26];
if (7 < iVar8) {
uVar15 = iVar8 - 8U >> 3;
puVar13 = puVar16;
do {
puVar12 = puVar13 + 8;
*(int *)((uint)*puVar13 * 0x40 + *(int *)(iVar6 + 0x50) + 4) = iVar10;
*(int *)((uint)puVar13[1] * 0x40 + *(int *)(iVar6 + 0x50) + 4) = iVar10;
*(int *)((uint)puVar13[2] * 0x40 + *(int *)(iVar6 + 0x50) + 4) = iVar10;
*(int *)((uint)puVar13[3] * 0x40 + *(int *)(iVar6 + 0x50) + 4) = iVar10;
*(int *)((uint)puVar13[4] * 0x40 + *(int *)(iVar6 + 0x50) + 4) = iVar10;
*(int *)((uint)puVar13[5] * 0x40 + *(int *)(iVar6 + 0x50) + 4) = iVar10;
*(int *)((uint)puVar13[6] * 0x40 + *(int *)(iVar6 + 0x50) + 4) = iVar10;
*(int *)((uint)puVar13[7] * 0x40 + *(int *)(iVar6 + 0x50) + 4) = iVar10;
puVar13 = puVar12;
} while (puVar12 != puVar16 + uVar15 * 8 + 8);
puVar16 = puVar16 + (uVar15 + 1) * 8;
iVar8 = (iVar8 - 8U) + uVar15 * -8;
}
if (iVar8 != 0) {
puVar13 = puVar16 + iVar8;
do {
uVar1 = *puVar16;
puVar16 = puVar16 + 1;
*(int *)((uint)uVar1 * 0x40 + *(int *)(iVar6 + 0x50) + 4) = iVar10;
} while (puVar16 != puVar13);
}
goto LAB_001a15f5;
}
LAB_001a17be:
if (DAT_003a8f2a < 8) {
CUtlLinkedList<VisCacheEntry,unsigned_short,false,unsigned_short,CUtlMemory<UtlLinkedListElem_t<VisCacheEntry,unsigned_short>,unsigned_short>>
::InsertAfter((CUtlLinkedList<VisCacheEntry,unsigned_short,false,unsigned_short,CUtlMemory<UtlLinkedListElem_t<VisCacheEntry,unsigned_short>,unsigned_short>>
*)&viscache,0xffff);
}
else {
CUtlLinkedList<VisCacheEntry,unsigned_short,false,unsigned_short,CUtlMemory<UtlLinkedListElem_t<VisCacheEntry,unsigned_short>,unsigned_short>>
::LinkAfter((CUtlLinkedList<VisCacheEntry,unsigned_short,false,unsigned_short,CUtlMemory<UtlLinkedListElem_t<VisCacheEntry,unsigned_short>,unsigned_short>>
*)&viscache,0xffff,DAT_003a8f26);
}
iVar8 = *(int *)(param_2 + 0x134);
piVar17 = (int *)((uint)DAT_003a8f24 * 0xb0 + viscache);
if ((VisCache_Build(VisCacheEntry&,worldbrushdata_t_const&)::_counter == '\0') &&
(iVar6 = __cxa_guard_acquire(&VisCache_Build(VisCacheEntry&,worldbrushdata_t_const&)::
_counter), iVar6 != 0)) {
/* try { // try from 001a1a5e to 001a1a62 has its CatchHandler @ 001a1b61 */
VisCache_Build(VisCacheEntry&,worldbrushdata_t_const&)::_counter =
(int *)CVProfile::FindOrCreateCounter(&g_VProfCurrentProfile,"VisCache misses",0);
__cxa_guard_release(&VisCache_Build(VisCacheEntry&,worldbrushdata_t_const&)::_counter);
__cxa_atexit(CVProfCounter::~CVProfCounter,
&VisCache_Build(VisCacheEntry&,worldbrushdata_t_const&)::_counter,&__dso_handle
);
}
*VisCache_Build(VisCacheEntry&,worldbrushdata_t_const&)::_counter =
*VisCache_Build(VisCacheEntry&,worldbrushdata_t_const&)::_counter + 1;
*piVar17 = vis;
if (0 < vis) {
piVar9 = &DAT_003a8f54;
iVar6 = vis * 5;
piVar11 = piVar17;
do {
piVar11 = piVar11 + 1;
iVar10 = *piVar9;
piVar9 = piVar9 + 5;
*piVar11 = iVar10;
} while (piVar9 != &DAT_003a8f54 + iVar6);
}
piVar17[0x24] = 0;
piVar17[0x29] = 0;
iVar6 = r_visframecount;
local_2048 = 0;
local_2058 = *(int *)(iVar8 + 0x10);
if (0 < *(int *)(iVar8 + 0xc)) {
do {
uVar1 = *(ushort *)(local_2058 + 0x30);
if (((short)uVar1 != -1) &&
((*(byte *)((int)&DAT_003a91c8 + ((int)(short)uVar1 >> 3)) >> (uVar1 & 7) & 1) != 0)) {
*(int *)(local_2058 + 4) = iVar6;
local_202e = (ushort)local_2048;
/* try { // try from 001a1923 to 001a19ac has its CatchHandler @ 001a1b0f */
CUtlVector<unsigned_short,CUtlMemory<unsigned_short,int>>::InsertBefore
((CUtlVector<unsigned_short,CUtlMemory<unsigned_short,int>> *)(piVar17 + 0x21)
,piVar17[0x24],&local_202e);
iVar10 = *(int *)(local_2058 + 8);
if ((iVar10 != 0) && (iVar6 != *(int *)(iVar10 + 4))) {
do {
local_2030 = (ushort)(iVar10 - *(int *)(iVar8 + 0x50) >> 6);
CUtlVector<unsigned_short,CUtlMemory<unsigned_short,int>>::InsertBefore
((CUtlVector<unsigned_short,CUtlMemory<unsigned_short,int>> *)
(piVar17 + 0x26),piVar17[0x29],&local_2030);
*(int *)(iVar10 + 4) = iVar6;
iVar10 = *(int *)(iVar10 + 8);
if (iVar10 == 0) break;
} while (iVar6 != *(int *)(iVar10 + 4));
}
}
local_2048 = local_2048 + 1;
local_2058 = local_2058 + 0x40;
} while (local_2048 < *(int *)(iVar8 + 0xc));
}
iVar8 = _DAT_0040b9d4;
if (((DAT_0040b02c == '\0') || (_DAT_0040b028 != 0)) &&
(iVar6 = ThreadGetCurrentId(), iVar8 == iVar6)) {
cVar5 = CVProfNode::ExitScope();
if (cVar5 != '\0') {
_DAT_0040b030 = (int *)_DAT_0040b030[0x19];
}
DAT_0040b02c = _DAT_0040b030 == (int *)0x40b034;
}
if (local_204c != 0) {
(**(code **)(local_204c + 0x54))(local_204c,uVar3,uVar4,0,0,0);
}
goto LAB_001a1644;
}
iVar8 = *(int *)(param_2 + 0x134);
if (0 < *(int *)(iVar8 + 0xc)) {
iVar10 = 0;
do {
iVar14 = iVar10 + 1;
*(int *)(iVar10 * 0x40 + *(int *)(iVar8 + 0x10) + 4) = iVar6;
iVar8 = *(int *)(param_2 + 0x134);
iVar10 = iVar14;
} while (iVar14 < *(int *)(iVar8 + 0xc));
}
if (0 < *(int *)(iVar8 + 0x4c)) {
iVar10 = 0;
do {
iVar14 = iVar10 + 1;
*(int *)(iVar10 * 0x40 + *(int *)(iVar8 + 0x50) + 4) = iVar6;
iVar8 = *(int *)(param_2 + 0x134);
iVar10 = iVar14;
} while (iVar14 < *(int *)(iVar8 + 0x4c));
}
}
LAB_001a15f5:
iVar8 = _DAT_0040b9d4;
if (((DAT_0040b02c == '\0') || (_DAT_0040b028 != 0)) &&
(iVar6 = ThreadGetCurrentId(), iVar8 == iVar6)) {
cVar5 = CVProfNode::ExitScope();
if (cVar5 != '\0') {
_DAT_0040b030 = (int *)_DAT_0040b030[0x19];
}
DAT_0040b02c = _DAT_0040b030 == (int *)0x40b034;
}
if (local_204c != 0) {
(**(code **)(local_204c + 0x54))(local_204c,uVar3,uVar4,0,0,0);
}
LAB_001a1644:
if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {
return;
}
/* WARNING: Subroutine does not return */
__stack_chk_fail();
LAB_001a13bf:
uVar15 = (uint)*(ushort *)((int)piVar17 + 0xae);
if (uVar15 == 0xffff) goto LAB_001a17be;
goto LAB_001a13d2;
}
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.