NWCEdit::UpdateEntityPosition
0x00b5f4a0 · 1269 bytes · __cdecl
_ZN7NWCEdit20UpdateEntityPositionEP11CBaseEntity
Decompiled
undefined (1 param)
/* NWCEdit::UpdateEntityPosition(CBaseEntity*) */
void NWCEdit::UpdateEntityPosition(CBaseEntity *param_1)
{
float fVar1;
float fVar2;
float fVar3;
code *pcVar4;
char cVar5;
undefined1 *puVar6;
uint uVar7;
int iVar8;
int iVar9;
undefined4 uVar10;
float *pfVar11;
char *pcVar12;
int in_GS_OFFSET;
double dVar13;
double dVar14;
double dVar15;
double dVar16;
double dVar17;
double dVar18;
float local_82c;
float local_828;
float local_824;
CFmtStrN<256> local_820 [5];
char local_81b [2043];
int local_20;
local_20 = *(int *)(in_GS_OFFSET + 0x14);
if (((byte)param_1[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition(param_1);
if (((byte)param_1[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition(param_1);
}
}
dVar17 = (double)*(float *)(param_1 + 0x380);
dVar16 = (double)*(float *)(param_1 + 0x37c);
dVar15 = (double)*(float *)(param_1 + 0x2e8);
dVar14 = (double)*(float *)(param_1 + 0x2e4);
dVar13 = (double)*(float *)(param_1 + 0x2e0);
dVar18 = (double)*(float *)(param_1 + 900);
puVar6 = &DAT_00d539c2;
if (*(undefined1 **)(param_1 + 0x7c) != (undefined1 *)0x0) {
puVar6 = *(undefined1 **)(param_1 + 0x7c);
}
DevMsg(1,"%s\n origin %f %f %f\n angles %f %f %f\n",puVar6,dVar13,dVar14,dVar15,dVar16,dVar17,
dVar18);
cVar5 = Ragdoll_IsPropRagdoll(param_1);
if (cVar5 != '\0') {
Ragdoll_GetAngleOverrideString((char *)local_820,0x800,param_1);
DevMsg(1,"pose: %s\n",local_820,dVar13,dVar14,dVar15,dVar16,dVar17,dVar18);
}
uVar7 = (**(code **)(*(int *)param_1 + 0xa4))(param_1);
if ((uVar7 & 0x40000000) == 0) goto LAB_00b5f574;
iVar8 = (**(code **)(*engine + 0xc))(engine);
if (iVar8 == 0) goto LAB_00b5f574;
if (*(int *)(param_1 + 0x30) == 0) {
iVar9 = 0;
iVar8 = 0;
}
else {
iVar8 = *(int *)(param_1 + 0x30) - *(int *)(gpGlobals + 0x58) >> 4;
iVar9 = iVar8 << 2;
iVar8 = iVar8 * 0xc;
}
pfVar11 = (float *)(g_EntityPositions + iVar8);
fVar1 = *pfVar11;
fVar2 = pfVar11[1];
fVar3 = pfVar11[2];
pcVar12 = "";
if (*(char **)(g_EntityClassnames + iVar9) != (char *)0x0) {
pcVar12 = *(char **)(g_EntityClassnames + iVar9);
}
iVar9 = CBaseEntity::GetModel(param_1);
if (iVar9 == 0) {
LAB_00b5f643:
cVar5 = Ragdoll_IsPropRagdoll(param_1);
if (cVar5 == '\0') {
LAB_00b5f6bd:
CFmtStrN<256>::CFmtStrN
(local_820,"%f %f %f",SUB84((double)*(float *)(param_1 + 0x37c),0),
(int)((ulonglong)(double)*(float *)(param_1 + 0x37c) >> 0x20),
SUB84((double)*(float *)(param_1 + 0x380),0),
(int)((ulonglong)(double)*(float *)(param_1 + 0x380) >> 0x20),
SUB84((double)*(float *)(param_1 + 900),0),
(int)((ulonglong)(double)*(float *)(param_1 + 900) >> 0x20));
iVar8 = Editor_SetKeyValue(pcVar12,fVar1,fVar2,fVar3,"angles",local_81b,false);
LAB_00b5f74c:
if (iVar8 == 0) goto LAB_00b5f754;
}
else {
Ragdoll_GetAngleOverrideString((char *)local_820,0x800,param_1);
iVar8 = Editor_SetKeyValue(pcVar12,fVar1,fVar2,fVar3,"angleOverride",(char *)local_820,false);
if (iVar8 == 0) goto LAB_00b5f6bd;
}
}
else {
pcVar4 = *(code **)(*modelinfo + 0x2c);
uVar10 = CBaseEntity::GetModel(param_1);
iVar9 = (*pcVar4)(modelinfo,uVar10);
if (iVar9 != 1) goto LAB_00b5f643;
RotationDelta((QAngle *)(iVar8 + g_EntityOrientations),(QAngle *)(param_1 + 0x37c),
(QAngle *)&local_82c);
if (0.0001 < SQRT(local_824 * local_824 + local_828 * local_828 + local_82c * local_82c)) {
iVar8 = Editor_RotateEntity(pcVar12,fVar1,fVar2,fVar3,(QAngle *)&local_82c,false);
goto LAB_00b5f74c;
}
LAB_00b5f754:
CFmtStrN<256>::CFmtStrN
(local_820,"%f %f %f",SUB84((double)*(float *)(param_1 + 0x2e0),0),
(int)((ulonglong)(double)*(float *)(param_1 + 0x2e0) >> 0x20),
SUB84((double)*(float *)(param_1 + 0x2e4),0),
(int)((ulonglong)(double)*(float *)(param_1 + 0x2e4) >> 0x20),
SUB84((double)*(float *)(param_1 + 0x2e8),0),
(int)((ulonglong)(double)*(float *)(param_1 + 0x2e8) >> 0x20));
iVar8 = Editor_SetKeyValue(pcVar12,fVar1,fVar2,fVar3,"origin",local_81b,false);
if (iVar8 == 0) {
NDebugOverlay::EntityBounds(param_1,0,0xff,0,0,5.0);
RememberEntityPosition(param_1);
goto LAB_00b5f574;
}
}
NDebugOverlay::EntityBounds(param_1,0xff,0,0,0,5.0);
LAB_00b5f574:
if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {
return;
}
/* WARNING: Subroutine does not return */
__stack_chk_fail();
}
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.