Advertisement
JennyMcJenster

Standard | CS:GO Rainbow-Cycling Crosshair Config Generator

Jul 17th, 2015
283
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.29 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <math.h>
  4.  
  5. using namespace std;
  6.  
  7. int main(int argc, char* argv)
  8. {
  9.     ofstream file;
  10.     file.open("cl_rainbowch.cfg");
  11.  
  12.     // Alteration of attack binds to cycle through the crosshair when using either primary or secondary attack
  13.     //  If you use different keys for attack and alternate (WHYYYYYYY) edit the keycodes "mouse1" and "mouse2"
  14.     file << "bind mouse1 \"+attack; rbch_next;\"" << endl;
  15.     file << "bind mouse2 \"+attack2; rbch_next;\"" << endl<<endl;
  16.  
  17.     // Required for the crosshair to change colour at all
  18.     file << "cl_crosshaircolor 5" << endl;
  19.  
  20.     // Minimum and maximum luminescence values
  21.     double minv = 128.0;
  22.     double maxv = 256.0;
  23.     /* Some examples:
  24.         minv = 0.0; maxv = 256.0;   // Colours are fully saturated
  25.         minv = 128.0;   maxv = 256.0;   // Colours are semi-saturated into white; pastel colours
  26.         minv = 0.0; maxv = 128.0;   // Colours are semi-saturated into black; darkened colours
  27.         minv = 96.0;    maxv = 144.0;   // Colours are distinctly greyed
  28.         minv = 256.0;   maxv = 256.0;   // Crosshair will just be white, what are you doing
  29.         minv = 0.0; maxv = 0.0; // Now it's just gone completely black, stop this nonsense
  30.     ...and so on */
  31.  
  32.     // Number of steps it takes to cycle through the entire rainbow
  33.     int cycle = 24;
  34.  
  35.     // Main loop
  36.     for(int i=0; i<cycle; ++i)
  37.     {
  38.         double c = (double)i / (double)cycle;
  39.         double r = abs((1.0/2.0 - c)*6.0) - 1.0; r = (maxv-minv)*r + minv; r = (r<minv?minv:(r>maxv?maxv:r));
  40.         double g = 2.0 - abs((1.0/3.0 - c)*6.0); g = (maxv-minv)*g + minv; g = (g<minv?minv:(g>maxv?maxv:g));
  41.         double b = 2.0 - abs((2.0/3.0 - c)*6.0); b = (maxv-minv)*b + minv; b = (b<minv?minv:(b>maxv?maxv:b));
  42.  
  43.         int ir = (int)r; ir=(ir<0?0:(ir>255?255:ir));
  44.         int ig = (int)g; ig=(ig<0?0:(ig>255?255:ig));
  45.         int ib = (int)b; ib=(ib<0?0:(ib>255?255:ib));
  46.  
  47.         file << "alias rbch_" << i << " \"";
  48.             file << "cl_crosshaircolor_r " << ir << "; ";
  49.             file << "cl_crosshaircolor_g " << ig << "; ";
  50.             file << "cl_crosshaircolor_b " << ib << "; ";
  51.         file << "alias rbch_next rbch_" << (i+1==cycle?0:i+1) << "\"" << endl;
  52.     }
  53.  
  54.     file << "rbch_0" << endl;
  55.  
  56.     file.close();
  57.     return 0;
  58. }
  59.  
  60. // Don't forget to actually put the generated file into your csgo/cfg folder
  61. // Also then add "exec cl_rainbowch" to your autoexec.cfg else it won't even run
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement