File: mpr.h

package info (click to toggle)
crawl 2%3A0.7.1-3
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 30,420 kB
  • ctags: 23,018
  • sloc: cpp: 244,317; ansic: 16,144; perl: 2,214; makefile: 984; python: 488; objc: 250; ruby: 200; sh: 140
file content (98 lines) | stat: -rw-r--r-- 3,721 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
/*
 *  File:       mpr.h
 *  Summary:    Functions used to print simple messages.
 *  Written by: Linley Henzell
 */

#ifndef MPR_H
#define MPR_H

// if you mess with this list, you'll need to make changes in initfile.cc
// to message_channel_names, and probably also to message.cc to colour
// everything properly
enum msg_channel_type
{
    MSGCH_PLAIN,            // regular text
    MSGCH_FRIEND_ACTION,    // friendly monsters taking actions
    MSGCH_PROMPT,           // various prompts
    MSGCH_GOD,              // god/religion (param is god)
    MSGCH_PRAY,             // praying messages (param is god)
    MSGCH_DURATION,         // effect down/warnings
    MSGCH_DANGER,           // serious life threats (ie very large HP attacks)
    MSGCH_WARN,             // much less serious threats
    MSGCH_FOOD,             // hunger notices
    MSGCH_RECOVERY,         // recovery from disease/stat/poison condition
    MSGCH_SOUND,            // messages about things the player hears
    MSGCH_TALK,             // monster talk (param is monster type)
    MSGCH_TALK_VISUAL,      // silent monster "talk" (not restricted by silence)
    MSGCH_INTRINSIC_GAIN,   // player level/stat/species-power gains
    MSGCH_MUTATION,         // player gain/lose mutations
    MSGCH_MONSTER_SPELL,    // monsters casting spells
    MSGCH_MONSTER_ENCHANT,  // monsters'*' enchantments up and down
    MSGCH_FRIEND_SPELL,     // allied monsters casting spells
    MSGCH_FRIEND_ENCHANT,   // allied monsters' enchantments up and down
    MSGCH_MONSTER_DAMAGE,   // monster damage reports (param is level)
    MSGCH_MONSTER_TARGET,   // message marking the monster as a target
    MSGCH_BANISHMENT,       // Abyss-related messages
    MSGCH_ROTTEN_MEAT,      // messages about chunks/corpses becoming rotten
    MSGCH_EQUIPMENT,        // equipment listing messages
    MSGCH_FLOOR_ITEMS,      // like equipment, but lists of floor items
    MSGCH_MULTITURN_ACTION, // delayed action messages
    MSGCH_EXAMINE,          // messages describing monsters, features, items
    MSGCH_EXAMINE_FILTER,   // "less important" instances of the above
    MSGCH_DIAGNOSTICS,      // various diagnostic messages
    MSGCH_ERROR,            // error messages
    MSGCH_TUTORIAL,         // messages for tutorial

    NUM_MESSAGE_CHANNELS    // always last
};

enum msg_colour_type
{
    MSGCOL_BLACK        = 0,
    MSGCOL_BLUE,
    MSGCOL_GREEN,
    MSGCOL_CYAN,
    MSGCOL_RED,
    MSGCOL_MAGENTA,
    MSGCOL_BROWN,
    MSGCOL_LIGHTGREY,
    MSGCOL_DARKGREY,
    MSGCOL_LIGHTBLUE,
    MSGCOL_LIGHTGREEN,
    MSGCOL_LIGHTCYAN,
    MSGCOL_LIGHTRED,
    MSGCOL_LIGHTMAGENTA,
    MSGCOL_YELLOW,
    MSGCOL_WHITE,
    MSGCOL_DEFAULT,             // use default colour
    MSGCOL_ALTERNATE,           // use secondary default colour scheme
    MSGCOL_MUTED,               // don't print messages
    MSGCOL_PLAIN,               // same as plain channel
    MSGCOL_NONE,                // parsing failure, etc
};

msg_colour_type msg_colour(int colour);

void mpr(std::string text, msg_channel_type channel=MSGCH_PLAIN, int param=0,
         bool nojoin=false);

inline void mprnojoin(std::string text, msg_channel_type channel=MSGCH_PLAIN,
                      int param=0)
{
    mpr(text, channel, param, true);
}

// 4.1-style mpr, currently named mprf for minimal disruption.
void mprf( msg_channel_type channel, int param, const char *format, ... );
void mprf( msg_channel_type channel, const char *format, ... );
void mprf( const char *format, ... );

// Yay for C89 and lack of variadic #defines...
#ifdef DEBUG_DIAGNOSTICS
void dprf( const char *format, ... );
#else
static inline void dprf( const char *format, ... ) {}
#endif

#endif