Results 1 to 1 of 1
  1. #1
    Dwar
    Dwar is offline
    Veteran Dwar's Avatar
    Join Date
    2010 Mar
    Posts
    2,222
    Thanks Thanks Given 
    211
    Thanks Thanks Received 
    2,230
    Thanked in
    292 Posts
    Rep Power
    10

    Single Player Nazi Zombie starter chams

    So if your starting d3d for first time and want to do chams. Here is an example from world at war nazi zombies (SINGLE PLAYER)
    as seen in this video chams arent complete but this is just example.

    okay so presuming you have the d3d starter kit include in your project and go to d3d9dev.cpp

    First we will have to add colors etc for chams so add these to your project:
    const BYTE bBlue[60] = 
    {
    0x42, 0x4D, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x36, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00,
    0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01,
    0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x12, 0x0B, 0x00, 0x00, 0x12, 0x0B, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0xFF, 0x00, 0x00, 0x00, 0x00, 0x00
    };

    const BYTE bGreen[60] =
    {
    0x42, 0x4D, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x36, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00,
    0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01,
    0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x12, 0x0B, 0x00, 0x00, 0x12, 0x0B, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x20, 0xA0, 0x00, 0x00, 0xFF, 0xFF
    };

    const BYTE bRed[60] =
    {
    0x42, 0x4D, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x36, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00,
    0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01,
    0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x12, 0x0B, 0x00, 0x00, 0x12, 0x0B, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0xFF, 0x00, 0x00, 0x00
    };

    Then add:

    LPDIRECT3DTEXTURE9 texRed, texBlue, texGreen;

    Okay Now go to initialise and add:
    D3DXCreateTextureFromFileInMemory(m_pD3Ddev, (LPCVOID)&bRed,  60,  &texRed); 
    D3DXCreateTextureFromFileInMemory(m_pD3Ddev, (LPCVOID)&bBlue, 60, &texBlue);
    D3DXCreateTextureFromFileInMemory(m_pD3Ddev, (LPCVOID)&bBlue, 60, &texBlue);

    and search for:
    HRESULT APIENTRY hkIDirect3DDevice9::DrawIndexedPrimitive(D3DPRIMIT  IVETYPE Type,INT BaseVertexIndex,UINT MinVertexIndex,UINT NumVertices,UINT startIndex,UINT primCount)

    Okay this is where we will do the wallhack. so first we would find the strides, numverts, primcounts, start index if needed.. using a stride logger.

    Then once we have them we would define them as you can see here->
    #define Zombies  ((NumVertices == 77 && primCount == 86) || (NumVertices == 79 && primCount == 86) || (NumVertices == 125 ) || (NumVertices ==  137 && primCount == 100 ) || (NumVertices ==  224 ) || (NumVertices == 237 ) || (NumVertices ==  228 ) || (NumVertices == 273  && primCount == 264 ) || (NumVertices ==  283 && primCount == 288  ) || (NumVertices == 308 && primCount == 319 ) || (NumVertices == 374 && primCount == 548  ) || (NumVertices == 438 && primCount == 568 ) || (NumVertices == 439 && primCount == 602 ) || (NumVertices == 645 && primCount == 690 ) || (NumVertices == 1219 && primCount == 1416 ) || (NumVertices == 1212 && primCount == 1348 ) || (NumVertices == 1219 && primCount == 1416 ) || (NumVertices ==  && primCount ==  ))
    #define MyPlayer ((NumVertices == 2446) || (NumVertices == 1033))
    #define weapons ((NumVertices == 74 && primCount == 58) || (NumVertices == 1481 && primCount == 1590 ) || (NumVertices == 1521 && primCount == 1494 ) || (NumVertices == 32 && primCount == 12 ) || (NumVertices == 219 && primCount == 172 ))

    Then to do the wallhack & chams we would add this...
    HRESULT APIENTRY hkIDirect3DDevice9::DrawIndexedPrimitive(D3DPRIMIT  IVETYPE Type,INT BaseVertexIndex,UINT MinVertexIndex,UINT NumVertices,UINT startIndex,UINT primCount)
    {

    if (Zombies)
    {

    m_pD3Ddev->SetRenderState(D3DRS_ZENABLE, false);
    m_pD3Ddev->SetTexture(0, texRed);
    m_pD3Ddev->DrawIndexedPrimitive(Type,BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount); //Draw Everything
    m_pD3Ddev->SetRenderState(D3DRS_ZENABLE, true);
    m_pD3Ddev->SetTexture(0, texBlue);
    }

    if(Weapons)
    {
    m_pD3Ddev->SetRenderState(D3DRS_ZENABLE, false);
    m_pD3Ddev->SetTexture(0, texGreen;
    m_pD3Ddev->DrawIndexedPrimitive(Type,BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount); //Draw Everything
    m_pD3Ddev->SetRenderState(D3DRS_ZENABLE, true);
    m_pD3Ddev->SetTexture(0, texGreen);
    }
    }
    return m_pD3Ddev->DrawIndexedPrimitive(Type,BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount);
    }

    There are other methods of Adding textures i use RGB but im not showing it here. this is just a quick way to get chams and as i said its not fully finished its just to get the idea.

    If somebody wonders how these color-bytes are generated. They are a single-color bitmap opened up in a hexadecimal form. Just construct the byte from the data given in the hexa-output.
    Or simply point to a 1x1 single-color bitmap instead:
    LPDIRECT3DTEXTURE9 redBitmapColor;
    #define REDBMP ".\BitmapColors\Red.png"
    D3DXCreateTextureFromFile(m_pD3Ddev, REDBMP, &redBitmapColor);

    and an another idea:
    HRESULT GenerateTexture( LPDIRECT3DDEVICE9 pD3Ddev, IDirect3DTexture9 **ppD3Dtex, DWORD colour32 )
    {
    if( FAILED( pD3Ddev->CreateTexture( 8, 8, 1, 0, D3DFMT_A4R4G4B4, D3DPOOL_MANAGED, ppD3Dtex, NULL ) ) )
    return E_FAIL;

    WORD colour16 = ( (WORD)( ( colour32 >> 28 ) & 0xF ) << 12 )
    |(WORD)( ( ( colour32 >> 20 ) & 0xF ) << 8 )
    |(WORD)( ( ( colour32 >> 12 ) & 0xF ) << 4 )
    |(WORD)( ( ( colour32 >> 4 ) & 0xF ) << 0 );

    D3DLOCKED_RECT d3dlr;
    (*ppD3Dtex)->LockRect( 0, &d3dlr, 0, 0 );
    WORD * pDst16 = (WORD *)d3dlr.pBits;

    for( int xy = 0; xy < 8 * 8; xy++ )
    *pDst16++ = colour16;

    (*ppD3Dtex)->UnlockRect( 0 );

    return S_OK;
    }

    ...Generate texture once with any RGB value:
    GenerateTexture( pDevice, &WhiteTexture, D3DCOLOR_RGBA( 255, 255, 255, 255 ) );
    by Salt3r
    Last edited by Grooguz; 2011-12-15 at 09:07 AM.
    Please, post your questions on forum, not by PM or mail

    I spend my time, so please pay a little bit of your time to keep world in equilibrium

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •