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) + 7; --- 3478,3483 ---- *************** *** 3216,3222 **** case ART_DETHANC: { - msg_print("Your dagger is covered in sparks..."); if (!get_aim_dir(&dir)) return; fire_bolt(GF_ELEC, dir, damroll(4, 8)); o_ptr->timeout = rand_int(6) + 6; --- 3486,3491 ---- *************** *** 3225,3231 **** case ART_RILIA: { - msg_print("Your dagger throbs deep green..."); if (!get_aim_dir(&dir)) return; fire_ball(GF_POIS, dir, 12, 3); o_ptr->timeout = rand_int(4) + 4; --- 3494,3499 ---- *************** *** 3234,3240 **** case ART_BELANGIL: { - msg_print("Your dagger is covered in frost..."); if (!get_aim_dir(&dir)) return; fire_ball(GF_COLD, dir, 48, 2); o_ptr->timeout = rand_int(5) + 5; --- 3502,3507 ---- *************** *** 3243,3249 **** case ART_ARUNRUTH: { - msg_print("Your sword glows a pale blue..."); if (!get_aim_dir(&dir)) return; fire_bolt(GF_COLD, dir, damroll(12, 8)); o_ptr->timeout = 500; --- 3510,3515 ---- *************** *** 3252,3258 **** case ART_RINGIL: { - msg_print("Your sword glows an intense blue..."); if (!get_aim_dir(&dir)) return; fire_ball(GF_COLD, dir, 100, 2); o_ptr->timeout = 300; --- 3518,3523 ---- *************** *** 3261,3267 **** case ART_ANDURIL: { - msg_print("Your sword glows an intense red..."); if (!get_aim_dir(&dir)) return; fire_ball(GF_FIRE, dir, 72, 2); o_ptr->timeout = 400; --- 3526,3531 ---- *************** *** 3271,3277 **** case ART_THEODEN: { - msg_print("Your axe blade glows black..."); if (!get_aim_dir(&dir)) return; drain_life(dir, 120); o_ptr->timeout = 400; --- 3535,3540 ---- *************** *** 3280,3286 **** case ART_AEGLOS: { - msg_print("Your spear glows a bright white..."); if (!get_aim_dir(&dir)) return; fire_ball(GF_COLD, dir, 100, 2); o_ptr->timeout = 500; --- 3543,3548 ---- *************** *** 3289,3295 **** case ART_OROME: { - msg_print("Your spear pulsates..."); if (!get_aim_dir(&dir)) return; wall_to_mud(dir); o_ptr->timeout = 5; --- 3551,3556 ---- *************** *** 3298,3304 **** case ART_EONWE: { - msg_print("Your axe lets out a long, shrill note..."); (void)mass_genocide(); o_ptr->timeout = 1000; break; --- 3559,3564 ---- *************** *** 3306,3312 **** case ART_LOTHARANG: { - msg_print("Your battle axe radiates deep purple..."); hp_player(damroll(4, 8)); (void)set_cut((p_ptr->cut / 2) - 50); o_ptr->timeout = rand_int(3) + 3; --- 3566,3571 ---- *************** *** 3315,3321 **** case ART_ULMO: { - msg_print("Your trident glows deep red..."); if (!get_aim_dir(&dir)) return; teleport_monster(dir); o_ptr->timeout = 150; --- 3574,3579 ---- *************** *** 3324,3340 **** case ART_AVAVIR: { ! msg_print("Your scythe glows soft white..."); ! 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..."); ! } o_ptr->timeout = 200; break; } --- 3582,3588 ---- case ART_AVAVIR: { ! set_recall(); o_ptr->timeout = 200; break; } *************** *** 3342,3348 **** case ART_TOTILA: { - msg_print("Your flail glows in scintillating colours..."); if (!get_aim_dir(&dir)) return; confuse_monster(dir, 20); o_ptr->timeout = 15; --- 3590,3595 ---- *************** *** 3351,3357 **** case ART_FIRESTAR: { - msg_print("Your morning star rages in fire..."); if (!get_aim_dir(&dir)) return; fire_ball(GF_FIRE, dir, 72, 3); o_ptr->timeout = 100; --- 3598,3603 ---- *************** *** 3360,3366 **** case ART_TARATOL: { - msg_print("Your mace glows bright green..."); if (!p_ptr->fast) { (void)set_fast(randint(20) + 20); --- 3606,3611 ---- *************** *** 3375,3381 **** case ART_ERIRIL: { - msg_print("Your quarterstaff glows yellow..."); if (!ident_spell()) return; o_ptr->timeout = 10; break; --- 3620,3625 ---- *************** *** 3383,3389 **** case ART_OLORIN: { - msg_print("Your quarterstaff glows brightly..."); probing(); o_ptr->timeout = 20; break; --- 3627,3632 ---- *************** *** 3391,3397 **** case ART_TURMIL: { - msg_print("Your hammer glows white..."); if (!get_aim_dir(&dir)) return; drain_life(dir, 90); o_ptr->timeout = 70; --- 3634,3639 ---- *************** *** 3401,3407 **** case ART_CUBRAGOL: { - msg_print("Your crossbow glows deep red..."); (void)brand_bolts(); o_ptr->timeout = 999; break; --- 3643,3648 ---- diff -r -c angband-283/src/config.h angband-285/src/config.h *** angband-283/src/config.h Wed Feb 11 06:30:28 1998 --- angband-285/src/config.h Wed Sep 1 14:51:09 1999 *************** *** 233,238 **** --- 233,261 ---- /* + * OPTION: Allow repeating of last command. + */ + #define ALLOW_REPEAT + + + /* + * OPTION: Allow open/disarm/close without direction. + */ + #define ALLOW_EASY_OPEN + + /* + * OPTION: Make floor stacks easy. + */ + #define ALLOW_EASY_FLOOR + + + /* + * OPTION: Allow scrolling while targetting. + */ + #define ALLOW_SCROLL_TARGET + + + /* * OPTION: Delay the loading of the "f_text" array until it is actually * needed, saving ~1K, since "feature" descriptions are unused. */ *************** *** 306,311 **** --- 329,344 ---- /* + * OPTION: Allow use of the "smart_monsters" and "smart_packs" + * software options, which attempt to make monsters smarter. + * + * AI code by Keldon Jones (keldon@umr.edu), modified by Julian + * Lighton (jl8e@fragment.com). + */ + #define MONSTER_AI + + + /* * OPTION: Support multiple "player" grids in "map_info()" */ /* #define MAP_INFO_MULTIPLE_PLAYERS */ *************** *** 337,352 **** #define DRS_SMART_OPTIONS - /* ! * OPTION: Enable the "track_follow" and "track_target" options. ! * They let monsters follow the player's foot-prints, or remember ! * the player's recent locations. This code has been removed from ! * the current version because it is being rewritten by Billy, and ! * until it is ready, it will not work. Do not define this option. */ ! /* #define WDT_TRACK_OPTIONS */ ! /* --- 370,379 ---- #define DRS_SMART_OPTIONS /* ! * OPTION: Allow the use of random artifacts (see "init3.c"). */ ! /* #define GJW_RANDART */ /* *************** *** 399,406 **** * See "main.c" for usage, and note that this value is only used on * certain machines, primarily Unix machines. If this value is used, * it will be over-ridden by the "ANGBAND_PATH" environment variable, ! * if that variable is defined and accessable. The final slash is ! * optional, but it may eventually be required. * * Using the value "./lib/" below tells Angband that, by default, * the user will run "angband" from the same directory that contains --- 426,433 ---- * See "main.c" for usage, and note that this value is only used on * certain machines, primarily Unix machines. If this value is used, * it will be over-ridden by the "ANGBAND_PATH" environment variable, ! * if that variable is defined and accessable. The final "slash" is ! * required if the value supplied is in fact a directory. * * Using the value "./lib/" below tells Angband that, by default, * the user will run "angband" from the same directory that contains *************** *** 488,500 **** --- 515,530 ---- # undef ALLOW_VISUALS # undef ALLOW_MACROS # undef MONSTER_FLOW + # undef ALLOW_TERROR # undef WDT_TRACK_OPTIONS # undef DRS_SMART_OPTIONS + # undef GJW_RANDART # undef ALLOW_OLD_SAVEFILES # undef ALLOW_BORG # undef ALLOW_DEBUG # undef ALLOW_SPOILERS # undef ALLOW_TEMPLATES + # undef MONSTER_AI # undef DELAY_LOAD_R_TEXT # define DELAY_LOAD_R_TEXT #endif diff -r -c angband-283/src/defines.h angband-285/src/defines.h *** angband-283/src/defines.h Wed Feb 11 06:30:28 1998 --- angband-285/src/defines.h Sun Sep 5 11:23:05 1999 *************** *** 41,59 **** /* * Current version string */ ! #define VERSION_STRING "2.8.3" /* * Current version numbers */ #define VERSION_MAJOR 2 #define VERSION_MINOR 8 ! #define VERSION_PATCH 3 /* ! * This value is not currently used */ ! #define VERSION_EXTRA 0 /* --- 41,61 ---- /* * Current version string */ ! #define VERSION_STRING "2.8.5" /* * Current version numbers */ #define VERSION_MAJOR 2 #define VERSION_MINOR 8 ! #define VERSION_PATCH 5 ! #define VERSION_EXTRA 0 ! /* ! * Version of random artifact code. */ ! #define RANDART_VERSION 62 /* *************** *** 121,126 **** --- 123,140 ---- #define MAX_OWNERS 4 /* + * Store index definitions (see "store.c", etc) + */ + #define STORE_GENERAL 0 + #define STORE_ARMOR 1 + #define STORE_WEAPON 2 + #define STORE_TEMPLE 3 + #define STORE_ALCHEMY 4 + #define STORE_MAGIC 5 + #define STORE_B_MARKET 6 + #define STORE_HOME 7 + + /* * Maximum number of player "sex" types (see "table.c", etc) */ #define MAX_SEXES 2 *************** *** 144,150 **** #define MAX_A_IDX 128 /* Max size for "a_info[]" */ #define MAX_E_IDX 128 /* Max size for "e_info[]" */ #define MAX_R_IDX 549 /* Max size for "r_info[]" */ ! #define MAX_V_IDX 16 /* Max size for "v_info[]" */ /* --- 158,164 ---- #define MAX_A_IDX 128 /* Max size for "a_info[]" */ #define MAX_E_IDX 128 /* Max size for "e_info[]" */ #define MAX_R_IDX 549 /* Max size for "r_info[]" */ ! #define MAX_V_IDX 64 /* Max size for "v_info[]" */ /* *************** *** 392,397 **** --- 406,417 ---- #define A_CHR 5 /* + * Total number of stats. + */ + #define A_MAX 6 + + + /* * Player sex constants (hard-coded by save-files, arrays, etc) */ #define SEX_FEMALE 0 *************** *** 521,530 **** #define SUMMON_DEMON 16 #define SUMMON_UNDEAD 17 #define SUMMON_DRAGON 18 ! #define SUMMON_HI_UNDEAD 21 ! #define SUMMON_HI_DRAGON 22 #define SUMMON_WRAITH 31 #define SUMMON_UNIQUE 32 /* --- 541,554 ---- #define SUMMON_DEMON 16 #define SUMMON_UNDEAD 17 #define SUMMON_DRAGON 18 ! /* xxx */ ! #define SUMMON_HI_DEMON 26 ! #define SUMMON_HI_UNDEAD 27 ! #define SUMMON_HI_DRAGON 28 ! /* xxx */ #define SUMMON_WRAITH 31 #define SUMMON_UNIQUE 32 + #define SUMMON_KIN 33 /* *************** *** 596,603 **** * * Most of these come from the "SM_xxx" flags */ ! #define DRS_FREE 14 ! #define DRS_MANA 15 #define DRS_RES_ACID 16 #define DRS_RES_ELEC 17 #define DRS_RES_FIRE 18 --- 620,627 ---- * * Most of these come from the "SM_xxx" flags */ ! #define DRS_FREE 14 ! #define DRS_MANA 15 #define DRS_RES_ACID 16 #define DRS_RES_ELEC 17 #define DRS_RES_FIRE 18 *************** *** 1626,1647 **** /* * Bit flags for the "monster_desc" function */ ! #define MDESC_OBJE 0x01 /* Objective (or Reflexive) */ ! #define MDESC_POSS 0x02 /* Possessive (or Reflexive) */ ! #define MDESC_IND1 0x04 /* Indefinites for hidden monsters */ ! #define MDESC_IND2 0x08 /* Indefinites for visible monsters */ ! #define MDESC_PRO1 0x10 /* Pronominalize hidden monsters */ ! #define MDESC_PRO2 0x20 /* Pronominalize visible monsters */ ! #define MDESC_HIDE 0x40 /* Assume the monster is hidden */ ! #define MDESC_SHOW 0x80 /* Assume the monster is visible */ /* * Bit flags for the "get_item" function */ ! #define USE_EQUIP 0x01 /* Allow equip items */ ! #define USE_INVEN 0x02 /* Allow inven items */ ! #define USE_FLOOR 0x04 /* Allow floor items */ --- 1650,1671 ---- /* * Bit flags for the "monster_desc" function */ ! #define MDESC_OBJE 0x01 /* Objective (or Reflexive) */ ! #define MDESC_POSS 0x02 /* Possessive (or Reflexive) */ ! #define MDESC_IND1 0x04 /* Indefinites for hidden monsters */ ! #define MDESC_IND2 0x08 /* Indefinites for visible monsters */ ! #define MDESC_PRO1 0x10 /* Pronominalize hidden monsters */ ! #define MDESC_PRO2 0x20 /* Pronominalize visible monsters */ ! #define MDESC_HIDE 0x40 /* Assume the monster is hidden */ ! #define MDESC_SHOW 0x80 /* Assume the monster is visible */ /* * Bit flags for the "get_item" function */ ! #define USE_EQUIP 0x01 /* Allow equip items */ ! #define USE_INVEN 0x02 /* Allow inven items */ ! #define USE_FLOOR 0x04 /* Allow floor items */ *************** *** 1651,1670 **** /* * Bit flags for the "p_ptr->notice" variable */ ! #define PN_COMBINE 0x00000001L /* Combine the pack */ ! #define PN_REORDER 0x00000002L /* Reorder the pack */ /* xxx (many) */ /* * Bit flags for the "p_ptr->update" variable */ ! #define PU_BONUS 0x00000001L /* Calculate bonuses */ ! #define PU_TORCH 0x00000002L /* Calculate torch radius */ /* xxx (many) */ ! #define PU_HP 0x00000010L /* Calculate chp and mhp */ ! #define PU_MANA 0x00000020L /* Calculate csp and msp */ ! #define PU_SPELLS 0x00000040L /* Calculate spells */ /* xxx (many) */ #define PU_FORGET_VIEW 0x00010000L /* Forget field of view */ #define PU_UPDATE_VIEW 0x00020000L /* Update field of view */ --- 1675,1694 ---- /* * Bit flags for the "p_ptr->notice" variable */ ! #define PN_COMBINE 0x00000001L /* Combine the pack */ ! #define PN_REORDER 0x00000002L /* Reorder the pack */ /* xxx (many) */ /* * Bit flags for the "p_ptr->update" variable */ ! #define PU_BONUS 0x00000001L /* Calculate bonuses */ ! #define PU_TORCH 0x00000002L /* Calculate torch radius */ /* xxx (many) */ ! #define PU_HP 0x00000010L /* Calculate chp and mhp */ ! #define PU_MANA 0x00000020L /* Calculate csp and msp */ ! #define PU_SPELLS 0x00000040L /* Calculate spells */ /* xxx (many) */ #define PU_FORGET_VIEW 0x00010000L /* Forget field of view */ #define PU_UPDATE_VIEW 0x00020000L /* Update field of view */ *************** *** 1672,1736 **** #define PU_FORGET_FLOW 0x00100000L /* Forget flow data */ #define PU_UPDATE_FLOW 0x00200000L /* Update flow data */ /* xxx (many) */ ! #define PU_MONSTERS 0x10000000L /* Update monsters */ ! #define PU_DISTANCE 0x20000000L /* Update distances */ /* xxx */ ! #define PU_PANEL 0x80000000L /* Update panel */ /* * Bit flags for the "p_ptr->redraw" variable */ ! #define PR_MISC 0x00000001L /* Display Race/Class */ ! #define PR_TITLE 0x00000002L /* Display Title */ ! #define PR_LEV 0x00000004L /* Display Level */ ! #define PR_EXP 0x00000008L /* Display Experience */ ! #define PR_STATS 0x00000010L /* Display Stats */ ! #define PR_ARMOR 0x00000020L /* Display Armor */ ! #define PR_HP 0x00000040L /* Display Hitpoints */ ! #define PR_MANA 0x00000080L /* Display Mana */ ! #define PR_GOLD 0x00000100L /* Display Gold */ ! #define PR_DEPTH 0x00000200L /* Display Depth */ ! /* xxx */ ! #define PR_HEALTH 0x00000800L /* Display Health Bar */ ! #define PR_CUT 0x00001000L /* Display Extra (Cut) */ ! #define PR_STUN 0x00002000L /* Display Extra (Stun) */ ! #define PR_HUNGER 0x00004000L /* Display Extra (Hunger) */ ! /* xxx */ ! #define PR_BLIND 0x00010000L /* Display Extra (Blind) */ ! #define PR_CONFUSED 0x00020000L /* Display Extra (Confused) */ ! #define PR_AFRAID 0x00040000L /* Display Extra (Afraid) */ ! #define PR_POISONED 0x00080000L /* Display Extra (Poisoned) */ ! #define PR_STATE 0x00100000L /* Display Extra (State) */ ! #define PR_SPEED 0x00200000L /* Display Extra (Speed) */ ! #define PR_STUDY 0x00400000L /* Display Extra (Study) */ /* xxx */ ! #define PR_EXTRA 0x01000000L /* Display Extra Info */ ! #define PR_BASIC 0x02000000L /* Display Basic Info */ /* xxx */ ! #define PR_MAP 0x08000000L /* Display Map */ /* xxx (many) */ /* * Bit flags for the "p_ptr->window" variable (etc) */ ! #define PW_INVEN 0x00000001L /* Display inven/equip */ ! #define PW_EQUIP 0x00000002L /* Display equip/inven */ ! #define PW_PLAYER_0 0x00000004L /* Display player (basic) */ ! #define PW_PLAYER_1 0x00000008L /* Display player (extra) */ /* xxx */ /* xxx */ ! #define PW_MESSAGE 0x00000040L /* Display messages */ ! #define PW_OVERHEAD 0x00000080L /* Display overhead view */ ! #define PW_MONSTER 0x00000100L /* Display monster recall */ ! #define PW_OBJECT 0x00000200L /* Display object recall */ /* xxx */ ! #define PW_SNAPSHOT 0x00000800L /* Display snap-shot */ /* xxx */ /* xxx */ ! #define PW_BORG_1 0x00004000L /* Display borg messages */ ! #define PW_BORG_2 0x00008000L /* Display borg status */ ! /*** Cave flags ***/ --- 1696,1759 ---- #define PU_FORGET_FLOW 0x00100000L /* Forget flow data */ #define PU_UPDATE_FLOW 0x00200000L /* Update flow data */ /* xxx (many) */ ! #define PU_MONSTERS 0x10000000L /* Update monsters */ ! #define PU_DISTANCE 0x20000000L /* Update distances */ /* xxx */ ! #define PU_PANEL 0x80000000L /* Update panel */ /* * Bit flags for the "p_ptr->redraw" variable */ ! #define PR_MISC 0x00000001L /* Display Race/Class */ ! #define PR_TITLE 0x00000002L /* Display Title */ ! #define PR_LEV 0x00000004L /* Display Level */ ! #define PR_EXP 0x00000008L /* Display Experience */ ! #define PR_STATS 0x00000010L /* Display Stats */ ! #define PR_ARMOR 0x00000020L /* Display Armor */ ! #define PR_HP 0x00000040L /* Display Hitpoints */ ! #define PR_MANA 0x00000080L /* Display Mana */ ! #define PR_GOLD 0x00000100L /* Display Gold */ ! #define PR_DEPTH 0x00000200L /* Display Depth */ ! /* xxx */ ! #define PR_HEALTH 0x00000800L /* Display Health Bar */ ! #define PR_CUT 0x00001000L /* Display Extra (Cut) */ ! #define PR_STUN 0x00002000L /* Display Extra (Stun) */ ! #define PR_HUNGER 0x00004000L /* Display Extra (Hunger) */ ! /* xxx */ ! #define PR_BLIND 0x00010000L /* Display Extra (Blind) */ ! #define PR_CONFUSED 0x00020000L /* Display Extra (Confused) */ ! #define PR_AFRAID 0x00040000L /* Display Extra (Afraid) */ ! #define PR_POISONED 0x00080000L /* Display Extra (Poisoned) */ ! #define PR_STATE 0x00100000L /* Display Extra (State) */ ! #define PR_SPEED 0x00200000L /* Display Extra (Speed) */ ! #define PR_STUDY 0x00400000L /* Display Extra (Study) */ /* xxx */ ! #define PR_EXTRA 0x01000000L /* Display Extra Info */ ! #define PR_BASIC 0x02000000L /* Display Basic Info */ /* xxx */ ! #define PR_MAP 0x08000000L /* Display Map */ /* xxx (many) */ /* * Bit flags for the "p_ptr->window" variable (etc) */ ! #define PW_INVEN 0x00000001L /* Display inven/equip */ ! #define PW_EQUIP 0x00000002L /* Display equip/inven */ ! #define PW_PLAYER_0 0x00000004L /* Display player (basic) */ ! #define PW_PLAYER_1 0x00000008L /* Display player (extra) */ /* xxx */ /* xxx */ ! #define PW_MESSAGE 0x00000040L /* Display messages */ ! #define PW_OVERHEAD 0x00000080L /* Display overhead view */ ! #define PW_MONSTER 0x00000100L /* Display monster recall */ ! #define PW_OBJECT 0x00000200L /* Display object recall */ /* xxx */ ! #define PW_SNAPSHOT 0x00000800L /* Display snap-shot */ /* xxx */ /* xxx */ ! #define PW_BORG_1 0x00004000L /* Display borg messages */ ! #define PW_BORG_2 0x00008000L /* Display borg status */ /*** Cave flags ***/ *************** *** 1739,1752 **** /* * Special cave grid flags */ ! #define CAVE_MARK 0x01 /* memorized feature */ ! #define CAVE_GLOW 0x02 /* self-illuminating */ ! #define CAVE_ICKY 0x04 /* part of a vault */ ! #define CAVE_ROOM 0x08 /* part of a room */ ! #define CAVE_SEEN 0x10 /* seen flag */ ! #define CAVE_VIEW 0x20 /* view flag */ ! #define CAVE_TEMP 0x40 /* temp flag */ ! #define CAVE_WALL 0x80 /* wall flag */ --- 1762,1775 ---- /* * Special cave grid flags */ ! #define CAVE_MARK 0x01 /* memorized feature */ ! #define CAVE_GLOW 0x02 /* self-illuminating */ ! #define CAVE_ICKY 0x04 /* part of a vault */ ! #define CAVE_ROOM 0x08 /* part of a room */ ! #define CAVE_SEEN 0x10 /* seen flag */ ! #define CAVE_VIEW 0x20 /* view flag */ ! #define CAVE_TEMP 0x40 /* temp flag */ ! #define CAVE_WALL 0x80 /* wall flag */ *************** *** 1756,1767 **** /* * Chest trap flags (see "tables.c") */ ! #define CHEST_LOSE_STR 0x01 ! #define CHEST_LOSE_CON 0x02 ! #define CHEST_POISON 0x04 ! #define CHEST_PARALYZE 0x08 ! #define CHEST_EXPLODE 0x10 ! #define CHEST_SUMMON 0x20 /* --- 1779,1790 ---- /* * Chest trap flags (see "tables.c") */ ! #define CHEST_LOSE_STR 0x01 ! #define CHEST_LOSE_CON 0x02 ! #define CHEST_POISON 0x04 ! #define CHEST_PARALYZE 0x08 ! #define CHEST_EXPLODE 0x10 ! #define CHEST_SUMMON 0x20 /* *************** *** 1778,1786 **** /* ! * Some bit-flags for the "smart" field * ! * Most of these map to the "TR2_xxx" flags */ #define SM_OPP_ACID 0x00000001 #define SM_OPP_ELEC 0x00000002 --- 1801,1829 ---- /* ! * The special inscriptions. ! */ ! #define INSCRIP_NULL 100 ! #define INSCRIP_TERRIBLE 100+1 ! #define INSCRIP_WORTHLESS 100+2 ! #define INSCRIP_CURSED 100+3 ! #define INSCRIP_BROKEN 100+4 ! #define INSCRIP_AVERAGE 100+5 ! #define INSCRIP_GOOD 100+6 ! #define INSCRIP_EXCELLENT 100+7 ! #define INSCRIP_SPECIAL 100+8 ! #define INSCRIP_UNCURSED 100+9 ! ! /* ! * Number of special inscriptions, plus one. ! */ ! #define MAX_INSCRIP 10 ! ! ! /* ! * Some bit-flags for the "smart" field of "monster_type". * ! * Most of these map to the "TR2_xxx" flags. */ #define SM_OPP_ACID 0x00000001 #define SM_OPP_ELEC 0x00000002 *************** *** 1938,1948 **** * Hack -- flag set 1 -- mask for "pval-dependant" flags. * Note that all "pval" dependant flags must be in "flags1". */ ! #define TR1_PVAL_MASK \ ! (TR1_STR | TR1_INT | TR1_WIS | TR1_DEX | \ ! TR1_CON | TR1_CHR | TR1_XXX1 | TR1_XXX2 | \ ! TR1_STEALTH | TR1_SEARCH | TR1_INFRA | TR1_TUNNEL | \ ! TR1_SPEED | TR1_BLOWS | TR1_SHOTS | TR1_MIGHT) /* --- 1981,1991 ---- * Hack -- flag set 1 -- mask for "pval-dependant" flags. * Note that all "pval" dependant flags must be in "flags1". */ ! #define TR1_PVAL_MASK \ ! (TR1_STR | TR1_INT | TR1_WIS | TR1_DEX | \ ! TR1_CON | TR1_CHR | TR1_XXX1 | TR1_XXX2 | \ ! TR1_STEALTH | TR1_SEARCH | TR1_INFRA | TR1_TUNNEL | \ ! TR1_SPEED | TR1_BLOWS | TR1_SHOTS | TR1_MIGHT) /* *************** *** 2188,2195 **** #define RF6_TRAPS 0x00002000 /* Create Traps */ #define RF6_FORGET 0x00004000 /* Cause amnesia */ #define RF6_XXX6 0x00008000 /* ??? */ ! #define RF6_XXX7 0x00010000 /* Summon (?) */ ! #define RF6_XXX8 0x00020000 /* Summon (?) */ #define RF6_S_MONSTER 0x00040000 /* Summon Monster */ #define RF6_S_MONSTERS 0x00080000 /* Summon Monsters */ #define RF6_S_ANT 0x00100000 /* Summon Ants */ --- 2231,2238 ---- #define RF6_TRAPS 0x00002000 /* Create Traps */ #define RF6_FORGET 0x00004000 /* Cause amnesia */ #define RF6_XXX6 0x00008000 /* ??? */ ! #define RF6_S_KIN 0x00010000 /* Summon Kin */ ! #define RF6_S_HI_DEMON 0x00020000 /* Summon Greater Demons */ #define RF6_S_MONSTER 0x00040000 /* Summon Monster */ #define RF6_S_MONSTERS 0x00080000 /* Summon Monsters */ #define RF6_S_ANT 0x00100000 /* Summon Ants */ *************** *** 2208,2262 **** /* ! * Hack -- choose "intelligent" spells when desperate */ #define RF4_INT_MASK \ ! 0L #define RF5_INT_MASK \ ! (RF5_HOLD | RF5_SLOW | RF5_CONF | RF5_BLIND | RF5_SCARE) #define RF6_INT_MASK \ ! (RF6_BLINK | RF6_TPORT | RF6_TELE_LEVEL | RF6_TELE_AWAY | \ ! RF6_HEAL | RF6_HASTE | RF6_TRAPS | \ ! RF6_S_MONSTER | RF6_S_MONSTERS | \ ! RF6_S_ANT | RF6_S_SPIDER | RF6_S_HOUND | RF6_S_HYDRA | \ ! RF6_S_ANGEL | RF6_S_DRAGON | RF6_S_UNDEAD | RF6_S_DEMON | \ ! RF6_S_HI_DRAGON | RF6_S_HI_UNDEAD | RF6_S_WRAITH | RF6_S_UNIQUE) ! /*** Cheating option Definitions ***/ /* ! * Indexes */ ! #define CHEAT_cheat_peek 0 ! #define CHEAT_cheat_hear 1 ! #define CHEAT_cheat_room 2 ! #define CHEAT_cheat_xtra 3 ! #define CHEAT_cheat_know 4 ! #define CHEAT_cheat_live 5 ! #define CHEAT_MAX 6 /* ! * Hack -- Option symbols */ ! #define cheat_peek p_ptr->cheat[CHEAT_cheat_peek] ! #define cheat_hear p_ptr->cheat[CHEAT_cheat_hear] ! #define cheat_room p_ptr->cheat[CHEAT_cheat_room] ! #define cheat_xtra p_ptr->cheat[CHEAT_cheat_xtra] ! #define cheat_know p_ptr->cheat[CHEAT_cheat_know] ! #define cheat_live p_ptr->cheat[CHEAT_cheat_live] /*** Option Definitions ***/ /* ! * Indexes */ #define OPT_rogue_like_commands 0 #define OPT_quick_messages 1 --- 2251,2433 ---- /* ! * Hack -- Bit masks to control what spells are considered ! */ ! ! /* ! * Choose "intelligent" spells when desperate */ #define RF4_INT_MASK \ ! (0L) #define RF5_INT_MASK \ ! (RF5_HOLD | RF5_SLOW | RF5_CONF | RF5_BLIND | RF5_SCARE) #define RF6_INT_MASK \ ! (RF6_BLINK | RF6_TPORT | RF6_TELE_LEVEL | RF6_TELE_AWAY | \ ! RF6_HEAL | RF6_HASTE | RF6_TRAPS | \ ! RF6_S_KIN | RF6_S_MONSTER | RF6_S_MONSTERS | \ ! RF6_S_ANT | RF6_S_SPIDER | RF6_S_HOUND | RF6_S_HYDRA | \ ! RF6_S_ANGEL | RF6_S_DRAGON | RF6_S_UNDEAD | RF6_S_DEMON | \ ! RF6_S_HI_DRAGON | RF6_S_HI_UNDEAD | RF6_S_HI_DEMON | \ ! RF6_S_WRAITH | RF6_S_UNIQUE) + /* + * "Bolt" spells that may hurt fellow monsters + */ + #define RF4_BOLT_MASK \ + (RF4_ARROW_1 | RF4_ARROW_2 | RF4_ARROW_3 | RF4_ARROW_4) + + #define RF5_BOLT_MASK \ + (RF5_BO_ACID | RF5_BO_ELEC | RF5_BO_FIRE | RF5_BO_COLD | \ + RF5_BO_POIS | RF5_BO_NETH | RF5_BO_WATE | RF5_BO_MANA | \ + RF5_BO_PLAS | RF5_BO_ICEE | RF5_MISSILE) ! #define RF6_BOLT_MASK \ ! (0L) /* ! * Spells that allow the caster to escape */ ! #define RF4_ESCAPE_MASK \ ! (0L) ! ! #define RF5_ESCAPE_MASK \ ! (0L) ! ! #define RF6_ESCAPE_MASK \ ! (RF6_BLINK | RF6_TPORT | RF6_TELE_AWAY | RF6_TELE_LEVEL) /* ! * Spells that hurt the player directly ! */ ! #define RF4_ATTACK_MASK \ ! (RF4_ARROW_1 | RF4_ARROW_2 | RF4_ARROW_3 | RF4_ARROW_4 | \ ! RF4_BR_ACID | RF4_BR_ELEC | RF4_BR_FIRE | RF4_BR_COLD | RF4_BR_POIS | \ ! RF4_BR_NETH | RF4_BR_LITE | RF4_BR_DARK | RF4_BR_CONF | RF4_BR_SOUN | \ ! RF4_BR_CHAO | RF4_BR_DISE | RF4_BR_NEXU | RF4_BR_TIME | RF4_BR_INER | \ ! RF4_BR_GRAV | RF4_BR_SHAR | RF4_BR_PLAS | RF4_BR_WALL | RF4_BR_MANA) ! ! #define RF5_ATTACK_MASK \ ! (RF5_BA_ACID | RF5_BA_ELEC | RF5_BA_FIRE | RF5_BA_COLD | RF5_BA_POIS | \ ! RF5_BA_NETH | RF5_BA_WATE | RF5_BA_MANA | RF5_BA_DARK | \ ! RF5_MIND_BLAST | RF5_BRAIN_SMASH | RF5_CAUSE_1 | RF5_CAUSE_2 | \ ! RF5_CAUSE_3 | RF5_CAUSE_4 | RF5_BO_ACID | RF5_BO_ELEC | RF5_BO_FIRE | \ ! RF5_BO_COLD | RF5_BO_POIS | RF5_BO_NETH | RF5_BO_WATE | RF5_BO_MANA | \ ! RF5_BO_PLAS | RF5_BO_ICEE | RF5_MISSILE) ! ! #define RF6_ATTACK_MASK \ ! (0L) ! ! ! /* ! * Summoning spells ! */ ! #define RF4_SUMMON_MASK \ ! (0L) ! ! #define RF5_SUMMON_MASK \ ! (0L) ! ! #define RF6_SUMMON_MASK \ ! (RF6_S_KIN | RF6_S_MONSTER | RF6_S_MONSTERS | RF6_S_ANT | \ ! RF6_S_SPIDER | RF6_S_HOUND | RF6_S_HYDRA | RF6_S_ANGEL | \ ! RF6_S_DEMON | RF6_S_UNDEAD | RF6_S_DRAGON | RF6_S_HI_UNDEAD | \ ! RF6_S_HI_DEMON | RF6_S_HI_DRAGON | RF6_S_WRAITH | RF6_S_UNIQUE) ! ! ! /* ! * Spells that improve the caster's tactical position ! */ ! #define RF4_TACTIC_MASK \ ! (0L) ! ! #define RF5_TACTIC_MASK \ ! (0L) ! ! #define RF6_TACTIC_MASK \ ! (RF6_BLINK) ! ! ! /* ! * Annoying spells */ ! #define RF4_ANNOY_MASK \ ! (RF4_SHRIEK) ! ! #define RF5_ANNOY_MASK \ ! (RF5_DRAIN_MANA | RF5_MIND_BLAST | RF5_BRAIN_SMASH | RF5_SCARE | \ ! RF5_BLIND | RF5_CONF | RF5_SLOW | RF5_HOLD) ! ! #define RF6_ANNOY_MASK \ ! (RF6_TELE_TO | RF6_DARKNESS | RF6_TRAPS | RF6_FORGET) ! ! ! /* ! * Spells that increase the caster's relative speed ! */ ! #define RF4_HASTE_MASK \ ! (0L) ! ! #define RF5_HASTE_MASK \ ! (RF5_SLOW | RF5_HOLD) ! ! #define RF6_HASTE_MASK \ ! (RF6_HASTE) ! ! ! /* ! * Healing spells ! */ ! #define RF4_HEAL_MASK \ ! (0L) ! ! #define RF5_HEAL_MASK \ ! (0L) ! ! #define RF6_HEAL_MASK \ ! (RF6_HEAL) ! ! ! /* ! * Innate spell-like effects ! */ ! #define RF4_INNATE_MASK \ ! (RF4_SHRIEK | RF4_ARROW_1 | RF4_ARROW_2 | RF4_ARROW_3 | RF4_ARROW_4 | \ ! RF4_BR_ACID | RF4_BR_ELEC | RF4_BR_FIRE | RF4_BR_COLD | RF4_BR_POIS | \ ! RF4_BR_NETH | RF4_BR_LITE | RF4_BR_DARK | RF4_BR_CONF | RF4_BR_SOUN | \ ! RF4_BR_CHAO | RF4_BR_DISE | RF4_BR_NEXU | RF4_BR_TIME | RF4_BR_INER | \ ! RF4_BR_GRAV | RF4_BR_SHAR | RF4_BR_PLAS | RF4_BR_WALL | RF4_BR_MANA) ! ! #define RF5_INNATE_MASK \ ! (0L) ! ! #define RF6_INNATE_MASK \ ! (0L) /*** Option Definitions ***/ /* ! * Option indexes (offsets) ! * ! * These values are hard-coded by savefiles (and various pieces of code). ! */ ! #define OPT_BIRTH 128 ! #define OPT_CHEAT 160 ! #define OPT_ADULT 192 ! #define OPT_SCORE 224 ! #define OPT_MAX 256 ! ! ! /* ! * Option indexes (normal) ! * ! * These values are hard-coded by savefiles. */ #define OPT_rogue_like_commands 0 #define OPT_quick_messages 1 *************** *** 2292,2299 **** /* xxx */ #define OPT_auto_haggle 32 #define OPT_auto_scum 33 ! #define OPT_testing_stack 34 ! #define OPT_testing_carry 35 #define OPT_expand_look 36 #define OPT_expand_list 37 #define OPT_view_perma_grids 38 --- 2463,2470 ---- /* xxx */ #define OPT_auto_haggle 32 #define OPT_auto_scum 33 ! /* xxx testing_stack */ ! /* xxx testing_carry */ #define OPT_expand_look 36 #define OPT_expand_list 37 #define OPT_view_perma_grids 38 *************** *** 2302,2309 **** #define OPT_dungeon_stair 41 #define OPT_flow_by_sound 42 #define OPT_flow_by_smell 43 ! /* xxx */ ! /* xxx */ #define OPT_smart_learn 46 #define OPT_smart_cheat 47 #define OPT_view_reduce_lite 48 --- 2473,2480 ---- #define OPT_dungeon_stair 41 #define OPT_flow_by_sound 42 #define OPT_flow_by_smell 43 ! /* xxx track_follow */ ! /* xxx track_target */ #define OPT_smart_learn 46 #define OPT_smart_cheat 47 #define OPT_view_reduce_lite 48 *************** *** 2322,2328 **** #define OPT_view_bright_lite 61 #define OPT_view_granite_lite 62 #define OPT_view_special_lite 63 ! #define OPT_MAX 64 /* --- 2493,2547 ---- #define OPT_view_bright_lite 61 #define OPT_view_granite_lite 62 #define OPT_view_special_lite 63 ! #define OPT_easy_open 64 ! #define OPT_easy_alter 65 ! #define OPT_easy_floor 66 ! #define OPT_show_piles 67 ! #define OPT_center_player 68 ! #define OPT_run_avoid_center 69 ! #define OPT_scroll_target 70 ! #define OPT_auto_more 71 ! #define OPT_smart_monsters 72 ! #define OPT_smart_packs 73 ! /* xxx */ ! /* xxx */ ! /* xxx */ ! /* xxx */ ! /* xxx */ ! /* xxx */ ! /* xxx xxx */ ! #define OPT_birth_point_based (OPT_BIRTH+0) ! #define OPT_birth_auto_roller (OPT_BIRTH+1) ! #define OPT_birth_maximize (OPT_BIRTH+2) ! #define OPT_birth_preserve (OPT_BIRTH+3) ! #define OPT_birth_ironman (OPT_BIRTH+4) ! #define OPT_birth_no_stores (OPT_BIRTH+5) ! #define OPT_birth_no_artifacts (OPT_BIRTH+6) ! #define OPT_birth_rand_artifacts (OPT_BIRTH+7) ! /* xxx xxx */ ! #define OPT_cheat_peek (OPT_CHEAT+0) ! #define OPT_cheat_hear (OPT_CHEAT+1) ! #define OPT_cheat_room (OPT_CHEAT+2) ! #define OPT_cheat_xtra (OPT_CHEAT+3) ! #define OPT_cheat_know (OPT_CHEAT+4) ! #define OPT_cheat_live (OPT_CHEAT+5) ! /* xxx xxx */ ! #define OPT_adult_point_based (OPT_ADULT+0) ! #define OPT_adult_auto_roller (OPT_ADULT+1) ! #define OPT_adult_maximize (OPT_ADULT+2) ! #define OPT_adult_preserve (OPT_ADULT+3) ! #define OPT_adult_ironman (OPT_ADULT+4) ! #define OPT_adult_no_stores (OPT_ADULT+5) ! #define OPT_adult_no_artifacts (OPT_ADULT+6) ! #define OPT_adult_rand_artifacts (OPT_ADULT+7) ! /* xxx xxx */ ! #define OPT_score_peek (OPT_SCORE+0) ! #define OPT_score_hear (OPT_SCORE+1) ! #define OPT_score_room (OPT_SCORE+2) ! #define OPT_score_xtra (OPT_SCORE+3) ! #define OPT_score_know (OPT_SCORE+4) ! #define OPT_score_live (OPT_SCORE+5) ! /* xxx xxx */ /* *************** *** 2362,2369 **** /* xxx */ #define auto_haggle op_ptr->opt[OPT_auto_haggle] #define auto_scum op_ptr->opt[OPT_auto_scum] ! #define testing_stack op_ptr->opt[OPT_testing_stack] ! #define testing_carry op_ptr->opt[OPT_testing_carry] #define expand_look op_ptr->opt[OPT_expand_look] #define expand_list op_ptr->opt[OPT_expand_list] #define view_perma_grids op_ptr->opt[OPT_view_perma_grids] --- 2581,2588 ---- /* xxx */ #define auto_haggle op_ptr->opt[OPT_auto_haggle] #define auto_scum op_ptr->opt[OPT_auto_scum] ! /* xxx testing_stack */ ! /* xxx testing_carry */ #define expand_look op_ptr->opt[OPT_expand_look] #define expand_list op_ptr->opt[OPT_expand_list] #define view_perma_grids op_ptr->opt[OPT_view_perma_grids] *************** *** 2372,2379 **** #define dungeon_stair op_ptr->opt[OPT_dungeon_stair] #define flow_by_sound op_ptr->opt[OPT_flow_by_sound] #define flow_by_smell op_ptr->opt[OPT_flow_by_smell] ! /* xxx */ ! /* xxx */ #define smart_learn op_ptr->opt[OPT_smart_learn] #define smart_cheat op_ptr->opt[OPT_smart_cheat] #define view_reduce_lite op_ptr->opt[OPT_view_reduce_lite] --- 2591,2598 ---- #define dungeon_stair op_ptr->opt[OPT_dungeon_stair] #define flow_by_sound op_ptr->opt[OPT_flow_by_sound] #define flow_by_smell op_ptr->opt[OPT_flow_by_smell] ! /* xxx track_follow */ ! /* xxx track_target */ #define smart_learn op_ptr->opt[OPT_smart_learn] #define smart_cheat op_ptr->opt[OPT_smart_cheat] #define view_reduce_lite op_ptr->opt[OPT_view_reduce_lite] *************** *** 2392,2397 **** --- 2611,2672 ---- #define view_bright_lite op_ptr->opt[OPT_view_bright_lite] #define view_granite_lite op_ptr->opt[OPT_view_granite_lite] #define view_special_lite op_ptr->opt[OPT_view_special_lite] + #define easy_open op_ptr->opt[OPT_easy_open] + #define easy_alter op_ptr->opt[OPT_easy_alter] + #define easy_floor op_ptr->opt[OPT_easy_floor] + #define show_piles op_ptr->opt[OPT_show_piles] + #define center_player op_ptr->opt[OPT_center_player] + #define run_avoid_center op_ptr->opt[OPT_run_avoid_center] + #define scroll_target op_ptr->opt[OPT_scroll_target] + #define auto_more op_ptr->opt[OPT_auto_more] + #define smart_monsters op_ptr->opt[OPT_smart_monsters] + #define smart_packs op_ptr->opt[OPT_smart_packs] + /* xxx */ + /* xxx */ + /* xxx */ + /* xxx */ + /* xxx */ + /* xxx */ + /* xxx xxx */ + #define birth_point_based op_ptr->opt[OPT_birth_point_based] + #define birth_auto_roller op_ptr->opt[OPT_birth_auto_roller] + #define birth_maximize op_ptr->opt[OPT_birth_maximize] + #define birth_preserve op_ptr->opt[OPT_birth_preserve] + #define birth_ironman op_ptr->opt[OPT_birth_ironman] + #define birth_no_stores op_ptr->opt[OPT_birth_no_stores] + #define birth_no_artifacts op_ptr->opt[OPT_birth_no_artifacts] + #define birth_rand_artifacts op_ptr->opt[OPT_birth_rand_artifacts] + /* xxx xxx */ + #define cheat_peek op_ptr->opt[OPT_cheat_peek] + #define cheat_hear op_ptr->opt[OPT_cheat_hear] + #define cheat_room op_ptr->opt[OPT_cheat_room] + #define cheat_xtra op_ptr->opt[OPT_cheat_xtra] + #define cheat_know op_ptr->opt[OPT_cheat_know] + #define cheat_live op_ptr->opt[OPT_cheat_live] + /* xxx xxx */ + #define adult_point_based op_ptr->opt[OPT_adult_point_based] + #define adult_auto_roller op_ptr->opt[OPT_adult_auto_roller] + #define adult_maximize op_ptr->opt[OPT_adult_maximize] + #define adult_preserve op_ptr->opt[OPT_adult_preserve] + #define adult_ironman op_ptr->opt[OPT_adult_ironman] + #define adult_no_stores op_ptr->opt[OPT_adult_no_stores] + #define adult_no_artifacts op_ptr->opt[OPT_adult_no_artifacts] + #define adult_rand_artifacts op_ptr->opt[OPT_adult_rand_artifacts] + /* xxx xxx */ + #define score_peek op_ptr->opt[OPT_score_peek] + #define score_hear op_ptr->opt[OPT_score_hear] + #define score_room op_ptr->opt[OPT_score_room] + #define score_xtra op_ptr->opt[OPT_score_xtra] + #define score_know op_ptr->opt[OPT_score_know] + #define score_live op_ptr->opt[OPT_score_live] + /* xxx xxx */ + + + /* + * Information for "do_cmd_options()". + */ + #define OPT_PAGE_MAX 6 + #define OPT_PAGE_PER 20 diff -r -c angband-283/src/dungeon.c angband-285/src/dungeon.c *** angband-283/src/dungeon.c Wed Feb 11 06:30:28 1998 --- angband-285/src/dungeon.c Fri Sep 3 15:26:38 1999 *************** *** 11,90 **** #include "angband.h" - - /* * Return a "feeling" (or NULL) about an item. Method 1 (Heavy). */ ! static cptr value_check_aux1(object_type *o_ptr) { /* Artifacts */ if (artifact_p(o_ptr)) { /* Cursed/Broken */ ! if (cursed_p(o_ptr) || broken_p(o_ptr)) return "terrible"; /* Normal */ ! return "special"; } /* Ego-Items */ if (ego_item_p(o_ptr)) { /* Cursed/Broken */ ! if (cursed_p(o_ptr) || broken_p(o_ptr)) return "worthless"; /* Normal */ ! return "excellent"; } /* Cursed items */ ! if (cursed_p(o_ptr)) return "cursed"; /* Broken items */ ! if (broken_p(o_ptr)) return "broken"; /* Good "armor" bonus */ ! if (o_ptr->to_a > 0) return "good"; /* Good "weapon" bonus */ ! if (o_ptr->to_h + o_ptr->to_d > 0) return "good"; /* Default to "average" */ ! return "average"; } /* * Return a "feeling" (or NULL) about an item. Method 2 (Light). */ ! static cptr value_check_aux2(object_type *o_ptr) { /* Cursed items (all of them) */ ! if (cursed_p(o_ptr)) return "cursed"; /* Broken items (all of them) */ ! if (broken_p(o_ptr)) return "broken"; /* Artifacts -- except cursed/broken ones */ ! if (artifact_p(o_ptr)) return "good"; /* Ego-Items -- except cursed/broken ones */ ! if (ego_item_p(o_ptr)) return "good"; /* Good armor bonus */ ! if (o_ptr->to_a > 0) return "good"; /* Good weapon bonuses */ ! if (o_ptr->to_h + o_ptr->to_d > 0) return "good"; /* No feeling */ ! return (NULL); } - /* * Sense the inventory * --- 11,87 ---- #include "angband.h" /* * Return a "feeling" (or NULL) about an item. Method 1 (Heavy). */ ! static int value_check_aux1(object_type *o_ptr) { /* Artifacts */ if (artifact_p(o_ptr)) { /* Cursed/Broken */ ! if (cursed_p(o_ptr) || broken_p(o_ptr)) return (INSCRIP_TERRIBLE); /* Normal */ ! return (INSCRIP_SPECIAL); } /* Ego-Items */ if (ego_item_p(o_ptr)) { /* Cursed/Broken */ ! if (cursed_p(o_ptr) || broken_p(o_ptr)) return (INSCRIP_WORTHLESS); /* Normal */ ! return (INSCRIP_EXCELLENT); } /* Cursed items */ ! if (cursed_p(o_ptr)) return (INSCRIP_CURSED); /* Broken items */ ! if (broken_p(o_ptr)) return (INSCRIP_BROKEN); /* Good "armor" bonus */ ! if (o_ptr->to_a > 0) return (INSCRIP_GOOD); /* Good "weapon" bonus */ ! if (o_ptr->to_h + o_ptr->to_d > 0) return (INSCRIP_GOOD); /* Default to "average" */ ! return (INSCRIP_AVERAGE); } /* * Return a "feeling" (or NULL) about an item. Method 2 (Light). */ ! static int value_check_aux2(object_type *o_ptr) { /* Cursed items (all of them) */ ! if (cursed_p(o_ptr)) return (INSCRIP_CURSED); /* Broken items (all of them) */ ! if (broken_p(o_ptr)) return (INSCRIP_BROKEN); /* Artifacts -- except cursed/broken ones */ ! if (artifact_p(o_ptr)) return (INSCRIP_GOOD); /* Ego-Items -- except cursed/broken ones */ ! if (ego_item_p(o_ptr)) return (INSCRIP_GOOD); /* Good armor bonus */ ! if (o_ptr->to_a > 0) return (INSCRIP_GOOD); /* Good weapon bonuses */ ! if (o_ptr->to_h + o_ptr->to_d > 0) return (INSCRIP_GOOD); /* No feeling */ ! return (0); } /* * Sense the inventory * *************** *** 103,109 **** bool heavy = FALSE; ! cptr feel; object_type *o_ptr; --- 100,106 ---- bool heavy = FALSE; ! int feel; object_type *o_ptr; *************** *** 224,230 **** /* Skip non-sense machines */ if (!okay) continue; ! /* We know about it already, do not tell us again */ if (o_ptr->ident & (IDENT_SENSE)) continue; /* It is fully known, no information needed */ --- 221,230 ---- /* Skip non-sense machines */ if (!okay) continue; ! /* It already has a discount or special inscription */ ! if (o_ptr->discount > 0) continue; ! ! /* It has already been sensed, do not sense it again */ if (o_ptr->ident & (IDENT_SENSE)) continue; /* It is fully known, no information needed */ *************** *** 250,256 **** { msg_format("You feel the %s (%c) you are %s %s %s...", o_name, index_to_label(i), describe_use(i), ! ((o_ptr->number == 1) ? "is" : "are"), feel); } /* Message (inventory) */ --- 250,257 ---- { msg_format("You feel the %s (%c) you are %s %s %s...", o_name, index_to_label(i), describe_use(i), ! ((o_ptr->number == 1) ? "is" : "are"), ! inscrip_text[feel - INSCRIP_NULL]); } /* Message (inventory) */ *************** *** 258,271 **** { msg_format("You feel the %s (%c) in your pack %s %s...", o_name, index_to_label(i), ! ((o_ptr->number == 1) ? "is" : "are"), feel); } ! /* We have "felt" it */ o_ptr->ident |= (IDENT_SENSE); - /* Inscribe it textually */ - if (!o_ptr->note) o_ptr->note = quark_add(feel); /* Combine / Reorder the pack (later) */ p_ptr->notice |= (PN_COMBINE | PN_REORDER); --- 259,274 ---- { msg_format("You feel the %s (%c) in your pack %s %s...", o_name, index_to_label(i), ! ((o_ptr->number == 1) ? "is" : "are"), ! inscrip_text[feel - INSCRIP_NULL]); } ! /* Sense the object */ ! o_ptr->discount = feel; ! ! /* The object has been "sensed" */ o_ptr->ident |= (IDENT_SENSE); /* Combine / Reorder the pack (later) */ p_ptr->notice |= (PN_COMBINE | PN_REORDER); *************** *** 520,527 **** if (cheat_xtra) msg_print("Updating Shops..."); /* Maintain each shop (except home) */ ! for (n = 0; n < MAX_STORES - 1; n++) { /* Maintain */ store_maint(n); } --- 523,533 ---- if (cheat_xtra) msg_print("Updating Shops..."); /* Maintain each shop (except home) */ ! for (n = 0; n < MAX_STORES; n++) { + /* Skip the home */ + if (n == STORE_HOME) continue; + /* Maintain */ store_maint(n); } *************** *** 532,539 **** /* Message */ if (cheat_xtra) msg_print("Shuffling a Shopkeeper..."); ! /* Shuffle a random shop (except home) */ ! store_shuffle(rand_int(MAX_STORES - 1)); } /* Message */ --- 538,550 ---- /* Message */ if (cheat_xtra) msg_print("Shuffling a Shopkeeper..."); ! /* Pick a random shop (except home) */ ! do { ! n = rand_int(MAX_STORES); ! } while (n != STORE_HOME); ! ! /* Shuffle it */ ! store_shuffle(n); } /* Message */ *************** *** 982,988 **** /* Process objects */ for (i = 1; i < o_max; i++) { ! /* Access object */ o_ptr = &o_list[i]; /* Skip dead objects */ --- 993,999 ---- /* Process objects */ for (i = 1; i < o_max; i++) { ! /* Get the object */ o_ptr = &o_list[i]; /* Skip dead objects */ *************** *** 1051,1057 **** static bool enter_wizard_mode(void) { /* Ask first time */ ! if (!(p_ptr->noscore & 0x0002)) { /* Mention effects */ msg_print("You are about to enter 'wizard' mode for the very first time!"); --- 1062,1068 ---- static bool enter_wizard_mode(void) { /* Ask first time */ ! if (verify_special || !(p_ptr->noscore & 0x0002)) { /* Mention effects */ msg_print("You are about to enter 'wizard' mode for the very first time!"); *************** *** 1063,1073 **** { return (FALSE); } - - /* Mark savefile */ - p_ptr->noscore |= 0x0002; } /* Success */ return (TRUE); } --- 1074,1084 ---- { return (FALSE); } } + /* Mark savefile */ + p_ptr->noscore |= 0x0002; + /* Success */ return (TRUE); } *************** *** 1081,1090 **** */ static bool verify_debug_mode(void) { - static int verify = 1; - /* Ask first time */ ! if (verify && verify_special) { /* Mention effects */ msg_print("You are about to use the dangerous, unsupported, debug commands!"); --- 1092,1099 ---- */ static bool verify_debug_mode(void) { /* Ask first time */ ! if (verify_special && !(p_ptr->noscore & 0x0008)) { /* Mention effects */ msg_print("You are about to use the dangerous, unsupported, debug commands!"); *************** *** 1098,1106 **** } } - /* Verified */ - verify = 0; - /* Mark savefile */ p_ptr->noscore |= 0x0008; --- 1107,1112 ---- *************** *** 1125,1134 **** */ static bool verify_borg_mode(void) { - static int verify = 1; - /* Ask first time */ ! if (verify && verify_special) { /* Mention effects */ msg_print("You are about to use the dangerous, unsupported, borg commands!"); --- 1131,1138 ---- */ static bool verify_borg_mode(void) { /* Ask first time */ ! if (verify_special && !(p_ptr->noscore & 0x0010)) { /* Mention effects */ msg_print("You are about to use the dangerous, unsupported, borg commands!"); *************** *** 1142,1150 **** } } - /* Verified */ - verify = 0; - /* Mark savefile */ p_ptr->noscore |= 0x0010; --- 1146,1151 ---- *************** *** 1168,1181 **** */ static void process_command(void) { /* Parse the command */ switch (p_ptr->command_cmd) { /* Ignore */ case ESCAPE: case ' ': ! ! /* Ignore */ case '\r': { break; --- 1169,1189 ---- */ static void process_command(void) { + + #ifdef ALLOW_REPEAT + + /* Handle repeating the last command */ + repeat_check(); + + #endif /* ALLOW_REPEAT */ + /* Parse the command */ switch (p_ptr->command_cmd) { /* Ignore */ case ESCAPE: case ' ': ! case '\n': case '\r': { break; *************** *** 1787,1793 **** { monster_race *r_ptr; ! /* Acquire monster race */ r_ptr = &r_info[p_ptr->monster_race_idx]; /* Check for change of any kind */ --- 1795,1801 ---- { monster_race *r_ptr; ! /* Get the monster race */ r_ptr = &r_info[p_ptr->monster_race_idx]; /* Check for change of any kind */ *************** *** 1851,1859 **** * * Note that the code to check for user abort during repeated commands * and running and resting can be disabled entirely with an option, and ! * even if not disabled, it will never check during "special" resting ! * (codes -1 and -2), and it will only check during every 16th player ! * turn of "normal" resting. */ static void process_player(void) { --- 1859,1866 ---- * * Note that the code to check for user abort during repeated commands * and running and resting can be disabled entirely with an option, and ! * even if not disabled, it will only check during every 160th game ! * turn of resting. */ static void process_player(void) { *************** *** 1908,1914 **** /* Check for "player abort" */ if (p_ptr->running || p_ptr->command_rep || ! (p_ptr->resting && !(p_ptr->resting & 0x0F))) { /* Do not wait */ inkey_scan = TRUE; --- 1915,1921 ---- /* Check for "player abort" */ if (p_ptr->running || p_ptr->command_rep || ! (p_ptr->resting && !((turn * 10) % 0x0F))) { /* Do not wait */ inkey_scan = TRUE; *************** *** 1963,1969 **** object_type *o_ptr; ! /* Access the slot to be dropped */ o_ptr = &inventory[item]; /* Disturbing */ --- 1970,1976 ---- object_type *o_ptr; ! /* Get the slot to be dropped */ o_ptr = &inventory[item]; /* Disturbing */ *************** *** 2057,2064 **** --- 2064,2077 ---- /* Clear the top line */ prt("", 0, 0); + /* Hack -- Set a special flag */ + command_repeating = TRUE; + /* Process the command */ process_command(); + + /* Hack -- Clear the special flag */ + command_repeating = FALSE; } /* Normal command */ *************** *** 2103,2115 **** monster_type *m_ptr; monster_race *r_ptr; ! /* Access monster */ m_ptr = &m_list[i]; /* Skip dead monsters */ if (!m_ptr->r_idx) continue; ! /* Access the monster race */ r_ptr = &r_info[m_ptr->r_idx]; /* Skip non-multi-hued monsters */ --- 2116,2128 ---- monster_type *m_ptr; monster_race *r_ptr; ! /* Get the monster */ m_ptr = &m_list[i]; /* Skip dead monsters */ if (!m_ptr->r_idx) continue; ! /* Get the monster race */ r_ptr = &r_info[m_ptr->r_idx]; /* Skip non-multi-hued monsters */ *************** *** 2134,2140 **** { monster_type *m_ptr; ! /* Access monster */ m_ptr = &m_list[i]; /* Skip dead monsters */ --- 2147,2153 ---- { monster_type *m_ptr; ! /* Get the monster */ m_ptr = &m_list[i]; /* Skip dead monsters */ *************** *** 2156,2162 **** { monster_type *m_ptr; ! /* Access monster */ m_ptr = &m_list[i]; /* Skip dead monsters */ --- 2169,2175 ---- { monster_type *m_ptr; ! /* Get the monster */ m_ptr = &m_list[i]; /* Skip dead monsters */ *************** *** 2196,2202 **** { monster_type *m_ptr; ! /* Access monster */ m_ptr = &m_list[i]; /* Skip dead monsters */ --- 2209,2215 ---- { monster_type *m_ptr; ! /* Get the monster */ m_ptr = &m_list[i]; /* Skip dead monsters */ *************** *** 2514,2546 **** /* * Process some user pref files */ static void process_some_user_pref_files(void) { ! char buf[128]; /* Process the "user.prf" file */ (void)process_pref_file("user.prf"); ! /* Process the "PLAYER.prf" file */ sprintf(buf, "%s.prf", op_ptr->base_name); /* Process the "PLAYER.prf" file */ (void)process_pref_file(buf); } /* ! * Actually play a game * ! * If the "new_game" parameter is true, then, after loading the ! * savefile, we will commit suicide, if necessary, to allow the ! * player to start a new game. * ! * Note that we load the RNG state from savefiles (2.8.0 or later) ! * and so we only initialize it if we were unable to load it, and ! * we mark successful loading using the "Rand_quick" flag. This ! * is a hack but it optimizes loading of savefiles. XXX XXX */ void play_game(bool new_game) { --- 2527,2600 ---- /* * Process some user pref files + * + * Hack -- Allow players on UNIX systems to keep a ".angband.prf" user + * pref file in their home directory. Perhaps it should be loaded with + * the "basic" user pref files instead of here. This may allow bypassing + * of some of the "security" compilation options. XXX XXX XXX XXX XXX */ static void process_some_user_pref_files(void) { ! char buf[1024]; ! ! #ifdef SET_UID ! ! char *homedir; ! ! #endif /* Process the "user.prf" file */ (void)process_pref_file("user.prf"); ! /* Get the "PLAYER.prf" filename */ sprintf(buf, "%s.prf", op_ptr->base_name); /* Process the "PLAYER.prf" file */ (void)process_pref_file(buf); + + #ifdef SET_UID + + /* Process the "~/.angband.prf" file */ + if ((homedir = getenv("HOME"))) + { + /* Get the ".angband.prf" filename */ + path_build(buf, 1024, homedir, ".angband.prf"); + + /* Process the ".angband.prf" file */ + (void)process_pref_file(buf); + } + + #endif /* SET_UID */ + } /* ! * Actually play a game. ! * ! * This function is called from a variety of entry points, since both ! * the standard "main.c" file, as well as several platform-specific ! * "main-xxx.c" files, call this function to start a new game with a ! * new savefile, start a new game with an existing savefile, or resume ! * a saved game with an existing savefile. * ! * If the "new_game" parameter is true, and the savefile contains a ! * living character, then that character will be killed, so that the ! * player may start a new game with that savefile. This is only used ! * by the "-n" option in "main.c". * ! * If the savefile does not exist, cannot be loaded, or contains a dead ! * (non-wizard-mode) character, then a new game will be started. ! * ! * Several platforms (Windows, Macintosh, Amiga) start brand new games ! * with "savefile" and "op_ptr->base_name" both empty, and initialize ! * them later based on the player name. To prevent weirdness, we must ! * initialize "op_ptr->base_name" to "PLAYER" if it is empty. ! * ! * Note that we load the RNG state from savefiles (2.8.0 or later) and ! * so we only initialize it if we were unable to load it. The loading ! * code marks successful loading of the RNG state using the "Rand_quick" ! * flag, which is a hack, but which optimizes loading of savefiles. */ void play_game(bool new_game) { *************** *** 2567,2573 **** Term->fixed_shape = TRUE; ! /* Hack -- turn off the cursor */ (void)Term_set_cursor(0); --- 2621,2627 ---- Term->fixed_shape = TRUE; ! /* Hack -- Turn off the cursor */ (void)Term_set_cursor(0); *************** *** 2588,2596 **** character_dungeon = FALSE; } ! /* Process old character */ ! if (!new_game) { } /* Init RNG */ --- 2642,2651 ---- character_dungeon = FALSE; } ! /* Hack -- Default base_name */ ! if (!op_ptr->base_name[0]) { + strcpy(op_ptr->base_name, "PLAYER"); } /* Init RNG */ *************** *** 2630,2640 **** --- 2685,2715 ---- /* Hack -- seed for town layout */ seed_town = rand_int(0x10000000); + #ifdef GJW_RANDART + + /* Hack -- seed for random artifacts */ + seed_randart = rand_int(0x10000000); + + #endif + /* Roll up a new character */ player_birth(); + #ifdef GJW_RANDART + + /* Randomize the artifacts */ + if (adult_rand_artifacts) + { + do_randart(seed_randart); + } + + #endif + /* Hack -- enter the world */ turn = 1; + + /* Read the default options */ + process_pref_file("default.prf"); } /* Normal machine (process player name) */ diff -r -c angband-283/src/externs.h angband-285/src/externs.h *** angband-283/src/externs.h Mon Feb 9 01:49:44 1998 --- angband-285/src/externs.h Sun Aug 22 19:27:25 1999 *************** *** 66,72 **** extern cptr option_text[OPT_MAX]; extern cptr option_desc[OPT_MAX]; extern bool option_norm[OPT_MAX]; ! extern byte option_page[4][16]; /* variable.c */ extern cptr copyright[5]; --- 66,73 ---- extern cptr option_text[OPT_MAX]; extern cptr option_desc[OPT_MAX]; extern bool option_norm[OPT_MAX]; ! extern byte option_page[OPT_PAGE_MAX][OPT_PAGE_PER]; ! extern cptr inscrip_text[MAX_INSCRIP]; /* variable.c */ extern cptr copyright[5]; *************** *** 88,93 **** --- 89,95 ---- extern bool arg_graphics; extern bool arg_force_original; extern bool arg_force_roguelike; + extern u32b seed_randart; extern bool character_generated; extern bool character_dungeon; extern bool character_loaded; *************** *** 121,126 **** --- 123,130 ---- extern s16b o_cnt; extern s16b m_max; extern s16b m_cnt; + extern char summon_kin_type; + extern bool command_repeating; extern s16b feeling; extern s16b rating; extern bool good_item_flag; *************** *** 220,226 **** extern bool (*get_mon_num_hook)(int r_idx); extern bool (*get_obj_num_hook)(int k_idx); - /* * Automatically generated "function declarations" */ --- 224,229 ---- *************** *** 271,277 **** extern void py_pickup(int pickup); extern void hit_trap(int y, int x); extern void py_attack(int y, int x); ! extern void move_player(int dir, int do_pickup); extern void run_step(int dir); /* cmd2.c */ --- 274,280 ---- extern void py_pickup(int pickup); extern void hit_trap(int y, int x); extern void py_attack(int y, int x); ! extern void move_player(int dir, int jumping); extern void run_step(int dir); /* cmd2.c */ *************** *** 445,450 **** --- 448,454 ---- extern cptr mention_use(int i); extern cptr describe_use(int i); extern bool item_tester_okay(object_type *o_ptr); + extern sint scan_floor(int *items, int size, int y, int x, int mode); extern void display_inven(void); extern void display_equip(void); extern void show_inven(void); *************** *** 481,486 **** --- 485,493 ---- extern void place_gold(int y, int x); extern void pick_trap(int y, int x); extern void place_trap(int y, int x); + extern void place_secret_door(int y, int x); + extern void place_closed_door(int y, int x); + extern void place_random_door(int y, int x); extern void inven_item_charges(int item); extern void inven_item_describe(int item); extern void inven_item_increase(int item, int num); *************** *** 535,540 **** --- 542,548 ---- extern bool restore_level(void); extern void self_knowledge(void); extern bool lose_all_info(void); + extern void set_recall(void); extern bool detect_traps(void); extern bool detect_doors(void); extern bool detect_stairs(void); *************** *** 700,705 **** --- 708,714 ---- extern cptr look_mon_desc(int m_idx); extern void ang_sort_aux(vptr u, vptr v, int p, int q); extern void ang_sort(vptr u, vptr v, int n); + extern sint motion_dir(int y1, int x1, int y2, int x2); extern sint target_dir(char ch); extern bool target_able(int m_idx); extern bool target_okay(void); *************** *** 746,749 **** --- 755,780 ---- /* main.c */ /* extern int main(int argc, char *argv[]); */ + #ifdef ALLOW_REPEAT + + /* util.c */ + extern void repeat_push(int what); + extern bool repeat_pull(int *what); + extern void repeat_check(void); + + #endif /* ALLOW_REPEAT */ + + #ifdef ALLOW_EASY_FLOOR + + /* object1.c */ + extern void show_floor(int *floor_list, int floor_num); + + #endif /* ALLOW_EASY_FLOOR */ + + #ifdef GJW_RANDART + + /* init3.c */ + extern int do_randart(u32b randart_seed); + + #endif /* GJW_RANDART */ diff -r -c angband-283/src/files.c angband-285/src/files.c *** angband-283/src/files.c Wed Feb 11 06:30:28 1998 --- angband-285/src/files.c Wed Sep 1 17:53:10 1999 *************** *** 255,293 **** * zero" will be used for the "stack" attr/char, and "feature zero" is * used for the "nothing" attr/char. * ! * Specify the attr/char values for "monsters" by race index * R::/ * ! * Specify the attr/char values for "objects" by kind index * K::/ * ! * Specify the attr/char values for "features" by feature index * F::/ * ! * Specify the attr/char values for "special" things * S::/ * ! * Specify the attr/char values for unaware "objects" by kind tval ! * U::/ ! * ! * Specify the attribute values for inventory "objects" by kind tval * E:: * ! * Define a macro action, given an encoded macro action * A: * ! * Create a macro, given an encoded macro trigger * P: * ! * Create a keymap, given an encoded keymap trigger * C:: * ! * Turn an option off, given its name * X: * ! * Turn an option on, given its name * Y: * * Specify visual information, given an index, and some data * V::::: */ --- 255,293 ---- * zero" will be used for the "stack" attr/char, and "feature zero" is * used for the "nothing" attr/char. * ! * Specify the attr/char values for "monsters" by race index. * R::/ * ! * Specify the attr/char values for "objects" by kind index. * K::/ * ! * Specify the attr/char values for "features" by feature index. * F::/ * ! * Specify the attr/char values for "special" things. * S::/ * ! * Specify the attribute values for inventory "objects" by kind tval. * E:: * ! * Define a macro action, given an encoded macro action. * A: * ! * Create a macro, given an encoded macro trigger. * P: * ! * Create a keymap, given an encoded keymap trigger. * C:: * ! * Turn an option off, given its name. * X: * ! * Turn an option on, given its name. * Y: * + * Turn a window flag on or off, given a window, flag, and value. + * W::: + * * Specify visual information, given an index, and some data * V::::: */ *************** *** 385,412 **** } - /* Process "U::/" -- attr/char for unaware items */ - else if (buf[0] == 'U') - { - if (tokenize(buf+2, 3, zz) == 3) - { - j = (huge)strtol(zz[0], NULL, 0); - n1 = strtol(zz[1], NULL, 0); - n2 = strtol(zz[2], NULL, 0); - for (i = 1; i < MAX_K_IDX; i++) - { - object_kind *k_ptr = &k_info[i]; - if (k_ptr->tval == j) - { - if (n1) k_ptr->d_attr = n1; - if (n2) k_ptr->d_char = n2; - } - } - return (0); - } - } - - /* Process "E::" -- attribute for inventory objects */ else if (buf[0] == 'E') { --- 385,390 ---- *************** *** 478,484 **** /* Process "X:" -- turn option off */ else if (buf[0] == 'X') { ! for (i = 0; i < OPT_MAX; i++) { if (option_text[i] && streq(option_text[i], buf + 2)) { --- 456,463 ---- /* Process "X:" -- turn option off */ else if (buf[0] == 'X') { ! /* Check non-adult options */ ! for (i = 0; i < OPT_ADULT; i++) { if (option_text[i] && streq(option_text[i], buf + 2)) { *************** *** 491,497 **** /* Process "Y:" -- turn option on */ else if (buf[0] == 'Y') { ! for (i = 0; i < OPT_MAX; i++) { if (option_text[i] && streq(option_text[i], buf + 2)) { --- 470,477 ---- /* Process "Y:" -- turn option on */ else if (buf[0] == 'Y') { ! /* Check non-adult options */ ! for (i = 0; i < OPT_ADULT; i++) { if (option_text[i] && streq(option_text[i], buf + 2)) { *************** *** 502,507 **** --- 482,526 ---- } + /* Process "W:::" -- window flags */ + else if (buf[0] == 'W') + { + int win, flag, value; + + if (tokenize(buf + 2, 3, zz) == 3) + { + win = strtol(zz[0], NULL, 0); + flag = strtol(zz[1], NULL, 0); + value = strtol(zz[2], NULL, 0); + + /* Ignore illegal windows */ + /* Hack -- Ignore the main window */ + if ((win <= 0) || (win >= 8)) return (1); + + /* Ignore illegal flags */ + if ((flag < 0) || (flag >= 32)) return (1); + + /* Require a real flag */ + if (window_flag_desc[flag]) + { + if (value) + { + /* Turn flag on */ + op_ptr->window_flag[win] |= (1L << flag); + } + else + { + /* Turn flag off */ + op_ptr->window_flag[win] &= ~(1L << flag); + } + } + + /* Success */ + return (0); + } + } + + /* Failure */ return (1); } *************** *** 1196,1206 **** /* Maximize */ Term_putstr(col, 7, -1, TERM_WHITE, "Maximize"); ! Term_putstr(col+12, 7, -1, TERM_L_BLUE, p_ptr->maximize ? "Y" : "N"); /* Preserve */ Term_putstr(col, 8, -1, TERM_WHITE, "Preserve"); ! Term_putstr(col+12, 8, -1, TERM_L_BLUE, p_ptr->preserve ? "Y" : "N"); /* Left */ --- 1215,1225 ---- /* Maximize */ Term_putstr(col, 7, -1, TERM_WHITE, "Maximize"); ! Term_putstr(col+12, 7, -1, TERM_L_BLUE, adult_maximize ? "Y" : "N"); /* Preserve */ Term_putstr(col, 8, -1, TERM_WHITE, "Preserve"); ! Term_putstr(col+12, 8, -1, TERM_L_BLUE, adult_preserve ? "Y" : "N"); /* Left */ *************** *** 1465,1471 **** /* Dump equippy chars */ ! for (i=INVEN_WIELD; ik_idx) attr = TERM_L_DARK; ! /* Default */ ! c_put_str(attr, ".", row, col+n); /* Check flags */ ! if (f[set] & flag) c_put_str(TERM_WHITE, "+", row, col+n); } /* Player flags */ --- 1639,1662 ---- /* Non-existant objects */ if (!o_ptr->k_idx) attr = TERM_L_DARK; ! /* Hack -- Check immunities */ ! if ((x == 0) && (y < 4) && ! (f[set] & ((TR2_IM_ACID) << y))) ! { ! c_put_str(TERM_WHITE, "*", row, col+n); ! } /* Check flags */ ! else if (f[set] & flag) ! { ! c_put_str(TERM_WHITE, "+", row, col+n); ! } ! ! /* Default */ ! else ! { ! c_put_str(attr, ".", row, col+n); ! } } /* Player flags */ *************** *** 1741,1747 **** c_put_str(TERM_WHITE, " Best", row-1, col+24); /* Display the stats */ ! for (i = 0; i < 6; i++) { /* Reduced */ if (p_ptr->stat_use[i] < p_ptr->stat_top[i]) --- 1773,1779 ---- c_put_str(TERM_WHITE, " Best", row-1, col+24); /* Display the stats */ ! for (i = 0; i < A_MAX; i++) { /* Reduced */ if (p_ptr->stat_use[i] < p_ptr->stat_top[i]) *************** *** 1827,1848 **** c_put_str(TERM_WHITE, "abcdefghijkl@", row-1, col); /* Process equipment */ ! for (i=INVEN_WIELD; ik_idx; ! /* Acquire "known" flags */ object_flags_known(o_ptr, &f1, &f2, &f3); /* Hack -- assume stat modifiers are known */ object_flags(o_ptr, &f1, &ignore_f2, &ignore_f3); /* Initialize color based of sign of pval. */ ! for (stat=0; stat<6; stat++) { /* Default */ a = TERM_SLATE; --- 1859,1880 ---- c_put_str(TERM_WHITE, "abcdefghijkl@", row-1, col); /* Process equipment */ ! for (i = INVEN_WIELD; i < INVEN_TOTAL; ++i) { ! /* Get the object */ o_ptr = &inventory[i]; /* Object kind */ k_idx = o_ptr->k_idx; ! /* Get the "known" flags */ object_flags_known(o_ptr, &f1, &f2, &f3); /* Hack -- assume stat modifiers are known */ object_flags(o_ptr, &f1, &ignore_f2, &ignore_f3); /* Initialize color based of sign of pval. */ ! for (stat = 0; stat < A_MAX; stat++) { /* Default */ a = TERM_SLATE; *************** *** 1878,1886 **** /* Sustain */ if (f2 & 1<opt[i] ? "yes" : "no ", + option_text[i]); + } + } + + /* Skip some lines */ + fprintf(fff, "\n\n"); + + /* Close it */ my_fclose(fff); *************** *** 2140,2156 **** * * Return FALSE on "ESCAPE", otherwise TRUE. * ! * Process various special text in the input file, including ! * the "menu" structures used by the "help file" system. * ! * XXX XXX XXX Consider using a temporary file. * ! * XXX XXX XXX Allow the user to "save" the current file. */ bool show_file(cptr name, cptr what, int line, int mode) { int i, k; /* Number of "real" lines passed by */ int next = 0; --- 2193,2217 ---- * * Return FALSE on "ESCAPE", otherwise TRUE. * ! * Process various special text in the input file, including the "menu" ! * structures used by the "help file" system. * ! * This function could be made much more efficient with the use of "seek" ! * functionality, especially when moving backwards through a file, or ! * forwards through a file by less than a page at a time. XXX XXX XXX ! * ! * Consider using a temporary file, in which special lines do not appear, ! * and which could be pre-padded to 80 characters per line, to allow the ! * use of perfect seeking. XXX XXX XXX * ! * Allow the user to "save" the current file. XXX XXX XXX */ bool show_file(cptr name, cptr what, int line, int mode) { int i, k; + char ch = '\0'; + /* Number of "real" lines passed by */ int next = 0; *************** *** 2170,2179 **** cptr find = NULL; /* Hold a string to find */ ! char finder[81]; /* Hold a string to show */ ! char shower[81]; /* Describe this thing */ char caption[128]; --- 2231,2240 ---- cptr find = NULL; /* Hold a string to find */ ! char finder[80]; /* Hold a string to show */ ! char shower[80]; /* Describe this thing */ char caption[128]; *************** *** 2207,2213 **** /* Caption */ strcpy(caption, what); ! /* Access the "file" */ strcpy(path, name); /* Open */ --- 2268,2274 ---- /* Caption */ strcpy(caption, what); ! /* Get the filename */ strcpy(path, name); /* Open */ *************** *** 2311,2317 **** fff = my_fopen(path, "r"); /* Oops */ ! if (!fff) return (FALSE); /* File has been restarted */ next = 0; --- 2372,2378 ---- fff = my_fopen(path, "r"); /* Oops */ ! if (!fff) return (TRUE); /* File has been restarted */ next = 0; *************** *** 2409,2429 **** } /* Get a keypress */ ! k = inkey(); ! /* Hack -- return to last screen */ ! if (k == '?') break; ! /* Hack -- try showing */ ! if (k == '=') { /* Get "shower" */ prt("Show: ", 23, 0); (void)askfor_aux(shower, 80); } ! /* Hack -- try finding */ ! if (k == '/') { /* Get "finder" */ prt("Find: ", 23, 0); --- 2470,2490 ---- } /* Get a keypress */ ! ch = inkey(); ! /* Hack -- Return to last screen */ ! if (ch == '?') break; ! /* Hack -- Try showing */ ! if (ch == '=') { /* Get "shower" */ prt("Show: ", 23, 0); (void)askfor_aux(shower, 80); } ! /* Hack -- Try finding */ ! if (ch == '/') { /* Get "finder" */ prt("Find: ", 23, 0); *************** *** 2439,2448 **** } } ! /* Hack -- go to a specific line */ ! if (k == '#') { ! char tmp[81]; prt("Goto Line: ", 23, 0); strcpy(tmp, "0"); if (askfor_aux(tmp, 80)) --- 2500,2509 ---- } } ! /* Hack -- Go to a specific line */ ! if (ch == '#') { ! char tmp[80]; prt("Goto Line: ", 23, 0); strcpy(tmp, "0"); if (askfor_aux(tmp, 80)) *************** *** 2451,2506 **** } } ! /* Hack -- go to a specific file */ ! if (k == '%') { ! char tmp[81]; prt("Goto File: ", 23, 0); ! strcpy(tmp, "help.hlp"); ! if (askfor_aux(tmp, 80)) { ! if (!show_file(tmp, NULL, 0, mode)) k = ESCAPE; } } ! /* Hack -- Allow backing up */ ! if (k == '-') { line = line - 10; if (line < 0) line = 0; } ! /* Hack -- Advance a single line */ ! if ((k == '\n') || (k == '\r')) { line = line + 1; } ! /* Advance one page */ ! if (k == ' ') { line = line + 20; } /* Recurse on numbers */ ! if (menu && isdigit(k) && hook[D2I(k)][0]) { /* Recurse on that file */ ! if (!show_file(hook[D2I(k)], NULL, 0, mode)) k = ESCAPE; } /* Exit on escape */ ! if (k == ESCAPE) break; } /* Close the file */ my_fclose(fff); ! /* Escape */ ! if (k == ESCAPE) return (FALSE); ! ! /* Normal return */ ! return (TRUE); } --- 2512,2585 ---- } } ! /* Hack -- Go to a specific file */ ! if (ch == '%') { ! char ftmp[80]; prt("Goto File: ", 23, 0); ! strcpy(ftmp, "help.hlp"); ! if (askfor_aux(ftmp, 80)) { ! if (!show_file(ftmp, NULL, 0, mode)) ch = ESCAPE; } } ! /* Back up one line */ ! if (ch == '=') ! { ! line = line - 1; ! if (line < 0) line = 0; ! } ! ! /* Back up one half page */ ! if (ch == '_') { line = line - 10; if (line < 0) line = 0; } ! /* Back up one full page */ ! if (ch == '-') ! { ! line = line - 20; ! if (line < 0) line = 0; ! } ! ! /* Advance one line */ ! if ((ch == '\n') || (ch == '\r')) { line = line + 1; } ! /* Advance one half page */ ! if (ch == '+') ! { ! line = line + 10; ! if (line < 0) line = 0; ! } ! ! /* Advance one full page */ ! if (ch == ' ') { line = line + 20; } /* Recurse on numbers */ ! if (menu && isdigit(ch) && hook[D2I(ch)][0]) { /* Recurse on that file */ ! if (!show_file(hook[D2I(ch)], NULL, 0, mode)) ch = ESCAPE; } /* Exit on escape */ ! if (ch == ESCAPE) break; } /* Close the file */ my_fclose(fff); ! /* Done */ ! return (ch != ESCAPE); } *************** *** 2754,2766 **** } ! #if 0 /* * Save a "bones" file for a dead character * ! * Note that we will not use these files until Angband 2.8.0, and * then we will only use the name and level on which death occured. * * Should probably attempt some form of locking... --- 2833,2845 ---- } ! #if 0 /* * Save a "bones" file for a dead character * ! * Note that we will not use these files until a later version, and * then we will only use the name and level on which death occured. * * Should probably attempt some form of locking... *************** *** 2816,2822 **** } } - #endif --- 2895,2900 ---- *************** *** 2923,2929 **** object_type *o_ptr; ! store_type *st_ptr = &store[7]; /* Hack -- Know everything in the inven/equip */ --- 3001,3007 ---- object_type *o_ptr; ! store_type *st_ptr = &store[STORE_HOME]; /* Hack -- Know everything in the inven/equip */ *************** *** 2972,2978 **** /* Dump character records as requested */ while (TRUE) { ! char tmp[81]; /* Prompt */ put_str("Filename: ", 23, 0); --- 3050,3056 ---- /* Dump character records as requested */ while (TRUE) { ! char tmp[80]; /* Prompt */ put_str("Filename: ", 23, 0); *************** *** 3048,3064 **** char o_name[80]; char tmp_val[80]; ! /* Acquire item */ o_ptr = &st_ptr->stock[i]; /* Print header, clear line */ sprintf(tmp_val, "%c) ", I2A(j)); prt(tmp_val, j+2, 4); ! /* Acquire object description */ object_desc(o_name, o_ptr, TRUE, 3); ! /* Acquire inventory color */ attr = tval_to_attr[o_ptr->tval & 0x7F]; /* Display the object */ --- 3126,3142 ---- char o_name[80]; char tmp_val[80]; ! /* Get the object */ o_ptr = &st_ptr->stock[i]; /* Print header, clear line */ sprintf(tmp_val, "%c) ", I2A(j)); prt(tmp_val, j+2, 4); ! /* Get the object description */ object_desc(o_name, o_ptr, TRUE, 3); ! /* Get the inventory color */ attr = tval_to_attr[o_ptr->tval & 0x7F]; /* Display the object */ *************** *** 3454,3459 **** --- 3532,3538 ---- } #ifndef SCORE_WIZARDS + /* Wizard-mode pre-empts scoring */ if (p_ptr->noscore & 0x000F) { *************** *** 3462,3470 **** --- 3541,3551 ---- display_scores_aux(0, 10, -1, NULL); return (0); } + #endif #ifndef SCORE_BORGS + /* Borg-mode pre-empts scoring */ if (p_ptr->noscore & 0x00F0) { *************** *** 3476,3492 **** #endif #ifndef SCORE_CHEATERS /* Cheaters are not scored */ ! if (p_ptr->noscore & 0xFF00) { msg_print("Score not registered for cheaters."); msg_print(NULL); display_scores_aux(0, 10, -1, NULL); return (0); } #endif ! /* Interupted */ if (!p_ptr->total_winner && streq(p_ptr->died_from, "Interrupting")) { msg_print("Score not registered due to interruption."); --- 3557,3577 ---- #endif #ifndef SCORE_CHEATERS + /* Cheaters are not scored */ ! for (j = OPT_SCORE; j < OPT_MAX; ++j) { + if (!op_ptr->opt[j]) continue; + msg_print("Score not registered for cheaters."); msg_print(NULL); display_scores_aux(0, 10, -1, NULL); return (0); } + #endif ! /* Hack -- Interupted */ if (!p_ptr->total_winner && streq(p_ptr->died_from, "Interrupting")) { msg_print("Score not registered due to interruption."); *************** *** 3495,3501 **** return (0); } ! /* Quitter */ if (!p_ptr->total_winner && streq(p_ptr->died_from, "Quitting")) { msg_print("Score not registered due to quitting."); --- 3580,3586 ---- return (0); } ! /* Hack -- Quitter */ if (!p_ptr->total_winner && streq(p_ptr->died_from, "Quitting")) { msg_print("Score not registered due to quitting."); diff -r -c angband-283/src/generate.c angband-285/src/generate.c *** angband-283/src/generate.c Fri Feb 6 04:10:31 1998 --- angband-285/src/generate.c Sun Aug 22 18:11:35 1999 *************** *** 105,111 **** */ #define DUN_ROOMS 50 /* Number of rooms to attempt */ #define DUN_UNUSUAL 200 /* Level/chance of unusual room */ ! #define DUN_DEST 15 /* 1/chance of having a destroyed level */ /* * Dungeon tunnel generation values --- 105,111 ---- */ #define DUN_ROOMS 50 /* Number of rooms to attempt */ #define DUN_UNUSUAL 200 /* Level/chance of unusual room */ ! #define DUN_DEST 30 /* 1/chance of having a destroyed level */ /* * Dungeon tunnel generation values *************** *** 415,485 **** /* - * Place a secret door at the given location - */ - static void place_secret_door(int y, int x) - { - /* Create secret door */ - cave_set_feat(y, x, FEAT_SECRET); - } - - - /* - * Place a random type of door at the given location - */ - static void place_random_door(int y, int x) - { - int tmp; - - /* Choose an object */ - tmp = rand_int(1000); - - /* Open doors (300/1000) */ - if (tmp < 300) - { - /* Create open door */ - cave_set_feat(y, x, FEAT_OPEN); - } - - /* Broken doors (100/1000) */ - else if (tmp < 400) - { - /* Create broken door */ - cave_set_feat(y, x, FEAT_BROKEN); - } - - /* Secret doors (200/1000) */ - else if (tmp < 600) - { - /* Create secret door */ - cave_set_feat(y, x, FEAT_SECRET); - } - - /* Closed doors (300/1000) */ - else if (tmp < 900) - { - /* Create closed door */ - cave_set_feat(y, x, FEAT_DOOR_HEAD + 0x00); - } - - /* Locked doors (99/1000) */ - else if (tmp < 999) - { - /* Create locked door */ - cave_set_feat(y, x, FEAT_DOOR_HEAD + randint(7)); - } - - /* Stuck doors (1/1000) */ - else - { - /* Create jammed door */ - cave_set_feat(y, x, FEAT_DOOR_HEAD + 0x08 + rand_int(8)); - } - } - - - - /* * Places some staircases near walls */ static void alloc_stairs(int feat, int num, int walls) --- 415,420 ---- *************** *** 539,545 **** - /* * Allocates some objects (using "place" and "type") */ --- 474,479 ---- *************** *** 2371,2377 **** /* Pick a lesser vault */ while (TRUE) { ! /* Access a random vault record */ v_ptr = &v_info[rand_int(MAX_V_IDX)]; /* Accept the first lesser vault */ --- 2305,2311 ---- /* Pick a lesser vault */ while (TRUE) { ! /* Get a random vault record */ v_ptr = &v_info[rand_int(MAX_V_IDX)]; /* Accept the first lesser vault */ *************** *** 2407,2413 **** /* Pick a lesser vault */ while (TRUE) { ! /* Access a random vault record */ v_ptr = &v_info[rand_int(MAX_V_IDX)]; /* Accept the first greater vault */ --- 2341,2347 ---- /* Pick a lesser vault */ while (TRUE) { ! /* Get a random vault record */ v_ptr = &v_info[rand_int(MAX_V_IDX)]; /* Accept the first greater vault */ *************** *** 2499,2505 **** /* Allow bends in the tunnel */ if (rand_int(100) < DUN_TUN_CHG) { ! /* Acquire the correct direction */ correct_dir(&row_dir, &col_dir, row1, col1, row2, col2); /* Random direction */ --- 2433,2439 ---- /* Allow bends in the tunnel */ if (rand_int(100) < DUN_TUN_CHG) { ! /* Get the correct direction */ correct_dir(&row_dir, &col_dir, row1, col1, row2, col2); /* Random direction */ *************** *** 2517,2523 **** /* Do not leave the dungeon!!! XXX XXX */ while (!in_bounds_fully(tmp_row, tmp_col)) { ! /* Acquire the correct direction */ correct_dir(&row_dir, &col_dir, row1, col1, row2, col2); /* Random direction */ --- 2451,2457 ---- /* Do not leave the dungeon!!! XXX XXX */ while (!in_bounds_fully(tmp_row, tmp_col)) { ! /* Get the correct direction */ correct_dir(&row_dir, &col_dir, row1, col1, row2, col2); /* Random direction */ *************** *** 2544,2550 **** /* Pierce "outer" walls of rooms */ if (cave_feat[tmp_row][tmp_col] == FEAT_WALL_OUTER) { ! /* Acquire the "next" location */ y = tmp_row + row_dir; x = tmp_col + col_dir; --- 2478,2484 ---- /* Pierce "outer" walls of rooms */ if (cave_feat[tmp_row][tmp_col] == FEAT_WALL_OUTER) { ! /* Get the "next" location */ y = tmp_row + row_dir; x = tmp_col + col_dir; *************** *** 2653,2659 **** /* Turn the tunnel into corridor */ for (i = 0; i < dun->tunn_n; i++) { ! /* Access the grid */ y = dun->tunn[i].y; x = dun->tunn[i].x; --- 2587,2593 ---- /* Turn the tunnel into corridor */ for (i = 0; i < dun->tunn_n; i++) { ! /* Get the grid */ y = dun->tunn[i].y; x = dun->tunn[i].x; *************** *** 2665,2671 **** /* Apply the piercings that we found */ for (i = 0; i < dun->wall_n; i++) { ! /* Access the grid */ y = dun->wall[i].y; x = dun->wall[i].x; --- 2599,2605 ---- /* Apply the piercings that we found */ for (i = 0; i < dun->wall_n; i++) { ! /* Get the grid */ y = dun->wall[i].y; x = dun->wall[i].x; *************** *** 2820,2826 **** /* It is *extremely* important that the following calculation */ /* be *exactly* correct to prevent memory errors XXX XXX XXX */ ! /* Acquire the location of the room */ y = ((by1 + by2 + 1) * BLOCK_HGT) / 2; x = ((bx1 + bx2 + 1) * BLOCK_WID) / 2; --- 2754,2760 ---- /* It is *extremely* important that the following calculation */ /* be *exactly* correct to prevent memory errors XXX XXX XXX */ ! /* Get the location of the room */ y = ((by1 + by2 + 1) * BLOCK_HGT) / 2; x = ((bx1 + bx2 + 1) * BLOCK_WID) / 2; *************** *** 3115,3120 **** --- 3049,3084 ---- (void)alloc_monster(0, TRUE); } + /* Ensure quest monsters */ + if (is_quest(p_ptr->depth)) + { + /* Ensure quest monsters */ + for (i = 0; i < MAX_R_IDX; i++) + { + monster_race *r_ptr = &r_info[i]; + + /* Ensure quest monsters */ + if ((r_ptr->flags1 & (RF1_QUESTOR)) && + (r_ptr->level == p_ptr->depth) && + (r_ptr->cur_num <= 0)) + { + int y, x; + + /* Pick a location */ + while (1) + { + y = rand_int(DUNGEON_HGT); + x = rand_int(DUNGEON_WID); + + if (cave_naked_bold(y, x)) break; + } + + /* Place the questor */ + place_monster_aux(y, x, i, TRUE, TRUE); + } + } + } + /* Place some traps in the dungeon */ alloc_object(ALLOC_SET_BOTH, ALLOC_TYP_TRAP, randint(k)); *************** *** 3497,3503 **** else feeling = 10; /* Hack -- Have a special feeling sometimes */ ! if (good_item_flag && !p_ptr->preserve) feeling = 1; /* It takes 1000 game turns for "feelings" to recharge */ if ((turn - old_turn) < 1000) feeling = 0; --- 3461,3467 ---- else feeling = 10; /* Hack -- Have a special feeling sometimes */ ! if (good_item_flag && !adult_preserve) feeling = 1; /* It takes 1000 game turns for "feelings" to recharge */ if ((turn - old_turn) < 1000) feeling = 0; diff -r -c angband-283/src/init1.c angband-285/src/init1.c *** angband-283/src/init1.c Mon Feb 9 01:12:39 1998 --- angband-285/src/init1.c Sat Jul 24 16:51:25 1999 *************** *** 349,356 **** "TRAPS", "FORGET", "XXX6X6", ! "XXX7X6", ! "XXX8X6", "S_MONSTER", "S_MONSTERS", "S_ANT", --- 349,356 ---- "TRAPS", "FORGET", "XXX6X6", ! "S_KIN", ! "S_HI_DEMON", "S_MONSTER", "S_MONSTERS", "S_ANT", *************** *** 371,377 **** /* * Object flags */ ! static cptr k_info_flags1[] = { "STR", "INT", --- 371,377 ---- /* * Object flags */ ! cptr k_info_flags1[] = { "STR", "INT", *************** *** 410,416 **** /* * Object flags */ ! static cptr k_info_flags2[] = { "SUST_STR", "SUST_INT", --- 410,416 ---- /* * Object flags */ ! cptr k_info_flags2[] = { "SUST_STR", "SUST_INT", *************** *** 449,455 **** /* * Object flags */ ! static cptr k_info_flags3[] = { "SLOW_DIGEST", "FEATHER", --- 449,455 ---- /* * Object flags */ ! cptr k_info_flags3[] = { "SLOW_DIGEST", "FEATHER", *************** *** 639,645 **** /* Process 'D' for "Description" */ if (buf[0] == 'D') { ! /* Acquire the text */ s = buf+2; /* Hack -- Verify space */ --- 639,645 ---- /* Process 'D' for "Description" */ if (buf[0] == 'D') { ! /* Get the text */ s = buf+2; /* Hack -- Verify space */ *************** *** 822,828 **** /* Process 'D' for "Description" */ if (buf[0] == 'D') { ! /* Acquire the text */ s = buf+2; /* Hack -- Verify space */ --- 822,828 ---- /* Process 'D' for "Description" */ if (buf[0] == 'D') { ! /* Get the text */ s = buf+2; /* Hack -- Verify space */ *************** *** 1072,1078 **** /* Process 'D' for "Description" */ if (buf[0] == 'D') { ! /* Acquire the text */ s = buf+2; /* Hack -- Verify space */ --- 1072,1078 ---- /* Process 'D' for "Description" */ if (buf[0] == 'D') { ! /* Get the text */ s = buf+2; /* Hack -- Verify space */ *************** *** 1428,1434 **** /* Process 'D' for "Description" */ if (buf[0] == 'D') { ! /* Acquire the text */ s = buf+2; /* Hack -- Verify space */ --- 1428,1434 ---- /* Process 'D' for "Description" */ if (buf[0] == 'D') { ! /* Get the text */ s = buf+2; /* Hack -- Verify space */ *************** *** 1717,1723 **** /* Process 'D' for "Description" */ if (buf[0] == 'D') { ! /* Acquire the text */ s = buf+2; /* Hack -- Verify space */ --- 1717,1723 ---- /* Process 'D' for "Description" */ if (buf[0] == 'D') { ! /* Get the text */ s = buf+2; /* Hack -- Verify space */ *************** *** 2049,2055 **** /* Process 'D' for "Description" */ if (buf[0] == 'D') { ! /* Acquire the text */ s = buf+2; /* Hack -- Verify space */ --- 2049,2055 ---- /* Process 'D' for "Description" */ if (buf[0] == 'D') { ! /* Get the text */ s = buf+2; /* Hack -- Verify space */ *************** *** 2280,2286 **** /* Mega-Hack -- acquire "ghost" */ r_ptr = &r_info[MAX_R_IDX-1]; ! /* Acquire the next index */ r_ptr->name = r_head->name_size; r_ptr->text = r_head->text_size; --- 2280,2286 ---- /* Mega-Hack -- acquire "ghost" */ r_ptr = &r_info[MAX_R_IDX-1]; ! /* Get the next index */ r_ptr->name = r_head->name_size; r_ptr->text = r_head->text_size; diff -r -c angband-283/src/init2.c angband-285/src/init2.c *** angband-283/src/init2.c Fri Feb 6 04:10:31 1998 --- angband-285/src/init2.c Sun Aug 22 19:26:22 1999 *************** *** 1,5 **** --- 1,6 ---- /* File: init2.c */ + /* * Copyright (c) 1997 Ben Harrison * *************** *** 337,343 **** f_head->v_major = VERSION_MAJOR; f_head->v_minor = VERSION_MINOR; f_head->v_patch = VERSION_PATCH; ! f_head->v_extra = 0; /* Save the "record" information */ f_head->info_num = MAX_F_IDX; --- 338,344 ---- f_head->v_major = VERSION_MAJOR; f_head->v_minor = VERSION_MINOR; f_head->v_patch = VERSION_PATCH; ! f_head->v_extra = VERSION_EXTRA; /* Save the "record" information */ f_head->info_num = MAX_F_IDX; *************** *** 590,596 **** k_head->v_major = VERSION_MAJOR; k_head->v_minor = VERSION_MINOR; k_head->v_patch = VERSION_PATCH; ! k_head->v_extra = 0; /* Save the "record" information */ k_head->info_num = MAX_K_IDX; --- 591,597 ---- k_head->v_major = VERSION_MAJOR; k_head->v_minor = VERSION_MINOR; k_head->v_patch = VERSION_PATCH; ! k_head->v_extra = VERSION_EXTRA; /* Save the "record" information */ k_head->info_num = MAX_K_IDX; *************** *** 843,849 **** a_head->v_major = VERSION_MAJOR; a_head->v_minor = VERSION_MINOR; a_head->v_patch = VERSION_PATCH; ! a_head->v_extra = 0; /* Save the "record" information */ a_head->info_num = MAX_A_IDX; --- 844,850 ---- a_head->v_major = VERSION_MAJOR; a_head->v_minor = VERSION_MINOR; a_head->v_patch = VERSION_PATCH; ! a_head->v_extra = VERSION_EXTRA; /* Save the "record" information */ a_head->info_num = MAX_A_IDX; *************** *** 1096,1102 **** e_head->v_major = VERSION_MAJOR; e_head->v_minor = VERSION_MINOR; e_head->v_patch = VERSION_PATCH; ! e_head->v_extra = 0; /* Save the "record" information */ e_head->info_num = MAX_E_IDX; --- 1097,1103 ---- e_head->v_major = VERSION_MAJOR; e_head->v_minor = VERSION_MINOR; e_head->v_patch = VERSION_PATCH; ! e_head->v_extra = VERSION_EXTRA; /* Save the "record" information */ e_head->info_num = MAX_E_IDX; *************** *** 1349,1355 **** r_head->v_major = VERSION_MAJOR; r_head->v_minor = VERSION_MINOR; r_head->v_patch = VERSION_PATCH; ! r_head->v_extra = 0; /* Save the "record" information */ r_head->info_num = MAX_R_IDX; --- 1350,1356 ---- r_head->v_major = VERSION_MAJOR; r_head->v_minor = VERSION_MINOR; r_head->v_patch = VERSION_PATCH; ! r_head->v_extra = VERSION_EXTRA; /* Save the "record" information */ r_head->info_num = MAX_R_IDX; *************** *** 1601,1607 **** v_head->v_major = VERSION_MAJOR; v_head->v_minor = VERSION_MINOR; v_head->v_patch = VERSION_PATCH; ! v_head->v_extra = 0; /* Save the "record" information */ v_head->info_num = MAX_V_IDX; --- 1602,1608 ---- v_head->v_major = VERSION_MAJOR; v_head->v_minor = VERSION_MINOR; v_head->v_patch = VERSION_PATCH; ! v_head->v_extra = VERSION_EXTRA; /* Save the "record" information */ v_head->info_num = MAX_V_IDX; *************** *** 2104,2110 **** /* Fill in each store */ for (i = 0; i < MAX_STORES; i++) { ! /* Access the store */ store_type *st_ptr = &store[i]; /* Assume full stock */ --- 2105,2111 ---- /* Fill in each store */ for (i = 0; i < MAX_STORES; i++) { ! /* Get the store */ store_type *st_ptr = &store[i]; /* Assume full stock */ *************** *** 2114,2120 **** C_MAKE(st_ptr->stock, st_ptr->stock_size, object_type); /* No table for the black market or home */ ! if ((i == 6) || (i == 7)) continue; /* Assume full table */ st_ptr->table_size = STORE_CHOICES; --- 2115,2121 ---- C_MAKE(st_ptr->stock, st_ptr->stock_size, object_type); /* No table for the black market or home */ ! if ((i == STORE_B_MARKET) || (i == STORE_HOME)) continue; /* Assume full table */ st_ptr->table_size = STORE_CHOICES; *************** *** 2149,2172 **** } - /*** Pre-allocate the basic "auto-inscriptions" ***/ - - /* The "basic" feelings */ - (void)quark_add("cursed"); - (void)quark_add("broken"); - (void)quark_add("average"); - (void)quark_add("good"); - - /* The "extra" feelings */ - (void)quark_add("excellent"); - (void)quark_add("worthless"); - (void)quark_add("special"); - (void)quark_add("terrible"); - - /* Some extra strings */ - (void)quark_add("uncursed"); - (void)quark_add("on sale"); - /*** Prepare the options ***/ --- 2150,2155 ---- *************** *** 2185,2190 **** --- 2168,2178 ---- } + /*** Pre-allocate the "on sale" quark ***/ + + (void)quark_add("on sale"); + + /*** Pre-allocate space for the "format()" buffer ***/ /* Hack -- Just call the "format()" function */ *************** *** 2262,2268 **** /* Allocate the alloc_kind_table */ C_MAKE(alloc_kind_table, alloc_kind_size, alloc_entry); ! /* Access the table entry */ table = alloc_kind_table; /* Scan the objects */ --- 2250,2256 ---- /* Allocate the alloc_kind_table */ C_MAKE(alloc_kind_table, alloc_kind_size, alloc_entry); ! /* Get the table entry */ table = alloc_kind_table; /* Scan the objects */ *************** *** 2348,2354 **** /* Allocate the alloc_race_table */ C_MAKE(alloc_race_table, alloc_race_size, alloc_entry); ! /* Access the table entry */ table = alloc_race_table; /* Scan the monsters (not the ghost) */ --- 2336,2342 ---- /* Allocate the alloc_race_table */ C_MAKE(alloc_race_table, alloc_race_size, alloc_entry); ! /* Get the table entry */ table = alloc_race_table; /* Scan the monsters (not the ghost) */ *************** *** 2624,2629 **** /* Done */ note("[Initialization complete]"); } - --- 2612,2616 ---- Only in angband-285/src: init3.c diff -r -c angband-283/src/load1.c angband-285/src/load1.c *** angband-283/src/load1.c Fri Feb 6 04:10:31 1998 --- angband-285/src/load1.c Wed Aug 18 17:03:56 1999 *************** *** 58,84 **** /* * Handle for the savefile */ ! static FILE *fff; /* * Hack -- simple encryption byte */ ! static byte xor_byte; /* * Hack -- parse old "compressed" fields */ ! static bool arg_stupid; /* * Hack -- parse old "colour" info */ ! static bool arg_colour; /* * Hack -- force "maximize" mode */ ! static bool arg_crappy; --- 58,84 ---- /* * Handle for the savefile */ ! static FILE *fff; /* * Hack -- simple encryption byte */ ! static byte xor_byte; /* * Hack -- parse old "compressed" fields */ ! static bool arg_stupid; /* * Hack -- parse old "colour" info */ ! static bool arg_colour; /* * Hack -- force "maximize" mode */ ! static bool arg_crappy; *************** *** 1174,1180 **** /*** Analyze the item ***/ ! /* Access the item kind */ k_ptr = &k_info[o_ptr->k_idx]; /* Extract "tval" and "sval" */ --- 1174,1180 ---- /*** Analyze the item ***/ ! /* Get the item kind */ k_ptr = &k_info[o_ptr->k_idx]; /* Extract "tval" and "sval" */ *************** *** 1302,1315 **** if (old_ident & 0x01) o_ptr->ident |= (IDENT_SENSE); ! /*** Acquire standard values ***/ ! /* Acquire standard fields */ o_ptr->ac = k_ptr->ac; o_ptr->dd = k_ptr->dd; o_ptr->ds = k_ptr->ds; ! /* Acquire standard weight */ o_ptr->weight = k_ptr->weight; --- 1302,1315 ---- if (old_ident & 0x01) o_ptr->ident |= (IDENT_SENSE); ! /*** Get the standard values ***/ ! /* Get the standard fields */ o_ptr->ac = k_ptr->ac; o_ptr->dd = k_ptr->dd; o_ptr->ds = k_ptr->ds; ! /* Get the standard weight */ o_ptr->weight = k_ptr->weight; *************** *** 1326,1332 **** o_ptr->to_d = k_ptr->to_d; o_ptr->to_a = k_ptr->to_a; ! /* Acquire normal pval */ o_ptr->pval = k_ptr->pval; /* Hack -- wands/staffs use "pval" for "charges" */ --- 1326,1332 ---- o_ptr->to_d = k_ptr->to_d; o_ptr->to_a = k_ptr->to_a; ! /* Get the normal pval */ o_ptr->pval = k_ptr->pval; /* Hack -- wands/staffs use "pval" for "charges" */ *************** *** 1383,1400 **** { artifact_type *a_ptr = &a_info[o_ptr->name1]; ! /* Acquire "broken" code */ if (!a_ptr->cost) o_ptr->ident |= (IDENT_BROKEN); ! /* Acquire artifact pval */ o_ptr->pval = a_ptr->pval; ! /* Acquire artifact fields */ o_ptr->ac = a_ptr->ac; o_ptr->dd = a_ptr->dd; o_ptr->ds = a_ptr->ds; ! /* Acquire artifact weight */ o_ptr->weight = a_ptr->weight; /* Assume current "curse" */ --- 1383,1400 ---- { artifact_type *a_ptr = &a_info[o_ptr->name1]; ! /* Get the "broken" code */ if (!a_ptr->cost) o_ptr->ident |= (IDENT_BROKEN); ! /* Get the artifact pval */ o_ptr->pval = a_ptr->pval; ! /* Get the artifact fields */ o_ptr->ac = a_ptr->ac; o_ptr->dd = a_ptr->dd; o_ptr->ds = a_ptr->ds; ! /* Get the artifact weight */ o_ptr->weight = a_ptr->weight; /* Assume current "curse" */ *************** *** 1406,1412 **** { ego_item_type *e_ptr = &e_info[o_ptr->name2]; ! /* Acquire "broken" code */ if (!e_ptr->cost) o_ptr->ident |= (IDENT_BROKEN); /* Hack -- Adapt to the new "speed" code */ --- 1406,1412 ---- { ego_item_type *e_ptr = &e_info[o_ptr->name2]; ! /* Get the "broken" code */ if (!e_ptr->cost) o_ptr->ident |= (IDENT_BROKEN); /* Hack -- Adapt to the new "speed" code */ *************** *** 1745,1751 **** } /* Read the "maximum" stats */ ! for (i = 0; i < 6; i++) { /* Read the maximal stat */ rd_s16b(&p_ptr->stat_max[i]); --- 1745,1751 ---- } /* Read the "maximum" stats */ ! for (i = 0; i < A_MAX; i++) { /* Read the maximal stat */ rd_s16b(&p_ptr->stat_max[i]); *************** *** 2403,2409 **** } ! /* Access the race */ r_ptr = &r_info[n_ptr->r_idx]; /* Hack -- recalculate speed */ --- 2403,2409 ---- } ! /* Get the race */ r_ptr = &r_info[n_ptr->r_idx]; /* Hack -- recalculate speed */ *************** *** 2701,2707 **** return (21); } ! /* Access the monster */ r_ptr = &r_info[tmp16u]; /* Extract the monster lore */ --- 2701,2707 ---- return (21); } ! /* Get the monster */ r_ptr = &r_info[tmp16u]; /* Extract the monster lore */ *************** *** 2857,2863 **** /* Hack -- maximize mode */ ! if (arg_crappy) p_ptr->maximize = TRUE; /* Assume success */ --- 2857,2863 ---- /* Hack -- maximize mode */ ! if (arg_crappy) adult_maximize = TRUE; /* Assume success */ diff -r -c angband-283/src/load2.c angband-285/src/load2.c *** angband-283/src/load2.c Fri Feb 6 04:10:31 1998 --- angband-285/src/load2.c Sun Sep 5 12:01:06 1999 *************** *** 511,521 **** --- 511,523 ---- else { rd_byte(&o_ptr->discount); + rd_byte(&o_ptr->number); rd_s16b(&o_ptr->weight); rd_byte(&o_ptr->name1); rd_byte(&o_ptr->name2); + rd_s16b(&o_ptr->timeout); rd_s16b(&o_ptr->to_h); *************** *** 554,560 **** /* Old special powers */ strip_bytes(2); } ! else { /* Special powers */ --- 556,562 ---- /* Old special powers */ strip_bytes(2); } ! else { /* Special powers */ *************** *** 562,567 **** --- 564,570 ---- rd_byte(&o_ptr->xtra2); } + /* Inscription */ rd_string(buf, 128); *************** *** 599,615 **** /* Repair non "wearable" items */ if (!wearable_p(o_ptr)) { ! /* Acquire correct fields */ o_ptr->to_h = k_ptr->to_h; o_ptr->to_d = k_ptr->to_d; o_ptr->to_a = k_ptr->to_a; ! /* Acquire correct fields */ o_ptr->ac = k_ptr->ac; o_ptr->dd = k_ptr->dd; o_ptr->ds = k_ptr->ds; ! /* Acquire correct weight */ o_ptr->weight = k_ptr->weight; /* Paranoia */ --- 602,618 ---- /* Repair non "wearable" items */ if (!wearable_p(o_ptr)) { ! /* Get the correct fields */ o_ptr->to_h = k_ptr->to_h; o_ptr->to_d = k_ptr->to_d; o_ptr->to_a = k_ptr->to_a; ! /* Get the correct fields */ o_ptr->ac = k_ptr->ac; o_ptr->dd = k_ptr->dd; o_ptr->ds = k_ptr->ds; ! /* Get the correct weight */ o_ptr->weight = k_ptr->weight; /* Paranoia */ *************** *** 759,770 **** } ! /* Acquire standard fields */ o_ptr->ac = k_ptr->ac; o_ptr->dd = k_ptr->dd; o_ptr->ds = k_ptr->ds; ! /* Acquire standard weight */ o_ptr->weight = k_ptr->weight; /* Hack -- extract the "broken" flag */ --- 762,773 ---- } ! /* Get the standard fields */ o_ptr->ac = k_ptr->ac; o_ptr->dd = k_ptr->dd; o_ptr->ds = k_ptr->ds; ! /* Get the standard weight */ o_ptr->weight = k_ptr->weight; /* Hack -- extract the "broken" flag */ *************** *** 779,793 **** /* Obtain the artifact info */ a_ptr = &a_info[o_ptr->name1]; ! /* Acquire new artifact "pval" */ o_ptr->pval = a_ptr->pval; ! /* Acquire new artifact fields */ o_ptr->ac = a_ptr->ac; o_ptr->dd = a_ptr->dd; o_ptr->ds = a_ptr->ds; ! /* Acquire new artifact weight */ o_ptr->weight = a_ptr->weight; /* Hack -- extract the "broken" flag */ --- 782,796 ---- /* Obtain the artifact info */ a_ptr = &a_info[o_ptr->name1]; ! /* Get the new artifact "pval" */ o_ptr->pval = a_ptr->pval; ! /* Get the new artifact fields */ o_ptr->ac = a_ptr->ac; o_ptr->dd = a_ptr->dd; o_ptr->ds = a_ptr->ds; ! /* Get the new artifact weight */ o_ptr->weight = a_ptr->weight; /* Hack -- extract the "broken" flag */ *************** *** 1032,1043 **** i_ptr->marked = FALSE; } ! /* Acquire valid items */ if (st_ptr->stock_num < STORE_INVEN_MAX) { int k = st_ptr->stock_num++; ! /* Acquire the item */ object_copy(&st_ptr->stock[k], i_ptr); } } --- 1035,1046 ---- i_ptr->marked = FALSE; } ! /* Accept any valid items */ if (st_ptr->stock_num < STORE_INVEN_MAX) { int k = st_ptr->stock_num++; ! /* Accept the item */ object_copy(&st_ptr->stock[k], i_ptr); } } *************** *** 1096,1102 **** byte b; ! u16b c; u32b flag[8]; u32b mask[8]; --- 1099,1105 ---- byte b; ! u16b tmp16u; u32b flag[8]; u32b mask[8]; *************** *** 1118,1135 **** rd_byte(&b); op_ptr->hitpoint_warn = b; ! ! /*** Cheating options ***/ ! ! rd_u16b(&c); ! ! if (c & 0x0002) p_ptr->wizard = TRUE; ! ! /* Extract the cheating flags */ ! for (i = 0; i < CHEAT_MAX; ++i) ! { ! p_ptr->cheat[i] = (c & (0x0100 << i)) ? TRUE : FALSE; ! } /* Pre-2.8.0 savefiles are done */ if (older_than(2, 8, 0)) return; --- 1121,1128 ---- rd_byte(&b); op_ptr->hitpoint_warn = b; ! /* Old cheating options */ ! rd_u16b(&tmp16u); /* Pre-2.8.0 savefiles are done */ if (older_than(2, 8, 0)) return; *************** *** 1249,1254 **** --- 1242,1249 ---- byte tmp8u; u16b tmp16u; + u32b randart_version; + rd_string(op_ptr->full_name, 32); rd_string(p_ptr->died_from, 80); *************** *** 1277,1284 **** rd_s16b(&p_ptr->wt); /* Read the stat info */ ! for (i = 0; i < 6; i++) rd_s16b(&p_ptr->stat_max[i]); ! for (i = 0; i < 6; i++) rd_s16b(&p_ptr->stat_cur[i]); strip_bytes(24); /* oops */ --- 1272,1279 ---- rd_s16b(&p_ptr->wt); /* Read the stat info */ ! for (i = 0; i < A_MAX; i++) rd_s16b(&p_ptr->stat_max[i]); ! for (i = 0; i < A_MAX; i++) rd_s16b(&p_ptr->stat_cur[i]); strip_bytes(24); /* oops */ *************** *** 1354,1369 **** rd_byte(&tmp8u); /* oops */ rd_byte(&tmp8u); /* oops */ rd_byte(&p_ptr->searching); ! rd_byte(&p_ptr->maximize); ! rd_byte(&p_ptr->preserve); rd_byte(&tmp8u); /* Future use */ ! for (i = 0; i < 48; i++) rd_byte(&tmp8u); /* Skip the flags */ strip_bytes(12); /* Hack -- the two "special seeds" */ rd_u32b(&seed_flavor); --- 1349,1397 ---- rd_byte(&tmp8u); /* oops */ rd_byte(&tmp8u); /* oops */ rd_byte(&p_ptr->searching); ! rd_byte(&tmp8u); /* oops */ ! if (older_than(2, 8, 5)) adult_maximize = tmp8u; ! rd_byte(&tmp8u); /* oops */ ! if (older_than(2, 8, 5)) adult_preserve = tmp8u; rd_byte(&tmp8u); /* Future use */ ! for (i = 0; i < 40; i++) rd_byte(&tmp8u); ! ! /* Read the randart version */ ! rd_u32b(&randart_version); ! ! /* Read the randart seed */ ! rd_u32b(&seed_randart); /* Skip the flags */ strip_bytes(12); + /* Initialize random artifacts */ + if (adult_rand_artifacts) + { + + #ifdef GJW_RANDART + + /* Check for incompatible randart version */ + if (randart_version != RANDART_VERSION) + { + note(format("Incompatible random artifacts version!")); + return (25); + } + + /* Initialize randarts */ + do_randart(seed_randart); + + #else /* GJW_RANDART */ + + note("Random artifacts are disabled in this binary."); + return (25); + + #endif /* GJW_RANDART */ + + } + /* Hack -- the two "special seeds" */ rd_u32b(&seed_flavor); *************** *** 2163,2169 **** } - /* The dungeon is ready */ character_dungeon = TRUE; --- 2191,2196 ---- *************** *** 2182,2187 **** --- 2209,2222 ---- * Note that the size of the dungeon is now hard-coded to * DUNGEON_HGT by DUNGEON_WID, and any dungeon with another * size will be silently discarded by this routine. + * + * Note that dungeon objects, including objects held by monsters, are + * placed directly into the dungeon, using "object_copy()", which will + * copy "iy", "ix", and "held_m_idx", leaving "next_o_idx" blank for + * objects held by monsters, since it is not saved in the savefile. + * + * After loading the monsters, the objects being held by monsters are + * linked directly into those monsters. */ static errr rd_dungeon(void) { *************** *** 2329,2336 **** object_type *i_ptr; object_type object_type_body; ! /* Acquire place */ i_ptr = &object_type_body; /* Wipe the object */ --- 2364,2374 ---- object_type *i_ptr; object_type object_type_body; + s16b o_idx; + object_type *o_ptr; ! ! /* Get the object */ i_ptr = &object_type_body; /* Wipe the object */ *************** *** 2340,2365 **** rd_item(i_ptr); ! /* Monster */ ! if (i_ptr->held_m_idx) { ! /* Give the object to the monster */ ! if (!monster_carry(i_ptr->held_m_idx, i_ptr)) ! { ! note(format("Cannot place object %d!", o_max)); ! return (152); ! } } ! /* Dungeon */ ! else { ! /* Give the object to the floor */ ! if (!floor_carry(i_ptr->iy, i_ptr->ix, i_ptr)) ! { ! note(format("Cannot place object %d!", o_max)); ! return (152); ! } } } --- 2378,2410 ---- rd_item(i_ptr); ! /* Make an object */ ! o_idx = o_pop(); ! ! /* Paranoia */ ! if (o_idx != i) { ! note(format("Cannot place object %d!", i)); ! return (152); } ! /* Get the object */ ! o_ptr = &o_list[o_idx]; ! ! /* Structure Copy */ ! object_copy(o_ptr, i_ptr); ! ! /* Dungeon floor */ ! if (!i_ptr->held_m_idx) { ! int x = i_ptr->ix; ! int y = i_ptr->iy; ! ! /* Link the object to the pile */ ! o_ptr->next_o_idx = cave_o_idx[y][x]; ! ! /* Link the floor to the object */ ! cave_o_idx[y][x] = o_idx; } } *************** *** 2394,2400 **** /* Place monster in dungeon */ ! if (!monster_place(n_ptr->fy, n_ptr->fx, n_ptr)) { note(format("Cannot place monster %d", i)); return (162); --- 2439,2445 ---- /* Place monster in dungeon */ ! if (monster_place(n_ptr->fy, n_ptr->fx, n_ptr) != i) { note(format("Cannot place monster %d", i)); return (162); *************** *** 2402,2407 **** --- 2447,2478 ---- } + /*** Holding ***/ + + /* Reacquire objects */ + for (i = 1; i < o_max; ++i) + { + object_type *o_ptr; + + monster_type *m_ptr; + + /* Get the object */ + o_ptr = &o_list[i]; + + /* Ignore dungeon objects */ + if (!o_ptr->held_m_idx) continue; + + /* Get the monster */ + m_ptr = &m_list[o_ptr->held_m_idx]; + + /* Link the object to the pile */ + o_ptr->next_o_idx = m_ptr->hold_o_idx; + + /* Link the monster to the object */ + m_ptr->hold_o_idx = i; + } + + /*** Success ***/ /* The dungeon is ready */ *************** *** 2508,2514 **** /* Read the lore */ rd_lore(i); ! /* Access that monster */ r_ptr = &r_info[i]; /* XXX XXX Hack -- repair old savefiles */ --- 2579,2585 ---- /* Read the lore */ rd_lore(i); ! /* Get the monster race */ r_ptr = &r_info[i]; /* XXX XXX Hack -- repair old savefiles */ diff -r -c angband-283/src/main-dos.c angband-285/src/main-dos.c *** angband-283/src/main-dos.c Fri Feb 6 04:10:31 1998 --- angband-285/src/main-dos.c Thu Jul 22 11:49:23 1999 *************** *** 524,530 **** { /* Build a one character string */ text[0] = cp[i]; ! /* Dump some text */ textout(screen, td->font, text, x1, y1, COLOR_OFFSET + (a & 0x0F)); --- 524,530 ---- { /* Build a one character string */ text[0] = cp[i]; ! /* Dump some text */ textout(screen, td->font, text, x1, y1, COLOR_OFFSET + (a & 0x0F)); *************** *** 704,710 **** * GRX font file reader by Mark Wodrich. * * GRX FNT files consist of the header data (see struct below). If the font ! * is proportional, followed by a table of widths per character (unsigned * shorts). Then, the data for each character follows. 1 bit/pixel is used, * with each line of the character stored in contiguous bytes. High bit of * first byte is leftmost pixel of line. --- 704,710 ---- * GRX font file reader by Mark Wodrich. * * GRX FNT files consist of the header data (see struct below). If the font ! * is proportional, followed by a table of widths per character (unsigned * shorts). Then, the data for each character follows. 1 bit/pixel is used, * with each line of the character stored in contiguous bytes. High bit of * first byte is leftmost pixel of line. *************** *** 763,769 **** /* * ??? */ ! void convert_grx_bitmap(int width, int height, GRX_BITMAP src, GRX_BITMAP dest) { unsigned short x, y, bytes_per_line; unsigned char bitpos, bitset; --- 763,769 ---- /* * ??? */ ! void convert_grx_bitmap(int width, int height, GRX_BITMAP src, GRX_BITMAP dest) { unsigned short x, y, bytes_per_line; unsigned char bitpos, bitset; *************** *** 786,792 **** * ??? */ GRX_BITMAP *load_grx_bmps(PACKFILE *f, FNTfile_header *hdr, ! int numchar, unsigned short *wtable) { int t, width, bmp_size; GRX_BITMAP temp; --- 786,792 ---- * ??? */ GRX_BITMAP *load_grx_bmps(PACKFILE *f, FNTfile_header *hdr, ! int numchar, unsigned short *wtable) { int t, width, bmp_size; GRX_BITMAP temp; diff -r -c angband-283/src/main-emx.c angband-285/src/main-emx.c *** angband-283/src/main-emx.c Wed Feb 11 06:07:30 1998 --- angband-285/src/main-emx.c Sat Jun 12 16:34:55 1999 *************** *** 51,57 **** * Old savefiles must be renamed to follow the new "savefile" naming * conventions. Either rename the savefile to "PLAYER", or start the * program with the "-uName" flag. See "main.c" for details. The ! * savefiles are stores in "./lib/save" if you forgot the old names... * * Changes * ======= --- 51,57 ---- * Old savefiles must be renamed to follow the new "savefile" naming * conventions. Either rename the savefile to "PLAYER", or start the * program with the "-uName" flag. See "main.c" for details. The ! * savefiles are stored in "./lib/save" if you forgot the old names... * * Changes * ======= *************** *** 85,105 **** * * 9.03.96 EK 2.7.9 Adjustable background color (PM) * v5 Added map window ! * 3 Dec 97 SWD 282 Brought key-handling, macros in sync with DOS. * Hacked on sub-window code -- it compiles, but * doesn't link. * * 23 Jan 98 SWD 282 Hacked more on sub-windows. Now links, with ! * warnings. Seems to work. */ #include #include #include #include ! #include ! #define INCL_KBD 1 #include #include --- 85,115 ---- * * 9.03.96 EK 2.7.9 Adjustable background color (PM) * v5 Added map window ! * * 3 Dec 97 SWD 282 Brought key-handling, macros in sync with DOS. * Hacked on sub-window code -- it compiles, but * doesn't link. * * 23 Jan 98 SWD 282 Hacked more on sub-windows. Now links, with ! * warnings. Seems to work. ! * ! * 25 May 99 GDL 283 Moved pipe and PM related data into Term struct to avoid ! * term conflicts (redefintion, etc). Some code cleanup. ! * ! * 02 Jun 99 GDL 283 Fixed handling of sub-windows so that they tell server ! * how big they are, avoiding sub-window display corruption. ! * */ #include #include #include #include ! #include ! #include ! #define INCL_KBD 1 ! #define INCL_WINWINDOWMGR ! #define INCL_WINSWITCHLIST #include #include *************** *** 110,117 **** * Maximum windows */ #define MAX_TERM_DATA 8 ! ! /* * Keypress input modifier flags (copied from main-ibm.c) * --- 120,126 ---- * Maximum windows */ #define MAX_TERM_DATA 8 ! /* * Keypress input modifier flags (copied from main-ibm.c) * *************** *** 135,155 **** static errr Term_wipe_emx(int x, int y, int n); static errr Term_text_emx(int x, int y, int n, unsigned char a, cptr s); static void Term_init_emx(term *t); ! static void Term_nuke_emx(term *t); ! #ifndef EMXPM /* ! * termPipe* is sometimes cast to term* and vice versa, ! * so "term t;" must be the first line */ typedef struct { - term t; FILE *out; /* used by the ..._pipe_emx stuff */ ! } termPipe; ! /* * Communication between server and client */ --- 144,169 ---- static errr Term_wipe_emx(int x, int y, int n); static errr Term_text_emx(int x, int y, int n, unsigned char a, cptr s); static void Term_init_emx(term *t); ! static void Term_nuke_emx(term *t); ! ! /* ! * the terms! kind of useless for client. Oh well. ! */ ! ! static term emxterm[MAX_TERM_DATA]; ! #ifndef EMXPM /* ! * Use the "data" field in the term struct to keep track of the ! * pipe handle */ typedef struct { FILE *out; /* used by the ..._pipe_emx stuff */ ! } termData; ! /* * Communication between server and client */ *************** *** 324,343 **** static void Term_init_pipe_emx(term *t); static void Term_nuke_pipe_emx(term *t); static FILE *initPipe(char *name); ! static void initPipeTerm(termPipe *pipe, char *name, term **term); ! /* * Main initialization function */ errr init_emx(void); /* - * The screens - */ - static termPipe term_screen[MAX_TERM_DATA]; - - - /* * Check for events -- called by "Term_scan_emx()" * * Note -- this is probably NOT the most efficient way --- 338,351 ---- static void Term_init_pipe_emx(term *t); static void Term_nuke_pipe_emx(term *t); static FILE *initPipe(char *name); ! static int initPipeTerm(term *term, char *name); ! /* * Main initialization function */ errr init_emx(void); /* * Check for events -- called by "Term_scan_emx()" * * Note -- this is probably NOT the most efficient way *************** *** 632,638 **** static errr Term_xtra_pipe_emx(int n, int v) { ! termPipe *tp=(termPipe*)Term; switch (n) { --- 640,646 ---- static errr Term_xtra_pipe_emx(int n, int v) { ! termData *tp=(termData *)Term->data; switch (n) { *************** *** 662,670 **** } static errr Term_curs_pipe_emx(int x, int y) ! { ! termPipe *tp=(termPipe*)Term; ! if (!tp->out) return -1; fputc(PIP_CURS, tp->out); --- 670,678 ---- } static errr Term_curs_pipe_emx(int x, int y) ! { ! termData *tp=(termData *)Term->data; ! if (!tp->out) return -1; fputc(PIP_CURS, tp->out); *************** *** 677,685 **** static errr Term_wipe_pipe_emx(int x, int y, int n) ! { ! termPipe *tp=(termPipe*)Term; ! if (!tp->out) return -1; fputc(PIP_WIPE, tp->out); --- 685,693 ---- static errr Term_wipe_pipe_emx(int x, int y, int n) ! { ! termData *tp=(termData *)Term->data; ! if (!tp->out) return -1; fputc(PIP_WIPE, tp->out); *************** *** 693,700 **** static errr Term_text_pipe_emx(int x, int y, int n, unsigned char a, cptr s) ! { ! termPipe *tp=(termPipe*)Term; if (!tp->out) return -1; --- 701,708 ---- static errr Term_text_pipe_emx(int x, int y, int n, unsigned char a, cptr s) ! { ! termData *tp=(termData *)Term->data; if (!tp->out) return -1; *************** *** 711,718 **** static void Term_init_pipe_emx(term *t) ! { ! termPipe *tp=(termPipe*)t; if (tp->out) { --- 719,726 ---- static void Term_init_pipe_emx(term *t) ! { ! termData *tp=(termData *)t->data; if (tp->out) { *************** *** 724,750 **** static void Term_nuke_pipe_emx(term *t) { ! termPipe *tp=(termPipe*)t; ! if (tp->out) { fputc(PIP_NUKE, tp->out); /* Terminate client */ fflush(tp->out); ! fclose(tp->out); /* Close Pipe */ ! tp->out=NULL; /* Paranoia */ } } ! static void initPipeTerm(termPipe *pipe, char *name, term **termTarget) ! { ! term *t; ! ! t=(term*)pipe; ! if ((pipe->out=initPipe(name))!=NULL) ! { /* Initialize the term */ ! term_init(t, 80, 24, 1); /* Special hooks */ t->init_hook = Term_init_pipe_emx; --- 732,780 ---- static void Term_nuke_pipe_emx(term *t) { ! termData *tp=(termData *)t->data; ! if (tp->out) { fputc(PIP_NUKE, tp->out); /* Terminate client */ fflush(tp->out); ! fclose(tp->out); /* Close Pipe */ ! FREE(t->data, termData); /* free xtra memory for pipe data */ ! t->data=NULL; /* Paranoia */ } } ! static int initPipeTerm(term *t, char *name) ! { ! termData *pipe; ! int lineCount = 0; ! char linesin[3] = { "00" }; ! size_t bytesin = 0; ! ! /* get memory for pipe */ ! pipe = RNEW(termData); if ((pipe->out=initPipe(name))!=NULL) ! { ! _sleep2(500); /* sleep a bit */ ! bytesin = fread(linesin, 2, 1, pipe->out); ! ! lineCount = atoi(linesin); ! #if 0 ! printf("%d blocks, string = \"%s\", count=%d, feof=%d, ferror=%d.\n",bytesin, ! linesin, lineCount, feof(pipe->out), ferror(pipe->out)); ! #endif ! ! /* sanity check: 0 < lines < 99 */ ! if (lineCount < 0 || lineCount > 99 || bytesin < 1) { ! return 0; ! /* the window will be idle */ ! } ! ! /* reset the stream for writing */ ! fseek(pipe->out, 0, SEEK_CUR); ! /* Initialize the term */ ! term_init(t, 80, lineCount, 1); /* Special hooks */ t->init_hook = Term_init_pipe_emx; *************** *** 755,767 **** t->wipe_hook = Term_wipe_pipe_emx; t->curs_hook = Term_curs_pipe_emx; t->xtra_hook = Term_xtra_pipe_emx; ! ! /* Save it */ ! *termTarget = t; ! ! /* Activate it */ ! Term_activate(t); ! } } /* --- 785,798 ---- t->wipe_hook = Term_wipe_pipe_emx; t->curs_hook = Term_curs_pipe_emx; t->xtra_hook = Term_xtra_pipe_emx; ! ! t->data = pipe; ! t->data_flag = TRUE; ! ! /* Activate it */ ! Term_activate(t); ! } ! return lineCount; } /* *************** *** 771,787 **** { int i; ! term *t; /* Initialize the pipe windows */ for (i = MAX_TERM_DATA-1; i > 0; --i) ! { ! const char *name = angband_term_name[i]; ! initPipeTerm(&term_screen[i], name, &angband_term[i]); } ! /* Initialize main window */ ! t = (term*)(&term_screen[0]); /* Initialize the term -- big key buffer */ term_init(t, 80, 24, 1024); --- 802,821 ---- { int i; ! term *t; ! const char *name; /* Initialize the pipe windows */ for (i = MAX_TERM_DATA-1; i > 0; --i) ! { ! name = angband_term_name[i]; ! /* if client connect successful, add term to list */ ! if (initPipeTerm(&emxterm[i], name)) ! angband_term[i] = &emxterm[i]; } ! /* Initialize main window */ ! t = &emxterm[0]; /* Initialize the term -- big key buffer */ term_init(t, 80, 24, 1024); *************** *** 796,807 **** t->curs_hook = Term_curs_emx; t->xtra_hook = Term_xtra_emx; - /* Save it */ - term_screen = t; - /* Activate it */ Term_activate(t); ! /* Success */ return (0); } --- 830,841 ---- t->curs_hook = Term_curs_emx; t->xtra_hook = Term_xtra_emx; /* Activate it */ Term_activate(t); ! ! /* Assign to angband_term[0] */ ! angband_term[0] = t; ! /* Success */ return (0); } *************** *** 812,823 **** FILE *fi; sprintf(buf, "\\pipe\\angband\\%s", name); /* Name of pipe */ ! fi=fopen(buf, "wb"); /* Look for server */ return fi; } #else /* __EMX__CLIENT__ */ ! int main(int argc, char **argv) { int c, end = 0, lines = 25; --- 846,873 ---- FILE *fi; sprintf(buf, "\\pipe\\angband\\%s", name); /* Name of pipe */ ! fi=fopen(buf, "r+b"); /* Look for client */ return fi; } #else /* __EMX__CLIENT__ */ ! ! void moveClientWindow(int x, int y) ! { ! SWCNTRL sw_info; ! int emxpid; ! BOOL rc; ! HSWITCH swhandle; ! ! emxpid = getpid(); ! swhandle = WinQuerySwitchHandle(NULLHANDLE, emxpid); ! if (swhandle != NULLHANDLE) { ! rc = WinQuerySwitchEntry(swhandle, &sw_info); ! if (rc == 0) ! WinSetWindowPos(sw_info.hwnd, 0, x, y, 0, 0, SWP_MOVE); ! } ! } ! int main(int argc, char **argv) { int c, end = 0, lines = 25; *************** *** 828,861 **** char buf[160]; HPIPE pipe; APIRET rc; - char *target; /* Check command line */ ! if (argc!=2 && argc!=3) { ! printf("Usage: %s Term-1|...|Term-7 [number of lines]\n" "Start this before angband.exe\n", argv[0]); exit(1); } ! if (argc==3) lines = atoi(argv[2]); ! if (lines <= 0) lines = 25; printf("Looking for Angband... press ^C to abort\n"); ! target=strdup(argv[1]); ! for (c=0; c5 || argc==4) { ! printf("Usage: %s Term-1|...|Term-7 [number of lines] [x-position y-position]\n" "Start this before angband.exe\n", argv[0]); exit(1); } ! if (argc>2) lines = atoi(argv[2]); ! if (lines <= 0) lines = 25; ! if (argc==5) { ! x=atoi(argv[3]); ! y=atoi(argv[4]); ! } printf("Looking for Angband... press ^C to abort\n"); ! sprintf(buf, "\\pipe\\angband\\%s", argv[1]); do { rc=DosCreateNPipe((PSZ)buf, /* Create pipe */ &pipe, ! NP_ACCESS_DUPLEX, NP_WAIT|NP_TYPE_BYTE|NP_READMODE_BYTE|1, ! 2, /* Output buffer */ ! 2048, /* Input buffer */ -1); if (rc) /* Pipe not created */ *************** *** 868,881 **** { rc=DosConnectNPipe(pipe); /* Wait for angband to connect */ if (!rc) break; ! _sleep2(500); /* Sleep for 0.5s */ } while (_read_kbd(0, 0, 0)==-1); /* Until key pressed */ if (rc) break; h=_imphandle(pipe); /* Register handle with io */ setmode(h, O_BINARY); /* Make it binary */ ! in=fdopen(h, "rb"); /* Register handle with stdio */ } while (0); /* We don't need no stinking exception handling */ --- 918,931 ---- { rc=DosConnectNPipe(pipe); /* Wait for angband to connect */ if (!rc) break; ! _sleep2(200); /* Sleep for 0.2s */ } while (_read_kbd(0, 0, 0)==-1); /* Until key pressed */ if (rc) break; h=_imphandle(pipe); /* Register handle with io */ setmode(h, O_BINARY); /* Make it binary */ ! in=fdopen(h, "r+b"); /* Register handle with stdio */ } while (0); /* We don't need no stinking exception handling */ *************** *** 889,895 **** sprintf(buf, "mode co80,%d", lines); system(buf); ! /* Infinite loop */ while (!end) { --- 939,956 ---- sprintf(buf, "mode co80,%d", lines); system(buf); ! ! /* now position it */ ! if (argc == 5) ! moveClientWindow(x,y); ! ! /* send screen length - ONLY time we write to this pipe. */ ! sprintf(buf,"%02d",lines); ! fwrite(buf,2,1,in); ! ! /* fseek so that we can start reading. */ ! fseek(in,0,SEEK_CUR); ! /* Infinite loop */ while (!end) { *************** *** 948,960 **** case PIP_NUKE: case EOF: ! default: Term_nuke_emx(NULL); end=1; break; } ! } ! return 0; } --- 1009,1024 ---- case PIP_NUKE: case EOF: ! default: ! #if 0 ! printf("feof=%d ferror=%d.\n",feof(in),ferror(in)); ! #endif Term_nuke_emx(NULL); end=1; break; } ! } ! return 0; } *************** *** 985,1006 **** void emx_showcursor(void *instance); /* ! * termWindow* is sometimes cast to term* and vice versa, ! * so "term t;" must be the first line */ typedef struct { - term t; void *instance; /* Pointer to window */ ! } termWindow; /* * Display a cursor, on top of a given attr/char */ static errr Term_curs_emx(int x, int y) { ! return emx_curs(((termWindow*)Term)->instance, x, y); } /* --- 1049,1068 ---- void emx_showcursor(void *instance); /* ! * Type to hold extra data. Again, we use termData type (as per pipes) */ typedef struct { void *instance; /* Pointer to window */ ! } termData; /* * Display a cursor, on top of a given attr/char */ static errr Term_curs_emx(int x, int y) { ! return emx_curs(((termData *)Term->data)->instance, x, y); } /* *************** *** 1008,1014 **** */ static errr Term_wipe_emx(int x, int y, int n) { ! return emx_wipe(((termWindow*)Term)->instance, x, y, n); } /* --- 1070,1076 ---- */ static errr Term_wipe_emx(int x, int y, int n) { ! return emx_wipe(((termData *)Term->data)->instance, x, y, n); } /* *************** *** 1016,1022 **** */ static errr Term_text_emx(int x, int y, int n, unsigned char a, cptr s) { ! return emx_text(((termWindow*)Term)->instance, x, y, n, a, s); } /* --- 1078,1084 ---- */ static errr Term_text_emx(int x, int y, int n, unsigned char a, cptr s) { ! return emx_text(((termData *)Term->data)->instance, x, y, n, a, s); } /* *************** *** 1024,1037 **** */ static void Term_init_emx(term *t) { ! return emx_init(((termWindow*)t)->instance); } /* * EMX shutdown */ static void Term_nuke_emx(term *t) ! { } /* --- 1086,1103 ---- */ static void Term_init_emx(term *t) { ! emx_init(((termData *)t->data)->instance); } /* * EMX shutdown */ static void Term_nuke_emx(term *t) ! { ! if (t->data_flag && t->data != NULL) { ! FREE(t->data, termData); ! t->data = NULL; ! } } /* *************** *** 1045,1061 **** errr init_emx(void); /* - * The screens - */ - static termWindow term_screen[MAX_TERM_DATA]; - - /* * Check for events -- called by "Term_scan_emx()" */ static errr CheckEvents(int returnImmediately) { /* Get key - Macro triggers are generated by emx_read_kbd() */ ! int k=emx_read_kbd(((termWindow*)Term)->instance, returnImmediately?0:1); /* Nothing ready */ if (k < 0) return (1); --- 1111,1122 ---- errr init_emx(void); /* * Check for events -- called by "Term_scan_emx()" */ static errr CheckEvents(int returnImmediately) { /* Get key - Macro triggers are generated by emx_read_kbd() */ ! int k=emx_read_kbd(((termData *)Term->data)->instance, returnImmediately?0:1); /* Nothing ready */ if (k < 0) return (1); *************** *** 1072,1078 **** */ static errr Term_xtra_emx(int n, int v) { ! void *instance=((termWindow*)Term)->instance; switch (n) { --- 1133,1139 ---- */ static errr Term_xtra_emx(int n, int v) { ! void *instance=((termData *)Term->data)->instance; switch (n) { *************** *** 1110,1136 **** return (1); } ! void emx_init_term(termWindow *t, void *main_instance, term **angTerm, int n) ! { ! term *te=(term*)t; ! /* Initialize window */ ! emx_init_window(&t->instance, main_instance, n); ! ! *angTerm=te; /* Initialize the term -- big key buffer */ ! term_init(te, 80, 24, 1024); /* Special hooks */ ! te->init_hook = Term_init_emx; ! te->nuke_hook = Term_nuke_emx; /* Add the hooks */ ! te->text_hook = Term_text_emx; ! te->wipe_hook = Term_wipe_emx; ! te->curs_hook = Term_curs_emx; ! te->xtra_hook = Term_xtra_emx; } /* --- 1171,1201 ---- return (1); } ! void emx_init_term(term *t, void *main_instance, int n) ! { ! termData *inst; ! ! /* get memory for instance */ ! inst = RNEW(termData); ! ! t->data = inst; ! t->data_flag = TRUE; ! /* Initialize window */ ! emx_init_window(t->data, main_instance, n); /* Initialize the term -- big key buffer */ ! term_init(t, 80, 24, 1024); /* Special hooks */ ! t->init_hook = Term_init_emx; ! t->nuke_hook = Term_nuke_emx; /* Add the hooks */ ! t->text_hook = Term_text_emx; ! t->wipe_hook = Term_wipe_emx; ! t->curs_hook = Term_curs_emx; ! t->xtra_hook = Term_xtra_emx; } /* *************** *** 1141,1155 **** int i; /* Initialize the windows */ ! emx_init_term(&term_screen[0], NULL, &angband_term[0], 0); for (i = 1; i < MAX_TERM_DATA; ++i) { ! emx_init_term(&term_screen[i], term_screen[0].instance, &angband_term[i], i); } /* Activate main window */ ! Term_activate(angband_term[0]); /* Success */ return (0); --- 1206,1222 ---- int i; /* Initialize the windows */ ! emx_init_term(&emxterm[0], NULL, 0); for (i = 1; i < MAX_TERM_DATA; ++i) { ! emx_init_term(&emxterm[i], emxterm[0].data, i); } /* Activate main window */ ! Term_activate(&emxterm[0]); ! ! angband_term[0] = &emxterm[0]; /* Success */ return (0); *************** *** 1183,1191 **** if (angband_term[i]) { term_nuke(angband_term[i]); ! emx_nuke(((termWindow*)angband_term[i])->instance); } ! ] /* Shut down window system - doesn't return */ emx_endPM(s); --- 1250,1258 ---- if (angband_term[i]) { term_nuke(angband_term[i]); ! emx_nuke(angband_term[i]->data); } ! } /* Shut down window system - doesn't return */ emx_endPM(s); diff -r -c angband-283/src/main-gcu.c angband-285/src/main-gcu.c *** angband-283/src/main-gcu.c Fri Feb 6 04:10:31 1998 --- angband-285/src/main-gcu.c Wed Aug 18 14:09:50 1999 *************** *** 32,46 **** * and uses the "termcap" information directly, or even bypasses the * "termcap" information and sends direct vt100 escape sequences. * ! * This file provides only a single "term" window. XXX XXX XXX * ! * But in theory, it should be possible to allow a 50 line screen to be ! * split into two (or more) sub-screens. * ! * The "init" and "nuke" hooks are built so that only the first init and ! * the last nuke actually do anything, but the other functions are not ! * "correct" for multiple windows. Minor changes would also be needed ! * to allow the system to handle the "locations" of the various windows. * * Consider the use of "savetty()" and "resetty()". XXX XXX XXX */ --- 32,46 ---- * and uses the "termcap" information directly, or even bypasses the * "termcap" information and sends direct vt100 escape sequences. * ! * This file provides up to 4 term windows. * ! * This file will attempt to redefine the screen colors to conform to ! * standard Angband colors. It will only do so if the terminal type ! * indicates that it can do so. See the page: ! * ! * http://www.umr.edu/~keldon/ang-patch/ncurses_color.html * ! * for information on this. * * Consider the use of "savetty()" and "resetty()". XXX XXX XXX */ *************** *** 51,57 **** #ifdef USE_GCU - /* * Hack -- play games with "bool" */ --- 51,56 ---- *************** *** 66,71 **** --- 65,74 ---- # include #endif + /* + * Try redefining the colors at startup. + */ + #define REDEFINE_COLORS /* *************** *** 187,204 **** #endif - - /* ! * Hack -- Number of initialized "term" structures */ ! static int active = 0; /* ! * The main screen information */ ! static term term_screen_body; #ifdef A_COLOR --- 190,218 ---- #endif /* ! * Information about a term */ ! typedef struct term_data term_data; ! ! struct term_data ! { ! term t; /* All term info */ ! ! WINDOW *win; /* Pointer to the curses window */ ! }; ! ! /* Max number of windows on screen */ ! #define MAX_TERM_DATA 4 ! ! /* Information about our windows */ ! static term_data data[MAX_TERM_DATA]; /* ! * Hack -- Number of initialized "term" structures */ ! static int active = 0; #ifdef A_COLOR *************** *** 501,517 **** */ static void Term_init_gcu(term *t) { /* Count init's, handle first */ if (active++ != 0) return; ! /* Erase the screen */ ! (void)clear(); /* Reset the cursor */ ! (void)move(0, 0); /* Flush changes */ ! (void)refresh(); /* Game keymap */ keymap_game(); --- 515,533 ---- */ static void Term_init_gcu(term *t) { + term_data *td = (term_data *)(t->data); + /* Count init's, handle first */ if (active++ != 0) return; ! /* Erase the window */ ! (void)wclear(td->win); /* Reset the cursor */ ! (void)wmove(td->win, 0, 0); /* Flush changes */ ! (void)wrefresh(td->win); /* Game keymap */ keymap_game(); *************** *** 523,534 **** --- 539,560 ---- */ static void Term_nuke_gcu(term *t) { + term_data *td = (term_data *)(t->data); + + /* Delete this window */ + delwin(td->win); + /* Count nuke's, handle last */ if (--active != 0) return; /* Hack -- make sure the cursor is visible */ Term_xtra(TERM_XTRA_SHAPE, 1); + #ifdef A_COLOR + /* Reset colors to defaults */ + start_color(); + #endif + #ifdef SPECIAL_BSD /* This moves curses to bottom right corner */ mvcur(curscr->cury, curscr->curx, LINES - 1, 0); *************** *** 655,673 **** #endif /* USE_GETCH */ /* * Handle a "special request" */ static errr Term_xtra_gcu(int n, int v) { /* Analyze the request */ switch (n) { /* Clear screen */ case TERM_XTRA_CLEAR: ! touchwin(stdscr); ! (void)clear(); return (0); /* Make a noise */ --- 681,730 ---- #endif /* USE_GETCH */ + /* + * React to changes + */ + static errr Term_xtra_gcu_react(void) + { + + #ifdef A_COLOR + + int i; + + /* Cannot handle color redefinition */ + if (!can_fix_color) return (0); + + /* Set the colors */ + for (i = 0; i < 16; i++) + { + /* Set one color (note scaling) */ + init_color(i, + angband_color_table[i][1] * 1000 / 255, + angband_color_table[i][2] * 1000 / 255, + angband_color_table[i][3] * 1000 / 255); + } + + #endif + + /* Success */ + return (0); + } + /* * Handle a "special request" */ static errr Term_xtra_gcu(int n, int v) { + term_data *td = (term_data *)(Term->data); + /* Analyze the request */ switch (n) { /* Clear screen */ case TERM_XTRA_CLEAR: ! touchwin(td->win); ! (void)wclear(td->win); return (0); /* Make a noise */ *************** *** 677,683 **** /* Flush the Curses buffer */ case TERM_XTRA_FRESH: ! (void)refresh(); return (0); #ifdef USE_CURS_SET --- 734,740 ---- /* Flush the Curses buffer */ case TERM_XTRA_FRESH: ! (void)wrefresh(td->win); return (0); #ifdef USE_CURS_SET *************** *** 706,711 **** --- 763,773 ---- case TERM_XTRA_DELAY: usleep(1000 * v); return (0); + + /* React to events */ + case TERM_XTRA_REACT: + Term_xtra_gcu_react(); + return (0); } /* Unknown */ *************** *** 718,725 **** */ static errr Term_curs_gcu(int x, int y) { /* Literally move the cursor */ ! move(y, x); /* Success */ return (0); --- 780,789 ---- */ static errr Term_curs_gcu(int x, int y) { + term_data *td = (term_data *)(Term->data); + /* Literally move the cursor */ ! wmove(td->win, y, x); /* Success */ return (0); *************** *** 732,750 **** */ static errr Term_wipe_gcu(int x, int y, int n) { /* Place cursor */ ! move(y, x); /* Clear to end of line */ ! if (x + n >= 80) { ! clrtoeol(); } /* Clear some characters */ else { ! while (n-- > 0) addch(' '); } /* Success */ --- 796,816 ---- */ static errr Term_wipe_gcu(int x, int y, int n) { + term_data *td = (term_data *)(Term->data); + /* Place cursor */ ! wmove(td->win, y, x); /* Clear to end of line */ ! if (x + n >= td->t.wid) { ! wclrtoeol(td->win); } /* Clear some characters */ else { ! while (n-- > 0) waddch(td->win, ' '); } /* Success */ *************** *** 752,790 **** } - - - - /* * Place some text on the screen using an attribute */ static errr Term_text_gcu(int x, int y, int n, byte a, cptr s) { ! int i; ! char text[81]; ! ! /* Obtain a copy of the text */ ! for (i = 0; i < n; i++) text[i] = s[i]; ! text[n] = 0; ! ! /* Move the cursor and dump the string */ ! move(y, x); #ifdef A_COLOR /* Set the color */ ! if (can_use_color) attrset(colortable[a & 0x0F]); #endif ! /* Add the text */ ! addstr(text); /* Success */ return (0); } /* --- 818,931 ---- } /* * Place some text on the screen using an attribute */ static errr Term_text_gcu(int x, int y, int n, byte a, cptr s) { ! term_data *td = (term_data *)(Term->data); ! int i, pic; #ifdef A_COLOR /* Set the color */ ! if (can_use_color) wattrset(td->win, colortable[a & 0x0F]); #endif ! /* Move the cursor */ ! wmove(td->win, y, x); ! ! /* Draw each character */ ! for (i = 0; i < n; i++) ! { ! #ifdef USE_GRAPHICS ! /* Special character */ ! if (use_graphics && (s[i] & 0x80)) ! { ! /* Determine picture to use */ ! switch (s[i] & 0x7F) ! { ! /* Wall */ ! case '#': ! pic = ACS_CKBOARD; ! break; ! ! /* Mineral vein */ ! case '%': ! pic = ACS_BOARD; ! break; ! ! /* XXX */ ! default: ! pic = '?'; ! break; ! } ! ! /* Draw the picture */ ! waddch(td->win, pic); ! ! /* Next character */ ! continue; ! } ! #endif ! ! /* Draw a normal character */ ! waddch(td->win, s[i]); ! } /* Success */ return (0); } + /* + * Create a window for the given "term_data" argument. + * + * Assumes legal arguments. + */ + static errr term_data_init_gcu(term_data *td, int rows, int cols, int y, int x) + { + term *t = &td->t; + + /* Create new window */ + td->win = newwin(rows, cols, y, x); + + /* Check for failure */ + if (!td->win) + { + /* Error */ + quit("Failed to setup curses window."); + } + + /* Initialize the term */ + term_init(t, cols, rows, 256); + + /* Avoid bottom right corner */ + t->icky_corner = TRUE; + + /* Erase with "white space" */ + t->attr_blank = TERM_WHITE; + t->char_blank = ' '; + + /* Set some hooks */ + t->init_hook = Term_init_gcu; + t->nuke_hook = Term_nuke_gcu; + + /* Set some more hooks */ + t->text_hook = Term_text_gcu; + t->wipe_hook = Term_wipe_gcu; + t->curs_hook = Term_curs_gcu; + t->xtra_hook = Term_xtra_gcu; + + /* Save the data */ + t->data = td; + + /* Activate it */ + Term_activate(t); + + /* Success */ + return (0); + } /* *************** *** 799,806 **** { int i; ! term *t = &term_screen_body; ! /* Extract the normal keymap */ keymap_norm_prepare(); --- 940,946 ---- { int i; ! int num_term = MAX_TERM_DATA, next_win = 0; /* Extract the normal keymap */ keymap_norm_prepare(); *************** *** 810,823 **** /* Initialize for USG Unix */ if (initscr() == NULL) return (-1); #else ! /* Initialize for others systems */ if (initscr() == (WINDOW*)ERR) return (-1); #endif ! /* Hack -- Require large screen, or Quit with message */ ! i = ((LINES < 24) || (COLS < 80)); ! if (i) quit("Angband needs an 80x24 'curses' screen"); #ifdef A_COLOR --- 950,972 ---- /* Initialize for USG Unix */ if (initscr() == NULL) return (-1); #else ! /* Initialize for other systems */ if (initscr() == (WINDOW*)ERR) return (-1); #endif + /* Require standard size screen */ + if ((LINES < 24) || (COLS < 80)) + { + quit("Angband needs at least an 80x24 'curses' screen"); + } + ! #ifdef USE_GRAPHICS ! ! /* Set graphics flag */ ! use_graphics = arg_graphics; ! ! #endif #ifdef A_COLOR *************** *** 828,870 **** (COLORS >= 8) && (COLOR_PAIRS >= 8)); #ifdef REDEFINE_COLORS /* Can we change colors? */ can_fix_color = (can_use_color && can_change_color() && ! (COLOR_PAIRS >= 16)); #endif /* Attempt to use customized colors */ if (can_fix_color) { /* Prepare the color pairs */ ! for (i = 0; i < 16; i++) { /* Reset the color */ ! init_pair(i, i, i); ! ! /* Reset the color data */ ! colortable[i] = (COLOR_PAIR(i) | A_NORMAL); } ! /* XXX XXX XXX Take account of "gamma correction" */ /* Prepare the "Angband Colors" */ ! init_color(0, 0, 0, 0); /* Black */ ! init_color(1, 1000, 1000, 1000); /* White */ ! init_color(2, 500, 500, 500); /* Grey */ ! init_color(3, 1000, 500, 0); /* Orange */ ! init_color(4, 750, 0, 0); /* Red */ ! init_color(5, 0, 500, 250); /* Green */ ! init_color(6, 0, 0, 1000); /* Blue */ ! init_color(7, 500, 250, 0); /* Brown */ ! init_color(8, 250, 250, 250); /* Dark-grey */ ! init_color(9, 750, 750, 750); /* Light-grey */ ! init_color(10, 1000, 0, 1000); /* Purple */ ! init_color(11, 1000, 1000, 0); /* Yellow */ ! init_color(12, 1000, 0, 0); /* Light Red */ ! init_color(13, 0, 1000, 0); /* Light Green */ ! init_color(14, 0, 1000, 1000); /* Light Blue */ ! init_color(15, 750, 500, 250); /* Light Brown */ } /* Attempt to use colors */ --- 977,1010 ---- (COLORS >= 8) && (COLOR_PAIRS >= 8)); #ifdef REDEFINE_COLORS + /* Can we change colors? */ can_fix_color = (can_use_color && can_change_color() && ! (COLORS >= 16) && (COLOR_PAIRS > 8)); ! #endif /* Attempt to use customized colors */ if (can_fix_color) { /* Prepare the color pairs */ ! for (i = 1; i <= 8; i++) { /* Reset the color */ ! if (init_pair(i, i - 1, 0) == ERR) ! { ! quit("Color pair init failed"); ! } ! ! /* Set up the colormap */ ! colortable[i - 1] = (COLOR_PAIR(i) | A_NORMAL); ! colortable[i + 7] = (COLOR_PAIR(i) | A_BRIGHT); } ! /* Take account of "gamma correction" XXX XXX XXX */ /* Prepare the "Angband Colors" */ ! Term_xtra_gcu_react(); } /* Attempt to use colors */ *************** *** 921,954 **** keymap_game_prepare(); ! /*** Now prepare the term ***/ ! /* Initialize the term */ ! term_init(t, 80, 24, 256); ! /* Avoid the bottom right corner */ ! t->icky_corner = TRUE; ! /* Erase with "white space" */ ! t->attr_blank = TERM_WHITE; ! t->char_blank = ' '; ! /* Set some hooks */ ! t->init_hook = Term_init_gcu; ! t->nuke_hook = Term_nuke_gcu; ! /* Set some more hooks */ ! t->text_hook = Term_text_gcu; ! t->wipe_hook = Term_wipe_gcu; ! t->curs_hook = Term_curs_gcu; ! t->xtra_hook = Term_xtra_gcu; ! /* Save the term */ ! term_screen = t; ! /* Activate it */ ! Term_activate(term_screen); /* Success */ return (0); --- 1061,1131 ---- keymap_game_prepare(); ! /*** Now prepare the term(s) ***/ ! /* Create several terms */ ! for (i = 0; i < num_term; i++) ! { ! int rows, cols, y, x; ! /* Decide on size and position */ ! switch (i) ! { ! /* Upper left */ ! case 0: ! rows = 24; ! cols = 80; ! y = x = 0; ! break; ! ! /* Lower left */ ! case 1: ! rows = LINES - 25; ! cols = 80; ! y = 25; ! x = 0; ! break; ! ! /* Upper right */ ! case 2: ! rows = 24; ! cols = COLS - 81; ! y = 0; ! x = 81; ! break; ! ! /* Lower right */ ! case 3: ! rows = LINES - 25; ! cols = COLS - 81; ! y = 25; ! x = 81; ! break; ! ! /* XXX */ ! default: ! rows = cols = y = x = 0; ! break; ! } ! /* Skip non-existant windows */ ! if (rows <= 0 || cols <= 0) continue; ! /* Create a term */ ! term_data_init_gcu(&data[next_win], rows, cols, y, x); ! /* Remember the term */ ! angband_term[next_win] = &data[next_win].t; ! /* One more window */ ! next_win++; ! } ! /* Activate the "Angband" window screen */ ! Term_activate(&data[0].t); + /* Remember the active screen */ + term_screen = &data[0].t; /* Success */ return (0); diff -r -c angband-283/src/main-win.c angband-285/src/main-win.c *** angband-283/src/main-win.c Fri Feb 6 04:10:31 1998 --- angband-285/src/main-win.c Thu Jul 22 11:49:23 1999 *************** *** 935,941 **** term_data *td = &data[i]; sprintf(buf, "Term-%d", i); ! save_prefs_aux(td, buf); } } --- 935,941 ---- term_data *td = &data[i]; sprintf(buf, "Term-%d", i); ! save_prefs_aux(td, buf); } } *************** *** 962,968 **** /* Analyze font, save desired font name */ td->font_want = string_make(analyze_font(tmp, &wid, &hgt)); ! /* Tile size */ td->tile_wid = GetPrivateProfileInt(sec_name, "TileWid", wid, ini_file); td->tile_hgt = GetPrivateProfileInt(sec_name, "TileHgt", hgt, ini_file); --- 962,968 ---- /* Analyze font, save desired font name */ td->font_want = string_make(analyze_font(tmp, &wid, &hgt)); ! /* Tile size */ td->tile_wid = GetPrivateProfileInt(sec_name, "TileWid", wid, ini_file); td->tile_hgt = GetPrivateProfileInt(sec_name, "TileHgt", hgt, ini_file); *************** *** 984,990 **** int i; char buf[1024]; ! /* Extract the "arg_graphics" flag */ arg_graphics = (GetPrivateProfileInt("Angband", "Graphics", 0, ini_file) != 0); --- 984,990 ---- int i; char buf[1024]; ! /* Extract the "arg_graphics" flag */ arg_graphics = (GetPrivateProfileInt("Angband", "Graphics", 0, ini_file) != 0); *************** *** 997,1003 **** term_data *td = &data[i]; sprintf(buf, "Term-%d", i); ! load_prefs_aux(td, buf); } } --- 997,1003 ---- term_data *td = &data[i]; sprintf(buf, "Term-%d", i); ! load_prefs_aux(td, buf); } } *************** *** 1114,1120 **** /* Main window */ td = &data[0]; ! /* Realize the palette */ hdc = GetDC(td->w); SelectPalette(hdc, hNewPal, 0); --- 1114,1120 ---- /* Main window */ td = &data[0]; ! /* Realize the palette */ hdc = GetDC(td->w); SelectPalette(hdc, hNewPal, 0); *************** *** 1126,1132 **** for (i = 1; i < MAX_TERM_DATA; i++) { td = &data[i]; ! hdc = GetDC(td->w); SelectPalette(hdc, hNewPal, 0); ReleaseDC(td->w, hdc); --- 1126,1132 ---- for (i = 1; i < MAX_TERM_DATA; i++) { td = &data[i]; ! hdc = GetDC(td->w); SelectPalette(hdc, hNewPal, 0); ReleaseDC(td->w, hdc); *************** *** 1220,1226 **** /* Sound available */ can_use_sound = TRUE; } ! /* Result */ return (can_use_sound); } --- 1220,1226 ---- /* Sound available */ can_use_sound = TRUE; } ! /* Result */ return (can_use_sound); } *************** *** 1389,1395 **** { /* Access the standard font file */ path_build(tmp, 1024, ANGBAND_DIR_XTRA_FONT, "8X13.FON"); ! /* Force the use of that font */ (void)term_force_font(td, tmp); } --- 1389,1395 ---- { /* Access the standard font file */ path_build(tmp, 1024, ANGBAND_DIR_XTRA_FONT, "8X13.FON"); ! /* Force the use of that font */ (void)term_force_font(td, tmp); } *************** *** 1530,1536 **** { /* Warning */ plog("Cannot initialize sound!"); ! /* Cannot enable */ arg_sound = FALSE; } --- 1530,1536 ---- { /* Warning */ plog("Cannot initialize sound!"); ! /* Cannot enable */ arg_sound = FALSE; } *************** *** 2197,2209 **** /* Access the standard font file */ path_build(buf, 1024, ANGBAND_DIR_XTRA_FONT, td->font_want); ! /* Activate the chosen font */ if (term_force_font(td, buf)) { /* Access the standard font file */ path_build(buf, 1024, ANGBAND_DIR_XTRA_FONT, "8X13.FON"); ! /* Force the use of that font */ (void)term_force_font(td, buf); --- 2197,2209 ---- /* Access the standard font file */ path_build(buf, 1024, ANGBAND_DIR_XTRA_FONT, td->font_want); ! /* Activate the chosen font */ if (term_force_font(td, buf)) { /* Access the standard font file */ path_build(buf, 1024, ANGBAND_DIR_XTRA_FONT, "8X13.FON"); ! /* Force the use of that font */ (void)term_force_font(td, buf); *************** *** 2677,2683 **** if ((i < 0) || (i >= MAX_TERM_DATA)) break; td = &data[i]; ! if (!td->visible) { td->visible = TRUE; --- 2677,2683 ---- if ((i < 0) || (i >= MAX_TERM_DATA)) break; td = &data[i]; ! if (!td->visible) { td->visible = TRUE; *************** *** 2708,2714 **** if ((i < 0) || (i >= MAX_TERM_DATA)) break; td = &data[i]; ! term_change_font(td); break; --- 2708,2714 ---- if ((i < 0) || (i >= MAX_TERM_DATA)) break; td = &data[i]; ! term_change_font(td); break; *************** *** 2729,2735 **** if ((i < 0) || (i >= MAX_TERM_DATA)) break; td = &data[i]; ! td->bizarre = !td->bizarre; term_getsize(td); --- 2729,2735 ---- if ((i < 0) || (i >= MAX_TERM_DATA)) break; td = &data[i]; ! td->bizarre = !td->bizarre; term_getsize(td); *************** *** 2754,2762 **** if ((i < 0) || (i >= MAX_TERM_DATA)) break; td = &data[i]; ! td->tile_wid += 1; ! term_getsize(td); term_window_resize(td); --- 2754,2762 ---- if ((i < 0) || (i >= MAX_TERM_DATA)) break; td = &data[i]; ! td->tile_wid += 1; ! term_getsize(td); term_window_resize(td); *************** *** 2779,2787 **** if ((i < 0) || (i >= MAX_TERM_DATA)) break; td = &data[i]; ! td->tile_wid -= 1; ! term_getsize(td); term_window_resize(td); --- 2779,2787 ---- if ((i < 0) || (i >= MAX_TERM_DATA)) break; td = &data[i]; ! td->tile_wid -= 1; ! term_getsize(td); term_window_resize(td); *************** *** 2804,2812 **** if ((i < 0) || (i >= MAX_TERM_DATA)) break; td = &data[i]; ! td->tile_hgt += 1; ! term_getsize(td); term_window_resize(td); --- 2804,2812 ---- if ((i < 0) || (i >= MAX_TERM_DATA)) break; td = &data[i]; ! td->tile_hgt += 1; ! term_getsize(td); term_window_resize(td); *************** *** 2829,2837 **** if ((i < 0) || (i >= MAX_TERM_DATA)) break; td = &data[i]; ! td->tile_hgt -= 1; ! term_getsize(td); term_window_resize(td); --- 2829,2837 ---- if ((i < 0) || (i >= MAX_TERM_DATA)) break; td = &data[i]; ! td->tile_hgt -= 1; ! term_getsize(td); term_window_resize(td); *************** *** 3434,3440 **** return 0; } ! break; } } --- 3434,3440 ---- return 0; } ! break; } } *************** *** 3841,3847 **** { special_key[special_key_list[i]] = TRUE; } ! /* Determine if display is 16/256/true color */ hdc = GetDC(NULL); colors16 = (GetDeviceCaps(hdc, BITSPIXEL) == 4); --- 3841,3847 ---- { special_key[special_key_list[i]] = TRUE; } ! /* Determine if display is 16/256/true color */ hdc = GetDC(NULL); colors16 = (GetDeviceCaps(hdc, BITSPIXEL) == 4); diff -r -c angband-283/src/main-x11.c angband-285/src/main-x11.c *** angband-283/src/main-x11.c Wed Feb 11 06:30:28 1998 --- angband-285/src/main-x11.c Thu Jul 22 11:49:23 1999 *************** *** 279,285 **** { Ty += *dy1; (*py2)++; ! } } return Tmp; --- 279,285 ---- { Ty += *dy1; (*py2)++; ! } } return Tmp; diff -r -c angband-283/src/main-xaw.c angband-285/src/main-xaw.c *** angband-283/src/main-xaw.c Sat Feb 7 21:23:07 1998 --- angband-285/src/main-xaw.c Thu Jul 22 11:49:23 1999 *************** *** 270,276 **** { Ty += *dy1; (*py2)++; ! } } return Tmp; --- 270,276 ---- { Ty += *dy1; (*py2)++; ! } } return Tmp; *************** *** 525,531 **** ! /* * Hack -- see below */ #define offset(field) XtOffsetOf(AngbandRec, angband.field) --- 525,531 ---- ! /* * Hack -- see below */ #define offset(field) XtOffsetOf(AngbandRec, angband.field) diff -r -c angband-283/src/main.c angband-285/src/main.c *** angband-283/src/main.c Wed Feb 11 06:30:28 1998 --- angband-285/src/main.c Sun Sep 5 11:51:00 1999 *************** *** 330,336 **** quit("The gates to Angband are closed (bad load)."); } ! /* Acquire the "user name" as a default player name */ user_name(op_ptr->full_name, player_uid); #endif --- 330,336 ---- quit("The gates to Angband are closed (bad load)."); } ! /* Get the "user name" as a default player name */ user_name(op_ptr->full_name, player_uid); #endif *************** *** 467,473 **** /* Process the player name */ process_player_name(TRUE); - /* Install "quit" hook */ --- 467,472 ---- diff -r -c angband-283/src/melee1.c angband-285/src/melee1.c *** angband-283/src/melee1.c Wed Feb 11 06:30:28 1998 --- angband-285/src/melee1.c Sat Jul 24 16:47:27 1999 *************** *** 717,723 **** /* Take damage */ take_hit(damage, ddesc); ! /* Access the lite */ o_ptr = &inventory[INVEN_LITE]; /* Drain fuel */ --- 717,723 ---- /* Take damage */ take_hit(damage, ddesc); ! /* Get the lite */ o_ptr = &inventory[INVEN_LITE]; /* Drain fuel */ diff -r -c angband-283/src/melee2.c angband-285/src/melee2.c *** angband-283/src/melee2.c Wed Feb 11 06:30:28 1998 --- angband-285/src/melee2.c Wed Sep 1 17:25:47 1999 *************** *** 11,17 **** #include "angband.h" - #ifdef DRS_SMART_OPTIONS --- 11,16 ---- *************** *** 288,295 **** if (smart & (SM_RES_CHAOS)) { - if (int_outof(r_ptr, 100)) f5 &= ~(RF5_CONF); - if (int_outof(r_ptr, 50)) f4 &= ~(RF4_BR_CONF); if (int_outof(r_ptr, 50)) f4 &= ~(RF4_BR_CHAO); } --- 287,292 ---- *************** *** 324,329 **** --- 321,401 ---- #endif + #ifdef MONSTER_AI + + /* + * Determine if there is a space near the player in which + * a summoned creature can appear + */ + static bool summon_possible(int y1, int x1) + { + int y, x; + + /* Start at the player's location, and check 2 grids in each dir */ + for (y = y1 - 2; y <= y1 + 2; y++) + { + for (x = x1 - 2; x <= x1 + 2; x++) + { + /* Ignore illegal locations */ + if (!in_bounds(y, x)) continue; + + /* Only check a circular area */ + if (distance(y1, x1, y, x) > 2) continue; + + /* Hack: no summon on glyph of warding */ + if (cave_feat[y][x] == FEAT_GLYPH) continue; + + /* Require empty floor grid in line of sight */ + if (cave_empty_bold(y, x) && los(y1, x1, y, x)) + { + return (TRUE); + } + } + } + + return FALSE; + } + + + + /* + * Determine if a bolt spell will hit the player. + * + * This is exactly like "projectable", but it will return FALSE if a monster + * is in the way. + * + * Then we should perhaps instead supply a flag to "projectable()". XXX XXX + */ + static bool clean_shot(int y1, int x1, int y2, int x2) + { + int y, x; + + int grid_n = 0; + u16b grid_g[512]; + + /* Check the projection path */ + grid_n = project_path(grid_g, MAX_RANGE, y1, x1, y2, x2, PROJECT_STOP); + + /* Source and target the same */ + if (!grid_n) return (FALSE); + + /* Final grid */ + y = GRID_Y(grid_g[grid_n-1]); + x = GRID_X(grid_g[grid_n-1]); + + /* May not end in a wall grid */ + if (!cave_floor_bold(y, x)) return (FALSE); + + /* May not end in an unrequested grid */ + if ((y != y2) || (x != x2)) return (FALSE); + + /* Assume okay */ + return (TRUE); + } + + #endif /* MONSTER_AI */ + + /* * Cast a bolt at the player * Stop if we hit a monster *************** *** 365,370 **** --- 437,621 ---- (void)project(m_idx, rad, py, px, dam_hp, typ, flg); } + /* + * Have a monster choose a spell to cast. + * + * Note that the monster's spell list has already had "useless" spells + * (bolts that won't hit the player, summons without room, etc.) removed. + * Perhaps that should be done by this function. + * + * Stupid monsters will just pick a spell randomly. Smart monsters + * will choose more "intelligently". + * + * This function could be an efficiency bottleneck. + */ + static int choose_attack_spell(int m_idx, u32b f4, u32b f5, u32b f6) + { + monster_type *m_ptr = &m_list[m_idx]; + monster_race *r_ptr = &r_info[m_ptr->r_idx]; + + u32b f4_mask = 0L; + u32b f5_mask = 0L; + u32b f6_mask = 0L; + + bool has_escape, has_attack, has_summon, has_tactic; + bool has_annoy, has_haste, has_heal; + + int num = 0; + byte spells[96]; + + int i, py = p_ptr->py, px = p_ptr->px; + + #ifdef MONSTER_AI + + /* Smart monsters restrict their spell choices. */ + if (smart_monsters && !(r_ptr->flags2 & (RF2_STUPID))) + { + /* What have we got? */ + has_escape = ((f4 & (RF4_ESCAPE_MASK)) || + (f5 & (RF5_ESCAPE_MASK)) || + (f6 & (RF6_ESCAPE_MASK))); + has_attack = ((f4 & (RF4_ATTACK_MASK)) || + (f5 & (RF5_ATTACK_MASK)) || + (f6 & (RF6_ATTACK_MASK))); + has_summon = ((f4 & (RF4_SUMMON_MASK)) || + (f5 & (RF5_SUMMON_MASK)) || + (f6 & (RF6_SUMMON_MASK))); + has_tactic = ((f4 & (RF4_TACTIC_MASK)) || + (f5 & (RF5_TACTIC_MASK)) || + (f6 & (RF6_TACTIC_MASK))); + has_annoy = ((f4 & (RF4_ANNOY_MASK)) || + (f5 & (RF5_ANNOY_MASK)) || + (f6 & (RF6_ANNOY_MASK))); + has_haste = ((f4 & (RF4_HASTE_MASK)) || + (f5 & (RF5_HASTE_MASK)) || + (f6 & (RF6_HASTE_MASK))); + has_heal = ((f4 & (RF4_HEAL_MASK)) || + (f5 & (RF5_HEAL_MASK)) || + (f6 & (RF6_HEAL_MASK))); + + /*** Try to pick an appropriate spell type ***/ + + /* Hurt badly or afraid, attempt to flee */ + if (has_escape && ((m_ptr->hp < m_ptr->maxhp / 4) || m_ptr->monfear)) + { + /* Choose escape spell */ + f4_mask = (RF4_ESCAPE_MASK); + f5_mask = (RF5_ESCAPE_MASK); + f6_mask = (RF6_ESCAPE_MASK); + } + + /* Still hurt badly, couldn't flee, attempt to heal */ + else if (has_heal && m_ptr->hp < m_ptr->maxhp / 4) + { + /* Choose heal spell */ + f4_mask = (RF4_HEAL_MASK); + f5_mask = (RF5_HEAL_MASK); + f6_mask = (RF6_HEAL_MASK); + } + + /* Player is close and we have attack spells, blink away */ + else if (has_tactic && (distance(py, px, m_ptr->fy, m_ptr->fx) < 4) && + has_attack && (rand_int(100) < 75)) + { + /* Choose tactical spell */ + f4_mask = (RF4_TACTIC_MASK); + f5_mask = (RF5_TACTIC_MASK); + f6_mask = (RF6_TACTIC_MASK); + } + + /* We're hurt (not badly), try to heal */ + else if (has_heal && (m_ptr->hp < m_ptr->maxhp * 3 / 4) && + (rand_int(100) < 60)) + { + /* Choose heal spell */ + f4_mask = (RF4_HEAL_MASK); + f5_mask = (RF5_HEAL_MASK); + f6_mask = (RF6_HEAL_MASK); + } + + /* Summon if possible (sometimes) */ + else if (has_summon && (rand_int(100) < 50)) + { + /* Choose summon spell */ + f4_mask = (RF4_SUMMON_MASK); + f5_mask = (RF5_SUMMON_MASK); + f6_mask = (RF6_SUMMON_MASK); + } + + /* Attack spell (most of the time) */ + else if (has_attack && (rand_int(100) < 85)) + { + /* Choose attack spell */ + f4_mask = (RF4_ATTACK_MASK); + f5_mask = (RF5_ATTACK_MASK); + f6_mask = (RF6_ATTACK_MASK); + } + + /* Try another tactical spell (sometimes) */ + else if (has_tactic && (rand_int(100) < 50)) + { + /* Choose tactic spell */ + f4_mask = (RF4_TACTIC_MASK); + f5_mask = (RF5_TACTIC_MASK); + f6_mask = (RF6_TACTIC_MASK); + } + + /* Haste self if we aren't already somewhat hasted (rarely) */ + else if (has_haste && (rand_int(100) < (20 + r_ptr->speed - m_ptr->mspeed))) + { + /* Choose haste spell */ + f4_mask = (RF4_HASTE_MASK); + f5_mask = (RF5_HASTE_MASK); + f6_mask = (RF6_HASTE_MASK); + } + + /* Annoy player (most of the time) */ + else if (has_annoy && (rand_int(100) < 85)) + { + /* Choose annoyance spell */ + f4_mask = (RF4_ANNOY_MASK); + f5_mask = (RF5_ANNOY_MASK); + f6_mask = (RF6_ANNOY_MASK); + } + + /* Else choose no spell (The masks default to this.) */ + + /* Keep only the interesting spells */ + f4 &= f4_mask; + f5 &= f5_mask; + f6 &= f6_mask; + + /* Anything left? */ + if (!(f4 || f5 || f6)) return (0); + } + + #endif /* MONSTER_AI */ + + /* Extract the "innate" spells */ + for (i = 0; i < 32; i++) + { + if (f4 & (1L << i)) spells[num++] = i + 32 * 3; + } + + /* Extract the "normal" spells */ + for (i = 0; i < 32; i++) + { + if (f5 & (1L << i)) spells[num++] = i + 32 * 4; + } + + /* Extract the "bizarre" spells */ + for (i = 0; i < 32; i++) + { + if (f6 & (1L << i)) spells[num++] = i + 32 * 5; + } + + /* Paranoia */ + if (num == 0) return 0; + + /* Pick at random */ + return (spells[rand_int(num)]); + } /* *************** *** 417,425 **** int py = p_ptr->py; int px = p_ptr->px; ! int k, chance, thrown_spell, rlev; ! ! byte spell[96], num = 0; u32b f4, f5, f6; --- 668,674 ---- int py = p_ptr->py; int px = p_ptr->px; ! int k, chance, thrown_spell, rlev, failrate; u32b f4, f5, f6; *************** *** 431,436 **** --- 680,686 ---- char ddesc[80]; + bool no_innate = FALSE; /* Target player */ int x = px; *************** *** 467,475 **** --- 717,746 ---- /* Not allowed to cast spells */ if (!chance) return (FALSE); + #ifdef MONSTER_AI + + if (!smart_monsters) + { + /* Only do spells occasionally */ + if (rand_int(100) >= chance) return (FALSE); + } + else + { + /* Do spells more often, because they can fail */ + if (rand_int(100) >= 2 * chance) return (FALSE); + + /* Sometimes forbid innate attacks (breaths) */ + if (rand_int(100) >= chance) no_innate = TRUE; + } + + #else + /* Only do spells occasionally */ if (rand_int(100) >= chance) return (FALSE); + #endif /* MONSTER_AI */ + + /* Hack -- require projectable player */ if (normal) *************** *** 492,497 **** --- 763,780 ---- f6 = r_ptr->flags6; + #ifdef MONSTER_AI + + /* Forbid innate attacks sometimes */ + if (no_innate) + { + f4 &= ~(RF4_INNATE_MASK); + f5 &= ~(RF5_INNATE_MASK); + f6 &= ~(RF6_INNATE_MASK); + } + + #endif + /* Hack -- allow "desperate" spells */ if ((r_ptr->flags2 & (RF2_SMART)) && (m_ptr->hp < m_ptr->maxhp / 10) && *************** *** 517,544 **** #endif ! /* Extract the "inate" spells */ ! for (k = 0; k < 32; k++) ! { ! if (f4 & (1L << k)) spell[num++] = k + 32 * 3; ! } ! ! /* Extract the "normal" spells */ ! for (k = 0; k < 32; k++) { ! if (f5 & (1L << k)) spell[num++] = k + 32 * 4; ! } ! /* Extract the "bizarre" spells */ ! for (k = 0; k < 32; k++) ! { ! if (f6 & (1L << k)) spell[num++] = k + 32 * 5; } ! ! /* No spells left */ ! if (!num) return (FALSE); ! /* Handle "leaving" */ if (p_ptr->leaving) return (FALSE); --- 800,835 ---- #endif + #ifdef MONSTER_AI ! /* Check whether summons and bolts are worth it. */ ! if (smart_monsters && !(r_ptr->flags2 & (RF2_STUPID))) { ! /* Check for a clean bolt shot */ ! if ((f4 & (RF4_BOLT_MASK) || ! f5 & (RF5_BOLT_MASK) || ! f6 & (RF6_BOLT_MASK)) && ! !clean_shot(m_ptr->fy, m_ptr->fx, py, px)) ! { ! /* Remove spells that will only hurt friends */ ! f4 &= ~(RF4_BOLT_MASK); ! f5 &= ~(RF5_BOLT_MASK); ! f6 &= ~(RF6_BOLT_MASK); ! } ! ! /* Check for a possible summon */ ! if (!(summon_possible(py,px))) ! { ! /* Remove summoning spells */ ! f4 &= ~(RF4_SUMMON_MASK); ! f5 &= ~(RF5_SUMMON_MASK); ! f6 &= ~(RF6_SUMMON_MASK); ! } ! /* No spells left */ ! if (!f4 && !f5 && !f6) return (FALSE); } ! #endif /* MONSTER_AI */ /* Handle "leaving" */ if (p_ptr->leaving) return (FALSE); *************** *** 555,562 **** /* Choose a spell to cast */ ! thrown_spell = spell[rand_int(num)]; /* Cast the spell. */ switch (thrown_spell) --- 846,872 ---- /* Choose a spell to cast */ ! thrown_spell = choose_attack_spell(m_idx, f4, f5, f6); ! ! /* Abort if no spell was chosen */ ! if (!thrown_spell) return (FALSE); ! ! #ifdef MONSTER_AI ! /* Calculate spell failure rate */ ! failrate = 25 - (rlev + 3) / 4; ! ! /* Hack -- Stupid monsters will never fail (for jellies and such) */ ! if (!smart_monsters || r_ptr->flags2 & (RF2_STUPID)) failrate = 0; + /* Check for spell failure (innate attacks never fail) */ + if ((thrown_spell >= 128) && (rand_int(100) < failrate)) + { + /* Message */ + msg_format("%^s tries to cast a spell, but fails.", m_name); + + return (TRUE); + } + #endif /* MONSTER_AI */ /* Cast the spell. */ switch (thrown_spell) *************** *** 1662,1676 **** break; } ! /* RF6_XXX7X6 */ case 160+16: { break; } ! /* RF6_XXX8X6 */ case 160+17: { break; } --- 1972,2010 ---- break; } ! /* RF6_S_KIN */ case 160+16: { + disturb(1, 0); + if (blind) msg_format("%^s mumbles.", m_name); + else msg_format("%^s magically summons %s %s.", m_name, m_poss, + ((r_ptr->flags1) & RF1_UNIQUE ? + "minions" : "kin")); + + /* XXX XXX Set the letter of the monsters to summon. */ + summon_kin_type = r_ptr->d_char; + for (k = 0; k < 6; k++) + { + count += summon_specific(y, x, rlev, SUMMON_KIN); + } + if (blind && count) msg_print("You hear many things appear nearby."); break; } ! /* RF6_HI_DEMON */ case 160+17: { + disturb(1, 0); + if (blind) msg_format("%^s mumbles.", m_name); + else msg_format("%^s magically summons greater demons!", m_name); + for (k = 0; k < 8; k++) + { + count += summon_specific(y, x, rlev, SUMMON_HI_DEMON); + } + if (blind && count) + { + msg_print("You hear many evil things appear nearby."); + } break; } *************** *** 1895,1901 **** /* Remember what the monster did to us */ if (seen) { ! /* Inate spell */ if (thrown_spell < 32*4) { r_ptr->r_flags4 |= (1L << (thrown_spell - 32*3)); --- 2229,2235 ---- /* Remember what the monster did to us */ if (seen) { ! /* Innate spell */ if (thrown_spell < 32*4) { r_ptr->r_flags4 |= (1L << (thrown_spell - 32*3)); *************** *** 2101,2107 **** return (TRUE); } ! #endif /* --- 2435,2855 ---- return (TRUE); } ! #ifdef MONSTER_AI ! ! /* ! * Provide a location to flee to, but give the player a wide berth. ! * ! * A monster may wish to flee to a location that is behind the player, ! * but instead of heading directly for it, the monster should "swerve" ! * around the player so that he has a smaller chance of getting hit. ! */ ! static bool get_fear_moves_aux(int m_idx, int *yp, int *xp) ! { ! int y, x, y1, x1, fy, fx, py, px, gy = 0, gx = 0; ! int when = 0, score = -1; ! int i; ! ! monster_type *m_ptr = &m_list[m_idx]; ! monster_race *r_ptr = &r_info[m_ptr->r_idx]; ! ! /* Monster flowing disabled */ ! if (!flow_by_sound) return (FALSE); ! ! /* Player location */ ! py = p_ptr->py; ! px = p_ptr->px; ! ! /* Monster location */ ! fy = m_ptr->fy; ! fx = m_ptr->fx; ! ! /* Desired destination */ ! y1 = fy - (*yp); ! x1 = fx - (*xp); ! ! /* The player is not currently near the monster grid */ ! if (cave_when[fy][fx] < cave_when[py][px]) ! { ! /* No reason to attempt flowing */ ! return (FALSE); ! } ! ! /* Monster is too far away to use flow information */ ! if (cave_cost[fy][fx] > MONSTER_FLOW_DEPTH) return (FALSE); ! if (cave_cost[fy][fx] > r_ptr->aaf) return (FALSE); ! ! /* Check nearby grids, diagonals first */ ! for (i = 7; i >= 0; i--) ! { ! int dis, s; ! ! /* Get the location */ ! y = fy + ddy_ddd[i]; ! x = fx + ddx_ddd[i]; ! ! /* Ignore illegal locations */ ! if (cave_when[y][x] == 0) continue; ! ! /* Ignore ancient locations */ ! if (cave_when[y][x] < when) continue; ! ! /* Calculate distance of this grid from our destination */ ! dis = distance(y, x, y1, x1); ! ! /* Score this grid */ ! s = 5000 / (dis + 3) - 500 / (cave_cost[y][x] + 1); ! ! /* No negative scores */ ! if (s < 0) s = 0; ! ! /* Ignore lower scores */ ! if (s < score) continue; ! ! /* Save the score and time */ ! when = cave_when[y][x]; ! score = s; ! ! /* Save the location */ ! gy = y; ! gx = x; ! } ! ! /* No legal move (?) */ ! if (!when) return (FALSE); ! ! /* Find deltas */ ! (*yp) = fy - gy; ! (*xp) = fx - gx; ! ! /* Success */ ! return (TRUE); ! } ! ! #endif /* MONSTER_AI */ ! ! #endif /* MONSTER_FLOW */ ! ! ! #ifdef MONSTER_AI ! ! /* ! * Hack -- Precompute a bunch of calls to distance() in find_safety() and ! * find_hiding(). ! * ! * The pair of arrays dist_offsets_y[n] and dist_offsets_x[n] contain the ! * offsets of all the locations with a distance of n from a central point, ! * with an offset of (0,0) indicating no more offsets at this distance. ! * ! * This is, of course, fairly unreadable, but it eliminates multiple loops ! * from the previous version. ! * ! * It is probably better to replace these arrays with code to compute ! * the relevant arrays, even if the storage is pre-allocated in hard ! * coded sizes. At the very least, code should be included which is ! * able to generate and dump these arrays (ala "los()"). XXX XXX XXX ! * ! * Also, the storage needs could be halved by using bytes. XXX XXX XXX ! * ! * These arrays could be combined into two big arrays, using sub-arrays ! * to hold the offsets and lengths of each portion of the sub-arrays, and ! * this could perhaps also be used somehow in the "look" code. XXX XXX XXX ! */ ! ! ! static sint d_off_y_0[] = ! { 0 }; ! ! static sint d_off_x_0[] = ! { 0 }; ! ! ! static sint d_off_y_1[] = ! { -1, -1, -1, 0, 0, 1, 1, 1, 0 }; ! ! static sint d_off_x_1[] = ! { -1, 0, 1, -1, 1, -1, 0, 1, 0 }; ! ! ! static sint d_off_y_2[] = ! { -1, -1, -2, -2, -2, 0, 0, 1, 1, 2, 2, 2, 0 }; ! ! static sint d_off_x_2[] = ! { -2, 2, -1, 0, 1, -2, 2, -2, 2, -1, 0, 1, 0 }; ! ! ! static sint d_off_y_3[] = ! { -1, -1, -2, -2, -3, -3, -3, 0, 0, 1, 1, 2, 2, ! 3, 3, 3, 0 }; ! ! static sint d_off_x_3[] = ! { -3, 3, -2, 2, -1, 0, 1, -3, 3, -3, 3, -2, 2, ! -1, 0, 1, 0 }; ! ! ! static sint d_off_y_4[] = ! { -1, -1, -2, -2, -3, -3, -3, -3, -4, -4, -4, 0, ! 0, 1, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 0 }; ! ! static sint d_off_x_4[] = ! { -4, 4, -3, 3, -2, -3, 2, 3, -1, 0, 1, -4, 4, ! -4, 4, -3, 3, -2, -3, 2, 3, -1, 0, 1, 0 }; ! ! ! static sint d_off_y_5[] = ! { -1, -1, -2, -2, -3, -3, -4, -4, -4, -4, -5, -5, ! -5, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 4, 4, 5, 5, ! 5, 0 }; ! ! static sint d_off_x_5[] = ! { -5, 5, -4, 4, -4, 4, -2, -3, 2, 3, -1, 0, 1, ! -5, 5, -5, 5, -4, 4, -4, 4, -2, -3, 2, 3, -1, ! 0, 1, 0 }; ! ! ! static sint d_off_y_6[] = ! { -1, -1, -2, -2, -3, -3, -4, -4, -5, -5, -5, -5, ! -6, -6, -6, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, ! 5, 5, 6, 6, 6, 0 }; ! ! static sint d_off_x_6[] = ! { -6, 6, -5, 5, -5, 5, -4, 4, -2, -3, 2, 3, -1, ! 0, 1, -6, 6, -6, 6, -5, 5, -5, 5, -4, 4, -2, ! -3, 2, 3, -1, 0, 1, 0 }; ! ! ! static sint d_off_y_7[] = ! { -1, -1, -2, -2, -3, -3, -4, -4, -5, -5, -5, -5, ! -6, -6, -6, -6, -7, -7, -7, 0, 0, 1, 1, 2, 2, 3, ! 3, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 0 }; ! ! static sint d_off_x_7[] = ! { -7, 7, -6, 6, -6, 6, -5, 5, -4, -5, 4, 5, -2, ! -3, 2, 3, -1, 0, 1, -7, 7, -7, 7, -6, 6, -6, ! 6, -5, 5, -4, -5, 4, 5, -2, -3, 2, 3, -1, 0, ! 1, 0 }; ! ! ! static sint d_off_y_8[] = ! { -1, -1, -2, -2, -3, -3, -4, -4, -5, -5, -6, -6, ! -6, -6, -7, -7, -7, -7, -8, -8, -8, 0, 0, 1, 1, ! 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, ! 8, 8, 8, 0 }; ! ! static sint d_off_x_8[] = ! { -8, 8, -7, 7, -7, 7, -6, 6, -6, 6, -4, -5, 4, ! 5, -2, -3, 2, 3, -1, 0, 1, -8, 8, -8, 8, -7, ! 7, -7, 7, -6, 6, -6, 6, -4, -5, 4, 5, -2, -3, ! 2, 3, -1, 0, 1, 0 }; ! ! ! static sint d_off_y_9[] = ! { -1, -1, -2, -2, -3, -3, -4, -4, -5, -5, -6, -6, ! -7, -7, -7, -7, -8, -8, -8, -8, -9, -9, -9, 0, ! 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 7, ! 7, 8, 8, 8, 8, 9, 9, 9, 0 }; ! ! static sint d_off_x_9[] = ! { -9, 9, -8, 8, -8, 8, -7, 7, -7, 7, -6, 6, -4, ! -5, 4, 5, -2, -3, 2, 3, -1, 0, 1, -9, 9, -9, ! 9, -8, 8, -8, 8, -7, 7, -7, 7, -6, 6, -4, -5, ! 4, 5, -2, -3, 2, 3, -1, 0, 1, 0 }; ! ! ! static sint *dist_offsets_y[10] = ! { ! d_off_y_0, d_off_y_1, d_off_y_2, d_off_y_3, d_off_y_4, ! d_off_y_5, d_off_y_6, d_off_y_7, d_off_y_8, d_off_y_9 ! }; ! ! static sint *dist_offsets_x[10] = ! { ! d_off_x_0, d_off_x_1, d_off_x_2, d_off_x_3, d_off_x_4, ! d_off_x_5, d_off_x_6, d_off_x_7, d_off_x_8, d_off_x_9 ! }; ! ! #endif /* MONSTER_AI */ ! ! ! /* ! * Choose a "safe" location near a monster for it to run toward. ! * ! * A location is "safe" if it can be reached quickly and the player ! * is not able to fire into it (it isn't a "clean shot"). So, this will ! * cause monsters to "duck" behind walls. Hopefully, monsters will also ! * try to run towards corridor openings if they are in a room. ! * ! * This function may take lots of CPU time if lots of monsters are fleeing. ! * ! * Return TRUE if a safe location is available. ! */ ! static bool find_safety(int m_idx, int *yp, int *xp) ! { ! ! #ifdef MONSTER_AI ! ! monster_type *m_ptr = &m_list[m_idx]; ! ! int fy = m_ptr->fy; ! int fx = m_ptr->fx; ! ! int py = p_ptr->py; ! int px = p_ptr->px; ! ! int i, y, x, dy, dx, d, dis; ! int gy = 0, gx = 0, gdis = 0; ! ! sint *y_offsets; ! sint *x_offsets; ! ! /* Start with adjacent locations, spread further */ ! for (d = 1; d < 10; d++) ! { ! /* Get the lists of points with a distance d from (fx, fy) */ ! y_offsets = dist_offsets_y[d]; ! x_offsets = dist_offsets_x[d]; ! ! /* Check the locations */ ! for (i = 0, dx = x_offsets[0], dy = y_offsets[0]; ! dx != 0 || dy != 0; ! i++, dx = x_offsets[i], dy = y_offsets[i]) ! { ! y = fy + dy; ! x = fx + dx; ! ! /* Skip illegal locations */ ! if (!in_bounds_fully(y, x)) continue; ! ! /* Skip locations in a wall */ ! if (!cave_floor_bold(y, x)) continue; ! ! /* Check for "availability" (if monsters can flow) */ ! if (flow_by_sound) ! { ! /* Ignore grids very far from the player */ ! if (cave_when[y][x] < cave_when[py][px]) continue; ! ! /* Ignore too-distant grids */ ! if (cave_cost[y][x] > cave_cost[fy][fx] + 2 * d) continue; ! } ! ! /* Check for absence of shot (more or less) */ ! if (!player_can_see_bold(y,x)) ! { ! /* Calculate distance from player */ ! dis = distance(y, x, py, px); ! ! /* Remember if further than previous */ ! if (dis > gdis) ! { ! gy = y; ! gx = x; ! gdis = dis; ! } ! } ! } ! ! /* Check for success */ ! if (gdis > 0) ! { ! /* Good location */ ! (*yp) = fy - gy; ! (*xp) = fx - gx; ! ! /* Found safe place */ ! return (TRUE); ! } ! } ! ! #endif /* MONSTER_AI */ ! ! /* No safe place */ ! return (FALSE); ! } ! ! ! #ifdef MONSTER_AI ! ! /* ! * Choose a good hiding place near a monster for it to run toward. ! * ! * Pack monsters will use this to "ambush" the player and lure him out ! * of corridors into open space so they can swarm him. ! * ! * Return TRUE if a good location is available. ! */ ! static bool find_hiding(int m_idx, int *yp, int *xp) ! { ! monster_type *m_ptr = &m_list[m_idx]; ! ! int fy = m_ptr->fy; ! int fx = m_ptr->fx; ! ! int py = p_ptr->py; ! int px = p_ptr->px; ! ! int i, y, x, dy, dx, d, dis; ! int gy = 0, gx = 0, gdis = 999, min; ! ! sint *y_offsets, *x_offsets; ! ! /* Closest distance to get */ ! min = distance(py, px, fy, fx) * 3 / 4 + 2; ! ! /* Start with adjacent locations, spread further */ ! for (d = 1; d < 10; d++) ! { ! /* Get the lists of points with a distance d from (fx, fy) */ ! y_offsets = dist_offsets_y[d]; ! x_offsets = dist_offsets_x[d]; ! ! /* Check the locations */ ! for (i = 0, dx = x_offsets[0], dy = y_offsets[0]; ! dx != 0 || dy != 0; ! i++, dx = x_offsets[i], dy = y_offsets[i]) ! { ! y = fy + dy; ! x = fx + dx; ! ! /* Skip illegal locations */ ! if (!in_bounds_fully(y, x)) continue; ! ! /* Skip occupied locations */ ! if (!cave_empty_bold(y, x)) continue; ! ! /* Check for hidden, available grid */ ! if (!player_can_see_bold(y, x) && (clean_shot(fy, fx, y, x))) ! { ! /* Calculate distance from player */ ! dis = distance(y, x, py, px); ! ! /* Remember if closer than previous */ ! if (dis < gdis && dis >= min) ! { ! gy = y; ! gx = x; ! gdis = dis; ! } ! } ! } ! ! /* Check for success */ ! if (gdis < 999) ! { ! /* Good location */ ! (*yp) = fy - gy; ! (*xp) = fx - gx; ! ! /* Found good place */ ! return (TRUE); ! } ! } ! ! /* No good place */ ! return (FALSE); ! } ! ! #endif /* MONSTER_AI */ /* *************** *** 2109,2120 **** * * We store the directions in a special "mm" array */ ! static void get_moves(int m_idx, int mm[5]) { int py = p_ptr->py; int px = p_ptr->px; monster_type *m_ptr = &m_list[m_idx]; int y, ay, x, ax; --- 2857,2869 ---- * * We store the directions in a special "mm" array */ ! static bool get_moves(int m_idx, int mm[5]) { int py = p_ptr->py; int px = p_ptr->px; monster_type *m_ptr = &m_list[m_idx]; + monster_race *r_ptr = &r_info[m_ptr->r_idx]; int y, ay, x, ax; *************** *** 2123,2136 **** --- 2872,2888 ---- int y2 = py; int x2 = px; + bool done = FALSE; #ifdef MONSTER_FLOW + /* Flow towards the player */ if (flow_by_sound) { /* Flow towards the player */ (void)get_moves_aux(m_idx, &y2, &x2); } + #endif /* Extract the "pseudo-direction" */ *************** *** 2138,2151 **** x = m_ptr->fx - x2; /* Apply fear */ ! if (mon_will_run(m_idx)) { ! /* This is not a very "smart" method XXX XXX */ ! y = (-y); ! x = (-x); } /* Extract the "absolute distances" */ ax = ABS(x); --- 2890,2997 ---- x = m_ptr->fx - x2; + #ifdef MONSTER_AI + + /* Normal animal packs try to get the player out of corridors. */ + if (smart_packs && + (r_ptr->flags1 & RF1_FRIENDS) && (r_ptr->flags3 & RF3_ANIMAL) && + !((r_ptr->flags2 & (RF2_PASS_WALL)) || (r_ptr->flags2 & (RF2_KILL_WALL)))) + { + int i, room = 0; + + /* Count room grids next to player */ + for (i = 0; i < 8; i++) + { + /* Check grid */ + if (cave_info[py + ddy_ddd[i]][px + ddx_ddd[i]] & (CAVE_ROOM)) + { + /* One more room grid */ + room++; + } + } + + /* Not in a room and strong player */ + if ((room < 8) && (p_ptr->chp > p_ptr->mhp / 2)) + { + /* Find hiding place */ + if (find_hiding(m_idx, &y, &x)) done = TRUE; + } + } + + #endif /* MONSTER_AI */ + /* Apply fear */ ! if (!done && mon_will_run(m_idx)) ! { ! /* Try to find safe place */ ! if (!(smart_monsters && find_safety(m_idx, &y, &x))) ! { ! /* This is not a very "smart" method XXX XXX */ ! y = (-y); ! x = (-x); ! } ! ! #ifdef MONSTER_AI ! ! else ! { ! /* Attempt to avoid the player */ ! if (flow_by_sound) ! { ! /* Adjust movement */ ! if (get_fear_moves_aux(m_idx, &y, &x)) done = TRUE; ! } ! } ! ! #endif /* MONSTER_AI */ ! ! } ! ! ! #ifdef MONSTER_AI ! ! /* Monster groups try to surround the player */ ! if (!done && smart_packs && (r_ptr->flags1 & RF1_FRIENDS)) { ! int i; ! ! /* Find an empty square near the player to fill */ ! for (i = 0; i < 8; i++) ! { ! /* Pick squares near player (semi-randomly) */ ! y2 = py + ddy_ddd[(m_idx + i) & 7]; ! x2 = px + ddx_ddd[(m_idx + i) & 7]; ! ! /* Already there? */ ! if ((m_ptr->fy == y2) && (m_ptr->fx == x2)) ! { ! /* Attack the player */ ! y2 = py; ! x2 = px; ! ! break; ! } ! ! /* Ignore filled grids */ ! if (!cave_empty_bold(y2, x2)) continue; ! ! /* Try to fill this hole */ ! break; ! } ! ! /* Extract the new "pseudo-direction" */ ! y = m_ptr->fy - y2; ! x = m_ptr->fx - x2; ! ! /* Done */ ! done = TRUE; } + #endif /* MONSTER_AI */ + + + /* Check for no move */ + if (!x && !y) return (FALSE); /* Extract the "absolute distances" */ ax = ABS(x); *************** *** 2333,2338 **** --- 3179,3187 ---- break; } } + + /* Want to move */ + return (TRUE); } *************** *** 2430,2440 **** { char m_name[80]; ! /* Acquire the monster name */ monster_desc(m_name, m_ptr, 0); /* Dump a message */ msg_format("%^s wakes up.", m_name); } /* Efficiency XXX XXX */ --- 3279,3293 ---- { char m_name[80]; ! /* Get the monster name */ monster_desc(m_name, m_ptr, 0); /* Dump a message */ msg_format("%^s wakes up.", m_name); + + /* Hack -- Update the health bar */ + if (p_ptr->health_who == m_idx) + p_ptr->redraw |= (PR_HEALTH); } /* Efficiency XXX XXX */ *************** *** 2480,2491 **** { char m_name[80]; ! /* Acquire the monster name */ monster_desc(m_name, m_ptr, 0); /* Dump a message */ msg_format("%^s wakes up.", m_name); /* Hack -- Count the wakings */ if (r_ptr->r_wake < MAX_UCHAR) { --- 3333,3348 ---- { char m_name[80]; ! /* Get the monster name */ monster_desc(m_name, m_ptr, 0); /* Dump a message */ msg_format("%^s wakes up.", m_name); + /* Hack -- Update the health bar */ + if (p_ptr->health_who == m_idx) + p_ptr->redraw |= (PR_HEALTH); + /* Hack -- Count the wakings */ if (r_ptr->r_wake < MAX_UCHAR) { *************** *** 2530,2540 **** { char m_name[80]; ! /* Acquire the monster name */ monster_desc(m_name, m_ptr, 0); /* Dump a message */ msg_format("%^s is no longer stunned.", m_name); } } --- 3387,3401 ---- { char m_name[80]; ! /* Get the monster name */ monster_desc(m_name, m_ptr, 0); /* Dump a message */ msg_format("%^s is no longer stunned.", m_name); + + /* Hack -- Update the health bar */ + if (p_ptr->health_who == m_idx) + p_ptr->redraw |= (PR_HEALTH); } } *************** *** 2566,2576 **** { char m_name[80]; ! /* Acquire the monster name */ monster_desc(m_name, m_ptr, 0); /* Dump a message */ msg_format("%^s is no longer confused.", m_name); } } } --- 3427,3441 ---- { char m_name[80]; ! /* Get the monster name */ monster_desc(m_name, m_ptr, 0); /* Dump a message */ msg_format("%^s is no longer confused.", m_name); + + /* Hack -- Update the health bar */ + if (p_ptr->health_who == m_idx) + p_ptr->redraw |= (PR_HEALTH); } } } *************** *** 2601,2612 **** char m_name[80]; char m_poss[80]; ! /* Acquire the monster name/poss */ monster_desc(m_name, m_ptr, 0); monster_desc(m_poss, m_ptr, 0x22); /* Dump a message */ msg_format("%^s recovers %s courage.", m_name, m_poss); } } } --- 3466,3481 ---- char m_name[80]; char m_poss[80]; ! /* Get the monster name/poss */ monster_desc(m_name, m_ptr, 0); monster_desc(m_poss, m_ptr, 0x22); /* Dump a message */ msg_format("%^s recovers %s courage.", m_name, m_poss); + + /* Hack -- Update the health bar */ + if (p_ptr->health_who == m_idx) + p_ptr->redraw |= (PR_HEALTH); } } } *************** *** 2714,2721 **** /* Normal movement */ if (!stagger) { ! /* Logical moves */ ! get_moves(m_idx, mm); } --- 3583,3590 ---- /* Normal movement */ if (!stagger) { ! /* Logical moves, may do nothing */ ! if (!get_moves(m_idx, mm)) return; } *************** *** 2922,2928 **** (r_ptr->flags1 & (RF1_NEVER_BLOW))) { /* Hack -- memorize lack of attacks */ ! /* if (m_ptr->ml) r_ptr->r_flags1 |= (RF1_NEVER_BLOW); */ /* Do not move */ do_move = FALSE; --- 3791,3797 ---- (r_ptr->flags1 & (RF1_NEVER_BLOW))) { /* Hack -- memorize lack of attacks */ ! if (m_ptr->ml) r_ptr->r_flags1 |= (RF1_NEVER_BLOW); /* Do not move */ do_move = FALSE; *************** *** 2947,2953 **** if (do_move && (r_ptr->flags1 & (RF1_NEVER_MOVE))) { /* Hack -- memorize lack of attacks */ ! /* if (m_ptr->ml) r_ptr->r_flags1 |= (RF1_NEVER_MOVE); */ /* Do not move */ do_move = FALSE; --- 3816,3822 ---- if (do_move && (r_ptr->flags1 & (RF1_NEVER_MOVE))) { /* Hack -- memorize lack of attacks */ ! if (m_ptr->ml) r_ptr->r_flags1 |= (RF1_NEVER_MOVE); /* Do not move */ do_move = FALSE; *************** *** 3030,3039 **** { 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 gold */ --- 3899,3908 ---- { 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 gold */ *************** *** 3053,3062 **** /* Extract some flags */ object_flags(o_ptr, &f1, &f2, &f3); ! /* Acquire the object name */ object_desc(o_name, o_ptr, TRUE, 3); ! /* Acquire the monster name */ monster_desc(m_name, m_ptr, 0x04); /* React to objects that hurt the monster */ --- 3922,3931 ---- /* Extract some flags */ object_flags(o_ptr, &f1, &f2, &f3); ! /* Get the object name */ object_desc(o_name, o_ptr, TRUE, 3); ! /* Get the monster name */ monster_desc(m_name, m_ptr, 0x04); /* React to objects that hurt the monster */ *************** *** 3143,3148 **** --- 4012,4024 ---- } + /* If we haven't done anything, try casting a spell again */ + if (smart_monsters && !do_turn && !do_move) + { + /* Cast spell */ + if (make_attack_spell(m_idx)) return; + } + /* Notice changes in view */ if (do_view) { *************** *** 3194,3200 **** { char m_name[80]; ! /* Acquire the monster name */ monster_desc(m_name, m_ptr, 0); /* Dump a message */ --- 4070,4076 ---- { char m_name[80]; ! /* Get the monster name */ monster_desc(m_name, m_ptr, 0); /* Dump a message */ *************** *** 3254,3260 **** /* Process the monsters */ for (i = 1; i < m_max; i++) { ! /* Access the monster */ m_ptr = &m_list[i]; /* Ignore "dead" monsters */ --- 4130,4136 ---- /* Process the monsters */ for (i = 1; i < m_max; i++) { ! /* Get the monster */ m_ptr = &m_list[i]; /* Ignore "dead" monsters */ *************** *** 3273,3279 **** if (p_ptr->leaving) break; ! /* Access the monster */ m_ptr = &m_list[i]; --- 4149,4155 ---- if (p_ptr->leaving) break; ! /* Get the monster */ m_ptr = &m_list[i]; *************** *** 3302,3308 **** /* Heal monster? XXX XXX XXX */ ! /* Access the race */ r_ptr = &r_info[m_ptr->r_idx]; /* Monsters can "sense" the player */ --- 4178,4184 ---- /* Heal monster? XXX XXX XXX */ ! /* Get the race */ r_ptr = &r_info[m_ptr->r_idx]; /* Monsters can "sense" the player */ *************** *** 3316,3322 **** } ! /* Access the location */ fx = m_ptr->fx; fy = m_ptr->fy; --- 4192,4198 ---- } ! /* Get the location */ fx = m_ptr->fx; fy = m_ptr->fy; diff -r -c angband-283/src/monster1.c angband-285/src/monster1.c *** angband-283/src/monster1.c Wed Feb 11 06:30:29 1998 --- angband-285/src/monster1.c Sat Jul 24 16:55:20 1999 *************** *** 148,154 **** #endif ! /* Access the race and lore */ r_ptr = &r_info[r_idx]; --- 148,154 ---- #endif ! /* Get the race and lore */ r_ptr = &r_info[r_idx]; *************** *** 158,164 **** /* XXX XXX XXX */ /* Hack -- save memory */ ! COPY(&save_mem, r_ptr, monster_type); /* Hack -- Maximal kills */ r_ptr->r_tkills = MAX_SHORT; --- 158,164 ---- /* XXX XXX XXX */ /* Hack -- save memory */ ! COPY(&save_mem, r_ptr, monster_race); /* Hack -- Maximal kills */ r_ptr->r_tkills = MAX_SHORT; *************** *** 741,748 **** if (flags6 & (RF6_TRAPS)) vp[vn++] = "create traps"; if (flags6 & (RF6_FORGET)) vp[vn++] = "cause amnesia"; if (flags6 & (RF6_XXX6)) vp[vn++] = "do something"; ! if (flags6 & (RF6_XXX7)) vp[vn++] = "do something"; ! if (flags6 & (RF6_XXX8)) vp[vn++] = "do something"; if (flags6 & (RF6_S_MONSTER)) vp[vn++] = "summon a monster"; if (flags6 & (RF6_S_MONSTERS)) vp[vn++] = "summon monsters"; if (flags6 & (RF6_S_ANT)) vp[vn++] = "summon ants"; --- 741,747 ---- if (flags6 & (RF6_TRAPS)) vp[vn++] = "create traps"; if (flags6 & (RF6_FORGET)) vp[vn++] = "cause amnesia"; if (flags6 & (RF6_XXX6)) vp[vn++] = "do something"; ! if (flags6 & (RF6_S_KIN)) vp[vn++] = "summon similar monsters"; if (flags6 & (RF6_S_MONSTER)) vp[vn++] = "summon a monster"; if (flags6 & (RF6_S_MONSTERS)) vp[vn++] = "summon monsters"; if (flags6 & (RF6_S_ANT)) vp[vn++] = "summon ants"; *************** *** 755,760 **** --- 754,760 ---- if (flags6 & (RF6_S_DRAGON)) vp[vn++] = "summon a dragon"; if (flags6 & (RF6_S_HI_UNDEAD)) vp[vn++] = "summon Greater Undead"; if (flags6 & (RF6_S_HI_DRAGON)) vp[vn++] = "summon Ancient Dragons"; + if (flags6 & (RF6_S_HI_DEMON)) vp[vn++] = "summon Greater Demons"; if (flags6 & (RF6_S_WRAITH)) vp[vn++] = "summon Ring Wraiths"; if (flags6 & (RF6_S_UNIQUE)) vp[vn++] = "summon Unique Monsters"; *************** *** 1206,1212 **** /* No method yet */ p = NULL; ! /* Acquire the method */ switch (method) { case RBM_HIT: p = "hit"; break; --- 1206,1212 ---- /* No method yet */ p = NULL; ! /* Get the method */ switch (method) { case RBM_HIT: p = "hit"; break; *************** *** 1239,1245 **** /* Default effect */ q = NULL; ! /* Acquire the effect */ switch (effect) { case RBE_HURT: q = "attack"; break; --- 1239,1245 ---- /* Default effect */ q = NULL; ! /* Get the effect */ switch (effect) { case RBE_HURT: q = "attack"; break; *************** *** 1350,1356 **** if (cheat_know) { /* Hack -- restore memory */ ! COPY(r_ptr, &save_mem, monster_type); } } --- 1350,1356 ---- if (cheat_know) { /* Hack -- restore memory */ ! COPY(r_ptr, &save_mem, monster_race); } } *************** *** 1369,1379 **** 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; --- 1369,1379 ---- 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/monster2.c angband-285/src/monster2.c *** angband-283/src/monster2.c Wed Feb 11 06:30:29 1998 --- angband-285/src/monster2.c Sun Sep 5 11:38:55 1999 *************** *** 56,65 **** { object_type *o_ptr; ! /* Acquire object */ o_ptr = &o_list[this_o_idx]; ! /* Acquire next object */ next_o_idx = o_ptr->next_o_idx; /* Hack -- efficiency */ --- 56,65 ---- { 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; /* Hack -- efficiency */ *************** *** 126,135 **** { object_type *o_ptr; ! /* Acquire object */ o_ptr = &o_list[this_o_idx]; ! /* Acquire next object */ next_o_idx = o_ptr->next_o_idx; /* Reset monster pointer */ --- 126,135 ---- { 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; /* Reset monster pointer */ *************** *** 287,293 **** /* ! * Acquires and returns the index of a "free" monster. * * This routine should almost never fail, but it *can* happen. */ --- 287,293 ---- /* ! * Get and return the index of a "free" monster. * * This routine should almost never fail, but it *can* happen. */ *************** *** 299,305 **** /* Normal allocation */ if (m_max < MAX_M_IDX) { ! /* Access the next hole */ i = m_max; /* Expand the array */ --- 299,305 ---- /* Normal allocation */ if (m_max < MAX_M_IDX) { ! /* Get the next hole */ i = m_max; /* Expand the array */ *************** *** 318,324 **** { monster_type *m_ptr; ! /* Acquire monster */ m_ptr = &m_list[i]; /* Skip live monsters */ --- 318,324 ---- { monster_type *m_ptr; ! /* Get the monster */ m_ptr = &m_list[i]; /* Skip live monsters */ *************** *** 449,458 **** /* Hack -- No town monsters in dungeon */ if ((level > 0) && (table[i].level <= 0)) continue; ! /* Access the "r_idx" of the chosen monster */ r_idx = table[i].index; ! /* Access the actual race */ r_ptr = &r_info[r_idx]; /* Hack -- "unique" monsters must be "unique" */ --- 449,458 ---- /* Hack -- No town monsters in dungeon */ if ((level > 0) && (table[i].level <= 0)) continue; ! /* Get the "r_idx" of the chosen monster */ r_idx = table[i].index; ! /* Get the actual race */ r_ptr = &r_info[r_idx]; /* Hack -- "unique" monsters must be "unique" */ *************** *** 1115,1133 **** monster_type *m_ptr = &m_list[m_idx]; - /* Option -- allow carrying */ - if (!testing_carry) return (0); - - /* Scan objects already being held for combination */ for (this_o_idx = m_ptr->hold_o_idx; this_o_idx; this_o_idx = next_o_idx) { object_type *o_ptr; ! /* Acquire object */ o_ptr = &o_list[this_o_idx]; ! /* Acquire next object */ next_o_idx = o_ptr->next_o_idx; /* Check for combination */ --- 1115,1129 ---- monster_type *m_ptr = &m_list[m_idx]; /* Scan objects already being held for combination */ for (this_o_idx = m_ptr->hold_o_idx; this_o_idx; this_o_idx = next_o_idx) { 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; /* Check for combination */ *************** *** 1162,1174 **** /* Forget location */ o_ptr->iy = o_ptr->ix = 0; ! /* Memorize monster */ o_ptr->held_m_idx = m_idx; ! /* Build stack */ o_ptr->next_o_idx = m_ptr->hold_o_idx; ! /* Build stack */ m_ptr->hold_o_idx = o_idx; } --- 1158,1170 ---- /* Forget location */ o_ptr->iy = o_ptr->ix = 0; ! /* Link the object to the monster */ o_ptr->held_m_idx = m_idx; ! /* Link the object to the pile */ o_ptr->next_o_idx = m_ptr->hold_o_idx; ! /* Link the monster to the object */ m_ptr->hold_o_idx = o_idx; } *************** *** 1315,1321 **** /* Make a new monster */ cave_m_idx[y][x] = m_idx; ! /* Acquire new monster */ m_ptr = &m_list[m_idx]; /* Copy the monster XXX */ --- 1311,1317 ---- /* Make a new monster */ cave_m_idx[y][x] = m_idx; ! /* Get the new monster */ m_ptr = &m_list[m_idx]; /* Copy the monster XXX */ *************** *** 1328,1334 **** /* Update the monster */ update_mon(m_idx, TRUE); ! /* Acquire new race */ r_ptr = &r_info[m_ptr->r_idx]; /* Hack -- Notice new multi-hued monsters */ --- 1324,1330 ---- /* Update the monster */ update_mon(m_idx, TRUE); ! /* Get the new race */ r_ptr = &r_info[m_ptr->r_idx]; /* Hack -- Notice new multi-hued monsters */ *************** *** 1947,1952 **** --- 1943,1955 ---- break; } + case SUMMON_KIN: + { + okay = ((r_ptr->d_char == summon_kin_type) && + !(r_ptr->flags1 & (RF1_UNIQUE))); + break; + } + case SUMMON_HI_UNDEAD: { okay = ((r_ptr->d_char == 'L') || *************** *** 1961,1966 **** --- 1964,1975 ---- break; } + case SUMMON_HI_DEMON: + { + okay = (r_ptr->d_char == 'U'); + break; + } + case SUMMON_WRAITH: { okay = ((r_ptr->d_char == 'W') && *************** *** 1986,1994 **** * * We will attempt to place the monster up to 10 times before giving up. * ! * Note: SUMMON_UNIQUE and SUMMON_WRAITH (XXX) will summon Unique's ! * Note: SUMMON_HI_UNDEAD and SUMMON_HI_DRAGON may summon Unique's ! * Note: None of the other summon codes will ever summon Unique's. * * This function has been changed. We now take the "monster level" * of the summoning monster as a parameter, and use that, along with --- 1995,2003 ---- * * We will attempt to place the monster up to 10 times before giving up. * ! * Note: SUMMON_UNIQUE and SUMMON_WRAITH (XXX) will summon Uniques ! * Note: SUMMON_HI_UNDEAD and SUMMON_HI_DRAGON may summon Uniques ! * Note: None of the other summon codes will ever summon Uniques. * * This function has been changed. We now take the "monster level" * of the summoning monster as a parameter, and use that, along with diff -r -c angband-283/src/object1.c angband-285/src/object1.c *** angband-283/src/object1.c Wed Feb 11 06:30:29 1998 --- angband-285/src/object1.c Sun Sep 5 12:48:21 1999 *************** *** 12,30 **** /* ! * Hack -- note that "TERM_MULTI" is now just "TERM_VIOLET". ! * We will have to find a cleaner method for "MULTI_HUED" later. ! * There were only two multi-hued "flavors" (one potion, one food). ! * Plus five multi-hued "base-objects" (3 dragon scales, one blade ! * of chaos, and one something else). See the SHIMMER_OBJECTS code ! * in "dungeon.c" and the object color extractor in "cave.c". ! * Currently, the "SHIMMER_OBJECTS" code is disabled anyway. ! */ ! #define TERM_MULTI TERM_VIOLET ! ! ! /* ! * Max sizes of the following arrays */ #define MAX_ROCKS 42 /* Used with rings (min 38) */ #define MAX_AMULETS 16 /* Used with amulets (min 13) */ --- 12,18 ---- /* ! * Max sizes of the following arrays. */ #define MAX_ROCKS 42 /* Used with rings (min 38) */ #define MAX_AMULETS 16 /* Used with amulets (min 13) */ *************** *** 37,43 **** /* ! * Rings (adjectives and colors) */ static cptr ring_adj[MAX_ROCKS] = --- 25,31 ---- /* ! * Rings (adjectives and colors). */ static cptr ring_adj[MAX_ROCKS] = *************** *** 68,74 **** /* ! * Amulets (adjectives and colors) */ static cptr amulet_adj[MAX_AMULETS] = --- 56,62 ---- /* ! * Amulets (adjectives and colors). */ static cptr amulet_adj[MAX_AMULETS] = *************** *** 89,95 **** /* ! * Staffs (adjectives and colors) */ static cptr staff_adj[MAX_WOODS] = --- 77,83 ---- /* ! * Staffs (adjectives and colors). */ static cptr staff_adj[MAX_WOODS] = *************** *** 116,122 **** /* ! * Wands (adjectives and colors) */ static cptr wand_adj[MAX_METALS] = --- 104,110 ---- /* ! * Wands (adjectives and colors). */ static cptr wand_adj[MAX_METALS] = *************** *** 144,150 **** /* * Rods (adjectives and colors). ! * Efficiency -- copied from wand arrays */ static cptr rod_adj[MAX_METALS]; --- 132,139 ---- /* * Rods (adjectives and colors). ! * ! * Efficiency -- copied from wand arrays. */ static cptr rod_adj[MAX_METALS]; *************** *** 153,159 **** /* ! * Mushrooms (adjectives and colors) */ static cptr food_adj[MAX_SHROOM] = --- 142,148 ---- /* ! * Mushrooms (adjectives and colors). */ static cptr food_adj[MAX_SHROOM] = *************** *** 175,182 **** /* * Color adjectives and colors, for potions. ! * Hack -- The first four entries are hard-coded. ! * (water, apple juice, slime mold juice, something) */ static cptr potion_adj[MAX_COLORS] = --- 164,172 ---- /* * Color adjectives and colors, for potions. ! * ! * Hack -- The first four entries (water, apple juice, slime mold juice, ! * and undefined) are hard-coded. */ static cptr potion_adj[MAX_COLORS] = *************** *** 208,219 **** TERM_RED, TERM_RED, TERM_L_WHITE, TERM_L_DARK, TERM_ORANGE, TERM_VIOLET, TERM_RED, TERM_WHITE, TERM_YELLOW, TERM_VIOLET, TERM_L_RED, TERM_RED, TERM_L_RED, TERM_YELLOW, TERM_GREEN, ! TERM_MULTI, TERM_RED, TERM_YELLOW, TERM_YELLOW }; /* ! * Syllables for scrolls (must be 1-4 letters each) */ static cptr syllables[MAX_SYLLABLES] = --- 198,209 ---- TERM_RED, TERM_RED, TERM_L_WHITE, TERM_L_DARK, TERM_ORANGE, TERM_VIOLET, TERM_RED, TERM_WHITE, TERM_YELLOW, TERM_VIOLET, TERM_L_RED, TERM_RED, TERM_L_RED, TERM_YELLOW, TERM_GREEN, ! TERM_VIOLET, TERM_RED, TERM_YELLOW, TERM_YELLOW }; /* ! * Syllables for scrolls (must be 1-4 letters each). */ static cptr syllables[MAX_SYLLABLES] = *************** *** 242,249 **** /* ! * Hold the titles of scrolls, 6 to 14 characters each ! * Also keep an array of scroll colors (always WHITE for now) */ static char scroll_adj[MAX_TITLES][16]; --- 232,240 ---- /* ! * Hold the titles of scrolls, 6 to 14 characters each. ! * ! * Also keep an array of scroll colors (always WHITE for now). */ static char scroll_adj[MAX_TITLES][16]; *************** *** 256,262 **** /* ! * Certain items have a flavor * This function is used only by "flavor_init()" */ static bool object_flavor(int k_idx) --- 247,254 ---- /* ! * Certain items have a flavor. ! * * This function is used only by "flavor_init()" */ static bool object_flavor(int k_idx) *************** *** 318,325 **** /* ! * Certain items, if aware, are known instantly ! * This function is used only by "flavor_init()" * * Add "EASY_KNOW" flag to "k_info.txt" file. XXX XXX XXX */ --- 310,318 ---- /* ! * Certain items, if aware, are known instantly. ! * ! * This function is used only by "flavor_init()". * * Add "EASY_KNOW" flag to "k_info.txt" file. XXX XXX XXX */ *************** *** 932,944 **** * Note that the inscription will be clipped to keep the total description * under 79 chars (plus a terminator). * * Note the use of "object_desc_int_macro()" and "object_desc_num_macro()" * and "object_desc_str_macro()" and "object_desc_chr_macro()" as extremely ! * efficient, portable, versions of some common "sprintf()" (or "strfmt()") ! * commands. * * Note that all ego-items (when known) append an "Ego-Item Name", unless ! * the item is also an artifact, which should NEVER happen. * * Note that all artifacts (when known) append an "Artifact Name", so we * have special processing for "Specials" (artifact Lites, Rings, Amulets). --- 925,951 ---- * Note that the inscription will be clipped to keep the total description * under 79 chars (plus a terminator). * + * This function does no bounds checking. If object names are altered to + * be longer than 79 characters, it will cause problems. Of course, all + * kinds of user interface code would break anyway, since they sometimes + * assume that every object name can fit in an 80 (or even 77) character + * display. If SAFE_OBJECT_DESC is defined, this function will use a big + * temporary array to create the description, and will then copy up to 79 + * characters from this array into the buffer, which will prevent crashes + * (but not ugliness) if any object name uses more than 79 characters. + * * Note the use of "object_desc_int_macro()" and "object_desc_num_macro()" * and "object_desc_str_macro()" and "object_desc_chr_macro()" as extremely ! * efficient, portable, versions of some common "strfmt()" commands (without ! * the bounds checking or termination writing), which allow a pointer to ! * efficiently move through a buffer while modifying it in various ways. ! * ! * Various improper uses and/or placements of "&" or "~" characters can ! * easily induce out-of-bounds memory accesses. Some of these could be ! * easily checked for, if efficiency was not a concern. * * Note that all ego-items (when known) append an "Ego-Item Name", unless ! * the item is also an artifact, which should never happen. * * Note that all artifacts (when known) append an "Artifact Name", so we * have special processing for "Specials" (artifact Lites, Rings, Amulets). *************** *** 961,966 **** --- 968,974 ---- * The "pluralization" rules are extremely hackish, in fact, for efficiency, * we only handle things like "torch"/"torches" and "cutlass"/"cutlasses", * and we would not handle "box"/"boxes", or "knife"/"knives", correctly. + * Of course, it would be easy to add rules for these forms. * * If "pref" is true then a "numeric" prefix will be pre-pended, else is is * assumed that a string such as "The" or "Your" will be pre-pended later. *************** *** 979,985 **** */ void object_desc(char *buf, object_type *o_ptr, int pref, int mode) { ! cptr basenm, modstr; int power; --- 987,994 ---- */ void object_desc(char *buf, object_type *o_ptr, int pref, int mode) { ! cptr basenm; ! cptr modstr; int power; *************** *** 993,1001 **** --- 1002,1013 ---- bool show_weapon; bool show_armour; + char *b; + char *t; cptr s; + cptr u; cptr v; *************** *** 1003,1009 **** char b1 = '[', b2 = ']'; char c1 = '{', c2 = '}'; ! char tmp_val[160]; u32b f1, f2, f3; --- 1015,1027 ---- char b1 = '[', b2 = ']'; char c1 = '{', c2 = '}'; ! char discount_buf[80]; ! ! #ifdef SAFE_OBJECT_DESC ! ! char tmp_buf[1024]; ! ! #endif u32b f1, f2, f3; *************** *** 1100,1106 **** /* Color the object */ modstr = amulet_adj[o_ptr->sval]; if (aware) append_name = TRUE; ! basenm = (flavor ? "& # Amulet ~" : "& Amulet~"); break; } --- 1118,1124 ---- /* Color the object */ modstr = amulet_adj[o_ptr->sval]; if (aware) append_name = TRUE; ! basenm = (flavor ? "& # Amulet~" : "& Amulet~"); break; } *************** *** 1226,1240 **** } /* Start dumping the result */ ! t = buf; ! /* The object "expects" a "number" */ ! if (basenm[0] == '&') { ! /* Skip the ampersand (and space) */ ! s = basenm + 2; /* No prefix */ if (!pref) --- 1244,1272 ---- } + #ifdef SAFE_OBJECT_DESC + /* Start dumping the result */ ! t = b = tmp_buf; + #else + + /* Start dumping the result */ + t = b = buf; ! #endif ! ! /* Begin */ ! s = basenm; ! ! /* Handle objects which sometimes use "a" or "an" */ ! if (*s == '&') { ! /* Paranoia XXX XXX XXX */ ! /* ASSERT(s[1] == ' '); */ ! ! /* Skip the ampersand and the following space */ ! s += 2; /* No prefix */ if (!pref) *************** *** 1261,1267 **** object_desc_str_macro(t, "The "); } ! /* A single one, and next character will be a vowel */ else if ((*s == '#') ? is_a_vowel(modstr[0]) : is_a_vowel(*s)) { object_desc_str_macro(t, "an "); --- 1293,1299 ---- object_desc_str_macro(t, "The "); } ! /* Hack -- A single one, and next character will be a vowel */ else if ((*s == '#') ? is_a_vowel(modstr[0]) : is_a_vowel(*s)) { object_desc_str_macro(t, "an "); *************** *** 1274,1285 **** } } ! /* Hack -- objects that "never" take an article */ else { - /* No ampersand */ - s = basenm; - /* No pref */ if (!pref) { --- 1306,1314 ---- } } ! /* Handle objects which never use "a" or "an" */ else { /* No pref */ if (!pref) { *************** *** 1314,1320 **** /* Paranoia XXX XXX XXX */ ! /* while (*s == '~') s++; */ /* Copy the string */ for (; *s; s++) --- 1343,1349 ---- /* Paranoia XXX XXX XXX */ ! /* ASSERT(*s != '~'); */ /* Copy the string */ for (; *s; s++) *************** *** 1338,1345 **** /* Modifier */ else if (*s == '#') { ! /* Insert the modifier */ ! for (u = modstr; *u; u++) *t++ = *u; } /* Normal */ --- 1367,1374 ---- /* Modifier */ else if (*s == '#') { ! /* Append the modifier */ ! object_desc_str_macro(t, modstr); } /* Normal */ *************** *** 1383,1394 **** /* No more details wanted */ ! if (mode < 1) ! { ! /* Terminate and return */ ! *t = '\0'; ! return; ! } /* Hack -- Chests must be described in detail */ --- 1412,1418 ---- /* No more details wanted */ ! if (mode < 1) goto object_desc_done; /* Hack -- Chests must be described in detail */ *************** *** 1411,1417 **** /* May be "disarmed" */ else if (o_ptr->pval < 0) { ! if (chest_traps[o_ptr->pval]) { tail = " (disarmed)"; } --- 1435,1441 ---- /* May be "disarmed" */ else if (o_ptr->pval < 0) { ! if (chest_traps[0 - o_ptr->pval]) { tail = " (disarmed)"; } *************** *** 1602,1613 **** /* No more details wanted */ ! if (mode < 2) ! { ! /* Terminate and return */ ! *t = '\0'; ! return; ! } /* Hack -- Wands and Staffs have charges */ --- 1626,1632 ---- /* No more details wanted */ ! if (mode < 2) goto object_desc_done; /* Hack -- Wands and Staffs have charges */ *************** *** 1749,1808 **** /* No more details wanted */ ! if (mode < 3) { ! /* Terminate and return */ ! *t = '\0'; ! return; } - /* Default to nothing */ - v = NULL; ! /* Use the standard inscription if available */ ! if (o_ptr->note) { ! v = quark_str(o_ptr->note); } ! /* Note "cursed" if the item is known to be cursed */ ! else if (cursed_p(o_ptr) && (known || (o_ptr->ident & (IDENT_SENSE)))) { v = "cursed"; } ! /* Mega-Hack -- note empty wands/staffs */ else if (!known && (o_ptr->ident & (IDENT_EMPTY))) { v = "empty"; } ! /* Note "tried" if the object has been tested unsuccessfully */ else if (!aware && object_tried_p(o_ptr)) { v = "tried"; } ! /* Note the discount, if any */ ! else if (o_ptr->discount) { ! char *q = tmp_val; object_desc_num_macro(q, o_ptr->discount); ! strcpy(q, "% off"); ! v = tmp_val; } ! /* Append the inscription, if any */ ! if (v) { ! /* Append the inscription */ ! object_desc_chr_macro(t, ' '); ! object_desc_chr_macro(t, c1); ! while ((t < buf + 75) && *v) *t++ = *v++; ! object_desc_chr_macro(t, c2); } /* Terminate */ *t = '\0'; } --- 1768,1879 ---- /* No more details wanted */ ! if (mode < 3) goto object_desc_done; ! ! ! /* Use standard inscription */ ! if (o_ptr->note) { ! u = quark_str(o_ptr->note); } + /* Use nothing */ + else + { + u = NULL; + } ! /* Use special inscription, if any */ ! if (o_ptr->discount >= INSCRIP_NULL) { ! v = inscrip_text[o_ptr->discount - INSCRIP_NULL]; } ! /* Use "cursed" if the item is known to be cursed */ ! else if (cursed_p(o_ptr) && known) { v = "cursed"; } ! /* Hack -- Use "empty" for empty wands/staffs */ else if (!known && (o_ptr->ident & (IDENT_EMPTY))) { v = "empty"; } ! /* Use "tried" if the object has been tested unsuccessfully */ else if (!aware && object_tried_p(o_ptr)) { v = "tried"; } ! /* Use the discount, if any */ ! else if (o_ptr->discount > 0) { ! char *q = discount_buf; object_desc_num_macro(q, o_ptr->discount); ! object_desc_str_macro(q, "% off"); ! *q = '\0'; ! v = discount_buf; } ! /* Nothing */ ! else { ! v = NULL; } + + /* Inscription */ + if (u || v) + { + /* Begin the inscription */ + *t++ = ' '; + *t++ = c1; + + /* Standard inscription */ + if (u) + { + /* Append the inscription */ + while ((t < b + 75) && *u) *t++ = *u++; + } + + /* Special inscription too */ + if (u && v && (t < b + 75)) + { + /* Separator */ + *t++ = ','; + *t++ = ' '; + } + + /* Special inscription */ + if (v) + { + /* Append the inscription */ + while ((t < b + 75) && *v) *t++ = *v++; + } + + /* Terminate the inscription */ + *t++ = c2; + } + + + object_desc_done: + + #ifdef SAFE_OBJECT_DESC + + /* Terminate */ + tmp_buf[79] = '\0'; + + /* Reset */ + t = buf; + + /* Copy the string over */ + object_desc_str_macro(t, tmp_buf); + + #endif SAFE_OBJECT_DESC + /* Terminate */ *t = '\0'; } *************** *** 2131,2137 **** } case SV_DRAGON_BALANCE: { ! return "You breathe balance (250) every 300+d300 turns"; } case SV_DRAGON_SHINING: { --- 2202,2208 ---- } case SV_DRAGON_BALANCE: { ! return "breathe balance (250) every 300+d300 turns"; } case SV_DRAGON_SHINING: { *************** *** 2558,2563 **** --- 2629,2637 ---- /* Label the information */ prt(" Item Attributes:", 1, 0); + + /* Back to the top */ + k = 2; } } *************** *** 2577,2583 **** /* ! * Convert an inventory index into a one character label * Note that the label does NOT distinguish inven/equip. */ s16b index_to_label(int i) --- 2651,2658 ---- /* ! * Convert an inventory index into a one character label. ! * * Note that the label does NOT distinguish inven/equip. */ s16b index_to_label(int i) *************** *** 2591,2598 **** /* ! * Convert a label into the index of an item in the "inven" ! * Return "-1" if the label does not indicate a real item */ s16b label_to_inven(int c) { --- 2666,2674 ---- /* ! * Convert a label into the index of an item in the "inven". ! * ! * Return "-1" if the label does not indicate a real item. */ s16b label_to_inven(int c) { *************** *** 2613,2620 **** /* ! * Convert a label into the index of a item in the "equip" ! * Return "-1" if the label does not indicate a real item */ s16b label_to_equip(int c) { --- 2689,2697 ---- /* ! * Convert a label into the index of a item in the "equip". ! * ! * Return "-1" if the label does not indicate a real item. */ s16b label_to_equip(int c) { *************** *** 2853,2858 **** --- 2930,2986 ---- + /* + * Get the indexes of objects at a given floor location. + * + * Return the number of object indexes acquired. + * + * Never acquire more than "size" object indexes, and never return a + * number bigger than "size", even if more floor objects exist. + * + * Valid flags are any combination of the bits: + * + * 0x01 -- Verify item tester + * 0x02 -- Marked items only + */ + sint scan_floor(int *items, int size, int y, int x, int mode) + { + int this_o_idx, next_o_idx; + + int num = 0; + + /* Sanity */ + if (!in_bounds(y, x)) return (0); + + /* Scan all objects in the grid */ + for (this_o_idx = cave_o_idx[y][x]; this_o_idx; this_o_idx = next_o_idx) + { + 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; + + /* Verify item tester */ + if ((mode & 0x01) && !item_tester_okay(o_ptr)) continue; + + /* Marked items only */ + if ((mode & 0x02) && !o_ptr->marked) continue; + + /* Accept this item */ + items[num++] = this_o_idx; + + /* Enforce size limit */ + if (num >= size) break; + } + + /* Result */ + return (num); + } + + /* * Choice window "shadow" of the "show_inven()" function *************** *** 2910,2916 **** /* Obtain the length of the description */ n = strlen(o_name); ! /* Acquire inventory color */ attr = tval_to_attr[o_ptr->tval & 0x7F]; /* Display the entry itself */ --- 3038,3044 ---- /* Obtain the length of the description */ n = strlen(o_name); ! /* Get inventory color */ attr = tval_to_attr[o_ptr->tval & 0x7F]; /* Display the entry itself */ *************** *** 2980,2986 **** /* Obtain the length of the description */ n = strlen(o_name); ! /* Acquire inventory color */ attr = tval_to_attr[o_ptr->tval & 0x7F]; /* Display the entry itself */ --- 3108,3114 ---- /* Obtain the length of the description */ n = strlen(o_name); ! /* Get inventory color */ attr = tval_to_attr[o_ptr->tval & 0x7F]; /* Display the entry itself */ *************** *** 3016,3024 **** - - - /* * Display the inventory. * --- 3144,3149 ---- *************** *** 3035,3043 **** char tmp_val[80]; ! int out_index[23]; ! byte out_color[23]; ! char out_desc[23][80]; /* Default length */ --- 3160,3168 ---- char tmp_val[80]; ! int out_index[24]; ! byte out_color[24]; ! char out_desc[24][80]; /* Default length */ *************** *** 3079,3085 **** /* Save the index */ out_index[k] = i; ! /* Acquire inventory color */ out_color[k] = tval_to_attr[o_ptr->tval & 0x7F]; /* Save the object description */ --- 3204,3210 ---- /* Save the index */ out_index[k] = i; ! /* Get inventory color */ out_color[k] = tval_to_attr[o_ptr->tval & 0x7F]; /* Save the object description */ *************** *** 3136,3142 **** } - /* * Display the equipment. */ --- 3261,3266 ---- *************** *** 3151,3159 **** char o_name[80]; ! int out_index[23]; ! byte out_color[23]; ! char out_desc[23][80]; /* Default length */ --- 3275,3283 ---- char o_name[80]; ! int out_index[24]; ! byte out_color[24]; ! char out_desc[24][80]; /* Default length */ *************** *** 3185,3191 **** /* Save the index */ out_index[k] = i; ! /* Acquire inventory color */ out_color[k] = tval_to_attr[o_ptr->tval & 0x7F]; /* Save the description */ --- 3309,3315 ---- /* Save the index */ out_index[k] = i; ! /* Get inventory color */ out_color[k] = tval_to_attr[o_ptr->tval & 0x7F]; /* Save the description */ *************** *** 3260,3265 **** --- 3384,3494 ---- } + #ifdef ALLOW_EASY_FLOOR + + /* + * Display a list of the items on the floor at the given location. + */ + void show_floor(int *floor_list, int floor_num) + { + int i, j, k, l; + int col, len, lim; + + object_type *o_ptr; + + char o_name[80]; + + char tmp_val[80]; + + int out_index[24]; + byte out_color[24]; + char out_desc[24][80]; + + + /* Default length */ + len = 79 - 50; + + /* Maximum space allowed for descriptions */ + lim = 79 - 3; + + /* Require space for weight (if needed) */ + if (show_weights) lim -= 9; + + /* Display the inventory */ + for (k = 0, i = 0; i < floor_num; i++) + { + o_ptr = &o_list[floor_list[i]]; + + /* Is this item acceptable? */ + if (!item_tester_okay(o_ptr)) continue; + + /* Describe the object */ + object_desc(o_name, o_ptr, TRUE, 3); + + /* Hack -- enforce max length */ + o_name[lim] = '\0'; + + /* Save the index */ + out_index[k] = i; + + /* Get inventory color */ + out_color[k] = tval_to_attr[o_ptr->tval & 0x7F]; + + /* Save the object description */ + strcpy(out_desc[k], o_name); + + /* Find the predicted "line length" */ + l = strlen(out_desc[k]) + 5; + + /* Be sure to account for the weight */ + if (show_weights) l += 9; + + /* Maintain the maximum length */ + if (l > len) len = l; + + /* Advance to next "line" */ + k++; + } + + /* Find the column to start in */ + col = (len > 76) ? 0 : (79 - len); + + /* Output each entry */ + for (j = 0; j < k; j++) + { + /* Get the index */ + i = floor_list[out_index[j]]; + + /* Get the item */ + o_ptr = &o_list[i]; + + /* Clear the line */ + prt("", j + 1, col ? col - 2 : col); + + /* Prepare an index --(-- */ + sprintf(tmp_val, "%c)", index_to_label(j)); + + /* Clear the line with the (possibly indented) index */ + put_str(tmp_val, j + 1, col); + + /* Display the entry itself */ + c_put_str(out_color[j], out_desc[j], j + 1, col + 3); + + /* Display the weight if needed */ + if (show_weights) + { + int wgt = o_ptr->weight * o_ptr->number; + sprintf(tmp_val, "%3d.%1d lb", wgt / 10, wgt % 10); + put_str(tmp_val, j + 1, 71); + } + } + + /* Make a "shadow" below the list (only if needed) */ + if (j && (j < 23)) prt("", j + 1, col ? col - 2 : col); + } + + #endif /* ALLOW_EASY_FLOOR */ + /* *************** *** 3301,3312 **** /* * Verify the choice of an item. * * The item can be negative to mean "item on floor". */ ! static bool verify(cptr prompt, int item) { char o_name[80]; --- 3530,3542 ---- + /* * Verify the choice of an item. * * The item can be negative to mean "item on floor". */ ! static bool verify_item(cptr prompt, int item) { char o_name[80]; *************** *** 3338,3344 **** /* ! * Hack -- allow user to "prevent" certain choices * * The item can be negative to mean "item on floor". */ --- 3568,3574 ---- /* ! * Hack -- allow user to "prevent" certain choices. * * The item can be negative to mean "item on floor". */ *************** *** 3373,3379 **** if ((s[1] == p_ptr->command_cmd) || (s[1] == '*')) { /* Verify the choice */ ! if (!verify("Really try", item)) return (FALSE); } /* Find another '!' */ --- 3603,3609 ---- if ((s[1] == p_ptr->command_cmd) || (s[1] == '*')) { /* Verify the choice */ ! if (!verify_item("Really try", item)) return (FALSE); } /* Find another '!' */ *************** *** 3385,3404 **** } - /* ! * Auxiliary function for "get_item()" -- test an index */ ! static bool get_item_okay(int i) { ! /* Illegal items */ ! if ((i < 0) || (i >= INVEN_TOTAL)) return (FALSE); ! /* Verify the item */ ! if (!item_tester_okay(&inventory[i])) return (FALSE); ! /* Assume okay */ ! return (TRUE); } --- 3615,3643 ---- } /* ! * Verify the "okayness" of a given item. ! * ! * The item can be negative to mean "item on floor". */ ! static bool get_item_okay(int item) { ! object_type *o_ptr; ! /* Inventory */ ! if (item >= 0) ! { ! o_ptr = &inventory[item]; ! } ! /* Floor */ ! else ! { ! o_ptr = &o_list[0 - item]; ! } ! ! /* Verify the item */ ! return (item_tester_okay(o_ptr)); } *************** *** 3510,3540 **** * Global "p_ptr->command_see" may be set before calling this function to start * out in "browse" mode. It is cleared before this function returns. * ! * Global "p_ptr->command_wrk" is used to choose between equip/inven listings. ! * If it is TRUE then we are viewing inventory, else equipment. * * We always erase the prompt when we are done, leaving a blank line, * or a warning message, if appropriate, if no items are available. */ bool get_item(int *cp, cptr pmt, cptr str, int mode) { int py = p_ptr->py; int px = p_ptr->px; ! s16b this_o_idx, next_o_idx = 0; ! char n1, n2, which = ' '; ! int j, k, i1, i2, e1, e2; bool done, item; bool oops = FALSE; ! bool equip = FALSE; ! bool inven = FALSE; ! bool floor = FALSE; bool allow_floor = FALSE; bool toggle = FALSE; --- 3749,3790 ---- * Global "p_ptr->command_see" may be set before calling this function to start * out in "browse" mode. It is cleared before this function returns. * ! * Global "p_ptr->command_wrk" is used to choose between equip/inven/floor ! * listings. It is equal to USE_INVEN or USE_EQUIP or USE_FLOOR, except ! * when this function is first called, when it is equal to zero, which will ! * cause it to be set to USE_INVEN. * * We always erase the prompt when we are done, leaving a blank line, * or a warning message, if appropriate, if no items are available. + * + * Note that the "easy_floor" option affects this function in several ways. + * + * Note that only "acceptable" floor objects get indexes, so between two + * commands, the indexes of floor objects may change. XXX XXX XXX */ bool get_item(int *cp, cptr pmt, cptr str, int mode) { int py = p_ptr->py; int px = p_ptr->px; ! char which = ' '; ! int i, j, k; ! int i1, i2; ! int e1, e2; ! int f1, f2; bool done, item; bool oops = FALSE; ! bool use_inven = ((mode & (USE_INVEN)) ? TRUE : FALSE); ! bool use_equip = ((mode & (USE_EQUIP)) ? TRUE : FALSE); ! bool use_floor = ((mode & (USE_FLOOR)) ? TRUE : FALSE); + bool allow_inven = FALSE; + bool allow_equip = FALSE; bool allow_floor = FALSE; bool toggle = FALSE; *************** *** 3542,3552 **** char tmp_val[160]; char out_val[160]; ! /* Extract args */ ! if (mode & (USE_EQUIP)) equip = TRUE; ! if (mode & (USE_INVEN)) inven = TRUE; ! if (mode & (USE_FLOOR)) floor = TRUE; /* Paranoia XXX XXX XXX */ --- 3792,3821 ---- char tmp_val[160]; char out_val[160]; + int floor_list[24]; + int floor_num = 0; + + + #ifdef ALLOW_REPEAT ! /* Get the item index */ ! if (repeat_pull(cp)) ! { ! /* Verify the item */ ! if (get_item_okay(*cp)) ! { ! /* Forget the item_tester_tval restriction */ ! item_tester_tval = 0; ! ! /* Forget the item_tester_hook restriction */ ! item_tester_hook = NULL; ! ! /* Success */ ! return (TRUE); ! } ! } ! ! #endif /* ALLOW_REPEAT */ /* Paranoia XXX XXX XXX */ *************** *** 3565,3611 **** i2 = INVEN_PACK - 1; /* Forbid inventory */ ! if (!inven) i2 = -1; /* Restrict inventory indexes */ while ((i1 <= i2) && (!get_item_okay(i1))) i1++; while ((i1 <= i2) && (!get_item_okay(i2))) i2--; /* Full equipment */ e1 = INVEN_WIELD; e2 = INVEN_TOTAL - 1; /* Forbid equipment */ ! if (!equip) e2 = -1; /* Restrict equipment indexes */ while ((e1 <= e2) && (!get_item_okay(e1))) e1++; while ((e1 <= e2) && (!get_item_okay(e2))) e2--; - /* Restrict floor usage */ - if (floor) - { - /* Scan all objects in the grid */ - 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]; ! /* Acquire next object */ ! next_o_idx = o_ptr->next_o_idx; ! /* Accept the item on the floor if legal */ ! if (item_tester_okay(o_ptr)) allow_floor = TRUE; ! } ! } /* Require at least one legal choice */ ! if (!allow_floor && (i1 > i2) && (e1 > e2)) { /* Cancel p_ptr->command_see */ p_ptr->command_see = FALSE; --- 3834,3884 ---- i2 = INVEN_PACK - 1; /* Forbid inventory */ ! if (!use_inven) i2 = -1; /* Restrict inventory indexes */ while ((i1 <= i2) && (!get_item_okay(i1))) i1++; while ((i1 <= i2) && (!get_item_okay(i2))) i2--; + /* Accept inventory */ + if (i1 <= i2) allow_inven = TRUE; + /* Full equipment */ e1 = INVEN_WIELD; e2 = INVEN_TOTAL - 1; /* Forbid equipment */ ! if (!use_equip) e2 = -1; /* Restrict equipment indexes */ while ((e1 <= e2) && (!get_item_okay(e1))) e1++; while ((e1 <= e2) && (!get_item_okay(e2))) e2--; + /* Accept equipment */ + if (e1 <= e2) allow_equip = TRUE; ! /* Scan all objects in the grid */ ! floor_num = scan_floor(floor_list, 23, py, px, 0x00); ! /* Full floor */ ! f1 = 0; ! f2 = floor_num - 1; ! /* Forbid floor */ ! if (!use_floor) f2 = -1; ! ! /* Restrict floor indexes */ ! while ((f1 <= f2) && (!get_item_okay(0 - floor_list[f1]))) f1++; ! while ((f1 <= f2) && (!get_item_okay(0 - floor_list[f2]))) f2--; ! ! /* Accept floor */ ! if (f1 <= f2) allow_floor = TRUE; /* Require at least one legal choice */ ! if (!allow_inven && !allow_equip && !allow_floor) { /* Cancel p_ptr->command_see */ p_ptr->command_see = FALSE; *************** *** 3621,3652 **** else { /* Hack -- Start on equipment if requested */ ! if (p_ptr->command_see && p_ptr->command_wrk && equip) { ! p_ptr->command_wrk = TRUE; } /* Use inventory if allowed */ ! else if (inven) { ! p_ptr->command_wrk = FALSE; } /* Use equipment if allowed */ ! else if (equip) { ! p_ptr->command_wrk = TRUE; } ! /* Use inventory for floor */ else { ! p_ptr->command_wrk = FALSE; } } ! /* Hack -- start out in "display" mode */ if (p_ptr->command_see) { /* Save screen */ --- 3894,3937 ---- else { /* Hack -- Start on equipment if requested */ ! if (p_ptr->command_see && ! (p_ptr->command_wrk == (USE_EQUIP)) && ! use_equip) { ! p_ptr->command_wrk = (USE_EQUIP); } /* Use inventory if allowed */ ! else if (use_inven) { ! p_ptr->command_wrk = (USE_INVEN); } /* Use equipment if allowed */ ! else if (use_equip) ! { ! p_ptr->command_wrk = (USE_EQUIP); ! } ! ! #ifdef ALLOW_EASY_FLOOR ! ! /* Use floor if allowed */ ! else if (easy_floor) { ! p_ptr->command_wrk = (USE_FLOOR); } ! #endif /* ALLOW_EASY_FLOOR */ ! ! /* Hack -- Use (empty) inventory */ else { ! p_ptr->command_wrk = (USE_INVEN); } } ! /* Start out in "display" mode */ if (p_ptr->command_see) { /* Save screen */ *************** *** 3677,3684 **** } /* Toggle if needed */ ! if ((p_ptr->command_wrk && ni && !ne) || ! (!p_ptr->command_wrk && !ni && ne)) { /* Toggle */ toggle_inven_equip(); --- 3962,3969 ---- } /* Toggle if needed */ ! if (((p_ptr->command_wrk == (USE_EQUIP)) && ni && !ne) || ! ((p_ptr->command_wrk == (USE_INVEN)) && !ni && ne)) { /* Toggle */ toggle_inven_equip(); *************** *** 3694,3728 **** window_stuff(); } ! /* Inventory screen */ ! if (!p_ptr->command_wrk) { - /* Extract the legal requests */ - n1 = I2A(i1); - n2 = I2A(i2); - /* Redraw if needed */ if (p_ptr->command_see) show_inven(); - } - /* Equipment screen */ - else - { - /* Extract the legal requests */ - n1 = I2A(e1 - INVEN_WIELD); - n2 = I2A(e2 - INVEN_WIELD); - - /* Redraw if needed */ - if (p_ptr->command_see) show_equip(); - } - - /* Viewing inventory */ - if (!p_ptr->command_wrk) - { /* Begin the prompt */ sprintf(out_val, "Inven:"); ! /* Some legal items */ if (i1 <= i2) { /* Build the prompt */ --- 3979,3994 ---- window_stuff(); } ! /* Viewing inventory */ ! if (p_ptr->command_wrk == (USE_INVEN)) { /* Redraw if needed */ if (p_ptr->command_see) show_inven(); /* Begin the prompt */ sprintf(out_val, "Inven:"); ! /* List choices */ if (i1 <= i2) { /* Build the prompt */ *************** *** 3736,3752 **** /* Indicate ability to "view" */ if (!p_ptr->command_see) strcat(out_val, " * to see,"); ! /* Append */ ! if (equip) strcat(out_val, " / for Equip,"); } /* Viewing equipment */ ! else { /* Begin the prompt */ sprintf(out_val, "Equip:"); ! /* Some legal items */ if (e1 <= e2) { /* Build the prompt */ --- 4002,4024 ---- /* Indicate ability to "view" */ if (!p_ptr->command_see) strcat(out_val, " * to see,"); ! /* Indicate legality of "toggle" */ ! if (use_equip) strcat(out_val, " / for Equip,"); ! ! /* Indicate legality of the "floor" */ ! if (allow_floor) strcat(out_val, " - for floor,"); } /* Viewing equipment */ ! else if (p_ptr->command_wrk == (USE_EQUIP)) { + /* Redraw if needed */ + if (p_ptr->command_see) show_equip(); + /* Begin the prompt */ sprintf(out_val, "Equip:"); ! /* List choices */ if (e1 <= e2) { /* Build the prompt */ *************** *** 3760,3771 **** /* Indicate ability to "view" */ if (!p_ptr->command_see) strcat(out_val, " * to see,"); /* Append */ ! if (inven) strcat(out_val, " / for Inven,"); } ! /* Indicate legality of the "floor" item */ ! if (allow_floor) strcat(out_val, " - for floor,"); /* Finish the prompt */ strcat(out_val, " ESC"); --- 4032,4076 ---- /* Indicate ability to "view" */ if (!p_ptr->command_see) strcat(out_val, " * to see,"); + /* Indicate legality of "toggle" */ + if (use_inven) strcat(out_val, " / for Inven,"); + + /* Indicate legality of the "floor" */ + if (allow_floor) strcat(out_val, " - for floor,"); + } + + #ifdef ALLOW_EASY_FLOOR + + /* Viewing floor */ + else + { + /* Redraw if needed */ + if (p_ptr->command_see) show_floor(floor_list, floor_num); + + /* Begin the prompt */ + sprintf(out_val, "Floor:"); + + /* List choices */ + if (f1 <= f2) + { + /* Build the prompt */ + sprintf(tmp_val, " %c-%c,", I2A(f1), I2A(f2)); + + /* Append */ + strcat(out_val, tmp_val); + } + + /* Indicate ability to "view" */ + if (!p_ptr->command_see) strcat(out_val, " * to see,"); + + /* Append */ + if (use_inven) strcat(out_val, " / for Inven,"); + /* Append */ ! else if (use_equip) strcat(out_val, " / for Equip,"); } ! #endif /* ALLOW_EASY_FLOOR */ /* Finish the prompt */ strcat(out_val, " ESC"); *************** *** 3812,3824 **** /* Flip flag */ p_ptr->command_see = TRUE; } break; } case '/': { ! /* Verify legality */ ! if (!inven || !equip) { bell("Cannot switch item selector!"); break; --- 4117,4142 ---- /* Flip flag */ p_ptr->command_see = TRUE; } + break; } case '/': { ! /* Toggle to inventory */ ! if (use_inven && (p_ptr->command_wrk != (USE_INVEN))) ! { ! p_ptr->command_wrk = (USE_INVEN); ! } ! ! /* Toggle to equipment */ ! else if (use_equip && (p_ptr->command_wrk != (USE_EQUIP))) ! { ! p_ptr->command_wrk = (USE_EQUIP); ! } ! ! /* No toggle allowed */ ! else { bell("Cannot switch item selector!"); break; *************** *** 3834,3887 **** screen_save(); } - /* Switch inven/equip */ - p_ptr->command_wrk = !p_ptr->command_wrk; - /* Need to redraw */ break; } case '-': { ! /* Use floor item */ ! if (allow_floor) { ! /* Scan all objects in the grid */ ! 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]; ! /* Acquire next object */ ! next_o_idx = o_ptr->next_o_idx; ! /* Validate the item */ ! if (!item_tester_okay(o_ptr)) continue; ! /* Special index */ ! k = 0 - this_o_idx; ! /* Verify the item (if required) */ ! if (floor_query_flag && !verify("Try", k)) continue; ! /* Allow player to "refuse" certain actions */ ! if (!get_item_allow(k)) continue; ! /* Accept that choice */ ! (*cp) = k; ! item = TRUE; ! done = TRUE; ! break; ! } ! /* Outer break */ ! if (done) break; } - /* Oops */ - bell("Illegal object choice (floor)!"); break; } --- 4152,4239 ---- screen_save(); } /* Need to redraw */ break; } case '-': { ! /* Paranoia */ ! if (!allow_floor) { ! bell("Cannot select floor!"); ! break; ! } ! ! #ifdef ALLOW_EASY_FLOOR ! ! if (easy_floor) ! { ! /* There is only one item */ ! if (floor_num == 1) { ! /* Hack -- Auto-Select */ ! if ((p_ptr->command_wrk == (USE_FLOOR)) || ! (!floor_query_flag)) ! { ! /* Special index */ ! k = 0 - floor_list[0]; ! ! /* Allow player to "refuse" certain actions */ ! if (!get_item_allow(k)) ! { ! done = TRUE; ! break; ! } ! ! /* Accept that choice */ ! (*cp) = k; ! item = TRUE; ! done = TRUE; ! break; ! } ! } ! /* Hack -- Fix screen */ ! if (p_ptr->command_see) ! { ! /* Load screen */ ! screen_load(); ! /* Save screen */ ! screen_save(); ! } ! p_ptr->command_wrk = (USE_FLOOR); ! break; ! } ! #endif ALLOW_EASY_FLOOR ! /* Check each legal object */ ! for (i = 0; i < floor_num; ++i) ! { ! /* Special index */ ! k = 0 - floor_list[i]; ! ! /* Skip non-okay objects */ ! if (!get_item_okay(k)) continue; ! ! /* Verify the item (if required) */ ! if (floor_query_flag && !verify_item("Try", k)) continue; ! /* Allow player to "refuse" certain actions */ ! if (!get_item_allow(k)) continue; ! ! /* Accept that choice */ ! (*cp) = k; ! item = TRUE; ! done = TRUE; ! break; } break; } *************** *** 3898,3904 **** } /* Hack -- Validate the item */ ! if ((k < INVEN_WIELD) ? !inven : !equip) { bell("Illegal object choice (tag)!"); break; --- 4250,4256 ---- } /* Hack -- Validate the item */ ! if ((k < INVEN_WIELD) ? !allow_inven : !allow_equip) { bell("Illegal object choice (tag)!"); break; *************** *** 3929,3945 **** case '\r': { /* Choose "default" inventory item */ ! if (!p_ptr->command_wrk) { ! k = ((i1 == i2) ? i1 : -1); } /* Choose "default" equipment item */ else { ! k = ((e1 == e2) ? e1 : -1); } /* Validate the item */ if (!get_item_okay(k)) { --- 4281,4325 ---- case '\r': { /* Choose "default" inventory item */ ! if (p_ptr->command_wrk == (USE_INVEN)) { ! if (i1 != i2) ! { ! bell("Illegal object choice (default)!"); ! break; ! } ! ! k = i1; } /* Choose "default" equipment item */ + else if (p_ptr->command_wrk == (USE_EQUIP)) + { + if (e1 != e2) + { + bell("Illegal object choice (default)!"); + break; + } + + k = e1; + } + + #ifdef ALLOW_EASY_FLOOR + + /* Choose "default" floor item */ else { ! if (f1 != f2) ! { ! bell("Illegal object choice (default)!"); ! break; ! } ! ! k = 0 - floor_list[f1]; } + #endif /* ALLOW_EASY_FLOOR */ + /* Validate the item */ if (!get_item_okay(k)) { *************** *** 3963,3986 **** default: { ! int ver; ! /* Extract "query" setting */ ! ver = isupper(which); which = tolower(which); /* Convert letter to inventory index */ ! if (!p_ptr->command_wrk) { k = label_to_inven(which); } /* Convert letter to equipment index */ ! else { k = label_to_equip(which); } /* Validate the item */ if (!get_item_okay(k)) { --- 4343,4399 ---- default: { ! bool verify; ! ! /* Note verify */ ! verify = (isupper(which) ? TRUE : FALSE); ! /* Lowercase */ which = tolower(which); /* Convert letter to inventory index */ ! if (p_ptr->command_wrk == (USE_INVEN)) { k = label_to_inven(which); + + if (k < 0) + { + bell("Illegal object choice (inven)!"); + break; + } } /* Convert letter to equipment index */ ! else if (p_ptr->command_wrk == (USE_EQUIP)) { k = label_to_equip(which); + + if (k < 0) + { + bell("Illegal object choice (equip)!"); + break; + } } + #ifdef ALLOW_EASY_FLOOR + + /* Convert letter to floor index */ + else + { + k = (islower(which) ? A2I(which) : -1); + + if (k < 0 || k >= floor_num) + { + bell("Illegal object choice (floor)!"); + break; + } + + /* Special index */ + k = 0 - floor_list[k]; + } + + #endif /* ALLOW_EASY_FLOOR */ + /* Validate the item */ if (!get_item_okay(k)) { *************** *** 3989,3995 **** } /* Verify the item */ ! if (ver && !verify("Try", k)) { done = TRUE; break; --- 4402,4408 ---- } /* Verify the item */ ! if (verify && !verify_item("Try", k)) { done = TRUE; break; *************** *** 4049,4054 **** --- 4462,4474 ---- /* Warning if needed */ if (oops && str) msg_print(str); + + #ifdef ALLOW_REPEAT + + /* Save item if available */ + if (item) repeat_push(*cp); + + #endif /* ALLOW_REPEAT */ /* Result */ return (item); diff -r -c angband-283/src/object2.c angband-285/src/object2.c *** angband-283/src/object2.c Wed Feb 11 06:30:29 1998 --- angband-285/src/object2.c Sun Sep 5 13:16:25 1999 *************** *** 39,48 **** { object_type *o_ptr; ! /* Acquire object */ o_ptr = &o_list[this_o_idx]; ! /* Acquire next object */ next_o_idx = o_ptr->next_o_idx; /* Done */ --- 39,48 ---- { 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; /* Done */ *************** *** 90,99 **** { object_type *o_ptr; ! /* Acquire object */ o_ptr = &o_list[this_o_idx]; ! /* Acquire next object */ next_o_idx = o_ptr->next_o_idx; /* Done */ --- 90,99 ---- { 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; /* Done */ *************** *** 185,194 **** { object_type *o_ptr; ! /* Acquire object */ o_ptr = &o_list[this_o_idx]; ! /* Acquire next object */ next_o_idx = o_ptr->next_o_idx; /* Wipe the object */ --- 185,194 ---- { 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; /* Wipe the object */ *************** *** 224,230 **** /* Repair objects */ for (i = 1; i < o_max; i++) { ! /* Acquire object */ o_ptr = &o_list[i]; /* Skip "dead" objects */ --- 224,230 ---- /* Repair objects */ for (i = 1; i < o_max; i++) { ! /* Get the object */ o_ptr = &o_list[i]; /* Skip "dead" objects */ *************** *** 239,245 **** } ! /* Acquire object */ o_ptr = &o_list[i1]; --- 239,245 ---- } ! /* Get the object */ o_ptr = &o_list[i1]; *************** *** 248,254 **** { monster_type *m_ptr; ! /* Acquire monster */ m_ptr = &m_list[o_ptr->held_m_idx]; /* Repair monster */ --- 248,254 ---- { monster_type *m_ptr; ! /* Get the monster */ m_ptr = &m_list[o_ptr->held_m_idx]; /* Repair monster */ *************** *** 264,270 **** { int y, x; ! /* Acquire location */ y = o_ptr->iy; x = o_ptr->ix; --- 264,270 ---- { int y, x; ! /* Get location */ y = o_ptr->iy; x = o_ptr->ix; *************** *** 348,354 **** { monster_type *m_ptr; ! /* Acquire monster */ m_ptr = &m_list[o_ptr->held_m_idx]; /* Get the location */ --- 348,354 ---- { monster_type *m_ptr; ! /* Get the monster */ m_ptr = &m_list[o_ptr->held_m_idx]; /* Get the location */ *************** *** 431,437 **** if (!o_ptr->k_idx) continue; /* Mega-Hack -- preserve artifacts */ ! if (!character_dungeon || p_ptr->preserve) { /* Hack -- Preserve unknown artifacts */ if (artifact_p(o_ptr) && !object_known_p(o_ptr)) --- 431,437 ---- if (!o_ptr->k_idx) continue; /* Mega-Hack -- preserve artifacts */ ! if (!character_dungeon || adult_preserve) { /* Hack -- Preserve unknown artifacts */ if (artifact_p(o_ptr) && !object_known_p(o_ptr)) *************** *** 456,462 **** /* Dungeon */ else { ! /* Access location */ int y = o_ptr->iy; int x = o_ptr->ix; --- 456,462 ---- /* Dungeon */ else { ! /* Get the location */ int y = o_ptr->iy; int x = o_ptr->ix; *************** *** 477,483 **** /* ! * Acquires and returns the index of a "free" object. * * This routine should almost never fail, but in case it does, * we must be sure to handle "failure" of this routine. --- 477,483 ---- /* ! * Get and return the index of a "free" object. * * This routine should almost never fail, but in case it does, * we must be sure to handle "failure" of this routine. *************** *** 509,515 **** { object_type *o_ptr; ! /* Acquire object */ o_ptr = &o_list[i]; /* Skip live objects */ --- 509,515 ---- { object_type *o_ptr; ! /* Get the object */ o_ptr = &o_list[i]; /* Skip live objects */ *************** *** 617,626 **** /* Default */ table[i].prob3 = 0; ! /* Access the index */ k_idx = table[i].index; ! /* Access the actual kind */ k_ptr = &k_info[k_idx]; /* Hack -- prevent embedded chests */ --- 617,626 ---- /* Default */ table[i].prob3 = 0; ! /* Get the index */ k_idx = table[i].index; ! /* Get the actual kind */ k_ptr = &k_info[k_idx]; /* Hack -- prevent embedded chests */ *************** *** 714,720 **** /* * Known is true when the "attributes" of an object are "known". ! * These include tohit, todam, toac, cost, and pval (charges). * * Note that "knowing" an object gives you everything that an "awareness" * gives you, and much more. In fact, the player is always "aware" of any --- 714,721 ---- /* * Known is true when the "attributes" of an object are "known". ! * ! * These attributes include tohit, todam, toac, cost, and pval (charges). * * Note that "knowing" an object gives you everything that an "awareness" * gives you, and much more. In fact, the player is always "aware" of any *************** *** 729,756 **** */ void object_known(object_type *o_ptr) { ! /* Remove "default inscriptions" */ ! if (o_ptr->note && (o_ptr->ident & (IDENT_SENSE))) ! { ! /* Access the inscription */ ! cptr q = quark_str(o_ptr->note); ! /* Hack -- Remove auto-inscriptions */ ! if ((streq(q, "cursed")) || ! (streq(q, "broken")) || ! (streq(q, "good")) || ! (streq(q, "average")) || ! (streq(q, "excellent")) || ! (streq(q, "worthless")) || ! (streq(q, "special")) || ! (streq(q, "terrible"))) ! { ! /* Forget the inscription */ ! o_ptr->note = 0; ! } ! } ! ! /* Clear the "Felt" info */ o_ptr->ident &= ~(IDENT_SENSE); /* Clear the "Empty" info */ --- 730,739 ---- */ void object_known(object_type *o_ptr) { ! /* Remove special inscription, if any */ ! if (o_ptr->discount >= INSCRIP_NULL) o_ptr->discount = 0; ! /* The object is not "sensed" */ o_ptr->ident &= ~(IDENT_SENSE); /* Clear the "Empty" info */ *************** *** 794,800 **** { object_kind *k_ptr = &k_info[o_ptr->k_idx]; ! /* Aware item -- use template cost */ if (object_aware_p(o_ptr)) return (k_ptr->cost); /* Analyze the type */ --- 777,783 ---- { object_kind *k_ptr = &k_info[o_ptr->k_idx]; ! /* Use template cost for aware objects */ if (object_aware_p(o_ptr)) return (k_ptr->cost); /* Analyze the type */ *************** *** 831,839 **** /* ! * Return the "real" price of a "known" item, not including discounts * ! * Wand and staffs get cost for each charge * * Armor is worth an extra 100 gold per bonus point to armor class. * --- 814,822 ---- /* ! * Return the "real" price of a "known" item, not including discounts. * ! * Wand and staffs get cost for each charge. * * Armor is worth an extra 100 gold per bonus point to armor class. * *************** *** 847,852 **** --- 830,836 ---- * and "brand" and "ignore" variety. * * Armor with a negative armor bonus is worthless. + * * Weapons with negative hit+damage bonuses are worthless. * * Every wearable item with a "pval" bonus is worth extra (see below). *************** *** 1056,1070 **** /* ! * Return the price of an item including plusses (and charges) * ! * This function returns the "value" of the given item (qty one) * * Never notice "unknown" bonuses or properties, including "curses", * since that would give the player information he did not have. * ! * Note that discounted items stay discounted forever, even if ! * the discount is "forgotten" by the player via memory loss. */ s32b object_value(object_type *o_ptr) { --- 1040,1053 ---- /* ! * Return the price of an item including plusses (and charges). * ! * This function returns the "value" of the given item (qty one). * * Never notice "unknown" bonuses or properties, including "curses", * since that would give the player information he did not have. * ! * Note that discounted items stay discounted forever. */ s32b object_value(object_type *o_ptr) { *************** *** 1099,1105 **** /* Apply discount (if any) */ ! if (o_ptr->discount) value -= (value * o_ptr->discount / 100L); /* Return the final value */ --- 1082,1091 ---- /* Apply discount (if any) */ ! if (o_ptr->discount > 0 && o_ptr->discount < INSCRIP_NULL) ! { ! value -= (value * o_ptr->discount / 100L); ! } /* Return the final value */ *************** *** 1255,1275 **** } ! /* Hack -- Require identical "cursed" status */ ! if ((o_ptr->ident & (IDENT_CURSED)) != (j_ptr->ident & (IDENT_CURSED))) return (0); ! /* Hack -- Require identical "broken" status */ ! if ((o_ptr->ident & (IDENT_BROKEN)) != (j_ptr->ident & (IDENT_BROKEN))) return (0); ! /* Hack -- require semi-matching "inscriptions" */ ! if (o_ptr->note && j_ptr->note && (o_ptr->note != j_ptr->note)) return (0); ! /* Hack -- normally require matching "inscriptions" */ ! if (!stack_force_notes && (o_ptr->note != j_ptr->note)) return (0); ! /* Hack -- normally require matching "discounts" */ ! if (!stack_force_costs && (o_ptr->discount != j_ptr->discount)) return (0); /* Maximal "stacking" limit */ --- 1241,1294 ---- } ! /* Hack -- Require identical "cursed" and "broken" status */ ! if (((o_ptr->ident & (IDENT_CURSED)) != (j_ptr->ident & (IDENT_CURSED))) || ! ((o_ptr->ident & (IDENT_BROKEN)) != (j_ptr->ident & (IDENT_BROKEN)))) ! { ! return (0); ! } ! ! ! /* Hack -- Require compatible inscriptions */ ! if (o_ptr->note != j_ptr->note) ! { ! /* Normally require matching inscriptions */ ! if (!stack_force_notes) return (0); ! /* Never combine different inscriptions */ ! if (o_ptr->note && j_ptr->note) return (0); ! } ! /* Hack -- Require compatible "discount" fields */ ! if (o_ptr->discount != j_ptr->discount) ! { ! /* Both are (different) special inscriptions */ ! if ((o_ptr->discount >= INSCRIP_NULL) && ! (j_ptr->discount >= INSCRIP_NULL)) ! { ! /* Normally require matching inscriptions */ ! return (0); ! } ! /* One is a special inscription, one is a discount or nothing */ ! else if ((o_ptr->discount >= INSCRIP_NULL) || ! (j_ptr->discount >= INSCRIP_NULL)) ! { ! /* Normally require matching inscriptions */ ! if (!stack_force_notes) return (0); ! /* Hack -- Never merge a special inscription with a discount */ ! if ((o_ptr->discount > 0) && (j_ptr->discount > 0)) return (0); ! } ! ! /* One is a discount, one is a (different) discount or nothing */ ! else ! { ! /* Normally require matching discounts */ ! if (!stack_force_costs) return (0); ! } ! } /* Maximal "stacking" limit */ *************** *** 1282,1288 **** /* ! * Allow one item to "absorb" another, assuming they are similar */ void object_absorb(object_type *o_ptr, object_type *j_ptr) { --- 1301,1320 ---- /* ! * Allow one item to "absorb" another, assuming they are similar. ! * ! * The blending of the "note" field assumes that either (1) one has an ! * inscription and the other does not, or (2) neither has an inscription. ! * In both these cases, we can simply use the existing note, unless the ! * blending object has a note, in which case we use that note. ! * ! * The blending of the "discount" field assumes that either (1) one is a ! * special inscription and one is nothing, or (2) one is a discount and ! * one is a smaller discount, or (3) one is a discount and one is nothing, ! * or (4) both are nothing. In all of these cases, we can simply use the ! * "maximum" of the two "discount" fields. ! * ! * These assumptions are enforced by the "object_similar()" code. */ void object_absorb(object_type *o_ptr, object_type *j_ptr) { *************** *** 1291,1310 **** /* Add together the item counts */ o_ptr->number = ((total < MAX_STACK_SIZE) ? total : (MAX_STACK_SIZE - 1)); ! /* Hack -- blend "known" status */ if (object_known_p(j_ptr)) object_known(o_ptr); ! /* Hack -- blend "rumour" status */ if (j_ptr->ident & (IDENT_RUMOUR)) o_ptr->ident |= (IDENT_RUMOUR); ! /* Hack -- blend "mental" status */ if (j_ptr->ident & (IDENT_MENTAL)) o_ptr->ident |= (IDENT_MENTAL); ! /* Hack -- blend "inscriptions" */ ! if (j_ptr->note) o_ptr->note = j_ptr->note; ! /* Hack -- could average discounts XXX XXX XXX */ ! /* Hack -- save largest discount XXX XXX XXX */ if (o_ptr->discount < j_ptr->discount) o_ptr->discount = j_ptr->discount; } --- 1323,1341 ---- /* Add together the item counts */ o_ptr->number = ((total < MAX_STACK_SIZE) ? total : (MAX_STACK_SIZE - 1)); ! /* Hack -- Blend "known" status */ if (object_known_p(j_ptr)) object_known(o_ptr); ! /* Hack -- Blend "rumour" status */ if (j_ptr->ident & (IDENT_RUMOUR)) o_ptr->ident |= (IDENT_RUMOUR); ! /* Hack -- Blend "mental" status */ if (j_ptr->ident & (IDENT_MENTAL)) o_ptr->ident |= (IDENT_MENTAL); ! /* Hack -- Blend "notes" */ ! if (j_ptr->note != 0) o_ptr->note = j_ptr->note; ! /* Mega-Hack -- Blend "discounts" */ if (o_ptr->discount < j_ptr->discount) o_ptr->discount = j_ptr->discount; } *************** *** 1518,1529 **** /* ! * Mega-Hack -- Attempt to create one of the "Special Objects" * * We are only called from "make_object()", and we assume that * "apply_magic()" is called immediately after we return. * ! * Note -- see "make_artifact()" and "apply_magic()" */ static bool make_artifact_special(object_type *o_ptr) { --- 1549,1565 ---- /* ! * Mega-Hack -- Attempt to create one of the "Special Objects". * * We are only called from "make_object()", and we assume that * "apply_magic()" is called immediately after we return. * ! * Note -- see "make_artifact()" and "apply_magic()". ! * ! * We *prefer* to create the special artifacts in order, but this is ! * normally outweighed by the "rarity" rolls for those artifacts. The ! * only major effect of this logic is that the Phial (with rarity one) ! * is always the first special artifact created. */ static bool make_artifact_special(object_type *o_ptr) { *************** *** 1532,1542 **** int k_idx = 0; /* No artifacts in the town */ if (!p_ptr->depth) return (FALSE); ! /* Check the artifact list (just the "specials") */ ! for (i = 0; i < ART_MIN_NORMAL; i++) { artifact_type *a_ptr = &a_info[i]; --- 1568,1581 ---- int k_idx = 0; + /* No artifacts, do nothing */ + if (adult_no_artifacts) return (FALSE); + /* No artifacts in the town */ if (!p_ptr->depth) return (FALSE); ! /* Check the special artifacts */ ! for (i = 0; i < ART_MIN_NORMAL; ++i) { artifact_type *a_ptr = &a_info[i]; *************** *** 1549,1555 **** /* Enforce minimum "depth" (loosely) */ if (a_ptr->level > p_ptr->depth) { ! /* Acquire the "out-of-depth factor" */ int d = (a_ptr->level - p_ptr->depth) * 2; /* Roll for out-of-depth creation */ --- 1588,1594 ---- /* Enforce minimum "depth" (loosely) */ if (a_ptr->level > p_ptr->depth) { ! /* Get the "out-of-depth factor" */ int d = (a_ptr->level - p_ptr->depth) * 2; /* Roll for out-of-depth creation */ *************** *** 1565,1571 **** /* Enforce minimum "object" level (loosely) */ if (k_info[k_idx].level > object_level) { ! /* Acquire the "out-of-depth factor" */ int d = (k_info[k_idx].level - object_level) * 5; /* Roll for out-of-depth creation */ --- 1604,1610 ---- /* Enforce minimum "object" level (loosely) */ if (k_info[k_idx].level > object_level) { ! /* Get the "out-of-depth factor" */ int d = (k_info[k_idx].level - object_level) * 5; /* Roll for out-of-depth creation */ *************** *** 1575,1581 **** /* Assign the template */ object_prep(o_ptr, k_idx); ! /* Mega-Hack -- mark the item as an artifact */ o_ptr->name1 = i; /* Success */ --- 1614,1620 ---- /* Assign the template */ object_prep(o_ptr, k_idx); ! /* Mark the item as an artifact */ o_ptr->name1 = i; /* Success */ *************** *** 1599,1604 **** --- 1638,1646 ---- int i; + /* No artifacts, do nothing */ + if (adult_no_artifacts) return (FALSE); + /* No artifacts in the town */ if (!p_ptr->depth) return (FALSE); *************** *** 1623,1629 **** /* XXX XXX Enforce minimum "depth" (loosely) */ if (a_ptr->level > p_ptr->depth) { ! /* Acquire the "out-of-depth factor" */ int d = (a_ptr->level - p_ptr->depth) * 2; /* Roll for out-of-depth creation */ --- 1665,1671 ---- /* XXX XXX Enforce minimum "depth" (loosely) */ if (a_ptr->level > p_ptr->depth) { ! /* Get the "out-of-depth factor" */ int d = (a_ptr->level - p_ptr->depth) * 2; /* Roll for out-of-depth creation */ *************** *** 1633,1639 **** /* We must make the "rarity roll" */ if (rand_int(a_ptr->rarity) != 0) continue; ! /* Hack -- mark the item as an artifact */ o_ptr->name1 = i; /* Success */ --- 1675,1681 ---- /* We must make the "rarity roll" */ if (rand_int(a_ptr->rarity) != 0) continue; ! /* Mark the item as an artifact */ o_ptr->name1 = i; /* Success */ *************** *** 3034,3041 **** * * If "okay" is true, and the object is going to be "great", then there is * a chance that an artifact will be created. This is true even if both the ! * "good" and "great" arguments are false. As a total hack, if "great" is ! * true, then the item gets 3 extra "attempts" to become an artifact. */ void apply_magic(object_type *o_ptr, int lev, bool okay, bool good, bool great) { --- 3076,3083 ---- * * If "okay" is true, and the object is going to be "great", then there is * a chance that an artifact will be created. This is true even if both the ! * "good" and "great" arguments are false. Objects which are forced "great" ! * get three extra "attempts" to become an artifact. */ void apply_magic(object_type *o_ptr, int lev, bool okay, bool good, bool great) { *************** *** 3089,3098 **** /* Get one roll if excellent */ if (power >= 2) rolls = 1; ! /* Hack -- Get four rolls if forced great */ if (great) rolls = 4; ! /* Hack -- Get no rolls if not allowed */ if (!okay || o_ptr->name1) rolls = 0; /* Roll for artifacts if allowed */ --- 3131,3140 ---- /* Get one roll if excellent */ if (power >= 2) rolls = 1; ! /* Get four rolls if forced great */ if (great) rolls = 4; ! /* Get no rolls if not allowed */ if (!okay || o_ptr->name1) rolls = 0; /* Roll for artifacts if allowed */ *************** *** 3281,3287 **** /* ! * Hack -- determine if a template is "good" */ static bool kind_is_good(int k_idx) { --- 3323,3334 ---- /* ! * Hack -- determine if a template is "good". ! * ! * Note that this test only applies to the object *kind*, so it is ! * possible to choose a kind which is "good", and then later cause ! * the actual object to be cursed. We do explicitly forbid objects ! * which are known to be boring or which start out somewhat damaged. */ static bool kind_is_good(int k_idx) { *************** *** 3374,3380 **** base = (good ? (object_level + 10) : object_level); ! /* Generate a special object, or a normal object */ if ((rand_int(prob) != 0) || !make_artifact_special(j_ptr)) { int k_idx; --- 3421,3427 ---- base = (good ? (object_level + 10) : object_level); ! /* Generate a special artifact, or a normal object */ if ((rand_int(prob) != 0) || !make_artifact_special(j_ptr)) { int k_idx; *************** *** 3506,3515 **** { object_type *o_ptr; ! /* Acquire object */ o_ptr = &o_list[this_o_idx]; ! /* Acquire next object */ next_o_idx = o_ptr->next_o_idx; /* Check for combination */ --- 3553,3562 ---- { 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; /* Check for combination */ *************** *** 3527,3536 **** } - /* Option -- allow stacking */ - if (n && !testing_stack) return (0); - - /* Make an object */ o_idx = o_pop(); --- 3574,3579 ---- *************** *** 3539,3545 **** { object_type *o_ptr; ! /* Acquire object */ o_ptr = &o_list[o_idx]; /* Structure Copy */ --- 3582,3588 ---- { object_type *o_ptr; ! /* Get the object */ o_ptr = &o_list[o_idx]; /* Structure Copy */ *************** *** 3552,3561 **** /* Forget monster */ o_ptr->held_m_idx = 0; ! /* Build a stack */ o_ptr->next_o_idx = cave_o_idx[y][x]; ! /* Place the object */ cave_o_idx[y][x] = o_idx; /* Notice */ --- 3595,3604 ---- /* Forget monster */ o_ptr->held_m_idx = 0; ! /* Link the object to the pile */ o_ptr->next_o_idx = cave_o_idx[y][x]; ! /* Link the floor to the object */ cave_o_idx[y][x] = o_idx; /* Notice */ *************** *** 3671,3680 **** { object_type *o_ptr; ! /* Acquire object */ o_ptr = &o_list[this_o_idx]; ! /* Acquire next object */ next_o_idx = o_ptr->next_o_idx; /* Check for possible combination */ --- 3714,3723 ---- { 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; /* Check for possible combination */ *************** *** 3687,3695 **** /* Add new object */ if (!comb) k++; - /* Option -- allow stacking */ - if (!testing_stack && (k > 1)) continue; - /* Paranoia */ if (k > 99) continue; --- 3730,3735 ---- *************** *** 3943,3948 **** --- 3983,4070 ---- } + /* + * Place a secret door at the given location + */ + void place_secret_door(int y, int x) + { + /* Create secret door */ + cave_set_feat(y, x, FEAT_SECRET); + } + + + /* + * Place a random type of closed door at the given location. + */ + void place_closed_door(int y, int x) + { + int tmp; + + /* Choose an object */ + tmp = rand_int(400); + + /* Closed doors (300/400) */ + if (tmp < 300) + { + /* Create closed door */ + cave_set_feat(y, x, FEAT_DOOR_HEAD + 0x00); + } + + /* Locked doors (99/400) */ + else if (tmp < 399) + { + /* Create locked door */ + cave_set_feat(y, x, FEAT_DOOR_HEAD + randint(7)); + } + + /* Stuck doors (1/400) */ + else + { + /* Create jammed door */ + cave_set_feat(y, x, FEAT_DOOR_HEAD + 0x08 + rand_int(8)); + } + } + + + /* + * Place a random type of door at the given location. + */ + void place_random_door(int y, int x) + { + int tmp; + + /* Choose an object */ + tmp = rand_int(1000); + + /* Open doors (300/1000) */ + if (tmp < 300) + { + /* Create open door */ + cave_set_feat(y, x, FEAT_OPEN); + } + + /* Broken doors (100/1000) */ + else if (tmp < 400) + { + /* Create broken door */ + cave_set_feat(y, x, FEAT_BROKEN); + } + + /* Secret doors (200/1000) */ + else if (tmp < 600) + { + /* Create secret door */ + cave_set_feat(y, x, FEAT_SECRET); + } + + /* Closed, locked, or stuck doors (400/1000) */ + else + { + /* Create closed door */ + place_closed_door(y, x); + } + } + /* * Describe the charges on an item in the inventory. *************** *** 4319,4324 **** --- 4441,4467 ---- if (!object_known_p(o_ptr)) continue; if (!object_known_p(j_ptr)) break; + /* Rods sort by increasing recharge time */ + if (o_ptr->tval == TV_ROD) + { + if (o_ptr->pval < j_ptr->pval) break; + if (o_ptr->pval > j_ptr->pval) continue; + } + + /* Wands/Staffs sort by decreasing charges */ + if ((o_ptr->tval == TV_WAND) || (o_ptr->tval == TV_STAFF)) + { + if (o_ptr->pval > j_ptr->pval) break; + if (o_ptr->pval < j_ptr->pval) continue; + } + + /* Lites sort by decreasing fuel */ + if (o_ptr->tval == TV_LITE) + { + if (o_ptr->pval > j_ptr->pval) break; + if (o_ptr->pval < j_ptr->pval) continue; + } + /* Determine the "value" of the pack item */ j_value = object_value(j_ptr); *************** *** 4345,4351 **** /* Copy the item */ object_copy(&inventory[i], o_ptr); ! /* Access new object */ j_ptr = &inventory[i]; /* Forget stack */ --- 4488,4494 ---- /* Copy the item */ object_copy(&inventory[i], o_ptr); ! /* Get the new object */ j_ptr = &inventory[i]; /* Forget stack */ *************** *** 4485,4491 **** char o_name[80]; ! /* Access original object */ o_ptr = &inventory[item]; /* Error check */ --- 4628,4634 ---- char o_name[80]; ! /* Get the original object */ o_ptr = &inventory[item]; /* Error check */ *************** *** 4501,4507 **** /* Take off first */ item = inven_takeoff(item, amt); ! /* Access original object */ o_ptr = &inventory[item]; } --- 4644,4650 ---- /* Take off first */ item = inven_takeoff(item, amt); ! /* Get the original object */ o_ptr = &inventory[item]; } *************** *** 4668,4673 **** --- 4811,4837 ---- if (!object_known_p(o_ptr)) continue; if (!object_known_p(j_ptr)) break; + /* Rods sort by increasing recharge time */ + if (o_ptr->tval == TV_ROD) + { + if (o_ptr->pval < j_ptr->pval) break; + if (o_ptr->pval > j_ptr->pval) continue; + } + + /* Wands/Staffs sort by decreasing charges */ + if ((o_ptr->tval == TV_WAND) || (o_ptr->tval == TV_STAFF)) + { + if (o_ptr->pval > j_ptr->pval) break; + if (o_ptr->pval < j_ptr->pval) continue; + } + + /* Lites sort by decreasing fuel */ + if (o_ptr->tval == TV_LITE) + { + if (o_ptr->pval > j_ptr->pval) break; + if (o_ptr->pval < j_ptr->pval) continue; + } + /* Determine the "value" of the pack item */ j_value = object_value(j_ptr); *************** *** 4721,4727 **** /* Paranoia -- must be literate */ if (!mp_ptr->spell_book) return (100); ! /* Access the spell */ s_ptr = &mp_ptr->info[spell]; /* Extract the base spell failure rate */ --- 4885,4891 ---- /* Paranoia -- must be literate */ if (!mp_ptr->spell_book) return (100); ! /* Get the spell */ s_ptr = &mp_ptr->info[spell]; /* Extract the base spell failure rate */ *************** *** 4779,4785 **** { magic_type *s_ptr; ! /* Access the spell */ s_ptr = &mp_ptr->info[spell]; /* Spell is illegal */ --- 4943,4949 ---- { magic_type *s_ptr; ! /* Get the spell */ s_ptr = &mp_ptr->info[spell]; /* Spell is illegal */ *************** *** 4902,4908 **** /* ! * Print a list of spells (for browsing or casting or viewing) */ void print_spells(byte *spells, int num, int y, int x) { --- 5066,5072 ---- /* ! * Print a list of spells (for browsing or casting or viewing). */ void print_spells(byte *spells, int num, int y, int x) { *************** *** 4916,4921 **** --- 5080,5086 ---- char out_val[160]; + byte line_attr; /* Title the list */ prt("", y, x); *************** *** 4925,4977 **** /* Dump the spells */ for (i = 0; i < num; i++) { ! /* Access the spell */ spell = spells[i]; ! /* Access the spell */ s_ptr = &mp_ptr->info[spell]; /* Skip illegible spells */ if (s_ptr->slevel >= 99) { sprintf(out_val, " %c) %-30s", I2A(i), "(illegible)"); ! prt(out_val, y + i + 1, x); continue; } - /* XXX XXX Could label spells above the players level */ - /* Get extra info */ spell_info(info, spell); /* Use that info */ comment = info; /* Analyze the spell */ if ((spell < 32) ? ((p_ptr->spell_forgotten1 & (1L << spell))) : ((p_ptr->spell_forgotten2 & (1L << (spell - 32))))) { comment = " forgotten"; } else if (!((spell < 32) ? (p_ptr->spell_learned1 & (1L << spell)) : (p_ptr->spell_learned2 & (1L << (spell - 32))))) { ! comment = " unknown"; } else if (!((spell < 32) ? (p_ptr->spell_worked1 & (1L << spell)) : (p_ptr->spell_worked2 & (1L << (spell - 32))))) { comment = " untried"; } /* Dump the spell --(-- */ sprintf(out_val, " %c) %-30s%2d %4d %3d%%%s", I2A(i), spell_names[mp_ptr->spell_type][spell], s_ptr->slevel, s_ptr->smana, spell_chance(spell), comment); ! prt(out_val, y + i + 1, x); } /* Clear the bottom line */ --- 5090,5154 ---- /* Dump the spells */ for (i = 0; i < num; i++) { ! /* Get the spell index */ spell = spells[i]; ! /* Get the spell info */ s_ptr = &mp_ptr->info[spell]; /* Skip illegible spells */ if (s_ptr->slevel >= 99) { sprintf(out_val, " %c) %-30s", I2A(i), "(illegible)"); ! c_prt(TERM_L_DARK, out_val, y + i + 1, x); continue; } /* Get extra info */ spell_info(info, spell); /* Use that info */ comment = info; + /* Assume spell is known and tried */ + line_attr = TERM_WHITE; + /* Analyze the spell */ if ((spell < 32) ? ((p_ptr->spell_forgotten1 & (1L << spell))) : ((p_ptr->spell_forgotten2 & (1L << (spell - 32))))) { comment = " forgotten"; + line_attr = TERM_YELLOW; } else if (!((spell < 32) ? (p_ptr->spell_learned1 & (1L << spell)) : (p_ptr->spell_learned2 & (1L << (spell - 32))))) { ! if (s_ptr->slevel <= p_ptr->lev) ! { ! comment = " unknown"; ! line_attr = TERM_L_BLUE; ! } ! else ! { ! comment = " difficult"; ! line_attr = TERM_RED; ! } } else if (!((spell < 32) ? (p_ptr->spell_worked1 & (1L << spell)) : (p_ptr->spell_worked2 & (1L << (spell - 32))))) { comment = " untried"; + line_attr = TERM_L_GREEN; } /* Dump the spell --(-- */ sprintf(out_val, " %c) %-30s%2d %4d %3d%%%s", I2A(i), spell_names[mp_ptr->spell_type][spell], s_ptr->slevel, s_ptr->smana, spell_chance(spell), comment); ! c_prt(line_attr, out_val, y + i + 1, x); } /* Clear the bottom line */ *************** *** 5037,5043 **** byte spells[64]; ! /* Access the item's sval */ sval = i_ptr->sval; /* Extract spells */ --- 5214,5220 ---- byte spells[64]; ! /* Get the item's sval */ sval = i_ptr->sval; /* Extract spells */ diff -r -c angband-283/src/save.c angband-285/src/save.c *** angband-283/src/save.c Fri Feb 6 04:10:31 1998 --- angband-285/src/save.c Sun Sep 5 12:11:36 1999 *************** *** 227,233 **** /*** Hack -- extract some data ***/ ! /* Hack -- Acquire the current time */ now = time((time_t*)(NULL)); /* Note the operating system */ --- 227,233 ---- /*** Hack -- extract some data ***/ ! /* Hack -- Get the current time */ now = time((time_t*)(NULL)); /* Note the operating system */ *************** *** 698,708 **** --- 698,710 ---- wr_s16b(o_ptr->pval); wr_byte(o_ptr->discount); + wr_byte(o_ptr->number); wr_s16b(o_ptr->weight); wr_byte(o_ptr->name1); wr_byte(o_ptr->name2); + wr_s16b(o_ptr->timeout); wr_s16b(o_ptr->to_h); *************** *** 893,900 **** { int i, k; - u16b c; - u32b flag[8]; u32b mask[8]; --- 895,900 ---- *************** *** 913,932 **** /* Write "hitpoint_warn" */ wr_byte(op_ptr->hitpoint_warn); ! ! /*** Cheating options ***/ ! ! c = 0; ! ! if (p_ptr->wizard) c |= 0x0002; ! ! /* Save the cheating flags */ ! for (i = 0; i < CHEAT_MAX; i++) ! { ! if (p_ptr->cheat[i]) c |= (0x0100 << i); ! } ! ! wr_u16b(c); /*** Normal options ***/ --- 913,919 ---- /* Write "hitpoint_warn" */ wr_byte(op_ptr->hitpoint_warn); ! wr_u16b(0); /* oops */ /*** Normal options ***/ *************** *** 1041,1048 **** wr_s16b(p_ptr->wt); /* Dump the stats (maximum and current) */ ! for (i = 0; i < 6; ++i) wr_s16b(p_ptr->stat_max[i]); ! for (i = 0; i < 6; ++i) wr_s16b(p_ptr->stat_cur[i]); /* Ignore the transient stats */ for (i = 0; i < 12; ++i) wr_s16b(0); --- 1028,1035 ---- wr_s16b(p_ptr->wt); /* Dump the stats (maximum and current) */ ! for (i = 0; i < A_MAX; ++i) wr_s16b(p_ptr->stat_max[i]); ! for (i = 0; i < A_MAX; ++i) wr_s16b(p_ptr->stat_cur[i]); /* Ignore the transient stats */ for (i = 0; i < 12; ++i) wr_s16b(0); *************** *** 1110,1121 **** wr_byte(0); /* oops */ wr_byte(0); /* oops */ wr_byte(p_ptr->searching); ! wr_byte(p_ptr->maximize); ! wr_byte(p_ptr->preserve); wr_byte(0); /* Future use */ ! for (i = 0; i < 12; i++) wr_u32b(0L); /* Ignore some flags */ wr_u32b(0L); /* oops */ --- 1097,1116 ---- wr_byte(0); /* oops */ wr_byte(0); /* oops */ wr_byte(p_ptr->searching); ! wr_byte(0); /* oops */ ! wr_byte(0); /* oops */ wr_byte(0); /* Future use */ ! for (i = 0; i < 10; i++) wr_u32b(0L); ! ! ! /* Random artifact version */ ! wr_u32b(RANDART_VERSION); ! ! /* Random artifact seed */ ! wr_u32b(seed_randart); ! /* Ignore some flags */ wr_u32b(0L); /* oops */ *************** *** 1337,1344 **** xor_byte = 0; wr_byte(VERSION_PATCH); xor_byte = 0; ! tmp8u = rand_int(256); ! wr_byte(tmp8u); /* Reset the checksum */ --- 1332,1338 ---- xor_byte = 0; wr_byte(VERSION_PATCH); xor_byte = 0; ! wr_byte(VERSION_EXTRA); /* Reset the checksum */ diff -r -c angband-283/src/spells1.c angband-285/src/spells1.c *** angband-283/src/spells1.c Wed Feb 11 06:30:29 1998 --- angband-285/src/spells1.c Wed Sep 1 17:57:47 1999 *************** *** 273,278 **** --- 273,284 ---- */ void teleport_player_level(void) { + if (adult_ironman) + { + msg_print("Nothing happens."); + return; + } + if (!p_ptr->depth) { msg_print("You sink through the floor."); *************** *** 1017,1023 **** int cur, max, loss, same, res = FALSE; ! /* Acquire current value */ cur = p_ptr->stat_cur[stat]; max = p_ptr->stat_max[stat]; --- 1023,1029 ---- int cur, max, loss, same, res = FALSE; ! /* Get the current value */ cur = p_ptr->stat_cur[stat]; max = p_ptr->stat_max[stat]; *************** *** 1366,1371 **** --- 1372,1389 ---- /* Destroy Traps (and Locks) */ case GF_KILL_TRAP: { + /* Reveal secret doors */ + if (cave_feat[y][x] == FEAT_SECRET) + { + place_closed_door(y, x); + + /* Check line of sight */ + if (player_has_los_bold(y, x)) + { + obvious = TRUE; + } + } + /* Destroy traps */ if ((cave_feat[y][x] == FEAT_INVIS) || ((cave_feat[y][x] >= FEAT_TRAP_HEAD) && *************** *** 1385,1394 **** cave_set_feat(y, x, FEAT_FLOOR); } ! /* Secret / Locked doors are found and unlocked */ ! else if ((cave_feat[y][x] == FEAT_SECRET) || ! ((cave_feat[y][x] >= FEAT_DOOR_HEAD + 0x01) && ! (cave_feat[y][x] <= FEAT_DOOR_HEAD + 0x07))) { /* Unlock the door */ cave_set_feat(y, x, FEAT_DOOR_HEAD + 0x00); --- 1403,1411 ---- cave_set_feat(y, x, FEAT_FLOOR); } ! /* Locked doors are unlocked */ ! else if ((cave_feat[y][x] >= FEAT_DOOR_HEAD + 0x01) && ! (cave_feat[y][x] <= FEAT_DOOR_HEAD + 0x07)) { /* Unlock the door */ cave_set_feat(y, x, FEAT_DOOR_HEAD + 0x00); *************** *** 1691,1700 **** cptr note_kill = NULL; ! /* Acquire object */ o_ptr = &o_list[this_o_idx]; ! /* Acquire next object */ next_o_idx = o_ptr->next_o_idx; /* Extract the flags */ --- 1708,1717 ---- cptr note_kill = NULL; ! /* Get the object */ o_ptr = &o_list[this_o_idx]; ! /* Get the next object */ next_o_idx = o_ptr->next_o_idx; /* Extract the flags */ *************** *** 3560,3566 **** { msg_print("You're not as powerful as you used to be..."); ! for (k = 0; k < 6; k++) { p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 3) / 4; if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3; --- 3577,3583 ---- { msg_print("You're not as powerful as you used to be..."); ! for (k = 0; k < A_MAX; k++) { p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 3) / 4; if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3; diff -r -c angband-283/src/spells2.c angband-285/src/spells2.c *** angband-283/src/spells2.c Wed Feb 11 06:30:29 1998 --- angband-285/src/spells2.c Fri Sep 3 15:41:51 1999 *************** *** 129,135 **** { bool sust = FALSE; ! /* Access the "sustain" */ switch (stat) { case A_STR: if (p_ptr->sustain_str) sust = TRUE; break; --- 129,135 ---- { bool sust = FALSE; ! /* Get the "sustain" */ switch (stat) { case A_STR: if (p_ptr->sustain_str) sust = TRUE; break; *************** *** 271,277 **** /* ! * Removes curses from items in inventory * * Note that Items which are "Perma-Cursed" (The One Ring, * The Crown of Morgoth) can NEVER be uncursed. --- 271,296 ---- /* ! * Hack -- Removes curse from an object. ! */ ! static void uncurse_object(object_type *o_ptr) ! { ! /* Uncurse it */ ! o_ptr->ident &= ~(IDENT_CURSED); ! ! /* Remove special inscription, if any */ ! if (o_ptr->discount >= INSCRIP_NULL) o_ptr->discount = 0; ! ! /* Take note if allowed */ ! if (o_ptr->discount == 0) o_ptr->discount = INSCRIP_UNCURSED; ! ! /* The object has been "sensed" */ ! o_ptr->ident |= (IDENT_SENSE); ! } ! ! ! /* ! * Removes curses from items in inventory. * * Note that Items which are "Perma-Cursed" (The One Ring, * The Crown of Morgoth) can NEVER be uncursed. *************** *** 306,319 **** /* Perma-Cursed Items can NEVER be uncursed */ if (f3 & (TR3_PERMA_CURSE)) continue; ! /* Uncurse it */ ! o_ptr->ident &= ~(IDENT_CURSED); ! ! /* Hack -- Assume felt */ ! o_ptr->ident |= (IDENT_SENSE); ! ! /* Take note */ ! o_ptr->note = quark_add("uncursed"); /* Recalculate the bonuses */ p_ptr->update |= (PU_BONUS); --- 325,332 ---- /* Perma-Cursed Items can NEVER be uncursed */ if (f3 & (TR3_PERMA_CURSE)) continue; ! /* Uncurse the object */ ! uncurse_object(o_ptr); /* Recalculate the bonuses */ p_ptr->update |= (PU_BONUS); *************** *** 398,404 **** cptr info[128]; ! /* Acquire item flags from equipment */ for (k = INVEN_WIELD; k < INVEN_TOTAL; k++) { u32b t1, t2, t3; --- 411,417 ---- cptr info[128]; ! /* Get item flags from equipment */ for (k = INVEN_WIELD; k < INVEN_TOTAL; k++) { u32b t1, t2, t3; *************** *** 725,731 **** } ! /* Access the current weapon */ o_ptr = &inventory[INVEN_WIELD]; /* Analyze the weapon */ --- 738,744 ---- } ! /* Get the current weapon */ o_ptr = &inventory[INVEN_WIELD]; /* Analyze the weapon */ *************** *** 869,903 **** /* Allow "protection" by the MENTAL flag */ if (o_ptr->ident & (IDENT_MENTAL)) continue; ! /* Remove "default inscriptions" */ ! if (o_ptr->note && (o_ptr->ident & (IDENT_SENSE))) ! { ! /* Access the inscription */ ! cptr q = quark_str(o_ptr->note); ! ! /* Hack -- Remove auto-inscriptions */ ! if ((streq(q, "cursed")) || ! (streq(q, "broken")) || ! (streq(q, "good")) || ! (streq(q, "average")) || ! (streq(q, "excellent")) || ! (streq(q, "worthless")) || ! (streq(q, "special")) || ! (streq(q, "terrible"))) ! { ! /* Forget the inscription */ ! o_ptr->note = 0; ! } ! } ! /* Hack -- Clear the "empty" flag */ ! o_ptr->ident &= ~(IDENT_EMPTY); /* Hack -- Clear the "known" flag */ o_ptr->ident &= ~(IDENT_KNOWN); ! /* Hack -- Clear the "felt" flag */ ! o_ptr->ident &= ~(IDENT_SENSE); } /* Recalculate bonuses */ --- 882,898 ---- /* Allow "protection" by the MENTAL flag */ if (o_ptr->ident & (IDENT_MENTAL)) continue; ! /* Remove special inscription, if any */ ! if (o_ptr->discount >= INSCRIP_NULL) o_ptr->discount = 0; ! /* Hack -- Clear the "felt" flag */ ! o_ptr->ident &= ~(IDENT_SENSE); /* Hack -- Clear the "known" flag */ o_ptr->ident &= ~(IDENT_KNOWN); ! /* Hack -- Clear the "empty" flag */ ! o_ptr->ident &= ~(IDENT_EMPTY); } /* Recalculate bonuses */ *************** *** 918,923 **** --- 913,946 ---- + /* + * Set word of recall as appropriate + */ + void set_recall(void) + { + /* Ironman */ + if (adult_ironman && !p_ptr->total_winner) + { + msg_print("Nothing happens."); + return; + } + + /* Activate recall */ + if (!p_ptr->word_recall) + { + p_ptr->word_recall = rand_int(20) + 15; + msg_print("The air about you becomes charged..."); + } + + /* Deactivate recall */ + else + { + p_ptr->word_recall = 0; + msg_print("A tension leaves the air around you..."); + } + } + + /* * Detect all traps on current panel *************** *** 987,999 **** /* Detect secret doors */ if (cave_feat[y][x] == FEAT_SECRET) { ! /* Pick a door XXX XXX XXX */ ! cave_set_feat(y, x, FEAT_DOOR_HEAD + 0x00); } /* Detect doors */ if (((cave_feat[y][x] >= FEAT_DOOR_HEAD) && ! (cave_feat[y][x] <= FEAT_DOOR_HEAD)) || ((cave_feat[y][x] == FEAT_OPEN) || (cave_feat[y][x] == FEAT_BROKEN))) { --- 1010,1022 ---- /* Detect secret doors */ if (cave_feat[y][x] == FEAT_SECRET) { ! /* Pick a door */ ! place_closed_door(y, x); } /* Detect doors */ if (((cave_feat[y][x] >= FEAT_DOOR_HEAD) && ! (cave_feat[y][x] <= FEAT_DOOR_TAIL)) || ((cave_feat[y][x] == FEAT_OPEN) || (cave_feat[y][x] == FEAT_BROKEN))) { *************** *** 1639,1658 **** else if (o_ptr->to_h > 15) chance = 1000; else chance = enchant_table[o_ptr->to_h]; if ((randint(1000) > chance) && (!a || (rand_int(100) < 50))) { - o_ptr->to_h++; res = TRUE; ! /* only when you get it above -1 -CFT */ if (cursed_p(o_ptr) && (!(f3 & (TR3_PERMA_CURSE))) && (o_ptr->to_h >= 0) && (rand_int(100) < 25)) { msg_print("The curse is broken!"); ! o_ptr->ident &= ~(IDENT_CURSED); ! o_ptr->ident |= (IDENT_SENSE); ! o_ptr->note = quark_add("uncursed"); } } } --- 1662,1684 ---- else if (o_ptr->to_h > 15) chance = 1000; else chance = enchant_table[o_ptr->to_h]; + /* Attempt to enchant */ if ((randint(1000) > chance) && (!a || (rand_int(100) < 50))) { res = TRUE; ! /* Enchant */ ! o_ptr->to_h++; ! ! /* Break curse */ if (cursed_p(o_ptr) && (!(f3 & (TR3_PERMA_CURSE))) && (o_ptr->to_h >= 0) && (rand_int(100) < 25)) { msg_print("The curse is broken!"); ! ! /* Uncurse the object */ ! uncurse_object(o_ptr); } } } *************** *** 1664,1683 **** else if (o_ptr->to_d > 15) chance = 1000; else chance = enchant_table[o_ptr->to_d]; if ((randint(1000) > chance) && (!a || (rand_int(100) < 50))) { - o_ptr->to_d++; res = TRUE; ! /* only when you get it above -1 -CFT */ if (cursed_p(o_ptr) && (!(f3 & (TR3_PERMA_CURSE))) && (o_ptr->to_d >= 0) && (rand_int(100) < 25)) { msg_print("The curse is broken!"); ! o_ptr->ident &= ~(IDENT_CURSED); ! o_ptr->ident |= (IDENT_SENSE); ! o_ptr->note = quark_add("uncursed"); } } } --- 1690,1712 ---- else if (o_ptr->to_d > 15) chance = 1000; else chance = enchant_table[o_ptr->to_d]; + /* Attempt to enchant */ if ((randint(1000) > chance) && (!a || (rand_int(100) < 50))) { res = TRUE; ! /* Enchant */ ! o_ptr->to_d++; ! ! /* Break curse */ if (cursed_p(o_ptr) && (!(f3 & (TR3_PERMA_CURSE))) && (o_ptr->to_d >= 0) && (rand_int(100) < 25)) { msg_print("The curse is broken!"); ! ! /* Uncurse the object */ ! uncurse_object(o_ptr); } } } *************** *** 1689,1708 **** else if (o_ptr->to_a > 15) chance = 1000; else chance = enchant_table[o_ptr->to_a]; if ((randint(1000) > chance) && (!a || (rand_int(100) < 50))) { - o_ptr->to_a++; res = TRUE; ! /* only when you get it above -1 -CFT */ if (cursed_p(o_ptr) && (!(f3 & (TR3_PERMA_CURSE))) && (o_ptr->to_a >= 0) && (rand_int(100) < 25)) { msg_print("The curse is broken!"); ! o_ptr->ident &= ~(IDENT_CURSED); ! o_ptr->ident |= (IDENT_SENSE); ! o_ptr->note = quark_add("uncursed"); } } } --- 1718,1740 ---- else if (o_ptr->to_a > 15) chance = 1000; else chance = enchant_table[o_ptr->to_a]; + /* Attempt to enchant */ if ((randint(1000) > chance) && (!a || (rand_int(100) < 50))) { res = TRUE; ! /* Enchant */ ! o_ptr->to_a++; ! ! /* Break curse */ if (cursed_p(o_ptr) && (!(f3 & (TR3_PERMA_CURSE))) && (o_ptr->to_a >= 0) && (rand_int(100) < 25)) { msg_print("The curse is broken!"); ! ! /* Uncurse the object */ ! uncurse_object(o_ptr); } } } *************** *** 2637,2645 **** /* Check around the player */ for (i = 0; i < 8; i++) { ! /* Access the location */ ! y = py + ddy[i]; ! x = px + ddx[i]; /* Skip non-empty grids */ if (!cave_empty_bold(y, x)) continue; --- 2669,2677 ---- /* Check around the player */ for (i = 0; i < 8; i++) { ! /* Get the location */ ! y = py + ddy_ddd[i]; ! x = px + ddx_ddd[i]; /* Skip non-empty grids */ if (!cave_empty_bold(y, x)) continue; *************** *** 2753,2761 **** /* Look for safety */ for (i = 0; i < 8; i++) { ! /* Access the grid */ ! y = yy + ddy[i]; ! x = xx + ddx[i]; /* Skip non-empty grids */ if (!cave_empty_bold(y, x)) continue; --- 2785,2793 ---- /* Look for safety */ for (i = 0; i < 8; i++) { ! /* Get the grid */ ! y = yy + ddy_ddd[i]; ! x = xx + ddx_ddd[i]; /* Skip non-empty grids */ if (!cave_empty_bold(y, x)) continue; *************** *** 2782,2788 **** msg_format("%^s wails out in pain!", m_name); /* Take damage from the quake */ ! damage = (sn ? damroll(4, 8) : 200); /* Monster is certainly awake */ m_ptr->csleep = 0; --- 2814,2820 ---- msg_format("%^s wails out in pain!", m_name); /* Take damage from the quake */ ! damage = (sn ? damroll(4, 8) : (m_ptr->hp + 1)); /* Monster is certainly awake */ m_ptr->csleep = 0; *************** *** 2971,2977 **** { char m_name[80]; ! /* Acquire the monster name */ monster_desc(m_name, m_ptr, 0); /* Dump a message */ --- 3003,3009 ---- { char m_name[80]; ! /* Get the monster name */ monster_desc(m_name, m_ptr, 0); /* Dump a message */ *************** *** 3428,3432 **** int flg = PROJECT_KILL | PROJECT_HIDE; return (project(-1, 1, py, px, p_ptr->lev, GF_OLD_SLEEP, flg)); } - - --- 3460,3462 ---- diff -r -c angband-283/src/store.c angband-285/src/store.c *** angband-283/src/store.c Wed Feb 11 06:30:29 1998 --- angband-285/src/store.c Fri Sep 3 15:44:34 1999 *************** *** 208,214 **** */ static void say_comment_6(void) { ! msg_print(comment_6[rand_int(5)]); } --- 208,214 ---- */ static void say_comment_6(void) { ! msg_print(comment_6[rand_int(MAX_COMMENT_6)]); } *************** *** 428,434 **** if (adjust > 100) adjust = 100; /* Mega-Hack -- Black market sucks */ ! if (store_num == 6) price = price / 2; } /* Shop is selling */ --- 428,434 ---- if (adjust > 100) adjust = 100; /* Mega-Hack -- Black market sucks */ ! if (store_num == STORE_B_MARKET) price = price / 2; } /* Shop is selling */ *************** *** 441,447 **** if (adjust < 100) adjust = 100; /* Mega-Hack -- Black market sucks */ ! if (store_num == 6) price = price * 2; } /* Compute the final price (with rounding) */ --- 441,447 ---- if (adjust < 100) adjust = 100; /* Mega-Hack -- Black market sucks */ ! if (store_num == STORE_B_MARKET) price = price * 2; } /* Compute the final price (with rounding) */ *************** *** 456,462 **** /* ! * Special "mass production" computation */ static int mass_roll(int num, int max) { --- 456,462 ---- /* ! * Special "mass production" computation. */ static int mass_roll(int num, int max) { *************** *** 470,481 **** /* ! * Certain "cheap" objects should be created in "piles" ! * Some objects can be sold at a "discount" (in small piles) */ static void mass_produce(object_type *o_ptr) { int size = 1; int discount = 0; s32b cost = object_value(o_ptr); --- 470,485 ---- /* ! * Certain "cheap" objects should be created in "piles". ! * ! * Some objects can be sold at a "discount" (in smaller piles). ! * ! * Standard percentage discounts include 10, 25, 50, 75, and 90. */ static void mass_produce(object_type *o_ptr) { int size = 1; + int discount = 0; s32b cost = object_value(o_ptr); *************** *** 550,555 **** --- 554,563 ---- } else if (rand_int(25) == 0) { + discount = 10; + } + else if (rand_int(50) == 0) + { discount = 25; } else if (rand_int(150) == 0) *************** *** 609,617 **** /* ! * Determine if a store object can "absorb" another object * ! * See "object_similar()" for the same function for the "player" */ static bool store_object_similar(object_type *o_ptr, object_type *j_ptr) { --- 617,629 ---- /* ! * Determine if a store object can "absorb" another object. ! * ! * See "object_similar()" for the same function for the "player". * ! * This function can ignore many of the checks done for the player, ! * since stores (but not the home) only get objects under certain ! * restricted circumstances. */ static bool store_object_similar(object_type *o_ptr, object_type *j_ptr) { *************** *** 625,633 **** if (o_ptr->pval != j_ptr->pval) return (0); /* Require many identical values */ ! if (o_ptr->to_h != j_ptr->to_h) return (0); ! if (o_ptr->to_d != j_ptr->to_d) return (0); ! if (o_ptr->to_a != j_ptr->to_a) return (0); /* Require identical "artifact" names */ if (o_ptr->name1 != j_ptr->name1) return (0); --- 637,645 ---- if (o_ptr->pval != j_ptr->pval) return (0); /* Require many identical values */ ! if (o_ptr->to_h != j_ptr->to_h) return (0); ! if (o_ptr->to_d != j_ptr->to_d) return (0); ! if (o_ptr->to_a != j_ptr->to_a) return (0); /* Require identical "artifact" names */ if (o_ptr->name1 != j_ptr->name1) return (0); *************** *** 642,655 **** if (o_ptr->timeout || j_ptr->timeout) return (0); /* Require many identical values */ ! if (o_ptr->ac != j_ptr->ac) return (0); ! if (o_ptr->dd != j_ptr->dd) return (0); ! if (o_ptr->ds != j_ptr->ds) return (0); /* Hack -- Never stack chests */ if (o_ptr->tval == TV_CHEST) return (0); ! /* Require matching discounts */ if (o_ptr->discount != j_ptr->discount) return (0); /* They match, so they must be similar */ --- 654,667 ---- if (o_ptr->timeout || j_ptr->timeout) return (0); /* Require many identical values */ ! if (o_ptr->ac != j_ptr->ac) return (0); ! if (o_ptr->dd != j_ptr->dd) return (0); ! if (o_ptr->ds != j_ptr->ds) return (0); /* Hack -- Never stack chests */ if (o_ptr->tval == TV_CHEST) return (0); ! /* Require matching "discount" fields */ if (o_ptr->discount != j_ptr->discount) return (0); /* They match, so they must be similar */ *************** *** 685,691 **** if (st_ptr->stock_num < st_ptr->stock_size) return TRUE; /* The "home" acts like the player */ ! if (store_num == 7) { /* Check all the objects */ for (i = 0; i < st_ptr->stock_num; i++) --- 697,703 ---- if (st_ptr->stock_num < st_ptr->stock_size) return TRUE; /* The "home" acts like the player */ ! if (store_num == STORE_HOME) { /* Check all the objects */ for (i = 0; i < st_ptr->stock_num; i++) *************** *** 727,733 **** static bool store_will_buy(object_type *o_ptr) { /* Hack -- The Home is simple */ ! if (store_num == 7) return (TRUE); /* Switch on the store */ switch (store_num) --- 739,745 ---- static bool store_will_buy(object_type *o_ptr) { /* Hack -- The Home is simple */ ! if (store_num == STORE_HOME) return (TRUE); /* Switch on the store */ switch (store_num) *************** *** 982,987 **** --- 994,1003 ---- /* Erase the inscription */ o_ptr->note = 0; + /* Remove special inscription, if any */ + if (o_ptr->discount >= INSCRIP_NULL) o_ptr->discount = 0; + + /* Check each existing object (try to combine) */ for (slot = 0; slot < st_ptr->stock_num; slot++) { *************** *** 991,997 **** /* Can the existing items be incremented? */ if (store_object_similar(j_ptr, o_ptr)) { ! /* Hack -- extra items disappear */ store_object_absorb(j_ptr, o_ptr); /* All done */ --- 1007,1013 ---- /* Can the existing items be incremented? */ if (store_object_similar(j_ptr, o_ptr)) { ! /* Absorb (some of) the object */ store_object_absorb(j_ptr, o_ptr); /* All done */ *************** *** 1114,1122 **** if (o_ptr->to_h > 0) return (FALSE); if (o_ptr->to_d > 0) return (FALSE); ! /* Check the other "normal" stores */ ! for (i = 0; i < 6; i++) { /* Check every object in the store */ for (j = 0; j < store[i].stock_num; j++) { --- 1130,1142 ---- if (o_ptr->to_h > 0) return (FALSE); if (o_ptr->to_d > 0) return (FALSE); ! /* Check the other stores */ ! for (i = 0; i < MAX_STORES; i++) { + /* Skip home and black market */ + if (i == STORE_B_MARKET || i == STORE_HOME) + continue; + /* Check every object in the store */ for (j = 0; j < store[i].stock_num; j++) { *************** *** 1188,1194 **** for (tries = 0; tries < 4; tries++) { /* Black Market */ ! if (store_num == 6) { /* Pick a level for object/magic */ level = 25 + rand_int(25); --- 1208,1214 ---- for (tries = 0; tries < 4; tries++) { /* Black Market */ ! if (store_num == STORE_B_MARKET) { /* Pick a level for object/magic */ level = 25 + rand_int(25); *************** *** 1235,1241 **** if (i_ptr->tval == TV_CHEST) continue; /* Prune the black market */ ! if (store_num == 6) { /* Hack -- No "crappy" items */ if (black_market_crap(i_ptr)) continue; --- 1255,1261 ---- if (i_ptr->tval == TV_CHEST) continue; /* Prune the black market */ ! if (store_num == STORE_B_MARKET) { /* Hack -- No "crappy" items */ if (black_market_crap(i_ptr)) continue; *************** *** 1354,1360 **** prt(out_val, y, 0); /* Describe an object in the home */ ! if (store_num == 7) { byte attr; --- 1374,1380 ---- prt(out_val, y, 0); /* Describe an object in the home */ ! if (store_num == STORE_HOME) { byte attr; *************** *** 1367,1373 **** object_desc(o_name, o_ptr, TRUE, 3); o_name[maxwid] = '\0'; ! /* Acquire inventory color */ attr = tval_to_attr[o_ptr->tval & 0x7F]; /* Display the object */ --- 1387,1393 ---- object_desc(o_name, o_ptr, TRUE, 3); o_name[maxwid] = '\0'; ! /* Get inventory color */ attr = tval_to_attr[o_ptr->tval & 0x7F]; /* Display the object */ *************** *** 1398,1404 **** object_desc_store(o_name, o_ptr, TRUE, 3); o_name[maxwid] = '\0'; ! /* Acquire inventory color */ attr = tval_to_attr[o_ptr->tval & 0x7F]; /* Display the object */ --- 1418,1424 ---- object_desc_store(o_name, o_ptr, TRUE, 3); o_name[maxwid] = '\0'; ! /* Get inventory color */ attr = tval_to_attr[o_ptr->tval & 0x7F]; /* Display the object */ *************** *** 1515,1521 **** Term_clear(); /* The "Home" is special */ ! if (store_num == 7) { /* Put the owner name */ put_str("Your Home", 3, 30); --- 1535,1541 ---- Term_clear(); /* The "Home" is special */ ! if (store_num == STORE_HOME) { /* Put the owner name */ put_str("Your Home", 3, 30); *************** *** 1586,1591 **** --- 1606,1625 ---- object_type *o_ptr; + #ifdef ALLOW_REPEAT + + /* Get the item index */ + if (repeat_pull(com_val)) + { + /* Verify the item */ + if ((*com_val >= 0) && (*com_val <= (st_ptr->stock_num - 1))) + { + /* Success */ + return (TRUE); + } + } + + #endif /* ALLOW_REPEAT */ /* Assume failure */ *com_val = (-1); *************** *** 1598,1610 **** /* Ask until done */ while (TRUE) { ! int ver; /* Escape */ if (!get_com(buf, &which)) return (FALSE); ! /* Extract "query" setting */ ! ver = isupper(which); which = tolower(which); /* Convert response to item */ --- 1632,1646 ---- /* Ask until done */ while (TRUE) { ! bool verify; /* Escape */ if (!get_com(buf, &which)) return (FALSE); ! /* Note verify */ ! verify = (isupper(which) ? TRUE : FALSE); ! ! /* Lowercase */ which = tolower(which); /* Convert response to item */ *************** *** 1620,1637 **** } /* No verification */ ! if (!ver) break; /* Object */ o_ptr = &st_ptr->stock[item]; /* Home */ ! if (store_num == 7) { /* Describe */ object_desc(o_name, o_ptr, TRUE, 3); } ! /* Shop */ else { --- 1656,1673 ---- } /* No verification */ ! if (!verify) break; /* Object */ o_ptr = &st_ptr->stock[item]; /* Home */ ! if (store_num == STORE_HOME) { /* Describe */ object_desc(o_name, o_ptr, TRUE, 3); } ! /* Shop */ else { *************** *** 1652,1657 **** --- 1688,1699 ---- /* Save item */ (*com_val) = item; + #ifdef ALLOW_REPEAT + + repeat_push(*com_val); + + #endif /* ALLOW_REPEAT */ + /* Success */ return (TRUE); } *************** *** 1771,1777 **** { cptr p; ! char out_val[81]; /* Default */ strcpy(out_val, ""); --- 1813,1819 ---- { cptr p; ! char out_val[80]; /* Default */ strcpy(out_val, ""); *************** *** 2312,2318 **** /* Empty? */ if (st_ptr->stock_num <= 0) { ! if (store_num == 7) { msg_print("Your home is empty."); } --- 2354,2360 ---- /* Empty? */ if (st_ptr->stock_num <= 0) { ! if (store_num == STORE_HOME) { msg_print("Your home is empty."); } *************** *** 2325,2331 **** /* Prompt */ ! if (store_num == 7) { sprintf(out_val, "Which item do you want to take? "); } --- 2367,2373 ---- /* Prompt */ ! if (store_num == STORE_HOME) { sprintf(out_val, "Which item do you want to take? "); } *************** *** 2363,2369 **** } /* Attempt to buy it */ ! if (store_num != 7) { /* Describe the object (fully) */ object_desc_store(o_name, i_ptr, TRUE, 3); --- 2405,2411 ---- } /* Attempt to buy it */ ! if (store_num != STORE_HOME) { /* Describe the object (fully) */ object_desc_store(o_name, i_ptr, TRUE, 3); *************** *** 2424,2429 **** --- 2466,2474 ---- /* Erase the inscription */ i_ptr->note = 0; + /* Remove special inscription, if any */ + if (o_ptr->discount >= INSCRIP_NULL) o_ptr->discount = 0; + /* Give it to the player */ item_new = inven_carry(i_ptr); *************** *** 2595,2601 **** q = "Drop which item? "; /* Real store */ ! if (store_num != 7) { /* New prompt */ q = "Sell which item? "; --- 2640,2646 ---- q = "Drop which item? "; /* Real store */ ! if (store_num != STORE_HOME) { /* New prompt */ q = "Sell which item? "; *************** *** 2650,2661 **** object_desc(o_name, i_ptr, TRUE, 3); /* Remove any inscription for stores */ ! if (store_num != 7) i_ptr->note = 0; /* Is there room in the store (or the home?) */ if (!store_check_num(i_ptr)) { ! if (store_num == 7) { msg_print("Your home is full."); } --- 2695,2713 ---- object_desc(o_name, i_ptr, TRUE, 3); /* Remove any inscription for stores */ ! if (store_num != STORE_HOME) ! { ! /* Erase the inscription */ ! i_ptr->note = 0; ! ! /* Remove special inscription, if any */ ! if (o_ptr->discount >= INSCRIP_NULL) o_ptr->discount = 0; ! } /* Is there room in the store (or the home?) */ if (!store_check_num(i_ptr)) { ! if (store_num == STORE_HOME) { msg_print("Your home is full."); } *************** *** 2668,2674 **** /* Real store */ ! if (store_num != 7) { /* Describe the transaction */ msg_format("Selling %s (%c).", o_name, index_to_label(item)); --- 2720,2726 ---- /* Real store */ ! if (store_num != STORE_HOME) { /* Describe the transaction */ msg_format("Selling %s (%c).", o_name, index_to_label(item)); *************** *** 2808,2813 **** --- 2860,2873 ---- */ static void store_process_command(void) { + + #ifdef ALLOW_REPEAT + + /* Handle repeating the last command */ + repeat_check(); + + #endif /* ALLOW_REPEAT */ + /* Parse the command */ switch (p_ptr->command_cmd) { *************** *** 2848,2853 **** --- 2908,2921 ---- break; } + /* Ignore */ + case '\n': + case '\r': + { + break; + } + + /* Redraw */ case KTRL('R'): { *************** *** 2870,2882 **** break; } - /* Ignore return */ - case '\r': - { - break; - } - - /*** Inventory Commands ***/ --- 2938,2943 ---- *************** *** 3143,3149 **** which = (cave_feat[py][px] - FEAT_SHOP_HEAD); /* Hack -- Check the "locked doors" */ ! if (store[which].store_open >= turn) { msg_print("The doors are locked."); return; --- 3204,3210 ---- which = (cave_feat[py][px] - FEAT_SHOP_HEAD); /* Hack -- Check the "locked doors" */ ! if (adult_no_stores || store[which].store_open >= turn) { msg_print("The doors are locked."); return; *************** *** 3233,3239 **** object_type *o_ptr = &inventory[item]; /* Hack -- Flee from the store */ ! if (store_num != 7) { /* Message */ msg_print("Your pack is so full that you flee the store..."); --- 3294,3300 ---- object_type *o_ptr = &inventory[item]; /* Hack -- Flee from the store */ ! if (store_num != STORE_HOME) { /* Message */ msg_print("Your pack is so full that you flee the store..."); *************** *** 3314,3321 **** } ! /* Free turn XXX XXX XXX */ ! p_ptr->energy_use = 0; /* Hack -- Cancel automatic command */ --- 3375,3382 ---- } ! /* Take a turn */ ! p_ptr->energy_use = 100; /* Hack -- Cancel automatic command */ *************** *** 3361,3367 **** /* Ignore home */ ! if (which == 7) return; /* Save the store index */ --- 3422,3428 ---- /* Ignore home */ ! if (which == STORE_HOME) return; /* Save the store index */ *************** *** 3387,3393 **** st_ptr->bad_buy = 0; ! /* Hack -- discount all the items */ for (i = 0; i < st_ptr->stock_num; i++) { object_type *o_ptr; --- 3448,3454 ---- st_ptr->bad_buy = 0; ! /* Discount all the items */ for (i = 0; i < st_ptr->stock_num; i++) { object_type *o_ptr; *************** *** 3395,3408 **** /* Get the object */ o_ptr = &st_ptr->stock[i]; ! /* Sell all old items for "half price" */ ! o_ptr->discount = 50; /* Clear the "fixed price" flag */ o_ptr->ident &= ~(IDENT_FIXED); - - /* Inscribe the object as "on sale" */ - o_ptr->note = quark_add("on sale"); } } --- 3456,3466 ---- /* Get the object */ o_ptr = &st_ptr->stock[i]; ! /* Discount non-discounted items by 40 percent */ ! if (o_ptr->discount == 0) o_ptr->discount = 40; /* Clear the "fixed price" flag */ o_ptr->ident &= ~(IDENT_FIXED); } } *************** *** 3418,3424 **** /* Ignore home */ ! if (which == 7) return; /* Save the store index */ --- 3476,3482 ---- /* Ignore home */ ! if (which == STORE_HOME) return; /* Save the store index */ *************** *** 3436,3442 **** /* Mega-Hack -- prune the black market */ ! if (store_num == 6) { /* Destroy crappy black market items */ for (j = st_ptr->stock_num - 1; j >= 0; j--) --- 3494,3500 ---- /* Mega-Hack -- prune the black market */ ! if (store_num == STORE_B_MARKET) { /* Destroy crappy black market items */ for (j = st_ptr->stock_num - 1; j >= 0; j--) *************** *** 3488,3494 **** /* Hack -- prevent "overflow" */ if (j >= st_ptr->stock_size) j = st_ptr->stock_size - 1; ! /* Acquire some new items */ while (st_ptr->stock_num < j) store_create(); --- 3546,3552 ---- /* Hack -- prevent "overflow" */ if (j >= st_ptr->stock_size) j = st_ptr->stock_size - 1; ! /* Create some new items */ while (st_ptr->stock_num < j) store_create(); diff -r -c angband-283/src/tables.c angband-285/src/tables.c *** angband-283/src/tables.c Wed Feb 11 06:30:29 1998 --- angband-285/src/tables.c Sun Sep 5 10:46:04 1999 *************** *** 14,26 **** /* ! * Global array for looping through the "keypad directions" */ s16b ddd[9] = { 2, 8, 6, 4, 3, 1, 9, 7, 5 }; /* ! * Global arrays for converting "keypad direction" into offsets */ s16b ddx[10] = { 0, -1, 0, 1, -1, 0, 1, -1, 0, 1 }; --- 14,26 ---- /* ! * Global array for looping through the "keypad directions". */ s16b ddd[9] = { 2, 8, 6, 4, 3, 1, 9, 7, 5 }; /* ! * Global arrays for converting "keypad direction" into "offsets". */ s16b ddx[10] = { 0, -1, 0, 1, -1, 0, 1, -1, 0, 1 }; *************** *** 29,35 **** { 0, 1, 1, 1, 0, 0, 0, -1, -1, -1 }; /* ! * Global arrays for optimizing "ddx[ddd[i]]" and "ddy[ddd[i]]" */ s16b ddx_ddd[9] = { 0, 0, 1, -1, 1, -1, 1, -1, 0 }; --- 29,35 ---- { 0, 1, 1, 1, 0, 0, 0, -1, -1, -1 }; /* ! * Global arrays for optimizing "ddx[ddd[i]]" and "ddy[ddd[i]]". */ s16b ddx_ddd[9] = { 0, 0, 1, -1, 1, -1, 1, -1, 0 }; *************** *** 38,44 **** { 1, -1, 0, 0, 1, 1, -1, -1, 0 }; - /* * Global array for converting numbers to uppercase hecidecimal digit * This array can also be used to convert a number to an octal digit --- 38,43 ---- *************** *** 2604,2611 **** NULL, /* xxx */ "auto_haggle", /* OPT_auto_haggle */ "auto_scum", /* OPT_auto_scum */ ! "testing_stack", /* OPT_testing_stack */ ! "testing_carry", /* OPT_testing_carry */ "expand_look", /* OPT_expand_look */ "expand_list", /* OPT_expand_list */ "view_perma_grids", /* OPT_view_perma_grids */ --- 2603,2610 ---- NULL, /* xxx */ "auto_haggle", /* OPT_auto_haggle */ "auto_scum", /* OPT_auto_scum */ ! NULL, /* xxx testing_stack */ ! NULL, /* xxx testing_carry */ "expand_look", /* OPT_expand_look */ "expand_list", /* OPT_expand_list */ "view_perma_grids", /* OPT_view_perma_grids */ *************** *** 2633,2639 **** "view_yellow_lite", /* OPT_view_yellow_lite */ "view_bright_lite", /* OPT_view_bright_lite */ "view_granite_lite", /* OPT_view_granite_lite */ ! "view_special_lite" /* OPT_view_special_lite */ }; --- 2632,2830 ---- "view_yellow_lite", /* OPT_view_yellow_lite */ "view_bright_lite", /* OPT_view_bright_lite */ "view_granite_lite", /* OPT_view_granite_lite */ ! "view_special_lite", /* OPT_view_special_lite */ ! "easy_open", /* OPT_easy_open */ ! "easy_alter", /* OPT_easy_alter */ ! "easy_floor", /* OPT_easy_floor */ ! "show_piles", /* OPT_show_piles */ ! "center_player", /* OPT_center_player */ ! "run_avoid_center", /* OPT_run_avoid_center */ ! "scroll_target", /* OPT_scroll_target */ ! "auto_more", /* OPT_auto_more */ ! "smart_monsters", /* OPT_smart_monsters */ ! "smart_packs", /* OPT_smart_packs */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! "birth_point_based", /* OPT_birth_point_based */ ! "birth_auto_roller", /* OPT_birth_auto_roller */ ! "birth_maximize", /* OPT_birth_maximize */ ! "birth_preserve", /* OPT_birth_preserve */ ! "birth_ironman", /* OPT_birth_ironman */ ! "birth_no_stores", /* OPT_birth_no_stores */ ! "birth_no_artifacts", /* OPT_birth_no_artifacts */ ! "birth_rand_artifacts", /* OPT_birth_rand_artifacts */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! "cheat_peek", /* OPT_cheat_peek */ ! "cheat_hear", /* OPT_cheat_hear */ ! "cheat_room", /* OPT_cheat_room */ ! "cheat_xtra", /* OPT_cheat_xtra */ ! "cheat_know", /* OPT_cheat_know */ ! "cheat_live", /* OPT_cheat_live */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! "adult_point_based", /* OPT_adult_point_based */ ! "adult_auto_roller", /* OPT_adult_auto_roller */ ! "adult_maximize", /* OPT_adult_maximize */ ! "adult_preserve", /* OPT_adult_preserve */ ! "adult_ironman", /* OPT_adult_ironman */ ! "adult_no_stores", /* OPT_adult_no_stores */ ! "adult_no_artifacts", /* OPT_adult_no_artifacts */ ! "adult_rand_artifacts", /* OPT_adult_rand_artifacts */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! "score_peek", /* OPT_score_peek */ ! "score_hear", /* OPT_score_hear */ ! "score_room", /* OPT_score_room */ ! "score_xtra", /* OPT_score_xtra */ ! "score_know", /* OPT_score_know */ ! "score_live", /* OPT_score_live */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL /* xxx */ }; *************** *** 2676,2683 **** NULL, /* xxx */ "Auto-haggle in stores", /* OPT_auto_haggle */ "Auto-scum for good levels", /* OPT_auto_scum */ ! "Allow objects to stack on floor", /* OPT_testing_stack */ ! "Allow monsters to carry objects", /* OPT_testing_carry */ "Expand the power of the look command", /* OPT_expand_look */ "Expand the power of the list commands", /* OPT_expand_list */ "Map remembers all perma-lit grids", /* OPT_view_perma_grids */ --- 2867,2874 ---- NULL, /* xxx */ "Auto-haggle in stores", /* OPT_auto_haggle */ "Auto-scum for good levels", /* OPT_auto_scum */ ! NULL, /* xxx testing_stack */ ! NULL, /* xxx testing_carry */ "Expand the power of the look command", /* OPT_expand_look */ "Expand the power of the list commands", /* OPT_expand_list */ "Map remembers all perma-lit grids", /* OPT_view_perma_grids */ *************** *** 2686,2693 **** "Generate dungeons with connected stairs", /* OPT_dungeon_stair */ "Monsters chase current location (v.slow)", /* OPT_flow_by_sound */ "Monsters chase recent locations (v.slow)", /* OPT_flow_by_smell */ ! NULL, /* xxx */ ! NULL, /* xxx */ "Monsters learn from their mistakes", /* OPT_smart_learn */ "Monsters exploit players weaknesses", /* OPT_smart_cheat */ "Reduce lite-radius when running", /* OPT_view_reduce_lite */ --- 2877,2884 ---- "Generate dungeons with connected stairs", /* OPT_dungeon_stair */ "Monsters chase current location (v.slow)", /* OPT_flow_by_sound */ "Monsters chase recent locations (v.slow)", /* OPT_flow_by_smell */ ! NULL, /* xxx track_follow */ ! NULL, /* xxx track_target */ "Monsters learn from their mistakes", /* OPT_smart_learn */ "Monsters exploit players weaknesses", /* OPT_smart_cheat */ "Reduce lite-radius when running", /* OPT_view_reduce_lite */ *************** *** 2705,2816 **** "Use special colors for torch lite", /* OPT_view_yellow_lite */ "Use special colors for field of view", /* OPT_view_bright_lite */ "Use special colors for wall grids", /* OPT_view_granite_lite */ ! "Use special colors for floor grids" /* OPT_view_special_lite */ ! }; ! ! ! /* ! * Options -- normal values ! */ ! bool option_norm[OPT_MAX] = ! { ! FALSE, /* OPT_rogue_like_commands */ ! FALSE, /* OPT_quick_messages */ ! TRUE, /* OPT_floor_query_flag */ ! FALSE, /* OPT_carry_query_flag */ ! FALSE, /* OPT_use_old_target */ ! TRUE, /* OPT_always_pickup */ ! FALSE, /* OPT_always_repeat */ ! FALSE, /* OPT_depth_in_feet */ ! FALSE, /* OPT_stack_force_notes */ ! FALSE, /* OPT_stack_force_costs */ ! TRUE, /* OPT_show_labels */ ! TRUE, /* OPT_show_weights */ ! TRUE, /* OPT_show_choices */ ! TRUE, /* OPT_show_details */ ! TRUE, /* OPT_ring_bell */ ! TRUE, /* OPT_show_flavors */ ! TRUE, /* OPT_run_ignore_stairs */ ! TRUE, /* OPT_run_ignore_doors */ ! TRUE, /* OPT_run_cut_corners */ ! TRUE, /* OPT_run_use_corners */ ! TRUE, /* OPT_disturb_move */ ! TRUE, /* OPT_disturb_near */ ! TRUE, /* OPT_disturb_panel */ ! TRUE, /* OPT_disturb_state */ ! TRUE, /* OPT_disturb_minor */ ! TRUE, /* OPT_disturb_other */ ! FALSE, /* OPT_alert_hitpoint */ ! FALSE, /* OPT_alert_failure */ ! TRUE, /* OPT_verify_destroy */ ! TRUE, /* OPT_verify_special */ ! TRUE, /* OPT_allow_quantity */ ! FALSE, /* xxx */ ! TRUE, /* OPT_auto_haggle */ ! FALSE, /* OPT_auto_scum */ ! FALSE, /* OPT_testing_stack */ ! FALSE, /* OPT_testing_carry */ ! FALSE, /* OPT_expand_look */ ! FALSE, /* OPT_expand_list */ ! TRUE, /* OPT_view_perma_grids */ ! FALSE, /* OPT_view_torch_grids */ ! TRUE, /* OPT_dungeon_align */ ! TRUE, /* OPT_dungeon_stair */ ! FALSE, /* OPT_flow_by_sound */ ! FALSE, /* OPT_flow_by_smell */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* OPT_smart_learn */ ! FALSE, /* OPT_smart_cheat */ ! FALSE, /* OPT_view_reduce_lite */ ! FALSE, /* OPT_hidden_player */ ! FALSE, /* OPT_avoid_abort */ ! FALSE, /* OPT_avoid_other */ ! TRUE, /* OPT_flush_failure */ ! FALSE, /* OPT_flush_disturb */ ! FALSE, /* xxx */ ! TRUE, /* OPT_fresh_before */ ! FALSE, /* OPT_fresh_after */ ! FALSE, /* xxx */ ! TRUE, /* OPT_compress_savefile */ ! FALSE, /* OPT_hilite_player */ ! FALSE, /* OPT_view_yellow_lite */ ! FALSE, /* OPT_view_bright_lite */ ! FALSE, /* OPT_view_granite_lite */ ! FALSE /* OPT_view_special_lite */ ! }; ! ! ! /* ! * Option screen interface ! */ ! byte option_page[4][16] = ! { ! /*** User-Interface ***/ ! ! { ! OPT_rogue_like_commands, ! OPT_quick_messages, ! OPT_floor_query_flag, ! OPT_carry_query_flag, ! OPT_use_old_target, ! OPT_always_pickup, ! OPT_always_repeat, ! OPT_depth_in_feet, ! OPT_stack_force_notes, ! OPT_stack_force_costs, ! OPT_show_labels, ! OPT_show_weights, ! OPT_show_choices, ! OPT_show_details, ! OPT_show_flavors, ! OPT_ring_bell ! }, ! ! /*** Disturbance ***/ ! ! { ! OPT_run_ignore_stairs, OPT_run_ignore_doors, OPT_run_cut_corners, OPT_run_use_corners, --- 2896,3397 ---- "Use special colors for torch lite", /* OPT_view_yellow_lite */ "Use special colors for field of view", /* OPT_view_bright_lite */ "Use special colors for wall grids", /* OPT_view_granite_lite */ ! "Use special colors for floor grids", /* OPT_view_special_lite */ ! "Open/Disarm/Close without direction", /* OPT_easy_open */ ! "Open/Disarm doors/traps on movement", /* OPT_easy_alter */ ! "Display floor stacks in a list", /* OPT_easy_floor */ ! "Show stacks using special attr/char", /* OPT_show_piles */ ! "Center map continuously (very slow)", /* OPT_center_player */ ! "Avoid centering while running", /* OPT_run_avoid_center */ ! "Scroll map while targetting", /* OPT_scroll_target */ ! "Automatically clear '-more-' prompts", /* OPT_auto_more */ ! "Monsters behave more intelligently", /* OPT_smart_monsters */ ! "Monsters act smarter in groups (v.slow)", /* OPT_smart_packs */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! "Birth: Allow purchase of stats using points", /* OPT_birth_point_based */ ! "Birth: Allow specification of minimal stats", /* OPT_birth_auto_roller */ ! "Birth: Maximize effect of race/class bonuses", /* OPT_birth_maximize */ ! "Birth: Preserve artifacts when leaving level", /* OPT_birth_preserve */ ! "Birth: Restrict the use of stairs/recall", /* OPT_birth_ironman */ ! "Birth: Restrict the use of stores/home", /* OPT_birth_no_stores */ ! "Birth: Restrict creation of artifacts", /* OPT_birth_no_artifacts */ ! "Birth: Randomize some of the artifacts", /* OPT_birth_rand_artifacts */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! "Cheat: Peek into object creation", /* OPT_cheat_peek */ ! "Cheat: Peek into monster creation", /* OPT_cheat_hear */ ! "Cheat: Peek into dungeon creation", /* OPT_cheat_room */ ! "Cheat: Peek into something else", /* OPT_cheat_xtra */ ! "Cheat: Know complete monster info", /* OPT_cheat_know */ ! "Cheat: Allow player to avoid death", /* OPT_cheat_live */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! "Adult: Allow purchase of stats using points", /* OPT_adult_point_based */ ! "Adult: Allow specification of minimal stats", /* OPT_adult_auto_roller */ ! "Adult: Maximize effect of race/class bonuses", /* OPT_adult_maximize */ ! "Adult: Preserve artifacts when leaving level", /* OPT_adult_preserve */ ! "Adult: Restrict the use of stairs/recall", /* OPT_adult_ironman */ ! "Adult: Restrict the use of stores/home", /* OPT_adult_no_stores */ ! "Adult: Restrict creation of artifacts", /* OPT_adult_no_artifacts */ ! "Adult: Randomize some of the artifacts", /* OPT_adult_rand_artifacts */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! "Score: Peek into object creation", /* OPT_score_peek */ ! "Score: Peek into monster creation", /* OPT_score_hear */ ! "Score: Peek into dungeon creation", /* OPT_score_room */ ! "Score: Peek into something else", /* OPT_score_xtra */ ! "Score: Know complete monster info", /* OPT_score_know */ ! "Score: Allow player to avoid death", /* OPT_score_live */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL, /* xxx */ ! NULL /* xxx */ ! }; ! ! ! /* ! * Options -- normal values ! */ ! bool option_norm[OPT_MAX] = ! { ! FALSE, /* OPT_rogue_like_commands */ ! FALSE, /* OPT_quick_messages */ ! TRUE, /* OPT_floor_query_flag */ ! FALSE, /* OPT_carry_query_flag */ ! FALSE, /* OPT_use_old_target */ ! TRUE, /* OPT_always_pickup */ ! FALSE, /* OPT_always_repeat */ ! FALSE, /* OPT_depth_in_feet */ ! FALSE, /* OPT_stack_force_notes */ ! FALSE, /* OPT_stack_force_costs */ ! TRUE, /* OPT_show_labels */ ! TRUE, /* OPT_show_weights */ ! TRUE, /* OPT_show_choices */ ! TRUE, /* OPT_show_details */ ! TRUE, /* OPT_ring_bell */ ! TRUE, /* OPT_show_flavors */ ! TRUE, /* OPT_run_ignore_stairs */ ! TRUE, /* OPT_run_ignore_doors */ ! TRUE, /* OPT_run_cut_corners */ ! TRUE, /* OPT_run_use_corners */ ! TRUE, /* OPT_disturb_move */ ! TRUE, /* OPT_disturb_near */ ! TRUE, /* OPT_disturb_panel */ ! TRUE, /* OPT_disturb_state */ ! TRUE, /* OPT_disturb_minor */ ! TRUE, /* OPT_disturb_other */ ! FALSE, /* OPT_alert_hitpoint */ ! FALSE, /* OPT_alert_failure */ ! TRUE, /* OPT_verify_destroy */ ! TRUE, /* OPT_verify_special */ ! TRUE, /* OPT_allow_quantity */ ! FALSE, /* xxx */ ! TRUE, /* OPT_auto_haggle */ ! FALSE, /* OPT_auto_scum */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* OPT_expand_look */ ! FALSE, /* OPT_expand_list */ ! TRUE, /* OPT_view_perma_grids */ ! FALSE, /* OPT_view_torch_grids */ ! TRUE, /* OPT_dungeon_align */ ! TRUE, /* OPT_dungeon_stair */ ! FALSE, /* OPT_flow_by_sound */ ! FALSE, /* OPT_flow_by_smell */ ! FALSE, /* xxx track_follow */ ! FALSE, /* xxx track_target */ ! FALSE, /* OPT_smart_learn */ ! FALSE, /* OPT_smart_cheat */ ! FALSE, /* OPT_view_reduce_lite */ ! FALSE, /* OPT_hidden_player */ ! FALSE, /* OPT_avoid_abort */ ! FALSE, /* OPT_avoid_other */ ! TRUE, /* OPT_flush_failure */ ! FALSE, /* OPT_flush_disturb */ ! FALSE, /* xxx */ ! TRUE, /* OPT_fresh_before */ ! FALSE, /* OPT_fresh_after */ ! FALSE, /* xxx */ ! TRUE, /* OPT_compress_savefile */ ! FALSE, /* OPT_hilite_player */ ! FALSE, /* OPT_view_yellow_lite */ ! FALSE, /* OPT_view_bright_lite */ ! FALSE, /* OPT_view_granite_lite */ ! FALSE, /* OPT_view_special_lite */ ! FALSE, /* OPT_easy_open */ ! FALSE, /* OPT_easy_alter */ ! FALSE, /* OPT_easy_floor */ ! FALSE, /* OPT_show_piles */ ! FALSE, /* OPT_center_player */ ! FALSE, /* OPT_run_avoid_center */ ! FALSE, /* OPT_scroll_target */ ! FALSE, /* OPT_auto_more */ ! FALSE, /* OPT_smart_monsters */ ! FALSE, /* OPT_smart_packs */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* OPT_birth_point_based */ ! FALSE, /* OPT_birth_auto_roller */ ! FALSE, /* OPT_birth_maximize */ ! FALSE, /* OPT_birth_preserve */ ! FALSE, /* OPT_birth_ironman */ ! FALSE, /* OPT_birth_no_stores */ ! FALSE, /* OPT_birth_no_artifacts */ ! FALSE, /* OPT_birth_rand_artifacts */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* OPT_cheat_peek */ ! FALSE, /* OPT_cheat_hear */ ! FALSE, /* OPT_cheat_room */ ! FALSE, /* OPT_cheat_xtra */ ! FALSE, /* OPT_cheat_know */ ! FALSE, /* OPT_cheat_live */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* OPT_adult_point_based */ ! FALSE, /* OPT_adult_auto_roller */ ! FALSE, /* OPT_adult_maximize */ ! FALSE, /* OPT_adult_preserve */ ! FALSE, /* OPT_adult_ironman */ ! FALSE, /* OPT_adult_no_stores */ ! FALSE, /* OPT_adult_no_artifacts */ ! FALSE, /* OPT_adult_rand_artifacts */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* OPT_score_peek */ ! FALSE, /* OPT_score_hear */ ! FALSE, /* OPT_score_room */ ! FALSE, /* OPT_score_xtra */ ! FALSE, /* OPT_score_know */ ! FALSE, /* OPT_score_live */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE, /* xxx */ ! FALSE /* xxx */ ! }; ! ! ! /* ! * Option screen interface ! * ! * Note the special significance given to the constant "255". ! */ ! byte option_page[OPT_PAGE_MAX][OPT_PAGE_PER] = ! { ! /*** User-Interface ***/ ! ! { ! OPT_rogue_like_commands, ! OPT_quick_messages, ! OPT_floor_query_flag, ! OPT_carry_query_flag, ! OPT_use_old_target, ! OPT_always_pickup, ! OPT_always_repeat, ! OPT_depth_in_feet, ! OPT_stack_force_notes, ! OPT_stack_force_costs, ! OPT_show_labels, ! OPT_show_weights, ! OPT_show_choices, ! OPT_show_details, ! OPT_show_flavors, ! OPT_ring_bell, ! 255, ! 255, ! 255, ! 255 ! }, ! ! /*** Disturbance ***/ ! ! { ! OPT_run_ignore_stairs, OPT_run_ignore_doors, OPT_run_cut_corners, OPT_run_use_corners, *************** *** 2825,2830 **** --- 3406,3415 ---- OPT_verify_destroy, OPT_verify_special, OPT_allow_quantity, + OPT_auto_more, + 255, + 255, + 255, 255 }, *************** *** 2833,2840 **** { OPT_auto_haggle, OPT_auto_scum, - OPT_testing_stack, - OPT_testing_carry, OPT_expand_look, OPT_expand_list, OPT_view_perma_grids, --- 3418,3423 ---- *************** *** 2843,2850 **** --- 3426,3439 ---- OPT_dungeon_stair, OPT_flow_by_sound, OPT_flow_by_smell, + OPT_smart_monsters, + OPT_smart_packs, OPT_smart_learn, OPT_smart_cheat, + OPT_easy_open, + OPT_easy_alter, + OPT_easy_floor, + OPT_show_piles, 255, 255 }, *************** *** 2866,2874 **** --- 3455,3531 ---- OPT_view_bright_lite, OPT_view_granite_lite, OPT_view_special_lite, + OPT_center_player, + OPT_run_avoid_center, + OPT_scroll_target, + 255, + 255, + 255, + }, + + /*** Birth ***/ + + { + OPT_birth_point_based, + OPT_birth_auto_roller, + OPT_birth_maximize, + OPT_birth_preserve, + OPT_birth_ironman, + OPT_birth_no_stores, + OPT_birth_no_artifacts, + OPT_birth_rand_artifacts, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255 + }, + + /*** Cheat ***/ + + { + OPT_cheat_peek, + OPT_cheat_hear, + OPT_cheat_room, + OPT_cheat_xtra, + OPT_cheat_know, + OPT_cheat_live, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, + 255, 255, 255 } }; + + cptr inscrip_text[MAX_INSCRIP] = + { + NULL, + "terrible", + "worthless", + "cursed", + "broken", + "average", + "good", + "excellent", + "special", + "uncursed" + }; diff -r -c angband-283/src/types.h angband-285/src/types.h *** angband-283/src/types.h Mon Feb 9 01:11:57 1998 --- angband-285/src/types.h Tue Aug 17 18:22:17 1999 *************** *** 498,503 **** --- 498,505 ---- u16b note; /* Inscription index */ + byte inscrip; /* INSCRIP_XXX constant */ + s16b next_o_idx; /* Next object in stack (if any) */ s16b held_m_idx; /* Monster holding us (if any) */ *************** *** 540,556 **** s16b hold_o_idx; /* Object being held (if any) */ - #ifdef WDT_TRACK_OPTIONS - - byte ty; /* Y location of target */ - byte tx; /* X location of target */ - - byte t_dur; /* How long are we tracking */ - - byte t_bit; /* Up to eight bit flags */ - - #endif - #ifdef DRS_SMART_OPTIONS u32b smart; /* Field for "smart_learn" */ --- 542,547 ---- *************** *** 717,723 **** { cptr title; /* Type of race */ ! s16b r_adj[6]; /* Racial stat bonuses */ s16b r_dis; /* disarming */ s16b r_dev; /* magic devices */ --- 708,714 ---- { cptr title; /* Type of race */ ! s16b r_adj[A_MAX]; /* Racial stat bonuses */ s16b r_dis; /* disarming */ s16b r_dev; /* magic devices */ *************** *** 757,763 **** { cptr title; /* Type of class */ ! s16b c_adj[6]; /* Class stat modifier */ s16b c_dis; /* class disarming */ s16b c_dev; /* class magic devices */ --- 748,754 ---- { cptr title; /* Type of class */ ! s16b c_adj[A_MAX]; /* Class stat modifier */ s16b c_dis; /* class disarming */ s16b c_dev; /* class magic devices */ *************** *** 855,862 **** s16b csp; /* Cur mana pts */ u16b csp_frac; /* Cur mana frac (times 2^16) */ ! s16b stat_max[6]; /* Current "maximal" stat values */ ! s16b stat_cur[6]; /* Current "natural" stat values */ s16b fast; /* Timed -- Fast */ s16b slow; /* Timed -- Slow */ --- 846,853 ---- s16b csp; /* Cur mana pts */ u16b csp_frac; /* Cur mana frac (times 2^16) */ ! s16b stat_max[A_MAX]; /* Current "maximal" stat values */ ! s16b stat_cur[A_MAX]; /* Current "natural" stat values */ s16b fast; /* Timed -- Fast */ s16b slow; /* Timed -- Slow */ *************** *** 916,922 **** bool wizard; /* Player is in wizard mode */ - bool cheat[CHEAT_MAX]; /* Cheating options */ /*** Temporary fields ***/ --- 907,912 ---- *************** *** 996,1008 **** u32b redraw; /* Normal Redraws (bit flags) */ u32b window; /* Window Redraws (bit flags) */ ! s16b stat_use[6]; /* Current modified stats */ ! s16b stat_top[6]; /* Maximal modified stats */ /*** Extracted fields ***/ ! s16b stat_add[6]; /* Equipment stat bonuses */ ! s16b stat_ind[6]; /* Indexes into stat tables */ bool immune_acid; /* Immunity to acid */ bool immune_elec; /* Immunity to lightning */ --- 986,998 ---- u32b redraw; /* Normal Redraws (bit flags) */ u32b window; /* Window Redraws (bit flags) */ ! s16b stat_use[A_MAX]; /* Current modified stats */ ! s16b stat_top[A_MAX]; /* Maximal modified stats */ /*** Extracted fields ***/ ! s16b stat_add[A_MAX]; /* Equipment stat bonuses */ ! s16b stat_ind[A_MAX]; /* Indexes into stat tables */ bool immune_acid; /* Immunity to acid */ bool immune_elec; /* Immunity to lightning */ diff -r -c angband-283/src/util.c angband-285/src/util.c *** angband-283/src/util.c Wed Feb 11 06:30:29 1998 --- angband-285/src/util.c Wed Sep 1 17:40:41 1999 *************** *** 1169,1175 **** /* Create a new macro */ else { ! /* Acquire a new index */ n = macro__num++; /* Save the pattern */ --- 1169,1175 ---- /* Create a new macro */ else { ! /* Get a new index */ n = macro__num++; /* Save the pattern */ *************** *** 1373,1379 **** if (Term_key_push(30)) return (0); ! /* Access the macro action */ act = macro__act[k]; /* Get the length of the action */ --- 1373,1379 ---- if (Term_key_push(30)) return (0); ! /* Get the macro action */ act = macro__act[k]; /* Get the length of the action */ *************** *** 1538,1544 **** } ! /* Access cursor state */ (void)Term_get_cursor(&v); /* Show the cursor if waiting, except sometimes in "command" mode */ --- 1538,1544 ---- } ! /* Get the cursor state */ (void)Term_get_cursor(&v); /* Show the cursor if waiting, except sometimes in "command" mode */ *************** *** 1624,1630 **** /* Excessive delay */ if (w >= 100) break; ! /* Delay */ Term_xtra(TERM_XTRA_DELAY, w); } --- 1624,1630 ---- /* Excessive delay */ if (w >= 100) break; ! /* Delay */ Term_xtra(TERM_XTRA_DELAY, w); } *************** *** 1798,1804 **** /* Verify */ if ((i < 0) || (i >= quark__num)) i = 0; ! /* Access the quark */ q = quark__str[i]; /* Return the quark */ --- 1798,1804 ---- /* Verify */ if ((i < 0) || (i >= quark__num)) i = 0; ! /* Get the quark */ q = quark__str[i]; /* Return the quark */ *************** *** 1885,1897 **** /* Forgotten messages have no text */ if ((age < 0) || (age >= message_num())) return (""); ! /* Acquire the "logical" index */ x = (message__next + MESSAGE_MAX - (age + 1)) % MESSAGE_MAX; /* Get the "offset" for the message */ o = message__ptr[x]; ! /* Access the message text */ s = &message__buf[o]; /* Return the message text */ --- 1885,1897 ---- /* Forgotten messages have no text */ if ((age < 0) || (age >= message_num())) return (""); ! /* Get the "logical" index */ x = (message__next + MESSAGE_MAX - (age + 1)) % MESSAGE_MAX; /* Get the "offset" for the message */ o = message__ptr[x]; ! /* Get the message text */ s = &message__buf[o]; /* Return the message text */ *************** *** 1969,1975 **** /* Do not optimize over large distances */ if (q >= MESSAGE_BUF / 4) continue; ! /* Access the old string */ old = &message__buf[o]; /* Inline 'streq(str, old)' */ --- 1969,1975 ---- /* Do not optimize over large distances */ if (q >= MESSAGE_BUF / 4) continue; ! /* Get the old string */ old = &message__buf[o]; /* Inline 'streq(str, old)' */ *************** *** 2256,2264 **** if (n > 1000) return; ! /* Memorize the message */ if (character_generated) message_add(msg); /* Copy it */ strcpy(buf, msg); --- 2256,2278 ---- if (n > 1000) return; ! /* Memorize the message (if legal) */ if (character_generated) message_add(msg); + /* Window stuff */ + p_ptr->window |= (PW_MESSAGE); + + + /* Handle "auto_more" */ + if (auto_more) + { + /* Force window update */ + window_stuff(); + + /* Done */ + return; + } + /* Copy it */ strcpy(buf, msg); *************** *** 2295,2303 **** /* Flush it */ msg_flush(split + 1); - /* Memorize the piece */ - /* if (character_generated) message_add(t); */ - /* Restore the split character */ t[split] = oops; --- 2309,2314 ---- *************** *** 2308,2323 **** t += split; n -= split; } - /* Display the tail of the message */ Term_putstr(p, 0, n, TERM_WHITE, t); - /* Memorize the tail */ - /* if (character_generated) message_add(t); */ - - /* Window stuff */ - p_ptr->window |= (PW_MESSAGE); - /* Remember the message */ msg_flag = TRUE; --- 2319,2327 ---- *************** *** 2583,2606 **** /* * Get some input at the cursor location. ! * Assume the buffer is initialized to a default string. * Note that this string is often "empty" (see below). ! * The default buffer is displayed in yellow until cleared. ! * Pressing RETURN right away accepts the default entry. * Normal chars clear the default and append the char. * Backspace clears the default or deletes the final char. ! * ESCAPE clears the buffer and the window and returns FALSE. ! * RETURN accepts the current buffer contents and returns TRUE. ! * The buffer must be large enough for 'len+1' characters. */ bool askfor_aux(char *buf, int len) { int y, x; - int i = 0; - int k = 0; bool done = FALSE; --- 2587,2616 ---- /* * Get some input at the cursor location. ! * ! * The buffer is assumed to have been initialized to a default string. * Note that this string is often "empty" (see below). ! * ! * The default buffer is displayed in yellow until cleared, which happens ! * on the first keypress, unless that keypress is Return. ! * * Normal chars clear the default and append the char. * Backspace clears the default or deletes the final char. ! * Return accepts the current buffer contents and returns TRUE. ! * Escape clears the buffer and the window and returns FALSE. ! * ! * Note that 'buf' must be able to hold 'len+1' characters, not just 'len' ! * characters, as might be expected. That is, 'len' primarily refers to ! * the input, not the buffer itself. */ bool askfor_aux(char *buf, int len) { int y, x; int k = 0; + char ch = '\0'; + bool done = FALSE; *************** *** 2608,2624 **** Term_locate(&x, &y); ! /* Paranoia -- check len */ ! if (len < 1) len = 1; ! /* Paranoia -- check column */ if ((x < 0) || (x >= 80)) x = 0; /* Restrict the length */ if (x + len > 80) len = 80 - x; ! ! /* Paranoia -- Clip the default entry */ buf[len] = '\0'; --- 2618,2634 ---- Term_locate(&x, &y); ! /* Paranoia */ ! if (len < 0) len = 0; ! /* Paranoia */ if ((x < 0) || (x >= 80)) x = 0; + /* Restrict the length */ if (x + len > 80) len = 80 - x; ! /* Truncate the default entry */ buf[len] = '\0'; *************** *** 2626,2632 **** Term_erase(x, y, len); Term_putstr(x, y, -1, TERM_YELLOW, buf); - /* Process input */ while (!done) { --- 2636,2641 ---- *************** *** 2634,2643 **** Term_gotoxy(x + k, y); /* Get a key */ ! i = inkey(); /* Analyze the key */ ! switch (i) { case ESCAPE: { --- 2643,2652 ---- Term_gotoxy(x + k, y); /* Get a key */ ! ch = inkey(); /* Analyze the key */ ! switch (ch) { case ESCAPE: { *************** *** 2663,2671 **** default: { ! if ((k < len) && (isprint(i))) { ! buf[k++] = i; } else { --- 2672,2680 ---- default: { ! if ((k < len) && (isprint(ch))) { ! buf[k++] = ch; } else { *************** *** 2683,2705 **** Term_putstr(x, y, -1, TERM_WHITE, buf); } ! /* Aborted */ ! if (i == ESCAPE) return (FALSE); ! ! /* Success */ ! return (TRUE); } /* ! * Get a string from the user ! * ! * The "prompt" should take the form "Prompt: " * ! * Note that the initial contents of the string is used as ! * the default response, so be sure to "clear" it if needed. * ! * We clear the input, and return FALSE, on "ESCAPE". */ bool get_string(cptr prompt, char *buf, int len) { --- 2692,2709 ---- Term_putstr(x, y, -1, TERM_WHITE, buf); } ! /* Done */ ! return (ch != ESCAPE); } /* ! * Prompt for a string from the user. * ! * The "prompt" should take the form "Prompt: ". * ! * See "askfor_aux" for some notes about "buf" and "len", and about ! * the return value of this function. */ bool get_string(cptr prompt, char *buf, int len) { *************** *** 2743,2748 **** --- 2747,2762 ---- p_ptr->command_arg = 0; } + #ifdef ALLOW_REPEAT + + /* Get the item index */ + else if ((max != 1) && allow_quantity && repeat_pull(&amt)) + { + /* nothing */ + } + + #endif /* ALLOW_REPEAT */ + /* Prompt if needed */ else if ((max != 1) && allow_quantity) { *************** *** 2779,2784 **** --- 2793,2804 ---- /* Enforce the minimum */ if (amt < 0) amt = 0; + #ifdef ALLOW_REPEAT + + if (amt) repeat_push(amt); + + #endif /* ALLOW_REPEAT */ + /* Return the result */ return (amt); } *************** *** 3149,3159 **** /* No inscription */ if (!o_ptr->note) continue; - /* Obtain the inscription */ - s = quark_str(o_ptr->note); - /* Find a '^' */ ! s = strchr(s, '^'); /* Process preventions */ while (s) --- 3169,3176 ---- /* No inscription */ if (!o_ptr->note) continue; /* Find a '^' */ ! s = strchr(quark_str(o_ptr->note), '^'); /* Process preventions */ while (s) *************** *** 3164,3171 **** /* Hack -- Verify command */ if (!get_check("Are you sure? ")) { ! /* Hack -- Use space */ ! p_ptr->command_cmd = ' '; } } --- 3181,3188 ---- /* Hack -- Verify command */ if (!get_check("Are you sure? ")) { ! /* Hack -- Use "newline" */ ! p_ptr->command_cmd = '\n'; } } *************** *** 3239,3246 **** * If "insert" is NULL, just remove the first instance of "target" * In either case, return TRUE if "target" is found. * ! * XXX Could be made more efficient, especially in the ! * case where "insert" is smaller than "target". */ static bool insert_str(char *buf, cptr target, cptr insert) { --- 3256,3263 ---- * If "insert" is NULL, just remove the first instance of "target" * In either case, return TRUE if "target" is found. * ! * Could be made more efficient, especially in the case where "insert" ! * is smaller than "target". */ static bool insert_str(char *buf, cptr target, cptr insert) { *************** *** 3290,3293 **** --- 3307,3399 ---- #endif + #ifdef ALLOW_REPEAT + + #define REPEAT_MAX 20 + + /* Number of chars saved */ + static int repeat__cnt = 0; + + /* Current index */ + static int repeat__idx = 0; + + /* Saved "stuff" */ + static int repeat__key[REPEAT_MAX]; + + + /* + * Push data. + */ + void repeat_push(int what) + { + /* Too many keys */ + if (repeat__cnt == REPEAT_MAX) return; + + /* Push the "stuff" */ + repeat__key[repeat__cnt++] = what; + + /* Prevents us from pulling keys */ + ++repeat__idx; + } + + + /* + * Pull data. + */ + bool repeat_pull(int *what) + { + /* All out of keys */ + if (repeat__idx == repeat__cnt) return (FALSE); + + /* Grab the next key, advance */ + *what = repeat__key[repeat__idx++]; + + /* Success */ + return (TRUE); + } + + + /* + * Repeat previous command, or begin memorizing new command. + */ + void repeat_check(void) + { + int what; + + /* Ignore some commands */ + if (p_ptr->command_cmd == ESCAPE) return; + if (p_ptr->command_cmd == ' ') return; + if (p_ptr->command_cmd == '\n') return; + if (p_ptr->command_cmd == '\r') return; + + /* Repeat Last Command */ + if (p_ptr->command_cmd == KTRL('V')) + { + /* Reset */ + repeat__idx = 0; + + /* Get the command */ + if (repeat_pull(&what)) + { + /* Save the command */ + p_ptr->command_cmd = what; + } + } + + /* Start saving new command */ + else + { + /* Reset */ + repeat__cnt = 0; + repeat__idx = 0; + + /* Get the current command */ + what = p_ptr->command_cmd; + + /* Save this command */ + repeat_push(what); + } + } + + #endif /* ALLOW_REPEAT */ diff -r -c angband-283/src/variable.c angband-285/src/variable.c *** angband-283/src/variable.c Mon Feb 9 01:49:54 1998 --- angband-285/src/variable.c Thu Aug 19 14:44:50 1999 *************** *** 70,75 **** --- 70,77 ---- s16b character_icky; /* Depth of the game in special mode */ s16b character_xtra; /* Depth of the game in startup mode */ + u32b seed_randart; /* Hack -- consistent random artifacts */ + u32b seed_flavor; /* Hack -- consistent object colors */ u32b seed_town; /* Hack -- consistent town layout */ *************** *** 110,115 **** --- 112,129 ---- s16b m_max = 1; /* Number of allocated monsters */ s16b m_cnt = 0; /* Number of live monsters */ + + + /* + * Hack -- see summon_specific(). + */ + char summon_kin_type; + + + /* + * TRUE if process_command() is a repeated call. + */ + bool command_repeating = FALSE; /* diff -r -c angband-283/src/wizard1.c angband-285/src/wizard1.c *** angband-283/src/wizard1.c Fri Feb 6 04:10:31 1998 --- angband-285/src/wizard1.c Sat Jul 24 16:56:39 1999 *************** *** 321,327 **** fprintf(fff, "\n\n%s\n\n", group_item[i].name); } ! /* Acquire legal item types */ for (k = 1; k < MAX_K_IDX; k++) { object_kind *k_ptr = &k_info[k]; --- 321,327 ---- fprintf(fff, "\n\n%s\n\n", group_item[i].name); } ! /* Get legal item types */ for (k = 1; k < MAX_K_IDX; k++) { object_kind *k_ptr = &k_info[k]; *************** *** 700,706 **** /* ! * Acquire a "basic" description "The Cloak of Death [1,+10]" */ static void analyze_general (object_type *o_ptr, char *desc_x_ptr) { --- 700,706 ---- /* ! * Get a "basic" description "The Cloak of Death [1,+10]" */ static void analyze_general (object_type *o_ptr, char *desc_x_ptr) { *************** *** 1147,1153 **** /* Ignore "empty" artifacts */ if (!a_ptr->name) return FALSE; ! /* Acquire the "kind" index */ i = lookup_kind(a_ptr->tval, a_ptr->sval); /* Oops */ --- 1147,1153 ---- /* Ignore "empty" artifacts */ if (!a_ptr->name) return FALSE; ! /* Get the "kind" index */ i = lookup_kind(a_ptr->tval, a_ptr->sval); /* Oops */ *************** *** 1803,1810 **** if (flags6 & (RF6_TRAPS)) vp[vn++] = "create traps"; if (flags6 & (RF6_FORGET)) vp[vn++] = "cause amnesia"; if (flags6 & (RF6_XXX6)) vp[vn++] = "do something"; ! if (flags6 & (RF6_XXX7)) vp[vn++] = "do something"; ! if (flags6 & (RF6_XXX8)) vp[vn++] = "do something"; if (flags6 & (RF6_S_MONSTER)) vp[vn++] = "summon a monster"; if (flags6 & (RF6_S_MONSTERS)) vp[vn++] = "summon monsters"; if (flags6 & (RF6_S_ANT)) vp[vn++] = "summon ants"; --- 1803,1810 ---- if (flags6 & (RF6_TRAPS)) vp[vn++] = "create traps"; if (flags6 & (RF6_FORGET)) vp[vn++] = "cause amnesia"; if (flags6 & (RF6_XXX6)) vp[vn++] = "do something"; ! if (flags6 & (RF6_S_KIN)) vp[vn++] = "summon similar monsters"; ! if (flags6 & (RF6_S_HI_DEMON)) vp[vn++] = "summon greater demons"; if (flags6 & (RF6_S_MONSTER)) vp[vn++] = "summon a monster"; if (flags6 & (RF6_S_MONSTERS)) vp[vn++] = "summon monsters"; if (flags6 & (RF6_S_ANT)) vp[vn++] = "summon ants"; *************** *** 2087,2093 **** /* No method yet */ p = "???"; ! /* Acquire the method */ switch (r_ptr->blow[j].method) { case RBM_HIT: p = "hit"; break; --- 2087,2093 ---- /* No method yet */ p = "???"; ! /* Get the method */ switch (r_ptr->blow[j].method) { case RBM_HIT: p = "hit"; break; *************** *** 2120,2126 **** /* Default effect */ q = "???"; ! /* Acquire the effect */ switch (r_ptr->blow[j].effect) { case RBE_HURT: q = "attack"; break; --- 2120,2126 ---- /* Default effect */ q = "???"; ! /* Get the effect */ switch (r_ptr->blow[j].effect) { case RBE_HURT: q = "attack"; break; diff -r -c angband-283/src/wizard2.c angband-285/src/wizard2.c *** angband-283/src/wizard2.c Wed Feb 11 06:30:29 1998 --- angband-285/src/wizard2.c Wed Sep 1 16:12:48 1999 *************** *** 148,154 **** /* Query the stats */ ! for (i = 0; i < 6; i++) { /* Prompt */ sprintf(ppp, "%s (3-118): ", stat_names[i]); --- 148,154 ---- /* Query the stats */ ! for (i = 0; i < A_MAX; i++) { /* Prompt */ sprintf(ppp, "%s (3-118): ", stat_names[i]); *************** *** 188,194 **** /* Default */ ! sprintf(tmp_val, "%ld", (long)(p_ptr->max_exp)); /* Query */ if (!get_string("Experience: ", tmp_val, 9)) return; --- 188,194 ---- /* Default */ ! sprintf(tmp_val, "%ld", (long)(p_ptr->exp)); /* Query */ if (!get_string("Experience: ", tmp_val, 9)) return; *************** *** 200,205 **** --- 200,223 ---- if (tmp_long < 0) tmp_long = 0L; /* Save */ + p_ptr->exp = tmp_long; + + /* Update */ + check_experience(); + + /* Default */ + sprintf(tmp_val, "%ld", (long)(p_ptr->max_exp)); + + /* Query */ + if (!get_string("Max Exp: ", tmp_val, 9)) return; + + /* Extract */ + tmp_long = atol(tmp_val); + + /* Verify */ + if (tmp_long < 0) tmp_long = 0L; + + /* Save */ p_ptr->max_exp = tmp_long; /* Update */ *************** *** 417,431 **** * Hack -- title for each column * * This will not work with "EBCDIC", I would think. XXX XXX XXX */ static char head[3] = { 'a', 'A', '0' }; /* ! * Acquire an object kind for creation (or zero) * ! * List up to 50 choices in three columns */ static int wiz_create_itemtype(void) { --- 435,452 ---- * Hack -- title for each column * * This will not work with "EBCDIC", I would think. XXX XXX XXX + * + * The third column head overlaps the first after 17 items are + * listed. XXX XXX XXX */ static char head[3] = { 'a', 'A', '0' }; /* ! * Get an object kind for creation (or zero) * ! * List up to 57 choices in three columns */ static int wiz_create_itemtype(void) { *************** *** 445,451 **** Term_clear(); /* Print all tval's and their descriptions */ ! for (num = 0; (num < 60) && tvals[num].tval; num++) { row = 2 + (num % 20); col = 30 * (num / 20); --- 466,472 ---- Term_clear(); /* Print all tval's and their descriptions */ ! for (num = 0; (num < 57) && tvals[num].tval; num++) { row = 2 + (num % 20); col = 30 * (num / 20); *************** *** 463,469 **** num = -1; if ((ch >= head[0]) && (ch < head[0] + 20)) num = ch - head[0]; if ((ch >= head[1]) && (ch < head[1] + 20)) num = ch - head[1] + 20; ! if ((ch >= head[2]) && (ch < head[2] + 10)) num = ch - head[2] + 40; /* Bail out if choice is illegal */ if ((num < 0) || (num >= max_num)) return (0); --- 484,490 ---- num = -1; if ((ch >= head[0]) && (ch < head[0] + 20)) num = ch - head[0]; if ((ch >= head[1]) && (ch < head[1] + 20)) num = ch - head[1] + 20; ! if ((ch >= head[2]) && (ch < head[2] + 17)) num = ch - head[2] + 40; /* Bail out if choice is illegal */ if ((num < 0) || (num >= max_num)) return (0); *************** *** 479,485 **** Term_clear(); /* We have to search the whole itemlist. */ ! for (num = 0, i = 1; (num < 60) && (i < MAX_K_IDX); i++) { object_kind *k_ptr = &k_info[i]; --- 500,506 ---- Term_clear(); /* We have to search the whole itemlist. */ ! for (num = 0, i = 1; (num < 57) && (i < MAX_K_IDX); i++) { object_kind *k_ptr = &k_info[i]; *************** *** 494,500 **** col = 30 * (num / 20); ch = head[num/20] + (num%20); ! /* Acquire the "name" of object "i" */ strip_name(buf, i); /* Print it */ --- 515,521 ---- col = 30 * (num / 20); ch = head[num/20] + (num%20); ! /* Get the "name" of object "i" */ strip_name(buf, i); /* Print it */ *************** *** 515,521 **** num = -1; if ((ch >= head[0]) && (ch < head[0] + 20)) num = ch - head[0]; if ((ch >= head[1]) && (ch < head[1] + 20)) num = ch - head[1] + 20; ! if ((ch >= head[2]) && (ch < head[2] + 10)) num = ch - head[2] + 40; /* Bail out if choice is "illegal" */ if ((num < 0) || (num >= max_num)) return (0); --- 536,542 ---- num = -1; if ((ch >= head[0]) && (ch < head[0] + 20)) num = ch - head[0]; if ((ch >= head[1]) && (ch < head[1] + 20)) num = ch - head[1] + 20; ! if ((ch >= head[2]) && (ch < head[2] + 17)) num = ch - head[2] + 40; /* Bail out if choice is "illegal" */ if ((num < 0) || (num >= max_num)) return (0); *************** *** 1417,1423 **** /* Analyze the command */ switch (cmd) { ! /* Nothing */ case ESCAPE: case ' ': case '\n': --- 1438,1444 ---- /* Analyze the command */ switch (cmd) { ! /* Ignore */ case ESCAPE: case ' ': case '\n': diff -r -c angband-283/src/xtra1.c angband-285/src/xtra1.c *** angband-283/src/xtra1.c Wed Feb 11 06:30:29 1998 --- angband-285/src/xtra1.c Wed Sep 1 17:27:10 1999 *************** *** 748,753 **** --- 748,759 ---- /* Afraid */ if (m_ptr->monfear) attr = TERM_VIOLET; + /* Confused */ + if (m_ptr->confused) attr = TERM_UMBER; + + /* Stunned */ + if (m_ptr->stunned) attr = TERM_L_BLUE; + /* Asleep */ if (m_ptr->csleep) attr = TERM_BLUE; *************** *** 783,789 **** prt_exp(); /* All Stats */ ! for (i = 0; i < 6; i++) prt_stat(i); /* Armor */ prt_ac(); --- 789,795 ---- prt_exp(); /* All Stats */ ! for (i = 0; i < A_MAX; i++) prt_stat(i); /* Armor */ prt_ac(); *************** *** 1193,1199 **** /* Efficiency -- all done */ if (!p_ptr->spell_learned1 && !p_ptr->spell_learned2) break; ! /* Access the spell */ j = p_ptr->spell_order[i]; /* Skip non-spells */ --- 1199,1205 ---- /* Efficiency -- all done */ if (!p_ptr->spell_learned1 && !p_ptr->spell_learned2) break; ! /* Get the spell */ j = p_ptr->spell_order[i]; /* Skip non-spells */ *************** *** 1305,1311 **** /* Skip unknown spells */ if (j >= 99) break; ! /* Access the spell */ s_ptr = &mp_ptr->info[j]; /* Skip spells we cannot remember */ --- 1311,1317 ---- /* Skip unknown spells */ if (j >= 99) break; ! /* Get the spell */ s_ptr = &mp_ptr->info[j]; /* Skip spells we cannot remember */ *************** *** 1352,1358 **** /* Count spells that can be learned */ for (j = 0; j < 64; j++) { ! /* Access the spell */ s_ptr = &mp_ptr->info[j]; /* Skip spells we cannot remember */ --- 1358,1364 ---- /* Count spells that can be learned */ for (j = 0; j < 64; j++) { ! /* Get the spell */ s_ptr = &mp_ptr->info[j]; /* Skip spells we cannot remember */ *************** *** 1688,1696 **** int extra_shots; int extra_might; ! int old_stat_top[6]; ! int old_stat_use[6]; ! int old_stat_ind[6]; object_type *o_ptr; --- 1694,1702 ---- int extra_shots; int extra_might; ! int old_stat_top[A_MAX]; ! int old_stat_use[A_MAX]; ! int old_stat_ind[A_MAX]; object_type *o_ptr; *************** *** 1711,1717 **** old_dis_to_a = p_ptr->dis_to_a; /* Save the old stats */ ! for (i = 0; i < 6; i++) { old_stat_top[i] = p_ptr->stat_top[i]; old_stat_use[i] = p_ptr->stat_use[i]; --- 1717,1723 ---- old_dis_to_a = p_ptr->dis_to_a; /* Save the old stats */ ! for (i = 0; i < A_MAX; i++) { old_stat_top[i] = p_ptr->stat_top[i]; old_stat_use[i] = p_ptr->stat_use[i]; *************** *** 1736,1742 **** extra_might = 0; /* Clear the stat modifiers */ ! for (i = 0; i < 6; i++) p_ptr->stat_add[i] = 0; /* Clear the Displayed/Real armor class */ p_ptr->dis_ac = p_ptr->ac = 0; --- 1742,1748 ---- extra_might = 0; /* Clear the stat modifiers */ ! for (i = 0; i < A_MAX; i++) p_ptr->stat_add[i] = 0; /* Clear the Displayed/Real armor class */ p_ptr->dis_ac = p_ptr->ac = 0; *************** *** 1985,1991 **** /*** Handle stats ***/ /* Calculate stats */ ! for (i = 0; i < 6; i++) { int add, top, use, ind; --- 1991,1997 ---- /*** Handle stats ***/ /* Calculate stats */ ! for (i = 0; i < A_MAX; i++) { int add, top, use, ind; *************** *** 1993,1999 **** add = p_ptr->stat_add[i]; /* Maximize mode */ ! if (p_ptr->maximize) { /* Modify the stats for race/class */ add += (rp_ptr->r_adj[i] + cp_ptr->c_adj[i]); --- 1999,2005 ---- add = p_ptr->stat_add[i]; /* Maximize mode */ ! if (adult_maximize) { /* Modify the stats for race/class */ add += (rp_ptr->r_adj[i] + cp_ptr->c_adj[i]); *************** *** 2109,2120 **** /*** Special flags ***/ - /* Hack -- Res chaos -> Res confu */ - if (p_ptr->resist_chaos) - { - p_ptr->resist_confu = TRUE; - } - /* Hack -- Hero/Shero -> Res fear */ if (p_ptr->hero || p_ptr->shero) { --- 2115,2120 ---- *************** *** 2139,2144 **** --- 2139,2147 ---- /* Searching slows the player down */ if (p_ptr->searching) p_ptr->pspeed -= 10; + /* Sanity check on extreme speeds */ + if (p_ptr->pspeed < 0) p_ptr->pspeed = 0; + if (p_ptr->pspeed > 199) p_ptr->pspeed = 199; /*** Apply modifier bonuses ***/ *************** *** 2360,2366 **** /* Enforce a minimum "weight" (tenth pounds) */ div = ((o_ptr->weight < wgt) ? wgt : o_ptr->weight); ! /* Access the strength vs weight */ str_index = (adj_str_blow[p_ptr->stat_ind[A_STR]] * mul / div); /* Maximal value */ --- 2363,2369 ---- /* Enforce a minimum "weight" (tenth pounds) */ div = ((o_ptr->weight < wgt) ? wgt : o_ptr->weight); ! /* Get the strength vs weight */ str_index = (adj_str_blow[p_ptr->stat_ind[A_STR]] * mul / div); /* Maximal value */ *************** *** 2392,2398 **** p_ptr->icky_wield = FALSE; /* Priest weapon penalty for non-blessed edged weapons */ ! if ((p_ptr->pclass == 2) && (!p_ptr->bless_blade) && ((o_ptr->tval == TV_SWORD) || (o_ptr->tval == TV_POLEARM))) { /* Reduce the real bonuses */ --- 2395,2401 ---- p_ptr->icky_wield = FALSE; /* Priest weapon penalty for non-blessed edged weapons */ ! if ((p_ptr->pclass == CLASS_PRIEST) && (!p_ptr->bless_blade) && ((o_ptr->tval == TV_SWORD) || (o_ptr->tval == TV_POLEARM))) { /* Reduce the real bonuses */ *************** *** 2411,2417 **** /*** Notice changes ***/ /* Analyze stats */ ! for (i = 0; i < 6; i++) { /* Notice changes */ if (p_ptr->stat_top[i] != old_stat_top[i]) --- 2414,2420 ---- /*** Notice changes ***/ /* Analyze stats */ ! for (i = 0; i < A_MAX; i++) { /* Notice changes */ if (p_ptr->stat_top[i] != old_stat_top[i]) diff -r -c angband-283/src/xtra2.c angband-285/src/xtra2.c *** angband-283/src/xtra2.c Wed Feb 11 06:30:29 1998 --- angband-285/src/xtra2.c Wed Sep 1 16:14:46 1999 *************** *** 1860,1869 **** { object_type *o_ptr; ! /* Acquire object */ o_ptr = &o_list[this_o_idx]; ! /* Acquire next object */ next_o_idx = o_ptr->next_o_idx; /* Paranoia */ --- 1860,1869 ---- { 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; /* Paranoia */ *************** *** 2241,2246 **** --- 2241,2289 ---- return (FALSE); } + /* + * Handle a request to change the current panel + * + * Return TRUE if the panel was changed. + */ + bool change_panel(int dir) + { + int y = p_ptr->wy + ddy[dir] * PANEL_HGT; + int x = p_ptr->wx + ddx[dir] * PANEL_WID; + + /* Verify the row */ + if (y < 0) y = 0; + if (y > DUNGEON_HGT - SCREEN_HGT) y = DUNGEON_HGT - SCREEN_HGT; + + /* Verify the col */ + if (x < 0) x = 0; + if (x > DUNGEON_WID - SCREEN_WID) x = DUNGEON_WID - SCREEN_WID; + + /* Handle "changes" */ + if ((p_ptr->wy != y) || (p_ptr->wx != x)) + { + /* Update panel */ + p_ptr->wy = y; + p_ptr->wx = x; + + /* Update stuff */ + p_ptr->update |= (PU_MONSTERS); + + /* Redraw map */ + p_ptr->redraw |= (PR_MAP); + + /* Handle stuff */ + handle_stuff(); + + /* Success */ + return TRUE; + } + + /* No change */ + return FALSE; + } + + *************** *** 2264,2271 **** /* Initial row */ i = p_ptr->wy; /* Scroll screen when 2 grids from top/bottom edge */ ! if ((py < p_ptr->wy + 2) || (py >= p_ptr->wy+SCREEN_HGT - 2)) { i = ((py - PANEL_HGT / 2) / PANEL_HGT) * PANEL_HGT; if (i < 0) i = 0; --- 2307,2323 ---- /* Initial row */ i = p_ptr->wy; + /* Scroll screen when off-center */ + if (center_player && (!p_ptr->running || !run_avoid_center) && + (py != p_ptr->wy + SCREEN_HGT / 2)) + { + i = py - SCREEN_HGT / 2; + if (i < 0) i = 0; + if (i > DUNGEON_HGT - SCREEN_HGT) i = DUNGEON_HGT - SCREEN_HGT; + } + /* Scroll screen when 2 grids from top/bottom edge */ ! else if ((py < p_ptr->wy + 2) || (py >= p_ptr->wy+SCREEN_HGT - 2)) { i = ((py - PANEL_HGT / 2) / PANEL_HGT) * PANEL_HGT; if (i < 0) i = 0; *************** *** 2289,2296 **** /* Initial col */ i = p_ptr->wx; /* Scroll screen when 4 grids from left/right edge */ ! if ((px < p_ptr->wx + 4) || (px >= p_ptr->wx+SCREEN_WID - 4)) { i = ((px - PANEL_WID / 2) / PANEL_WID) * PANEL_WID; if (i < 0) i = 0; --- 2341,2357 ---- /* Initial col */ i = p_ptr->wx; + /* Scroll screen when off-center */ + if (center_player && (!p_ptr->running || !run_avoid_center) && + (px != p_ptr->wx + SCREEN_WID / 2)) + { + i = px - SCREEN_WID / 2; + if (i < 0) i = 0; + if (i > DUNGEON_WID - SCREEN_WID) i = DUNGEON_WID - SCREEN_WID; + } + /* Scroll screen when 4 grids from left/right edge */ ! else if ((px < p_ptr->wx + 4) || (px >= p_ptr->wx+SCREEN_WID - 4)) { i = ((px - PANEL_WID / 2) / PANEL_WID) * PANEL_WID; if (i < 0) i = 0; *************** *** 2315,2321 **** if (scroll) { /* Optional disturb on "panel change" */ ! if (disturb_panel) disturb(0, 0); /* Redraw map */ p_ptr->redraw |= (PR_MAP); --- 2376,2382 ---- if (scroll) { /* Optional disturb on "panel change" */ ! if (disturb_panel && !center_player) disturb(0, 0); /* Redraw map */ p_ptr->redraw |= (PR_MAP); *************** *** 2447,2452 **** --- 2508,2543 ---- /* + * Given a "source" and "target" location, extract a "direction", + * which will move one step from the "source" towards the "target". + * + * Note that we use "diagonal" motion whenever possible. + * + * We return "5" if no motion is needed. + */ + sint motion_dir(int y1, int x1, int y2, int x2) + { + /* No movement required */ + if ((y1 == y2) && (x1 == x2)) return (5); + + /* South or North */ + if (x1 == x2) return ((y1 < y2) ? 2 : 8); + + /* East or West */ + if (y1 == y2) return ((x1 < x2) ? 6 : 4); + + /* South-east or South-west */ + if (y1 < y2) return ((x1 < x2) ? 3 : 1); + + /* North-east or North-west */ + if (y1 > y2) return ((x1 < x2) ? 9 : 7); + + /* Paranoia */ + return (5); + } + + + /* * Extract a direction (or zero) from a character */ sint target_dir(char ch) *************** *** 2569,2575 **** { monster_type *m_ptr = &m_list[m_idx]; ! /* Acquire monster location */ p_ptr->target_row = m_ptr->fy; p_ptr->target_col = m_ptr->fx; --- 2660,2666 ---- { monster_type *m_ptr = &m_list[m_idx]; ! /* Get the monster location */ p_ptr->target_row = m_ptr->fy; p_ptr->target_col = m_ptr->fx; *************** *** 2782,2791 **** { 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 object */ --- 2873,2882 ---- { 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 object */ *************** *** 2909,2914 **** --- 3000,3007 ---- bool boring; + bool floored; + int feat; int query; *************** *** 2954,2960 **** query = inkey(); /* Stop on everything but "return" */ ! if ((query != '\r') && (query != '\n')) break; /* Repeat forever */ continue; --- 3047,3053 ---- query = inkey(); /* Stop on everything but "return" */ ! if ((query != '\n') && (query != '\r')) break; /* Repeat forever */ continue; *************** *** 3033,3040 **** recall = !recall; } ! /* Always stop at "normal" keys */ ! if ((query != '\r') && (query != '\n') && (query != ' ')) break; /* Sometimes stop at "space" key */ if ((query == ' ') && !(mode & (TARGET_LOOK))) break; --- 3126,3133 ---- recall = !recall; } ! /* Stop on everything but "return"/"space" */ ! if ((query != '\n') && (query != '\r') && (query != ' ')) break; /* Sometimes stop at "space" key */ if ((query == ' ') && !(mode & (TARGET_LOOK))) break; *************** *** 3046,3051 **** --- 3139,3146 ---- if (r_ptr->flags1 & (RF1_FEMALE)) s1 = "She is "; else if (r_ptr->flags1 & (RF1_MALE)) s1 = "He is "; + #if 1 + /* Use a preposition */ s2 = "carrying "; *************** *** 3056,3065 **** object_type *o_ptr; ! /* Acquire object */ o_ptr = &o_list[this_o_idx]; ! /* Acquire next object */ next_o_idx = o_ptr->next_o_idx; /* Obtain an object description */ --- 3151,3160 ---- 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; /* Obtain an object description */ *************** *** 3071,3078 **** move_cursor_relative(y, x); query = inkey(); ! /* Always stop at "normal" keys */ ! if ((query != '\r') && (query != '\n') && (query != ' ')) break; /* Sometimes stop at "space" key */ if ((query == ' ') && !(mode & (TARGET_LOOK))) break; --- 3166,3173 ---- move_cursor_relative(y, x); query = inkey(); ! /* Stop on everything but "return"/"space" */ ! if ((query != '\n') && (query != '\r') && (query != ' ')) break; /* Sometimes stop at "space" key */ if ((query == ' ') && !(mode & (TARGET_LOOK))) break; *************** *** 3084,3106 **** /* Double break */ if (this_o_idx) break; /* Use a preposition */ s2 = "on "; } } /* Scan all objects in the grid */ for (this_o_idx = cave_o_idx[y][x]; this_o_idx; this_o_idx = next_o_idx) { object_type *o_ptr; ! /* Acquire object */ o_ptr = &o_list[this_o_idx]; ! /* Acquire next object */ next_o_idx = o_ptr->next_o_idx; /* Describe it */ if (o_ptr->marked) { --- 3179,3279 ---- /* Double break */ if (this_o_idx) break; + #endif + /* Use a preposition */ s2 = "on "; } } + /* Assume not floored */ + floored = FALSE; + + #ifdef ALLOW_EASY_FLOOR + + /* Scan all objects in the grid */ + if (easy_floor) + { + int floor_list[24]; + int floor_num; + + /* Scan for floor objects */ + floor_num = scan_floor(floor_list, 24, y, x, 0x02); + + /* Actual pile */ + if (floor_num > 1) + { + /* Not boring */ + boring = FALSE; + + /* Floored */ + floored = TRUE; + + /* Describe */ + while (1) + { + /* Describe the pile */ + sprintf(out_val, "%s%s%sa pile of %d objects [r,%s]", + s1, s2, s3, floor_num, info); + prt(out_val, 0, 0); + move_cursor_relative(y, x); + query = inkey(); + + /* Display objects */ + if (query == 'r') + { + /* Save screen */ + screen_save(); + + /* Display */ + show_floor(floor_list, floor_num); + + /* Describe the pile */ + prt(out_val, 0, 0); + query = inkey(); + + /* Load screen */ + screen_load(); + + /* Continue on 'r' only */ + if (query == 'r') continue; + } + + /* Done */ + break; + } + + /* Stop on everything but "return"/"space" */ + if ((query != '\n') && (query != '\r') && (query != ' ')) break; + + /* Sometimes stop at "space" key */ + if ((query == ' ') && !(mode & (TARGET_LOOK))) break; + + /* Change the intro */ + s1 = "It is "; + + /* Preposition */ + s2 = "on "; + } + } + + #endif /* ALLOW_EASY_FLOOR */ + /* Scan all objects in the grid */ for (this_o_idx = cave_o_idx[y][x]; this_o_idx; this_o_idx = next_o_idx) { 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 objects if floored */ + if (floored) continue; + /* Describe it */ if (o_ptr->marked) { *************** *** 3118,3125 **** move_cursor_relative(y, x); query = inkey(); ! /* Always stop at "normal" keys */ ! if ((query != '\r') && (query != '\n') && (query != ' ')) break; /* Sometimes stop at "space" key */ if ((query == ' ') && !(mode & (TARGET_LOOK))) break; --- 3291,3298 ---- move_cursor_relative(y, x); query = inkey(); ! /* Stop on everything but "return"/"space" */ ! if ((query != '\n') && (query != '\r') && (query != ' ')) break; /* Sometimes stop at "space" key */ if ((query == ' ') && !(mode & (TARGET_LOOK))) break; *************** *** 3175,3186 **** move_cursor_relative(y, x); query = inkey(); ! /* Always stop at "normal" keys */ ! if ((query != '\r') && (query != '\n') && (query != ' ')) break; } /* Stop on everything but "return" */ ! if ((query != '\r') && (query != '\n')) break; } /* Keep going */ --- 3348,3359 ---- move_cursor_relative(y, x); query = inkey(); ! /* Stop on everything but "return"/"space" */ ! if ((query != '\n') && (query != '\r') && (query != ' ')) break; } /* Stop on everything but "return" */ ! if ((query != '\n') && (query != '\r')) break; } /* Keep going */ *************** *** 3234,3240 **** int py = p_ptr->py; int px = p_ptr->px; ! int i, d, m; int y = py; int x = px; --- 3407,3413 ---- int py = p_ptr->py; int px = p_ptr->px; ! int i, d, m, t, bd; int y = py; int x = px; *************** *** 3326,3338 **** case 'p': { y = py; x = px; } case 'o': { ! flag = !flag; break; } --- 3499,3534 ---- case 'p': { + + #ifdef ALLOW_SCROLL_TARGET + + if (scroll_target) + { + /* Recenter the map around the player */ + verify_panel(); + + /* Update stuff */ + p_ptr->update |= (PU_MONSTERS); + + /* Redraw map */ + p_ptr->redraw |= (PR_MAP); + + /* Window stuff */ + p_ptr->window |= (PW_OVERHEAD); + + /* Handle stuff */ + handle_stuff(); + } + + #endif /* ALLOW_SCROLL_TARGET */ + y = py; x = px; } case 'o': { ! flag = FALSE; break; } *************** *** 3344,3349 **** --- 3540,3546 ---- case 't': case '5': case '0': + case '.': { int m_idx = cave_m_idx[y][x]; *************** *** 3375,3383 **** --- 3572,3663 ---- /* Hack -- move around */ if (d) { + + #ifdef ALLOW_SCROLL_TARGET + + int y2 = p_ptr->wy; + int x2 = p_ptr->wx; + + #endif /* ALLOW_SCROLL_TARGET */ + /* Find a new monster */ i = target_pick(temp_y[m], temp_x[m], ddy[d], ddx[d]); + #ifdef ALLOW_SCROLL_TARGET + + /* Request to target past last interesting grid */ + while (scroll_target && flag && (i < 0)) + { + /* Note the change */ + if (change_panel(d)) + { + int v = temp_y[m]; + int u = temp_x[m]; + + /* Recalculate interesting grids */ + target_set_interactive_prepare(mode); + + /* Look at interesting grids */ + flag = TRUE; + + /* Find a new monster */ + i = target_pick(v, u, ddy[d], ddx[d]); + + /* Use that grid */ + if (i >= 0) m = i; + } + + /* Nothing interesting */ + else + { + /* Restore previous position */ + p_ptr->wy = y2; + p_ptr->wx = x2; + + /* Update stuff */ + p_ptr->update |= (PU_MONSTERS); + + /* Redraw map */ + p_ptr->redraw |= (PR_MAP); + + /* Window stuff */ + p_ptr->window |= (PW_OVERHEAD); + + /* Handle stuff */ + handle_stuff(); + + /* Recalculate interesting grids */ + target_set_interactive_prepare(mode); + + /* Look at boring grids */ + flag = FALSE; + + /* Move */ + x += ddx[d]; + y += ddy[d]; + + /* Apply the motion */ + if ((y >= p_ptr->wy + SCREEN_HGT) || (y < p_ptr->wy) || + (x >= p_ptr->wx + SCREEN_WID) || (x < p_ptr->wx)) + { + if (change_panel(d)) + { + target_set_interactive_prepare(mode); + } + } + + /* Slide into legality */ + if (x >= DUNGEON_WID-1) x = DUNGEON_WID - 2; + else if (x <= 0) x = 1; + + /* Slide into legality */ + if (y >= DUNGEON_HGT-1) y = DUNGEON_HGT - 2; + else if (y <= 0) y = 1; + } + } + + #endif /* ALLOW_SCROLL_TARGET */ + /* Use that grid */ if (i >= 0) m = i; } *************** *** 3418,3423 **** --- 3698,3726 ---- case 'p': { + + #ifdef ALLOW_SCROLL_TARGET + + if (scroll_target) + { + /* Recenter the map around the player */ + verify_panel(); + + /* Update stuff */ + p_ptr->update |= (PU_MONSTERS); + + /* Redraw map */ + p_ptr->redraw |= (PR_MAP); + + /* Window stuff */ + p_ptr->window |= (PW_OVERHEAD); + + /* Handle stuff */ + handle_stuff(); + } + + #endif /* ALLOW_SCROLL_TARGET */ + y = py; x = px; } *************** *** 3429,3441 **** case 'm': { ! flag = !flag; break; } case 't': case '5': case '0': { target_set_location(y, x); done = TRUE; --- 3732,3765 ---- case 'm': { ! flag = TRUE; ! ! m = 0; ! bd = 999; ! ! /* Pick a nearby monster */ ! for (i = 0; i < temp_n; i++) ! { ! t = distance(y, x, temp_y[i], temp_x[i]); ! ! /* Pick closest */ ! if (t < bd) ! { ! m = i; ! bd = t; ! } ! } ! ! /* Nothing interesting */ ! if (bd == 999) flag = FALSE; ! break; } case 't': case '5': case '0': + case '.': { target_set_location(y, x); done = TRUE; *************** *** 3461,3473 **** x += ddx[d]; y += ddy[d]; /* Slide into legality */ ! if ((x >= DUNGEON_WID-1) || (x >= p_ptr->wx+SCREEN_WID)) x--; ! else if ((x <= 0) || (x < p_ptr->wx)) x++; /* Slide into legality */ ! if ((y >= DUNGEON_HGT-1) || (y >= p_ptr->wy+SCREEN_HGT)) y--; ! else if ((y <= 0) || (y < p_ptr->wy)) y++; } } } --- 3785,3807 ---- x += ddx[d]; y += ddy[d]; + /* Apply the motion */ + if ((y >= p_ptr->wy + SCREEN_HGT) || (y < p_ptr->wy) || + (x >= p_ptr->wx + SCREEN_WID) || (x < p_ptr->wx)) + { + if (change_panel(d)) + { + target_set_interactive_prepare(mode); + } + } + /* Slide into legality */ ! if (x >= DUNGEON_WID-1) x = DUNGEON_WID - 2; ! else if (x <= 0) x = 1; /* Slide into legality */ ! if (y >= DUNGEON_HGT-1) y = DUNGEON_HGT - 2; ! else if (y <= 0) y = 1; } } } *************** *** 3478,3483 **** --- 3812,3839 ---- /* Clear the top line */ prt("", 0, 0); + #ifdef ALLOW_SCROLL_TARGET + + if (scroll_target) + { + /* Recenter the map around the player */ + verify_panel(); + + /* Update stuff */ + p_ptr->update |= (PU_MONSTERS); + + /* Redraw map */ + p_ptr->redraw |= (PR_MAP); + + /* Window stuff */ + p_ptr->window |= (PW_OVERHEAD); + + /* Handle stuff */ + handle_stuff(); + } + + #endif /* ALLOW_SCROLL_TARGET */ + /* Failure to set target */ if (!p_ptr->target_set) return (FALSE); *************** *** 3510,3515 **** --- 3866,3883 ---- cptr p; + #ifdef ALLOW_REPEAT + + if (repeat_pull(dp)) + { + /* Verify */ + if (!(*dp == 5 && !target_okay())) + { + return (TRUE); + } + } + + #endif /* ALLOW_REPEAT */ /* Initialize */ (*dp) = 0; *************** *** 3550,3555 **** --- 3918,3924 ---- case 't': case '5': case '0': + case '.': { if (target_okay()) dir = 5; break; *************** *** 3590,3595 **** --- 3959,3970 ---- /* Save direction */ (*dp) = dir; + #ifdef ALLOW_REPEAT + + repeat_push(dir); + + #endif /* ALLOW_REPEAT */ + /* A "valid" direction was entered */ return (TRUE); } *************** *** 3619,3624 **** --- 3994,4007 ---- cptr p; + #ifdef ALLOW_REPEAT + + if (repeat_pull(dp)) + { + return (TRUE); + } + + #endif /* ALLOW_REPEAT */ /* Initialize */ (*dp) = 0; *************** *** 3650,3655 **** --- 4033,4044 ---- /* Save direction */ (*dp) = dir; + + #ifdef ALLOW_REPEAT + + repeat_push(dir); + + #endif /* ALLOW_REPEAT */ /* Success */ return (TRUE); diff -r -c angband-283/src/z-form.c angband-285/src/z-form.c *** angband-283/src/z-form.c Fri Feb 6 04:10:31 1998 --- angband-285/src/z-form.c Sat Jul 24 16:50:17 1999 *************** *** 311,317 **** { int *arg; ! /* Access the next argument */ arg = va_arg(vp, int *); /* Save the current length */ --- 311,317 ---- { int *arg; ! /* Get the next argument */ arg = va_arg(vp, int *); /* Save the current length */ *************** *** 415,421 **** { int arg; ! /* Access the next argument */ arg = va_arg(vp, int); /* Hack -- append the "length" */ --- 415,421 ---- { int arg; ! /* Get the next argument */ arg = va_arg(vp, int); /* Hack -- append the "length" */ *************** *** 462,468 **** { int arg; ! /* Access next argument */ arg = va_arg(vp, int); /* Format the argument */ --- 462,468 ---- { int arg; ! /* Get the next argument */ arg = va_arg(vp, int); /* Format the argument */ *************** *** 479,485 **** { long arg; ! /* Access next argument */ arg = va_arg(vp, long); /* Format the argument */ --- 479,485 ---- { long arg; ! /* Get the next argument */ arg = va_arg(vp, long); /* Format the argument */ *************** *** 489,495 **** { int arg; ! /* Access next argument */ arg = va_arg(vp, int); /* Format the argument */ --- 489,495 ---- { int arg; ! /* Get the next argument */ arg = va_arg(vp, int); /* Format the argument */ *************** *** 507,513 **** { unsigned long arg; ! /* Access next argument */ arg = va_arg(vp, unsigned long); /* Format the argument */ --- 507,513 ---- { unsigned long arg; ! /* Get the next argument */ arg = va_arg(vp, unsigned long); /* Format the argument */ *************** *** 517,523 **** { unsigned int arg; ! /* Access next argument */ arg = va_arg(vp, unsigned int); /* Format the argument */ --- 517,523 ---- { unsigned int arg; ! /* Get the next argument */ arg = va_arg(vp, unsigned int); /* Format the argument */ *************** *** 535,541 **** { double arg; ! /* Access next argument */ arg = va_arg(vp, double); /* Format the argument */ --- 535,541 ---- { double arg; ! /* Get the next argument */ arg = va_arg(vp, double); /* Format the argument */ *************** *** 550,556 **** { vptr arg; ! /* Access next argument */ arg = va_arg(vp, vptr); /* Format the argument */ --- 550,556 ---- { vptr arg; ! /* Get the next argument */ arg = va_arg(vp, vptr); /* Format the argument */ *************** *** 565,571 **** { cptr arg; ! /* Access next argument */ arg = va_arg(vp, cptr); /* Hack -- convert NULL to EMPTY */ --- 565,571 ---- { cptr arg; ! /* Get the next argument */ arg = va_arg(vp, cptr); /* Hack -- convert NULL to EMPTY */ *************** *** 584,590 **** { vptr arg; ! /* Access next argument */ arg = va_arg(vp, vptr); /* Format the "user data" */ --- 584,590 ---- { vptr arg; ! /* Get the next argument */ arg = va_arg(vp, vptr); /* Format the "user data" */