Thread: DrawPrim

Page 2 of 2 FirstFirst 12
Results 16 to 17 of 17
  1. #16
    DeadLinez's Avatar
    Join Date
    Dec 2009
    Gender
    male
    Location
    https://mpgh.net Sexy Points: 989,576,420
    Posts
    465
    Reputation
    11
    Thanks
    500
    My Mood
    Psychedelic
    Present
    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);
    	}

    W2S
    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 );
    }

    and i used his struct, and the public Client_Info struct.

  2. #17
    Hahaz's Avatar
    Join Date
    Sep 2008
    Gender
    male
    Location
    Matrix World
    Posts
    1,170
    Reputation
    64
    Thanks
    4,091
    My Mood
    Bored
    Quote Originally Posted by DeadLinez View Post
    Present
    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);
    	}

    W2S
    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 );
    }

    and i used his struct, and the public Client_Info struct.
    DeadLinez.. its easy fix,

    Code:
    D3DVIEWPORT9 viewPort = {0};
    You forgot this:

    Code:
    pDevice->GetViewport(&viewPort);
    Also, what's the point of this? i see u not using it :/

    Code:
    typedef PlayerInfo* (__thiscall *lpGetLocalPlayer)(unsigned long ulThis);
    lpGetLocalPlayer GetLocalPlayer;
    GetLocalPlayer   = (lpGetLocalPlayer)(0x3715E6C0);
    
    PlayerInfo* pLocal = GetPlayerByIndex( ulThis,i,0);
    Maybe i should make tut for you guys on this...

Page 2 of 2 FirstFirst 12