1 /** @file automapstyle.h Style configuration for AutomapWidget. 2 * 3 * @authors Copyright © 2005-2017 Jaakko Keränen <jaakko.keranen@iki.fi> 4 * @authors Copyright © 2005-2015 Daniel Swanson <danij@dengine.net> 5 * 6 * @par License 7 * GPL: http://www.gnu.org/licenses/gpl.html 8 * 9 * <small>This program is free software; you can redistribute it and/or modify 10 * it under the terms of the GNU General Public License as published by the 11 * Free Software Foundation; either version 2 of the License, or (at your 12 * option) any later version. This program is distributed in the hope that it 13 * will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty 14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General 15 * Public License for more details. You should have received a copy of the GNU 16 * General Public License along with this program; if not, write to the Free 17 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 18 * 02110-1301 USA</small> 19 */ 20 21 #ifndef LIBCOMMON_UI_AUTOMAPSTYLE_H 22 #define LIBCOMMON_UI_AUTOMAPSTYLE_H 23 24 #include "doomsday.h" 25 26 #if defined (__JDOOM__) || defined(__JDOOM64__) 27 # define BLACK (0) 28 # define WHITE (256-47) 29 # define REDS (256-5*16) 30 # define GREENS (7*16) 31 # define YELLOWS (256-32+7) 32 # define GRAYS (6*16) 33 # define BROWNS (4*16) 34 35 # define WALLCOLORS REDS 36 # define TSWALLCOLORS GRAYS 37 # define UNWALLCOLORS (GRAYS + 3) 38 # define CDWALLCOLORS YELLOWS 39 # define FDWALLCOLORS BROWNS 40 # define THINGCOLORS GREENS 41 # define BACKGROUND BLACK 42 43 // Keys for Baby Mode 44 # define KEY1_COLOR (197) // Blue Key 45 # define KEY2_COLOR (256-5*16) // Red Key 46 # define KEY3_COLOR (256-32+7) // Yellow Key 47 # define KEY4_COLOR (256-32+7) // Yellow Skull 48 # define KEY5_COLOR (256-5*16) // Red Skull 49 # define KEY6_COLOR (197) // Blue Skull 50 51 # define AM_PLR1_COLOR GREENS 52 # define AM_PLR2_COLOR GRAYS 53 # define AM_PLR3_COLOR BROWNS 54 # define AM_PLR4_COLOR REDS 55 #endif 56 57 #if defined (__JHERETIC__) 58 # define BLACK (0) 59 # define WHITE (35) 60 # define REDS (145) 61 # define GREENS (209) 62 # define YELLOWS (111) 63 # define GRAYS (16) 64 # define BROWNS (66) 65 # define PARCH (103) 66 67 # define WALLCOLORS (72) 68 # define TSWALLCOLORS (1) 69 # define UNWALLCOLORS (40) 70 # define CDWALLCOLORS (77) 71 # define FDWALLCOLORS (110) 72 # define THINGCOLORS (4) 73 # define BACKGROUND PARCH 74 75 // Keys for Baby Mode 76 # define KEY1_COLOR (144) // Green Key 77 # define KEY2_COLOR (197) // Yellow Key 78 # define KEY3_COLOR (220) // Blue Key 79 80 # define AM_PLR1_COLOR (220) 81 # define AM_PLR2_COLOR (197) 82 # define AM_PLR3_COLOR (150) 83 # define AM_PLR4_COLOR (144) 84 #endif 85 86 #if defined (__JHEXEN__) 87 // For use if I do walls with outsides/insides 88 # define REDS (12*8) 89 # define BLUES (256-4*16+8) 90 # define GREENS (33*8) 91 # define GRAYS (5*8) 92 # define BROWNS (14*8) 93 # define YELLOWS (10*8) 94 # define BLACK (0) 95 # define WHITE (4*8) 96 # define PARCH (13*8-1) 97 # define BLOODRED (177) 98 99 // Automap colors 100 # define BACKGROUND PARCH 101 # define WALLCOLORS (83) // REDS 102 # define TSWALLCOLORS GRAYS 103 # define UNWALLCOLORS (GRAYS + 3) 104 # define FDWALLCOLORS (96) // BROWNS 105 # define CDWALLCOLORS (107) // YELLOWS 106 # define THINGCOLORS (255) 107 # define SECRETWALLCOLORS WALLCOLORS 108 109 # define BORDEROFFSET (4) 110 111 // Automap colors 112 # define AM_PLR1_COLOR (157) // Blue 113 # define AM_PLR2_COLOR (177) // Red 114 # define AM_PLR3_COLOR (137) // Yellow 115 # define AM_PLR4_COLOR (198) // Green 116 # define AM_PLR5_COLOR (215) // Jade 117 # define AM_PLR6_COLOR (32) // White 118 # define AM_PLR7_COLOR (106) // Hazel 119 # define AM_PLR8_COLOR (234) // Purple 120 121 # define KEY1 (197) // HEXEN - 122 # define KEY2 (144) // HEXEN - 123 # define KEY3 (220) // HEXEN - 124 #endif 125 126 enum automapcfg_objectname_t 127 { 128 AMO_NONE = -1, 129 AMO_THING = 0, 130 AMO_THINGPLAYER, 131 AMO_UNSEENLINE, 132 AMO_SINGLESIDEDLINE, 133 AMO_TWOSIDEDLINE, 134 AMO_FLOORCHANGELINE, 135 AMO_CEILINGCHANGELINE, 136 AMO_NUMOBJECTS 137 }; 138 139 enum glowtype_t 140 { 141 GLOW_NONE, 142 GLOW_BOTH, 143 GLOW_BACK, 144 GLOW_FRONT 145 }; 146 147 enum 148 { 149 MOL_LINEDEF = 0, 150 MOL_LINEDEF_TWOSIDED, 151 MOL_LINEDEF_FLOOR, 152 MOL_LINEDEF_CEILING, 153 MOL_LINEDEF_UNSEEN, 154 NUM_MAP_OBJECTLISTS 155 }; 156 157 #define AUTOMAPCFG_MAX_LINEINFO 32 158 159 struct automapcfg_lineinfo_t 160 { 161 int reqSpecial; 162 int reqSided; 163 int reqNotFlagged; 164 int reqAutomapFlags; 165 float rgba[4]; 166 //blendmode_t blendMode; 167 float glowStrength, glowSize; 168 glowtype_t glow; 169 dd_bool scaleWithView; 170 }; 171 172 /** 173 * @ingroup ui 174 */ 175 class AutomapStyle 176 { 177 DENG2_NO_ASSIGN(AutomapStyle) 178 DENG2_NO_COPY(AutomapStyle) 179 180 public: 181 AutomapStyle(); 182 ~AutomapStyle(); 183 184 void applyDefaults(); 185 186 automapcfg_lineinfo_t const &lineInfo(int lineType); 187 188 automapcfg_lineinfo_t const *tryFindLineInfo(automapcfg_objectname_t name) const; 189 automapcfg_lineinfo_t const *tryFindLineInfo_special(int special, int flags, Sector const *frontsector, Sector const *backsector, int automapFlags) const; 190 191 void objectColor(automapcfg_objectname_t name, float *r, float *g, float *b, float *a) const; 192 void setObjectColor(automapcfg_objectname_t name, float r, float g, float b); 193 void setObjectColorAndOpacity(automapcfg_objectname_t name, float r, float g, float b, float a); 194 195 void setObjectGlow(automapcfg_objectname_t name, glowtype_t type, float size, float alpha, dd_bool canScale); 196 197 svgid_t objectSvg(automapcfg_objectname_t name) const; 198 void setObjectSvg(automapcfg_objectname_t name, svgid_t svg); 199 200 private: 201 DENG2_PRIVATE(d) 202 }; 203 204 void ST_InitAutomapStyle(); 205 206 AutomapStyle *ST_AutomapStyle(); 207 208 void AM_GetMapColor(float *rgb, float const *uColor, int palidx, dd_bool customPal); 209 210 #endif // LIBCOMMON_UI_AUTOMAPSTYLE_H 211