Mod_LoadWorldlights
0x00196120 · 1001 bytes · __cdecl
_Z19Mod_LoadWorldlightsR14CMapLoadHelperb
Decompiled
undefined (2 params)
/* Mod_LoadWorldlights(CMapLoadHelper&, bool) */
void Mod_LoadWorldlights(CMapLoadHelper *param_1,bool param_2)
{
uint uVar1;
CMapLoadHelper *pCVar2;
char *pcVar3;
undefined4 uVar4;
undefined4 *puVar5;
int iVar6;
undefined4 *puVar7;
int iVar8;
dworldlight_t *pdVar9;
int iVar10;
longdouble lVar11;
uint local_28;
iVar8 = s_pMap;
*(undefined4 *)(s_pMap + 0xa0) = 0;
uVar1 = *(uint *)param_1;
if (uVar1 == 0) {
*(undefined4 *)(iVar8 + 0x98) = 0;
*(undefined4 *)(iVar8 + 0x9c) = 0;
}
else {
if (*(int *)(param_1 + 8) == 0) {
uVar1 = uVar1 / 0x58;
*(uint *)(iVar8 + 0x98) = uVar1;
pCVar2 = (CMapLoadHelper *)s_szMapPathName;
if ((&s_MapLumpFiles)[*(int *)(param_1 + 0x18) * 7] != 0) {
pCVar2 = param_1 + 0x1c;
}
pcVar3 = (char *)va("%s [%s]",pCVar2,"worldlights");
uVar4 = Hunk_AllocName(uVar1 * 100,pcVar3,true);
*(undefined4 *)(iVar8 + 0x9c) = uVar4;
iVar8 = s_pMap;
if (uVar1 != 0) {
local_28 = 0;
puVar5 = *(undefined4 **)(param_1 + 0x10);
puVar7 = *(undefined4 **)(s_pMap + 0x9c);
do {
*puVar7 = *puVar5;
puVar7[1] = puVar5[1];
puVar7[2] = puVar5[2];
puVar7[3] = puVar5[3];
puVar7[4] = puVar5[4];
puVar7[5] = puVar5[5];
puVar7[6] = puVar5[6];
puVar7[7] = puVar5[7];
puVar7[8] = puVar5[8];
puVar7[9] = 0;
puVar7[10] = 0;
puVar7[0xb] = 0;
puVar7[0xc] = puVar5[9];
puVar7[0xd] = puVar5[10];
puVar7[0xe] = puVar5[0xb];
local_28 = local_28 + 1;
puVar7[0xf] = puVar5[0xc];
puVar7[0x10] = puVar5[0xd];
puVar7[0x11] = puVar5[0xe];
puVar7[0x12] = puVar5[0xf];
puVar7[0x13] = puVar5[0x10];
puVar7[0x14] = puVar5[0x11];
puVar7[0x15] = puVar5[0x12];
puVar7[0x16] = puVar5[0x13];
puVar7[0x17] = puVar5[0x14];
puVar7[0x18] = puVar5[0x15];
puVar5 = puVar5 + 0x16;
puVar7 = puVar7 + 0x19;
} while (uVar1 != local_28);
}
}
else if (*(int *)(param_1 + 8) == 1) {
*(uint *)(iVar8 + 0x98) = uVar1 / 100;
pCVar2 = (CMapLoadHelper *)s_szMapPathName;
if ((&s_MapLumpFiles)[*(int *)(param_1 + 0x18) * 7] != 0) {
pCVar2 = param_1 + 0x1c;
}
pcVar3 = (char *)va("%s [%s]",pCVar2,"worldlights");
uVar4 = Hunk_AllocName(*(int *)param_1,pcVar3,true);
*(undefined4 *)(iVar8 + 0x9c) = uVar4;
iVar8 = s_pMap;
memcpy(*(void **)(s_pMap + 0x9c),*(void **)(param_1 + 0x10),*(size_t *)param_1);
}
else {
Host_Error("Invalid worldlight lump version!\n");
iVar8 = s_pMap;
}
iVar10 = 0;
if (0 < *(int *)(iVar8 + 0x98)) {
do {
iVar6 = iVar10 * 100;
pdVar9 = (dworldlight_t *)(*(int *)(iVar8 + 0x9c) + iVar6);
if (*(int *)(pdVar9 + 0x34) == 2) {
if (((*(float *)(pdVar9 + 0x4c) == 0.0) && (*(float *)(pdVar9 + 0x50) == 0.0)) &&
(*(float *)(pdVar9 + 0x54) == 0.0)) {
*(undefined4 *)(pdVar9 + 0x54) = 0x3f800000;
pdVar9 = (dworldlight_t *)(*(int *)(iVar8 + 0x9c) + iVar6);
}
if (*(float *)(pdVar9 + 0x44) != 0.0) goto LAB_00196209;
*(undefined4 *)(pdVar9 + 0x44) = 0x3f800000;
pdVar9 = (dworldlight_t *)(iVar6 + *(int *)(iVar8 + 0x9c));
if (*(float *)(pdVar9 + 0x48) <= 1.0 && *(float *)(pdVar9 + 0x48) != 1.0)
goto LAB_00196288;
}
else {
if ((((*(int *)(pdVar9 + 0x34) == 1) && (*(float *)(pdVar9 + 0x4c) == 0.0)) &&
(*(float *)(pdVar9 + 0x50) == 0.0)) && (*(float *)(pdVar9 + 0x54) == 0.0)) {
*(undefined4 *)(pdVar9 + 0x54) = 0x3f800000;
pdVar9 = (dworldlight_t *)(iVar6 + *(int *)(iVar8 + 0x9c));
}
LAB_00196209:
if (*(float *)(pdVar9 + 0x48) <= 1.0 && *(float *)(pdVar9 + 0x48) != 1.0) {
LAB_00196288:
lVar11 = (longdouble)ComputeLightRadius(pdVar9,param_2);
*(float *)(pdVar9 + 0x48) = (float)lVar11;
}
}
iVar10 = iVar10 + 1;
iVar8 = s_pMap;
} while (iVar10 < *(int *)(s_pMap + 0x98));
}
}
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.