Advertisement
Guest User

Untitled

a guest
Nov 25th, 2019
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 3.02 KB | None | 0 0
  1. #pragma once
  2.  
  3. #include "q_math.h"
  4.  
  5. #if defined(__cplusplus)
  6. extern "C" {
  7. #endif
  8.  
  9. #define MAKERGB( v, r, g, b ) v[0]=r;v[1]=g;v[2]=b
  10. #define MAKERGBA( v, r, g, b, a ) v[0]=r;v[1]=g;v[2]=b;v[3]=a
  11.  
  12. #define Q_COLOR_ESCAPE  '^'
  13. #define Q_COLOR_BITS 0xF // was 7
  14.  
  15. // you MUST have the last bit on here about colour strings being less than 7 or taiwanese strings register as colour!!!!
  16. #define Q_IsColorString(p)  ( p && *(p) == Q_COLOR_ESCAPE && *((p)+1) && *((p)+1) != Q_COLOR_ESCAPE && *((p)+1) <= '9' && *((p)+1) >= '0' )
  17. #define Q_IsColorStringExt(p)   ((p) && *(p) == Q_COLOR_ESCAPE && *((p)+1) && *((p)+1) >= '0' && *((p)+1) <= '9') // ^[0-9]
  18.  
  19. #define COLOR_BLACK     '0'
  20. #define COLOR_RED       '1'
  21. #define COLOR_BROWN     'B'
  22. #define COLOR_GREEN     '2'
  23. #define COLOR_YELLOW    '3'
  24. #define COLOR_BLUE      '4'
  25. #define COLOR_CYAN      '5'
  26. #define COLOR_MAGENTA   '6'
  27. #define COLOR_WHITE     '7'
  28. #define COLOR_ORANGE    '8'
  29. #define COLOR_GREY      '9'
  30. #define ColorIndex(c)   ( ( (c) - '0' ) & Q_COLOR_BITS )
  31.  
  32. #define S_COLOR_BLACK   "^0"
  33. #define S_COLOR_RED     "^1"
  34. #define S_COLOR_BROWN   "^B"
  35. #define S_COLOR_GREEN   "^2"
  36. #define S_COLOR_YELLOW  "^3"
  37. #define S_COLOR_BLUE    "^4"
  38. #define S_COLOR_CYAN    "^5"
  39. #define S_COLOR_MAGENTA "^6"
  40. #define S_COLOR_WHITE   "^7"
  41. #define S_COLOR_ORANGE  "^8"
  42. #define S_COLOR_GREY    "^9"
  43.  
  44. typedef enum ct_table_e
  45. {
  46.     CT_NONE,
  47.     CT_BLACK,
  48.     CT_RED,
  49.     CT_BROWN,
  50.     CT_GREEN,
  51.     CT_BLUE,
  52.     CT_YELLOW,
  53.     CT_MAGENTA,
  54.     CT_CYAN,
  55.     CT_WHITE,
  56.     CT_LTGREY,
  57.     CT_MDGREY,
  58.     CT_DKGREY,
  59.     CT_DKGREY2,
  60.  
  61.     CT_VLTORANGE,
  62.     CT_LTORANGE,
  63.     CT_DKORANGE,
  64.     CT_VDKORANGE,
  65.  
  66.     CT_VLTBLUE1,
  67.     CT_LTBLUE1,
  68.     CT_DKBLUE1,
  69.     CT_VDKBLUE1,
  70.  
  71.     CT_VLTBLUE2,
  72.     CT_LTBLUE2,
  73.     CT_DKBLUE2,
  74.     CT_VDKBLUE2,
  75.  
  76.     CT_VLTBROWN1,
  77.     CT_LTBROWN1,
  78.     CT_DKBROWN1,
  79.     CT_VDKBROWN1,
  80.  
  81.     CT_VLTGOLD1,
  82.     CT_LTGOLD1,
  83.     CT_DKGOLD1,
  84.     CT_VDKGOLD1,
  85.  
  86.     CT_VLTPURPLE1,
  87.     CT_LTPURPLE1,
  88.     CT_DKPURPLE1,
  89.     CT_VDKPURPLE1,
  90.  
  91.     CT_VLTPURPLE2,
  92.     CT_LTPURPLE2,
  93.     CT_DKPURPLE2,
  94.     CT_VDKPURPLE2,
  95.  
  96.     CT_VLTPURPLE3,
  97.     CT_LTPURPLE3,
  98.     CT_DKPURPLE3,
  99.     CT_VDKPURPLE3,
  100.  
  101.     CT_VLTRED1,
  102.     CT_LTRED1,
  103.     CT_DKRED1,
  104.     CT_VDKRED1,
  105.     CT_VDKRED,
  106.     CT_DKRED,
  107.  
  108.     CT_VLTAQUA,
  109.     CT_LTAQUA,
  110.     CT_DKAQUA,
  111.     CT_VDKAQUA,
  112.  
  113.     CT_LTPINK,
  114.     CT_DKPINK,
  115.     CT_LTCYAN,
  116.     CT_DKCYAN,
  117.     CT_LTBLUE3,
  118.     CT_BLUE3,
  119.     CT_DKBLUE3,
  120.  
  121.     CT_HUD_GREEN,
  122.     CT_HUD_RED,
  123.     CT_ICON_BLUE,
  124.     CT_NO_AMMO_RED,
  125.     CT_HUD_ORANGE,
  126.  
  127.     CT_TITLE,
  128.  
  129.     CT_MAX
  130. } ct_table_t;
  131.  
  132. extern vec4_t colorBlack;
  133. extern vec4_t colorRed;
  134. extern vec4_t colorBrown;
  135. extern vec4_t colorGreen;
  136. extern vec4_t colorBlue;
  137. extern vec4_t colorYellow;
  138. extern vec4_t colorOrange;
  139. extern vec4_t colorMagenta;
  140. extern vec4_t colorCyan;
  141. extern vec4_t colorWhite;
  142. extern vec4_t colorLtGrey;
  143. extern vec4_t colorMdGrey;
  144. extern vec4_t colorDkGrey;
  145. extern vec4_t colorLtBlue;
  146. extern vec4_t colorDkBlue;
  147.  
  148. extern vec4_t g_color_table[Q_COLOR_BITS+1];
  149. extern vec4_t colorTable[CT_MAX];
  150.  
  151. unsigned ColorBytes3 (float r, float g, float b);
  152. unsigned ColorBytes4 (float r, float g, float b, float a);
  153. float NormalizeColor( const vec3_t in, vec3_t out );
  154.  
  155. #if defined(__cplusplus)
  156. } // extern "C"
  157. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement