CModelRender::ComputeLOD
0x00187630 · 349 bytes · __thiscall
_ZN12CModelRender10ComputeLODERK17ModelRenderInfo_tP14studiohwdata_t
Decompiled
undefined (3 params)
/* CModelRender::ComputeLOD(ModelRenderInfo_t const&, studiohwdata_t*) */
int __thiscall
CModelRender::ComputeLOD(CModelRender *this,ModelRenderInfo_t *param_1,studiohwdata_t *param_2)
{
code *pcVar1;
int iVar2;
int iVar3;
int iVar4;
int *piVar5;
undefined4 uVar6;
int iVar7;
float *pfVar8;
int iVar9;
longdouble lVar10;
float fVar11;
iVar4 = *(int *)(r_lod._28_4_ + 0x30);
if (iVar4 == -1) {
piVar5 = (int *)(**(code **)(*materials + 0x180))(materials);
if (piVar5 != (int *)0x0) {
/* try { // try from 001876e6 to 001876e8 has its CatchHandler @ 001877b5 */
(**(code **)(*piVar5 + 8))(piVar5);
}
pcVar1 = *(code **)(*piVar5 + 0x13c);
/* try { // try from 001876ff to 00187712 has its CatchHandler @ 001877a0 */
uVar6 = (**(code **)(**(int **)(param_1 + 0x18) + 4))(*(int **)(param_1 + 0x18));
lVar10 = (longdouble)(*pcVar1)(piVar5,uVar6,0x3f000000);
fVar11 = 0.0;
if ((float)lVar10 != 0.0) {
fVar11 = 100.0 / (float)lVar10;
}
iVar4 = *(int *)(param_2 + 4);
iVar9 = 0;
if (iVar4 != 0) {
iVar3 = *(int *)(param_2 + 8);
pfVar8 = (float *)(iVar3 + -0x18 + iVar4 * 0x1c);
if (*pfVar8 <= 0.0 && *pfVar8 != 0.0) {
iVar4 = iVar4 + -1;
}
iVar2 = *(int *)param_2;
iVar4 = iVar4 + -1;
iVar9 = iVar4;
if (iVar2 < iVar4) {
iVar7 = iVar2 + 1;
iVar9 = iVar2;
if (*(float *)(iVar3 + 4 + iVar7 * 0x1c) <= fVar11) {
pfVar8 = (float *)(iVar3 + 0x20 + iVar7 * 0x1c);
while ((iVar9 = iVar4, iVar7 != iVar4 && (iVar9 = iVar7, *pfVar8 <= fVar11))) {
iVar7 = iVar7 + 1;
pfVar8 = pfVar8 + 7;
}
}
}
}
if ((piVar5 != (int *)0x0) && ((**(code **)(*piVar5 + 0xc))(piVar5), piVar5 != (int *)0x0)) {
(**(code **)(*piVar5 + 4))(piVar5);
}
}
else {
iVar3 = *(int *)(param_2 + 4);
if (((((byte)param_1[0x2c] & 0x40) == 0) || (iVar9 = iVar3 + -2, iVar4 < iVar3 + -1)) &&
(iVar9 = iVar3 + -1, iVar4 < iVar3)) {
iVar9 = 0;
if (-1 < iVar4) {
iVar9 = iVar4;
}
goto LAB_00187697;
}
}
if (iVar9 < 0) {
iVar4 = *(int *)param_2;
if (iVar4 < 1) {
iVar4 = 0;
}
return iVar4;
}
iVar3 = *(int *)(param_2 + 4);
LAB_00187697:
if (iVar3 <= iVar9) {
iVar9 = iVar3 + -1;
}
iVar4 = *(int *)param_2;
if (*(int *)param_2 <= iVar9) {
iVar4 = iVar9;
}
return iVar4;
}
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.