billr@saab.CNA.TEK.COM (Bill Randle) (07/14/89)
Submitted-by: "Laurence R. Brothers" <brothers@paul.rutgers.edu> Posting-number: Volume 7, Issue 30 Archive-name: omega3/Part11 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 11 (of 20)." # Contents: ocom2.c ohouse.c oinit.c oitemf1.c # Wrapped by billr@saab on Thu Jun 29 08:14:06 1989 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'\" \(27106 characters\) sed "s/^X//" >'ocom2.c' <<'END_OF_FILE' X/* omega copyright (C) by Laurence Raphael Brothers, 1987,1988,1989 */ X/* ocom2.c */ X X/* This file contains toplevel commands called from ocom1.c */ X X#include "oglob.h" X#ifdef MSDOS X#include <curses.h> X#endif 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#ifndef MSDOS 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#endif 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+difficulty()*5) < X Player.dex*2+Player.level*3+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+difficulty()*2) > 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#ifndef MSDOS X char response; X#else X int response; X#endif 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#ifdef MSDOS X case KEY_DOWN: X#endif X slot = move_slot(slot,slot+1,NUMOPTIONS+1); X break; X case 'k': X case '<': X#ifdef MSDOS X case KEY_UP: X#endif X if (slot > 1) /* hack hack */ X slot = move_slot(slot,slot-1,NUMOPTIONS+1); X break; X#ifdef MSDOS X case KEY_HOME: X slot = move_slot(slot,1,NUMOPTIONS+1); X break; X case KEY_LL: X slot = move_slot(slot,NUMOPTIONS,NUMOPTIONS+1); X break; X#endif 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(50+difficulty()*10) < 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 == E_ABYSS) { 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 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 27106 -ne `wc -c <'ocom2.c'`; then echo shar: \"'ocom2.c'\" unpacked with wrong size! fi # end of 'ocom2.c' fi if test -f 'ohouse.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'ohouse.c'\" else echo shar: Extracting \"'ohouse.c'\" \(5524 characters\) sed "s/^X//" >'ohouse.c' <<'END_OF_FILE' X/* omega copyright (C) by Laurence Raphael Brothers, 1987,1988,1989 */ X/* ohouse.c */ X/* some functions to make the house levels */ X X#include "oglob.h" X X X/* loads the house level into Level*/ Xvoid load_house(kind) Xint kind; 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 clear_level(Level); X strcpy(Str3,OMEGALIB); X switch(kind) { X case E_HOUSE: X strcat(Str3,"ohome1.dat"); X Level->environment = E_HOUSE; X break; X case E_MANSION: X strcat(Str3,"ohome2.dat"); X Level->environment = E_MANSION; X break; X default: X case E_HOVEL: X strcat(Str3,"ohome3.dat"); X Level->environment = E_HOVEL; X break; X } X fd = fopen(Str3,"r"); X for(j=0;j<LENGTH;j++) { X for(i=0;i<WIDTH;i++) { X if (kind == E_HOVEL) Level->site[i][j].lstatus = SEEN; X else Level->site[i][j].lstatus = 0; X Level->site[i][j].roomnumber = RS_CORRIDOR; X Level->site[i][j].p_locf = L_NO_OP; X site = getc(fd); X switch(site) { X case 'N': X Level->site[i][j].locchar = FLOOR; X Level->site[i][j].roomnumber = RS_BEDROOM; X if (random_range(2)) make_house_npc(i,j); X break; X case 'H': X Level->site[i][j].locchar = FLOOR; X Level->site[i][j].roomnumber = RS_BEDROOM; X if (random_range(2)) make_mansion_npc(i,j); X break; X case 'D': X Level->site[i][j].locchar = FLOOR; X Level->site[i][j].roomnumber = RS_DININGROOM; X break; X case '.': X Level->site[i][j].locchar = FLOOR; X break; X case 'c': X Level->site[i][j].locchar = FLOOR; X Level->site[i][j].roomnumber = RS_CLOSET; X break; X case 'G': X Level->site[i][j].locchar = FLOOR; X Level->site[i][j].roomnumber = RS_BATHROOM; X break; X case 'B': X Level->site[i][j].locchar = FLOOR; X Level->site[i][j].roomnumber = RS_BEDROOM; X break; X case 'K': X Level->site[i][j].locchar = FLOOR; X Level->site[i][j].roomnumber = RS_KITCHEN; X break; X case 'S': X Level->site[i][j].locchar = FLOOR; X Level->site[i][j].showchar = WALL; X lset(i,j,SECRET); X Level->site[i][j].roomnumber = RS_SECRETPASSAGE; X break; X case '3': X Level->site[i][j].locchar = SAFE; X Level->site[i][j].showchar = WALL; X lset(i,j,SECRET); X Level->site[i][j].p_locf = L_SAFE; X break; X case '^': X Level->site[i][j].locchar = FLOOR; X Level->site[i][j].p_locf = TRAP_BASE+random_range(NUMTRAPS); X break; X case 'P': X Level->site[i][j].locchar = PORTCULLIS; X Level->site[i][j].p_locf = L_PORTCULLIS; X break; X case 'R': X Level->site[i][j].locchar = FLOOR; X Level->site[i][j].p_locf = L_RAISE_PORTCULLIS; X break; X case 'p': X Level->site[i][j].locchar = FLOOR; X Level->site[i][j].p_locf = L_PORTCULLIS; X break; X case 'T': X Level->site[i][j].locchar = FLOOR; X Level->site[i][j].p_locf = L_PORTCULLIS_TRAP; X break; X case 'X': X Level->site[i][j].locchar = FLOOR; X Level->site[i][j].p_locf = L_HOUSE_EXIT; X break; X case '#': X Level->site[i][j].locchar = WALL; X switch (kind) { X case E_HOVEL: Level->site[i][j].aux = 10; break; X case E_HOUSE: Level->site[i][j].aux = 50; break; X case E_MANSION: Level->site[i][j].aux = 150; break; X } X break; X case '|': X Level->site[i][j].locchar = OPEN_DOOR; X Level->site[i][j].roomnumber = RS_CORRIDOR; X lset(i,j,STOPS); X break; X case '+': X Level->site[i][j].locchar = CLOSED_DOOR; X Level->site[i][j].roomnumber = RS_CORRIDOR; X Level->site[i][j].aux = LOCKED; X lset(i,j,STOPS); X break; X case 'd': X Level->site[i][j].locchar = FLOOR; X Level->site[i][j].roomnumber = RS_CORRIDOR; X make_site_monster(i,j,ML4+10); /* dog */ X break; X case 'a': X Level->site[i][j].locchar = FLOOR; X Level->site[i][j].roomnumber = RS_CORRIDOR; X Level->site[i][j].p_locf = L_TRAP_SIREN; X break; X case 'A': X Level->site[i][j].locchar = FLOOR; X Level->site[i][j].roomnumber = RS_CORRIDOR; X make_site_monster(i,j,ML4+2); /* automaton */ X break; X } X Level->site[i][j].showchar = ' '; X } X fscanf(fd,"\n"); X } X fclose(fd); X} X X X X/* makes a log npc for houses and hovels */ Xvoid make_house_npc(i,j) Xint i,j; X{ X pml ml = ((pml) malloc(sizeof(mltype))); X pob ob; X ml->m = ((pmt) malloc(sizeof(montype))); X *(ml->m) = Monsters[NPC]; X make_log_npc(ml->m); X if (ml->m->id == NPC) mprint("You detect signs of life in this house."); X else mprint("An eerie shiver runs down your spine as you enter...."); X /* if not == NPC, then we got a ghost off the npc list */ X ml->m->x = i; X ml->m->y = j; X Level->site[i][j].creature = ml->m; X ml->m->click = (Tick + 1) % 50; X ml->next = Level->mlist; X Level->mlist = ml; X m_status_set(ml->m,HOSTILE); X if (nighttime()) X m_status_reset(ml->m,AWAKE); X else m_status_set(ml->m,AWAKE); X if (ml->m->startthing > -1) { X ob = ((pob) malloc(sizeof(objtype))); X *ob = Objects[ml->m->startthing]; X m_pickup(ml->m,ob); X } X} X X X X X X/* makes a hiscore npc for mansions */ Xvoid make_mansion_npc(i,j) Xint i,j; X{ X pml ml = ((pml) malloc(sizeof(mltype))); X ml->m = ((pmt) malloc(sizeof(montype))); X *(ml->m) = Monsters[NPC]; X make_hiscore_npc(ml->m,random_range(14)+1); X mprint("You detect signs of life in this house."); X ml->m->x = i; X ml->m->y = j; X Level->site[i][j].creature = ml->m; X ml->m->click = (Tick + 1) % 50; X ml->next = Level->mlist; X Level->mlist = ml; X m_status_set(ml->m,HOSTILE); X if (nighttime()) X m_status_reset(ml->m,AWAKE); X else m_status_set(ml->m,AWAKE); X} X X END_OF_FILE if test 5524 -ne `wc -c <'ohouse.c'`; then echo shar: \"'ohouse.c'\" unpacked with wrong size! fi # end of 'ohouse.c' fi if test -f 'oinit.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'oinit.c'\" else echo shar: Extracting \"'oinit.c'\" \(212 characters\) sed "s/^X//" >'oinit.c' <<'END_OF_FILE' X/* omega copyright (c) 1987,1988,1989 by Laurence Raphael Brothers */ X X/* oinit.c */ X X#include "odefs.h" X X#include "oiinit.h" X X#include "ominit.h" X X/* This file contains all the object and monster definitions */ END_OF_FILE if test 212 -ne `wc -c <'oinit.c'`; then echo shar: \"'oinit.c'\" unpacked with wrong size! fi # end of 'oinit.c' fi if test -f 'oitemf1.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'oitemf1.c'\" else echo shar: Extracting \"'oitemf1.c'\" \(18117 characters\) sed "s/^X//" >'oitemf1.c' <<'END_OF_FILE' X/* omega copyright (C) 1987,1988,1989 by Laurence Raphael Brothers */ X/* oitemf1.c */ X X/* various item functions: potions,scrolls,boots,cloaks,things,food */ X X#include "oglob.h" X X X/* general item functions */ X Xvoid i_no_op(o) Xpob o; X{ X} X Xvoid i_nothing(o) Xpob o; X{ X} X X X X X X/* scroll functions */ X Xvoid i_knowledge(o) Xpob o; X{ X if (o->blessing > -1) X Objects[o->id].known = 1; X knowledge(o->blessing); X} X Xvoid i_jane_t(o) Xpob o; X{ X int volume = random_range(6); X int i,j,k; X X print1("Jane's Guide to the World's Treasures: "); X X switch(volume) { X case 0:nprint1("SCROLLS");j = SCROLLID; k = POTIONID; break; X case 1:nprint1("POTIONS");j = POTIONID; k = WEAPONID; break; X case 2:nprint1("CLOAKS");j = CLOAKID; k = BOOTID; break; X case 3:nprint1("BOOTS");j = BOOTID; k = RINGID; break; X case 4:nprint1("RINGS");j = RINGID; k = STICKID; break; X case 5:nprint1("STICKS");j = STICKID; k = ARTIFACTID; break; X } X for(i=j;i<k;i++) X Objects[i].known = 1; X} X X Xvoid i_flux(o) Xpob o; X{ X if (o->blessing > -1) X Objects[o->id].known = 1; X flux(o->blessing); X} X X X/* enchantment */ Xvoid i_enchant(o) Xpob o; X{ X if (o->blessing > -1) X Objects[o->id].known = 1; X enchant(o->blessing < 0 ? -1-o->plus : o->plus+1); X} X X/* scroll of clairvoyance */ Xvoid i_clairvoyance(o) Xstruct object *o; X{ X if (o->blessing > -1) X Objects[o->id].known = 1; X if (o->blessing < 0) X amnesia(); X else clairvoyance(5+o->blessing*5); X} X X X Xvoid i_acquire(o) Xpob o; X{ X if (o->blessing > -1) X Objects[o->id].known = 1; X acquire(o->blessing); X *o = Objects[SCROLLID+0]; /* blank out the scroll */ X} X Xvoid i_teleport(o) Xpob o; X{ X if (o->blessing > -1) X Objects[o->id].known = 1; X p_teleport(o->blessing); X} X X Xvoid i_spells(o) Xpob o; X{ X if (o->blessing > -1) X Objects[o->id].known = 1; X mprint("A scroll of spells."); X learnspell(o->blessing); X} X X X X/* scroll of blessing */ Xvoid i_bless(o) Xpob o; X{ X Objects[o->id].known = 1; X bless(o->blessing); X} X X/* scroll of wishing */ Xvoid i_wish(o) Xpob o; X{ X if (o->blessing > -1) X Objects[o->id].known = 1; X wish(o->blessing); X *o = Objects[SCROLLID+0]; /* blank out the scroll */ X} X X/* scroll of displacement */ Xvoid i_displace(o) Xpob o; X{ X if (o->blessing > -1) X Objects[o->id].known = 1; X displace(o->blessing); X} X X X/* scroll of deflection */ Xvoid i_deflect(o) Xpob o; X{ X if (o->blessing > -1) X Objects[o->id].known = 1; X deflection(o->blessing); X} X X/* scroll of identification */ Xvoid i_id(o) Xpob o; X{ X if (o->blessing > -1) X Objects[o->id].known = 1; X identify(o->blessing); X} X X/* potion functions */ X X/* potion of healing */ Xvoid i_heal(o) Xpob o; X{ X if (o->blessing > -1) { X Objects[o->id].known = 1; X heal(1+o->plus); X } X else heal(-1-abs(o->plus)); X} X X/* potion of monster detection */ Xvoid i_mondet(o) Xpob o; X{ X if (o->blessing > -1) X Objects[o->id].known = 1; X mondet(o->blessing); X} X X X/* potion of object detection */ Xvoid i_objdet(o) Xpob o; X{ X X if (o->blessing > -1) X Objects[o->id].known = 1; X objdet(o->blessing); X} X X/* potion of neutralize poison */ Xvoid i_neutralize_poison(o) Xpob o; X{ X if (o->blessing > -1) { X Objects[o->id].known = 1; X mprint("You feel vital!"); X Player.status[POISONED] = 0; X } X else p_poison(random_range(20)+5); X} X X X/* potion of sleep */ Xvoid i_sleep_self(o) Xpob o; X{ X sleep_player(6); X Objects[o->id].known = 1; X} X X X X X/* potion of speed */ Xvoid i_speed(o) Xpob o; X{ X if (o->blessing > -1) X Objects[o->id].known = 1; X haste(o->blessing); X} X X X/* potion of restoration */ Xvoid i_restore(o) Xpob o; X{ X if (o->blessing > -1) X Objects[o->id].known = 1; X recover_stat(o->blessing); X} X Xvoid i_augment(o) Xpob o; X{ X if (o->blessing > -1) X Objects[o->id].known = 1; X augment(o->blessing); X} X Xvoid i_azoth(o) Xpob o; X{ X if (o->plus < 0) { X mprint("The mercury was poisonous!"); X p_poison(25); X } X else if (o->plus == 0) { X mprint("The partially enchanted azoth makes you sick!"); X Player.con = ((int) (Player.con / 2)); X calc_melee(); X } X else if (o->blessing < 1) { X mprint("The unblessed azoth warps your soul!"); X Player.pow = Player.maxpow = ((int) (Player.maxpow / 2)); X level_drain(random_range(10),"cursed azoth"); X } X else { X mprint("The azoth fills you with cosmic power!"); X if (Player.str > Player.maxstr*2) { X mprint("The power rages out of control!"); X p_death("overdose of azoth"); X } X else { X heal(10); X cleanse(1); X Player.mana = calcmana()*3; X Player.str = (Player.maxstr++)*3; X } X } X} X Xvoid i_regenerate(o) Xpob o; X{ X regenerate(o->blessing); X} X X X X X X/* boots functions */ Xvoid i_perm_speed(o) Xpob o; X{ X if (o->blessing > -1) { X if (o->used) { X o->known = 2; X Objects[o->id].known = 1; X if (Player.status[SLOWED] > 0) { X Player.status[SLOWED] = 0; X } X mprint("The world slows down!"); X Player.status[HASTED] += 1500; X } X else { X Player.status[HASTED] -= 1500; X if (Player.status[HASTED] < 1) X mprint("The world speeds up again."); X } X } X else { X if (o->used) { X if (Player.status[HASTED] > 0) { X Player.status[HASTED] = 0; X } X mprint("You feel slower."); X Player.status[SLOWED] += 1500; X } X else { X Player.status[SLOWED] -= 1500; X if (Player.status[SLOWED] < 1) X mprint("You feel quicker again."); X } X } X} X X/* cloak functions */ Xvoid i_perm_displace(o) Xpob o; X{ X if (o->blessing > -1) { X if (o->used) { X mprint("You feel dislocated."); X Player.status[DISPLACED] += 1500; X } X else { X Player.status[DISPLACED] -= 1500; X if (Player.status[DISPLACED] < 1) { X mprint("You feel a sense of position."); X Player.status[DISPLACED] = 0; X } X } X } X else { X if (o->used) { X mprint("You have a forboding of bodily harm!"); X Player.status[VULNERABLE] += 1500; X } X else { X Player.status[VULNERABLE] -= 1500; X if (Player.status[VULNERABLE] < 1) { X mprint("You feel less endangered."); X Player.status[VULNERABLE] = 0; X } X } X } X} X Xvoid i_perm_negimmune(o) Xpob o; X{ X if (o->blessing > -1) { X if (o->used) { X Player.immunity[NEGENERGY]++; X } X else Player.immunity[NEGENERGY]--; X } X else if (o->used) X level_drain(abs(o->blessing),"cursed cloak of level drain"); X} X X/* food functions */ X X Xvoid i_food(o) Xpob o; X{ X switch(random_range(5)) { X case 0: mprint("That tasted horrible!"); break; X case 1: mprint("Yum!"); break; X case 2: mprint("How nauseous!"); break; X case 3: mprint("Can I have some more? Please?"); break; X case 4: mprint("Your mouth feels like it is growing hair!"); break; X } X} X Xvoid i_stim(o) Xpob o; X{ X mprint("You feel Hyper!"); X i_speed(o); X Player.str +=3; X Player.con -=1; X calc_melee(); X} X Xvoid i_pow(o) Xpob o; X{ X mprint("You feel a surge of mystic power!"); X Player.mana = 2 * calcmana(); X} X Xvoid i_poison_food(o) Xpob o; X{ X mprint("This food was contaminated with cyanide!"); X p_poison(random_range(20)+5); X} X Xvoid i_pepper_food(o) Xpob o; X{ X mprint("You innocently start to chew the szechuan pepper....."); X morewait(); X mprint("hot."); X morewait(); X mprint("Hot."); X morewait(); X mprint("Hot!"); X morewait(); X mprint("HOT!!!!!!"); X morewait(); X p_damage(1,UNSTOPPABLE,"a szechuan pepper"); X mprint("Your sinuses melt and run out your ears."); X mprint("Your mouth and throat seem to be permanently on fire."); X mprint("You feel much more awake now...."); X Player.immunity[SLEEP]++; X} X Xvoid i_lembas(o) Xpob o; X{ X heal(10); X cleanse(0); X Player.food = 40; X} X X Xvoid i_cure(o) Xpob o; X{ X cure(o->blessing); X} X Xvoid i_immune(o) Xpob o; X{ X if (o->blessing > 0) { X mprint("You feel a sense of innoculation"); X Player.immunity[INFECTION]++; X cure(o->blessing); X } X} X X X Xvoid i_breathing(o) Xpob o; X{ X X if (o->blessing > -1) X Objects[o->id].known = 1; X breathe(o->blessing); X} X X Xvoid i_invisible(o) Xpob o; X{ X if (o->blessing > -1) X Objects[o->id].known = 1; X invisible(o->blessing); X} X X Xvoid i_perm_invisible(o) Xpob o; X{ X if (o->blessing > -1) X Objects[o->id].known = 1; X if (o->used) { X if (o->blessing > -1) { X mprint("You feel transparent!"); X Player.status[INVISIBLE] += 1500; X } X else { X mprint("You feel a forboding of bodily harm!"); X Player.status[VULNERABLE] += 1500; X } X } X else { X if (o->blessing > -1) { X Player.status[INVISIBLE]-=1500; X if (Player.status[INVISIBLE] < 1) { X mprint("You feel opaque again."); X Player.status[INVISIBLE] = 0; X } X } X else { X Player.status[VULNERABLE] -= 1500; X if (Player.status[VULNERABLE] < 1) { X mprint("You feel less endangered now."); X Player.status[VULNERABLE] = 0; X } X } X } X} X X Xvoid i_warp(o) Xpob o; X{ X if (o->blessing > -1) X Objects[o->id].known = 1; X warp(o->blessing); X} X X Xvoid i_alert(o) Xpob o; X{ X if (o->blessing > -1) { X Objects[o->id].known = 1; X alert(o->blessing); X } X} X Xvoid i_charge(o) Xpob o; X{ X int i; X if (o->blessing > -1) X Objects[o->id].known = 1; X mprint("A scroll of charging."); X mprint("Charge: "); X i = getitem(STICK); X if (i != ABORT) { X if (o->blessing < 0) { X mprint("The stick glows black!"); X Player.possessions[i]->charge = 0; X } X else { X mprint("The stick glows blue!"); X Player.possessions[i]->charge += (random_range(10)+1)*(o->blessing+1); X if (Player.possessions[i]->charge > 99) X Player.possessions[i]->charge = 99; X } X } X} X X Xvoid i_fear_resist(o) Xpob o; X{ X if (o->blessing > -1) { X Objects[o->id].known = 1; X if (Player.status[AFRAID] > 0) { X mprint("You feel stauncher now."); X Player.status[AFRAID] = 0; X } X } X else if (! p_immune(FEAR)) { X mprint("You panic!"); X Player.status[AFRAID]+=random_range(100); X } X} X X X X/* use a thieves pick */ Xvoid i_pick(o) Xpob o; X{ X int dir; X int ox,oy; X o->used = FALSE; X if ((! o->known) && (! Player.rank[THIEVES])) X mprint("You have no idea what do with a piece of twisted metal."); X else { X o->known = 1; X Objects[o->id].known = 1; X mprint("Pick lock:"); X dir = getdir(); X if (dir == ABORT) X resetgamestatus(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 loc_statusp(ox,oy,SECRET)) { X mprint("You can't unlock that!"); X resetgamestatus(SKIP_MONSTERS); X } X else if (Level->site[ox][oy].aux == LOCKED) { X if (Level->depth == MaxDungeonLevels-1) X mprint("The lock is too complicated for you!!!"); X else if (Level->depth*2 + random_range(50) < X Player.dex+Player.level+Player.rank[THIEVES]*10) { X mprint("You picked the lock!"); X Level->site[ox][oy].aux = UNLOCKED; X gain_experience(max(3,Level->depth)); X } X else mprint("You failed to pick the lock."); X } X else mprint("That door is already unlocked!"); X } X } X} X X/* use a magic key*/ Xvoid i_key(o) Xpob o; X{ X int dir; X int ox,oy; X o->used = FALSE; X mprint("Unlock door: "); X dir = getdir(); X if (dir == ABORT) X resetgamestatus(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 loc_statusp(ox,oy,SECRET)) { X mprint("You can't unlock that!"); X resetgamestatus(SKIP_MONSTERS); X } X else if (Level->site[ox][oy].aux == LOCKED) { X mprint("The lock clicks open!"); X Level->site[ox][oy].aux = UNLOCKED; X o->blessing--; X if ((o->blessing<0)||(Level->depth == MaxDungeonLevels-1)) { X mprint("The key disintegrates!"); X conform_lost_objects(1,o); X } X else { X mprint("Your key glows faintly."); X o->blessing--; X } X } X else mprint("That door is already unlocked!"); X } X} X Xvoid i_corpse(o) Xpob o; X{ X switch (o->aux) { X case ML0+1: X case ML0+2: X case ML0+3: X case ML0+4: X case ML2+0: X case ML2+2: X case ML7+3: X case ML10+0: /* cannibalism */ X mprint("Yechh! How could you! You didn't even cook him, first!"); X if (Player.alignment > 0) Player.food = 25; X Player.food += 8; X Player.alignment -=10; X foodcheck(); X break; X case ML1+2: /* fnord */ X mprint("You feel illuminated!"); X Player.iq++; X break; X case ML4+3: /* denebian slime devil */ X mprint("I don't believe this. You ate Denebian Slime?"); X mprint("You deserve a horrible wasting death, uncurable by any means!"); X break; X case ML5+0: X mprint("Those dragon-steaks were fantastic!"); X Player.food=24; X foodcheck(); X break; X case ML7+0: X mprint("You feel infinitely more virile now."); X Player.str = max(Player.str,Player.maxstr+10); X Player.food = 24; X foodcheck(); X break; X case ML9+1: X mprint("Guess what? You're invisible."); X if (Player.status[INVISIBLE] < 1000) Player.status[INVISIBLE] = 666; X Player.food+=6; X foodcheck(); X break; X case ML7+2: X mprint("You ATE a unicorn's horn?!?!?"); X Player.immunity[POISON]=1000; X break; X case ML0+0: X case ML1+0: X case ML1+1: X case ML1+4: X case ML1+5: X case ML1+6: X case ML1+10: X case ML2+1: X case ML2+4: X case ML4+1: X case ML4+4: X case ML5+3: X mprint("Well, you forced it down. Not much nutrition, though."); X Player.food++; X foodcheck(); X break; X case ML1+3: X case ML1+7: X case ML2+3: X case ML2+5: X case ML3+1: X case ML4+5: X case ML9+3: X case ML10+1: X mprint("Oh, yuck. The 'food' seems to be tainted."); X mprint("You feel very sick. You throw up."); X Player.food = min(Player.food, 4); X if (! Player.immunity[INFECTION]) X Player.status[DISEASED]+=24; X p_poison(10); X break; X default: mprint("It proved completely inedible, but you tried anyhow."); X } X} X Xvoid i_accuracy(o) Xpob o; X{ X o->known = 1; X Objects[o->id].known = 1; X accuracy(o->blessing); X} X Xvoid i_perm_accuracy(o) Xpob o; X{ X o->known = 1; X Objects[o->id].known = 1; X if ((o->used) && (o->blessing > -1)) { X Player.status[ACCURATE] += 1500; X mprint("You feel skillful and see bulls' eyes everywhere."); X } X else { X Player.status[ACCURATE] -= 1500; X if (Player.status[ACCURATE] < 1) { X Player.status[ACCURATE] = 0; X calc_melee(); X mprint("Your vision blurs...."); X } X } X} X Xvoid i_hero(o) Xpob o; X{ X o->known = 1; X Objects[o->id].known = 1; X hero(o->blessing); X} X Xvoid i_perm_hero(o) Xpob o; X{ X o->known = 1; X Objects[o->id].known = 1; X if (o->used){ X if (o->blessing > -1) { X Player.status[HERO] += 1500; X calc_melee(); X mprint("You feel super!"); X } X else { X Player.status[HERO] = 0; X calc_melee(); X if (! Player.immunity[FEAR]) { X Player.status[AFRAID]+=1500; X mprint("You feel cowardly...."); X } X } X } X else { X if (o->blessing > -1) { X Player.status[HERO] -= 1500; X if (Player.status[HERO] < 1) { X calc_melee(); X mprint("You feel less super now."); X Player.status[HERO] = 0; X } X } X else { X Player.status[AFRAID] -= 1500; X if (Player.status[AFRAID] < 1) { X mprint("You finally conquer your fear."); X Player.status[AFRAID] = 0; X } X } X } X} X Xvoid i_levitate(o) Xpob o; X{ X o->known = 1; X Objects[o->id].known = 1; X levitate(o->blessing); X} X Xvoid i_perm_levitate(o) Xpob o; X{ X o->known = 1; X Objects[o->id].known = 1; X if (o->blessing > -1) { X if (o->used) { X Player.status[LEVITATING] += 1400; X mprint("You start to float a few inches above the floor"); X mprint("You find you can easily control your altitude"); X } X else { X Player.status[LEVITATING] -= 1500; X if (Player.status[LEVITATING] < 1) { X Player.status[LEVITATING] = 0; X mprint("You sink to the floor."); X } X } X } X else i_perm_burden(o); X} X Xvoid i_perm_protection(o) Xpob o; X{ X if (o->used){ X if (o->blessing > -1) X Player.status[PROTECTION] += abs(o->plus)+1; X else X Player.status[PROTECTION] -= abs(o->plus)+1; X } X else { X if (o->blessing > -1) X Player.status[PROTECTION] -= abs(o->plus)+1; X else X Player.status[PROTECTION] += abs(o->plus)+1; X } X calc_melee(); X} X Xvoid i_perm_agility(o) Xpob o; X{ X o->known = 2; X Objects[o->id].known = 1; X if (o->used){ X if (o->blessing > -1) X Player.agi += abs(o->plus)+1; X else X Player.agi -= abs(o->plus)+1; X } X else { X if (o->blessing > -1) X Player.agi -= abs(o->plus)+1; X else X Player.agi += abs(o->plus)+1; X } X calc_melee(); X} X Xvoid i_truesight(o) Xpob o; X{ X o->known = 1; X Objects[o->id].known = 1; X truesight(o->blessing); X} X Xvoid i_perm_truesight(o) Xpob o; X{ X o->known = 1; X Objects[o->id].known = 1; X if (o->used){ X if (o->blessing > -1) { X Player.status[TRUESIGHT] += 1500; X mprint("You feel sharp!"); X } X else { X Player.status[BLINDED] += 1500; X mprint("You've been blinded!"); X } X } X else { X if (o->blessing > -1) { X Player.status[TRUESIGHT] -= 1500; X if (Player.status[TRUESIGHT] < 1) { X mprint("You feel less keen now."); X Player.status[TRUESIGHT] = 0; X } X } X else { X Player.status[BLINDED] -= 1500; X if (Player.status[BLINDED] < 1) { X mprint("You can see again!"); X Player.status[BLINDED] = 0; X } X } X } X} X Xvoid i_illuminate(o) Xpob o; X{ X o->known = 1; X Objects[o->id].known = 1; X illuminate(o->blessing); X} X Xvoid i_perm_illuminate(o) Xpob o; X{ X o->known = 1; X Objects[o->id].known = 1; X if (o->used) X Player.status[ILLUMINATION]+=1500; X else X Player.status[ILLUMINATION]=max(0,Player.status[ILLUMINATION]-1500); X} X X X X Xvoid i_trap(o) Xpob o; X{ X Objects[o->id].known = 1; X X if ((Level->site[Player.x][Player.y].locchar != FLOOR) || X (Level->site[Player.x][Player.y].p_locf != L_NO_OP)) X mprint("Your attempt fails."); X else if (! o->known) { X mprint("Fiddling with the thing, you have a small accident...."); X p_movefunction(o->aux); X } X else { X mprint("You successfully set a trap at your location."); X Level->site[Player.x][Player.y].p_locf = o->aux; X } X dispose_lost_objects(1,o); X} X X Xvoid i_raise_portcullis(o) Xpob o; X{ X l_raise_portcullis(); X mprint("The box beeps once and explodes in your hands!"); X conform_lost_objects(1,o); X} X END_OF_FILE if test 18117 -ne `wc -c <'oitemf1.c'`; then echo shar: \"'oitemf1.c'\" unpacked with wrong size! fi # end of 'oitemf1.c' fi echo shar: End of archive 11 \(of 20\). cp /dev/null ark11isdone 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