Results 1 to 2 of 2
  1. #1
    goalkeeper's Avatar
    Join Date
    Jul 2021
    Gender
    male
    Posts
    2
    Reputation
    10
    Thanks
    0

    WorldToScreen External

    does anyone know how i can calculate the worldtoscreen for this game?

    I'm using it this way and calculating like this, but it doesn't stay on the screen correctly

    PlayerPosition
    Code:
    //How i use playerposition, because the y takes the position of the z
    D3DXVECTOR3 Screen, HeadPos;	
    		HeadPos = { pfnEntity[i].pos[0], pfnEntity[i].pos[2], pfnEntity[i].pos[1] };

    WorldToScreen function
    Code:
    //Matrix 
    //0xDD7230 offset CFBR
    void WorldToScreen(D3DXVECTOR3* vecWorld, D3DXVECTOR3* vecScreen)
    {	
    D3DXMATRIX m;	
    	ReadProcessMemory(MyHandle, (PBYTE*)(Crossfire + 0xDD7230), &m, sizeof(D3DXMATRIX), 0);
    	
    	DWORD dwLenX = rWidth;
    	DWORD dwLenY = rHeight;
    	
    	vecScreen->x = vecWorld->x * m._11 + vecWorld->y * m._21 + vecWorld->z * m._31 + m._41;
    	vecScreen->y = vecWorld->x * m._12 + vecWorld->y * m._22 + vecWorld->z * m._32 + m._42;
    	vecScreen->z = vecWorld->x * m._13 + vecWorld->y * m._23 + vecWorld->z * m._33 + m._43;	
    	
    	float dv = 1.0f / vecScreen->z;
    	vecScreen->x *= dv * dwLenX;
    	vecScreen->y *= dv * dwLenY;
    }
    Could someone tell me why it doesn't work?
    Last edited by goalkeeper; 07-24-2021 at 01:54 PM.

  2. #2
    xuansheng's Avatar
    Join Date
    Jan 2020
    Gender
    male
    Posts
    4
    Reputation
    10
    Thanks
    8

    aa

    Code:
    bool World2Screen(D3DXVECTOR3* InOut) {
    	D3DXVECTOR3 vScreen;
    	D3DXVECTOR3 PlayerPos(InOut->x, InOut->y, InOut->z);
    	D3DVIEWPORT9 viewPort = { 0 };
    	D3DXMATRIX projection, view, world;
    	view = CMemory::instance()->Read<D3DXMATRIX>(Matrix - 0x80);
    	projection = CMemory::instance()->Read<D3DXMATRIX>(Matrix - 0x40);
    	viewPort = CMemory::instance()->Read<D3DVIEWPORT9>(Matrix);
    
    	world = D3DXMATRIX(
    		1.0f, 0.0f, 0.0f, 0.0f,
    		0.0f, 1.0f, 0.0f, 0.0f,
    		0.0f, 0.0f, 1.0f, 0.0f,
    		0.0f, 0.0f, 0.0f, 1.0f);
    	D3DXVec3Project(&vScreen, &PlayerPos, &viewPort, &projection, &view, &world);
    	if (vScreen.z <= 1.0f) {
    		*InOut = vScreen;
    		return true;
    	}
    	return false;
    
    }
    Need to import d3dx9.h and d3dx9.lib files
    Matrix = 00 00 00 00 00 00 00 00 ?? ?? 00 00 ?? 03 00 00 ?? ?? ?? ?? 00 00 80 3F The static address found is
    Last edited by xuansheng; 07-30-2021 at 10:02 AM. Reason: Need to import d3dx9.h and d3dx9.lib files

Similar Threads

  1. Replies: 5
    Last Post: 09-05-2009, 01:10 PM
  2. New external harddrive
    By PyrexxHero® in forum General
    Replies: 4
    Last Post: 07-26-2009, 05:22 AM
  3. External links for hacks foribben.
    By EndRiT in forum WarRock - International Hacks
    Replies: 13
    Last Post: 04-08-2009, 05:48 AM
  4. a question on external files
    By mpghhackersrock123 in forum WarRock - International Hacks
    Replies: 9
    Last Post: 09-02-2007, 05:23 AM
  5. how do you put hacks on an external drive
    By mpghhackersrock123 in forum WarRock - International Hacks
    Replies: 23
    Last Post: 09-01-2007, 06:22 PM