bool Goodies = false; bool Baddies = false; VOID ( *orig_DrawXModelSkinnedParent )( ); __declspec(naked) VOID R_DrawXModelSkinnedParent( ) { char *pShader; _asm pushad _asm mov ebx, [edi+0xb8] _asm mov eax, [eax] _asm mov pShader, ebx if( !strstr( pShader, "mi24p" ) && !strstr( pShader, "weapon" ) && !strstr( pShader, "cobra" ) ) { if( strstr( pShader, "sas" ) || strstr( pShader, "usmc" ) ) { Goodies = true; } else if( strstr( pShader, "opforce" ) || strstr( pShader, "arab" ) || strstr( pShader, "head_suren" ) ) { Baddies = true; } } _asm popad _asm jmp [ orig_DrawXModelSkinnedParent ] } VOID ( *orig_DrawXModelSkinnedCached )( ); __declspec(naked) VOID R_DrawXModelSkinnedCached( ) { char *pShader; _asm pushad _asm mov ebx, [edi+0xb8] _asm mov eax, [ebx] _asm mov pShader, eax if( !strstr( pShader, "mi24p" ) && !strstr( pShader, "weapon" ) && !strstr( pShader, "cobra" ) ) { if( strstr( pShader, "sas" ) || strstr( pShader, "usmc" ) ) { Goodies = true; } else if( strstr( pShader, "opforce" ) || strstr( pShader, "arab" ) || strstr( pShader, "head_suren" ) ) { Baddies = true; } } _asm popad _asm jmp [ orig_DrawXModelSkinnedCached ] } //D3D Model Rec CALL BEFORE D3D HOOK!! orig_DrawXModelSkinnedParent = (void (__cdecl *)(void) ) \ DetourFunction( (PBYTE)0x61D9A0, (PBYTE)R_DrawXModelSkinnedParent ); //D3D Model Rec CALL BEFORE D3D HOOK!! orig_DrawXModelSkinnedCached = (void (__cdecl *)(void) ) \ DetourFunction( (PBYTE)0x61D8A0, (PBYTE)R_DrawXModelSkinnedCached ); //In Primitive HRESULT APIENTRY hkIDirect3DDevice9::DrawIndexedPrimitive(D3DPRIMITIVETYPE Type,INT BaseVertexIndex,UINT MinVertexIndex,UINT NumVertices,UINT startIndex,UINT primCount) { if( show ) { if( Mom_Chams->integer == 1 ) { if( Baddies ) { m_pD3Ddev->SetTexture( 0, texYellow ); //Behind Wall m_pD3Ddev->SetRenderState( D3DRS_ZENABLE, D3DZB_FALSE ); m_pD3Ddev->DrawIndexedPrimitive( Type, BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount ); m_pD3Ddev->SetTexture( 0, texRed ); //Normal View m_pD3Ddev->SetRenderState( D3DRS_ZENABLE, D3DZB_TRUE ); m_pD3Ddev->DrawIndexedPrimitive( Type, BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount ); } if( Goodies ) { m_pD3Ddev->SetTexture( 0, texYellow ); //Behind Wall m_pD3Ddev->SetRenderState( D3DRS_ZENABLE, D3DZB_FALSE ); m_pD3Ddev->DrawIndexedPrimitive( Type, BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount ); m_pD3Ddev->SetTexture( 0, texBlue ); //Normal View m_pD3Ddev->SetRenderState( D3DRS_ZENABLE, D3DZB_TRUE ); m_pD3Ddev->DrawIndexedPrimitive( Type, BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount ); } } } Baddies = false; Goodies = false; return m_pD3Ddev->DrawIndexedPrimitive(Type,BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount); }