1 //---------------------------------------------------------------------------- 2 // EDGE Colour Code 3 //---------------------------------------------------------------------------- 4 // 5 // Copyright (c) 1999-2009 The EDGE Team. 6 // 7 // This program is free software; you can redistribute it and/or 8 // modify it under the terms of the GNU General Public License 9 // as published by the Free Software Foundation; either version 2 10 // of the License, or (at your option) any later version. 11 // 12 // This program is distributed in the hope that it will be useful, 13 // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 // GNU General Public License for more details. 16 // 17 //---------------------------------------------------------------------------- 18 // 19 // Based on the DOOM source code, released by Id Software under the 20 // following copyright: 21 // 22 // Copyright (C) 1993-1996 by id Software, Inc. 23 // 24 //---------------------------------------------------------------------------- 25 26 #ifndef __R_COLORS_H__ 27 #define __R_COLORS_H__ 28 29 #include "dm_defs.h" 30 31 #include "ddf/types.h" 32 #include "ddf/main.h" 33 #include "ddf/colormap.h" 34 35 #include "r_defs.h" 36 37 class abstract_shader_c; 38 39 void V_InitPalette(void); 40 void V_InitColour(void); 41 42 // -ACB- 1999/10/11 Gets an RGB colour from the current palette 43 void V_IndexColourToRGB(int indexcol, byte *returncol); 44 45 rgbcol_t V_LookupColour(int col); 46 47 // -AJA- 1999/07/03: moved here from v_res.h. 48 extern int var_gamma; 49 50 #define GAMMA_CONV(light) (light) 51 52 // -AJA- 1999/07/03: Some palette stuff. 53 extern byte playpal_data[14][256][3]; 54 55 #define PALETTE_NORMAL 0 56 #define PALETTE_PAIN 1 57 #define PALETTE_BONUS 2 58 #define PALETTE_SUIT 3 59 60 int V_FindColour(int r, int g, int b); 61 void V_SetPalette(int type, float amount); 62 void V_ColourNewFrame(void); 63 void R_PaletteStuff(void); 64 65 66 #define PAL_RED(pix) ((float)(playpal_data[0][pix][0]) / 255.0f) 67 #define PAL_GRN(pix) ((float)(playpal_data[0][pix][1]) / 255.0f) 68 #define PAL_BLU(pix) ((float)(playpal_data[0][pix][2]) / 255.0f) 69 70 71 // -AJA- 1999/07/10: Some stuff for colmap.ddf. 72 73 typedef enum 74 { 75 VCOL_None = 0x0000, 76 VCOL_Sky = 0x0001 77 } 78 vcol_flags_e; 79 80 // translation support 81 const byte *V_GetTranslationTable(const colourmap_c * colmap); 82 83 void R_TranslatePalette(byte *new_pal, const byte *old_pal, 84 const colourmap_c *trans); 85 86 void V_GetColmapRGB(const colourmap_c *colmap, float *r, float *g, float *b); 87 88 rgbcol_t V_GetFontColor(const colourmap_c *colmap); 89 rgbcol_t V_ParseFontColor(const char *name, bool strict = false); 90 91 abstract_shader_c *R_GetColormapShader( 92 const struct region_properties_s *props, int light_add = 0); 93 94 // text translation tables 95 extern const byte *font_whitener; 96 extern const colourmap_c *font_whiten_map; 97 98 extern const colourmap_c *text_red_map; 99 extern const colourmap_c *text_white_map; 100 extern const colourmap_c *text_grey_map; 101 extern const colourmap_c *text_green_map; 102 extern const colourmap_c *text_brown_map; 103 extern const colourmap_c *text_blue_map; 104 extern const colourmap_c *text_purple_map; 105 extern const colourmap_c *text_yellow_map; 106 extern const colourmap_c *text_orange_map; 107 108 // automap translation tables 109 extern const byte *am_normal_colmap; 110 extern const byte *am_overlay_colmap; 111 112 // colour indices from palette 113 extern int pal_black, pal_white, pal_gray239; 114 extern int pal_red, pal_green, pal_blue; 115 extern int pal_yellow, pal_green1, pal_brown1; 116 117 // colour values. These assume the standard Doom palette. Maybe 118 // remove most of these one day -- will take some work though... 119 // Note: some of the ranges begin with a bright (often white) colour. 120 121 #define BLACK 0 122 #define WHITE 4 123 124 #define PINK 0x10 125 #define PINK_LEN 32 126 #define BROWN 0x30 127 #define BROWN_LEN 32 128 #define GRAY 0x50 129 #define GRAY_LEN 32 130 #define GREEN 0x70 131 #define GREEN_LEN 16 132 #define BEIGE 0x80 133 #define BEIGE_LEN 16 134 #define RED 0xB0 135 #define RED_LEN 16 136 #define CYAN 0xC0 137 #define CYAN_LEN 8 138 #define BLUE 0xC8 139 #define BLUE_LEN 8 140 #define ORANGE 0xD8 141 #define ORANGE_LEN 8 142 #define YELLOW 0xE7 143 #define YELLOW_LEN 1 144 #define DBLUE 0xF0 145 #define DBLUE_LEN 8 146 147 #endif // __R_COLORS_H__ 148 149 //--- editor settings --- 150 // vi:ts=4:sw=4:noexpandtab 151