From e8062078edfe77f4d6f38a7732bb5d08d8c8a048 Mon Sep 17 00:00:00 2001 From: dshaligram Date: Thu, 28 Jun 2007 14:47:11 +0000 Subject: Colour unvisited stone stairs white (can be customised with the feature option). Fixed level compiler not croaking for bad monster names. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1678 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/dat/entry.des | 2 +- crawl-ref/source/externs.h | 2 ++ crawl-ref/source/initfile.cc | 8 +++-- crawl-ref/source/mapdef.cc | 3 +- crawl-ref/source/newgame.cc | 3 +- crawl-ref/source/travel.cc | 15 +++++++++ crawl-ref/source/travel.h | 2 ++ crawl-ref/source/view.cc | 75 +++++++++++++++++++++++++++++++++--------- 8 files changed, 88 insertions(+), 22 deletions(-) (limited to 'crawl-ref/source') diff --git a/crawl-ref/source/dat/entry.des b/crawl-ref/source/dat/entry.des index e58e952d02..f31d5db9fa 100644 --- a/crawl-ref/source/dat/entry.des +++ b/crawl-ref/source/dat/entry.des @@ -4483,7 +4483,7 @@ ORIENT: float SHUFFLE: ({[<, 1234567 MONS: giant gecko/giant iguana/giant lizard/giant newt/gila monster/komodo dragon MONS: hog/jackal/wolf/hound/war dog -MONS: giant cockroach/giant ant/butterfly/killer bee/bumbleebee/redback/giant mite +MONS: giant cockroach/giant ant/butterfly/killer bee/bumblebee/redback/giant mite MONS: swamp worm/lindwurm/worm/spiny worm MONS: swamp drake/hydra/wyvern/firedrake MONS: bear/polar bear/grizzly bear/black bear diff --git a/crawl-ref/source/externs.h b/crawl-ref/source/externs.h index 7fb356ff5c..05a1ae4209 100644 --- a/crawl-ref/source/externs.h +++ b/crawl-ref/source/externs.h @@ -1407,6 +1407,8 @@ struct feature_def unsigned short colour; // normal in LoS colour unsigned short map_colour; // colour when out of LoS on display unsigned short seen_colour; // map_colour when is_terrain_seen() + unsigned short em_colour; // Emphasised colour when in LoS. + unsigned short seen_em_colour; // Emphasised colour when out of LoS bool notable; // gets noted when seen bool seen_effect; // requires special handling when seen }; diff --git a/crawl-ref/source/initfile.cc b/crawl-ref/source/initfile.cc index 86e169d2a9..1c6d28bac8 100644 --- a/crawl-ref/source/initfile.cc +++ b/crawl-ref/source/initfile.cc @@ -848,11 +848,11 @@ void game_options::add_feature_override(const std::string &text) std::string props = text.substr(spos + 1, epos - spos - 1); std::vector iprops = split_string(",", props, true, true); - if (iprops.size() < 1 || iprops.size() > 5) + if (iprops.size() < 1 || iprops.size() > 7) return; - if (iprops.size() < 5) - iprops.resize(5); + if (iprops.size() < 7) + iprops.resize(7); trim_string(fname); std::vector feats = @@ -870,6 +870,8 @@ void game_options::add_feature_override(const std::string &text) fov.override.colour = str_to_colour(iprops[2], BLACK); fov.override.map_colour = str_to_colour(iprops[3], BLACK); fov.override.seen_colour = str_to_colour(iprops[4], BLACK); + fov.override.em_colour = str_to_colour(iprops[5], BLACK); + fov.override.seen_em_colour = str_to_colour(iprops[6], BLACK); feature_overrides.push_back(fov); } diff --git a/crawl-ref/source/mapdef.cc b/crawl-ref/source/mapdef.cc index 1fb07839b4..dc3e9bf384 100644 --- a/crawl-ref/source/mapdef.cc +++ b/crawl-ref/source/mapdef.cc @@ -1550,7 +1550,7 @@ mons_list::mons_spec_slot mons_list::parse_mons_spec(std::string spec) { const mons_spec nspec = mons_by_name(s); - if (mspec.mid == MONS_PROGRAM_BUG) + if (nspec.mid == MONS_PROGRAM_BUG) { error = make_stringf("unrecognised monster \"%s\"", s.c_str()); return (slot); @@ -1559,7 +1559,6 @@ mons_list::mons_spec_slot mons_list::parse_mons_spec(std::string spec) mspec.mid = nspec.mid; mspec.monnum = nspec.monnum; } - slot.mlist.push_back(mspec); } diff --git a/crawl-ref/source/newgame.cc b/crawl-ref/source/newgame.cc index 50ffe912aa..df76dd7d60 100644 --- a/crawl-ref/source/newgame.cc +++ b/crawl-ref/source/newgame.cc @@ -255,7 +255,8 @@ static void pick_random_species_and_class( void ) { // we only want draconians counted once in this loop... // we'll add the variety lower down -- bwr - if (sp >= SP_WHITE_DRACONIAN && sp <= SP_BASE_DRACONIAN) + if ((sp >= SP_WHITE_DRACONIAN && sp <= SP_BASE_DRACONIAN) + || sp == SP_ELF) continue; for (int cl = JOB_FIGHTER; cl < NUM_JOBS; cl++) diff --git a/crawl-ref/source/travel.cc b/crawl-ref/source/travel.cc index 297d953cfe..539fe436c8 100644 --- a/crawl-ref/source/travel.cc +++ b/crawl-ref/source/travel.cc @@ -2853,6 +2853,15 @@ stair_info *LevelInfo::get_stair(int x, int y) return get_stair(c); } +bool LevelInfo::know_stair(const coord_def &c) const +{ + const int index = get_stair_index(c); + if (index == -1) + return (false); + const level_pos &lp = stairs[index].destination; + return (lp.is_valid()); +} + stair_info *LevelInfo::get_stair(const coord_def &pos) { int index = get_stair_index(pos); @@ -3067,6 +3076,12 @@ void LevelInfo::fixup() } } +bool TravelCache::know_stair(const coord_def &c) const +{ + travel_levels_map::const_iterator i = levels.find(level_id::current()); + return (i == levels.end()? false : i->second.know_stair(c)); +} + void TravelCache::travel_to_waypoint(int num) { if (num < 0 || num >= TRAVEL_WAYPOINT_COUNT) return; diff --git a/crawl-ref/source/travel.h b/crawl-ref/source/travel.h index 37a54b9d67..6028282961 100644 --- a/crawl-ref/source/travel.h +++ b/crawl-ref/source/travel.h @@ -356,6 +356,7 @@ struct LevelInfo stair_info *get_stair(int x, int y); stair_info *get_stair(const coord_def &pos); + bool know_stair(const coord_def &pos) const; int get_stair_index(const coord_def &pos) const; void reset_distances(); @@ -431,6 +432,7 @@ public: return (i != levels.end()? &i->second : NULL); } + bool know_stair(const coord_def &c) const; bool know_level(const level_id &lev) const { return levels.find(lev) != levels.end(); diff --git a/crawl-ref/source/view.cc b/crawl-ref/source/view.cc index 3aa253c3d4..a0096622fb 100644 --- a/crawl-ref/source/view.cc +++ b/crawl-ref/source/view.cc @@ -303,6 +303,17 @@ static unsigned get_symbol(int object, unsigned short *colour, return (ch); } +static int view_emphasised_colour(int x, int y, dungeon_feature_type feat, + int oldcolour, int newcolour) +{ + if (is_travelable_stair(feat) && !travel_cache.know_stair(coord_def(x, y))) + { + if (you.your_level || stair_direction(feat) == CMD_GO_DOWNSTAIRS) + return (newcolour); + } + return (oldcolour); +} + static void get_symbol( int x, int y, int object, unsigned *ch, unsigned short *colour, @@ -312,20 +323,28 @@ static void get_symbol( int x, int y, if (object < NUM_FEATURES) { - *ch = magic_mapped? Feature[object].magic_symbol - : Feature[object].symbol; + const feature_def &fdef = Feature[object]; + + *ch = magic_mapped? fdef.magic_symbol + : fdef.symbol; if (colour) { const int colmask = *colour & COLFLAG_MASK; // Don't clobber with BLACK, because the colour should be // already set. - if (Feature[object].colour != BLACK) - *colour = Feature[object].colour | colmask; + if (fdef.colour != BLACK) + *colour = fdef.colour | colmask; + + if (fdef.em_colour != fdef.colour && fdef.em_colour) + *colour = + view_emphasised_colour( + x, y, static_cast(object), + *colour, fdef.em_colour | colmask); } // Note anything we see that's notable - if ((x || y) && Feature[object].notable) + if ((x || y) && fdef.notable) seen_notable_thing( static_cast(object), x, y ); } @@ -493,9 +512,17 @@ screen_buffer_t colour_code_map( int x, int y, bool item_colour, return get_envmap_col(x, y); int feature_colour = DARKGREY; - feature_colour = - is_terrain_seen(x, y)? Feature[grid_value].seen_colour - : Feature[grid_value].map_colour; + const bool terrain_seen = is_terrain_seen(x, y); + const feature_def &fdef = Feature[grid_value]; + feature_colour = terrain_seen? fdef.seen_colour : fdef.map_colour; + + if (terrain_seen && feature_colour != fdef.seen_em_colour + && fdef.seen_em_colour) + { + feature_colour = + view_emphasised_colour(x, y, grid_value, feature_colour, + fdef.seen_em_colour); + } if (feature_colour != DARKGREY) tc = feature_colour; @@ -3150,6 +3177,10 @@ void apply_feature_overrides() feat.map_colour = ofeat.map_colour; if (ofeat.seen_colour) feat.seen_colour = ofeat.seen_colour; + if (ofeat.seen_em_colour) + feat.seen_em_colour = ofeat.seen_em_colour; + if (ofeat.em_colour) + feat.em_colour = ofeat.em_colour; } } @@ -3164,6 +3195,8 @@ void init_feature_table( void ) Feature[i].magic_symbol = 0; // made equal to symbol if untouched Feature[i].map_colour = DARKGREY; Feature[i].seen_colour = BLACK; // marks no special seen map handling + Feature[i].seen_em_colour = BLACK; + Feature[i].em_colour = BLACK; switch (i) { @@ -3327,9 +3360,11 @@ void init_feature_table( void ) case DNGN_STONE_STAIRS_DOWN_I: case DNGN_STONE_STAIRS_DOWN_II: case DNGN_STONE_STAIRS_DOWN_III: - Feature[i].symbol = Options.char_table[ DCHAR_STAIRS_DOWN ]; - Feature[i].colour = LIGHTGREY; - Feature[i].map_colour = RED; + Feature[i].symbol = Options.char_table[ DCHAR_STAIRS_DOWN ]; + Feature[i].colour = LIGHTGREY; + Feature[i].em_colour = WHITE; + Feature[i].map_colour = RED; + Feature[i].seen_em_colour = WHITE; break; case DNGN_ROCK_STAIRS_UP: @@ -3344,6 +3379,8 @@ void init_feature_table( void ) Feature[i].symbol = Options.char_table[ DCHAR_STAIRS_UP ]; Feature[i].colour = LIGHTGREY; Feature[i].map_colour = GREEN; + Feature[i].em_colour = WHITE; + Feature[i].seen_em_colour = WHITE; break; case DNGN_ENTER_DIS: @@ -3688,11 +3725,19 @@ void init_feature_table( void ) for (int i = 0; i < NUM_FEATURES; ++i) { - if (!Feature[i].magic_symbol) - Feature[i].magic_symbol = Feature[i].symbol; + feature_def &f(Feature[i]); + + if (!f.magic_symbol) + f.magic_symbol = f.symbol; + + if (f.seen_colour == BLACK) + f.seen_colour = f.map_colour; + + if (f.seen_em_colour == BLACK) + f.seen_em_colour = f.seen_colour; - if (Feature[i].seen_colour == BLACK) - Feature[i].seen_colour = Feature[i].map_colour; + if (f.em_colour == BLACK) + f.em_colour = f.colour; } } -- cgit v1.2.3-54-g00ecf