bool HOOK_IsDrawingLoadingImage( void )
{
__asm pushad;
static bool bOnce = true;
static bool bOffsetsFound = true;
if( bOnce )
{
std::for_each( namesMap.begin( ), namesMap.end( ), []( pair< const char*, DWORD > curelem )
{
if( curelem.second == -1 )
{
Warning( "Could not get offset from %s\n", curelem.first );
bOffsetsFound = false;
}
else
{
Msg( "Prop :%s | Offset :%x\n", curelem.first, curelem.second );
}
}
);
bOnce = false;
}
if( g_pClientEngine->IsInGame( ) )
{
if( !bOffsetsFound )
{
goto Label;
}
int iLocalIndex = -1;
int iLocalTeam = -1;
void* pLocalEntity = g_pClientEntityList->GetClientEntity( g_pClientEngine->GetLocalPlayer( ) )->GetBaseEntity( );
for( int i = 0; i <= g_pClientEngine->GetMaxClients( ); i++ )
{
IClientEntity *pClientEntity = g_pClientEntityList->GetClientEntity( i );
if( pClientEntity )
{
if( pClientEntity->GetBaseEntity( ) == pLocalEntity )
{
iLocalIndex = i;
break;
}
}
}
GR_Fn GetRes = nullptr;
void* pRadarList = nullptr;
for( int i = 0; i < sizeof( sigList ) / sizeof( Signatures ); i++ )
{
if( !strcmp( sigList[i].name, "GetGameResources" ) )
{
GetRes = (GR_Fn)sigList[i].offset;
}
if( !strcmp( sigList[i].name, "m_pRadarList" ) )
{
if( sigList[i].offset != nullptr && sigList[i].offset != (void*)-1 )
{
pRadarList = *(void**)((DWORD)sigList[i].offset+0x2);
}
}
}
if( pRadarList != nullptr )
{
void* mapPlayers = *(void**)pRadarList;
for( int i = 1; i < g_pClientEngine->GetMaxClients( ); i++ )
{
IClientEntity *pEntity = g_pClientEntityList->GetClientEntity( i );
if( !pEntity )
{
continue;
}
void* pBaseEntity = g_pClientEntityList->GetClientEntity( i );
if( *READ_OFFS( int, mapPlayers, i * 0x140 + HEALTH_OFFSET ) != 0 )
{
Vector vecOrigin;
Vector vecMins( -20, -20, 0 );
Vector vecMaxs( 20, 20, 75);
QAngle angRot( 0, 0, 0 );
int iHealth = *READ_OFFS( int, mapPlayers, i*0x140 + HEALTH_OFFSET );
if( iHealth == 0 )
{
continue;
}
int iTeam = *READ_OFFS( int, mapPlayers, i * 0x140 +TEAM_OFFSET );
char* szName = READ_OFFS( char, mapPlayers, i * 0x140 + NAME_OFFSET );
if( pEntity->IsDormant( ) )//READ_PTR( int, pBaseEntity, m_PlayerFog.m_hCtrl, 0 ) == 0 )
{
vecOrigin = pEntity->GetAbsOrigin( );
}
else
{
vecOrigin = *READ_OFFS( Vector, mapPlayers, i * 0x140 + ORIGIN_OFFSET );
}
if( iTeam > 1 )
{
char szFormatName[64];
sprintf( szFormatName, "%s\n--[%d]--", szName, iHealth );
g_pDbgOverlay->AddEntityTextOverlay( i + 1, 0, 0.01, iTeam == 2 ? 255 : 0, 0, iTeam == 3 ? 255 : 0, 255, szFormatName );
g_pDbgOverlay->AddBoxOverlay( vecOrigin, vecMins, vecMaxs, angRot, iTeam == 2 ? 255 : 0, 0, iTeam == 3 ? 255 : 0, 30, 0.07 );
}
}
}
}
}
Label:
__asm popad;
__asm call p_fnOldFunction;
}
Comments