void activate() { int index; char response; clearmsg(); print1("Activate -- item [i] or artifact [a] or quit [ESCAPE]?"); do response = (char) mcigetc(); while ((response != 'i') && (response != 'a') && (response != ESCAPE)); if (response != ESCAPE) { if (response == 'i') index = getitem(THING); else if (response == 'a') index = getitem(ARTIFACT); if (index != ABORT) { clearmsg(); print1("You activate it.... "); morewait(); item_use(Player.possessions[index]); } else setgamestatus(SKIP_MONSTERS); } else setgamestatus(SKIP_MONSTERS); }
int initstats(void) { char response; char savedg[80]; print1("Do you want to run a character [c], load a game [l], or "); print2("play yourself [p]?"); /* RM 04-19-2000 loading patch */ do response = (char) mcigetc(); while ((response!='c')&&(response != 'p')&&(response !='l')); if (response == 'c') omegan_character_stats(); else if (response == 'l') { /* RM 04-19-2000: loading patch - a blatant hack */ clearmsg(); print1("Enter saved game name: "); strcpy(savedg,msgscanstring()); game_restore(savedg); return true; } else { clearmsg(); /* RM 04-19-2000 loading patch - fix the display */ user_character_stats(); user_intro(); print1("Do you want to save this set-up to .omegarc in your home directory? [yn] "); if (ynq1()=='y') save_omegarc(); } xredraw(); return false; }
void bufferprint(void) { int i = bufferpos - 1, c, finished = 0; clearmsg(); #ifndef MSDOS_SUPPORTED_ANTIQUE wprintw(Msg1w,"^p for previous message, ^n for next, anything else to quit."); #else wprintw(Msg1w,"^o for last message, ^n for next, anything else to quit."); #endif wrefresh(Msg1w); do { if (i >= STRING_BUFFER_SIZE) i = 0; if (i < 0) i = STRING_BUFFER_SIZE - 1; wclear(Msg2w); wprintw(Msg2w,Stringbuffer[i]); wrefresh(Msg2w); c = mgetc(); #ifndef MSDOS_SUPPORTED_ANTIQUE if (c == 16) /* ^p */ #else if (c == 15) /* ^o */ #endif i--; else if (c == 14) /* ^n */ i++; else finished = 1; } while (!finished); clearmsg(); omshowcursor(Player.x,Player.y); }
void stationcheck(void) { int stationsleft=FALSE; int i,j; morewait(); clearmsg(); print1("You feel regenerated."); Player.hp = Player.maxhp; dataprint(); for(j=0;j<Level->level_length;j++) for(i=0;i<Level->level_width;i++) if ((Level->site[i][j].locchar == WATER) || (Level->site[i][j].locchar == HEDGE) || (Level->site[i][j].locchar == WHIRLWIND) || (Level->site[i][j].locchar == FIRE)) stationsleft=TRUE; if (! stationsleft) { print1("There is a noise like a wild horse's neigh."); print2("You spin around, and don't see anyone around at all"); print3("except for a spurred black cloaked figure carrying a scythe."); morewait();clearmsg(); print1("Death coughs apologetically. He seems a little embarrassed."); print2("A voice peals out:"); print3("'An Adept must be able to conquer Death himself...."); make_site_monster(32,4,DEATH); } }
void l_void_station(void) { int i,something=FALSE; if (cinema_confirm("You're about to Peter Pan into an endless void.")=='y') { if (Level->mlist == NULL) { print2("You fall forever. Eventually you die of starvation."); morewait(); while(Player.hp>0) { Time+=60; hourly_check(); usleep(250000); } } else { print1("You enter the void."); print2("You feel a sudden surge of power from five directions."); morewait(); something = (Player.packptr > 0); if (! something) for(i=0;((i<MAXITEMS)&&(!something));i++) if (Player.possessions[i] != NULL) something = TRUE; if (something) { print1("The flow of power is disrupted by something!"); print2("The power is unbalanced! You lose control!"); morewait(); print1("Each of your cells explodes with a little scream of pain."); print2("Your disrupted essence merges with the megaflow."); p_death("the Power of the Void"); } else if (! gamestatusp(PREPARED_VOID)){ print1("The hungry void swallows you whole!"); print2("Your being dissipates with a pathetic little sigh...."); p_death("the Emptyness of the Void"); } else { print1("The flow of power rages through your body,"); print2("but you manage to master the surge!"); print3("You feel adept...."); morewait();clearmsg(); print1("With a thought, you soar up through the void to the"); print2("place from whence you came."); print3("As the platform of the Challenge dwindles beneath you"); morewait(); clearmsg(); print1("You see Death raise his scythe to you in a salute."); Player.rank[ADEPT] = 1; setgamestatus(COMPLETED_CHALLENGE); FixedPoints = calc_points(); /* set so change_environment puts player in correct temple! */ Player.x = 49; Player.y = 59; print2("You find yourself back in the Temple of Destiny."); morewait(); change_environment(E_TEMPLE); } } } else print2("You back away from the edge...."); }
void l_void(void) { clearmsg(); print1("Geronimo!"); morewait(); clearmsg(); print1("You leap into the void."); if (Level->mlist) { print2("Death peers over the edge and gazes quizzically at you...."); morewait(); print3("'Bye-bye,' he says... 'We'll meet again.'"); } morewait(); while(Player.hp>0) { Time+=60; hourly_check(); /* WDT: GCC doesn't like usleep being included from unistd.h when it's * checking for ANSI compliance. That's the stupidest thing I've seen, * but I wasn't offered a choice -- the man pages don't document any other * options. * Fortunately, this is a bad use of usleep, so commenting it out won't * hurt the game, and might even help it. */ /* usleep(250000);*/ } }
void l_vault(void) { print1("You come to a thick vault door with a complex time lock."); if ((hour()==23)) { print2("The door is open."); Level->site[12][56].locchar = FLOOR; } else { print2("The door is closed."); Level->site[12][56].locchar = WALL; morewait(); clearmsg(); if (cinema_confirm("You're about to try to crack the safe.")=='y') { if (random_range(100) < Player.rank[THIEVES]*Player.rank[THIEVES]) { print2("The lock clicks open!!!"); gain_experience(5000); Level->site[12][56].locchar = FLOOR; } else { print2("Uh, oh, set off the alarm.... The castle guard arrives...."); morewait(); if (Player.rank[NOBILITY] == DUKE) { clearmsg(); print1("\"Ah, just testing us, your Grace? I hope we're up to scratch.\""); morewait(); } else send_to_jail(); } } else print2("Good move."); } }
/* move the cursor around, like for firing a wand, sets x and y to target */ void setspot(int *x, int *y) { char c = ' '; mprint("Targeting.... ? for help"); omshowcursor(*x,*y); while ((c != '.') && (c != ESCAPE)) { c = lgetc(); switch(c) { case 'h': case '4': movecursor(x,y,-1,0); break; case 'j': case '2': movecursor(x,y,0,1); break; case 'k': case '8': movecursor(x,y,0,-1); break; case 'l': case '6': movecursor(x,y,1,0); break; case 'b': case '1': movecursor(x,y,-1,1); break; case 'n': case '3': movecursor(x,y,1,1); break; case 'y': case '7': movecursor(x,y,-1,-1); break; case 'u': case '9': movecursor(x,y,1,-1); break; case '?': clearmsg(); mprint("Use vi keys or numeric keypad to move cursor to target."); mprint("Hit the '.' key when done, or ESCAPE to abort."); break; } } if (c==ESCAPE) { *x = *y = ABORT; clearmsg(); } screencheck(Player.x,Player.y); }
void eat() { int index; struct object *obj; clearmsg(); print1("Eat --"); index = getitem(FOOD); if (index == ABORT) setgamestatus(SKIP_MONSTERS); else { obj = Player.possessions[index]; if ((obj->objchar != FOOD)&&(obj->objchar != CORPSE)) { print3("You can't eat "); nprint3(itemid(obj)); } else { if (obj->usef == I_FOOD) Player.food = max(0,Player.food+obj->aux); item_use(obj); dispose_lost_objects(1,obj); if (Current_Dungeon == E_COUNTRYSIDE) { Time += 100; hourly_check(); } } } foodcheck(); }
void l_voidstone(void) { int i; print1("This is a grey and uninteresting stone."); print2("A feeling of nihility emanates from it."); morewait(); clearmsg(); if (cinema_confirm("You're about to touch it.")=='y') { print1("You feel negated."); morewait(); Player.mana = 0; toggle_item_use(TRUE); for(i=0;i<NUMSTATI;i++) Player.status[i] = 0; for(i=0;i<MAXITEMS;i++) if (Player.possessions[i] != NULL) { Player.possessions[i]->blessing = 0; Player.possessions[i]->plus = 0; Player.possessions[i]->usef = I_NOTHING; } toggle_item_use(FALSE); calc_melee(); } else print1("You back away from the strange rock."); }
/* Increase in level at appropriate experience gain */ void gain_level(void) { int gained=FALSE; int hp_gain; /* FIXED! 12/30/98 */ if (gamestatusp(SUPPRESS_PRINTING)) return; while (expval(Player.level+1) <= Player.xp) { if (!gained) morewait(); gained = TRUE; Player.level++; print1("You have attained a new experience level!"); print2("You are now "); nprint2(getarticle(levelname(Player.level))); nprint2(levelname(Player.level)); hp_gain = random_range(Player.con)+1; /* start fix 12/30/98 */ if (Player.hp < Player.maxhp ) Player.hp += hp_gain*Player.hp/Player.maxhp; else if (Player.hp < Player.maxhp + hp_gain) Player.hp = Player.maxhp + hp_gain; /* else leave current hp alone */ Player.maxhp += hp_gain; Player.maxmana = calcmana(); /* If the character was given a bonus, let him keep it. Otherwise * recharge him. */ Player.mana = max(Player.mana, Player.maxmana); /* end fix 12/30/98 */ morewait(); } if (gained) clearmsg(); calc_melee(); }
void l_charity(void) { long donation; print2("'Greetings, friend. Do you wish to make a donation?' [yn] "); if (ynq2()!='y') print3("'Pinchpurse!'"); else { clearmsg(); // print1("How much can you give? "); donation = parsenum("How much can you give?"); if (donation < 1) print2("'Go stick your head in a pig.'"); else if (donation > Player.cash) print2("'I'm afraid you're charity is bigger than your purse!'"); else if (donation < max(100,Player.level*Player.level*100)) { print2("'Oh, can't you do better than that?'"); print3("'Well, I guess we'll take it....'"); if (Player.alignment < 10) Player.alignment++; Player.cash -= donation; } else { print2("'Oh thank you kindly, friend, and bless you!'"); Player.cash -= donation; Player.alignment += 5; } } dataprint(); }
/* read a scroll, book, tome, etc. */ void peruse() { int index; struct object *obj; clearmsg(); if (Player.status[BLINDED] > 0) print3("You're blind -- you can't read!!!"); else if (Player.status[AFRAID] > 0) print3("You are too afraid to stop to read a scroll!"); else { print1("Read -- "); index = getitem(SCROLL); if (index == ABORT) setgamestatus(SKIP_MONSTERS); else { obj = Player.possessions[index]; if (obj->objchar != SCROLL) { print3("There's nothing written on "); nprint3(itemid(obj)); } else { nprint1("You carefully unfurl the scroll...."); morewait(); item_use(obj); dispose_lost_objects(1,obj); } } } }
void l_adept(void) { print1("You see a giant shimmering gate in the form of an omega."); if (! gamestatusp(ATTACKED_ORACLE)) { if (Player.str+Player.con+Player.iq+Player.pow < 100) print2("A familiar female voice says: I would not advise this now...."); else print2("A familiar female voice says: Go for it!"); } morewait(); clearmsg(); if (cinema_confirm("You're about to step into the mystic portal.")!='y') { if (Player.level > 100) { print1("The Lords of Destiny spurn your cowardice and indecision..."); Player.xp = 0; Player.level = 0; Player.hp = Player.maxhp = Player.con; Player.mana = calcmana(); print2("You suddenly feel very inexperienced."); dataprint(); morewait(); clearmsg(); } print1("You edge away from the challenge."); } else { clearmsg(); print1("You pass through the portal."); morewait(); drawomega(); print1("Like wow man! Colors! "); if (Player.patron != DESTINY) { print2("Strange forces try to tear you apart!"); p_damage(random_range(200),UNSTOPPABLE,"a vortex of chaos"); } else print2("Some strange force shields you from a chaos vortex!"); morewait(); print1("Your head spins for a moment...."); print2("and clears...."); morewait(); Player.hp = Player.maxhp; Player.mana = calcmana(); change_environment(E_ABYSS); } }
/* hooray */ void p_win(void) { morewait(); clearmsg(); print1("You won!"); morewait(); display_win(); endgraf(); exit(0); }
void signalexit(int ignored) { clearmsg(); mprint("Yikes!"); morewait(); mprint("Sorry, caught a core-dump signal."); signalsave(0); endgraf(); printf("Bye!\n"); exit(0); }
/* WDT HACK! This should use the interaction code, and should allow * direct input. */ int getnumber(int range) { int done=FALSE,value=1; int atom; if (range==1) return(1); else while (! done) { clearmsg(); wprintw(Msg1w,"How many? Change with < or >, ESCAPE to select:"); mnumprint(value); #ifndef MSDOS do atom=mcigetc(); while ((atom != '<')&&(atom != '>')&&(atom!=ESCAPE)); if ((atom=='>') && (value < range)) value++; else if ((atom=='<') && (value > 1)) value--; else if (atom==ESCAPE) done = TRUE; #else atom=mcigetc(); switch (atom) { case '>': case 'k': #ifdef KEY_UP case KEY_UP: #endif if (value < range) value++; break; case '<': case 'j': #ifdef KEY_DOWN case KEY_DOWN: #endif if (value > 1) value--; break; #ifdef KEY_HOME case KEY_HOME: #endif value = 1; break; #ifdef KEY_LL case KEY_LL: #endif value = range; break; case ESCAPE: done = TRUE; break; } #endif } return(value); }
/* select a spell to cast */ int getspell(void) { int spell= ABORT - 1; do { mprint("Cast Spell: [type spell abbrev, ?, or ESCAPE]: "); spell = spellparse(); } while (spell < ABORT); clearmsg(); return(spell); }
void identify(int blessing) { int index; clearmsg(); if (blessing == 0) { index = getitem_prompt("Identify: ", NULL_ITEM); if (index == CASHVALUE) print3("Your money is really money."); else if (index == ABORT) State.setSkipMonsters(); else { if (Player.possessions[index]->objchar == FOOD) Player.possessions[index]->known = 1; else { Player.possessions[index]->known = 2; Objects[Player.possessions[index]->id].known = 1; } print1("Identified: "); mprint(itemid(Player.possessions[index])); } } else if (blessing < 0) { print2("You feel forgetful."); for (index=0; index<MAXITEMS; index++) if (Player.possessions[index] != NULL) { Player.possessions[index]->known = 0; Objects[Player.possessions[index]->id].known = 0; } } else { print2("You feel encyclopaedic."); for (index=0; index<MAXITEMS; index++) if (Player.possessions[index] != NULL) { if (Player.possessions[index]->objchar == FOOD) Player.possessions[index]->known = 1; else { Player.possessions[index]->known = 2; Objects[Player.possessions[index]->id].known = 1; } } for (index=0; index<Player.packptr; index++) if (Player.pack[index] != NULL) { if (Player.pack[index]->objchar == FOOD) Player.pack[index]->known = 1; else { Player.pack[index]->known = 2; Objects[Player.pack[index]->id].known = 1; } } } calc_melee(); }
void Interface::moreprompt() { int attrs = COLOR_PAIR((COLOR_WHITE ^ 7) + (COLOR_CYAN << 3)); move(0, 73); attron(attrs); addstr(" More "); attroff(attrs); getkey(); clearmsg(); }
void l_house_exit(void) { if (optionp(CONFIRM)) { clearmsg(); if (cinema_confirm("You're about to step out of this abode.") != 'y') return; } #ifndef MSDOS_SUPPORTED_ANTIQUE free_level(Level); #endif Level = NULL; change_environment(Last_Environment); }
/* * Exit from window mode */ void to_exit(int last) { if (in_screen) { if (last) { clearmsg(); refresh(); } cookterm(); endwin(); restore_terminal(); /* some curses are buggy */ } }
/* VARARGS */ void postmsg(char *msg) { if (linemode == YES || incurses == NO) { (void) printf("%s\n", msg); fflush(stdout); } else { clearmsg(); addstr(msg); refresh(); } (void) strncpy(lastmsg, msg, sizeof(lastmsg) - 1); }
void l_balancestone(void) { print1("This is a massive granite slab teetering dangerously on a corner."); print2("You feel a sense of balance as you regard it."); morewait(); clearmsg(); if (cinema_confirm("Your hand naturally drifts forward to touch it.")=='y') { print1("A vortex of mana spins about you!"); if (abs(Player.alignment) > random_range(50)) { print2("The cyclone whirls you off to a strange place!"); morewait(); change_environment(E_COUNTRYSIDE); do { setPlayerXY( random_range(COUNTRY_WIDTH), random_range(COUNTRY_LENGTH)); } while (Country[Player.x][Player.y].current_terrain_type == CHAOS_SEA); screencheck(Player.x,Player.y); drawvision(Player.x,Player.y); } else { print2("You are being drained of experience! Step back? [yn] "); if (ynq2()=='y') { clearmsg(); print1("The vortex calms down, dimishes, and then disappears."); } else { Player.xp -= Player.xp/4; dataprint(); print2("The vortex vanishes. Suddenly, there is a clap of thunder!"); morewait(); Player.alignment = 0; strategic_teleport(1); } } } else print1("You step back from the unlikely boulder."); }
FILE *omegarc_check(void) { FILE *fd; getOmegaRCPath(); if ((fd = fopen(Str1,"r")) != NULL) { print2("Use .omegarc in home directory? [yn] "); if (ynq2()!='y') { fclose(fd); fd = NULL; } } clearmsg(); return(fd); }
/* get a direction: return index into Dirs array corresponding to direction */ int getdir(void) { while (1) { mprint("Select direction [hjklyubn, ESCAPE to quit]: "); switch (mgetc()) { case '4': case 'h': case 'H': return(5); case '2': case 'j': case 'J': return(6); case '8': case 'k': case 'K': return(7); case '6': case 'l': case 'L': return(4); case '7': case 'y': case 'Y': return(3); case '9': case 'u': case 'U': return(1); case '1': case 'b': case 'B': return(2); case '3': case 'n': case 'N': return(0); case ESCAPE: clearmsg(); return(ABORT); default: print3("That's not a direction! "); } } }
void l_water_station(void) { print1("The fluid seems murky and unknowably deep."); print2("It bubbles and hisses threateningly."); morewait(); if (Player.status[BREATHING]) { print1("You don't feel sanguine about trying to breathe that stuff!"); morewait(); } if (Player.immunity[ACID]) { print2("The vapor burns despite your immunity to acid!"); morewait(); } print1("Enter the fluid? [yn] "); if (ynq1()=='y') { if (Player.hp == 1) p_death("drowning in acid (ick, what a way to go)"); else Player.hp = 1; dataprint(); print2("You choke...."); morewait(); nprint2("Your lungs burn...."); morewait(); print2("Your body begins to disintegrate.... Leave the pool? [yn] "); if (ynq2()=='y') print2("Phew! That was close!"); else { clearmsg(); Player.con -= (15+random_range(15)); if (Player.con > 0) { print1("That's odd, the fluid seems to have been neutralized...."); print2("A moist miasma wafts above the void nearby."); Level->site[Player.x][Player.y].locchar = FLOOR; Level->site[Player.x][Player.y].p_locf = L_NO_OP; stationcheck(); } else { print2("The bubbling fluid has destroyed your constitution!"); p_death("the Essence of Water"); } } } else print2("You step back from the pool of acid."); }
void l_lawstone(void) { print1("This is a stele carved of blueish-green feldspar."); print2("You feel an aura of serenity rising from it, and your gaze"); morewait(); print1("is attracted to the bulk of Star Peak to the North-East."); if (Player.alignment > 0) print2("You feel a subtle attraction to the stone."); else print2("You find the stone extremely distasteful to contemplate."); morewait(); clearmsg(); if (cinema_confirm("Your arm moves as though compelled to grasp it.")=='y') { print1("A matrix of power flows about you!"); morewait(); if (stonecheck(1)) { print2("You feel more vigorous!"); Player.maxcon = min(Player.maxcon+10,max(Player.maxcon,30)); dataprint(); } } else print1("You step back from the strange obelisk."); }
void l_chaostone(void) { print1("This is a menhir carved of black marble with veins of gold."); print2("It emanates an aura of raw chaos, which is not terribly"); morewait(); print1("surprising, considering its location."); if (Player.alignment < 0) print2("You feel an almost unbearable attraction to the stone."); else print2("You find it extremely difficult to approach the stone."); morewait(); clearmsg(); if (cinema_confirm("You reach out your fist to strike it.")=='y') { print1("A sudden flux of energy surrounds you!"); morewait(); if (stonecheck(-1)) { print2("You feel stronger!"); Player.maxstr = min(Player.maxstr+10,max(30,Player.maxstr)); dataprint(); } } else print1("You step back from the ominous dolmech."); }
void signalexit(int ignored) { clearmsg(); mprint("Yikes!"); morewait(); mprint("Sorry, caught a core-dump signal."); #if 0 /* DAG used to prompt... space-bar holding through messages could cause * failure to save. Now always just force through with signalsave() */ mprint("Want to try and save the game?"); reply = ynq(); if (reply=='y') save(FALSE, TRUE); /* don't compress, force save */ else if (reply == EOF) signalsave(0); #else signalsave(0); #endif endgraf(); printf("Bye!\n"); exit(0); }