[comp.sources.games] v03i048: omega - rogue like dungeon exploration, Part01/15

games-request@tekred.TEK.COM (01/20/88)

Submitted by: "Laurence R. Brothers" <brothers@paul.rutgers.edu>
Comp.sources.games: Volume 3, Issue 48
Archive-name: omega/Part01

	[I compiled and started this on my Sun 3/60 and it seemed
	 to work OK.	-br]

#! /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 1 (of 15)."
# Contents:  README MANIFEST ocom.c odepths.dat omega.lognum
#   oscroll1.txt
# Wrapped by billr@tekred on Mon Jan 18 10:20:06 1988
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f README -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"README\"
else
echo shar: Extracting \"README\" \(360 characters\)
sed "s/^X//" >README <<'END_OF_README'
XNote that omega is copyrighted. See the public license in omega.license in
Xthis directory for what you can do with the code. 
X
XFor directions on how to compile, see omega.compilation.notes
X
XFor directions how to play, see ohelp.txt
X
XA manifest of omega files is in the file MANIFEST
X
XA command list is in ocommands.txt
X
XHave Fun, and Be Careful....
X
X-Laurence
END_OF_README
if test 360 -ne `wc -c <README`; then
    echo shar: \"README\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f MANIFEST -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"MANIFEST\"
else
echo shar: Extracting \"MANIFEST\" \(1999 characters\)
sed "s/^X//" >MANIFEST <<'END_OF_MANIFEST'
X   File Name		Archive #	Description
X-----------------------------------------------------------
X MANIFEST                  1	This file
X Makefile                 15	sun makefile
X Makefile.orig             6	original sun makefile
X README                    1	guess what
X makefile.notsun           3	non-sun sample makefile
X o.c                      15	source files, *.c, *.h
X oaux1.c                  12	
X oaux2.c                  11	
X ochar.c                  10	
X ocity.c                  10	
X ocity.dat                15	city level
X ocom.c                    1	
X ocommands.txt            10	command list
X odefs.h                   8	
X odepths.c                 9	
X odepths.dat               1	bottom level
X oeffect1.c               13	
X oeffect2.c               14	
X oetc.c                    9	
X ofile.c                   2	
X ogen.c                   14	
X oglob.h                   7	
X oguild.c                  4	
X ohelp.txt                 5	help file
X oinititem1.c             11	
X oinititem2.c              8	
X oinitmon0to3.c            6	
X oinitmon4to7.c            5	
X oinitmon8to10.c           9	
X oinv.c                    3	
X oitem.c                  13	
X oitemf.c                  2	
X olev.c                   15	
X omega.compilation.notes  15	how to compile
X omega.hiscore             9	hiscore file
X omega.intro              13	cute intro
X omega.license            15	public license
X omega.log                12	npc log
X omega.lognum              1	number of log entries
X omega.motd                5	msg of the day
X omega.programming.notes   4	notes on the code
X omega.thanks             12	congrat
X omega.update.history      8	says it all
X omon.c                   10	
X omonf.c                   7	
X omove.c                   7	
X oscr.c                   12	
X oscroll1.txt              1	library scroll
X oscroll2.txt             14	library scroll
X osite.c                   3	
X ospell.c                  6	
X otime.c                  15	new module in 0.60
X outil.c                   4	
END_OF_MANIFEST
if test 1999 -ne `wc -c <MANIFEST`; then
    echo shar: \"MANIFEST\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f ocom.c -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"ocom.c\"
else
echo shar: Extracting \"ocom.c\" \(46035 characters\)
sed "s/^X//" >ocom.c <<'END_OF_ocom.c'
X/* omega copyright (C) by Laurence Raphael Brothers, 1987 */
X/* ocom.c */
X
X/* this file should only include p_process, and functions called by */
X/* p_process. functions called by those are in oaux */
X
X#include <strings.h>
X#include "oglob.h"
X
X/* from omovef */
Xextern void p_movefunction();
X
X/* from oeffect1 or 2 */
Xextern void wish(),level_drain();
X
X/* from olev */
Xextern int save_game(),restore_game();
X
X/* from ogen */
Xextern void create_level(),change_level();
X
X/* from outil */
Xextern int random_range(),inbounds(),los_p(),distance();
Xextern void do_object_los();
X
X/* from ocity */
Xextern void load_city();
X
X/* from oscr */
Xextern void commanderror(),redraw(),commandlist(),helpfile();
Xextern void printm(),mprint(),menumorewait(),xredraw(),morewait();
Xextern void drawspot(),show_screen(),menuclear(),show_license();
Xextern void menuprint(),erase_level(),drawvision(),maddch(),clearmsg();
Xextern void menu_i_print(),drawscreen(),locprint(),endgraf(),mnumprint();
Xextern void display_quit();
Xextern char *msgscanstring();
Xextern char mgetc(),menugetc();
Xextern char ynq();
Xextern void screencheck();
X
X
X/* from omon */
Xextern void monster_talk(),m_status_set();
X
X/* from oitem */
Xextern int twohanded_p();
Xextern void item_use();
X
X/* from oinv */
Xextern void p_drop_at(),drop_at(),drop_money(),give_money();
X
X/* from oaux, probably 1, maybe 2 */
Xextern void pickup_at(),setspot(),foodcheck(),p_death(),tunnelcheck();
Xextern void calc_melee(),p_melee(),gain_experience(),p_damage();
Xextern void p_teleport(),tacmode(),darkenroom();
Xextern void searchat(),weapon_use(),damage_item(),roomcheck();
Xextern void givemonster(),conform_unused_object(),conform_lost_object();
Xextern void hand_wield(),optionset(),optionreset(),describe_player();
Xextern void conform_lost_objects(),lightroom(),surrender(),threaten();
Xextern char *itemid(),*mstatus_string(),*trapid();
Xextern int p_moveable(),cursed(),getitem(),getdir(),optionp(),goberserk();
Xextern int corridor_turn(),player_on_sanctuary();
X
X/* ocom functions */
Xvoid pickup(),drop(),wwp(),magic(),disarm(),save(),restore();
Xvoid inventory(),opendoor(),closedoor(),fire(),fight();
Xvoid p_process(),eat(),version(),nap(),vault(),bash_item();
Xvoid search(),peruse(),quaff(),talk(),bash_location(),wizard();
Xvoid give(),rest(),examine(),help(),quit(),lastmprint();
Xvoid zapwand(),urt(),floor_inv(),callitem(), charid();
Xvoid moveplayer(),levelchange(),setoptions(),activate();
Xvoid pickpocket(),rename_player(),abortshadowform(),tunnel();
X
X
X
X/* deal with a new player command */
Xvoid p_process()
X{
X  static int searchval=10; /* do a search for the first 10 moves */
X
X  drawvision(Player.x,Player.y,Player.vision);
X
X  Skipplayer = (Skipplayer ||
X		((Player.status[BERSERK] > 0) && goberserk()));
X  if (! Skipplayer) {
X    if (searchval > 0) {
X      searchval--;
X      if (searchval == 0) Fastmove = FALSE;
X    }
X    if (! Fastmove) {
X      dataprint();
X      searchval = 0;
X      Cmd = mgetc();
X      clearmsg();
X    }
X    else if (! optionp(JUMPMOVE)) drawvision(Player.x,Player.y,Player.vision);
X    switch (Cmd) {
X     case ' ': 
X     case 13: Skipmonsters = TRUE; break;  /* no op on space or return */
X     case 6: abortshadowform(); /* ^f */
X     case 7: wizard(); break; /* ^g */
X     case 14: xredraw(); Skipmonsters = TRUE; break; /* ^l */
X     case 16: lastmprint(); break; /* ^p */ 
X     case 18: redraw();  Skipmonsters = TRUE; break; /* ^r */
X     case 23: if (Wizard) drawscreen();  break; /* ^w */
X     case 24: if (Wizard || Player.rank[ADEPT]) wish(1);  break; /* ^x */
X     case 'a': zapwand();  break;
X     case 'c': closedoor();  break;
X     case 'd': drop();  break;
X     case 'e': eat();  break;
X     case 'f': fire();  break;
X     case 'g': pickup();  break;
X     case 'i': inventory();  Skipmonsters = TRUE; break;
X     case 'm': magic();  break;
X     case 'o': opendoor(); break;
X     case 'p': pickpocket(); break;
X     case 'q': quaff();  break;
X     case 'r': peruse();  break;
X     case 's': search(&searchval); break;
X     case 't': talk(); break;
X     case 'v': vault(); break;
X     case 'w': wwp();  break; /* wield/wear/put on */
X     case 'x': examine(); break;
X     case 'z': bash_location();  break;
X     case 'A': activate();  break;
X     case 'C': callitem();  break;
X     case 'D': disarm();  break;
X     case 'F': fight();  break;
X     case 'G': give();  break;
X     case 'I': floor_inv(); break;
X     case 'O': setoptions(); break;
X     case 'P': show_license(); break; /* actually show_license is in oscr */
X     case 'Q': quit(); break;
X     case 'R': rename_player(); break;
X     case 'S': save(); break;
X     case 'T': tunnel(); break;
X     case 'V': version(); break;
X     case 'W': urt();  break;
X     case 'Z': bash_item();  break;
X     case '.': rest(); break;
X     case ',': nap(); break;
X     case '>': levelchange(Dungeon[Dlevel][Player.x][Player.y].aux,'>');break;
X     case '<': levelchange(Dungeon[Dlevel][Player.x][Player.y].aux,'<');break;
X     case '/': charid(); Skipmonsters = TRUE; break;
X     case '?': help(); Skipmonsters = TRUE; break;
X     case '4':	       
X     case 'h': moveplayer(-1,0);  break;
X     case '2':
X     case 'j': moveplayer(0,1);  break;
X     case '8':
X     case 'k': moveplayer(0,-1);  break;
X     case '6':
X     case 'l': moveplayer(1,0);  break;
X     case '1':
X     case 'b': moveplayer(-1,1);  break;
X     case '3':	      
X     case 'n': moveplayer(1,1);  break;
X     case '7':
X     case 'y': moveplayer(-1,-1);  break;
X     case '9':
X     case 'u': moveplayer(1,-1);  break;
X     case '5': 
X       Skipmonsters = TRUE; /* don't do anything; this is a dummy turn */
X       Cmd = mgetc();
X       while ((Cmd != ESCAPE) &&
X	      ((Cmd < '1') || (Cmd > '9') || (Cmd=='5'))) {
X	 printm("\nRun in keypad direction [ESCAPE to abort]: ");
X	 Cmd = mgetc();
X       }
X       if (Cmd != ESCAPE) Fastmove = TRUE;
X       break;
X     case 'H': Fastmove = TRUE; Cmd = 'h'; moveplayer(-1,0);  break; 
X     case 'J': Fastmove = TRUE; Cmd = 'j'; moveplayer(0,1);  break;  
X     case 'K': Fastmove = TRUE; Cmd = 'k'; moveplayer(0,-1);  break; 
X     case 'L': Fastmove = TRUE; Cmd = 'l'; moveplayer(1,0);  break;  
X     case 'B': Fastmove = TRUE; Cmd = 'b'; moveplayer(-1,1);  break; 
X     case 'N': Fastmove = TRUE; Cmd = 'n'; moveplayer(1,1);  break;  
X     case 'Y': Fastmove = TRUE; Cmd = 'y'; moveplayer(-1,-1);  break;
X     case 'U': Fastmove = TRUE; Cmd = 'u'; moveplayer(1,-1);  break;
X     default: commanderror();  Skipmonsters = TRUE; break;
X    }
X  }
X}
X
X/* no op a turn.... */
Xvoid rest()
X{
X  if (random_range(20) == 1) {
X    switch(random_range(10)) {
X      case 0: mprint(" Time passes slowly.... "); break;
X      case 1: mprint(" Tick. Tock. Tick. Tock. "); break;
X      case 2: mprint(" Ho Hum. "); break;
X      case 3: mprint(" Beauty Sleep. Well, in your case, Ugly Sleep. "); break;
X      case 4: mprint(" And with Strange Aeons, even Death may die. "); break;
X      case 5: mprint(" La Di Da. "); break;
X      case 6: mprint(" Time keeps on tickin' tickin' -- into the future.... ");
X  	      break;
X      case 7: mprint(" Boooring! "); break;
X      case 8: mprint(" You think I like watching you sleep? "); break;
X      case 9: mprint(" You sure have an early bedtime! "); break;
X    }
X    morewait();
X  }
X}
X
X
X/* read a scroll, book, tome, etc. */
Xvoid peruse()
X{
X  int index;
X  struct object *obj;
X
X  if (Player.status[BLINDED] > 0)
X    mprint("You're blind -- you can't read!!!");
X  else if (Player.status[AFRAID] > 0)
X    mprint("You are too afraid to stop to read a scroll!");
X  else {
X    printm("\nRead -- ");
X    index = getitem(SCROLL);
X    if (index == ABORT)
X      Skipmonsters = TRUE;
X    else {
X      obj = Player.possessions[index-'a'];
X      if (obj->objchar != SCROLL) {
X	printm("\nThere's nothing written on ");
X	mprint(itemid(obj));
X      }
X      else {
X	mprint("You carefully unfurl the scroll....");
X	item_use(obj);
X	conform_lost_objects(1,obj);
X      }
X    }
X  }
X}
X
X
X
X
Xvoid quaff()
X{
X  int index;
X  struct object *obj;
X
X  printm("\nQuaff --");
X  index = getitem(POTION);
X  if (index == ABORT)
X    Skipmonsters = TRUE;
X  else {
X    obj = Player.possessions[index-'a'];
X    if (obj->objchar != POTION) {
X      printm("\nYou can't drink ");
X      printm(itemid(obj));
X    }
X    else {
X      mprint("You drink it down.... ");
X      item_use(obj);
X      conform_lost_objects(1,obj);
X    }
X  }
X}
X
X
X
X
Xvoid activate()
X{
X  int index;
X  struct object *obj;
X
X  printm("\nActivate --");
X  index = getitem(ARTIFACT);
X  if (index == ABORT)
X    Skipmonsters = TRUE;
X  else {
X    obj = Player.possessions[index-'a'];
X    if (obj->objchar != ARTIFACT) {
X      printm("\nYou can't activate ");
X      printm(itemid(obj));
X    }
X    else {
X      mprint("You activate the artifact.... ");
X      item_use(obj);
X    }
X  }
X}
X
X
X
X
X
Xvoid eat()
X{
X  int index;
X  struct object *obj;
X
X  printm("\nEat --");
X  index = getitem(FOOD);
X  if (index == ABORT)
X    Skipmonsters = TRUE;
X  else {
X    obj = Player.possessions[index-'a'];
X    if ((obj->objchar != FOOD)&&(obj->objchar != CORPSE)) {
X      printm("\nYou can't eat ");
X      printm(itemid(obj));
X    }
X    else {
X      mprint("Munch Munch.... ");
X      if (obj->objchar == FOOD) Player.food = max(0,Player.food+obj->aux);
X      item_use(obj);
X      conform_lost_objects(1,obj);
X    }
X  }
X  foodcheck();
X}
X
X
X
X
X/* search all adjacent spots for secrecy */
Xvoid search(searchval)
Xint *searchval;
X{
X  int i;
X  if (Player.status[AFRAID] > 0)
X    mprint("You are too terror-stricken to stop to search for anything.");
X  else {
X    if (!Fastmove) {
X      Fastmove = TRUE;
X      *searchval = Searchnum;
X    }
X    for (i=0;i<8;i++) 
X      searchat(Player.x+Dirs[0][i],Player.y+Dirs[1][i]);
X    drawvision(Player.x,Player.y,Player.vision);
X  }
X}
X
X
X
X/* pick up a thing where the player is */
X void pickup()
X {
X   if (Dungeon[Dlevel][Player.x][Player.y].things == NULL)
X     printm("\nThere's nothing there!");
X   else pickup_at(Player.x,Player.y);
X }
X
X
X/* floor inventory */
Xvoid floor_inv()
X{
X  pol ol = Dungeon[Dlevel][Player.x][Player.y].things;
X  Skipmonsters = TRUE;
X  menuclear();
X  while (ol != NULL) {
X    if (ol->thing == NULL) printf("***Error; null thing on things list***");
X    else {
X      menuprint(itemid(ol->thing));
X      menuprint("\n");
X    }
X    ol = ol->next;
X  }
X  menumorewait();
X  xredraw();
X}
X
X
X
X
X
X
X
X
X
Xvoid drop()
X{
X  int index,n;
X  
X  printm("\nDrop --");
X  index = getitem(NULL);
X  if (index == ABORT)
X    Skipmonsters = TRUE;
X  else {
X    if (index == CASHVALUE) drop_money();
X    else if ((! Player.possessions[index-'a']->used) ||
X	     (! cursed(Player.possessions[index-'a']))) {
X      if (Player.possessions[index-'a']->number == 1) {
X	drop_at(Player.x,Player.y,Player.possessions[index-'a']);
X	conform_lost_objects(1,Player.possessions[index-'a']);
X      }
X      else {
X	n = getnumber(Player.possessions[index-'a']->number);
X	p_drop_at(Player.x,Player.y,n,Player.possessions[index-'a']);
X	conform_lost_objects(n,Player.possessions[index-'a']);
X      }
X    }
X    else {
X      mprint("You can't seem to get rid of: ");
X      mprint(itemid(Player.possessions[index-'a']));
X    }
X  }
X  calc_melee();
X}
X
X
X/* wield/wear/put-on */
Xvoid wwp()
X{
X  int index;
X  struct object *obj;
X  int unuseable = FALSE;
X
X  printm("\nUse --");
X  index = getitem(NULL);
X  if (index == ABORT)
X    Skipmonsters = TRUE;
X  else if (index == CASHVALUE) mprint("Can't use cash!");
X  else if (Player.possessions[index-'a']->used)
X    printm("\nYou already are using that item!");
X  else {
X    morewait();
X    obj = Player.possessions[index-'a'];
X    switch (obj->objchar) {
X      case SHIELD:
X        if ((Player.primary != NULL) && twohanded_p(Player.primary->id))
X	  mprint("You can't use a shield with a two-handed weapon.");
X	else if (! cursed(Player.secondary)) {
X	  if (Player.secondary != NULL) {
X	    mprint("You stop using your old shield.");
X	    morewait();
X	    conform_unused_object(Player.secondary);
X	  }
X	  Player.secondary = obj;
X	  obj->used = TRUE;
X	  printm("\nNow blocking with ");
X	  mprint(itemid(obj));
X	  item_use(obj);
X        }
X        else mprint("You can't take your shield off!");
X	break;
X      case WEAPON:
X      case MISSILEWEAPON:
X        if (twohanded_p(obj->id) && (Player.secondary != NULL))
X	  mprint("You'll have to stop using that shield, first.");
X	else if (! cursed(Player.primary)) {
X	  if (Player.primary != NULL) {
X	    mprint("You put away your old weapon.");
X	    morewait();
X	    conform_unused_object(Player.primary);
X	  }
X	  Player.primary = obj;
X	  obj->used = TRUE;
X	  printm("\nNow wielding ");
X	  mprint(itemid(obj));
X	  item_use(obj);
X        }
X        else mprint("Your weapon seems stuck to your hand!");
X	break;
X      case ARMOR:
X	if (! cursed(Player.armor)) {
X	  if (Player.armor != NULL) {
X	    mprint("You take off your old suit of armor");
X	    morewait();
X	    conform_unused_object(Player.armor);
X	  }
X	  Player.armor = obj;
X	  obj->used = TRUE;
X	  printm("\nNow armored in ");
X	  mprint(itemid(obj));	  
X	  item_use(obj);
X        }
X        else mprint("You can't seem to take your armor off!");		   
X	break;
X      case BOOTS:
X	if (! cursed(Player.boots)) {
X	  if (Player.boots != NULL) {
X	    mprint("You take off your old pair of boots.");
X	    morewait();
X	    conform_unused_object(Player.boots);
X	  }
X	  Player.boots = obj;
X	  obj->used = TRUE;
X	  printm("\nNow shod in ");
X	  mprint(itemid(obj));
X	  item_use(obj);
X	}
X        else mprint("Your boots are stuck on your feet!");
X	break;
X      case CLOAK:
X	if (! cursed(Player.cloak)) {
X	  if (Player.cloak != NULL) {
X	    mprint("You take off your old cloak.");
X	    morewait();
X	    conform_unused_object(Player.cloak);
X	  }
X	  Player.cloak = obj;
X	  obj->used = TRUE;
X	  printm("\nNow garbed in ");
X	  mprint(itemid(obj));
X	  item_use(obj);
X	}
X	else mprint("Your cloak refuses to come off!");
X	break;
X      case RING:
X	if (Player.numrings == 8)
X	  mprint("Too many rings! Can't wear ");
X	else {
X	  Player.numrings++;
X	  obj->used = TRUE;
X	  printm("\nNow wearing: ");
X	  item_use(obj);
X	}
X	mprint(itemid(obj));
X	break;
X      case THING:
X	if (obj->usef == I_NO_OP) {
X	  mprint("You can't use:");
X	  mprint(itemid(obj));
X	}
X	else {
X	  obj->used = TRUE;
X	  printm("\nUsing: ");
X	  mprint(itemid(obj));
X	  item_use(obj);
X	}
X	break;
X      default:
X	printm("\nNo way you can employ ");
X	mprint(itemid(obj));
X	unuseable = TRUE;
X	break;
X      }	     
X  }
X  calc_melee();
X}
X      
X
X
X
X
X/* unwield/remove/take-off */
Xvoid urt()
X{
X  int index;
X  printm("\nStop using --");
X  index = getitem(NULL);
X  if (index == ABORT)
X    Skipmonsters = TRUE;
X  else if (index == CASHVALUE) printm("\nNot using cash!");
X  else if (! Player.possessions[index-'a']->used) {
X    printm("\nYou're not using that item!");
X    Skipmonsters = TRUE;
X  }
X  else if (! cursed(Player.possessions[index-'a'])) {
X    morewait();
X    clearmsg();
X    switch (Player.possessions[index-'a']->objchar) {
X      case WEAPON:
X        mprint("No longer wielding ");
X	break;
X      case ARMOR:
X	mprint("Took off ");
X	break;
X      case SHIELD:
X	mprint("Stopped blocking with ");
X	break;
X      case BOOTS:
X	mprint("Took off ");
X	break;
X      case CLOAK:
X	mprint("Took off ");
X	break;
X      case RING:
X	mprint("Removed ");
X	Player.numrings--;
X	break;
X      case THING:
X	mprint("Stopped using: ");
X	break;
X      }
X    mprint(itemid(Player.possessions[index-'a']));
X    conform_unused_object(Player.possessions[index-'a']);
X  }
X  else {
X    mprint("You can't seem to stop using: ");
X    mprint(itemid(Player.possessions[index-'a']));
X  }
X  calc_melee();
X}
X
Xvoid inventory()
X{
X  int i;
X
X  menuclear();
X  menuprint("Cash: ");
X  menunumprint(Player.cash);
X  menuprint("Au.\n");
X  for (i=0;i<MAXITEMS;i++)
X    if (Player.possessions[i] != NULL)
X      menu_i_print(i);
X  menumorewait();
X  xredraw();
X}
X
X
X
X
X/* talk to the animals -- learn their languages.... */
Xvoid talk()
X{
X  int dir;
X  int dx,dy,index=0;
X  char response;
X  struct monster *m;
X  printm("\nTalk:");
X  index = getdir();
X
X  if (index == ABORT)
X    Skipmonsters = TRUE;
X  else {
X    dx = Dirs[0][index];
X    dy = Dirs[1][index];
X    
X    if ((! inbounds(Player.x+dx, Player.y+dy)) ||
X	(Dungeon[Dlevel][Player.x+dx][Player.y+dy].creature == NULL)) {
X      printm("\nThere's nothing there to talk to!!!");
X      Skipmonsters = TRUE;
X    }
X    else {
X      m = Dungeon[Dlevel][Player.x+dx][Player.y+dy].creature;
X      menuclear();
X      strcpy(Str1,"     Talk to ");
X      strcat(Str1,m->monstring);
X      strcat(Str1,":");
X      menuprint(Str1);
X      menuprint("\na: Greet.");
X      menuprint("\nb: Threaten.");
X      menuprint("\nc: Surrender.");
X      menuprint("\nESCAPE: Clam up.");
X      do response = menugetc();
X      while ((response != 'a') &&
X	     (response != 'b') &&
X	     (response != 'c') &&
X	     (response != ESCAPE));
X      switch(response) {
X      case 'a': monster_talk(m); break;
X      case 'b': threaten(m); break;
X      case 'c': surrender(m); break;
X      default: Skipmonsters = TRUE; break;
X      }
X    }
X  }
X  xredraw();
X}
X
X/* try to deactivate a trap */
Xvoid disarm()
X{
X  int dir;
X  int x,y,index=0;
X  pob o;
X
X  index = getdir();
X
X  if (index == ABORT)
X    Skipmonsters = TRUE;
X  else {
X    x = Dirs[0][index]+Player.x;
X    y = Dirs[1][index]+Player.y;
X    
X    if (! inbounds(x,y))
X      mprint("Whoa, off the map...");
X    else if (Dungeon[Dlevel][x][y].locchar != TRAP)
X      mprint("You can't see a trap there!");
X    else {
X      if (random_range(50+Dlevel*2) < 
X	  Player.dex+Player.level+Player.rank[THIEVES]*10) {
X	mprint("You disarmed the trap!");
X	if (random_range(100) < Player.dex+Player.rank[THIEVES]*10) {
X	  o = ((pob) malloc(sizeof(objtype)));
X	  switch(Dungeon[Dlevel][x][y].p_locf) {
X	  case L_TRAP_DART: 
X	    *o=Objects[THINGID+17];
X	    break;
X	  case L_TRAP_DISINTEGRATE:
X	    *o=Objects[THINGID+23];
X	    break;
X	  case L_TRAP_SLEEP_GAS:
X	    *o=Objects[THINGID+22];
X	    break;
X	  case L_TRAP_TELEPORT:
X	    *o=Objects[THINGID+21];
X	    break;
X	  case L_TRAP_ABYSS:
X	    *o=Objects[THINGID+24];
X	    break;
X	  case L_TRAP_FIRE:
X	    *o=Objects[THINGID+20];
X	    break;
X	  case L_TRAP_SNARE:
X	    *o=Objects[THINGID+19];
X	    break;
X	  case L_TRAP_ACID:
X	    *o=Objects[THINGID+18];
X	    break;
X	  case L_TRAP_MANADRAIN:
X	    *o=Objects[THINGID+25];
X	    break;
X	  default:
X	    o = NULL;
X	    break;
X	  }
X	  if (o != NULL) {
X	    mprint("You manage to retrieve the trap components!");
X	    Objects[o->id].known = 1;
X	    o->known = 1;
X	    add_item_to_pack(o);
X	    gain_experience(25);
X	  }
X	}
X	Dungeon[Dlevel][x][y].p_locf = L_NO_OP;
X	Dungeon[Dlevel][x][y].locchar = FLOOR;
X	gain_experience(5);
X      }
X      else if (random_range(10+Dlevel) > Player.dex) {
X	mprint("You accidentally set off the trap!");
X	Player.x = x; Player.y = y;
X	p_movefunction(Dungeon[Dlevel][x][y].p_locf);
X      }
X      else mprint("You failed to disarm the trap.");
X    }
X  }
X}
X
X/* is it more blessed to give, or receive? */
Xvoid give()
X{
X  int index;
X  int dx,dy,dindex=0;
X  struct monster *m;
X  pob obj;
X
X  printm("\nGive to monster --");
X  dindex = getdir();
X  if (dindex == ABORT) 
X    Skipmonsters = TRUE;
X  else {
X    dx = Dirs[0][dindex];
X    dy = Dirs[1][dindex];
X    if ((! inbounds(Player.x+dx, Player.y+dy)) ||
X	(Dungeon[Dlevel][Player.x+dx][Player.y+dy].creature == NULL)) {
X      printm("\nThere's nothing there to give something to!!!");
X      Skipmonsters = TRUE;
X    }
X    else {
X      m = Dungeon[Dlevel][Player.x+dx][Player.y+dy].creature;
X      printm("\nItem to give away: "); 
X      index = getitem(NULL);
X      if (index == ABORT)
X	Skipmonsters = TRUE;
X      else if (index == CASHVALUE) give_money(m);
X      else if (! cursed(Player.possessions[index-'a'])) {
X	  obj = ((pob) calloc(1,sizeof(objtype)));
X	  *obj = *(Player.possessions[index-'a']);
X	  obj->number = 1;
X	  givemonster(m,obj);
X	  printm("\nGiven: ");
X	  mprint(itemid(obj));
X	  morewait();
X	  clearmsg();
X	  calc_melee();
X	}
X	else {
X	  mprint("You can't even give away: ");
X	  mprint(itemid(Player.possessions[index-'a']));
X	}
X      }
X    }
X}
X
X
X
X
X/* zap a wand, of course */
Xvoid zapwand()
X{
X  int index;
X  struct object *obj;
X
X  if (Player.status[AFRAID] > 0)
X    mprint("You are so terror-stricken you can't hold a wand straight!");
X  else {
X    printm("\nZap --");
X    index = getitem(STICK);
X    if (index == ABORT)
X      Skipmonsters = TRUE;
X    else {
X      obj = Player.possessions[index-'a'];
X      if (obj->objchar != STICK) {
X	printm("\nYou can't zap: ");
X	printm(itemid(obj));
X      }
X      else 
X	if (obj->charge < 1) 
X	  printm("\nFizz.... Pflpt. Out of charges. ");
X	else {
X	  obj->charge--;
X	  item_use(obj);
X	}
X    }
X  }
X}
X
X/* cast a spell */
Xvoid magic()
X{
X  int index,drain;
X  if (Player.status[AFRAID] > 0)
X    mprint("You are too afraid to concentrate on a spell!");
X  else {
X    index = getspell();
X    xredraw();
X    if (index == ABORT)
X      Skipmonsters = TRUE;
X    else {
X      drain = Spells[index].powerdrain;
X      if (Lunarity == 1) drain = drain / 2;
X      else if (Lunarity == -1) drain = drain *2;
X      if (drain > Player.mana)
X	mprint("You lack the power for that spell! ");
X      else {
X	Player.mana -= drain;
X	(*(Spells[index].castf))();
X      }
X    }
X  }
X}
X
Xvoid levelchange(newlevel,sitechar)
Xint newlevel;
Xchar sitechar;
X{
X  char reverse=FLOOR;
X
X  if (sitechar==UP) reverse = DOWN;
X  else if (sitechar==DOWN) reverse = UP;
X
X  if (Dungeon[Dlevel][Player.x][Player.y].locchar != sitechar)
X    mprint("Not here!");
X  else {
X    Dungeon[Dlevel][Player.x][Player.y].showchar = 
X      Dungeon[Dlevel][Player.x][Player.y].locchar;
X    if (newlevel < 0) {
X      mprint("You appear high above the ground!");
X      p_damage(abs(newlevel)*10,UNSTOPPABLE,"a fall from a height");
X      newlevel = 0;
X      }
X    else if ((newlevel == NUMLEVELS-1) && (newlevel-Dlevel > 1)) {
X      if (Player.patron != DESTINY) {
X	mprint("Some mysterious force changes your destination...");
X	newlevel = Dlevel+1;
X      }
X      else mprint("Your long hours of devotion are finally paid off!");
X    }
X    else if (newlevel >= NUMLEVELS) {
X      mprint("You appear deep underground!!!");
X      p_death("molten magma");
X    }
X    morewait();
X    if (newlevel > Dlevel+1) {
X      printm("\nYou descend ");
X      mnumprint(newlevel-Dlevel);
X      mprint(" levels...");
X    }
X    else if (newlevel == Dlevel+1)
X      printm("\nYou descend a level.");
X    else if (newlevel+1 == Dlevel)
X      printm("\nYou ascend a level.");
X    else if (newlevel+1 < Dlevel) {
X      printm("\nYou ascend ");
X      mnumprint(Dlevel-newlevel);
X      mprint(" levels...");
X    }
X    
X    if (newlevel == 0) {
X      Dlevel = 0;
X      erase_level();
X      if (! Leveldata[0].generated) load_city();
X      Player.x = 32;
X      Player.y = 2;
X      drawvision(Player.x,Player.y,Player.vision);
X      Leveldata[0].generated = TRUE;
X      mprint("You find yourself on a familiar street corner.");
X      locprint("The City of Rampart.");
X      WhichScreen = 0;
X      show_screen(WhichScreen);
X    }
X    else {
X      Deepest = max(Deepest,newlevel);
X      erase_level();
X      if (Leveldata[newlevel].generated)
X	change_level(newlevel,reverse); /* sets player location */
X      else create_level(Dlevel,newlevel,reverse); /* ditto */
X      Leveldata[newlevel].generated = TRUE;
X
X      Dlevel = newlevel;
X
X      screencheck(Player.y);
X      roomcheck();
X    }
X  }
X}
X
X
X/* set various player options */
Xvoid setoptions()
X{
X  char response=' ';
X
X  printm("\nOption BELLICOSE [TF]: ");
X  printm( optionp(BELLICOSE) ? "(now T) " : "(now F) ");
X  while ((response != 'T') && (response != 'F'))
X    response = mgetc();
X  maddch(response);
X  if (response == 'T') optionset(BELLICOSE);
X  else optionreset(BELLICOSE);
X  response = ' ';
X  printm("\nOption JUMPMOVE [TF]: ");
X  printm( optionp(JUMPMOVE) ? "(now T) " : "(now F) ");
X  while ((response != 'T') && (response != 'F'))
X    response = mgetc();
X  maddch(response);
X  if (response == 'T') optionset(JUMPMOVE);
X  else optionreset(JUMPMOVE);
X  response = ' ';
X  printm("\nOption PICKUP [TF]: ");
X  printm( optionp(PICKUP) ? "(now T) " : "(now F) ");
X  while ((response != 'T') && (response != 'F'))
X    response = mgetc();
X  maddch(response);
X  if (response == 'T') optionset(PICKUP);
X  else optionreset(PICKUP);
X  response = ' ';
X  printm("\nOption RUNSTOP [TF]: ");
X  printm( optionp(RUNSTOP) ? "(now T) " : "(now F) ");
X  while ((response != 'T') && (response != 'F'))
X    response = mgetc();
X  maddch(response);
X  if (response == 'T') optionset(RUNSTOP);
X  else optionreset(RUNSTOP);
X  response = ' ';
X  printm("\nOption CONFIRM [TF]: ");
X  printm( optionp(CONFIRM) ? "(now T) " : "(now F) ");
X  while ((response != 'T') && (response != 'F'))
X    response = mgetc();
X  maddch(response);
X  if (response == 'T') optionset(CONFIRM);
X  else optionreset(CONFIRM);
X  printm("\nOption SEARCHNUM [0>x>10]: ");
X  printm("(now ");
X  maddch(Searchnum+'0');
X  printm(") ");
X  Searchnum = parsenum();
X  if (Searchnum < 1) {
X    printm("\nSet minimum value: 1");
X    Searchnum = 1;
X  }
X  else if (Searchnum > 9) {
X    printm("\nSet maximum value: 9");
X    Searchnum = 9;
X  }
X}
X
X
X/* name an item */
Xvoid callitem()
X{
X  int index;
X  pob obj;
X
X  Skipmonsters = TRUE;
X  printm("\nCall --");
X  index = getitem(NULL);
X  if (index == CASHVALUE) mprint("Can't rename cash!");
X  else if (index != ABORT) {
X    obj = Player.possessions[index-'a'];
X    if (obj->known)
X      printm("\nThat item is already identified!");
X    else {
X      printm("\nCall it:");
X      strcpy(obj->objstr,msgscanstring());
X      clearmsg();
X      printm("\nAlso call by that name all similar items? [yn]");
X      if (ynq() == 'y') strcpy(Objects[obj->id].objstr,obj->objstr);
X    }
X  }
X}
X      
X
X
X
X/* open a door */
Xvoid opendoor()
X{
X  int dir;
X  int ox,oy;
X
X  printm("\nOpen door");
X  dir = getdir();
X  if (dir == ABORT)
X    Skipmonsters = TRUE;
X  else {
X    ox = Player.x + Dirs[0][dir];
X    oy = Player.y + Dirs[1][dir];
X    if (Dungeon[Dlevel][ox][oy].locchar == OPEN_DOOR) {
X      mprint("That door is already open!");
X      Skipmonsters = TRUE;
X    }
X    else if ((Dungeon[Dlevel][ox][oy].locchar != CLOSED_DOOR) || 
X	Dungeon[Dlevel][ox][oy].secret) {
X	  mprint("You can't open that!");
X	  Skipmonsters = TRUE;
X	}
X    else if (Dungeon[Dlevel][ox][oy].aux == LOCKED) 
X      mprint("That door seems to be locked.");
X    else Dungeon[Dlevel][ox][oy].locchar = OPEN_DOOR;
X  }
X}
X
X
X
X/* Try to destroy some location */
Xvoid bash_location()
X{
X  int dir;
X  int ox,oy;
X
X  printm("\nBashing location:");
X  dir = getdir();
X  if (dir == ABORT)
X    Skipmonsters = TRUE;
X  else {
X    ox = Player.x + Dirs[0][dir];
X    oy = Player.y + Dirs[1][dir];
X    if (Dungeon[Dlevel][ox][oy].locchar == WALL) {
X      mprint("You hurl yourself at the wall!");
X      p_damage(Player.str,NORMAL_DAMAGE,"a suicidal urge");
X    }
X    else if (Dungeon[Dlevel][ox][oy].locchar == OPEN_DOOR) {
X      mprint("You hurl yourself through the open door!");
X      mprint("Yaaaaah! ... thud.");
X      Player.x = ox;
X      Player.y = oy;
X      p_damage(3,UNSTOPPABLE,"silliness");
X      p_movefunction(Dungeon[Dlevel][Player.x][Player.y].p_locf);
X      Skipmonsters = TRUE; /* monsters are surprised... */
X    }
X    else if (Dungeon[Dlevel][ox][oy].locchar == CLOSED_DOOR) {
X      if (Dungeon[Dlevel][ox][oy].secret) {
X	mprint("You found a secret door!");
X	Dungeon[Dlevel][ox][oy].secret = FALSE;
X      }
X      if (Dungeon[Dlevel][ox][oy].aux == LOCKED) {
X	if (Dlevel == NUMLEVELS-1) {
X	  mprint("Ouch! The door was made out of adamant!");
X	  p_damage(Player.str,UNSTOPPABLE,"a door");
X	}
X	else if (random_range(100)+Dlevel < Player.str) {
X	  Player.x = ox;
X	  Player.y = oy;
X	  mprint("You blast the door off its hinges!");
X	  p_movefunction(Dungeon[Dlevel][Player.x][Player.y].p_locf);
X	  Dungeon[Dlevel][ox][oy].locchar = FLOOR;
X	  Skipmonsters = TRUE; /* monsters are surprised... */
X	}
X	else {
X	  mprint("Crash! The door holds.");
X	  if (random_range(30) > Player.str)
X	    p_damage(max(1,statmod(Player.str)),UNSTOPPABLE,"a door");
X	}
X      }
X      else {
X	Player.x = ox;
X	Player.y = oy;
X	mprint("You bash open the door!");
X	if (random_range(30) > Player.str)
X	  p_damage(1,UNSTOPPABLE,"a door");
X	p_movefunction(Dungeon[Dlevel][Player.x][Player.y].p_locf);
X	Dungeon[Dlevel][ox][oy].locchar = OPEN_DOOR;
X	Skipmonsters = TRUE; /* monsters are surprised... */
X      }
X    }
X    else if (Dungeon[Dlevel][ox][oy].locchar == STATUE){
X      mprint("you shouldn't of ought to have done that....");
X      l_statue_wake();
X    }
X    else {
X      mprint("You restrain yourself from total silliness.");
X      Skipmonsters = TRUE;
X    }
X  }
X}
X
X
X/* attempt destroy an item */
Xvoid bash_item()
X{
X  int item;
X  pob obj;
X  printm("\nDestroy an item: ");
X  morewait();
X  item = getitem(NULL);
X  if (item == CASHVALUE) mprint("Can't destroy cash!");
X  else if (item != ABORT) {
X    obj = Player.possessions[item-'a'];
X    if (Player.str+random_range(20) > obj->fragility+random_range(20)) {
X      if (Player.alignment < 0) {
X	mprint("That was fun....");
X	gain_experience(obj->level * obj->level * 5);
X      }
X      damage_item(obj);
X    }
X    else {
X      if (obj->objchar == WEAPON) {
X	mprint("The weapon turned in your hand -- you hit yourself!");
X	p_damage(random_range(obj->dmg+abs(obj->plus)),
X		 NORMAL_DAMAGE,
X		 "a failure at vandalism");
X      }
X      else if (obj->objchar == ARTIFACT) {
X	mprint("Uh Oh -- Now you've gotten it angry....");
X	p_damage(obj->level*10,
X		 UNSTOPPABLE,
X		 "an enraged artifact");
X      }
X      else {
X	mprint("Ouch! Damn thing refuses to break...");
X	p_damage(1,UNSTOPPABLE,"a failure at vandalism");
X      }
X    }
X  }
X}
X
X
X/* guess what this does */
Xvoid save()
X{
X  printm("\nEnter filename to save character to: ");
X  strcpy(Str1,msgscanstring());
X  if (save_game(Str1)) {
X    endgraf();
X    printf("Bye!\n");
X    exit(0);
X  }
X  else Skipmonsters = TRUE;
X}
X
X
X/* close a door */
Xvoid closedoor()
X{
X  int dir;
X  int ox,oy;
X
X  printm("\nClose door");
X  dir = getdir();
X  if (dir == ABORT)
X    Skipmonsters = TRUE;
X  else {
X    ox = Player.x + Dirs[0][dir];
X    oy = Player.y + Dirs[1][dir];
X    if (Dungeon[Dlevel][ox][oy].locchar == CLOSED_DOOR) {
X      mprint("That door is already closed!");
X      Skipmonsters = TRUE;
X    }
X    else if (Dungeon[Dlevel][ox][oy].locchar != OPEN_DOOR) {
X      mprint("You can't close that!");
X      Skipmonsters = TRUE;
X    }
X    else Dungeon[Dlevel][ox][oy].locchar = CLOSED_DOOR;
X  }
X}
X
X/* handle a h,j,k,l, etc. */
Xvoid moveplayer(dx,dy)
Xint dx,dy;
X{
X  struct location *p;
X
X  if (p_moveable(Player.x+dx,Player.y+dy)) {
X    if (Player.status[IMMOBILE] > 0) {
X      Fastmove = FALSE;
X      mprint("You are unable to move");
X    }
X    else {
X      Player.x += dx;
X      Player.y += dy;
X      p_movefunction(Dungeon[Dlevel][Player.x][Player.y].p_locf);
X      if (Fastmove)
X	Fastmove =
X	  ! ((Dungeon[Dlevel][Player.x][Player.y].things != NULL) ||
X	     (optionp(RUNSTOP) && 
X	      Dungeon[Dlevel][Player.x][Player.y].stopsrun));
X      if ((Dungeon[Dlevel][Player.x][Player.y].things != NULL) &&
X	  (optionp(PICKUP)))
X	pickup();
X      screencheck(Player.y);
X      roomcheck();
X    }
X  }
X  else if (Fastmove == TRUE) {
X    drawvision(Player.x,Player.y,Player.vision);
X    Fastmove = FALSE;
X  }
X}
X
X
X
X/* look at some spot */
Xvoid examine()
X{
X  pol ol;
X  int x=Player.x,y=Player.y;
X
X  Skipmonsters = TRUE;
X  mprint("Examine:");
X  setspot(&x,&y);
X  if (! los_p(Player.x,Player.y,x,y))
X    mprint("I refuse to examine something I can't see.");
X  else {
X    printm("\nYou see:");
X    menuclear();
X    if (Dungeon[Dlevel][x][y].creature != NULL) {
X      strcpy(Str3,mstatus_string(Dungeon[Dlevel][x][y].creature));
X      menuprint(Str3);
X      menuprint("\n---------------------------\n");
X    }
X    else if ((Player.x == x) && (Player.y ==y)) {
X      describe_player();
X      menuprint("\n---------------------------\n");
X    }
X    if (Dungeon[Dlevel][x][y].things != NULL) {
X      ol = Dungeon[Dlevel][x][y].things;
X      while (ol != NULL) {
X	menuprint(itemid(ol->thing));
X	menuprint("\n");
X	ol = ol->next;
X      }
X      menuprint("---------------------------\n");
X    }
X    if (Dungeon[Dlevel][x][y].secret)
X      menuprint("An age-worn stone wall.\n");
X    else
X      switch (Dungeon[Dlevel][x][y].locchar) {
X        case ABYSS: menuprint("An entrance to the infinite abyss\n"); break;
X        case PORTAL: menuprint("A strange glowing portal\n"); break;
X        case FLOOR:menuprint("A dirty stone floor.\n"); break;
X        case WALL:
X	  if (Dungeon[Dlevel][x][y].aux < 10)
X	    menuprint("A pitted concrete wall.\n");
X	  else if (Dungeon[Dlevel][x][y].aux < 30)
X	    menuprint("An age-worn sandstone wall.\n");
X	  else if (Dungeon[Dlevel][x][y].aux < 50)
X	    menuprint("A smooth basalt wall.\n");
X	  else if (Dungeon[Dlevel][x][y].aux < 70)
X	    menuprint("A solid granite wall.\n");
X	  else if (Dungeon[Dlevel][x][y].aux < 90)
X	    menuprint("A reinforced plasteel wall.\n");
X	  else if (Dungeon[Dlevel][x][y].aux < 110)
X	    menuprint("A thick wall of Rampart bluestone\n");
X	  else menuprint("A wall of Puppeteer hull metal.\n");
X	  break;
X        case CLOSED_DOOR:menuprint("A solid oaken door, now closed.\n"); break;
X        case OPEN_DOOR:menuprint("A solid oaken door, now open.\n"); break;
X        case STATUE:menuprint("A strange-looking statue.\n"); break;
X        case UP:menuprint("A stairway leading up.\n"); break;
X        case DOWN:menuprint("A stairway leading down....\n"); break;
X        case TRAP:menuprint(trapid(Dungeon[Dlevel][x][y].p_locf));
X		   menuprint("\n"); break;
X        case HEDGE:menuprint("A brambly, thorny hedge.\n"); break;
X        case LAVA:menuprint("A bubbling pool of lava.\n"); break;
X        case LIFT:menuprint("A strange glowing disk.\n"); break;
X        case ALTAR:menuprint("An (un?)holy altar.\n"); break;
X        case WHIRLWIND: case WHIRLWIND2:
X	  menuprint("A small electrical storm.\n"); break;
X        case WATER: 
X	  if (Dungeon[Dlevel][x][y].p_locf == L_WATER)
X	    menuprint("A deep pool of water.\n");
X	  else menuprint("An eerie pool of water.\n");
X	  break;
X        case FIRE:menuprint("A curtain of fire.\n"); break;
X      }
X    menumorewait();
X    xredraw();
X  }
X}
X
X
Xvoid help()
X{
X  char c;
X
X  printm("\nh for help, c for command list, ESCAPE to quit: ");
X  do 
X    c = mgetc();
X  while ((c != 'h') && (c != 'c') && (c != ESCAPE));
X
X  if (c == 'h') helpfile();
X  else if (c == 'c') commandlist();
X}  
X
X
Xvoid version()
X{
X  Skipmonsters=TRUE;
X  printm("\n");
X  printm(VERSIONSTRING);
X}
X
Xvoid fire()
X{
X  int index,x1,y1,x2,y2;
X  pob obj;
X  struct monster *m;
X
X  printm("\nFire/Throw --");
X  index = getitem(NULL);
X  if (index == ABORT)
X    Skipmonsters = TRUE;
X  else if (index == CASHVALUE) mprint("Can't fire money at something!");
X  else if (cursed(Player.possessions[index-'a']))
X    mprint("You can't seem to get rid of it!");
X  else if (Player.possessions[index-'a']->used)
X    mprint("You'd better stop using it first.");
X  else if ((Player.primary != NULL) &&  /* load a crossbow */
X	   (Player.primary->id == WEAPONID+27) && /* crossbow id */
X	   (Player.primary->aux != LOADED) &&
X	   (Player.possessions[index-'a']->id == WEAPONID+29)) { /* bolt id */
X	     mprint("You crank back the crossbow and load a bolt.");
X	     Player.primary->aux = LOADED;
X	   }
X  else {
X    obj = Player.possessions[index-'a'];
X    x1 = x2 = Player.x;
X    y1 = y2 = Player.y;
X    setspot(&x2,&y2);
X    do_object_los(obj->objchar,&x1,&y1,x2,y2);
X    if ((m=Dungeon[Dlevel][x1][y1].creature) != NULL) {
X      if (obj->dmg == 0) {
X	if (m->treasure > 0) { /* ie, the monster can have treasure/objects */
X	  strcpy(Str1,"The ");
X	  strcat(Str1,m->monstring);
X	  strcat(Str1," catches your thrown offering!");
X	  mprint(Str1);
X	  givemonster(m,obj);
X	}
X	else {
X	  strcpy(Str1,"Your thrown offering bounces off the ");
X	  strcat(Str1,m->monstring);
X	  mprint(Str1);
X	  drop_at(x1,y1,obj);
X	}
X      }
X      else if (hitp(Player.hit,m->ac)) /* ok already, hit the damn thing */
X	weapon_use(2*statmod(Player.str),obj,m);
X      else {
X	strcpy(Str1,"Your ");
X	strcat(Str1,itemid(obj));
X	strcat(Str1," misses the ");
X	strcat(Str1,m->monstring);
X	mprint(Str1);
X	p_drop_at(x1,y1,1,obj);
X	conform_lost_objects(1,obj);
X      }
X    }
X    else {
X      p_drop_at(x1,y1,1,obj);
X      conform_lost_objects(1,obj);
X    }
X  }
X}
X
Xvoid quit()
X{
X  mprint("Quit: Are you sure? [yn] ");
X  if (ynq()=='y') {
X    display_quit();
X    endgraf();
X    exit(0);
X  }
X  else Skipmonsters=TRUE;
X}
X
X
Xvoid lastmprint()
X{
X  clearmsg();
X  printm(Laststring);
X  Skipmonsters = TRUE;
X}
X
Xvoid nap()
X{
X  static int naptime;
X  if (Fastmove) {
X    if (naptime-- < 1) {
X      Fastmove = FALSE;
X      drawvision(Player.x,Player.y,Player.vision);
X    }
X  }
X  else {
X    mprint("Rest for how long? (in turns) ");
X    naptime = parsenum();
X    if (naptime > 1000) {
X      mprint("You can only sleep up to 10 hours (1000 turns)");
X      naptime = 1000;
X    }
X    if (naptime > 1) {
X      Fastmove = TRUE;
X      mprint("Resting.... ");
X    }
X  }
X}
X
X
Xvoid charid()
X{
X  char id;
X  
X  printm("\nCharacter to identify: ");
X  id = mgetc();
X  if (((id >= 'a') && (id <= 'z')) || ((id >= 'A') && (id <= 'Z'))) 
X    printm("A monster or NPC -- examine (x) to find out exactly.");
X  else switch(id) {
X    case SPACE:
X      printm(" : Empty space or unknown region");
X      break;
X    case WALL:
X      printm(" : An (impenetrable?) wall");
X      break;
X    case PORTAL:
X      printm(" : A strange glowing portal");
X      break;
X    case OPEN_DOOR:
X      printm(" : An open door");
X      break;
X    case CLOSED_DOOR:
X      printm(" : A closed (possibly locked) door");
X      break;
X    case LAVA:
X      printm(" : A pool of lava");
X      break;
X    case HEDGE:
X      printm(" : A dense hedge");
X      break;
X    case WATER:
X      printm(" : A deep body of water");
X      break;
X    case WHIRLWIND:
X      printm(" : A mysterious storm");
X      break;
X    case FIRE:
X      printm(" : A curtain of fire");
X      break;
X    case TRAP:
X      printm(" : An uncovered trap");
X      break;
X    case UP:
X      printm(" : A stairway leading up");
X      break;
X    case DOWN:
X      printm(" : A stairway leading down");
X      break;
X    case FLOOR:
X      printm(" : The dungeon floor");
X      break;
X    case ABYSS:
X      printm(" : An entrance to the infinite abyss");
X      break;
X    case PLAYER:
X      printm(" : You, the player");
X      break;
X    case CORPSE:
X      printm(" : The remains of some creature");
X      break;
X    case THING:
X      printm(" : Some random miscellaneous object");
X      break;
X    case STATUE:
X      printm(" : A statue");
X      break;
X    case ALTAR:
X      printm(" : A (un?)holy altar");
X      break;
X    case CASH:
X      printm(" : Bills, specie, gems: cash");
X      break;
X    case PILE:
X      printm(" : A pile of objects");
X      break;
X    case FOOD:
X      printm(" : Something edible");
X      break;
X    case WEAPON:
X      printm(" : Some kind of weapon");
X      break;
X    case MISSILEWEAPON:
X      printm(" : Some kind of missile");
X      break;
X    case SCROLL:
X      printm(" : Something readable");
X      break;
X    case POTION:
X      printm(" : Something drinkable");
X      break;
X    case ARMOR:
X      printm(" : A suit of armor");
X      break;
X    case SHIELD:
X      printm(" : A shield");
X      break;
X    case CLOAK:
X      printm(" : A cloak");
X      break;
X    case BOOTS:
X      printm(" : A pair of boots");
X      break;
X    case STICK:
X      printm(" : A stick");
X      break;
X    case RING:
X      printm(" : A ring");
X      break;
X    case ARTIFACT:
X      printm(" : An artifact");
X      break;
X    default:
X      printm("That character is unused.");
X      break;
X    }
X}
X
Xvoid wizard()
X{
X  Skipmonsters = TRUE;
X  mprint("Really try to toggle wizard mode? [yn]");
X  if (ynq()=='y') {
X    if (strcmp(getlogin(),WIZARD)==0) {
X      if  (! Wizard) {
X	Cheated = TRUE;
X	mprint("Wizard mode set.");
X	Wizard = TRUE;
X      }
X      else {
X	mprint("Wizard mode reset.");
X	Wizard = FALSE;
X      }
X    }
X    else {
X      mprint("There is a shrieking sound, as of reality being distorted.");
X      strcpy(Str1,WIZARD);
X      strcat(Str1,", the Wizard of omega appears before you....");
X      mprint(Str1);
X      mprint("'Do not meddle in the affairs of Wizards --");
X      if (random_range(2)) mprint("it makes them soggy and hard to light.'");
X      else mprint("for they are subtle, and swift to anger!'");
X    }
X  }
X}
X
X
X/* Jump, that is */
Xvoid vault()
X{
X  static int lastvault = 0;
X  int x=Player.x,y=Player.y,jumper=0;
X  
X  if (Player.boots != NULL)
X    if (Player.boots->usef = I_BOOTS_JUMPING)
X      jumper = 2;
X  
X  if (lastvault+5 > Time) 
X    mprint("You're still recovering your wind from the last jump...");
X  else if (Player.status[IMMOBILE] > 0) {
X    Fastmove = FALSE;
X    mprint("You are unable to move");
X  }
X  else {
X    Skipmonsters = TRUE;
X    mprint("Jump where?");
X    setspot(&x,&y);
X    if (! los_p(x,y,Player.x,Player.y))
X      mprint("The way is obstructed.");
X    else if (distance(x,y,Player.x,Player.y) > 
X	     max(2,statmod(Player.agi)+2)+jumper)
X      mprint("The jump is too far for you.");
X    else if (Dungeon[Dlevel][x][y].creature != NULL)
X      mprint("You can't jump on another creature.");
X    else if (! p_moveable(x,y))
X      mprint("You can't jump there.");
X    else {
X      lastvault = Time;
X      Skipmonsters = FALSE;
X      Player.x = x;
X      Player.y = y;
X      if ((! jumper) && (random_range(30) > Player.agi)) {
X	mprint("Oops -- took a tumble.");
X	Skipplayer = TRUE;
X	p_damage((Player.itemweight/250),UNSTOPPABLE,"clumsiness");
X      }
X      p_movefunction(Dungeon[Dlevel][Player.x][Player.y].p_locf);
X      if ((Dungeon[Dlevel][Player.x][Player.y].things != NULL) &&
X	  (optionp(PICKUP)))
X	pickup();
X      screencheck(Player.y);
X      roomcheck();
X    }
X  }
X}
X
X
X
X/* fight an adjacent monster */
Xvoid fight()
X{
X  int dir;
X  int ox,oy;
X  int level=Dlevel,x=Player.x,y=Player.y;
X  struct monster *m;
X  
X  if (Player.status[AFRAID] > 0)
X    mprint("You are much too afraid to fight!");
X  else if (player_on_sanctuary())
X    mprint("You dare not profane this holy place.");
X  else {
X    printm("\nFight");
X    dir = getdir();
X    if (dir == ABORT)
X      Skipmonsters = TRUE;
X    else {
X      ox = Player.x + Dirs[0][dir];
X      oy = Player.y + Dirs[1][dir];
X      if ((m=Dungeon[Dlevel][ox][oy].creature) == NULL) {
X	mprint("There's no enemy there!");
X	Skipmonsters = TRUE;
X      }
X      else {
X	if (m->attacked == 0) Player.alignment--; /* chaotic action */
X	tacmode(m);
X	Tacmode = FALSE; /* just making sure */
X	xredraw();
X      }      
X    }
X  }
X}
X
X
X/* Do the Artful Dodger trick */
Xvoid pickpocket()
X{
X  int dir;
X  int dx,dy,index=0;
X  struct monster *m;
X
X  index = getdir();
X
X  if (index == ABORT)
X    Skipmonsters = TRUE;
X  else {
X    dx = Dirs[0][index];
X    dy = Dirs[1][index];
X    
X    if ((! inbounds(Player.x+dx, Player.y+dy)) ||
X	(Dungeon[Dlevel][Player.x+dx][Player.y+dy].creature == NULL)) {
X      printm("\There's nothing there to steal from!!!");
X      Skipmonsters = TRUE;
X    }
X    else {
X      m = Dungeon[Dlevel][Player.x+dx][Player.y+dy].creature;
X      if (m->id == ML0+3) {
X	mprint("Trying to steal from a guardsman, eh?");
X	mprint("Go directly to jail. Do not pass go, do not collect 200Au.");
X	erase_level();
X	Dlevel=0;
X	if (! Leveldata[0].generated) load_city();
X	mprint("You are taken to the city gaol.");
X	send_to_jail();
X	locprint("The City of Rampart.");
X	drawvision(Player.x,Player.y,Player.vision);
X      }
X      else if (m->possessions == NULL) {
X	mprint("You couldn't find anything worth taking!");
X	mprint("But you managed to annoy it...");
X	m_status_set(m,HOSTILE);
X      }
X      else if (Player.dex*5+Player.rank[THIEVES]*20+random_range(100) >
X	       random_range(100)+m->level*20) {
X	mprint("You successfully complete your crime!");
X	mprint("You stole:");
X	mprint(itemid(m->possessions->thing));
X	Player.alignment--;
X	gain_experience(m->level*m->level);
X	add_item_to_pack(m->possessions->thing);
X	m->possessions = m->possessions->next;
X      }
X    }
X  }
X}
X
X
X
Xvoid rename_player()
X{
X  Skipmonsters = TRUE;
X  printm("\nRename Character:");
X  strcpy(Player.name,msgscanstring());
X}
X
X
Xvoid abortshadowform()
X{
X  Skipmonsters = TRUE;
X  if (Player.status[SHADOWFORM] && (Player.status[SHADOWFORM]<1000)) {
X    mprint("You abort your spell of Shadow Form.");
X    Player.immunity[NORMAL_DAMAGE]--;
X    Player.immunity[ACID]--;
X    Player.immunity[THEFT]--;
X    Player.immunity[INFECTION]--;
X    mprint("You feel less shadowy now.");
X    Player.status[SHADOWFORM] = 0;
X  }
X}
X
Xvoid tunnel()
X{
X  int dir,ox,oy;
X
X  printm("\Tunnel");
X  dir = getdir();
X  if (dir == ABORT)
X    Skipmonsters = TRUE;
X  else {
X    ox = Player.x + Dirs[0][dir];
X    oy = Player.y + Dirs[1][dir];
X    if (Dungeon[Dlevel][ox][oy].secret)
X      mprint("You have no success as yet.");
X    else if (Dungeon[Dlevel][ox][oy].locchar != WALL) {
X      mprint("You can't tunnel through that!");
X      Skipmonsters = TRUE;
X    }
X    else {
X      if (random_range(20)==1){
X	if (Player.primary == NULL) {
X	  mprint("Ouch! broke a fingernail...");
X	  p_damage(Player.str / 6,UNSTOPPABLE,"A broken fingernail");
X	}
X	else if ((Player.primary->type == THRUSTING) ||
X		 ((Player.primary->type != STRIKING) &&
X		  (Player.primary->fragility < random_range(20)))) {
X	  mprint("Clang! Uh oh...");
X	  damage_item(Player.primary);
X	}
X	else mprint("Your digging implement shows no sign of breaking.");
X      }
X      if (Player.primary == NULL) {
X	if ((Player.str/3)+random_range(100) >
X	    Dungeon[Dlevel][ox][oy].aux*2) {
X	  mprint("You carve a tunnel through the stone!");
X	  tunnelcheck();
X	  Dungeon[Dlevel][ox][oy].locchar = FLOOR;
X	}
X      }
X      else if (Player.primary->type == THRUSTING) {
X	if (Player.primary->dmg*2+random_range(100) >
X	    Dungeon[Dlevel][ox][oy].aux) {
X	  mprint("You carve a tunnel through the stone!");
X	  tunnelcheck();
X	  Dungeon[Dlevel][ox][oy].locchar = FLOOR;
X	}
X      }
X      else if (Player.primary->dmg+random_range(100) >
X	       Dungeon[Dlevel][ox][oy].aux) {
X	mprint("You carve a tunnel through the stone!");
X	tunnelcheck();
X	Dungeon[Dlevel][ox][oy].locchar = FLOOR;
X      }
X      else mprint("You have no success as yet.");
X    }
X  }
X}
X
X
X
X
END_OF_ocom.c
if test 46035 -ne `wc -c <ocom.c`; then
    echo shar: \"ocom.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f odepths.dat -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"odepths.dat\"
else
echo shar: Extracting \"odepths.dat\" \(4161 characters\)
sed "s/^X//" >odepths.dat <<'END_OF_odepths.dat'
X################################################################
X###############|###############GG###############|.####...##...##
X################^^^^#....#####....#####....#....#.####.##.#.##.#
X####################.####.###......###.####.#####.####...##...##
X####################.#####.#.##..##.#.#####.#####.####.#.##.##.#
X#####################^#####.##.##.##.#####.######....|.##.|...##
X####################S#.###.##.####.##.###.#S##################|#
X##################.D###.#.##.##..##.##.#.###D.####DS.##..##....#
X##################..####.##.###D.###.##.####.^#######|.##.|###.#
X#################S#####.##.#.##SS##.#.##.#####S########..####.##
X################.#####.##.###.^^^^.###.##.#####.######.##.##.###
X###############.#####.##.##############.##.#####.######..##^####
X##############.#######.##..............##.#######.##############
X#############.#.#######.################.#######.#.#############
X############.###.#######................#######.###.############
X###########.###.#.#####^#######SS#######^#####.#.###.###########
X##########.###.###.####..##..........##..####^###.###.##########
X#########.###.###.#.####..##.######.##..####.#.###.###.#########
X########.###.###.###.####..##.####.##..####.###.###.###^########
X###########.###.##.##.####..##S##S##..####.##.##.###.###########
X##########.###.##.#.##.####..##^D##..####.##.#.##.###.##########
X#########.###.##.#S#.##.####..####..####.##.###.##.###.#########
X########.###.##.##D##.##.####..##..####.##.##D##.##.###^########
X###########.##.#######.##.####....####.##.###S###.##.###########
X##########.##....^^^....##.####..####.##..........###.##########
X#########.########^########.########.########.########.#########
X########................................................########
X###############################SS###############################
X################################-#-#-#o#########################
X#################################-#-#-##########################
X################################################################
X################################################################
X################################################################
X################################################################
X###########BSSSSSSSSSSSSSS............SSSSSSSSSSSSSSIIIIIII#####
X###########S###############..........###############IIIIIII#####
X###########B################........################IIIIIII#####
X###########S#################......#############################
X###########B##################....##############################
X#############K#################..#################K#############
X#############S#################..#################S#############
X#############K##################Y#################K#############
X#############S########K########Y#########K########S#############
X#####.#######S########S#########Y########S########S#######.#####
X####...######S########S########Y#########S########S######...####
X###.....#####S########SSS######YY######SSS########S#####.....###
X##-......#SSSSSSSSSSSS###....XXXXXX....###SSSSSSSSSSSS#......-##
X#^111####S###############.############.###############S####111^#
X#^1~~~..1111.11.11.11.11S.#1111111111#.S11.11.11.11.11.11.;;;1^#
X#W-^~~..-..-..-..-..-..-S.#11""""""11#.S-..-..-..-..-..-..;;^-F#
X#^1~~~..1111.11.11.11.11S.#11""00""11#.S11.11.11.11.11.11.;;;1^#
X#^111####S###############.#11""""""11#.###############S####111^#
X##-......#SSSS###########.#111""""111#.###########SSSS#......-##
X###.....######SSSSS...SSS.##111""111##.SSS...SSSSS######.....###
X####...######S######S####.#^111MM111^#.####S######S######...####
X#####.######S#######S####..............####S#######S######.#####
X###########S####^###S###SSSS###SS###SSSS###S###^####S###########
X####SSSSS#S####^^^##K##....##SS##SS##....##K##^^^####S#SSSSS####
X###S#####S####^^6^^###....##S##SS##S##....###^^'^^####S#####S###
X##S##SSS#####^^666..##.########S#########.##^^'''^^#####SSS##S##
X#S##K###S###^^^-A66..##......###S##......##..''E-^^^###S###K##S#
X##S####S###^^6666666..#######.#S##.#######..'''''''^^###S####S##
X###SSSS###^^^^^^^^^^.........###<##.........^^^^^^^^^^###SSSS###
X################################################################
X
END_OF_odepths.dat
if test 4161 -ne `wc -c <odepths.dat`; then
    echo shar: \"odepths.dat\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f omega.lognum -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"omega.lognum\"
else
echo shar: Extracting \"omega.lognum\" \(2 characters\)
sed "s/^X//" >omega.lognum <<'END_OF_omega.lognum'
X4
END_OF_omega.lognum
if test 2 -ne `wc -c <omega.lognum`; then
    echo shar: \"omega.lognum\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f oscroll1.txt -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"oscroll1.txt\"
else
echo shar: Extracting \"oscroll1.txt\" \(2291 characters\)
sed "s/^X//" >oscroll1.txt <<'END_OF_oscroll1.txt'
XTheogony of Omega,
X
Xbeing an explication of the Ways of the Gods of Omega.
X
XKnow ye, O ignorant ones, that Omega is the battleground of the mighty forces
Xof Law and Chaos. Powerful are the Champions and Avatars of the two great
Xforces, but most powerful of all are the Gods who, it is rumored, have
Xbeen summoned from other planes to represent the two forces.
X
XOn the side of Law:
X
X  Odin, God of Vengeance -- followers of Odin vow to eradicate the taint
Xof chaos wherever it may be found. Odin rewards his faithful with the
Xpower to strike strong blows against the Legions of Chaos.
X
X  Athena, Goddess of Justice -- devotees of Athena, while prepared to
Xfight the forces of chaos, choose a more intellectual approach to the
Xbattle, marshalling the more subtle powers of magic in their striving.
X
XOn the side of Chaos:
X
X  Set, God of Destruction -- worshippers of Set will follow any path to
Xdestroy and corrupt Law and its minions. Set teaches his followers powers
Xequally as potent as those of Odin.
X
X  Hecate, Goddess of Illusion -- Hecate matches Athena's wisdom with 
Xdeception, and matches Athena's defensive powers with destructive
Xabilities.
X
XFollowers of any of these deities must be careful to keep to the true path --
Xthe wrath of a God is fearsome.... It is also said the Gods are jealous --
Xhonoring another deity, even of the same alignment, is an extremely bad idea.
XOn the other hand, any act against a God of the opposite alignment would
Xbe looked on kindly by your patron deity.
X
XIt should be noted that there are still other Gods of Omega. The Druids
Xthink themselves beyond the struggles of Law and Chaos and attempt to
Xmaintain a Balance between the two -- they are despised by all the
Xaligned Gods. The ArchDruid is said to command powers greater than
Xany other cleric.
X
XThe mysterious Lords of Destiny are said to preside over the struggles
Xof Law and Chaos as a referee rules a bout. Their powers are said to
Xbe extremely subtle and pervasive, and while no one has ever seen this
Xpower displayed, the self-appointed clerics of these mysterious beings
Xclaim great abilities.  Certain it is that the aligned Gods have never
Xacted against the followers of the Lords of Destiny, though whether
Xthis is because of their power, or because they offer no threat, is
Xunknown.
END_OF_oscroll1.txt
if test 2291 -ne `wc -c <oscroll1.txt`; then
    echo shar: \"oscroll1.txt\" unpacked with wrong size!
fi
# end of overwriting check
fi
echo shar: End of archive 1 \(of 15\).
cp /dev/null ark1isdone
MISSING=""
for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 ; do
    if test ! -f ark${I}isdone ; then
	MISSING="${MISSING} ${I}"
    fi
done
if test "${MISSING}" = "" ; then
    echo You have unpacked all 15 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