CLagCompensationManager::RestoreEntityFromRecords
0x007c9a00 · 2424 bytes · __thiscall
_ZN23CLagCompensationManager24RestoreEntityFromRecordsEP11CBaseEntityP9LagRecordS3_b
Decompiled
undefined (5 params)
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* CLagCompensationManager::RestoreEntityFromRecords(CBaseEntity*, LagRecord*, LagRecord*, bool) */
void __thiscall
CLagCompensationManager::RestoreEntityFromRecords
(CLagCompensationManager *this,CBaseEntity *param_1,LagRecord *param_2,LagRecord *param_3,
bool param_4)
{
CCollisionProperty *this_00;
uint *puVar1;
undefined4 uVar2;
CBaseEdict *pCVar3;
int iVar4;
bool bVar5;
char cVar6;
CBaseAnimating *this_01;
int iVar7;
float *pfVar8;
CBaseAnimatingOverlay *this_02;
int iVar9;
int iVar10;
int iVar11;
int iVar12;
uint uVar13;
LagRecord *pLVar14;
float fVar15;
float fVar16;
float fVar17;
undefined4 local_9c;
undefined4 local_98;
float local_94;
float local_90;
float local_8c;
undefined4 local_88;
undefined4 local_84;
int local_80;
float local_7c;
float local_78;
float local_74;
CGameTrace local_70 [12];
Vector local_64 [32];
float local_44;
char local_3a;
char local_39;
bVar5 = false;
uVar13 = *(uint *)param_2;
if ((uVar13 & 0x400) != 0) {
this_00 = (CCollisionProperty *)(param_1 + 0x194);
pfVar8 = (float *)(**(code **)(*(int *)(param_1 + 0x194) + 4))(this_00);
if (((((*(float *)(param_3 + 0x1c) == *pfVar8) && (*(float *)(param_3 + 0x20) == pfVar8[1])) &&
(*(float *)(param_3 + 0x24) == pfVar8[2])) &&
((pfVar8 = (float *)(**(code **)(*(int *)(param_1 + 0x194) + 8))(this_00),
*(float *)(param_3 + 0x28) == *pfVar8 && (*(float *)(param_3 + 0x2c) == pfVar8[1])))) &&
(*(float *)(param_3 + 0x30) == pfVar8[2])) {
bVar5 = true;
CCollisionProperty::SetCollisionBounds
(this_00,(Vector *)(param_2 + 0x1c),(Vector *)(param_2 + 0x28));
uVar13 = *(uint *)param_2;
}
else {
bVar5 = true;
uVar13 = *(uint *)param_2;
}
}
if ((uVar13 & 0x200) == 0) goto LAB_007c9a59;
if (((byte)param_1[0x14d] & 8) == 0) {
if (*(float *)(param_3 + 0x10) == *(float *)(param_1 + 0x37c)) {
LAB_007c9b18:
if ((*(float *)(param_3 + 0x14) == *(float *)(param_1 + 0x380)) &&
(*(float *)(param_3 + 0x18) == *(float *)(param_1 + 900))) {
CBaseEntity::SetAbsAngles(param_1,(QAngle *)(param_2 + 0x10));
}
}
}
else {
CBaseEntity::CalcAbsolutePosition(param_1);
if (*(float *)(param_3 + 0x10) == *(float *)(param_1 + 0x37c)) goto LAB_007c9b18;
}
bVar5 = true;
uVar13 = *(uint *)param_2;
LAB_007c9a59:
if ((uVar13 & 0x100) != 0) {
if (((byte)param_1[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition(param_1);
}
fVar17 = *(float *)(param_1 + 0x2e0) - *(float *)(param_3 + 4);
fVar15 = *(float *)(param_1 + 0x2e8) - *(float *)(param_3 + 0xc);
fVar16 = *(float *)(param_1 + 0x2e4) - *(float *)(param_3 + 8);
if (fVar15 * fVar15 + fVar17 * fVar17 + fVar16 * fVar16 < 4096.0) {
local_9c = 0;
local_98 = 0;
local_94 = fVar17 + *(float *)(param_2 + 4);
local_90 = fVar16 + *(float *)(param_2 + 8);
local_8c = fVar15 + *(float *)(param_2 + 0xc);
if (_towlower == 0) {
local_80 = 0;
}
else {
(**(code **)(_towlower + 0x50))
(_towlower,&local_9c,0,0,0,0,"/data/src/game/server/player_lagcompensation.cpp",
0x68,&RestoreEntityTo(CBaseEntity*,Vector_const&)::tm_fmt,"(%s)%s",
"CLagCompensationManager","RestoreEntityTo");
local_80 = _towlower;
}
iVar7 = _DAT_0105db00;
local_88 = local_9c;
local_84 = local_98;
/* try { // try from 007c9d31 to 007c9d35 has its CatchHandler @ 007ca3f8 */
if (((_DAT_0105d154 != 0) || (DAT_0105d158 == '\0')) &&
(iVar12 = ThreadGetCurrentId(), iVar7 == iVar12)) {
if ((char *)*_DAT_0105d15c != "RestoreEntityTo") {
/* try { // try from 007ca390 to 007ca3b3 has its CatchHandler @ 007ca3f8 */
_DAT_0105d15c =
(int *)CVProfNode::GetSubNode((char *)_DAT_0105d15c,0xcbc660,(char *)0x0,0xcbc670);
}
puVar1 = (uint *)(_DAT_0105d1e8 + 4 + _DAT_0105d15c[0x1c] * 8);
*puVar1 = *puVar1 | 4;
CVProfNode::EnterScope();
DAT_0105d158 = '\0';
}
if (*(int *)(sv_lagcompensationforcerestore._28_4_ + 0x30) != 0) {
/* try { // try from 007c9d57 to 007c9e6c has its CatchHandler @ 007ca410 */
CBaseEntity::SetAbsOrigin(param_1,(Vector *)&local_94);
CBaseEntity::PhysicsTouchTriggers(param_1,(Vector *)0x0);
}
iVar7 = CBaseEntity::GetTeamNumber(param_1);
cVar6 = IsASurvivorTeam(iVar7);
uVar13 = (-(uint)(cVar6 == '\0') & 0x10000) + 0x201420b;
UTIL_TraceEntity(param_1,(Vector *)&local_94,(Vector *)&local_94,uVar13,
(IHandleEntity *)param_1,8,local_70);
if ((local_39 == '\0') && (local_3a == '\0')) {
/* try { // try from 007ca3ca to 007ca3de has its CatchHandler @ 007ca410 */
CBaseEntity::SetAbsOrigin(param_1,local_64);
CBaseEntity::PhysicsTouchTriggers(param_1,(Vector *)0x0);
}
else {
if (*(int *)(sv_unlag_debug._28_4_ + 0x30) != 0) {
if (*(int *)(param_1 + 0x30) == 0) {
iVar7 = 0;
}
else {
iVar7 = *(int *)(param_1 + 0x30) - *(int *)(gpGlobals + 0x58) >> 4;
}
DevMsg("RestoreEntityTo could not restore player position for client \"%d\" ( %.1f %.1f %.1f )\n"
,iVar7,(double)local_94,(double)local_90,(double)local_8c);
}
if (((byte)param_1[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition(param_1);
}
UTIL_TraceEntity(param_1,(Vector *)(param_1 + 0x2e0),(Vector *)&local_94,uVar13,
(IHandleEntity *)param_1,8,local_70);
if ((local_39 == '\0') && (local_3a == '\0')) {
fVar15 = g_flFractionScale * local_44;
if (((byte)param_1[0x14d] & 8) != 0) {
/* try { // try from 007ca201 to 007ca2ab has its CatchHandler @ 007ca410 */
CBaseEntity::CalcAbsolutePosition(param_1);
}
local_7c = (local_94 - *(float *)(param_1 + 0x2e0)) * fVar15 + *(float *)(param_1 + 0x2e0)
;
local_78 = (local_90 - *(float *)(param_1 + 0x2e4)) * fVar15 + *(float *)(param_1 + 0x2e4)
;
local_74 = (local_8c - *(float *)(param_1 + 0x2e8)) * fVar15 + *(float *)(param_1 + 0x2e8)
;
CBaseEntity::SetAbsOrigin(param_1,(Vector *)&local_7c);
CBaseEntity::PhysicsTouchTriggers(param_1,(Vector *)0x0);
if (*(int *)(sv_unlag_debug._28_4_ + 0x30) != 0) {
DevMsg(" restore got most of the way\n");
}
}
else if (*(int *)(sv_unlag_debug._28_4_ + 0x30) != 0) {
/* try { // try from 007ca317 to 007ca31b has its CatchHandler @ 007ca410 */
DevMsg(" restore failed entirely\n");
}
}
iVar7 = _DAT_0105db00;
if (((DAT_0105d158 == '\0') || (_DAT_0105d154 != 0)) &&
(iVar12 = ThreadGetCurrentId(), iVar7 == iVar12)) {
cVar6 = CVProfNode::ExitScope();
if (cVar6 != '\0') {
_DAT_0105d15c = (int *)_DAT_0105d15c[0x19];
}
DAT_0105d158 = _DAT_0105d15c == (int *)0x105d160;
}
if (local_80 != 0) {
(**(code **)(local_80 + 0x54))(local_80,local_88,local_84,0,0,0);
}
}
bVar5 = true;
}
this_01 = (CBaseAnimating *)(**(code **)(*(int *)param_1 + 0xf0))(param_1);
if (((this_01 == (CBaseAnimating *)0x0) || (!param_4)) || ((*(uint *)param_2 & 0x800) == 0)) {
if (!bVar5) {
return;
}
}
else {
CBaseAnimating::SetSequence(this_01,*(int *)(param_2 + 0x128));
fVar15 = *(float *)(param_2 + 300);
if (fVar15 != *(float *)(this_01 + 0x490)) {
if (this_01[0x6c] == (CBaseAnimating)0x0) {
pCVar3 = *(CBaseEdict **)(this_01 + 0x30);
if (pCVar3 != (CBaseEdict *)0x0) {
*(uint *)pCVar3 = *(uint *)pCVar3 | 0x101;
iVar7 = CBaseEdict::GetChangeAccessor(pCVar3);
*(undefined2 *)(iVar7 + 2) = 0;
}
}
else {
this_01[0x70] = (CBaseAnimating)((byte)this_01[0x70] | 1);
}
*(float *)(this_01 + 0x490) = fVar15;
}
this_02 = (CBaseAnimatingOverlay *)(**(code **)(*(int *)param_1 + 0xf4))(param_1);
if ((this_02 != (CBaseAnimatingOverlay *)0x0) && (iVar7 = *(int *)(this_02 + 0x1400), 0 < iVar7)
) {
iVar12 = 0;
pLVar14 = param_2;
LAB_007ca07b:
do {
iVar10 = CBaseAnimatingOverlay::GetAnimOverlay(this_02,iVar12);
if (iVar10 != 0) {
fVar15 = *(float *)(pLVar14 + 0x3c);
if (fVar15 != *(float *)(iVar10 + 0xc)) {
iVar4 = *(int *)(iVar10 + 0x48);
if (iVar4 != 0) {
if (*(char *)(iVar4 + 0x6c) == '\0') {
pCVar3 = *(CBaseEdict **)(iVar4 + 0x30);
if (pCVar3 != (CBaseEdict *)0x0) {
*(uint *)pCVar3 = *(uint *)pCVar3 | 0x101;
iVar11 = CBaseEdict::GetChangeAccessor(pCVar3);
*(undefined2 *)(iVar11 + 2) = 0;
}
}
else {
*(byte *)(iVar4 + 0x70) = *(byte *)(iVar4 + 0x70) | 1;
}
uVar2 = *(undefined4 *)(gpGlobals + 0xc);
*(undefined4 *)(iVar4 + 0x78) = 0;
*(undefined4 *)(iVar4 + 0x74) = uVar2;
}
*(float *)(iVar10 + 0xc) = fVar15;
}
iVar4 = *(int *)(pLVar14 + 0x44);
if (iVar4 != *(int *)(iVar10 + 0x3c)) {
iVar11 = *(int *)(iVar10 + 0x48);
if (iVar11 != 0) {
if (*(char *)(iVar11 + 0x6c) == '\0') {
pCVar3 = *(CBaseEdict **)(iVar11 + 0x30);
if (pCVar3 != (CBaseEdict *)0x0) {
*(uint *)pCVar3 = *(uint *)pCVar3 | 0x101;
iVar9 = CBaseEdict::GetChangeAccessor(pCVar3);
*(undefined2 *)(iVar9 + 2) = 0;
}
}
else {
*(byte *)(iVar11 + 0x70) = *(byte *)(iVar11 + 0x70) | 1;
}
uVar2 = *(undefined4 *)(gpGlobals + 0xc);
*(undefined4 *)(iVar11 + 0x78) = 0;
*(undefined4 *)(iVar11 + 0x74) = uVar2;
}
*(int *)(iVar10 + 0x3c) = iVar4;
}
iVar4 = *(int *)(pLVar14 + 0x38);
if (iVar4 != *(int *)(iVar10 + 8)) {
iVar11 = *(int *)(iVar10 + 0x48);
if (iVar11 != 0) {
if (*(char *)(iVar11 + 0x6c) == '\0') {
pCVar3 = *(CBaseEdict **)(iVar11 + 0x30);
if (pCVar3 != (CBaseEdict *)0x0) {
*(uint *)pCVar3 = *(uint *)pCVar3 | 0x101;
iVar9 = CBaseEdict::GetChangeAccessor(pCVar3);
*(undefined2 *)(iVar9 + 2) = 0;
}
}
else {
*(byte *)(iVar11 + 0x70) = *(byte *)(iVar11 + 0x70) | 1;
}
uVar2 = *(undefined4 *)(gpGlobals + 0xc);
*(undefined4 *)(iVar11 + 0x78) = 0;
*(undefined4 *)(iVar11 + 0x74) = uVar2;
}
*(int *)(iVar10 + 8) = iVar4;
}
fVar15 = *(float *)(pLVar14 + 0x40);
if (fVar15 != *(float *)(iVar10 + 0x14)) {
iVar4 = *(int *)(iVar10 + 0x48);
if (iVar4 != 0) {
if (*(char *)(iVar4 + 0x6c) == '\0') {
pCVar3 = *(CBaseEdict **)(iVar4 + 0x30);
if (pCVar3 != (CBaseEdict *)0x0) {
*(uint *)pCVar3 = *(uint *)pCVar3 | 0x101;
iVar11 = CBaseEdict::GetChangeAccessor(pCVar3);
*(undefined2 *)(iVar11 + 2) = 0;
}
}
else {
*(byte *)(iVar4 + 0x70) = *(byte *)(iVar4 + 0x70) | 1;
}
uVar2 = *(undefined4 *)(gpGlobals + 0xc);
*(undefined4 *)(iVar4 + 0x78) = 0;
*(undefined4 *)(iVar4 + 0x74) = uVar2;
}
iVar12 = iVar12 + 1;
pLVar14 = pLVar14 + 0x10;
*(float *)(iVar10 + 0x14) = fVar15;
if (iVar12 == iVar7) break;
goto LAB_007ca07b;
}
}
iVar12 = iVar12 + 1;
pLVar14 = pLVar14 + 0x10;
} while (iVar12 != iVar7);
}
}
fVar15 = *(float *)(param_2 + 0x34);
if (fVar15 == *(float *)(param_1 + 0x94)) {
return;
}
if (param_1[0x6c] == (CBaseEntity)0x0) {
pCVar3 = *(CBaseEdict **)(param_1 + 0x30);
if (pCVar3 != (CBaseEdict *)0x0) {
*(uint *)pCVar3 = *(uint *)pCVar3 | 0x101;
iVar7 = CBaseEdict::GetChangeAccessor(pCVar3);
*(undefined2 *)(iVar7 + 2) = 0;
}
}
else {
param_1[0x70] = (CBaseEntity)((byte)param_1[0x70] | 1);
}
*(float *)(param_1 + 0x94) = fVar15;
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.