-+-+-+-+-+-+-+-+ START OF PART 3 -+-+-+-+-+-+-+-+ X#define TR_SLOW_DIGEST`090x00000080L X#define TR_STEALTH`090x00000100L X#define TR_AGGRAVATE`090x00000200L X#define TR_TELEPORT`090x00000400L X#define TR_REGEN`090x00000800L X#define TR_SPEED`090x00001000L X X#define TR_EGO_WEAPON`090x0007E000L X#define TR_SLAY_DRAGON`090x00002000L X#define TR_SLAY_ANIMAL`090x00004000L X#define TR_SLAY_EVIL`090x00008000L X#define TR_SLAY_UNDEAD`090x00010000L X#define TR_FROST_BRAND`090x00020000L X#define TR_FLAME_TONGUE`090x00040000L X X#define TR_RES_FIRE`090x00080000L X#define TR_RES_ACID`090x00100000L X#define TR_RES_COLD`090x00200000L X#define TR_SUST_STAT`090x00400000L X#define TR_FREE_ACT`090x00800000L X#define TR_SEE_INVIS`090x01000000L X#define TR_RES_LIGHT`090x02000000L X#define TR_FFALL`090x04000000L X#define TR_BLIND`090x08000000L X#define TR_TIMID`090x10000000L X#define TR_TUNNEL`090x20000000L X#define TR_INFRA`090x40000000L X#define TR_CURSED`090x80000000L X X/* definitions for chests */ X#define CH_LOCKED`090x00000001L X#define CH_TRAPPED`090x000001F0L X#define CH_LOSE_STR`090x00000010L X#define CH_POISON`090x00000020L X#define CH_PARALYSED`090x00000040L X#define CH_EXPLODE`090x00000080L X#define CH_SUMMON`090x00000100L X X/* definitions for creatures, cmove field */ X#define CM_ALL_MV_FLAGS`090x0000003FL X#define CM_ATTACK_ONLY`090x00000001L X#define CM_MOVE_NORMAL`090x00000002L X/* For Quylthulgs, which have no physical movement. */ X#define CM_ONLY_MAGIC`090x00000004L X X#define CM_RANDOM_MOVE`090x00000038L X#define CM_20_RANDOM`090x00000008L X#define CM_40_RANDOM`090x00000010L X#define CM_75_RANDOM`090x00000020L X X#define CM_SPECIAL`090x003F0000L X#define CM_INVISIBLE`090x00010000L X#define CM_OPEN_DOOR`090x00020000L X#define CM_PHASE`090x00040000L X#define CM_EATS_OTHER`090x00080000L X#define CM_PICKS_UP`090x00100000L X#define CM_MULTIPLY`090x00200000L X X#define CM_CARRY_OBJ`090x01000000L X#define CM_CARRY_GOLD`090x02000000L X#define CM_TREASURE`090x7C000000L X#define CM_TR_SHIFT`0926`09`09/* used for recall of treasure */ X#define CM_60_RANDOM`090x04000000L X#define CM_90_RANDOM`090x08000000L X#define CM_1D2_OBJ`090x10000000L X#define CM_2D2_OBJ`090x20000000L X#define CM_4D2_OBJ`090x40000000L X#define CM_WIN`09`090x80000000L X X/* creature spell definitions */ X#define CS_FREQ`09`090x0000000FL X#define CS_SPELLS`090x0001FFF0L X#define CS_TEL_SHORT`090x00000010L X#define CS_TEL_LONG`090x00000020L X#define CS_TEL_TO`090x00000040L X#define CS_LGHT_WND`090x00000080L X#define CS_SER_WND`090x00000100L X#define CS_HOLD_PER`090x00000200L X#define CS_BLIND`090x00000400L X#define CS_CONFUSE`090x00000800L X#define CS_FEAR`09`090x00001000L X#define CS_SUMMON_MON`090x00002000L X#define CS_SUMMON_UND`090x00004000L X#define CS_SLOW_PER`090x00008000L X#define CS_DRAIN_MANA`090x00010000L X X#define CS_BREATHE`090x00F80000L X#define CS_BR_LIGHT`090x00080000L X#define CS_BR_GAS`090x00100000L X#define CS_BR_ACID`090x00200000L X#define CS_BR_FROST`090x00400000L X#define CS_BR_FIRE`090x00800000L X X/* creature defense flags */ X#define CD_DRAGON`090x0001 X#define CD_ANIMAL`090x0002 X#define CD_EVIL`09`090x0004 X#define CD_UNDEAD`090x0008 X#define CD_WEAKNESS`090x03F0 X#define CD_FROST`090x0010 X#define CD_FIRE`09`090x0020 X#define CD_POISON`090x0040 X#define CD_ACID`09`090x0080 X#define CD_LIGHT`090x0100 X#define CD_STONE`090x0200 X X#define CD_NO_SLEEP`090x1000 X#define CD_INFRA`090x2000 X#define CD_MAX_HP`090x4000 X X/* inventory stacking subvals */ X/* these never stack */ X#define ITEM_NEVER_STACK_MIN`090 X#define ITEM_NEVER_STACK_MAX`0963 X/* these items always stack with others of same subval, always treated as X single objects, must be power of 2 */ X#define ITEM_SINGLE_STACK_MIN`0964 X#define ITEM_SINGLE_STACK_MAX`09192`09/* see NOTE below */ X/* these items stack with others only if have same subval and same p1, X they are treated as a group for wielding, etc. */ X#define ITEM_GROUP_MIN`09`09192 X#define ITEM_GROUP_MAX`09`09255 X/* NOTE: items with subval 192 are treated as single objects, but only stack X with others of same subval if have the same p1 value, only used for X torches */ X X/* id's used for object description, stored in object_ident */ X#define OD_TRIED`090x1 X#define OD_KNOWN1`090x2 X X/* id's used for item description, stored in i_ptr->ident */ X#define ID_MAGIK`090x1 X#define ID_DAMD`09`090x2 X#define ID_EMPTY`090x4 X#define ID_KNOWN2`090x8 X#define ID_STOREBOUGHT`090x10 X#define ID_SHOW_HITDAM`090x20 X#define ID_NOSHOW_P1`090x40 X#define ID_SHOW_P1`090x80 X X/* indexes into the special name table */ X#define SN_NULL`09`09`090 X#define SN_R`09`09`091 X#define SN_RA`09`09`092 X#define SN_RF`09`09`093 X#define SN_RC`09`09`094 X#define SN_RL`09`09`095 X#define SN_HA`09`09`096 X#define SN_DF`09`09`097 X#define SN_SA`09`09`098 X#define SN_SD`09`09`099 X#define SN_SE`09`09`0910 X#define SN_SU`09`09`0911 X#define SN_FT`09`09`0912 X#define SN_FB`09`09`0913 X#define SN_FREE_ACTION`09`0914 X#define SN_SLAYING`09`0915 X#define SN_CLUMSINESS`09`0916 X#define SN_WEAKNESS`09`0917 X#define SN_SLOW_DESCENT`09`0918 X#define SN_SPEED`09`0919 X#define SN_STEALTH`09`0920 X#define SN_SLOWNESS`09`0921 X#define SN_NOISE`09`0922 X#define SN_GREAT_MASS`09`0923 X#define SN_INTELLIGENCE`09`0924 X#define SN_WISDOM`09`0925 X#define SN_INFRAVISION`09`0926 X#define SN_MIGHT`09`0927 X#define SN_LORDLINESS`09`0928 X#define SN_MAGI`09`09`0929 X#define SN_BEAUTY`09`0930 X#define SN_SEEING`09`0931 X#define SN_REGENERATION`09`0932 X#define SN_STUPIDITY`09`0933 X#define SN_DULLNESS`09`0934 X#define SN_BLINDNESS`09`0935 X#define SN_TIMIDNESS`09`0936 X#define SN_TELEPORTATION`0937 X#define SN_UGLINESS`09`0938 X#define SN_PROTECTION`09`0939 X#define SN_IRRITATION`09`0940 X#define SN_VULNERABILITY`0941 X#define SN_ENVELOPING`09`0942 X#define SN_FIRE`09`09`0943 X#define SN_SLAY_EVIL`09`0944 X#define SN_DRAGON_SLAYING`0945 X#define SN_EMPTY`09`0946 X#define SN_LOCKED`09`0947 X#define SN_POISON_NEEDLE`0948 X#define SN_GAS_TRAP`09`0949 X#define SN_EXPLOSION_DEVICE`0950 X#define SN_SUMMONING_RUNES`0951 X#define SN_MULTIPLE_TRAPS`0952 X#define SN_DISARMED`09`0953 X#define SN_UNLOCKED`09`0954 X#define SN_SLAY_ANIMAL`09`0955 X#define SN_ARRAY_SIZE`09`0956 /* must be at end of this list */ X X/* defines for treasure type values (tval) */ X#define TV_NEVER`09-1 /* used by find_range() for non-search */ X#define TV_NOTHING`090 X#define TV_MISC`09`091 X#define TV_CHEST`092 X/* min tval for wearable items, all items between TV_MIN_WEAR and TV_MAX_WEA VR X use the same flag bits, see the TR_* defines */ X#define TV_MIN_WEAR`0910 X/* items tested for enchantments, i.e. the MAGIK inscription, see the X enchanted() procedure */ X#define TV_MIN_ENCHANT`0910 X#define TV_SLING_AMMO`0910 X#define TV_BOLT`09`0911 X#define TV_ARROW`0912 X#define TV_SPIKE`0913 X#define TV_LIGHT`0915 X#define TV_BOW`09`0920 X#define TV_HAFTED`0921 X#define TV_POLEARM`0922 X#define TV_SWORD`0923 X#define TV_DIGGING`0925 X#define TV_BOOTS`0930 X#define TV_GLOVES`0931 X#define TV_CLOAK`0932 X#define TV_HELM`09`0933 X#define TV_SHIELD`0934 X#define TV_HARD_ARMOR`0935 X#define TV_SOFT_ARMOR`0936 X/* max tval that uses the TR_* flags */ X#define TV_MAX_ENCHANT`0939 X#define TV_AMULET`0940 X#define TV_RING`09`0945 X/* max tval for wearable items */ X#define TV_MAX_WEAR`0950 X#define TV_STAFF`0955 X#define TV_WAND`09`0965 X#define TV_SCROLL1`0970 X#define TV_SCROLL2`0971 X#define TV_POTION1`0975 X#define TV_POTION2`0976 X#define TV_FLASK`0977 X#define TV_FOOD `0980 X#define TV_MAGIC_BOOK`0990 X#define TV_PRAYER_BOOK`0991 X/* objects with tval above this are never picked up by monsters */ X#define TV_MAX_OBJECT`0999 X#define TV_GOLD`09`09100 X/* objects with higher tvals can not be picked up */ X#define TV_MAX_PICK_UP`09100 X#define TV_INVIS_TRAP`09101 X/* objects between TV_MIN_VISIBLE and TV_MAX_VISIBLE are always visible, X i.e. the cave fm flag is set when they are present */ X#define TV_MIN_VISIBLE`09102 X#define TV_VIS_TRAP`09102 X#define TV_RUBBLE`09103 X/* following objects are never deleted when trying to create another one X during level generation */ X#define TV_MIN_DOORS`09104 X#define TV_OPEN_DOOR`09104 X#define TV_CLOSED_DOOR`09105 X#define TV_UP_STAIR`09107 X#define TV_DOWN_STAIR`09108 X#define TV_SECRET_DOOR`09109 X#define TV_STORE_DOOR`09110 X#define TV_MAX_VISIBLE`09110 X X/* spell types used by get_flags(), breathe(), fire_bolt() and fire_ball() * V/ X#define GF_MAGIC_MISSILE 0 X#define GF_LIGHTNING`091 X#define GF_POISON_GAS`092 X#define GF_ACID`09`093 X#define GF_FROST`094 X#define GF_FIRE`09`095 X#define GF_HOLY_ORB`096 X X/* Number of entries allowed in the scorefile. */ X#define SCOREFILE_SIZE`091000 $ CALL UNPACK CONSTANT.H;1 1298106995 $ create 'f' X/* source/create.c: create a player character X X Copyright (c) 1989-92 James E. Wilson, Robert A. Koeneke X X This software may be copied and distributed for educational, research, an Vd X not for profit purposes provided that this copyright and statement are X included in all such copies. */ X X#ifdef __TURBOC__ X#include`09 X#endif /* __TURBOC__ */ X`20 X#include "config.h" X#include "constant.h" X#include "types.h" X#include "externs.h" X X#ifdef USG X#ifndef ATARIST_MWC X#include X#endif X#else X#include X#endif X X#if defined(LINT_ARGS) Xstatic void get_stats(void); Xstatic void change_stat(int, int16); Xstatic void get_all_stats(void); Xstatic void choose_race(void); Xstatic void print_history(void); Xstatic void get_history(void); Xstatic void get_sex(void); Xstatic void get_ahw(void); Xstatic void get_class(void); Xstatic int monval(int8u); Xstatic void get_money(void); X#endif X X/* Generates character's stats`09`09`09`09-JWT-`09*/ Xstatic void get_stats() X`7B X register int i, tot; X int dice`5B18`5D; X X do X `7B X tot = 0; X for (i = 0; i < 18; i++) X`09`7B X`09 dice`5Bi`5D = randint (3 + i % 3); /* Roll 3,4,5 sided dice once each V */ X`09 tot += dice`5Bi`5D; X`09`7D X `7D X while (tot <= 42 `7C`7C tot >= 54); X X for (i = 0; i < 6; i++) X py.stats.max_stat`5Bi`5D = 5 + dice`5B3*i`5D + dice`5B3*i+1`5D + dice`5B V3*i+2`5D; X`7D X X X/* Changes stats by given amount`09`09`09`09-JWT-`09*/ Xstatic void change_stat(stat, amount) Xint stat; Xint16 amount; X`7B X register int i; X register int tmp_stat; X X tmp_stat = py.stats.max_stat`5Bstat`5D; X if (amount < 0) X for (i = 0; i > amount; i--) X `7B X`09if (tmp_stat > 108) X`09 tmp_stat--; X`09else if (tmp_stat > 88) X`09 tmp_stat += -randint(6) - 2; X`09else if (tmp_stat > 18) X`09 `7B X`09 tmp_stat += -randint(15) - 5; X`09 if (tmp_stat < 18) X`09 tmp_stat = 18; X`09 `7D X`09else if (tmp_stat > 3) X`09 tmp_stat--; X `7D X else X for (i = 0; i < amount; i++) X `7B X`09if (tmp_stat < 18) X`09 tmp_stat++; X`09else if (tmp_stat < 88) X`09 tmp_stat += randint(15) + 5; X`09else if (tmp_stat < 108) X`09 tmp_stat += randint(6) + 2; X`09else if (tmp_stat < 118) X`09 tmp_stat++; X `7D X py.stats.max_stat`5Bstat`5D = tmp_stat; X`7D X X X/* generate all stats and modify for race. needed in a separate module so X looping of character selection would be allowed -RGM- */ Xstatic void get_all_stats () X`7B X register player_type *p_ptr; X register race_type *r_ptr; X register int j; X X p_ptr = &py; X r_ptr = &race`5Bp_ptr->misc.prace`5D; X get_stats (); X change_stat (A_STR, r_ptr->str_adj); X change_stat (A_INT, r_ptr->int_adj); X change_stat (A_WIS, r_ptr->wis_adj); X change_stat (A_DEX, r_ptr->dex_adj); X change_stat (A_CON, r_ptr->con_adj); X change_stat (A_CHR, r_ptr->chr_adj); X for (j = 0; j < 6; j++) X `7B X py.stats.cur_stat`5Bj`5D = py.stats.max_stat`5Bj`5D; X set_use_stat (j); X `7D X X p_ptr->misc.srh = r_ptr->srh; X p_ptr->misc.bth = r_ptr->bth; X p_ptr->misc.bthb = r_ptr->bthb; X p_ptr->misc.fos = r_ptr->fos; X p_ptr->misc.stl = r_ptr->stl; X p_ptr->misc.save = r_ptr->bsav; X p_ptr->misc.hitdie = r_ptr->bhitdie; X p_ptr->misc.lev = 1; X p_ptr->misc.ptodam = todam_adj(); X p_ptr->misc.ptohit = tohit_adj(); X p_ptr->misc.ptoac = 0; X p_ptr->misc.pac = toac_adj(); X p_ptr->misc.expfact = r_ptr->b_exp; X p_ptr->flags.see_infra = r_ptr->infra; X`7D X X X/* Allows player to select a race`09`09`09-JWT-`09*/ Xstatic void choose_race() X`7B X register int j, k; X int l, m, exit_flag; X char s; X char tmp_str`5B80`5D; X register player_type *p_ptr; X register race_type *r_ptr; X X j = 0; X k = 0; X l = 2; X m = 21; X clear_from (20); X put_buffer("Choose a race (? for Help):", 20, 2); X do X `7B X (void) sprintf(tmp_str, "%c) %s", k+'a', race`5Bj`5D.trace); X put_buffer(tmp_str, m, l); X k++; X l += 15; X if (l > 70) X`09`7B X`09 l = 2; X`09 m++; X`09`7D X j++; X `7D X while (j < MAX_RACES); X exit_flag = FALSE; X do X `7B X move_cursor (20, 30); X s = inkey(); X j = s - 'a'; X if ((j < MAX_RACES) && (j >= 0)) X`09exit_flag = TRUE; X else if (s == '?') X`09helpfile (MORIA_WELCOME); X else X`09bell (); X `7D X while (!exit_flag); X X p_ptr = &py; X r_ptr = &race`5Bj`5D; X p_ptr->misc.prace = j; X put_buffer(r_ptr->trace, 3, 15); X`7D X X X/* Will print the history of a character`09`09`09-JWT-`09*/ Xstatic void print_history() X`7B X register int i; X X put_buffer("Character Background", 14, 27); X for (i = 0; i < 4; i++) X prt(py.misc.history`5Bi`5D, i+15, 10); X`7D X X X/* Get the racial history, determines social class`09-RAK-`09*/ X/* Assumptions:`09Each race has init history beginning at`09`09*/ X/*`09`09(race-1)*3+1`09`09`09`09`09*/ X/*`09`09All history parts are in ascending order`09*/ Xstatic void get_history() X`7B X int hist_ptr, cur_ptr, test_roll, flag; X register int start_pos, end_pos, cur_len; X int line_ctr, new_start, social_class; X char history_block`5B240`5D; X register background_type *b_ptr; X X /* Get a block of history text`09`09`09`09*/ X hist_ptr = py.misc.prace*3 + 1; X history_block`5B0`5D = '\0'; X social_class = randint(4); X cur_ptr = 0; X do X `7B X flag = FALSE; +-+-+-+-+-+-+-+- END OF PART 3 +-+-+-+-+-+-+-+-