From 467446254ef22c7d361764d1244a8d83fd285f95 Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Sat, 19 Jan 2008 20:35:24 +0000 Subject: Fix non-tile compile of tutorial.cc (whoops!) Add messages when entering or leaving the level map ('X') in tiles. First attempts at outlining icons via cursor in tile tutorial. (Currently this only works for monsters, though I'm not sure why...) And some code clean-up for tiles and the tutorial. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3301 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/acr.cc | 10 +++++++++ crawl-ref/source/libgui.cc | 5 +++-- crawl-ref/source/libgui.h | 4 ++-- crawl-ref/source/tile1.cc | 8 +++---- crawl-ref/source/tutorial.cc | 51 ++++++++++++++++++++++++++++++++++++++------ 5 files changed, 63 insertions(+), 15 deletions(-) diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc index d76c66dd41..1aeb3e30e1 100644 --- a/crawl-ref/source/acr.cc +++ b/crawl-ref/source/acr.cc @@ -2104,8 +2104,18 @@ void process_command( command_type cmd ) #endif { coord_def pos; +#ifdef USE_TILE + std::string str = "Move the cursor to view the level map, or " + "type ? for a list of commands."; + print_formatted_paragraph(str, get_number_of_cols()); +#endif + show_map(pos, true); redraw_screen(); + +#ifdef USE_TILE + mpr("Returning to the game..."); +#endif if (pos.x > 0) start_travel(pos.x, pos.y); } diff --git a/crawl-ref/source/libgui.cc b/crawl-ref/source/libgui.cc index 6817a9db38..3baa8fb27d 100644 --- a/crawl-ref/source/libgui.cc +++ b/crawl-ref/source/libgui.cc @@ -323,7 +323,9 @@ void GmapUpdate(int x, int y, int what, bool upd_tile) c = MAP_WHITE; // player position always in white else if (mgrd[x][y] != NON_MONSTER && mons_friendly(&menv[mgrd[x][y]]) && upd_tile) + { c = MAP_LTRED; // friendly monsters subtly different from hostiles + } else { const coord_def gc(x,y); @@ -423,11 +425,10 @@ void GmapDisplay(int linex, int liney) for (y = gmap_min_y; y <= gmap_max_y; y++) { - for (x = gmap_min_x; x <= gmap_max_x; x++) + for (x = gmap_min_x; x <= gmap_max_x; x++, count++) { if ( (count>=0)&&(count gv_now; bool is_bazaar() { return (you.level_type == LEVEL_PORTAL_VAULT && - you.level_type_name == "bazaar"); + you.level_type_name == "bazaar"); } unsigned short get_bazaar_special_colour() @@ -53,9 +53,9 @@ int tile_unseen_flag(const coord_def& gc) if (!map_bounds(gc)) return TILE_FLAG_UNSEEN; else if (is_terrain_known(gc.x,gc.y) - && !is_terrain_seen(gc.x,gc.y) - || is_envmap_detected_item(gc.x,gc.y) - || is_envmap_detected_mons(gc.x,gc.y)) + && !is_terrain_seen(gc.x,gc.y) + || is_envmap_detected_item(gc.x,gc.y) + || is_envmap_detected_mons(gc.x,gc.y)) { return TILE_FLAG_MM_UNSEEN; } diff --git a/crawl-ref/source/tutorial.cc b/crawl-ref/source/tutorial.cc index e82c899047..d99dd0b2f6 100644 --- a/crawl-ref/source/tutorial.cc +++ b/crawl-ref/source/tutorial.cc @@ -863,6 +863,16 @@ static std::string colour_to_tag(int col, bool closed = false) } #endif +static bool mons_is_highlighted(const monsters *mons) +{ + return (mons_friendly(mons) + && Options.friend_brand != CHATTR_NORMAL + || mons_looks_stabbable(mons) + && Options.stab_brand != CHATTR_NORMAL + || mons_looks_distracted(mons) + && Options.may_stab_brand != CHATTR_NORMAL); +} + void tutorial_first_monster(const monsters &mon) { if (!Options.tutorial_events[TUT_SEEN_MONSTER]) @@ -871,7 +881,7 @@ void tutorial_first_monster(const monsters &mon) // crude hack: // if the first monster is sleeping wake it // (highlighting is an unnecessary complication) - if (get_mons_colour(&mon) != (&mon)->colour) + if (mons_is_highlighted(&mon)) { noisy(1, mon.x, mon.y); viewwindow(true, false); @@ -890,6 +900,9 @@ void tutorial_first_monster(const monsters &mon) "b or K. " #else // need to highlight monster + const coord_def ep = grid2view(coord_def(mon.x, mon.y)); + tile_place_cursor(ep.x-1,ep.y-1,true); + text += "monster is a "; text += mon.name(DESC_PLAIN).c_str(); text += ". Examples for typical early monsters are: rat, " @@ -937,9 +950,17 @@ void tutorial_first_item(const item_def &item) std::string text = "That "; #ifndef USE_TILE + unsigned ch; + unsigned short col; + get_item_glyph(&item, &ch, &col); + text += colour_to_tag(col); text += ch; text += ""; +#else + // highlight item + const coord_def ep = grid2view(coord_def(item.x, item.y)); + tile_place_cursor(ep.x-1,ep.y-1,true); #endif text += "is an item. If you move there and press g or " ", you will pick it up. " @@ -971,13 +992,17 @@ void learned_something_new(tutorial_event_type seen_what, int x, int y) return; std::ostringstream text; + #ifndef USE_TILE const int ex = x - you.x_pos + 9; const int ey = y - you.y_pos + 9; unsigned ch; unsigned short colour; int object; +#else + const coord_def ep = grid2view(coord_def(x,y)); #endif + switch(seen_what) { case TUT_SEEN_POTION: @@ -1179,6 +1204,8 @@ void learned_something_new(tutorial_event_type seen_what, int x, int y) text << colour_to_tag(colour) << static_cast(ch) << " "; +#else + tile_place_cursor(ep.x-1,ep.y-1,true); #endif text << "are some downstairs. You can enter the next (deeper) " "level by following them down (>). To get back to " @@ -1201,6 +1228,8 @@ void learned_something_new(tutorial_event_type seen_what, int x, int y) if (ch == '<') text << "<"; text << " "; +#else + tile_place_cursor(ep.x-1,ep.y-1,true); #endif text << "are some kind of escape hatch. You can use them to " "quickly leave a level with << and >, " @@ -1217,7 +1246,7 @@ void learned_something_new(tutorial_event_type seen_what, int x, int y) if (ch == ' ' || colour == BLACK) colour = LIGHTCYAN; - text << "depicted by " << colour_to_tag(colour) << "^" + text << "depicted by " << colour_to_tag(colour) << "^"; #endif text << ". They can do physical damage (with darts or needles, for " "example) or have other, more magical effects, like " @@ -1232,6 +1261,8 @@ void learned_something_new(tutorial_event_type seen_what, int x, int y) get_item_symbol( object, &ch, &colour ); text << colour_to_tag(colour) << static_cast(ch) << " "; +#else + tile_place_cursor(ep.x-1,ep.y-1,true); #endif text << "is an altar. You can get information about it by pressing " "p while standing on the square. Before taking up " @@ -1239,6 +1270,9 @@ void learned_something_new(tutorial_event_type seen_what, int x, int y) break; case TUT_SEEN_SHOP: +#ifdef USE_TILES + tile_place_cursor(ep.x-1,ep.y-1,true); +#endif text << "That " #ifndef USE_TILE "" << stringize_glyph(get_screen_glyph(x,y)) @@ -1251,6 +1285,9 @@ void learned_something_new(tutorial_event_type seen_what, int x, int y) if (you.num_turns < 1) return; +#ifdef USE_TILES + tile_place_cursor(ep.x-1,ep.y-1,true); +#endif text << "That " #ifndef USE_TILE "" << stringize_glyph(get_screen_glyph(x,y)) << " " @@ -1536,6 +1573,9 @@ void learned_something_new(tutorial_event_type seen_what, int x, int y) break; case TUT_MONSTER_BRAND: +#ifdef USE_TILE + tile_place_cursor(ep.x-1,ep.y-1,true); +#endif text << "That monster looks a bit unusual. You might wish to examine " "it a bit more closely by pressing x and moving " "the cursor onto its square."; @@ -2197,12 +2237,8 @@ bool tutorial_monster_interesting(const monsters *mons) return true; // highlighted in some way - if (mons_friendly(mons) && Options.friend_brand != CHATTR_NORMAL - || mons_looks_stabbable(mons) && Options.stab_brand != CHATTR_NORMAL - || mons_looks_distracted(mons) && Options.may_stab_brand != CHATTR_NORMAL) - { + if (mons_is_highlighted(mons)) return true; - } // monster is (seriously) out of depth if (you.level_type == LEVEL_DUNGEON && @@ -2247,6 +2283,7 @@ void tutorial_describe_monster(const monsters *mons) if (mons->has_ench(ENCH_BERSERK)) ostr << "A berserking monster is bloodthirsty and fighting madly.\n"; + // monster is highlighted if (mons_friendly(mons)) { ostr << "Friendly monsters will follow you around and attempt to aid " -- cgit v1.2.3-54-g00ecf