LCOV - code coverage report
Current view: top level - omega-rpg-0.90-pa9 - char.c (source / functions) Hit Total Coverage
Test: lcov.info Lines: 2 502 0.4 %
Date: 2017-09-08 22:00:26 Functions: 1 46 2.2 %
Branches: 0 218 0.0 %

           Branch data     Line data    Source code
       1                 :            : /* omega copyright (C) by Laurence Raphael Brothers, 1987,1988,1989 */
       2                 :            : /* char.c */
       3                 :            : /* Player generation */
       4                 :            : 
       5                 :            : #ifndef MSDOS_SUPPORTED_ANTIQUE
       6                 :            : #include <sys/types.h>
       7                 :            : #include <unistd.h>
       8                 :            : #include <pwd.h>
       9                 :            : #endif
      10                 :            : 
      11                 :            : #include "glob.h"
      12                 :            : 
      13                 :            : /* set player to begin with */
      14                 :          0 : int initplayer(void)
      15                 :            : {
      16                 :            :   int i;
      17                 :          0 :   int oldchar=FALSE;
      18                 :            :   FILE *fd;
      19                 :            :   char *lname;
      20                 :          0 :   int loaded = FALSE;
      21                 :            : #ifndef MSDOS
      22                 :            :   struct passwd *dastuff;
      23                 :            : #endif
      24                 :            : 
      25                 :          0 :   lname = getlogin();
      26                 :            : #ifndef MSDOS
      27 [ #  # ][ #  # ]:          0 :   if (!lname || strlen(lname) == 0)
      28                 :            :     {
      29                 :          0 :       dastuff = getpwuid(getuid());
      30                 :          0 :       lname = dastuff->pw_name;
      31                 :            :     }
      32                 :            : #endif
      33                 :          0 :   strcpy(Player.name,lname);
      34 [ #  # ][ #  # ]:          0 :   if (Player.name[0] >= 'a' && Player.name[0] <= 'z')
      35                 :          0 :     Player.name[0] += 'A'-'a'; /* capitalise 1st letter */
      36                 :          0 :   Player.itemweight = 0;
      37                 :          0 :   Player.food = 36; 
      38                 :          0 :   Player.packptr = 0;
      39                 :          0 :   Behavior = -1;
      40                 :          0 :   Player.options = 0;
      41         [ #  # ]:          0 :   for (i=0;i<MAXITEMS;i++)
      42                 :          0 :     Player.possessions[i] = NULL;
      43         [ #  # ]:          0 :   for (i=0;i<MAXPACK;i++)
      44                 :          0 :     Player.pack[i] = NULL;
      45         [ #  # ]:          0 :   for (i=0;i<NUMIMMUNITIES;i++) Player.immunity[i] = 0;
      46         [ #  # ]:          0 :   for (i=0;i<NUMSTATI;i++) Player.status[i] = 0;
      47         [ #  # ]:          0 :   for (i=0;i<NUMRANKS;i++) {
      48                 :          0 :     Player.rank[i] = 0;
      49                 :          0 :     Player.guildxp[i] = 0;
      50                 :            :   }
      51                 :          0 :   Player.patron = 0;
      52                 :          0 :   Player.alignment = 0;
      53                 :          0 :   Player.cash = 250;
      54                 :          0 :   change_to_user_perms();
      55         [ #  # ]:          0 :   if ((fd=omegarc_check())!=NULL) {
      56                 :          0 :     fread((char *)&i,sizeof(int),1,fd);
      57         [ #  # ]:          0 :     if (i != VERSION) {
      58                 :            : #if defined(MSDOS) || defined(AMIGA)
      59                 :            :       print1("Out of date omega.rc! Make another!");
      60                 :            : #else
      61                 :          0 :       print1("Out of date .omegarc! Make another!");
      62                 :            : #endif
      63                 :          0 :       morewait();
      64                 :            :     }
      65                 :            :     else {
      66                 :          0 :       oldchar = TRUE;
      67                 :          0 :       fread((char *)&Player,sizeof(Player),1,fd);
      68                 :          0 :       fread((char *)&Searchnum,sizeof(int),1,fd);
      69                 :          0 :       fread((char *)&Verbosity,sizeof(char),1,fd);
      70                 :          0 :       strcpy(Player.name,lname);
      71 [ #  # ][ #  # ]:          0 :       if (Player.name[0] >= 'a' && Player.name[0] <= 'z')
      72                 :          0 :         Player.name[0] += 'A'-'a'; /* capitalise 1st letter */
      73                 :            :     }
      74                 :          0 :     fclose(fd);
      75                 :            :   }
      76                 :          0 :   change_to_game_perms();
      77         [ #  # ]:          0 :   if (! oldchar) {
      78                 :          0 :     optionset(RUNSTOP);
      79                 :          0 :     optionset(CONFIRM);
      80                 :            : #ifdef COMPRESS_SAVE_FILES
      81                 :            :     optionset(COMPRESS_OPTION);
      82                 :            : #endif
      83                 :          0 :     optionset(SHOW_COLOUR);
      84                 :          0 :     loaded = initstats() ; /* RM 04-19-2000:loading patch */ /* DAG */
      85                 :            :   }
      86                 :            :   /* This gets executed when the player loads from .omegarc */
      87                 :            :   /* DAG - put the code back in the same place, rather than duplicating */
      88         [ #  # ]:          0 :   Searchnum = max(1,min(9,Searchnum));
      89         [ #  # ]:          0 :   if (!loaded) {
      90                 :          0 :           Player.hp = Player.maxhp = Player.maxcon;
      91                 :          0 :           Player.mana = Player.maxmana = calcmana();
      92                 :          0 :           Player.click = 1;
      93                 :          0 :           strcpy(Player.meleestr,"CCBC");
      94                 :            :   }
      95                 :          0 :   calc_melee();
      96                 :          0 :   ScreenOffset = -1000; /* to force a redraw */
      97                 :          0 :   return loaded; /* RM 04-19-2000: loading patch */ /* DAG */
      98                 :            : }
      99                 :            : 
     100                 :            : 
     101                 :          0 : FILE *omegarc_check(void)
     102                 :            : {
     103                 :            :   FILE *fd;
     104                 :            : #if defined(MSDOS) || defined(AMIGA)
     105                 :            :   if ((fd = fopen("omega.rc","rb")) != NULL) {
     106                 :            :     print2("Use omega.rc charcter record in current directory? [yn] ");
     107                 :            : #else
     108                 :          0 :     snprintf(Str1, sizeof(Str1)-1, "%s/.omegarc", getenv("HOME"));
     109         [ #  # ]:          0 :     if ((fd = fopen(Str1,"r")) != NULL) {
     110                 :          0 :       print2("Use .omegarc in home directory? [yn] ");
     111                 :            : #endif
     112         [ #  # ]:          0 :       if (ynq2()!='y') {
     113                 :          0 :         fclose(fd);
     114                 :          0 :         fd = NULL;
     115                 :            :       }
     116                 :            :     }
     117                 :          0 :     clearmsg();
     118                 :          0 :     return(fd);
     119                 :            :   }
     120                 :            : 
     121                 :          0 : int initstats(void)
     122                 :            : {
     123                 :            :   char response;
     124                 :            :   char savedg[80];
     125                 :          0 :   print1("Do you want to run a character [c], load a game [l], or ");
     126                 :          0 :   print2("play yourself [p]?"); /* RM 04-19-2000 loading patch */
     127                 :            :   do 
     128                 :          0 :     response = (char) mcigetc(); 
     129 [ #  # ][ #  # ]:          0 :   while ((response!='c')&&(response != 'p')&&(response !='l'));
                 [ #  # ]
     130         [ #  # ]:          0 :   if (response == 'c') omegan_character_stats();
     131         [ #  # ]:          0 :   else if (response == 'l')
     132                 :            :   {
     133                 :            :         /* RM 04-19-2000: loading patch - a blatant hack */
     134                 :          0 :         clearmsg();
     135                 :          0 :         print1("Enter saved game name: ");
     136                 :          0 :         strcpy(savedg,msgscanstring());
     137                 :            : 
     138                 :          0 :         game_restore(savedg);
     139                 :          0 :         return TRUE;
     140                 :            :   }
     141                 :            :   else {
     142                 :          0 :     clearmsg(); /* RM 04-19-2000 loading patch - fix the display */
     143                 :          0 :     user_character_stats();
     144                 :          0 :     user_intro();
     145                 :            : #if defined(MSDOS) || defined(AMIGA)
     146                 :            :     print1("Do you want to save this set-up to omega.rc in this directory? [yn] ");
     147                 :            : #else
     148                 :          0 :     print1("Do you want to save this set-up to .omegarc in your home directory? [yn] ");
     149                 :            : #endif
     150         [ #  # ]:          0 :     if (ynq1()=='y')
     151                 :          0 :       save_omegarc();
     152                 :            :   }
     153                 :          0 :   xredraw();
     154                 :          0 :   return FALSE;
     155                 :            : }
     156                 :            : 
     157                 :          0 : void save_omegarc(void)
     158                 :            : {
     159                 :          0 :   int i=VERSION;
     160                 :            :   FILE *fd;
     161                 :          0 :   change_to_user_perms();
     162                 :            : #if defined(MSDOS) || defined(AMIGA)
     163                 :            :   fd = fopen("omega.rc","wb");
     164                 :            : #else
     165                 :          0 :   snprintf(Str1, sizeof(Str1)-1, "%s/.omegarc", getenv("HOME"));
     166                 :          0 :   fd = fopen(Str1,"w");
     167                 :            : #endif
     168         [ #  # ]:          0 :   if (fd == NULL)
     169                 :            : #if defined(MSDOS) || defined(AMIGA)
     170                 :            :     print1("Sorry, couldn't save omega.rc for some reason.");
     171                 :            : #else
     172                 :          0 :     print1("Sorry, couldn't save .omegarc for some reason.");
     173                 :            : #endif
     174                 :            :   else {
     175                 :          0 :     fwrite((char *)&i,sizeof(int),1,fd);
     176                 :          0 :     print1("First, set options.");
     177                 :          0 :     setoptions();
     178                 :          0 :     fwrite((char *)&Player,sizeof(Player),1,fd);
     179                 :          0 :     fwrite((char *)&Searchnum,sizeof(int),1,fd);
     180                 :          0 :     fwrite((char *)&Verbosity,sizeof(char),1,fd);
     181                 :          0 :     fclose(fd);
     182                 :            :   }
     183                 :          0 :   change_to_game_perms();
     184                 :          0 : }
     185                 :            : 
     186                 :            : 
     187                 :            : 
     188                 :          1 : long calcmana(void)
     189                 :            : {
     190                 :          1 :   return(Player.pow * (long)(Player.level+1));
     191                 :            : }
     192                 :            : 
     193                 :            : 
     194                 :            : /*  npcbehavior digits 1234
     195                 :            : 
     196                 :            : 4 : alignment (LAWFUL,CHAOTIC, or NEUTRAL)
     197                 :            : 3 : primary combat action (melee,missile,spell,thief,flight,1..5)
     198                 :            : 2 : competence at 4 (0..9, 0 = incompetent, 9 = masterful)
     199                 :            : 1 : conversation mode
     200                 :            : 
     201                 :            : status : 1 = dead, 2 = saved, 3 = retired, 4 = still playing
     202                 :            : */
     203                 :          0 : int fixnpc(int status)
     204                 :            : {
     205                 :          0 :   int npcbehavior=0;
     206                 :            :   char response;
     207         [ #  # ]:          0 :   if (status == 1) { /* player is dead, all undead are chaotic */
     208                 :          0 :     npcbehavior+=CHAOTIC;
     209                 :          0 :     npcbehavior+=10; /* melee */
     210         [ #  # ]:          0 :     npcbehavior+=100*min(9,((int) (Player.level/3)));
     211                 :          0 :     npcbehavior+=1000; /* threaten */
     212                 :            :   }
     213         [ #  # ]:          0 :   else if (Behavior >= 0)
     214                 :          0 :     npcbehavior = Behavior;
     215                 :            :   else {
     216                 :          0 :     menuclear();
     217                 :          0 :     menuprint("NPC Behavior Determination Module\n\n");
     218                 :          0 :     menuprint("Your overall NPC behavior is:");
     219         [ #  # ]:          0 :     if (Player.alignment < -10) {
     220                 :          0 :       npcbehavior += CHAOTIC;
     221                 :          0 :       menuprint("\n\n CHAOTIC");
     222                 :            :     }
     223         [ #  # ]:          0 :     else if (Player.alignment > 10) {
     224                 :          0 :       npcbehavior += LAWFUL;
     225                 :          0 :       menuprint("\n\n LAWFUL");
     226                 :            :     }
     227                 :            :     else {
     228                 :          0 :       npcbehavior += NEUTRAL;
     229                 :          0 :       menuprint("\n\n NEUTRAL");
     230                 :            :     }
     231                 :          0 :     menuprint("\n\n1: hand-to-hand combat");
     232                 :          0 :     menuprint("\n2: missile combat");
     233                 :          0 :     menuprint("\n3: spellcasting");
     234                 :          0 :     menuprint("\n4: thieving");
     235                 :          0 :     menuprint("\n5: escape");
     236                 :          0 :     menuprint("\n\nEnter NPC response to combat: ");
     237                 :          0 :     showmenu();
     238                 :          0 :     response = '0';
     239 [ #  # ][ #  # ]:          0 :     while ((response != '1') && 
     240         [ #  # ]:          0 :            (response != '2') &&
     241         [ #  # ]:          0 :            (response != '3') &&
     242         [ #  # ]:          0 :            (response != '4') &&
     243                 :            :            (response != '5'))
     244                 :          0 :       response = menugetc();
     245                 :          0 :     menuaddch(response);
     246                 :          0 :     npcbehavior+=10*(response - '0');
     247                 :          0 :     npcbehavior+=100*competence_check(response-'0');
     248                 :          0 :     response = '0';
     249                 :          0 :     menuclear();
     250                 :          0 :     menuprint("1: threaten");
     251                 :          0 :     menuprint("\n2: greet");
     252                 :          0 :     menuprint("\n3: aid");
     253                 :          0 :     menuprint("\n4: beg");
     254                 :          0 :     menuprint("\n5: silence");
     255                 :          0 :     menuprint("\n\nEnter NPC response to conversation: ");
     256                 :          0 :     showmenu();
     257 [ #  # ][ #  # ]:          0 :     while ((response != '1') && 
     258         [ #  # ]:          0 :            (response != '2') &&
     259         [ #  # ]:          0 :            (response != '3') &&
     260         [ #  # ]:          0 :            (response != '4') &&
     261                 :            :            (response != '5'))
     262                 :          0 :       response = menugetc();
     263                 :          0 :     menuaddch(response);
     264                 :          0 :     npcbehavior+=1000*(response - '0');
     265                 :          0 :     xredraw();
     266                 :            :   }
     267                 :          0 :   Behavior = npcbehavior;
     268                 :          0 :   return(npcbehavior);
     269                 :            : }
     270                 :            : 
     271                 :            : 
     272                 :            : /* estimates on a 0..9 scale how good a player is at something */
     273                 :          0 : int competence_check(int attack)
     274                 :            : {
     275                 :          0 :   int ability = 0;
     276   [ #  #  #  #  :          0 :   switch(attack) {
                   #  # ]
     277                 :            :   case 1: /* melee */
     278                 :          0 :     ability += statmod(Player.str);
     279                 :            :   case 2: /* missle */
     280                 :          0 :     ability += statmod(Player.dex);
     281                 :          0 :     ability += Player.rank[LEGION];
     282                 :          0 :     ability += ((int) (Player.dmg / 10) - 1);
     283                 :          0 :     break;
     284                 :            :   case 3: /* spellcasting */
     285                 :          0 :     ability += statmod(Player.iq);
     286                 :          0 :     ability += statmod(Player.pow);
     287                 :          0 :     ability += Player.rank[CIRCLE];
     288                 :          0 :     ability += Player.rank[COLLEGE];
     289                 :          0 :     ability += Player.rank[PRIEST];
     290                 :          0 :     break;
     291                 :            :   case 4: /* thieving */
     292                 :          0 :     ability += statmod(Player.dex);
     293                 :          0 :     ability += statmod(Player.agi);
     294                 :          0 :     ability += Player.rank[THIEVES];
     295                 :          0 :     break;
     296                 :            :   case 5: /* escape */
     297                 :          0 :     ability += 2 * statmod(Player.agi);
     298                 :          0 :     break;
     299                 :            :   }
     300                 :          0 :   ability += ((int) (Player.level / 5));
     301         [ #  # ]:          0 :   if (ability < 0) ability = 0;
     302         [ #  # ]:          0 :   if (ability > 9) ability = 9;
     303                 :          0 :   return(ability);
     304                 :            : }
     305                 :            : 
     306                 :          0 : static int user_character_strength (void)
     307                 :            : {
     308                 :            :   int num;
     309                 :            : 
     310                 :          0 :   cinema_blank();
     311                 :          0 :   num = (int)cinema_getnum_line(0, "How many pounds can you bench press? ");
     312                 :            : 
     313         [ #  # ]:          0 :   if (num < 30) return 3;
     314         [ #  # ]:          0 :   if (num < 90) return num / 10;
     315                 :            :   
     316                 :          0 :   num = (num - 120) / 30 + 9;
     317                 :            : 
     318         [ #  # ]:          0 :   if (num > 18)
     319                 :            :     {
     320                 :          0 :       num = 18;
     321                 :          0 :       cinema_scene("Right, make me believe THAT's true.",
     322                 :            :                    "Even if it's true, I don't believe it.", 0);
     323                 :            :     }
     324                 :            : 
     325                 :          0 :   return num;
     326                 :            : }
     327                 :            : 
     328                 :          0 : static int user_character_iq_test (void)
     329                 :            : {
     330                 :          0 :   int num = 0;
     331                 :            : 
     332                 :          0 :   cinema_blank();
     333         [ #  # ]:          0 :   if ('y' == cinema_ynq_line(0, "Took an official IQ test? [yn] "))
     334                 :            :     {
     335                 :          0 :       num = (int)cinema_getnum_line(1, "So, whadja get? ");
     336                 :          0 :       num /= 10;
     337                 :            : 
     338         [ #  # ]:          0 :       if (num > 18)
     339                 :            :         {
     340                 :          0 :           num = 18;
     341                 :          0 :           cinema_scene("I'm not convinced...",
     342                 :            :                        "If you're so smart, why aren't you rich?", 0);
     343                 :            :         }
     344                 :            :     }
     345                 :            : 
     346                 :          0 :   return num;
     347                 :            : }
     348                 :            : 
     349                 :          0 : static int user_character_undergraduate_exam (void)
     350                 :            : {
     351                 :          0 :   int num = 0;
     352                 :          0 :   char * prompt = "Took Undergraduate entrance exams? [yn] ";
     353                 :            : 
     354                 :          0 :   cinema_blank();
     355         [ #  # ]:          0 :   if ('y' == cinema_ynq_line(0, prompt))
     356                 :            :     {
     357                 :            :       while (1)
     358                 :            :         {
     359                 :          0 :           num = (int)cinema_getnum_line(1, "So, what percentile? ");
     360         [ #  # ]:          0 :           if (num < 100) break;
     361                 :            : 
     362                 :          0 :           cinema_scene("That's impossible!", 0, 0);
     363                 :          0 :           cinema_print_line(0, prompt);
     364                 :          0 :         }
     365                 :            : 
     366                 :          0 :       num = 9 * (num - 49) / 50 + 9;
     367                 :            :     }
     368                 :            : 
     369                 :          0 :   return num;
     370                 :            : }
     371                 :            : 
     372                 :          0 : static int user_character_graduate_exam (void)
     373                 :            : {
     374                 :          0 :   int num = 0;
     375                 :          0 :   char * prompt = "Took Graduate entrance exams? [yn] ";
     376                 :            : 
     377                 :          0 :   cinema_blank();
     378         [ #  # ]:          0 :   if ('y' == cinema_ynq_line(0, prompt))
     379                 :            :     {
     380                 :            :       while (1)
     381                 :            :         {
     382                 :          0 :           num = (int)cinema_getnum_line(1, "So, what percentile? ");
     383         [ #  # ]:          0 :           if (num < 100) break;
     384                 :            : 
     385                 :          0 :           cinema_scene("That's impossible!", 0, 0);
     386                 :          0 :           cinema_print_line(0, prompt);
     387                 :          0 :         }
     388                 :            : 
     389                 :          0 :       num = 9 * (num - 49) / 50 + 9;
     390                 :            :     }
     391                 :            : 
     392                 :          0 :   return num;
     393                 :            : }
     394                 :            : 
     395                 :          0 : static int user_character_dumb (void)
     396                 :            : {
     397                 :            :   int num;
     398                 :            : 
     399                 :          0 :   cinema_blank();
     400         [ #  # ]:          0 :   if ('y' == cinema_ynq_line(0, "Pretty dumb, aren't you? [yn] "))
     401                 :            :     {
     402                 :          0 :       num = 3 + random_range(3);
     403                 :          0 :       cinema_print_line(1, "I thought so...");
     404                 :            :     }
     405                 :            :   else
     406                 :            :     {
     407                 :          0 :       num = 6 + random_range(6);
     408                 :          0 :       cinema_print_line(1, "Well, not *that* dumb.");
     409                 :            :     }
     410                 :            : 
     411                 :          0 :   morewait();
     412                 :          0 :   return num;
     413                 :            : }
     414                 :            : 
     415                 :          0 : static int user_character_dance (void)
     416                 :            : {
     417                 :          0 :   cinema_blank();
     418         [ #  # ]:          0 :   if ('y' != cinema_ynq_line(0, "Can you dance? [yn] ")) return 0;
     419         [ #  # ]:          0 :   if ('y' != cinema_ynq_line(1, "Well? [yn] ")) return 1;
     420                 :          0 :   return 3;
     421                 :            : }
     422                 :            : 
     423                 :          0 : static int user_character_martial_art (void)
     424                 :            : {
     425                 :          0 :   cinema_blank();
     426         [ #  # ]:          0 :   if ('y' != cinema_ynq_line(0, "Do you have training in a martial art or gymnastics? [yn] ")) return 0;
     427         [ #  # ]:          0 :   if ('y' != cinema_ynq_line(1, "Do you have dan rank or equivalent? [yn] ")) return 2;
     428                 :          0 :   return 6;
     429                 :            : }
     430                 :            : 
     431                 :          0 : static int user_character_field_sport (void)
     432                 :            : {
     433                 :          0 :   cinema_blank();
     434         [ #  # ]:          0 :   if ('y' != cinema_ynq_line(0, "Do you play some field sport? [yn] ")) return 0;
     435         [ #  # ]:          0 :   if ('y' != cinema_ynq_line(1, "Are you good? [yn] ")) return 1;
     436                 :          0 :   return 2;
     437                 :            : }
     438                 :            : 
     439                 :          0 : static int user_character_cave (void)
     440                 :            : {
     441                 :          0 :   cinema_blank();
     442         [ #  # ]:          0 :   if ('y' != cinema_ynq_line(0, "Do you cave, mountaineer, etc.? [yn] ")) return 0;
     443                 :          0 :   return 3;
     444                 :            : }
     445                 :            : 
     446                 :          0 : static int user_character_skate (void)
     447                 :            : {
     448                 :          0 :   cinema_blank();
     449         [ #  # ]:          0 :   if ('y' != cinema_ynq_line(0, "Do you skate or ski? [yn] ")) return 0;
     450         [ #  # ]:          0 :   if ('y' != cinema_ynq_line(1, "Well? [yn] ")) return 2;
     451                 :          0 :   return 4;
     452                 :            : }
     453                 :            : 
     454                 :          0 : static int user_character_handicapped (void)
     455                 :            : {
     456                 :          0 :   cinema_blank();
     457         [ #  # ]:          0 :   if ('y' != cinema_ynq_line(0, "Are you physically handicapped? [yn] ")) return 0;
     458                 :          0 :   return -4;
     459                 :            : }
     460                 :            : 
     461                 :          0 : static int user_character_accident_prone (void)
     462                 :            : {
     463                 :          0 :   cinema_blank();
     464         [ #  # ]:          0 :   if ('y' != cinema_ynq_line(0, "Are you accident prone? [yn] ")) return 0;
     465                 :          0 :   return -4;
     466                 :            : }
     467                 :            : 
     468                 :          0 : static int user_character_bicycle (void)
     469                 :            : {
     470                 :          0 :   cinema_blank();
     471         [ #  # ]:          0 :   if ('y' == cinema_ynq_line(0, "Can you ride a bicycle? [yn] ")) return 0;
     472                 :          0 :   return -4;
     473                 :            : }
     474                 :            : 
     475                 :          0 : static int user_character_video_games (void)
     476                 :            : {
     477                 :          0 :   cinema_blank();
     478         [ #  # ]:          0 :   if ('y' != cinema_ynq_line(0, "Do you play video games? [yn] ")) return 0;
     479         [ #  # ]:          0 :   if ('y' != cinema_ynq_line(1, "Do you get high scores? [yn] ")) return 2;
     480                 :          0 :   return 6;
     481                 :            : }
     482                 :            : 
     483                 :          0 : static int user_character_archer (void)
     484                 :            : {
     485                 :          0 :   cinema_blank();
     486         [ #  # ]:          0 :   if ('y' != cinema_ynq_line(0, "Are you an archer, fencer, or marksman? [yn] ")) return 0;
     487         [ #  # ]:          0 :   if ('y' != cinema_ynq_line(1, "A good one? [yn] ")) return 2;
     488                 :          0 :   return 6;
     489                 :            : }
     490                 :            : 
     491                 :          0 : static int user_character_picked_lock (void)
     492                 :            : {
     493                 :          0 :   cinema_blank();
     494         [ #  # ]:          0 :   if ('y' != cinema_ynq_line(0, "Have you ever picked a lock? [yn] ")) return 0;
     495                 :            : 
     496                 :          0 :   cinema_print_line(1, "Really? Well, the police are being notified.");
     497                 :          0 :   usleep(250000);
     498                 :          0 :   cinema_print_line(1, "Really? Well, the police are being notified..");
     499                 :          0 :   usleep(250000);
     500                 :          0 :   cinema_print_line(1, "Really? Well, the police are being notified...");
     501                 :          0 :   usleep(250000);
     502                 :          0 :   cinema_print_line(1, "Really? Well, the police are being notified....");
     503                 :          0 :   usleep(250000);
     504                 :          0 :   cinema_print_line(1, "Really? Well, the police are being notified.... done!");
     505                 :          0 :   morewait();
     506                 :            : 
     507                 :          0 :   return 2;
     508                 :            : }
     509                 :            : 
     510                 :          0 : static int user_character_typing_speed (void)
     511                 :            : {
     512                 :            :   int num;
     513                 :            : 
     514                 :          0 :   cinema_blank();
     515                 :          0 :   num = (int)cinema_getnum_line(0, "What's your typing speed (words per minute)? ");
     516                 :            : 
     517         [ #  # ]:          0 :   if (num > 124)
     518                 :            :     {
     519                 :          0 :       num = 124;
     520                 :          0 :       cinema_print_line(1, "Tell me another one...");
     521                 :          0 :       morewait();
     522                 :            :     }
     523                 :            : 
     524                 :          0 :   return num / 25;
     525                 :            : }
     526                 :            : 
     527                 :          0 : static int user_character_hand_shakes (void)
     528                 :            : {
     529                 :          0 :   cinema_blank();
     530         [ #  # ]:          0 :   if ('y' != cinema_ynq_line(0, "Hold your arm out. Tense your fist. Hand shaking? [yn] ")) return 0;
     531                 :          0 :   return -3;
     532                 :            : }
     533                 :            : 
     534                 :          0 : static int user_character_ambidextrous (void)
     535                 :            : {
     536                 :          0 :   cinema_blank();
     537         [ #  # ]:          0 :   if ('y' != cinema_ynq_line(0, "Ambidextrous, are you? [yn] ")) return 0;
     538                 :          0 :   return 4;
     539                 :            : }
     540                 :            : 
     541                 :          0 : static int user_character_can_cut_deck (void)
     542                 :            : {
     543                 :          0 :   cinema_blank();
     544         [ #  # ]:          0 :   if ('y' != cinema_ynq_line(0, "Can you cut a deck of cards with one hand? [yn] ")) return 0;
     545                 :          0 :   return 2;
     546                 :            : }
     547                 :            : 
     548                 :          0 : static int user_character_can_tie_shoes (void)
     549                 :            : {
     550                 :          0 :   cinema_blank();
     551         [ #  # ]:          0 :   if ('y' == cinema_ynq_line(0, "Can you tie your shoes blindfolded? [yn] ")) return 0;
     552                 :          0 :   return -3;
     553                 :            : }
     554                 :            : 
     555                 :          0 : static int user_character_colds (void)
     556                 :            : {
     557                 :          0 :   cinema_blank();
     558         [ #  # ]:          0 :   if ('y' != cinema_ynq_line(0, "Do you ever get colds? [yn] ")) return 4;
     559         [ #  # ]:          0 :   if ('y' != cinema_ynq_line(1, "Frequently? [yn] ")) return 0;
     560                 :          0 :   return -4;
     561                 :            : }
     562                 :            : 
     563                 :          0 : static int user_character_recent_accident (void)
     564                 :            : {
     565                 :          0 :   cinema_blank();
     566         [ #  # ]:          0 :   if ('y' == cinema_ynq_line(0, "Had any serious accident or illness this year? [yn] ")) return -4;
     567                 :          0 :   return 4;
     568                 :            : }
     569                 :            : 
     570                 :          0 : static int user_character_chronic_disease (void)
     571                 :            : {
     572                 :          0 :   cinema_blank();
     573         [ #  # ]:          0 :   if ('y' == cinema_ynq_line(0, "Have a chronic disease? [yn] ")) return -4;
     574                 :          0 :   return 0;
     575                 :            : }
     576                 :            : 
     577                 :          0 : static int user_character_overweight (void)
     578                 :            : {
     579                 :          0 :   cinema_blank();
     580         [ #  # ]:          0 :   if ('y' == cinema_ynq_line(0, "Overweight or underweight by more than 20 percent? [yn] ")) return -2;
     581                 :          0 :   return 0;
     582                 :            : }
     583                 :            : 
     584                 :          0 : static int user_character_high_blood_pressure (void)
     585                 :            : {
     586                 :          0 :   cinema_blank();
     587         [ #  # ]:          0 :   if ('y' == cinema_ynq_line(0, "High blood pressure? [yn] ")) return -2;
     588                 :          0 :   return 0;
     589                 :            : }
     590                 :            : 
     591                 :          0 : static int user_character_smoke (void)
     592                 :            : {
     593                 :          0 :   cinema_blank();
     594         [ #  # ]:          0 :   if ('y' != cinema_ynq_line(0, "Do you smoke? [yn] ")) return 0;
     595                 :            : 
     596                 :          0 :   cinema_print_line(1, "*cough*");
     597                 :          0 :   morewait();
     598                 :            : 
     599                 :          0 :   return -3;
     600                 :            : }
     601                 :            : 
     602                 :          0 : static int user_character_aerobics (void)
     603                 :            : {
     604                 :          0 :   cinema_blank();
     605         [ #  # ]:          0 :   if ('y' != cinema_ynq_line(0, "Take aerobics classes? [yn] ")) return 0;
     606                 :          0 :   return 2;
     607                 :            : }
     608                 :            : 
     609                 :          0 : static int user_character_miles_run (void)
     610                 :            : {
     611                 :            :   int num;
     612                 :            : 
     613                 :          0 :   cinema_blank();
     614                 :          0 :   num = (int)cinema_getnum_line(0, "How many miles can you run? ");
     615                 :            : 
     616         [ #  # ]:          0 :   if (num < 1) return -3;
     617         [ #  # ]:          0 :   if (num < 5) return 2;
     618         [ #  # ]:          0 :   if (num < 10) return 4;
     619         [ #  # ]:          0 :   if (num < 26) return 8;
     620                 :            : 
     621                 :          0 :   cinema_print_line(1, "Right. Sure. Give me a break.");
     622                 :          0 :   morewait();
     623                 :            : 
     624                 :          0 :   return 8;
     625                 :            : }
     626                 :            : 
     627                 :          0 : static int user_character_animals (void)
     628                 :            : {
     629                 :          0 :   cinema_blank();
     630         [ #  # ]:          0 :   if ('y' != cinema_ynq_line(0, "Do animals react oddly to your presence? [yn] ")) return 0;
     631                 :            : 
     632                 :          0 :   cinema_print_line(1, "How curious that must be.");
     633                 :          0 :   morewait();
     634                 :            : 
     635                 :          0 :   return 2;
     636                 :            : }
     637                 :            : 
     638                 :          0 : static int user_character_auras (void)
     639                 :            : {
     640                 :          0 :   cinema_blank();
     641         [ #  # ]:          0 :   if ('y' != cinema_ynq_line(0, "Can you see auras? [yn] ")) return 0;
     642                 :            : 
     643                 :          0 :   cinema_print_line(1, "How strange.");
     644                 :          0 :   morewait();
     645                 :            : 
     646                 :          0 :   return 3;
     647                 :            : }
     648                 :            : 
     649                 :          0 : static int user_character_out_of_body (void)
     650                 :            : {
     651                 :          0 :   cinema_blank();
     652         [ #  # ]:          0 :   if ('y' != cinema_ynq_line(0, "Ever have an out-of-body experience? [yn] ")) return 0;
     653                 :            : 
     654                 :          0 :   cinema_print_line(1, "Wow, man! Fly the friendly skies...");
     655                 :          0 :   morewait();
     656                 :            : 
     657                 :          0 :   return 3;
     658                 :            : }
     659                 :            : 
     660                 :          0 : static int user_character_spell (void)
     661                 :            : {
     662                 :          0 :   cinema_blank();
     663         [ #  # ]:          0 :   if ('y' != cinema_ynq_line(0, "Did you ever cast a spell? [yn] ")) return 0;
     664         [ #  # ]:          0 :   if ('y' != cinema_ynq_line(1, "Did it work? [yn] ")) return 3;
     665                 :            : 
     666                 :          0 :   cinema_print_line(2, "Sure it did...");
     667                 :          0 :   morewait();
     668                 :            : 
     669                 :          0 :   return 7;
     670                 :            : }
     671                 :            : 
     672                 :          0 : static int user_character_esp (void)
     673                 :            : {
     674                 :          0 :   cinema_blank();
     675         [ #  # ]:          0 :   if ('y' != cinema_ynq_line(0, "Do you have ESP? [yn] ")) return 0;
     676                 :            : 
     677                 :          0 :   cinema_print_line(1, "Somehow, I knew you were going to say that.");
     678                 :          0 :   morewait();
     679                 :            : 
     680                 :          0 :   return 3;
     681                 :            : }
     682                 :            : 
     683                 :          0 : static int user_character_pk (void)
     684                 :            : {
     685                 :          0 :   cinema_blank();
     686         [ #  # ]:          0 :   if ('y' != cinema_ynq_line(0, "Do you have PK? [yn] ")) return 0;
     687                 :            : 
     688                 :          0 :   cinema_print_line(1, "I can't tell you how much that moves me.");
     689                 :          0 :   morewait();
     690                 :            : 
     691                 :          0 :   return 6;
     692                 :            : }
     693                 :            : 
     694                 :          0 : static int user_character_ghosts (void)
     695                 :            : {
     696                 :          0 :   cinema_blank();
     697         [ #  # ]:          0 :   if ('y' != cinema_ynq_line(0, "Do you believe in ghosts? [yn] ")) return 0;
     698                 :            : 
     699                 :          0 :   cinema_print_line(1, "I do! I do! I do believe in ghosts!");
     700                 :          0 :   morewait();
     701                 :            : 
     702                 :          0 :   return 2;
     703                 :            : }
     704                 :            : 
     705                 :          0 : static int user_character_irish (void)
     706                 :            : {
     707                 :          0 :   cinema_blank();
     708         [ #  # ]:          0 :   if ('y' != cinema_ynq_line(0, "Are you Irish? [yn] ")) return 0;
     709                 :            : 
     710                 :          0 :   cinema_print_line(1, "Is that blarney or what?");
     711                 :          0 :   morewait();
     712                 :            : 
     713                 :          0 :   return 2;
     714                 :            : }
     715                 :            : 
     716                 :          0 : void user_character_stats(void)
     717                 :            : {
     718                 :            :   int num;
     719                 :          0 :   int iqpts = 0;
     720                 :          0 :   int agipts = 0;
     721                 :          0 :   int dexpts = 0;
     722                 :          0 :   int powpts = 0;
     723                 :          0 :   int conpts = 0;
     724                 :          0 :   int numints = 0;
     725                 :            : 
     726                 :          0 :   cinema_scene("OK, now try to answer the following questions honestly:", 0, 0);
     727                 :            : 
     728                 :          0 :   Player.str = Player.maxstr = user_character_strength();
     729                 :            : 
     730                 :          0 :   num = user_character_iq_test();
     731         [ #  # ]:          0 :   if (num) ++numints;
     732                 :          0 :   iqpts += num;
     733                 :            : 
     734                 :          0 :   num = user_character_undergraduate_exam();
     735         [ #  # ]:          0 :   if (num) ++numints;
     736                 :          0 :   iqpts += num;
     737                 :            : 
     738                 :          0 :   num = user_character_graduate_exam();
     739         [ #  # ]:          0 :   if (num) ++numints;
     740                 :          0 :   iqpts += num;
     741                 :            : 
     742         [ #  # ]:          0 :   if (0 == numints)
     743                 :          0 :     Player.iq = user_character_dumb();
     744                 :            :   else
     745                 :          0 :     Player.iq = iqpts / numints;
     746                 :            : 
     747                 :          0 :   Player.maxiq = Player.iq;
     748                 :            : 
     749                 :          0 :   agipts += user_character_dance();
     750                 :          0 :   agipts += user_character_martial_art();
     751                 :          0 :   agipts += user_character_field_sport();
     752                 :          0 :   agipts += user_character_cave();
     753                 :          0 :   agipts += user_character_skate();
     754                 :          0 :   agipts += user_character_handicapped();
     755                 :          0 :   agipts += user_character_accident_prone();
     756                 :          0 :   agipts += user_character_bicycle();
     757                 :            : 
     758                 :          0 :   Player.agi = Player.maxagi = 9 + agipts / 2;
     759                 :            : 
     760                 :          0 :   dexpts += user_character_video_games();
     761                 :          0 :   dexpts += user_character_archer();
     762                 :          0 :   dexpts += user_character_picked_lock();
     763                 :          0 :   dexpts += user_character_typing_speed();
     764                 :          0 :   dexpts += user_character_hand_shakes();
     765                 :          0 :   dexpts += user_character_ambidextrous();
     766                 :          0 :   dexpts += user_character_can_cut_deck();
     767                 :          0 :   dexpts += user_character_can_tie_shoes();
     768                 :            : 
     769                 :          0 :   Player.dex = Player.maxdex = 6 + dexpts / 2;
     770                 :            : 
     771                 :          0 :   conpts += user_character_colds();
     772                 :          0 :   conpts += user_character_recent_accident();
     773                 :          0 :   conpts += user_character_chronic_disease();
     774                 :          0 :   conpts += user_character_overweight();
     775                 :          0 :   conpts += user_character_high_blood_pressure();
     776                 :          0 :   conpts += user_character_smoke();
     777                 :          0 :   conpts += user_character_aerobics();
     778                 :          0 :   conpts += user_character_miles_run();
     779                 :            : 
     780                 :          0 :   Player.con = Player.maxcon = 12 + conpts / 3;
     781                 :            : 
     782                 :          0 :   powpts += user_character_animals();
     783                 :          0 :   powpts += user_character_auras();
     784                 :          0 :   powpts += user_character_out_of_body();
     785                 :          0 :   powpts += user_character_spell();
     786                 :          0 :   powpts += user_character_esp();
     787                 :          0 :   powpts += user_character_pk();
     788                 :          0 :   powpts += user_character_ghosts();
     789                 :          0 :   powpts += user_character_irish();
     790                 :            : 
     791                 :          0 :   Player.pow = Player.maxpow = 3 + powpts / 2;
     792                 :            : 
     793                 :          0 :   Player.preference =
     794                 :          0 :     cinema_interact("mfyn", "Are you sexually interested in males or females? ", 0, 0);
     795                 :          0 : }
     796                 :            : 
     797                 :            : 
     798                 :            : 
     799                 :          0 : void omegan_character_stats(void)
     800                 :            : {
     801                 :          0 :   int share1,share2,i=0;
     802                 :          0 :   print1("To reroll hit ESCAPE; hit any other key to accept these stats.");
     803                 :            :   do {
     804                 :          0 :     i++;
     805                 :            : #if REROLLS == -1
     806                 :          0 :     sprintf(Str1, "Generated character # %d", i );
     807                 :            : #else
     808                 :            :     sprintf(Str1, "You have only %d chance%s to reroll... ", REROLLS - i,
     809                 :            :             (i == (REROLLS-1) ) ? "":"s");
     810                 :            : #endif
     811                 :          0 :     print2(Str1);
     812                 :          0 :     Player.iq = Player.maxiq = 4 + random_range(5)+
     813                 :          0 :       (share1 = random_range(6)) + (share2 = random_range(6));
     814                 :          0 :     Player.pow = Player.maxpow = 4 + random_range(5) + share1 +share2;
     815                 :          0 :     Player.dex = Player.maxdex = 4 + random_range(5)+
     816                 :          0 :       (share1 = random_range(6)) + (share2 = random_range(6));
     817                 :          0 :     Player.agi = Player.maxagi = 4 + random_range(5) + share1 +share2;
     818                 :          0 :     Player.str = Player.maxstr = 4 + random_range(5)+
     819                 :          0 :       (share1 = random_range(6)) + (share2 = random_range(6));
     820                 :          0 :     Player.con = Player.maxcon = 4 + random_range(5) + share1 +share2;
     821                 :          0 :     Player.cash = random_range(100)+random_range(100)+
     822                 :          0 :       random_range(100)+random_range(100)+random_range(100);
     823                 :          0 :     Player.hp=Player.maxhp=Player.con;
     824                 :          0 :     Player.mana=Player.maxmana = calcmana();
     825                 :          0 :     calc_melee();
     826                 :          0 :     dataprint();
     827                 :            : #if REROLLS == -1
     828         [ #  # ]:          0 :   } while (mgetc() == ESCAPE);
     829                 :            : #else
     830                 :            :   } while ((i < REROLLS) && (mgetc() == ESCAPE));
     831                 :            : #endif
     832                 :          0 :   clearmsg();
     833                 :          0 :   print1("Please enter your character's name: ");
     834                 :          0 :   strcpy(Player.name,msgscanstring());
     835 [ #  # ][ #  # ]:          0 :   if (Player.name[0] >= 'a' && Player.name[0] <= 'z')
     836                 :          0 :     Player.name[0] += 'A'-'a'; /* capitalise 1st letter */
     837                 :          0 :   print1("Is your character sexually interested in males or females? [mf] ");
     838                 :          0 :   do Player.preference = (char) mcigetc();
     839 [ #  # ][ #  # ]:          0 :   while ((Player.preference != 'm') && (Player.preference != 'f') &&
     840 [ #  # ][ #  # ]:          0 :         (Player.preference != 'y') && (Player.preference != 'n')); /* :-) */
     841                 :            : 
     842                 :          0 : }
     843                 :            : 

Generated by: LCOV version 1.11