Advertisement
Guest User

TextureChanger.cpp

a guest
Jul 16th, 2021
490
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.63 KB | None | 0 0
  1. class mtexinfo_t
  2. {
  3.     char pad[76];
  4. public:
  5.     IMaterial* material;
  6. };
  7.  
  8. class worldbrushdata_t
  9. {
  10.     char pad[88];
  11. public:
  12.     int numtexinfo;
  13.     mtexinfo_t* texinfo;
  14.  
  15.     int         numtexdata;
  16.     csurface_t* texdata;
  17. };
  18.  
  19. void UpdateMapTextures()
  20. {
  21.     static auto NewMaterial = MatSystemOther->FindMaterial("ground\snow01", 0); // Already exists in CS:S.
  22.  
  23.     for (auto i = 0; i < host_state.worldbrush->numtexinfo; i++)
  24.     {
  25.         host_state->worldbrush->texinfo[i].material->Release();
  26.  
  27.         host_state->worldbrush->texinfo[i].material = NewMaterial;
  28.  
  29.         NewMaterial->AddRef();
  30.     }
  31.  
  32.     Engine->ClientCmd_Unrestricted("mat_reloadallmaterials");
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement