1 /**
2  * @file
3  * @brief Stuff needed for hints mode
4 **/
5 
6 #pragma once
7 
8 #include <cstdio>
9 #include <cstdlib>
10 #include <string>
11 #include <vector>
12 
13 #include "tag-version.h"
14 
15 class formatted_string;
16 class writer;
17 class reader;
18 
19 struct monster_info;
20 
21 enum hints_types
22 {
23     HINT_BERSERK_CHAR,
24     HINT_MAGIC_CHAR,
25     HINT_RANGER_CHAR,
26     HINT_TYPES_NUM   // 3
27 };
28 
29 void save_hints(writer& outf);
30 void load_hints(reader& inf);
31 void init_hints_options();
32 
33 enum hints_event_type
34 {
35     HINT_SEEN_FIRST_OBJECT,
36     // seen certain items
37     HINT_SEEN_POTION,
38     HINT_SEEN_SCROLL,
39     HINT_SEEN_WAND,
40     HINT_SEEN_SPBOOK,
41     HINT_SEEN_JEWELLERY,
42     HINT_SEEN_MISC,
43     HINT_SEEN_STAFF,
44     HINT_SEEN_WEAPON,
45     HINT_SEEN_MISSILES,
46     HINT_SEEN_ARMOUR,
47     HINT_SEEN_RANDART,
48     HINT_SEEN_CARRION,
49     HINT_SEEN_GOLD,
50     // encountered dungeon features
51     HINT_SEEN_STAIRS,
52     HINT_SEEN_ESCAPE_HATCH,
53     HINT_SEEN_BRANCH,
54     HINT_SEEN_PORTAL,
55     HINT_SEEN_TRAP,
56     HINT_SEEN_ALTAR,
57     HINT_SEEN_SHOP,
58     HINT_SEEN_DOOR,
59     HINT_SEEN_RUNED_DOOR,
60     // other 'first events'
61     HINT_SEEN_MONSTER,
62     HINT_SEEN_ZERO_EXP_MON,
63     HINT_MONSTER_BRAND,
64     HINT_MONSTER_FRIENDLY,
65     HINT_MONSTER_SHOUT,
66     HINT_MONSTER_LEFT_LOS,
67     HINT_KILLED_MONSTER,
68     HINT_NEW_LEVEL,
69     HINT_SKILL_RAISE,
70     HINT_GAINED_MAGICAL_SKILL,
71     HINT_GAINED_MELEE_SKILL,
72     HINT_GAINED_RANGED_SKILL,
73     HINT_CHOOSE_STAT,
74     HINT_MAKE_CHUNKS,
75     HINT_NEW_ABILITY_GOD,
76 #if TAG_MAJOR_VERSION == 34
77     HINT_NEW_ABILITY_MUT,
78 #endif
79     HINT_NEW_ABILITY_ITEM,
80     HINT_FLEEING_MONSTER,
81     HINT_CONVERT,
82     HINT_GOD_DISPLEASED,
83     HINT_EXCOMMUNICATE,
84     HINT_SPELL_MISCAST,
85     HINT_GLOWING,
86     HINT_YOU_RESIST,
87     // status changes
88     HINT_YOU_ENCHANTED,
89     HINT_YOU_POISON,
90 #if TAG_MAJOR_VERSION == 34
91     HINT_YOU_CURSED,
92 #endif
93     HINT_YOU_STARVING,
94     HINT_YOU_MUTATED,
95     HINT_CAN_BERSERK,
96     HINT_POSTBERSERK,
97     HINT_CAUGHT_IN_NET,
98     HINT_YOU_SILENCE,
99     // warning
100     HINT_RUN_AWAY,
101     HINT_RETREAT_CASTER,
102     HINT_WIELD_WEAPON,
103     HINT_NEED_HEALING,
104     HINT_NEED_POISON_HEALING,
105     HINT_INVISIBLE_DANGER,
106     HINT_NEED_HEALING_INVIS,
107     HINT_ABYSS,
108     // interface
109     HINT_MULTI_PICKUP,
110     HINT_FULL_INVENTORY,
111     HINT_SHIFT_RUN,
112     HINT_MAP_VIEW,
113     HINT_AUTO_EXPLORE,
114     HINT_DONE_EXPLORE,
115     HINT_AUTO_EXCLUSION,
116     HINT_STAIR_BRAND,
117     HINT_HEAP_BRAND,
118     HINT_TRAP_BRAND,
119     HINT_LOAD_SAVED_GAME,
120     // for the tutorial
121     HINT_AUTOPICKUP_THROWN,
122     HINT_TARGET_NO_FOE,
123 #if TAG_MAJOR_VERSION == 34
124     HINT_REMOVED_CURSE,
125 #endif
126     HINT_ITEM_RESISTANCES,
127     HINT_HEALING_POTIONS,
128     HINT_GAINED_SPELLCASTING,
129     HINT_FUMBLING_SHALLOW_WATER,
130     HINT_CLOUD_WARNING,
131     HINT_ANIMATE_CORPSE_SKELETON,
132     HINT_SEEN_WEB,
133     HINT_EVENTS_NUM
134 };
135 
136 struct newgame_def;
137 void init_hints();
138 void tutorial_init_hints();
139 void pick_hints(newgame_def& choice);
140 void hints_load_game();
141 
142 void hints_starting_screen();
143 void hints_new_turn();
144 void print_hint(string key, const string& arg1 = "", const string& arg2 = "");
145 void hints_death_screen();
146 void hints_finished();
147 
148 void hints_healing_check();
149 
150 void taken_new_item(object_class_type item_type);
151 void hints_gained_new_skill(skill_type skill);
152 void hints_monster_seen(const monster& mon);
153 void hints_first_item(const item_def& item);
154 void learned_something_new(hints_event_type seen_what,
155                            coord_def gc = coord_def());
156 formatted_string hints_abilities_info();
157 string hints_skills_info();
158 string hints_skill_training_info();
159 string hints_skill_costs_info();
160 string hints_skill_targets_info();
161 string hints_skills_description_info();
162 string hints_memorise_info();
163 
164 // Additional information for tutorial players.
165 void check_item_hint(const item_def &item, unsigned int num_old_talents);
166 string hints_describe_item(const item_def &item);
167 bool hints_pos_interesting(int x, int y);
168 string hints_describe_pos(int x, int y);
169 bool hints_monster_interesting(const monster* mons);
170 string hints_describe_monster(const monster_info& mi, bool has_stat_desc);
171 
172 void hints_observe_cell(const coord_def& gc);
173 
174 struct hints_state
175 {
176     FixedVector<bool, HINT_EVENTS_NUM> hints_events;
177     bool hints_explored;
178     bool hints_stashes;
179     bool hints_travel;
180     unsigned int hints_spell_counter;
181     unsigned int hints_throw_counter;
182     unsigned int hints_berserk_counter;
183     unsigned int hints_melee_counter;
184     unsigned int hints_last_healed;
185     unsigned int hints_seen_invisible;
186 
187     bool hints_just_triggered;
188     unsigned int hints_type;
189 };
190 
191 extern hints_state Hints;
192 
193 void tutorial_msg(const char *text, bool end = false);
194