Code:
bool Color = true;
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
LPDIRECT3DTEXTURE9 texYellow, texRed, texGreen, texBlue, texBlack, texWhite, texPink, texOrange, texLightBlue, texCyan, texPurple, texSteelBlue, texLightSteelBlue, texSalmon, texBrown, texTeal, texLime, texElectricLime, texGold, texOrangeRed, texGreenYellow, texAquaMarine, texSkyBlue, texSlateBlue, texCrimson, texDarkOliveGreen, texPaleGreen, texDarkGoldenRod, texFireBrick, texDarkBlue, texDarkerBlue, texDarkYellow, texLightYellow;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
HRESULT GenerateShader(LPDIRECT3DDEVICE9 pD3Ddev, IDirect3DPixelShader9 **pShader, float r, float g, float b )
{
char szShader[ 256 ];
ID3DXBuffer *pShaderBuf = NULL;
sprintf( szShader, "ps.1.1\ndef c0, %f, %f, %f, %f\nmov r0,c0", r, g, b, 1.0f );
D3DXAssembleShader( szShader, sizeof( szShader ), NULL, NULL, 0, &pShaderBuf, NULL );
if( FAILED( pD3Ddev->CreatePixelShader((const DWORD*)pShaderBuf->GetBufferPointer(), pShader)) )return E_FAIL;
return S_OK;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
if(Color)
{
GenerateTexture(pDevice, &texGreen , D3DCOLOR_ARGB(255,0,255,0));
GenerateTexture(pDevice, &texRed , D3DCOLOR_ARGB(255,255,0,0));
GenerateTexture(pDevice, &texBlue , D3DCOLOR_ARGB(255,0,0,255));
GenerateTexture(pDevice, &texOrange , D3DCOLOR_ARGB(255,255,165,0));
GenerateTexture(pDevice, &texYellow , D3DCOLOR_ARGB(255,255,255,0));
GenerateTexture(pDevice, &texPink , D3DCOLOR_ARGB(255,255,192,203));
GenerateTexture(pDevice, &texCyan , D3DCOLOR_ARGB(255,0,255,255));
GenerateTexture(pDevice, &texPurple , D3DCOLOR_ARGB(255,160,32,240));
GenerateTexture(pDevice, &texBlack , D3DCOLOR_ARGB(255,0,0,0));
GenerateTexture(pDevice, &texWhite , D3DCOLOR_ARGB(255,255,255,255));
GenerateTexture(pDevice, &texSteelBlue , D3DCOLOR_ARGB(255,33,104,140));
GenerateTexture(pDevice, &texLightSteelBlue, D3DCOLOR_ARGB(255,201,255,255));
GenerateTexture(pDevice, &texLightBlue , D3DCOLOR_ARGB(255,26,140,306));
GenerateTexture(pDevice, &texSalmon , D3DCOLOR_ARGB(255,196,112,112));
GenerateTexture(pDevice, &texBrown , D3DCOLOR_ARGB(255,168,99,20));
GenerateTexture(pDevice, &texTeal , D3DCOLOR_ARGB(255,38,140,140));
GenerateTexture(pDevice, &texLime , D3DCOLOR_ARGB(255,50,205,50));
GenerateTexture(pDevice, &texElectricLime , D3DCOLOR_ARGB(255,204,255,0));
GenerateTexture(pDevice, &texGold , D3DCOLOR_ARGB(255,255, 215, 0));
GenerateTexture(pDevice, &texOrangeRed , D3DCOLOR_ARGB(255,255,69,0));
GenerateTexture(pDevice, &texGreenYellow , D3DCOLOR_ARGB(255,173,255,47));
GenerateTexture(pDevice, &texAquaMarine , D3DCOLOR_ARGB(255,127,255,212));
GenerateTexture(pDevice, &texSkyBlue , D3DCOLOR_ARGB(255,0,191,255));
GenerateTexture(pDevice, &texSlateBlue , D3DCOLOR_ARGB(255,132, 112, 255));
GenerateTexture(pDevice, &texCrimson , D3DCOLOR_ARGB(255,220,20,60));
GenerateTexture(pDevice, &texDarkOliveGreen, D3DCOLOR_ARGB(255,188,238,104 ));
GenerateTexture(pDevice, &texPaleGreen , D3DCOLOR_ARGB(255,154,255, 154));
GenerateTexture(pDevice, &texDarkGoldenRod , D3DCOLOR_ARGB(255,255, 185, 15 ));
GenerateTexture(pDevice, &texFireBrick , D3DCOLOR_ARGB(255,255,48,48));
GenerateTexture(pDevice, &texDarkBlue , D3DCOLOR_ARGB(255,0,0,204));
GenerateTexture(pDevice, &texDarkerBlue , D3DCOLOR_ARGB(255,0,0,153));
GenerateTexture(pDevice, &texDarkYellow , D3DCOLOR_ARGB(255,255,204,0));
GenerateTexture(pDevice, &texLightYellow , D3DCOLOR_ARGB(255,255,255,153));
GenerateShader( pDevice, &Blue, 0.0f, 0.0f, 1.0f );
GenerateShader( pDevice, &Orange, 1.0f, 0.5f, 0.0f );
GenerateShader( pDevice, &Purple, 1.0f, 0.0f, 1.0f );
GenerateShader( pDevice, &White, 1.0f, 1.0f, 1.0f );
GenerateShader( pDevice, &Yellow, 1.0f, 1.0f, 0.0f );
Color = false;
}
if(m_Stride == 32 || m_Stride == 36 || m_Stride == 44 )
{
pDevice->SetRenderState(D3DRS_ZENABLE, true);
pDevice->SetTexture(0, texGreen);
pDrawIndexedPrimitive(pDevice,pType D3DparamvalX,nMinIndex,nNumVertices,nStartIndex,nPrimitiveCount);
pDevice->SetTexture(0, texRed);
pDevice->SetRenderState(D3DRS_ZENABLE, false);
}
ifif(m_Stride == 32 || m_Stride == 36 || m_Stride == 44 )
{
pDevice->SetRenderState( D3DRS_ZENABLE,false );
pDevice->SetRenderState( D3DRS_FILLMODE,D3DFILL_SOLID );
pDevice->SetPixelShader( White );
pDrawIndexedPrimitive(pDevice,pType D3DparamvalX,nMinIndex,nNumVertices,nStartIndex,nPrimitiveCount);
pDevice->SetRenderState( D3DRS_ZENABLE, true );
pDevice->SetRenderState( D3DRS_FILLMODE,D3DFILL_SOLID );
pDevice->SetPixelShader( Blue );
}
if(if(m_Stride == 32 || m_Stride == 36 || m_Stride == 44 )
{
SumStride=SumStride+4;
pDevice->SetRenderState(D3DRS_ZENABLE,false);
pDevice->SetRenderState(D3DRS_ALPHABLENDENABLE,false);
pDevice->SetRenderState(D3DRS_DESTBLEND,D3DBLEND_INVDESTCOLOR);
pDevice->SetRenderState(D3DRS_ZENABLE,false);
}
ifif(m_Stride == 32 || m_Stride == 36 || m_Stride == 44 )
{
pDevice->SetRenderState(D3DRS_ZENABLE,false);
pDevice->SetRenderState( D3DRS_SRCBLEND, 4 );
pDevice->SetRenderState(D3DRS_DESTBLEND,D3DBLEND_INVDESTCOLOR);
pDevice->SetRenderState(D3DRS_ZENABLE,false);
}
if(opt.d3d.HD)
{
pDevice->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCCOLOR);
}
if(opt.d3d.WhiteWalls)
{
pDevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCCOLOR);
}
if(opt.d3d.NoGun)
{
pDevice->SetRenderState(D3DRS_STENCILFUNC, D3DCMP_EQUAL);
}
have a blast. Credits to me on 90% of this. Will need modification to work with the dip posted here