diff options
author | j-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-06-02 12:31:12 +0000 |
---|---|---|
committer | j-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-06-02 12:31:12 +0000 |
commit | b50eafe8de72cbcc4431813934695c22642cdd46 (patch) | |
tree | 393c748e0cffac935a3ca89114e3444a2795ca7f | |
parent | c78ed8ca5a6f1528db2bfe1f846e24bef6695a89 (diff) | |
download | crawl-ref-b50eafe8de72cbcc4431813934695c22642cdd46.tar.gz crawl-ref-b50eafe8de72cbcc4431813934695c22642cdd46.zip |
I'm not sure I actually coded anything worthwhile, though I experimented
a fair bit and as usually ended up doing lots of clean-up.
Oh wait, I modified eat_from_floor prompts to only force a more if there
was actually a message before trying the inventory (whoops), and also
modified the corpses in pack hint to take into account that a saccing
player won't be interested in butchering rotten corpses.
Also implemented a modified FR 1981119: when Detect Creatures only
detects plants already seen before, print a different message
("You detect no further creatures.").
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5435 c06c8d41-db1a-0410-9941-cceddc491573
-rw-r--r-- | crawl-ref/source/abl-show.cc | 16 | ||||
-rw-r--r-- | crawl-ref/source/acr.cc | 13 | ||||
-rw-r--r-- | crawl-ref/source/debug.cc | 1 | ||||
-rw-r--r-- | crawl-ref/source/dungeon.cc | 4 | ||||
-rw-r--r-- | crawl-ref/source/files.cc | 222 | ||||
-rw-r--r-- | crawl-ref/source/food.cc | 27 | ||||
-rw-r--r-- | crawl-ref/source/libgui.cc | 47 | ||||
-rw-r--r-- | crawl-ref/source/misc.cc | 8 | ||||
-rw-r--r-- | crawl-ref/source/monstuff.cc | 18 | ||||
-rw-r--r-- | crawl-ref/source/notes.cc | 18 | ||||
-rw-r--r-- | crawl-ref/source/spells2.cc | 8 | ||||
-rw-r--r-- | crawl-ref/source/spl-cast.cc | 14 | ||||
-rw-r--r-- | crawl-ref/source/tile2.cc | 88 | ||||
-rw-r--r-- | crawl-ref/source/travel.cc | 5 | ||||
-rw-r--r-- | crawl-ref/source/view.cc | 63 | ||||
-rw-r--r-- | crawl-ref/source/view.h | 2 |
16 files changed, 303 insertions, 251 deletions
diff --git a/crawl-ref/source/abl-show.cc b/crawl-ref/source/abl-show.cc index 8a94c634d5..5e6e547816 100644 --- a/crawl-ref/source/abl-show.cc +++ b/crawl-ref/source/abl-show.cc @@ -1082,7 +1082,7 @@ static bool _do_ability(const ability_def& abil) if (abil.ability == ABIL_MAPPING && player_mutation_level(MUT_MAPPING) < 3 && (you.level_type == LEVEL_PANDEMONIUM - || you.level_type == LEVEL_LABYRINTH)) + || !player_in_mappable_area())) { mpr("You feel momentarily disoriented."); return (false); @@ -2168,7 +2168,7 @@ std::vector<talent> your_talents( bool check_confused ) || scan_randarts( RAP_LEVITATE )) { // Has no effect on permanently flying Kenku. - if (!you.permanent_levitation() && you.flight_mode() != FL_FLY) + if (!you.permanent_flight() && you.flight_mode() != FL_FLY) { // Now you can only turn levitation off if you have an // activatable item. Potions and miscast effects will @@ -2186,20 +2186,20 @@ std::vector<talent> your_talents( bool check_confused ) _add_talent(talents, ABIL_EVOKE_TELEPORTATION, check_confused ); } - // find hotkeys for the non-hotkeyed talents + // Find hotkeys for the non-hotkeyed talents. for (unsigned int i = 0; i < talents.size(); ++i) { - // skip preassigned hotkeys + // Skip preassigned hotkeys. if ( talents[i].hotkey != 0 ) continue; - // try to find a free hotkey for i, starting from Z + // Try to find a free hotkey for i, starting from Z. for ( int k = 51; k >= 0; ++k ) { const int kkey = index_to_letter(k); bool good_key = true; - // check that it doesn't conflict with other hotkeys + // Check that it doesn't conflict with other hotkeys. for ( unsigned int j = 0; j < talents.size(); ++j ) { if ( talents[j].hotkey == kkey ) @@ -2209,7 +2209,7 @@ std::vector<talent> your_talents( bool check_confused ) } } - if ( good_key ) + if (good_key) { talents[i].hotkey = k; you.ability_letter_table[k] = talents[i].which; @@ -2217,7 +2217,7 @@ std::vector<talent> your_talents( bool check_confused ) } } // In theory, we could be left with an unreachable ability - // here (if you have 53 or more abilities simultaneously.) + // here (if you have 53 or more abilities simultaneously). } return talents; diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc index a873ddc5c9..327a50d4f9 100644 --- a/crawl-ref/source/acr.cc +++ b/crawl-ref/source/acr.cc @@ -1930,8 +1930,7 @@ void process_command( command_type cmd ) break; case CMD_CLEAR_MAP: - if (you.level_type != LEVEL_LABYRINTH - && you.level_type != LEVEL_ABYSS) + if (player_in_mappable_area()) { mpr("Clearing level map."); clear_map(); @@ -1939,11 +1938,11 @@ void process_command( command_type cmd ) } break; - case CMD_GO_UPSTAIRS: _go_upstairs(); break; - case CMD_GO_DOWNSTAIRS: _go_downstairs(); break; case CMD_DISPLAY_OVERMAP: display_overmap(); break; - case CMD_OPEN_DOOR: _open_door(0, 0); break; - case CMD_CLOSE_DOOR: _close_door(0, 0); break; + case CMD_GO_UPSTAIRS: _go_upstairs(); break; + case CMD_GO_DOWNSTAIRS: _go_downstairs(); break; + case CMD_OPEN_DOOR: _open_door(0, 0); break; + case CMD_CLOSE_DOOR: _close_door(0, 0); break; case CMD_DROP: drop(); @@ -2200,6 +2199,8 @@ void process_command( command_type cmd ) { coord_def pos; #ifdef USE_TILE + // Since they're no actual overview map, but the functionality + // exists, give a message to explain what's going on. std::string str = "Move the cursor to view the level map, or " "type <w>?</w> for a list of commands."; print_formatted_paragraph(str, get_number_of_cols()); diff --git a/crawl-ref/source/debug.cc b/crawl-ref/source/debug.cc index 48c3c0a3ce..5dd91441a7 100644 --- a/crawl-ref/source/debug.cc +++ b/crawl-ref/source/debug.cc @@ -578,7 +578,6 @@ static dungeon_feature_type _find_appropriate_stairs(bool down) case LEVEL_LABYRINTH: if (down) { - // Can't go down in the Labyrinth mpr("Can't go down in the Labyrinth."); return DNGN_UNSEEN; } diff --git a/crawl-ref/source/dungeon.cc b/crawl-ref/source/dungeon.cc index 6863cbf44c..1a86391623 100644 --- a/crawl-ref/source/dungeon.cc +++ b/crawl-ref/source/dungeon.cc @@ -5235,7 +5235,7 @@ static dungeon_feature_type _pick_an_altar() || player_in_branch( BRANCH_ECUMENICAL_TEMPLE ) || you.level_type == LEVEL_LABYRINTH) { - // No extra altars in temple, none at all in slime pits or labyrinth. + // No extra altars in Temple, none at all in Slime Pits or Labyrinth. altar_type = DNGN_FLOOR; } else if (you.level_type == LEVEL_DUNGEON && !one_chance_in(5)) @@ -6397,7 +6397,7 @@ static bool _has_vault_in_radius(const coord_def &pos, int radius, // * At least 4 squares away from the nearest vault. // * Floor (well, obviously). static coord_def _labyrinth_find_entry_point(const dgn_region ®, - const coord_def &end) + const coord_def &end) { const int min_distance = 20 * 20; // Try many times. diff --git a/crawl-ref/source/files.cc b/crawl-ref/source/files.cc index 1dc98c7bbd..dcf852e7d3 100644 --- a/crawl-ref/source/files.cc +++ b/crawl-ref/source/files.cc @@ -107,42 +107,42 @@ #endif #endif -static void save_level(int level_saved, level_area_type lt, - branch_type where_were_you); +static void _save_level( int level_saved, level_area_type lt, + branch_type where_were_you); -static bool _get_and_validate_version(FILE *restoreFile, char& major, char& minor, - std::string* reason=0); +static bool _get_and_validate_version( FILE *restoreFile, char& major, + char& minor, std::string* reason=0); -static bool determine_ghost_version( FILE *ghostFile, - char &majorVersion, char &minorVersion ); +static bool _determine_ghost_version( FILE *ghostFile, + char &majorVersion, char &minorVersion ); -static void restore_ghost_version( FILE *ghostFile, char major, char minor ); +static void _restore_ghost_version( FILE *ghostFile, char major, char minor ); -static void restore_tagged_file( FILE *restoreFile, int fileType, - char minorVersion ); +static void _restore_tagged_file( FILE *restoreFile, int fileType, + char minorVersion ); -static void load_ghost(); +static void _load_ghost(); const short GHOST_SIGNATURE = short( 0xDC55 ); -static void redraw_all(void) +static void _redraw_all(void) { - you.redraw_hit_points = 1; - you.redraw_magic_points = 1; - you.redraw_strength = 1; - you.redraw_intelligence = 1; - you.redraw_dexterity = 1; - you.redraw_armour_class = 1; - you.redraw_evasion = 1; - you.redraw_experience = 1; - you.redraw_gold = 1; + you.redraw_hit_points = true; + you.redraw_magic_points = true; + you.redraw_strength = true; + you.redraw_intelligence = true; + you.redraw_dexterity = true; + you.redraw_armour_class = true; + you.redraw_evasion = true; + you.redraw_experience = true; + you.redraw_gold = true; you.redraw_status_flags = REDRAW_LINE_1_MASK | REDRAW_LINE_2_MASK | REDRAW_LINE_3_MASK; } -static std::string uid_as_string() +static std::string _uid_as_string() { #ifdef MULTIUSER char struid[20]; @@ -153,7 +153,7 @@ static std::string uid_as_string() #endif } -static bool is_uid_file(const std::string &name, const std::string &ext) +static bool _is_uid_file(const std::string &name, const std::string &ext) { std::string save_suffix = get_savedir_filename("", "", ""); save_suffix += ext; @@ -172,17 +172,17 @@ static bool is_uid_file(const std::string &name, const std::string &ext) bool is_save_file_name(const std::string &name) { - return is_uid_file(name, ".sav"); + return _is_uid_file(name, ".sav"); } #ifdef LOAD_UNPACKAGE_CMD bool is_packed_save(const std::string &name) { - return is_uid_file(name, PACKAGE_SUFFIX); + return _is_uid_file(name, PACKAGE_SUFFIX); } #endif -// Return the save_info from the save. +// Returns the save_info from the save. player_save_info read_character_info(const std::string &savefile) { player_save_info fromfile; @@ -195,10 +195,10 @@ player_save_info read_character_info(const std::string &savefile) if (_get_and_validate_version(charf, majorVersion, minorVersion)) { - // backup before we clobber "you" + // Backup before we clobber "you". const player backup(you); - restore_tagged_file(charf, TAGTYPE_PLAYER_NAME, minorVersion); + _restore_tagged_file(charf, TAGTYPE_PLAYER_NAME, minorVersion); fromfile = you; you.copy_from(backup); @@ -386,7 +386,7 @@ bool dir_exists(const std::string &dir) #endif } -static int create_directory(const char *dir) +static int _create_directory(const char *dir) { #if defined(MULTIUSER) return mkdir(dir, SHARED_FILES_CHMOD_PUBLIC | 0111); @@ -399,7 +399,7 @@ static int create_directory(const char *dir) #endif } -static bool create_dirs(const std::string &dir) +static bool _create_dirs(const std::string &dir) { std::string sep = " "; sep[0] = FILE_SEPARATOR; @@ -419,7 +419,7 @@ static bool create_dirs(const std::string &dir) if (i == 0 && dir.size() && dir[0] == FILE_SEPARATOR) path = FILE_SEPARATOR + path; - if (!dir_exists(path) && create_directory(path.c_str())) + if (!dir_exists(path) && _create_directory(path.c_str())) return (false); path += FILE_SEPARATOR; @@ -558,7 +558,7 @@ bool check_dir(const std::string &whatdir, std::string &dir, bool silent) if (dir[dir.length() - 1] != FILE_SEPARATOR) dir += FILE_SEPARATOR; - if (!dir_exists(dir) && !create_dirs(dir)) + if (!dir_exists(dir) && !_create_dirs(dir)) { if (!silent) fprintf(stderr, "%s \"%s\" does not exist " @@ -664,7 +664,7 @@ std::string get_savedir_filename(const std::string &prefix, // MULTIUSER is set we'll have long filenames anyway. Caveat // emptor. if ( !suppress_uid ) - result += uid_as_string(); + result += _uid_as_string(); result += suffix; @@ -690,8 +690,8 @@ std::string get_prefs_filename() #endif } -static std::string get_level_suffix(int level, branch_type where, - level_area_type lt) +static std::string _get_level_suffix(int level, branch_type where, + level_area_type lt) { switch (lt) { @@ -714,7 +714,7 @@ std::string make_filename( const char *prefix, int level, branch_type where, level_area_type ltype, bool isGhost ) { return get_savedir_filename( prefix, "", - get_level_suffix(level, where, ltype), + _get_level_suffix(level, where, ltype), isGhost ); } @@ -786,7 +786,7 @@ bool travel_load_map( branch_type branch, int absdepth ) return true; } -static void sanity_test_monster_inventory() +static void _sanity_test_monster_inventory() { // Sanity forcing of monster inventory items (required?) for (int i = 0; i < MAX_MONSTERS; i++) @@ -806,17 +806,17 @@ static void sanity_test_monster_inventory() } } -static void place_player_on_stair(branch_type old_branch, - int stair_taken) +static void _place_player_on_stair(branch_type old_branch, + int stair_taken) { bool find_first = true; - // Order is important here: + // Order is important here. if (you.level_type == LEVEL_DUNGEON && old_branch == BRANCH_VESTIBULE_OF_HELL && stair_taken == DNGN_STONE_STAIRS_UP_I) { - // leaving hell - look for entry portal first + // Leaving hell - look for entry portal first. stair_taken = DNGN_ENTER_HELL; find_first = false; } @@ -832,39 +832,39 @@ static void place_player_on_stair(branch_type old_branch, } else if (stair_taken == DNGN_ENTER_HELL) { - // the vestibule and labyrith always start from this stair + // The vestibule and labyrinth always start from this stair. stair_taken = DNGN_STONE_STAIRS_UP_I; } else if (stair_taken >= DNGN_STONE_STAIRS_DOWN_I && stair_taken <= DNGN_ESCAPE_HATCH_DOWN) { - // look for coresponding up stair + // Look for corresponding up stair. stair_taken += (DNGN_STONE_STAIRS_UP_I - DNGN_STONE_STAIRS_DOWN_I); } else if (stair_taken >= DNGN_STONE_STAIRS_UP_I && stair_taken <= DNGN_ESCAPE_HATCH_UP) { - // look for coresponding down stair + // Look for coresponding down stair. stair_taken += (DNGN_STONE_STAIRS_DOWN_I - DNGN_STONE_STAIRS_UP_I); } else if (stair_taken >= DNGN_RETURN_FROM_FIRST_BRANCH && stair_taken < 150) // 20 slots reserved { - // find entry point to subdungeon when leaving + // Find entry point to subdungeon when leaving. stair_taken += (DNGN_ENTER_FIRST_BRANCH - DNGN_RETURN_FROM_FIRST_BRANCH); } else if (stair_taken >= DNGN_ENTER_FIRST_BRANCH && stair_taken < DNGN_RETURN_FROM_FIRST_BRANCH) { - // find exit staircase from subdungeon when entering + // Find exit staircase from subdungeon when entering. stair_taken += (DNGN_RETURN_FROM_FIRST_BRANCH - DNGN_ENTER_FIRST_BRANCH); } else if (stair_taken >= DNGN_ENTER_DIS && stair_taken <= DNGN_TRANSIT_PANDEMONIUM) { - // when entering a hell or pandemonium + // When entering a hell or pandemonium. stair_taken = DNGN_STONE_STAIRS_UP_I; } else if (stair_taken == DNGN_ENTER_PORTAL_VAULT) @@ -882,7 +882,7 @@ static void place_player_on_stair(branch_type old_branch, } else // Note: stair_taken can equal things like DNGN_FLOOR { - // just find a nice empty square + // Just find a nice empty square. stair_taken = DNGN_FLOOR; find_first = false; } @@ -893,7 +893,7 @@ static void place_player_on_stair(branch_type old_branch, you.moveto(where_to_go); } -static void close_level_gates() +static void _close_level_gates() { for ( int i = 0; i < GXM; ++i ) for ( int j = 0; j < GYM; ++j ) @@ -910,19 +910,19 @@ static void close_level_gates() } } -static void clear_env_map() +static void _clear_env_map() { env.map.init(map_cell()); } -static void clear_clouds() +static void _clear_clouds() { for (int clouty = 0; clouty < MAX_CLOUDS; ++clouty) delete_cloud( clouty ); env.cgrid.init(EMPTY_CLOUD); } -static bool grab_follower_at(const coord_def &pos) +static bool _grab_follower_at(const coord_def &pos) { if (pos == you.pos()) return (false); @@ -946,7 +946,7 @@ static bool grab_follower_at(const coord_def &pos) return (true); } -static void grab_followers() +static void _grab_followers() { const bool can_follow = level_type_allows_followers(you.level_type); for (int i = you.x_pos - 1; i < you.x_pos + 2; i++) @@ -987,7 +987,7 @@ static void grab_followers() if (!in_bounds(fp) || travel_point_distance[fp.x][fp.y]) continue; travel_point_distance[fp.x][fp.y] = 1; - if (grab_follower_at(fp)) + if (_grab_follower_at(fp)) places[!place_set].push_back(fp); } } @@ -1006,9 +1006,9 @@ static void grab_followers() } } -// Should be called after grab_followers(), so that items carried by +// Should be called after _grab_followers(), so that items carried by // followers won't be considered lost. -static void do_lost_items(level_area_type old_level_type) +static void _do_lost_items(level_area_type old_level_type) { if (old_level_type == LEVEL_DUNGEON) return; @@ -1069,7 +1069,7 @@ bool load( dungeon_feature_type stair_taken, load_mode_type load_mode, // We clear twice - on save and on load. // Once would be enough... if (make_changes) - clear_clouds(); + _clear_clouds(); // Lose all listeners. dungeon_events.clear(); @@ -1077,14 +1077,14 @@ bool load( dungeon_feature_type stair_taken, load_mode_type load_mode, // This block is to grab followers and save the old level to disk. if (load_mode == LOAD_ENTER_LEVEL && old_level != -1) { - grab_followers(); + _grab_followers(); if (old_level_type == LEVEL_DUNGEON) - save_level( old_level, LEVEL_DUNGEON, old_branch ); + _save_level( old_level, LEVEL_DUNGEON, old_branch ); } - if ( make_changes ) - do_lost_items(old_level_type); + if (make_changes) + _do_lost_items(old_level_type); // Try to open level savefile. FILE *levelFile = fopen(cha_fil.c_str(), "rb"); @@ -1100,7 +1100,7 @@ bool load( dungeon_feature_type stair_taken, load_mode_type load_mode, if ((you.your_level > 1 || you.level_type != LEVEL_DUNGEON) && one_chance_in(3)) { - load_ghost(); + _load_ghost(); } env.turns_on_level = 0; // sanctuary @@ -1122,9 +1122,9 @@ bool load( dungeon_feature_type stair_taken, load_mode_type load_mode, reason.c_str()); } - restore_tagged_file(levelFile, TAGTYPE_LEVEL, minorVersion); + _restore_tagged_file(levelFile, TAGTYPE_LEVEL, minorVersion); - // sanity check - EOF + // Sanity check - EOF if (!feof( levelFile )) { end(-1, false, "\nIncomplete read of \"%s\" - aborting.\n", @@ -1135,28 +1135,28 @@ bool load( dungeon_feature_type stair_taken, load_mode_type load_mode, // POST-LOAD tasks : link_items(); - redraw_all(); + _redraw_all(); } if (load_mode == LOAD_START_GAME) just_created_level = true; - // closes all the gates if you're on the way out + // Closes all the gates if you're on the way out. if (you.char_direction == GDT_ASCENDING && you.level_type != LEVEL_PANDEMONIUM) { - close_level_gates(); + _close_level_gates(); } if (just_created_level) - clear_env_map(); + _clear_env_map(); - // Here's the second cloud clearing, on load (see above) - if ( make_changes ) + // Here's the second cloud clearing, on load (see above). + if (make_changes) { - clear_clouds(); + _clear_clouds(); if (you.level_type != LEVEL_ABYSS) - place_player_on_stair(old_branch, stair_taken); + _place_player_on_stair(old_branch, stair_taken); else you.moveto(45, 35); } @@ -1166,7 +1166,7 @@ bool load( dungeon_feature_type stair_taken, load_mode_type load_mode, if (make_changes && mgrd[you.x_pos][you.y_pos] != NON_MONSTER) monster_teleport(&menv[mgrd[you.x_pos][you.y_pos]], true, true); - // actually "move" the followers if applicable + // Actually "move" the followers if applicable. if (level_type_allows_followers(you.level_type) && load_mode == LOAD_ENTER_LEVEL) { @@ -1180,9 +1180,9 @@ bool load( dungeon_feature_type stair_taken, load_mode_type load_mode, place_transiting_items(); } - redraw_all(); + _redraw_all(); - sanity_test_monster_inventory(); + _sanity_test_monster_inventory(); if (load_mode != LOAD_VISITOR) dungeon_events.fire_event(DET_ENTERING_LEVEL); @@ -1228,8 +1228,8 @@ bool load( dungeon_feature_type stair_taken, load_mode_type load_mode, } // Save the created/updated level out to disk: - if ( make_changes ) - save_level( you.your_level, you.level_type, you.where_are_you ); + if (make_changes) + _save_level( you.your_level, you.level_type, you.where_are_you ); setup_environment_effects(); @@ -1278,8 +1278,8 @@ bool load( dungeon_feature_type stair_taken, load_mode_type load_mode, return just_created_level; } // end load() -void save_level(int level_saved, level_area_type old_ltype, - branch_type where_were_you) +void _save_level(int level_saved, level_area_type old_ltype, + branch_type where_were_you) { std::string cha_fil = make_filename( you.your_name, level_saved, where_were_you, old_ltype, @@ -1296,7 +1296,7 @@ void save_level(int level_saved, level_area_type old_ltype, cha_fil.c_str()); } - // nail all items to the ground + // Nail all items to the ground. fix_item_coordinates(); _write_tagged_file( saveFile, TAGTYPE_LEVEL ); @@ -1304,7 +1304,7 @@ void save_level(int level_saved, level_area_type old_ltype, fclose(saveFile); DO_CHMOD_PRIVATE(cha_fil.c_str()); -} // end save_level() +} void save_game(bool leave_game, const char *farewellmsg) @@ -1385,13 +1385,13 @@ void save_game(bool leave_game, const char *farewellmsg) fclose(charf); DO_CHMOD_PRIVATE(charFile.c_str()); - // if just save, early out + // If just save, early out. if (!leave_game) return; - // must be exiting -- save level & goodbye! + // Must be exiting -- save level & goodbye! if (!you.entering_level) - save_level(you.your_level, you.level_type, you.where_are_you); + _save_level(you.your_level, you.level_type, you.where_are_you); clrscr(); @@ -1425,7 +1425,7 @@ void save_game_state() save_game(true); } -void load_ghost(void) +void _load_ghost(void) { char majorVersion; char minorVersion; @@ -1440,7 +1440,7 @@ void load_ghost(void) if (gfile == NULL) return; // no such ghost. - if (!determine_ghost_version(gfile, majorVersion, minorVersion)) + if (!_determine_ghost_version(gfile, majorVersion, minorVersion)) { fclose(gfile); #if DEBUG_DIAGNOSTICS @@ -1460,7 +1460,7 @@ void load_ghost(void) } ghosts.clear(); - restore_ghost_version(gfile, majorVersion, minorVersion); + _restore_ghost_version(gfile, majorVersion, minorVersion); // sanity check - EOF if (!feof(gfile)) @@ -1509,9 +1509,9 @@ void restore_game(void) if (!_get_and_validate_version(charf, majorVersion, minorVersion, &reason)) end(-1, false, "\nSave file is invalid. %s\n", reason.c_str()); - restore_tagged_file(charf, TAGTYPE_PLAYER, minorVersion); + _restore_tagged_file(charf, TAGTYPE_PLAYER, minorVersion); - // sanity check - EOF + // Sanity check - EOF if (!feof(charf)) end(-1, false, "\nIncomplete read of \"%s\" - aborting.\n", charFile.c_str()); @@ -1607,7 +1607,7 @@ bool apply_to_level(const level_id &level, bool preserve_current, if (level != original) { if (preserve_current) - save_level(you.your_level, you.level_type, you.where_are_you); + _save_level(you.your_level, you.level_type, you.where_are_you); you.where_are_you = level.branch; you.your_level = level.absdepth(); @@ -1625,7 +1625,7 @@ bool apply_to_level(const level_id &level, bool preserve_current, if (level != original) { // And save it back. - save_level(you.your_level, you.level_type, you.where_are_you); + _save_level(you.your_level, you.level_type, you.where_are_you); if (preserve_current) _restore_level(original); @@ -1640,7 +1640,7 @@ bool apply_to_all_dungeons(bool (*applicator)()) // Apply to current level, then save it out. bool success = applicator(); - save_level(original.absdepth(), original.level_type, original.branch); + _save_level(original.absdepth(), original.level_type, original.branch); for ( int i = 0; i < MAX_LEVELS; ++i ) for ( int j = 0; j < NUM_BRANCHES; ++j ) @@ -1670,13 +1670,14 @@ static bool _get_and_validate_version(FILE *restoreFile, char &major, char &mino std::string dummy; if (reason == 0) reason = &dummy; - // read first two bytes. + // Read first two bytes. char buf[2]; if (read2(restoreFile, buf, 2) != 2) { + // Empty file? major = minor = -1; *reason = "File is corrupt."; - return false; // empty file? + return (false); } major = buf[0]; @@ -1686,21 +1687,21 @@ static bool _get_and_validate_version(FILE *restoreFile, char &major, char &mino { *reason = make_stringf("Major version mismatch: %d (want %d).", major, TAG_MAJOR_VERSION); - return false; + return (false); } if (minor > TAG_MINOR_VERSION) { *reason = make_stringf("Minor version mismatch: %d (want <= %d).", minor, TAG_MINOR_VERSION); - return false; + return (false); } - return true; + return (true); } -static void restore_tagged_file( FILE *restoreFile, int fileType, - char minorVersion ) +static void _restore_tagged_file( FILE *restoreFile, int fileType, + char minorVersion ) { char tags[NUM_TAGS]; tag_set_expected(tags, fileType); @@ -1716,26 +1717,26 @@ static void restore_tagged_file( FILE *restoreFile, int fileType, break; } - // go through and init missing tags + // Go through and init missing tags. for (int i = 0; i < NUM_TAGS; i++) if (tags[i] == 1) // expected but never read tag_missing(i, minorVersion); } -static bool determine_ghost_version( FILE *ghostFile, - char &majorVersion, char &minorVersion ) +static bool _determine_ghost_version( FILE *ghostFile, + char &majorVersion, char &minorVersion ) { - // read first two bytes. + // Read first two bytes. char buf[2]; if (read2(ghostFile, buf, 2) != 2) return false; // empty file? - // otherwise, read version and validate. + // Otherwise, read version and validate. majorVersion = buf[0]; minorVersion = buf[1]; reader inf(ghostFile); - // check for the DCSS ghost signature. + // Check for the DCSS ghost signature. if (unmarshallShort(inf) != GHOST_SIGNATURE) return (false); @@ -1747,16 +1748,17 @@ static bool determine_ghost_version( FILE *ghostFile, return !feof(ghostFile); } - return false; // if its not TAG_MAJOR_VERSION, no idea! + // If its not TAG_MAJOR_VERSION, no idea! + return (false); } -static void restore_ghost_version( FILE *ghostFile, - char majorVersion, char minorVersion ) +static void _restore_ghost_version( FILE *ghostFile, + char majorVersion, char minorVersion ) { switch(majorVersion) { case TAG_MAJOR_VERSION: - restore_tagged_file(ghostFile, TAGTYPE_GHOST, minorVersion); + _restore_tagged_file(ghostFile, TAGTYPE_GHOST, minorVersion); break; default: break; @@ -1775,7 +1777,7 @@ void save_ghost( bool force ) FILE *gfile = fopen(cha_fil.c_str(), "rb"); - // don't overwrite existing bones! + // Don't overwrite existing bones! if (gfile != NULL) { fclose(gfile); @@ -1802,7 +1804,7 @@ void save_ghost( bool force ) #endif DO_CHMOD_PRIVATE(cha_fil.c_str()); -} // end save_ghost() +} //////////////////////////////////////////////////////////////////////////// // Locking for multiuser systems diff --git a/crawl-ref/source/food.cc b/crawl-ref/source/food.cc index bea45db105..c23724aa73 100644 --- a/crawl-ref/source/food.cc +++ b/crawl-ref/source/food.cc @@ -331,10 +331,11 @@ static void _terminate_butchery(bool wpn_switch, bool removed_gloves, static bool _have_corpses_in_pack(bool remind) { - const bool can_bottle = (you.species == SP_VAMPIRE - && you.experience_level > 5 - && (!you.duration[DUR_PRAYER] - || !god_likes_butchery(you.religion))); + const bool sacrifice = (you.duration[DUR_PRAYER] + && god_likes_butchery(you.religion)); + + const bool can_bottle = (!sacrifice && you.species == SP_VAMPIRE + && you.experience_level > 5); int num = 0; int num_bottle = 0; @@ -351,8 +352,12 @@ static bool _have_corpses_in_pack(bool remind) continue; // Only saprovorous characters care about rotten food. - if (food_is_rotten(obj) && !player_mutation_level(MUT_SAPROVOROUS)) + // Also, rotten corpses can't be sacrificed. + if (food_is_rotten(obj) && (sacrifice + || !player_mutation_level(MUT_SAPROVOROUS))) + { continue; + } num++; if (can_bottle && mons_has_blood(obj.plus)) @@ -1106,7 +1111,7 @@ void eat_floor_item(int item_link) dec_mitm_item_quantity( item_link, 1 ); } -// return -1 for cancel, 1 for eaten, 0 for not eaten +// Returns -1 for cancel, 1 for eaten, 0 for not eaten. int eat_from_floor() { if (you.flight_mode() == FL_LEVITATE) @@ -1196,6 +1201,7 @@ int eat_from_floor() } else _player_can_eat_rotten_meat(true); + need_more = true; } else if (inedible_food) { @@ -1211,8 +1217,8 @@ int eat_from_floor() } else // Several different food items. mpr("You refuse to eat these food items."); + need_more = true; } - need_more = true; } if (need_more && Options.auto_list) @@ -1231,9 +1237,8 @@ static const char *_chunk_flavour_phrase(bool likes_chunks) const int gourmand = you.duration[DUR_GOURMAND]; if (gourmand >= GOURMAND_MAX) { - phrase = - one_chance_in(1000)? "tastes like chicken!" - : "tastes great."; + phrase = one_chance_in(1000) ? "tastes like chicken!" + : "tastes great."; } else if (gourmand > GOURMAND_MAX * 75 / 100) phrase = "tastes very good."; @@ -2041,6 +2046,8 @@ bool can_ingest(int what_isit, int kindof_thing, bool suppress_msg, bool reqid, if (!item_type_known(you.inv[amulet])) { + // For artefact amulets, this will tell you its name + // and subtype. Other properties may still be hidden. set_ident_flags( you.inv[ amulet], ISFLAG_KNOW_TYPE); set_ident_type( OBJ_JEWELLERY, AMU_THE_GOURMAND, ID_KNOWN_TYPE ); diff --git a/crawl-ref/source/libgui.cc b/crawl-ref/source/libgui.cc index 93f3c90cf8..a5171b3906 100644 --- a/crawl-ref/source/libgui.cc +++ b/crawl-ref/source/libgui.cc @@ -341,13 +341,14 @@ int tile_idx_unseen_terrain(int x, int y, int what) void GmapUpdate(int x, int y, int what, bool upd_tile) { - if ((you.level_type == LEVEL_LABYRINTH) || (you.level_type == LEVEL_ABYSS)) + // If you can't map the area, the minimap won't show. + if (!player_in_mappable_area()) return; int c; if (x == you.x_pos && y == you.y_pos) - c = Options.tile_player_col; // player position always highlighted + c = Options.tile_player_col; // Player position always highlighted. else { const coord_def gc(x,y); @@ -417,7 +418,7 @@ void GmapUpdate(int x, int y, int what, bool upd_tile) } else if (c == 0) { - // forget map + // Forget map. env.tile_bk_fg[x][y] = 0; env.tile_bk_bg[x][y] = t; return; @@ -436,6 +437,10 @@ void GmapUpdate(int x, int y, int what, bool upd_tile) void GmapInit(bool upd_tile) { + // If you can't map the area, the minimap won't show. + if (!player_in_mappable_area()) + return; + int x, y; gmap_min_x = gmap_max_x = you.x_pos - 1; gmap_min_y = gmap_max_y = you.y_pos - 1; @@ -454,6 +459,14 @@ void GmapDisplay(int linex, int liney) for (int x = 0; x < GXM*GYM; x++) buf2[x] = 0; + if (!player_in_mappable_area()) + { + // Don't bother in the Abyss or Labyrinth. + region_map->flag = true; + region_map->draw_data(buf2, false, 0, 0); + return; + } + ox = ( gmap_min_x + (GXM - 1 - gmap_max_x) ) / 2; oy = ( gmap_min_y + (GYM - 1 - gmap_max_y) ) / 2; int count = ox + oy * GXM; @@ -463,33 +476,23 @@ void GmapDisplay(int linex, int liney) for (int y = gmap_min_y; y <= gmap_max_y; y++) { for (int x = gmap_min_x; x <= gmap_max_x; x++, count++) - { if (count >= 0 && count < GXM*GYM) buf2[count] = gmap_data[x][y]; - } + count += GXM - (gmap_max_x - gmap_min_x + 1); } - bool show_mark = false; - int mark_x = 0; - int mark_y = 0; - // Unmappables... - if (you.level_type != LEVEL_LABYRINTH && you.level_type != LEVEL_ABYSS) - { - ox += linex - gmap_min_x; - oy += liney - gmap_min_y; - - mark_x = ox; - mark_y = oy; - show_mark = true; + // Highlight centre of the map (ox, oy). + ox += linex - gmap_min_x; + oy += liney - gmap_min_y; - // Highlight centre of the map. - // [enne] Maybe we need another colour for the highlight? - buf2[ox + oy * GXM] = Options.tile_player_col; - } + // [enne] Maybe we need another colour for the highlight? + // [jpeg] I think reusing the player colour is okay, because that's + // usually where the centre will be. + buf2[ox + oy * GXM] = Options.tile_player_col; region_map->flag = true; - region_map->draw_data(buf2, show_mark, mark_x, mark_y); + region_map->draw_data(buf2, true, ox, oy); } // Initialize routines. diff --git a/crawl-ref/source/misc.cc b/crawl-ref/source/misc.cc index f0ca36bc89..1ce293a3e6 100644 --- a/crawl-ref/source/misc.cc +++ b/crawl-ref/source/misc.cc @@ -2236,8 +2236,12 @@ void down_stairs( int old_level, dungeon_feature_type force_stair, break; case LEVEL_LABYRINTH: - // Finding the way out of a labyrinth interests Xom. - xom_is_stimulated(98); + // Finding the way out of a labyrinth interests Xom, + // but less so for Minotaurs. + if (you.species == SP_MINOTAUR) + xom_is_stimulated(49); + else + xom_is_stimulated(98); break; case LEVEL_ABYSS: diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc index d79233cc63..0ac59d48c6 100644 --- a/crawl-ref/source/monstuff.cc +++ b/crawl-ref/source/monstuff.cc @@ -882,12 +882,10 @@ void monster_die(monsters *monster, killer_type killer, int i, bool silent) case KILL_YOU_MISSILE: // You kill by missile or beam. case KILL_YOU_CONF: // You kill by confusion. { - const bool bad_kill = - god_hates_killing(you.religion, monster); + const bool bad_kill = god_hates_killing(you.religion, monster); + const bool was_neutral = testbits(monster->flags, MF_WAS_NEUTRAL); const bool created_friendly = testbits(monster->flags, MF_CREATED_FRIENDLY); - const bool was_neutral = - testbits(monster->flags, MF_WAS_NEUTRAL); if (death_message) { @@ -1600,11 +1598,11 @@ bool monster_polymorph( monsters *monster, monster_type targetc, monster->base_monster = MONS_PROGRAM_BUG; monster->number = 0; - mon_enchant abj = monster->get_ench(ENCH_ABJ); - mon_enchant charm = monster->get_ench(ENCH_CHARM); - mon_enchant neutral = monster->get_ench(ENCH_NEUTRAL); - mon_enchant shifter = monster->get_ench(ENCH_GLOWING_SHAPESHIFTER, - ENCH_SHAPESHIFTER); + mon_enchant abj = monster->get_ench(ENCH_ABJ); + mon_enchant charm = monster->get_ench(ENCH_CHARM); + mon_enchant neutral = monster->get_ench(ENCH_NEUTRAL); + mon_enchant shifter = monster->get_ench(ENCH_GLOWING_SHAPESHIFTER, + ENCH_SHAPESHIFTER); // Note: define_monster() will clear out all enchantments! -- bwr define_monster( monster_index(monster) ); @@ -2061,7 +2059,7 @@ void behaviour_event( monsters *mon, int event, int src, || ((wontAttack != sourceWontAttack || isSmart) && mon->behaviour != BEH_FLEE && mon->behaviour != BEH_PANIC)) { - // (plain) plants and fungi cannot flee or fight back + // (Plain) plants and fungi cannot flee or fight back. if (mon->type == MONS_FUNGUS || mon->type == MONS_PLANT) return; diff --git a/crawl-ref/source/notes.cc b/crawl-ref/source/notes.cc index 957b8cb52f..9191fbb7ae 100644 --- a/crawl-ref/source/notes.cc +++ b/crawl-ref/source/notes.cc @@ -87,7 +87,7 @@ static bool _is_noteworthy_dlevel( unsigned short place ) static_cast<unsigned char>((place >> 8) & 0xFF); const int lev = (place & 0xFF); - /* Special levels (Abyss, etc.) are always interesting */ + // Special levels (Abyss, etc.) are always interesting. if (lev == 0xFF) return true; @@ -106,7 +106,7 @@ static bool _is_noteworthy_dlevel( unsigned short place ) // the note was taken, e.g. you.* is valid. static bool _is_noteworthy( const Note& note ) { - /* always noteworthy */ + // Always noteworthy. if (note.type == NOTE_XP_LEVEL_CHANGE || note.type == NOTE_GET_GOD || note.type == NOTE_GOD_GIFT @@ -127,7 +127,7 @@ static bool _is_noteworthy( const Note& note ) return true; } - /* never noteworthy, hooked up for fun or future use */ + // Never noteworthy, hooked up for fun or future use. if (note.type == NOTE_MP_CHANGE || note.type == NOTE_MAXHP_CHANGE || note.type == NOTE_MAXMP_CHANGE) @@ -135,22 +135,22 @@ static bool _is_noteworthy( const Note& note ) return false; } - /* god powers might be noteworthy if it's an actual power */ + // God powers might be noteworthy if it's an actual power. if (note.type == NOTE_GOD_POWER && _real_god_power(note.first, note.second) == -1) { return false; } - /* hp noteworthiness is handled in its own function */ + // HP noteworthiness is handled in its own function. if (note.type == NOTE_HP_CHANGE && !_is_noteworthy_hp(note.first, note.second)) { return false; } - /* skills are noteworthy if in the skill value list or if - it's a new maximal skill (depending on options) */ + // Skills are noteworthy if in the skill value list or if + // it's a new maximal skill (depending on options). if (note.type == NOTE_GAIN_SKILL) { if (Options.note_all_skill_levels @@ -167,7 +167,7 @@ static bool _is_noteworthy( const Note& note ) if (!_is_noteworthy_dlevel(note.packed_place)) return false; - // labyrinths are always interesting + // Labyrinths are always interesting. if ((note.packed_place & 0xFF) == 0xFF && (note.packed_place >> 8) == LEVEL_LABYRINTH) { @@ -175,7 +175,7 @@ static bool _is_noteworthy( const Note& note ) } } - /* Learning a spell is always noteworthy if note_all_spells is set */ + // Learning a spell is always noteworthy if note_all_spells is set. if (note.type == NOTE_LEARN_SPELL && Options.note_all_spells) return true; diff --git a/crawl-ref/source/spells2.cc b/crawl-ref/source/spells2.cc index 9242f42436..363ab5cd58 100644 --- a/crawl-ref/source/spells2.cc +++ b/crawl-ref/source/spells2.cc @@ -199,18 +199,18 @@ static bool mark_detected_creature(int gridx, int gridy, const monsters *mon, int detect_creatures( int pow, bool telepathic ) { int fuzz_radius = 0, fuzz_chance = 0; - if ( !telepathic ) + if (!telepathic) fuzz_detect_creatures(pow, &fuzz_radius, &fuzz_chance); if (pow > 50) pow = 50; - int creatures_found = 0; + int creatures_found = 0; const int map_radius = 8 + random2(8) + pow; // Clear the map so detect creatures is more useful and the detection // fuzz is harder to analyse by averaging. - if ( !telepathic ) + if (!telepathic) clear_map(false); for (int i = you.x_pos - map_radius; i < you.x_pos + map_radius; i++) @@ -241,7 +241,7 @@ int detect_creatures( int pow, bool telepathic ) } return (creatures_found); -} // end detect_creatures() +} int corpse_rot(int power) { diff --git a/crawl-ref/source/spl-cast.cc b/crawl-ref/source/spl-cast.cc index 3cff8a1102..64b23cfea0 100644 --- a/crawl-ref/source/spl-cast.cc +++ b/crawl-ref/source/spl-cast.cc @@ -1695,10 +1695,18 @@ spret_type your_spells( spell_type spell, int powc, bool allow_fail ) break; case SPELL_DETECT_CREATURES: - mprf("You detect %s", (detect_creatures(powc) > 0) ? "creatures!" - : "nothing."); - break; + { + int known_plants = count_detected_plants(); + int num_creatures = detect_creatures(powc); + if (!num_creatures) + mpr("You detect nothing."); + else if (num_creatures == known_plants) + mpr("You detect no further creatures."); + else + mpr("You detect creatures!"); + break; + } case SPELL_CURE_POISON_II: // poison magic version of cure poison cast_cure_poison(powc); break; diff --git a/crawl-ref/source/tile2.cc b/crawl-ref/source/tile2.cc index 920e8229ac..dace6d104c 100644 --- a/crawl-ref/source/tile2.cc +++ b/crawl-ref/source/tile2.cc @@ -925,44 +925,44 @@ void WallIdx(int &wall, int &floor, int &special) { case BLUE: case LIGHTBLUE: - wall = IDX_WALL_ZOT_BLUE; + wall = IDX_WALL_ZOT_BLUE; floor = IDX_FLOOR_ZOT_BLUE; break; case RED: case LIGHTRED: - wall = IDX_WALL_ZOT_RED; + wall = IDX_WALL_ZOT_RED; floor = IDX_FLOOR_ZOT_RED; break; case MAGENTA: case LIGHTMAGENTA: - wall = IDX_WALL_ZOT_MAGENTA; + wall = IDX_WALL_ZOT_MAGENTA; floor = IDX_FLOOR_ZOT_MAGENTA; break; case GREEN: case LIGHTGREEN: - wall = IDX_WALL_ZOT_GREEN; + wall = IDX_WALL_ZOT_GREEN; floor = IDX_FLOOR_ZOT_GREEN; break; case CYAN: case LIGHTCYAN: - wall = IDX_WALL_ZOT_CYAN; + wall = IDX_WALL_ZOT_CYAN; floor = IDX_FLOOR_ZOT_CYAN; break; case BROWN: case YELLOW: - wall = IDX_WALL_ZOT_YELLOW; + wall = IDX_WALL_ZOT_YELLOW; floor = IDX_FLOOR_ZOT_YELLOW; break; case BLACK: case WHITE: default: - wall = IDX_WALL_ZOT_GRAY; + wall = IDX_WALL_ZOT_GRAY; floor = IDX_FLOOR_ZOT_GRAY; break; } @@ -978,13 +978,13 @@ void WallIdx(int &wall, int &floor, int &special) } else if (you.level_type == LEVEL_ABYSS) { - wall = IDX_WALL_UNDEAD; + wall = IDX_WALL_UNDEAD; floor = IDX_FLOOR_NERVES; return; } else if (you.level_type == LEVEL_LABYRINTH) { - wall = IDX_WALL_UNDEAD; + wall = IDX_WALL_UNDEAD; floor = IDX_FLOOR_UNDEAD; return; } @@ -999,8 +999,8 @@ void WallIdx(int &wall, int &floor, int &special) switch (colour) { case BLUE: - wall = IDX_WALL_BAZAAR_GRAY; - floor = IDX_FLOOR_BAZAAR_GRASS; + wall = IDX_WALL_BAZAAR_GRAY; + floor = IDX_FLOOR_BAZAAR_GRASS; special = IDX_FLOOR_BAZAAR_GRASS1_SPECIAL; return; @@ -1008,118 +1008,118 @@ void WallIdx(int &wall, int &floor, int &special) // Reds often have lava, which looks ridiculous // next to grass or dirt, so we'll use existing // floor and wall tiles here. - wall = IDX_WALL_PEBBLE_RED; - floor = IDX_FLOOR_VAULT; + wall = IDX_WALL_PEBBLE_RED; + floor = IDX_FLOOR_VAULT; special = IDX_FLOOR_BAZAAR_VAULT_SPECIAL; return; case LIGHTBLUE: - wall = IDX_WALL_HIVE; - floor = IDX_FLOOR_BAZAAR_GRASS; + wall = IDX_WALL_HIVE; + floor = IDX_FLOOR_BAZAAR_GRASS; special = IDX_FLOOR_BAZAAR_GRASS2_SPECIAL; return; case GREEN: - wall = IDX_WALL_BAZAAR_STONE; - floor = IDX_FLOOR_BAZAAR_GRASS; + wall = IDX_WALL_BAZAAR_STONE; + floor = IDX_FLOOR_BAZAAR_GRASS; special = IDX_FLOOR_BAZAAR_GRASS1_SPECIAL; return; case MAGENTA: - wall = IDX_WALL_BAZAAR_STONE; - floor = IDX_FLOOR_BAZAAR_DIRT; + wall = IDX_WALL_BAZAAR_STONE; + floor = IDX_FLOOR_BAZAAR_DIRT; special = IDX_FLOOR_BAZAAR_DIRT_SPECIAL; return; default: - wall = IDX_WALL_VAULT; - floor = IDX_FLOOR_VAULT; + wall = IDX_WALL_VAULT; + floor = IDX_FLOOR_VAULT; special = IDX_FLOOR_BAZAAR_VAULT_SPECIAL; return; } } } - int depth = player_branch_depth(); + int depth = player_branch_depth(); int branch_depth = your_branch().depth; switch (you.where_are_you) { case BRANCH_MAIN_DUNGEON: - wall = IDX_WALL_NORMAL; + wall = IDX_WALL_NORMAL; floor = IDX_FLOOR_NORMAL; return; case BRANCH_HIVE: - wall = IDX_WALL_HIVE; + wall = IDX_WALL_HIVE; floor = IDX_FLOOR_HIVE; return; case BRANCH_VAULTS: - wall = IDX_WALL_VAULT; + wall = IDX_WALL_VAULT; floor = IDX_FLOOR_VAULT; return; case BRANCH_ECUMENICAL_TEMPLE: - wall = IDX_WALL_VINES; + wall = IDX_WALL_VINES; floor = IDX_FLOOR_VINES; return; case BRANCH_ELVEN_HALLS: case BRANCH_HALL_OF_BLADES: - wall = IDX_WALL_HALL; + wall = IDX_WALL_HALL; floor = IDX_FLOOR_HALL; return; case BRANCH_TARTARUS: case BRANCH_CRYPT: case BRANCH_VESTIBULE_OF_HELL: - wall = IDX_WALL_UNDEAD; + wall = IDX_WALL_UNDEAD; floor = IDX_FLOOR_UNDEAD; return; case BRANCH_TOMB: - wall = IDX_WALL_TOMB; + wall = IDX_WALL_TOMB; floor = IDX_FLOOR_TOMB; return; case BRANCH_DIS: - wall = IDX_WALL_ZOT_CYAN; + wall = IDX_WALL_ZOT_CYAN; floor = IDX_FLOOR_ZOT_CYAN; return; case BRANCH_GEHENNA: - wall = IDX_WALL_ZOT_RED; + wall = IDX_WALL_ZOT_RED; floor = IDX_FLOOR_ROUGH_RED; return; case BRANCH_COCYTUS: - wall = IDX_WALL_ICE; + wall = IDX_WALL_ICE; floor = IDX_FLOOR_ICE; return; case BRANCH_ORCISH_MINES: - wall = IDX_WALL_ORC; + wall = IDX_WALL_ORC; floor = IDX_FLOOR_ORC; return; case BRANCH_LAIR: - wall = IDX_WALL_LAIR; + wall = IDX_WALL_LAIR; floor = IDX_FLOOR_LAIR; return; case BRANCH_SLIME_PITS: - wall = IDX_WALL_SLIME; + wall = IDX_WALL_SLIME; floor = IDX_FLOOR_SLIME; return; case BRANCH_SNAKE_PIT: - wall = IDX_WALL_SNAKE; + wall = IDX_WALL_SNAKE; floor = IDX_FLOOR_SNAKE; return; case BRANCH_SWAMP: - wall = IDX_WALL_SWAMP; + wall = IDX_WALL_SWAMP; floor = IDX_FLOOR_SWAMP; return; @@ -1128,13 +1128,14 @@ void WallIdx(int &wall, int &floor, int &special) wall = IDX_WALL_VINES; else wall = IDX_WALL_YELLOW_ROCK; + floor = IDX_FLOOR_SAND_STONE; return; case BRANCH_HALL_OF_ZOT: if (you.your_level - you.branch_stairs[7] <= 1) { - wall = IDX_WALL_ZOT_YELLOW; + wall = IDX_WALL_ZOT_YELLOW; floor = IDX_FLOOR_ZOT_YELLOW; return; } @@ -1142,20 +1143,20 @@ void WallIdx(int &wall, int &floor, int &special) switch (you.your_level - you.branch_stairs[7]) { case 2: - wall = IDX_WALL_ZOT_GREEN; + wall = IDX_WALL_ZOT_GREEN; floor = IDX_FLOOR_ZOT_GREEN; return; case 3: - wall = IDX_WALL_ZOT_CYAN; + wall = IDX_WALL_ZOT_CYAN; floor = IDX_WALL_ZOT_CYAN; return; case 4: - wall = IDX_WALL_ZOT_BLUE; + wall = IDX_WALL_ZOT_BLUE; floor = IDX_FLOOR_ZOT_GREEN; return; case 5: default: - wall = IDX_WALL_ZOT_MAGENTA; + wall = IDX_WALL_ZOT_MAGENTA; floor = IDX_FLOOR_ZOT_MAGENTA; return; } @@ -1170,7 +1171,7 @@ void WallIdx(int &wall, int &floor, int &special) // the compiler will issue a warning when new branches are created. } - wall = IDX_WALL_NORMAL; + wall = IDX_WALL_NORMAL; floor = IDX_FLOOR_NORMAL; } void TileLoadWall(bool wizard) @@ -1188,6 +1189,7 @@ void TileLoadWall(bool wizard) floor_tile_idx = TILE_DNGN_FLOOR; floor_flavors = tile_W2D_count[floor_idx]; int offset = floor_tile_idx; + for (int i = 0; i < floor_flavors; i++) { int idx_src = tile_W2D_start[floor_idx] + i; diff --git a/crawl-ref/source/travel.cc b/crawl-ref/source/travel.cc index 84a8a60474..d645f2b3df 100644 --- a/crawl-ref/source/travel.cc +++ b/crawl-ref/source/travel.cc @@ -290,8 +290,9 @@ inline bool is_stash(const LevelStashes *ls, int x, int y) void clear_excludes() { // Sanity checks - if (you.level_type == LEVEL_LABYRINTH || you.level_type == LEVEL_ABYSS) + if (!player_in_mappable_area()) return; + #ifdef USE_TILE for (int i = curr_excludes.size()-1; i >= 0; i--) toggle_exclude(curr_excludes[i].pos); @@ -346,7 +347,7 @@ void set_exclude(const coord_def &p, int radius) { // Sanity checks; excludes can be set in Pan and regular dungeon // levels only. - if (you.level_type == LEVEL_LABYRINTH || you.level_type == LEVEL_ABYSS) + if (!player_in_mappable_area()) return; if (!in_bounds(p)) diff --git a/crawl-ref/source/view.cc b/crawl-ref/source/view.cc index 8cf0f47afe..bcea143495 100644 --- a/crawl-ref/source/view.cc +++ b/crawl-ref/source/view.cc @@ -668,6 +668,30 @@ screen_buffer_t colour_code_map( int x, int y, bool item_colour, return real_colour(tc); } +int count_detected_plants() +{ + int count = 0; + for (int y = Y_BOUND_1; y <= Y_BOUND_2; ++y) + for (int x = X_BOUND_1; x <= X_BOUND_2; ++x) + { + // Don't expose new dug out areas: + // Note: assumptions are being made here about how + // terrain can change (eg it used to be solid, and + // thus monster/item free). + if (is_terrain_changed(x, y)) + continue; + + unsigned envc = get_envmap_char(x, y); + if (!envc) + continue; + + if (envc == 'P' || envc == 'f') + count++; + } + + return (count); +} + void clear_map(bool clear_detected_items, bool clear_detected_monsters) { for (int y = Y_BOUND_1; y <= Y_BOUND_2; ++y) @@ -936,7 +960,7 @@ void handle_monster_shouts(monsters* monster, bool force) default_msg_key = "__DEMON_TAUNT"; break; default: - default_msg_key = "__BUGGY"; + default_msg_key = "__BUGGY"; // S_LOUD, S_VERY_SOFT, etc. (loudness) } // Now that we have the message key, get a random verb and noise level @@ -999,7 +1023,7 @@ void handle_monster_shouts(monsters* monster, bool force) { ; // No "visual shout" defined for silent monster, do nothing. } - else if (msg == "") + else if (msg == "") // S_SILENT handled above { msg::streams(MSGCH_DIAGNOSTICS) << "No shout entry for default shout type '" @@ -4657,7 +4681,7 @@ void viewwindow(bool draw_it, bool do_updates) env.show_col.init(LIGHTGREY); Show_Backup.init(0); - item_grid(); // must be done before cloud and monster + item_grid(); // Must be done before cloud and monster. cloud_grid(); monster_grid( do_updates ); @@ -4689,6 +4713,7 @@ void viewwindow(bool draw_it, bool do_updates) const coord_def gc(view2grid(coord_def(count_x, count_y))); const coord_def ep = view2show(grid2view(gc)); + // Print tutorial messages for features in LOS. if (Options.tutorial_left && in_bounds(gc) && crawl_view.in_grid_los(gc)) { @@ -4723,21 +4748,21 @@ void viewwindow(bool draw_it, bool do_updates) } } - // order is important here + // Order is important here. if (!map_bounds(gc)) { // off the map - buffy[bufcount] = 0; + buffy[bufcount] = 0; buffy[bufcount + 1] = DARKGREY; #ifdef USE_TILE - tileb[bufcount] = 0; - tileb[bufcount+1] = tileidx_unseen(' ', gc); + tileb[bufcount] = 0; + tileb[bufcount + 1] = tileidx_unseen(' ', gc); #endif } else if (!crawl_view.in_grid_los(gc)) { - // outside the env.show area - buffy[bufcount] = get_envmap_char( gc.x, gc.y ); + // Outside the env.show area. + buffy[bufcount] = get_envmap_char( gc.x, gc.y ); buffy[bufcount + 1] = DARKGREY; if (Options.colour_map) @@ -4754,8 +4779,8 @@ void viewwindow(bool draw_it, bool do_updates) bg = tileidx_unseen(get_envmap_char(gc.x,gc.y), gc); env.tile_bk_bg[gc.x][gc.y] = bg; } - tileb[bufcount] = fg; - tileb[bufcount+1] = bg | tile_unseen_flag(gc); + tileb[bufcount] = fg; + tileb[bufcount + 1] = bg | tile_unseen_flag(gc); #endif } else if (gc == you.pos()) @@ -4784,8 +4809,8 @@ void viewwindow(bool draw_it, bool do_updates) tileb[bufcount+1] = env.tile_bg[ep.x-1][ep.y-1]; #endif - // player overrides everything in cell - buffy[bufcount] = you.symbol; + // Player overrides everything in cell. + buffy[bufcount] = you.symbol; buffy[bufcount + 1] = you.colour; if (player_is_swimming()) @@ -4807,7 +4832,7 @@ void viewwindow(bool draw_it, bool do_updates) _get_symbol( gc.x, gc.y, object, &ch, &colour ); - buffy[bufcount] = ch; + buffy[bufcount] = ch; buffy[bufcount + 1] = colour; #ifdef USE_TILE tileb[bufcount] = env.tile_fg[ep.x-1][ep.y-1]; @@ -4819,7 +4844,7 @@ void viewwindow(bool draw_it, bool do_updates) // This section is very tricky because it // duplicates the old code (which was horrid). - // if the grid is in LoS env.show was set and + // If the grid is in LoS env.show was set and // we set the buffer already, so... if (buffy[bufcount] != 0) { @@ -4881,8 +4906,8 @@ void viewwindow(bool draw_it, bool do_updates) // to do for when we move away from the area!) if (buffy[bufcount] == 0) { - // show map - buffy[bufcount] = get_envmap_char( gc.x, gc.y ); + // Show map. + buffy[bufcount] = get_envmap_char( gc.x, gc.y ); buffy[bufcount + 1] = DARKGREY; if (Options.colour_map) @@ -4914,7 +4939,7 @@ void viewwindow(bool draw_it, bool do_updates) } } - // alter colour if flashing the characters vision + // Alter colour if flashing the characters vision. if (flash_colour && buffy[bufcount]) { buffy[bufcount + 1] = @@ -4930,7 +4955,7 @@ void viewwindow(bool draw_it, bool do_updates) // and this simply works without requiring a stack. you.flash_colour = BLACK; - // avoiding unneeded draws when running + // Avoiding unneeded draws when running. if (draw) { #ifdef USE_TILE diff --git a/crawl-ref/source/view.h b/crawl-ref/source/view.h index 02280e573e..31de54e2f7 100644 --- a/crawl-ref/source/view.h +++ b/crawl-ref/source/view.h @@ -127,6 +127,8 @@ void setLOSRadius(int newLR); * *********************************************************************** */ bool check_awaken(monsters* monster); +int count_detected_plants(void); + void clear_map(bool clear_items = true, bool clear_mons = true); bool is_feature(int feature, int x, int y); |