コード例 #1
0
ファイル: profile.c プロジェクト: HieuLsw/iphonefrotz
void profile_quit()
{
  int bucknum;
  function_t *func;
  char linebuf[512];
  frefid_t profref;
  strid_t profstr;

  while (current_frame) {
    profile_out();
  }

  profref = glk_fileref_create_by_name(fileusage_BinaryMode|fileusage_Data, "profile-raw", 0);
  if (!profref)
    fatal_error("Profiler: unable to create profile-raw file");

  profstr = glk_stream_open_file(profref, filemode_Write, 0);

  glk_put_string_stream(profstr, "<profile>\n");

  for (bucknum=0; bucknum<FUNC_HASH_SIZE; bucknum++) {
    char total_buf[20], self_buf[20];

    for (func = functions[bucknum]; func; func=func->hash_next) {
      /* ###
      sprintf(linebuf, "function %lx called %ld times, total ops %ld, total time %s, self ops %ld,  self time %s\n",
        func->addr, func->call_count,
        func->total_ops,
        timeprint(&func->total_time, total_buf),
        func->self_ops,
        timeprint(&func->self_time, self_buf));
      ### */
      sprintf(linebuf, "  <function addr=\"%lx\" call_count=\"%ld\" accel_count=\"%ld\" total_ops=\"%ld\" total_time=\"%s\" self_ops=\"%ld\" self_time=\"%s\" />\n",
        func->addr, func->call_count, func->accel_count,
        func->total_ops,
        timeprint(&func->total_time, total_buf),
        func->self_ops,
        timeprint(&func->self_time, self_buf));
      glk_put_string_stream(profstr, linebuf);
    }
  }

  glk_put_string_stream(profstr, "</profile>\n");

  glk_stream_close(profstr, NULL);

  glulx_free(functions);
  functions = NULL;
}
コード例 #2
0
ファイル: aux2.c プロジェクト: anylonen/omega
/* values over 1000 indicate a permanent effect */
void tenminute_status_check(void)
{
  if ((Player.status[SHADOWFORM]>0) && (Player.status[SHADOWFORM]<1000)) {
    Player.status[SHADOWFORM]--;
    if (Player.status[SHADOWFORM] == 0) {
      Player.immunity[NORMAL_DAMAGE]--;
      Player.immunity[ACID]--;
      Player.immunity[THEFT]--;
      Player.immunity[INFECTION]--;
      mprint("You feel less shadowy now.");
    }
  }

  if ((Player.status[ILLUMINATION]>0) && (Player.status[ILLUMINATION]<1000)) {
    Player.status[ILLUMINATION]--;
    if (Player.status[ILLUMINATION] == 0) {
      mprint("Your light goes out!");
    }
  }


  if ((Player.status[VULNERABLE]>0) && (Player.status[VULNERABLE]<1000)){
    Player.status[VULNERABLE]--;
    if (Player.status[VULNERABLE] == 0)
      mprint("You feel less endangered.");
  }


  if ((Player.status[DEFLECTION]>0) && (Player.status[DEFLECTION]<1000)){
    Player.status[DEFLECTION]--;
    if (Player.status[DEFLECTION] == 0)
      mprint("You feel less well defended.");
  }

  if ((Player.status[ACCURATE]>0) && (Player.status[ACCURACY]<1000)){
    Player.status[ACCURATE]--;
    if (Player.status[ACCURATE] == 0) {
      calc_melee();
      mprint("The bulls' eyes go away.");
    }
  }
  if ((Player.status[HERO]>0) && (Player.status[HERO]<1000)){
    Player.status[HERO]--;
    if (Player.status[HERO] == 0) {
      calc_melee();
      mprint("You feel less than super.");
    }
  }

  if ((Player.status[LEVITATING]>0) && (Player.status[LEVITATING]<1000)){
    Player.status[LEVITATING]--;
    if (Player.status[LEVITATING] == 0)
      mprint("You're no longer walking on air.");
  }

  if (Player.status[DISEASED]>0) {
    Player.status[DISEASED]--;
    if (Player.status[DISEASED] == 0) {
      showflags();
      mprint("You feel better now.");
    }
  }


  if ((Player.status[INVISIBLE] > 0) && (Player.status[INVISIBLE]<1000)){
    Player.status[INVISIBLE]--;
    if (Player.status[INVISIBLE] == 0)
      mprint("You feel more opaque now.");
  }

  if ((Player.status[BLINDED]>0) && (Player.status[BLINDED]<1000)) {
    Player.status[BLINDED]--;
    if (Player.status[BLINDED] == 0) 
      mprint("You can see again.");
  }

  if ((Player.status[TRUESIGHT]>0) && (Player.status[TRUESIGHT]<1000)) {
    Player.status[TRUESIGHT]--;
    if (Player.status[TRUESIGHT] == 0) 
      mprint("You feel less keen now.");
  }

  if ((Player.status[BERSERK]>0) && (Player.status[BERSERK]<1000)) {
    Player.status[BERSERK]--;
    if (Player.status[BERSERK] == 0) 
      mprint("You stop foaming at the mouth.");
  }

  if ((Player.status[ALERT]>0) && (Player.status[ALERT] < 1000)) {
    Player.status[ALERT]--;
    if (Player.status[ALERT] == 0) 
      mprint("You feel less alert now.");
  }

  if ((Player.status[BREATHING]>0) && (Player.status[BREATHING] < 1000)) {
    Player.status[BREATHING]--;
    if (Player.status[BREATHING] == 0) 
      mprint("You feel somewhat congested."); 
  }

  if ((Player.status[DISPLACED]>0) && (Player.status[DISPLACED] < 1000)) {
    Player.status[DISPLACED]--;
    if (Player.status[DISPLACED]==0) 
      mprint("You feel a sense of position.");
  }
  timeprint();
  dataprint();
}
コード例 #3
0
ファイル: omega.c プロジェクト: muspellsson/omega-ng
int main(int argc, char *argv[])
{
  int continuing = 0;
  int count;
  int scores_only = 0;
  int i;

#ifndef NOGETOPT
  while(( i= getopt( argc, argv, "dsh")) != -1)
  {
     switch (i)
     {
       case 'd':
#ifdef DEBUG
         DG_debug_flag++;
#endif
         break;
       case 's':
         scores_only = 1;
         break;
       case 'h':
#ifdef DEBUG
         printf("Usage: omega [-shd] [savefile]\n");
#else
         printf("Usage: omega [-sh] [savefile]\n");
#endif
         printf("Options:\n");
         printf("  -s  Display high score list\n");
         printf("  -h  Display this message\n");
#ifdef DEBUG
         printf("  -d  Enable debug mode\n");
#endif
         exit(0);
         break;
       case '?':
         /* error parsing args... ignore? */
         printf("'%c' is an invalid option, ignoring\n", optopt );
         break;
     }
  }

  if (optind >= argc ) {
    /* no save file given */
#if defined( BSD ) || defined( SYSV )
    sprintf( SaveFileName, "Omega%d", getuid() );
#else
    strcpy( SaveFileName,"Omega");
#endif
  } else {
    /* savefile given */
    continuing = 1;
    strcpy(SaveFileName,argv[optind]);
  }

#else 
  /* alternate code for people who don't support getopt() -- no enhancement */
  if (argc ==2) {
    strcpy( SaveFileName, argv[1]);
    continuing = 1;
  } else {
    strcpy( SaveFileName,"Omega");
  }
#endif

  /* always catch ^c and hang-up signals */

#ifdef SIGINT
  signal(SIGINT,signalquit);
#endif
#ifdef SIGHUP
  signal(SIGHUP,signalsave);
#endif

#ifndef MSDOS
  if (CATCH_SIGNALS) {
    signal(SIGQUIT,signalexit);
    signal(SIGILL,signalexit);
#ifdef DEBUG
    if( DG_debug_flag ) {
#endif
    signal(SIGTRAP,signalexit);
    signal(SIGFPE,signalexit);
    signal(SIGSEGV,signalexit);
#ifdef DEBUG
    }
#endif
#ifdef SIGIOT
    signal(SIGIOT,signalexit);
#endif
#ifdef SIGABRT
    signal(SIGABRT,signalexit);
#endif
#ifdef SIGEMT
    signal(SIGEMT,signalexit);
#endif
#ifdef SIGBUS
    signal(SIGBUS,signalexit);
#endif
#ifdef SIGSYS
    signal(SIGSYS,signalexit);
#endif
    }
#endif

#ifndef FIXED_OMEGALIB
  if (!(Omegalib = getenv("OMEGALIB")))
#endif
    Omegalib = OMEGALIB;

  /* if filecheck is 0, some necessary data files are missing */
  if (filecheck() == 0) exit(0);

  /* all kinds of initialization */
  init_perms();
  initgraf();
#ifndef MSDOS_SUPPORTED_ANTIQUE
  initdirs();
#endif
  initrand(E_RANDOM, 0);
  initspells();

#ifdef DEBUG
  /* initialize debug log file */
  DG_debug_log = fopen( "/tmp/omega_dbg_log", "a" );
  assert( DG_debug_log ); /* WDT :) */
  setvbuf( DG_debug_log, NULL, _IOLBF, 0);
  fprintf(DG_debug_log, "##############  new game started ##############\n");
#endif

  for (count = 0; count < STRING_BUFFER_SIZE; count++)
    strcpy(Stringbuffer[count],"<nothing>");

#ifdef SAVE_LEVELS
  msdos_init();
#endif

  omega_title();
  showscores();

  if (scores_only ) {
    endgraf();
    exit(0);
  }

  /* game restore attempts to restore game if there is an argument */
  if (continuing) 
  {
     game_restore(SaveFileName);
     mprint("Your adventure continues....");
  }
  else
  {
    /* monsters initialized in game_restore if game is being restored */  
    /* items initialized in game_restore if game is being restored */
    inititem(TRUE);
    Date = random_range(360);
    Phase = random_range(24);
#ifdef NEW_BANK
    bank_init();
#else
    strcpy(Password,"");
#endif
    continuing = initplayer(); /* RM: 04-19-2000 loading patch */
  }
  if (!continuing)
  {
    init_world();  /* RM: 04-19-2000 loading patch */
    mprint("'?' for help or commandlist, 'Q' to quit.");
  }

  timeprint();
  calc_melee();
  if (Current_Environment != E_COUNTRYSIDE)
    showroom(Level->site[Player.x][Player.y].roomnumber);
  else
    terrain_check(FALSE);
  
  if (optionp(SHOW_COLOUR))
    colour_on();
  else
    colour_off();

  screencheck(Player.x,Player.y);

 /* game cycle */
  if (!continuing)
    time_clock(TRUE);
  while (TRUE) {
    if (Current_Environment == E_COUNTRYSIDE)
      p_country_process();
    else time_clock(FALSE);
  }
}
コード例 #4
0
ファイル: guild2.c プロジェクト: anylonen/omega
void l_monastery(void)
{
  char action;
  int done=FALSE,enrolled = FALSE;
  print1("Tholian Monastery of Rampart. Founded 12031, AOF.");
  print2("Welcome to our humble hovel.");
  if (nighttime())
    print2("The monastery doors are sealed until dawn.");
  else {
    while (! done) {
      menuclear();
      menuprint("Find your True Course:\n\n");
      menuprint("a: Discover the Way.\n");
      menuprint("b: Meditate on the Path.\n");
      menuprint("c: Meditate on Knowledge.\n");
      menuprint("d: Take an extended Meditation.\n");
      menuprint("ESCAPE: Re-enter the World.\n");
      showmenu();
      action = mgetc();
      if (action == ESCAPE) {
	done = TRUE;
	calc_melee();
      }
      else if (action == 'a') {
	if (Player.rank[MONKS] > 0)
	  print2("You are already initiated, Brother.");
	else if (Player.con < 13) 
	  print2("Your body is too fragile to walk the Path, child.");
	else if (Player.pow < 13) 
	  print2("Your mind is too fragile to follow the Path, child.");
	else if (Player.rank[COLLEGE] > 0)
	  print2("The Collegium has corruputed your spirit, child.");
	else if (Player.rank[CIRCLE] > 0)
	  print2("The Circle has corruputed your spirit, child.");
	else {
	  if (Player.pow > 17) {
	    print2("Your spirit is strong. You may study the Path with us.");
	    morewait();
	    enrolled=TRUE;
	  }
	  else {
	    print1("A substantial cash sacrifice will cleanse your spirit.. ");
	    print2("Donate your worldly goods? [yn] ");
	    if (ynq1() =='y') {
	      if (Player.cash < 1000)
		{
                  /* WDT HACK! I'd rather the monks have some other
		   * criteria for joining. */
		  print2("You have not much to give.");
		}
	      else {
		Player.cash = 0;
		enrolled = TRUE;
		dataprint();
	      }		
	    }
	  }
	  if (enrolled) {
	    print1("Grandmaster ");
	    nprint1(Grandmaster);
	    nprint1(" welcomes you to the Brotherhood.");
	    print2("You are now a Tholian Monk trainee!");
	    morewait();
	    print2("You may study the Way with us.");
	    Studiesleft = 1;
	    Player.rank[MONKS] = MONK_TRAINEE;
	    Player.guildxp[MONKS] = 1;
	    Player.maxpow += 1;
	    Player.pow += 1;
	  }
	}
      }
      else if (action == 'b') {
	if (Player.rank[MONKS] == 0)
	  print2("You are not yet initiated, child.");
	else if (Player.rank[MONKS]==MONK_GRANDMASTER) 
	  print2("Your advancement lies within, Grandmaster.");
	else if (Player.rank[MONKS]==MONK_MASTER_TEARS) {
	  if (Player.level <= Grandmasterlevel)
	    print2("Seek more experience, Master.");
	  else if ((Player.rank[MONKS]==MONK_MASTER_TEARS) &&
		   (Player.level > Grandmasterlevel) &&
		   find_and_remove_item(CORPSEID,EATER))
	    {
	      print1("You brought back the heart of the Eater of Magic!");
	      morewait();
	      print1("The Heart is sent to the placed in the kitchen cauldron.");
	      print2("The Grandmaster steps down. You are the new Grandmaster.");
	      morewait();
	      clearmsg();
	      strcpy(Grandmaster,Player.name);
	      Grandmasterlevel = Player.level;
	      Player.rank[MONKS] = MONK_GRANDMASTER;
	      Player.maxhp += (Player.maxpow * 3);
	      Player.maxiq += 5;
	      Player.iq+= 5;
	      Player.maxpow += 3;
	      Player.pow += 3;
	      Player.maxstr += 3;
	      Player.str += 3;
	      morewait();
	      Grandmasterbehavior = fixnpc(4);
	      save_hiscore_npc(16);
	    }
	  else
	    print2("You must return with the heart of the Eater of Magic!");

	}
	else if (Player.rank[MONKS]==MONK_MASTER_PAINS) {
	  if (Player.guildxp[MONKS] < 40000)
	    print2("Seek more experience, Master.");
	  else  {
	    print1("You have travelled far, Master.");
	    print2("You are now Master of Tears.");
	    Studiesleft += 6;
	    morewait();
	    print1("To become Grandmaster, you must return with the");
	    print2("heart of the Eater of Magic");
	    morewait();
	    clearmsg();
	    print1("The Eater may be found on a desert isle somewhere.");
	    Spells[S_REGENERATE].known = TRUE;
	    Player.rank[MONKS] = MONK_MASTER_TEARS;
	    Player.maxhp += (Player.maxpow * 2);
	    Player.maxpow += 2;
	    Player.pow += 2;
	    Player.maxstr += 2;
	    Player.str += 2;
	    Player.maxagi += 2;
	    Player.agi += 2;
	  }
	}
	else if (Player.rank[MONKS]==MONK_MASTER_SIGHS) {
	  if (Player.guildxp[MONKS] < 15000)
	    print2("Seek more experience, Master.");
	  else  {
	    print1("The Path is long, Master.");
	    print2("You are now Master of Pain.");
	    morewait();
	    print1("You feel enlightened.");
	    morewait();
	    clearmsg();
	    Studiesleft +=4;
	    Spells[S_RITUAL].known = TRUE;
	    Spells[S_RESTORE].known = TRUE;
	    Player.status[ILLUMINATION] = 1500;  /* enlightened */
	    Player.rank[MONKS] = MONK_MASTER_PAINS;
	    Player.maxhp += Player.maxpow;
	    Player.maxcon += 1;
	    Player.con += 1;
	    Player.maxdex += 2;
	    Player.dex += 2;
	  }
	}
	else if (Player.rank[MONKS]==MONK_MASTER) {
	  if (Player.guildxp[MONKS] < 9000)
	    print2("Seek more experience, Master.");
	  else  {
	    print1("Drink, weary Master.");
	    print2("You are now Master of Sighs.");
	    morewait();
	    clearmsg();
	    Studiesleft +=2;
	    Spells[S_HASTE].known = TRUE;
	    Player.rank[MONKS] = MONK_MASTER_SIGHS;
	    Player.maxhp += Player.maxpow;
	    Player.maxcon += 1;
	    Player.con += 1;
	    Player.maxiq += 2;
	    Player.iq += 2;
	  }
	}
	else if (Player.rank[MONKS]==MONK_MONK) {
	  if (Player.guildxp[MONKS] < 3000)
	    print2("Seek more experience, Brother.");
	  else  {
	    print1("A thousand steps on the path, Brother.");
	    print2("You are now a Master.");
	    morewait();
	    clearmsg();
	    Studiesleft +=2;
	    Spells[S_HEAL].known = TRUE;
	    Player.rank[MONKS] = MONK_MASTER;
	    Player.maxhp += Player.maxpow;
	    Player.maxcon += 1;
	    Player.con += 1;
	    Player.maxpow += 2;
	    Player.pow += 5; /* [sic] */
	  }
	}
	else if (Player.rank[MONKS]==MONK_TRAINEE) {
	  if (Player.guildxp[MONKS] < 1500)
	    print2("Seek more experience, Brother.");
	  else  {
	    print1("You have sought wisdom, Brother.");
	    print2("You are now a Tholian Monk.");
	    morewait();
	    clearmsg();
	    Studiesleft +=2;
	    Spells[S_CURE].known = TRUE;
	    Player.rank[MONKS] = MONK_MONK;
	    Player.maxhp += Player.maxpow;
	    Player.maxcon += 1;
	    Player.con += 1;
	    Player.maxpow += 1;
	    Player.pow += 1; 
	  }
	}
      }
      else if (action == 'c') {
	clearmsg();
	if (Studiesleft > 0) {
	  print1("Studies permitted: ");
	  mnumprint(Studiesleft);
	  nprint1(" Studies.");
	  morewait();
	}
	if (Studiesleft < 1) {
	  print1("Sacrifice clears a cluttered heart. ");
	  nprint1("Donate your worldly cash? [yn] ");
	  if (ynq1()=='y') {
	    if (Player.cash < 2000)
	      {
		if ( Player.rank[MONKS] >= MONK_GRANDMASTER )
		  print2("You have not much to give, Grandmaster.");
		else if ( Player.rank[MONKS] >= MONK_MASTER )
		  print2("You have not much to give, Master.");
		else
		  print2("You have not much to give, Brother.");
	      }
	    else {
	      Player.cash = 0;
	      dataprint();
	      Studiesleft = 1;
	    }
	  }
	}
	if (Studiesleft > 0) {
	  learnspell(0);
	  Studiesleft--;
	}
      }
      else if (action == 'd') {
	if (Player.rank[MONKS] < MONK_MASTER) {
	  clearmsg();
	  print1("Only Masters can achieve extended meditation, child.");
	  print2(" ");
	}
	else {
	  int i = 0;
	  clearmsg();
	  print1("Seeking inner truth...");
	  morewait();
	  clearmsg();
	  morewait();
	  toggle_item_use(TRUE);
	  Player.cash = 0;
	  Player.hp = Player.maxhp;
	  Player.str = Player.maxstr;
	  Player.agi = Player.maxagi;
	  Player.con = Player.maxcon;
	  Player.dex = Player.maxdex;
	  Player.iq = Player.maxiq;
	  Player.pow = Player.maxpow;
	  for (i=0;i<NUMSTATI;i++)
	    if (Player.status[i]<1000) Player.status[i]=0;
	  toggle_item_use(FALSE);
	  Player.food = 43;
	  print2("Your body and mind are whole.");
	  if (random_range(2) == 1) {
	    morewait();
	    print1("Extra whole!");
	    Player.maxhp += 1;
	  }
	}
	Time += 60*24*7;
	Date += 7;
	moon_check();
	timeprint();
      }

    }
  }
  xredraw();
}
コード例 #5
0
ファイル: profile.c プロジェクト: MikulasZelinka/glulxe
void profile_quit()
{
  int bucknum;
  function_t *func;
  char linebuf[512];
  strid_t profstr;

  if (!profiling_active)
    return;

  while (current_frame) {
    profile_out(0);
  }

  if (profiling_stream) {
    profstr = profiling_stream;
  }
  else if (profiling_filename) {
    frefid_t profref = glk_fileref_create_by_name(fileusage_BinaryMode|fileusage_Data, profiling_filename, 0);
    if (!profref)
        fatal_error_2("Profiler: unable to create profile output fileref", profiling_filename);

    profstr = glk_stream_open_file(profref, filemode_Write, 0);
  }
  else {
    fatal_error("Profiler: no profile output handle!");
  }

  glk_put_string_stream(profstr, "<profile>\n");

  for (bucknum=0; bucknum<FUNC_HASH_SIZE; bucknum++) {
    char total_buf[20], self_buf[20];
    callcount_t *cc;

    for (func = functions[bucknum]; func; func=func->hash_next) {
      /* ###
      sprintf(linebuf, "function %lx called %ld times, total ops %ld, total time %s, self ops %ld,  self time %s\n",
        func->addr, func->call_count,
        func->total_ops,
        timeprint(&func->total_time, total_buf),
        func->self_ops,
        timeprint(&func->self_time, self_buf));
      ### */
      sprintf(linebuf, "  <function addr=\"%lx\" call_count=\"%ld\" accel_count=\"%ld\" total_ops=\"%ld\" total_time=\"%s\" self_ops=\"%ld\" self_time=\"%s\" max_depth=\"%ld\" max_stack_use=\"%ld\" />\n",
        (unsigned long)func->addr, (long)func->call_count, (long)func->accel_count,
        (long)func->total_ops,
        timeprint(&func->total_time, total_buf),
        (long)func->self_ops,
        timeprint(&func->self_time, self_buf),
        (long)func->max_depth, (long)func->max_stack_use);
      glk_put_string_stream(profstr, linebuf);
      for (cc = func->outcalls; cc; cc = cc->next) {
        sprintf(linebuf, "  <calls fromaddr=\"%lx\" toaddr=\"%lx\" count=\"%ld\" />\n",
          (unsigned long)func->addr, (unsigned long)cc->toaddr, (long)cc->count);
        glk_put_string_stream(profstr, linebuf);
      }
    }
  }

  glk_put_string_stream(profstr, "</profile>\n");

  glk_stream_close(profstr, NULL);

  /* ### Ought to free the function structures, not just the hash array. */
  glulx_free(functions);
  functions = NULL;
}
コード例 #6
0
ファイル: site2.c プロジェクト: albert-wang/OmegaRPG
void l_condo(void)
{
    pol ol,prev=NULL;
    int i,done=FALSE,over=FALSE,weeksleep=FALSE;
    char response;

    if (! gamestatusp(SOLD_CONDO)) {
        response = cinema_interact
                   ("rp","Rampart Arms. Weekly Condo Rentals and Purchases",
                    "Which are you interested in [r,p, or ESCAPE] ",
                    NULL);
        if (response == 'p') {
            print2("Only 50,000Au. Buy it? [yn] ");
            if (ynq2()=='y') {
                if (Player.cash < 50000)
                    print3("No mortgages, buddy.");
                else {
                    setgamestatus(SOLD_CONDO);
                    Player.cash-=50000;
                    dataprint();
                    print2("You are the proud owner of a luxurious condo penthouse.");
                    Condoitems = NULL;
                }
            }
        }
        else if (response == 'r') {
            print2("Weekly Rental, 1000Au. Pay for it? [yn] ");
            if (ynq2()=='y') {
                if (Player.cash < 1000)
                    print2("Hey, pay the rent or out you go....");
                else {
                    weeksleep = TRUE;
                    Player.cash -=1000;
                    dataprint();
                }
            }
        }
        else print2("Please keep us in mind for your housing needs.");
    }
    else {
        while (! done) {
            menuclear();
            menuprint("Home Sweet Home\n");
            menuprint("a: Leave items in your safe.\n");
            menuprint("b: Retrieve items.\n");
            menuprint("c: Take a week off to rest.\n");
            menuprint("d: Retire permanently.\n");
            menuprint("ESCAPE: Leave this place.\n");
            showmenu();
            response = (char) mcigetc();
            if (response == 'a') {
                i = getitem(NULL_ITEM);
                if (i != ABORT) {
                    if (Player.possessions[i]->blessing < 0)
                        print2("The item just doesn't want to be stored away...");
                    else {
                        ol = ((pol) checkmalloc(sizeof(oltype)));
                        ol->thing = Player.possessions[i];
                        ol->next = Condoitems;
                        Condoitems = ol;
                        conform_unused_object(Player.possessions[i]);
                        Player.possessions[i] = NULL;
                    }
                }
            }
            else if (response == 'b') {
                ol = Condoitems;
                while ((ol != NULL) && (! over)) {
                    print1("Retrieve ");
                    nprint1(itemid(ol->thing));
                    nprint1(" [ynq] ");
                    response = (char) mcigetc();
                    /* DAG -- fix memory leak where object list nodes weren't deleted */
                    if (response == 'y') {
                        gain_item(ol->thing);
                        if (ol == Condoitems)
                        {
                            ol = ol->next;
                            free( Condoitems );
                            Condoitems = ol;
                        }
                        else
                        {
                            ol=ol->next;
                            free( prev->next );
                            prev->next = ol;
                        }
                    }
                    else if (response == 'q')
                        over = TRUE;
                    else
                    {
                        prev = ol;
                        ol = ol->next;
                    }
                }
            }
            else if (response == 'c') {
                weeksleep = TRUE;
                print1("You take a week off to rest...");
                morewait();
            }
            else if (response == 'd') {
                clearmsg();
                if (cinema_confirm("You ponder settling down here for good.") == 'y') {
                    p_win();
                }
            }
            else if (response == ESCAPE) done = TRUE;
        }
        xredraw();
    }
    if (weeksleep) {
        clearmsg();
        print1("Taking a week off to rest...");
        morewait();
        toggle_item_use(TRUE);
        Player.hp = Player.maxhp;
        Player.str = Player.maxstr;
        Player.agi = Player.maxagi;
        Player.con = Player.maxcon;
        Player.dex = Player.maxdex;
        Player.iq = Player.maxiq;
        Player.pow = Player.maxpow;
        for (i=0; i<NUMSTATI; i++)
            if (Player.status[i]<1000) Player.status[i]=0;
        toggle_item_use(FALSE);
        Player.food = 36;
        print2("You're once again fit and ready to continue your adventure.");
        Time += 60*24*7;
        Date += 7;
        moon_check();
        timeprint();
    }
}
コード例 #7
0
ファイル: site2.c プロジェクト: albert-wang/OmegaRPG
void l_brothel(void)
{
    char response;
    print1("You come to a heavily reinforced inner door.");
    print2("A sign reads `The House of the Eclipse'");
    morewait();
    clearmsg();
    if (cinema_confirm("You are about to open the door.")=='y') {
        menuclear();
        menuprint("a:knock on the door.\n");
        menuprint("b:try to pick the lock.\n");
        menuprint("c:bash down the door.\n");
        menuprint("ESCAPE: Leave this house of ill repute.\n");
        showmenu();
        do
            response = menugetc();
        while ((response != 'a') &&
                (response != 'b') &&
                (response != 'c') &&
                (response != ESCAPE));
        xredraw();
        if (response == 'a') {
            if (!nighttime())
                print2("There is no reponse.");
            else {
                print1("A window opens in the door.");
                print2("`500Au, buddy. For the night.' pay it? [yn] ");
                if (ynq2()=='y') {
                    if (Player.cash < 500) {
                        print1("`What, no roll?!'");
                        print2("The bouncer bounces you a little and lets you go.");
                        p_damage(25,UNSTOPPABLE,"da bouncer");
                    }
                    else {
                        Player.cash -= 500;
                        print1("You are ushered into an opulently appointed hall.");
                        print2("After an expensive dinner (takeout from Les Crapuleux)");
                        morewait();
                        if (Player.preference == 'n') {
                            switch(random_range(4)) {
                            case 0:
                                print1("you spend the evening playing German Whist with");
                                break;
                            case 1:
                                print1("you spend the evening discussing philosophy with");
                                break;
                            case 2:
                                print1("you spend the evening playing chess against");
                                break;
                            case 3:
                                print1("you spend the evening telling your adventures to");
                            }
                            print2("various employees of the House of the Eclipse.");
                        }
                        else {
                            print1("you spend an enjoyable and educational evening with");
                            if (Player.preference == 'm' ||
                                    (Player.preference == 'y' && random_range(2)))
                                switch(random_range(4)) {
                                case 0:
                                    print2("Skarn the Insatiable, a satyr.");
                                    break;
                                case 1:
                                    print2("Dryden the Defanged, an incubus.");
                                    break;
                                case 2:
                                    print2("Gorgar the Equipped, a centaur.");
                                    break;
                                case 3:
                                    print2("Hieronymus, the mendicant priest of Eros.");
                                    break;
                                }
                            else switch(random_range(4)) {
                                case 0:
                                    print2("Noreen the Nymph (omaniac)");
                                    break;
                                case 1:
                                    print2("Angelface, a recanted succubus.");
                                    break;
                                case 2:
                                    print2("Corporal Sue of the City Guard (moonlighting).");
                                    break;
                                case 3:
                                    print2("Sheena the Queena the Jungle, a wereleopard.");
                                    break;
                                }
                        }
                        morewait();
                        if (hour() > 12) Time += ((24-hour())+8) * 60;
                        else {
                            Time += ((9-hour())*60);
                            Date++;
                        }
                        Player.food = 40;
                        Player.status[DISEASED] = 0;
                        Player.status[POISONED] = 0;
                        Player.hp = Player.maxhp;
                        /* reduce temporary stat gains to max stat levels */
                        toggle_item_use(TRUE);
                        Player.str = min(Player.str,Player.maxstr);
                        Player.con = min(Player.con,Player.maxcon);
                        Player.agi = min(Player.agi,Player.maxagi);
                        Player.dex = min(Player.dex,Player.maxdex);
                        Player.iq = min(Player.iq,Player.maxiq);
                        Player.pow = min(Player.pow,Player.maxpow);
                        toggle_item_use(FALSE);
                        if (Player.preference == 'n')
                            Player.iq++; /* whatever :-) */
                        else
                            Player.con++;
                        gain_experience(100);
                        timeprint();
                        dataprint();
                        showflags();
                        morewait();
                        clearmsg();
                        if (Player.preference == 'n')
                            print1("You arise refreshed the next morning...");
                        else
                            print1("You arise, tired but happy, the next morning...");
                    }
                }
                else print2("What are you, some kinda prude?");
            }
        }
        else if (response == 'b') {
            if (nighttime()) {
                print1("As you fumble at the lock, the door opens....");
                print2("The bouncer tosses you into the street.");
            }
            else print1("The door appears to be bolted and barred from behind.");
        }
        else if (response == 'c') {
            if (nighttime()) {
                print1("As you charge toward the door it opens....");
                print2("Yaaaaah! Thud!");
                morewait();
                print1("You run past the startled bouncer into a wall.");
                p_damage(20,UNSTOPPABLE,"a move worthy of Clouseau");
                print2("The bouncer tosses you into the street.");
            }
            else {
                print1("Ouch! The door resists your efforts.");
                p_damage(1,UNSTOPPABLE,"a sturdy door");
                morewait();
                print1("You hear an irritated voice from inside:");
                print2("'Keep it down out there! Some of us are trying to sleep!'");
            }
        }
    }
}