diff options
-rw-r--r-- | crawl-ref/source/acr.cc | 5 | ||||
-rw-r--r-- | crawl-ref/source/stuff.cc | 31 | ||||
-rw-r--r-- | crawl-ref/source/stuff.h | 2 |
3 files changed, 15 insertions, 23 deletions
diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc index e3d2edfaba..f2a8328931 100644 --- a/crawl-ref/source/acr.cc +++ b/crawl-ref/source/acr.cc @@ -3736,8 +3736,9 @@ static bool _initialise(void) // Mark items in inventory as of unknown origin. origin_set_inventory(origin_set_unknown); - // For a new game, wipe out monsters in LOS. - zap_los_monsters(); + // For a new game, wipe out monsters in LOS, and + // for new tutorial games also the items. + zap_los_monsters(Options.tutorial_events[TUT_SEEN_FIRST_OBJECT]); // For a newly started tutorial, turn secret doors into normal ones. if (Options.tutorial_left) diff --git a/crawl-ref/source/stuff.cc b/crawl-ref/source/stuff.cc index 377b9ba84a..4f4a11b76a 100644 --- a/crawl-ref/source/stuff.cc +++ b/crawl-ref/source/stuff.cc @@ -885,27 +885,21 @@ bool is_trap_square(dungeon_feature_type grid) // Does the equivalent of KILL_RESET on all monsters in LOS. Should only be // applied to new games. -void zap_los_monsters() +void zap_los_monsters(bool items_also) { - calc_show_los(); + // Not using player LOS since clouds might temporarily + // block monsters. + los_def los(you.pos(), opc_fullyopaque); + los.update(); - for (rectangle_iterator ri(crawl_view.vlos1, crawl_view.vlos2); ri; ++ri ) + for (radius_iterator ri(you.pos(), LOS_RADIUS); ri; ++ri) { - const coord_def g = view2grid(*ri); - - if (!map_bounds(g)) - continue; - - if (!you.see_cell(g)) + if (!you.see_cell(*ri)) continue; - if (g == you.pos()) - continue; - - // At tutorial beginning disallow items in line of sight. - if (Options.tutorial_events[TUT_SEEN_FIRST_OBJECT]) + if (items_also) { - int item = igrd(g); + int item = igrd(*ri); if (item != NON_ITEM && mitm[item].is_valid() ) destroy_item(item); @@ -913,11 +907,8 @@ void zap_los_monsters() // If we ever allow starting with a friendly monster, // we'll have to check here. - monsters *mon = monster_at(g); - if (mon == NULL) - continue; - - if (mons_class_flag( mon->type, M_NO_EXP_GAIN )) + monsters *mon = monster_at(*ri); + if (mon == NULL || mons_class_flag(mon->type, M_NO_EXP_GAIN)) continue; #ifdef DEBUG_DIAGNOSTICS diff --git a/crawl-ref/source/stuff.h b/crawl-ref/source/stuff.h index 4a7fab6c11..976bb8fddb 100644 --- a/crawl-ref/source/stuff.h +++ b/crawl-ref/source/stuff.h @@ -93,7 +93,7 @@ template <typename Z> inline Z sgn(Z x) } bool is_trap_square(dungeon_feature_type grid); -void zap_los_monsters(); +void zap_los_monsters(bool items_also); int integer_sqrt(int value); |