[BACK]Return to help.c CVS log [TXT][DIR] Up to [contributed] / early-roguelike / xrogue

Annotation of early-roguelike/xrogue/help.c, Revision 1.1.1.1

1.1       rubenllo    1: /*
                      2:     help.c  -  Routines having to do with help
                      3:
                      4:     XRogue: Expeditions into the Dungeons of Doom
                      5:     Copyright (C) 1991 Robert Pietkivitch
                      6:     All rights reserved.
                      7:
                      8:     Based on "Advanced Rogue"
                      9:     Copyright (C) 1984, 1985 Michael Morgan, Ken Dalka and AT&T
                     10:     All rights reserved.
                     11:
                     12:     Based on "Rogue: Exploring the Dungeons of Doom"
                     13:     Copyright (C) 1980, 1981 Michael Toy, Ken Arnold and Glenn Wichman
                     14:     All rights reserved.
                     15:
                     16:     See the file LICENSE.TXT for full copyright and licensing information.
                     17: */
                     18:
                     19: #include <curses.h>
                     20: #include <ctype.h>
                     21: #include "mach_dep.h"
                     22: #include "rogue.h"
                     23:
                     24: /*
                     25:  * Give character descripts
                     26:  */
                     27:
                     28: static char *game_fighter = "Strength is the main attribute of the Fighter.  \
                     29: He can wield any weapon and the two-handed sword is his weapon of choice.  He \
                     30: can also wear any type of armor.  Plate armor being the best choice and \
                     31: leather armor the worst.  The Fighter is  able to sense both traps and gold \
                     32: at higher experience levels.  His natural     quest item is the Axe of Aklad.  \
                     33: Due to his superior form, the Fighter usually  receives more hit-points per \
                     34: new experience level than the other characters.    The Fighter is neither good \
                     35: or evil; he is a neutral character.  The default    attribute values of the \
                     36: Fighter are: Int=7, Str=16, Wis=7, Dxt=16, Con=17, and  Chr=11.  Default gold \
                     37: amount is 2000 pieces and default hit-points are 24.";
                     38:
                     39: static char *game_thief = "Dexterity is the main attribute of the Thief.  His \
                     40: stealth allows him to move   quietly, thus disturbing less monsters.  He can \
                     41: sense traps and gold and can    take (steal) things from the monsters.  The \
                     42: Thief can not wield the two-handed  sword so the bastard sword is his weapon \
                     43: of choice.  He can only wear studded   leather armor.  The Thief's natural \
                     44: quest item is the Daggers of Musty Doit.    With higher dexterity the Thief \
                     45: is able to \"backstab\" monsters, thereby killing them with a single blow.  \
                     46: His character type fluctuates between that of good,   neutral, and evil.  The \
                     47: default attribute values of the Thief are:  Int=7,      Str=14, Wis=7, Dxt=18, \
                     48: Con=17, and Chr=11.  Default gold amount is 2000 pieces  and default \
                     49: hit-points are 23.";
                     50:
                     51: static char *game_assassin = "Dexterity is the main attribute of the \
                     52: Assassin.  Like the Thief, he moves with an extra degree of stealth.  He can \
                     53: sense gold and steal things from monsters.  The ability to sense traps comes \
                     54: at higher experience levels.  The Assassin can not wield the two-handed sword \
                     55: and he can only wear studded leather armor.  The natural quest item of the \
                     56: Assassin is the Eye of Vecna.  He is also skilled in  the use of poison.  \
                     57: Higher dexterity enables him to \"assassinate\" monsters with a single blow.  \
                     58: The Assassin is aligned with the powers of evil.  The default   attribute \
                     59: values of the Assassin are: Int=7, Str=14, Wis=7, Dxt=18, Con=17, and \
                     60: Chr=11.  Default gold amount is 2000 pieces and default hit-points are 23.";
                     61:
                     62: static char *game_ranger = "Charisma is the main attribute of the Ranger who \
                     63: also has a secondary attribute of Intelligence.  Like the Magician, this \
                     64: gives him the ability to cast spells  which increases as he attains higher \
                     65: experience levels.  Like the Fighter, he   can wield any weapon and wear any \
                     66: armor.  The Ranger's natural quest item is    the Mandolin of Brian.  He is \
                     67: aligned with the powers of good.  Therefore, he   can be made to suffer and \
                     68: even become cursed by the very powers that allow him  to cast spells if he \
                     69: happens to cause the demise of a likewise good creature.   The default \
                     70: attribute values of the Ranger are: Int=11, Str=11, Wis=7, Dxt=16,  Con=16, \
                     71: and Chr=13.  Default gold amount is 2000 pieces and default hit-points  \
                     72: are 22.";
                     73:
                     74: static char *game_paladin = "Charisma is the main attribute of the Paladin \
                     75: who has a secondary attribute of  Wisdom.  Like the Cleric, this gives him \
                     76: the ability to offer prayers, receive  what his heart desires, and an ability \
                     77: to turn the undead.  This ability will   increase as he gains higher \
                     78: experience levels.  Like the Fighter, he can wield  any weapon and wear any \
                     79: armor.  The Ankh of Heil is the Paladin's natural quest item.  Like the \
                     80: Ranger, the Paladin is aligned with the powers of good.  This   can cause \
                     81: him to suffer and become cursed if he brings ruin to a likewise good  \
                     82: creature.  The default attribute values of the Paladin are:  Int=7, \
                     83: Str=11,     Wis=11, Dxt=16, Con=16, and Chr=13.  Default gold amount is \
                     84: 2000 pieces and     default hit-points are 22.";
                     85:
                     86: static char *game_druid = "Wisdom is the main attribute of the Druid.  This \
                     87: gives him the ability to chant secret words and mantras, which is much \
                     88: greater than that of the Monk.  The     Druid can not wield the two-handed or \
                     89: bastard swords but he can wear any armor. His natural quest item is the Quill \
                     90: of Nagrom.  Like the Magician and Cleric,   the Druid is aligned neutral.  He \
                     91: therefore, must rely upon his Wisdom and his  chanting ability in order to \
                     92: remain alive.  Likewise, he does not receive as    many new hit-points per \
                     93: new experience level.  The default attribute values of  the Druid are: Int=7, \
                     94: Str=10, Wis=14, Dxt=16, Con=15, and Chr=12.  Default gold amount is 2000 \
                     95: pieces and default hit-points are 21.";
                     96:
                     97: static char *game_monk = "Constitution is the main attribute of the Monk who \
                     98: has a secondary aspect of    Wisdom.  Like the Druid, this gives him the \
                     99: ability to chant mantras which will increase as he gains higher experience.  \
                    100: The Monk can not wield the two-handed  sword and he can not wear any armor.  \
                    101: The Cloak of Emori is the Monk's natural  quest item.  The Monk can also \
                    102: sense traps, though much less than the Thief or  Assassin.  He is the most \
                    103: healthy character.  Like the Ranger and Paladin, he   is aligned with the \
                    104: powers of good.  Therefore, he is made to suffer and can    become cursed if \
                    105: he kills a likewise good creature.  The default attribute      values of the \
                    106: Monk are: Int=7, Str=11, Wis=11, Dxt=16, Con=18, and Chr=11.      Default \
                    107: gold amount is 2000 pieces and default hit-points are 22.";
                    108:
                    109: static char *game_magician = "Intelligence is the main attribute of the \
                    110: Magician.  The Magician's ability to  cast spells is much greater than that \
                    111: of the Ranger.  He can not wield the two- handed or bastard swords, but he \
                    112: can wear any kind of armor.  His natural quest item is the Amulet of \
                    113: Stonebones.  The Magician is aligned neutral.  He must    rely upon his \
                    114: Intelligence and spell casting abilities to remain alive.  There- fore, he \
                    115: does not receive as many new hit-points per new experience level.  The \
                    116: default attribute values of the Magician are: Int=14, Str=10, Wis=7, \
                    117: Dxt=16,    Con=15, and Chr=12.  Default gold amount is 2000 pieces and \
                    118: default hit-points  are 21.";
                    119:
                    120: static char *game_cleric = "Wisdom is the main attribute of the Cleric.  The \
                    121: Cleric's ability to give or    offer prayers, receive their due, and affect \
                    122: the undead are much greater than   that of the Paladin.  Like the Magician, \
                    123: the Cleric can not wield the two-      handed or bastard swords, but he can \
                    124: wear any armor.  His natural quest item is the Horn of Geryon.  The Cleric \
                    125: is aligned neutral  and he must rely upon his   Wisdom and prayer ability to \
                    126: remain alive.  He therefore, does not receive as   many new hit-points per \
                    127: new experience level.  The default attribute values of  the Cleric are: Int=7, \
                    128: Str=10, Wis=14, Dxt=16, Con=15, and Chr=12.  The default gold amount is 2000 \
                    129: pieces and default hit-points are 21.";
                    130:
                    131:
                    132: static char *game_food ="There are three types of food, regular food rations, \
                    133: various fruits, and slime- molds.  Eating regular food will add 750 points to \
                    134: your current food level      [see the CTRL(E) command].  Eating fruit adds \
                    135: 300 points.  Certain fruits also  cure you, add an attribute point, add a \
                    136: hit-point, increase your armor, give    you additional prayer, chant, or spell \
                    137: casting abilities, or add experience     points.  Eating slime-mold (monster \
                    138: food) can make you ill, but they will add   100 points to your current food \
                    139: level.  If your food level points drop below    100 you will become weak.  You \
                    140: will faint and might die if they drop to 0 or    below.  At the other extreme, \
                    141: if your food level points reach 2000 (and above)  you will become satiated.  \
                    142: Risk eating more and you could choke to death.";
                    143:
                    144: /*
                    145: static char *game_monst ="To be updated.";
                    146: static char *game_potion ="To be updated...";
                    147: static char *game_scroll ="To be updated...";
                    148: static char *game_ring ="To be updated...";
                    149: static char *game_stick ="To be updated...";
                    150: static char *game_weapon ="To be updated...";
                    151: static char *game_armor ="To be updated...";
                    152: static char *game_miscm ="To be updated...";
                    153: static char *game_qitems ="To be updated...";
                    154: static char *game_dungeon ="To be updated...";
                    155: static char *game_traps ="To be updated...";
                    156: static char *game_mazes ="To be updated...";
                    157: static char *game_option ="To be updated...";
                    158: static char *game_begin ="To be updated...";
                    159: */
                    160:
                    161: /* help list */
                    162: static struct h_list helpstr[] = {
                    163:     { '?',     "    Print help" },
                    164:     { '/',     "    Identify object" },
                    165:     { '=',     "    Identify a screen character" },
                    166:     { ' ',     "" },
                    167:     { 'h',     "    Move left" },
                    168:     { 'j',     "    Move down" },
                    169:     { 'k',     "    Move up" },
                    170:     { 'l',     "    Move right" },
                    171:     { 'y',      "    Move up and left" },
                    172:     { 'u',        "    Move up and right" },
                    173:     { 'b',        "    Move down and left" },
                    174:     { 'n',        "    Move down and right" },
                    175:     { 'H',        "    Run left" },
                    176:     { 'J',        "    Run down" },
                    177:     { 'K',        "    Run up" },
                    178:     { 'L',        "    Run right" },
                    179:     { 'Y',        "    Run up & left" },
                    180:     { 'U',        "    Run up & right" },
                    181:     { 'B',        "    Run down & left" },
                    182:     { 'N',        "    Run down & right" },
                    183:     { ' ',        "" },
                    184:     { '>',        "    Go down a staircase" },
                    185:     { '<',        "    Go up a staircase" },
                    186:     { '\\',        "  Game descriptions" },
                    187:     { '.',        "   Rest for a while" },
                    188:     { '*',        "   Count gold pieces" },
                    189:     { 'a',        "   Affect the undead" },
                    190:     { 'A',        "   Choose artifact (equipage)" },
                    191:     { 'c',        "   Chant a mantra" },
                    192:     { 'C',        "   Cast a spell" },
                    193:     { 'd',        "   Drop something" },
                    194:     { 'D',        "   Dip something (into a pool)" },
                    195:     { 'e',        "   Eat food or fruit" },
                    196:     { 'f',        "<dir>  Forward until find something" },
                    197:     { 'F',        "   Frighten a monster" },
                    198:     { 'g',        "   Give food to monster" },
                    199:     { 'G',        "   Sense for gold" },
                    200:     { 'i',        "   Inventory" },
                    201:     { 'I',        "   Inventory (single item)" },
                    202:     { 'm',        "   Mark an object (specific)" },
                    203:     { 'o',        "   Examine and/or set options" },
                    204:     { 'O',        "   Character type and quest item" },
                    205:     { 'p',        "   Pray to the powers that be" },
                    206:     { 'P',        "   Pick up object(s)" },
                    207:     { 'q',        "   Quaff a potion" },
                    208:     { 'Q',        "   Quit the game" },
                    209:     { 'r',        "   Read a scroll" },
                    210:     { 's',        "   Search for a trap/secret door" },
                    211:     { 'S',        "   Save your game" },
                    212:     { 't',        "<dir>  Throw something" },
                    213:     { 'T',        "   Take off something" },
                    214:     { 'v',        "   Print program version" },
                    215:     { 'w',        "   Wield a weapon" },
                    216:     { 'W',        "   Wear something" },
                    217:     { 'X',        "   Sense for traps" },
                    218:     { 'z',        "<dir>  Zap a wand or staff" },
                    219:     { ' ',        "" },
                    220:     { '^',        "   Set a trap" },
                    221:     { '$',        "   Price an item (trading post)" },
                    222:     { '#',        "   Buy an item   (trading post)" },
                    223:     { '%',        "   Sell an item  (trading post)" },
                    224:     { '!',        "   Shell escape" },
                    225:     { ESC,        "   Cancel command (Esc)" },
                    226:     { ' ',        "" },
                    227:     { CTRL('B'),    " Current score (if you win)" },
                    228:     { CTRL('E'),    " Current food level" },
                    229:     { CTRL('L'),    " Redraw the screen" },
                    230:     { CTRL('N'),    " Name an object or a monster" },
                    231:     { CTRL('O'),    " Character affect status" },
                    232:     { CTRL('R'),    " Repeat last message" },
                    233:     { CTRL('T'),    "<dir>    Take (steal) from (direction)" },
                    234:     { CTRL('U'),    " Use a magic item" },
                    235:     { 0, "" }
                    236: } ;
                    237:
                    238: /* wizard help list */
                    239: static struct h_list wiz_help[] = {
                    240:     { ' ',        "" },
                    241:     { '+',        "   Random fortunes" },
                    242:     { 'M',        "   Make an object" },
                    243:     { 'V',        "   Display vlevel and turns" },
                    244:     { CTRL('A'),    " System activity" },
                    245:     { CTRL('C'),    " Move to another dungeon level" },
                    246:     { CTRL('D'),    " Go down 1 dungeon level" },
                    247:     { CTRL('F'),    " Display the entire level" },
                    248:     { CTRL('G'),    " Charge wands and staffs" },
                    249:     { CTRL('H'),    " Jump 9 experience levels" },
                    250:     { CTRL('I'),    " Inventory of level" },
                    251:     { CTRL('J'),    " Teleport somewhere" },
                    252:     { CTRL('K'),    " Identify an object" },
                    253:     { CTRL('M'),    " Recharge wand or staff" },
                    254:     { CTRL('P'),    " Toggle wizard status" },
                    255:     { CTRL('X'),    " Detect monsters" },
                    256:     { CTRL('Y'),    " Display food levels" },
                    257:     { 0, "" }
                    258: };
                    259:
                    260: /* item help list */
                    261: static struct item_list item_help[] = {
                    262:     { '@',   "   You (visible)" },
                    263:     { '_',   "   You (invisible)" },
                    264:     { ' ',   "" },
                    265:     { ':',   "   Food ration or fruit (eat)" },
                    266:     { '!',   "   Potion (quaff)" },
                    267:     { '?',   "   Scroll (read)" },
                    268:     { '=',   "   Ring (wear)" },
                    269:     { ')',   "   Weapon (wield)" },
                    270:     { ']',   "   Armor (wear)" },
                    271:     { '/',   "   Wand or staff (zap)" },
                    272:     { ';',   "   Magic item (use)" },
                    273:     { ',',   "   Artifact (quest item)" },
                    274:     { '*',   "   Gold or zapped missile" },
                    275:     { ' ',   "" },
                    276:     { '$',   "   Magical item in room" },
                    277:     { '>',   "   Blessed magical item" },
                    278:     { '<',   "   Cursed magical item" },
                    279:     { ' ',   " " },
                    280:     { '`',   "   Dart trap" },
                    281:     { '{',   "   Arrow trap" },
                    282:     { '}',   "   Bear trap" },
                    283:     { '~',   "   Teleport trap" },
                    284:     { '$',   "   Sleeping gas trap" },
                    285:     { '>',   "   Trap door" },
                    286:     { '<',   "   Outer region entrance" },
                    287:     { '\'',   "   Maze entrance" },
                    288:     { '^',   "   Trading post entrance" },
                    289:     { '"',   "   Magic pool or lake" },
                    290:     { ' ',   "   Solid rock or mountain" },
                    291:     { '.',   "   Floor of a room or meadow" },
                    292:     { '%',   "   Stairs (up or down)" },
                    293:     { '+',   "   Doorway" },
                    294:     { '&',   "   Secret doorway" },
                    295:     { '#',   "   Passage between rooms" },
                    296:     { '\\',   "   Forest" },
                    297:     { HORZWALL,   "   Horizontal wall of a room" },
                    298:     { VERTWALL,   "   Vertical wall of a room" },
                    299:     { 0, "" }
                    300: };
                    301:
                    302: void
                    303: ident_hero(void)
                    304: {
                    305:     bool doit = TRUE;
                    306:
                    307:     wclear(hw);
                    308:     wprintw(hw, "Characters, Items, and Game Descriptions:\n");
                    309:     wprintw(hw, "-----------------------------------------\n");
                    310:     wprintw(hw, "a) Fighter        m) Scrolls\n");
                    311:     wprintw(hw, "b) Thief          n) Rings\n");
                    312:     wprintw(hw, "c) Assassin       o) Wands and Staffs\n");
                    313:     wprintw(hw, "d) Ranger         p) Weapons\n");
                    314:     wprintw(hw, "e) Paladin        q) Armors\n");
                    315:     wprintw(hw, "f) Monk           r) Miscellaneous Magic Items\n");
                    316:     wprintw(hw, "g) Magician       s) Quest Items (Artifacts and Relics)\n");
                    317:     wprintw(hw, "h) Cleric         t) The Dungeon\n");
                    318:     wprintw(hw, "i) Druid          u) Traps\n");
                    319:     wprintw(hw, "j) Monsters       v) Mazes and Outer Regions\n");
                    320:     wprintw(hw, "k) Foods          w) Setting game options\n");
                    321:     wprintw(hw, "l) Potions        x) Starting out\n");
                    322:     wprintw(hw, "\nEnter a letter: ");
                    323:     draw(hw);
                    324:     while (doit) {
                    325:     switch (wgetch(cw)) {
                    326:        case EOF:
                    327:        case ESC:
                    328:         doit = FALSE;
                    329:        when 'a':
                    330:             wclear(hw);
                    331:             wprintw(hw, "Fighter Characteristics:");
                    332:             mvwaddstr(hw, 2, 0, game_fighter);
                    333:         draw(hw);
                    334:         doit = FALSE;
                    335:        when 'b':
                    336:             wclear(hw);
                    337:             wprintw(hw, "Thief Characteristics:");
                    338:             mvwaddstr(hw, 2, 0, game_thief);
                    339:         draw(hw);
                    340:         doit = FALSE;
                    341:        when 'c':
                    342:             wclear(hw);
                    343:             wprintw(hw, "Assassin Characteristics:");
                    344:             mvwaddstr(hw, 2, 0, game_assassin);
                    345:             draw(hw);
                    346:         doit = FALSE;
                    347:         when 'd':
                    348:             wclear(hw);
                    349:             wprintw(hw, "Ranger Characteristics:");
                    350:             mvwaddstr(hw, 2, 0, game_ranger);
                    351:             draw(hw);
                    352:         doit = FALSE;
                    353:         when 'e':
                    354:             wclear(hw);
                    355:             wprintw(hw, "Paladin Characteristics:");
                    356:             mvwaddstr(hw, 2, 0, game_paladin);
                    357:             draw(hw);
                    358:         doit = FALSE;
                    359:         when 'f':
                    360:             wclear(hw);
                    361:             wprintw(hw, "Monk Characteristics:");
                    362:             mvwaddstr(hw, 2, 0, game_monk);
                    363:             draw(hw);
                    364:         doit = FALSE;
                    365:         when 'g':
                    366:             wclear(hw);
                    367:             wprintw(hw, "Magician Characteristics:");
                    368:             mvwaddstr(hw, 2, 0, game_magician);
                    369:             draw(hw);
                    370:         doit = FALSE;
                    371:         when 'h':
                    372:             wclear(hw);
                    373:             wprintw(hw, "Cleric Characteristics:");
                    374:             mvwaddstr(hw, 2, 0, game_cleric);
                    375:             draw(hw);
                    376:         doit = FALSE;
                    377:         when 'i':
                    378:             wclear(hw);
                    379:             wprintw(hw, "Druid Characteristics:");
                    380:             mvwaddstr(hw, 2, 0, game_druid);
                    381:             draw(hw);
                    382:         doit = FALSE;
                    383:         when 'j':
                    384:             wclear(hw);
                    385:             wprintw(hw, "Monster Characteristics:");
                    386:             draw(hw);
                    387:         doit = FALSE;
                    388:         when 'k':
                    389:             wclear(hw);
                    390:             wprintw(hw, "Foods:");
                    391:             mvwaddstr(hw, 2, 0, game_food);
                    392:             draw(hw);
                    393:         doit = FALSE;
                    394:         when 'l':
                    395:             wclear(hw);
                    396:             wprintw(hw, "Potions:");
                    397:             draw(hw);
                    398:         doit = FALSE;
                    399:         when 'm':
                    400:             wclear(hw);
                    401:             wprintw(hw, "Scrolls:");
                    402:             draw(hw);
                    403:         doit = FALSE;
                    404:         when 'n':
                    405:             wclear(hw);
                    406:             wprintw(hw, "Rings:");
                    407:             draw(hw);
                    408:         doit = FALSE;
                    409:         when 'o':
                    410:             wclear(hw);
                    411:             wprintw(hw, "Wands and Staffs:");
                    412:             draw(hw);
                    413:         doit = FALSE;
                    414:         when 'p':
                    415:             wclear(hw);
                    416:             wprintw(hw, "Weapons:");
                    417:             draw(hw);
                    418:         doit = FALSE;
                    419:         when 'q':
                    420:             wclear(hw);
                    421:             wprintw(hw, "Armors:");
                    422:             draw(hw);
                    423:         doit = FALSE;
                    424:         when 'r':
                    425:             wclear(hw);
                    426:             wprintw(hw, "Miscellaneous Magic Items:");
                    427:             draw(hw);
                    428:         doit = FALSE;
                    429:         when 's':
                    430:             wclear(hw);
                    431:             wprintw(hw, "Quest Items (Artifacts and Relics):");
                    432:             draw(hw);
                    433:         doit = FALSE;
                    434:         when 't':
                    435:             wclear(hw);
                    436:             wprintw(hw, "The Dungeon:");
                    437:             draw(hw);
                    438:         doit = FALSE;
                    439:         when 'u':
                    440:             wclear(hw);
                    441:             wprintw(hw, "Traps:");
                    442:             draw(hw);
                    443:         doit = FALSE;
                    444:         when 'v':
                    445:             wclear(hw);
                    446:             wprintw(hw, "Mazes and Outer Regions:");
                    447:             draw(hw);
                    448:         doit = FALSE;
                    449:         when 'w':
                    450:             wclear(hw);
                    451:             wprintw(hw, "Setting game options:");
                    452:             draw(hw);
                    453:         doit = FALSE;
                    454:         when 'x':
                    455:             wclear(hw);
                    456:             wprintw(hw, "Starting out:");
                    457:             draw(hw);
                    458:         doit = FALSE;
                    459:         otherwise:
                    460:         doit = TRUE;
                    461:     }
                    462:     }
                    463:     wmove(hw, lines-1, 0);
                    464:     wprintw(hw, spacemsg);
                    465:     draw(hw);
                    466:     wait_for(' ');
                    467:     wclear(hw);
                    468:     draw(hw);
                    469:     wmove(cw, 0, 0);
                    470:     wclrtoeol(cw);
                    471:     status(FALSE);
                    472:     touchwin(cw);
                    473: }
                    474:
                    475: /*
                    476:  * Real Help
                    477:  */
                    478:
                    479: void
                    480: help(void)
                    481: {
                    482:     register struct h_list *strp = helpstr;
                    483:     register struct item_list *itemp = item_help;
                    484:     struct h_list *wizp = wiz_help;
                    485:     register char helpch;
                    486:     register int cnt;
                    487:
                    488:     msg("Character you want help for (* for commands, @ for items): ");
                    489:     helpch = wgetch(cw);
                    490:     mpos = 0;
                    491:     /*
                    492:      * If it's not a *, @, or +, then just print help string
                    493:      * for the character entered.
                    494:      */
                    495:     if (helpch != '*' && helpch != '@' && helpch != '+') {
                    496:         wmove(msgw, 0, 0);
                    497:         while (strp->h_ch) {
                    498:             if (strp->h_ch == helpch) {
                    499:                 msg("%s%s", unctrl(strp->h_ch), strp->h_desc);
                    500:                 return;
                    501:             }
                    502:             strp++;
                    503:         }
                    504:         if (wizard) {
                    505:             while (wizp->h_ch) {
                    506:                 if (wizp->h_ch == helpch) {
                    507:                     msg("%s%s", unctrl(wizp->h_ch), wizp->h_desc);
                    508:                     return;
                    509:                 }
                    510:                 wizp++;
                    511:             }
                    512:         }
                    513:         msg("Unknown command '%s'", unctrl(helpch));
                    514:         return;
                    515:     }
                    516:
                    517:     /* fortunes - but let's not say so - explicitly */
                    518:     if (helpch == '+') {
                    519:     msg("Meaningless command '+'");
                    520:     return;
                    521:     }
                    522:
                    523:     /*
                    524:      * Print help for everything else
                    525:      */
                    526:     if (helpch == '*') {
                    527:         wclear(hw);
                    528:         cnt = 0;
                    529:         while (strp->h_ch) {
                    530:             mvwaddstr(hw, cnt % 23, cnt > 22 ? 40 : 0, unctrl(strp->h_ch));
                    531:             waddstr(hw, strp->h_desc);
                    532:             strp++;
                    533:             if (++cnt >= 46 && strp->h_ch) {
                    534:                 wmove(hw, lines-1, 0);
                    535:                 wprintw(hw, morestr);
                    536:                 draw(hw);
                    537:                 wait_for(' ');
                    538:                 wclear(hw);
                    539:                 cnt = 0;
                    540:             }
                    541:         }
                    542:         if (wizard) {
                    543:             while (wizp->h_ch) {
                    544:                 mvwaddstr(hw, cnt % 23, cnt > 22 ? 40 : 0, unctrl(wizp->h_ch));
                    545:                 waddstr(hw, wizp->h_desc);
                    546:                 wizp++;
                    547:                 if (++cnt >= 46 && wizp->h_ch) {
                    548:                     wmove(hw, lines-1, 0);
                    549:                     wprintw(hw, morestr);
                    550:                     draw(hw);
                    551:                     wait_for(' ');
                    552:                     wclear(hw);
                    553:                     cnt = 0;
                    554:                 }
                    555:             }
                    556:         }
                    557:     }
                    558:     if (helpch == '@') {
                    559:         wclear(hw);
                    560:         cnt = 0;
                    561:         while (itemp->item_ch) {
                    562:             mvwaddstr(hw, cnt % 23, cnt > 22 ? 40 : 0, unctrl(itemp->item_ch));
                    563:             waddstr(hw, itemp->item_desc);
                    564:             itemp++;
                    565:             if (++cnt >= 46 && itemp->item_ch) {
                    566:                 wmove(hw, lines-1, 0);
                    567:                 wprintw(hw, morestr);
                    568:                 draw(hw);
                    569:                 wait_for(' ');
                    570:                 wclear(hw);
                    571:                 cnt = 0;
                    572:             }
                    573:         }
                    574:     }
                    575:     wmove(hw, lines-1, 0);
                    576:     wprintw(hw, spacemsg);
                    577:     draw(hw);
                    578:     wait_for(' ');
                    579:     wclear(hw);
                    580:     draw(hw);
                    581:     wmove(cw, 0, 0);
                    582:     wclrtoeol(cw);
                    583:     status(FALSE);
                    584:     touchwin(cw);
                    585: }
                    586:
                    587: /*
                    588:  * identify:
                    589:  *      Tell the player what a certain thing is.
                    590:  */
                    591:
                    592: void
                    593: identify(unsigned char ch)
                    594: {
                    595:     register char *str = NULL;
                    596:
                    597:     if (ch == 0) {
                    598:         msg("What do you want identified? ");
                    599:         ch = wgetch(cw);
                    600:         mpos = 0;
                    601:         if (ch == ESC)
                    602:         {
                    603:             msg("");
                    604:             return;
                    605:         }
                    606:     }
                    607:     if (isalpha(ch))
                    608:         msg("Use the \"=\" command to identify monsters. ");
                    609:     else switch(ch)
                    610:     {
                    611:         case VPLAYER:   str = "You (visibly)";
                    612:         when IPLAYER:   str = "You (invisibly)";
                    613:         when GOLD:      str = "Gold";
                    614:         when STAIRS:    str = (levtype == OUTSIDE) ? "Entrance to the dungeon"
                    615:                                                    : "Stairway";
                    616:         when DOOR:      str = "Doorway";
                    617:         when SECRETDOOR:str = "Secret door";
                    618:         when FLOOR:     str = (levtype == OUTSIDE) ? "Meadow" : "Room floor";
                    619:         when PASSAGE:   str = "Passage";
                    620:         when VERTWALL:
                    621:         case HORZWALL:
                    622:             str = (levtype == OUTSIDE) ? "Boundary of sector"
                    623:                                        : "Wall of a room";
                    624:         when POST:      str = "Trading post";
                    625:         when POOL:      str = (levtype == OUTSIDE) ? "Lake"
                    626:                                                    : "A shimmering pool";
                    627:         when TRAPDOOR:  str = "Trap door";
                    628:         when ARROWTRAP: str = "Arrow trap";
                    629:         when SLEEPTRAP: str = "Sleeping gas trap";
                    630:         when BEARTRAP:  str = "Bear trap";
                    631:         when TELTRAP:   str = "Teleport trap";
                    632:         when DARTTRAP:  str = "Dart trap";
                    633:         when MAZETRAP:  str = "Entrance to a maze";
                    634:         when WORMHOLE:  str = "Entrance to a worm hole";
                    635:         when FOREST:    str = "Forest";
                    636:         when ' ' :      str = (levtype == OUTSIDE) ? "Mountain"
                    637:                                                    : "Solid rock";
                    638:         when FOOD:      str = "Food";
                    639:         when POTION:    str = "Potion";
                    640:         when SCROLL:    str = "Scroll";
                    641:         when RING:      str = "Ring";
                    642:         when WEAPON:    str = "Weapon";
                    643:         when ARMOR:     str = "Armor";
                    644:         when MM:        str = "Miscellaneous magic";
                    645:         when STICK:     str = "Wand or staff";
                    646:         when RELIC:     str = "Artifact";
                    647:         otherwise:      str = "Unknown character";
                    648:     }
                    649:     if (!isalpha(ch))
                    650:         msg("%s     %s", unctrl(ch), str);
                    651: }
                    652:
                    653:

CVSweb