1 /**
2 * @file
3 * @brief Functions used to print simple messages.
4 **/
5
6 #pragma once
7
8 #include "format.h"
9
10 // if you mess with this list, you'll need to make changes in initfile.cc
11 // to message_channel_names, and probably also to message.cc to colour
12 // everything properly
13 enum msg_channel_type
14 {
15 MSGCH_PLAIN, // regular text
16 MSGCH_FRIEND_ACTION, // friendly monsters taking actions
17 MSGCH_PROMPT, // various prompts
18 MSGCH_GOD, // god/religion (param is god)
19 MSGCH_DURATION, // effect down/warnings
20 MSGCH_DANGER, // serious life threats (ie very large HP attacks)
21 MSGCH_WARN, // much less serious threats
22 MSGCH_RECOVERY, // recovery from disease/stat/poison condition
23 MSGCH_SOUND, // messages about things the player hears
24 MSGCH_TALK, // monster talk (param is monster type)
25 MSGCH_TALK_VISUAL, // silent monster "talk" (not restricted by silence)
26 MSGCH_INTRINSIC_GAIN, // player level/stat/species-power gains
27 MSGCH_MUTATION, // player gain/lose mutations
28 MSGCH_MONSTER_SPELL, // monsters casting spells
29 MSGCH_MONSTER_ENCHANT, // monsters'*' enchantments up and down
30 MSGCH_FRIEND_SPELL, // allied monsters casting spells
31 MSGCH_FRIEND_ENCHANT, // allied monsters' enchantments up and down
32 MSGCH_MONSTER_DAMAGE, // monster damage reports (param is level)
33 MSGCH_MONSTER_TARGET, // message marking the monster as a target
34 MSGCH_BANISHMENT, // Abyss-related messages
35 MSGCH_EQUIPMENT, // equipment listing messages
36 MSGCH_FLOOR_ITEMS, // like equipment, but lists of floor items
37 MSGCH_MULTITURN_ACTION, // delayed action messages
38 MSGCH_EXAMINE, // messages describing monsters, features, items
39 MSGCH_EXAMINE_FILTER, // "less important" instances of the above
40 MSGCH_DIAGNOSTICS, // various diagnostic messages
41 MSGCH_ERROR, // error messages
42 MSGCH_TUTORIAL, // messages for tutorial
43 MSGCH_ORB, // messages for the orb
44 MSGCH_TIMED_PORTAL, // timed portal entry "tick tick tick" sounds
45 MSGCH_HELL_EFFECT, // hell effects
46 MSGCH_MONSTER_WARNING, // "Foo comes into view", et al
47 MSGCH_DGL_MESSAGE, // dgamelaunch messages
48
49 NUM_MESSAGE_CHANNELS // always last
50 };
51
52 enum msg_colour_type
53 {
54 MSGCOL_BLACK = 0,
55 MSGCOL_BLUE,
56 MSGCOL_GREEN,
57 MSGCOL_CYAN,
58 MSGCOL_RED,
59 MSGCOL_MAGENTA,
60 MSGCOL_BROWN,
61 MSGCOL_LIGHTGREY,
62 MSGCOL_DARKGREY,
63 MSGCOL_LIGHTBLUE,
64 MSGCOL_LIGHTGREEN,
65 MSGCOL_LIGHTCYAN,
66 MSGCOL_LIGHTRED,
67 MSGCOL_LIGHTMAGENTA,
68 MSGCOL_YELLOW,
69 MSGCOL_WHITE,
70 MSGCOL_DEFAULT, // use default colour
71 MSGCOL_ALTERNATE, // use secondary default colour scheme
72 MSGCOL_MUTED, // don't print messages
73 MSGCOL_PLAIN, // same as plain channel
74 MSGCOL_NONE, // parsing failure, etc
75 };
76
77 // Be sure to change diag_names in dbg-util.cc to match.
78 enum diag_type
79 {
80 DIAG_NORMAL,
81 DIAG_DNGN,
82 DIAG_SKILLS,
83 DIAG_COMBAT,
84 DIAG_BEAM,
85 DIAG_NOISE,
86 DIAG_ABYSS,
87 DIAG_MONPLACE,
88 #ifdef DEBUG_MONSPEAK
89 DIAG_SPEECH,
90 #endif
91 #ifdef DEBUG_MONINDEX
92 DIAG_MONINDEX,
93 #endif
94 NUM_DIAGNOSTICS
95 };
96
97 msg_colour_type msg_colour(int colour);
98
99 void do_message_print(msg_channel_type channel, int param, bool cap,
100 bool nojoin, const char *format, va_list argp);
101
102 void mpr(const string &text);
103 void mpr_nojoin(msg_channel_type channel, string text);
104
mpr(const formatted_string & text)105 static inline void mpr(const formatted_string &text)
106 {
107 mpr(text.to_colour_string());
108 }
109
110 // 4.1-style mpr, currently named mprf for minimal disruption.
111 void mprf(msg_channel_type channel, int param, PRINTF(2, ));
112 void mprf(msg_channel_type channel, PRINTF(1, ));
113 void mprf(PRINTF(0, ));
114 void mprf_nojoin(msg_channel_type channel, PRINTF(1,));
115 void mprf_nojoin(PRINTF(0,));
116
117 void mprf_nocap(msg_channel_type channel, int param, PRINTF(2, ));
118 void mprf_nocap(msg_channel_type channel, PRINTF(1, ));
119 void mprf_nocap(PRINTF(0, ));
120
121 #ifdef DEBUG_DIAGNOSTICS
122 void dprf(PRINTF(0, ));
123 void dprf(diag_type param, PRINTF(1, ));
124 #else
125 # define dprf(...) ((void)0)
126 #endif
127