Was bored again. This is how the game calculates WorldToScreen.

Offsets are for MP.

Code:

bool WorldToScreen ( float flVec[ 3 ], float* flScreen )
{
DWORD screenMatrix = ( ( *(DWORD*)0x1337F48 == 2 ) ? 0x1338030 : 0x1337F50 );
float * flWorld = (float*)0x96A298, *flWorld2 = (float*)0x96A2A4;
float flVec[ 3 ], flVec2[3];
flVec[ 0 ] = flVec[ 0 ] - flWorld[ 0 ];
flVec[ 1 ] = flVec[ 1 ] - flWorld[ 1 ];
flVec[ 2 ] = flVec[ 2 ] - flWorld[ 2 ];
float dp = sqrt( ( ( flVec[ 0 ] * flVec[ 0 ] ) + ( flVec[ 1 ] * flVec[ 1 ] ) + ( flVec[ 2 ] * flVec[ 2 ] ) ) );
if( -dp >= 0.f )
dp = 1.f;
float flTmp = 1.f / dp;
flVec[ 0 ] *= flTmp;
flVec[ 1 ] *= flTmp;
flVec[ 2 ] *= flTmp;
flVec[ 0 ] = ( ( flVec[ 0 ] * flWorld2[ 0 ] ) + ( flVec[ 1 ] * flWorld2[ 1 ] ) + ( flVec[ 2 ] * flWorld2[ 2 ] ) );
flVec[ 1 ] = ( ( flVec[ 0 ] * flWorld2[ 3 ] ) + ( flVec[ 1 ] * flWorld2[ 4 ] ) + ( flVec[ 2 ] * flWorld2[ 5 ] ) );
flVec[ 2 ] = ( ( flVec[ 0 ] * flWorld2[ 6 ] ) + ( flVec[ 1 ] * flWorld2[ 7 ] ) + ( flVec[ 2 ] * flWorld2[ 8 ] ) );
if( flVec[ 0 ] > 0.f )
{
flScreen[ 0 ] = ( *(float*)(screenMatrix+0x20) * 0.5f * ( 1.f - ( flVec[ 1 ] / *(float*)0x96A290 ) / flVec[ 0 ] ) );
flScreen[ 1 ] = ( *(float*)(screenMatrix+0x24) * 0.5f * ( 1.f - ( flVec[ 2 ] / *(float*)0x96A294 ) / flVec[ 0 ] ) );
return true;
}
return false;
}

Example:

Code:

float flOut[ 2 ], flPosition[ 3 ];
cEngine->GetTagPosition( cg_entities[ i ], wBoneTables[ j_head ], &flPosition );
if( WorldToScreen( flPosition, &flOut ) )
cEngine->DrawText( flOut[ 0 ], flOut[ 1 ], cEngine->EspFont, "[ x ]" );