Mod_LeafAmbientColorAtPos
0x0019b080 · 633 bytes · __cdecl
_Z25Mod_LeafAmbientColorAtPosP6VectorRKS_i
Decompiled
undefined (3 params)
/* Mod_LeafAmbientColorAtPos(Vector*, Vector const&, int) */
void Mod_LeafAmbientColorAtPos(Vector *param_1,Vector *param_2,int param_3)
{
ushort *puVar1;
ColorRGBExp32 *pCVar2;
int iVar3;
ushort uVar4;
int iVar5;
Vector *pVVar6;
int iVar7;
float fVar8;
float fVar9;
float fVar10;
int local_38;
float local_34;
float local_28;
float local_24;
float local_20;
iVar5 = 6;
pVVar6 = param_1;
do {
*(undefined4 *)pVVar6 = 0;
*(undefined4 *)(pVVar6 + 4) = 0;
*(undefined4 *)(pVVar6 + 8) = 0;
iVar5 = iVar5 + -1;
pVVar6 = pVVar6 + 0xc;
} while (iVar5 != 0);
iVar5 = *(int *)(DAT_003a172c + 0xe4);
puVar1 = (ushort *)(iVar5 + param_3 * 4);
uVar4 = *puVar1;
if (uVar4 == 0) {
uVar4 = puVar1[1];
param_3 = (int)uVar4;
if (uVar4 == 0) {
return;
}
uVar4 = *(ushort *)(iVar5 + param_3 * 4);
}
if (uVar4 != 0) {
local_38 = 0;
local_34 = 0.0;
iVar3 = param_3 * 0x40 + *(int *)(DAT_003a172c + 0x10);
iVar5 = (uint)*(ushort *)(iVar5 + 2 + param_3 * 4) * 0x1c + *(int *)(DAT_003a172c + 0xe8);
do {
iVar7 = 0;
fVar10 = (*(float *)(iVar3 + 0x10) - (*(float *)param_2 + *(float *)(iVar3 + 0x20))) +
*(float *)(iVar3 + 0x20) * 0.007843138 * ((float)*(byte *)(iVar5 + 0x18) + 0.0);
fVar8 = (*(float *)(iVar3 + 0x14) - (*(float *)(param_2 + 4) + *(float *)(iVar3 + 0x24))) +
*(float *)(iVar3 + 0x24) * 0.007843138 * ((float)*(byte *)(iVar5 + 0x19) + 0.0);
fVar9 = (*(float *)(iVar3 + 0x18) - (*(float *)(param_2 + 8) + *(float *)(iVar3 + 0x28))) +
*(float *)(iVar3 + 0x28) * 0.007843138 * ((float)*(byte *)(iVar5 + 0x1a) + 0.0);
fVar8 = 1.0 / (fVar8 * fVar8 + fVar10 * fVar10 + 1.0 + fVar9 * fVar9);
local_34 = local_34 + fVar8;
pVVar6 = param_1;
do {
pCVar2 = (ColorRGBExp32 *)(iVar7 + iVar5);
iVar7 = iVar7 + 4;
ColorRGBExp32ToVector(pCVar2,(Vector *)&local_28);
*(float *)(pVVar6 + 4) = local_24 * fVar8 + *(float *)(pVVar6 + 4);
*(float *)(pVVar6 + 8) = local_20 * fVar8 + *(float *)(pVVar6 + 8);
*(float *)pVVar6 = local_28 * fVar8 + *(float *)pVVar6;
pVVar6 = pVVar6 + 0xc;
} while (iVar7 != 0x18);
local_38 = local_38 + 1;
iVar5 = iVar5 + 0x1c;
} while (local_38 < (int)(uint)uVar4);
iVar5 = 6;
local_34 = 1.0 / local_34;
do {
*(float *)param_1 = *(float *)param_1 * local_34;
*(float *)(param_1 + 4) = *(float *)(param_1 + 4) * local_34;
*(float *)(param_1 + 8) = *(float *)(param_1 + 8) * local_34;
iVar5 = iVar5 + -1;
param_1 = param_1 + 0xc;
} while (iVar5 != 0);
}
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.