Advertisement
Guest User

Untitled

a guest
Jul 15th, 2019
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.43 KB | None | 0 0
  1. IMaterial* create_material_galaxy(bool ignorez, bool lit, bool wireframe)
  2. {
  3. static auto created = 0;
  4.  
  5. std::string type = lit ? "VertexLitGeneric" : "UnlitGeneric";
  6. auto matdata =
  7. "\"" + type + "\"\
  8. \n{\
  9. \n\t\"$basetexture\" \"dev/zone_warning proxies { texturescroll { texturescrollvar $basetexturetransform texturescrollrate 0.6 texturescrollangle 90 } } }\"\
  10. \n\t\"$envmap\" \"editor/cube_vertigo\"\
  11. \n\t\"$envmapcontrast\" \"1\"\
  12. \n\t\"$envmaptint\" \"[.6 .6 .6]\"\
  13. \n\t\"$model\" \"1\"\
  14. \n\t\"$normalmapalphaenvmapmask\" \"1\"\
  15. \n\t\"$envmapcontrast\" \"1\"\
  16. \n\t\"$flat\" \"1\"\
  17. \n\t\"$nocull\" \"0\"\
  18. \n\t\"$selfillum\" \"1\"\
  19. \n\t\"$halflambert\" \"1\"\
  20. \n\t\"$nofog\" \"0\"\
  21. \n\t\"$ignorez\" \"" + std::to_string(ignorez) + "\"\
  22. \n\t\"$znearer\" \"0\"\
  23. \n\t\"$wireframe\" \"" + std::to_string(wireframe) + "\"\
  24. \n}\n";
  25.  
  26. auto matname = "custom_" + std::to_string(created);
  27. ++created;
  28.  
  29. auto init_key_values = [](KeyValuesv2* keyvalues, const char* key_name) -> void {
  30. using InitKeyValues_t = void(__thiscall*)(void*, const char*);
  31. static InitKeyValues_t InitKeyValuesEx = nullptr;
  32. static auto pThis = *reinterpret_cast<DWORD * *>(Utils::FindSignature("client_panorama.dll", "B9 ? ? ? ? E8 ? ? ? ? 8B 5D 08") + 1);
  33. if (!InitKeyValuesEx)
  34. InitKeyValuesEx = *reinterpret_cast<InitKeyValues_t>(Utils::FindSignature("client_panorama.dll", "55 8B EC 51 33 C0 C7 45"));
  35.  
  36. InitKeyValuesEx(keyvalues, key_name);
  37. };
  38.  
  39. auto load_from_buffer = [](KeyValuesv2* key_values, const char* resource_name, const char* buf, void* file_sys = nullptr, const char* path_id = nullptr, void* eval_sym_proc = nullptr, void* unk = nullptr) -> void {
  40. using LoadFromBuffer_t = void(__thiscall*)(void*, const char*, const char*, void*, const char*, void*, void*);
  41. static LoadFromBuffer_t LoadFromBufferEx = nullptr;
  42.  
  43. if (!LoadFromBufferEx)
  44. LoadFromBufferEx = *reinterpret_cast<LoadFromBuffer_t>(Utils::FindSignature("client_panorama.dll", "55 8B EC 83 E4 F8 83 EC 34 53 8B 5D 0C 89"));
  45.  
  46. LoadFromBufferEx(key_values, resource_name, buf, file_sys, path_id, eval_sym_proc, unk);
  47. };
  48.  
  49. auto* key_values = new KeyValuesv2();
  50. init_key_values(key_values, type.c_str());
  51. load_from_buffer(key_values, matname.c_str(), matdata.c_str());
  52.  
  53. return g_pMaterialSys->CreateMaterial(matname.c_str(), key_values);
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement