Advertisement
Guest User

Untitled

a guest
Jun 18th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Globals:
  2.  
  3. int colored walls;
  4.  
  5. walls)//your bool statement in globals
  6.  
  7. texnum = (nNumVertices*100000)+nPrimitiveCount;//having it in texnums never hurts, unless its just a stride
  8.  
  9. if(m_Stride == model_rec)//Model Recognition, this recognizes what you want to color in, so we would have to get a Model Recognition logger, go in game and find the Stride for the wall/floor
  10. {
  11.  
  12. {
  13. pDevice->SetTexture( 0, Red ); //we colored it red. How'd we get to color it check out the next shizznet under this, chams..
  14. }
  15. return pDrawIndexedPrimitive(pDevice, pType, nMinIndex, nNumVertices, nStartIndex, nPrimitiveCount);
  16. }
  17.  
  18. //==================================Defines============================================
  19. #define ForceRecon (nNumVertices == 83 && nPrimitiveCount == 137 || nNumVertices == 79 && nPrimitiveCount == 105 || nNumVertices == 142 && nPrimitiveCount == 174 || nNumVertices == 278 && nPrimitiveCount == 462 || nNumVertices == 263 && nPrimitiveCount == 290 || nNumVertices == 316 && nPrimitiveCount == 556)
  20. #define ForceReconAddons (nNumVertices == 432 && nPrimitiveCount == 354 || nNumVertices == 144 && nPrimitiveCount == 136 || nNumVertices == 299 && nPrimitiveCount == 311 || nNumVertices == 167 && nPrimitiveCount == 252 || nNumVertices == 298 && nPrimitiveCount == 506 || nNumVertices == 168 && nPrimitiveCount == 254 || nNumVertices == 860 && nNumVertices == 778 || nNumVertices == 648 && nPrimitiveCount == 710 || nNumVertices == 113 && nPrimitiveCount == 189 || nNumVertices == 142 && nPrimitiveCount == 172 || nNumVertices == 87 && nPrimitiveCount == 90 || nNumVertices == 79 && nPrimitiveCount == 105 || nNumVertices == 84 && nPrimitiveCount == 110 || nNumVertices == 70 && nPrimitiveCount == 70 || nNumVertices == 860 && nPrimitiveCount == 778 || nNumVertices == 85 && nPrimitiveCount == 137)
  21. #define Mulan (nNumVertices == 118 && nPrimitiveCount == 126|| nNumVertices == 121 && nPrimitiveCount == 180|| nNumVertices == 124 && nPrimitiveCount == 126|| nNumVertices == 295 && nPrimitiveCount == 482|| nNumVertices == 299 && nPrimitiveCount == 452|| nNumVertices == 474 && nPrimitiveCount == 728)
  22. #define MulanAddons (nNumVertices == 162 && nPrimitiveCount == 200|| nNumVertices == 120 && nPrimitiveCount == 188|| nNumVertices == 167 && nPrimitiveCount == 276|| nNumVertices == 108 && nPrimitiveCount == 198|| nNumVertices == 512 && nPrimitiveCount == 728|| nNumVertices == 790 && nPrimitiveCount == 881|| nNumVertices == 619 && nPrimitiveCount == 800|| nNumVertices == 399 && nPrimitiveCount == 532|| nNumVertices == 402 && nPrimitiveCount == 580|| nNumVertices == 102 && nPrimitiveCount == 170|| nNumVertices == 125 && nPrimitiveCount == 98|| nNumVertices == 116 && nPrimitiveCount == 128|| nNumVertices == 160 && nPrimitiveCount == 174)
  23. //========================================================
  24.  
  25. int m_Stride;
  26. int texnum;
  27. int nNumVertices;
  28. int nPrimitiveCount;
  29. LPDIRECT3DTEXTURE8 Red;
  30. LPDIRECT3DTEXTURE8 Yellow;
  31. LPDIRECT3DTEXTURE8 Green;
  32. LPDIRECT3DTEXTURE8 Blue;
  33. LPDIRECT3DTEXTURE8 Purple;
  34. LPDIRECT3DTEXTURE8 Orange;
  35. LPDIRECT3DTEXTURE8 Pink;
  36. LPDIRECT3DTEXTURE8 White;
  37. LPDIRECT3DTEXTURE8 Black;
  38. bool chams = false;
  39. bool Color = true;
  40.  
  41. //======================================================================================================================================================================================================================================================================================================================//
  42. HRESULT GenerateTexture(IDirect3DDevice8 *pD3Ddev, IDirect3DTexture8 **ppD3Dtex, DWORD colour32)
  43. {
  44. if( FAILED(pD3Ddev->CreateTexture(8, 8, 1, 0, D3DFMT_A4R4G4B4, D3DPOOL_MANAGED, ppD3Dtex)) )
  45. return E_FAIL;
  46.  
  47. WORD colour16 = ((WORD)((colour32>>28)&0xF)<<12)
  48. |(WORD)(((colour32>>20)&0xF)<<8)
  49. |(WORD)(((colour32>>12)&0xF)<<4)
  50. |(WORD)(((colour32>>4)&0xF)<<0);
  51.  
  52. D3DLOCKED_RECT d3dlr;
  53. (*ppD3Dtex)->LockRect(0, &d3dlr, 0, 0);
  54. WORD *pDst16 = (WORD*)d3dlr.pBits;
  55.  
  56. for(int xy=0; xy < 8*8; xy++)
  57. *pDst16++ = colour16;
  58.  
  59. (*ppD3Dtex)->UnlockRect(0);
  60.  
  61. return S_OK;
  62. }
  63. //==============================================================================================================
  64.  
  65. bool Color = true;
  66.  
  67. typedef HRESULT ( WINAPI* oEndScene ) ( LPDIRECT3DDEVICE8 pDevice );
  68. oEndScene pEndScene;
  69.  
  70. HRESULT WINAPI myEndScene(LPDIRECT3DDEVICE8 pDevice)
  71. {
  72. if(Color)
  73. {
  74. GenerateTexture(pDevice, &Red, D3DCOLOR_ARGB (255 , 255 , 0 , 0 ));
  75. GenerateTexture(pDevice, &Yellow, D3DCOLOR_ARGB (255 , 255 , 255 , 0 ));
  76. GenerateTexture(pDevice, &Green, D3DCOLOR_ARGB (255 , 0 , 255 , 0 ));
  77. GenerateTexture(pDevice, &Blue, D3DCOLOR_ARGB (255 , 0 , 0 , 255 ));
  78. GenerateTexture(pDevice, &Purple, D3DCOLOR_ARGB (255 , 102 , 0 , 153 ));
  79. GenerateTexture(pDevice, &Pink, D3DCOLOR_ARGB (255 , 255 , 20 , 147 ));
  80. GenerateTexture(pDevice, &Orange, D3DCOLOR_ARGB (255 , 255 , 165 , 0 ));
  81. GenerateTexture(pDevice, &Black, D3DCOLOR_ARGB (255 , 0 , 0 , 0 ));
  82. GenerateTexture(pDevice, &White, D3DCOLOR_ARGB (255 , 255 , 255 , 255 ));
  83. Color=false;
  84. }
  85.  
  86. return pEndScene(pDevice);
  87. }
  88.  
  89. typedef HRESULT ( WINAPI* oDrawIndexedPrimitive ) ( LPDIRECT3DDEVICE8 pDevice, D3DPRIMITIVETYPE pType, UINT nMinIndex, UINT nNumVertices, UINT nStartIndex, UINT nPrimitiveCount );
  90. oDrawIndexedPrimitive pDrawIndexedPrimitive;
  91.  
  92. HRESULT WINAPI myDrawIndexedPrimitive(LPDIRECT3DDEVICE8 pDevice, D3DPRIMITIVETYPE pType, UINT nMinIndex, UINT nNumVertices, UINT nStartIndex, UINT nPrimitiveCount)
  93. {
  94.  
  95. if(chams)
  96. {
  97. texnum = (nNumVertices*100000)+nPrimitiveCount;
  98. if(m_Stride==40 &&
  99. (texnum==34900580)|| // Delta Force Head
  100. (texnum==36100604)|| // Spetsnaz Head
  101. (texnum==38000658)|| // Spetsnaz Legs
  102. (texnum==18300268)|| // Spetsnaz Body
  103. (texnum==36200604)|| // GIGN Head
  104. (texnum==21200306)|| // GIGN Body
  105. (texnum==35500568)|| // GSG9 Head
  106. (texnum==2200024)|| // GSG9 Bangs
  107. (texnum==8800105)|| // GSG9 Feet
  108. (texnum==36900650)|| // GSG9 Legs
  109. (texnum==19600314)|| // GSG9 Body
  110. (texnum==36700612)|| // SAS Head
  111. (texnum==8500105)|| // SAS Feet
  112. (texnum==37000650)|| // SAS Legs
  113. (texnum==18000274)|| // SAS Body
  114. (texnum==35300556)|| // KSF Head
  115. (texnum==7500121)|| // KSF Arms
  116. (texnum==9200115)|| // KSF Feet
  117. (texnum==12400168)|| // KSF Hands
  118. (texnum==30100522)|| // KSF Legs
  119. (texnum==18700288)|| // KSF Body
  120. (texnum==40900594)|| // ARTC Head
  121. (texnum==11700190)|| // ARTC Arms
  122. (texnum==9100118)|| // ARTC Feet
  123. (texnum==12500170)|| // ARTC Hands
  124. (texnum==37000634)|| // ARTC Legs
  125. (texnum==41700516)|| // ARTC Body
  126. (texnum==19400260)|| // ROKMC Body
  127. (texnum==37900592)|| // ROKMC Head
  128. (texnum==36500642)|| // ROKMC Legs
  129. (texnum==44800776)|| // SRG Head
  130. (texnum==15900200)|| // SRG Left Arm
  131. (texnum==10500168)|| // SRG Right Arm
  132. (texnum==80401016)|| // SRG Body
  133. (texnum==10000121)|| // SRG Feet
  134. (texnum==13200180)|| // SRG Hands
  135. (ForceRecon)|| // ForceRecon
  136. (Mulan)||
  137. (texnum==33800534)) // SRG Leg
  138.  
  139. {
  140. pDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);
  141. pDevice->SetRenderState(D3DRS_ZFUNC,D3DCMP_NEVER);
  142. pDevice->SetTexture(0,Yellow);
  143. pDrawIndexedPrimitive(pDevice, pType, nMinIndex, nNumVertices, nStartIndex, nPrimitiveCount);
  144. pDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_TRUE);
  145. pDevice->SetRenderState(D3DRS_ZFUNC,D3DCMP_LESSEQUAL);
  146. pDevice->SetTexture(0,Red);
  147. }
  148.  
  149. if (nNumVertices == 213 && nPrimitiveCount == 174) // M67 Grenade =============== //
  150. {
  151. pDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);
  152. pDevice->SetRenderState(D3DRS_ZFUNC,D3DCMP_NEVER);
  153. pDevice->SetTexture(0,Red);
  154. pDrawIndexedPrimitive(pDevice, pType, nMinIndex, nNumVertices, nStartIndex, nPrimitiveCount);
  155. pDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_TRUE);
  156. pDevice->SetRenderState(D3DRS_ZFUNC,D3DCMP_LESSEQUAL);
  157. pDevice->SetTexture(0,Green);
  158. }
  159. if (nNumVertices == 158 && nPrimitiveCount == 131) // Flashbang =============== //
  160. {
  161. pDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);
  162. pDevice->SetRenderState(D3DRS_ZFUNC,D3DCMP_NEVER);
  163. pDevice->SetTexture(0,Red);
  164. pDrawIndexedPrimitive(pDevice, pType, nMinIndex, nNumVertices, nStartIndex, nPrimitiveCount);
  165. pDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_TRUE);
  166. pDevice->SetRenderState(D3DRS_ZFUNC,D3DCMP_LESSEQUAL);
  167. pDevice->SetTexture(0,Green);
  168. }
  169. if (nNumVertices == 171 && nPrimitiveCount == 143) // Smoke Grenade =============== //
  170. {
  171. pDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);
  172. pDevice->SetRenderState(D3DRS_ZFUNC,D3DCMP_NEVER);
  173. pDevice->SetTexture(0,Red);
  174. pDrawIndexedPrimitive(pDevice, pType, nMinIndex, nNumVertices, nStartIndex, nPrimitiveCount);
  175. pDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_TRUE);
  176. pDevice->SetRenderState(D3DRS_ZFUNC,D3DCMP_LESSEQUAL);
  177. pDevice->SetTexture(0,Blue);
  178. }
  179. if (nNumVertices == 271 && nPrimitiveCount == 257) // VX Grenade =============== //
  180. {
  181. pDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);
  182. pDevice->SetRenderState(D3DRS_ZFUNC,D3DCMP_NEVER);
  183. pDevice->SetTexture(0,Red);
  184. pDrawIndexedPrimitive(pDevice, pType, nMinIndex, nNumVertices, nStartIndex, nPrimitiveCount);
  185. pDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_TRUE);
  186. pDevice->SetRenderState(D3DRS_ZFUNC,D3DCMP_LESSEQUAL);
  187. pDevice->SetTexture(0,Blue);
  188. }
  189. if (nNumVertices == 338 && nPrimitiveCount == 339) // RGD-5 Grenade =============== //
  190. {
  191. pDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);
  192. pDevice->SetRenderState(D3DRS_ZFUNC,D3DCMP_NEVER);
  193. pDevice->SetTexture(0,Red);
  194. pDrawIndexedPrimitive(pDevice, pType, nMinIndex, nNumVertices, nStartIndex, nPrimitiveCount);
  195. pDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_TRUE);
  196. pDevice->SetRenderState(D3DRS_ZFUNC,D3DCMP_LESSEQUAL);
  197. pDevice->SetTexture(0,Yellow);
  198. }
  199.  
  200.  
  201.  
  202. if (m_Stride==40 && // Equipment =============== //
  203. (texnum==13200212)|| // Delta Force Helmet
  204. (texnum==13200212)|| // Delta Force Helmet 2
  205. (texnum==34700538)|| // Delta Force Gas Mask
  206. (texnum==19500352)|| // Delta Force Balaclava
  207. (texnum==84900778)|| // Delta Force Clan BDU
  208. (texnum==27500442)|| // Delta Force Body Armor
  209. (texnum==42800576)|| // Delta Force Body Armor 2
  210. (texnum==52100658)|| // Delta Force Tactical Vest
  211. (texnum==12200196)|| // Spetsnaz Helmet
  212. (texnum==27100464)|| // Spetsnaz Gas Mask
  213. (texnum==33600552)|| // Spetsnaz Body Armor
  214. (texnum==44100646)|| // Spetsnaz Tactical Vest
  215. (texnum==17800292)|| // GIGN Red Bandana
  216. (texnum==21300290)|| // GIGN Helmet
  217. (texnum==2800036)|| // GIGN Helmet Lens
  218. (texnum==35700558)|| // GIGN Gas Mask
  219. (texnum==22100396)|| // GIGN Balaclava
  220. (texnum==29700492)|| // GIGN Body Armor
  221. (texnum==11200188)|| // ROKMC Beret
  222. (texnum==12000194)|| // ROKMC Helmet
  223. (texnum==29800450)|| // ROKMC Gas Mask
  224. (texnum==27100394)|| // ROKMC Body Armor
  225. (texnum==28700374)|| // ROKMC X Harness
  226. (texnum==34700470)|| // ROKMC X Harness
  227. (texnum==5100056)|| // ROKMC Pouch
  228. (texnum==9900163)|| // ROKMC Left Arm
  229. (texnum==18300163)|| // ROKMC Right Arm
  230. (texnum==16400266)|| // GSG9 Red Bandana
  231. (texnum==16200243)|| // GSG9 Helmet
  232. (texnum==31900466)|| // GSG9 Gas Mask
  233. (texnum==19300342)|| // GSG9 Balaclava
  234. (texnum==83600752)|| // GSG9 Clan BDU
  235. (texnum==33400477)|| // GSG9 Body Armor
  236. (texnum==10500163)|| // GSG9 Rolled Up Sleeves
  237. (texnum==38100666)|| // GSG9 Tactical Knee Pads
  238. (texnum==9600172)|| // SAS Boonie Hat
  239. (texnum==14200236)|| // SAS Helmet
  240. (texnum==37800552)|| // SAS Gas Mask
  241. (texnum==28100486)|| // SAS Balaclava
  242. (texnum==62400752)|| // SAS Clan BDU
  243. (texnum==27900456)|| // SAS Body Armor
  244. (texnum==45700654)|| // SAS Tactical Vest
  245. (texnum==39800532)|| // SAS Tactical Vest 2
  246. (texnum==9200100)|| // SAS Holster
  247. (texnum==4800040)|| // SAS Magazine Pouch
  248. (texnum==4000044)|| // SAS Pouch
  249. (texnum==6500110) || // KSF Boonie Hat
  250. (texnum==12900208)|| // KSF Helmet
  251. (texnum==29600448)|| // KSF Gas Mask
  252. (texnum==31100398)|| // KSF Sunglasses
  253. (texnum==84700776)|| // KSF Clan BDU
  254. (texnum==600004)|| // KSF Clan BDU Logo
  255. (texnum==36500606)|| // KSF Body Armor
  256. (texnum==63100646)|| // KSF Tactical Vest
  257. (texnum==19800163)|| // KSF Rolled Up Sleeves
  258. (texnum==7000066)|| // KSF Holster
  259. (texnum==10400190)|| // SRG Beret
  260. (texnum==23800294)|| // SRG Deer Head
  261. (texnum==11600180)|| // SRG NIJ IIIA Helmet
  262. (texnum==17100278)|| // SRG Red Bandana
  263. (texnum==14600198)|| // SRG Battle Cap
  264. (texnum==18200266)|| // SRG Helmet
  265. (texnum==19100106)|| // SRG Gas Mask
  266. (texnum==54300350)|| // SRG Sunglasses
  267. (texnum==30800380)|| // SRG Mid Class Sunglasses
  268. (texnum==79300995)|| // SRG Clan BDU 1
  269. (texnum==13300138)|| // SRG Clan BDU 2
  270. (texnum==300001)|| // SRG Clan BDU 3
  271. (texnum==1200012)|| // SRG Clan BDU Logo
  272. (texnum==10900110)|| // SRG Bulletproof Vest
  273. (texnum==6200064)|| // SRG Holster
  274. (ForceReconAddons)||
  275. (MulanAddons)||
  276. (texnum==22700250)) // SRG Pouch
  277. {
  278. pDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);
  279. pDevice->SetRenderState(D3DRS_ZFUNC,D3DCMP_NEVER);
  280. pDevice->SetTexture(0,Green);
  281. pDrawIndexedPrimitive(pDevice, pType, nMinIndex, nNumVertices, nStartIndex, nPrimitiveCount);
  282. pDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_TRUE);
  283. pDevice->SetRenderState(D3DRS_ZFUNC,D3DCMP_LESSEQUAL);
  284. pDevice->SetTexture(0,Blue);
  285. }
  286. if (m_Stride==40 && // Guns =============== //
  287. (texnum==187200968)|| // GALIL
  288. (texnum==187200968)|| // GALIL 2
  289. (texnum==149701124)|| // UZI
  290. (texnum==193701304)|| // M249
  291. (texnum==232501431)|| // SIG551
  292. (texnum==161500751)|| // FA-MAS
  293. (texnum==107400724)|| // FR-F2
  294. (texnum==141600900)|| // AN94
  295. (texnum==145900805)|| // G36C
  296. (texnum==42200339)|| // K1
  297. (texnum==23400116)|| // K1 2
  298. (texnum==17500073)|| // K1 3
  299. (texnum==3200012)|| // K1 4
  300. (texnum==2300012)|| // K1 5
  301. (texnum==71900459)|| // MP5
  302. (texnum==1800008)|| // MP5 2
  303. (texnum==20300084)|| // MP5 3
  304. (texnum==16700083)|| // MP5 4
  305. (texnum==79100469)|| // M4A1
  306. (texnum==12000044)|| // M4A1 2
  307. (texnum==16800062)|| // M4A1 3
  308. (texnum==2400008)|| // M4A1 4
  309. (texnum==600002)|| // M4A1 5
  310. (texnum==12800050)|| // M4A1 6
  311. (texnum==2600010)|| // M4A1 7
  312. (texnum==4200014)|| // M4A1 8
  313. (texnum==1400008)|| // M4A1 9
  314. (texnum==80600442)|| // M16A2
  315. (texnum==13400052)|| // M16A2 2
  316. (texnum==17600066)|| // M16A2 3
  317. (texnum==5400018)|| // M16A2 4
  318. (texnum==46200348)|| // STEYR_AUG
  319. (texnum==27000133)|| // STEYR_AUG 2
  320. (texnum==4100025)|| // STEYR_AUG 3
  321. (texnum==1200006)|| // STEYR_AUG 4
  322. (texnum==400002)|| // STEYR_AUG 5
  323. (texnum==46800367)|| // PSG-1
  324. (texnum==9600042)|| // PSG-1 2
  325. (texnum==18800092)|| // PSG-1 3
  326. (texnum==16900071)|| // PSG-1 4
  327. (texnum==3400012)|| // PSG-1 5
  328. (texnum==800004)|| // PSG-1 6
  329. (texnum==40500383)|| // K2
  330. (texnum==15800089)|| // K2 2
  331. (texnum==2200012)|| // K2 3
  332. (texnum==7000034)|| // K2 4
  333. (texnum==60700349)|| // P90
  334. (texnum==5500033)|| // P90 2
  335. (texnum==47700227)|| // P90 3
  336. (texnum==10300047)|| // P90 4
  337. (texnum==3800014)|| // P90 5
  338. (texnum==50300349)|| // AK-74
  339. (texnum==14700071)|| // AK-74 2
  340. (texnum==13100061)|| // AK-74 3
  341. (texnum==194501145)|| // MG36
  342. (texnum==116000670)|| // DESERT EAGLE
  343. (texnum==182101089)|| // MR73
  344. (texnum==62500454)|| // REMINGTON M870
  345. (texnum==95200571)|| // BENELLI M1
  346. (texnum==40700334)|| // GLOCK 23
  347. (texnum==71500449)|| // BERETTA M92F
  348. (texnum==11000044)|| // BERETTA M92F 2
  349. (texnum==16500075)|| // BERETTA M92F 3
  350. (texnum==4400020)|| // BERETTA M92F 4
  351. (texnum==2800014)|| // BERETTA M92F 5
  352. (texnum==92000543)|| // COLT 45
  353. (texnum==239001276)) // DRAGONUV
  354. {
  355. pDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);
  356. pDevice->SetRenderState(D3DRS_ZFUNC,D3DCMP_NEVER);
  357. pDevice->SetTexture(0,Blue);
  358. pDrawIndexedPrimitive(pDevice, pType, nMinIndex, nNumVertices, nStartIndex, nPrimitiveCount);
  359. pDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_TRUE);
  360. pDevice->SetRenderState(D3DRS_ZFUNC,D3DCMP_LESSEQUAL);
  361. pDevice->SetTexture(0,Green);
  362. }
  363. }
  364. return pDrawIndexedPrimitive(pDevice, pType, nMinIndex, nNumVertices, nStartIndex, nPrimitiveCount);
  365. }
  366.  
  367. int m_Stride;
  368. int texnum;
  369. int nNumVertices;
  370. int nPrimitiveCount;
  371. bool chams = false;
  372.  
  373. texnum = (nNumVertices*100000)+nPrimitiveCount;
  374.  
  375. pDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);
  376. pDevice->SetRenderState(D3DRS_ZFUNC,D3DCMP_NEVER);
  377. pDevice->SetTexture(0,Yellow);
  378. pDrawIndexedPrimitive(pDevice, pType, nMinIndex, nNumVertices, nStartIndex, nPrimitiveCount);
  379. pDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_TRUE);
  380. pDevice->SetRenderState(D3DRS_ZFUNC,D3DCMP_LESSEQUAL);
  381. pDevice->SetTexture(0,Red);
  382.  
  383. pDevice->SetTexture(0,Yellow);
  384.  
  385. pDevice->SetTexture(0,Red);
  386.  
  387. LPDIRECT3DTEXTURE8 Red;
  388. LPDIRECT3DTEXTURE8 Yellow;
  389. LPDIRECT3DTEXTURE8 Green;
  390. LPDIRECT3DTEXTURE8 Blue;
  391. LPDIRECT3DTEXTURE8 Purple;
  392. LPDIRECT3DTEXTURE8 Orange;
  393. LPDIRECT3DTEXTURE8 Pink;
  394. LPDIRECT3DTEXTURE8 White;
  395. LPDIRECT3DTEXTURE8 Black;
  396.  
  397. typedef HRESULT ( WINAPI* oSetStreamSource ) ( LPDIRECT3DDEVICE8 pDevice, UINT nStreamNumber, LPDIRECT3DVERTEXBUFFER8 pStreamData, UINT nStride );
  398. oSetStreamSource pSetStreamSource;
  399.  
  400. HRESULT WINAPI mySetStreamSource(LPDIRECT3DDEVICE8 pDevice, UINT nStreamNumber, LPDIRECT3DVERTEXBUFFER8 pStreamData, UINT nStride)
  401. {
  402. if(nStreamNumber==0)
  403. m_Stride = nStride;
  404.  
  405. return pSetStreamSource(pDevice, nStreamNumber, pStreamData, nStride);
  406. }
  407.  
  408.  if (GetAsyncKeyState(VK_F1)&1) // if we click f1
  409. { chams = !chams; } // chams = on
  410.  
  411. if (GetAsyncKeyState(VK_F2)&1) // if we click f2
  412. { colored walls = !colored walls; } // colored walls = on
  413.  
  414. int nofog;
  415. int xray;
  416. int fullbright;
  417.  
  418. typedef HRESULT ( WINAPI* oSetRenderState ) ( LPDIRECT3DDEVICE8 pDevice, D3DRENDERSTATETYPE State, DWORD Value);
  419. oSetRenderState pSetRenderState;
  420. HRESULT WINAPI mySetRenderState(LPDIRECT3DDEVICE8 pDevice, D3DRENDERSTATETYPE State, DWORD Value)
  421. {
  422. if(fullbright)
  423. {
  424. pDevice->SetRenderState(D3DRS_LIGHTING, false); //d3d lighting off
  425. pDevice->SetRenderState(D3DRS_AMBIENT,D3DCOLOR_ARGB(255,255,255,255)); // use all colors to glow up the lighting ingame
  426. }
  427.  
  428.  
  429. if(nofog) // if nofog on
  430. { // then
  431. pDevice->SetRenderState(D3DRS_FOGENABLE, false); // Disable the Fog
  432. } // end of then
  433. if(xray)
  434. {
  435. if(m_Stride == Modelrecognition) //you can define the stride like this to        
  436. {
  437. m_pD3Ddev->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);  
  438. }
  439. }
  440.  
  441. return pSetRenderState(pDevice,State, Value);
  442. }
  443.  
  444. if (GetAsyncKeyState(VK_F3)&1) // if we click f3
  445. { //then
  446. nofog = !nofog; //nofog = on
  447. } //end of then
  448.  
  449. float ScreenCenterX = 0.0f;
  450. float ScreenCenterY = 0.0f;
  451. bool xhair = false;
  452. D3DCOLOR redt = D3DCOLOR_XRGB( 255, 0, 0 );
  453.  
  454. if(xhair)
  455. {
  456. D3DRECT rec2 = {ScreenCenterX-20, ScreenCenterY, ScreenCenterX+ 20, ScreenCenterY+2};
  457. D3DRECT rec3 = {ScreenCenterX, ScreenCenterY-20, ScreenCenterX+ 2,ScreenCenterY+20};
  458. pDevice->Clear(1, &rec2, D3DCLEAR_TARGET,redt, 0, 0);
  459. pDevice->Clear(1, &rec3, D3DCLEAR_TARGET,redt, 0, 0);
  460. }
  461.  
  462. typedef HRESULT (WINAPI* oSetViewport)(LPDIRECT3DDEVICE8 pDevice,CONST D3DVIEWPORT8* pViewport);
  463. oSetViewport pSetViewport;
  464.  
  465. HRESULT WINAPI mySetViewport(LPDIRECT3DDEVICE8 pDevice,CONST D3DVIEWPORT8* pViewport)
  466. {
  467. ScreenCenterX = ( float )pViewport->Width / 2;
  468. ScreenCenterY = ( float )pViewport->Height / 2;
  469.  
  470. return pSetViewport(pDevice,pViewport);
  471. }
  472.  
  473. if (GetAsyncKeyState(VK_F8)&1) // if we click f8
  474. { xhair = !xhair; } // xhair = on
  475.  
  476. typedef HRESULT ( WINAPI* oDrawIndexedPrimitive ) ( LPDIRECT3DDEVICE8 pDevice, D3DPRIMITIVETYPE pType, UINT nMinIndex, UINT nNumVertices, UINT nStartIndex, UINT nPrimitiveCount );
  477. oDrawIndexedPrimitive pDrawIndexedPrimitive, OriginalDrawIndexedPrimitive;
  478. HRESULT WINAPI myDrawIndexedPrimitive(LPDIRECT3DDEVICE8 pDevice, D3DPRIMITIVETYPE pType, UINT nMinIndex, UINT nNumVertices, UINT nStartIndex, UINT nPrimitiveCount)
  479. {
  480.  
  481. if(WireFame)
  482.  
  483. if(m_Stride == modelrecog)
  484. { // then
  485.  pDevice->SetRenderState(D3DRS_FILLMODE, D3DFILL_WIREFRAME);
  486. } // end of then
  487.  
  488. int WireFrame;
  489.  
  490. if (GetAsyncKeyState(VK_F3)&1) // if we click f3
  491. { //then
  492. wireframe = !wireframe; //wireframe = on
  493. } // end of then
  494.  
  495. int AsusWallhack;
  496.  
  497. typedef HRESULT ( WINAPI* oDrawIndexedPrimitive ) ( LPDIRECT3DDEVICE8 pDevice, D3DPRIMITIVETYPE pType, UINT nMinIndex, UINT nNumVertices, UINT nStartIndex, UINT nPrimitiveCount );
  498. oDrawIndexedPrimitive pDrawIndexedPrimitive, OriginalDrawIndexedPrimitive;
  499. HRESULT WINAPI myDrawIndexedPrimitive(LPDIRECT3DDEVICE8 pDevice, D3DPRIMITIVETYPE pType, UINT nMinIndex, UINT nNumVertices, UINT nStartIndex, UINT nPrimitiveCount)
  500. {
  501.  
  502. if(AsusWallhack)
  503.  
  504. if(Model_rec//for walls)
  505.       {
  506. pDevice->SetRenderState( D3DRS_SRCBLEND, 3 );
  507. pDevice->SetRenderState( D3DRS_DESTBLEND, 4 );
  508. pDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, true );
  509.       }
  510. }  
  511.  
  512. int nosky;
  513.  
  514. if(nosky)
  515. {
  516. if(modelrec)
  517. {
  518. return D3D_OK
  519. }
  520. }
  521.  
  522. int noflash;
  523.  
  524. if(noflash)
  525. {
  526. if(ModelRec)
  527. {
  528. return D3D_OK;
  529. }
  530. }
  531.  
  532. if(nosmoke)
  533. {
  534. if(ModelRec)
  535. {
  536. return D3D_OK;
  537. }
  538. }
  539.  
  540. int nowater;
  541.  
  542. if(nowater)
  543. {
  544. if(ModelRec)
  545. {
  546. return D3D_OK;
  547. }
  548. }
  549.  
  550. return D3D_OK;
  551.  
  552. return 0;
  553.  
  554. int GlassWalls;
  555.  
  556. if(GlassWalls)
  557. {
  558. if(ModelRec)
  559. {
  560. return D3D_OK;
  561. }
  562. }
  563.  
  564. //==========================================FindPatt======================================================================//
  565. bool bCompare(const BYTE* pData, const BYTE* bMask, const char* szMask)
  566. {
  567. for(;*szMask;++szMask,++pData,++bMask)
  568. if(*szMask=='x' && *pData!=*bMask) return 0;
  569. return (*szMask) == NULL;
  570. }
  571. //=======================================================================
  572. DWORD FindPattern(DWORD dwAddress,DWORD dwLen,BYTE *bMask,char * szMask)
  573. {
  574. for(DWORD i=0; i<dwLen; i++)
  575. if (bCompare((BYTE*)(dwAddress+i),bMask,szMask)) return (DWORD)(dwAddress+i);
  576. return 0;
  577. }
  578. //=======================================================================
  579. void *DetourFunc(BYTE *src, const BYTE *dst, const int len)
  580. {
  581. BYTE *jmp = (BYTE*)malloc(len+5);
  582. DWORD dwBack;
  583. VirtualProtect(src, len, PAGE_READWRITE, &dwBack);
  584. memcpy(jmp, src, len);
  585. jmp += len;
  586. jmp[0] = 0xE9;
  587. *(DWORD*)(jmp+1) = (DWORD)(src+len - jmp) - 5;
  588. src[0] = 0x90; //50
  589. src[1] = 0x90; // 58
  590. src[2] = 0xE9;
  591. *(DWORD*)(&src[3]) = (DWORD)(dst - src) - 7;
  592. for (int i=7; i<len; i++) src[i] = 0x90;
  593. VirtualProtect(src, len, dwBack, &dwBack);
  594. return (jmp-len);
  595. }
  596.  
  597.  
  598. bool bCompare(const BYTE* pData, const BYTE* bMask, const char* szMask);
  599. DWORD FindPattern(DWORD dwAddress,DWORD dwLen,BYTE *bMask,char * szMask);
  600. void *DetourFunc(BYTE *src, const BYTE *dst, const int len);
  601. int D3D8BASE (void);
  602. int sleepthread2 (void);
  603. int sleepthread (void);
  604.  
  605. //=======================================Vtable Hook====================================================================//
  606. int D3D8BASE (void)
  607. {
  608.     HMODULE D3D8BASE = NULL;
  609.     for (;D3D8BASE == NULL;Sleep(100))
  610.     D3D8BASE = LoadLibrary("d3d8.dll");
  611.     DWORD* VTableHook = 0;                  
  612.     DWORD hD3D8 = (DWORD)GetModuleHandle("d3d8.dll");
  613.     DWORD VIRTUALTABLE = FindPattern(hD3D8, 0x128000, (PBYTE)"\xC7\x06\x00\x00\x00\x00\x89\x86\x00\x00\x00\x00\x89\x86", "xx????xx????xx");
  614.     memcpy(&VTableHook, (void*)(VIRTUALTABLE+2), 4);
  615.  
  616.     DWORD dwEndScene                    = VTableHook[35];
  617.     DWORD dwDrawIndexedPrimitive        = VTableHook[71];
  618.     DWORD dwSetStreamSource             = VTableHook[83];
  619.     DWORD dwSetViewport                 = VTableHook[40];
  620. DWORD dwSetRenderState              = VTableHook[50];
  621.  
  622.  
  623.     pDrawIndexedPrimitive = (oDrawIndexedPrimitive)DetourFunc((PBYTE)dwDrawIndexedPrimitive, (PBYTE)myDrawIndexedPrimitive, 7);
  624.     pSetStreamSource = (oSetStreamSource)DetourFunc((PBYTE)dwSetStreamSource, (PBYTE)mySetStreamSource, 7);
  625.     pEndScene = (oEndScene)DetourFunc((PBYTE)dwEndScene, (PBYTE)myEndScene, 7);
  626.     pSetViewport = (oSetViewport)DetourFunc((PBYTE)dwSetViewport, (PBYTE)mySetViewport, 7);
  627. pSetRenderState = (oSetRenderState)DetourFunc((PBYTE)dwSetRenderState, (PBYTE)mySetRenderState, 7);
  628.  
  629.     return 0;
  630. }
  631.  
  632. BOOL WINAPI DllMain ( HMODULE hDll, DWORD dwReason, LPVOID lpReserved )
  633. {
  634.     DisableThreadLibraryCalls(hDll);
  635.  
  636.     if ( dwReason == DLL_PROCESS_ATTACH )
  637.     {        
  638.         CreateThread(NULL, NULL, (LPTHREAD_START_ROUTINE)D3D8BASE, NULL, NULL, NULL);
  639.  
  640.     }
  641.     return TRUE;
  642. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement