Only in angband-283/src: Makefile.lsl diff -r -c angband-283/src/birth.c angband-285/src/birth.c *** angband-283/src/birth.c Mon Feb 9 07:29:31 1998 --- angband-285/src/birth.c Wed Aug 18 17:25:07 1999 *************** *** 245,278 **** /* ! * Current stats */ static s16b stat_use[6]; - /* - * Autoroll limit - */ - static s16b stat_limit[6]; - - /* - * Autoroll matches - */ - static s32b stat_match[6]; - - /* - * Autoroll round - */ - static s32b auto_round; - - /* - * Last round - */ - static s32b last_round; - /* ! * Save the current data for later */ static void save_prev_data(void) { --- 245,258 ---- /* ! * Current stats (when rolling a character). */ static s16b stat_use[6]; /* ! * Save the currently rolled data for later. */ static void save_prev_data(void) { *************** *** 289,295 **** prev.au = p_ptr->au; /* Save the stats */ ! for (i = 0; i < 6; i++) { prev.stat[i] = p_ptr->stat_max[i]; } --- 269,275 ---- prev.au = p_ptr->au; /* Save the stats */ ! for (i = 0; i < A_MAX; i++) { prev.stat[i] = p_ptr->stat_max[i]; } *************** *** 303,309 **** /* ! * Load the previous data */ static void load_prev_data(void) { --- 283,289 ---- /* ! * Load the previously rolled data. */ static void load_prev_data(void) { *************** *** 322,328 **** temp.au = p_ptr->au; /* Save the stats */ ! for (i = 0; i < 6; i++) { temp.stat[i] = p_ptr->stat_max[i]; } --- 302,308 ---- temp.au = p_ptr->au; /* Save the stats */ ! for (i = 0; i < A_MAX; i++) { temp.stat[i] = p_ptr->stat_max[i]; } *************** *** 344,350 **** p_ptr->au = prev.au; /* Load the stats */ ! for (i = 0; i < 6; i++) { p_ptr->stat_max[i] = prev.stat[i]; p_ptr->stat_cur[i] = prev.stat[i]; --- 324,330 ---- p_ptr->au = prev.au; /* Load the stats */ ! for (i = 0; i < A_MAX; i++) { p_ptr->stat_max[i] = prev.stat[i]; p_ptr->stat_cur[i] = prev.stat[i]; *************** *** 367,373 **** prev.au = temp.au; /* Save the stats */ ! for (i = 0; i < 6; i++) { prev.stat[i] = temp.stat[i]; } --- 347,353 ---- prev.au = temp.au; /* Save the stats */ ! for (i = 0; i < A_MAX; i++) { prev.stat[i] = temp.stat[i]; } *************** *** 383,389 **** /* ! * Adjust a stat by an amount * * The "auto_roll" flag selects "maximal" changes for use with the * auto-roller initialization code. Otherwise, if "maximize" mode --- 363,373 ---- /* ! * Adjust a stat by an amount. ! * ! * This just uses "modify_stat_value()" unless "maximize" mode is false, ! * and a positive bonus is being applied, in which case, a special hack ! * is used, with the "auto_roll" flag affecting the result. * * The "auto_roll" flag selects "maximal" changes for use with the * auto-roller initialization code. Otherwise, if "maximize" mode *************** *** 392,423 **** */ static int adjust_stat(int value, s16b amount, int auto_roll) { ! int i; ! ! /* Negative amounts */ ! if (amount < 0) { ! /* Apply penalty */ ! for (i = 0; i < (0 - amount); i++) ! { ! if (value >= 18+10) ! { ! value -= 10; ! } ! else if (value > 18) ! { ! value = 18; ! } ! else if (value > 3) ! { ! value--; ! } ! } } ! /* Positive amounts */ ! else if (amount > 0) { /* Apply reward */ for (i = 0; i < amount; i++) { --- 376,392 ---- */ static int adjust_stat(int value, s16b amount, int auto_roll) { ! /* Negative amounts or maximize mode */ ! if ((amount < 0) || adult_maximize) { ! return (modify_stat_value(value, amount)); } ! /* Special hack */ ! else { + int i; + /* Apply reward */ for (i = 0; i < amount; i++) { *************** *** 425,434 **** { value++; } - else if (p_ptr->maximize) - { - value += 10; - } else if (value < 18+70) { value += ((auto_roll ? 15 : randint(15)) + 5); --- 394,399 ---- *************** *** 482,489 **** if ((j > 42) && (j < 54)) break; } ! /* Acquire the stats */ ! for (i = 0; i < 6; i++) { /* Extract 5 + 1d3 + 1d4 + 1d5 */ j = 5 + dice[3*i] + dice[3*i+1] + dice[3*i+2]; --- 447,454 ---- if ((j > 42) && (j < 54)) break; } ! /* Roll the stats */ ! for (i = 0; i < A_MAX; i++) { /* Extract 5 + 1d3 + 1d4 + 1d5 */ j = 5 + dice[3*i] + dice[3*i+1] + dice[3*i+2]; *************** *** 495,501 **** bonus = rp_ptr->r_adj[i] + cp_ptr->c_adj[i]; /* Variable stat maxes */ ! if (p_ptr->maximize) { /* Start fully healed */ p_ptr->stat_cur[i] = p_ptr->stat_max[i]; --- 460,466 ---- bonus = rp_ptr->r_adj[i] + cp_ptr->c_adj[i]; /* Variable stat maxes */ ! if (adult_maximize) { /* Start fully healed */ p_ptr->stat_cur[i] = p_ptr->stat_max[i]; *************** *** 663,672 **** /* Roll for nobility */ roll = randint(100); ! /* Access the proper entry in the table */ while ((chart != bg[i].chart) || (roll > bg[i].roll)) i++; ! /* Acquire the textual history */ strcat(buf, bg[i].info); /* Add in the social class */ --- 628,637 ---- /* Roll for nobility */ roll = randint(100); ! /* Get the proper entry in the table */ while ((chart != bg[i].chart) || (roll > bg[i].roll)) i++; ! /* Get the textual history */ strcat(buf, bg[i].info); /* Add in the social class */ *************** *** 764,776 **** */ static void get_money(void) { ! int i, gold; /* Social Class determines starting gold */ gold = (p_ptr->sc * 6) + randint(100) + 300; /* Process the stats */ ! for (i = 0; i < 6; i++) { /* Mega-Hack -- reduce gold for high stats */ if (stat_use[i] >= 18+50) gold -= 300; --- 729,743 ---- */ static void get_money(void) { ! int i; ! ! int gold; /* Social Class determines starting gold */ gold = (p_ptr->sc * 6) + randint(100) + 300; /* Process the stats */ ! for (i = 0; i < A_MAX; i++) { /* Mega-Hack -- reduce gold for high stats */ if (stat_use[i] >= 18+50) gold -= 300; *************** *** 782,791 **** /* Minimum 100 gold */ if (gold < 100) gold = 100; - /* She charmed the banker into it! -CJS- */ - /* She slept with the banker.. :) -GDH- */ - /* if (p_ptr->psex == SEX_FEMALE) gold += 50; */ - /* Save the gold */ p_ptr->au = gold; } --- 749,754 ---- *************** *** 793,840 **** /* - * Display stat values, subset of "put_stats()" - * - * See 'display_player()' for screen layout constraints. - */ - static void birth_put_stats(void) - { - int col; - int i, p; - byte attr; - - char buf[80]; - - - col = 42; - - - /* Put the stats (and percents) */ - for (i = 0; i < 6; i++) - { - /* Put the stat */ - cnv_stat(stat_use[i], buf); - c_put_str(TERM_L_GREEN, buf, 3+i, col+24); - - /* Put the percent */ - if (stat_match[i]) - { - p = 1000L * stat_match[i] / auto_round; - attr = (p < 100) ? TERM_YELLOW : TERM_L_GREEN; - sprintf(buf, "%3d.%d%%", p/10, p%10); - c_put_str(attr, buf, 3+i, col+13); - } - - /* Never happened */ - else - { - c_put_str(TERM_RED, "(NONE)", 3+i, col+13); - } - } - } - - - /* * Clear all the global "character" data */ static void player_wipe(void) --- 756,761 ---- *************** *** 1028,1047 **** /* ! * Helper function for 'player_birth()' * ! * The delay may be reduced, but is recommended to keep players ! * from continuously rolling up characters, which can be VERY ! * expensive CPU wise. And it cuts down on player stupidity. ! * ! * See "display_player" for screen layout code. */ ! static bool player_birth_aux() { ! int i, j, k, m, n, v; ! ! bool flag = FALSE; ! bool prev = FALSE; cptr str; --- 949,962 ---- /* ! * Helper function for 'player_birth()'. * ! * This function allows the player to select a sex, race, and class, and ! * modify options (including the birth options). */ ! static bool player_birth_aux_1() { ! int k, n, i; cptr str; *************** *** 1051,1063 **** char p1 = '('; #endif char p2 = ')'; - char b1 = '['; - char b2 = ']'; char buf[80]; - bool autoroll = FALSE; - /*** Instructions ***/ --- 966,974 ---- *************** *** 1066,1078 **** /* Display some helpful information */ Term_putstr(5, 10, -1, TERM_WHITE, ! "Please answer the following questions. Most of the questions"); Term_putstr(5, 11, -1, TERM_WHITE, ! "display a set of standard answers, and many will also accept"); Term_putstr(5, 12, -1, TERM_WHITE, ! "some special responses, including 'Q' to quit, 'S' to restart,"); Term_putstr(5, 13, -1, TERM_WHITE, ! "and '?' for help. Note that 'Q' and 'S' must be capitalized."); /*** Player sex ***/ --- 977,989 ---- /* Display some helpful information */ Term_putstr(5, 10, -1, TERM_WHITE, ! "Please answer the following questions. Most of the questions"); Term_putstr(5, 11, -1, TERM_WHITE, ! "display a set of standard answers, and many will also accept"); Term_putstr(5, 12, -1, TERM_WHITE, ! "some special responses, including 'Q' to quit, 'S' to restart,"); Term_putstr(5, 13, -1, TERM_WHITE, ! "and '?' for help. Note that 'Q' and 'S' must be capitalized."); /*** Player sex ***/ *************** *** 1097,1109 **** /* Choose */ while (1) { ! sprintf(buf, "Choose a sex (%c-%c): ", I2A(0), I2A(n-1)); put_str(buf, 20, 2); c = inkey(); if (c == 'Q') quit(NULL); if (c == 'S') return (FALSE); - if (c == ESCAPE) c = 'a'; k = (islower(c) ? A2I(c) : -1); if ((k >= 0) && (k < n)) break; if (c == '?') do_cmd_help(); else bell("Illegal sex!"); --- 1008,1022 ---- /* Choose */ while (1) { ! sprintf(buf, "Choose a sex (%c-%c, or * for random): ", ! I2A(0), I2A(n-1)); put_str(buf, 20, 2); c = inkey(); if (c == 'Q') quit(NULL); if (c == 'S') return (FALSE); k = (islower(c) ? A2I(c) : -1); + if (c == ESCAPE) c = '*'; + if (c == '*') k = rand_int(MAX_SEXES); if ((k >= 0) && (k < n)) break; if (c == '?') do_cmd_help(); else bell("Illegal sex!"); *************** *** 1113,1118 **** --- 1026,1035 ---- p_ptr->psex = k; sp_ptr = &sex_info[p_ptr->psex]; + /* Sex */ + put_str("Sex", 3, 1); + c_put_str(TERM_L_BLUE, sp_ptr->title, 3, 8); + /* Clean up */ clear_from(15); *************** *** 1121,1127 **** /* Extra info */ Term_putstr(5, 15, -1, TERM_WHITE, ! "Your 'race' determines various intrinsic factors and bonuses."); /* Dump races */ for (n = 0; n < MAX_RACES; n++) --- 1038,1044 ---- /* Extra info */ Term_putstr(5, 15, -1, TERM_WHITE, ! "Your 'race' determines various intrinsic factors and bonuses."); /* Dump races */ for (n = 0; n < MAX_RACES; n++) *************** *** 1139,1151 **** /* Choose */ while (1) { ! sprintf(buf, "Choose a race (%c-%c): ", I2A(0), I2A(n-1)); put_str(buf, 20, 2); c = inkey(); if (c == 'Q') quit(NULL); if (c == 'S') return (FALSE); - if (c == ESCAPE) c = 'a'; k = (islower(c) ? A2I(c) : -1); if ((k >= 0) && (k < n)) break; if (c == '?') do_cmd_help(); else bell("Illegal race!"); --- 1056,1070 ---- /* Choose */ while (1) { ! sprintf(buf, "Choose a race (%c-%c, or * for random): ", ! I2A(0), I2A(n-1)); put_str(buf, 20, 2); c = inkey(); if (c == 'Q') quit(NULL); if (c == 'S') return (FALSE); k = (islower(c) ? A2I(c) : -1); + if (c == ESCAPE) c = '*'; + if (c == '*') k = rand_int(MAX_RACES); if ((k >= 0) && (k < n)) break; if (c == '?') do_cmd_help(); else bell("Illegal race!"); *************** *** 1155,1160 **** --- 1074,1083 ---- p_ptr->prace = k; rp_ptr = &race_info[p_ptr->prace]; + /* Race */ + put_str("Race", 4, 1); + c_put_str(TERM_L_BLUE, rp_ptr->title, 4, 8); + /* Clean up */ clear_from(15); *************** *** 1163,1171 **** /* Extra info */ Term_putstr(5, 15, -1, TERM_WHITE, ! "Your 'class' determines various intrinsic abilities and bonuses."); Term_putstr(5, 16, -1, TERM_WHITE, ! "Any entries with a (*) should only be used by advanced players."); /* Dump classes */ for (n = 0; n < MAX_CLASS; n++) --- 1086,1094 ---- /* Extra info */ Term_putstr(5, 15, -1, TERM_WHITE, ! "Your 'class' determines various intrinsic abilities and bonuses."); Term_putstr(5, 16, -1, TERM_WHITE, ! "Any entries with a (*) should only be used by advanced players."); /* Dump classes */ for (n = 0; n < MAX_CLASS; n++) *************** *** 1189,1201 **** /* Get a class */ while (1) { ! sprintf(buf, "Choose a class (%c-%c): ", I2A(0), I2A(n-1)); put_str(buf, 20, 2); c = inkey(); if (c == 'Q') quit(NULL); if (c == 'S') return (FALSE); - if (c == ESCAPE) c = 'a'; k = (islower(c) ? A2I(c) : -1); if ((k >= 0) && (k < n)) break; if (c == '?') do_cmd_help(); else bell("Illegal class!"); --- 1112,1126 ---- /* Get a class */ while (1) { ! sprintf(buf, "Choose a class (%c-%c, or * for random): ", ! I2A(0), I2A(n-1)); put_str(buf, 20, 2); c = inkey(); if (c == 'Q') quit(NULL); if (c == 'S') return (FALSE); k = (islower(c) ? A2I(c) : -1); + if (c == ESCAPE) c = '*'; + if (c == '*') k = rand_int(MAX_CLASS); if ((k >= 0) && (k < n)) break; if (c == '?') do_cmd_help(); else bell("Illegal class!"); *************** *** 1206,1321 **** cp_ptr = &class_info[p_ptr->pclass]; mp_ptr = &magic_info[p_ptr->pclass]; /* Clean up */ clear_from(15); ! /*** Maximize mode ***/ /* Extra info */ Term_putstr(5, 15, -1, TERM_WHITE, ! "Using 'maximize' mode makes the game harder at the start,"); Term_putstr(5, 16, -1, TERM_WHITE, ! "but often makes it easier to win."); ! /* Ask about "maximize" mode */ while (1) { ! put_str("Use 'maximize' mode? (y/n) ", 20, 2); c = inkey(); if (c == 'Q') quit(NULL); if (c == 'S') return (FALSE); if (c == ESCAPE) break; ! if ((c == 'y') || (c == 'n')) break; if (c == '?') do_cmd_help(); ! else bell("Illegal maximize flag!"); } ! /* Set "maximize" mode */ ! p_ptr->maximize = (c == 'y'); ! /* Clear */ ! clear_from(15); ! /*** Preserve mode ***/ - /* Extra info */ - Term_putstr(5, 15, -1, TERM_WHITE, - "Using 'preserve' mode makes it difficult to 'lose' artifacts,"); - Term_putstr(5, 16, -1, TERM_WHITE, - "but eliminates the 'special' feelings about some levels."); ! /* Ask about "preserve" mode */ ! while (1) { ! put_str("Use 'preserve' mode? (y/n) ", 20, 2); ! c = inkey(); ! if (c == 'Q') quit(NULL); ! if (c == 'S') return (FALSE); ! if (c == ESCAPE) break; ! if ((c == 'y') || (c == 'n')) break; ! if (c == '?') do_cmd_help(); ! else bell("Illegal preserve flag!"); } - /* Set "preserve" mode */ - p_ptr->preserve = (c == 'y'); - - /* Clear */ - clear_from(20); ! #ifdef ALLOW_AUTOROLLER ! /*** Autoroll ***/ - /* Extra info */ - Term_putstr(5, 15, -1, TERM_WHITE, - "The 'autoroller' allows you to specify certain 'minimal' stats,"); - Term_putstr(5, 16, -1, TERM_WHITE, - "but be warned that your various stats may not be independant!"); ! /* Ask about "auto-roller" mode */ while (1) { ! put_str("Use the Auto-Roller? (y/n) ", 20, 2); c = inkey(); if (c == 'Q') quit(NULL); if (c == 'S') return (FALSE); if (c == ESCAPE) break; ! if ((c == 'y') || (c == 'n')) break; ! if (c == '?') do_cmd_help(); ! else bell("Illegal autoroller flag!"); } - /* Set "autoroll" */ - autoroll = (c == 'y'); ! /* Clear */ ! clear_from(15); /* Initialize */ ! if (autoroll) { int mval[6]; char inp[80]; ! /* Clear fields */ ! auto_round = 0L; ! last_round = 0L; ! ! /* Clean up */ ! clear_from(10); /* Prompt for the minimum stats */ ! put_str("Enter minimum attribute for: ", 15, 2); /* Output the maximum stats */ ! for (i = 0; i < 6; i++) { /* Reset the "success" counter */ stat_match[i] = 0; --- 1131,1425 ---- cp_ptr = &class_info[p_ptr->pclass]; mp_ptr = &magic_info[p_ptr->pclass]; + /* Class */ + put_str("Class", 5, 1); + c_put_str(TERM_L_BLUE, cp_ptr->title, 5, 8); + /* Clean up */ clear_from(15); ! /*** Birth options ***/ /* Extra info */ Term_putstr(5, 15, -1, TERM_WHITE, ! "You can change your options at any time, but the 'Birth' options"); Term_putstr(5, 16, -1, TERM_WHITE, ! "must be changed now to affect the birth of this character."); ! /* Verify birth options */ while (1) { ! sprintf(buf, "Modify options (y/n)? "); ! put_str(buf, 20, 2); c = inkey(); if (c == 'Q') quit(NULL); if (c == 'S') return (FALSE); if (c == ESCAPE) break; ! if (c == 'y' || c == 'n') break; if (c == '?') do_cmd_help(); ! else bell("Illegal answer!"); } ! /* Verify */ ! if (c == 'y') ! { ! /* Interact with options */ ! do_cmd_options(); ! } ! /* Set adult options from birth options */ ! for (i = OPT_BIRTH; i < OPT_CHEAT; i++) ! { ! op_ptr->opt[OPT_ADULT + (i - OPT_BIRTH)] = op_ptr->opt[i]; ! } + /* Clean up */ + clear_from(10); ! /* Done */ ! return (TRUE); ! } ! /* ! * Initial stat costs (initial stats always range from 10 to 18 inclusive). ! */ ! static birth_stat_costs[(18-10)+1] = { 0, 1, 2, 4, 7, 11, 16, 22, 30 }; ! ! ! /* ! * Helper function for 'player_birth()'. ! * ! * This function handles "point-based" character creation. ! * ! * The player selects, for each stat, a value from 10 to 18 (inclusive), ! * each costing a certain amount of points (as above), from a pool of 48 ! * available points, to which race/class modifiers are then applied. ! * ! * Each unused point is converted into 100 gold pieces. ! */ ! static bool player_birth_aux_2() ! { ! int i; ! ! int row = 3; ! int col = 42; ! ! int stat = 0; ! ! int stats[A_MAX]; ! ! int cost = 0; ! ! char c; ! ! char buf[80]; ! ! ! /* Initialize stats */ ! for (i = 0; i < A_MAX; i++) { ! /* Initial stats */ ! stats[i] = 10; } + /* Roll for base hitpoints */ + get_extra(); ! /* Roll for age/height/weight */ ! get_ahw(); ! /* Roll for social class */ ! get_history(); ! /* Interact */ while (1) { ! /* Reset cost */ ! cost = 0; ! ! /* Process stats */ ! for (i = 0; i < A_MAX; i++) ! { ! /* Variable stat maxes */ ! if (adult_maximize) ! { ! /* Reset stats */ ! p_ptr->stat_cur[i] = p_ptr->stat_max[i] = stats[i]; ! ! } ! ! /* Fixed stat maxes */ ! else ! { ! /* Obtain a "bonus" for "race" and "class" */ ! int bonus = rp_ptr->r_adj[i] + cp_ptr->c_adj[i]; ! ! /* Apply the racial/class bonuses */ ! p_ptr->stat_cur[i] = p_ptr->stat_max[i] = ! modify_stat_value(stats[i], bonus); ! } ! ! /* Total cost */ ! cost += birth_stat_costs[stats[i] - 10]; ! } ! ! /* Restrict cost */ ! if (cost > 48) ! { ! /* Warning */ ! bell("Excessive stats!"); ! ! /* Reduce stat */ ! stats[stat]--; ! ! /* Recompute costs */ ! continue; ! } ! ! /* Gold is inversely proportional to cost */ ! p_ptr->au = (100 * (48 - cost)) + 100; ! ! /* Calculate the bonuses and hitpoints */ ! p_ptr->update |= (PU_BONUS | PU_HP); ! ! /* Update stuff */ ! update_stuff(); ! ! /* Fully healed */ ! p_ptr->chp = p_ptr->mhp; ! ! /* Fully rested */ ! p_ptr->csp = p_ptr->msp; ! ! /* Display the player */ ! display_player(0); ! ! /* Display the costs header */ ! put_str("Cost", row - 1, col + 32); ! ! /* Display the costs */ ! for (i = 0; i < A_MAX; i++) ! { ! /* Display cost */ ! sprintf(buf, "%4d", birth_stat_costs[stats[i] - 10]); ! put_str(buf, row + i, col + 32); ! } ! ! ! /* Prompt XXX XXX XXX */ ! sprintf(buf, "Total Cost %2d/48. Use 2/8 to move, 4/6 to modify, ESC to accept.", cost); ! prt(buf, 0, 0); ! ! /* Place cursor just after cost of current stat */ ! Term_gotoxy(col + 36, row + stat); ! ! /* Get key */ c = inkey(); + + /* Quit */ if (c == 'Q') quit(NULL); + + /* Start over */ if (c == 'S') return (FALSE); + + /* Done */ if (c == ESCAPE) break; ! ! /* Prev stat */ ! if (c == '8') ! { ! stat = (stat + 5) % 6; ! } ! ! /* Next stat */ ! if (c == '2') ! { ! stat = (stat + 1) % 6; ! } ! ! /* Decrease stat */ ! if ((c == '4') && (stats[stat] > 10)) ! { ! stats[stat]--; ! } ! ! /* Increase stat */ ! if ((c == '6') && (stats[stat] < 18)) ! { ! stats[stat]++; ! } } ! /* Done */ ! return (TRUE); ! } ! ! ! /* ! * Helper function for 'player_birth()'. ! * ! * This function handles "auto-rolling" and "random-rolling". ! * ! * The delay may be reduced, but is recommended to keep players ! * from continuously rolling up characters, which can be VERY ! * expensive CPU wise. And it cuts down on player stupidity. ! */ ! static bool player_birth_aux_3() ! { ! int i, j, m, v; + bool flag = FALSE; + bool prev = FALSE; + + char c; + + char b1 = '['; + char b2 = ']'; + + char buf[80]; + + + #ifdef ALLOW_AUTOROLLER + + s16b stat_limit[6]; + + s32b stat_match[6]; + + s32b auto_round = 0L; + + s32b last_round = 0L; + + + /*** Autoroll ***/ /* Initialize */ ! if (adult_auto_roller) { int mval[6]; char inp[80]; ! /* Extra info */ ! Term_putstr(5, 10, -1, TERM_WHITE, ! "The auto-roller will automatically ignore characters which do"); ! Term_putstr(5, 11, -1, TERM_WHITE, ! "not meet the minimum values for any stats specified below."); ! Term_putstr(5, 12, -1, TERM_WHITE, ! "Note that stats are not independant, so it is not possible to"); ! Term_putstr(5, 13, -1, TERM_WHITE, ! "get perfect (or even high) values for all your stats."); /* Prompt for the minimum stats */ ! put_str("Enter minimum value for: ", 15, 2); /* Output the maximum stats */ ! for (i = 0; i < A_MAX; i++) { /* Reset the "success" counter */ stat_match[i] = 0; *************** *** 1352,1358 **** } /* Input the minimum stats */ ! for (i = 0; i < 6; i++) { /* Get a minimum stat */ while (TRUE) --- 1456,1462 ---- } /* Input the minimum stats */ ! for (i = 0; i < A_MAX; i++) { /* Get a minimum stat */ while (TRUE) *************** *** 1400,1411 **** /* Roll */ while (TRUE) { ! int col; ! ! col = 42; /* Feedback */ ! if (autoroll) { Term_clear(); --- 1504,1513 ---- /* Roll */ while (TRUE) { ! int col = 42; /* Feedback */ ! if (adult_auto_roller) { Term_clear(); *************** *** 1419,1425 **** put_str(" Roll", 2, col+24); /* Put the minimal stats */ ! for (i = 0; i < 6; i++) { /* Label stats */ put_str(stat_names[i], 3+i, col); --- 1521,1527 ---- put_str(" Roll", 2, col+24); /* Put the minimal stats */ ! for (i = 0; i < A_MAX; i++) { /* Label stats */ put_str(stat_names[i], 3+i, col); *************** *** 1437,1510 **** /* Indicate the state */ put_str("(Hit ESC to stop)", 12, col+13); - } - - /* Otherwise just get a character */ - else - { - /* Get a new character */ - get_stats(); - } - - /* Auto-roll */ - while (autoroll) - { - bool accept = TRUE; ! /* Get a new character */ ! get_stats(); ! /* Advance the round */ ! auto_round++; ! /* Hack -- Prevent overflow */ ! if (auto_round >= 1000000L) break; ! /* Check and count acceptable stats */ ! for (i = 0; i < 6; i++) ! { ! /* This stat is okay */ ! if (stat_use[i] >= stat_limit[i]) ! { ! stat_match[i]++; ! } ! /* This stat is not okay */ ! else { ! accept = FALSE; } - } ! /* Break if "happy" */ ! if (accept) break; ! /* Take note every 25 rolls */ ! flag = (!(auto_round % 25L)); ! /* Update display occasionally */ ! if (flag || (auto_round < last_round + 100)) ! { ! /* Dump data */ ! birth_put_stats(); ! ! /* Dump round */ ! put_str(format("%10ld", auto_round), 10, col+20); ! ! /* Make sure they see everything */ ! Term_fresh(); ! /* Delay 1/10 second */ ! if (flag) Term_xtra(TERM_XTRA_DELAY, 100); ! /* Do not wait for a key */ ! inkey_scan = TRUE; ! /* Check for a keypress */ ! if (inkey()) break; } } /* Flush input */ flush(); --- 1539,1632 ---- /* Indicate the state */ put_str("(Hit ESC to stop)", 12, col+13); ! /* Auto-roll */ ! while (1) ! { ! bool accept = TRUE; ! /* Get a new character */ ! get_stats(); ! /* Advance the round */ ! auto_round++; ! /* Hack -- Prevent overflow */ ! if (auto_round >= 1000000L) break; ! /* Check and count acceptable stats */ ! for (i = 0; i < A_MAX; i++) { ! /* This stat is okay */ ! if (stat_use[i] >= stat_limit[i]) ! { ! stat_match[i]++; ! } ! ! /* This stat is not okay */ ! else ! { ! accept = FALSE; ! } } ! /* Break if "happy" */ ! if (accept) break; ! /* Take note every 25 rolls */ ! flag = (!(auto_round % 25L)); ! /* Update display occasionally */ ! if (flag || (auto_round < last_round + 100)) ! { ! /* Put the stats (and percents) */ ! for (i = 0; i < A_MAX; i++) ! { ! /* Put the stat */ ! cnv_stat(stat_use[i], buf); ! c_put_str(TERM_L_GREEN, buf, 3+i, col+24); ! ! /* Put the percent */ ! if (stat_match[i]) ! { ! int p = 1000L * stat_match[i] / auto_round; ! byte attr = (p < 100) ? TERM_YELLOW : TERM_L_GREEN; ! sprintf(buf, "%3d.%d%%", p/10, p%10); ! c_put_str(attr, buf, 3+i, col+13); ! } ! ! /* Never happened */ ! else ! { ! c_put_str(TERM_RED, "(NONE)", 3+i, col+13); ! } ! } ! ! /* Dump round */ ! put_str(format("%10ld", auto_round), 10, col+20); ! ! /* Make sure they see everything */ ! Term_fresh(); ! /* Delay 1/10 second */ ! if (flag) Term_xtra(TERM_XTRA_DELAY, 100); ! /* Do not wait for a key */ ! inkey_scan = TRUE; ! /* Check for a keypress */ ! if (inkey()) break; ! } } } + /* Otherwise just get a character */ + else + { + /* Get a new character */ + get_stats(); + } + /* Flush input */ flush(); *************** *** 1579,1585 **** } /* Warning */ ! bell("Illegal autoroller command!"); } /* Are we done? */ --- 1701,1707 ---- } /* Warning */ ! bell("Illegal auto-roller command!"); } /* Are we done? */ *************** *** 1595,1602 **** /* Clear prompt */ clear_from(23); ! /*** Finish up ***/ /* Get a name, prepare savefile */ get_name(); --- 1717,1752 ---- /* Clear prompt */ clear_from(23); + /* Done */ + return (TRUE); + } + ! /* ! * Helper function for 'player_birth()'. ! * ! * See "display_player" for screen layout code. ! */ ! static bool player_birth_aux() ! { ! char c; ! ! /* Ask questions */ ! if (!player_birth_aux_1()) return (FALSE); ! ! /* Point-based */ ! if (adult_point_based) ! { ! /* Point based */ ! if (!player_birth_aux_2()) return (FALSE); ! } ! ! /* Random */ ! else ! { ! /* Auto-roll */ ! if (!player_birth_aux_3()) return (FALSE); ! } /* Get a name, prepare savefile */ get_name(); *************** *** 1662,1668 **** store_init(n); /* Ignore home */ ! if (n == MAX_STORES - 1) continue; /* Maintain the shop (ten times) */ for (i = 0; i < 10; i++) store_maint(n); --- 1812,1818 ---- store_init(n); /* Ignore home */ ! if (n == STORE_HOME) continue; /* Maintain the shop (ten times) */ for (i = 0; i < 10; i++) store_maint(n); diff -r -c angband-283/src/cave.c angband-285/src/cave.c *** angband-283/src/cave.c Mon Feb 9 01:18:52 1998 --- angband-285/src/cave.c Sun Sep 5 10:45:20 1999 *************** *** 323,332 **** { object_type *o_ptr; ! /* Acquire object */ o_ptr = &o_list[this_o_idx]; ! /* Acquire next object */ next_o_idx = o_ptr->next_o_idx; /* Forbid artifact grids */ --- 323,332 ---- { object_type *o_ptr; ! /* Get the object */ o_ptr = &o_list[this_o_idx]; ! /* Get the next object */ next_o_idx = o_ptr->next_o_idx; /* Forbid artifact grids */ *************** *** 452,459 **** * * Note that the "zero" entry in the feature/object/monster arrays are * used to provide "special" attr/char codes, with "monster zero" being ! * used for the player attr/char, "object zero" being used for the "stack" ! * attr/char, and "feature zero" being used for the "nothing" attr/char. * * Note that eventually we may want to use the "&" symbol for embedded * treasure, and use the "*" symbol to indicate multiple objects, but --- 452,459 ---- * * Note that the "zero" entry in the feature/object/monster arrays are * used to provide "special" attr/char codes, with "monster zero" being ! * used for the player attr/char, "object zero" being used for the "pile" ! * attr/char, and "feature zero" being used for the "darkness" attr/char. * * Note that eventually we may want to use the "&" symbol for embedded * treasure, and use the "*" symbol to indicate multiple objects, but *************** *** 590,595 **** --- 590,596 ---- bool image = p_ptr->image; + int floor_num = 0; /* Monster/Player */ m_idx = cave_m_idx[y][x]; *************** *** 632,637 **** --- 633,639 ---- if (image && (!rand_int(256)) && (feat < FEAT_PERM_SOLID)) { int i = image_random(); + a = PICT_A(i); c = PICT_C(i); } *************** *** 643,657 **** if ((info & (CAVE_MARK)) || (info & (CAVE_SEEN))) { ! /* Access floor */ f_ptr = &f_info[FEAT_FLOOR]; - /* Normal char */ - c = f_ptr->x_char; - /* Normal attr */ a = f_ptr->x_attr; /* Special lighting effects */ if (view_special_lite && (a == TERM_WHITE)) { --- 645,659 ---- if ((info & (CAVE_MARK)) || (info & (CAVE_SEEN))) { ! /* Get the floor feature */ f_ptr = &f_info[FEAT_FLOOR]; /* Normal attr */ a = f_ptr->x_attr; + /* Normal char */ + c = f_ptr->x_char; + /* Special lighting effects */ if (view_special_lite && (a == TERM_WHITE)) { *************** *** 692,698 **** /* Unknown */ else { ! /* Access darkness */ f_ptr = &f_info[FEAT_NONE]; /* Normal attr */ --- 694,700 ---- /* Unknown */ else { ! /* Get the darkness feature */ f_ptr = &f_info[FEAT_NONE]; /* Normal attr */ *************** *** 712,726 **** /* Apply "mimic" field */ feat = f_info[feat].mimic; ! /* Access feature */ f_ptr = &f_info[feat]; - /* Normal char */ - c = f_ptr->x_char; - /* Normal attr */ a = f_ptr->x_attr; /* Special lighting effects (walls only) */ if (view_granite_lite && (a == TERM_WHITE) && (feat >= FEAT_SECRET)) --- 714,728 ---- /* Apply "mimic" field */ feat = f_info[feat].mimic; ! /* Get the feature */ f_ptr = &f_info[feat]; /* Normal attr */ a = f_ptr->x_attr; + /* Normal char */ + c = f_ptr->x_char; + /* Special lighting effects (walls only) */ if (view_granite_lite && (a == TERM_WHITE) && (feat >= FEAT_SECRET)) *************** *** 750,756 **** /* Unknown */ else { ! /* Access darkness */ f_ptr = &f_info[FEAT_NONE]; /* Normal attr */ --- 752,758 ---- /* Unknown */ else { ! /* Get the darkness feature */ f_ptr = &f_info[FEAT_NONE]; /* Normal attr */ *************** *** 767,776 **** { object_type *o_ptr; ! /* Acquire object */ o_ptr = &o_list[this_o_idx]; ! /* Acquire next object */ next_o_idx = o_ptr->next_o_idx; /* Memorized objects */ --- 769,778 ---- { object_type *o_ptr; ! /* Get the object */ o_ptr = &o_list[this_o_idx]; ! /* Get the next object */ next_o_idx = o_ptr->next_o_idx; /* Memorized objects */ *************** *** 780,801 **** if (image) { int i = image_object(); a = PICT_A(i); c = PICT_C(i); } ! /* Normal */ ! else { ! /* Normal char */ ! c = object_char(o_ptr); /* Normal attr */ ! a = object_attr(o_ptr); ! } ! /* Done */ ! break; } } --- 782,819 ---- if (image) { int i = image_object(); + a = PICT_A(i); c = PICT_C(i); + + break; } ! /* Normal attr */ ! a = object_attr(o_ptr); ! ! /* Normal char */ ! c = object_char(o_ptr); ! ! /* First marked object */ ! if (!show_piles) break; ! ! /* Special stack symbol */ ! if (++floor_num > 1) { ! object_kind *k_ptr; ! ! /* Get the "pile" feature */ ! k_ptr = &k_info[0]; /* Normal attr */ ! a = k_ptr->x_attr; ! /* Normal char */ ! c = k_ptr->x_char; ! ! break; ! } } } *************** *** 823,828 **** --- 841,847 ---- if (image) { int i = image_monster(); + a = PICT_A(i); c = PICT_C(i); } *************** *** 830,880 **** /* Ignore weird codes */ else if (avoid_other) { - /* Use char */ - c = dc; - /* Use attr */ a = da; } /* Special attr/char codes */ else if ((da & 0x80) && (dc & 0x80)) { - /* Use char */ - c = dc; - /* Use attr */ a = da; } /* Multi-hued monster */ else if (r_ptr->flags1 & (RF1_ATTR_MULTI)) { - /* Normal char */ - c = dc; - /* Multi-hued attr */ a = randint(15); } /* Normal monster (not "clear" in any way) */ else if (!(r_ptr->flags1 & (RF1_ATTR_CLEAR | RF1_CHAR_CLEAR))) { - /* Use char */ - c = dc; - /* Use attr */ a = da; } /* Hack -- Bizarre grid under monster */ else if ((a & 0x80) || (c & 0x80)) { - /* Use char */ - c = dc; - /* Use attr */ a = da; } /* Normal char, Clear attr, monster */ --- 849,899 ---- /* Ignore weird codes */ else if (avoid_other) { /* Use attr */ a = da; + + /* Use char */ + c = dc; } /* Special attr/char codes */ else if ((da & 0x80) && (dc & 0x80)) { /* Use attr */ a = da; + + /* Use char */ + c = dc; } /* Multi-hued monster */ else if (r_ptr->flags1 & (RF1_ATTR_MULTI)) { /* Multi-hued attr */ a = randint(15); + + /* Normal char */ + c = dc; } /* Normal monster (not "clear" in any way) */ else if (!(r_ptr->flags1 & (RF1_ATTR_CLEAR | RF1_CHAR_CLEAR))) { /* Use attr */ a = da; + + /* Use char */ + c = dc; } /* Hack -- Bizarre grid under monster */ else if ((a & 0x80) || (c & 0x80)) { /* Use attr */ a = da; + + /* Use char */ + c = dc; } /* Normal char, Clear attr, monster */ *************** *** 1038,1044 **** { object_type *o_ptr = &o_list[this_o_idx]; ! /* Acquire next object */ next_o_idx = o_ptr->next_o_idx; /* Memorize objects */ --- 1057,1063 ---- { object_type *o_ptr = &o_list[this_o_idx]; ! /* Get the next object */ next_o_idx = o_ptr->next_o_idx; /* Memorize objects */ *************** *** 1230,1236 **** /* Feature index */ p0 = priority_table[i][0]; ! /* Access the feature */ f_ptr = &f_info[p0]; /* Check character and attribute, accept matches */ --- 1249,1255 ---- /* Feature index */ p0 = priority_table[i][0]; ! /* Get the feature */ f_ptr = &f_info[p0]; /* Check character and attribute, accept matches */ *************** *** 1518,1524 **** * which grids have been "memorized" by the player. This flag is used by * the "map_info()" function to determine if a grid should be displayed. * This flag is used in a few other places to determine if the player can ! * "know" about a given grid. This flag must be very fast. * * The "CAVE_GLOW" flag is saved in the savefile and is used to determine * which grids are "permanently illuminated". This flag is used by the --- 1537,1543 ---- * which grids have been "memorized" by the player. This flag is used by * the "map_info()" function to determine if a grid should be displayed. * This flag is used in a few other places to determine if the player can ! * "know" about a given grid. This flag must be very fast. * * The "CAVE_GLOW" flag is saved in the savefile and is used to determine * which grids are "permanently illuminated". This flag is used by the *************** *** 1670,1676 **** * two wall grids which form the "entrance" to the room would not be marked * as "CAVE_SEEN", since of the three "touching" grids nearer to the player * than each wall grid, only the farthest of these grids is itself marked ! * "CAVE_GLOW". * * * Here are some pictures of the legal "light source" radius values, in --- 1689,1695 ---- * two wall grids which form the "entrance" to the room would not be marked * as "CAVE_SEEN", since of the three "touching" grids nearer to the player * than each wall grid, only the farthest of these grids is itself marked ! * "CAVE_GLOW". * * * Here are some pictures of the legal "light source" radius values, in *************** *** 1681,1687 **** * * Rad=0 Rad=1 Rad=2 Rad=3 * No-Lite Torch,etc Lantern Artifacts ! * * 333 * 333 43334 * 212 32123 3321233 --- 1700,1706 ---- * * Rad=0 Rad=1 Rad=2 Rad=3 * No-Lite Torch,etc Lantern Artifacts ! * * 333 * 333 43334 * 212 32123 3321233 *************** *** 2910,2916 **** tx = flow_x[flow_head]; /* Forget that entry (with wrap) */ ! if (++flow_head == TEMP_MAX) flow_head = 0; /* Child cost */ n = cave_cost[ty][tx] + 1; --- 2929,2935 ---- tx = flow_x[flow_head]; /* Forget that entry (with wrap) */ ! if (++flow_head == FLOW_MAX) flow_head = 0; /* Child cost */ n = cave_cost[ty][tx] + 1; *************** *** 3112,3118 **** { int i, y, x; ! /* Forget every grid */ for (y = 0; y < DUNGEON_HGT; y++) { --- 3131,3137 ---- { int i, y, x; ! /* Forget every grid */ for (y = 0; y < DUNGEON_HGT; y++) { *************** *** 3218,3224 **** /* Illuminate the grid */ cave_info[yy][xx] |= (CAVE_GLOW); ! /* Hack -- Memorize grids */ if (view_perma_grids) { --- 3237,3243 ---- /* Illuminate the grid */ cave_info[yy][xx] |= (CAVE_GLOW); ! /* Hack -- Memorize grids */ if (view_perma_grids) { *************** *** 3708,3713 **** --- 3727,3735 ---- { /* Cancel */ p_ptr->running = 0; + + /* Check for new panel if appropriate */ + if (center_player && run_avoid_center) verify_panel(); /* Calculate torch radius */ p_ptr->update |= (PU_TORCH); diff -r -c angband-283/src/cmd1.c angband-285/src/cmd1.c *** angband-283/src/cmd1.c Wed Feb 11 06:30:28 1998 --- angband-285/src/cmd1.c Sun Aug 22 17:22:04 1999 *************** *** 426,433 **** /* Message */ msg_print("You have found a secret door."); ! /* Pick a door XXX XXX XXX */ ! cave_set_feat(y, x, FEAT_DOOR_HEAD + 0x00); /* Disturb */ disturb(0, 0); --- 426,433 ---- /* Message */ msg_print("You have found a secret door."); ! /* Pick a door */ ! place_closed_door(y, x); /* Disturb */ disturb(0, 0); *************** *** 438,447 **** { object_type *o_ptr; ! /* Acquire object */ o_ptr = &o_list[this_o_idx]; ! /* Acquire next object */ next_o_idx = o_ptr->next_o_idx; /* Skip non-chests */ --- 438,447 ---- { object_type *o_ptr; ! /* Get the object */ o_ptr = &o_list[this_o_idx]; ! /* Get the next object */ next_o_idx = o_ptr->next_o_idx; /* Skip non-chests */ *************** *** 469,480 **** } /* ! * Make the player carry everything in a grid * ! * If "pickup" is FALSE then only gold will be picked up */ void py_pickup(int pickup) { --- 469,542 ---- } + /* + * Determine if the object can be picked up, and has "=g" in its inscription. + */ + static bool auto_pickup_okay(object_type *o_ptr) + { + cptr s; + + /* It can't be carried */ + if (!inven_carry_okay(o_ptr)) return (FALSE); + + /* No inscription */ + if (!o_ptr->note) return (FALSE); + + /* Find a '=' */ + s = strchr(quark_str(o_ptr->note), '='); + + /* Process inscription */ + while (s) + { + /* Auto-pickup on "=g" */ + if (s[1] == 'g') return (TRUE); + + /* Find another '=' */ + s = strchr(s + 1, '='); + } + + /* Don't auto pickup */ + return (FALSE); + } + + + /* + * Helper routine for py_pickup() and py_pickup_floor(). + * + * Add the given dungeon object to the character's inventory. + * + * Delete the object afterwards. + */ + static void py_pickup_aux(int o_idx) + { + int slot; + + char o_name[80]; + object_type *o_ptr; + + o_ptr = &o_list[o_idx]; + + /* Carry the object */ + slot = inven_carry(o_ptr); + + /* Get the object again */ + o_ptr = &inventory[slot]; + + /* Describe the object */ + object_desc(o_name, o_ptr, TRUE, 3); + + /* Message */ + msg_format("You have %s (%c).", o_name, index_to_label(slot)); + + /* Delete the object */ + delete_object_idx(o_idx); + } /* ! * Make the player carry everything in a grid. * ! * If "pickup" is FALSE then only gold will be picked up. */ void py_pickup(int pickup) { *************** *** 483,503 **** s16b this_o_idx, next_o_idx = 0; char o_name[80]; /* Scan the pile of objects */ for (this_o_idx = cave_o_idx[py][px]; this_o_idx; this_o_idx = next_o_idx) { ! object_type *o_ptr; ! ! /* Acquire object */ o_ptr = &o_list[this_o_idx]; /* Describe the object */ object_desc(o_name, o_ptr, TRUE, 3); ! /* Acquire next object */ next_o_idx = o_ptr->next_o_idx; /* Hack -- disturb */ --- 545,574 ---- s16b this_o_idx, next_o_idx = 0; + object_type *o_ptr; + char o_name[80]; + #ifdef ALLOW_EASY_FLOOR + + int last_o_idx = 0; + + int can_pickup = 0; + int not_pickup = 0; + + #endif /* ALLOW_EASY_FLOOR */ + /* Scan the pile of objects */ for (this_o_idx = cave_o_idx[py][px]; this_o_idx; this_o_idx = next_o_idx) { ! /* Get the object */ o_ptr = &o_list[this_o_idx]; /* Describe the object */ object_desc(o_name, o_ptr, TRUE, 3); ! /* Get the next object */ next_o_idx = o_ptr->next_o_idx; /* Hack -- disturb */ *************** *** 521,582 **** /* Delete the gold */ delete_object_idx(this_o_idx); } ! /* Pick up objects */ ! else { ! /* Describe the object */ ! if (!pickup) { msg_format("You see %s.", o_name); } ! /* Note that the pack is too full */ ! else if (!inven_carry_okay(o_ptr)) { msg_format("You have no room for %s.", o_name); } ! /* Pick up the item (if requested and allowed) */ else { ! int okay = TRUE; ! ! /* Hack -- query every item */ ! if (carry_query_flag) ! { ! char out_val[160]; ! sprintf(out_val, "Pick up %s? ", o_name); ! okay = get_check(out_val); ! } ! /* Attempt to pick up an object. */ ! if (okay) ! { ! int slot; ! /* Carry the item */ ! slot = inven_carry(o_ptr); ! /* Get the item again */ ! o_ptr = &inventory[slot]; ! /* Describe the object */ ! object_desc(o_name, o_ptr, TRUE, 3); ! /* Message */ ! msg_format("You have %s (%c).", o_name, index_to_label(slot)); ! /* Delete the object */ ! delete_object_idx(this_o_idx); ! } ! } } } - } --- 592,766 ---- /* Delete the gold */ delete_object_idx(this_o_idx); + + /* Check the next object */ + continue; } ! /* Test for auto-pickup */ ! if (auto_pickup_okay(o_ptr)) { ! /* Pick up the object */ ! py_pickup_aux(this_o_idx); ! ! /* Check the next object */ ! continue; ! } ! ! #ifdef ALLOW_EASY_FLOOR ! ! /* Easy Floor */ ! if (easy_floor) ! { ! /* Pickup if possible */ ! if (pickup && inven_carry_okay(o_ptr)) ! { ! /* Pick up if allowed */ ! if (!carry_query_flag) ! { ! /* Pick up the object */ ! py_pickup_aux(this_o_idx); ! } ! ! /* Else count */ ! else ! { ! /* Remember */ ! last_o_idx = this_o_idx; ! ! /* Count */ ! ++can_pickup; ! } ! } ! ! /* Else count */ ! else { + /* Remember */ + last_o_idx = this_o_idx; + + /* Count */ + ++not_pickup; + } + + /* Check the next object */ + continue; + } + + #endif /* ALLOW_EASY_FLOOR */ + + /* Describe the object */ + if (!pickup) + { + msg_format("You see %s.", o_name); + + /* Check the next object */ + continue; + } + + /* Note that the pack is too full */ + if (!inven_carry_okay(o_ptr)) + { + msg_format("You have no room for %s.", o_name); + + /* Check the next object */ + continue; + } + + /* Query before picking up */ + if (carry_query_flag) + { + char out_val[160]; + sprintf(out_val, "Pick up %s? ", o_name); + if (!get_check(out_val)) continue; + } + + /* Pick up the object */ + py_pickup_aux(this_o_idx); + } + + #ifdef ALLOW_EASY_FLOOR + + /* Easy floor, objects left */ + if (easy_floor && (can_pickup + not_pickup > 0)) + { + /* Not picking up */ + if (!pickup) + { + /* One object */ + if (not_pickup == 1) + { + /* Get the object */ + o_ptr = &o_list[last_o_idx]; + + /* Describe the object */ + object_desc(o_name, o_ptr, TRUE, 3); + + /* Message */ msg_format("You see %s.", o_name); } ! /* Multiple objects */ ! else { + /* Message */ + msg_format("You see a pile of %d objects.", not_pickup); + } + + /* Done */ + return; + } + + /* No room */ + if (!can_pickup) + { + /* One object */ + if (not_pickup == 1) + { + /* Get the object */ + o_ptr = &o_list[last_o_idx]; + + /* Describe the object */ + object_desc(o_name, o_ptr, TRUE, 3); + + /* Message */ msg_format("You have no room for %s.", o_name); } ! /* Multiple objects */ else { ! /* Message */ ! msg_print("You have no room for any of the objects on the floor."); ! } ! /* Done */ ! return; ! } ! /* Pick up objects */ ! while (1) ! { ! cptr q, s; ! int item; ! /* Restrict the choices */ ! item_tester_hook = inven_carry_okay; ! /* Get an object*/ ! q = "Get which item? "; ! s = NULL; ! if (!get_item(&item, q, s, (USE_FLOOR))) break; ! /* Pick up the object */ ! py_pickup_aux(0 - item); } } + #endif /* ALLOW_EASY_FLOOR */ + } *************** *** 897,903 **** bool do_quake = FALSE; ! /* Access the monster */ m_ptr = &m_list[cave_m_idx[y][x]]; r_ptr = &r_info[m_ptr->r_idx]; --- 1081,1087 ---- bool do_quake = FALSE; ! /* Get the monster */ m_ptr = &m_list[cave_m_idx[y][x]]; r_ptr = &r_info[m_ptr->r_idx]; *************** *** 932,938 **** } ! /* Access the weapon */ o_ptr = &inventory[INVEN_WIELD]; /* Calculate the "attack quality" */ --- 1116,1122 ---- } ! /* Get the weapon */ o_ptr = &inventory[INVEN_WIELD]; /* Calculate the "attack quality" */ *************** *** 1056,1062 **** * Note that this routine handles monsters in the destination grid, * and also handles attempting to move into walls/doors/rubble/etc. */ ! void move_player(int dir, int do_pickup) { int py = p_ptr->py; int px = p_ptr->px; --- 1240,1246 ---- * Note that this routine handles monsters in the destination grid, * and also handles attempting to move into walls/doors/rubble/etc. */ ! void move_player(int dir, int jumping) { int py = p_ptr->py; int px = p_ptr->px; *************** *** 1076,1081 **** --- 1260,1282 ---- py_attack(y, x); } + /* Optionally alter known traps/doors on (non-jumping) movement */ + else if (easy_alter && !jumping && + (cave_info[y][x] & (CAVE_MARK)) && + (cave_feat[y][x] >= FEAT_TRAP_HEAD) && + (cave_feat[y][x] <= FEAT_DOOR_TAIL)) + { + /* Hack -- Optional auto-repeat */ + if (always_repeat && (p_ptr->command_arg <= 0) && !command_repeating) + { + /* Repeat 99 times */ + p_ptr->command_arg = 99; + } + + /* Alter */ + do_cmd_alter(); + } + /* Player can not walk through "walls" */ else if (!cave_floor_bold(y, x)) { *************** *** 1164,1170 **** } /* Handle "objects" */ ! py_pickup(do_pickup); /* Handle "store doors" */ if ((cave_feat[y][x] >= FEAT_SHOP_HEAD) && --- 1365,1371 ---- } /* Handle "objects" */ ! py_pickup(jumping != always_pickup); /* Handle "store doors" */ if ((cave_feat[y][x] >= FEAT_SHOP_HEAD) && *************** *** 1175,1180 **** --- 1376,1384 ---- /* Hack -- Enter store */ p_ptr->command_new = '_'; + + /* Free turn XXX XXX XXX */ + p_ptr->energy_use = 0; } /* Discover invisible traps */ *************** *** 1587,1596 **** { object_type *o_ptr; ! /* Acquire object */ o_ptr = &o_list[this_o_idx]; ! /* Acquire next object */ next_o_idx = o_ptr->next_o_idx; /* Visible object */ --- 1791,1800 ---- { object_type *o_ptr; ! /* Get the object */ o_ptr = &o_list[this_o_idx]; ! /* Get the next object */ next_o_idx = o_ptr->next_o_idx; /* Visible object */ *************** *** 1934,1940 **** /* Take time */ p_ptr->energy_use = 100; ! /* Move the player, using the "pickup" flag */ ! move_player(p_ptr->run_cur_dir, always_pickup); } --- 2138,2144 ---- /* Take time */ p_ptr->energy_use = 100; ! /* Move the player */ ! move_player(p_ptr->run_cur_dir, FALSE); } diff -r -c angband-283/src/cmd2.c angband-285/src/cmd2.c *** angband-283/src/cmd2.c Fri Feb 6 04:10:31 1998 --- angband-285/src/cmd2.c Wed Sep 1 17:56:34 1999 *************** *** 26,31 **** --- 26,38 ---- return; } + /* Ironman */ + if (adult_ironman) + { + msg_print("Nothing happens!"); + return; + } + /* Hack -- take a turn */ p_ptr->energy_use = 100; *************** *** 149,158 **** { object_type *o_ptr; ! /* Acquire object */ o_ptr = &o_list[this_o_idx]; ! /* Acquire next object */ next_o_idx = o_ptr->next_o_idx; /* Skip unknown chests XXX XXX */ --- 156,165 ---- { object_type *o_ptr; ! /* Get the object */ o_ptr = &o_list[this_o_idx]; ! /* Get the next object */ next_o_idx = o_ptr->next_o_idx; /* Skip unknown chests XXX XXX */ *************** *** 190,196 **** object_type object_type_body; ! /* Access chest */ o_ptr = &o_list[o_idx]; /* Small chests often hold "gold" */ --- 197,203 ---- object_type object_type_body; ! /* Get the chest */ o_ptr = &o_list[o_idx]; /* Small chests often hold "gold" */ *************** *** 472,477 **** --- 479,587 ---- } + #if defined(ALLOW_EASY_OPEN) + + /* + * Return the number of features around (or under) the character. + * Usually look for doors and floor traps. + */ + static int count_feats(int *y, int *x, byte f1, byte f2) + { + int d, count; + + /* Count how many matches */ + count = 0; + + /* Check around (and under) the character */ + for (d = 0; d < 9; d++) + { + /* Extract adjacent (legal) location */ + int yy = p_ptr->py + ddy_ddd[d]; + int xx = p_ptr->px + ddx_ddd[d]; + + /* Must have knowledge */ + if (!(cave_info[yy][xx] & (CAVE_MARK))) continue; + + /* Not looking for this feature */ + if (cave_feat[yy][xx] < f1) continue; + if (cave_feat[yy][xx] > f2) continue; + + /* Count it */ + ++count; + + /* Remember the location of the last door found */ + *y = yy; + *x = xx; + } + + /* All done */ + return count; + } + + + /* + * Return the number of chests around (or under) the character. + * If requested, count only trapped chests. + */ + static int count_chests(int *y, int *x, bool trapped) + { + int d, count, o_idx; + + object_type *o_ptr; + + /* Count how many matches */ + count = 0; + + /* Check around (and under) the character */ + for (d = 0; d < 9; d++) + { + /* Extract adjacent (legal) location */ + int yy = p_ptr->py + ddy_ddd[d]; + int xx = p_ptr->px + ddx_ddd[d]; + + /* No (visible) chest is there */ + if ((o_idx = chest_check(yy, xx)) == 0) continue; + + /* Grab the object */ + o_ptr = &o_list[o_idx]; + + /* Already open */ + if (o_ptr->pval == 0) continue; + + /* No (known) traps here */ + if (trapped && + (!object_known_p(o_ptr) || + (o_ptr->pval < 0) || + !chest_traps[o_ptr->pval])) + { + continue; + } + + /* Count it */ + ++count; + + /* Remember the location of the last chest found */ + *y = yy; + *x = xx; + } + + /* All done */ + return count; + } + + + /* + * Extract a "direction" which will move one step from the player location + * towards the given "target" location (or "5" if no motion necessary). + */ + static int coords_to_dir(int y, int x) + { + return (motion_dir(p_ptr->py, p_ptr->px, y, x)); + } + + #endif /* ALLOW_EASY_OPEN */ + + /* * Determine if a given grid may be "opened" */ *************** *** 615,620 **** --- 725,744 ---- bool more = FALSE; + #ifdef ALLOW_EASY_OPEN + + /* Easy Open */ + if (easy_open) + { + /* Handle a single closed door or locked chest */ + if ((count_feats(&y, &x, FEAT_DOOR_HEAD, FEAT_DOOR_TAIL) + + count_chests(&y, &x, FALSE)) == 1) + { + p_ptr->command_dir = coords_to_dir(y, x); + } + } + + #endif /* ALLOW_EASY_OPEN */ /* Get a direction (or abort) */ if (!get_rep_dir(&dir)) return; *************** *** 772,777 **** --- 896,914 ---- bool more = FALSE; + #ifdef ALLOW_EASY_OPEN + + /* Easy Close */ + if (easy_open) + { + /* Handle a single open door */ + if (count_feats(&y, &x, FEAT_OPEN, FEAT_OPEN) == 1) + { + p_ptr->command_dir = coords_to_dir(y, x); + } + } + + #endif /* ALLOW_EASY_OPEN */ /* Get a direction (or abort) */ if (!get_rep_dir(&dir)) return; *************** *** 1213,1219 **** if (!do_cmd_disarm_test(y, x)) return (FALSE); ! /* Access trap name */ name = (f_name + f_info[cave_feat[y][x]].name); /* Get the "disarm" factor */ --- 1350,1356 ---- if (!do_cmd_disarm_test(y, x)) return (FALSE); ! /* Get the trap name */ name = (f_name + f_info[cave_feat[y][x]].name); /* Get the "disarm" factor */ *************** *** 1292,1297 **** --- 1429,1448 ---- bool more = FALSE; + #ifdef ALLOW_EASY_OPEN + + /* Easy Disarm */ + if (easy_open) + { + /* Handle a single visible trap or trapped chest */ + if ((count_feats(&y, &x, FEAT_TRAP_HEAD, FEAT_TRAP_TAIL) + + count_chests(&y, &x, TRUE)) == 1) + { + p_ptr->command_dir = coords_to_dir(y, x); + } + } + + #endif /* ALLOW_EASY_OPEN */ /* Get a direction (or abort) */ if (!get_rep_dir(&dir)) return; *************** *** 1665,1670 **** --- 1816,1832 ---- /* Tunnel */ more = do_cmd_disarm_aux(y, x); } + + #if 0 + + /* Close open doors */ + else if (feat == FEAT_OPEN) + { + /* Close */ + more = do_cmd_close_aux(y, x); + } + + #endif /* Oops */ else *************** *** 1851,1856 **** --- 2013,2021 ---- /* Door */ else if (cave_feat[y][x] < FEAT_SECRET) { + /* Hack -- Easy open XXX XXX XXX */ + if (easy_alter) return (TRUE); + /* Message */ msg_print("There is a door in the way!"); } *************** *** 1872,1880 **** /* ! * Helper function for the "walk" and "jump" commands */ ! static void do_cmd_walk_or_jump(int pickup) { int py = p_ptr->py; int px = p_ptr->px; --- 2037,2045 ---- /* ! * Helper function for the "walk" and "jump" commands. */ ! static void do_cmd_walk_or_jump(int jumping) { int py = p_ptr->py; int px = p_ptr->px; *************** *** 1924,1950 **** } /* Move the player */ ! move_player(dir, pickup); } /* ! * Walk into a grid (usually pickup) */ void do_cmd_walk(void) { ! /* Move (usually pickup) */ ! do_cmd_walk_or_jump(always_pickup); } /* ! * Jump into a grid (usually do not pickup) */ void do_cmd_jump(void) { ! /* Move (usually do not pickup) */ ! do_cmd_walk_or_jump(!always_pickup); } --- 2089,2115 ---- } /* Move the player */ ! move_player(dir, jumping); } /* ! * Walk into a grid. */ void do_cmd_walk(void) { ! /* Move (normal) */ ! do_cmd_walk_or_jump(FALSE); } /* ! * Jump into a grid. */ void do_cmd_jump(void) { ! /* Move (jump) */ ! do_cmd_walk_or_jump(TRUE); } *************** *** 2037,2042 **** --- 2202,2210 ---- /* Hack -- enter store */ p_ptr->command_new = '_'; + + /* Free turn XXX XXX XXX */ + p_ptr->energy_use = 0; } } *************** *** 2157,2169 **** /* Often break */ case TV_LITE: case TV_SCROLL: - case TV_ARROW: case TV_SKELETON: { return (50); } /* Sometimes break */ case TV_WAND: case TV_SHOT: case TV_BOLT: --- 2325,2342 ---- /* Often break */ case TV_LITE: case TV_SCROLL: case TV_SKELETON: { return (50); } /* Sometimes break */ + case TV_ARROW: + { + return (35); + } + + /* Sometimes break */ case TV_WAND: case TV_SHOT: case TV_BOLT: *************** *** 2256,2262 **** s = "You have nothing to fire."; if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return; ! /* Access the item (if in the pack) */ if (item >= 0) { o_ptr = &inventory[item]; --- 2429,2435 ---- s = "You have nothing to fire."; if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return; ! /* Get the object */ if (item >= 0) { o_ptr = &inventory[item]; *************** *** 2547,2553 **** s = "You have nothing to throw."; if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return; ! /* Access the item (if in the pack) */ if (item >= 0) { o_ptr = &inventory[item]; --- 2720,2726 ---- s = "You have nothing to throw."; if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return; ! /* Get the object */ if (item >= 0) { o_ptr = &inventory[item]; diff -r -c angband-283/src/cmd3.c angband-285/src/cmd3.c *** angband-283/src/cmd3.c Wed Feb 11 06:30:28 1998 --- angband-285/src/cmd3.c Sun Sep 5 12:25:33 1999 *************** *** 20,28 **** */ void do_cmd_inven(void) { ! /* Note that we are in "inventory" mode */ ! p_ptr->command_wrk = FALSE; ! /* Save screen */ screen_save(); --- 20,27 ---- */ void do_cmd_inven(void) { ! /* Hack -- Start in "inventory" mode */ ! p_ptr->command_wrk = (USE_INVEN); /* Save screen */ screen_save(); *************** *** 67,75 **** */ void do_cmd_equip(void) { ! /* Note that we are in "equipment" mode */ ! p_ptr->command_wrk = TRUE; ! /* Save screen */ screen_save(); --- 66,73 ---- */ void do_cmd_equip(void) { ! /* Hack -- Start in "equipment" mode */ ! p_ptr->command_wrk = (USE_EQUIP); /* Save screen */ screen_save(); *************** *** 206,212 **** floor_item_optimize(0 - item); } ! /* Access the wield slot */ o_ptr = &inventory[slot]; /* Take off existing item */ --- 204,210 ---- floor_item_optimize(0 - item); } ! /* Get the wield slot */ o_ptr = &inventory[slot]; /* Take off existing item */ *************** *** 255,261 **** /* Warn the player */ msg_print("Oops! It feels deathly cold!"); ! /* Note the curse */ o_ptr->ident |= (IDENT_SENSE); } --- 253,265 ---- /* Warn the player */ msg_print("Oops! It feels deathly cold!"); ! /* Remove special inscription, if any */ ! if (o_ptr->discount >= INSCRIP_NULL) o_ptr->discount = 0; ! ! /* Sense the object if allowed */ ! if (o_ptr->discount == 0) o_ptr->discount = IDENT_CURSED; ! ! /* The object has been "sensed" */ o_ptr->ident |= (IDENT_SENSE); } *************** *** 436,453 **** /* Artifacts cannot be destroyed */ if (artifact_p(o_ptr)) { ! cptr feel = "special"; /* Message */ msg_format("You cannot destroy %s.", o_name); /* Hack -- Handle icky artifacts */ ! if (cursed_p(o_ptr) || broken_p(o_ptr)) feel = "terrible"; ! /* Hack -- inscribe the artifact */ ! o_ptr->note = quark_add(feel); ! /* We have "felt" it (again) */ o_ptr->ident |= (IDENT_SENSE); /* Combine the pack */ --- 440,460 ---- /* Artifacts cannot be destroyed */ if (artifact_p(o_ptr)) { ! int feel = INSCRIP_SPECIAL; /* Message */ msg_format("You cannot destroy %s.", o_name); /* Hack -- Handle icky artifacts */ ! if (cursed_p(o_ptr) || broken_p(o_ptr)) feel = INSCRIP_TERRIBLE; ! ! /* Remove special inscription, if any */ ! if (o_ptr->discount >= INSCRIP_NULL) o_ptr->discount = 0; ! /* Sense the object if allowed */ ! if (o_ptr->discount == 0) o_ptr->discount = feel; ! /* The object has been "sensed" */ o_ptr->ident |= (IDENT_SENSE); /* Combine the pack */ *************** *** 595,601 **** char o_name[80]; ! char tmp[81]; cptr q, s; --- 602,608 ---- char o_name[80]; ! char tmp[80]; cptr q, s; *************** *** 631,637 **** if (o_ptr->note) { /* Start with the old inscription */ ! strcpy(tmp, quark_str(o_ptr->note)); } /* Get a new inscription (possibly empty) */ --- 638,644 ---- if (o_ptr->note) { /* Start with the old inscription */ ! strnfmt(tmp, 80, "%s", quark_str(o_ptr->note)); } /* Get a new inscription (possibly empty) */ *************** *** 658,666 **** /* Flasks of oil are okay */ if (o_ptr->tval == TV_FLASK) return (TRUE); ! /* Torches are okay */ if ((o_ptr->tval == TV_LITE) && ! (o_ptr->sval == SV_LITE_LANTERN)) return (TRUE); /* Assume not okay */ return (FALSE); --- 665,677 ---- /* Flasks of oil are okay */ if (o_ptr->tval == TV_FLASK) return (TRUE); ! /* Non-empty lanterns are okay */ if ((o_ptr->tval == TV_LITE) && ! (o_ptr->sval == SV_LITE_LANTERN) && ! (o_ptr->pval > 0)) ! { ! return (TRUE); ! } /* Assume not okay */ return (FALSE); *************** *** 684,691 **** item_tester_hook = item_tester_refill_lantern; /* Get an item */ ! q = "Refill with which flask? "; ! s = "You have no flasks of oil."; if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return; /* Get the item (in the pack) */ --- 695,702 ---- item_tester_hook = item_tester_refill_lantern; /* Get an item */ ! q = "Refill with which source of oil? "; ! s = "You have no sources of oil."; if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return; /* Get the item (in the pack) */ *************** *** 704,710 **** /* Take a partial turn */ p_ptr->energy_use = 50; ! /* Access the lantern */ j_ptr = &inventory[INVEN_LITE]; /* Refuel */ --- 715,721 ---- /* Take a partial turn */ p_ptr->energy_use = 50; ! /* Get the lantern */ j_ptr = &inventory[INVEN_LITE]; /* Refuel */ *************** *** 720,727 **** msg_print("Your lamp is full."); } /* Decrease the item (from the pack) */ ! if (item >= 0) { inven_item_increase(item, -1); inven_item_describe(item); --- 731,751 ---- msg_print("Your lamp is full."); } + /* Use fuel from a lantern */ + if (o_ptr->sval == SV_LITE_LANTERN) + { + /* No more fuel */ + o_ptr->pval = 0; + + /* Combine / Reorder the pack (later) */ + p_ptr->notice |= (PN_COMBINE | PN_REORDER); + + /* Window stuff */ + p_ptr->window |= (PW_INVEN); + } + /* Decrease the item (from the pack) */ ! else if (item >= 0) { inven_item_increase(item, -1); inven_item_describe(item); *************** *** 738,743 **** --- 762,770 ---- /* Recalculate torch */ p_ptr->update |= (PU_TORCH); + + /* Window stuff */ + p_ptr->window |= (PW_EQUIP); } *************** *** 793,799 **** /* Take a partial turn */ p_ptr->energy_use = 50; ! /* Access the primary torch */ j_ptr = &inventory[INVEN_LITE]; /* Refuel */ --- 820,826 ---- /* Take a partial turn */ p_ptr->energy_use = 50; ! /* Get the primary torch */ j_ptr = &inventory[INVEN_LITE]; /* Refuel */ *************** *** 833,838 **** --- 860,868 ---- /* Recalculate torch */ p_ptr->update |= (PU_TORCH); + + /* Window stuff */ + p_ptr->window |= (PW_EQUIP); } *************** *** 948,953 **** --- 978,992 ---- "Map sector [%d,%d], which is%s your sector. Direction?", (y2 / PANEL_HGT), (x2 / PANEL_WID), tmp_val); + /* More detail */ + if (center_player) + { + sprintf(out_val, + "Map sector [%d(%02d),%d(%02d)], which is%s your sector. Direction?", + (y2 / PANEL_HGT), (y2 % PANEL_HGT), + (x2 / PANEL_WID), (x2 % PANEL_WID), tmp_val); + } + /* Assume no direction */ dir = 0; *************** *** 1223,1233 **** char c1, c2; ! /* Access the chars */ c1 = r_ptr->d_char; c2 = r_ptr->x_char; ! /* Access the attrs */ a1 = r_ptr->d_attr; a2 = r_ptr->x_attr; --- 1262,1272 ---- char c1, c2; ! /* Get the chars */ c1 = r_ptr->d_char; c2 = r_ptr->x_char; ! /* Get the attrs */ a1 = r_ptr->d_attr; a2 = r_ptr->x_attr; diff -r -c angband-283/src/cmd4.c angband-285/src/cmd4.c *** angband-283/src/cmd4.c Wed Feb 11 06:30:28 1998 --- angband-285/src/cmd4.c Fri Sep 3 14:25:19 1999 *************** *** 132,146 **** /* File dump */ else if (c == 'f') { ! char tmp[81]; ! sprintf(tmp, "%s.txt", op_ptr->base_name); ! if (get_string("File name: ", tmp, 80)) { ! if (tmp[0] && (tmp[0] != ' ')) { ! file_character(tmp, FALSE); } } } --- 132,146 ---- /* File dump */ else if (c == 'f') { ! char ftmp[80]; ! sprintf(ftmp, "%s.txt", op_ptr->base_name); ! if (get_string("File name: ", ftmp, 80)) { ! if (ftmp[0] && (ftmp[0] != ' ')) { ! file_character(ftmp, FALSE); } } } *************** *** 195,202 **** { int i, j, k, n, q; ! char shower[81]; ! char finder[81]; /* Wipe finder */ --- 195,202 ---- { int i, j, k, n, q; ! char shower[80]; ! char finder[80]; /* Wipe finder */ *************** *** 386,534 **** } - /* - * Cheating options -- textual names - */ - cptr cheating_text[CHEAT_MAX] = - { - "cheat_peek", - "cheat_hear", - "cheat_room", - "cheat_xtra", - "cheat_know", - "cheat_live" - }; /* ! * Cheating options -- descriptions */ ! cptr cheating_desc[CHEAT_MAX] = { ! "Peek into object creation", ! "Peek into monster creation", ! "Peek into dungeon creation", ! "Peek into something else", ! "Know complete monster info", ! "Allow player to avoid death" ! }; /* ! * Interact with some options */ ! static void do_cmd_options_cheat(cptr info) { ! char ch; ! int i, k = 0, n = CHEAT_MAX; ! char buf[80]; ! /* Clear screen */ ! Term_clear(); ! /* Interact with the player */ ! while (TRUE) { ! /* Prompt XXX XXX XXX */ ! sprintf(buf, "%s (RET to advance, y/n to set, ESC to accept) ", info); ! prt(buf, 0, 0); ! ! /* Display the options */ ! for (i = 0; i < n; i++) ! { ! byte a = TERM_WHITE; ! ! /* Color current option */ ! if (i == k) a = TERM_L_BLUE; ! ! /* Display the option text */ ! sprintf(buf, "%-48s: %s (%s)", ! cheating_desc[i], ! p_ptr->cheat[i] ? "yes" : "no ", ! cheating_text[i]); ! c_prt(a, buf, i + 2, 0); ! } ! ! /* Hilite current option */ ! move_cursor(k + 2, 50); ! ! /* Get a key */ ! ch = inkey(); ! ! /* Analyze */ ! switch (ch) ! { ! case ESCAPE: ! { ! return; ! } ! ! case '-': ! case '8': ! { ! k = (n + k - 1) % n; ! break; ! } ! ! case ' ': ! case '\n': ! case '\r': ! case '2': ! { ! k = (k + 1) % n; ! break; ! } ! ! case 't': ! case '5': ! { ! if (p_ptr->cheat[k]) ! { ! p_ptr->cheat[k] = FALSE; ! } ! ! else ! { ! /* Mark player as a cheater */ ! p_ptr->noscore |= (0x0100 << k); ! ! p_ptr->cheat[k] = TRUE; ! } ! ! break; ! } ! ! case 'y': ! case '6': ! { ! /* Mark player as a cheater */ ! p_ptr->noscore |= (0x0100 << k); ! ! p_ptr->cheat[k] = TRUE; ! k = (k + 1) % n; ! break; ! } ! ! case 'n': ! case '4': ! { ! p_ptr->cheat[k] = FALSE; ! k = (k + 1) % n; ! break; ! } ! ! default: ! { ! bell("Illegal command for cheat options!"); ! break; ! } ! } } } /* * Interact with some options */ --- 386,449 ---- } /* ! * Ask for a "user pref line" and process it */ ! void do_cmd_pref(void) { ! char tmp[80]; ! ! /* Default */ ! strcpy(tmp, ""); ! ! /* Ask for a "user pref command" */ ! if (!get_string("Pref: ", tmp, 80)) return; ! ! /* Process that pref command */ ! (void)process_pref_file_aux(tmp); ! } /* ! * Ask for a "user pref file" and process it. ! * ! * This function should only be used by standard interaction commands, ! * in which a standard "Command:" prompt is present on the given row. ! * ! * Allow absolute file names? XXX XXX XXX */ ! static void do_cmd_pref_file_hack(int row) { ! char ftmp[80]; ! /* Prompt */ ! prt("Command: Load a user pref file", row, 0); ! /* Prompt */ ! prt("File: ", row + 2, 0); + /* Default filename */ + sprintf(ftmp, "%s.prf", op_ptr->base_name); ! /* Ask for a file (or cancel) */ ! if (!askfor_aux(ftmp, 80)) return; ! /* Process the given filename */ ! if (process_pref_file(ftmp)) { ! /* Mention failure */ ! msg_format("Failed to load '%s'!", ftmp); ! } ! else ! { ! /* Mention success */ ! msg_format("Loaded '%s'.", ftmp); } } + /* * Interact with some options */ *************** *** 538,550 **** int i, k = 0, n = 0; ! int opt[16]; char buf[80]; /* Scan the options */ ! for (i = 0; i < 16; i++) { /* Collect options on this "page" */ if (option_page[page][i] != 255) --- 453,465 ---- int i, k = 0, n = 0; ! int opt[OPT_PAGE_PER]; char buf[80]; /* Scan the options */ ! for (i = 0; i < OPT_PAGE_PER; i++) { /* Collect options on this "page" */ if (option_page[page][i] != 255) *************** *** 591,596 **** --- 506,521 ---- { case ESCAPE: { + /* Hack -- Notice use of any "cheat" options */ + for (i = OPT_CHEAT; i < OPT_ADULT; i++) + { + if (op_ptr->opt[i]) + { + /* Set score option */ + op_ptr->opt[OPT_SCORE + (i - OPT_CHEAT)] = TRUE; + } + } + return; } *************** *** 661,667 **** /* Memorize old flags */ for (j = 0; j < 8; j++) { - /* Acquire current flags */ old_flag[j] = op_ptr->window_flag[j]; } --- 586,591 ---- *************** *** 800,812 **** } /* * Set or unset various options. * ! * After using this command, a complete redraw is performed, ! * whether or not it is technically required. */ void do_cmd_options(void) { --- 724,827 ---- } + /* + * Write all current options to the given preference file in the + * lib/user directory. Modified from KAmband 1.8. + */ + static errr option_dump(cptr fname) + { + int i, j; + + FILE *fff; + + char buf[1024]; + + /* Build the filename */ + path_build(buf, 1024, ANGBAND_DIR_USER, fname); + + /* File type is "TEXT" */ + FILE_TYPE(FILE_TYPE_TEXT); + + /* Append to the file */ + fff = my_fopen(buf, "w"); + + /* Failure */ + if (!fff) return (-1); + + + /* Skip some lines */ + fprintf(fff, "\n\n"); + + /* Start dumping */ + fprintf(fff, "# Automatic option dump\n\n"); + + /* Dump options (skip cheat, adult, score) */ + for (i = 0; i < OPT_CHEAT; i++) + { + /* Require a real option */ + if (!option_text[i]) continue; + + /* Comment */ + fprintf(fff, "# Option '%s'\n", option_desc[i]); + + /* Dump the option */ + if (op_ptr->opt[i]) + { + fprintf(fff, "Y:%s\n", option_text[i]); + } + else + { + fprintf(fff, "X:%s\n", option_text[i]); + } + + /* Skip a line */ + fprintf(fff, "\n"); + } + + /* Dump window flags */ + for (i = 1; i < 8; i++) + { + /* Require a real window */ + if (!angband_term[i]) continue; + + /* Check each flag */ + for (j = 0; j < 32; j++) + { + /* Require a real flag */ + if (!window_flag_desc[j]) continue; + + /* Comment */ + fprintf(fff, "# Window '%s', Flag '%s'\n", + angband_term_name[i], window_flag_desc[j]); + + /* Dump the flag */ + if (op_ptr->window_flag[i] & (1L << j)) + { + fprintf(fff, "W:%d:%d:1\n", i, j); + } + else + { + fprintf(fff, "W:%d:%d:0\n", i, j); + } + + /* Skip a line */ + fprintf(fff, "\n"); + } + } + + /* Close */ + my_fclose(fff); + + /* Success */ + return (0); + } /* * Set or unset various options. * ! * After using this command, a complete redraw should be performed, ! * in case any visual options have been changed. */ void do_cmd_options(void) { *************** *** 831,849 **** prt("(2) Disturbance Options", 5, 5); prt("(3) Game-Play Options", 6, 5); prt("(4) Efficiency Options", 7, 5); ! ! /* Cheating */ ! prt("(C) Cheating Options", 9, 5); /* Window flags */ prt("(W) Window flags", 11, 5); /* Special choices */ ! prt("(D) Base Delay Factor", 13, 5); ! prt("(H) Hitpoint Warning", 14, 5); /* Prompt */ ! prt("Command: ", 18, 0); /* Get command */ k = inkey(); --- 846,867 ---- prt("(2) Disturbance Options", 5, 5); prt("(3) Game-Play Options", 6, 5); prt("(4) Efficiency Options", 7, 5); ! prt("(5) Birth Options", 8, 5); ! prt("(6) Cheat Options", 9, 5); /* Window flags */ prt("(W) Window flags", 11, 5); + /* Load and Append */ + prt("(L) Load a user pref file", 13, 5); + prt("(A) Append options to a file", 14, 5); + /* Special choices */ ! prt("(D) Base Delay Factor", 16, 5); ! prt("(H) Hitpoint Warning", 17, 5); /* Prompt */ ! prt("Command: ", 19, 0); /* Get command */ k = inkey(); *************** *** 851,962 **** /* Exit */ if (k == ESCAPE) break; ! /* Analyze */ ! switch (k) { ! /* General Options */ ! case '1': ! { ! /* Process the general options */ ! do_cmd_options_aux(0, "User Interface Options"); ! break; ! } ! /* Disturbance Options */ ! case '2': ! { ! /* Spawn */ ! do_cmd_options_aux(1, "Disturbance Options"); ! break; ! } ! /* Inventory Options */ ! case '3': ! { ! /* Spawn */ ! do_cmd_options_aux(2, "Game-Play Options"); ! break; ! } ! /* Efficiency Options */ ! case '4': ! { ! /* Spawn */ ! do_cmd_options_aux(3, "Efficiency Options"); ! break; ! } ! /* Cheating Options */ ! case 'C': ! { ! /* Spawn */ ! do_cmd_options_cheat("Cheaters never win (seriously!)"); ! break; ! } ! /* Window flags */ ! case 'W': ! case 'w': { ! /* Spawn */ ! do_cmd_options_win(); ! break; } ! ! /* Hack -- Delay Speed */ ! case 'D': ! case 'd': { ! /* Prompt */ ! prt("Command: Base Delay Factor", 18, 0); ! /* Get a new value */ ! while (1) ! { ! int msec = op_ptr->delay_factor * op_ptr->delay_factor; ! prt(format("Current base delay factor: %d (%d msec)", ! op_ptr->delay_factor, msec), 22, 0); ! prt("Delay Factor (0-9 or ESC to accept): ", 20, 0); ! k = inkey(); ! if (k == ESCAPE) break; ! if (isdigit(k)) op_ptr->delay_factor = D2I(k); ! else bell("Illegal delay factor!"); ! } ! break; ! } ! /* Hack -- hitpoint warning factor */ ! case 'H': ! case 'h': { ! /* Prompt */ ! prt("Command: Hitpoint Warning", 18, 0); ! /* Get a new value */ ! while (1) ! { ! prt(format("Current hitpoint warning: %2d%%", ! op_ptr->hitpoint_warn * 10), 22, 0); ! prt("Hitpoint Warning (0-9 or ESC to accept): ", 20, 0); ! k = inkey(); ! if (k == ESCAPE) break; ! if (isdigit(k)) op_ptr->hitpoint_warn = D2I(k); ! else bell("Illegal hitpoint warning!"); ! } ! ! break; } ! /* Unknown option */ ! default: { ! /* Oops */ ! bell("Illegal command for options!"); ! break; } } /* Flush messages */ msg_print(NULL); } --- 869,1007 ---- /* Exit */ if (k == ESCAPE) break; ! /* General Options */ ! else if (k == '1') { ! do_cmd_options_aux(0, "User Interface Options"); ! } ! /* Disturbance Options */ ! else if (k == '2') ! { ! do_cmd_options_aux(1, "Disturbance Options"); ! } ! /* Inventory Options */ ! else if (k == '3') ! { ! do_cmd_options_aux(2, "Game-Play Options"); ! } ! /* Efficiency Options */ ! else if (k == '4') ! { ! do_cmd_options_aux(3, "Efficiency Options"); ! } ! /* Birth Options */ ! else if (k == '5') ! { ! do_cmd_options_aux(4, "Birth Options"); ! } ! ! /* Cheating Options */ ! else if (k == '6') ! { ! do_cmd_options_aux(5, "Cheat Options"); ! } ! ! /* Window flags */ ! else if ((k == 'W') || (k == 'w')) ! { ! do_cmd_options_win(); ! } ! ! /* Load a user pref file */ ! else if ((k == 'L') || (k == 'l')) ! { ! /* Ask for and load a user pref file */ ! do_cmd_pref_file_hack(19); ! } ! ! /* Append options to a file */ ! else if ((k == 'A') || (k == 'a')) ! { ! char ftmp[80]; ! ! /* Prompt */ ! prt("Command: Append options to a file", 19, 0); ! ! /* Prompt */ ! prt("File: ", 21, 0); ! ! /* Default filename */ ! sprintf(ftmp, "%s.prf", op_ptr->base_name); ! ! /* Ask for a file */ ! if (!askfor_aux(ftmp, 80)) continue; ! ! /* Drop priv's */ ! safe_setuid_drop(); ! /* Dump the options */ ! if (option_dump(ftmp)) { ! /* Failure */ ! msg_print("Failed!"); } ! else { ! /* Success */ ! msg_print("Done."); ! } ! /* Grab priv's */ ! safe_setuid_grab(); ! } ! /* Hack -- Base Delay Factor */ ! else if ((k == 'D') || (k == 'd')) ! { ! /* Prompt */ ! prt("Command: Base Delay Factor", 19, 0); ! /* Get a new value */ ! while (1) { ! int msec = op_ptr->delay_factor * op_ptr->delay_factor; ! prt(format("Current base delay factor: %d (%d msec)", ! op_ptr->delay_factor, msec), 22, 0); ! prt("New base delay factor (0-9 or ESC to accept): ", 21, 0); ! k = inkey(); ! if (k == ESCAPE) break; ! if (isdigit(k)) op_ptr->delay_factor = D2I(k); ! else bell("Illegal delay factor!"); } + } ! /* Hack -- hitpoint warning factor */ ! else if ((k == 'H') || (k == 'h')) ! { ! /* Prompt */ ! prt("Command: Hitpoint Warning", 19, 0); ! ! /* Get a new value */ ! while (1) { ! prt(format("Current hitpoint warning: %2d%%", ! op_ptr->hitpoint_warn * 10), 22, 0); ! prt("New hitpoint warning (0-9 or ESC to accept): ", 21, 0); ! ! k = inkey(); ! if (k == ESCAPE) break; ! if (isdigit(k)) op_ptr->hitpoint_warn = D2I(k); ! else bell("Illegal hitpoint warning!"); } } + /* Unknown option */ + else + { + /* Oops */ + bell("Illegal command for options!"); + } + /* Flush messages */ msg_print(NULL); } *************** *** 968,993 **** - /* - * Ask for a "user pref line" and process it - * - * XXX XXX XXX Allow absolute file names? - */ - void do_cmd_pref(void) - { - char tmp[81]; - - /* Default */ - strcpy(tmp, ""); - - /* Ask for a "user pref command" */ - if (!get_string("Pref: ", tmp, 80)) return; - - /* Process that pref command */ - (void)process_pref_file_aux(tmp); - } - - #ifdef ALLOW_MACROS /* --- 1013,1018 ---- *************** *** 1015,1021 **** if (!fff) return (-1); ! /* Skip space */ fprintf(fff, "\n\n"); /* Start dumping */ --- 1040,1046 ---- if (!fff) return (-1); ! /* Skip some lines */ fprintf(fff, "\n\n"); /* Start dumping */ *************** *** 1027,1042 **** /* Start the macro */ fprintf(fff, "# Macro '%d'\n\n", i); ! /* Extract the action */ ascii_to_text(buf, macro__act[i]); ! /* Dump the macro */ fprintf(fff, "A:%s\n", buf); ! /* Extract the action */ ascii_to_text(buf, macro__pat[i]); ! /* Dump normal macros */ fprintf(fff, "P:%s\n", buf); /* End the macro */ --- 1052,1067 ---- /* Start the macro */ fprintf(fff, "# Macro '%d'\n\n", i); ! /* Extract the macro action */ ascii_to_text(buf, macro__act[i]); ! /* Dump the macro action */ fprintf(fff, "A:%s\n", buf); ! /* Extract the macro pattern */ ascii_to_text(buf, macro__pat[i]); ! /* Dump the macro pattern */ fprintf(fff, "P:%s\n", buf); /* End the macro */ *************** *** 1143,1149 **** /* ! * Hack -- append all keymaps to the given file */ static errr keymap_dump(cptr fname) { --- 1168,1176 ---- /* ! * Hack -- Append all keymaps to the given file. ! * ! * Hack -- We only append the keymaps for the "active" mode. */ static errr keymap_dump(cptr fname) { *************** *** 1151,1157 **** FILE *fff; - char key[1024]; char buf[1024]; int mode; --- 1178,1183 ---- *************** *** 1183,1189 **** if (!fff) return (-1); ! /* Skip space */ fprintf(fff, "\n\n"); /* Start dumping */ --- 1209,1215 ---- if (!fff) return (-1); ! /* Skip some lines */ fprintf(fff, "\n\n"); /* Start dumping */ *************** *** 1192,1197 **** --- 1218,1225 ---- /* Dump them */ for (i = 0; i < 256; i++) { + char key[2] = "?"; + cptr act; /* Loop up the keymap */ *************** *** 1200,1218 **** /* Skip empty keymaps */ if (!act) continue; - /* Encode the key */ - buf[0] = i; - buf[1] = '\0'; - ascii_to_text(key, buf); - /* Encode the action */ ascii_to_text(buf, act); ! /* Dump the macro */ ! fprintf(fff, "M:%d %2s %s\n", mode, key, buf); } ! /* Start dumping */ fprintf(fff, "\n\n\n"); --- 1228,1253 ---- /* Skip empty keymaps */ if (!act) continue; /* Encode the action */ ascii_to_text(buf, act); ! /* Dump the keymap action */ ! fprintf(fff, "A:%s\n", buf); ! ! /* Convert the key into a string */ ! key[0] = i; ! ! /* Encode the key */ ! ascii_to_text(buf, key); ! ! /* Dump the keymap pattern */ ! fprintf(fff, "C:%d:%s\n", mode, buf); ! ! /* Skip a line */ ! fprintf(fff, "\n"); } ! /* Skip some lines */ fprintf(fff, "\n\n\n"); *************** *** 1230,1246 **** /* * Interact with "macros" * - * Note that the macro "action" must be defined before the trigger. - * * Could use some helpful instructions on this page. XXX XXX XXX */ void do_cmd_macros(void) { ! int i; char tmp[1024]; ! char buf[1024]; int mode; --- 1265,1279 ---- /* * Interact with "macros" * * Could use some helpful instructions on this page. XXX XXX XXX */ void do_cmd_macros(void) { ! char ch; char tmp[1024]; ! char pat[1024]; int mode; *************** *** 1280,1289 **** prt("Current action (if any) shown below:", 20, 0); /* Analyze the current action */ ! ascii_to_text(buf, macro_buffer); /* Display the current action */ ! prt(buf, 22, 0); /* Selections */ --- 1313,1322 ---- prt("Current action (if any) shown below:", 20, 0); /* Analyze the current action */ ! ascii_to_text(tmp, macro_buffer); /* Display the current action */ ! prt(tmp, 22, 0); /* Selections */ *************** *** 1304,1342 **** prt("Command: ", 16, 0); /* Get a command */ ! i = inkey(); /* Leave */ ! if (i == ESCAPE) break; ! /* Load a 'macro' file */ ! else if (i == '1') { ! /* Prompt */ ! prt("Command: Load a user pref file", 16, 0); ! ! /* Prompt */ ! prt("File: ", 18, 0); ! ! /* Default filename */ ! sprintf(tmp, "%s.prf", op_ptr->base_name); ! ! /* Ask for a file */ ! if (!askfor_aux(tmp, 80)) continue; ! ! /* Process the given filename */ ! if (0 != process_pref_file(tmp)) ! { ! /* Prompt */ ! msg_print("Could not load file!"); ! } } #ifdef ALLOW_MACROS /* Save macros */ ! else if (i == '2') { /* Prompt */ prt("Command: Append macros to a file", 16, 0); --- 1337,1361 ---- prt("Command: ", 16, 0); /* Get a command */ ! ch = inkey(); /* Leave */ ! if (ch == ESCAPE) break; ! /* Load a user pref file */ ! if (ch == '1') { ! /* Ask for and load a user pref file */ ! do_cmd_pref_file_hack(16); } #ifdef ALLOW_MACROS /* Save macros */ ! else if (ch == '2') { + char ftmp[80]; + /* Prompt */ prt("Command: Append macros to a file", 16, 0); *************** *** 1344,1359 **** prt("File: ", 18, 0); /* Default filename */ ! sprintf(tmp, "%s.prf", op_ptr->base_name); /* Ask for a file */ ! if (!askfor_aux(tmp, 80)) continue; /* Drop priv's */ safe_setuid_drop(); /* Dump the macros */ ! (void)macro_dump(tmp); /* Grab priv's */ safe_setuid_grab(); --- 1363,1378 ---- prt("File: ", 18, 0); /* Default filename */ ! sprintf(ftmp, "%s.prf", op_ptr->base_name); /* Ask for a file */ ! if (!askfor_aux(ftmp, 80)) continue; /* Drop priv's */ safe_setuid_drop(); /* Dump the macros */ ! (void)macro_dump(ftmp); /* Grab priv's */ safe_setuid_grab(); *************** *** 1363,1369 **** } /* Query a macro */ ! else if (i == '3') { int k; --- 1382,1388 ---- } /* Query a macro */ ! else if (ch == '3') { int k; *************** *** 1374,1383 **** prt("Trigger: ", 18, 0); /* Get a macro trigger */ ! do_cmd_macro_aux(buf); ! /* Acquire action */ ! k = macro_find_exact(buf); /* Nothing found */ if (k < 0) --- 1393,1402 ---- prt("Trigger: ", 18, 0); /* Get a macro trigger */ ! do_cmd_macro_aux(pat); ! /* Get the action */ ! k = macro_find_exact(pat); /* Nothing found */ if (k < 0) *************** *** 1393,1402 **** strcpy(macro_buffer, macro__act[k]); /* Analyze the current action */ ! ascii_to_text(buf, macro_buffer); /* Display the current action */ ! prt(buf, 22, 0); /* Prompt */ msg_print("Found a macro."); --- 1412,1421 ---- strcpy(macro_buffer, macro__act[k]); /* Analyze the current action */ ! ascii_to_text(tmp, macro_buffer); /* Display the current action */ ! prt(tmp, 22, 0); /* Prompt */ msg_print("Found a macro."); *************** *** 1404,1410 **** } /* Create a macro */ ! else if (i == '4') { /* Prompt */ prt("Command: Create a macro", 16, 0); --- 1423,1429 ---- } /* Create a macro */ ! else if (ch == '4') { /* Prompt */ prt("Command: Create a macro", 16, 0); *************** *** 1413,1419 **** prt("Trigger: ", 18, 0); /* Get a macro trigger */ ! do_cmd_macro_aux(buf); /* Clear */ clear_from(20); --- 1432,1438 ---- prt("Trigger: ", 18, 0); /* Get a macro trigger */ ! do_cmd_macro_aux(pat); /* Clear */ clear_from(20); *************** *** 1431,1437 **** text_to_ascii(macro_buffer, tmp); /* Link the macro */ ! macro_add(buf, macro_buffer); /* Prompt */ msg_print("Added a macro."); --- 1450,1456 ---- text_to_ascii(macro_buffer, tmp); /* Link the macro */ ! macro_add(pat, macro_buffer); /* Prompt */ msg_print("Added a macro."); *************** *** 1439,1445 **** } /* Remove a macro */ ! else if (i == '5') { /* Prompt */ prt("Command: Remove a macro", 16, 0); --- 1458,1464 ---- } /* Remove a macro */ ! else if (ch == '5') { /* Prompt */ prt("Command: Remove a macro", 16, 0); *************** *** 1448,1465 **** prt("Trigger: ", 18, 0); /* Get a macro trigger */ ! do_cmd_macro_aux(buf); /* Link the macro */ ! macro_add(buf, buf); /* Prompt */ msg_print("Removed a macro."); } /* Save keymaps */ ! else if (i == '6') { /* Prompt */ prt("Command: Append keymaps to a file", 16, 0); --- 1467,1486 ---- prt("Trigger: ", 18, 0); /* Get a macro trigger */ ! do_cmd_macro_aux(pat); /* Link the macro */ ! macro_add(pat, pat); /* Prompt */ msg_print("Removed a macro."); } /* Save keymaps */ ! else if (ch == '6') { + char ftmp[80]; + /* Prompt */ prt("Command: Append keymaps to a file", 16, 0); *************** *** 1467,1482 **** prt("File: ", 18, 0); /* Default filename */ ! sprintf(tmp, "%s.prf", op_ptr->base_name); /* Ask for a file */ ! if (!askfor_aux(tmp, 80)) continue; /* Drop priv's */ safe_setuid_drop(); /* Dump the macros */ ! (void)keymap_dump(tmp); /* Grab priv's */ safe_setuid_grab(); --- 1488,1503 ---- prt("File: ", 18, 0); /* Default filename */ ! sprintf(ftmp, "%s.prf", op_ptr->base_name); /* Ask for a file */ ! if (!askfor_aux(ftmp, 80)) continue; /* Drop priv's */ safe_setuid_drop(); /* Dump the macros */ ! (void)keymap_dump(ftmp); /* Grab priv's */ safe_setuid_grab(); *************** *** 1486,1492 **** } /* Query a keymap */ ! else if (i == '7') { cptr act; --- 1507,1513 ---- } /* Query a keymap */ ! else if (ch == '7') { cptr act; *************** *** 1497,1506 **** prt("Keypress: ", 18, 0); /* Get a keymap trigger */ ! do_cmd_macro_aux_keymap(buf); /* Look up the keymap */ ! act = keymap_act[mode][(byte)(buf[0])]; /* Nothing found */ if (!act) --- 1518,1527 ---- prt("Keypress: ", 18, 0); /* Get a keymap trigger */ ! do_cmd_macro_aux_keymap(pat); /* Look up the keymap */ ! act = keymap_act[mode][(byte)(pat[0])]; /* Nothing found */ if (!act) *************** *** 1516,1525 **** strcpy(macro_buffer, act); /* Analyze the current action */ ! ascii_to_text(buf, macro_buffer); /* Display the current action */ ! prt(buf, 22, 0); /* Prompt */ msg_print("Found a keymap."); --- 1537,1546 ---- strcpy(macro_buffer, act); /* Analyze the current action */ ! ascii_to_text(tmp, macro_buffer); /* Display the current action */ ! prt(tmp, 22, 0); /* Prompt */ msg_print("Found a keymap."); *************** *** 1527,1533 **** } /* Create a keymap */ ! else if (i == '8') { /* Prompt */ prt("Command: Create a keymap", 16, 0); --- 1548,1554 ---- } /* Create a keymap */ ! else if (ch == '8') { /* Prompt */ prt("Command: Create a keymap", 16, 0); *************** *** 1536,1542 **** prt("Keypress: ", 18, 0); /* Get a keymap trigger */ ! do_cmd_macro_aux_keymap(buf); /* Clear */ clear_from(20); --- 1557,1563 ---- prt("Keypress: ", 18, 0); /* Get a keymap trigger */ ! do_cmd_macro_aux_keymap(pat); /* Clear */ clear_from(20); *************** *** 1554,1563 **** text_to_ascii(macro_buffer, tmp); /* Free old keymap */ ! string_free(keymap_act[mode][(byte)(buf[0])]); /* Make new keymap */ ! keymap_act[mode][(byte)(buf[0])] = string_make(macro_buffer); /* Prompt */ msg_print("Added a keymap."); --- 1575,1584 ---- text_to_ascii(macro_buffer, tmp); /* Free old keymap */ ! string_free(keymap_act[mode][(byte)(pat[0])]); /* Make new keymap */ ! keymap_act[mode][(byte)(pat[0])] = string_make(macro_buffer); /* Prompt */ msg_print("Added a keymap."); *************** *** 1565,1571 **** } /* Remove a keymap */ ! else if (i == '9') { /* Prompt */ prt("Command: Remove a keymap", 16, 0); --- 1586,1592 ---- } /* Remove a keymap */ ! else if (ch == '9') { /* Prompt */ prt("Command: Remove a keymap", 16, 0); *************** *** 1574,1593 **** prt("Keypress: ", 18, 0); /* Get a keymap trigger */ ! do_cmd_macro_aux_keymap(buf); /* Free old keymap */ ! string_free(keymap_act[mode][(byte)(buf[0])]); /* Make new keymap */ ! keymap_act[mode][(byte)(buf[0])] = NULL; /* Prompt */ msg_print("Removed a keymap."); } /* Enter a new action */ ! else if (i == '0') { /* Prompt */ prt("Command: Enter a new action", 16, 0); --- 1595,1614 ---- prt("Keypress: ", 18, 0); /* Get a keymap trigger */ ! do_cmd_macro_aux_keymap(pat); /* Free old keymap */ ! string_free(keymap_act[mode][(byte)(pat[0])]); /* Make new keymap */ ! keymap_act[mode][(byte)(pat[0])] = NULL; /* Prompt */ msg_print("Removed a keymap."); } /* Enter a new action */ ! else if (ch == '0') { /* Prompt */ prt("Command: Enter a new action", 16, 0); *************** *** 1595,1608 **** /* Go to the correct location */ Term_gotoxy(0, 22); ! /* Hack -- limit the value */ ! tmp[80] = '\0'; /* Get an encoded action */ ! if (!askfor_aux(buf, 80)) continue; ! ! /* Extract an action */ ! text_to_ascii(macro_buffer, buf); } #endif /* ALLOW_MACROS */ --- 1616,1630 ---- /* Go to the correct location */ Term_gotoxy(0, 22); ! /* Analyze the current action */ ! ascii_to_text(tmp, macro_buffer); /* Get an encoded action */ ! if (askfor_aux(tmp, 80)) ! { ! /* Extract an action */ ! text_to_ascii(macro_buffer, tmp); ! } } #endif /* ALLOW_MACROS */ *************** *** 1630,1641 **** */ void do_cmd_visuals(void) { int i; FILE *fff; - char tmp[160]; - char buf[1024]; --- 1652,1663 ---- */ void do_cmd_visuals(void) { + int ch; + int i; FILE *fff; char buf[1024]; *************** *** 1674,1708 **** prt("Command: ", 15, 0); /* Prompt */ ! i = inkey(); /* Done */ ! if (i == ESCAPE) break; ! /* Load a 'pref' file */ ! else if (i == '1') { ! /* Prompt */ ! prt("Command: Load a user pref file", 15, 0); ! ! /* Prompt */ ! prt("File: ", 17, 0); ! ! /* Default filename */ ! sprintf(tmp, "%s.prf", op_ptr->base_name); ! ! /* Query */ ! if (!askfor_aux(tmp, 80)) continue; ! ! /* Process the given filename */ ! (void)process_pref_file(tmp); } #ifdef ALLOW_VISUALS /* Dump monster attr/chars */ ! else if (i == '2') { /* Prompt */ prt("Command: Dump monster attr/chars", 15, 0); --- 1696,1720 ---- prt("Command: ", 15, 0); /* Prompt */ ! ch = inkey(); /* Done */ ! if (ch == ESCAPE) break; ! /* Load a user pref file */ ! if (ch == '1') { ! /* Ask for and load a user pref file */ ! do_cmd_pref_file_hack(15); } #ifdef ALLOW_VISUALS /* Dump monster attr/chars */ ! else if (ch == '2') { + char ftmp[80]; + /* Prompt */ prt("Command: Dump monster attr/chars", 15, 0); *************** *** 1710,1722 **** prt("File: ", 17, 0); /* Default filename */ ! sprintf(tmp, "%s.prf", op_ptr->base_name); /* Get a filename */ ! if (!askfor_aux(tmp, 80)) continue; /* Build the filename */ ! path_build(buf, 1024, ANGBAND_DIR_USER, tmp); /* Drop priv's */ safe_setuid_drop(); --- 1722,1734 ---- prt("File: ", 17, 0); /* Default filename */ ! sprintf(ftmp, "%s.prf", op_ptr->base_name); /* Get a filename */ ! if (!askfor_aux(ftmp, 80)) continue; /* Build the filename */ ! path_build(buf, 1024, ANGBAND_DIR_USER, ftmp); /* Drop priv's */ safe_setuid_drop(); *************** *** 1730,1737 **** /* Failure */ if (!fff) continue; ! /* Start dumping */ fprintf(fff, "\n\n"); fprintf(fff, "# Monster attr/char definitions\n\n"); /* Dump monsters */ --- 1742,1752 ---- /* Failure */ if (!fff) continue; ! ! /* Skip some lines */ fprintf(fff, "\n\n"); + + /* Start dumping */ fprintf(fff, "# Monster attr/char definitions\n\n"); /* Dump monsters */ *************** *** 1761,1768 **** } /* Dump object attr/chars */ ! else if (i == '3') { /* Prompt */ prt("Command: Dump object attr/chars", 15, 0); --- 1776,1785 ---- } /* Dump object attr/chars */ ! else if (ch == '3') { + char ftmp[80]; + /* Prompt */ prt("Command: Dump object attr/chars", 15, 0); *************** *** 1770,1782 **** prt("File: ", 17, 0); /* Default filename */ ! sprintf(tmp, "%s.prf", op_ptr->base_name); /* Get a filename */ ! if (!askfor_aux(tmp, 80)) continue; /* Build the filename */ ! path_build(buf, 1024, ANGBAND_DIR_USER, tmp); /* Drop priv's */ safe_setuid_drop(); --- 1787,1799 ---- prt("File: ", 17, 0); /* Default filename */ ! sprintf(ftmp, "%s.prf", op_ptr->base_name); /* Get a filename */ ! if (!askfor_aux(ftmp, 80)) continue; /* Build the filename */ ! path_build(buf, 1024, ANGBAND_DIR_USER, ftmp); /* Drop priv's */ safe_setuid_drop(); *************** *** 1790,1797 **** /* Failure */ if (!fff) continue; ! /* Start dumping */ fprintf(fff, "\n\n"); fprintf(fff, "# Object attr/char definitions\n\n"); /* Dump objects */ --- 1807,1817 ---- /* Failure */ if (!fff) continue; ! ! /* Skip some lines */ fprintf(fff, "\n\n"); + + /* Start dumping */ fprintf(fff, "# Object attr/char definitions\n\n"); /* Dump objects */ *************** *** 1821,1828 **** } /* Dump feature attr/chars */ ! else if (i == '4') { /* Prompt */ prt("Command: Dump feature attr/chars", 15, 0); --- 1841,1850 ---- } /* Dump feature attr/chars */ ! else if (ch == '4') { + char ftmp[80]; + /* Prompt */ prt("Command: Dump feature attr/chars", 15, 0); *************** *** 1830,1842 **** prt("File: ", 17, 0); /* Default filename */ ! sprintf(tmp, "%s.prf", op_ptr->base_name); /* Get a filename */ ! if (!askfor_aux(tmp, 80)) continue; /* Build the filename */ ! path_build(buf, 1024, ANGBAND_DIR_USER, tmp); /* Drop priv's */ safe_setuid_drop(); --- 1852,1864 ---- prt("File: ", 17, 0); /* Default filename */ ! sprintf(ftmp, "%s.prf", op_ptr->base_name); /* Get a filename */ ! if (!askfor_aux(ftmp, 80)) continue; /* Build the filename */ ! path_build(buf, 1024, ANGBAND_DIR_USER, ftmp); /* Drop priv's */ safe_setuid_drop(); *************** *** 1850,1857 **** /* Failure */ if (!fff) continue; ! /* Start dumping */ fprintf(fff, "\n\n"); fprintf(fff, "# Feature attr/char definitions\n\n"); /* Dump features */ --- 1872,1882 ---- /* Failure */ if (!fff) continue; ! ! /* Skip some lines */ fprintf(fff, "\n\n"); + + /* Start dumping */ fprintf(fff, "# Feature attr/char definitions\n\n"); /* Dump features */ *************** *** 1881,1887 **** } /* Modify monster attr/chars */ ! else if (i == '6') { static int r = 0; --- 1906,1912 ---- } /* Modify monster attr/chars */ ! else if (ch == '6') { static int r = 0; *************** *** 1936,1942 **** } /* Modify object attr/chars */ ! else if (i == '7') { static int k = 0; --- 1961,1967 ---- } /* Modify object attr/chars */ ! else if (ch == '7') { static int k = 0; *************** *** 1948,1957 **** { object_kind *k_ptr = &k_info[k]; ! int da = (byte)k_ptr->d_attr; ! int dc = (byte)k_ptr->d_char; ! int ca = (byte)k_ptr->x_attr; ! int cc = (byte)k_ptr->x_char; /* Label the object */ Term_putstr(5, 17, -1, TERM_WHITE, --- 1973,1982 ---- { object_kind *k_ptr = &k_info[k]; ! int da = (byte)(k_ptr->d_attr); ! int dc = (byte)(k_ptr->d_char); ! int ca = (byte)(k_ptr->x_attr); ! int cc = (byte)(k_ptr->x_char); /* Label the object */ Term_putstr(5, 17, -1, TERM_WHITE, *************** *** 1991,1997 **** } /* Modify feature attr/chars */ ! else if (i == '8') { static int f = 0; --- 2016,2022 ---- } /* Modify feature attr/chars */ ! else if (ch == '8') { static int f = 0; *************** *** 2003,2012 **** { feature_type *f_ptr = &f_info[f]; ! int da = (byte)f_ptr->d_attr; ! int dc = (byte)f_ptr->d_char; ! int ca = (byte)f_ptr->x_attr; ! int cc = (byte)f_ptr->x_char; /* Label the object */ Term_putstr(5, 17, -1, TERM_WHITE, --- 2028,2037 ---- { feature_type *f_ptr = &f_info[f]; ! int da = (byte)(f_ptr->d_attr); ! int dc = (byte)(f_ptr->d_char); ! int ca = (byte)(f_ptr->x_attr); ! int cc = (byte)(f_ptr->x_char); /* Label the object */ Term_putstr(5, 17, -1, TERM_WHITE, *************** *** 2048,2054 **** #endif /* Reset visuals */ ! else if (i == '0') { /* Reset */ reset_visuals(TRUE); --- 2073,2079 ---- #endif /* Reset visuals */ ! else if (ch == '0') { /* Reset */ reset_visuals(TRUE); *************** *** 2078,2089 **** */ void do_cmd_colors(void) { int i; FILE *fff; - char tmp[160]; - char buf[1024]; --- 2103,2114 ---- */ void do_cmd_colors(void) { + int ch; + int i; FILE *fff; char buf[1024]; *************** *** 2115,2155 **** prt("Command: ", 8, 0); /* Prompt */ ! i = inkey(); /* Done */ ! if (i == ESCAPE) break; ! /* Load a 'pref' file */ ! if (i == '1') { ! /* Prompt */ ! prt("Command: Load a user pref file", 8, 0); ! ! /* Prompt */ ! prt("File: ", 10, 0); ! ! /* Default file */ ! sprintf(tmp, "%s.prf", op_ptr->base_name); ! ! /* Query */ ! if (!askfor_aux(tmp, 80)) continue; ! /* Process the given filename */ ! (void)process_pref_file(tmp); ! /* Mega-Hack -- react to changes */ Term_xtra(TERM_XTRA_REACT, 0); ! /* Mega-Hack -- redraw */ Term_redraw(); } #ifdef ALLOW_COLORS /* Dump colors */ ! else if (i == '2') { /* Prompt */ prt("Command: Dump colors", 8, 0); --- 2140,2172 ---- prt("Command: ", 8, 0); /* Prompt */ ! ch = inkey(); /* Done */ ! if (ch == ESCAPE) break; ! /* Load a user pref file */ ! if (ch == '1') { ! /* Ask for and load a user pref file */ ! do_cmd_pref_file_hack(8); ! /* Could skip the following if loading cancelled XXX XXX XXX */ ! /* Mega-Hack -- React to color changes */ Term_xtra(TERM_XTRA_REACT, 0); ! /* Mega-Hack -- Redraw physical windows */ Term_redraw(); } #ifdef ALLOW_COLORS /* Dump colors */ ! else if (ch == '2') { + char ftmp[80]; + /* Prompt */ prt("Command: Dump colors", 8, 0); *************** *** 2157,2169 **** prt("File: ", 10, 0); /* Default filename */ ! sprintf(tmp, "%s.prf", op_ptr->base_name); /* Get a filename */ ! if (!askfor_aux(tmp, 80)) continue; /* Build the filename */ ! path_build(buf, 1024, ANGBAND_DIR_USER, tmp); /* Drop priv's */ safe_setuid_drop(); --- 2174,2186 ---- prt("File: ", 10, 0); /* Default filename */ ! sprintf(ftmp, "%s.prf", op_ptr->base_name); /* Get a filename */ ! if (!askfor_aux(ftmp, 80)) continue; /* Build the filename */ ! path_build(buf, 1024, ANGBAND_DIR_USER, ftmp); /* Drop priv's */ safe_setuid_drop(); *************** *** 2177,2184 **** /* Failure */ if (!fff) continue; ! /* Start dumping */ fprintf(fff, "\n\n"); fprintf(fff, "# Color redefinitions\n\n"); /* Dump colors */ --- 2194,2204 ---- /* Failure */ if (!fff) continue; ! ! /* Skip some lines */ fprintf(fff, "\n\n"); + + /* Start dumping */ fprintf(fff, "# Color redefinitions\n\n"); /* Dump colors */ *************** *** 2216,2222 **** } /* Edit colors */ ! else if (i == '3') { static int a = 0; --- 2236,2242 ---- } /* Edit colors */ ! else if (ch == '3') { static int a = 0; *************** *** 2309,2315 **** */ void do_cmd_note(void) { ! char tmp[81]; /* Default */ strcpy(tmp, ""); --- 2329,2335 ---- */ void do_cmd_note(void) { ! char tmp[80]; /* Default */ strcpy(tmp, ""); *************** *** 2640,2649 **** { object_type *o_ptr; ! /* Acquire object */ o_ptr = &o_list[this_o_idx]; ! /* Acquire next object */ next_o_idx = o_ptr->next_o_idx; /* Ignore non-artifacts */ --- 2660,2669 ---- { object_type *o_ptr; ! /* Get the object */ o_ptr = &o_list[this_o_idx]; ! /* Get the next object */ next_o_idx = o_ptr->next_o_idx; /* Ignore non-artifacts */ diff -r -c angband-283/src/cmd5.c angband-285/src/cmd5.c *** angband-283/src/cmd5.c Wed Feb 11 06:30:28 1998 --- angband-285/src/cmd5.c Wed Aug 25 15:59:06 1999 *************** *** 31,37 **** byte spells[64]; ! int ver; bool flag, redraw, okay; char choice; --- 31,37 ---- byte spells[64]; ! bool verify; bool flag, redraw, okay; char choice; *************** *** 42,47 **** --- 42,61 ---- cptr p = ((mp_ptr->spell_book == TV_MAGIC_BOOK) ? "spell" : "prayer"); + #ifdef ALLOW_REPEAT + + /* Get the spell, if available */ + if (repeat_pull(sn)) + { + /* Verify the spell */ + if (spell_okay(*sn, known)) + { + /* Success */ + return (TRUE); + } + } + + #endif /* ALLOW_REPEAT */ /* Extract spells */ for (spell = 0; spell < 64; spell++) *************** *** 136,142 **** /* Note verify */ ! ver = (isupper(choice)); /* Lowercase */ choice = tolower(choice); --- 150,156 ---- /* Note verify */ ! verify = (isupper(choice) ? TRUE : FALSE); /* Lowercase */ choice = tolower(choice); *************** *** 163,173 **** } /* Verify it */ ! if (ver) { char tmp_val[160]; ! /* Access the spell */ s_ptr = &mp_ptr->info[spell]; /* Prompt */ --- 177,187 ---- } /* Verify it */ ! if (verify) { char tmp_val[160]; ! /* Get the spell */ s_ptr = &mp_ptr->info[spell]; /* Prompt */ *************** *** 201,206 **** --- 215,226 ---- /* Save the choice */ (*sn) = spell; + #ifdef ALLOW_REPEAT + + repeat_push(*sn); + + #endif /* ALLOW_REPEAT */ + /* Success */ return (TRUE); } *************** *** 275,281 **** o_ptr = &o_list[0 - item]; } ! /* Access the item's sval */ sval = o_ptr->sval; --- 295,301 ---- o_ptr = &o_list[0 - item]; } ! /* Get the item's sval */ sval = o_ptr->sval; *************** *** 388,394 **** o_ptr = &o_list[0 - item]; } ! /* Access the item's sval */ sval = o_ptr->sval; --- 408,414 ---- o_ptr = &o_list[0 - item]; } ! /* Get the item's sval */ sval = o_ptr->sval; *************** *** 560,566 **** o_ptr = &o_list[0 - item]; } ! /* Access the item's sval */ sval = o_ptr->sval; --- 580,586 ---- o_ptr = &o_list[0 - item]; } ! /* Get the item's sval */ sval = o_ptr->sval; *************** *** 579,585 **** } ! /* Access the spell */ s_ptr = &mp_ptr->info[spell]; --- 599,605 ---- } ! /* Get the spell */ s_ptr = &mp_ptr->info[spell]; *************** *** 608,614 **** else { /* Hack -- chance of "beam" instead of "bolt" */ ! beam = ((p_ptr->pclass == 1) ? plev : (plev / 2)); /* Spells. */ switch (spell) --- 628,634 ---- else { /* Hack -- chance of "beam" instead of "bolt" */ ! beam = ((p_ptr->pclass == CLASS_MAGE) ? plev : (plev / 2)); /* Spells. */ switch (spell) *************** *** 870,885 **** case 37: { ! if (!p_ptr->word_recall) ! { ! p_ptr->word_recall = rand_int(20) + 15; ! msg_print("The air about you becomes charged..."); ! } ! else ! { ! p_ptr->word_recall = 0; ! msg_print("A tension leaves the air around you..."); ! } break; } --- 890,896 ---- case 37: { ! set_recall(); break; } *************** *** 1212,1218 **** o_ptr = &o_list[0 - item]; } ! /* Access the item's sval */ sval = o_ptr->sval; --- 1223,1229 ---- o_ptr = &o_list[0 - item]; } ! /* Get the item's sval */ sval = o_ptr->sval; *************** *** 1231,1237 **** } ! /* Access the spell */ s_ptr = &mp_ptr->info[spell]; --- 1242,1248 ---- } ! /* Get the spell */ s_ptr = &mp_ptr->info[spell]; *************** *** 1373,1379 **** if (!get_aim_dir(&dir)) return; fire_ball(GF_HOLY_ORB, dir, (damroll(3, 6) + plev + ! (plev / ((p_ptr->pclass == 2) ? 2 : 4))), ((plev < 30) ? 2 : 3)); break; } --- 1384,1390 ---- if (!get_aim_dir(&dir)) return; fire_ball(GF_HOLY_ORB, dir, (damroll(3, 6) + plev + ! (plev / ((p_ptr->pclass == CLASS_PRIEST) ? 2 : 4))), ((plev < 30) ? 2 : 3)); break; } *************** *** 1633,1648 **** case 56: { ! if (p_ptr->word_recall == 0) ! { ! p_ptr->word_recall = rand_int(20) + 15; ! msg_print("The air about you becomes charged..."); ! } ! else ! { ! p_ptr->word_recall = 0; ! msg_print("A tension leaves the air around you..."); ! } break; } --- 1644,1650 ---- case 56: { ! set_recall(); break; } diff -r -c angband-283/src/cmd6.c angband-285/src/cmd6.c *** angband-283/src/cmd6.c Wed Feb 11 06:30:28 1998 --- angband-285/src/cmd6.c Sat Jul 24 15:20:31 1999 *************** *** 1183,1198 **** case SV_SCROLL_WORD_OF_RECALL: { ! if (p_ptr->word_recall == 0) ! { ! p_ptr->word_recall = randint(20) + 15; ! msg_print("The air about you becomes charged..."); ! } ! else ! { ! p_ptr->word_recall = 0; ! msg_print("A tension leaves the air around you..."); ! } ident = TRUE; break; } --- 1183,1189 ---- case SV_SCROLL_WORD_OF_RECALL: { ! set_recall(); ident = TRUE; break; } *************** *** 2398,2413 **** case SV_ROD_RECALL: { ! if (p_ptr->word_recall == 0) ! { ! msg_print("The air about you becomes charged..."); ! p_ptr->word_recall = 15 + randint(20); ! } ! else ! { ! msg_print("A tension leaves the air around you..."); ! p_ptr->word_recall = 0; ! } ident = TRUE; o_ptr->pval = 60; break; --- 2389,2395 ---- case SV_ROD_RECALL: { ! set_recall(); ident = TRUE; o_ptr->pval = 60; break; *************** *** 2801,2806 **** --- 2783,3105 ---- /* + * Choose a message for an artifact activation. + * + * Random artifacts (except special artifacts) print messages that are + * not specific to the type of item in use, but ideally, the message + * should vary based on the item's actual type. XXX XXX + * + * Returns NULL if artifact has no activation. + */ + static cptr art_activate_msg(int a_idx) + { + + #ifdef GJW_RANDART + + if (adult_rand_artifacts) + { + switch (a_idx) + { + case ART_RAZORBACK: + return "You call forth ball lightning!"; + + case ART_BLADETURNER: + return "You are surrounded by many colours..."; + + case ART_SOULKEEPER: + return "You see a bright white glow..."; + + case ART_BELEGENNON: + return "Space is twisted around you..."; + + case ART_CELEBORN: + return "You see a deep blue glow..."; + + case ART_CASPANION: + return "You see a bright red glow..."; + + case ART_HOLHENNETH: + return "You see a bright white glow..."; + + case ART_GONDOR: + return "You see a deep blue glow..."; + + case ART_COLLUIN: + return "You are surrounded by many colours..."; + + case ART_HOLCOLLETH: + return "You see a deep blue glow..."; + + case ART_THINGOL: + return "You see a bright yellow glow..."; + + case ART_COLANNON: + return "Space is twisted around you..."; + + case ART_LUTHIEN: + return "You see a deep red glow..."; + + case ART_CAMMITHRIM: + return "You see an extremely bright glow..."; + + case ART_PAURHACH: + return "You call forth a bolt of fire!"; + + case ART_PAURNIMMEN: + return "You call forth an icy blast!"; + + case ART_PAURAEGEN: + return "You call forth a lightning bolt!"; + + case ART_PAURNEN: + return "A stream of acid spews forth!"; + + case ART_FINGOLFIN: + return "Huge magical spikes shoot out!"; + + case ART_FEANOR: + return "You see a bright green glow..."; + + case ART_DAL: + return "You see a deep blue glow..."; + + case ART_NARTHANC: + return "You call forth a fire bolt!"; + + case ART_NIMTHANC: + return "You call forth an icy blast!"; + + case ART_DETHANC: + return "You call forth a lightning bolt!"; + + case ART_RILIA: + return "You see a throbbing green light..."; + + case ART_BELANGIL: + return "You hear the howl of a fearsome winter storm!"; + + case ART_ARUNRUTH: + return "You see a pale blue glow..."; + + case ART_RINGIL: + return "You see an intense blue glow..."; + + case ART_ANDURIL: + return "You see an intense red glow..."; + + case ART_THEODEN: + return "You see a black aura..."; + + case ART_AEGLOS: + return "You see a bright white glow..."; + + case ART_OROME: + return "You hear distant pounding..."; + + case ART_EONWE: + return "You hear a long, shrill note..."; + + case ART_LOTHARANG: + return "You see a deep purple glow..."; + + case ART_ULMO: + return "You see a deep red glow..."; + + case ART_AVAVIR: + return "You see a soft white glow..."; + + case ART_TOTILA: + return "You see scintillating colours..."; + + case ART_FIRESTAR: + return "You feel the heat of a raging fire!"; + + case ART_TARATOL: + return "You see a bright green glow..."; + + case ART_ERIRIL: + return "You see a yellow glow..."; + + case ART_OLORIN: + return "You see a bright glow..."; + + case ART_TURMIL: + return "You see a white glow..."; + + case ART_CUBRAGOL: + return "You see a fiery red glow..."; + } + } + + #endif /* GJW_RANDART */ + + switch (a_idx) + { + case ART_GALADRIEL: + return "The phial wells with clear light..."; + + case ART_ELENDIL: + return "The star shines brightly..."; + + case ART_THRAIN: + return "The stone glows a deep green..."; + + case ART_CARLAMMAS: + return "The amulet lets out a shrill wail..."; + + case ART_INGWE: + return "The amulet floods the area with goodness..."; + + case ART_TULKAS: + return "The ring glows brightly..."; + + case ART_NARYA: + return "The ring glows deep red..."; + + case ART_NENYA: + return "The ring glows bright white..."; + + case ART_VILYA: + return "The ring glows deep blue..."; + + case ART_POWER: + return "The ring glows intensely black..."; + + case ART_RAZORBACK: + return "Your armor is surrounded by lightning..."; + + case ART_BLADETURNER: + return "Your armor glows many colours..."; + + case ART_SOULKEEPER: + return "Your armor glows a bright white..."; + + case ART_BELEGENNON: + return "Your armor twists space around you..."; + + case ART_CELEBORN: + return "Your armor glows deep blue..."; + + case ART_CASPANION: + return "Your armor glows bright red..."; + + case ART_HOLHENNETH: + return "Your helm glows bright white..."; + + case ART_GONDOR: + return "Your crown glows deep blue..."; + + case ART_COLLUIN: + return "Your cloak glows many colours..."; + + case ART_HOLCOLLETH: + return "Your cloak glows deep blue..."; + + case ART_THINGOL: + return "Your cloak glows bright yellow..."; + + case ART_COLANNON: + return "Your cloak twists space around you..."; + + case ART_LUTHIEN: + return "Your cloak glows a deep red..."; + + case ART_CAMMITHRIM: + return "Your gloves glow extremely brightly..."; + + case ART_PAURHACH: + return "Your gauntlets are covered in fire..."; + + case ART_PAURNIMMEN: + return "Your gauntlets are covered in frost..."; + + case ART_PAURAEGEN: + return "Your gauntlets are covered in sparks..."; + + case ART_PAURNEN: + return "Your gauntlets are covered in acid..."; + + case ART_FINGOLFIN: + return "Your cesti grows magical spikes..."; + + case ART_FEANOR: + return "Your boots glow bright green..."; + + case ART_DAL: + return "Your boots glow deep blue..."; + + case ART_NARTHANC: + return "Your dagger is covered in fire..."; + + case ART_NIMTHANC: + return "Your dagger is covered in frost..."; + + case ART_DETHANC: + return "Your dagger is covered in sparks..."; + + case ART_RILIA: + return "Your dagger throbs deep green..."; + + case ART_BELANGIL: + return "Your dagger is covered in frost..."; + + case ART_ARUNRUTH: + return "Your sword glows a pale blue..."; + + case ART_RINGIL: + return "Your sword glows an intense blue..."; + + case ART_ANDURIL: + return "Your sword glows an intense red..."; + + case ART_THEODEN: + return "Your axe blade glows black..."; + + case ART_AEGLOS: + return "Your spear glows a bright white..."; + + case ART_OROME: + return "Your spear pulsates..."; + + case ART_EONWE: + return "Your axe lets out a long, shrill note..."; + + case ART_LOTHARANG: + return "Your battle axe radiates deep purple..."; + + case ART_ULMO: + return "Your trident glows deep red..."; + + case ART_AVAVIR: + return "Your scythe glows soft white..."; + + case ART_TOTILA: + return "Your flail glows in scintillating colours..."; + + case ART_FIRESTAR: + return "Your morning star rages in fire..."; + + case ART_TARATOL: + return "Your mace glows bright green..."; + + case ART_ERIRIL: + return "Your quarterstaff glows yellow..."; + + case ART_OLORIN: + return "Your quarterstaff glows brightly..."; + + case ART_TURMIL: + return "Your hammer glows white..."; + + case ART_CUBRAGOL: + return "Your crossbow glows deep red..."; + } + + return NULL; + } + + + /* * Activate a wielded object. Wielded objects never stack. * And even if they did, activatable objects never stack. * *************** *** 2816,2822 **** object_type *o_ptr; ! cptr q, s; /* Prepare the hook */ --- 3115,3121 ---- object_type *o_ptr; ! cptr q, s, msg; /* Prepare the hook */ *************** *** 2890,2901 **** /* Artifacts */ if (o_ptr->name1) { /* Choose effect */ switch (o_ptr->name1) { case ART_GALADRIEL: { - msg_print("The phial wells with clear light..."); lite_area(damroll(2, 15), 3); o_ptr->timeout = rand_int(10) + 10; break; --- 3189,3203 ---- /* Artifacts */ if (o_ptr->name1) { + /* Get and print activation message */ + msg = art_activate_msg(o_ptr->name1); + if (msg) msg_print(msg); + /* Choose effect */ switch (o_ptr->name1) { case ART_GALADRIEL: { lite_area(damroll(2, 15), 3); o_ptr->timeout = rand_int(10) + 10; break; *************** *** 2903,2909 **** case ART_ELENDIL: { - msg_print("The star shines brightly..."); map_area(); o_ptr->timeout = rand_int(50) + 50; break; --- 3205,3210 ---- *************** *** 2911,2917 **** case ART_THRAIN: { - msg_print("The stone glows a deep green..."); wiz_lite(); (void)detect_traps(); (void)detect_doors(); --- 3212,3217 ---- *************** *** 2923,2929 **** case ART_CARLAMMAS: { - msg_print("The amulet lets out a shrill wail..."); k = 3 * p_ptr->lev; (void)set_protevil(p_ptr->protevil + randint(25) + k); o_ptr->timeout = rand_int(225) + 225; --- 3223,3228 ---- *************** *** 2932,2938 **** case ART_INGWE: { - msg_print("The amulet floods the area with goodness..."); dispel_evil(p_ptr->lev * 5); o_ptr->timeout = rand_int(300) + 300; break; --- 3231,3236 ---- *************** *** 2941,2947 **** case ART_TULKAS: { - msg_print("The ring glows brightly..."); if (!p_ptr->fast) { (void)set_fast(randint(75) + 75); --- 3239,3244 ---- *************** *** 2956,2962 **** case ART_NARYA: { - msg_print("The ring glows deep red..."); if (!get_aim_dir(&dir)) return; fire_ball(GF_FIRE, dir, 120, 3); o_ptr->timeout = rand_int(225) + 225; --- 3253,3258 ---- *************** *** 2965,2971 **** case ART_NENYA: { - msg_print("The ring glows bright white..."); if (!get_aim_dir(&dir)) return; fire_ball(GF_COLD, dir, 200, 3); o_ptr->timeout = rand_int(325) + 325; --- 3261,3266 ---- *************** *** 2974,2980 **** case ART_VILYA: { - msg_print("The ring glows deep blue..."); if (!get_aim_dir(&dir)) return; fire_ball(GF_ELEC, dir, 250, 3); o_ptr->timeout = rand_int(425) + 425; --- 3269,3274 ---- *************** *** 2983,2989 **** case ART_POWER: { - msg_print("The ring glows intensely black..."); if (!get_aim_dir(&dir)) return; ring_of_power(dir); o_ptr->timeout = rand_int(450) + 450; --- 3277,3282 ---- *************** *** 2993,2999 **** case ART_RAZORBACK: { - msg_print("Your armor is surrounded by lightning..."); for (i = 0; i < 8; i++) fire_ball(GF_ELEC, ddd[i], 150, 3); o_ptr->timeout = 1000; break; --- 3286,3291 ---- *************** *** 3001,3007 **** case ART_BLADETURNER: { - msg_print("Your armor glows many colours..."); (void)hp_player(30); (void)set_afraid(0); (void)set_shero(p_ptr->shero + randint(50) + 50); --- 3293,3298 ---- *************** *** 3018,3024 **** case ART_SOULKEEPER: { - msg_print("Your armor glows a bright white..."); msg_print("You feel much better..."); (void)hp_player(1000); (void)set_cut(0); --- 3309,3314 ---- *************** *** 3028,3034 **** case ART_BELEGENNON: { - msg_print("Your armor twists space around you..."); teleport_player(10); o_ptr->timeout = 2; break; --- 3318,3323 ---- *************** *** 3036,3042 **** case ART_CELEBORN: { - msg_print("Your armor glows deep blue..."); (void)genocide(); o_ptr->timeout = 500; break; --- 3325,3330 ---- *************** *** 3044,3050 **** case ART_CASPANION: { - msg_print("Your armor glows bright red..."); destroy_doors_touch(); o_ptr->timeout = 10; break; --- 3332,3337 ---- *************** *** 3053,3059 **** case ART_HOLHENNETH: { - msg_print("Your helm glows bright white..."); msg_print("An image forms in your mind..."); detect_all(); o_ptr->timeout = rand_int(55) + 55; --- 3340,3345 ---- *************** *** 3062,3068 **** case ART_GONDOR: { - msg_print("Your crown glows deep blue..."); msg_print("You feel a warm tingling inside..."); (void)hp_player(500); (void)set_cut(0); --- 3348,3353 ---- *************** *** 3073,3079 **** case ART_COLLUIN: { - msg_print("Your cloak glows many colours..."); (void)set_oppose_acid(p_ptr->oppose_acid + randint(20) + 20); (void)set_oppose_elec(p_ptr->oppose_elec + randint(20) + 20); (void)set_oppose_fire(p_ptr->oppose_fire + randint(20) + 20); --- 3358,3363 ---- *************** *** 3085,3091 **** case ART_HOLCOLLETH: { - msg_print("Your cloak glows deep blue..."); sleep_monsters_touch(); o_ptr->timeout = 55; break; --- 3369,3374 ---- *************** *** 3093,3099 **** case ART_THINGOL: { - msg_print("Your cloak glows bright yellow..."); recharge(60); o_ptr->timeout = 70; break; --- 3376,3381 ---- *************** *** 3101,3107 **** case ART_COLANNON: { - msg_print("Your cloak twists space around you..."); teleport_player(100); o_ptr->timeout = 45; break; --- 3383,3388 ---- *************** *** 3109,3115 **** case ART_LUTHIEN: { - msg_print("Your cloak glows a deep red..."); restore_level(); o_ptr->timeout = 450; break; --- 3390,3395 ---- *************** *** 3118,3124 **** case ART_CAMMITHRIM: { - msg_print("Your gloves glow extremely brightly..."); if (!get_aim_dir(&dir)) return; fire_bolt(GF_MISSILE, dir, damroll(2, 6)); o_ptr->timeout = 2; --- 3398,3403 ---- *************** *** 3127,3133 **** case ART_PAURHACH: { - msg_print("Your gauntlets are covered in fire..."); if (!get_aim_dir(&dir)) return; fire_bolt(GF_FIRE, dir, damroll(9, 8)); o_ptr->timeout = rand_int(8) + 8; --- 3406,3411 ---- *************** *** 3136,3142 **** case ART_PAURNIMMEN: { - msg_print("Your gauntlets are covered in frost..."); if (!get_aim_dir(&dir)) return; fire_bolt(GF_COLD, dir, damroll(6, 8)); o_ptr->timeout = rand_int(7) + 7; --- 3414,3419 ---- *************** *** 3145,3151 **** case ART_PAURAEGEN: { - msg_print("Your gauntlets are covered in sparks..."); if (!get_aim_dir(&dir)) return; fire_bolt(GF_ELEC, dir, damroll(4, 8)); o_ptr->timeout = rand_int(6) + 6; --- 3422,3427 ---- *************** *** 3154,3160 **** case ART_PAURNEN: { - msg_print("Your gauntlets are covered in acid..."); if (!get_aim_dir(&dir)) return; fire_bolt(GF_ACID, dir, damroll(5, 8)); o_ptr->timeout = rand_int(5) + 5; --- 3430,3435 ---- *************** *** 3163,3169 **** case ART_FINGOLFIN: { - msg_print("Your cesti grows magical spikes..."); if (!get_aim_dir(&dir)) return; fire_bolt(GF_ARROW, dir, 150); o_ptr->timeout = rand_int(90) + 90; --- 3438,3443 ---- *************** *** 3173,3179 **** case ART_FEANOR: { - msg_print("Your boots glow bright green..."); if (!p_ptr->fast) { (void)set_fast(randint(20) + 20); --- 3447,3452 ---- *************** *** 3188,3194 **** case ART_DAL: { - msg_print("Your boots glow deep blue..."); (void)set_afraid(0); (void)set_poisoned(0); o_ptr->timeout = 5; --- 3461,3466 ---- *************** *** 3198,3204 **** case ART_NARTHANC: { - msg_print("Your dagger is covered in fire..."); if (!get_aim_dir(&dir)) return; fire_bolt(GF_FIRE, dir, damroll(9, 8)); o_ptr->timeout = rand_int(8) + 8; --- 3470,3475 ---- *************** *** 3207,3213 **** case ART_NIMTHANC: { - msg_print("Your dagger is covered in frost..."); if (!get_aim_dir(&dir)) return; fire_bolt(GF_COLD, dir, damroll(6, 8)); o_ptr->timeout = rand_int(7) +