File: char.c

package info (click to toggle)
omega-rpg 1%3A0.90-pa9-16
  • links: PTS
  • area: main
  • in suites: bullseye, buster, stretch
  • size: 2,764 kB
  • ctags: 5,047
  • sloc: ansic: 38,528; makefile: 112; sh: 17
file content (843 lines) | stat: -rw-r--r-- 21,242 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
/* omega copyright (C) by Laurence Raphael Brothers, 1987,1988,1989 */
/* char.c */
/* Player generation */

#ifndef MSDOS_SUPPORTED_ANTIQUE
#include <sys/types.h>
#include <unistd.h>
#include <pwd.h>
#endif

#include "glob.h"

/* set player to begin with */
int initplayer(void)
{
  int i;
  int oldchar=FALSE;
  FILE *fd;
  char *lname;
  int loaded = FALSE;
#ifndef MSDOS
  struct passwd *dastuff;
#endif

  lname = getlogin();
#ifndef MSDOS
  if (!lname || strlen(lname) == 0)
    {
      dastuff = getpwuid(getuid());
      lname = dastuff->pw_name;
    }
#endif
  strcpy(Player.name,lname);
  if (Player.name[0] >= 'a' && Player.name[0] <= 'z')
    Player.name[0] += 'A'-'a'; /* capitalise 1st letter */
  Player.itemweight = 0;
  Player.food = 36; 
  Player.packptr = 0;
  Behavior = -1;
  Player.options = 0;
  for (i=0;i<MAXITEMS;i++)
    Player.possessions[i] = NULL;
  for (i=0;i<MAXPACK;i++)
    Player.pack[i] = NULL;
  for (i=0;i<NUMIMMUNITIES;i++) Player.immunity[i] = 0;
  for (i=0;i<NUMSTATI;i++) Player.status[i] = 0;
  for (i=0;i<NUMRANKS;i++) {
    Player.rank[i] = 0;
    Player.guildxp[i] = 0;
  }
  Player.patron = 0;
  Player.alignment = 0;
  Player.cash = 250;
  change_to_user_perms();
  if ((fd=omegarc_check())!=NULL) {
    fread((char *)&i,sizeof(int),1,fd);
    if (i != VERSION) {
#if defined(MSDOS) || defined(AMIGA)
      print1("Out of date omega.rc! Make another!");
#else
      print1("Out of date .omegarc! Make another!");
#endif
      morewait();
    }
    else {
      oldchar = TRUE;
      fread((char *)&Player,sizeof(Player),1,fd);
      fread((char *)&Searchnum,sizeof(int),1,fd);
      fread((char *)&Verbosity,sizeof(char),1,fd);
      strcpy(Player.name,lname);
      if (Player.name[0] >= 'a' && Player.name[0] <= 'z')
        Player.name[0] += 'A'-'a'; /* capitalise 1st letter */
    }
    fclose(fd);
  }
  change_to_game_perms();
  if (! oldchar) {
    optionset(RUNSTOP);
    optionset(CONFIRM);
#ifdef COMPRESS_SAVE_FILES
    optionset(COMPRESS_OPTION);
#endif
    optionset(SHOW_COLOUR);
    loaded = initstats() ; /* RM 04-19-2000:loading patch */ /* DAG */
  }
  /* This gets executed when the player loads from .omegarc */
  /* DAG - put the code back in the same place, rather than duplicating */
  Searchnum = max(1,min(9,Searchnum));
  if (!loaded) {
	  Player.hp = Player.maxhp = Player.maxcon;
	  Player.mana = Player.maxmana = calcmana();
	  Player.click = 1;
	  strcpy(Player.meleestr,"CCBC");
  }
  calc_melee();
  ScreenOffset = -1000;	/* to force a redraw */
  return loaded; /* RM 04-19-2000: loading patch */ /* DAG */
}


FILE *omegarc_check(void)
{
  FILE *fd;
#if defined(MSDOS) || defined(AMIGA)
  if ((fd = fopen("omega.rc","rb")) != NULL) {
    print2("Use omega.rc charcter record in current directory? [yn] ");
#else
    snprintf(Str1, sizeof(Str1)-1, "%s/.omegarc", getenv("HOME"));
    if ((fd = fopen(Str1,"r")) != NULL) {
      print2("Use .omegarc in home directory? [yn] ");
#endif
      if (ynq2()!='y') {
        fclose(fd);
        fd = NULL;
      }
    }
    clearmsg();
    return(fd);
  }

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();
#if defined(MSDOS) || defined(AMIGA)
    print1("Do you want to save this set-up to omega.rc in this directory? [yn] ");
#else
    print1("Do you want to save this set-up to .omegarc in your home directory? [yn] ");
#endif
    if (ynq1()=='y')
      save_omegarc();
  }
  xredraw();
  return FALSE;
}

void save_omegarc(void)
{
  int i=VERSION;
  FILE *fd;
  change_to_user_perms();
#if defined(MSDOS) || defined(AMIGA)
  fd = fopen("omega.rc","wb");
#else
  snprintf(Str1, sizeof(Str1)-1, "%s/.omegarc", getenv("HOME"));
  fd = fopen(Str1,"w");
#endif
  if (fd == NULL)
#if defined(MSDOS) || defined(AMIGA)
    print1("Sorry, couldn't save omega.rc for some reason.");
#else
    print1("Sorry, couldn't save .omegarc for some reason.");
#endif
  else {
    fwrite((char *)&i,sizeof(int),1,fd);
    print1("First, set options.");
    setoptions();
    fwrite((char *)&Player,sizeof(Player),1,fd);
    fwrite((char *)&Searchnum,sizeof(int),1,fd);
    fwrite((char *)&Verbosity,sizeof(char),1,fd);
    fclose(fd);
  }
  change_to_game_perms();
}



long calcmana(void)
{
  return(Player.pow * (long)(Player.level+1));
}


/*  npcbehavior digits 1234

4 : alignment (LAWFUL,CHAOTIC, or NEUTRAL)
3 : primary combat action (melee,missile,spell,thief,flight,1..5)
2 : competence at 4 (0..9, 0 = incompetent, 9 = masterful)
1 : conversation mode

status : 1 = dead, 2 = saved, 3 = retired, 4 = still playing
*/
int fixnpc(int status)
{
  int npcbehavior=0;
  char response;
  if (status == 1) { /* player is dead, all undead are chaotic */
    npcbehavior+=CHAOTIC;
    npcbehavior+=10; /* melee */
    npcbehavior+=100*min(9,((int) (Player.level/3)));
    npcbehavior+=1000; /* threaten */
  }
  else if (Behavior >= 0)
    npcbehavior = Behavior;
  else {
    menuclear();
    menuprint("NPC Behavior Determination Module\n\n");
    menuprint("Your overall NPC behavior is:");
    if (Player.alignment < -10) {
      npcbehavior += CHAOTIC;
      menuprint("\n\n CHAOTIC");
    }
    else if (Player.alignment > 10) {
      npcbehavior += LAWFUL;
      menuprint("\n\n LAWFUL");
    }
    else {
      npcbehavior += NEUTRAL;
      menuprint("\n\n NEUTRAL");
    }
    menuprint("\n\n1: hand-to-hand combat");
    menuprint("\n2: missile combat");
    menuprint("\n3: spellcasting");
    menuprint("\n4: thieving");
    menuprint("\n5: escape");
    menuprint("\n\nEnter NPC response to combat: ");
    showmenu();
    response = '0';
    while ((response != '1') && 
	   (response != '2') &&
	   (response != '3') &&
	   (response != '4') &&
	   (response != '5'))
      response = menugetc();
    menuaddch(response);
    npcbehavior+=10*(response - '0');
    npcbehavior+=100*competence_check(response-'0');
    response = '0';
    menuclear();
    menuprint("1: threaten");
    menuprint("\n2: greet");
    menuprint("\n3: aid");
    menuprint("\n4: beg");
    menuprint("\n5: silence");
    menuprint("\n\nEnter NPC response to conversation: ");
    showmenu();
    while ((response != '1') && 
	   (response != '2') &&
	   (response != '3') &&
	   (response != '4') &&
	   (response != '5'))
      response = menugetc();
    menuaddch(response);
    npcbehavior+=1000*(response - '0');
    xredraw();
  }
  Behavior = npcbehavior;
  return(npcbehavior);
}


/* estimates on a 0..9 scale how good a player is at something */
int competence_check(int attack)
{
  int ability = 0;
  switch(attack) {
  case 1: /* melee */
    ability += statmod(Player.str);
  case 2: /* missle */
    ability += statmod(Player.dex);
    ability += Player.rank[LEGION];
    ability += ((int) (Player.dmg / 10) - 1);
    break;
  case 3: /* spellcasting */
    ability += statmod(Player.iq);
    ability += statmod(Player.pow);
    ability += Player.rank[CIRCLE];
    ability += Player.rank[COLLEGE];
    ability += Player.rank[PRIEST];
    break;
  case 4: /* thieving */
    ability += statmod(Player.dex);
    ability += statmod(Player.agi);
    ability += Player.rank[THIEVES];
    break;
  case 5: /* escape */
    ability += 2 * statmod(Player.agi);
    break;
  }
  ability += ((int) (Player.level / 5));
  if (ability < 0) ability = 0;
  if (ability > 9) ability = 9;
  return(ability);
}

static int user_character_strength (void)
{
  int num;

  cinema_blank();
  num = (int)cinema_getnum_line(0, "How many pounds can you bench press? ");

  if (num < 30) return 3;
  if (num < 90) return num / 10;
  
  num = (num - 120) / 30 + 9;

  if (num > 18)
    {
      num = 18;
      cinema_scene("Right, make me believe THAT's true.",
                   "Even if it's true, I don't believe it.", 0);
    }

  return num;
}

static int user_character_iq_test (void)
{
  int num = 0;

  cinema_blank();
  if ('y' == cinema_ynq_line(0, "Took an official IQ test? [yn] "))
    {
      num = (int)cinema_getnum_line(1, "So, whadja get? ");
      num /= 10;

      if (num > 18)
        {
          num = 18;
          cinema_scene("I'm not convinced...",
                       "If you're so smart, why aren't you rich?", 0);
        }
    }

  return num;
}

static int user_character_undergraduate_exam (void)
{
  int num = 0;
  char * prompt = "Took Undergraduate entrance exams? [yn] ";

  cinema_blank();
  if ('y' == cinema_ynq_line(0, prompt))
    {
      while (1)
        {
          num = (int)cinema_getnum_line(1, "So, what percentile? ");
          if (num < 100) break;

          cinema_scene("That's impossible!", 0, 0);
          cinema_print_line(0, prompt);
        }

      num = 9 * (num - 49) / 50 + 9;
    }

  return num;
}

static int user_character_graduate_exam (void)
{
  int num = 0;
  char * prompt = "Took Graduate entrance exams? [yn] ";

  cinema_blank();
  if ('y' == cinema_ynq_line(0, prompt))
    {
      while (1)
        {
          num = (int)cinema_getnum_line(1, "So, what percentile? ");
          if (num < 100) break;

          cinema_scene("That's impossible!", 0, 0);
          cinema_print_line(0, prompt);
        }

      num = 9 * (num - 49) / 50 + 9;
    }

  return num;
}

static int user_character_dumb (void)
{
  int num;

  cinema_blank();
  if ('y' == cinema_ynq_line(0, "Pretty dumb, aren't you? [yn] "))
    {
      num = 3 + random_range(3);
      cinema_print_line(1, "I thought so...");
    }
  else
    {
      num = 6 + random_range(6);
      cinema_print_line(1, "Well, not *that* dumb.");
    }

  morewait();
  return num;
}

static int user_character_dance (void)
{
  cinema_blank();
  if ('y' != cinema_ynq_line(0, "Can you dance? [yn] ")) return 0;
  if ('y' != cinema_ynq_line(1, "Well? [yn] ")) return 1;
  return 3;
}

static int user_character_martial_art (void)
{
  cinema_blank();
  if ('y' != cinema_ynq_line(0, "Do you have training in a martial art or gymnastics? [yn] ")) return 0;
  if ('y' != cinema_ynq_line(1, "Do you have dan rank or equivalent? [yn] ")) return 2;
  return 6;
}

static int user_character_field_sport (void)
{
  cinema_blank();
  if ('y' != cinema_ynq_line(0, "Do you play some field sport? [yn] ")) return 0;
  if ('y' != cinema_ynq_line(1, "Are you good? [yn] ")) return 1;
  return 2;
}

static int user_character_cave (void)
{
  cinema_blank();
  if ('y' != cinema_ynq_line(0, "Do you cave, mountaineer, etc.? [yn] ")) return 0;
  return 3;
}

static int user_character_skate (void)
{
  cinema_blank();
  if ('y' != cinema_ynq_line(0, "Do you skate or ski? [yn] ")) return 0;
  if ('y' != cinema_ynq_line(1, "Well? [yn] ")) return 2;
  return 4;
}

static int user_character_handicapped (void)
{
  cinema_blank();
  if ('y' != cinema_ynq_line(0, "Are you physically handicapped? [yn] ")) return 0;
  return -4;
}

static int user_character_accident_prone (void)
{
  cinema_blank();
  if ('y' != cinema_ynq_line(0, "Are you accident prone? [yn] ")) return 0;
  return -4;
}

static int user_character_bicycle (void)
{
  cinema_blank();
  if ('y' == cinema_ynq_line(0, "Can you ride a bicycle? [yn] ")) return 0;
  return -4;
}

static int user_character_video_games (void)
{
  cinema_blank();
  if ('y' != cinema_ynq_line(0, "Do you play video games? [yn] ")) return 0;
  if ('y' != cinema_ynq_line(1, "Do you get high scores? [yn] ")) return 2;
  return 6;
}

static int user_character_archer (void)
{
  cinema_blank();
  if ('y' != cinema_ynq_line(0, "Are you an archer, fencer, or marksman? [yn] ")) return 0;
  if ('y' != cinema_ynq_line(1, "A good one? [yn] ")) return 2;
  return 6;
}

static int user_character_picked_lock (void)
{
  cinema_blank();
  if ('y' != cinema_ynq_line(0, "Have you ever picked a lock? [yn] ")) return 0;

  cinema_print_line(1, "Really? Well, the police are being notified.");
  usleep(250000);
  cinema_print_line(1, "Really? Well, the police are being notified..");
  usleep(250000);
  cinema_print_line(1, "Really? Well, the police are being notified...");
  usleep(250000);
  cinema_print_line(1, "Really? Well, the police are being notified....");
  usleep(250000);
  cinema_print_line(1, "Really? Well, the police are being notified.... done!");
  morewait();

  return 2;
}

static int user_character_typing_speed (void)
{
  int num;

  cinema_blank();
  num = (int)cinema_getnum_line(0, "What's your typing speed (words per minute)? ");

  if (num > 124)
    {
      num = 124;
      cinema_print_line(1, "Tell me another one...");
      morewait();
    }

  return num / 25;
}

static int user_character_hand_shakes (void)
{
  cinema_blank();
  if ('y' != cinema_ynq_line(0, "Hold your arm out. Tense your fist. Hand shaking? [yn] ")) return 0;
  return -3;
}

static int user_character_ambidextrous (void)
{
  cinema_blank();
  if ('y' != cinema_ynq_line(0, "Ambidextrous, are you? [yn] ")) return 0;
  return 4;
}

static int user_character_can_cut_deck (void)
{
  cinema_blank();
  if ('y' != cinema_ynq_line(0, "Can you cut a deck of cards with one hand? [yn] ")) return 0;
  return 2;
}

static int user_character_can_tie_shoes (void)
{
  cinema_blank();
  if ('y' == cinema_ynq_line(0, "Can you tie your shoes blindfolded? [yn] ")) return 0;
  return -3;
}

static int user_character_colds (void)
{
  cinema_blank();
  if ('y' != cinema_ynq_line(0, "Do you ever get colds? [yn] ")) return 4;
  if ('y' != cinema_ynq_line(1, "Frequently? [yn] ")) return 0;
  return -4;
}

static int user_character_recent_accident (void)
{
  cinema_blank();
  if ('y' == cinema_ynq_line(0, "Had any serious accident or illness this year? [yn] ")) return -4;
  return 4;
}

static int user_character_chronic_disease (void)
{
  cinema_blank();
  if ('y' == cinema_ynq_line(0, "Have a chronic disease? [yn] ")) return -4;
  return 0;
}

static int user_character_overweight (void)
{
  cinema_blank();
  if ('y' == cinema_ynq_line(0, "Overweight or underweight by more than 20 percent? [yn] ")) return -2;
  return 0;
}

static int user_character_high_blood_pressure (void)
{
  cinema_blank();
  if ('y' == cinema_ynq_line(0, "High blood pressure? [yn] ")) return -2;
  return 0;
}

static int user_character_smoke (void)
{
  cinema_blank();
  if ('y' != cinema_ynq_line(0, "Do you smoke? [yn] ")) return 0;

  cinema_print_line(1, "*cough*");
  morewait();

  return -3;
}

static int user_character_aerobics (void)
{
  cinema_blank();
  if ('y' != cinema_ynq_line(0, "Take aerobics classes? [yn] ")) return 0;
  return 2;
}

static int user_character_miles_run (void)
{
  int num;

  cinema_blank();
  num = (int)cinema_getnum_line(0, "How many miles can you run? ");

  if (num < 1) return -3;
  if (num < 5) return 2;
  if (num < 10) return 4;
  if (num < 26) return 8;

  cinema_print_line(1, "Right. Sure. Give me a break.");
  morewait();

  return 8;
}

static int user_character_animals (void)
{
  cinema_blank();
  if ('y' != cinema_ynq_line(0, "Do animals react oddly to your presence? [yn] ")) return 0;

  cinema_print_line(1, "How curious that must be.");
  morewait();

  return 2;
}

static int user_character_auras (void)
{
  cinema_blank();
  if ('y' != cinema_ynq_line(0, "Can you see auras? [yn] ")) return 0;

  cinema_print_line(1, "How strange.");
  morewait();

  return 3;
}

static int user_character_out_of_body (void)
{
  cinema_blank();
  if ('y' != cinema_ynq_line(0, "Ever have an out-of-body experience? [yn] ")) return 0;

  cinema_print_line(1, "Wow, man! Fly the friendly skies...");
  morewait();

  return 3;
}

static int user_character_spell (void)
{
  cinema_blank();
  if ('y' != cinema_ynq_line(0, "Did you ever cast a spell? [yn] ")) return 0;
  if ('y' != cinema_ynq_line(1, "Did it work? [yn] ")) return 3;

  cinema_print_line(2, "Sure it did...");
  morewait();

  return 7;
}

static int user_character_esp (void)
{
  cinema_blank();
  if ('y' != cinema_ynq_line(0, "Do you have ESP? [yn] ")) return 0;

  cinema_print_line(1, "Somehow, I knew you were going to say that.");
  morewait();

  return 3;
}

static int user_character_pk (void)
{
  cinema_blank();
  if ('y' != cinema_ynq_line(0, "Do you have PK? [yn] ")) return 0;

  cinema_print_line(1, "I can't tell you how much that moves me.");
  morewait();

  return 6;
}

static int user_character_ghosts (void)
{
  cinema_blank();
  if ('y' != cinema_ynq_line(0, "Do you believe in ghosts? [yn] ")) return 0;

  cinema_print_line(1, "I do! I do! I do believe in ghosts!");
  morewait();

  return 2;
}

static int user_character_irish (void)
{
  cinema_blank();
  if ('y' != cinema_ynq_line(0, "Are you Irish? [yn] ")) return 0;

  cinema_print_line(1, "Is that blarney or what?");
  morewait();

  return 2;
}

void user_character_stats(void)
{
  int num;
  int iqpts = 0;
  int agipts = 0;
  int dexpts = 0;
  int powpts = 0;
  int conpts = 0;
  int numints = 0;

  cinema_scene("OK, now try to answer the following questions honestly:", 0, 0);

  Player.str = Player.maxstr = user_character_strength();

  num = user_character_iq_test();
  if (num) ++numints;
  iqpts += num;

  num = user_character_undergraduate_exam();
  if (num) ++numints;
  iqpts += num;

  num = user_character_graduate_exam();
  if (num) ++numints;
  iqpts += num;

  if (0 == numints)
    Player.iq = user_character_dumb();
  else
    Player.iq = iqpts / numints;

  Player.maxiq = Player.iq;

  agipts += user_character_dance();
  agipts += user_character_martial_art();
  agipts += user_character_field_sport();
  agipts += user_character_cave();
  agipts += user_character_skate();
  agipts += user_character_handicapped();
  agipts += user_character_accident_prone();
  agipts += user_character_bicycle();

  Player.agi = Player.maxagi = 9 + agipts / 2;

  dexpts += user_character_video_games();
  dexpts += user_character_archer();
  dexpts += user_character_picked_lock();
  dexpts += user_character_typing_speed();
  dexpts += user_character_hand_shakes();
  dexpts += user_character_ambidextrous();
  dexpts += user_character_can_cut_deck();
  dexpts += user_character_can_tie_shoes();

  Player.dex = Player.maxdex = 6 + dexpts / 2;

  conpts += user_character_colds();
  conpts += user_character_recent_accident();
  conpts += user_character_chronic_disease();
  conpts += user_character_overweight();
  conpts += user_character_high_blood_pressure();
  conpts += user_character_smoke();
  conpts += user_character_aerobics();
  conpts += user_character_miles_run();

  Player.con = Player.maxcon = 12 + conpts / 3;

  powpts += user_character_animals();
  powpts += user_character_auras();
  powpts += user_character_out_of_body();
  powpts += user_character_spell();
  powpts += user_character_esp();
  powpts += user_character_pk();
  powpts += user_character_ghosts();
  powpts += user_character_irish();

  Player.pow = Player.maxpow = 3 + powpts / 2;

  Player.preference =
    cinema_interact("mfyn", "Are you sexually interested in males or females? ", 0, 0);
}



void omegan_character_stats(void)
{
  int share1,share2,i=0;
  print1("To reroll hit ESCAPE; hit any other key to accept these stats.");
  do {
    i++;
#if REROLLS == -1
    sprintf(Str1, "Generated character # %d", i );
#else
    sprintf(Str1, "You have only %d chance%s to reroll... ", REROLLS - i,
            (i == (REROLLS-1) ) ? "":"s");
#endif
    print2(Str1);
    Player.iq = Player.maxiq = 4 + random_range(5)+
      (share1 = random_range(6)) + (share2 = random_range(6));
    Player.pow = Player.maxpow = 4 + random_range(5) + share1 +share2;
    Player.dex = Player.maxdex = 4 + random_range(5)+
      (share1 = random_range(6)) + (share2 = random_range(6));
    Player.agi = Player.maxagi = 4 + random_range(5) + share1 +share2;
    Player.str = Player.maxstr = 4 + random_range(5)+
      (share1 = random_range(6)) + (share2 = random_range(6));
    Player.con = Player.maxcon = 4 + random_range(5) + share1 +share2;
    Player.cash = random_range(100)+random_range(100)+
      random_range(100)+random_range(100)+random_range(100);
    Player.hp=Player.maxhp=Player.con;
    Player.mana=Player.maxmana = calcmana();
    calc_melee();
    dataprint();
#if REROLLS == -1
  } while (mgetc() == ESCAPE);
#else
  } while ((i < REROLLS) && (mgetc() == ESCAPE));
#endif
  clearmsg();
  print1("Please enter your character's name: ");
  strcpy(Player.name,msgscanstring());
  if (Player.name[0] >= 'a' && Player.name[0] <= 'z')
    Player.name[0] += 'A'-'a'; /* capitalise 1st letter */
  print1("Is your character sexually interested in males or females? [mf] ");
  do Player.preference = (char) mcigetc();
  while ((Player.preference != 'm') && (Player.preference != 'f') &&
	(Player.preference != 'y') && (Player.preference != 'n')); /* :-) */

}