CModelRender::ComputeLightingState
0x00189c40 · 926 bytes · __thiscall
_ZN12CModelRender20ComputeLightingStateEiPK15LightingQuery_tP23MaterialLightingState_tPP8ITexture
Decompiled
undefined (5 params)
/* CModelRender::ComputeLightingState(int, LightingQuery_t const*, MaterialLightingState_t*,
ITexture**) */
void __thiscall
CModelRender::ComputeLightingState
(CModelRender *this,int param_1,LightingQuery_t *param_2,MaterialLightingState_t *param_3,
ITexture **param_4)
{
int iVar1;
char cVar2;
undefined4 *puVar3;
undefined4 *puVar4;
MaterialLightingState_t *pMVar5;
uint uVar6;
int iVar7;
uint uVar8;
CUtlMemory<ModelInstanceHashPair_t,int> *this_00;
CUtlVector<ModelInstanceHashPair_t,CUtlMemory<ModelInstanceHashPair_t,int>> *this_01;
MaterialLightingState_t *pMVar9;
int *piVar10;
MaterialLightingState_t *pMVar11;
byte bVar12;
uint local_60;
MaterialLightingState_t *local_5c;
MaterialLightingState_t *local_58;
int local_54;
LightingQuery_t *local_50;
undefined4 local_48;
int local_44;
int local_40 [5];
code *local_2c;
code *local_28;
char local_24;
uint local_20;
bVar12 = 0;
local_40[0] = 0;
local_40[1] = 0;
local_40[2] = 0;
local_40[3] = 0;
local_40[4] = 0;
uVar6 = param_1 * 2;
local_2c = ModelInstanceHashCompare;
local_28 = ModelInstanceHash;
if (0x10000 < (int)uVar6) {
uVar6 = 0x10000;
}
/* try { // try from 00189c98 to 00189c9c has its CatchHandler @ 0018a04f */
CUtlVector<CUtlVector<ModelInstanceHashPair_t,CUtlMemory<ModelInstanceHashPair_t,int>>,CUtlMemory<CUtlVector<ModelInstanceHashPair_t,CUtlMemory<ModelInstanceHashPair_t,int>>,int>>
::SetCount((CUtlVector<CUtlVector<ModelInstanceHashPair_t,CUtlMemory<ModelInstanceHashPair_t,int>>,CUtlMemory<CUtlVector<ModelInstanceHashPair_t,CUtlMemory<ModelInstanceHashPair_t,int>>,int>>
*)local_40,uVar6);
if (0 < (int)uVar6) {
puVar3 = (undefined4 *)(local_40[0] + 0xc);
do {
*puVar3 = 0;
puVar4 = puVar3 + 5;
puVar3[-1] = 0;
puVar3 = puVar4;
} while (puVar4 != (undefined4 *)(local_40[0] + 0xc) + uVar6 * 5);
}
local_24 = (uVar6 - 1 & uVar6) == 0;
local_20 = 0;
if ((bool)local_24) {
local_20 = uVar6 - 1;
}
if (0 < param_1) {
local_54 = 0;
local_50 = param_2;
local_58 = param_3;
local_5c = param_3 + 0x48;
do {
local_48 = CONCAT22(local_48._2_2_,*(undefined2 *)(local_50 + 0xc));
local_44 = local_54;
/* try { // try from 00189d17 to 00189fc4 has its CatchHandler @ 0018a000 */
uVar6 = (*local_28)(&local_48);
if (local_24 == '\0') {
uVar6 = uVar6 % (uint)local_40[3];
}
else {
uVar6 = uVar6 & local_20;
}
iVar7 = 0;
piVar10 = (int *)(local_40[0] + uVar6 * 0x14);
iVar1 = piVar10[3];
if (iVar1 < 1) {
LAB_00189d69:
if (iVar1 == iVar7) goto LAB_00189f98;
}
else {
do {
cVar2 = (*local_2c)(*piVar10 + iVar7 * 8,&local_48);
if (cVar2 != '\0') goto LAB_00189d69;
iVar7 = iVar7 + 1;
} while (iVar7 != iVar1);
LAB_00189f98:
this_01 = (CUtlVector<ModelInstanceHashPair_t,CUtlMemory<ModelInstanceHashPair_t,int>> *)
(uVar6 * 0x14 + local_40[0]);
iVar1 = *(int *)(this_01 + 0xc);
CUtlVector<ModelInstanceHashPair_t,CUtlMemory<ModelInstanceHashPair_t,int>>::GrowVector
(this_01,1);
CUtlVector<ModelInstanceHashPair_t,CUtlMemory<ModelInstanceHashPair_t,int>>::
ShiftElementsRight(this_01,iVar1,1);
puVar3 = (undefined4 *)(*(int *)this_01 + iVar1 * 8);
if (puVar3 != (undefined4 *)0x0) {
*puVar3 = local_48;
puVar3[1] = local_44;
}
}
if (*(short *)(local_50 + 0xe) == -1) {
LAB_00189f28:
*(undefined4 *)(local_58 + 0x54) = 0;
*(undefined4 *)local_5c = *(undefined4 *)local_50;
*(undefined4 *)(local_5c + 4) = *(undefined4 *)(local_50 + 4);
*(undefined4 *)(local_5c + 8) = *(undefined4 *)(local_50 + 8);
}
else {
local_48 = CONCAT22(local_48._2_2_,*(short *)(local_50 + 0xe));
local_44 = 0;
local_60 = (*local_28)(&local_48);
if (local_24 == '\0') {
local_60 = local_60 % (uint)local_40[3];
}
else {
local_60 = local_60 & local_20;
}
uVar8 = 0;
piVar10 = (int *)(local_40[0] + local_60 * 0x14);
uVar6 = piVar10[3];
if ((int)uVar6 < 1) {
LAB_00189de1:
if (uVar6 == uVar8) goto LAB_00189f80;
uVar6 = uVar8 & 0xffff;
uVar8 = (local_60 << 0x10 | uVar8) >> 0x10;
}
else {
do {
cVar2 = (*local_2c)(*piVar10 + uVar8 * 8,&local_48);
if (cVar2 != '\0') goto LAB_00189de1;
uVar8 = uVar8 + 1;
} while (uVar8 != uVar6);
LAB_00189f80:
uVar6 = 0xffff;
uVar8 = 0xffff;
}
if ((local_40[3] <= (int)uVar8) ||
(piVar10 = (int *)(local_40[0] + uVar8 * 0x14), piVar10[3] <= (int)uVar6))
goto LAB_00189f28;
iVar1 = *(int *)(*piVar10 + 4 + uVar6 * 8);
pMVar5 = param_3 + iVar1 * 0x1b8;
pMVar9 = pMVar5;
pMVar11 = local_58;
for (iVar7 = 0x16; iVar7 != 0; iVar7 = iVar7 + -1) {
*(undefined4 *)pMVar11 = *(undefined4 *)pMVar9;
pMVar9 = pMVar9 + (uint)bVar12 * -8 + 4;
pMVar11 = pMVar11 + (uint)bVar12 * -8 + 4;
}
memcpy(local_58 + 0x58,pMVar5 + 0x58,*(int *)(pMVar5 + 0x54) * 0x58);
param_4[local_54] = param_4[iVar1];
}
local_54 = local_54 + 1;
local_50 = local_50 + 0x14;
local_58 = local_58 + 0x1b8;
local_5c = local_5c + 0x1b8;
} while (local_54 != param_1);
}
ComputeAmbientBoost(this,param_1,param_2,param_3);
if (*(int *)(mat_fullbright._28_4_ + 0x30) == 1) {
SetFullbrightLightingState(this,param_1,param_3);
}
iVar1 = local_40[3];
if (0 < local_40[3]) {
iVar7 = 0;
uVar6 = 0;
do {
uVar6 = uVar6 + 1;
this_00 = (CUtlMemory<ModelInstanceHashPair_t,int> *)(local_40[0] + iVar7);
iVar7 = iVar7 + 0x14;
*(undefined4 *)(this_00 + 0xc) = 0;
CUtlMemory<ModelInstanceHashPair_t,int>::Purge(this_00);
*(undefined4 *)(this_00 + 0x10) = *(undefined4 *)this_00;
} while (uVar6 != iVar1);
}
CUtlVector<CUtlVector<ModelInstanceHashPair_t,CUtlMemory<ModelInstanceHashPair_t,int>>,CUtlMemory<CUtlVector<ModelInstanceHashPair_t,CUtlMemory<ModelInstanceHashPair_t,int>>,int>>
::RemoveAll((CUtlVector<CUtlVector<ModelInstanceHashPair_t,CUtlMemory<ModelInstanceHashPair_t,int>>,CUtlMemory<CUtlVector<ModelInstanceHashPair_t,CUtlMemory<ModelInstanceHashPair_t,int>>,int>>
*)local_40);
CUtlMemory<CUtlVector<ModelInstanceHashPair_t,CUtlMemory<ModelInstanceHashPair_t,int>>,int>::Purge
((CUtlMemory<CUtlVector<ModelInstanceHashPair_t,CUtlMemory<ModelInstanceHashPair_t,int>>,int>
*)local_40);
local_40[4] = local_40[0];
CUtlMemory<CUtlVector<ModelInstanceHashPair_t,CUtlMemory<ModelInstanceHashPair_t,int>>,int>::Purge
((CUtlMemory<CUtlVector<ModelInstanceHashPair_t,CUtlMemory<ModelInstanceHashPair_t,int>>,int>
*)local_40);
return;
}
SourceMod gamedata
paste intoaddons/sourcemod/gamedata/<your_plugin>.txt
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.
Type inference is best-effort from the C signature - sanity-check the DHooks types before shipping.