games@tekred.TEK.COM (07/26/88)
Submitted by: "Laurence R. Brothers" <brothers@paul.rutgers.edu>
Comp.sources.games: Volume 5, Issue 20
Archive-name: omega2/Part10
#! /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 10 (of 19)."
# Contents: ocom2.c oeffect1.c omaze1.dat ovillage.c
# Wrapped by billr@saab on Wed Jul 13 10:46:50 1988
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'ocom2.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'ocom2.c'\"
else
echo shar: Extracting \"'ocom2.c'\" \(26763 characters\)
sed "s/^X//" >'ocom2.c' <<'END_OF_FILE'
X/* omega copyright (C) by Laurence Raphael Brothers, 1987,1988 */
X/* ocom2.c */
X
X/* This file contains toplevel commands called from ocom1.c */
X
X#include "oglob.h"
X
X
X/* no op a turn.... */
Xvoid rest()
X{
X if (random_range(20) == 1) {
X switch(random_range(10)) {
X case 0: print3(" Time passes slowly.... "); break;
X case 1: print3(" Tick. Tock. Tick. Tock. "); break;
X case 2: print3(" Ho Hum. "); break;
X case 3: print3(" Beauty Sleep. Well, in your case, Ugly Sleep. "); break;
X case 4: print3(" And with Strange Aeons, even Death may die. "); break;
X case 5: print3(" La Di Da. "); break;
X case 6: print3(" Time keeps on tickin' tickin' -- into the future.... ");
X break;
X case 7: print3(" Boooring! "); break;
X case 8: print3(" You think I like watching you sleep? "); break;
X case 9: print3(" 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 clearmsg();
X
X if (Player.status[BLINDED] > 0)
X print3("You're blind -- you can't read!!!");
X else if (Player.status[AFRAID] > 0)
X print3("You are too afraid to stop to read a scroll!");
X else {
X print1("Read -- ");
X index = getitem(SCROLL);
X if (index == ABORT)
X setgamestatus(SKIP_MONSTERS);
X else {
X obj = Player.possessions[index];
X if (obj->objchar != SCROLL) {
X print3("There's nothing written on ");
X nprint3(itemid(obj));
X }
X else {
X nprint1("You carefully unfurl the scroll....");
X morewait();
X item_use(obj);
X dispose_lost_objects(1,obj);
X }
X }
X }
X}
X
X
X
X
Xvoid quaff()
X{
X int index;
X struct object *obj;
X clearmsg();
X print1("Quaff --");
X index = getitem(POTION);
X if (index == ABORT)
X setgamestatus(SKIP_MONSTERS);
X else {
X obj = Player.possessions[index];
X if (obj->objchar != POTION) {
X print3("You can't drink ");
X nprint3(itemid(obj));
X }
X else {
X print1("You drink it down.... ");
X item_use(obj);
X morewait();
X dispose_lost_objects(1,obj);
X }
X }
X}
X
X
X
X
Xvoid activate()
X{
X int index;
X char response;
X
X clearmsg();
X
X print1("Activate -- item [i] or artifact [a] or quit [ESCAPE]?");
X do response = mcigetc();
X while ((response != 'i') && (response != 'a') && (response != ESCAPE));
X if (response != ESCAPE) {
X if (response == 'i')
X index = getitem(THING);
X else if (response == 'a')
X index = getitem(ARTIFACT);
X if (index != ABORT) {
X clearmsg();
X print1("You activate it.... ");
X morewait();
X item_use(Player.possessions[index]);
X }
X else setgamestatus(SKIP_MONSTERS);
X }
X else setgamestatus(SKIP_MONSTERS);
X}
X
X
X
X
X
Xvoid eat()
X{
X int index;
X struct object *obj;
X
X clearmsg();
X
X print1("Eat --");
X index = getitem(FOOD);
X if (index == ABORT)
X setgamestatus(SKIP_MONSTERS);
X else {
X obj = Player.possessions[index];
X if ((obj->objchar != FOOD)&&(obj->objchar != CORPSE)) {
X print3("You can't eat ");
X nprint3(itemid(obj));
X }
X else {
X if (obj->usef == I_FOOD) Player.food = max(0,Player.food+obj->aux);
X item_use(obj);
X dispose_lost_objects(1,obj);
X if (Current_Dungeon == E_COUNTRYSIDE) {
X Time += 100;
X hourly_check();
X }
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 print3("You are too terror-stricken to stop to search for anything.");
X else {
X if (!gamestatusp(FAST_MOVE)) {
X setgamestatus(FAST_MOVE);
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);
X }
X}
X
X
X
X/* pick up a thing where the player is */
X void pickup()
X {
X if (Level->site[Player.x][Player.y].things == NULL)
X print3("There's nothing there!");
X else pickup_at(Player.x,Player.y);
X }
X
X
X/* floor inventory */
Xvoid floor_inv()
X{
X pol ol = Level->site[Player.x][Player.y].things;
X setgamestatus(SKIP_MONSTERS);
X menuclear();
X while (ol != NULL) {
X if (ol->thing == NULL) print3("***Error; null thing on things list***");
X else {
X menuprint(itemid(ol->thing));
X menuprint("\n");
X }
X ol = ol->next;
X }
X morewait();
X xredraw();
X}
X
X
X
X
X
X
X
X
X
Xvoid drop()
X{
X int index,n;
X
X clearmsg();
X
X print1("Drop --");
X index = getitem(CASHVALUE);
X if (index == ABORT)
X setgamestatus(SKIP_MONSTERS);
X else {
X if (index == CASHVALUE) drop_money();
X else if ((! Player.possessions[index]->used) ||
X (! cursed(Player.possessions[index]))) {
X if (Player.possessions[index]->number == 1) {
X p_drop_at(Player.x,Player.y,1,Player.possessions[index]);
X conform_lost_objects(1,Player.possessions[index]);
X }
X else {
X n = getnumber(Player.possessions[index]->number);
X p_drop_at(Player.x,Player.y,n,Player.possessions[index]);
X conform_lost_objects(n,Player.possessions[index]);
X }
X }
X else {
X print3("You can't seem to get rid of: ");
X nprint3(itemid(Player.possessions[index]));
X }
X }
X calc_melee();
X}
X
X
X
X
X
X
X
X
X
X/* talk to the animals -- learn their languages.... */
Xvoid talk()
X{
X int dx,dy,index=0;
X char response;
X struct monster *m;
X
X clearmsg();
X
X print1("Talk --");
X index = getdir();
X
X if (index == ABORT)
X setgamestatus(SKIP_MONSTERS);
X else {
X dx = Dirs[0][index];
X dy = Dirs[1][index];
X
X if ((! inbounds(Player.x+dx, Player.y+dy)) ||
X (Level->site[Player.x+dx][Player.y+dy].creature == NULL)) {
X print3("There's nothing there to talk to!!!");
X setgamestatus(SKIP_MONSTERS);
X }
X else {
X m = Level->site[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: setgamestatus(SKIP_MONSTERS); break;
X }
X }
X }
X xredraw();
X}
X
X/* try to deactivate a trap */
Xvoid disarm()
X{
X int x,y,index=0;
X pob o;
X
X clearmsg();
X print1("Disarm -- ");
X
X index = getdir();
X
X if (index == ABORT)
X setgamestatus(SKIP_MONSTERS);
X else {
X x = Dirs[0][index]+Player.x;
X y = Dirs[1][index]+Player.y;
X
X if (! inbounds(x,y))
X print3("Whoa, off the map...");
X else if (Level->site[x][y].locchar != TRAP)
X print3("You can't see a trap there!");
X else {
X if (random_range(50+Level->depth*2) <
X Player.dex+Player.level+Player.rank[THIEVES]*10) {
X print1("You disarmed the trap!");
X if (random_range(100) < Player.dex+Player.rank[THIEVES]*10) {
X o = ((pob) malloc(sizeof(objtype)));
X switch(Level->site[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 print2("You manage to retrieve the trap components!");
X Objects[o->id].known = 1;
X o->known = 1;
X gain_item(o);
X gain_experience(25);
X }
X }
X Level->site[x][y].p_locf = L_NO_OP;
X Level->site[x][y].locchar = FLOOR;
X gain_experience(5);
X }
X else if (random_range(10+Level->depth) > Player.dex) {
X print1("You accidentally set off the trap!");
X Player.x = x; Player.y = y;
X p_movefunction(Level->site[x][y].p_locf);
X }
X else print1("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 clearmsg();
X
X print1("Give to monster --");
X dindex = getdir();
X if (dindex == ABORT)
X setgamestatus(SKIP_MONSTERS);
X else {
X dx = Dirs[0][dindex];
X dy = Dirs[1][dindex];
X if (! inbounds(Player.x+dx, Player.y+dy))
X print3("Whoa, off the map...");
X else if (Level->site[Player.x+dx][Player.y+dy].creature == NULL) {
X print3("There's nothing there to give something to!!!");
X setgamestatus(SKIP_MONSTERS);
X }
X else {
X m = Level->site[Player.x+dx][Player.y+dy].creature;
X clearmsg();
X print1("Give what? ");
X index = getitem(CASHVALUE);
X if (index == ABORT)
X setgamestatus(SKIP_MONSTERS);
X else if (index == CASHVALUE) give_money(m);
X else if (! cursed(Player.possessions[index])) {
X obj = ((pob) malloc(sizeof(objtype)));
X *obj = *(Player.possessions[index]);
X conform_lost_objects(1,Player.possessions[index]);
X obj->number = 1;
X givemonster(m,obj);
X print2("Given: ");
X nprint2(itemid(obj));
X morewait();
X calc_melee();
X }
X else {
X print3("You can't even give away: ");
X nprint3(itemid(Player.possessions[index]));
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 clearmsg();
X
X if (Player.status[AFRAID] > 0)
X print3("You are so terror-stricken you can't hold a wand straight!");
X else {
X print1("Zap --");
X index = getitem(STICK);
X if (index == ABORT)
X setgamestatus(SKIP_MONSTERS);
X else {
X obj = Player.possessions[index];
X if (obj->objchar != STICK) {
X print3("You can't zap: ");
X nprint3(itemid(obj));
X }
X else
X if (obj->charge < 1)
X print3("Fizz.... 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 clearmsg();
X if (Player.status[AFRAID] > 0)
X print3("You are too afraid to concentrate on a spell!");
X else {
X index = getspell();
X xredraw();
X if (index == ABORT)
X setgamestatus(SKIP_MONSTERS);
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 print3("You lack the power for that spell! ");
X else {
X Player.mana -= drain;
X cast_spell(index);
X }
X }
X }
X dataprint();
X}
X
X
X/* go upstairs ('<' command) */
Xvoid upstairs()
X{
X if (Level->site[Player.x][Player.y].locchar != UP)
X print3("Not here!");
X else {
X if (gamestatusp(MOUNTED))
X print2("You manage to get your horse upstairs.");
X print1("You ascend a level.");
X if (Level->depth <= 1) {
X if (Level->environment == E_SEWERS)
X change_environment(E_CITY);
X else change_environment(E_COUNTRYSIDE);
X }
X else change_level(Level->depth,Level->depth-1,FALSE);
X roomcheck();
X }
X setgamestatus(SKIP_MONSTERS);
X}
X
X
X
X/* go downstairs ('>' command) */
Xvoid downstairs()
X{
X if (Level->site[Player.x][Player.y].locchar != DOWN)
X print3("Not here!");
X else {
X if (gamestatusp(MOUNTED))
X print2("You manage to get your horse downstairs.");
X if (Current_Environment == Current_Dungeon) {
X print1("You descend a level.");
X change_level(Level->depth,Level->depth+1,FALSE);
X roomcheck();
X }
X else if ((Current_Environment == E_CITY) ||
X (Last_Environment == E_CITY))
X change_environment(E_SEWERS);
X else if (Current_Environment != Current_Dungeon)
X print3("This stairway is deviant. You can't use it.");
X }
X setgamestatus(SKIP_MONSTERS);
X}
X
X
X
X
X/* set various player options */
X/* have to redefine in odefs for next full recompile */
Xvoid setoptions()
X{
X int slot = 1,done = FALSE;
X char response;
X
X clearmsg();
X menuclear();
X
X display_options();
X
X move_slot(1,1,NUMOPTIONS);
X clearmsg();
X print1("Currently selected option is preceded by highlit >>");
X print2("Move selected option with '>' and '<', ESCAPE to quit.");
X do {
X response = mcigetc();
X switch(response) {
X case 'j':
X case '>':
X slot = move_slot(slot,slot+1,NUMOPTIONS+1);
X break;
X case 'k':
X case '<':
X if (slot > 1) /* hack hack */
X slot = move_slot(slot,slot-1,NUMOPTIONS+1);
X break;
X case 't':
X if (slot <= NUMTFOPTIONS)
X optionset(pow2(slot-1));
X else if (slot == VERBOSITY_LEVEL)
X Verbosity = TERSE;
X else print3("'T' is meaningless for this option.");
X break;
X case 'f':
X if (slot <= NUMTFOPTIONS)
X optionreset(pow2(slot-1));
X else print3("'F' is meaningless for this option.");
X break;
X case 'm':
X if (slot == VERBOSITY_LEVEL)
X Verbosity = MEDIUM;
X else print3("'M' is meaningless for this option.");
X break;
X case 'v':
X if (slot == VERBOSITY_LEVEL)
X Verbosity = VERBOSE;
X else print3("'V' is meaningless for this option.");
X break;
X case '1':case '2':case '3':case '4':case '5':
X case '6':case '7':case '8':case'9':
X if (slot == SEARCH_DURATION)
X Searchnum = response - '0';
X else print3("A number is meaningless for this option.");
X break;
X case ESCAPE:
X done = TRUE;
X break;
X default: print3("That response is meaningless for this option."); break;
X }
X display_option_slot(slot);
X move_slot(slot,slot,NUMOPTIONS+1);
X } while (! done);
X xredraw();
X}
X
X
X
X/* name an item */
Xvoid callitem()
X{
X int index;
X pob obj;
X
X clearmsg();
X setgamestatus(SKIP_MONSTERS);
X print1("Call --");
X index = getitem(NULL);
X if (index == CASHVALUE) print3("Can't rename cash!");
X else if (index != ABORT) {
X obj = Player.possessions[index];
X if (obj->known)
X print3("That item is already identified!");
X else {
X print1("Call it:");
X obj->objstr = salloc(msgscanstring());
X clearmsg();
X print2("Also call by that name all similar items? [yn] ");
X if (ynq2() == 'y') {
X Objects[obj->id].objstr = salloc(obj->objstr);
X }
X }
X }
X}
X
X
X
X
X/* open a door */
Xvoid opendoor()
X{
X int dir;
X int ox,oy;
X
X clearmsg();
X print1("Open --");
X dir = getdir();
X if (dir == ABORT)
X setgamestatus(SKIP_MONSTERS);
X else {
X ox = Player.x + Dirs[0][dir];
X oy = Player.y + Dirs[1][dir];
X if (Level->site[ox][oy].locchar == OPEN_DOOR) {
X print3("That door is already open!");
X setgamestatus(SKIP_MONSTERS);
X }
X else if (Level->site[ox][oy].locchar == PORTCULLIS) {
X print1("You try to lift the massive steel portcullis....");
X if (random_range(100) < Player.str) {
X print2("Incredible. You bust a gut and lift the portcullis.");
X Level->site[ox][oy].locchar = FLOOR;
X }
X else {
X print2("Argh. You ruptured yourself.");
X p_damage(Player.str,UNSTOPPABLE,"a portcullis");
X }
X }
X else if ((Level->site[ox][oy].locchar != CLOSED_DOOR) ||
X loc_statusp(ox,oy,SECRET)) {
X print3("You can't open that!");
X setgamestatus(SKIP_MONSTERS);
X }
X else if (Level->site[ox][oy].aux == LOCKED)
X print3("That door seems to be locked.");
X else Level->site[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 clearmsg();
X print1("Bashing --");
X dir = getdir();
X if (dir == ABORT)
X setgamestatus(SKIP_MONSTERS);
X else {
X ox = Player.x + Dirs[0][dir];
X oy = Player.y + Dirs[1][dir];
X if ((Current_Environment == E_CITY) &&
X (ox == 0) &&
X (oy == 0)) {
X print1("Back Door WIZARD Mode!");
X print2("You will invalidate your score if you proceed.");
X morewait();
X print1("Enable WIZARD Mode? [yn] ");
X if (ynq1()=='y') {
X print2("You feel like a cheater.");
X setgamestatus(CHEATED);
X }
X else print2("A sudden tension goes out of the air....");
X }
X else {
X if (Level->site[ox][oy].locchar == WALL) {
X print1("You hurl yourself at the wall!");
X p_damage(Player.str,NORMAL_DAMAGE,"a suicidal urge");
X }
X else if (Level->site[ox][oy].locchar == OPEN_DOOR) {
X print1("You hurl yourself through the open door!");
X print2("Yaaaaah! ... thud.");
X Player.x = ox;
X Player.y = oy;
X p_damage(3,UNSTOPPABLE,"silliness");
X p_movefunction(Level->site[Player.x][Player.y].p_locf);
X setgamestatus(SKIP_MONSTERS); /* monsters are surprised... */
X }
X else if (Level->site[ox][oy].locchar == CLOSED_DOOR) {
X if (loc_statusp(ox,oy,SECRET)) {
X print1("You found a secret door!");
X lreset(ox,oy,SECRET);
X }
X if (Level->site[ox][oy].aux == LOCKED) {
X if (random_range(100)+Level->depth < Player.str) {
X Player.x = ox;
X Player.y = oy;
X print1("You blast the door off its hinges!");
X p_movefunction(Level->site[Player.x][Player.y].p_locf);
X Level->site[ox][oy].locchar = FLOOR;
X setgamestatus(SKIP_MONSTERS); /* monsters are surprised... */
X }
X else {
X print1("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 print1("You bash open the door!");
X if (random_range(30) > Player.str)
X p_damage(1,UNSTOPPABLE,"a door");
X p_movefunction(Level->site[Player.x][Player.y].p_locf);
X Level->site[ox][oy].locchar = OPEN_DOOR;
X setgamestatus(SKIP_MONSTERS); /* monsters are surprised... */
X }
X }
X else if (Level->site[ox][oy].locchar == STATUE) {
X statue_random(ox,oy);
X }
X else if (Level->site[ox][oy].locchar == PORTCULLIS) {
X print1("Really, you don't have a prayer.");
X if (random_range(1000) < Player.str) {
X print2("The portcullis flies backwards into a thousand fragments.");
X print3("Wow. What a stud.");
X gain_experience(100);
X Level->site[ox][oy].locchar = FLOOR;
X Level->site[ox][oy].p_locf = L_NO_OP;
X }
X else {
X print2("You only hurt yourself on the 3'' thick steel bars.");
X p_damage(Player.str,UNSTOPPABLE,"a portcullis");
X }
X }
X else if (Level->site[ox][oy].locchar == ALTAR) {
X if ((Player.patron > 0)&&(Level->site[ox][oy].aux == Player.patron)) {
X print1("You have a vision! An awesome angel hovers over the altar.");
X print2("The angel says: 'You twit, don't bash your own altar!'");
X print3("The angel slaps you upside the head for your presumption.");
X p_damage(Player.hp-1,UNSTOPPABLE,"an annoyed angel");
X }
X else if (Level->site[ox][oy].aux == 0) {
X print1("The feeble powers of the minor godling are not enough to");
X print2("protect his altar! The altar crumbles away to dust.");
X print3("You feel almost unbearably smug.");
X Level->site[ox][oy].locchar = RUBBLE;
X Level->site[ox][oy].p_locf = L_RUBBLE;
X gain_experience(5);
X }
X else {
X print1("You have successfully annoyed a major deity. Good job.");
X print2("Zzzzap! A bolt of godsfire strikes!");
X if (Player.rank[PRIESTHOOD] > 0)
X print3("Your own deity's aegis defends you from the bolt!");
X p_damage(max(0,random_range(100)-Player.rank[PRIESTHOOD]*20),
X UNSTOPPABLE,
X "a bolt of godsfire");
X if (Player.rank[PRIESTHOOD]*20+Player.pow+Player.level >
X random_range(200)) {
X morewait();
X print1("The altar crumbles...");
X Level->site[ox][oy].locchar = RUBBLE;
X Level->site[ox][oy].p_locf = L_RUBBLE;
X morewait();
X print2("You sense your deity's pleasure with you.");
X morewait();
X print3("You are surrounded by a golden glow.");
X cleanse(1);
X heal(10);
X gain_experience(500);
X }
X }
X }
X else {
X print3("You restrain yourself from total silliness.");
X setgamestatus(SKIP_MONSTERS);
X }
X }
X }
X}
X
X
X/* attempt destroy an item */
Xvoid bash_item()
X{
X int item;
X pob obj;
X
X clearmsg();
X print1("Destroy an item --");
X item = getitem(NULL);
X if (item == CASHVALUE) print3("Can't destroy cash!");
X else if (item != ABORT) {
X obj = Player.possessions[item];
X if (Player.str+random_range(20) > obj->fragility+random_range(20)) {
X if (Player.alignment < 0) {
X print2("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 print2("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 print2("Uh Oh -- Now you've gotten it angry....");
X p_damage(obj->level*10,
X UNSTOPPABLE,
X "an enraged artifact");
X }
X else {
X print2("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(compress)
Xint compress;
X{
X clearmsg();
X print1("Confirm Save? [yn] ");
X if (ynq1() == 'y') {
X if (gamestatusp(ARENA_MODE)) {
X print3("Can't save the game in the arena!");
X setgamestatus(SKIP_MONSTERS);
X }
X else if (Current_Environment == L_ADEPT) {
X print3("Can't save the game in the Adept's Challenge!");
X setgamestatus(SKIP_MONSTERS);
X }
X else {
X print1("Enter savefile name: ");
X strcpy(Str1,msgscanstring());
X#ifdef COMPRESS_SAVE_FILES
X if (!compress) {
X print1("Warning: This file will not be compressed.");
X print2("You should compress it yourself.");
X morewait();
X }
X#endif
X if (save_game(compress,Str1)) {
X print3("Bye!");
X sleep(1);
X endgraf();
X exit(0);
X }
X else setgamestatus(SKIP_MONSTERS);
X }
X }
X else print1("Save Aborted.");
X}
X
X/* close a door */
Xvoid closedoor()
X{
X int dir;
X int ox,oy;
X
X clearmsg();
X
X print1("Close --");
X dir = getdir();
X if (dir == ABORT)
X setgamestatus(SKIP_MONSTERS);
X else {
X ox = Player.x + Dirs[0][dir];
X oy = Player.y + Dirs[1][dir];
X if (Level->site[ox][oy].locchar == CLOSED_DOOR) {
X print3("That door is already closed!");
X setgamestatus(SKIP_MONSTERS);
X }
X else if (Level->site[ox][oy].locchar != OPEN_DOOR) {
X print3("You can't close that!");
X setgamestatus(SKIP_MONSTERS);
X }
X else Level->site[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 static int twiddle = FALSE;
X if (p_moveable(Player.x+dx,Player.y+dy)) {
X
X if (Player.status[IMMOBILE] > 0) {
X resetgamestatus(FAST_MOVE);
X print3("You are unable to move");
X }
X else if ((Player.maxweight < Player.itemweight) &&
X random_range(2) &&
X (! Player.status[LEVITATING])) {
X if (gamestatusp(MOUNTED)) {
X print1("Your horse refuses to carry you and your pack another step!");
X print2("Your steed bucks wildly and throws you off!");
X p_damage(10,UNSTOPPABLE,"a cruelly abused horse");
X resetgamestatus(MOUNTED);
X summon(-1,HORSE);
X }
X else {
X p_damage(1,UNSTOPPABLE,"a rupture");
X print3("The weight of your pack drags you down. You can't move.");
X }
X }
X else {
X Player.x += dx;
X Player.y += dy;
X p_movefunction(Level->site[Player.x][Player.y].p_locf);
X
X /* causes moves to take effectively 30 seconds in town without
X monsters being sped up compared to player */
X if ((Current_Environment == E_CITY) ||
X (Current_Environment == E_VILLAGE)) {
X twiddle = ! twiddle;
X if (twiddle) {
X Time++;
X if (Time % 10 == 0) tenminute_check();
X else minute_status_check();
X }
X }
X
X /* this test protects against player entering countryside and still
X having effects from being on the Level, a kluge, but hey,... */
X
X if (Current_Environment != E_COUNTRYSIDE) {
X if (gamestatusp(FAST_MOVE))
X if ((Level->site[Player.x][Player.y].things != NULL) ||
X (optionp(RUNSTOP) &&
X loc_statusp(Player.x,Player.y,STOPS)))
X resetgamestatus(FAST_MOVE);
X if ((Level->site[Player.x][Player.y].things != NULL) &&
X (optionp(PICKUP)))
X pickup();
X }
X }
X }
X else if (gamestatusp(FAST_MOVE)) {
X drawvision(Player.x,Player.y);
X resetgamestatus(FAST_MOVE);
X }
X}
X
X
X/* handle a h,j,k,l, etc. */
Xvoid movepincountry(dx,dy)
Xint dx,dy;
X{
X int i,takestime = TRUE;
X if ((Player.maxweight < Player.itemweight) &&
X random_range(2) &&
X (! Player.status[LEVITATING])) {
X if (gamestatusp(MOUNTED)) {
X print1("Your horse refuses to carry you and your pack another step!");
X print2("Your steed bucks wildly and throws you off!");
X p_damage(10,UNSTOPPABLE,"a cruelly abused horse");
X resetgamestatus(MOUNTED);
X morewait();
X print1("With a shrill neigh of defiance, your former steed gallops");
X print2("off into the middle distance....");
X if (Player.packptr != 0) {
X morewait();
X print1("You remember (too late) that the contents of your pack");
X print2("were kept in your steed's saddlebags!");
X for(i=0;i<MAXPACK;i++) {
X if (Player.pack[i] != NULL)
X free((char *) Player.pack[i]);
X Player.pack[i] = NULL;
X }
X Player.packptr = 0;
X calc_melee();
X }
X }
X else {
X p_damage(1,UNSTOPPABLE,"a rupture");
X print3("The weight of your pack drags you down. You can't move.");
X }
X }
X else {
X if (gamestatusp(LOST)) {
X print3("Being lost, you strike out randomly....");
X morewait();
X dx = random_range(3)-1;
X dy = random_range(3)-1;
X }
X if (p_country_moveable(Player.x+dx,Player.y+dy)) {
X if (Player.status[IMMOBILE] > 0)
X print3("You are unable to move");
X else {
X Player.x += dx;
X Player.y += dy;
X if ((! gamestatusp(MOUNTED))&&(Player.possessions[O_BOOTS] != NULL)) {
X if (Player.possessions[O_BOOTS]->usef == I_BOOTS_7LEAGUE) {
X takestime = FALSE;
X if (Player.possessions[O_BOOTS]->blessing < 0) {
X print1("Whooah! -- Your boots launch you into the sky....");
X print2("You come down in a strange location....");
X Player.x = random_range(WIDTH);
X Player.y = random_range(LENGTH);
X morewait();
X clearmsg();
X print1("Your boots disintegrate with a malicious giggle...");
X dispose_lost_objects(1,Player.possessions[O_BOOTS]);
X }
X else if (Player.possessions[O_BOOTS]->known != 2) {
X print1("Wow! Your boots take you 7 leagues in a single stride!");
X Player.possessions[O_BOOTS]->known = 2;
X }
X }
X }
X if (gamestatusp(LOST) && (Precipitation < 1) &&
X Country[Player.x][Player.y].explored) {
X print3("Ah! Now you know where you are!");
X morewait();
X resetgamestatus(LOST);
X }
X else if (gamestatusp(LOST)) {
X print3("You're still lost.");
X morewait();
X }
X if (Precipitation > 0) Precipitation--;
X Country[Player.x][Player.y].explored = TRUE;
X terrain_check(takestime);
X }
X }
X }
X}
X
END_OF_FILE
if test 26763 -ne `wc -c <'ocom2.c'`; then
echo shar: \"'ocom2.c'\" unpacked with wrong size!
fi
# end of 'ocom2.c'
fi
if test -f 'oeffect1.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'oeffect1.c'\"
else
echo shar: Extracting \"'oeffect1.c'\" \(17668 characters\)
sed "s/^X//" >'oeffect1.c' <<'END_OF_FILE'
X
X/* omega copyright (C) by Laurence Raphael Brothers, 1987,1988 */
X/* oeffect1.c */
X
X#include "oglob.h"
X
X
X/* enchant */
Xvoid enchant(delta)
Xint delta;
X{
X int i,used = FALSE;
X float mult;
X
X if (delta < 0) {
X i = random_item();
X if (i == ABORT) {
X print1("You feel fortunate.");
X morewait();
X }
X else {
X if (Player.possessions[i]->blessing < 0) {
X print1("The item glows, but the glow flickers out...");
X morewait();
X }
X else {
X used = (Player.possessions[i]->used);
X if (used) {
X Player.possessions[i]->used = FALSE;
X item_use(Player.possessions[i]);
X }
X print1("Your ");
X nprint1(itemid(Player.possessions[i]));
X nprint1(" radiates an aura of mundanity!");
X morewait();
X Player.possessions[i]->plus = 0;
X Player.possessions[i]->charge = -1;
X Player.possessions[i]->usef = I_NOTHING;
X if (used) {
X Player.possessions[i]->used = TRUE;
X item_use(Player.possessions[i]);
X }
X }
X }
X }
X else {
X i = getitem(NULL);
X if (i == ABORT) {
X print1("You feel unlucky.");
X morewait();
X }
X else if (i == CASHVALUE) {
X print1("You enchant your money.... What a concept!");
X mult = 1 + (random_range(7)-3)/6.0;
X if (mult > 1.0) print2("Seems to have been a good idea!");
X else print2("Maybe it wasn't such a good idea....");
X Player.cash = ((int) (mult*Player.cash));
X morewait();
X }
X else {
X if (Player.possessions[i]->plus > random_range(20)+1) {
X print1("Uh-oh, the force of the enchantment was too much!");
X print2("There is a loud explosion!");
X morewait();
X manastorm(Player.x,Player.y,Player.possessions[i]->plus*5);
X dispose_lost_objects(1,Player.possessions[i]);
X }
X else {
X used = (Player.possessions[i]->used);
X if (used) {
X setgamestatus(SUPPRESS_PRINTING);
X Player.possessions[i]->used = FALSE;
X item_use(Player.possessions[i]);
X resetgamestatus(SUPPRESS_PRINTING);
X }
X print1("The item shines!");
X morewait();
X Player.possessions[i]->plus += delta+1;
X if (Player.possessions[i]->charge > -1)
X Player.possessions[i]->charge +=
X ((delta+1) * (random_range(10) + 1));
X if (used) {
X setgamestatus(SUPPRESS_PRINTING);
X Player.possessions[i]->used = TRUE;
X item_use(Player.possessions[i]);
X resetgamestatus(SUPPRESS_PRINTING);
X }
X }
X }
X calc_melee();
X }
X}
X
X/* bless */
Xvoid bless(blessing)
Xint blessing;
X{
X int index,used;
X
X if (blessing < 0) {
X index = random_item();
X if (index == ABORT) {
X print1("You feel fortunate.");
X morewait();
X }
X else {
X print1("A foul odor arises from your ");
X nprint1(itemid(Player.possessions[index]));
X morewait();
X used = (Player.possessions[index]->used);
X if (used) {
X setgamestatus(SUPPRESS_PRINTING);
X Player.possessions[index]->used = FALSE;
X item_use(Player.possessions[index]);
X resetgamestatus(SUPPRESS_PRINTING);
X }
X Player.possessions[index]->blessing -= 2;
X if (Player.possessions[index]->blessing < 0)
X Player.possessions[index]->plus =
X abs(Player.possessions[index]->plus) - 1;
X if (used) {
X setgamestatus(SUPPRESS_PRINTING);
X Player.possessions[index]->used = TRUE;
X item_use(Player.possessions[index]);
X resetgamestatus(SUPPRESS_PRINTING);
X }
X }
X }
X else {
X index = getitem(NULL);
X if (index == CASHVALUE) {
X print1("Blessing your money has no effect.");
X morewait();
X }
X else if (index != ABORT) {
X used = (Player.possessions[index]->used == TRUE);
X if (used) {
X setgamestatus(SUPPRESS_PRINTING);
X Player.possessions[index]->used = FALSE;
X item_use(Player.possessions[index]);
X resetgamestatus(SUPPRESS_PRINTING);
X }
X print1("A pure white light surrounds the item... ");
X if (Player.possessions[index]->blessing < 0-(blessing+1)) {
X print2("which is evil enough to resist the effect of the blessing!");
X morewait();
X }
X else if (Player.possessions[index]->blessing < -1) {
X print2("which disintegrates under the influence of the holy aura!");
X morewait();
X Player.itemweight -= Player.possessions[index]->weight;
X dispose_lost_objects(1,Player.possessions[index]);
X }
X else if (Player.possessions[index]->blessing < blessing+1) {
X print2("which now seems affected by afflatus!");
X morewait();
X Player.possessions[index]->blessing++;
X Player.possessions[index]->plus =
X abs(Player.possessions[index]->plus)+1;
X }
X else {
X print2("The hierolux fades without any appreciable effect....");
X morewait();
X }
X if (used && (Player.possessions[index] != NULL)) {
X setgamestatus(SUPPRESS_PRINTING);
X Player.possessions[index]->used = TRUE;
X item_use(Player.possessions[index]);
X resetgamestatus(SUPPRESS_PRINTING);
X }
X }
X }
X calc_melee();
X}
X
X
X
Xvoid heal(amount)
Xint amount;
X{
X if (amount > -1) {
X mprint("You feel better.");
X Player.hp += random_range(10*amount)+1;
X Player.status[BLINDED] = 0;
X if (Player.hp > Player.maxhp)
X Player.hp = Player.maxhp + amount;
X }
X else {
X mprint("You feel unwell.");
X Player.hp -= random_range(10*abs(amount)+1);
X if (Player.hp < 0)
X p_death("magical disruption");
X }
X dataprint();
X}
X
X
Xvoid fbolt(fx,fy,tx,ty,hit,dmg)
Xint fx,fy,tx,ty,hit,dmg;
X{
X bolt(fx,fy,tx,ty,hit,dmg,FLAME);
X}
X
Xvoid lbolt(fx,fy,tx,ty,hit,dmg)
Xint fx,fy,tx,ty,hit,dmg;
X{
X bolt(fx,fy,tx,ty,hit,dmg,ELECTRICITY);
X}
X
Xvoid nbolt(fx,fy,tx,ty,hit,dmg)
Xint fx,fy,tx,ty,hit,dmg;
X{
X bolt(fx,fy,tx,ty,hit,dmg,NORMAL_DAMAGE);
X}
X
X
X/* from f to t */
Xvoid bolt(fx,fy,tx,ty,hit,dmg,dtype)
Xint fx,fy,tx,ty,hit,dmg,dtype;
X{
X int xx,yy;
X struct monster *target;
X char boltchar;
X xx = fx; yy = fy;
X
X switch(dtype) {
X case FLAME:boltchar='*';break;
X case ELECTRICITY:boltchar = '^';break;
X case NORMAL_DAMAGE:boltchar = '!';break;
X }
X
X do_los(boltchar,&xx,&yy,tx,ty);
X
X if ((xx == Player.x) && (yy == Player.y)) {
X if (Player.status[DEFLECTION] > 0)
X mprint("The bolt just missed you!");
X else {
X switch (dtype) {
X case FLAME:
X mprint("You were blasted by a firebolt!");
X p_damage(random_range(dmg),dtype,"a firebolt");
X break;
X case ELECTRICITY:
X mprint("You were zapped by lightning!");
X p_damage(random_range(dmg),dtype,"a bolt of lightning");
X break;
X case NORMAL_DAMAGE:
X mprint("You were hit by a missile!");
X p_damage(random_range(dmg),dtype,"a missile");
X break;
X }
X }
X }
X else if (NULL != (target = Level->site[xx][yy].creature)) {
X if (hitp(hit,target->ac)) {
X if (target->uniqueness == COMMON) {
X strcpy(Str1,"The ");
X strcat(Str1,target->monstring);
X }
X else strcpy(Str1,target->monstring);
X switch (dtype) {
X case FLAME:strcat(Str1," was blasted by a firebolt!");break;
X case ELECTRICITY:strcat(Str1," was zapped by lightning!");break;
X case NORMAL_DAMAGE:strcat(Str1," was hit by a missile!"); break;
X }
X mprint(Str1);
X m_status_set(target,HOSTILE);
X m_damage(target,random_range(dmg),dtype);
X }
X else {
X if (target->uniqueness == COMMON) {
X strcpy(Str1,"The ");
X strcat(Str1,target->monstring);
X }
X else strcpy(Str1,target->monstring);
X switch (dtype) {
X case FLAME:strcat(Str1," was missed by a firebolt!");break;
X case ELECTRICITY:strcat(Str1," was missed by lightning!");break;
X case NORMAL_DAMAGE:strcat(Str1," was missed by a missile!"); break;
X }
X mprint(Str1);
X }
X }
X else if (Level->site[xx][yy].locchar == HEDGE)
X if (Level->site[xx][yy].p_locf == L_HEDGE) {
X if ((dtype == FLAME)||(dtype == ELECTRICITY)) {
X mprint("The hedge is blasted away!");
X Level->site[xx][yy].p_locf = L_NO_OP;
X Level->site[xx][yy].locchar = FLOOR;
X }
X else mprint("The hedge is unaffected.");
X }
X else mprint("The trifid absorbs the energy and laughs!");
X else if (Level->site[xx][yy].locchar == WATER)
X if (dtype == FLAME) {
X mprint("The water is vaporised!");
X Level->site[xx][yy].p_locf = L_NO_OP;
X Level->site[xx][yy].locchar = FLOOR;
X }
X}
X
X
Xvoid lball(fx,fy,tx,ty,dmg)
Xint fx,fy,tx,ty,dmg;
X{
X ball(fx,fy,tx,ty,dmg,ELECTRICITY);
X}
X
Xvoid manastorm(x,y,dmg)
Xint x,y,dmg;
X{
X ball(x,y,x,y,dmg,UNSTOPPABLE);
X}
X
Xvoid snowball(fx,fy,tx,ty,dmg)
Xint fx,fy,tx,ty,dmg;
X{
X ball(fx,fy,tx,ty,dmg,COLD);
X}
X
Xvoid fball(fx,fy,tx,ty,dmg)
Xint fx,fy,tx,ty,dmg;
X{
X ball(fx,fy,tx,ty,dmg,FLAME);
X}
X
X
X/* from f to t */
Xvoid ball(fx,fy,tx,ty,dmg,dtype)
Xint fx,fy,tx,ty,dmg,dtype;
X{
X int xx,yy,ex,ey,i;
X struct monster *target;
X char expchar='@';
X
X xx = fx; yy = fy;
X
X switch(dtype){
X case FLAME:expchar='*';break;
X case COLD:expchar='o';break;
X case ELECTRICITY:expchar='^';break;
X }
X
X do_los(expchar,&xx,&yy,tx,ty);
X draw_explosion(expchar,xx,yy);
X for(i=0;i<9;i++) {
X ex = xx + Dirs[0][i];
X ey = yy + Dirs[1][i];
X
X if ((ex == Player.x) && (ey == Player.y)) {
X switch(dtype) {
X case FLAME:mprint("You were blasted by a fireball!");
X p_damage(random_range(dmg),FLAME,"a fireball");
X break;
X case COLD:mprint("You were blasted by a snowball!");
X p_damage(random_range(dmg),COLD,"a snowball");
X break;
X case ELECTRICITY:mprint("You were blasted by ball lightning!");
X p_damage(random_range(dmg),ELECTRICITY,"ball lightning");
X break;
X case UNSTOPPABLE:mprint("Oh No! Manastorm!");
X p_damage(random_range(dmg),UNSTOPPABLE,"a manastorm!");
X break;
X }
X }
X else if (NULL != (target = Level->site[ex][ey].creature)) {
X if (los_p(Player.x,Player.y,target->x,target->y)) {
X if (target->uniqueness == COMMON) {
X strcpy(Str1,"The ");
X strcat(Str1,target->monstring);
X }
X else strcpy(Str1,target->monstring);
X switch(dtype) {
X case FLAME:strcat(Str1," was zorched by a fireball!"); break;
X case COLD:strcat(Str1," was blasted by a snowball!"); break;
X case ELECTRICITY:strcat(Str1," was zapped by ball lightning!");break;
X case UNSTOPPABLE:strcat(Str1," was nuked by a manastorm!");break;
X }
X mprint(Str1);
X }
X m_status_set(target,HOSTILE);
X m_damage(target,random_range(dmg),dtype);
X }
X else if (Level->site[ex][ey].locchar == HEDGE)
X if (Level->site[ex][ey].p_locf == L_HEDGE) {
X if ((dtype == FLAME)||(dtype == ELECTRICITY)) {
X mprint("The hedge is blasted away!");
X Level->site[ex][ey].p_locf = L_NO_OP;
X Level->site[ex][ey].locchar = FLOOR;
X }
X else mprint("The hedge is unaffected.");
X }
X else mprint("The trifid absorbs the energy and laughs!");
X else if (Level->site[xx][yy].locchar == WATER)
X if (dtype == FLAME) {
X mprint("The water is vaporised!");
X Level->site[xx][yy].p_locf = L_NO_OP;
X Level->site[xx][yy].locchar = FLOOR;
X }
X }
X}
X
X
X
X
Xvoid mondet(blessing)
Xint blessing;
X{
X pml ml;
X for (ml=Level->mlist;ml!=NULL;ml=ml->next)
X if (ml->m->hp > 0)
X plotmon(blessing > -1 ? ml->m : &(Monsters[random_range(NUMMONSTERS)]));
X levelrefresh();
X morewait();
X erase_level();
X show_screen();
X}
X
X
Xvoid objdet(blessing)
Xint blessing;
X{
X int i,j;
X for (i=0;i<WIDTH;i++)
X for (j=0;j<LENGTH;j++)
X if (Level->site[i][j].things != NULL) {
X if (blessing < 0)
X putspot(random_range(WIDTH),
X random_range(LENGTH),
X Level->site[i][j].things->thing->objchar);
X else putspot(i,j,Level->site[i][j].things->thing->objchar);
X }
X levelrefresh();
X morewait();
X erase_level();
X show_screen();
X}
X
Xvoid identify(blessing)
X{
X int index;
X
X clearmsg();
X
X if (blessing == 0) {
X print1("Identify:");
X index = getitem(NULL);
X if (index == CASHVALUE) print3("Your money is really money.");
X else if (index == ABORT)
X setgamestatus(SKIP_MONSTERS);
X else {
X if (Player.possessions[index]->objchar == FOOD)
X Player.possessions[index]->known = 1;
X else {
X Player.possessions[index]->known = 2;
X Objects[Player.possessions[index]->id].known = 1;
X }
X print1("Identified: ");
X mprint(itemid(Player.possessions[index]));
X }
X }
X else if (blessing < 0) {
X print2("You feel forgetful.");
X for (index=0;index<MAXITEMS;index++)
X if (Player.possessions[index] != NULL) {
X Player.possessions[index]->known = 0;
X Objects[Player.possessions[index]->id].known = 0;
X }
X }
X else {
X print2("You feel encyclopaedic.");
X for (index=0;index<MAXITEMS;index++)
X if (Player.possessions[index] != NULL) {
X if (Player.possessions[index]->objchar == FOOD)
X Player.possessions[index]->known = 1;
X else {
X Player.possessions[index]->known = 2;
X Objects[Player.possessions[index]->id].known = 1;
X }
X }
X for (index=0;index<Player.packptr;index++)
X if (Player.pack[index] != NULL) {
X if (Player.pack[index]->objchar == FOOD)
X Player.pack[index]->known = 1;
X else {
X Player.pack[index]->known = 2;
X Objects[Player.pack[index]->id].known = 1;
X }
X }
X }
X calc_melee();
X}
X
X
X
X
X/* returns index of random item, ABORT if player carrying none */
Xint random_item()
X{
X int item,tries=0;
X int done = FALSE;
X
X for(tries=0;((tries<MAXITEMS)&&(!done));tries++) {
X item = random_range(MAXITEMS);
X done = (Player.possessions[item] != NULL);
X }
X return(done ? item : ABORT);
X}
X
X
X/* various kinds of wishes */
Xvoid wish(blessing)
Xint blessing;
X{
X int i;
X char wishstr[80];
X clearmsg();
X print1("What do you wish for? ");
X if (blessing < 0) deathprint();
X strcpy(wishstr,msgscanstring());
X if (strcmp(wishstr,"Death")==0) {
X print2("As you wish, so shall it be.");
X p_death("a deathwish");
X }
X if (strcmp(wishstr,"Power")==0) {
X print2("You feel a sudden surge of energy");
X Player.mana=calcmana()*10;
X }
X else if (strcmp(wishstr,"Skill")==0) {
X print2("You feel more competent.");
X gain_experience(min(10000,Player.xp));
X }
X else if (strcmp(wishstr,"Wealth")==0) {
X print2("You are submerged in shower of gold pieces!");
X Player.cash += 10000;
X }
X else if (strcmp(wishstr,"Balance")==0) {
X print2("You feel neutral.");
X Player.alignment = 0;
X }
X else if (strcmp(wishstr,"Chaos")==0) {
X print2("You feel chaotic.");
X Player.alignment -= 25;
X }
X else if (strcmp(wishstr,"Law")==0) {
X print2("You feel lawful.");
X Player.alignment += 25;
X }
X else if (strcmp(wishstr,"Location")==0)
X strategic_teleport(1);
X else if (strcmp(wishstr,"Knowledge")==0) {
X print2("You feel more knowledgeable.");
X i = random_range(NUMSPELLS);
X if (Spells[i].known)
X Spells[i].powerdrain =
X (max(1,Spells[i].powerdrain/2));
X else Spells[i].known = TRUE;
X }
X else if (strcmp(wishstr,"Health")==0) {
X print2("You feel vigorous");
X Player.hp = Player.maxhp;
X Player.status[DISEASED] = 0;
X Player.status[POISONED] = 0;
X }
X else if (strcmp(wishstr,"Destruction")==0)
X annihilate(gamestatusp(CHEATED));
X else if (strcmp(wishstr,"Acquisition")==0)
X acquire(gamestatusp(CHEATED));
X else if (strcmp(wishstr,"Summoning")==0)
X summon(gamestatusp(CHEATED),-1);
X else print2("You feel stupid.");
X dataprint();
X showflags();
X}
X
X/* gain for an item */
Xvoid acquire(blessing)
Xint blessing;
X{
X char otype;
X int index,id = ABORT;
X pob newthing;
X
X if (blessing < 0) {
X index = random_item();
X if (index == ABORT)
X mprint("You feel fortunate.");
X else {
X print1("Smoke drifts out of your pack.... ");
X print2("Destroyed: ");
X nprint2(itemid(Player.possessions[index]));
X morewait();
X dispose_lost_objects(1,Player.possessions[index]);
X }
X }
X else if (blessing == 0) {
X print1("You magically acquire an object!");
X morewait();
X newthing = ((pob) malloc(sizeof(objtype)));
X *newthing = Objects[random_range(TOTALITEMS)];
X newthing->used = FALSE;
X gain_item(newthing);
X }
X else {
X newthing = ((pob) malloc(sizeof(objtype)));
X newthing->id = -1;
X
X print1("Acquire which kind of item: !?][}{)/=%%\\ ");
X otype = mgetc();
X nprint1("Item ID? ");
X switch (otype) {
X case POTION:
X id = itemlist(POTIONID,NUMPOTIONS);
X if (id < 0) print2("You feel stupid.");
X else make_potion(newthing,id);
X break;
X case SCROLL:
X id = itemlist(SCROLLID,NUMSCROLLS);
X if (id < 0) print2("You feel stupid.");
X else make_scroll(newthing,id);
X break;
X case RING:
X id = itemlist(RINGID,NUMRINGS);
X if (id < 0) print2("You feel stupid.");
X else make_ring(newthing,id);
X break;
X case STICK:
X id = itemlist(STICKID,NUMSTICKS);
X if (id < 0) print2("You feel stupid.");
X else make_stick(newthing,id);
X break;
X case ARMOR:
X id = itemlist(ARMORID,NUMARMOR);
X if (id < 0) print2("You feel stupid.");
X else make_armor(newthing,id);
X break;
X case SHIELD:
X id = itemlist(SHIELDID,NUMSHIELDS);
X if (id < 0) print2("You feel stupid.");
X else make_shield(newthing,id);
X break;
X case WEAPON:
X id = itemlist(WEAPONID,NUMWEAPONS);
X if (id < 0) print2("You feel stupid.");
X else make_weapon(newthing,id);
X break;
X case BOOTS:
X id = itemlist(BOOTID,NUMBOOTS);
X if (id < 0) print2("You feel stupid.");
X else make_boots(newthing,id);
X break;
X case CLOAK:
X id = itemlist(CLOAKID,NUMCLOAKS);
X if (id < 0) print2("You feel stupid.");
X else make_cloak(newthing,id);
X break;
X case FOOD:
X id = itemlist(FOODID,NUMFOODS);
X if (id < 0) print2("You feel stupid.");
X else make_food(newthing,id);
X break;
X case THING:
X id = itemlist(THINGID,10); /* crock to avoid grot*/
X if (id < 0) print2("You feel stupid.");
X else make_thing(newthing,id);
X break;
X }
X xredraw();
X if (id != ABORT) {
X newthing->known = 2;
X Objects[id].known = 1;
X gain_item(newthing);
X }
X }
X}
END_OF_FILE
if test 17668 -ne `wc -c <'oeffect1.c'`; then
echo shar: \"'oeffect1.c'\" unpacked with wrong size!
fi
# end of 'oeffect1.c'
fi
if test -f 'omaze1.dat' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'omaze1.dat'\"
else
echo shar: Extracting \"'omaze1.dat'\" \(287 characters\)
sed "s/^X//" >'omaze1.dat' <<'END_OF_FILE'
X"z"""""""""""""""""""""."...".....".".."...""..."."."-".".?".""".""""""."."?".".".".."."".......""".""".""...""-"""""."....."".""".""?".....".""""""?..".""""."."""."""""""".".""..."..?".""O?.....".""-"""""""."""""""""".""?..?"".".""""""."."."""""">?"-......."."?."""""""""""""""""""""""
END_OF_FILE
if test 287 -ne `wc -c <'omaze1.dat'`; then
echo shar: \"'omaze1.dat'\" unpacked with wrong size!
fi
# end of 'omaze1.dat'
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'\" \(6150 characters\)
sed "s/^X//" >'ovillage.c' <<'END_OF_FILE'
X/* omega copyright (C) by Laurence Raphael Brothers, 1987,1988 */
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 free((char *) TempLevel);
X TempLevel = NULL;
X }
X
X assign_village_function(0,0,TRUE);
X
X Level = ((plv) malloc(sizeof(levtype)));
X clear_level(Level);
X Level->environment = E_VILLAGE;
X strcpy(Str3,OMEGALIB);
X switch(villagenum) {
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 }
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 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 6150 -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 10 \(of 19\).
cp /dev/null ark10isdone
MISSING=""
for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 ; do
if test ! -f ark${I}isdone ; then
MISSING="${MISSING} ${I}"
fi
done
if test "${MISSING}" = "" ; then
echo You have unpacked all 19 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