1 // Emacs style mode select   -*- C++ -*-
2 //-----------------------------------------------------------------------------
3 //
4 // $Id: v_text.h 4469 2014-01-03 23:38:29Z dr_sean $
5 //
6 // Copyright (C) 1998-2006 by Randy Heit (ZDoom 1.22).
7 // Copyright (C) 2006-2014 by The Odamex Team.
8 //
9 // This program is free software; you can redistribute it and/or
10 // modify it under the terms of the GNU General Public License
11 // as published by the Free Software Foundation; either version 2
12 // of the License, or (at your option) any later version.
13 //
14 // This program is distributed in the hope that it will be useful,
15 // but WITHOUT ANY WARRANTY; without even the implied warranty of
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 // GNU General Public License for more details.
18 //
19 // DESCRIPTION:
20 //	V_TEXT
21 //
22 //-----------------------------------------------------------------------------
23 
24 
25 #ifndef __V_TEXT_H__
26 #define __V_TEXT_H__
27 
28 #include "doomtype.h"
29 
30 struct brokenlines_s {
31 	int width;
32 	char *string;
33 };
34 typedef struct brokenlines_s brokenlines_t;
35 
36 enum EColorRange
37 {
38 	CR_BRICK,
39 	CR_TAN,
40 	CR_GRAY,
41 	CR_GREY = CR_GRAY,
42 	CR_GREEN,
43 	CR_BROWN,
44 	CR_GOLD,
45 	CR_RED,
46 	CR_BLUE,
47 	CR_ORANGE,
48 	CR_WHITE,
49 	CR_YELLOW,
50 
51 	// [AM] Extended ZDoom colors.  Not all of these actually work yet.
52 	CR_UNTRANSLATED,
53 	CR_BLACK,
54 	CR_LIGHTBLUE,
55 	CR_CREAM,
56 	CR_OLIVE,
57 	CR_DARKGREEN,
58 	CR_DARKRED,
59 	CR_DARKBROWN,
60 	CR_PURPLE,
61 	CR_DARKGRAY,
62 	CR_DARKGREY = CR_DARKGRAY,
63 	CR_CYAN,
64 	NUM_TEXT_COLORS
65 };
66 
67 #define TEXTCOLOR_ESCAPE	'\x8a'
68 
69 #define TEXTCOLOR_BRICK		"\x8aA"
70 #define TEXTCOLOR_TAN		"\x8aB"
71 #define TEXTCOLOR_GRAY		"\x8aC"
72 #define TEXTCOLOR_GREY		"\x8aC"
73 #define TEXTCOLOR_GREEN		"\x8aD"
74 #define TEXTCOLOR_BROWN		"\x8aE"
75 #define TEXTCOLOR_GOLD		"\x8aF"
76 #define TEXTCOLOR_RED		"\x8aG"
77 #define TEXTCOLOR_BLUE		"\x8aH"
78 #define TEXTCOLOR_ORANGE	"\x8aI"
79 #define TEXTCOLOR_WHITE		"\x8aJ"
80 #define TEXTCOLOR_YELLOW	"\x8aK"
81 
82 // [AM] Extended ZDoom colors.  Not all of these actually work yet.
83 #define TEXTCOLOR_UNTRANSLATED	"\x8aL"
84 #define TEXTCOLOR_BLACK		"\x8aM"
85 #define TEXTCOLOR_LIGHTBLUE	"\x8aN"
86 #define TEXTCOLOR_CREAM		"\x8aO"
87 #define TEXTCOLOR_OLIVE		"\x8aP"
88 #define TEXTCOLOR_DARKGREEN	"\x8aQ"
89 #define TEXTCOLOR_DARKRED	"\x8aR"
90 #define TEXTCOLOR_DARKBROWN	"\x8aS"
91 #define TEXTCOLOR_PURPLE	"\x8aT"
92 #define TEXTCOLOR_DARKGRAY	"\x8aU"
93 #define TEXTCOLOR_DARKGREY	"\x8aU"
94 #define TEXTCOLOR_CYAN		"\x8aV"
95 
96 #define TEXTCOLOR_NORMAL	"\x8a-"
97 #define TEXTCOLOR_BOLD		"\x8a+"
98 
99 int V_StringWidth (const byte *str);
V_StringWidth(const char * str)100 inline int V_StringWidth (const char *str) { return V_StringWidth ((const byte *)str); }
101 
102 brokenlines_t *V_BreakLines (int maxwidth, const byte *str);
103 void V_FreeBrokenLines (brokenlines_t *lines);
V_BreakLines(int maxwidth,const char * str)104 inline brokenlines_t *V_BreakLines (int maxwidth, const char *str) { return V_BreakLines (maxwidth, (const byte *)str); }
105 
106 void V_InitConChars (byte transcolor);
107 
108 #endif //__V_TEXT_H__
109 
110