| 1 | #ifndef INCLUDED_Z_MSG_H |
|---|
| 2 | #define INCLUDED_Z_MSG_H |
|---|
| 3 | |
|---|
| 4 | #include "h-basic.h" |
|---|
| 5 | |
|---|
| 6 | /*** Constants ***/ |
|---|
| 7 | |
|---|
| 8 | |
|---|
| 9 | /*** Message constants ***/ |
|---|
| 10 | |
|---|
| 11 | enum |
|---|
| 12 | { |
|---|
| 13 | MSG_GENERIC = 0, |
|---|
| 14 | MSG_HIT = 1, |
|---|
| 15 | MSG_MISS = 2, |
|---|
| 16 | MSG_FLEE = 3, |
|---|
| 17 | MSG_DROP = 4, |
|---|
| 18 | MSG_KILL = 5, |
|---|
| 19 | MSG_LEVEL = 6, |
|---|
| 20 | MSG_DEATH = 7, |
|---|
| 21 | MSG_STUDY = 8, |
|---|
| 22 | MSG_TELEPORT = 9, |
|---|
| 23 | MSG_SHOOT = 10, |
|---|
| 24 | MSG_QUAFF = 11, |
|---|
| 25 | MSG_ZAP_ROD = 12, |
|---|
| 26 | MSG_WALK = 13, |
|---|
| 27 | MSG_TPOTHER = 14, |
|---|
| 28 | MSG_HITWALL = 15, |
|---|
| 29 | MSG_EAT = 16, |
|---|
| 30 | MSG_STORE1 = 17, |
|---|
| 31 | MSG_STORE2 = 18, |
|---|
| 32 | MSG_STORE3 = 19, |
|---|
| 33 | MSG_STORE4 = 20, |
|---|
| 34 | MSG_DIG = 21, |
|---|
| 35 | MSG_OPENDOOR = 22, |
|---|
| 36 | MSG_SHUTDOOR = 23, |
|---|
| 37 | MSG_TPLEVEL = 24, |
|---|
| 38 | MSG_BELL = 25, |
|---|
| 39 | MSG_NOTHING_TO_OPEN = 26, |
|---|
| 40 | MSG_LOCKPICK_FAIL = 27, |
|---|
| 41 | MSG_STAIRS_DOWN = 28, |
|---|
| 42 | MSG_HITPOINT_WARN = 29, |
|---|
| 43 | MSG_ACT_ARTIFACT = 30, |
|---|
| 44 | MSG_USE_STAFF = 31, |
|---|
| 45 | MSG_DESTROY = 32, |
|---|
| 46 | MSG_MON_HIT = 33, |
|---|
| 47 | MSG_MON_TOUCH = 34, |
|---|
| 48 | MSG_MON_PUNCH = 35, |
|---|
| 49 | MSG_MON_KICK = 36, |
|---|
| 50 | MSG_MON_CLAW = 37, |
|---|
| 51 | MSG_MON_BITE = 38, |
|---|
| 52 | MSG_MON_STING = 39, |
|---|
| 53 | MSG_MON_BUTT = 40, |
|---|
| 54 | MSG_MON_CRUSH = 41, |
|---|
| 55 | MSG_MON_ENGULF = 42, |
|---|
| 56 | MSG_MON_CRAWL = 43, |
|---|
| 57 | MSG_MON_DROOL = 44, |
|---|
| 58 | MSG_MON_SPIT = 45, |
|---|
| 59 | MSG_MON_GAZE = 46, |
|---|
| 60 | MSG_MON_WAIL = 47, |
|---|
| 61 | MSG_MON_SPORE = 48, |
|---|
| 62 | MSG_MON_BEG = 49, |
|---|
| 63 | MSG_MON_INSULT = 50, |
|---|
| 64 | MSG_MON_MOAN = 51, |
|---|
| 65 | MSG_RECOVER = 52, |
|---|
| 66 | MSG_BLIND = 53, |
|---|
| 67 | MSG_CONFUSED = 54, |
|---|
| 68 | MSG_POISONED = 55, |
|---|
| 69 | MSG_AFRAID = 56, |
|---|
| 70 | MSG_PARALYZED = 57, |
|---|
| 71 | MSG_DRUGGED = 58, |
|---|
| 72 | MSG_SPEED = 59, |
|---|
| 73 | MSG_SLOW = 60, |
|---|
| 74 | MSG_SHIELD = 61, |
|---|
| 75 | MSG_BLESSED = 62, |
|---|
| 76 | MSG_HERO = 63, |
|---|
| 77 | MSG_BERSERK = 64, |
|---|
| 78 | MSG_PROT_EVIL = 65, |
|---|
| 79 | MSG_INVULN = 66, |
|---|
| 80 | MSG_SEE_INVIS = 67, |
|---|
| 81 | MSG_INFRARED = 68, |
|---|
| 82 | MSG_RES_ACID = 69, |
|---|
| 83 | MSG_RES_ELEC = 70, |
|---|
| 84 | MSG_RES_FIRE = 71, |
|---|
| 85 | MSG_RES_COLD = 72, |
|---|
| 86 | MSG_RES_POIS = 73, |
|---|
| 87 | MSG_STUN = 74, |
|---|
| 88 | MSG_CUT = 75, |
|---|
| 89 | MSG_STAIRS_UP = 76, |
|---|
| 90 | MSG_STORE_ENTER = 77, |
|---|
| 91 | MSG_STORE_LEAVE = 78, |
|---|
| 92 | MSG_STORE_HOME = 79, |
|---|
| 93 | MSG_MONEY1 = 80, |
|---|
| 94 | MSG_MONEY2 = 81, |
|---|
| 95 | MSG_MONEY3 = 82, |
|---|
| 96 | MSG_SHOOT_HIT = 83, |
|---|
| 97 | MSG_STORE5 = 84, |
|---|
| 98 | MSG_LOCKPICK = 85, |
|---|
| 99 | MSG_DISARM = 86, |
|---|
| 100 | MSG_IDENT_BAD = 87, |
|---|
| 101 | MSG_IDENT_EGO = 88, |
|---|
| 102 | MSG_IDENT_ART = 89, |
|---|
| 103 | MSG_BR_ELEMENTS = 90, |
|---|
| 104 | MSG_BR_FROST = 91, |
|---|
| 105 | MSG_BR_ELEC = 92, |
|---|
| 106 | MSG_BR_ACID = 93, |
|---|
| 107 | MSG_BR_GAS = 94, |
|---|
| 108 | MSG_BR_FIRE = 95, |
|---|
| 109 | MSG_BR_CONF = 96, |
|---|
| 110 | MSG_BR_DISENCHANT = 97, |
|---|
| 111 | MSG_BR_CHAOS = 98, |
|---|
| 112 | MSG_BR_SHARDS = 99, |
|---|
| 113 | MSG_BR_SOUND = 100, |
|---|
| 114 | MSG_BR_LIGHT = 101, |
|---|
| 115 | MSG_BR_DARK = 102, |
|---|
| 116 | MSG_BR_NETHER = 103, |
|---|
| 117 | MSG_BR_NEXUS = 104, |
|---|
| 118 | MSG_BR_TIME = 105, |
|---|
| 119 | MSG_BR_INERTIA = 106, |
|---|
| 120 | MSG_BR_GRAVITY = 107, |
|---|
| 121 | MSG_BR_PLASMA = 108, |
|---|
| 122 | MSG_BR_FORCE = 109, |
|---|
| 123 | MSG_SUM_MONSTER = 110, |
|---|
| 124 | MSG_SUM_ANGEL = 111, |
|---|
| 125 | MSG_SUM_UNDEAD = 112, |
|---|
| 126 | MSG_SUM_ANIMAL = 113, |
|---|
| 127 | MSG_SUM_SPIDER = 114, |
|---|
| 128 | MSG_SUM_HOUND = 115, |
|---|
| 129 | MSG_SUM_HYDRA = 116, |
|---|
| 130 | MSG_SUM_DEMON = 117, |
|---|
| 131 | MSG_SUM_DRAGON = 118, |
|---|
| 132 | MSG_SUM_HI_UNDEAD = 119, |
|---|
| 133 | MSG_SUM_HI_DRAGON = 120, |
|---|
| 134 | MSG_SUM_HI_DEMON = 121, |
|---|
| 135 | MSG_SUM_WRAITH = 122, |
|---|
| 136 | MSG_SUM_UNIQUE = 123, |
|---|
| 137 | MSG_WIELD = 124, |
|---|
| 138 | MSG_CURSED = 125, |
|---|
| 139 | MSG_PSEUDOID = 126, |
|---|
| 140 | MSG_HUNGRY = 127, |
|---|
| 141 | MSG_NOTICE = 128, |
|---|
| 142 | MSG_AMBIENT_DAY = 129, |
|---|
| 143 | MSG_AMBIENT_NITE = 130, |
|---|
| 144 | MSG_AMBIENT_DNG1 = 131, |
|---|
| 145 | MSG_AMBIENT_DNG2 = 132, |
|---|
| 146 | MSG_AMBIENT_DNG3 = 133, |
|---|
| 147 | MSG_AMBIENT_DNG4 = 134, |
|---|
| 148 | MSG_AMBIENT_DNG5 = 135, |
|---|
| 149 | MSG_CREATE_TRAP = 136, |
|---|
| 150 | MSG_SHRIEK = 137, |
|---|
| 151 | MSG_CAST_FEAR = 138, |
|---|
| 152 | MSG_HIT_GOOD = 139, |
|---|
| 153 | MSG_HIT_GREAT = 140, |
|---|
| 154 | MSG_HIT_SUPERB = 141, |
|---|
| 155 | MSG_HIT_HI_GREAT = 142, |
|---|
| 156 | MSG_HIT_HI_SUPERB = 143, |
|---|
| 157 | MSG_SPELL = 144, |
|---|
| 158 | MSG_PRAYER = 145, |
|---|
| 159 | MSG_KILL_UNIQUE = 146, |
|---|
| 160 | MSG_KILL_KING = 147, |
|---|
| 161 | MSG_DRAIN_STAT = 148, |
|---|
| 162 | MSG_MULTIPLY = 149, |
|---|
| 163 | |
|---|
| 164 | MSG_MAX = 150, |
|---|
| 165 | SOUND_MAX = MSG_MAX |
|---|
| 166 | }; |
|---|
| 167 | |
|---|
| 168 | |
|---|
| 169 | /*** Functions ***/ |
|---|
| 170 | |
|---|
| 171 | /** Initialisation/exit **/ |
|---|
| 172 | |
|---|
| 173 | /** |
|---|
| 174 | * Initialise the messages package. Should be called before using any other |
|---|
| 175 | * functions in the package. |
|---|
| 176 | */ |
|---|
| 177 | errr messages_init(void); |
|---|
| 178 | |
|---|
| 179 | /** |
|---|
| 180 | * Free the message package. |
|---|
| 181 | */ |
|---|
| 182 | void messages_free(void); |
|---|
| 183 | |
|---|
| 184 | |
|---|
| 185 | /** General info **/ |
|---|
| 186 | |
|---|
| 187 | /** |
|---|
| 188 | * Return the current number of messages stored. |
|---|
| 189 | */ |
|---|
| 190 | u16b messages_num(void); |
|---|
| 191 | |
|---|
| 192 | |
|---|
| 193 | /** Individual message handling **/ |
|---|
| 194 | |
|---|
| 195 | /** |
|---|
| 196 | * Save a new message into the memory buffer, with text `str` and type `type`. |
|---|
| 197 | * The type should be one of the MSG_ constants defined above. |
|---|
| 198 | * |
|---|
| 199 | * The new message may not be saved if it is identical to the one saved before |
|---|
| 200 | * it, in which case the "count" of the message will be increased instead. |
|---|
| 201 | * This count can be fetched using the message_count() function. |
|---|
| 202 | */ |
|---|
| 203 | void message_add(const char *str, u16b type); |
|---|
| 204 | |
|---|
| 205 | |
|---|
| 206 | /** |
|---|
| 207 | * Returns the text of the message of age `age`. The age of the most recently |
|---|
| 208 | * saved message is 0, the one before that is of age 1, etc. |
|---|
| 209 | * |
|---|
| 210 | * Returns the empty string if the no messages of the age specified are |
|---|
| 211 | * available. |
|---|
| 212 | */ |
|---|
| 213 | const char *message_str(u16b age); |
|---|
| 214 | |
|---|
| 215 | /** |
|---|
| 216 | * Returns the number of times the message of age `age` was saved. The age of |
|---|
| 217 | * the most recently saved message is 0, the one before that is of age 1, etc. |
|---|
| 218 | * |
|---|
| 219 | * In other words, if message_add() was called five times, one after the other, |
|---|
| 220 | * with the message "The orc sets your hair on fire.", then the text will only |
|---|
| 221 | * have one age (age = 0), but will have a count of 5. |
|---|
| 222 | */ |
|---|
| 223 | u16b message_count(u16b age); |
|---|
| 224 | |
|---|
| 225 | /** |
|---|
| 226 | * Returns the type of the message of age `age`. The age of the most recently |
|---|
| 227 | * saved message is 0, the one before that is of age 1, etc. |
|---|
| 228 | * |
|---|
| 229 | * The type is one of the MSG_ constants, defined above. |
|---|
| 230 | */ |
|---|
| 231 | u16b message_type(u16b age); |
|---|
| 232 | |
|---|
| 233 | /** |
|---|
| 234 | * Returns the display colour of the message memorised `age` messages ago. |
|---|
| 235 | * (i.e. age = 0 represents the last memorised message, age = 1 is the one |
|---|
| 236 | * before that, etc). |
|---|
| 237 | */ |
|---|
| 238 | byte message_color(u16b age); |
|---|
| 239 | |
|---|
| 240 | |
|---|
| 241 | /** Message type changes **/ |
|---|
| 242 | |
|---|
| 243 | /** |
|---|
| 244 | * Returns the colour for the message type `type`. |
|---|
| 245 | */ |
|---|
| 246 | byte message_type_color(u16b type); |
|---|
| 247 | |
|---|
| 248 | /** |
|---|
| 249 | * Defines the color `color` for the message type `type`. |
|---|
| 250 | */ |
|---|
| 251 | errr message_color_define(u16b type, byte color); |
|---|
| 252 | |
|---|
| 253 | |
|---|
| 254 | #endif /* !INCLUDED_Z_MSG_H */ |
|---|