Code:
HRESULT myPresent(LPDIRECT3DDEVICE9 pDevice, CONST RECT* pSourceRect,CONST RECT* pDestRect, HWND hDestWindowOverride,CONST RGNDATA* pDirtyRegion)
{
_asm NOP;
RenderFrame(pDevice);
/*Draws text in the top corner, saying the text below, can be changed to your liking, color can be changed too.*/
DrawGameTextPixel(10,25,White,"DeadHook 1.0.0");
//DrawRadar(radarX, radarY, 100, pDevice);
typedef PlayerInfo* (__thiscall *lpGetPlayerByIndex)(unsigned long ulThis,int index, int unk);
lpGetPlayerByIndex GetPlayerByIndex;
GetPlayerByIndex = (lpGetPlayerByIndex)(0x3715DD10);
unsigned long ulThis = *(unsigned long*)(0x3780A0A8);
char *szFormat = new char[ 256 ];
typedef PlayerInfo* (__thiscall *lpGetLocalPlayer)(unsigned long ulThis);
lpGetLocalPlayer GetLocalPlayer;
GetLocalPlayer = (lpGetLocalPlayer)(0x3715E6C0);
//if(CH_Name){
for ( int i = 0; i < 16; i++ )
{
PlayerInfo* pPlayer = GetPlayerByIndex( ulThis,i,0);
PlayerInfo* pLocal = GetPlayerByIndex( ulThis,i,0);
if(pPlayer != 0 && pPlayer->obj != 0 && pPlayer->IsDead ==0)
{
sprintf(szFormat,"%s",pPlayer->Name);
D3DXVECTOR3 Position;
if(WorldToScreen2(pPlayer, &Position))
//if(WorldToScreen(pDevice, pPlayer, &Position))
{
pDevice->SetRenderState( D3DRS_ZENABLE, D3DZB_FALSE );
pDevice->SetRenderState( D3DRS_FOGENABLE, false );
DrawGameTextPixel(Position.x, Position.y-60,0xFFEE2C2C,szFormat);
//DrawString(Position.x,Position.y-60,0xFFEE2C2C,ButtonFont,szFormat);
pDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_TRUE);
pDevice->SetRenderState( D3DRS_FOGENABLE, true );
}
}
//}
//if(CH_hBox){
for ( int i = 0; i < 16; i++ )
{
PlayerInfo* pPlayer = GetPlayerByIndex( ulThis,i,0);
PlayerInfo* pLocal = GetPlayerByIndex( ulThis,i,0);
if(pPlayer != 0 && pPlayer->obj != 0 && pPlayer->IsDead ==0)
{
sprintf(szFormat,"%s",pPlayer->Name);
D3DXVECTOR3 Position;
if(WorldToScreen2(pPlayer, &Position))
//if(WorldToScreen(pDevice, pPlayer, &Position))
{
pDevice->SetRenderState( D3DRS_ZENABLE, D3DZB_FALSE );
pDevice->SetRenderState( D3DRS_FOGENABLE, false );
DrawBorder(Position.x, Position.y,25,50,1.5,Red,pDevice);
//(Position.x,Position.y-60,0xFFEE2C2C,ButtonFont,szFormat);
pDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_TRUE);
pDevice->SetRenderState( D3DRS_FOGENABLE, true );
}
}
}
}
}
return pPresent(pDevice, pSourceRect, pDestRect, hDestWindowOverride, pDirtyRegion);
}
Code:
bool WorldToScreen2(PlayerInfo* pPlayer, D3DXVECTOR3 * pOut )
{
D3DVIEWPORT9 viewPort = {0};
D3DXVECTOR3 vWorld(pPlayer->obj->origin.x ,pPlayer->obj->origin.y, pPlayer->obj->origin.z);
CILTDrawPrim* pDrawPrim = *(CILTDrawPrim**)0x7FF010;
D3DXVec3Project( pOut, &vWorld, &viewPort, &pDrawPrim->Projection, &pDrawPrim->View, &pDrawPrim->World );
return ( pOut->z < 1.0f );
}