Code:
int __fastcall CInputMain__HSyncPos__hook(int a1, int a2, int a3, int a4, int a5, unsigned int a6)
{
int v7; // eax@2
int v8; // eax@2
int v9; // eax@2
int v10; // eax@2
int v11; // eax@2
int v12; // eax@2
int v13; // eax@2
int v14; // eax@2
int v15; // eax@2
int v16; // eax@2
int v17; // eax@2
int v18; // eax@9
int v19; // eax@9
int v20; // eax@9
int v21; // eax@9
int v22; // eax@9
int v23; // eax@9
int v24; // eax@9
int v25; // eax@9
int v26; // eax@9
int v27; // eax@9
int v28; // eax@9
char v29; // al@13
int v30; // edi@22
int v31; // esi@22
int v32; // eax@22
int v33; // eax@22
int v34; // eax@22
int v35; // eax@22
int v36; // eax@22
int v37; // eax@22
int v38; // eax@22
int v39; // eax@22
int v40; // eax@22
int v41; // eax@22
int v42; // eax@22
int v43; // edi@23
int v44; // esi@23
int v45; // eax@23
int v46; // eax@23
int v47; // eax@23
int v48; // eax@23
int v49; // eax@23
int v50; // eax@23
int v51; // eax@23
int v52; // eax@23
int v53; // eax@23
int v54; // eax@23
int v55; // eax@23
int v56; // eax@23
int v57; // eax@23
char v58; // [sp+20h] [bp-68h]@2
char v59; // [sp+24h] [bp-64h]@9
char v60; // [sp+28h] [bp-60h]@22
char v61; // [sp+2Ch] [bp-5Ch]@23
float v62; // [sp+30h] [bp-58h]@23
float v63; // [sp+34h] [bp-54h]@23
float v64; // [sp+38h] [bp-50h]@23
float v65; // [sp+3Ch] [bp-4Ch]@16
float v66; // [sp+40h] [bp-48h]@16
float v67; // [sp+44h] [bp-44h]@16
char v68; // [sp+4Bh] [bp-3Dh]@10
int v69; // [sp+4Ch] [bp-3Ch]@8
int v70; // [sp+50h] [bp-38h]@8
int v71; // [sp+54h] [bp-34h]@5
unsigned int v72; // [sp+58h] [bp-30h]@1
int v73; // [sp+5Ch] [bp-2Ch]@16
int v74; // [sp+60h] [bp-28h]@16
int v75; // [sp+64h] [bp-24h]@5
int v76; // [sp+68h] [bp-20h]@5
__int16 v77; // [sp+6Eh] [bp-1Ah]@3
v72 = *(_WORD *)(a5 + 1);
if ( v72 > a6 )
{
CurrentDateTime(&v58);
v7 = std__operator___char_std__char_traits_char__std__allocator_char__(serr, &v58);
v8 = std__operator___std__char_traits_char__(v7, &unk_BA78);
v9 = std__ostream__operator__(v8, 19);
v10 = std__operator___std__char_traits_char__(v9, " :: ");
v11 = std__operator___std__char_traits_char__(v10, "CInputMain::SycPosition :: length mismatch. Expected ");
v12 = std__ostream__operator__(v11, a6);
v13 = std__operator___std__char_traits_char__(v12, " got ");
v14 = std__ostream__operator__(v13, v72);
v15 = std__operator___std__char_traits_char__(v14, ". Player (");
v16 = std__operator___char_std__char_traits_char__std__allocator_char__(v15, a4 + 260);
v17 = std__operator___std__char_traits_char__(v16, ")");
std__ostream__operator__(v17, &std__endl_char_std__char_traits_char__);
std__string___string(&v58);
return -1;
}
v77 = (v72 - 3) / 0xC;
if ( v77 > 16 )
v77 = 16;
v76 = a5 + 3;
v71 = ((int (__fastcall *)(int, _DWORD))GetGlobalTime)(a1, 2863311531u * (unsigned __int64)(v72 - 3) >> 32);
v75 = 0;
while ( v77 > v75 && *(_DWORD *)singleton_CHARACTER_MANAGER )
{
v70 = *(_DWORD *)v76;
v69 = ((int (__cdecl *)(_DWORD, int))CHARACTER_MANAGER__Find)(*(_DWORD *)singleton_CHARACTER_MANAGER, v70);
if ( !v69 )
{
CurrentDateTime(&v59);
v18 = std__operator___char_std__char_traits_char__std__allocator_char__(serr, &v59);
v19 = std__operator___std__char_traits_char__(v18, &unk_BA78);
v20 = std__ostream__operator__(v19, 40);
v21 = std__operator___std__char_traits_char__(v20, " :: ");
v22 = std__operator___std__char_traits_char__(v21, "CInputMain::SycPosition :: Invalid Target (");
v23 = std__ostream__operator__(v22, v70);
v24 = std__operator___std__char_traits_char__(v23, " | ");
v25 = std__ostream__operator__(v24, v69);
v26 = std__operator___std__char_traits_char__(v25, ") by Name(");
v27 = std__operator___char_std__char_traits_char__std__allocator_char__(v26, a4 + 260);
v28 = std__operator___std__char_traits_char__(v27, ")");
std__ostream__operator__(v28, &std__endl_char_std__char_traits_char__);
std__string___string(&v59);
goto LABEL_25;
}
v68 = ((int (__cdecl *)(int))CHARACTER__GetCharType)(v69);
v29 = v68 != 1
&& v68 != 3
&& (unsigned __int8)((int (__cdecl *)(int, int, signed int))CHARACTER__SetSyncOwner)(v69, a4, 1);
if ( v29 )
{
v74 = *(_DWORD *)(v76 + 4);
v67 = (long double)(*(_DWORD *)(v69 + 48) - v74) / 100.0;
v73 = *(_DWORD *)(v76 + 8);
v66 = (long double)(*(_DWORD *)(v69 + 52) - v73) / 100.0;
v65 = sqrt(v67 * v67 + v66 * v66);
if ( v65 < 25.0 )
{
if ( *(_DWORD *)(v69 + 3992) != v71 )
{
*(_DWORD *)(v69 + 3992) = v71;
*(_DWORD *)(v69 + 3996) = dword_BD1C;
}
if ( *(float *)(v69 + 3996) + v65 > 25.0 )
{
if ( *(float *)(v69 + 3996) >= 25.0 )
{
v30 = v69 + 260;
v31 = *(_DWORD *)(v69 + 3996);
CurrentDateTime(&v60);
v32 = std__operator___char_std__char_traits_char__std__allocator_char__(slog, &v60);
v33 = std__operator___std__char_traits_char__(v32, &unk_BA78);
v34 = std__ostream__operator__(v33, 58);
v35 = std__operator___std__char_traits_char__(v34, " :: ");
v36 = std__operator___std__char_traits_char__(v35, "CInputMain::SycPosition :: Dist too high (");
v37 = std__ostream__operator__(v36, v31);
v38 = std__operator___std__char_traits_char__(v37, " already) - skipping - Name (");
v39 = std__operator___char_std__char_traits_char__std__allocator_char__(v38, a4 + 260);
v40 = std__operator___std__char_traits_char__(v39, ") Target (");
v41 = std__operator___char_std__char_traits_char__std__allocator_char__(v40, v30);
v42 = std__operator___std__char_traits_char__(v41, ")");
std__ostream__operator__(v42, &std__endl_char_std__char_traits_char__);
std__string___string(&v60);
goto LABEL_25;
}
v43 = v69 + 260;
v44 = *(_DWORD *)(v69 + 3996);
CurrentDateTime(&v61);
v45 = std__operator___char_std__char_traits_char__std__allocator_char__(slog, &v61);
v46 = std__operator___std__char_traits_char__(v45, &unk_BA78);
v47 = std__ostream__operator__(v46, 61);
v48 = std__operator___std__char_traits_char__(v47, " :: ");
v49 = std__operator___std__char_traits_char__(v48, "CInputMain::SycPosition :: Dist too high (");
v50 = std__ostream__operator__(v49, v44);
v51 = std__operator___std__char_traits_char__(v50, " + ");
v52 = std__ostream__operator__(v51, LODWORD(v65));
v53 = std__operator___std__char_traits_char__(v52, ") - limiting - Name (");
v54 = std__operator___char_std__char_traits_char__std__allocator_char__(v53, a4 + 260);
v55 = std__operator___std__char_traits_char__(v54, ") Target (");
v56 = std__operator___char_std__char_traits_char__std__allocator_char__(v55, v43);
v57 = std__operator___std__char_traits_char__(v56, ")");
std__ostream__operator__(v57, &std__endl_char_std__char_traits_char__);
std__string___string(&v61);
v64 = v67 / v65;
v63 = v66 / v65;
v62 = 25.0 - *(float *)(v69 + 3996);
v74 -= (signed int)((v67 - v64 * v62) * 100.0);
v73 -= (signed int)((v66 - v63 * v62) * 100.0);
}
((void (__cdecl *)(int, int, int))CHARACTER__Sync)(v69, v74, v73);
}
}
LABEL_25:
++v75;
v76 += 12;
}
return v72 - 3;
}