From 1b7d49de6031caab5a0ef6210ebb3e7c6b625d5c Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Fri, 18 Jan 2008 11:49:07 +0000 Subject: Fix tutorial output for tile mode. For now, we simply suppress output of ASCII item/monster symbols. Also, fix non-tile compile and add a few comments to tiles. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3298 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/tutorial.cc | 219 ++++++++++++++++++++++++++++++------------- 1 file changed, 152 insertions(+), 67 deletions(-) (limited to 'crawl-ref/source/tutorial.cc') diff --git a/crawl-ref/source/tutorial.cc b/crawl-ref/source/tutorial.cc index df6456ff76..e82c899047 100644 --- a/crawl-ref/source/tutorial.cc +++ b/crawl-ref/source/tutorial.cc @@ -30,6 +30,9 @@ #include "spl-util.h" #include "stuff.h" #include "terrain.h" +#ifdef USE_TILE +#include "tiles.h" +#endif #include "view.h" static species_type get_tutorial_species(unsigned int type); @@ -420,6 +423,7 @@ static formatted_string tutorial_debug() } #endif // debug +#ifndef USE_TILE static formatted_string tutorial_map_intro() { std::string result; @@ -486,6 +490,7 @@ static formatted_string tutorial_message_intro() linebreak_string2(result,get_tutorial_cols()); return formatted_string::parse_block(result, false); } +#endif static void tutorial_movement_info() { @@ -502,8 +507,9 @@ static void tutorial_movement_info() // copied from display_mutations and adapted void tut_starting_screen() { - +#ifndef USE_TILE int y_pos; +#endif int MAX_INFO = 4; #ifdef TUTORIAL_DEBUG MAX_INFO++; @@ -512,29 +518,37 @@ void tut_starting_screen() for (int i=0; i<=MAX_INFO; i++) { +#ifndef USE_TILE // map window (starts at 1) or message window (starts at 18) y_pos = (i==1 || i==3 ? 18 : 1); gotoxy(1,y_pos); - +#endif if (i==0) clrscr(); if (i==0) tut_starting_info(get_tutorial_cols()).display(); +#ifdef USE_TILE + else if (i > 0 && i < 4) + continue; +#else else if (i==1) tutorial_map_intro().display(); else if (i==2) tutorial_stats_intro().display(); else if (i==3) tutorial_message_intro().display(); +#endif else if (i==4) tutorial_movement_info(); else { #ifdef TUTORIAL_DEBUG clrscr(); + #ifndef USE_TILE gotoxy(1,y_pos); + #endif tutorial_debug().display(); #else continue; @@ -836,6 +850,7 @@ void taken_new_item(unsigned char item_type) } } +#ifndef USE_TILE static std::string colour_to_tag(int col, bool closed = false) { std::string tag = "<"; @@ -846,6 +861,7 @@ static std::string colour_to_tag(int col, bool closed = false) return tag; } +#endif void tutorial_first_monster(const monsters &mon) { @@ -861,23 +877,31 @@ void tutorial_first_monster(const monsters &mon) viewwindow(true, false); } + std::string text = "That "; +#ifndef USE_TILE unsigned ch; unsigned short col; get_mons_glyph(&mon, &ch, &col); - std::string text = "That "; text += colour_to_tag(col); text += ch; text += " is a monster, usually depicted by a letter. Some typical " "early monsters look like r, g, " - "b or K. You can gain information " - "about it by pressing x and moving the cursor on the " - "monster." + "b or K. " +#else + // need to highlight monster + text += "monster is a "; + text += mon.name(DESC_PLAIN).c_str(); + text += ". Examples for typical early monsters are: rat, " + "giant newt, kobold and goblin. " +#endif + "You can gain information about it by pressing x and " + "moving the cursor on the monster." "\nTo attack this monster with your wielded weapon, just move into " "it."; print_formatted_paragraph(text, get_tutorial_cols(), MSGCH_TUTORIAL); - + if (Options.tutorial_type == TUT_RANGER_CHAR) { text = "However, as a hunter you will want to deal with it using your " @@ -907,21 +931,25 @@ void tutorial_first_item(const item_def &item) return; } - unsigned ch; - unsigned short col; - get_item_glyph(&item, &ch, &col); - - if (ch == ' ') // happens if monster standing on dropped corpse or item + // happens if monster standing on dropped corpse or item + if (mgrd[item.x][item.y] != NON_MONSTER) return; std::string text = "That "; +#ifndef USE_TILE text += colour_to_tag(col); text += ch; - text += " is an item. If you move there and press g or " - ", you will pick it up. Generally, items are shown by " - "non-letter symbols like %?!\"=()[. Once it is in your " - "inventory, you can drop it again with d. Several types " - "of objects will usually be picked up automatically." + text += ""; +#endif + text += "is an item. If you move there and press g or " + ", you will pick it up. " +#ifndef USE_TILE + "Generally, items are shown by " + "non-letter symbols like %?!\"=()[. " +#endif + "Once it is in your inventory, you can drop it again with " + "d. Several types of objects will usually be picked up " + "automatically." "\nAny time you view an item, you can read about its " "properties and description."; print_formatted_paragraph(text, get_tutorial_cols(), MSGCH_TUTORIAL); @@ -943,34 +971,48 @@ void learned_something_new(tutorial_event_type seen_what, int x, int y) return; std::ostringstream text; - unsigned ch; - unsigned short colour; +#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; - +#endif switch(seen_what) { case TUT_SEEN_POTION: - text << "You have picked up your first potion ('!'). " - "Use q to drink (quaff) it."; + text << "You have picked up your first potion" +#ifndef USE_TILE + " ('!')" +#endif + ". Use q to drink (quaff) it."; break; case TUT_SEEN_SCROLL: - text << "You have picked up your first scroll ('?'). " - "Type r to read it."; + text << "You have picked up your first scroll" +#ifndef USE_TILE + " ('?')" +#endif + ". Type r to read it."; break; case TUT_SEEN_WAND: - text << "You have picked up your first wand ('/'). " - "Type z to zap it."; + text << "You have picked up your first wand" +#ifndef USE_TILE + " ('/')" +#endif + ". Type z to zap it."; break; case TUT_SEEN_SPBOOK: + text << "You have picked up a book " +#ifndef USE_TILE + "('"; get_item_symbol(DNGN_ITEM_BOOK, &ch, &colour); - text << "You have picked up a book ('" - << static_cast(ch) - << "') that you can read by typing r. " + text << static_cast(ch) + << "') " +#endif + << "that you can read by typing r. " "If it's a spellbook you'll then be able to memorise " "spells via M and cast a memorised spell with " "Z."; @@ -993,7 +1035,11 @@ void learned_something_new(tutorial_event_type seen_what, int x, int y) break; case TUT_SEEN_WEAPON: - text << "This is the first weapon ('(') you've picked up. " + text << "This is the first weapon " +#ifndef USE_TILE + "('(') " +#endif + "you've picked up. " "Use w to wield it, but be aware that this weapon " "might train a different skill from your current one. You can " "view the weapon's properties with v."; @@ -1031,10 +1077,13 @@ void learned_something_new(tutorial_event_type seen_what, int x, int y) break; case TUT_SEEN_ARMOUR: - text << "This is the first piece of armour ('[') you've " - "picked up. Use W to wear it and T to " - "take it off again. You can view its properties with " - "v."; + text << "This is the first piece of armour " +#ifndef USE_TILE + "('[') " +#endif + "you've picked up. Use W to wear it and " + "T to take it off again. You can view its " + "properties with v."; if (you.species == SP_CENTAUR || you.species == SP_MINOTAUR) { @@ -1052,15 +1101,22 @@ void learned_something_new(tutorial_event_type seen_what, int x, int y) break; case TUT_SEEN_FOOD: - text << "You have picked up some food ('%'). You can eat it " - "by typing e."; + text << "You have picked up some food" +#ifndef USE_TILE + " ('%')" +#endif + ". You can eat it by typing e."; break; case TUT_SEEN_CARRION: - text << "You have picked up a corpse ('%'). When a corpse " - "is lying on the ground, you can Dissect with a " - "sharp implement. Once hungry you can eat the " - "resulting chunks (though they may not be healthy)."; + text << "You have picked up a corpse" +#ifndef USE_TILE + " ('%')" +#endif + ". When a corpse is lying on the ground, you can " + "Dissect with a sharp implement. Once hungry you " + "can eat the resulting chunks (though they may " + "not be healthy)."; if (god_likes_butchery(you.religion)) { @@ -1074,11 +1130,17 @@ void learned_something_new(tutorial_event_type seen_what, int x, int y) break; case TUT_SEEN_JEWELLERY: - text << "You have picked up a a piece of jewellery, either a ring " - "('=') or an amulet ('\"'). Type " - "P to put it on and R to remove it. You " - "can view it with v although often magic is " - "necessary to reveal its true nature."; + text << "You have picked up a a piece of jewellery, either a ring" +#ifndef USE_TILE + << " ('=')" +#endif + << " or an amulet" +#ifndef USE_TILE + << " ('\"')" +#endif + << ". Type P to put it on and R to remove " + "it. You can view it with v although often magic " + "is necessary to reveal its true nature."; break; case TUT_SEEN_MISC: @@ -1088,11 +1150,14 @@ void learned_something_new(tutorial_event_type seen_what, int x, int y) break; case TUT_SEEN_STAFF: + text << "You have picked up a magic staff or a rod" +#ifndef USE_TILE + ", both of which are represented by '"; get_item_symbol(DNGN_ITEM_STAVE, &ch, &colour); - text << "You have picked up a magic staff or a rod, both of which are " - "represented by '" - << static_cast(ch) - << "'. Both must be wielded to be of use. " + text << static_cast(ch) + << "'" +#endif + ". Both must be wielded to be of use. " "Magicians use staves to increase their power in certain spell " "schools. By contrast, a rod allows the casting of certain " "spells even without magic knowledge simply by " @@ -1106,12 +1171,16 @@ void learned_something_new(tutorial_event_type seen_what, int x, int y) if (you.num_turns < 1) return; + text << "These "; +#ifndef USE_TILE object = env.show[ex][ey]; colour = env.show_col[ex][ey]; get_item_symbol( object, &ch, &colour ); - text << "The " << colour_to_tag(colour) << static_cast(ch) - << " are some downstairs. You can enter the next (deeper) " + text << colour_to_tag(colour) << static_cast(ch) + << " "; +#endif + text << "are some downstairs. You can enter the next (deeper) " "level by following them down (>). To get back to " "this level again, press << while standing on the " "upstairs."; @@ -1122,55 +1191,71 @@ void learned_something_new(tutorial_event_type seen_what, int x, int y) if (you.num_turns < 1) return; + text << "These "; +#ifndef USE_TILE object = env.show[ex][ey]; colour = env.show_col[ex][ey]; get_item_symbol( object, &ch, &colour ); - - text << "These " << colour_to_tag(colour) << static_cast(ch); + + text << colour_to_tag(colour) << static_cast(ch); if (ch == '<') text << "<"; - text << " are some kind of escape hatch. You can use them to " + text << " "; +#endif + text << "are some kind of escape hatch. You can use them to " "quickly leave a level with << and >, " "respectively, but will usually be unable to return right away."; break; case TUT_SEEN_TRAP: + text << "Oops... you just triggered a trap. An unwary adventurer will " + "occasionally stumble into one of these nasty constructions "; +#ifndef USE_TILE object = env.show[ex][ey]; colour = env.show_col[ex][ey]; get_item_symbol( object, &ch, &colour ); if (ch == ' ' || colour == BLACK) colour = LIGHTCYAN; - text << "Oops... you just triggered a trap. An unwary adventurer will " - "occasionally stumble into one of these nasty constructions " - "depicted by " << colour_to_tag(colour) << "^. They " - "can do physical damage (with darts or needles, for example) " - "or have other, more magical effects, like teleportation."; + 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 " + "teleportation."; break; case TUT_SEEN_ALTAR: + text << "That "; +#ifndef USE_TILE object = env.show[ex][ey]; colour = env.show_col[ex][ey]; get_item_symbol( object, &ch, &colour ); - - text << "The " << colour_to_tag(colour) << static_cast(ch) - << " is an altar. You can get information about it by pressing " + + text << colour_to_tag(colour) << static_cast(ch) << " "; +#endif + text << "is an altar. You can get information about it by pressing " "p while standing on the square. Before taking up " "the responding faith you'll be asked for confirmation."; break; case TUT_SEEN_SHOP: - text << "The " << stringize_glyph(get_screen_glyph(x,y)) - << " is a shop. You can enter it by typing " - "<<."; + text << "That " +#ifndef USE_TILE + "" << stringize_glyph(get_screen_glyph(x,y)) + << " " +#endif + "is a shop. You can enter it by typing <<."; break; case TUT_SEEN_DOOR: if (you.num_turns < 1) return; - text << "The " << stringize_glyph(get_screen_glyph(x,y)) - << " is a closed door. You can open it by walking into it. " + text << "That " +#ifndef USE_TILE + "" << stringize_glyph(get_screen_glyph(x,y)) << " " +#endif + "is a closed door. You can open it by walking into it. " "Sometimes it is useful to close a door. Do so by pressing " "c, followed by the direction."; break; -- cgit v1.2.3-54-g00ecf