[comp.sources.games] v11i085: larn - dungeon type adventure game, Part02/11

billr@saab.CNA.TEK.COM (Bill Randle) (12/19/90)

Submitted-by: routley@tle.ENET.DEC.COM (Kevin Routley)
Posting-number: Volume 11, Issue 85
Archive-name: larn/Part02
Environment: Unix, VMS, MS-DOS, termcap



#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of archive 2 (of 11)."
# Contents:  data.c display.c larn.opt larn.prj
# Wrapped by billr@saab on Tue Dec 18 10:14:15 1990
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'data.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'data.c'\"
else
echo shar: Extracting \"'data.c'\" \(31189 characters\)
sed "s/^X//" >'data.c' <<'END_OF_FILE'
X/*  data.c      Larn is copyrighted 1986 by Noah Morgan. */
X#define NODEFS
X#include "header.h"
X
X/*
X    class[c[LEVEL]-1] gives the correct name of the players experience level
X */
Xstatic char aa1[] = " mighty evil master";
Xstatic char aa2[] = "apprentice demi-god";
Xstatic char aa3[] = "  minor demi-god   ";
Xstatic char aa4[] = "  major demi-god   ";
Xstatic char aa5[] = "    minor deity    ";
Xstatic char aa6[] = "    major deity    "; 
Xstatic char aa7[] = "  novice guardian  ";
Xstatic char aa8[] = "apprentice guardian";
Xstatic char aa9[] = "    The Creator    ";
Xchar *class[]=
X{   "  novice explorer  ", "apprentice explorer", " practiced explorer",/*  -3*/
X    "   expert explorer ", "  novice adventurer", "     adventurer    ",/*  -6*/
X    "apprentice conjurer", "     conjurer      ", "  master conjurer  ",/*  -9*/
X    "  apprentice mage  ", "        mage       ", "  experienced mage ",/* -12*/
X    "     master mage   ", " apprentice warlord", "   novice warlord  ",/* -15*/
X    "   expert warlord  ", "   master warlord  ", " apprentice gorgon ",/* -18*/
X    "       gorgon      ", "  practiced gorgon ", "   master gorgon   ",/* -21*/
X    "    demi-gorgon    ", "    evil master    ", " great evil master ",/* -24*/
X      aa1       ,   aa1       ,   aa1       ,/* -27*/
X      aa1       ,   aa1       ,   aa1       ,/* -30*/
X      aa1       ,   aa1       ,   aa1       ,/* -33*/
X      aa1       ,   aa1       ,   aa1       ,/* -36*/
X      aa1       ,   aa1       ,   aa1       ,/* -39*/
X      aa2       ,   aa2       ,   aa2       ,/* -42*/
X      aa2       ,   aa2       ,   aa2       ,/* -45*/
X      aa2       ,   aa2       ,   aa2       ,/* -48*/
X      aa3       ,   aa3       ,   aa3       ,/* -51*/
X      aa3       ,   aa3       ,   aa3       ,/* -54*/
X      aa3       ,   aa3       ,   aa3       ,/* -57*/
X      aa4       ,   aa4       ,   aa4       ,/* -60*/
X      aa4       ,   aa4       ,   aa4       ,/* -63*/
X      aa4       ,   aa4       ,   aa4       ,/* -66*/
X      aa5       ,   aa5       ,   aa5       ,/* -69*/
X      aa5       ,   aa5       ,   aa5       ,/* -72*/
X      aa5       ,   aa5       ,   aa5       ,/* -75*/
X      aa6       ,   aa6       ,   aa6       ,/* -78*/
X      aa6       ,   aa6       ,   aa6       ,/* -81*/
X      aa6       ,   aa6       ,   aa6       ,/* -84*/
X      aa7       ,   aa7       ,   aa7       ,/* -87*/
X      aa8       ,   aa8       ,   aa8       ,/* -90*/
X      aa8       ,   aa8       ,   aa8       ,/* -93*/
X    "  earth guardian   ", "   air guardian    ", "   fire guardian   ",/* -96*/
X    "  water guardian   ", "  time guardian    ", " ethereal guardian ",/* -99*/
X      aa9       ,   aa9       ,   aa9       ,/* -102*/
X};
X
X/*
X    table of experience needed to be a certain level of player
X    skill[c[LEVEL]] is the experience required to attain the next level
X */
X#define MEG 1000000
Xlong skill[] = {
X0, 10, 20, 40, 80, 160, 320, 640, 1280, 2560, 5120,                  /*  1-11 */
X10240, 20480, 40960, 100000, 200000, 400000, 700000, 1*MEG,          /* 12-19 */
X2*MEG,3*MEG,4*MEG,5*MEG,6*MEG,8*MEG,10*MEG,                          /* 20-26 */
X12*MEG,14*MEG,16*MEG,18*MEG,20*MEG,22*MEG,24*MEG,26*MEG,28*MEG,      /* 27-35 */
X30*MEG,32*MEG,34*MEG,36*MEG,38*MEG,40*MEG,42*MEG,44*MEG,46*MEG,      /* 36-44 */
X48*MEG,50*MEG,52*MEG,54*MEG,56*MEG,58*MEG,60*MEG,62*MEG,64*MEG,      /* 45-53 */
X66*MEG,68*MEG,70*MEG,72*MEG,74*MEG,76*MEG,78*MEG,80*MEG,82*MEG,      /* 54-62 */
X84*MEG,86*MEG,88*MEG,90*MEG,92*MEG,94*MEG,96*MEG,98*MEG,100*MEG,     /* 63-71 */
X105*MEG,110*MEG,115*MEG,120*MEG, 125*MEG, 130*MEG, 135*MEG, 140*MEG, /* 72-79 */
X145*MEG,150*MEG,155*MEG,160*MEG, 165*MEG, 170*MEG, 175*MEG, 180*MEG, /* 80-87 */
X185*MEG,190*MEG,195*MEG,200*MEG, 210*MEG, 220*MEG, 230*MEG, 240*MEG, /* 88-95 */
X250*MEG,260*MEG,270*MEG,280*MEG, 290*MEG, 300*MEG                    /* 96-101*/
X};
X#undef MEG
X
Xchar *lpbuf,*lpnt,*inbuffer,*lpend; /* input/output pointers to the buffers */
X# ifdef MSDOS
XRAMBLOCK *ramblks;
XDISKBLOCK *diskblks;
X# else
Xstruct cel *cell;   /*  pointer to the dungeon storage  */
X# endif
Xshort hitp[MAXX][MAXY];     /*  monster hp on level     */
Xshort iarg[MAXX][MAXY]; /*  arg for the item array  */
Xchar item[MAXX][MAXY];  /*  objects in maze if any  */
Xchar know[MAXX][MAXY];  /*  1 or 0 if here before   */
Xchar mitem[MAXX][MAXY]; /*  monster item array      */
Xchar stealth[MAXX][MAXY];   /*  0=sleeping 1=awake monst*/
Xchar iven[26];          /*  inventory for player            */
Xshort ivenarg[26];      /*  inventory for player            */
Xchar lastmonst[40];     /*  this has the name of the current monster    */
Xchar beenhere[MAXLEVEL+MAXVLEVEL];  /*  1 if have been on this level */
Xchar VERSION=VER;   /*  this is the present version # of the program    */
Xchar SUBVERSION=SUBVER;
Xchar nosignal=0;    /* set to 1 to disable the signals from doing anything */
Xchar predostuff=0;  /*  2 means that the trap handling routines must do a
X                        showplayer() after a trap.  0 means don't showplayer()
X                        0 - we are in create player screen
X                        1 - we are in welcome screen
X                        2 - we are in the normal game   */
Xchar loginname[20];     /* players login name */
Xchar logname[LOGNAMESIZE];  /* players name storage for scoring             */
Xchar sex=1;             /*  default is a man  0=woman                       */
Xchar boldon=1;          /*  1=bold objects  0=inverse objects               */
Xchar ckpflag=0;         /*  1 if want checkpointing of game, 0 otherwise    */
Xchar cheat=0;           /*  1 if the player has fudged save file            */
Xchar level=0;           /*  cavelevel player is on = c[CAVELEVEL]           */
Xchar wizard=0;          /*  the wizard mode flag                            */
Xshort lastnum=0;        /* the number of the monster last hitting player    */
Xshort hitflag=0;        /*  flag for if player has been hit when running    */
Xshort hit2flag=0;       /*  flag for if player has been hit when running    */
Xshort hit3flag=0;       /*  flag for if player has been hit flush input     */
Xshort playerx,playery;  /*  the room on the present level of the player     */
Xshort lastpx,lastpy;    /*  0 --- MAXX-1  or  0 --- MAXY-1                  */
Xshort oldx,oldy;
Xchar  prayed = 1;       /* did player pray at an altar (command mode)? needs
X                           to be saved, but I don't want to add incompatibility
X                           right now.  KBR 1/11/90 */
Xshort lasthx=0,lasthy=0;/* location of monster last hit by player       */
Xshort nobeep=0;         /* true if program is not to beep                   */
Xunsigned long lrandx=33601;  /*  the random number seed                      */
Xlong initialtime=0;         /* time playing began                           */
Xlong gtime=0;               /*  the clock for the game                      */
Xlong outstanding_taxes=0;   /* present tax bill from score file             */
Xlong c[100],cbak[100];      /*  the character description arrays            */
Xint enable_scroll=0;        /* constant for enabled/disabled scrolling regn */
Xchar aborted[] = " aborted";
Xstruct sphere *spheres=0; /*pointer to linked list for spheres of annihilation*/
Xchar *levelname[]=
X{ " H"," 1"," 2"," 3"," 4"," 5"," 6"," 7"," 8"," 9","10","V1","V2","V3" };
X
Xchar original_objnamelist[]=".ATOP<^F&^+M=>^$$f*OD#~][[)))(((||||||||{?!BC}o:;,@@@@EVV))([[]]](^.[H***.^^.S.tsTLc,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,";
Xchar hacklike_objnamelist[]=".:\\_^<_{%^6|2>_55}$'+#~[[[))))))========-?!?&~~~~~****899)))[[[[[)^.[1$$$.^^.3./0\\4,____________________________________________";
Xchar objnamelist[MAXOBJECT+1];
Xchar monstnamelist[]=".BGHJKOScjtAELNQRZabhiCTYdegmvzFWflorXV.pqsyUkMwDDPxnDDuD........,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,";
Xchar floorc = '.';
Xchar wallc = '#';
Xchar boldobjects = FALSE ;
Xchar auto_pickup = FALSE ;
X
X# ifdef MSDOS
X  int DECRainbow, keypad;
X# endif
X
Xchar *objectname[]=
X{ 0,"a holy altar","a handsome jewel encrusted throne","the orb","a pit",
X  "a staircase leading upwards","an elevator going up","a bubbling fountain",
X  "a great marble statue","a teleport trap","the college of Larn",
X  "a mirror","the DND store","a staircase going down","an elevator going down",
X  "the bank of Larn","the 5th branch of the Bank of Larn",
X  "a dead fountain","gold","an open door","a closed door",
X  "a wall","The Eye of Larn","plate mail","chain mail","leather armor",
X  "a sword of slashing","Bessman's flailing hammer","a sunsword",
X  "a two handed sword","a spear","a dagger",
X  "ring of extra regeneration","a ring of regeneration","a ring of protection",
X  "an energy ring","a ring of dexterity","a ring of strength",
X  "a ring of cleverness","a ring of increase damage","a belt of striking",
X  "a magic scroll","a magic potion","a book","a chest",
X  "an amulet of invisibility","an orb of dragon slaying",
X  "a scarab of negate spirit","a cube of undead control",
X  "device of theft prevention","a brilliant diamond","a ruby",
X  "an enchanting emerald","a sparkling sapphire","the dungeon entrance",
X  "a volcanic shaft leaning downward","the base of a volcanic shaft",
X  "a battle axe","a longsword","a flail","ring mail","studded leather armor",
X  "splint mail","plate armor","stainless plate armor","a lance of death",
X  "an arrow trap","an arrow trap","a shield","your home",
X  "gold","gold","gold","a dart trap",
X  "a dart trap","a trapdoor","a trapdoor","the local trading post",
X  "a teleport trap", "a massive throne",
X  "a sphere of annihilation","a handsome jewel encrusted throne",
X  "the Larn Revenue Service","a fortune cookie","","","","","","",
X  "","","","","","","","","","","","","","","","","","","",""
X };
X
X
X/*
X *  for the monster data
X *
X *  array to do rnd() to create monsters <= a given level
X */
Xchar monstlevel[] = { 5, 11, 17, 22, 27, 33, 39, 42, 46, 50, 53, 56, 59 };
X
Xstruct monst monster[] = {
X/*  NAME            LV  AC  DAM ATT DEF GEN INT GOLD    HP  EXP
X----------------------------------------------------------------- */
X{ "",               0,  0,  0,  0,  0,   0,  3,   0,    0,  0   },
X{ "bat",            1,  0,  1,  0,  0,   0,  3,   0,    1,  1   },
X{ "gnome",          1,  10, 1,  0,  0,   0,  8,  30,    2,  2   },
X{ "hobgoblin",      1,  14, 2,  0,  0,   0,  5,  25,    3,  2   },
X{ "jackal",         1,  17, 1,  0,  0,   0,  4,   0,    1,  1   },
X{ "kobold",         1,  20, 1,  0,  0,   0,  7,  10,    1,  1   },
X
X{ "orc",            2,  12, 1,  0,  0,   0,  9,  40,    4,  2   },
X{ "snake",          2,  15, 1,  0,  0,   0,  3,   0,    3,  1   },
X{ "giant centipede",2,  14, 0,  4,  0,   0,  3,   0,    1,  2   },
X{ "jaculi",         2,  20, 1,  0,  0,   0,  3,   0,    2,  1   },
X{ "troglodyte",     2,  10, 2,  0,  0,   0,  5,  80,    4,  3   },
X{ "giant ant",      2,  8,  1,  4,  0,   0,  4,   0,    5,  5   },
X
X/*  NAME            LV  AC  DAM ATT DEF GEN INT GOLD    HP  EXP
X----------------------------------------------------------------- */
X
X{ "floating eye",   3,  8,  1,  0,  0,   0,  3,   0,     5,  2  },
X{ "leprechaun",     3,  3,  0,  8,  0,   0,  3,1500,    13, 45  },
X{ "nymph",          3,  3,  0,  14, 0,   0,  9,   0,    18, 45  },
X{ "quasit",         3,  5,  3,  0,  0,   0,  3,   0,    10, 15  },
X{ "rust monster",   3,  4,  0,  1,  0,   0,  3,   0,    18, 25  },
X{ "zombie",         3,  12, 2,  0,  0,   0,  3,   0,     6,  7  },
X
X{ "assassin bug",   4,  9,  3,  0,  0,   0,  3,   0,    20, 15  },
X{ "bugbear",        4,  5,  4,  15, 0,   0,  5,  40,    20, 35  },
X{ "hell hound",     4,  5,  2,  2,  0,   0,  6,   0,    16, 35  },
X{ "ice lizard",     4,  11, 2,  10, 0,   0,  6,  50,    16, 25  },
X{ "centaur",        4,  6,  4,  0,  0,   0, 10,  40,    24, 45  },
X
X/*  NAME            LV  AC  DAM ATT DEF GEN INT GOLD    HP  EXP
X----------------------------------------------------------------- */
X
X{ "troll",          5,  4,  5,  0,  0,   0,  9,  80,    50, 300 },
X{ "yeti",           5,  6,  4,  0,  0,   0,  5,  50,    35, 100 },
X{ "white dragon",   5,  2,  4,  5,  0,   0, 16, 500,    55, 1000},
X{ "elf",            5,  8,  1,  0,  0,   0, 15,  50,    22, 35  },
X{ "gelatinous cube",5,  9,  1,  0,  0,   0,  3,   0,    22, 45  },
X
X{ "metamorph",      6,  7,  3,  0,  0,   0,  3,  0,     30, 40  },
X{ "vortex",         6,  4,  3,  0,  0,   0,  3,  0,     30, 55  },
X{ "ziller",         6,  15, 3,  0,  0,   0,  3,  0,     30, 35  },
X{ "violet fungi",   6,  12, 3,  0,  0,   0,  3,  0,     38, 100 },
X{ "wraith",         6,  3,  1,  6,  0,   0,  3,  0,     30, 325 },
X{ "forvalaka",      6,  2,  5,  0,  0,   0,  7,  0,     50, 280 },
X
X/*  NAME            LV  AC  DAM ATT DEF GEN INT GOLD    HP  EXP
X----------------------------------------------------------------- */
X
X{ "lama nobe",      7,  7,  3,  0,  0,   0,  6,  0,     35, 80  },
X{ "osequip",        7,  4,  3,  16, 0,   0,  4,  0,     35, 100 },
X{ "rothe",          7,  15, 5,  0,  0,   0,  3,  100,   50, 250 },
X{ "xorn",           7,  0,  6,  0,  0,   0, 13,  0,     60, 300 },
X{ "vampire",        7,  3,  4,  6,  0,   0, 17,  0,     50, 1000},
X{ "invisible stalker",7,3,  6,  0,  0,   0,  5,  0,     50, 350 },
X
X{ "poltergeist",    8,  1,  4,  0,  0,   0,  3,  0,     50, 450 },
X{ "disenchantress", 8,  3,  0,  9,  0,   0,  3,  0,     50, 500 },
X{ "shambling mound",8,  2,  5,  0,  0,   0,  6,  0,     45, 400 },
X{ "yellow mold",    8,  12, 4,  0,  0,   0,  3,  0,     35, 250 },
X{ "umber hulk",     8,  3,  7,  11, 0,   0, 14,  0,     65, 600 },
X
X/*  NAME            LV  AC  DAM ATT DEF GEN INT GOLD    HP  EXP
X----------------------------------------------------------------- */
X
X{ "gnome king",     9,  -1, 10, 0,  0,   0, 18,  2000,  100,3000    },
X{ "mimic",          9,   5, 6,  0,  0,   0,  8,  0,     55, 99      },
X{ "water lord",     9, -10, 15, 7,  0,   0, 20,  0,     150,15000   },
X{ "bronze dragon",  9,   2, 9,  3,  0,   0, 16,  300,   80, 4000    },
X{ "green dragon",   9,   3, 8,  10, 0,   0, 15,  200,   70, 2500    },
X{ "purple worm",    9,  -1, 11, 0,  0,   0,  3,  100,   120,15000   },
X{ "xvart",          9,  -2, 12, 0,  0,   0, 13,  0,     90, 1000    },
X
X{ "spirit naga",    10, -20,12, 12, 0,   0, 23,  0,     95, 20000   },
X{ "silver dragon",  10, -1, 12, 3,  0,   0, 20,  700,   100,10000   },
X{ "platinum dragon",10, -5, 15, 13, 0,   0, 22,  1000,  130,24000   },
X{ "green urchin",   10, -3, 12, 0,  0,   0,  3,  0,     85, 5000    },
X{ "red dragon",     10, -2, 13, 3,  0,   0, 19,  800,   110,14000   },
X
X{ "type I demon lord",  12,-30, 18, 0,   0,  0, 20, 0,  140,50000   },
X{ "type II demon lord", 13,-30, 18, 0,   0,  0, 21, 0,  160,75000   },
X{ "type III demon lord",14,-30, 18, 0,   0,  0, 22, 0,  180,100000  },
X{ "type IV demon lord", 15,-35, 20, 0,   0,  0, 23, 0,  200,125000  },
X{ "type V demon lord",  16,-40, 22, 0,   0,  0, 24, 0,  220,150000  },
X{ "type VI demon lord", 17,-45, 24, 0,   0,  0, 25, 0,  240,175000  },
X{ "type VII demon lord",18,-70, 27, 6,   0,  0, 26, 0,  260,200000  },
X{ "demon prince",       25,-127,30, 6,   0,  0, 28, 0,  345,300000  }
X
X/*  NAME                LV  AC  DAM ATT DEF GEN INT GOLD    HP  EXP
X--------------------------------------------------------------------- */
X };
X
X/*  name array for scrolls      */
X
Xchar *scrollname[] = {
X"\0enchant armor",
X"\0enchant weapon",
X"\0enlightenment",
X"\0blank paper",
X"\0create monster",
X"\0create artifact",
X"\0aggravate monsters",
X"\0time warp",
X"\0teleportation",
X"\0expanded awareness",
X"\0haste monsters",
X"\0monster healing",
X"\0spirit protection",
X"\0undead protection",
X"\0stealth",
X"\0magic mapping",
X"\0hold monsters",
X"\0gem perfection",
X"\0spell extension",
X"\0identify",
X"\0remove curse",
X"\0annihilation",
X"\0pulverization",
X"\0life protection",
X"\0 ",
X"\0 ",
X"\0 ",
X"\0 "
X };
X
X/*  name array for magic potions    */
Xchar *potionname[] = {
X"\0sleep",
X"\0healing",
X"\0raise level",
X"\0increase ability",
X"\0wisdom",
X"\0strength",
X"\0raise charisma",
X"\0dizziness",
X"\0learning",
X"\0gold detection",
X"\0monster detection",
X"\0forgetfulness",
X"\0water",
X"\0blindness",
X"\0confusion",
X"\0heroism",
X"\0sturdiness",
X"\0giant strength",
X"\0fire resistance",
X"\0treasure finding",
X"\0instant healing",
X" cure dianthroritis",
X"\0poison",
X"\0see invisible",
X"\0 ",
X"\0 ",
X"\0 ",
X"\0 ",
X"\0 ",
X"\0 ",
X"\0 ",
X"\0 ",
X"\0 ",
X"\0 ",
X"\0 "
X };
X
X
X/*
X    spell data
X */
Xchar spelknow[SPNUM];
Xchar splev[] = { 1, 4, 9, 14, 18, 22, 26, 29, 32, 35, 37, 37, 37, 37, 37 };
X
Xchar *spelcode[]={
X    "pro",  "mle",  "dex",  "sle",  "chm",  "ssp",
X    "web",  "str",  "enl",  "hel",  "cbl",  "cre",  "pha",  "inv",
X    "bal",  "cld",  "ply",  "can",  "has",  "ckl",  "vpr",
X    "dry",  "lit",  "drl",  "glo",  "flo",  "fgr",
X    "sca",  "hld",  "stp",  "tel",  "mfi", /* 31 */
X    "sph",  "gen",  "sum",  "wtw",  "alt",  "per"
X };
X
Xchar *spelname[]={
X    "protection",               "magic missile",        "dexterity",
X    "sleep",                    "charm monster",        "sonic spear",
X
X    "web",                      "strength",             "enlightenment",
X    "healing",                  "cure blindness",       "create monster",
X    "phantasmal forces",        "invisibility",
X
X    "fireball",                 "cold",                 "polymorph",
X    "cancellation",             "haste self",           "cloud kill",
X    "vaporize rock",
X
X    "dehydration",              "lightning",            "drain life",
X    "invulnerability",          "flood",                "finger of death",
X
X    "scare monster",            "hold monster",         "time stop",
X    "teleport away",            "magic fire",
X
X    "sphere of annihilation",   "genocide",             "summon demon",
X    "walk through walls",       "alter reality",        "permanence",
X    ""
X };
X
Xchar *speldescript[]={
X/* 1 */
X    "generates a +2 protection field",
X    "creates and hurls a magic missile equivalent to a + 1 magic arrow",
X    "adds +2 to the casters dexterity",
X    "causes some monsters to go to sleep",
X    "some monsters may be awed at your magnificence",
X    "causes your hands to emit a screeching sound toward what they point",
X/* 7 */
X    "causes strands of sticky thread to entangle an enemy",
X    "adds +2 to the casters strength for a short term",
X    "the caster becomes aware of things around him",
X    "restores some hp to the caster",
X    "restores sight to one so unfortunate as to be blinded",
X    "creates a monster near the caster appropriate for the location",
X    "creates illusions, and if believed, monsters die",
X    "the caster becomes invisible",
X/* 15 */
X    "makes a ball of fire that burns on what it hits",
X    "sends forth a cone of cold which freezes what it touches",
X    "you can find out what this does for yourself",
X    "negates the ability of a monster to use his special abilities",
X    "speeds up the casters movements",
X    "creates a fog of poisonous gas which kills all that is within it",
X    "this changes rock to air",
X/* 22 */
X    "dries up water in the immediate vicinity",
X    "you finger will emit a lightning bolt when this spell is cast",
X    "subtracts hit points from both you and a monster",
X    "this globe helps to protect the player from physical attack",
X    "this creates an avalanche of H2O to flood the immediate chamber",
X    "this is a holy spell and calls upon your god to back you up",
X/* 28 */
X    "terrifies the monster so that hopefully he wont hit the magic user",
X    "the monster is frozen in his tracks if this is successful",
X    "all movement in the caverns ceases for a limited duration",
X    "moves a particular monster around in the dungeon (hopefully away from you)",
X    "this causes a curtain of fire to appear all around you",
X/* 33 */
X    "anything caught in this sphere is instantly killed.  Warning -- dangerous",
X    "eliminates a species of monster from the game -- use sparingly",
X    "summons a demon who hopefully helps you out",
X    "allows the player to walk through walls for a short period of time",
X    "god only knows what this will do",
X    "makes a character spell permanent, i. e. protection, strength, etc.",
X    ""
X };
X
Xchar spelweird[MAXMONST+8][SPNUM] = {
X/*                      p m d s c s    w s e h c c p i    b c p c h c v    d l d g f f    s h s t m    s g s w a p */
X/*                      r l e l h s    e t n e b r h n    a l l a a k p    r i r l l g    c l t e f    p e u t l e */
X/*                      o e x e m p    b r l l l e a v    l d y n s l r    y t l o o r    a d p l i    h n m w t r */
X    
X
X/*            bat */ {  0,0,0,0,0,0,   0,0,0,0,0,0,0,0,   0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
X/*          gnome */ {  0,0,0,0,0,0,   0,0,0,0,0,0,0,5,   0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
X/*      hobgoblin */ {  0,0,0,0,0,0,   0,0,0,0,0,0,0,0,   0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
X/*         jackal */ {  0,0,0,0,0,0,   0,0,0,0,0,0,0,0,   0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
X/*         kobold */ {  0,0,0,0,0,0,   0,0,0,0,0,0,0,5,   0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
X
X/*            orc */ {  0,0,0,0,0,0,   0,0,0,0,0,0,0,0,   0,0,0,0,0,0,0,   4,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
X/*          snake */ {  0,0,0,0,0,0,   0,0,0,0,0,0,0,0,   0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
X/*giant centipede */ {  0,0,0,0,0,0,   0,0,0,0,0,0,0,0,   0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
X/*         jaculi */ {  0,0,0,0,0,0,   0,0,0,0,0,0,0,0,   0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
X/*     troglodyte */ {  0,0,0,0,0,0,   0,0,0,0,0,0,0,0,   0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
X
X/*      giant ant */ {  0,0,0,0,0,0,   0,0,0,0,0,0,0,0,   0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
X/*   floating eye */ {  0,0,0,0,0,0,   0,0,0,0,0,0,0,0,   0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
X/*     leprechaun */ {  0,0,0,0,0,0,   0,0,0,0,0,0,0,0,   0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
X/*          nymph */ {  0,0,0,0,0,0,   0,0,0,0,0,0,0,0,   0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
X/*         quasit */ {  0,0,0,0,0,0,   0,0,0,0,0,0,0,0,   0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
X
X/*   rust monster */ {  0,0,0,0,0,0,   0,0,0,0,0,0,0,0,   0,0,0,0,0,0,0,   4,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
X/*         zombie */ {  0,0,0,8,0,4,   0,0,0,0,0,0,0,0,   0,0,0,0,0,4,0,   4,0,0,0,0,4,   0,0,0,0,0,   0,0,0,0,0,0 },
X/*   assassin bug */ {  0,0,0,0,0,0,   0,0,0,0,0,0,0,0,   0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
X/*        bugbear */ {  0,0,0,0,0,0,   0,0,0,0,0,0,0,5,   0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
X/*     hell hound */ {  0,6,0,0,0,0,   12,0,0,0,0,0,0,0,  0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
X
X/*     ice lizard */ {  0,0,0,0,0,0,   11,0,0,0,0,0,0,0,  0,15,0,0,0,0,0,  0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
X/*        centaur */ {  0,0,0,0,0,0,   0,0,0,0,0,0,0,0,   0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
X/*          troll */ {  0,7,0,0,0,0,   0,0,0,0,0,0,0,5,   0,0,0,0,0,0,0,   4,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
X/*           yeti */ {  0,0,0,0,0,0,   0,0,0,0,0,0,0,0,   0,15,0,0,0,0,0,  0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
X/*   white dragon */ {  0,0,0,0,0,0,   0,0,0,0,0,0,14,0,  0,15,0,0,0,0,0,  4,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
X
X/*            elf */ {  0,0,0,0,0,0,   0,0,0,0,0,0,14,5,  0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
X/*gelatinous cube */ {  0,0,0,0,0,0,   2,0,0,0,0,0,0,0,   0,0,0,0,0,4,0,   0,0,0,0,0,4,   0,0,0,0,0,   0,0,0,0,0,0 },
X/*      metamorph */ {  0,13,0,0,0,0,  2,0,0,0,0,0,0,0,   0,0,0,0,0,4,0,   4,0,0,0,0,4,   0,0,0,0,0,   0,0,0,0,0,0 },
X/*         vortex */ {  0,13,0,0,0,10, 1,0,0,0,0,0,0,0,   0,0,0,0,0,4,0,   4,0,0,0,4,4,   0,0,0,0,0,   0,0,0,0,0,0 },
X/*         ziller */ {  0,0,0,0,0,0,   0,0,0,0,0,0,0,0,   0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
X
X/*   violet fungi */ {  0,0,0,0,0,0,   0,0,0,0,0,0,0,0,   0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
X/*         wraith */ {  0,0,0,8,0,4,   0,0,0,0,0,0,0,0,   0,0,0,0,0,4,0,   4,0,0,0,0,4,   0,0,0,0,0,   0,0,0,0,0,0 },
X/*      forvalaka */ {  0,0,0,0,0,0,   0,0,0,0,0,0,0,5,   0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
X/*      lama nobe */ {  0,0,0,0,0,0,   0,0,0,0,0,0,0,0,   0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
X/*        osequip */ {  0,0,0,0,0,0,   0,0,0,0,0,0,0,0,   0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
X
X/*          rothe */ {  0,7,0,0,0,0,   0,0,0,0,0,0,0,5,   0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
X/*           xorn */ {  0,7,0,0,0,0,   0,0,0,0,0,0,0,5,   0,0,0,0,0,0,0,   4,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
X/*        vampire */ {  0,0,0,8,0,4,   0,0,0,0,0,0,0,0,   0,0,0,0,0,4,0,   0,0,0,0,0,4,   0,0,0,0,0,   0,0,0,0,0,0 },
X/*invisible staker*/ {  0,0,0,0,0,0,   1,0,0,0,0,0,0,0,   0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
X/*    poltergeist */ {  0,13,0,8,0,4,  1,0,0,0,0,0,0,0,   0,4,0,0,0,4,0,   4,0,0,0,4,4,   0,0,0,0,0,   0,0,0,0,0,0 },
X
X/* disenchantress */ {  0,0,0,8,0,0,   0,0,0,0,0,0,0,0,   0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
X/*shambling mound */ {  0,0,0,0,0,10,  0,0,0,0,0,0,0,0,   0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
X/*    yellow mold */ {  0,0,0,8,0,0,   1,0,0,0,0,0,4,0,   0,0,0,0,0,4,0,   0,0,0,0,0,4,   0,0,0,0,0,   0,0,0,0,0,0 },
X/*     umber hulk */ {  0,7,0,0,0,0,   0,0,0,0,0,0,0,5,   0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
X/*     gnome king */ {  0,7,0,0,3,0,   0,0,0,0,0,0,0,5,   0,0,9,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
X
X/*          mimic */ {  0,0,0,0,0,0,   0,0,0,0,0,0,0,0,   0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
X/*     water lord */ {  0,13,0,8,3,4,  1,0,0,0,0,0,0,0,   0,0,9,0,0,4,0,   0,0,0,0,16,4,  0,0,0,0,0,   0,0,0,0,0,0 },
X/*  bronze dragon */ {  0,7,0,0,0,0,   0,0,0,0,0,0,0,0,   0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
X/*   green dragon */ {  0,7,0,0,0,0,   11,0,0,0,0,0,0,0,  0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
X/*    purple worm */ {  0,0,0,0,0,0,   0,0,0,0,0,0,0,0,   0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
X
X/*          xvart */ {  0,0,0,0,0,0,   0,0,0,0,0,0,0,0,   0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
X/*    spirit naga */ {  0,13,0,8,3,4,  1,0,0,0,0,0,0,5,   0,4,9,0,0,4,0,   4,0,0,0,4,4,   0,0,0,0,0,   0,0,0,0,0,0 },
X/*  silver dragon */ {  0,6,0,9,0,0,   12,0,0,0,0,0,0,0,  0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
X/*platinum dragon */ {  0,7,0,9,0,0,   11,0,0,0,0,0,14,0, 0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
X/*   green urchin */ {  0,0,0,0,0,0,   0,0,0,0,0,0,0,0,   0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
X/*     red dragon */ {  0,6,0,0,0,0,   12,0,0,0,0,0,0,0,  0,0,0,0,0,0,0,   0,0,0,0,0,0,   0,0,0,0,0,   0,0,0,0,0,0 },
X
X/*                      p m d s c s    w s e h c c p i    b c p c h c v    d l d g f f    s h s t m    s g s w a p */
X/*                      r l e l h s    e t n e b r h n    a l l a a k p    r i r l l g    c l t e f    p e u t l e */
X/*                      o e x e m p    b r l l l e a v    l d y n s l r    y t l o o r    a d p l i    h n m w t r */
X
X/*     demon lord */ {  0,7,0,4,3,0,   1,0,0,0,0,0,14,5,  0,0,4,0,0,4,0,   4,0,0,0,4,4,   0,0,0,0,0,   9,0,0,0,0,0 },
X/*     demon lord */ {  0,7,0,4,3,0,   1,0,0,0,0,0,14,5,  0,0,4,0,0,4,0,   4,0,0,0,4,4,   0,0,0,0,0,   9,0,0,0,0,0 },
X/*     demon lord */ {  0,7,0,4,3,0,   1,0,0,0,0,0,14,5,  0,0,4,0,0,4,0,   4,0,0,0,4,4,   0,0,0,0,0,   9,0,0,0,0,0 },
X/*     demon lord */ {  0,7,0,4,3,0,   1,0,0,0,0,0,14,5,  0,0,4,0,0,4,0,   4,0,0,0,4,4,   0,0,0,0,0,   9,0,0,0,0,0 },
X/*     demon lord */ {  0,7,0,4,3,0,   1,0,0,0,0,0,14,5,  0,0,4,0,0,4,0,   4,0,0,0,4,4,   0,0,0,0,0,   9,0,0,0,0,0 },
X/*     demon lord */ {  0,7,0,4,3,0,   1,0,0,0,0,0,14,5,  0,0,4,0,0,4,0,   4,0,0,0,4,4,   0,0,0,0,0,   9,0,0,0,0,0 },
X/*     demon lord */ {  0,7,0,4,3,0,   1,0,0,0,0,0,14,5,  0,0,4,0,0,4,0,   4,0,0,0,4,4,   0,0,0,0,0,   9,0,0,0,0,0 },
X/*   demon prince */ {  0,7,0,4,3,9,   1,0,0,0,0,0,14,5,  0,0,4,0,0,4,0,   4,0,0,0,4,4,   4,0,0,0,4,   9,0,0,0,0,0 }
X
X };
X
Xchar *spelmes[] = { "",
X/*  1 */    "the web had no effect on the %s",
X/*  2 */    "the %s changed shape to avoid the web",
X/*  3 */    "the %s isn't afraid of you",
X/*  4 */    "the %s isn't affected",
X/*  5 */    "the %s can see you with his infravision",
X/*  6 */    "the %s vaporizes your missile",
X/*  7 */    "your missile bounces off the %s",
X/*  8 */    "the %s doesn't sleep",
X/*  9 */    "the %s resists",
X/* 10 */    "the %s can't hear the noise",
X/* 11 */    "the %s's tail cuts it free of the web",
X/* 12 */    "the %s burns through the web",
X/* 13 */    "your missiles pass right through the %s",
X/* 14 */    "the %s sees through your illusions",
X/* 15 */    "the %s loves the cold!",
X/* 16 */    "the %s loves the water!"
X };
X
X/*
X *  function to create scroll numbers with appropriate probability of 
X *  occurrence
X *
X *  0 - armor           1 - weapon      2 - enlightenment   3 - paper
X *  4 - create monster  5 - create item 6 - aggravate       7 - time warp
X *  8 - teleportation   9 - expanded awareness              10 - haste monst
X *  11 - heal monster   12 - spirit protection      13 - undead protection
X *  14 - stealth        15 - magic mapping          16 - hold monster
X *  17 - gem perfection 18 - spell extension        19 - identify
X *  20 - remove curse   21 - annihilation           22 - pulverization
X *  23 - life protection
X */
Xchar scprob[]= { 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3,
X    3, 3, 3, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 9, 9,
X    9, 9, 10, 10, 10, 10, 11, 11, 11, 12, 12, 12, 13, 13, 13, 13, 14, 14,
X    15, 15, 16, 16, 16, 17, 17, 18, 18, 19, 19, 19, 20, 20, 20, 20, 21, 22,
X    22, 22, 23 };
X
X/*
X *  function to return a potion number created with appropriate probability
X *  of occurrence
X *
X *  0 - sleep               1 - healing                 2 - raise level
X *  3 - increase ability    4 - gain wisdom             5 - gain strength
X *  6 - charismatic character   7 - dizziness           8 - learning
X *  9 - gold detection      10 - monster detection      11 - forgetfulness
X *  12 - water              13 - blindness              14 - confusion
X *  15 - heroism            16 - sturdiness             17 - giant strength
X *  18 - fire resistance    19 - treasure finding       20 - instant healing
X *  21 - cure dianthroritis 22 - poison                 23 - see invisible
X */
Xchar potprob[] = { 0, 0, 1, 1, 1, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 9, 9, 9, 10, 10, 10, 11, 11, 12, 12, 13, 14, 15, 16, 17, 18, 19, 19, 20, 20, 22, 22, 23, 23 };
X
Xchar nlpts[] = { 0, 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 5, 6, 7 };
Xchar nch[] = { 0, 0, 0, 1, 1, 1, 2, 2, 3, 4 };
Xchar nplt[] = { 0, 0, 0, 0, 1, 1, 2, 2, 3, 4 };
Xchar ndgg[] = { 0, 0, 0, 1, 1, 1, 1, 2, 2, 3, 3, 4, 5 };
Xchar nsw[] = { 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 3 };
END_OF_FILE
if test 31189 -ne `wc -c <'data.c'`; then
    echo shar: \"'data.c'\" unpacked with wrong size!
fi
# end of 'data.c'
fi
if test -f 'display.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'display.c'\"
else
echo shar: Extracting \"'display.c'\" \(18900 characters\)
sed "s/^X//" >'display.c' <<'END_OF_FILE'
X/*  display.c       Larn is copyrighted 1986 by Noah Morgan. */
X#include "header.h"
X
X#define botsub( _idx, _x, _y, _str )        \
X    if ( c[(_idx)] != cbak[(_idx)] )        \
X    {                                   \
X    cbak[(_idx)] = c[(_idx)];           \
X    cursor( (_x), (_y) );               \
X    lprintf( (_str), (long)c[(_idx)] ); \
X    }
X
Xstatic int minx,maxx,miny,maxy,k,m;
Xstatic char bot1f=0,bot2f=0,bot3f=0;
Xstatic char always=0;
X/*
X    bottomline()
X
X    now for the bottom line of the display
X */
Xbottomline()
X    {   recalc();   bot1f=1;    }
Xbottomhp()
X    {   bot2f=1;    }
Xbottomspell()
X    {   bot3f=1;    }
Xbottomdo()
X    {
X    if (bot1f) { bot3f=bot1f=bot2f=0; bot_linex(); return; }
X    if (bot2f) { bot2f=0; bot_hpx(); }
X    if (bot3f) { bot3f=0; bot_spellx(); }
X    }
X
Xbot_linex()
X    {
X    register int i;
X    if (cbak[SPELLS] <= -50 || (always))
X        {
X        cursor( 1,18);
X        if (c[SPELLMAX]>99)  lprintf("Spells:%3d(%3d)",(long)c[SPELLS],(long)c[SPELLMAX]);
X                        else lprintf("Spells:%3d(%2d) ",(long)c[SPELLS],(long)c[SPELLMAX]);
X        lprintf(" AC: %-3d  WC: %-3d  Level",(long)c[AC],(long)c[WCLASS]);
X        if (c[LEVEL]>99) lprintf("%3d",(long)c[LEVEL]);
X                    else lprintf(" %-2d",(long)c[LEVEL]);
X        lprintf(" Exp: %-9d %s\n",(long)c[EXPERIENCE],class[c[LEVEL]-1]);
X        lprintf("HP: %3d(%3d) STR=%-2d INT=%-2d ",
X            (long)c[HP],(long)c[HPMAX],(long)(c[STRENGTH]+c[STREXTRA]),(long)c[INTELLIGENCE]);
X        lprintf("WIS=%-2d CON=%-2d DEX=%-2d CHA=%-2d LV:",
X            (long)c[WISDOM],(long)c[CONSTITUTION],(long)c[DEXTERITY],(long)c[CHARISMA]);
X
X        if ((level==0) || (wizard))  c[TELEFLAG]=0;
X        if (c[TELEFLAG])  lprcat(" ?");  else  lprcat(levelname[level]);
X        lprintf("  Gold: %-6d",(long)c[GOLD]);
X        always=1;  botside();
X        c[TMP] = c[STRENGTH]+c[STREXTRA];
X        for (i=0; i<100; i++) cbak[i]=c[i];
X        return;
X        }
X
X    botsub(SPELLS,8,18,"%3d");
X    if (c[SPELLMAX]>99)
X        {
X        botsub(SPELLMAX,12,18,"%3d)");
X        }
X    else
X        botsub(SPELLMAX,12,18,"%2d) ");
X    botsub(HP,5,19,"%3d");
X    botsub(HPMAX,9,19,"%3d");
X    botsub(AC,21,18,"%-3d");
X    botsub(WCLASS,30,18,"%-3d");
X    botsub(EXPERIENCE,49,18,"%-9d");
X    if (c[LEVEL] != cbak[LEVEL])
X        {
X        cursor(59,18);
X        lprcat(class[c[LEVEL]-1]);
X        }
X    if (c[LEVEL]>99)
X        {
X        botsub(LEVEL,40,18,"%3d");
X        }
X    else
X        botsub(LEVEL,40,18," %-2d");
X    c[TMP] = c[STRENGTH]+c[STREXTRA];
X    botsub(TMP,18,19,"%-2d");
X    botsub(INTELLIGENCE,25,19,"%-2d");
X    botsub(WISDOM,32,19,"%-2d");
X    botsub(CONSTITUTION,39,19,"%-2d");
X    botsub(DEXTERITY,46,19,"%-2d");
X    botsub(CHARISMA,53,19,"%-2d");
X    if ((level != cbak[CAVELEVEL]) || (c[TELEFLAG] != cbak[TELEFLAG]))
X        {
X        if ((level==0) || (wizard))
X            c[TELEFLAG]=0;
X        cbak[TELEFLAG] = c[TELEFLAG];
X        cbak[CAVELEVEL] = level;
X        cursor(59,19);
X        if (c[TELEFLAG])
X            lprcat(" ?");
X        else
X            lprcat(levelname[level]);
X        }
X    botsub(GOLD,69,19,"%-6d");
X    botside();
X    }
X
X/*
X    special subroutine to update only the gold number on the bottomlines
X    called from ogold()
X */
Xbottomgold()
X    {
X    botsub(GOLD,69,19,"%-6d");
X    }
X
X/*
X    special routine to update hp and level fields on bottom lines
X    called in monster.c hitplayer() and spattack()
X */
Xstatic bot_hpx()
X    {
X    if (c[EXPERIENCE] != cbak[EXPERIENCE])
X        {
X        recalc();
X        bot_linex();
X        }
X    else
X        botsub(HP,5,19,"%3d");
X    }
X
X/*
X    special routine to update number of spells called from regen()
X */
Xstatic bot_spellx()
X    {
X    botsub(SPELLS,9,18,"%2d");
X    }
X
X/*
X    common subroutine for a more economical bottomline()
X */
Xstatic struct bot_side_def
X    {
X    int typ;
X    char *string;
X    }
X    bot_data[] =
X    {
X    STEALTH,"stealth",      UNDEADPRO,"undead pro",     SPIRITPRO,"spirit pro",
X    CHARMCOUNT,"Charm",     TIMESTOP,"Time Stop",       HOLDMONST,"Hold Monst",
X    GIANTSTR,"Giant Str",   FIRERESISTANCE,"Fire Resit", DEXCOUNT,"Dexterity",
X    STRCOUNT,"Strength",    SCAREMONST,"Scare",         HASTESELF,"Haste Self",
X    CANCELLATION,"Cancel",  INVISIBILITY,"Invisible",   ALTPRO,"Protect 3",
X    PROTECTIONTIME,"Protect 2", WTW,"Wall-Walk"
X    };
X
Xstatic botside()
X    {
X    register int i,idx;
X    for (i=0; i<17; i++)
X        {
X        idx = bot_data[i].typ;
X        if ((always) || (c[idx] != cbak[idx]))
X           {
X           if ((always) || (cbak[idx] == 0))
X                { if (c[idx]) { cursor(70,i+1); lprcat(bot_data[i].string); } }  else
X           if (c[idx]==0)     { cursor(70,i+1); lprcat("          "); }
X           cbak[idx]=c[idx];
X           }
X        }
X    always=0;
X    }
X
X/*
X *  subroutine to draw only a section of the screen
X *  only the top section of the screen is updated.  If entire lines are being
X *  drawn, then they will be cleared first.
X */
Xstatic int d_xmin=0,d_xmax=MAXX,d_ymin=0,d_ymax=MAXY;  /* for limited screen drawing */
Xdraws(xmin,xmax,ymin,ymax)
X    int xmin,xmax,ymin,ymax;
X    {
X    register int i,idx;
X    if (xmin==0 && xmax==MAXX) /* clear section of screen as needed */
X        {
X        if (ymin==0) cl_up(79,ymax);
X        else for (i=ymin; i<ymin; i++)  cl_line(1,i+1);
X        xmin = -1;
X        }
X    d_xmin=xmin;    d_xmax=xmax;    d_ymin=ymin;    d_ymax=ymax;    /* for limited screen drawing */
X    drawscreen();
X    if (xmin<=0 && xmax==MAXX) /* draw stuff on right side of screen as needed*/
X        {
X        for (i=ymin; i<ymax; i++)
X            {
X            idx = bot_data[i].typ;
X            if (c[idx])
X                {
X                cursor(70,i+1); lprcat(bot_data[i].string);
X                }
X            cbak[idx]=c[idx];
X            }
X        }
X    }
X
X#ifdef DECRainbow
X static int DECgraphics;     /* The graphics mode toggle */
X
X# define DECgraphicsON() if (!DECgraphics) lprc('\16'), DECgraphics = 1
X# define DECgraphicsOFF() if (DECgraphics) lprc('\17'), DECgraphics = 0
X
X/* For debugging on a non-DEC
X# define DECgraphicsON() if (!DECgraphics) lprcat("\33[4m"), DECgraphics = 1
X# define DECgraphicsOFF() if (DECgraphics) lprcat("\33[0m"), DECgraphics = 0
X*/
X
X# define DEClprc(ch)    if (ch & 0x80) {\
X                            DECgraphicsON();\
X                            lprc(ch ^ 0x80);\
X                        } else {\
X                            DECgraphicsOFF();\
X                            lprc(ch);\
X                        }
X#define nlprc(_ch) DEClprc(_ch)
X# else
X#define nlprc(_ch) lprc(_ch)
X#endif DECRainbow
X
X/*
X    drawscreen()
X
X    subroutine to redraw the whole screen as the player knows it
X */
Xstatic char d_flag;
Xdrawscreen()
X    {
X    register int i,j,k,ileft,iright;
X    int lastx,lasty;  /* variables used to optimize the object printing */
X    char    ch;
X
X    if (d_xmin==0 && d_xmax==MAXX && d_ymin==0 && d_ymax==MAXY)
X        {
X        d_flag=1;  clear(); /* clear the screen */
X        }
X    else
X        {
X        d_flag=0;  cursor(1,1);
X        }
X    if (d_xmin<0)
X        d_xmin=0; /* d_xmin=-1 means display all without bottomline */
X
X    /* display lines of the screen
X    */
X    for ( j = d_ymin ; j < d_ymax ; j++ )
X        {
X        /* When we show a spot of the dungeon, we have 4 cases:
X            squares we know nothing about
X                - know == 0
X            squares we've been at and still know whats there
X                - know == KNOWALL (== KNOWHERE | HAVESEEN)
X            squares we've been at, but don't still recall because
X            something else happened there.
X                - know == HAVESEEN
X            squares we recall, but haven't been at (an error condition)
X                - know == KNOWHERE
X
X           to minimize printing of spaces, scan from left of line until
X           we reach a location that the user knows.
X        */
X        ileft = d_xmin - 1;
X        while ( ++ileft < d_xmax )
X            if (know[ileft][j])     /* instead of know[i][j] != 0 */
X                break;              /* exitloop while */
X
X        /* if not a blank line ... */
X        if ( ileft < d_xmax )
X            {
X            /* scan from right of line until we reach a location that the
X               user knows.
X            */
X            iright = d_xmax ;
X            while ( --iright > ileft )
X                if (know[iright][j])
X                    break ;    /* exitloop while */
X
X            /* now print the line, after positioning the cursor.
X               print the line with bold objects in a different
X               loop for effeciency
X            */
X            cursor( ileft+1, j+1 );
X            if (boldobjects)
X                for ( i=ileft ; i <= iright ; i++ )
X
X                    /* we still need to check for the location being known,
X                       for we might have an unknown spot in the middle of
X                       an otherwise known line.
X                    */
X                    if ( know[i][j] == 0 )
X                        nlprc( ' ' );
X                    else if ( know[i][j] & HAVESEEN )
X                        {
X                        /* if monster there and the user still knows the place,
X                           then show the monster.  Otherwise, show what was
X                           there before.
X                        */
X                        if (( k = mitem[i][j] ) &&
X                            ( know[i][j] & KNOWHERE ))
X                            nlprc( monstnamelist[k] );
X                        else if (((k=item[i][j]) == OWALL ) ||
X				  (objnamelist[k] == floorc))
X                            nlprc( objnamelist[k] );
X                        else
X                            {
X                            setbold();
X                            nlprc( objnamelist[k] );
X                            resetbold();
X                            }
X                        }
X                    else
X                        /* error condition.  recover by resetting location
X                           to an 'unknown' state.
X                        */
X                        {
X                        nlprc( ' ' );
X                        mitem[i][j] = item[i][j] = 0 ;
X                        }
X            else /* non-bold objects here */
X                for ( i=ileft ; i <= iright ; i++ )
X
X                    /* we still need to check for the location being known,
X                       for we might have an unknown spot in the middle of
X                       an otherwise known line.
X                    */
X                    if ( know[i][j] == 0 )
X                        nlprc( ' ' );
X                    else if ( know[i][j] & HAVESEEN )
X                        {
X                        /* if monster there and the user still knows the place,
X                           then show the monster.  Otherwise, show what was
X                           there before.
X                        */
X                        if (( k = mitem[i][j] ) &&
X                            ( know[i][j] & KNOWHERE ))
X                            nlprc( monstnamelist[k] );
X                        else
X                            nlprc( objnamelist[item[i][j]] );
X                        }
X                    else
X                        /* error condition.  recover by resetting location
X                           to an 'unknown' state.
X                        */
X                        {
X                        nlprc( ' ' );
X                        mitem[i][j] = item[i][j] = 0 ;
X                        }
X            }   /* if (ileft < d_xmax ) */
X        }       /* for (j) */
X
X#ifdef DECRainbow
X    if (DECRainbow)
X        DECgraphicsOFF();
X#endif DECRainbow
X    resetbold();
X    if (d_flag)  { always=1; botside(); always=1; bot_linex(); }
X    oldx=99;
X    d_xmin = d_ymin = 0; d_xmax = MAXX; d_ymax = MAXY; /* for limited screen drawing */
X    }
X
X/*
X    showcell(x,y)
X
X    subroutine to display a cell location on the screen
X */
Xshowcell(x,y)
X    int x,y;
X    {
X    register int i,j,k,m;
X    if (c[BLINDCOUNT])  return; /* see nothing if blind     */
X    if (c[AWARENESS]) { minx = x-3; maxx = x+3; miny = y-3; maxy = y+3; }
X            else      { minx = x-1; maxx = x+1; miny = y-1; maxy = y+1; }
X
X    if (minx < 0) minx=0;       if (maxx > MAXX-1) maxx = MAXX-1;
X    if (miny < 0) miny=0;       if (maxy > MAXY-1) maxy = MAXY-1;
X
X    for (j=miny; j<=maxy; j++)
X      for (m=minx; m<=maxx; m++)
X        if ((know[m][j] & KNOWHERE) == 0)
X            {
X            cursor(m+1,j+1);
X        x=maxx;
X        while (know[x][j] & KNOWHERE)
X        --x;
X            for (i=m; i<=x; i++)
X                {
X                if ((k=mitem[i][j]) != 0)  lprc(monstnamelist[k]);
X                else switch(k=item[i][j])
X                    {
X                    case OWALL:  case 0: case OIVTELETRAP:  case OTRAPARROWIV:
X                    case OIVDARTRAP: case OIVTRAPDOOR:
X#ifdef DECRainbow
X                        if (DECRainbow) {
X                            DEClprc(objnamelist[k]);
X                        } else
X#endif DECRainbow
X                        lprc(objnamelist[k]);   
X                        break;
X                    default:
X                        if (boldobjects)
X                            setbold();
X                        lprc(objnamelist[k]);
X                        if (boldobjects)
X                            resetbold();
X                        break;
X                    };
X                know[i][j] = KNOWALL;
X                }
X            m = maxx;
X#ifdef DECRainbow
X            if (DECRainbow)
X                DECgraphicsOFF();
X#endif DECRainbow
X            }
X    }
X
X/*
X    this routine shows only the spot that is given it.  the spaces around
X    these coordinated are not shown
X    used in godirect() in monster.c for missile weapons display
X */
Xshow1cell(x,y)
X    int x,y;
X    {
X    if (c[BLINDCOUNT])  return; /* see nothing if blind     */
X    cursor(x+1,y+1);
X    if ((k=mitem[x][y]))
X        lprc(monstnamelist[k]);
X    else switch(k=item[x][y])
X        {
X        case OWALL:  case 0:  case OIVTELETRAP:  case OTRAPARROWIV:
X        case OIVDARTRAP: case OIVTRAPDOOR:
X# ifdef DECRainbow
X            if (DECRainbow) {
X                DEClprc(objnamelist[k]);
X                DECgraphicsOFF();
X            } else
X# endif
X                lprc(objnamelist[k]);
X                break;
X
X        default:
X            if (boldobjects)
X                setbold();
X            lprc(objnamelist[k]);
X            if (boldobjects)
X                resetbold();
X            break;
X        };
X    know[x][y] = KNOWALL;   /* we end up knowing about it */
X    }
X
X/*
X    showplayer()
X
X    subroutine to show where the player is on the screen
X    cursor values start from 1 up
X */
Xshowplayer()
X    {
X    cursor(playerx+1,playery+1);
X    oldx=playerx;  oldy=playery;
X    }
X
X/*
X    moveplayer(dir)
X
X    subroutine to move the player from one room to another
X    returns 0 if can't move in that direction or hit a monster or on an object
X    else returns 1
X    nomove is set to 1 to stop the next move (inadvertent monsters hitting
X    players when walking into walls) if player walks off screen or into wall
X */
Xshort diroffx[] = { 0,  0, 1,  0, -1,  1, -1, 1, -1 };
Xshort diroffy[] = { 0,  1, 0, -1,  0, -1, -1, 1,  1 };
Xmoveplayer(dir)
X    int dir;            /*  from = present room #  direction = [1-north]
X                            [2-east] [3-south] [4-west] [5-northeast]
X                            [6-northwest] [7-southeast] [8-southwest]
X                        if direction=0, don't move--just show where he is */
X    {
X    register int k,m,i,j;
X    extern char prayed ;
X
X    if (c[CONFUSE]) if (c[LEVEL]<rnd(30)) dir=rund(9); /*if confused any dir*/
X    k = playerx + diroffx[dir];     m = playery + diroffy[dir];
X    if (k<0 || k>=MAXX || m<0 || m>=MAXY) { nomove=1; return(yrepcount = 0); }
X    i = item[k][m];         j = mitem[k][m];
X
X    /* prevent the player from moving onto a wall, or a closed door when
X       in command mode, unless the character has Walk-Through-Walls.
X    */
X    if ((i==OCLOSEDDOOR && !prompt_mode) || (i==OWALL) && c[WTW]==0)
X        { 
X        nomove=1;  
X        return(yrepcount = 0); 
X        }
X    if (k==33 && m==MAXY-1 && level==1)
X        {
X        newcavelevel(0); for (k=0; k<MAXX; k++) for (m=0; m<MAXY; m++)
X        if (item[k][m]==OENTRANCE)
X          { playerx=k; playery=m; positionplayer();  drawscreen(); return(0); }
X        }
X    /* hit a monster
X    */    
X    if (j>0)     
X        { hitmonster(k,m); return(yrepcount = 0); } 
X
X    /* check for the player ignoring an altar when in command mode.
X    */
X    if ((!prompt_mode) &&
X        (item[playerx][playery] == OALTAR) &&
X        (!prayed))
X        {
X    cursors();
X    lprcat("\nYou have ignored the altar!");
X    act_ignore_altar();
X    }
X    prayed = 0 ;
X
X    lastpx = playerx;   lastpy = playery;
X    playerx = k;        playery = m;
X    if (i && i!=OTRAPARROWIV && i!=OIVTELETRAP && i!=OIVDARTRAP && i!=OIVTRAPDOOR) 
X        return(yrepcount = 0);  
X    else 
X        return(1);
X    }
X
X/*
X *  function to show what magic items have been discovered thus far
X *  enter with -1 for just spells, anything else will give scrolls & potions
X */
Xstatic int lincount,count;
Xseemagic(arg)
X    int arg;
X    {
X    register int i,number;
X    count = lincount = 0;  nosignal=1;
X
X    if (arg== -1) /* if display spells while casting one */
X        {
X        for (number=i=0; i<SPNUM; i++) if (spelknow[i]) number++;
X        number = (number+2)/3 + 4;  /* # lines needed to display */
X        cl_up(79,number);  cursor(1,1);
X        }
X    else
X        {
X        resetscroll();  clear();
X        }
X
X    lprcat("The magic spells you have discovered thus far:\n\n");
X    for (i=0; i<SPNUM; i++)
X        if (spelknow[i])
X            { lprintf("%s %-20s ",spelcode[i],spelname[i]);  seepage(); }
X
X    if (arg== -1)
X        {
X        seepage();  more();  nosignal=0;
X        draws(0,MAXX,0,number);  return;
X        }
X
X    lincount += 3;  if (count!=0) { count=2;  seepage(); }
X
X    lprcat("\nThe magic scrolls you have found to date are:\n\n");
X    count=0;
X    for (i=0; i<MAXSCROLL; i++)
X        if (scrollname[i][0])
X          if (scrollname[i][1]!=' ')
X            { lprintf("%-26s",&scrollname[i][1]);  seepage(); }
X
X    lincount += 3;  if (count!=0) { count=2;  seepage(); }
X
X    lprcat("\nThe magic potions you have found to date are:\n\n");
X    count=0;
X    for (i=0; i<MAXPOTION; i++)
X        if (potionname[i][0])
X          if (potionname[i][1]!=' ')
X            { lprintf("%-26s",&potionname[i][1]);  seepage(); }
X
X    if (lincount!=0) more();    nosignal=0;  setscroll();   drawscreen();
X    }
X
X/*
X *  subroutine to paginate the seemagic function
X */
Xstatic seepage()
X    {
X    if (++count==3)
X        {
X        lincount++; count=0;    lprc('\n');
X        if (lincount>17) {  lincount=0;  more();  clear();  }
X        }
X    }
END_OF_FILE
if test 18900 -ne `wc -c <'display.c'`; then
    echo shar: \"'display.c'\" unpacked with wrong size!
fi
# end of 'display.c'
fi
if test -f 'larn.opt' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'larn.opt'\"
else
echo shar: Extracting \"'larn.opt'\" \(83 characters\)
sed "s/^X//" >'larn.opt' <<'END_OF_FILE'
Xname: "Mr. Wizard"
Xauto-pickup
Xhighlight-objects
Xbold-objects
Xmale
Xno-introduction
END_OF_FILE
if test 83 -ne `wc -c <'larn.opt'`; then
    echo shar: \"'larn.opt'\" unpacked with wrong size!
fi
# end of 'larn.opt'
fi
if test -f 'larn.prj' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'larn.prj'\"
else
echo shar: Extracting \"'larn.prj'\" \(597 characters\)
sed "s/^X//" >'larn.prj' <<'END_OF_FILE'
XACTION.C  (HEADER.H)
XBILL.C    (HEADER.H)
XCONFIG.C  (HEADER.H)
XCREATE.C  (HEADER.H)
XDATA.C    (HEADER.H)
XDIAG.C    (HEADER.H)
XDISPLAY.C (HEADER.H)
XFORTUNE.C (HEADER.H)
XGLOBAL.C  (HEADER.H)
XHELP.C    (HEADER.H)
XIO.C      (HEADER.H)
XMAIN.C    (HEADER.H)
XMONSTER.C (HEADER.H)
XMOREOBJ.C (HEADER.H)
XMOVEM.C   (HEADER.H)
XMSDOS.C   (HEADER.H)
XNAP.C
XOBJECT.C  (HEADER.H)
XREGEN.C   (HEADER.H)
XSAVELEV.C (HEADER.H)
XSCORES.C  (HEADER.H)
XSIGNAL.C  (HEADER.H)
XSPELLS.C  (HEADER.H)
XSPHERES.C (HEADER.H)
XSTORE.C   (HEADER.H)
XTOK.C     (HEADER.H)
XVMS.C     (HEADER.H)
Xfgetlr.c
Xtgetent.c
Xtgetstr.c
Xtputs.c
Xtgoto.c
END_OF_FILE
if test 597 -ne `wc -c <'larn.prj'`; then
    echo shar: \"'larn.prj'\" unpacked with wrong size!
fi
# end of 'larn.prj'
fi
echo shar: End of archive 2 \(of 11\).
cp /dev/null ark2isdone
MISSING=""
for I in 1 2 3 4 5 6 7 8 9 10 11 ; do
    if test ! -f ark${I}isdone ; then
	MISSING="${MISSING} ${I}"
    fi
done
if test "${MISSING}" = "" ; then
    echo You have unpacked all 11 archives.
    rm -f ark[1-9]isdone ark[1-9][0-9]isdone
else
    echo You still need to unpack the following archives:
    echo "        " ${MISSING}
fi
##  End of shell archive.
exit 0