summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-01-19 20:35:24 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-01-19 20:35:24 +0000
commit467446254ef22c7d361764d1244a8d83fd285f95 (patch)
treebe45f553eae1bc1664d07980806537a2c78d2482 /crawl-ref/source
parentb305accdee3ce085e65639f874e59f9592f234d3 (diff)
downloadcrawl-ref-467446254ef22c7d361764d1244a8d83fd285f95.tar.gz
crawl-ref-467446254ef22c7d361764d1244a8d83fd285f95.zip
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
Diffstat (limited to 'crawl-ref/source')
-rw-r--r--crawl-ref/source/acr.cc10
-rw-r--r--crawl-ref/source/libgui.cc5
-rw-r--r--crawl-ref/source/libgui.h4
-rw-r--r--crawl-ref/source/tile1.cc8
-rw-r--r--crawl-ref/source/tutorial.cc51
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 <w>?</w> 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<GXM*GYM) )
buf2[count] = gmap_data[x][y];
- count += 1;
}
count += GXM - (gmap_max_x - gmap_min_x + 1);
}
diff --git a/crawl-ref/source/libgui.h b/crawl-ref/source/libgui.h
index 89331b6b37..f258d1b4f3 100644
--- a/crawl-ref/source/libgui.h
+++ b/crawl-ref/source/libgui.h
@@ -127,7 +127,7 @@ void put_colour_ch(int colour, unsigned ch);
void writeWChar(unsigned char *ch);
void puttext(int x, int y, int lx, int ly, unsigned char *buf,
- bool mono = false, int where = 0);
+ bool mono = false, int where = 0);
void ViewTextFile(const char *name);
#define textattr(x) textcolor(x)
@@ -156,7 +156,7 @@ int getch_ck();
#define EV_UNBUTTON 4
#define _NORMALCURSOR 1
-#define _NOCURSOR 0
+#define _NOCURSOR 0
#define textcolor_cake(col) textcolor((col)<<4 | (col))
diff --git a/crawl-ref/source/tile1.cc b/crawl-ref/source/tile1.cc
index 0fe3771d50..b1517af2ee 100644
--- a/crawl-ref/source/tile1.cc
+++ b/crawl-ref/source/tile1.cc
@@ -29,7 +29,7 @@ static FixedArray < unsigned char, GXM, GYM > 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)
"<lightgray>b<magenta> or <brown>K<magenta>. "
#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 = "<magenta>That ";
#ifndef USE_TILE
+ unsigned ch;
+ unsigned short col;
+ get_item_glyph(&item, &ch, &col);
+
text += colour_to_tag(col);
text += ch;
text += "<magenta>";
+#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 <w>g<magenta> or "
"<w>,<magenta> 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<char>(ch)
<< "<magenta> ";
+#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 (<w>><magenta>). 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 << "<magenta> ";
+#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 <w><<<magenta> and <w>><magenta>, "
@@ -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) << "^<magenta>"
+ text << "depicted by " << colour_to_tag(colour) << "^<magenta>";
#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<char>(ch) << "<magenta> ";
+#else
+ tile_place_cursor(ep.x-1,ep.y-1,true);
#endif
text << "is an altar. You can get information about it by pressing "
"<w>p<magenta> 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
"<yellow>" << 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
"<w>" << stringize_glyph(get_screen_glyph(x,y)) << "<magenta> "
@@ -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 <w>x<magenta> 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 "