UTIL_SetModel
0x00b2c880 · 463 bytes · __cdecl
_Z13UTIL_SetModelP11CBaseEntityPKc
Decompiled
undefined (2 params)
/* UTIL_SetModel(CBaseEntity*, char const*) */
void UTIL_SetModel(CBaseEntity *param_1,char *param_2)
{
CBaseEdict *pCVar1;
int iVar2;
int iVar3;
int iVar4;
undefined1 *puVar5;
undefined1 *puVar6;
undefined1 *local_40 [3];
Vector local_34 [12];
Vector local_28 [24];
iVar2 = (**(code **)(*modelinfo + 0xc))(modelinfo,param_2);
if (iVar2 < 0) {
puVar6 = *(undefined1 **)(param_1 + 0x7c);
puVar5 = *(undefined1 **)(param_1 + 0x154);
if (puVar6 == (undefined1 *)0x0) {
puVar6 = &DAT_00d539c2;
}
if (puVar5 == (undefined1 *)0x0) {
puVar5 = &DAT_00d539c2;
}
if (*(int *)(param_1 + 0x30) == 0) {
iVar3 = 0;
}
else {
iVar3 = *(int *)(param_1 + 0x30) - *(int *)(gpGlobals + 0x58) >> 4;
}
Error("%i/%s - %s: UTIL_SetModel: not precached: %s\n",iVar3,puVar5,puVar6,param_2);
}
(**(code **)(*(int *)param_1 + 0x24))(param_1,iVar2);
AllocPooledString((char *)local_40);
*(undefined1 **)(param_1 + 0x260) = local_40[0];
CBaseEntity::DispatchUpdateTransmitState(param_1);
puVar6 = &DAT_00d539c2;
if (local_40[0] != (undefined1 *)0x0) {
puVar6 = local_40[0];
}
iVar3 = (**(code **)(*soundemitterbase + 0x88))(soundemitterbase,puVar6);
if (iVar3 != *(int *)(param_1 + 0xf4)) {
if (param_1[0x6c] == (CBaseEntity)0x0) {
pCVar1 = *(CBaseEdict **)(param_1 + 0x30);
if (pCVar1 != (CBaseEdict *)0x0) {
*(uint *)pCVar1 = *(uint *)pCVar1 | 0x101;
iVar4 = CBaseEdict::GetChangeAccessor(pCVar1);
*(undefined2 *)(iVar4 + 2) = 0;
}
}
else {
param_1[0x70] = (CBaseEntity)((byte)param_1[0x70] | 1);
}
*(int *)(param_1 + 0xf4) = iVar3;
}
iVar2 = (**(code **)(*modelinfo + 8))(modelinfo,iVar2);
if (iVar2 == 0) {
SetMinMaxSize(param_1,(Vector *)&vec3_origin,(Vector *)&vec3_origin);
}
else {
(**(code **)(*modelinfo + 0x20))(modelinfo,iVar2,local_34,local_28);
SetMinMaxSize(param_1,local_34,local_28);
}
iVar2 = (**(code **)(*(int *)param_1 + 0xf0))(param_1);
if ((iVar2 != 0) && (*(int *)(iVar2 + 0x448) != 0)) {
if (*(char *)(iVar2 + 0x6c) == '\0') {
pCVar1 = *(CBaseEdict **)(iVar2 + 0x30);
if (pCVar1 != (CBaseEdict *)0x0) {
*(uint *)pCVar1 = *(uint *)pCVar1 | 0x101;
iVar3 = CBaseEdict::GetChangeAccessor(pCVar1);
*(undefined2 *)(iVar3 + 2) = 0;
}
*(undefined4 *)(iVar2 + 0x448) = 0;
}
else {
*(byte *)(iVar2 + 0x70) = *(byte *)(iVar2 + 0x70) | 1;
*(undefined4 *)(iVar2 + 0x448) = 0;
}
return;
}
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.