Advertisement
dcomicboy

complete chams

Apr 7th, 2012
226
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.10 KB | None | 0 0
  1. // Top of your main file
  2. bool Color = true;
  3. LPDIRECT3DDEVICE9 pDevice;
  4. UINT OffsetInBytes;
  5. UINT m_Stride;
  6. LPDIRECT3DVERTEXBUFFER9 Stream_Data;
  7. UINT Offset = 0;
  8. UINT Stride = 0;
  9. //////////////////////////////////////////////////////////////////////////////////////////////////
  10. 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;
  11. /////////////////////////////////////////////////////////////////////////////////////////////////////
  12. HRESULT GenerateShader(LPDIRECT3DDEVICE9 pD3Ddev, IDirect3DPixelShader9 **pShader, float r, float g, float b )
  13. {
  14. char szShader[ 256 ];
  15. ID3DXBuffer *pShaderBuf = NULL;
  16. sprintf( szShader, "ps.1.1\ndef c0, %f, %f, %f, %f\nmov r0,c0", r, g, b, 1.0f );
  17. D3DXAssembleShader( szShader, sizeof( szShader ), NULL, NULL, 0, &pShaderBuf, NULL );
  18. if( FAILED( pD3Ddev->CreatePixelShader((const DWORD*)pShaderBuf->GetBufferPointer(), pShader)) )return E_FAIL;
  19. return S_OK;
  20. }
  21. ////////////////////////////////////////////////////////////////////////////////////////////////////////
  22.  
  23. //In your WINAPI DIP section
  24.  
  25. if(pDevice->GetStreamSource(0,&Stream_Data,&OffsetInBytes,&m_Stride) == D3D_OK)
  26. Stream_Data->Release();
  27. DWORD dwOldZEnable = D3DZB_TRUE;
  28.  
  29. if(Color)
  30. {
  31. GenerateTexture(pDevice, &texGreen , D3DCOLOR_ARGB(255,0,255,0));
  32. GenerateTexture(pDevice, &texRed , D3DCOLOR_ARGB(255,255,0,0));
  33. GenerateTexture(pDevice, &texBlue , D3DCOLOR_ARGB(255,0,0,255));
  34. GenerateTexture(pDevice, &texOrange , D3DCOLOR_ARGB(255,255,165,0));
  35. GenerateTexture(pDevice, &texYellow , D3DCOLOR_ARGB(255,255,255,0));
  36. GenerateTexture(pDevice, &texPink , D3DCOLOR_ARGB(255,255,192,203));
  37. GenerateTexture(pDevice, &texCyan , D3DCOLOR_ARGB(255,0,255,255));
  38. GenerateTexture(pDevice, &texPurple , D3DCOLOR_ARGB(255,160,32,240));
  39. GenerateTexture(pDevice, &texBlack , D3DCOLOR_ARGB(255,0,0,0));
  40. GenerateTexture(pDevice, &texWhite , D3DCOLOR_ARGB(255,255,255,255));
  41. GenerateTexture(pDevice, &texSteelBlue , D3DCOLOR_ARGB(255,33,104,140));
  42. GenerateTexture(pDevice, &texLightSteelBlue, D3DCOLOR_ARGB(255,201,255,255));
  43. GenerateTexture(pDevice, &texLightBlue , D3DCOLOR_ARGB(255,26,140,306));
  44. GenerateTexture(pDevice, &texSalmon , D3DCOLOR_ARGB(255,196,112,112));
  45. GenerateTexture(pDevice, &texBrown , D3DCOLOR_ARGB(255,168,99,20));
  46. GenerateTexture(pDevice, &texTeal , D3DCOLOR_ARGB(255,38,140,140));
  47. GenerateTexture(pDevice, &texLime , D3DCOLOR_ARGB(255,50,205,50));
  48. GenerateTexture(pDevice, &texElectricLime , D3DCOLOR_ARGB(255,204,255,0));
  49. GenerateTexture(pDevice, &texGold , D3DCOLOR_ARGB(255,255, 215, 0));
  50. GenerateTexture(pDevice, &texOrangeRed , D3DCOLOR_ARGB(255,255,69,0));
  51. GenerateTexture(pDevice, &texGreenYellow , D3DCOLOR_ARGB(255,173,255,47));
  52. GenerateTexture(pDevice, &texAquaMarine , D3DCOLOR_ARGB(255,127,255,212));
  53. GenerateTexture(pDevice, &texSkyBlue , D3DCOLOR_ARGB(255,0,191,255));
  54. GenerateTexture(pDevice, &texSlateBlue , D3DCOLOR_ARGB(255,132, 112, 255));
  55. GenerateTexture(pDevice, &texCrimson , D3DCOLOR_ARGB(255,220,20,60));
  56. GenerateTexture(pDevice, &texDarkOliveGreen, D3DCOLOR_ARGB(255,188,238,104 ));
  57. GenerateTexture(pDevice, &texPaleGreen , D3DCOLOR_ARGB(255,154,255, 154));
  58. GenerateTexture(pDevice, &texDarkGoldenRod , D3DCOLOR_ARGB(255,255, 185, 15 ));
  59. GenerateTexture(pDevice, &texFireBrick , D3DCOLOR_ARGB(255,255,48,48));
  60. GenerateTexture(pDevice, &texDarkBlue , D3DCOLOR_ARGB(255,0,0,204));
  61. GenerateTexture(pDevice, &texDarkerBlue , D3DCOLOR_ARGB(255,0,0,153));
  62. GenerateTexture(pDevice, &texDarkYellow , D3DCOLOR_ARGB(255,255,204,0));
  63. GenerateTexture(pDevice, &texLightYellow , D3DCOLOR_ARGB(255,255,255,153));
  64. GenerateShader( pDevice, &Blue, 0.0f, 0.0f, 1.0f );
  65. GenerateShader( pDevice, &Orange, 1.0f, 0.5f, 0.0f );
  66. GenerateShader( pDevice, &Purple, 1.0f, 0.0f, 1.0f );
  67. GenerateShader( pDevice, &White, 1.0f, 1.0f, 1.0f );
  68. GenerateShader( pDevice, &Yellow, 1.0f, 1.0f, 0.0f );
  69. Color = false;
  70.  
  71.  
  72. }
  73. if(m_Stride == 32 || m_Stride == 36 || m_Stride == 44 )
  74. {
  75. pDevice->SetRenderState(D3DRS_ZENABLE, true);
  76. pDevice->SetTexture(0, texGreen);
  77. pDrawIndexedPrimitive(pDevice,pType D3DparamvalX,nMinIndex,nNumVertices,nStartIndex,nPrimitiveCount);
  78. pDevice->SetTexture(0, texRed);
  79. pDevice->SetRenderState(D3DRS_ZENABLE, false);
  80. }
  81.  
  82. ifif(m_Stride == 32 || m_Stride == 36 || m_Stride == 44 )
  83. {
  84. pDevice->SetRenderState( D3DRS_ZENABLE,false );
  85. pDevice->SetRenderState( D3DRS_FILLMODE,D3DFILL_SOLID );
  86. pDevice->SetPixelShader( White );
  87. pDrawIndexedPrimitive(pDevice,pType D3DparamvalX,nMinIndex,nNumVertices,nStartIndex,nPrimitiveCount);
  88. pDevice->SetRenderState( D3DRS_ZENABLE, true );
  89. pDevice->SetRenderState( D3DRS_FILLMODE,D3DFILL_SOLID );
  90. pDevice->SetPixelShader( Blue );
  91.  
  92. }
  93.  
  94. if(if(m_Stride == 32 || m_Stride == 36 || m_Stride == 44 )
  95. {
  96. SumStride=SumStride+4;
  97. pDevice->SetRenderState(D3DRS_ZENABLE,false);
  98. pDevice->SetRenderState(D3DRS_ALPHABLENDENABLE,false);
  99. pDevice->SetRenderState(D3DRS_DESTBLEND,D3DBLEND_INVDESTCOLOR);
  100. pDevice->SetRenderState(D3DRS_ZENABLE,false);
  101.  
  102. }
  103.  
  104. ifif(m_Stride == 32 || m_Stride == 36 || m_Stride == 44 )
  105. {
  106. pDevice->SetRenderState(D3DRS_ZENABLE,false);
  107. pDevice->SetRenderState( D3DRS_SRCBLEND, 4 );
  108. pDevice->SetRenderState(D3DRS_DESTBLEND,D3DBLEND_INVDESTCOLOR);
  109. pDevice->SetRenderState(D3DRS_ZENABLE,false);
  110. }
  111.  
  112.  
  113. if(opt.d3d.HD)
  114. {
  115. pDevice->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCCOLOR);
  116. }
  117.  
  118. if(opt.d3d.WhiteWalls)
  119. {
  120. pDevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCCOLOR);
  121. }
  122.  
  123. if(opt.d3d.NoGun)
  124. {
  125. pDevice->SetRenderState(D3DRS_STENCILFUNC, D3DCMP_EQUAL);
  126. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement