summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-07-23 17:11:56 +0000
committerdshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-07-23 17:11:56 +0000
commit7e8a32831f88e720c9ba724037b76d09fc5c1cd0 (patch)
treec6cf3786e3650ee690136f8330fd8c50033c5eb3
parent74306af7d80b6dc3360b145270bd7d5ca20eb19f (diff)
downloadcrawl-ref-7e8a32831f88e720c9ba724037b76d09fc5c1cd0.tar.gz
crawl-ref-7e8a32831f88e720c9ba724037b76d09fc5c1cd0.zip
Allow monster symbols to be customised using the mon_glyph option.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1916 c06c8d41-db1a-0410-9941-cceddc491573
-rw-r--r--crawl-ref/docs/crawl_options.txt41
-rw-r--r--crawl-ref/init.txt2
-rw-r--r--crawl-ref/source/acr.cc12
-rw-r--r--crawl-ref/source/externs.h19
-rw-r--r--crawl-ref/source/initfile.cc84
-rw-r--r--crawl-ref/source/initfile.h3
-rw-r--r--crawl-ref/source/libutil.cc12
-rw-r--r--crawl-ref/source/libutil.h10
-rw-r--r--crawl-ref/source/mon-data.h18
-rw-r--r--crawl-ref/source/mon-util.cc88
-rw-r--r--crawl-ref/source/mon-util.h7
11 files changed, 223 insertions, 73 deletions
diff --git a/crawl-ref/docs/crawl_options.txt b/crawl-ref/docs/crawl_options.txt
index a5fdb148cf..d080639f54 100644
--- a/crawl-ref/docs/crawl_options.txt
+++ b/crawl-ref/docs/crawl_options.txt
@@ -78,7 +78,7 @@ The contents of this text are:
6-a All OS.
macro_meta_entry, mouse_input, wiz_mode, colours,
char_set, cset_ascii, cset_ibm, cset_dec, feature,
- classic_item_colours
+ mon_glyph, classic_item_colours
6-b DOS and Windows.
dos_use_background_intensity
6-c Unix
@@ -1285,6 +1285,45 @@ feature = <regex> { <symbol>, <magicmap symbol>, <view colour>,
feature = metal wall {x23}
all do the same thing.
+mon_glyph = <monster name or symbol> : <colour> <glyph>
+ The mon_glyph option allows you to customise the symbol and
+ colour used to display a monster.
+
+ You can customise symbols based on monster names or their existing
+ symbols. For instance, if you want to put elves on E and efreeti
+ on e, you can do this:
+
+ mon_glyph = e : E
+ mon_glyph = E : e
+
+ If you want to change the symbol for a monster that uses a
+ space as a symbol, specify an underscore on the left:
+
+ mon_glyph = _ : #
+
+ (That changes shades to use #.)
+
+ You can specify a different symbol, or a colour, or both, in
+ any order. Here are more examples:
+
+ mon_glyph = deep elf annihilator : E lightmagenta
+ mon_glyph = Xtahua : lightmagenta D
+ mon_glyph = large zombie : darkgrey
+ mon_glyph = small simulacrum : x
+
+ (The left hand side of the : is case-sensitive.)
+
+ You can specify symbols using their code points using the
+ syntax as shown in feature. If you're using char_set=unicode,
+ you can use unicode code points:
+
+ mon_glyph = draconian scorcher : x6e9
+
+ A single _ is treated as a space; if you want a real underscore,
+ put a \ in front of it like this:
+
+ mon_glyph = player ghost : \_
+
classic_item_colours = false
Crawl uses 4.0 b26/0.1.x-like item colours if classic_item_colours is
set to true. The default (false) is to use the new 0.2 item colours.
diff --git a/crawl-ref/init.txt b/crawl-ref/init.txt
index 95a8a9c1ec..7cd544ee93 100644
--- a/crawl-ref/init.txt
+++ b/crawl-ref/init.txt
@@ -256,7 +256,7 @@ message_colour = lightcyan:LOW MAGIC WARNING
# classic_item_colours = true
#
# See crawl_options.txt for the options
-# char_set, cset_ascii, cset_ibm, cset_dec, cset_any, feature
+# char_set, cset_ascii, cset_ibm, cset_dec, cset_any, feature, mon_glyph
##### 6-b DOS and Windows #######################
diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc
index 3bcbd517bc..fd23b5e1dc 100644
--- a/crawl-ref/source/acr.cc
+++ b/crawl-ref/source/acr.cc
@@ -208,7 +208,10 @@ int main( int argc, char *argv[] )
exit(1);
}
- // Read the init file
+ // Init monsters up front - needed to handle the mon_glyph option right.
+ init_monsters(mcolour);
+
+ // Read the init file.
init_file_location = read_init_file();
// now parse the args again, looking for everything else.
@@ -536,7 +539,6 @@ static void handle_wizard_command( void )
continue;
monster_die(monster, KILL_RESET, 0);
-
}
break;
@@ -2751,9 +2753,8 @@ static bool initialise(void)
get_typeid_array().init(ID_UNKNOWN_TYPE);
init_char_table(Options.char_set);
init_feature_table();
-
+ init_monster_symbols();
init_properties();
- init_monsters(mcolour); // this needs to be way up top {dlb}
init_spell_descs(); // this needs to be way up top {dlb}
msg::initialise_mpr_streams();
@@ -2816,7 +2817,7 @@ static bool initialise(void)
calc_mp();
run_map_preludes();
-
+
load( you.entering_level? you.transit_stair : DNGN_STONE_STAIRS_DOWN_I,
you.entering_level? LOAD_ENTER_LEVEL :
newc ? LOAD_START_GAME : LOAD_RESTART_GAME,
@@ -2869,6 +2870,7 @@ static bool initialise(void)
// In case Lua changed the character set.
init_char_table(Options.char_set);
init_feature_table();
+ init_monster_symbols();
#endif
set_cursor_enabled(false);
diff --git a/crawl-ref/source/externs.h b/crawl-ref/source/externs.h
index 67138455c0..bba92b51c0 100644
--- a/crawl-ref/source/externs.h
+++ b/crawl-ref/source/externs.h
@@ -1535,6 +1535,17 @@ private:
void set_comparators(std::string &s);
};
+struct mon_display
+{
+ monster_type type;
+ unsigned glyph;
+ unsigned colour;
+
+ mon_display(monster_type m = MONS_PROGRAM_BUG,
+ unsigned gly = 0,
+ unsigned col = 0) : type(m), glyph(gly), colour(col) { }
+};
+
class InitLineInput;
struct game_options
{
@@ -1549,6 +1560,7 @@ public:
public:
// View options
std::vector<feature_override> feature_overrides;
+ std::vector<mon_display> mon_glyph_overrides;
unsigned cset_override[NUM_CSET][NUM_DCHAR_TYPES];
std::string save_dir; // Directory where saves and bones go.
@@ -1852,6 +1864,13 @@ private:
int read_explore_stop_conditions(const std::string &) const;
void validate_options();
+ void add_all(const std::string &s, const std::string &separator,
+ void (game_options::*add)(const std::string &));
+ void add_mon_glyph_override(monster_type mtype, mon_display &mdisp);
+ void add_mon_glyph_overrides(const std::string &mons, mon_display &mdisp);
+ void add_mon_glyph_override(const std::string &);
+ mon_display parse_mon_glyph(const std::string &s) const;
+
static const std::string interrupt_prefix;
};
diff --git a/crawl-ref/source/initfile.cc b/crawl-ref/source/initfile.cc
index cf7466b49a..65386c6290 100644
--- a/crawl-ref/source/initfile.cc
+++ b/crawl-ref/source/initfile.cc
@@ -30,6 +30,7 @@
#include "defines.h"
#include "invent.h"
#include "libutil.h"
+#include "mon-util.h"
#include "player.h"
#include "religion.h"
#include "stash.h"
@@ -85,7 +86,8 @@ const char* colour_to_str(unsigned char colour)
}
// returns -1 if unmatched else returns 0-15
-int str_to_colour( const std::string &str, int default_colour )
+int str_to_colour( const std::string &str, int default_colour,
+ bool accept_number )
{
int ret;
@@ -128,7 +130,7 @@ int str_to_colour( const std::string &str, int default_colour )
}
}
- if (ret == 16)
+ if (ret == 16 && accept_number)
{
// Check if we have a direct colour index
const char *s = str.c_str();
@@ -769,6 +771,7 @@ void game_options::reset_options()
clear_cset_overrides();
clear_feature_overrides();
+ mon_glyph_overrides.clear();
// Map each category to itself. The user can override in init.txt
kill_map[KC_YOU] = KC_YOU;
@@ -794,12 +797,12 @@ static unsigned read_symbol(std::string s)
if (s.empty())
return (0);
- if (s.length() == 1)
- return s[0];
-
if (s.length() > 1 && s[0] == '\\')
s = s.substr(1);
+ if (s.length() == 1)
+ return s[0];
+
int base = 10;
if (s.length() > 1 && s[0] == 'x')
{
@@ -830,6 +833,59 @@ void game_options::add_fire_order_slot(const std::string &s)
fire_order.push_back(flags);
}
+void game_options::add_mon_glyph_override(monster_type mtype,
+ mon_display &mdisp)
+{
+ mdisp.type = mtype;
+ mon_glyph_overrides.push_back(mdisp);
+}
+
+void game_options::add_mon_glyph_overrides(const std::string &mons,
+ mon_display &mdisp)
+{
+ // If one character, this is a monster letter.
+ int letter = -1;
+ if (mons.length() == 1)
+ letter = mons[0] == '_' ? ' ' : mons[0];
+
+ for (int i = 0; i < NUM_MONSTERS; ++i)
+ {
+ const monsterentry *me = get_monster_data(i);
+ if (!me || me->mc == MONS_PROGRAM_BUG)
+ continue;
+
+ if (me->showchar == letter || me->name == mons)
+ add_mon_glyph_override(static_cast<monster_type>(i), mdisp);
+ }
+}
+
+mon_display game_options::parse_mon_glyph(const std::string &s) const
+{
+ mon_display md;
+ std::vector<std::string> phrases = split_string(" ", s);
+ for (int i = 0, size = phrases.size(); i < size; ++i)
+ {
+ const std::string &p = phrases[i];
+ const int col = str_to_colour(p, -1, false);
+ if (col != -1 && colour)
+ md.colour = col;
+ else
+ md.glyph = p == "_"? ' ' : read_symbol(p);
+ }
+ return (md);
+}
+
+void game_options::add_mon_glyph_override(const std::string &text)
+{
+ std::vector<std::string> override = split_string(":", text);
+ if (override.size() != 2u)
+ return;
+
+ mon_display mdisp = parse_mon_glyph(override[1]);
+ if (mdisp.glyph || mdisp.colour)
+ add_mon_glyph_overrides(override[0], mdisp);
+}
+
void game_options::add_feature_override(const std::string &text)
{
std::string::size_type epos = text.rfind("}");
@@ -1336,6 +1392,14 @@ void game_options::set_menu_sort(std::string field)
sort_menus.push_back(cond);
}
+void game_options::add_all(const std::string &s, const std::string &separator,
+ void (game_options::*add)(const std::string &))
+{
+ const std::vector<std::string> defs = split_string(separator, s);
+ for (int i = 0, size = defs.size(); i < size; ++i)
+ (this->*add)( defs[i] );
+}
+
void game_options::read_option_line(const std::string &str, bool runscript)
{
std::string key = "";
@@ -1412,6 +1476,7 @@ void game_options::read_option_line(const std::string &str, bool runscript)
&& key != "note_monsters" && key != "note_messages"
&& key.find("cset") != 0 && key != "dungeon"
&& key != "feature" && key != "fire_items_start"
+ && key != "mon_glyph"
&& key != "menu_colour" && key != "menu_color"
&& key != "message_colour" && key != "message_color"
&& key != "levels" && key != "level" && key != "entries")
@@ -1657,10 +1722,11 @@ void game_options::read_option_line(const std::string &str, bool runscript)
}
else if (key == "feature" || key == "dungeon")
{
- std::vector<std::string> defs = split_string(";", field);
-
- for (int i = 0, size = defs.size(); i < size; ++i)
- add_feature_override( defs[i] );
+ add_all(field, ";", &game_options::add_feature_override);
+ }
+ else if (key == "mon_glyph")
+ {
+ add_all(field, ",", &game_options::add_mon_glyph_override);
}
else if (key == "friend_brand")
{
diff --git a/crawl-ref/source/initfile.h b/crawl-ref/source/initfile.h
index 2edd72a876..c159bdb42d 100644
--- a/crawl-ref/source/initfile.h
+++ b/crawl-ref/source/initfile.h
@@ -20,7 +20,8 @@
#include "enum.h"
god_type str_to_god(std::string god);
-int str_to_colour( const std::string &str, int default_colour = -1 );
+int str_to_colour( const std::string &str, int default_colour = -1,
+ bool accept_number = true );
const char* colour_to_str( unsigned char colour );
// last updated 12may2000 {dlb}
diff --git a/crawl-ref/source/libutil.cc b/crawl-ref/source/libutil.cc
index e3c68f87bb..e1cca6a43e 100644
--- a/crawl-ref/source/libutil.cc
+++ b/crawl-ref/source/libutil.cc
@@ -414,14 +414,14 @@ static void add_segment(std::vector<std::string> &segs,
}
std::vector<std::string> split_string(
- const char *sep,
- std::string s,
- bool trim_segments,
- bool accept_empty_segments,
- int nsplits)
+ const std::string &sep,
+ std::string s,
+ bool trim_segments,
+ bool accept_empty_segments,
+ int nsplits)
{
std::vector<std::string> segments;
- int separator_length = strlen(sep);
+ int separator_length = sep.length();
std::string::size_type pos;
while (nsplits && (pos = s.find(sep)) != std::string::npos)
diff --git a/crawl-ref/source/libutil.h b/crawl-ref/source/libutil.h
index 990463852f..9af70c60ad 100644
--- a/crawl-ref/source/libutil.h
+++ b/crawl-ref/source/libutil.h
@@ -86,11 +86,11 @@ std::string trimmed_string( std::string s );
// remainder of the string as the last segment; negative values of nsplits
// split on all occurrences of the separator.
std::vector<std::string> split_string(
- const char *sep,
- std::string s,
- bool trim = true,
- bool accept_empties = false,
- int nsplits = -1);
+ const std::string &sep,
+ std::string s,
+ bool trim = true,
+ bool accept_empties = false,
+ int nsplits = -1);
inline std::string lowercase_first(std::string s)
{
diff --git a/crawl-ref/source/mon-data.h b/crawl-ref/source/mon-data.h
index 8e37414b0a..c66b117164 100644
--- a/crawl-ref/source/mon-data.h
+++ b/crawl-ref/source/mon-data.h
@@ -421,7 +421,7 @@
// small zombie
{
- MONS_ZOMBIE_SMALL, 'z', BROWN, "",
+ MONS_ZOMBIE_SMALL, 'z', BROWN, "small zombie",
M_EVIL,
MR_RES_POISON | MR_RES_COLD,
0, 6, MONS_ZOMBIE_SMALL, MONS_ZOMBIE_SMALL, MH_UNDEAD, -1,
@@ -737,7 +737,7 @@
// big zombie
{
- MONS_ZOMBIE_LARGE, 'Z', BROWN, "",
+ MONS_ZOMBIE_LARGE, 'Z', BROWN, "large zombie",
M_EVIL,
MR_RES_POISON | MR_RES_COLD,
0, 6, MONS_ZOMBIE_SMALL, MONS_ZOMBIE_LARGE, MH_UNDEAD, -1,
@@ -1320,7 +1320,7 @@
// small skeleton
{
- MONS_SKELETON_SMALL, 'z', LIGHTGREY, "",
+ MONS_SKELETON_SMALL, 'z', LIGHTGREY, "small skeleton",
M_EVIL,
MR_RES_POISON | MR_RES_COLD,
0, 10, MONS_SKELETON_SMALL, MONS_SKELETON_SMALL, MH_UNDEAD, -1,
@@ -1333,7 +1333,7 @@
// large skeleton
{
- MONS_SKELETON_LARGE, 'Z', LIGHTGREY, "",
+ MONS_SKELETON_LARGE, 'Z', LIGHTGREY, "large skeleton",
M_EVIL,
MR_RES_POISON | MR_RES_COLD,
0, 10, MONS_SKELETON_SMALL, MONS_SKELETON_LARGE, MH_UNDEAD, -1,
@@ -3504,7 +3504,7 @@
/* spectral thing - similar to zombies/skeletons */
{
- MONS_SPECTRAL_THING, 'W', GREEN, "",
+ MONS_SPECTRAL_THING, 'W', GREEN, "spectral thing",
M_LEVITATE | M_SEE_INVIS,
MR_RES_POISON | MR_RES_COLD,
0, 11, MONS_WRAITH, MONS_SPECTRAL_THING, MH_UNDEAD, MAG_IMMUNE,
@@ -4074,7 +4074,7 @@
/* player ghost - only one per level. stats are stored in ghost struct */
{
- MONS_PLAYER_GHOST, 'p', DARKGREY, "",
+ MONS_PLAYER_GHOST, 'p', DARKGREY, "player ghost",
M_FIGHTER | M_SPEAKS | M_SPELLCASTER | M_ACTUAL_SPELLS | M_FLIES | M_UNIQUE,
MR_RES_POISON,
0, 15, MONS_PHANTOM, MONS_PLAYER_GHOST, MH_UNDEAD, -5,
@@ -4087,7 +4087,7 @@
/* random demon in pan - only one per level. stats are stored in ghost struct */
{
- MONS_PANDEMONIUM_DEMON, '&', BLACK, "&",
+ MONS_PANDEMONIUM_DEMON, '&', BLACK, "pandemonium lord",
M_FIGHTER | M_SPELLCASTER | M_SPEAKS | M_EVIL,
MR_RES_POISON,
0, 14, MONS_PANDEMONIUM_DEMON, MONS_PANDEMONIUM_DEMON, MH_DEMONIC, -5,
@@ -4296,7 +4296,7 @@
// small simulacrum
{
- MONS_SIMULACRUM_SMALL, 'z', WHITE, "",
+ MONS_SIMULACRUM_SMALL, 'z', WHITE, "small simulacrum",
M_EVIL,
MR_RES_POISON | MR_VUL_FIRE | MR_RES_COLD,
0, 6, MONS_SIMULACRUM_SMALL, MONS_SIMULACRUM_SMALL, MH_UNDEAD, -1,
@@ -4309,7 +4309,7 @@
// large simulacrum
{
- MONS_SIMULACRUM_LARGE, 'Z', WHITE, "",
+ MONS_SIMULACRUM_LARGE, 'Z', WHITE, "large simulacrum",
M_EVIL,
MR_RES_POISON | MR_VUL_FIRE | MR_RES_COLD,
0, 6, MONS_SIMULACRUM_SMALL, MONS_SIMULACRUM_LARGE, MH_UNDEAD, -1,
diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc
index b88e6ff9af..aee81286ff 100644
--- a/crawl-ref/source/mon-util.cc
+++ b/crawl-ref/source/mon-util.cc
@@ -56,6 +56,8 @@ struct mon_spellbook
spell_type spells[NUM_MONSTER_SPELL_SLOTS];
};
+mon_display monster_symbols[NUM_MONSTERS];
+
// really important extern -- screen redraws suck w/o it {dlb}
FixedVector < unsigned short, 1000 > mcolour;
@@ -84,10 +86,9 @@ static mon_spellbook mspell_list[] = {
};
static int mons_exp_mod(int mclass);
-static monsterentry *seekmonster(int p_monsterid);
// macro that saves some typing, nothing more
-#define smc seekmonster(mc)
+#define smc get_monster_data(mc)
/* ******************** BEGIN PUBLIC FUNCTIONS ******************** */
@@ -206,12 +207,39 @@ void init_monsters(FixedVector < unsigned short, 1000 > &colour)
// finally, monsters yet with dummy entries point to TTTSNB(tm) {dlb}:
for (x = 0; x < NUM_MONSTERS; x++)
- {
if (mon_entry[x] == -1)
mon_entry[x] = mon_entry[MONS_PROGRAM_BUG];
- }
+
+ init_monster_symbols();
} // end mons_init()
+void init_monster_symbols()
+{
+ for (int i = 0; i < NUM_MONSTERS; ++i)
+ {
+ mon_display &md = monster_symbols[i];
+ const monsterentry *me = get_monster_data(i);
+ if (me)
+ {
+ md.glyph = me->showchar;
+ md.colour = me->colour;
+ }
+ }
+
+ for (int i = 0, size = Options.mon_glyph_overrides.size();
+ i < size; ++i)
+ {
+ const mon_display &md = Options.mon_glyph_overrides[i];
+ if (md.type == MONS_PROGRAM_BUG)
+ continue;
+
+ if (md.glyph)
+ monster_symbols[md.type].glyph = md.glyph;
+ if (md.colour)
+ monster_symbols[md.type].colour = md.colour;
+ }
+}
+
unsigned long get_mons_class_resists(int mc)
{
return (smc->resists);
@@ -422,7 +450,7 @@ corpse_effect_type mons_corpse_effect(int mc)
monster_type mons_species( int mc )
{
- const monsterentry *me = seekmonster(mc);
+ const monsterentry *me = get_monster_data(mc);
return (me? me->species : MONS_PROGRAM_BUG);
} // end mons_species()
@@ -486,7 +514,7 @@ bool mons_see_invis(const monsters *mon)
{
if (mon->type == MONS_PLAYER_GHOST || mon->type == MONS_PANDEMONIUM_DEMON)
return (mon->ghost->values[ GVAL_SEE_INVIS ]);
- else if (((seekmonster(mon->type))->bitfields & M_SEE_INVIS) != 0)
+ else if (((get_monster_data(mon->type))->bitfields & M_SEE_INVIS) != 0)
return (true);
else if (scan_mon_inv_randarts( mon, RAP_EYESIGHT ) > 0)
return (true);
@@ -526,26 +554,21 @@ bool mons_player_visible( struct monsters *mon )
return (true);
}
-unsigned char mons_char(int mc)
+unsigned mons_char(int mc)
{
- return static_cast<unsigned char>(smc->showchar);
-} // end mons_char()
+ return monster_symbols[mc].glyph;
+}
+
+int mons_class_colour(int mc)
+{
+ return monster_symbols[mc].colour;
+}
mon_itemuse_type mons_itemuse(int mc)
{
return (smc->gmon_use);
} // end mons_itemuse()
-int mons_class_colour(int mc)
-{
- const monsterentry *m = smc;
- if (!m)
- return (BLACK);
-
- const int class_colour = m->colour;
- return (class_colour);
-} // end mons_colour()
-
int mons_colour(const monsters *monster)
{
return (monster->colour);
@@ -658,7 +681,7 @@ int mons_damage(int mc, int rt)
bool mons_immune_magic(const monsters *mon)
{
- return seekmonster(mon->type)->resist_magic == MAG_IMMUNE;
+ return get_monster_data(mon->type)->resist_magic == MAG_IMMUNE;
}
int mons_resist_magic( const monsters *mon )
@@ -666,7 +689,7 @@ int mons_resist_magic( const monsters *mon )
if ( mons_immune_magic(mon) )
return MAG_IMMUNE;
- int u = (seekmonster(mon->type))->resist_magic;
+ int u = (get_monster_data(mon->type))->resist_magic;
// negative values get multiplied with mhd
if (u < 0)
@@ -1015,7 +1038,7 @@ int hit_points(int hit_dice, int min_hp, int rand_hp)
// of monster, not a pacticular monsters current hit dice. -- bwr
int mons_type_hit_dice( int type )
{
- struct monsterentry *mon_class = seekmonster( type );
+ struct monsterentry *mon_class = get_monster_data( type );
if (mon_class)
return (mon_class->hpdice[0]);
@@ -1190,7 +1213,7 @@ void define_monster(int index)
int mcls = mons.type;
int hd, hp, hp_max, ac, ev, speed;
int monnumber = mons.number;
- const monsterentry *m = seekmonster(mcls);
+ const monsterentry *m = get_monster_data(mcls);
int col = mons_class_colour(mons.type);
mon_spellbook_type spells = MST_NO_SPELLS;
@@ -1363,6 +1386,7 @@ void define_monster(int index)
mons.number = monnumber;
mons.flags = 0L;
mons.colour = col;
+
mons_load_spells( &mons, spells );
// reset monster enchantments
@@ -1468,7 +1492,7 @@ static std::string str_monam(const monsters& mon, description_level_type desc,
}
// Add the base name.
- result += seekmonster(nametype)->name;
+ result += get_monster_data(nametype)->name;
// Add suffixes.
switch (mon.type)
@@ -1509,7 +1533,7 @@ std::string mons_type_name(int type, description_level_type desc )
}
}
- result += seekmonster(type)->name;
+ result += get_monster_data(type)->name;
// Vowel fix: Change 'a orc' to 'an orc'
if ( result.length() >= 3 &&
@@ -1525,7 +1549,7 @@ std::string mons_type_name(int type, description_level_type desc )
/* ********************* END PUBLIC FUNCTIONS ********************* */
// see mons_init for initialization of mon_entry array.
-static monsterentry *seekmonster(int p_monsterid)
+monsterentry *get_monster_data(int p_monsterid)
{
const int me = p_monsterid != -1? mon_entry[p_monsterid] : -1;
@@ -1533,7 +1557,7 @@ static monsterentry *seekmonster(int p_monsterid)
return (&mondata[me]);
else
return (NULL);
-} // end seekmonster()
+} // end get_monster_data()
static int mons_exp_mod(int mc)
{
@@ -2077,7 +2101,7 @@ static bool mons_can_smite(const monsters *monster)
*/
bool monster_shover(const monsters *m)
{
- const monsterentry *me = seekmonster(m->type);
+ const monsterentry *me = get_monster_data(m->type);
if (!me)
return (false);
@@ -2107,8 +2131,8 @@ bool monster_shover(const monsters *m)
// below.
bool monster_senior(const monsters *m1, const monsters *m2)
{
- const monsterentry *me1 = seekmonster(m1->type),
- *me2 = seekmonster(m2->type);
+ const monsterentry *me1 = get_monster_data(m1->type),
+ *me2 = get_monster_data(m2->type);
if (!me1 || !me2)
return (false);
@@ -2241,7 +2265,7 @@ bool monsters::can_drown() const
size_type monsters::body_size(int /* psize */, bool /* base */) const
{
- const monsterentry *e = seekmonster(type);
+ const monsterentry *e = get_monster_data(type);
return (e? e->size : SIZE_MEDIUM);
}
@@ -4022,7 +4046,7 @@ bool monsters::sicken(int amount)
int monsters::base_speed(int mcls)
{
- const monsterentry *m = seekmonster(mcls);
+ const monsterentry *m = get_monster_data(mcls);
if (!m)
return (10);
diff --git a/crawl-ref/source/mon-util.h b/crawl-ref/source/mon-util.h
index ecf33d7683..a5802ba51a 100644
--- a/crawl-ref/source/mon-util.h
+++ b/crawl-ref/source/mon-util.h
@@ -69,15 +69,14 @@ struct monsterentry
size_type size;
};
-
-// wow. this struct is only about 48 bytes, (excluding the name)
-
+monsterentry *get_monster_data(int p_monsterid);
// last updated 10jun2000 {dlb}
/* ***********************************************************************
* called from: acr
* *********************************************************************** */
void init_monsters( FixedVector<unsigned short, 1000>& colour );
+void init_monster_symbols();
// this is the old moname()
std::string mons_type_name(int type, description_level_type desc );
@@ -263,7 +262,7 @@ int mons_power(int mclass);
/* ***********************************************************************
* called from: spells2 - view
* *********************************************************************** */
-unsigned char mons_char(int mc);
+unsigned mons_char(int mc);
// last updated 10jun2000 {dlb}