[comp.sources.games] v07i037: omega3 - rogue like dungeon exploration

billr@saab.CNA.TEK.COM (Bill Randle) (07/14/89)

Submitted-by: "Laurence R. Brothers"   <brothers@paul.rutgers.edu>
Posting-number: Volume 7, Issue 37
Archive-name: omega3/Part18
Supersedes: omega2: Volume 5, Issue 12-29,38-40



#! /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 18 (of 20)."
# Contents:  oabyss.c ocom1.c oitemf2.c omovef.c otrap.c ovillage.c
# Wrapped by billr@saab on Thu Jun 29 08:14:14 1989
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'oabyss.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'oabyss.c'\"
else
echo shar: Extracting \"'oabyss.c'\" \(4888 characters\)
sed "s/^X//" >'oabyss.c' <<'END_OF_FILE'
X/* omega copyright (C) by Laurence Raphael Brothers, 1987,1988,1989 */
X/* oabyss.c */
X/* some functions to make the abyss level and run the final challenge */
X
X#ifdef MSDOS
X#include <sys/types.h>
X#include <sys/timeb.h>
X#include <dos.h>
X#include <malloc.h>
X#endif
X#include "oglob.h"
X
X
X/* loads the abyss level into Level*/
Xvoid load_abyss()
X{
X  int i,j;
X  char site;
X  
X  FILE *fd;
X  
X  TempLevel = Level;
X  if (ok_to_free(TempLevel)) {
X#ifndef MSDOS
X    free((char *) TempLevel);
X#endif
X    TempLevel = NULL;
X  }
X#ifndef MSDOS
X  Level = ((plv) malloc(sizeof(levtype)));
X#else
X  msdos_changelevel(TempLevel,0,-1);
X  Level = &TheLevel;
X#endif
X  
X  clear_level(Level);
X
X  strcpy(Str3,OMEGALIB);
X  strcat(Str3,"oabyss.dat");
X  fd = fopen(Str3,"r");
X  for(j=0;j<LENGTH;j++) {
X    for(i=0;i<WIDTH;i++) {
X      site = getc(fd);
X      switch(site) {
X      case '0':
X	Level->site[i][j].locchar = ' ';
X	Level->site[i][j].p_locf = L_VOID;
X	break;
X      case 'V':
X	Level->site[i][j].locchar = ' ';
X	Level->site[i][j].p_locf = L_VOID_STATION;
X	break;
X      case '1':
X	Level->site[i][j].locchar = FLOOR;
X	Level->site[i][j].p_locf = L_VOICE1;
X	break;
X      case '2':
X	Level->site[i][j].locchar = FLOOR;
X	Level->site[i][j].p_locf = L_VOICE2;
X	break;
X      case '3':
X	Level->site[i][j].locchar = FLOOR;
X	Level->site[i][j].p_locf = L_VOICE3;
X	break;
X      case '~':
X	Level->site[i][j].locchar = WATER;
X	Level->site[i][j].p_locf = L_WATER_STATION;
X	break;
X      case ';':
X	Level->site[i][j].locchar = FIRE;
X	Level->site[i][j].p_locf = L_FIRE_STATION;
X	break;
X      case '"':
X	Level->site[i][j].locchar = HEDGE;
X	Level->site[i][j].p_locf = L_EARTH_STATION;
X	break;
X      case '6':
X	Level->site[i][j].locchar = WHIRLWIND;
X	Level->site[i][j].p_locf = L_AIR_STATION;
X	break;
X      case '#':
X	Level->site[i][j].locchar = WALL;
X	break;
X      case '.':
X	Level->site[i][j].locchar = FLOOR;
X	break;
X      }
X    }
X    fscanf(fd,"\n");
X  }
X}
X
X
X#ifdef MSDOS
X/* This stuff is in this file because the file was really small. */
X
Xmsdos_init()
X{
X    int i;
X
X    /* Allocate the inner level of pointers for TheLevel */
X    for (i = 0; i < MAXWIDTH; i++)
X    	TheLevel.site[i] = (plc)malloc(MAXLENGTH * sizeof(loctype));
X
X    /* Remove old level files */
X    kill_all_levels();
X}
X
Xkill_all_levels()
X{
X    kill_levels("om*.lev");
X}
X
Xkill_levels(str)
Xchar *str;
X{
X    int i;
X    struct find_t buf;
X
X    /* Remove old level files laying around */
X    sprintf(Str1,"%s%s",OMEGALIB,str);
X    for (i = _dos_findfirst(Str1,_A_NORMAL,&buf); !i; i = _dos_findnext(&buf))
X    {
X    	sprintf(Str2,"%s%s",OMEGALIB,buf.name);
X	remove(Str2);
X    }
X}
X
X#define MEM_CHECK_AMOUNT 0xf000
Xcheck_memory()
X{
X    char *mems[50];
X    long amount = 0;
X    int num_mems = 0;
X    unsigned try;
X
X    sprintf(Str1,"Heapchk returned %d.",_heapchk());
X    mprint(Str1);
X
X    try = MEM_CHECK_AMOUNT;
X    while (try > 10000)
X    {
X    	while (try > 0 && (mems[num_mems] = malloc(try)) == NULL)
X	    try -= 0x400;
X
X	amount += try;
X	num_mems++;
X    }
X    while (--num_mems >= 0)
X    	if (mems[num_mems] != NULL)
X	    free(mems[num_mems]);
X
X    sprintf(Str1,"Free mem approx %dK",(int)(amount / 0x400));
X    mprint(Str1);
X}
X
Xsleep(n)
Xint n;
X{
X    struct timeb otime,ntime;
X
X    ftime(&otime);
X    do
X    	ftime(&ntime);
X    while (((short)(ntime.time - otime.time)) * 1000 +
X      (short)ntime.millitm - (short)otime.millitm < n * 1000);
X}
X
Xstatic FILE *open_levfile(env,depth,rw)
Xint env,depth,rw;
X{
X    sprintf(Str1,"%som%03d%03d.lev",OMEGALIB,env,depth);
X    return(fopen(Str1,(rw) ? "wb" : "rb"));
X}
X
Xstatic free_objlist(pobjlist)
Xpol pobjlist;
X{
X    pol tmp;
X
X    while (pobjlist)
X    {
X    	free((tmp = pobjlist)->thing);
X	pobjlist = pobjlist->next;
X	free(tmp);
X    }
X}
X
Xstatic free_mons_and_objs(mlist)
Xpml mlist;
X{
X    pml tmp;
X
X    while (mlist)
X    {
X    	free_objlist((tmp = mlist)->m->possessions);
X	free(tmp->m);
X	mlist = mlist->next;
X	free(tmp);
X    }
X}
X
X/* Free up monsters and items */
Xfree_levelstuff(oldlevel)
Xplv oldlevel;
X{
X    int i,j;
X
X    free_mons_and_objs(oldlevel->mlist);
X    for (i = 0; i < MAXWIDTH; i++)
X    	for (j = 0; j < MAXLENGTH; j++)
X	    free_objlist(oldlevel->site[i][j].things);
X}
X
X/* Saves oldlevel (unless NULL), and reads in the new level,
X   unless depth is < 0. */
Xplv msdos_changelevel(oldlevel,newenv,newdepth)
Xplv oldlevel;
Xint newenv,newdepth;
X{
X    FILE *fp;
X
X    if (oldlevel != NULL)
X    {
X    	if (oldlevel->environment == newenv &&
X	  oldlevel->depth == newdepth)
X	    return(oldlevel);
X    	if (fp = open_levfile(oldlevel->environment,oldlevel->depth,1))
X	{
X	    save_level(fp,oldlevel);
X	    fclose(fp);
X	}
X	else
X	    mprint("Cannot save level!!!");
X	/* Free up monsters and items */
X	free_levelstuff(oldlevel);
X    }
X    if (newdepth >= 0)
X    {
X    	if ((fp = open_levfile(newenv,newdepth,0)) == NULL)
X	    return(NULL);
X	restore_level(fp);
X	fclose(fp);
X	return(Level);
X    }
X    return(NULL);
X}
X#endif
END_OF_FILE
if test 4888 -ne `wc -c <'oabyss.c'`; then
    echo shar: \"'oabyss.c'\" unpacked with wrong size!
fi
# end of 'oabyss.c'
fi
if test -f 'ocom1.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'ocom1.c'\"
else
echo shar: Extracting \"'ocom1.c'\" \(9634 characters\)
sed "s/^X//" >'ocom1.c' <<'END_OF_FILE'
X/* omega copyright (C) by Laurence Raphael Brothers, 1987,1988,1989 */
X/* ocom1.c */
X
X/* This file has the two toplevel command scanners, p_process,
Xwhich works everywhere but the countryside, and p_couyntry_process,
Xwhich works.... */
X
X#include "oglob.h"
X
X
X/* deal with a new player command in dungeon or city mode*/
Xvoid p_process()
X{
X  static int searchval=0;
X
X  if (Player.status[BERSERK]) 
X    if (goberserk()) {
X    setgamestatus(SKIP_PLAYER);
X    drawvision(Player.x,Player.y);
X  }
X  if (! gamestatusp(SKIP_PLAYER)) {
X    if (searchval > 0) {
X      searchval--;
X      if (searchval == 0) resetgamestatus(FAST_MOVE);
X    }
X    drawvision(Player.x,Player.y);
X    if (! gamestatusp(FAST_MOVE)) {
X      searchval = 0;
X      Cmd = mgetc();
X      clear_if_necessary();
X    }
X    Command_Duration = 0;
X    switch (Cmd) {
X    case ' ': 
X    case 13: setgamestatus(SKIP_MONSTERS); break; /*no op on space or return*/
X    case 6: abortshadowform(); break; /* ^f */
X    case 7: wizard(); break; /* ^g */
X    case 9: display_pack(); morewait(); xredraw(); break; /* ^i */
X    case 11: if (gamestatusp(CHEATED)) frobgamestatus();
X    case 12: xredraw(); setgamestatus(SKIP_MONSTERS); break; /* ^l */
X#ifndef MSDOS
X    case 16: bufferprint(); setgamestatus(SKIP_MONSTERS); break; /* ^p */ 
X#else
X    case 15: bufferprint(); setgamestatus(SKIP_MONSTERS); break; /* ^o */ 
X#endif
X    case 18: redraw();  setgamestatus(SKIP_MONSTERS); break; /* ^r */
X    case 23: if (gamestatusp(CHEATED)) drawscreen();  break; /* ^w */
X    case 24: /* ^x */ 
X      if (gamestatusp(CHEATED) || 
X	  Player.rank[ADEPT]) 
X	wish(1);
X      Command_Duration = 5;
X      break;
X    case 'a': zapwand();
X      Command_Duration =((int) 8.0*Player.speed/5.0); 
X      break;
X    case 'c': closedoor();  
X      Command_Duration =((int) 2.0*Player.speed/5.0); 
X      break;
X    case 'd': drop();
X      Command_Duration =((int) 5.0*Player.speed/5.0); 
X      break;
X    case 'e': eat();
X      Command_Duration = 30;
X      break;
X    case 'f': fire();
X      Command_Duration =((int) 5.0*Player.speed/5.0); 
X      break;
X    case 'g': pickup();
X      Command_Duration =((int) 10.0*Player.speed/5.0); 
X      break;
X    case 'i': 
X      if (optionp(TOPINV)) top_inventory_control();
X      else {
X	menuclear();
X	display_possessions();
X	inventory_control();
X      }
X      break;
X    case 'm': magic();
X      Command_Duration = 12;
X      break;
X    case 'o': opendoor();
X      Command_Duration =((int) 5.0*Player.speed/5.0); 
X      break;
X    case 'p': pickpocket();
X      Command_Duration =((int) 20.0*Player.speed/5.0); 
X      break;
X    case 'q': quaff();
X      Command_Duration = 10;
X      break;
X    case 'r': peruse();
X      Command_Duration = 20;
X      break;
X    case 's': search(&searchval);
X      Command_Duration = 20;
X      break;
X    case 't': talk();
X      Command_Duration = 10;
X      break;
X    case 'v': vault();
X      Command_Duration =((int) 10.0*Player.speed/5.0); 
X      break;
X    case 'x': examine();
X      Command_Duration = 1;
X      break;
X    case 'z': bash_location();
X      Command_Duration =((int) 10.0*Player.speed/5.0); 
X      break;
X    case 'A': activate();
X      Command_Duration = 10;
X      break;
X    case 'C': callitem();
X      break;
X    case 'D': disarm();
X      Command_Duration = 30;
X      break;
X    case 'E': dismount_steed();
X      Command_Duration =((int) 10.0*Player.speed/5.0); 
X      break;
X    case 'F': tacoptions();
X      break;
X    case 'G': give();
X      Command_Duration = 10;
X      break;
X    case 'I':
X      if (! optionp(TOPINV)) top_inventory_control();
X      else {
X	menuclear();
X	display_possessions();
X	inventory_control();
X      }
X      break;
X    case 'M': city_move();
X      Command_Duration = 10;
X      break;
X    case 'O': setoptions();
X      break;
X    case 'P': show_license();
X      break; /* actually show_license is in ofile */
X    case 'Q': quit(); 
X      break;
X    case 'R': rename_player();
X      break;
X    case 'S': save(TRUE); 
X      break;
X    case 'T': tunnel(); 
X      Command_Duration = ((int) 30.0*Player.speed/5.0); 
X      break;
X    case 'V': version(); 
X      break;
X#ifdef MSDOS
X     case 'X': check_memory(); break;
X#endif
X    case 'Z': bash_item();
X      Command_Duration =((int) 10.0*Player.speed/5.0); 
X      break;
X    case '.': rest();
X      Command_Duration = 10;
X      break;
X    case ',': 
X      Command_Duration = 10;
X      nap();
X      break;
X    case '>': 
X      downstairs();
X      break;
X    case '<':
X      upstairs();
X      break;
X    case '@': 
X      p_movefunction(Level->site[Player.x][Player.y].p_locf);
X      Command_Duration = 5; 
X      break;
X    case '/': charid(); setgamestatus(SKIP_MONSTERS);
X      break;
X    case '?': help(); setgamestatus(SKIP_MONSTERS);
X      break;
X    case '4':	       
X    case 'h': moveplayer(-1,0);
X      Command_Duration =((int) 5.0*Player.speed/5.0); 
X      break;
X    case '2':
X    case 'j': moveplayer(0,1);  
X      Command_Duration =((int) 5.0*Player.speed/5.0); 
X      break;
X    case '8':
X    case 'k': moveplayer(0,-1);
X      Command_Duration =((int) 5.0*Player.speed/5.0); 
X      break;
X    case '6':
X    case 'l': moveplayer(1,0);
X      Command_Duration =((int) 5.0*Player.speed/5.0); 
X      break;
X    case '1':
X    case 'b': moveplayer(-1,1);
X      Command_Duration =((int) 5.0*Player.speed/5.0); 
X      break;
X    case '3':	      
X    case 'n': moveplayer(1,1); 
X      Command_Duration =((int) 5.0*Player.speed/5.0); 
X      break;
X    case '7':
X    case 'y': moveplayer(-1,-1);  
X      Command_Duration =((int) 5.0*Player.speed/5.0); 
X      break;
X    case '9':
X    case 'u': moveplayer(1,-1);  
X      Command_Duration =((int) 5.0*Player.speed/5.0); 
X      break;
X    case '5': 
X      setgamestatus(SKIP_MONSTERS); /* don't do anything; a dummy turn */
X      Cmd = mgetc();
X      while ((Cmd != ESCAPE) &&
X	     ((Cmd < '1') || (Cmd > '9') || (Cmd=='5'))) {
X	print3("Run in keypad direction [ESCAPE to abort]: ");
X	Cmd = mgetc();
X      }
X      if (Cmd != ESCAPE) setgamestatus(FAST_MOVE);
X      break;
X    case 'H': setgamestatus(FAST_MOVE); Cmd = 'h'; moveplayer(-1,0);
X      Command_Duration =((int) 4.0*Player.speed/5.0); 
X      break; 
X    case 'J': setgamestatus(FAST_MOVE); Cmd = 'j'; moveplayer(0,1);
X      Command_Duration =((int) 4.0*Player.speed/5.0); 
X      break;  
X    case 'K': setgamestatus(FAST_MOVE); Cmd = 'k'; moveplayer(0,-1);
X      Command_Duration =((int) 4.0*Player.speed/5.0); 
X      break; 
X    case 'L': setgamestatus(FAST_MOVE); Cmd = 'l'; moveplayer(1,0);
X      Command_Duration =((int) 4.0*Player.speed/5.0); 
X      break;  
X    case 'B': setgamestatus(FAST_MOVE); Cmd = 'b'; moveplayer(-1,1);
X      Command_Duration =((int) 4.0*Player.speed/5.0); 
X      break; 
X    case 'N': setgamestatus(FAST_MOVE); Cmd = 'n'; moveplayer(1,1);
X      Command_Duration =((int) 4.0*Player.speed/5.0); 
X      break;  
X    case 'Y': setgamestatus(FAST_MOVE); Cmd = 'y'; moveplayer(-1,-1);  
X      Command_Duration =((int) 4.0*Player.speed/5.0); 
X      break;
X    case 'U': setgamestatus(FAST_MOVE); Cmd = 'u'; moveplayer(1,-1);
X      Command_Duration =((int) 4.0*Player.speed/5.0); 
X      break;
X    default: commanderror();  setgamestatus(SKIP_MONSTERS); break;
X    }
X  }
X  if (Current_Environment != E_COUNTRYSIDE) roomcheck();
X  screencheck(Player.y);
X}
X
X
X
X
X
X/* deal with a new player command in countryside mode */
Xvoid p_country_process()
X{
X  int no_op;
X  
X  drawvision(Player.x,Player.y);
X  do {
X    no_op = FALSE;
X    Cmd = mgetc();
X    clear_if_necessary();
X    switch (Cmd) {
X    case ' ': 
X    case 13: no_op = TRUE; break;
X    case 7: wizard(); break; /* ^g */
X    case 14: xredraw(); no_op = TRUE; break; /* ^l */
X#ifndef MSDOS
X    case 16: bufferprint(); no_op = TRUE; break; /* ^p */ 
X#else
X    case 15: bufferprint(); no_op = TRUE; break; /* ^o */ 
X#endif
X    case 18: redraw(); no_op = TRUE; break; /* ^r */
X    case 23: if (gamestatusp(CHEATED)) drawscreen();  break; /* ^w */
X    case 24: if (gamestatusp(CHEATED) || 
X		 Player.rank[ADEPT]) wish(1);  break; /* ^x */
X    case 'd': drop();  break;
X    case 'e': eat();  break;
X    case 'i': 
X      if (optionp(TOPINV)) top_inventory_control();
X      else {
X	menuclear();
X	display_possessions();
X	inventory_control();
X      }
X      break;
X    case 's': countrysearch(); break;
X    case 'x': examine(); break;
X    case 'E': dismount_steed(); break;
X    case 'H': hunt(Country[Player.x][Player.y].current_terrain_type); break;
X    case 'I': 
X      if (! optionp(TOPINV)) top_inventory_control();
X      else {
X	menuclear();
X	display_possessions();
X	inventory_control();
X      }
X      break;
X    case 'O': setoptions(); break;
X    case 'P': show_license(); break; /* actually show_license is in ofile */
X    case 'Q': quit(); break;
X    case 'R': rename_player(); break;
X    case 'S': save(TRUE); break;
X    case 'V': version(); break;
X#ifdef MSDOS
X     case 'X': check_memory(); break;
X#endif
X    case '>': 
X      enter_site(Country[Player.x][Player.y].base_terrain_type);
X      break;
X    case '/': charid(); no_op = TRUE; break;
X    case '?': help(); no_op = TRUE; break;
X    case '4':	       
X    case 'h': movepincountry(-1,0);  break;
X    case '2':
X    case 'j': movepincountry(0,1);  break;
X    case '8':
X    case 'k': movepincountry(0,-1);  break;
X    case '6':
X    case 'l': movepincountry(1,0);  break;
X    case '1':
X    case 'b': movepincountry(-1,1);  break;
X    case '3':	      
X    case 'n': movepincountry(1,1);  break;
X    case '7':
X    case 'y': movepincountry(-1,-1);  break;
X    case '9':
X    case 'u': movepincountry(1,-1);  break;
X    default: commanderror();  no_op = TRUE; break;
X    }
X  } while (no_op);
X  screencheck(Player.y);
X}
X
X
END_OF_FILE
if test 9634 -ne `wc -c <'ocom1.c'`; then
    echo shar: \"'ocom1.c'\" unpacked with wrong size!
fi
# end of 'ocom1.c'
fi
if test -f 'oitemf2.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'oitemf2.c'\"
else
echo shar: Extracting \"'oitemf2.c'\" \(12158 characters\)
sed "s/^X//" >'oitemf2.c' <<'END_OF_FILE'
X/* omega copyright (C) 1987,1988,1989 by Laurence Raphael Brothers */
X/* oitemf2.c */
X
X/* mostly ring, armor, and weapon functions */
X
X#include "oglob.h"
X
X
X
X
X/* ring functions */
Xvoid i_perm_knowledge(o)
Xpob o;
X{
X  if (o->known < 1)
X    o->known = 1;
X  if (o->blessing > -1)
X    Objects[o->id].known = 1;
X  if (o->used) 
X    knowledge(o->blessing);
X}
X
Xvoid i_perm_strength(o)
Xpob o;
X{
X  if (o->known < 1) o->known = 1;
X  Objects[o->id].known = 1;
X  if (o->used){
X    if (o->blessing > -1)
X      Player.str += abs(o->plus)+1;
X    else
X      Player.str -= abs(o->plus)+1;
X  }
X  else {
X    if (o->blessing > -1)
X      Player.str -= abs(o->plus)+1;
X    else
X      Player.str += abs(o->plus)+1;
X  }
X  calc_melee();
X}
X
X
X
Xvoid i_perm_burden(o)
Xpob o;
X{
X  int i;
X  
X  if (o->used) {
X    o->weight = 1000;
X    mprint("You feel heavier.");
X  }
X  else {
X    o->weight = 1;
X    mprint("Phew. What a relief.");
X  }
X  Player.itemweight = 0;
X  for (i=0;i<MAXITEMS;i++) {
X    if (Player.possessions[i] != NULL)
X      Player.itemweight += 
X	(Player.possessions[i]->weight*Player.possessions[i]->number);
X  }
X}
X
Xvoid i_perm_gaze_immune(o)
Xpob o;
X{
X  if (o->used) Player.immunity[GAZE]++;
X  else Player.immunity[GAZE]--;
X}
X
Xvoid i_perm_fire_resist(o)
Xpob o;
X{
X  if (o->used) Player.immunity[FLAME]++;
X  else Player.immunity[FLAME]--;
X}
X
Xvoid i_perm_poison_resist(o)
Xpob o;
X{
X  if (o->used) {
X    if (o->blessing < 0) {
X      Player.immunity[POISON] = 0;
X      p_poison(100);
X    }
X    else {
X      Player.immunity[POISON]++;
X      if (Player.status[POISONED] > 0) {
X	mprint("You feel much better now.");
X	Player.status[POISONED] = 0;
X      }
X    }
X  }
X  else {
X    Player.status[POISONED] = 0;
X    Player.immunity[POISON]--;
X  }
X}
X
X
X
X
X
X
Xvoid i_perm_regenerate(o)
Xpob o;
X{
X  if (o->known < 1)  o->known = 1;
X  if (o->blessing > -1)
X    Objects[o->id].known = 1;
X  if (o->used) {
X    mprint("You seem abnormally healthy.");
X    Player.status[REGENERATING] += 1500;
X  }
X  else {
X    Player.status[REGENERATING] -= 1500;
X    if (Player.status[REGENERATING] < 1) {
X      mprint("Your vitality is back to normal");
X      Player.status[REGENERATING] = 0;
X    }
X  }
X}
X
X
X
X
X/* armor functions */
X
X
Xvoid i_normal_armor(o)
Xpob o;
X{
X  if (o->used) mprint("You put on your suit of armor.");
X}
X
Xvoid i_perm_energy_resist(o)
Xpob o;
X{
X  if (o->used){
X    Player.immunity[FLAME]++;
X    Player.immunity[COLD]++;
X    Player.immunity[ELECTRICITY]++;
X  }
X  else {
X    Player.immunity[FLAME]--;
X    Player.immunity[COLD]--;
X    Player.immunity[ELECTRICITY]--;
X  }
X}
X
X
X
Xvoid i_perm_fear_resist(o)
Xpob o;
X{
X  if (o->used){
X    Player.immunity[FEAR]++;
X    if (o->blessing < 0) {
X      Player.status[BERSERK] += 1500;
X      mprint("You feel blood-simple!");
X    }
X  }
X  else {
X    Player.immunity[FEAR]--;
X    if (o->blessing < 0) {
X      Player.status[BERSERK] -= 1500;
X      if (Player.status[BERSERK] < 1) {
X	mprint("You feel less rabid now.");
X      Player.status[BERSERK] = 0;
X      }
X    }
X  }
X}    
X
X
X
Xvoid i_perm_breathing(o)
Xpob o;
X{
X  if (o->known < 1)  o->known = 1;
X  if (o->blessing > -1)
X    Objects[o->id].known = 1;
X
X  if (o->blessing > -1) {
X    if (o->used) {
X      mprint("Your breath is energized!");
X      Player.status[BREATHING] += 1500;
X    }
X    else  {
X      Player.status[BREATHING] -= 1500;
X      if (Player.status[BREATHING] < 1) {
X	mprint("Your breathing is back to normal.");
X	Player.status[BREATHING] = 0;
X      }
X    }
X  }
X  else if (o->used) {
X    Player.status[BREATHING] = 0;
X    p_drown();
X  }
X}
X
X
X
X/* weapons functions */
X
Xvoid weapon_acidwhip(dmgmod,o,m)
Xint dmgmod;
Xpob o;
Xstruct monster *m;
X{
X  if ((random_range(2) == 1) && (! m_immunityp(m,NORMAL_DAMAGE))) {
X    mprint("You entangle the monster!");
X    m_status_reset(m,MOBILE);
X  }
X  p_hit(m,Player.dmg+dmgmod,ACID);
X
X}
X
Xvoid weapon_scythe(dmgmod,o,m)
Xint dmgmod;
Xpob o;
Xstruct monster *m;
X{
X  mprint("Slice!");
X  m_death(m);
X  if (! Player.rank[ADEPT]) {
X    mprint("Ooops!");
X    mprint("You accidentally touch yourself on the backswing....");
X    p_death("the Scythe of Death");
X  }
X}
X
Xvoid weapon_demonblade(dmgmod,o,m)
Xint dmgmod;
Xpob o;
Xstruct monster *m;
X{ 
X  if (o->blessing > -1) {
X    mprint("Demonblade disintegrates with a soft sigh.");
X    mprint("You stop foaming at the mouth.");
X    Player.status[BERSERK] = 0;
X    conform_lost_object(o);
X  }
X  else if (m->specialf == M_SP_DEMON) {
X    mprint("The demon flees in terror before your weapon!");
X    m_vanish(m);
X  }
X  else if (m->meleef != M_MELEE_SPIRIT) {
X    if (m->level > random_range(10)) {
X      Player.hp = min(Player.maxhp,Player.hp+m->hp);
X      Player.str++;
X      Player.pow = min(Player.maxpow,Player.pow+m->level);
X      m_death(m);
X      mprint("You feel a surge of raw power from Demonblade!");
X    }
X    else p_hit(m,Player.dmg+dmgmod,NORMAL_DAMAGE);
X
X  }
X  else {
X    mprint("Demonblade howls as it strikes the spirit!");
X    if (random_range(10) == 1) {
X      mprint("... and shatters into a thousand lost fragments!");
X      p_damage(50,UNSTOPPABLE,"Demonblade exploding");
X      conform_lost_object(o);
X    }
X    else {
X      mprint("You feel your lifeforce draining....");
X      p_damage(25,UNSTOPPABLE,"a backlash of negative energies");
X      Player.str -= 3;
X      Player.con -= 3;
X    }
X  }
X}
X
Xvoid weapon_lightsabre(dmgmod,o,m)
Xint dmgmod;
Xpob o;
Xstruct monster *m;
X{
X  if (! o->known) {
X    mprint("Fumbling with the cylinder, you press the wrong stud....");
X    p_damage(100,UNSTOPPABLE,"fumbling with a lightsabre");
X    o->known = 1;
X  }
X  else {
X    /* test prevents confusing immunity messages.... */
X    if (! m_immunityp(m,NORMAL_DAMAGE)) {
X      mprint("Vzzzzmmm!");
X      m_damage(m,20,NORMAL_DAMAGE);
X    }
X    if ((m->hp>0) && (! m_immunityp(m,FLAME))) {
X      mprint("Zzzzap!");
X      m_damage(m,20,FLAME);
X    }
X  }
X}
X
Xvoid weapon_tangle(dmgmod,o,m)
Xint dmgmod;
Xpob o;
Xstruct monster *m;
X{
X  if ((random_range(2) == 1) && (! m_immunityp(m,NORMAL_DAMAGE))) {
X    mprint("You entangle the monster!");
X    m_status_reset(m,MOBILE);
X  }
X  p_hit(m,Player.dmg+dmgmod,NORMAL_DAMAGE);
X}
X
X/* if wielding a bow, add bow damage to arrow damage */
Xvoid weapon_arrow(dmgmod,o,m)
Xint dmgmod;
Xpob o;
Xstruct monster *m;
X{
X  if ((Player.possessions[O_WEAPON_HAND] != NULL) &&
X      (Player.possessions[O_WEAPON_HAND]->id == WEAPONID+26)) /* ie, using a bow */
X    p_hit(m,Player.dmg+o->plus+o->dmg+dmgmod,NORMAL_DAMAGE);
X  else p_hit(m,o->plus+o->dmg+dmgmod,NORMAL_DAMAGE);
X}
X
X/* if wielding a crossbow, add bow damage to arrow damage */
Xvoid weapon_bolt(dmgmod,o,m)
Xpob o;
Xstruct monster *m;
X{
X  if ((Player.possessions[O_WEAPON_HAND] != NULL) &&
X      (Player.possessions[O_WEAPON_HAND]->id == WEAPONID+27) && /*ie using a crossbow */
X      (Player.possessions[O_WEAPON_HAND]->aux==LOADED)) {
X	p_hit(m,Player.dmg+o->plus+o->dmg+dmgmod,NORMAL_DAMAGE);
X	Player.possessions[O_WEAPON_HAND]->aux = UNLOADED;
X      }
X  else p_hit(m,o->plus+o->dmg,NORMAL_DAMAGE);
X}
X
X
Xvoid weapon_mace_disrupt(dmgmod,o,m)
Xint dmgmod;
Xpob o;
Xstruct monster *m;
X{
X  if (m->meleef == M_MELEE_SPIRIT) {
X    mprint("The monster crumbles away to dust!");
X    m_death(m);
X  }
X  else p_hit(m,Player.dmg+dmgmod,UNSTOPPABLE);
X}
X
Xvoid weapon_normal_hit(dmgmod,o,m)
Xint dmgmod;
Xpob o;
Xstruct monster *m;
X{
X  p_hit(m,Player.dmg+dmgmod,NORMAL_DAMAGE);
X}
X
X
X/* will be updated eventually */
Xvoid weapon_bare_hands(dmgmod,m)
Xint dmgmod;
Xstruct monster *m;
X{
X  p_hit(m,Player.dmg+dmgmod,NORMAL_DAMAGE);
X}
X
X
Xvoid i_demonblade(o)
Xpob o;
X{
X  if (o->used) {
X    o->known = 2;
X    mprint("Demonblade's fangs open and bury themselves in your wrist!");
X    mprint("You hear evil laughter in the distance....");
X    mprint("You begin to foam at the mouth!");
X    Player.status[BERSERK] = 1500;
X  }
X  else {
X    mprint("You hear a sound like a demon cursing.");
X    mprint("You feel less like biting your shield.");
X    Player.status[BERSERK] = 0;
X  }
X}
X
Xvoid i_normal_weapon(o)
Xpob o;
X{
X  if (o->used) mprint("You ready your weapon for battle.");
X}
X
Xvoid i_lightsabre(o)
Xpob o;
X{
X  if (o->used) mprint("You feel one with the Force.");
X  else mprint("You feel out of touch with the Force.");
X}
X
Xvoid i_mace_disrupt(o)
Xpob o;
X{
X  mprint("That's a damned heavy mace!");
X}
X
X
X
Xvoid weapon_vorpal(dmgmod,o,m)
Xint dmgmod;
Xpob o;
Xstruct monster *m;
X{
X  if ((random_range(10) < 3) && (! m_immunityp(m,NORMAL_DAMAGE))) {
X    o->known = 2;
X    if (random_range(2) == 1)
X      mprint("One Two! One Two! And through and through!");
X    else mprint("Your vorpal blade goes snicker-snack!");
X    m_death(m);
X  }
X  else weapon_normal_hit(dmgmod,o,m);
X}
X
Xvoid weapon_desecrate(dmgmod,o,m)
Xint dmgmod;
Xpob o;
Xstruct monster *m;
X{
X  o->known = 2;
X  if (Player.alignment < 0) {
X    mprint("Your opponent screams in agony!");
X    p_hit(m,Player.dmg+dmgmod,UNSTOPPABLE);
X    Player.alignment--;
X    if (Player.hp < Player.maxhp) {
X      mprint("You feel a thrill of power surging up your blade!");
X      Player.hp = min(Player.maxhp,Player.hp+Player.dmg+dmgmod);
X    }
X  }
X  else {
X    mprint("Your blade turns in your hands and hits you!");
X    mprint("You hear evil laughter....");
X    level_drain(Player.dmg,"the sword Desecrator");
X    Player.alignment-=10;
X    mprint("A strange force spreads from the wound throughout your body...");
X    mprint("You feel much more chaotic now.");
X  }
X}
X
X
X
Xvoid weapon_firestar(dmgmod,o,m)
Xint dmgmod;
Xpob o;
Xstruct monster *m;
X{
X  if (random_range(3) == 1) {
X    o->known = 2;
X    fball(Player.x,Player.y,Player.x,Player.y,max(Player.dmg,25));
X  }
X  if (m->hp > 0) weapon_normal_hit(dmgmod,o,m);
X}
X
Xvoid weapon_defend(dmgmod,o,m)
Xpob o;
Xstruct monster *m;
X{
X  if ((Player.alignment < 0) && (o->blessing > 0)) {
X      mprint("The Holy Defender screams in your hands....");
X      mprint("You stagger before the sound of its rage....");
X      p_damage(50,UNSTOPPABLE,"a pissed-off Holy Defender");
X      mprint("The weapon finally quiets. It seems less holy now.");
X      o->truename = o->cursestr;
X      Player.status[PROTECTION] -= (o->hit);
X      o->plus = 0-abs(o->plus);
X      o->blessing = -1;
X    }
X  if ((o->blessing > 0) &&
X      ((m->specialf == M_SP_DEMON) ||
X       (m->meleef == M_MELEE_SPIRIT))) {
X    mprint("Your opponent shies back before your holy weapon!");
X    m->hit = 0;
X    m->speed *=2;
X  }
X  weapon_normal_hit(dmgmod,o,m);
X}
X
Xvoid weapon_victrix(dmgmod,o,m)
Xint dmgmod;
Xpob o;
Xstruct monster *m;
X{
X  if (m->meleef == M_MELEE_SPIRIT) {
X    mprint("Your opponent dissipates in a harmless cloud of vapors...");
X    m_death(m);
X  }
X  else weapon_normal_hit(dmgmod,o,m);
X}
X
Xvoid i_defend(o)
Xpob o;
X{
X  o->known = 2;
X  if (o->used) {
X    mprint("You feel under an aegis!");
X    Player.status[PROTECTION] += o->hit;
X  }
X  else Player.status[PROTECTION] -= o->hit;
X}
X
X
Xvoid i_victrix(o)
Xpob o;
X{
X  o->known = 2;
X  o->blessing = abs(o->blessing);
X  if (o->used) {
X    Player.immunity[POISON]++;
X    Player.immunity[FEAR]++;
X    Player.immunity[INFECTION]++;
X  }
X  else {
X    Player.immunity[POISON]--;
X    Player.immunity[FEAR]--;
X    Player.immunity[INFECTION]--;
X  }
X}    
X
X
Xvoid i_desecrate(o)
Xpob o;
X{
X  if (o->known < 1)  o->known = 2;
X  if (o->blessing > 0) {
X    mprint("How weird, a blessed desecrator... ");
X    mprint("The structure of reality cannot permit such a thing....");
X    dispose_lost_objects(1,o);
X  }
X  else if (Level->site[Player.x][Player.y].locchar == ALTAR)
X    sanctify(-1);
X}
X
X
X/* shield functions */
Xvoid i_normal_shield(o)
Xpob o;
X{
X  if (o->used) mprint("You sling your shield across a forearm.");
X}
X
X
Xvoid i_perm_deflect(o)
Xpob o;
X{
X  if (o->known < 1)  o->known = 2;
X  if (o->blessing > -1) {
X    if (o->used) {
X      mprint("You feel buffered.");
X      Player.status[DEFLECTION] += 1500;
X    }
X    else {
X      Player.status[DEFLECTION] -= 1500;
X      if (Player.status[DEFLECTION] < 1) {
X	mprint("You feel less defended");
X	Player.status[DEFLECTION] = 0;
X      }
X    }
X  }
X  else {
X    if (o->used) {
X      mprint("You feel naked.");
X      Player.status[VULNERABLE] += 1500;
X      Player.status[DEFLECTION] = 0;
X    }
X    else {
X      Player.status[VULNERABLE] -= 1500;
X      if (Player.status[VULNERABLE] < 1) {
X	mprint("You feel less vulnerable");
X	Player.status[VULNERABLE] = 0;
X      }
X    }
X  }
X}
END_OF_FILE
if test 12158 -ne `wc -c <'oitemf2.c'`; then
    echo shar: \"'oitemf2.c'\" unpacked with wrong size!
fi
# end of 'oitemf2.c'
fi
if test -f 'omovef.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'omovef.c'\"
else
echo shar: Extracting \"'omovef.c'\" \(9655 characters\)
sed "s/^X//" >'omovef.c' <<'END_OF_FILE'
X/* omega copyright (C) by Laurence Raphael Brothers, 1987,1988,1989 */
X/* omovef.c */
X/* the movefunctions switch functions, for player and monster*/
X
X#include "oglob.h"
X
X
X
Xvoid p_movefunction(movef)
Xint movef;
X{
X  /* loc functs above traps should be activated whether levitating or not */
X  if (movef != L_NO_OP) clearmsg();
X  sign_print(Player.x,Player.y,FALSE);
X  if ((! Player.status[LEVITATING]) || 
X      gamestatusp(MOUNTED) ||
X      (Cmd == '@') || /* @ command activates all effects under player */
X      (movef < LEVITATION_AVOIDANCE)) {
X
X    switch(movef) {
X      
X      /* miscellaneous */
X    case L_NO_OP:l_no_op(); break;
X    case L_HEDGE:l_hedge(); break;
X    case L_WATER:l_water(); break;
X    case L_LIFT:l_lift(); break;
X    case L_LAVA:l_lava(); break;
X    case L_FIRE:l_fire(); break;
X    case L_WHIRLWIND:l_whirlwind(); break;
X    case L_RUBBLE:l_rubble(); break;
X    case L_MAGIC_POOL:l_magic_pool(); break;
X    case L_ABYSS:l_abyss(); break;
X      
X    case L_PORTCULLIS_TRAP:l_portcullis_trap(); break;
X    case L_RAISE_PORTCULLIS:l_raise_portcullis(); break;
X    case L_DROP_EVERY_PORTCULLIS:l_drop_every_portcullis(); break;
X    case L_ARENA_EXIT:l_arena_exit(); break;
X    case L_TRIFID:l_trifid(); break;
X    case L_ENTER_COURT:l_enter_court(); break;
X    case L_ESCALATOR:l_escalator(); break;
X    case L_THRONE:l_throne(); break;
X
X    case L_TRAP_DART:l_trap_dart(); break;
X    case L_TRAP_SIREN:l_trap_siren(); break;
X    case L_TRAP_PIT:l_trap_pit(); break;
X    case L_TRAP_DOOR:l_trap_door(); break;
X    case L_TRAP_SNARE:l_trap_snare(); break;
X    case L_TRAP_BLADE:l_trap_blade(); break;
X    case L_TRAP_FIRE:l_trap_fire(); break;
X    case L_TRAP_TELEPORT:l_trap_teleport(); break;
X    case L_TRAP_DISINTEGRATE:l_trap_disintegrate(); break;
X    case L_TRAP_SLEEP_GAS:l_trap_sleepgas(); break;
X    case L_TRAP_MANADRAIN:l_trap_manadrain(); break;
X    case L_TRAP_ACID:l_trap_acid(); break;
X    case L_TRAP_ABYSS:l_trap_abyss(); break;
X
X   /*door functions */
X    case L_BANK:l_bank(); break;
X    case L_ARMORER:l_armorer(); break;
X    case L_CLUB:l_club(); break;
X    case L_GYM:l_gym(); break;
X    case L_BROTHEL:l_brothel(); break;
X    case L_THIEVES_GUILD:l_thieves_guild(); break;
X    case L_COLLEGE:l_college(); break;
X    case L_HEALER:l_healer(); break;
X    case L_STATUE_WAKE:l_statue_wake(); break;
X    case L_CASINO:l_casino(); break;
X    case L_COMMANDANT:l_commandant(); break;
X    case L_DINER:l_diner(); break;
X    case L_CRAP:l_crap(); break;
X    case L_TAVERN:l_tavern(); break;
X    case L_MERC_GUILD:l_merc_guild(); break;
X    case L_ALCHEMIST:l_alchemist(); break;
X    case L_SORCERORS:l_sorcerors(); break;
X    case L_CASTLE:l_castle(); break;
X    case L_ARENA:l_arena(); break;
X    case L_VAULT:l_vault(); break;
X    case L_DPW:l_dpw(); break;
X    case L_LIBRARY:l_library(); break;
X    case L_PAWN_SHOP:l_pawn_shop(); break;
X    case L_CONDO:l_condo(); break;
X    case L_ALTAR:l_altar(); break;
X    case L_TACTICAL_EXIT:l_tactical_exit(); break;
X    case L_HOUSE_EXIT:l_house_exit(); break;
X    case L_SAFE: l_safe(); break;
X    case L_HOUSE: l_house(); break;
X    case L_HOVEL: l_hovel(); break;
X    case L_MANSION: l_mansion(); break;
X    case L_COUNTRYSIDE:l_countryside(); break;
X    case L_ORACLE:l_oracle(); break;
X    case L_ORDER:l_order(); break;
X    case L_CARTOGRAPHER:l_cartographer(); break;
X
X    case L_TEMPLE_WARNING:l_temple_warning(); break;
X    case L_ENTER_CIRCLE:l_enter_circle(); break;
X    case L_CIRCLE_LIBRARY:l_circle_library(); break;
X    case L_TOME1: l_tome1(); break;
X    case L_TOME2: l_tome2(); break;
X
X    case L_CHARITY: l_charity(); break;
X
X    case L_CHAOSTONE:l_chaostone();break;
X    case L_VOIDSTONE:l_voidstone();break;
X    case L_BALANCESTONE:l_balancestone();break;
X    case L_LAWSTONE:l_lawstone();break;
X    case L_SACRIFICESTONE:l_sacrificestone(); break;
X    case L_MINDSTONE:l_mindstone(); break;
X
X    /* challenge functions */
X    case L_ADEPT:l_adept(); break;
X    case L_VOICE1:l_voice1();break;
X    case L_VOICE2:l_voice2();break;
X    case L_VOICE3:l_voice3();break;
X    case L_VOID:l_void();break;
X    case L_FIRE_STATION:l_fire_station();break;
X    case L_EARTH_STATION:l_earth_station();break;
X    case L_WATER_STATION:l_water_station();break;
X    case L_AIR_STATION:l_air_station();break;
X    case L_VOID_STATION:l_void_station();break;
X    }
X    if (movef != L_NO_OP) {
X      resetgamestatus(FAST_MOVE);
X      dataprint();
X    }
X  }
X}
X
X
X
X
X
X/* execute some move function for a monster */
Xvoid m_movefunction(m,movef)
Xstruct monster *m;
Xint movef;
X{
X  /* loc functs above traps should be activated whether levitating or not */
X  if (! m_statusp(m,FLYING))
X    switch(movef) {
X
X    /* miscellaneous */
X    case L_NO_OP:m_no_op(m); break;
X    case L_WATER:m_water(m); break;
X    case L_LAVA:m_lava(m); break;
X    case L_FIRE:m_fire(m); break;
X    case L_MAGIC_POOL:m_water(m); break;
X    case L_ABYSS: m_abyss(m); break;
X
X    case L_TRAP_DART:m_trap_dart(m); break;
X    case L_TRAP_PIT:m_trap_pit(m); break;
X    case L_TRAP_DOOR:m_trap_door(m); break;
X    case L_TRAP_SNARE:m_trap_snare(m); break;
X    case L_TRAP_BLADE:m_trap_blade(m); break;
X    case L_TRAP_FIRE:m_trap_fire(m); break;
X    case L_TRAP_TELEPORT:m_trap_teleport(m); break;
X    case L_TRAP_DISINTEGRATE:m_trap_disintegrate(m); break;
X    case L_TRAP_MANADRAIN:m_trap_manadrain(m); break;
X    case L_TRAP_SLEEP_GAS:m_trap_sleepgas(m); break;
X    case L_TRAP_ACID:m_trap_acid(m); break;
X    case L_TRAP_ABYSS:m_trap_abyss(m);break;
X
X    case L_ALTAR:m_altar(m); break;
X    }
X}
X
X#ifdef MSDOS
X/* ****Moved here from another file**** */
X/* if sign is true, always print message, otherwise do so only sometimes */
Xvoid sign_print(x,y,sign)
Xint x,y,sign;
X{
X  if ((Level->site[x][y].p_locf >= CITYSITEBASE) &&
X      (Level->site[x][y].p_locf < CITYSITEBASE+NUMCITYSITES))
X    CitySiteList[Level->site[x][y].p_locf - CITYSITEBASE][0] = TRUE;
X  switch(Level->site[x][y].p_locf) {
X  case L_CHARITY:
X    print1("You notice a sign: The Rampart Orphanage And Hospice For The Needy.");
X    break;
X  case L_MANSION:
X    print1("You notice a sign:");
X    print2("This edifice protected by DeathWatch Devices, Ltd.");
X    morewait();
X    break;
X  case L_GRANARY:  
X    print1("You notice a sign:");
X    print2("Public Granary: Entrance Strictly Forbidden.");
X    break;
X  case L_PORTCULLIS:
X    if (Level->site[x][y].locchar == FLOOR)
X      print1("You see a groove in the floor and slots above you.");
X    break;
X  case L_STABLES:
X    print1("You notice a sign:");
X    print2("Village Stables");
X    break;
X  case L_COMMONS:
X    print1("You notice a sign:");
X    print2("Village Commons: No wolves allowed.");
X    break;
X  case L_MAZE:
X    print1("You notice a sign:");
X    print2("Hedge maze closed for trifid extermination.");
X    break;
X  case L_BANK:
X    if (sign) {
X      print1("You notice a sign:");
X      print2("First Bank of Omega: Autoteller Carrel.");
X    }
X    break;
X  case L_TEMPLE:
X    print1("You see the ornate portico of the Rampart Pantheon");
X    break;
X  case L_ARMORER:
X    if (sign) {
X      print1("You notice a sign:");
X      print2("Julie's Armor of Proof and Weapons of Quality");
X    }
X    break;
X  case L_CLUB:
X    if (sign) {
X      print1("You notice a sign:");
X      print2("Rampart Explorers' Club.");
X    }
X    break;
X  case L_GYM:
X    if (sign) {
X      print1("You notice a sign:");
X      print2("The Rampart Gymnasium, (affil. Rampart Coliseum).");
X    }
X    break;
X  case L_HEALER:
X    if (sign) {
X      print1("You notice a sign:");
X      print2("Rampart Healers. Member RMA.");
X    }
X    break;
X  case L_CASINO:
X    if (sign) {
X      print1("You notice a sign:");
X      print2("Rampart Mithril Nugget Casino.");
X    }
X    break;
X  case L_SEWER:
X    print1("A sewer entrance. You don't want to go down THERE, do you?");
X    break;
X  case L_COMMANDANT:
X    if (sign) {
X      print1("You notice a sign:");
X      print2("Commandant Sonder's Rampart-fried Lyzzard partes. Open 24 hrs.");
X    }
X    break;
X  case L_DINER:
X    if (sign) {
X      print1("You notice a sign:");
X      print2("The Rampart Diner. All you can eat, 25Au.");
X    }
X    break;
X  case L_CRAP:
X    if (sign) {
X      print1("You notice a sign:"); 
X      print2("Les Crapeuleaux. (****)");
X    }
X    break;
X  case L_TAVERN:
X    if (sign) {
X      print1("You notice a sign:"); 
X      print2("The Centaur and Nymph -- J. Riley, prop.");
X    }
X    break;
X  case L_ALCHEMIST:
X    if (sign) {
X      print1("You notice a sign:"); 
X      print2("Ambrosias' Potions et cie.");
X    }
X    break;
X  case L_DPW:
X    if (sign) {
X      print1("You notice a sign:"); 
X      print2("Rampart Department of Public Works.");
X    }
X    break;
X  case L_LIBRARY:
X    if (sign) {
X      print1("You notice a sign:"); 
X      print2("Rampart Public Library.");
X    }
X    break;
X  case L_CONDO:
X    if (sign) {
X      print1("You notice a sign:"); 
X      if (gamestatusp(SOLD_CONDO)) 
X	print2("Home Sweet Home");
X      else print2("Luxury Condominium For Sale; Inquire Within");
X    }
X    break;
X  case L_PAWN_SHOP:
X    if (sign) {
X      print1("You notice a sign:"); 
X      print2("Knight's Pawn Shop.");
X    }
X    break;
X  case L_CEMETARY:
X    print1("You notice a sign:"); 
X    print2("Rampart City Cemetary. Closed -- Full.");
X    break;
X  case L_GARDEN:
X    print1("You notice a sign:"); 
X    print2("Rampart Botanical Gardens---Do not deface statues.");
X    break;
X  case L_JAIL:
X    print1("You notice a sign:"); 
X    print2("Rampart City Gaol -- always room for more.");
X    break;
X  case L_ORACLE:
X    print1("You notice a sign:");
X    print2("The Oracle of the Cyan Flames");
X    morewait();
X    break;
X  }
X}
X#endif
END_OF_FILE
if test 9655 -ne `wc -c <'omovef.c'`; then
    echo shar: \"'omovef.c'\" unpacked with wrong size!
fi
# end of 'omovef.c'
fi
if test -f 'otrap.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'otrap.c'\"
else
echo shar: Extracting \"'otrap.c'\" \(7623 characters\)
sed "s/^X//" >'otrap.c' <<'END_OF_FILE'
X/* omega copyright (C) by Laurence Raphael Brothers, 1987,1988,1989 */
X/* otrap.c */
X/* trap movement functions */
X
X#include "oglob.h"
X
X
X/* various traps */
X
X/* note special function on different levels */
Xvoid l_trap_siren()
X{
X  pml ml;
X  Level->site[Player.x][Player.y].locchar = TRAP;
X  print1("A klaxon goes off!");
X  print2("'Intruder Alert -- Intruder Alert -- Intruder Alert'");
X  print3("You have the feeling you have been discovered....");
X  morewait();
X  clearmsg();
X  if ((Current_Environment == E_HOUSE) ||
X      (Current_Environment == E_MANSION)) {
X    if (! gamestatusp(DESTROYED_ORDER)) {
X      print1("The city guard arrives!");
X      print2("You are apprehended....");
X      morewait();
X      send_to_jail();
X    }
X    else print1("Nobody answers the alarm.");
X  }
X  else if (Current_Environment == E_HOVEL) 
X    print1("Nobody answers the alarm.");
X  else {
X    if (Current_Environment == E_CIRCLE) {
X      summon(-1,ML9+7); /* prime circle demon */
X      summon(-1,ML9+7);
X      summon(-1,ML9+7);
X    }
X    for(ml=Level->mlist;ml!=NULL;ml=ml->next) {
X      m_status_set(ml->m,AWAKE);
X      ml->m->sense *= 2;
X      if ((Current_Environment == E_CIRCLE) ||
X	  ((Current_Environment == E_VILLAGE) && (ml->m->id == ML0+3)) ||
X	  ((Current_Environment == E_CITY) && (ml->m->id == ML0+3)))
X	m_status_set(ml->m,HOSTILE);
X    }
X  }
X}
X
Xvoid l_trap_dart()
X{
X  Level->site[Player.x][Player.y].locchar = TRAP;
X  if (gamestatusp(MOUNTED)) {
X    mprint("A dart annoys your horse....");
X  }
X  else if (random_range(100) < Player.absorption) 
X    mprint("A dart plinks off your armor");
X  else {
X    mprint("You were hit by a dart!");
X    p_damage(difficulty(),NORMAL_DAMAGE,"a dart trap");
X    if (random_range(3)==1) {
X      mprint("It was poisoned!");
X      p_poison(difficulty());
X    }
X  }
X}
X
Xvoid l_trap_pit()
X{
X  Level->site[Player.x][Player.y].locchar = TRAP;
X  if (gamestatusp(MOUNTED)) {
X    mprint("Your horse stumbles into a pit and breaks a leg!");
X    mprint("You are forced to put it out of its misery.");
X    resetgamestatus(MOUNTED);
X    showflags();
X  }
X  else if (Player.itemweight < ((int) (Player.maxweight / 2)))
X    mprint("You nimbly dodge a pit trap.");
X  else {
X    mprint("You fell into a pit!");
X    if (random_range(3) == 1) {
X      mprint("And were impaled by spikes!");
X      p_damage(difficulty()*5,NORMAL_DAMAGE,"a spiked pit");
X    }
X    else p_damage(difficulty()*2,NORMAL_DAMAGE,"a pit");
X    Player.status[IMMOBILE] ++;
X  }
X}
X
Xvoid l_trap_door()
X{
X  if (Current_Environment != Current_Dungeon)
X    mprint("You feel oddly lucky.");
X  else {
X    Level->site[Player.x][Player.y].locchar = TRAP;
X    if (gamestatusp(MOUNTED)) {
X      mprint("You and your horse fall through a trap door!");
X      mprint("Your horse breaks its back. Snif.");
X      if (Level->site[Player.x][Player.y].aux != S_DISINTEGRATE) {
X	mprint("You're hit by a rockslide!");
X	p_damage(Level->depth*difficulty(),UNSTOPPABLE,"a rockslide");
X      }
X      change_level(Level->depth,Level->depth+1,FALSE);
X      resetgamestatus(MOUNTED);
X      showflags();
X      roomcheck();
X    }
X    else if (random_range(100) < Player.agi)
X      mprint("You leap over a trap door.");
X    else {
X      mprint("You fell through a trap door!");
X      p_damage(difficulty(),NORMAL_DAMAGE,"a trap door");
X      if (Level->site[Player.x][Player.y].aux != S_DISINTEGRATE) {
X	mprint("You're hit by a rockslide!");
X	p_damage(Level->depth*difficulty(),UNSTOPPABLE,"a rockslide");
X      }
X      change_level(Level->depth,Level->depth+1,FALSE);
X      roomcheck();
X    }
X  }
X}
X
Xvoid l_trap_snare()
X{
X  Level->site[Player.x][Player.y].locchar = TRAP;
X  if (gamestatusp(MOUNTED)) 
X    mprint("Your horse steps out of a snare trap.");
X  else if (random_range(100) < Player.agi)
X    mprint("You agilely avoid a snare.");
X  else {
X    mprint("You were caught in a snare!");
X    Player.status[IMMOBILE]+=difficulty();
X  }
X}
X
Xvoid l_trap_blade()
X{
X  Level->site[Player.x][Player.y].locchar = TRAP;
X  if (random_range(30) < Player.agi+Player.level)
X    mprint("You duck under a scything blade!");
X  else {
X    if (gamestatusp(MOUNTED)) {
X      mprint("Your horse is struck by a blade and killed instantly.");
X      resetgamestatus(MOUNTED);
X      showflags();
X    }
X    else {
X      mprint("A heavy blade scythes across the room and hits you!");
X      p_damage(random_range(difficulty()*3)+difficulty()-Player.absorption,
X	       NORMAL_DAMAGE,
X	       "a blade trap");
X    }
X  }
X}
X
Xvoid l_trap_fire()
X{
X  if (gamestatusp(MOUNTED)) {
X    mprint("Your horse is struck by a blast of fire and is charbroiled!");
X    resetgamestatus(MOUNTED);
X    showflags();
X  }
X  else if (random_range(50) < Player.agi+Player.level)
X    mprint("You dodge a pillar of fire!");
X  else {
X    mprint("You were blasted by a fire trap!");
X    p_damage(random_range((difficulty()+1)*5),FLAME,"a fire trap");
X  }
X  Level->site[Player.x][Player.y].locchar = FIRE;
X  Level->site[Player.x][Player.y].p_locf = L_FIRE;
X}
X
Xvoid l_trap_teleport()
X{
X  Level->site[Player.x][Player.y].locchar = TRAP;
X  mprint("You experience a momentary disorientation....");
X  if (random_range(10000) > difficulty()*difficulty()) p_teleport(0);
X  else p_teleport(-1);
X}
X
Xvoid l_trap_disintegrate()
X{
X  Level->site[Player.x][Player.y].locchar = TRAP;
X  mprint("Oh, no! A disintegration trap!");
X  if (gamestatusp(MOUNTED)) {
X    mprint("Your horse falls apart into its component atoms...");
X    resetgamestatus(MOUNTED);
X    showflags();
X  }
X  disintegrate(Player.x,Player.y);
X}
X
Xvoid l_trap_sleepgas()
X{
X  Level->site[Player.x][Player.y].locchar = TRAP;
X  mprint("Hsssssssss....");
X  morewait();
X  mprint("You detect a strange odor....");
X  sleep_player((difficulty()/5)+1);
X}
X
X
Xvoid l_trap_acid()
X{
X  int i,k,itemdamage;
X  Level->site[Player.x][Player.y].locchar = TRAP;
X  if (Player.agi+Player.level < random_range(100)) {
X    mprint("You are drenched by a spray of acid!");
X    if (gamestatusp(MOUNTED)) {
X      mprint("Your horse dies unpleasantly.");
X      resetgamestatus(MOUNTED);
X      showflags();
X    }
X    p_damage(random_range(difficulty()*5),ACID,"an acid trap");
X    if (! p_immune(ACID)) {
X      mprint("The acid seeps into your pack...");
X      morewait();
X      itemdamage = random_range(5);
X      for(i=k=0;((i<MAXITEMS) && (k<itemdamage));i++)
X	if (Player.possessions[i]!=NULL) {
X	  k++;
X	  damage_item(Player.possessions[i]);
X	}
X    }
X  }
X  else mprint("You somehow dodge a shower of hydroflouric acid!");
X}
X
Xvoid l_trap_abyss()
X{
X  Level->site[Player.x][Player.y].locchar = ABYSS;
X  if (gamestatusp(MOUNTED)) {
X    mprint("You and your horse fall into the infinite abyss!");
X    l_abyss();
X  }
X  if (Player.dex + Player.level < random_range(100)) {
X    mprint("You stumble over a concealed entrance to the abyss!");
X    l_abyss();
X  }
X  else mprint("You gingerly step around a concealed entrance to the abyss!");
X}
X
Xvoid l_trap_manadrain()
X{
X  Level->site[Player.x][Player.y].locchar = TRAP;
X  if (Player.mana==0) {
X    if (random_range(10)==3) {
X      mprint("That's strange.... You feel repowered!");
X      mprint("The manadrain trap overloads -- positive feedback....");
X      Level->site[Player.x][Player.y].locchar = FLOOR;
X      Level->site[Player.x][Player.y].p_locf = L_NO_OP;
X      Player.mana = calcmana();
X    }
X    else mprint("You feel strangely unaffected by the manadrain trap.");
X  }
X  else {
X    Level->site[Player.x][Player.y].locchar = TRAP;
X    mprint("A weird rainbow light seems to play over you....");
X    mprint("You feel drained.");
X    while (Player.mana > 1) {
X      Player.mana /= 2;
X      dataprint();
X    }
X    Player.mana = 0;
X    dispel(-1);
X  }
X}
END_OF_FILE
if test 7623 -ne `wc -c <'otrap.c'`; then
    echo shar: \"'otrap.c'\" unpacked with wrong size!
fi
# end of 'otrap.c'
fi
if test -f 'ovillage.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'ovillage.c'\"
else
echo shar: Extracting \"'ovillage.c'\" \(6553 characters\)
sed "s/^X//" >'ovillage.c' <<'END_OF_FILE'
X/* omega copyright (C) by Laurence Raphael Brothers, 1987,1988,1989 */
X/* ovillage.c */
X/* some functions to make the village levels */
X
X#include "oglob.h"
X
X
X/* loads the village level into Level*/
Xvoid load_village(villagenum)
Xint villagenum;
X{
X  int i,j;
X  char site;
X  
X  FILE *fd;
X  
X
X  TempLevel = Level;
X  if (ok_to_free(TempLevel)) {
X#ifndef MSDOS
X    free((char *) TempLevel);
X#endif
X    TempLevel = NULL;
X  }
X
X  assign_village_function(0,0,TRUE);
X
X#ifndef MSDOS
X  Level = ((plv) malloc(sizeof(levtype)));
X#else
X  msdos_changelevel(TempLevel,0,-1);
X  Level = &TheLevel;
X#endif
X  clear_level(Level);
X  Level->environment = E_VILLAGE;
X  strcpy(Str3,OMEGALIB);
X  switch(villagenum) {
X#ifndef MSDOS
X  case 1:strcat(Str3,"ovillage1.dat");break;
X  case 2:strcat(Str3,"ovillage2.dat");break;
X  case 3:strcat(Str3,"ovillage3.dat");break;
X  case 4:strcat(Str3,"ovillage4.dat");break;
X  case 5:strcat(Str3,"ovillage5.dat");break;
X  case 6:strcat(Str3,"ovillage6.dat");break;
X#else
X  case 1:strcat(Str3,"ovillag1.dat");break;
X  case 2:strcat(Str3,"ovillag2.dat");break;
X  case 3:strcat(Str3,"ovillag3.dat");break;
X  case 4:strcat(Str3,"ovillag4.dat");break;
X  case 5:strcat(Str3,"ovillag5.dat");break;
X  case 6:strcat(Str3,"ovillag6.dat");break;
X#endif
X  }
X  fd = fopen(Str3,"r");
X  for(j=0;j<LENGTH;j++) {
X    for(i=0;i<WIDTH;i++) {
X      lset(i,j,SEEN);
X      site = getc(fd);
X      switch(site) {
X      case 'f':
X	Level->site[i][j].locchar = FLOOR;
X	make_food_bin(i,j);
X	break;
X      case 'g':
X	Level->site[i][j].locchar = FLOOR;
X	Level->site[i][j].p_locf = L_GRANARY;
X	break;
X      case 'h':
X	Level->site[i][j].locchar = FLOOR;
X	make_horse(i,j);
X	break;
X      case 'S':
X	Level->site[i][j].locchar = FLOOR;
X	Level->site[i][j].p_locf = L_STABLES;
X	break;
X      case 'H':
X	Level->site[i][j].locchar = FLOOR;
X	make_merchant(i,j);
X	break;
X      case 'C':
X	Level->site[i][j].locchar = FLOOR;
X	Level->site[i][j].p_locf = L_COMMONS;
X	break;
X      case 's':
X	Level->site[i][j].locchar = FLOOR;
X	make_sheep(i,j);
X	break;
X      case 'x':
X	assign_village_function(i,j,FALSE);
X	break;
X      case 'X':
X	Level->site[i][j].locchar = FLOOR;
X	Level->site[i][j].p_locf = L_COUNTRYSIDE;
X	break;
X      case 'G':
X	Level->site[i][j].locchar = FLOOR;
X	make_guard(i,j);
X	break;
X      case '^':
X	Level->site[i][j].locchar = FLOOR;
X	Level->site[i][j].p_locf = L_TRAP_SIREN;
X	break;
X      case '"':
X	Level->site[i][j].locchar = HEDGE;
X	Level->site[i][j].p_locf = L_HEDGE;
X	break;
X      case '~':
X	Level->site[i][j].locchar = WATER;
X	Level->site[i][j].p_locf = L_WATER;
X	break;
X      case '+':
X	Level->site[i][j].locchar = WATER;
X	Level->site[i][j].p_locf = L_CHAOS;
X	break;
X      case '\'':
X	Level->site[i][j].locchar = HEDGE;
X	Level->site[i][j].p_locf = L_TRIFID;
X	break;
X      case '!':
X	special_village_site(i,j,villagenum);
X	break;
X      case '#':
X	Level->site[i][j].locchar = WALL;
X	Level->site[i][j].aux = 100;
X	break;
X      default:
X	Level->site[i][j].p_locf = L_NO_OP;
X	Level->site[i][j].locchar = site;
X	break;
X      }
X      if (loc_statusp(i,j,SECRET))
X	Level->site[i][j].showchar = '#';
X      else Level->site[i][j].showchar = Level->site[i][j].locchar;
X    }
X    fscanf(fd,"\n");
X  }
X  fclose(fd);
X}
X
Xvoid make_guard(i,j)
Xint i,j;
X{
X  pml tml = ((pml) (malloc(sizeof(mltype))));
X  tml->m = (Level->site[i][j].creature = make_creature(ML0+3));
X  tml->m->x = i;
X  tml->m->y = j;
X  tml->next = Level->mlist;
X  Level->mlist = tml;
X}
X
Xvoid make_sheep(i,j)
Xint i,j;
X{
X  pml tml = ((pml) (malloc(sizeof(mltype))));
X  tml->m = (Level->site[i][j].creature = make_creature(SHEEP));
X  tml->m->x = i;
X  tml->m->y = j;
X  tml->next = Level->mlist;
X  Level->mlist = tml;
X}
X
Xvoid make_food_bin(i,j)
Xint i,j;
X{ 
X  pol tol;
X  int k;
X
X  for(k=0;k<10;k++) {
X    tol = ((pol) malloc(sizeof(oltype)));
X    tol->thing = ((pob) malloc(sizeof(objtype)));
X    make_food(tol->thing,15); /* grain */
X    tol->next = Level->site[i][j].things;
X    Level->site[i][j].things = tol;
X  }
X}
X
Xvoid make_horse(i,j)
Xint i,j;
X{
X  pml tml = ((pml) (malloc(sizeof(mltype))));
X  tml->m = (Level->site[i][j].creature = make_creature(HORSE));
X  tml->m->x = i;
X  tml->m->y = j;
X  tml->next = Level->mlist;
X  Level->mlist = tml;
X}
X
X
Xvoid make_merchant(i,j)
Xint i,j;
X{
X  pml tml = ((pml) (malloc(sizeof(mltype))));
X  tml->m = (Level->site[i][j].creature = make_creature(ML0+6));
X  tml->m->x = i;
X  tml->m->y = j;
X  tml->next = Level->mlist;
X  Level->mlist = tml;
X}
X
X
Xvoid assign_village_function(x,y,setup)
Xint x,y,setup;
X{
X  static int next=0;
X  static int permutation[24]; /* number of x's in village map */
X  int i,j,k;
X
X
X  if (setup) {
X    next = 0;
X    for(i=0;i<24;i++)
X      permutation[i] = i;
X    for(i=0;i<24;i++) {
X      j = permutation[i];
X      k = random_range(24);
X      permutation[i] = permutation[k];
X      permutation[k] = j;
X    }
X  }
X  else {
X
X    lset(x,y+1,STOPS);
X    lset(x+1,y,STOPS);
X    lset(x-1,y,STOPS);
X    lset(x,y-1,STOPS);
X    
X    
X    switch(permutation[next++]) {
X    case 0:
X      Level->site[x][y].locchar = OPEN_DOOR;
X      Level->site[x][y].p_locf = L_ARMORER;
X      break;
X    case 1:
X      Level->site[x][y].locchar = OPEN_DOOR;
X      Level->site[x][y].p_locf = L_HEALER;
X      break;
X    case 2: 
X      Level->site[x][y].locchar = OPEN_DOOR;
X      Level->site[x][y].p_locf = L_TAVERN;
X      break;
X    case 3:
X      Level->site[x][y].locchar = OPEN_DOOR;
X      Level->site[x][y].p_locf = L_COMMANDANT;
X      break;
X    case 4:
X      Level->site[x][y].locchar = OPEN_DOOR;
X      Level->site[x][y].p_locf = L_CARTOGRAPHER;
X      break;
X    default:
X      Level->site[x][y].locchar = CLOSED_DOOR;
X      if (random_range(2))
X	Level->site[x][y].p_locf = L_HOVEL;
X
X      if (random_range(2)) 
X	Level->site[x][y].aux = LOCKED;
X      else Level->site[x][y].p_locf = L_HOUSE;
X      break;
X    }
X  }
X}  
X  
X
Xvoid special_village_site(i,j,villagenum)
Xint i,j,villagenum;
X{
X  if (villagenum == 1) {
X    Level->site[i][j].locchar = ALTAR;
X    Level->site[i][j].p_locf = L_LAWSTONE;
X  }
X  if (villagenum == 2) {
X    Level->site[i][j].locchar = ALTAR;
X    Level->site[i][j].p_locf = L_BALANCESTONE;
X  }
X  else if (villagenum == 3) {
X    Level->site[i][j].locchar = ALTAR; 
X    Level->site[i][j].p_locf = L_CHAOSTONE; 
X  }
X  else if (villagenum == 4) {
X    Level->site[i][j].locchar = ALTAR; 
X    Level->site[i][j].p_locf = L_VOIDSTONE; 
X  }
X  else if (villagenum == 5) {
X    Level->site[i][j].locchar = ALTAR; 
X    Level->site[i][j].p_locf = L_SACRIFICESTONE; 
X  }
X  else if (villagenum == 6) {
X    Level->site[i][j].locchar = ALTAR; 
X    Level->site[i][j].p_locf = L_MINDSTONE; 
X  }
X}
END_OF_FILE
if test 6553 -ne `wc -c <'ovillage.c'`; then
    echo shar: \"'ovillage.c'\" unpacked with wrong size!
fi
# end of 'ovillage.c'
fi
echo shar: End of archive 18 \(of 20\).
cp /dev/null ark18isdone
MISSING=""
for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ; do
    if test ! -f ark${I}isdone ; then
	MISSING="${MISSING} ${I}"
    fi
done
if test "${MISSING}" = "" ; then
    echo You have unpacked all 20 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