Only in src-281: A-mac-h.c diff -r -c -w src-281/A-mac-h.pch angband-281/src/A-mac-h.pch *** src-281/A-mac-h.pch Mon Mar 3 22:15:46 1997 --- angband-281/src/A-mac-h.pch Thu Apr 24 10:19:15 1997 *************** *** 1,8 **** /* File: A-mac-h.pch */ /* ! * Purpose: Source for the pre-compiled header "A-mac-h-68K" ! * This file is used by the Code Warrior 7 Macintosh version */ #if defined(__MWERKS__) --- 1,8 ---- /* File: A-mac-h.pch */ /* ! * This file creates pre-compiled header files which are used ! * to compile Macintosh Angband using the Code Warrior compiler. */ #if defined(__MWERKS__) *************** *** 42,45 **** --- 42,51 ---- * Precompile the header files */ #include "angband.h" + + /* + * Include the standard ansi_prefix.mac.h file + */ + #define MSL_USE_PRECOMPILED_HEADERS 0 + #include "ansi_prefix.mac.h" diff -r -c -w src-281/A-win-h.pch angband-281/src/A-win-h.pch *** src-281/A-win-h.pch Mon Mar 3 22:16:36 1997 --- angband-281/src/A-win-h.pch Thu Apr 24 10:19:17 1997 *************** *** 6,33 **** #pragma precompile_target "A-win-h-W32" /* ! * Special "Windows" stuff for Code Warrior 7 */ ! #include /* ! * Activate some "Ben Hacks" in "main-win.c" */ ! #define BEN_HACK /* ! * Hack -- compiler complaint */ ! #define _export /* nothing */ /* - * Hack -- file constants - */ - #define O_RDONLY 1 - #define O_WRONLY 2 - #define O_RDWR 4 - - /* * Activate the Windows-specific code */ #ifndef WINDOWS --- 6,26 ---- #pragma precompile_target "A-win-h-W32" /* ! * Include windows stuff */ ! #include "ansi_prefix.win32.h" /* ! * Include windows stuff */ ! #include /* ! * Activate some "Ben Hacks" in "main-win.c" */ ! /* #define BEN_HACK */ /* * Activate the Windows-specific code */ #ifndef WINDOWS *************** *** 45,51 **** /* * Optional modules */ ! #define ALLOW_BORG ! #define ALLOW_WIZARD ! #define ALLOW_SPOILERS --- 38,44 ---- /* * Optional modules */ ! /* #define ALLOW_BORG */ ! /* #define ALLOW_WIZARD */ ! /* #define ALLOW_SPOILERS */ diff -r -c -w src-281/Makefile angband-281/src/Makefile *** src-281/Makefile Mon Mar 10 21:08:35 1997 --- angband-281/src/Makefile Thu Apr 24 22:05:24 1997 *************** *** 1,9 **** # File: Makefile CFLAGS = -Wall -O1 -pipe -g -pg -D"USE_X11" -D"USE_GCU" -D"SOLARIS" \ ! -I/usr/local/X11R6/include -L/usr/local/X11R6/lib -Wl,-Bstatic LIBS = -Wl,-Bdynamic -lX11 -lcurses -ltermcap -lsocket -lnsl # This is not a very "nice" Makefile, but it usually works. # --- 1,12 ---- # File: Makefile CFLAGS = -Wall -O1 -pipe -g -pg -D"USE_X11" -D"USE_GCU" -D"SOLARIS" \ ! -D"ALLOW_BORG" -D"ALLOW_WIZARD" -D"ALLOW_SPOILERS" \ ! -I/usr/local/X11R6/include ! LDFLAGS = -L/usr/local/X11R6/lib -Wl,-Bstatic LIBS = -Wl,-Bdynamic -lX11 -lcurses -ltermcap -lsocket -lnsl + # This is not a very "nice" Makefile, but it usually works. # *************** *** 57,62 **** --- 60,67 ---- store.c birth.c load1.c load2.c \ wizard1.c wizard2.c \ generate.c dungeon.c init1.c init2.c \ + borg1.c borg2.c borg3.c borg4.c borg5.c \ + borg6.c borg7.c borg8.c borg9.c \ main-cap.c main-gcu.c main-x11.c main-xaw.c main.c OBJS = \ *************** *** 69,74 **** --- 74,81 ---- store.o birth.o load1.o load2.o \ wizard1.o wizard2.o \ generate.o dungeon.o init1.o init2.o \ + borg1.o borg2.o borg3.o borg4.o borg5.o \ + borg6.o borg7.o borg8.o borg9.o \ main-cap.o main-gcu.o main-x11.o main-xaw.o main.o *************** *** 219,226 **** # Hack -- "install" as the base target # ! install: testing ! cp testing .. # --- 226,233 ---- # Hack -- "install" as the base target # ! install: angband ! cp angband .. # *************** *** 227,234 **** # Build the "Angband" program # ! testing: $(OBJS) ! $(CC) $(CFLAGS) -o testing $(OBJS) $(LDFLAGS) $(LIBS) # --- 234,241 ---- # Build the "Angband" program # ! angband: $(OBJS) ! $(CC) $(CFLAGS) $(LDFLAGS) -o angband $(OBJS) $(LIBS) # Only in angband-281/src: Makefile.std Only in angband-281/src: angband diff -r -c -w src-281/birth.c angband-281/src/birth.c *** src-281/birth.c Fri Mar 7 15:50:12 1997 --- angband-281/src/birth.c Thu Apr 24 10:19:37 1997 *************** *** 299,305 **** /* Save the history */ for (i = 0; i < 4; i++) { ! strcpy(prev.history[i], history[i]); } } --- 299,305 ---- /* Save the history */ for (i = 0; i < 4; i++) { ! strcpy(prev.history[i], p_ptr->history[i]); } } *************** *** 332,338 **** /* Save the history */ for (i = 0; i < 4; i++) { ! strcpy(temp.history[i], history[i]); } --- 332,338 ---- /* Save the history */ for (i = 0; i < 4; i++) { ! strcpy(temp.history[i], p_ptr->history[i]); } *************** *** 355,361 **** /* Load the history */ for (i = 0; i < 4; i++) { ! strcpy(history[i], prev.history[i]); } --- 355,361 ---- /* Load the history */ for (i = 0; i < 4; i++) { ! strcpy(p_ptr->history[i], prev.history[i]); } *************** *** 385,396 **** /* ! * Returns adjusted stat -JK- Algorithm by -JWT- * ! * auto_roll is boolean and states maximum changes should be used rather ! * than random ones to allow specification of higher values to wait for ! * ! * The "p_ptr->maximize" code is important -BEN- */ static int adjust_stat(int value, s16b amount, int auto_roll) { --- 385,396 ---- /* ! * 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 ! * is being used, the changes are fixed. Otherwise, semi-random ! * changes will occur, with larger changes at lower values. */ static int adjust_stat(int value, s16b amount, int auto_roll) { *************** *** 528,534 **** /* Level one */ ! p_ptr->max_plv = p_ptr->lev = 1; /* Experience factor */ p_ptr->expfact = rp_ptr->r_exp + cp_ptr->c_exp; --- 528,534 ---- /* Level one */ ! p_ptr->max_lev = p_ptr->lev = 1; /* Experience factor */ p_ptr->expfact = rp_ptr->r_exp + cp_ptr->c_exp; *************** *** 548,554 **** max_value += PY_MAX_LEVEL; /* Pre-calculate level 1 hitdice */ ! player_hp[0] = p_ptr->hitdie; /* Roll out the hitpoints */ while (TRUE) --- 548,554 ---- max_value += PY_MAX_LEVEL; /* Pre-calculate level 1 hitdice */ ! p_ptr->player_hp[0] = p_ptr->hitdie; /* Roll out the hitpoints */ while (TRUE) *************** *** 557,570 **** for (i = 1; i < PY_MAX_LEVEL; i++) { j = randint(p_ptr->hitdie); ! player_hp[i] = player_hp[i-1] + j; } /* XXX Could also require acceptable "mid-level" hitpoints */ /* Require "valid" hitpoints at highest level */ ! if (player_hp[PY_MAX_LEVEL-1] < min_value) continue; ! if (player_hp[PY_MAX_LEVEL-1] > max_value) continue; /* Acceptable */ break; --- 557,570 ---- for (i = 1; i < PY_MAX_LEVEL; i++) { j = randint(p_ptr->hitdie); ! p_ptr->player_hp[i] = p_ptr->player_hp[i-1] + j; } /* XXX Could also require acceptable "mid-level" hitpoints */ /* Require "valid" hitpoints at highest level */ ! if (p_ptr->player_hp[PY_MAX_LEVEL-1] < min_value) continue; ! if (p_ptr->player_hp[PY_MAX_LEVEL-1] > max_value) continue; /* Acceptable */ break; *************** *** 586,592 **** /* Clear the previous history strings */ ! for (i = 0; i < 4; i++) history[i][0] = '\0'; /* Clear the history text */ --- 586,592 ---- /* Clear the previous history strings */ ! for (i = 0; i < 4; i++) p_ptr->history[i][0] = '\0'; /* Clear the history text */ *************** *** 711,717 **** if (n < 60) { /* Save one line of history */ ! strcpy(history[i++], s); /* All done */ break; --- 711,717 ---- if (n < 60) { /* Save one line of history */ ! strcpy(p_ptr->history[i++], s); /* All done */ break; *************** *** 727,733 **** while ((n > 0) && (s[n-1] == ' ')) s[--n] = '\0'; /* Save one line of history */ ! strcpy(history[i++], s); /* Start next line */ for (s = t; *s == ' '; s++) /* loop */; --- 727,733 ---- while ((n > 0) && (s[n-1] == ' ')) s[--n] = '\0'; /* Save one line of history */ ! strcpy(p_ptr->history[i++], s); /* Start next line */ for (s = t; *s == ' '; s++) /* loop */; *************** *** 839,853 **** { int i; ! /* Hack -- zero the struct */ WIPE(p_ptr, player_type); ! /* Wipe the history */ ! for (i = 0; i < 4; i++) ! { ! strcpy(history[i], ""); ! } /* No weight */ --- 839,855 ---- { int i; + char full_name[32]; ! ! /* Save full name XXX XXX XXX */ ! strcpy(full_name, p_ptr->full_name); ! ! /* Hack -- wipe XXX XXX XXX */ WIPE(p_ptr, player_type); ! /* Restore full name XXX XXX XXX */ ! strcpy(p_ptr->full_name, full_name); /* No weight */ *************** *** 925,935 **** p_ptr->food = PY_FOOD_FULL - 1; ! /* Wipe the spells */ ! spell_learned1 = spell_learned2 = 0L; ! spell_worked1 = spell_worked2 = 0L; ! spell_forgotten1 = spell_forgotten2 = 0L; ! for (i = 0; i < 64; i++) spell_order[i] = 99; /* Clear "cheat" options */ --- 927,934 ---- p_ptr->food = PY_FOOD_FULL - 1; ! /* None of the spells have been learned yet */ ! for (i = 0; i < 64; i++) p_ptr->spell_order[i] = 99; /* Clear "cheat" options */ *************** *** 1014,1044 **** { int i, tv, sv; ! object_type forge; ! object_type *q_ptr; /* Get local object */ ! q_ptr = &forge; /* Hack -- Give the player some food */ ! object_prep(q_ptr, lookup_kind(TV_FOOD, SV_FOOD_RATION)); ! q_ptr->number = rand_range(3, 7); ! object_aware(q_ptr); ! object_known(q_ptr); ! (void)inven_carry(q_ptr, FALSE); /* Get local object */ ! q_ptr = &forge; /* Hack -- Give the player some torches */ ! object_prep(q_ptr, lookup_kind(TV_LITE, SV_LITE_TORCH)); ! q_ptr->number = rand_range(3, 7); ! q_ptr->pval = rand_range(3, 7) * 500; ! object_aware(q_ptr); ! object_known(q_ptr); ! (void)inven_carry(q_ptr, FALSE); /* Hack -- Give the player three useful objects */ for (i = 0; i < 3; i++) --- 1013,1043 ---- { int i, tv, sv; ! object_type *i_ptr; ! object_type object_type_body; /* Get local object */ ! i_ptr = &object_type_body; /* Hack -- Give the player some food */ ! object_prep(i_ptr, lookup_kind(TV_FOOD, SV_FOOD_RATION)); ! i_ptr->number = rand_range(3, 7); ! object_aware(i_ptr); ! object_known(i_ptr); ! (void)inven_carry(i_ptr); /* Get local object */ ! i_ptr = &object_type_body; /* Hack -- Give the player some torches */ ! object_prep(i_ptr, lookup_kind(TV_LITE, SV_LITE_TORCH)); ! i_ptr->number = rand_range(3, 7); ! i_ptr->pval = rand_range(3, 7) * 500; ! object_aware(i_ptr); ! object_known(i_ptr); ! (void)inven_carry(i_ptr); /* Hack -- Give the player three useful objects */ for (i = 0; i < 3; i++) *************** *** 1048,1060 **** sv = player_init[p_ptr->pclass][i][1]; /* Get local object */ ! q_ptr = &forge; /* Hack -- Give the player an object */ ! object_prep(q_ptr, lookup_kind(tv, sv)); ! object_aware(q_ptr); ! object_known(q_ptr); ! (void)inven_carry(q_ptr, FALSE); } } --- 1047,1059 ---- sv = player_init[p_ptr->pclass][i][1]; /* Get local object */ ! i_ptr = &object_type_body; /* Hack -- Give the player an object */ ! object_prep(i_ptr, lookup_kind(tv, sv)); ! object_aware(i_ptr); ! object_known(i_ptr); ! (void)inven_carry(i_ptr); } } *************** *** 1079,1085 **** --- 1078,1086 ---- char c; + #if 0 char p1 = '('; + #endif char p2 = ')'; char b1 = '['; char b2 = ']'; *************** *** 1101,1107 **** put_str("Class :", 5, 1); /* Dump the default name */ ! c_put_str(TERM_L_BLUE, player_name, 2, 15); /*** Instructions ***/ --- 1102,1108 ---- put_str("Class :", 5, 1); /* Dump the default name */ ! c_put_str(TERM_L_BLUE, p_ptr->full_name, 2, 15); /*** Instructions ***/ *************** *** 1146,1152 **** if (c == 'S') return (FALSE); k = (islower(c) ? A2I(c) : -1); if ((k >= 0) && (k < n)) break; ! if (c == '?') do_cmd_help("help.hlp"); else bell(); } --- 1147,1153 ---- if (c == 'S') return (FALSE); k = (islower(c) ? A2I(c) : -1); if ((k >= 0) && (k < n)) break; ! if (c == '?') do_cmd_help(); else bell(); } *************** *** 1191,1197 **** if (c == 'S') return (FALSE); k = (islower(c) ? A2I(c) : -1); if ((k >= 0) && (k < n)) break; ! if (c == '?') do_cmd_help("help.hlp"); else bell(); } --- 1192,1198 ---- if (c == 'S') return (FALSE); k = (islower(c) ? A2I(c) : -1); if ((k >= 0) && (k < n)) break; ! if (c == '?') do_cmd_help(); else bell(); } *************** *** 1244,1250 **** if (c == 'S') return (FALSE); k = (islower(c) ? A2I(c) : -1); if ((k >= 0) && (k < n)) break; ! if (c == '?') do_cmd_help("help.hlp"); else bell(); } --- 1245,1251 ---- if (c == 'S') return (FALSE); k = (islower(c) ? A2I(c) : -1); if ((k >= 0) && (k < n)) break; ! if (c == '?') do_cmd_help(); else bell(); } *************** *** 1278,1284 **** if (c == 'S') return (FALSE); if (c == ESCAPE) break; if ((c == 'y') || (c == 'n')) break; ! if (c == '?') do_cmd_help("help.hlp"); else bell(); } --- 1279,1285 ---- if (c == 'S') return (FALSE); if (c == ESCAPE) break; if ((c == 'y') || (c == 'n')) break; ! if (c == '?') do_cmd_help(); else bell(); } *************** *** 1306,1312 **** if (c == 'S') return (FALSE); if (c == ESCAPE) break; if ((c == 'y') || (c == 'n')) break; ! if (c == '?') do_cmd_help("help.hlp"); else bell(); } --- 1307,1313 ---- if (c == 'S') return (FALSE); if (c == ESCAPE) break; if ((c == 'y') || (c == 'n')) break; ! if (c == '?') do_cmd_help(); else bell(); } *************** *** 1336,1342 **** if (c == 'S') return (FALSE); if (c == ESCAPE) break; if ((c == 'y') || (c == 'n')) break; ! if (c == '?') do_cmd_help("help.hlp"); else bell(); } --- 1337,1343 ---- if (c == 'S') return (FALSE); if (c == ESCAPE) break; if ((c == 'y') || (c == 'n')) break; ! if (c == '?') do_cmd_help(); else bell(); } *************** *** 1461,1467 **** put_str("Race :", 4, 1); put_str("Class :", 5, 1); ! c_put_str(TERM_L_BLUE, player_name, 2, 15); c_put_str(TERM_L_BLUE, sp_ptr->title, 3, 15); c_put_str(TERM_L_BLUE, rp_ptr->title, 4, 15); c_put_str(TERM_L_BLUE, cp_ptr->title, 5, 15); --- 1462,1468 ---- put_str("Race :", 4, 1); put_str("Class :", 5, 1); ! c_put_str(TERM_L_BLUE, p_ptr->full_name, 2, 15); c_put_str(TERM_L_BLUE, sp_ptr->title, 3, 15); c_put_str(TERM_L_BLUE, rp_ptr->title, 4, 15); c_put_str(TERM_L_BLUE, cp_ptr->title, 5, 15); *************** *** 1631,1637 **** /* Help */ if (c == '?') { ! do_cmd_help("help.hlp"); continue; } --- 1632,1638 ---- /* Help */ if (c == '?') { ! do_cmd_help(); continue; } Only in angband-281/src: birth.o Only in angband-281/src: borg.h Only in angband-281/src: borg1.c Only in angband-281/src: borg1.o Only in angband-281/src: borg2.c Only in angband-281/src: borg2.o Only in angband-281/src: borg3.c Only in angband-281/src: borg3.o Only in angband-281/src: borg4.c Only in angband-281/src: borg4.o Only in angband-281/src: borg5.c Only in angband-281/src: borg5.o Only in angband-281/src: borg6.c Only in angband-281/src: borg6.o Only in angband-281/src: borg7.c Only in angband-281/src: borg7.o Only in angband-281/src: borg8.c Only in angband-281/src: borg8.o Only in angband-281/src: borg9.c Only in angband-281/src: borg9.o diff -r -c -w src-281/cave.c angband-281/src/cave.c *** src-281/cave.c Mon Mar 3 22:17:26 1997 --- angband-281/src/cave.c Thu Apr 24 22:08:51 1997 *************** *** 105,114 **** if ((ax < 2) && (ay < 2)) return (TRUE); - /* Paranoia -- require "safe" origin */ - /* if (!in_bounds(y1, x1)) return (FALSE); */ - - /* Directly South/North */ if (!dx) { --- 105,110 ---- *************** *** 296,331 **** /* ! * Can the player "see" the given grid in detail? * * He must have vision, illumination, and line of sight. * ! * Note -- "CAVE_LITE" is only set if the "torch" has "los()". ! * So, given "CAVE_LITE", we know that the grid is "fully visible". * ! * Note that "CAVE_GLOW" makes little sense for a wall, since it would mean ! * that a wall is visible from any direction. That would be odd. Except ! * under wizard light, which might make sense. Thus, for walls, we require ! * not only that they be "CAVE_GLOW", but also, that they be adjacent to a ! * grid which is not only "CAVE_GLOW", but which is a non-wall, and which is ! * in line of sight of the player. * ! * This extra check is expensive, but it provides a more "correct" semantics. * ! * Note that we should not run this check on walls which are "outer walls" of ! * the dungeon, or we will induce a memory fault, but actually verifying all ! * of the locations would be extremely expensive. * ! * Thus, to speed up the function, we assume that all "perma-walls" which are ! * "CAVE_GLOW" are "illuminated" from all sides. This is correct for all cases ! * except "vaults" and the "buildings" in town. But the town is a hack anyway, ! * and the player has more important things on his mind when he is attacking a ! * monster vault. It is annoying, but an extremely important optimization. * ! * Note that "glowing walls" are only considered to be "illuminated" if the ! * grid which is next to the wall in the direction of the player is also a ! * "glowing" grid. This prevents the player from being able to "see" the ! * walls of illuminated rooms from a corridor outside the room. */ bool player_can_see_bold(int y, int x) { --- 292,342 ---- /* ! * Can the player "see" the given grid? * * He must have vision, illumination, and line of sight. * ! * If the player is "blind", then no grids can be "seen". * ! * Note that "CAVE_LITE" means that a grid is lit by the player's torch, ! * which means that the grid is "lit" and "viewable", so all such grids ! * can, by definition, be "seen". * ! * Note that "CAVE_GLOW" means that a grid is "permanently illuminated", ! * which, normally, means that if the grid is "viewable", then it can be ! * "seen". But for wall/door grids, since they are not "translucent", ! * this is only true if, in addition, the grid which is closest to the ! * player and adjacent to the wall grid is also "permanently lit". * ! * This bizarre method for handling perma-lit wall grids may be more ! * expensive than simply assuming that perma-lit wall grids, like the ! * floor grids, can be seen when viewable, but it provides a somewhat ! * more "correct" semantics, in particular, it prevents the player from ! * "seeing" the wall of a room from a hallway running next to the room. * ! * Technically, we should check all eight grids adjacent to the wall grid, ! * and if any of them are "perma-lit" non-wall grids which are "viewable" ! * to the player, then the wall grid, if perma-lit itself, can be "seen", ! * but this is extremely expensive, and dangerous, if the wall grid is ! * adjacent to any "illegal" grids. But the semantics would be slightly ! * better, for example, currently, wall grids which frame the "entrance" ! * to a lit room cannot be "seen" by a player in a dark hallway. * ! * We must be very careful about combining this function, in particular, ! * the parts which deal with "perma-lit" wall grids, with any optimized ! * algorithms, such as the "update_view()" code, which only calls the ! * "note_spot()" function (which uses an "inline" version of this code) ! * for grids which "change" viewability, since strange things may happen ! * if we are not careful. For example, when a player enters a lit room, ! * from a dark hall, through a closed door, with no torch, we must ensure ! * that the walls adjacent to the door are "seen" from the doorway. ! * ! * The "doorway" example is responsible for the "optional" method shown ! * below, in which we check three adjacent grids instead of just a single ! * adjacent grid, and we forbid these grids from being walls. ! * ! * See also the various "inline" versions of "player_can_see_bold()", for ! * example, in the "note_spot()" and "map_info()" functions. */ bool player_can_see_bold(int y, int x) { *************** *** 352,360 **** if (cave_floor_bold(y, x)) return (TRUE); /* Hack -- move towards player */ ! yy = (y < py) ? (y + 1) : (y > py) ? (y - 1) : y; ! xx = (x < px) ? (x + 1) : (x > px) ? (x - 1) : x; /* Check for "local" illumination */ if (cave[yy][xx].info & (CAVE_GLOW)) { --- 363,382 ---- if (cave_floor_bold(y, x)) return (TRUE); /* Hack -- move towards player */ ! yy = (y < p_ptr->py) ? (y + 1) : (y > p_ptr->py) ? (y - 1) : y; ! xx = (x < p_ptr->px) ? (x + 1) : (x > p_ptr->px) ? (x - 1) : x; + #if 0 + /* Alternative method */ + if ((cave_floor_bold(yy, xx) && (cave[yy][xx].info & (CAVE_GLOW))) || + (cave_floor_bold(y, xx) && (cave[y][xx].info & (CAVE_GLOW))) || + (cave_floor_bold(yy, x) && (cave[yy][x].info & (CAVE_GLOW)))) + { + /* Assume the wall is really illuminated */ + return (TRUE); + } + #endif + /* Check for "local" illumination */ if (cave[yy][xx].info & (CAVE_GLOW)) { *************** *** 373,379 **** */ bool no_lite(void) { ! return (!player_can_see_bold(py, px)); } --- 395,401 ---- */ bool no_lite(void) { ! return (!player_can_see_bold(p_ptr->py, p_ptr->px)); } *************** *** 581,589 **** * grids when the "view_bright_lite" option is set, and we do NOT use * any special colors for "dark" wall grids, since this would allow the * player to notice the walls of illuminated rooms from a hallway that ! * happened to run beside the room. The alternative, by the way, would ! * be to prevent the generation of hallways next to rooms, but this ! * would still allow problems when digging towards a room. * * Note that bizarre things must be done when the "attr" and/or "char" * codes have the "high-bit" set, since these values are used to encode --- 603,609 ---- * grids when the "view_bright_lite" option is set, and we do NOT use * any special colors for "dark" wall grids, since this would allow the * player to notice the walls of illuminated rooms from a hallway that ! * happened to run beside the room. * * Note that bizarre things must be done when the "attr" and/or "char" * codes have the "high-bit" set, since these values are used to encode *************** *** 593,601 **** * * Note that eventually we may use the "&" symbol for embedded treasure, * and use the "*" symbol to indicate multiple objects, though this will ! * have to wait for Angband 2.8.0 or later. Note that currently, this ! * is not important, since only one object or terrain feature is allowed ! * in each grid. If needed, "k_info[0]" will hold the "stack" attr/char. * * Note the assumption that doing "x_ptr = &x_info[x]" plus a few of * "x_ptr->xxx", is quicker than "x_info[x].xxx", if this is incorrect --- 613,621 ---- * * Note that eventually we may use the "&" symbol for embedded treasure, * and use the "*" symbol to indicate multiple objects, though this will ! * have to wait for Angband 2.8.2 or later. Currently, we simply use ! * the attr/char of the first "marked" object in the stack. If we did ! * use some special symbol, it could be stored in "f_info[0]". * * Note the assumption that doing "x_ptr = &x_info[x]" plus a few of * "x_ptr->xxx", is quicker than "x_info[x].xxx", if this is incorrect *************** *** 761,768 **** int xx, yy; /* Hack -- move towards player */ ! yy = (y < py) ? (y + 1) : (y > py) ? (y - 1) : y; ! xx = (x < px) ? (x + 1) : (x > px) ? (x - 1) : x; /* Check for "local" illumination */ if (!(cave[yy][xx].info & (CAVE_GLOW))) --- 781,788 ---- int xx, yy; /* Hack -- move towards player */ ! yy = (y < p_ptr->py) ? (y + 1) : (y > p_ptr->py) ? (y - 1) : y; ! xx = (x < p_ptr->px) ? (x + 1) : (x > p_ptr->px) ? (x - 1) : x; /* Check for "local" illumination */ if (!(cave[yy][xx].info & (CAVE_GLOW))) *************** *** 948,956 **** /* Only do "legal" locations */ if (panel_contains(y, x)) { - /* Hack -- fake monochrome */ - if (!use_color) a = TERM_WHITE; - /* Draw the char using the attr */ Term_draw(x-panel_col_prt, y-panel_row_prt, a, c); } --- 968,973 ---- *************** *** 995,1003 **** * viewable or illuminated in any way, but not when they "maintain" * or "lose" their previous viewability or illumination. * ! * Note the butchered "internal" version of "player_can_see_bold()", * optimized primarily for the most common cases, that is, for the ! * non-marked floor grids. */ void note_spot(int y, int x) { --- 1012,1021 ---- * viewable or illuminated in any way, but not when they "maintain" * or "lose" their previous viewability or illumination. * ! * Note the butchered "inline" version of "player_can_see_bold()", * optimized primarily for the most common cases, that is, for the ! * non-marked floor grids. See "player_can_see_bold()" for some ! * warnings about possible problems with this technique. */ void note_spot(int y, int x) { *************** *** 1074,1081 **** int yy, xx; /* Hack -- move one grid towards player */ ! yy = (y < py) ? (y + 1) : (y > py) ? (y - 1) : y; ! xx = (x < px) ? (x + 1) : (x > px) ? (x - 1) : x; /* Check for "local" illumination */ if (cave[yy][xx].info & (CAVE_GLOW)) --- 1092,1099 ---- int yy, xx; /* Hack -- move one grid towards player */ ! yy = (y < p_ptr->py) ? (y + 1) : (y > p_ptr->py) ? (y - 1) : y; ! xx = (x < p_ptr->px) ? (x + 1) : (x > p_ptr->px) ? (x - 1) : x; /* Check for "local" illumination */ if (cave[yy][xx].info & (CAVE_GLOW)) *************** *** 1102,1108 **** char c; /* Handle "player" */ ! if ((y == py) && (x == px)) { monster_race *r_ptr = &r_info[0]; --- 1120,1126 ---- char c; /* Handle "player" */ ! if ((y == p_ptr->py) && (x == p_ptr->px)) { monster_race *r_ptr = &r_info[0]; *************** *** 1120,1128 **** map_info(y, x, &a, &c); } - /* Hack -- fake monochrome */ - if (!use_color) a = TERM_WHITE; - /* Efficiency -- immitate "print_rel()" */ Term_draw(x-panel_col_prt, y-panel_row_prt, a, c); } --- 1138,1143 ---- *************** *** 1162,1170 **** /* Determine what is there */ map_info(y, x, &a, &c); - /* Hack -- fake monochrome */ - if (!use_color) a = TERM_WHITE; - /* Efficiency -- Redraw that grid of the map */ Term_draw(x-panel_col_prt, y-panel_row_prt, a, c); } --- 1177,1182 ---- *************** *** 1171,1177 **** } /* Display player */ ! lite_spot(py, px); /* Restore the cursor */ (void)Term_set_cursor(v); --- 1183,1189 ---- } /* Display player */ ! lite_spot(p_ptr->py, p_ptr->px); /* Restore the cursor */ (void)Term_set_cursor(v); *************** *** 1381,1389 **** ta = ma[y][x]; tc = mc[y][x]; - /* Hack -- fake monochrome */ - if (!use_color) ta = TERM_WHITE; - /* Add the character */ Term_addch(ta, tc); } --- 1393,1398 ---- *************** *** 1391,1398 **** /* Player location */ ! (*cy) = py / RATIO + 1; ! (*cx) = px / RATIO + 1; /* Restore lighting effects */ --- 1400,1407 ---- /* Player location */ ! (*cy) = p_ptr->py / RATIO + 1; ! (*cx) = p_ptr->px / RATIO + 1; /* Restore lighting effects */ *************** *** 1446,1454 **** a = r_ptr->x_attr; c = r_ptr->x_char; - /* Hack -- fake monochrome */ - if (!use_color) a = TERM_WHITE; - /* Dump the player */ Term_draw(cx, cy, a, c); } --- 1455,1460 ---- *************** *** 1471,1477 **** /* ! * Some comments on the cave grid flags. -BEN- * * * One of the major bottlenecks in previous versions of Angband was in --- 1477,1483 ---- /* ! * Some comments on the cave grid flags. * * * One of the major bottlenecks in previous versions of Angband was in *************** *** 1528,1547 **** * grid and maintains an array of all "CAVE_LITE" grids. * * This set of grids is the complete set of all grids which are lit by ! * the players light source, which allows the "player_can_see_bold()" ! * function to work very quickly. * - * Note that every "CAVE_LITE" grid is also a "CAVE_VIEW" grid, and in - * fact, the player (unless blind) can always "see" all grids which are - * marked as "CAVE_LITE", unless they are "off screen". * - * * The "update_view()" function maintains the "CAVE_VIEW" flag for each * grid and maintains an array of all "CAVE_VIEW" grids. * * This set of grids is the complete set of all grids within line of sight ! * of the player, allowing the "player_has_los_bold()" macro to work very ! * quickly. * * * The current "update_view()" algorithm uses the "CAVE_XTRA" flag as a --- 1534,1549 ---- * grid and maintains an array of all "CAVE_LITE" grids. * * This set of grids is the complete set of all grids which are lit by ! * the players torch. See "player_can_see_bold()" for an important use ! * of this set of grids. * * * The "update_view()" function maintains the "CAVE_VIEW" flag for each * grid and maintains an array of all "CAVE_VIEW" grids. * * This set of grids is the complete set of all grids within line of sight ! * of the player. See "player_has_los_bold()" for an important use of this ! * set of grids. * * * The current "update_view()" algorithm uses the "CAVE_XTRA" flag as a *************** *** 1562,1571 **** * * Any grid can be marked as "CAVE_GLOW" which means that the grid itself is * in some way permanently lit. However, for the player to "see" anything ! * in the grid, as determined by "player_can_see()", the player must not be ! * blind, the grid must be marked as "CAVE_VIEW", and, in addition, "wall" * grids, even if marked as "perma lit", are only illuminated if they touch ! * a grid which is not a wall and is marked both "CAVE_GLOW" and "CAVE_VIEW". * * * To simplify various things, a grid may be marked as "CAVE_MARK", meaning --- 1564,1575 ---- * * Any grid can be marked as "CAVE_GLOW" which means that the grid itself is * in some way permanently lit. However, for the player to "see" anything ! * in the grid, as determined by "player_can_see_bold()", the player must not ! * be blind, the grid must be marked as "CAVE_VIEW", and, in addition, "wall" * grids, even if marked as "perma lit", are only illuminated if they touch ! * a grid which is not a wall and is marked both "CAVE_GLOW" and "CAVE_VIEW", ! * and that grid must be closer to the player than the wall grid. Note that ! * this last condition can cause problems, see "player_can_see_bold()". * * * To simplify various things, a grid may be marked as "CAVE_MARK", meaning *************** *** 1720,1729 **** * called when the "lite" array is full. */ #define cave_lite_hack(Y,X) \ cave[Y][X].info |= (CAVE_LITE); \ lite_y[lite_n] = (Y); \ lite_x[lite_n] = (X); \ ! lite_n++ --- 1724,1735 ---- * called when the "lite" array is full. */ #define cave_lite_hack(Y,X) \ + do { \ cave[Y][X].info |= (CAVE_LITE); \ lite_y[lite_n] = (Y); \ lite_x[lite_n] = (X); \ ! lite_n++; \ ! } while (0) *************** *** 1756,1764 **** */ void update_lite(void) { ! int i, x, y, min_x, max_x, min_y, max_y; /*** Special case ***/ /* Hack -- Player has no lite */ --- 1762,1775 ---- */ void update_lite(void) { ! int i, y, x; + int py = p_ptr->py; + int px = p_ptr->px; + cave_type *c_ptr; + + /*** Special case ***/ /* Hack -- Player has no lite */ *************** *** 1783,1793 **** y = lite_y[i]; x = lite_x[i]; /* Mark the grid as not "lite" */ ! cave[y][x].info &= ~(CAVE_LITE); /* Mark the grid as "seen" */ ! cave[y][x].info |= (CAVE_TEMP); /* Add it to the "seen" set */ temp_y[temp_n] = y; --- 1794,1807 ---- y = lite_y[i]; x = lite_x[i]; + /* Acquire cave grid */ + c_ptr = &cave[y][x]; + /* Mark the grid as not "lite" */ ! c_ptr->info &= ~(CAVE_LITE); /* Mark the grid as "seen" */ ! c_ptr->info |= (CAVE_TEMP); /* Add it to the "seen" set */ temp_y[temp_n] = y; *************** *** 1861,1866 **** --- 1875,1882 ---- { int d, p; + int y1, y2, x1, x2; + /* Maximal radius */ p = p_ptr->cur_lite; *************** *** 1892,1916 **** } /* Maximal north */ ! min_y = py - p; ! if (min_y < 0) min_y = 0; /* Maximal south */ ! max_y = py + p; ! if (max_y > cur_hgt-1) max_y = cur_hgt-1; /* Maximal west */ ! min_x = px - p; ! if (min_x < 0) min_x = 0; /* Maximal east */ ! max_x = px + p; ! if (max_x > cur_wid-1) max_x = cur_wid-1; /* Scan the maximal box */ ! for (y = min_y; y <= max_y; y++) { ! for (x = min_x; x <= max_x; x++) { int dy = (py > y) ? (py - y) : (y - py); int dx = (px > x) ? (px - x) : (x - px); --- 1908,1932 ---- } /* Maximal north */ ! y1 = py - p; ! if (y1 < 0) y1 = 0; /* Maximal south */ ! y2 = py + p; ! if (y2 > cur_hgt-1) y2 = cur_hgt-1; /* Maximal west */ ! x1 = px - p; ! if (x1 < 0) x1 = 0; /* Maximal east */ ! x2 = px + p; ! if (x2 > cur_wid-1) x2 = cur_wid-1; /* Scan the maximal box */ ! for (y = y1; y <= y2; y++) { ! for (x = x1; x <= x2; x++) { int dy = (py > y) ? (py - y) : (y - py); int dx = (px > x) ? (px - x) : (x - px); *************** *** 1937,1951 **** /*** Complete the algorithm ***/ ! /* Draw the new grids */ for (i = 0; i < lite_n; i++) { y = lite_y[i]; x = lite_x[i]; ! /* Update fresh grids */ ! if (cave[y][x].info & (CAVE_TEMP)) continue; /* Note */ note_spot(y, x); --- 1953,1970 ---- /*** Complete the algorithm ***/ ! /* Process "new" grids */ for (i = 0; i < lite_n; i++) { y = lite_y[i]; x = lite_x[i]; ! /* Acquire cave grid */ ! c_ptr = &cave[y][x]; + /* Update/Redraw "new" grids */ + if (!(c_ptr->info & (CAVE_TEMP))) + { /* Note */ note_spot(y, x); *************** *** 1952,1973 **** /* Redraw */ lite_spot(y, x); } ! /* Clear them all */ for (i = 0; i < temp_n; i++) { y = temp_y[i]; x = temp_x[i]; /* No longer in the array */ ! cave[y][x].info &= ~(CAVE_TEMP); ! /* Update stale grids */ ! if (cave[y][x].info & (CAVE_LITE)) continue; ! /* Redraw */ lite_spot(y, x); } /* None left */ temp_n = 0; --- 1971,1997 ---- /* Redraw */ lite_spot(y, x); } + } ! /* Process "old" grids */ for (i = 0; i < temp_n; i++) { y = temp_y[i]; x = temp_x[i]; + /* Acquire cave grid */ + c_ptr = &cave[y][x]; + /* No longer in the array */ ! c_ptr->info &= ~(CAVE_TEMP); ! /* Redraw "old" grids */ ! if (!(c_ptr->info & (CAVE_LITE))) ! { /* Redraw */ lite_spot(y, x); } + } /* None left */ temp_n = 0; *************** *** 2020,2032 **** * called when the "view" array is full. */ #define cave_view_hack(C,Y,X) \ (C)->info |= (CAVE_VIEW); \ view_y[view_n] = (Y); \ view_x[view_n] = (X); \ ! view_n++ - /* * Helper function for "update_view()" below * --- 2044,2057 ---- * called when the "view" array is full. */ #define cave_view_hack(C,Y,X) \ + do { \ (C)->info |= (CAVE_VIEW); \ view_y[view_n] = (Y); \ view_x[view_n] = (X); \ ! view_n++; \ ! } while (0) /* * Helper function for "update_view()" below * *************** *** 2127,2133 **** /* Hack -- check line of sight */ ! if (los(py, px, y, x)) { cave_view_hack(c_ptr, y, x); --- 2152,2158 ---- /* Hack -- check line of sight */ ! if (los(p_ptr->py, p_ptr->px, y, x)) { cave_view_hack(c_ptr, y, x); *************** *** 2249,2255 **** /*** Initialize ***/ /* Optimize */ ! if (view_reduce_view && !dun_level) { /* Full radius (10) */ full = MAX_SIGHT / 2; --- 2274,2280 ---- /*** Initialize ***/ /* Optimize */ ! if (view_reduce_view && !p_ptr->depth) { /* Full radius (10) */ full = MAX_SIGHT / 2; *************** *** 2299,2306 **** /*** Step 1 -- adjacent grids ***/ /* Now start on the player */ ! y = py; ! x = px; /* Access the grid */ c_ptr = &cave[y][x]; --- 2324,2331 ---- /*** Step 1 -- adjacent grids ***/ /* Now start on the player */ ! y = p_ptr->py; ! x = p_ptr->px; /* Access the grid */ c_ptr = &cave[y][x]; *************** *** 2645,2651 **** /*** Step 5 -- Complete the algorithm ***/ ! /* Update all the new grids */ for (n = 0; n < view_n; n++) { y = view_y[n]; --- 2670,2676 ---- /*** Step 5 -- Complete the algorithm ***/ ! /* Process "new" grids */ for (n = 0; n < view_n; n++) { y = view_y[n]; *************** *** 2657,2665 **** /* Clear the "CAVE_XTRA" flag */ c_ptr->info &= ~(CAVE_XTRA); ! /* Update only newly viewed grids */ ! if (c_ptr->info & (CAVE_TEMP)) continue; /* Note */ note_spot(y, x); --- 2682,2701 ---- /* Clear the "CAVE_XTRA" flag */ c_ptr->info &= ~(CAVE_XTRA); ! /* Update/Redraw "new" grids */ ! if (!(c_ptr->info & (CAVE_TEMP))) ! { ! /* Note */ ! note_spot(y, x); + /* Redraw */ + lite_spot(y, x); + } + + /* Update/Redraw all perma-lit wall grids */ + else if ((c_ptr->info & (CAVE_GLOW)) && + !cave_floor_grid(c_ptr)) + { /* Note */ note_spot(y, x); *************** *** 2666,2673 **** /* Redraw */ lite_spot(y, x); } ! /* Wipe the old grids, update as needed */ for (n = 0; n < temp_n; n++) { y = temp_y[n]; --- 2702,2710 ---- /* Redraw */ lite_spot(y, x); } + } ! /* Process "old" grids */ for (n = 0; n < temp_n; n++) { y = temp_y[n]; *************** *** 2679,2690 **** /* No longer in the array */ c_ptr->info &= ~(CAVE_TEMP); ! /* Update only non-viewable grids */ ! if (c_ptr->info & (CAVE_VIEW)) continue; ! /* Redraw */ lite_spot(y, x); } /* None left */ temp_n = 0; --- 2716,2728 ---- /* No longer in the array */ c_ptr->info &= ~(CAVE_TEMP); ! /* Redraw "old" grids */ ! if (!(c_ptr->info & (CAVE_VIEW))) ! { /* Redraw */ lite_spot(y, x); } + } /* None left */ temp_n = 0; *************** *** 2846,2852 **** flow_head = flow_tail = 0; /* Add the player's grid to the queue */ ! update_flow_aux(py, px, 0); /* Now process the queue */ while (flow_head != flow_tail) --- 2884,2890 ---- flow_head = flow_tail = 0; /* Add the player's grid to the queue */ ! update_flow_aux(p_ptr->py, p_ptr->px, 0); /* Now process the queue */ while (flow_head != flow_tail) *************** *** 3264,3271 **** ny = rand_spread(y, d); nx = rand_spread(x, d); ! /* Ignore illegal locations and outer walls */ ! if (!in_bounds(y, x)) continue; /* Ignore "excessively distant" locations */ if ((d > 1) && (distance(y, x, ny, nx) > d)) continue; --- 3302,3309 ---- ny = rand_spread(y, d); nx = rand_spread(x, d); ! /* Ignore annoying locations */ ! if (!in_bounds_fully(y, x)) continue; /* Ignore "excessively distant" locations */ if ((d > 1) && (distance(y, x, ny, nx) > d)) continue; *************** *** 3352,3361 **** } /* Cancel Resting */ ! if (resting) { /* Cancel */ ! resting = 0; /* Redraw the state (later) */ p_ptr->redraw |= (PR_STATE); --- 3390,3399 ---- } /* Cancel Resting */ ! if (p_ptr->resting) { /* Cancel */ ! p_ptr->resting = 0; /* Redraw the state (later) */ p_ptr->redraw |= (PR_STATE); *************** *** 3362,3371 **** } /* Cancel running */ ! if (running) { /* Cancel */ ! running = 0; /* Calculate torch radius */ p_ptr->update |= (PU_TORCH); --- 3400,3409 ---- } /* Cancel running */ ! if (p_ptr->running) { /* Cancel */ ! p_ptr->running = 0; /* Calculate torch radius */ p_ptr->update |= (PU_TORCH); Only in angband-281/src: cave.o diff -r -c -w src-281/cmd1.c angband-281/src/cmd1.c *** src-281/cmd1.c Thu Mar 6 21:46:26 1997 --- angband-281/src/cmd1.c Thu Apr 24 10:20:34 1997 *************** *** 406,414 **** if (p_ptr->confused || p_ptr->image) chance = chance / 10; /* Search the nearby grids, which are always in bounds */ ! for (y = (py - 1); y <= (py + 1); y++) { ! for (x = (px - 1); x <= (px + 1); x++) { /* Sometimes, notice things */ if (rand_int(100) < chance) --- 406,414 ---- if (p_ptr->confused || p_ptr->image) chance = chance / 10; /* Search the nearby grids, which are always in bounds */ ! for (y = (p_ptr->py - 1); y <= (p_ptr->py + 1); y++) { ! for (x = (p_ptr->px - 1); x <= (p_ptr->px + 1); x++) { /* Sometimes, notice things */ if (rand_int(100) < chance) *************** *** 481,493 **** /* ! * Player "wants" to pick up an object or gold. ! * Note that we ONLY handle things that can be picked up. ! * See "move_player()" for handling of other things. */ ! void carry(int pickup) { ! cave_type *c_ptr = &cave[py][px]; s16b this_o_idx, next_o_idx = 0; --- 481,493 ---- /* ! * Make the player carry everything in a grid ! * ! * If "pickup" is FALSE then only gold will be picked up */ ! void py_pickup(int pickup) { ! cave_type *c_ptr = &cave[p_ptr->py][p_ptr->px]; s16b this_o_idx, next_o_idx = 0; *************** *** 565,571 **** int slot; /* Carry the item */ ! slot = inven_carry(o_ptr, FALSE); /* Get the item again */ o_ptr = &inventory[slot]; --- 565,571 ---- int slot; /* Carry the item */ ! slot = inven_carry(o_ptr); /* Get the item again */ o_ptr = &inventory[slot]; *************** *** 621,627 **** /* * Handle player hitting a real trap */ ! static void hit_trap(void) { int i, num, dam; --- 621,627 ---- /* * Handle player hitting a real trap */ ! void hit_trap(int y, int x) { int i, num, dam; *************** *** 634,640 **** disturb(0, 0); /* Get the cave grid */ ! c_ptr = &cave[py][px]; /* Analyze XXX XXX XXX */ switch (c_ptr->feat) --- 634,640 ---- disturb(0, 0); /* Get the cave grid */ ! c_ptr = &cave[y][x]; /* Analyze XXX XXX XXX */ switch (c_ptr->feat) *************** *** 641,647 **** { case FEAT_TRAP_HEAD + 0x00: { ! msg_print("You fell through a trap door!"); if (p_ptr->ffall) { msg_print("You float gently down to the next level."); --- 641,647 ---- { case FEAT_TRAP_HEAD + 0x00: { ! msg_print("You fall through a trap door!"); if (p_ptr->ffall) { msg_print("You float gently down to the next level."); *************** *** 652,664 **** take_hit(dam, name); } new_level_flag = TRUE; ! dun_level++; break; } case FEAT_TRAP_HEAD + 0x01: { ! msg_print("You fell into a pit!"); if (p_ptr->ffall) { msg_print("You float gently to the bottom of the pit."); --- 652,664 ---- take_hit(dam, name); } new_level_flag = TRUE; ! p_ptr->depth++; break; } case FEAT_TRAP_HEAD + 0x01: { ! msg_print("You fall into a pit!"); if (p_ptr->ffall) { msg_print("You float gently to the bottom of the pit."); *************** *** 747,757 **** { msg_print("You are enveloped in a cloud of smoke!"); c_ptr->info &= ~(CAVE_MARK); ! cave_set_feat(py, px, FEAT_FLOOR); num = 2 + randint(3); for (i = 0; i < num; i++) { ! (void)summon_specific(py, px, dun_level, 0); } break; } --- 747,757 ---- { msg_print("You are enveloped in a cloud of smoke!"); c_ptr->info &= ~(CAVE_MARK); ! cave_set_feat(y, x, FEAT_FLOOR); num = 2 + randint(3); for (i = 0; i < num; i++) { ! (void)summon_specific(p_ptr->py, p_ptr->px, p_ptr->depth, 0); } break; } *************** *** 845,851 **** case FEAT_TRAP_HEAD + 0x0C: { ! msg_print("A black gas surrounds you!"); if (!p_ptr->resist_blind) { (void)set_blind(p_ptr->blind + rand_int(50) + 25); --- 845,851 ---- case FEAT_TRAP_HEAD + 0x0C: { ! msg_print("You are surrounded by a black gas!"); if (!p_ptr->resist_blind) { (void)set_blind(p_ptr->blind + rand_int(50) + 25); *************** *** 855,862 **** case FEAT_TRAP_HEAD + 0x0D: { ! msg_print("A gas of scintillating colors surrounds you!"); ! if (!p_ptr->resist_conf) { (void)set_confused(p_ptr->confused + rand_int(20) + 10); } --- 855,862 ---- case FEAT_TRAP_HEAD + 0x0D: { ! msg_print("You are surrounded by a gas of scintillating colors!"); ! if (!p_ptr->resist_confu) { (void)set_confused(p_ptr->confused + rand_int(20) + 10); } *************** *** 865,871 **** case FEAT_TRAP_HEAD + 0x0E: { ! msg_print("A pungent green gas surrounds you!"); if (!p_ptr->resist_pois && !p_ptr->oppose_pois) { (void)set_poisoned(p_ptr->poisoned + rand_int(20) + 10); --- 865,871 ---- case FEAT_TRAP_HEAD + 0x0E: { ! msg_print("You are surrounded by a pungent green gas!"); if (!p_ptr->resist_pois && !p_ptr->oppose_pois) { (void)set_poisoned(p_ptr->poisoned + rand_int(20) + 10); *************** *** 875,881 **** case FEAT_TRAP_HEAD + 0x0F: { ! msg_print("A strange white mist surrounds you!"); if (!p_ptr->free_act) { (void)set_paralyzed(p_ptr->paralyzed + rand_int(10) + 5); --- 875,881 ---- case FEAT_TRAP_HEAD + 0x0F: { ! msg_print("You are surrounded by a strange white mist!"); if (!p_ptr->free_act) { (void)set_paralyzed(p_ptr->paralyzed + rand_int(10) + 5); *************** *** 888,894 **** /* ! * Player attacks a (poor, defenseless) creature -RAK- * * If no "weapon" is available, then "punch" the monster one time. */ --- 888,894 ---- /* ! * Attack the monster at the given location * * If no "weapon" is available, then "punch" the monster one time. */ *************** *** 1043,1049 **** /* Mega-Hack -- apply earthquake brand */ ! if (do_quake) earthquake(py, px, 10); } --- 1043,1049 ---- /* Mega-Hack -- apply earthquake brand */ ! if (do_quake) earthquake(p_ptr->py, p_ptr->px, 10); } *************** *** 1053,1063 **** /* * Move player in the given direction, with the given "pickup" flag. * ! * This routine should (probably) always induce energy expenditure. * ! * Note that moving will *always* take a turn, and will *always* hit ! * any monster which might be in the destination grid. Previously, ! * moving into walls was "free" and did NOT hit invisible monsters. */ void move_player(int dir, int do_pickup) { --- 1053,1062 ---- /* * Move player in the given direction, with the given "pickup" flag. * ! * This routine should only be called when energy has been expended. * ! * 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) { *************** *** 1068,1075 **** /* Find the result of moving */ ! y = py + ddy[dir]; ! x = px + ddx[dir]; /* Examine the destination */ c_ptr = &cave[y][x]; --- 1067,1074 ---- /* Find the result of moving */ ! y = p_ptr->py + ddy[dir]; ! x = p_ptr->px + ddx[dir]; /* Examine the destination */ c_ptr = &cave[y][x]; *************** *** 1091,1099 **** /* Disturb the player */ disturb(0, 0); ! /* Notice things in the dark */ ! if (!(c_ptr->info & (CAVE_MARK)) && ! (p_ptr->blind || !(c_ptr->info & (CAVE_LITE)))) { /* Rubble */ if (c_ptr->feat == FEAT_RUBBLE) --- 1090,1097 ---- /* Disturb the player */ disturb(0, 0); ! /* Notice unknown obstacles */ ! if (!(c_ptr->info & (CAVE_MARK))) { /* Rubble */ if (c_ptr->feat == FEAT_RUBBLE) *************** *** 1120,1126 **** } } ! /* Notice things */ else { /* Rubble */ --- 1118,1124 ---- } } ! /* Mention known obstacles */ else { /* Rubble */ *************** *** 1152,1166 **** int oy, ox; /* Save old location */ ! oy = py; ! ox = px; /* Move the player */ ! py = y; ! px = x; /* Redraw new spot */ ! lite_spot(py, px); /* Redraw old spot */ lite_spot(oy, ox); --- 1150,1164 ---- int oy, ox; /* Save old location */ ! oy = p_ptr->py; ! ox = p_ptr->px; /* Move the player */ ! p_ptr->py = y; ! p_ptr->px = x; /* Redraw new spot */ ! lite_spot(p_ptr->py, p_ptr->px); /* Redraw old spot */ lite_spot(oy, ox); *************** *** 1195,1201 **** } /* Handle "objects" */ ! carry(do_pickup); /* Handle "store doors" */ if ((c_ptr->feat >= FEAT_SHOP_HEAD) && --- 1193,1199 ---- } /* Handle "objects" */ ! py_pickup(do_pickup); /* Handle "store doors" */ if ((c_ptr->feat >= FEAT_SHOP_HEAD) && *************** *** 1218,1227 **** msg_print("You found a trap!"); /* Pick a trap */ ! pick_trap(py, px); /* Hit the trap */ ! hit_trap(); } /* Set off an visible trap */ --- 1216,1225 ---- msg_print("You found a trap!"); /* Pick a trap */ ! pick_trap(p_ptr->py, p_ptr->px); /* Hit the trap */ ! hit_trap(p_ptr->py, p_ptr->px); } /* Set off an visible trap */ *************** *** 1232,1238 **** disturb(0, 0); /* Hit the trap */ ! hit_trap(); } } } --- 1230,1236 ---- disturb(0, 0); /* Hit the trap */ ! hit_trap(p_ptr->py, p_ptr->px); } } } *************** *** 1247,1254 **** y += ddy[dir]; x += ddx[dir]; ! /* Illegal grids are blank */ ! if (!in_bounds2(y, x)) return (FALSE); /* Must be a motion blocker */ if (cave_floor_bold(y, x)) return (FALSE); --- 1245,1252 ---- y += ddy[dir]; x += ddx[dir]; ! /* Illegal grids are blank XXX XXX XXX */ ! if (!in_bounds_fully(y, x)) return (FALSE); /* Must be a motion blocker */ if (cave_floor_bold(y, x)) return (FALSE); *************** *** 1270,1277 **** y += ddy[dir]; x += ddx[dir]; ! /* Illegal grids are unknown */ ! if (!in_bounds2(y, x)) return (TRUE); /* Memorized grids are always known */ if (cave[y][x].info & (CAVE_MARK)) return (FALSE); --- 1268,1275 ---- y += ddy[dir]; x += ddx[dir]; ! /* Illegal grids are unknown XXX XXX XXX */ ! if (!in_bounds_fully(y, x)) return (TRUE); /* Memorized grids are always known */ if (cave[y][x].info & (CAVE_MARK)) return (FALSE); *************** *** 1493,1506 **** shortright = shortleft = FALSE; /* Find the destination grid */ ! row = py + ddy[dir]; ! col = px + ddx[dir]; /* Extract cycle index */ i = chome[dir]; /* Check for walls */ ! if (see_wall(cycle[i+1], py, px)) { find_breakleft = TRUE; shortleft = TRUE; --- 1491,1504 ---- shortright = shortleft = FALSE; /* Find the destination grid */ ! row = p_ptr->py + ddy[dir]; ! col = p_ptr->px + ddx[dir]; /* Extract cycle index */ i = chome[dir]; /* Check for walls */ ! if (see_wall(cycle[i+1], p_ptr->py, p_ptr->px)) { find_breakleft = TRUE; shortleft = TRUE; *************** *** 1512,1518 **** } /* Check for walls */ ! if (see_wall(cycle[i-1], py, px)) { find_breakright = TRUE; shortright = TRUE; --- 1510,1516 ---- } /* Check for walls */ ! if (see_wall(cycle[i-1], p_ptr->py, p_ptr->px)) { find_breakright = TRUE; shortright = TRUE; *************** *** 1596,1603 **** new_dir = cycle[chome[prev_dir] + i]; /* New location */ ! row = py + ddy[new_dir]; ! col = px + ddx[new_dir]; /* Access grid */ c_ptr = &cave[row][col]; --- 1594,1601 ---- new_dir = cycle[chome[prev_dir] + i]; /* New location */ ! row = p_ptr->py + ddy[new_dir]; ! col = p_ptr->px + ddx[new_dir]; /* Access grid */ c_ptr = &cave[row][col]; *************** *** 1678,1684 **** case FEAT_BROKEN: { /* Option -- ignore */ ! if (find_ignore_doors) notice = FALSE; /* Done */ break; --- 1676,1682 ---- case FEAT_BROKEN: { /* Option -- ignore */ ! if (run_ignore_doors) notice = FALSE; /* Done */ break; *************** *** 1689,1695 **** case FEAT_MORE: { /* Option -- ignore */ ! if (find_ignore_stairs) notice = FALSE; /* Done */ break; --- 1687,1693 ---- case FEAT_MORE: { /* Option -- ignore */ ! if (run_ignore_stairs) notice = FALSE; /* Done */ break; *************** *** 1775,1782 **** { new_dir = cycle[chome[prev_dir] + i]; ! row = py + ddy[new_dir]; ! col = px + ddx[new_dir]; /* Access grid */ c_ptr = &cave[row][col]; --- 1773,1780 ---- { new_dir = cycle[chome[prev_dir] + i]; ! row = p_ptr->py + ddy[new_dir]; ! col = p_ptr->px + ddx[new_dir]; /* Access grid */ c_ptr = &cave[row][col]; *************** *** 1807,1814 **** { new_dir = cycle[chome[prev_dir] + i]; ! row = py + ddy[new_dir]; ! col = px + ddx[new_dir]; /* Access grid */ c_ptr = &cave[row][col]; --- 1805,1812 ---- { new_dir = cycle[chome[prev_dir] + i]; ! row = p_ptr->py + ddy[new_dir]; ! col = p_ptr->px + ddx[new_dir]; /* Access grid */ c_ptr = &cave[row][col]; *************** *** 1856,1862 **** } /* Two options, examining corners */ ! else if (find_examine && !find_cut) { /* Primary option */ find_current = option; --- 1854,1860 ---- } /* Two options, examining corners */ ! else if (run_use_corners && !run_cut_corners) { /* Primary option */ find_current = option; *************** *** 1869,1876 **** else { /* Get next location */ ! row = py + ddy[option]; ! col = px + ddx[option]; /* Don't see that it is closed off. */ /* This could be a potential corner or an intersection. */ --- 1867,1874 ---- else { /* Get next location */ ! row = p_ptr->py + ddy[option]; ! col = p_ptr->px + ddx[option]; /* Don't see that it is closed off. */ /* This could be a potential corner or an intersection. */ *************** *** 1879,1885 **** { /* Can not see anything ahead and in the direction we */ /* are turning, assume that it is a potential corner. */ ! if (find_examine && see_nothing(option, row, col) && see_nothing(option2, row, col)) { --- 1877,1883 ---- { /* Can not see anything ahead and in the direction we */ /* are turning, assume that it is a potential corner. */ ! if (run_use_corners && see_nothing(option, row, col) && see_nothing(option2, row, col)) { *************** *** 1895,1901 **** } /* This corner is seen to be enclosed; we cut the corner. */ ! else if (find_cut) { find_current = option2; find_prevdir = option2; --- 1893,1899 ---- } /* This corner is seen to be enclosed; we cut the corner. */ ! else if (run_cut_corners) { find_current = option2; find_prevdir = option2; *************** *** 1913,1919 **** /* About to hit a known wall, stop */ ! if (see_wall(find_current, py, px)) { return (TRUE); } --- 1911,1917 ---- /* About to hit a known wall, stop */ ! if (see_wall(find_current, p_ptr->py, p_ptr->px)) { return (TRUE); } *************** *** 1934,1940 **** if (dir) { /* Hack -- do not start silly run */ ! if (see_wall(dir, py, px)) { /* Message */ msg_print("You cannot run in that direction."); --- 1932,1938 ---- if (dir) { /* Hack -- do not start silly run */ ! if (see_wall(dir, p_ptr->py, p_ptr->px)) { /* Message */ msg_print("You cannot run in that direction."); *************** *** 1968,1974 **** } /* Decrease the run counter */ ! if (--running <= 0) return; /* Take time */ energy_use = 100; --- 1966,1972 ---- } /* Decrease the run counter */ ! if (--p_ptr->running <= 0) return; /* Take time */ energy_use = 100; Only in angband-281/src: cmd1.o diff -r -c -w src-281/cmd2.c angband-281/src/cmd2.c *** src-281/cmd2.c Mon Mar 3 22:18:12 1997 --- angband-281/src/cmd2.c Thu Apr 24 10:21:02 1997 *************** *** 14,20 **** /* ! * Go up one level -RAK- */ void do_cmd_go_up(void) { --- 14,20 ---- /* ! * Go up one level */ void do_cmd_go_up(void) { *************** *** 21,27 **** cave_type *c_ptr; /* Player grid */ ! c_ptr = &cave[py][px]; /* Verify stairs */ if (c_ptr->feat != FEAT_LESS) --- 21,27 ---- cave_type *c_ptr; /* Player grid */ ! c_ptr = &cave[p_ptr->py][p_ptr->px]; /* Verify stairs */ if (c_ptr->feat != FEAT_LESS) *************** *** 37,43 **** msg_print("You enter a maze of up staircases."); /* Go up the stairs */ ! dun_level--; new_level_flag = TRUE; /* Create a way back */ --- 37,43 ---- msg_print("You enter a maze of up staircases."); /* Go up the stairs */ ! p_ptr->depth--; new_level_flag = TRUE; /* Create a way back */ *************** *** 53,59 **** cave_type *c_ptr; /* Player grid */ ! c_ptr = &cave[py][px]; /* Verify stairs */ if (c_ptr->feat != FEAT_MORE) --- 53,59 ---- cave_type *c_ptr; /* Player grid */ ! c_ptr = &cave[p_ptr->py][p_ptr->px]; /* Verify stairs */ if (c_ptr->feat != FEAT_MORE) *************** *** 69,75 **** msg_print("You enter a maze of down staircases."); /* Go down */ ! dun_level++; new_level_flag = TRUE; /* Create a way back */ --- 69,75 ---- msg_print("You enter a maze of down staircases."); /* Go down */ ! p_ptr->depth++; new_level_flag = TRUE; /* Create a way back */ *************** *** 172,178 **** /* ! * Allocates objects upon opening a chest -BEN- * * Disperse treasures from the given chest, centered at (x,y). * --- 172,178 ---- /* ! * Allocate objects upon opening a chest * * Disperse treasures from the given chest, centered at (x,y). * *************** *** 188,199 **** bool small; ! object_type forge; ! object_type *q_ptr; ! object_type *o_ptr = &o_list[o_idx]; /* Small chests often hold "gold" */ small = (o_ptr->sval < SV_CHEST_MIN_LARGE); --- 188,202 ---- bool small; ! object_type *o_ptr; ! object_type *i_ptr; ! object_type object_type_body; + /* Access chest */ + o_ptr = &o_list[o_idx]; + /* Small chests often hold "gold" */ small = (o_ptr->sval < SV_CHEST_MIN_LARGE); *************** *** 213,228 **** for (; number > 0; --number) { /* Get local object */ ! q_ptr = &forge; /* Wipe the object */ ! object_wipe(q_ptr); /* Small chests often drop gold */ if (small && (rand_int(100) < 75)) { /* Make some gold */ ! if (!make_gold(q_ptr)) continue; } /* Otherwise drop an item */ --- 216,231 ---- for (; number > 0; --number) { /* Get local object */ ! i_ptr = &object_type_body; /* Wipe the object */ ! object_wipe(i_ptr); /* Small chests often drop gold */ if (small && (rand_int(100) < 75)) { /* Make some gold */ ! if (!make_gold(i_ptr)) continue; } /* Otherwise drop an item */ *************** *** 229,243 **** else { /* Make an object */ ! if (!make_object(q_ptr, FALSE, FALSE)) continue; } /* Drop it in the dungeon */ ! drop_near(q_ptr, -1, y, x); } /* Reset the object level */ ! object_level = dun_level; /* No longer opening a chest */ opening_chest = FALSE; --- 232,246 ---- else { /* Make an object */ ! if (!make_object(i_ptr, FALSE, FALSE)) continue; } /* Drop it in the dungeon */ ! drop_near(i_ptr, -1, y, x); } /* Reset the object level */ ! object_level = p_ptr->depth; /* No longer opening a chest */ opening_chest = FALSE; *************** *** 312,318 **** msg_print("You are enveloped in a cloud of smoke!"); for (i = 0; i < num; i++) { ! (void)summon_specific(y, x, dun_level, 0); } } --- 315,321 ---- msg_print("You are enveloped in a cloud of smoke!"); for (i = 0; i < num; i++) { ! (void)summon_specific(y, x, p_ptr->depth, 0); } } *************** *** 345,353 **** object_type *o_ptr = &o_list[o_idx]; - /* Take a turn */ - energy_use = 100; - /* Attempt to unlock it */ if (o_ptr->pval > 0) { --- 348,353 ---- *************** *** 400,417 **** } /* * Perform the basic "open" command on doors * - * Assume destination is a closed/locked/jammed door - * * Assume there is no monster blocking the destination * * Returns TRUE if repeated commands may continue */ ! static bool do_cmd_open_aux(int y, int x, int dir) { int i, j; --- 400,525 ---- } + /* + * Attempt to disarm the chest at the given location + * + * Assume there is no monster blocking the destination + * + * Returns TRUE if repeated commands may continue + */ + static bool do_cmd_disarm_chest(int y, int x, s16b o_idx) + { + int i, j; + bool more = FALSE; + object_type *o_ptr = &o_list[o_idx]; + + + /* Get the "disarm" factor */ + i = p_ptr->skill_dis; + + /* Penalize some conditions */ + if (p_ptr->blind || no_lite()) i = i / 10; + if (p_ptr->confused || p_ptr->image) i = i / 10; + + /* Extract the difficulty */ + j = i - o_ptr->pval; + + /* Always have a small chance of success */ + if (j < 2) j = 2; + + /* Must find the trap first. */ + if (!object_known_p(o_ptr)) + { + msg_print("I don't see any traps."); + } + + /* Already disarmed/unlocked */ + else if (o_ptr->pval <= 0) + { + msg_print("The chest is not trapped."); + } + + /* No traps to find. */ + else if (!chest_traps[o_ptr->pval]) + { + msg_print("The chest is not trapped."); + } + + /* Success (get a lot of experience) */ + else if (rand_int(100) < j) + { + msg_print("You have disarmed the chest."); + gain_exp(o_ptr->pval); + o_ptr->pval = (0 - o_ptr->pval); + } + + /* Failure -- Keep trying */ + else if ((i > 5) && (randint(i) > 5)) + { + /* We may keep trying */ + more = TRUE; + if (flush_failure) flush(); + msg_print("You failed to disarm the chest."); + } + + /* Failure -- Set off the trap */ + else + { + msg_print("You set off a trap!"); + chest_trap(y, x, o_idx); + } + + /* Result */ + return (more); + } + + /* + * Determine if a given grid may be "opened" + */ + static bool do_cmd_open_test(int y, int x) + { + cave_type *c_ptr; + + /* Acquire grid */ + c_ptr = &cave[y][x]; + + /* Must have knowledge */ + if (!(c_ptr->info & (CAVE_MARK))) + { + /* Message */ + msg_print("You see nothing there."); + + /* Nope */ + return (FALSE); + } + + /* Must be a closed door */ + if (!((c_ptr->feat >= FEAT_DOOR_HEAD) && + (c_ptr->feat <= FEAT_DOOR_TAIL))) + { + /* Message */ + msg_print("You see nothing there to open."); + + /* Nope */ + return (FALSE); + } + + /* Okay */ + return (TRUE); + } + + + /* * Perform the basic "open" command on doors * * Assume there is no monster blocking the destination * * Returns TRUE if repeated commands may continue */ ! static bool do_cmd_open_aux(int y, int x) { int i, j; *************** *** 420,432 **** bool more = FALSE; ! /* XXX XXX XXX */ ! dir = (0, dir); - /* Take a turn */ - energy_use = 100; - /* Get requested grid */ c_ptr = &cave[y][x]; --- 528,537 ---- bool more = FALSE; ! /* Verify legality */ ! if (!do_cmd_open_test(y, x)) return (FALSE); /* Get requested grid */ c_ptr = &cave[y][x]; *************** *** 524,529 **** --- 629,670 ---- bool more = FALSE; + /* Get a direction (or abort) */ + if (!get_rep_dir(&dir)) return; + + /* Get location */ + y = p_ptr->py + ddy[dir]; + x = p_ptr->px + ddx[dir]; + + /* Get grid */ + c_ptr = &cave[y][x]; + + /* Check for chests */ + o_idx = chest_check(y, x); + + + /* Verify legality */ + if (!o_idx && !do_cmd_open_test(y, x)) return; + + + /* Take a turn */ + energy_use = 100; + + /* Apply confusion */ + if (confuse_dir(&dir)) + { + /* Get location */ + y = p_ptr->py + ddy[dir]; + x = p_ptr->px + ddx[dir]; + + /* Get grid */ + c_ptr = &cave[y][x]; + + /* Check for chest */ + o_idx = chest_check(y, x); + } + + /* Allow repeated command */ if (command_arg) { *************** *** 537,571 **** command_arg = 0; } ! /* Get a "repeated" direction */ ! if (get_rep_dir(&dir)) { - /* Get requested location */ - y = py + ddy[dir]; - x = px + ddx[dir]; - - /* Get requested grid */ - c_ptr = &cave[y][x]; - - /* Check for chest */ - o_idx = chest_check(y, x); - - /* Nothing useful */ - if (!((c_ptr->feat >= FEAT_DOOR_HEAD) && - (c_ptr->feat <= FEAT_DOOR_TAIL)) && - !o_idx) - { /* Message */ - msg_print("You see nothing there to open."); - } - - /* Monster in the way */ - else if (c_ptr->m_idx) - { - /* Take a turn */ - energy_use = 100; - - /* Message */ msg_print("There is a monster in the way!"); /* Attack */ --- 678,687 ---- command_arg = 0; } ! /* Monster */ ! if (c_ptr->m_idx) { /* Message */ msg_print("There is a monster in the way!"); /* Attack */ *************** *** 572,578 **** py_attack(y, x); } ! /* Handle chests */ else if (o_idx) { /* Open the chest */ --- 688,694 ---- py_attack(y, x); } ! /* Chest */ else if (o_idx) { /* Open the chest */ *************** *** 579,591 **** more = do_cmd_open_chest(y, x, o_idx); } ! /* Handle doors */ else { /* Open the door */ ! more = do_cmd_open_aux(y, x, dir); } - } /* Cancel repeat unless we may continue */ if (!more) disturb(0, 0); --- 695,706 ---- more = do_cmd_open_chest(y, x, o_idx); } ! /* Door */ else { /* Open the door */ ! more = do_cmd_open_aux(y, x); } /* Cancel repeat unless we may continue */ if (!more) disturb(0, 0); *************** *** 592,608 **** } /* * Perform the basic "close" command * - * Assume destination is an open/broken door - * * Assume there is no monster blocking the destination * * Returns TRUE if repeated commands may continue */ ! static bool do_cmd_close_aux(int y, int x, int dir) { cave_type *c_ptr; --- 707,756 ---- } + /* + * Determine if a given grid may be "closed" + */ + static bool do_cmd_close_test(int y, int x) + { + cave_type *c_ptr; + /* Acquire grid */ + c_ptr = &cave[y][x]; + + /* Must have knowledge */ + if (!(c_ptr->info & (CAVE_MARK))) + { + /* Message */ + msg_print("You see nothing there."); + + /* Nope */ + return (FALSE); + } + + /* Require open/broken door */ + if ((c_ptr->feat != FEAT_OPEN) && + (c_ptr->feat != FEAT_BROKEN)) + { + /* Message */ + msg_print("You see nothing there to close."); + + /* Nope */ + return (FALSE); + } + + /* Okay */ + return (TRUE); + } + + /* * Perform the basic "close" command * * Assume there is no monster blocking the destination * * Returns TRUE if repeated commands may continue */ ! static bool do_cmd_close_aux(int y, int x) { cave_type *c_ptr; *************** *** 609,621 **** bool more = FALSE; ! /* XXX XXX XXX */ ! dir = (0, dir); - /* Take a turn */ - energy_use = 100; - /* Get grid and contents */ c_ptr = &cave[y][x]; --- 757,766 ---- bool more = FALSE; ! /* Verify legality */ ! if (!do_cmd_close_test(y, x)) return (FALSE); /* Get grid and contents */ c_ptr = &cave[y][x]; *************** *** 656,661 **** --- 801,836 ---- bool more = FALSE; + /* Get a direction (or abort) */ + if (!get_rep_dir(&dir)) return; + + /* Get location */ + y = p_ptr->py + ddy[dir]; + x = p_ptr->px + ddx[dir]; + + /* Get grid */ + c_ptr = &cave[y][x]; + + + /* Verify legality */ + if (!do_cmd_close_test(y, x)) return; + + + /* Take a turn */ + energy_use = 100; + + /* Apply confusion */ + if (confuse_dir(&dir)) + { + /* Get location */ + y = p_ptr->py + ddy[dir]; + x = p_ptr->px + ddx[dir]; + + /* Get grid */ + c_ptr = &cave[y][x]; + } + + /* Allow repeated command */ if (command_arg) { *************** *** 669,718 **** command_arg = 0; } ! /* Get a "repeated" direction */ ! if (get_rep_dir(&dir)) { ! /* Get requested location */ ! y = py + ddy[dir]; ! x = px + ddx[dir]; ! /* Get grid and contents */ ! c_ptr = &cave[y][x]; ! /* Require open/broken door */ ! if ((c_ptr->feat != FEAT_OPEN) && (c_ptr->feat != FEAT_BROKEN)) { ! /* Message */ ! msg_print("You see nothing there to close."); } ! /* Monster in the way */ ! else if (c_ptr->m_idx) { ! /* Take a turn */ ! energy_use = 100; /* Message */ ! msg_print("There is a monster in the way!"); ! /* Attack */ ! py_attack(y, x); } ! /* Close the door */ ! else { ! /* Close the door */ ! more = do_cmd_close_aux(y, x, dir); } - } ! /* Cancel repeat unless we may continue */ ! if (!more) disturb(0, 0); } - /* * Tunnel through wall. Assumes valid location. * --- 844,907 ---- command_arg = 0; } ! /* Monster */ ! if (c_ptr->m_idx) { ! /* Message */ ! msg_print("There is a monster in the way!"); ! /* Attack */ ! py_attack(y, x); ! } ! /* Door */ ! else { ! /* Close door */ ! more = do_cmd_close_aux(y, x); } ! /* Cancel repeat unless told not to */ ! if (!more) disturb(0, 0); ! } ! ! ! ! /* ! * Determine if a given grid may be "tunneled" ! */ ! static bool do_cmd_tunnel_test(int y, int x) { ! cave_type *c_ptr; + /* Acquire grid */ + c_ptr = &cave[y][x]; + + /* Must have knowledge */ + if (!(c_ptr->info & (CAVE_MARK))) + { /* Message */ ! msg_print("You see nothing there."); ! /* Nope */ ! return (FALSE); } ! /* Must be a wall/door/etc */ ! if (cave_floor_grid(c_ptr)) { ! /* Message */ ! msg_print("You see nothing there to tunnel."); ! ! /* Nope */ ! return (FALSE); } ! /* Okay */ ! return (TRUE); } /* * Tunnel through wall. Assumes valid location. * *************** *** 719,726 **** * Note that it is impossible to "extend" rooms past their * outer walls (which are actually part of the room). * ! * This will, however, produce grids which are NOT illuminated ! * (or darkened) along with the rest of the room. */ static bool twall(int y, int x) { --- 908,916 ---- * Note that it is impossible to "extend" rooms past their * outer walls (which are actually part of the room). * ! * Attempting to do so will produce floor grids which are not part ! * of the room, and whose "illumination" status do not change with ! * the rest of the room. */ static bool twall(int y, int x) { *************** *** 743,760 **** } - /* * Perform the basic "tunnel" command * - * Assumes that the destination is a wall, a vein, a secret - * door, or rubble. - * * Assumes that no monster is blocking the destination * * Returns TRUE if repeated commands may continue */ ! static bool do_cmd_tunnel_aux(int y, int x, int dir) { cave_type *c_ptr; --- 933,946 ---- } /* * Perform the basic "tunnel" command * * Assumes that no monster is blocking the destination * * Returns TRUE if repeated commands may continue */ ! static bool do_cmd_tunnel_aux(int y, int x) { cave_type *c_ptr; *************** *** 761,773 **** bool more = FALSE; ! /* XXX XXX XXX */ ! dir = (0, dir); - /* Take a turn */ - energy_use = 100; - /* Get grid */ c_ptr = &cave[y][x]; --- 947,956 ---- bool more = FALSE; ! /* Verify legality */ ! if (!do_cmd_tunnel_test(y, x)) return (FALSE); /* Get grid */ c_ptr = &cave[y][x]; *************** *** 892,908 **** } } ! /* Default to secret doors */ ! else /* if (c_ptr->feat == FEAT_SECRET) */ { ! /* Message, keep digging */ msg_print("You tunnel into the granite wall."); more = TRUE; ! /* Hack -- Search */ ! search(); } /* Notice new floor grids */ if (!cave_floor_bold(y, x)) { --- 1075,1119 ---- } } ! /* Secret doors */ ! else if (c_ptr->feat >= FEAT_SECRET) { ! /* Tunnel */ ! if ((p_ptr->skill_dig > 30 + rand_int(1200)) && twall(y, x)) ! { ! msg_print("You have finished the tunnel."); ! } ! ! /* Keep trying */ ! else ! { ! /* We may continue tunelling */ msg_print("You tunnel into the granite wall."); more = TRUE; ! /* Occasional Search XXX XXX */ ! if (rand_int(100) < 25) search(); } + } + /* Doors */ + else + { + /* Tunnel */ + if ((p_ptr->skill_dig > 30 + rand_int(1200)) && twall(y, x)) + { + msg_print("You have finished the tunnel."); + } + + /* Keep trying */ + else + { + /* We may continue tunelling */ + msg_print("You tunnel into the door."); + more = TRUE; + } + } + /* Notice new floor grids */ if (!cave_floor_bold(y, x)) { *************** *** 916,926 **** /* ! * Tunnels through "walls" (including rubble and closed doors) * - * Note that you must tunnel in order to hit invisible monsters - * in walls, though moving into walls still takes a turn anyway. - * * Digging is very difficult without a "digger" weapon, but can be * accomplished by strong players using heavy weapons. */ --- 1127,1134 ---- /* ! * Tunnel through "walls" (including rubble and secret doors) * * Digging is very difficult without a "digger" weapon, but can be * accomplished by strong players using heavy weapons. */ *************** *** 933,938 **** --- 1141,1176 ---- bool more = FALSE; + /* Get a direction (or abort) */ + if (!get_rep_dir(&dir)) return; + + /* Get location */ + y = p_ptr->py + ddy[dir]; + x = p_ptr->px + ddx[dir]; + + /* Get grid */ + c_ptr = &cave[y][x]; + + + /* Oops */ + if (!do_cmd_tunnel_test(y, x)) return; + + + /* Take a turn */ + energy_use = 100; + + /* Apply confusion */ + if (confuse_dir(&dir)) + { + /* Get location */ + y = p_ptr->py + ddy[dir]; + x = p_ptr->px + ddx[dir]; + + /* Get grid */ + c_ptr = &cave[y][x]; + } + + /* Allow repeated command */ if (command_arg) { *************** *** 946,982 **** command_arg = 0; } ! /* Get a direction to tunnel, or Abort */ ! if (get_rep_dir(&dir)) { - /* Get location */ - y = py + ddy[dir]; - x = px + ddx[dir]; - - /* Get grid */ - c_ptr = &cave[y][x]; - - /* Oops */ - if (cave_floor_grid(c_ptr)) - { /* Message */ - msg_print("You cannot tunnel through air."); - } - - /* No tunnelling through doors */ - else if (c_ptr->feat < FEAT_SECRET) - { - /* Message */ - msg_print("You cannot tunnel through doors."); - } - - /* A monster is in the way */ - else if (c_ptr->m_idx) - { - /* Take a turn */ - energy_use = 100; - - /* Message */ msg_print("There is a monster in the way!"); /* Attack */ --- 1184,1193 ---- command_arg = 0; } ! /* Monster */ ! if (c_ptr->m_idx) { /* Message */ msg_print("There is a monster in the way!"); /* Attack */ *************** *** 983,995 **** py_attack(y, x); } ! /* Try digging */ else { /* Tunnel through walls */ ! more = do_cmd_tunnel_aux(y, x, dir); } - } /* Cancel repetition unless we can continue */ if (!more) disturb(0, 0); --- 1194,1205 ---- py_attack(y, x); } ! /* Walls */ else { /* Tunnel through walls */ ! more = do_cmd_tunnel_aux(y, x); } /* Cancel repetition unless we can continue */ if (!more) disturb(0, 0); *************** *** 997,1092 **** /* ! * Perform the basic "disarm" command ! * ! * Assume destination is a visible trap ! * ! * Assume there is no monster blocking the destination ! * ! * Returns TRUE if repeated commands may continue */ ! static bool do_cmd_disarm_chest(int y, int x, s16b o_idx) { ! int i, j; ! bool more = FALSE; ! object_type *o_ptr = &o_list[o_idx]; ! ! ! /* Take a turn */ ! energy_use = 100; ! ! /* Get the "disarm" factor */ ! i = p_ptr->skill_dis; ! ! /* Penalize some conditions */ ! if (p_ptr->blind || no_lite()) i = i / 10; ! if (p_ptr->confused || p_ptr->image) i = i / 10; ! ! /* Extract the difficulty */ ! j = i - o_ptr->pval; ! ! /* Always have a small chance of success */ ! if (j < 2) j = 2; ! ! /* Must find the trap first. */ ! if (!object_known_p(o_ptr)) { ! msg_print("I don't see any traps."); ! } ! /* Already disarmed/unlocked */ ! else if (o_ptr->pval <= 0) ! { ! msg_print("The chest is not trapped."); } ! /* No traps to find. */ ! else if (!chest_traps[o_ptr->pval]) { ! msg_print("The chest is not trapped."); ! } ! /* Success (get a lot of experience) */ ! else if (rand_int(100) < j) ! { ! msg_print("You have disarmed the chest."); ! gain_exp(o_ptr->pval); ! o_ptr->pval = (0 - o_ptr->pval); } ! /* Failure -- Keep trying */ ! else if ((i > 5) && (randint(i) > 5)) ! { ! /* We may keep trying */ ! more = TRUE; ! if (flush_failure) flush(); ! msg_print("You failed to disarm the chest."); } - /* Failure -- Set off the trap */ - else - { - msg_print("You set off a trap!"); - chest_trap(y, x, o_idx); - } - /* Result */ - return (more); - } - - /* * Perform the basic "disarm" command * - * Assume destination is a visible trap - * * Assume there is no monster blocking the destination * * Returns TRUE if repeated commands may continue */ ! static bool do_cmd_disarm_aux(int y, int x, int dir) { int i, j, power; --- 1207,1255 ---- /* ! * Determine if a given grid may be "disarmed" */ ! static bool do_cmd_disarm_test(int y, int x) { ! cave_type *c_ptr; ! /* Acquire grid */ ! c_ptr = &cave[y][x]; ! /* Must have knowledge */ ! if (!(c_ptr->info & (CAVE_MARK))) { ! /* Message */ ! msg_print("You see nothing there."); ! /* Nope */ ! return (FALSE); } ! /* Require an actual trap */ ! if (!((c_ptr->feat >= FEAT_TRAP_HEAD) && ! (c_ptr->feat <= FEAT_TRAP_TAIL))) { ! /* Message */ ! msg_print("You see nothing there to disarm."); ! /* Nope */ ! return (FALSE); } ! /* Okay */ ! return (TRUE); } /* * Perform the basic "disarm" command * * Assume there is no monster blocking the destination * * Returns TRUE if repeated commands may continue */ ! static bool do_cmd_disarm_aux(int y, int x) { int i, j, power; *************** *** 1097,1105 **** bool more = FALSE; ! /* Take a turn */ ! energy_use = 100; /* Get grid and contents */ c_ptr = &cave[y][x]; --- 1260,1269 ---- bool more = FALSE; ! /* Verify legality */ ! if (!do_cmd_disarm_test(y, x)) return (FALSE); + /* Get grid and contents */ c_ptr = &cave[y][x]; *************** *** 1138,1146 **** /* Remove the trap */ cave_set_feat(y, x, FEAT_FLOOR); - - /* move the player onto the trap grid */ - move_player(dir, FALSE); } /* Failure -- Keep trying */ --- 1302,1307 ---- *************** *** 1162,1169 **** /* Message */ msg_format("You set off the %s!", name); ! /* Move the player onto the trap */ ! move_player(dir, FALSE); } /* Result */ --- 1323,1330 ---- /* Message */ msg_format("You set off the %s!", name); ! /* Hit the trap */ ! hit_trap(y, x); } /* Result */ *************** *** 1172,1178 **** /* ! * Disarms a trap, or chest */ void do_cmd_disarm(void) { --- 1333,1339 ---- /* ! * Disarms a trap, or a chest */ void do_cmd_disarm(void) { *************** *** 1185,1227 **** bool more = FALSE; ! /* Allow repeated command */ ! if (command_arg) ! { ! /* Set repeat count */ ! command_rep = command_arg - 1; ! /* Redraw the state */ ! p_ptr->redraw |= (PR_STATE); ! /* Cancel the arg */ ! command_arg = 0; ! } ! /* Get a direction (or abort) */ ! if (get_rep_dir(&dir)) { /* Get location */ ! y = py + ddy[dir]; ! x = px + ddx[dir]; ! /* Get grid and contents */ c_ptr = &cave[y][x]; /* Check for chests */ o_idx = chest_check(y, x); ! /* Disarm a trap */ ! if (!((c_ptr->feat >= FEAT_TRAP_HEAD) && ! (c_ptr->feat <= FEAT_TRAP_TAIL)) && ! !o_idx) { ! /* Message */ ! msg_print("You see nothing there to disarm."); } ! /* Monster in the way */ ! else if (c_ptr->m_idx) { /* Message */ msg_print("There is a monster in the way!"); --- 1346,1402 ---- bool more = FALSE; ! /* Get a direction (or abort) */ ! if (!get_rep_dir(&dir)) return; ! /* Get location */ ! y = p_ptr->py + ddy[dir]; ! x = p_ptr->px + ddx[dir]; ! /* Get grid */ ! c_ptr = &cave[y][x]; ! /* Check for chests */ ! o_idx = chest_check(y, x); ! ! ! /* Verify legality */ ! if (!o_idx && !do_cmd_disarm_test(y, x)) return; ! ! ! /* Take a turn */ ! energy_use = 100; ! ! /* Apply confusion */ ! if (confuse_dir(&dir)) { /* Get location */ ! y = p_ptr->py + ddy[dir]; ! x = p_ptr->px + ddx[dir]; ! /* Get grid */ c_ptr = &cave[y][x]; /* Check for chests */ o_idx = chest_check(y, x); + } ! ! /* Allow repeated command */ ! if (command_arg) { ! /* Set repeat count */ ! command_rep = command_arg - 1; ! ! /* Redraw the state */ ! p_ptr->redraw |= (PR_STATE); ! ! /* Cancel the arg */ ! command_arg = 0; } ! /* Monster */ ! if (c_ptr->m_idx) { /* Message */ msg_print("There is a monster in the way!"); *************** *** 1230,1236 **** py_attack(y, x); } ! /* Disarm chest */ else if (o_idx) { /* Disarm the chest */ --- 1405,1411 ---- py_attack(y, x); } ! /* Chest */ else if (o_idx) { /* Disarm the chest */ *************** *** 1241,1249 **** else { /* Disarm the trap */ ! more = do_cmd_disarm_aux(y, x, dir); } - } /* Cancel repeat unless told not to */ if (!more) disturb(0, 0); --- 1416,1423 ---- else { /* Disarm the trap */ ! more = do_cmd_disarm_aux(y, x); } /* Cancel repeat unless told not to */ if (!more) disturb(0, 0); *************** *** 1251,1265 **** /* * Perform the basic "bash" command * - * Assume destination is a closed/locked/jammed door - * * Assume there is no monster blocking the destination * * Returns TRUE if repeated commands may continue */ ! static bool do_cmd_bash_aux(int y, int x, int dir) { int bash, temp; --- 1425,1473 ---- /* + * Determine if a given grid may be "bashed" + */ + static bool do_cmd_bash_test(int y, int x) + { + cave_type *c_ptr; + + /* Acquire grid */ + c_ptr = &cave[y][x]; + + /* Must have knowledge */ + if (!(c_ptr->info & (CAVE_MARK))) + { + /* Message */ + msg_print("You see nothing there."); + + /* Nope */ + return (FALSE); + } + + /* Require a door */ + if (!((c_ptr->feat >= FEAT_DOOR_HEAD) && + (c_ptr->feat <= FEAT_DOOR_TAIL))) + { + /* Message */ + msg_print("You see nothing there to bash."); + + /* Nope */ + return (FALSE); + } + + /* Okay */ + return (TRUE); + } + + + /* * Perform the basic "bash" command * * Assume there is no monster blocking the destination * * Returns TRUE if repeated commands may continue */ ! static bool do_cmd_bash_aux(int y, int x) { int bash, temp; *************** *** 1268,1276 **** bool more = FALSE; ! /* Take a turn */ ! energy_use = 100; /* Get grid */ c_ptr = &cave[y][x]; --- 1476,1485 ---- bool more = FALSE; ! /* Verify legality */ ! if (!do_cmd_bash_test(y, x)) return (FALSE); + /* Get grid */ c_ptr = &cave[y][x]; *************** *** 1311,1319 **** /* Sound */ sound(SOUND_OPENDOOR); - /* Hack -- Fall through the door */ - move_player(dir, FALSE); - /* Update some things */ p_ptr->update |= (PU_VIEW | PU_LITE); p_ptr->update |= (PU_DISTANCE); --- 1520,1525 ---- *************** *** 1368,1373 **** --- 1574,1609 ---- bool more = FALSE; + /* Get a direction (or abort) */ + if (!get_rep_dir(&dir)) return; + + /* Get location */ + y = p_ptr->py + ddy[dir]; + x = p_ptr->px + ddx[dir]; + + /* Get grid */ + c_ptr = &cave[y][x]; + + + /* Verify legality */ + if (!do_cmd_bash_test(y, x)) return; + + + /* Take a turn */ + energy_use = 100; + + /* Apply confusion */ + if (confuse_dir(&dir)) + { + /* Get location */ + y = p_ptr->py + ddy[dir]; + x = p_ptr->px + ddx[dir]; + + /* Get grid */ + c_ptr = &cave[y][x]; + } + + /* Allow repeated command */ if (command_arg) { *************** *** 1381,1426 **** command_arg = 0; } ! /* Get a "repeated" direction */ ! if (get_rep_dir(&dir)) { - /* Bash location */ - y = py + ddy[dir]; - x = px + ddx[dir]; - - /* Get grid */ - c_ptr = &cave[y][x]; - - /* Nothing useful */ - if (!((c_ptr->feat >= FEAT_DOOR_HEAD) && - (c_ptr->feat <= FEAT_DOOR_TAIL))) - { /* Message */ - msg_print("You see nothing there to bash."); - } - - /* Monster in the way */ - else if (c_ptr->m_idx) - { - /* Take a turn */ - energy_use = 100; - - /* Message */ msg_print("There is a monster in the way!"); /* Attack */ py_attack(y, x); } ! /* Bash a closed door */ else { /* Bash the door */ ! more = do_cmd_bash_aux(y, x, dir); } - } ! /* Unless valid action taken, cancel bash */ if (!more) disturb(0, 0); } --- 1617,1643 ---- command_arg = 0; } ! /* Monster */ ! if (c_ptr->m_idx) { /* Message */ msg_print("There is a monster in the way!"); /* Attack */ py_attack(y, x); + + /* Done */ + return; } ! /* Door */ else { /* Bash the door */ ! more = do_cmd_bash_aux(y, x); } ! /* Cancel repeat unless told not to */ if (!more) disturb(0, 0); } *************** *** 1431,1450 **** * * Attack monsters, tunnel through walls, disarm traps, open doors. * - * Consider confusion XXX XXX XXX - * * This command must always take a turn, to prevent free detection * of invisible monsters. */ void do_cmd_alter(void) { int y, x, dir; cave_type *c_ptr; bool more = FALSE; /* Allow repeated command */ if (command_arg) { --- 1648,1703 ---- * * Attack monsters, tunnel through walls, disarm traps, open doors. * * This command must always take a turn, to prevent free detection * of invisible monsters. + * + * The "semantics" of this command must be chosen before the player + * is confused, and it must be verified against the new grid. */ void do_cmd_alter(void) { int y, x, dir; + int feat; + cave_type *c_ptr; bool more = FALSE; + /* Get a direction */ + if (!get_rep_dir(&dir)) return; + + /* Get location */ + y = p_ptr->py + ddy[dir]; + x = p_ptr->px + ddx[dir]; + + /* Get grid */ + c_ptr = &cave[y][x]; + + + /* Original feature */ + feat = c_ptr->feat; + + /* Must have knowledge to know feature XXX XXX */ + if (!(c_ptr->info & (CAVE_MARK))) feat = FEAT_NONE; + + + /* Take a turn */ + energy_use = 100; + + /* Apply confusion */ + if (confuse_dir(&dir)) + { + /* Get location */ + y = p_ptr->py + ddy[dir]; + x = p_ptr->px + ddx[dir]; + + /* Get grid */ + c_ptr = &cave[y][x]; + } + + /* Allow repeated command */ if (command_arg) { *************** *** 1458,1476 **** command_arg = 0; } - /* Get a direction */ - if (get_rep_dir(&dir)) - { - /* Get location */ - y = py + ddy[dir]; - x = px + ddx[dir]; - - /* Get grid */ - c_ptr = &cave[y][x]; - - /* Take a turn */ - energy_use = 100; - /* Attack monsters */ if (c_ptr->m_idx) { --- 1711,1716 ---- *************** *** 1479,1509 **** } /* Tunnel through walls */ ! else if (c_ptr->feat >= FEAT_SECRET) { /* Tunnel */ ! more = do_cmd_tunnel_aux(y, x, dir); } /* Bash jammed doors */ ! else if (c_ptr->feat >= FEAT_DOOR_HEAD + 0x08) { /* Tunnel */ ! more = do_cmd_bash_aux(y, x, dir); } /* Open closed doors */ ! else if (c_ptr->feat >= FEAT_DOOR_HEAD) { /* Tunnel */ ! more = do_cmd_open_aux(y, x, dir); } /* Disarm traps */ ! else if (c_ptr->feat >= FEAT_TRAP_HEAD) { /* Tunnel */ ! more = do_cmd_disarm_aux(y, x, dir); } /* Oops */ --- 1719,1749 ---- } /* Tunnel through walls */ ! else if (feat >= FEAT_SECRET) { /* Tunnel */ ! more = do_cmd_tunnel_aux(y, x); } /* Bash jammed doors */ ! else if (feat >= FEAT_DOOR_HEAD + 0x08) { /* Tunnel */ ! more = do_cmd_bash_aux(y, x); } /* Open closed doors */ ! else if (feat >= FEAT_DOOR_HEAD) { /* Tunnel */ ! more = do_cmd_open_aux(y, x); } /* Disarm traps */ ! else if (feat >= FEAT_TRAP_HEAD) { /* Tunnel */ ! more = do_cmd_disarm_aux(y, x); } /* Oops */ *************** *** 1510,1518 **** else { /* Oops */ ! msg_print("You attack the empty air."); } - } /* Cancel repetition unless we can continue */ if (!more) disturb(0, 0); --- 1750,1757 ---- else { /* Oops */ ! msg_print("You spin around."); } /* Cancel repetition unless we can continue */ if (!more) disturb(0, 0); *************** *** 1552,1601 **** } - /* ! * Jam a closed door with a spike ! * ! * This command may NOT be repeated */ ! void do_cmd_spike(void) { - int y, x, dir, item; - cave_type *c_ptr; ! /* Get a "repeated" direction */ ! if (get_rep_dir(&dir)) { ! /* Get location */ ! y = py + ddy[dir]; ! x = px + ddx[dir]; ! /* Get grid and contents */ ! c_ptr = &cave[y][x]; ! /* Require closed door */ if (!((c_ptr->feat >= FEAT_DOOR_HEAD) && (c_ptr->feat <= FEAT_DOOR_TAIL))) { /* Message */ msg_print("You see nothing there to spike."); } /* Get a spike */ ! else if (!get_spike(&item)) { /* Message */ msg_print("You have no spikes!"); } ! /* Is a monster in the way? */ ! else if (c_ptr->m_idx) ! { /* Take a turn */ energy_use = 100; /* Message */ msg_print("There is a monster in the way!"); --- 1791,1888 ---- } /* ! * Determine if a given grid may be "spiked" */ ! static bool do_cmd_spike_test(int y, int x) { cave_type *c_ptr; + /* Acquire grid */ + c_ptr = &cave[y][x]; ! /* Must have knowledge */ ! if (!(c_ptr->info & (CAVE_MARK))) { ! /* Message */ ! msg_print("You see nothing there."); ! /* Nope */ ! return (FALSE); ! } ! /* Require a door */ if (!((c_ptr->feat >= FEAT_DOOR_HEAD) && (c_ptr->feat <= FEAT_DOOR_TAIL))) { /* Message */ msg_print("You see nothing there to spike."); + + /* Nope */ + return (FALSE); } + /* Okay */ + return (TRUE); + } + + + /* + * Jam a closed door with a spike + * + * This command may NOT be repeated + */ + void do_cmd_spike(void) + { + int y, x, dir, item; + + cave_type *c_ptr; + + /* Get a spike */ ! if (!get_spike(&item)) { /* Message */ msg_print("You have no spikes!"); + + /* Done */ + return; } ! ! /* Get a direction (or abort) */ ! if (!get_rep_dir(&dir)) return; ! ! /* Get location */ ! y = p_ptr->py + ddy[dir]; ! x = p_ptr->px + ddx[dir]; ! ! /* Get grid and contents */ ! c_ptr = &cave[y][x]; ! ! ! /* Verify legality */ ! if (!do_cmd_spike_test(y, x)) return; ! ! /* Take a turn */ energy_use = 100; + /* Confuse direction */ + if (confuse_dir(&dir)) + { + /* Get location */ + y = p_ptr->py + ddy[dir]; + x = p_ptr->px + ddx[dir]; + + /* Get grid and contents */ + c_ptr = &cave[y][x]; + } + + + /* Monster */ + if (c_ptr->m_idx) + { /* Message */ msg_print("There is a monster in the way!"); *************** *** 1606,1613 **** /* Go for it */ else { ! /* Take a turn */ ! energy_use = 100; /* Successful jamming */ msg_print("You jam the door with a spike."); --- 1893,1900 ---- /* Go for it */ else { ! /* Verify legality */ ! if (!do_cmd_spike_test(y, x)) return; /* Successful jamming */ msg_print("You jam the door with a spike."); *************** *** 1624,1643 **** inven_item_optimize(item); } } } /* ! * Support code for the "Walk" and "Jump" commands */ ! void do_cmd_walk(int pickup) { ! int dir; ! bool more = FALSE; /* Allow repeated command */ if (command_arg) { --- 1911,1991 ---- inven_item_optimize(item); } } + + + + /* + * Determine if a given grid may be "walked" + */ + static bool do_cmd_walk_test(int y, int x) + { + cave_type *c_ptr; + + /* Acquire grid */ + c_ptr = &cave[y][x]; + + /* Hack -- walking obtains knowledge XXX XXX */ + if (!(c_ptr->info & (CAVE_MARK))) return (TRUE); + + /* Require open space */ + if (!cave_floor_grid(c_ptr)) + { + /* Message */ + msg_print("There is a wall in the way!"); + + /* Nope */ + return (FALSE); } + /* Okay */ + return (TRUE); + } /* ! * Helper function for the "walk" and "jump" commands */ ! static void do_cmd_walk_or_jump(int pickup) { ! int y, x, dir; ! cave_type *c_ptr; + /* Get a direction (or abort) */ + if (!get_rep_dir(&dir)) return; + + /* Get location */ + y = p_ptr->py + ddy[dir]; + x = p_ptr->px + ddx[dir]; + + /* Get grid and contents */ + c_ptr = &cave[y][x]; + + + /* Verify legality */ + if (!do_cmd_walk_test(y, x)) return; + + + /* Take a turn */ + energy_use = 100; + + /* Confuse direction */ + if (confuse_dir(&dir)) + { + /* Get location */ + y = p_ptr->py + ddy[dir]; + x = p_ptr->px + ddx[dir]; + + /* Get grid and contents */ + c_ptr = &cave[y][x]; + } + + + /* Verify legality */ + if (!do_cmd_walk_test(y, x)) return; + + /* Allow repeated command */ if (command_arg) { *************** *** 1651,1677 **** command_arg = 0; } ! /* Get a "repeated" direction */ ! if (get_rep_dir(&dir)) ! { ! /* Take a turn */ ! energy_use = 100; ! ! /* Actually move the character */ move_player(dir, pickup); - - /* Allow more walking */ - more = TRUE; } ! /* Cancel repeat unless we may continue */ ! if (!more) disturb(0, 0); } /* * Start running. */ void do_cmd_run(void) { --- 1999,2033 ---- command_arg = 0; } ! /* 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); + } + /* * Start running. + * + * Note that running while confused is not allowed. */ void do_cmd_run(void) { *************** *** 1688,1694 **** if (get_rep_dir(&dir)) { /* Hack -- Set the run counter */ ! running = (command_arg ? command_arg : 1000); /* First step */ run_step(dir); --- 2044,2050 ---- if (get_rep_dir(&dir)) { /* Hack -- Set the run counter */ ! p_ptr->running = (command_arg ? command_arg : 1000); /* First step */ run_step(dir); *************** *** 1701,1709 **** * Stay still. Search. Enter stores. * Pick up treasure if "pickup" is true. */ ! void do_cmd_stay(int pickup) { ! cave_type *c_ptr = &cave[py][px]; /* Allow repeated command */ --- 2057,2065 ---- * Stay still. Search. Enter stores. * Pick up treasure if "pickup" is true. */ ! static void do_cmd_hold_or_stay(int pickup) { ! cave_type *c_ptr = &cave[p_ptr->py][p_ptr->px]; /* Allow repeated command */ *************** *** 1719,1729 **** command_arg = 0; } - /* Take a turn */ energy_use = 100; - /* Spontaneous Searching */ if ((p_ptr->skill_fos >= 50) || (0 == rand_int(50 - p_ptr->skill_fos))) { --- 2075,2083 ---- *************** *** 1736,1746 **** search(); } - /* Handle "objects" */ ! carry(pickup); - /* Hack -- enter a store if we are on one */ if ((c_ptr->feat >= FEAT_SHOP_HEAD) && (c_ptr->feat <= FEAT_SHOP_TAIL)) --- 2090,2098 ---- search(); } /* Handle "objects" */ ! py_pickup(pickup); /* Hack -- enter a store if we are on one */ if ((c_ptr->feat >= FEAT_SHOP_HEAD) && (c_ptr->feat <= FEAT_SHOP_TAIL)) *************** *** 1754,1765 **** } /* ! * Resting allows a player to safely restore his hp -RAK- */ void do_cmd_rest(void) { --- 2106,2133 ---- } + /* + * Hold still (usually pickup) + */ + void do_cmd_hold(void) + { + /* Hold still (usually pickup) */ + do_cmd_hold_or_stay(always_pickup); + } + /* + * Stay still (usually do not pickup) + */ + void do_cmd_stay(void) + { + /* Stay still (usually do not pickup) */ + do_cmd_hold_or_stay(!always_pickup); + } /* ! * Rest (restores hit points and mana and such) */ void do_cmd_rest(void) { *************** *** 1805,1811 **** energy_use = 100; /* Save the rest code */ ! resting = command_arg; /* Cancel searching */ p_ptr->searching = FALSE; --- 2173,2179 ---- energy_use = 100; /* Save the rest code */ ! p_ptr->resting = command_arg; /* Cancel searching */ p_ptr->searching = FALSE; *************** *** 1908,1919 **** int bonus, chance; int cur_dis, visible; - object_type forge; - object_type *q_ptr; - object_type *o_ptr; object_type *j_ptr; bool hit_body = FALSE; byte missile_attr; --- 2276,2287 ---- int bonus, chance; int cur_dis, visible; object_type *o_ptr; object_type *j_ptr; + object_type *i_ptr; + object_type object_type_body; + bool hit_body = FALSE; byte missile_attr; *************** *** 1921,1926 **** --- 2289,2296 ---- char o_name[80]; + cptr q, s; + int msec = delay_factor * delay_factor * delay_factor; *************** *** 1927,1934 **** /* Get the "bow" (if any) */ j_ptr = &inventory[INVEN_BOW]; ! /* Require a launcher */ ! if (!j_ptr->tval) { msg_print("You have nothing to fire with."); return; --- 2297,2304 ---- /* Get the "bow" (if any) */ j_ptr = &inventory[INVEN_BOW]; ! /* Require a usable launcher */ ! if (!j_ptr->tval || !p_ptr->ammo_tval) { msg_print("You have nothing to fire with."); return; *************** *** 1936,1949 **** /* Require proper missile */ ! item_tester_tval = p_ptr->tval_ammo; ! /* Get an item (from inven or floor) */ ! if (!get_item(&item, "Fire which item? ", FALSE, TRUE, TRUE)) ! { ! if (item == -2) msg_print("You have nothing to fire."); ! return; ! } /* Access the item (if in the pack) */ if (item >= 0) --- 2306,2317 ---- /* Require proper missile */ ! item_tester_tval = p_ptr->ammo_tval; ! /* Get an item */ ! q = "Fire which item? "; ! 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) *************** *** 1961,1973 **** /* Get local object */ ! q_ptr = &forge; /* Obtain a local object */ ! object_copy(q_ptr, o_ptr); /* Single object */ ! q_ptr->number = 1; /* Reduce and describe inventory */ if (item >= 0) --- 2329,2341 ---- /* Get local object */ ! i_ptr = &object_type_body; /* Obtain a local object */ ! object_copy(i_ptr, o_ptr); /* Single object */ ! i_ptr->number = 1; /* Reduce and describe inventory */ if (item >= 0) *************** *** 1990,2000 **** /* Describe the object */ ! object_desc(o_name, q_ptr, FALSE, 3); /* Find the color and symbol for the object for throwing */ ! missile_attr = object_attr(q_ptr); ! missile_char = object_char(q_ptr); /* Use the proper number of shots */ --- 2358,2368 ---- /* Describe the object */ ! object_desc(o_name, i_ptr, FALSE, 3); /* Find the color and symbol for the object for throwing */ ! missile_attr = object_attr(i_ptr); ! missile_char = object_char(i_ptr); /* Use the proper number of shots */ *************** *** 2004,2060 **** tdis = 10; /* Base damage from thrown object plus launcher bonus */ ! tdam = damroll(q_ptr->dd, q_ptr->ds) + q_ptr->to_d + j_ptr->to_d; /* Actually "fire" the object */ ! bonus = (p_ptr->to_h + q_ptr->to_h + j_ptr->to_h); chance = (p_ptr->skill_thb + (bonus * BTH_PLUS_ADJ)); /* Assume a base multiplier */ ! tmul = 1; - /* Analyze the launcher */ - switch (j_ptr->sval) - { - /* Sling and ammo */ - case SV_SLING: - { - tmul = 2; - break; - } - - /* Short Bow and Arrow */ - case SV_SHORT_BOW: - { - tmul = 2; - break; - } - - /* Long Bow and Arrow */ - case SV_LONG_BOW: - { - tmul = 3; - break; - } - - /* Light Crossbow and Bolt */ - case SV_LIGHT_XBOW: - { - tmul = 3; - break; - } - - /* Heavy Crossbow and Bolt */ - case SV_HEAVY_XBOW: - { - tmul = 4; - break; - } - } - - /* Get extra "power" from "extra might" */ - if (p_ptr->xtra_might) tmul++; - /* Boost the damage */ tdam *= tmul; --- 2372,2386 ---- tdis = 10; /* Base damage from thrown object plus launcher bonus */ ! tdam = damroll(i_ptr->dd, i_ptr->ds) + i_ptr->to_d + j_ptr->to_d; /* Actually "fire" the object */ ! bonus = (p_ptr->to_h + i_ptr->to_h + j_ptr->to_h); chance = (p_ptr->skill_thb + (bonus * BTH_PLUS_ADJ)); /* Assume a base multiplier */ ! tmul = p_ptr->ammo_mult; /* Boost the damage */ tdam *= tmul; *************** *** 2067,2078 **** /* Start at the player */ ! y = py; ! x = px; /* Predict the "target" location */ ! tx = px + 99 * ddx[dir]; ! ty = py + 99 * ddy[dir]; /* Check for "target request" */ if ((dir == 5) && target_okay()) --- 2393,2404 ---- /* Start at the player */ ! y = p_ptr->py; ! x = p_ptr->px; /* Predict the "target" location */ ! tx = p_ptr->px + 99 * ddx[dir]; ! ty = p_ptr->py + 99 * ddy[dir]; /* Check for "target request" */ if ((dir == 5) && target_okay()) *************** *** 2095,2101 **** /* Calculate the new location (see "project()") */ ny = y; nx = x; ! mmove2(&ny, &nx, py, px, ty, tx); /* Stopped by walls/doors */ if (!cave_floor_bold(ny, nx)) break; --- 2421,2427 ---- /* Calculate the new location (see "project()") */ ny = y; nx = x; ! mmove2(&ny, &nx, p_ptr->py, p_ptr->px, ty, tx); /* Stopped by walls/doors */ if (!cave_floor_bold(ny, nx)) break; *************** *** 2187,2194 **** } /* Apply special damage XXX XXX XXX */ ! tdam = tot_dam_aux(q_ptr, tdam, m_ptr); ! tdam = critical_shot(q_ptr->weight, q_ptr->to_h, tdam); /* No negative damage */ if (tdam < 0) tdam = 0; --- 2513,2520 ---- } /* Apply special damage XXX XXX XXX */ ! tdam = tot_dam_aux(i_ptr, tdam, m_ptr); ! tdam = critical_shot(i_ptr->weight, i_ptr->to_h, tdam); /* No negative damage */ if (tdam < 0) tdam = 0; *************** *** 2235,2244 **** } /* Chance of breakage (during attacks) */ ! j = (hit_body ? breakage_chance(q_ptr) : 0); /* Drop (or break) near that location */ ! drop_near(q_ptr, j, y, x); } --- 2561,2570 ---- } /* Chance of breakage (during attacks) */ ! j = (hit_body ? breakage_chance(i_ptr) : 0); /* Drop (or break) near that location */ ! drop_near(i_ptr, j, y, x); } *************** *** 2260,2270 **** int mul, div; int cur_dis, visible; - object_type forge; - object_type *q_ptr; - object_type *o_ptr; bool hit_body = FALSE; byte missile_attr; --- 2586,2596 ---- int mul, div; int cur_dis, visible; object_type *o_ptr; + object_type *i_ptr; + object_type object_type_body; + bool hit_body = FALSE; byte missile_attr; *************** *** 2272,2286 **** char o_name[80]; int msec = delay_factor * delay_factor * delay_factor; ! /* Get an item (from inven or floor) */ ! if (!get_item(&item, "Throw which item? ", FALSE, TRUE, TRUE)) ! { ! if (item == -2) msg_print("You have nothing to throw."); ! return; ! } /* Access the item (if in the pack) */ if (item >= 0) --- 2598,2612 ---- char o_name[80]; + cptr q, s; + int msec = delay_factor * delay_factor * delay_factor; ! /* Get an item */ ! q = "Throw which item? "; ! 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) *************** *** 2298,2310 **** /* Get local object */ ! q_ptr = &forge; /* Obtain a local object */ ! object_copy(q_ptr, o_ptr); /* Single object */ ! q_ptr->number = 1; /* Reduce and describe inventory */ if (item >= 0) --- 2624,2636 ---- /* Get local object */ ! i_ptr = &object_type_body; /* Obtain a local object */ ! object_copy(i_ptr, o_ptr); /* Single object */ ! i_ptr->number = 1; /* Reduce and describe inventory */ if (item >= 0) *************** *** 2323,2333 **** /* Description */ ! object_desc(o_name, q_ptr, FALSE, 3); /* Find the color and symbol for the object for throwing */ ! missile_attr = object_attr(q_ptr); ! missile_char = object_char(q_ptr); /* Extract a "distance multiplier" */ --- 2649,2659 ---- /* Description */ ! object_desc(o_name, i_ptr, FALSE, 3); /* Find the color and symbol for the object for throwing */ ! missile_attr = object_attr(i_ptr); ! missile_char = object_char(i_ptr); /* Extract a "distance multiplier" */ *************** *** 2334,2340 **** mul = 10; /* Enforce a minimum "weight" of one pound */ ! div = ((q_ptr->weight > 10) ? q_ptr->weight : 10); /* Hack -- Distance -- Reward strength, penalize weight */ tdis = (adj_str_blow[p_ptr->stat_ind[A_STR]] + 20) * mul / div; --- 2660,2666 ---- mul = 10; /* Enforce a minimum "weight" of one pound */ ! div = ((i_ptr->weight > 10) ? i_ptr->weight : 10); /* Hack -- Distance -- Reward strength, penalize weight */ tdis = (adj_str_blow[p_ptr->stat_ind[A_STR]] + 20) * mul / div; *************** *** 2343,2349 **** if (tdis > 10) tdis = 10; /* Hack -- Base damage from thrown object */ ! tdam = damroll(q_ptr->dd, q_ptr->ds) + q_ptr->to_d; /* Chance of hitting */ chance = (p_ptr->skill_tht + (p_ptr->to_h * BTH_PLUS_ADJ)); --- 2669,2675 ---- if (tdis > 10) tdis = 10; /* Hack -- Base damage from thrown object */ ! tdam = damroll(i_ptr->dd, i_ptr->ds) + i_ptr->to_d; /* Chance of hitting */ chance = (p_ptr->skill_tht + (p_ptr->to_h * BTH_PLUS_ADJ)); *************** *** 2354,2365 **** /* Start at the player */ ! y = py; ! x = px; /* Predict the "target" location */ ! tx = px + 99 * ddx[dir]; ! ty = py + 99 * ddy[dir]; /* Check for "target request" */ if ((dir == 5) && target_okay()) --- 2680,2691 ---- /* Start at the player */ ! y = p_ptr->py; ! x = p_ptr->px; /* Predict the "target" location */ ! tx = p_ptr->px + 99 * ddx[dir]; ! ty = p_ptr->py + 99 * ddy[dir]; /* Check for "target request" */ if ((dir == 5) && target_okay()) *************** *** 2382,2388 **** /* Calculate the new location (see "project()") */ ny = y; nx = x; ! mmove2(&ny, &nx, py, px, ty, tx); /* Stopped by walls/doors */ if (!cave_floor_bold(ny, nx)) break; --- 2708,2714 ---- /* Calculate the new location (see "project()") */ ny = y; nx = x; ! mmove2(&ny, &nx, p_ptr->py, p_ptr->px, ty, tx); /* Stopped by walls/doors */ if (!cave_floor_bold(ny, nx)) break; *************** *** 2474,2481 **** } /* Apply special damage XXX XXX XXX */ ! tdam = tot_dam_aux(q_ptr, tdam, m_ptr); ! tdam = critical_shot(q_ptr->weight, q_ptr->to_h, tdam); /* No negative damage */ if (tdam < 0) tdam = 0; --- 2800,2807 ---- } /* Apply special damage XXX XXX XXX */ ! tdam = tot_dam_aux(i_ptr, tdam, m_ptr); ! tdam = critical_shot(i_ptr->weight, i_ptr->to_h, tdam); /* No negative damage */ if (tdam < 0) tdam = 0; *************** *** 2522,2531 **** } /* Chance of breakage (during attacks) */ ! j = (hit_body ? breakage_chance(q_ptr) : 0); /* Drop (or break) near that location */ ! drop_near(q_ptr, j, y, x); } --- 2848,2857 ---- } /* Chance of breakage (during attacks) */ ! j = (hit_body ? breakage_chance(i_ptr) : 0); /* Drop (or break) near that location */ ! drop_near(i_ptr, j, y, x); } Only in angband-281/src: cmd2.o diff -r -c -w src-281/cmd3.c angband-281/src/cmd3.c *** src-281/cmd3.c Mon Mar 3 22:18:25 1997 --- angband-281/src/cmd3.c Thu Apr 24 10:21:20 1997 *************** *** 147,159 **** { int item, slot; - object_type forge; - object_type *q_ptr; - object_type *o_ptr; cptr act; char o_name[80]; --- 147,161 ---- { int item, slot; object_type *o_ptr; + object_type *i_ptr; + object_type object_type_body; + cptr act; + cptr q, s; + char o_name[80]; *************** *** 160,171 **** /* Restrict the choices */ item_tester_hook = item_tester_hook_wear; ! /* Get an item (from inven or floor) */ ! if (!get_item(&item, "Wear/Wield which item? ", FALSE, TRUE, TRUE)) ! { ! if (item == -2) msg_print("You have nothing you can wear or wield."); ! return; ! } /* Get the item (in the pack) */ if (item >= 0) --- 162,171 ---- /* Restrict the choices */ item_tester_hook = item_tester_hook_wear; ! /* Get an item */ ! q = "Wear/Wield which item? "; ! s = "You have nothing you can wear or wield."; ! if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return; /* Get the item (in the pack) */ if (item >= 0) *************** *** 202,214 **** energy_use = 100; /* Get local object */ ! q_ptr = &forge; /* Obtain local object */ ! object_copy(q_ptr, o_ptr); /* Modify quantity */ ! q_ptr->number = 1; /* Decrease the item (from the pack) */ if (item >= 0) --- 202,214 ---- energy_use = 100; /* Get local object */ ! i_ptr = &object_type_body; /* Obtain local object */ ! object_copy(i_ptr, o_ptr); /* Modify quantity */ ! i_ptr->number = 1; /* Decrease the item (from the pack) */ if (item >= 0) *************** *** 235,244 **** } /* Wear the new stuff */ ! object_copy(o_ptr, q_ptr); /* Increase the weight */ ! total_weight += q_ptr->weight; /* Increment the equip counter by hand */ equip_cnt++; --- 235,244 ---- } /* Wear the new stuff */ ! object_copy(o_ptr, i_ptr); /* Increase the weight */ ! total_weight += i_ptr->weight; /* Increment the equip counter by hand */ equip_cnt++; *************** *** 301,314 **** object_type *o_ptr; - /* Get an item (from equip) */ - if (!get_item(&item, "Take off which item? ", TRUE, FALSE, FALSE)) - { - if (item == -2) msg_print("You are not wearing anything to take off."); - return; - } /* Get the item (in the pack) */ if (item >= 0) { --- 301,314 ---- object_type *o_ptr; + cptr q, s; + /* Get an item */ + q = "Take off which item? "; + s = "You are not wearing anything to take off."; + if (!get_item(&item, q, s, (USE_EQUIP))) return; + /* Get the item (in the pack) */ if (item >= 0) { *************** *** 350,364 **** object_type *o_ptr; ! cave_type *c_ptr = &cave[py][px]; ! /* Get an item (from equip or inven) */ ! if (!get_item(&item, "Drop which item? ", TRUE, TRUE, FALSE)) ! { ! if (item == -2) msg_print("You have nothing to drop."); ! return; ! } /* Get the item (in the pack) */ if (item >= 0) --- 350,362 ---- object_type *o_ptr; ! cptr q, s; ! /* Get an item */ ! q = "Drop which item? "; ! s = "You have nothing to drop."; ! if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN))) return; /* Get the item (in the pack) */ if (item >= 0) *************** *** 420,436 **** char out_val[160]; /* Hack -- force destruction */ if (command_arg > 0) force = TRUE; ! /* Get an item (from inven or floor) */ ! if (!get_item(&item, "Destroy which item? ", FALSE, TRUE, TRUE)) ! { ! if (item == -2) msg_print("You have nothing to destroy."); ! return; ! } /* Get the item (in the pack) */ if (item >= 0) --- 418,434 ---- char out_val[160]; + cptr q, s; + /* Hack -- force destruction */ if (command_arg > 0) force = TRUE; ! /* Get an item */ ! q = "Destroy which item? "; ! s = "You have nothing to destroy."; ! if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return; /* Get the item (in the pack) */ if (item >= 0) *************** *** 532,545 **** char o_name[80]; - /* Get an item (from equip or inven or floor) */ - if (!get_item(&item, "Examine which item? ", TRUE, TRUE, TRUE)) - { - if (item == -2) msg_print("You have nothing to examine."); - return; - } /* Get the item (in the pack) */ if (item >= 0) { --- 530,543 ---- char o_name[80]; + cptr q, s; + /* Get an item */ + q = "Examine which item? "; + s = "You have nothing to examine."; + if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return; + /* Get the item (in the pack) */ if (item >= 0) { *************** *** 583,596 **** object_type *o_ptr; - /* Get an item (from equip or inven or floor) */ - if (!get_item(&item, "Un-inscribe which item? ", TRUE, TRUE, TRUE)) - { - if (item == -2) msg_print("You have nothing to un-inscribe."); - return; - } /* Get the item (in the pack) */ if (item >= 0) { --- 581,594 ---- object_type *o_ptr; + cptr q, s; + /* Get an item */ + q = "Un-inscribe which item? "; + s = "You have nothing to un-inscribe."; + if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return; + /* Get the item (in the pack) */ if (item >= 0) { *************** *** 637,650 **** char out_val[80]; - /* Get an item (from equip or inven or floor) */ - if (!get_item(&item, "Inscribe which item? ", TRUE, TRUE, TRUE)) - { - if (item == -2) msg_print("You have nothing to inscribe."); - return; - } /* Get the item (in the pack) */ if (item >= 0) { --- 635,648 ---- char out_val[80]; + cptr q, s; + /* Get an item */ + q = "Inscribe which item? "; + s = "You have nothing to inscribe."; + if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return; + /* Get the item (in the pack) */ if (item >= 0) { *************** *** 717,732 **** object_type *o_ptr; object_type *j_ptr; /* Restrict the choices */ item_tester_hook = item_tester_refill_lantern; ! /* Get an item (from inven or floor) */ ! if (!get_item(&item, "Refill with which flask? ", FALSE, TRUE, TRUE)) ! { ! if (item == -2) msg_print("You have no flasks of oil."); ! return; ! } /* Get the item (in the pack) */ if (item >= 0) --- 715,730 ---- object_type *o_ptr; object_type *j_ptr; + cptr q, s; + /* Restrict the choices */ 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) */ if (item >= 0) *************** *** 806,821 **** object_type *o_ptr; object_type *j_ptr; /* Restrict the choices */ item_tester_hook = item_tester_refill_torch; ! /* Get an item (from inven or floor) */ ! if (!get_item(&item, "Refuel with which torch? ", FALSE, TRUE, TRUE)) ! { ! if (item == -2) msg_print("You have no extra torches."); ! return; ! } /* Get the item (in the pack) */ if (item >= 0) --- 804,819 ---- object_type *o_ptr; object_type *j_ptr; + cptr q, s; + /* Restrict the choices */ item_tester_hook = item_tester_refill_torch; ! /* Get an item */ ! q = "Refuel with which torch? "; ! s = "You have no extra torches."; ! if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return; /* Get the item (in the pack) */ if (item >= 0) *************** *** 1287,1297 **** a1 = r_ptr->d_attr; a2 = r_ptr->x_attr; - /* Hack -- fake monochrome */ - if (!use_color) a1 = TERM_WHITE; - if (!use_color) a2 = TERM_WHITE; - /* Clear the top line */ Term_erase(0, 0, 255); --- 1285,1291 ---- Only in angband-281/src: cmd3.o diff -r -c -w src-281/cmd4.c angband-281/src/cmd4.c *** src-281/cmd4.c Mon Mar 3 22:19:07 1997 --- angband-281/src/cmd4.c Thu Apr 24 10:21:42 1997 *************** *** 136,142 **** /* File dump */ else if (c == 'f') { ! sprintf(tmp, "%s.txt", player_base); if (get_string("File name: ", tmp, 80)) { if (tmp[0] && (tmp[0] != ' ')) --- 136,142 ---- /* File dump */ else if (c == 'f') { ! sprintf(tmp, "%s.txt", p_ptr->base_name); if (get_string("File name: ", tmp, 80)) { if (tmp[0] && (tmp[0] != ' ')) *************** *** 181,187 **** /* ! * Show previous messages to the user -BEN- * * The screen format uses line 0 and 23 for headers and prompts, * skips line 1 and 22, and uses line 2 thru 21 for old messages. --- 181,187 ---- /* ! * Show previous messages to the user * * The screen format uses line 0 and 23 for headers and prompts, * skips line 1 and 22, and uses line 2 thru 21 for old messages. *************** *** 675,681 **** cptr s = angband_term_name[j]; /* Use color */ ! if (use_color && (j == x)) a = TERM_L_BLUE; /* Window name, staggered, centered */ Term_putstr(35 + j * 5 - strlen(s) / 2, 2 + j % 2, -1, a, s); --- 675,681 ---- cptr s = angband_term_name[j]; /* Use color */ ! if (j == x) a = TERM_L_BLUE; /* Window name, staggered, centered */ Term_putstr(35 + j * 5 - strlen(s) / 2, 2 + j % 2, -1, a, s); *************** *** 689,695 **** cptr str = window_flag_desc[i]; /* Use color */ ! if (use_color && (i == y)) a = TERM_L_BLUE; /* Unused option */ if (!str) str = "(Unused option)"; --- 689,695 ---- cptr str = window_flag_desc[i]; /* Use color */ ! if (i == y) a = TERM_L_BLUE; /* Unused option */ if (!str) str = "(Unused option)"; *************** *** 705,711 **** char c = '.'; /* Use color */ ! if (use_color && (i == y) && (j == x)) a = TERM_L_BLUE; /* Active flag */ if (window_flag[j] & (1L << i)) c = 'X'; --- 705,711 ---- char c = '.'; /* Use color */ ! if ((i == y) && (j == x)) a = TERM_L_BLUE; /* Active flag */ if (window_flag[j] & (1L << i)) c = 'X'; *************** *** 1173,1206 **** Term_clear(); /* Describe */ ! Term_putstr(0, 2, -1, TERM_WHITE, "Interact with Macros"); /* Describe that action */ ! Term_putstr(0, 18, -1, TERM_WHITE, "Current action (if any) shown below:"); /* Analyze the current action */ ascii_to_text(buf, macro__buf); /* Display the current action */ ! Term_putstr(0, 20, -1, TERM_WHITE, buf); /* Selections */ ! Term_putstr(5, 4, -1, TERM_WHITE, "(1) Load a user pref file"); #ifdef ALLOW_MACROS ! Term_putstr(5, 5, -1, TERM_WHITE, "(2) Dump macros"); ! Term_putstr(5, 6, -1, TERM_WHITE, "(3) Enter a new action"); ! Term_putstr(5, 7, -1, TERM_WHITE, "(4) Query a macro action"); ! Term_putstr(5, 8, -1, TERM_WHITE, "(5) Create a command macro"); ! Term_putstr(5, 9, -1, TERM_WHITE, "(6) Create a normal macro"); ! Term_putstr(5, 10, -1, TERM_WHITE, "(7) Create an identity macro"); ! Term_putstr(5, 11, -1, TERM_WHITE, "(8) Create an empty macro"); ! Term_putstr(5, 12, -1, TERM_WHITE, "(9) Define a special keymap"); #endif /* ALLOW_MACROS */ /* Prompt */ ! Term_putstr(0, 14, -1, TERM_WHITE, "Command: "); /* Get a command */ i = inkey(); --- 1173,1206 ---- Term_clear(); /* Describe */ ! prt("Interact with Macros", 2, 0); /* Describe that action */ ! prt("Current action (if any) shown below:", 18, 0); /* Analyze the current action */ ascii_to_text(buf, macro__buf); /* Display the current action */ ! prt(buf, 20, 0); /* Selections */ ! prt("(1) Load a user pref file", 4, 5); #ifdef ALLOW_MACROS ! prt("(2) Dump macros", 5, 5); ! prt("(3) Enter a new action", 6, 5); ! prt("(4) Query a macro action", 7, 5); ! prt("(5) Create a command macro", 8, 5); ! prt("(6) Create a normal macro", 9, 5); ! prt("(7) Create an identity macro", 10, 5); ! prt("(8) Create an empty macro", 11, 5); ! prt("(9) Define a special keymap", 12, 5); #endif /* ALLOW_MACROS */ /* Prompt */ ! prt("Command: ", 14, 0); /* Get a command */ i = inkey(); *************** *** 1212,1224 **** else if (i == '1') { /* Prompt */ ! Term_putstr(0, 14, -1, TERM_WHITE, "Command: Load a user pref file"); ! /* Get a filename, handle ESCAPE */ ! Term_putstr(0, 16, -1, TERM_WHITE, "File: "); /* Default filename */ ! sprintf(tmp, "user-%s.prf", ANGBAND_SYS); /* Ask for a file */ if (!askfor_aux(tmp, 70)) continue; --- 1212,1224 ---- else if (i == '1') { /* Prompt */ ! prt("Command: Load a user pref file", 14, 0); ! /* Prompt */ ! prt("File: ", 16, 0); /* Default filename */ ! sprintf(tmp, "user.prf"); /* Ask for a file */ if (!askfor_aux(tmp, 70)) continue; *************** *** 1233,1245 **** else if (i == '2') { /* Prompt */ ! Term_putstr(0, 14, -1, TERM_WHITE, "Command: Save a macro file"); ! /* Get a filename, handle ESCAPE */ ! Term_putstr(0, 16, -1, TERM_WHITE, "File: "); /* Default filename */ ! sprintf(tmp, "user-%s.prf", ANGBAND_SYS); /* Ask for a file */ if (!askfor_aux(tmp, 70)) continue; --- 1233,1245 ---- else if (i == '2') { /* Prompt */ ! prt("Command: Save a macro file", 14, 0); ! /* Prompt */ ! prt("File: ", 16, 0); /* Default filename */ ! sprintf(tmp, "user.prf"); /* Ask for a file */ if (!askfor_aux(tmp, 70)) continue; *************** *** 1258,1264 **** else if (i == '3') { /* Prompt */ ! Term_putstr(0, 14, -1, TERM_WHITE, "Command: Enter a new action"); /* Go to the correct location */ Term_gotoxy(0, 20); --- 1258,1264 ---- else if (i == '3') { /* Prompt */ ! prt("Command: Enter a new action", 14, 0); /* Go to the correct location */ Term_gotoxy(0, 20); *************** *** 1279,1288 **** #if 0 /* Prompt */ ! Term_putstr(0, 14, -1, TERM_WHITE, "Command: Query a macro action"); /* Prompt */ ! Term_putstr(0, 16, -1, TERM_WHITE, "Enter a macro trigger: "); /* Get a macro trigger */ do_cmd_macro_aux(buf); --- 1279,1288 ---- #if 0 /* Prompt */ ! prt("Command: Query a macro action", 14, 0); /* Prompt */ ! prt("Enter a macro trigger: ", 16, 0); /* Get a macro trigger */ do_cmd_macro_aux(buf); *************** *** 1296,1305 **** else if (i == '5') { /* Prompt */ ! Term_putstr(0, 14, -1, TERM_WHITE, "Command: Create a command macro"); /* Prompt */ ! Term_putstr(0, 16, -1, TERM_WHITE, "Trigger: "); /* Get a macro trigger */ do_cmd_macro_aux(buf); --- 1296,1305 ---- else if (i == '5') { /* Prompt */ ! prt("Command: Create a command macro", 14, 0); /* Prompt */ ! prt("Trigger: ", 16, 0); /* Get a macro trigger */ do_cmd_macro_aux(buf); *************** *** 1315,1324 **** else if (i == '6') { /* Prompt */ ! Term_putstr(0, 14, -1, TERM_WHITE, "Command: Create a normal macro"); /* Prompt */ ! Term_putstr(0, 16, -1, TERM_WHITE, "Trigger: "); /* Get a macro trigger */ do_cmd_macro_aux(buf); --- 1315,1324 ---- else if (i == '6') { /* Prompt */ ! prt("Command: Create a normal macro", 14, 0); /* Prompt */ ! prt("Trigger: ", 16, 0); /* Get a macro trigger */ do_cmd_macro_aux(buf); *************** *** 1334,1343 **** else if (i == '7') { /* Prompt */ ! Term_putstr(0, 14, -1, TERM_WHITE, "Command: Create an identity macro"); /* Prompt */ ! Term_putstr(0, 16, -1, TERM_WHITE, "Trigger: "); /* Get a macro trigger */ do_cmd_macro_aux(buf); --- 1334,1343 ---- else if (i == '7') { /* Prompt */ ! prt("Command: Create an identity macro", 14, 0); /* Prompt */ ! prt("Trigger: ", 16, 0); /* Get a macro trigger */ do_cmd_macro_aux(buf); *************** *** 1353,1362 **** else if (i == '8') { /* Prompt */ ! Term_putstr(0, 14, -1, TERM_WHITE, "Command: Create an empty macro"); /* Prompt */ ! Term_putstr(0, 16, -1, TERM_WHITE, "Trigger: "); /* Get a macro trigger */ do_cmd_macro_aux(buf); --- 1353,1362 ---- else if (i == '8') { /* Prompt */ ! prt("Command: Create an empty macro", 14, 0); /* Prompt */ ! prt("Trigger: ", 16, 0); /* Get a macro trigger */ do_cmd_macro_aux(buf); *************** *** 1488,1494 **** prt("File: ", 17, 0); /* Default filename */ ! sprintf(tmp, "user-%s.prf", ANGBAND_SYS); /* Query */ if (!askfor_aux(tmp, 70)) continue; --- 1488,1494 ---- prt("File: ", 17, 0); /* Default filename */ ! sprintf(tmp, "user.prf"); /* Query */ if (!askfor_aux(tmp, 70)) continue; *************** *** 1509,1515 **** prt("File: ", 17, 0); /* Default filename */ ! sprintf(tmp, "user-%s.prf", ANGBAND_SYS); /* Get a filename */ if (!askfor_aux(tmp, 70)) continue; --- 1509,1515 ---- prt("File: ", 17, 0); /* Default filename */ ! sprintf(tmp, "user.prf"); /* Get a filename */ if (!askfor_aux(tmp, 70)) continue; *************** *** 1569,1575 **** prt("File: ", 17, 0); /* Default filename */ ! sprintf(tmp, "user-%s.prf", ANGBAND_SYS); /* Get a filename */ if (!askfor_aux(tmp, 70)) continue; --- 1569,1575 ---- prt("File: ", 17, 0); /* Default filename */ ! sprintf(tmp, "user.prf"); /* Get a filename */ if (!askfor_aux(tmp, 70)) continue; *************** *** 1629,1635 **** prt("File: ", 17, 0); /* Default filename */ ! sprintf(tmp, "user-%s.prf", ANGBAND_SYS); /* Get a filename */ if (!askfor_aux(tmp, 70)) continue; --- 1629,1635 ---- prt("File: ", 17, 0); /* Default filename */ ! sprintf(tmp, "user.prf"); /* Get a filename */ if (!askfor_aux(tmp, 70)) continue; *************** *** 1850,1856 **** else if (i == '0') { /* Reset */ ! reset_visuals(); /* Message */ msg_print("Visual attr/char tables reset."); --- 1850,1856 ---- else if (i == '0') { /* Reset */ ! reset_visuals(TRUE); /* Message */ msg_print("Visual attr/char tables reset."); *************** *** 1935,1941 **** prt("File: ", 10, 0); /* Default file */ ! sprintf(tmp, "user-%s.prf", ANGBAND_SYS); /* Query */ if (!askfor_aux(tmp, 70)) continue; --- 1935,1941 ---- prt("File: ", 10, 0); /* Default file */ ! sprintf(tmp, "user.prf"); /* Query */ if (!askfor_aux(tmp, 70)) continue; *************** *** 1962,1968 **** prt("File: ", 10, 0); /* Default filename */ ! sprintf(tmp, "user-%s.prf", ANGBAND_SYS); /* Get a filename */ if (!askfor_aux(tmp, 70)) continue; --- 1962,1968 ---- prt("File: ", 10, 0); /* Default filename */ ! sprintf(tmp, "user.prf"); /* Get a filename */ if (!askfor_aux(tmp, 70)) continue; *************** *** 2175,2181 **** if (feeling > 10) feeling = 10; /* No useful feeling in town */ ! if (!dun_level) { msg_print("Looks like a typical town."); return; --- 2175,2181 ---- if (feeling > 10) feeling = 10; /* No useful feeling in town */ ! if (!p_ptr->depth) { msg_print("Looks like a typical town."); return; *************** *** 2269,2277 **** if (hack[i] == buf[x]) a = i; } - /* Hack -- fake monochrome */ - if (!use_color) a = TERM_WHITE; - /* Put the attr/char */ Term_draw(x, y, a, c); } --- 2269,2274 ---- *************** *** 2411,2419 **** /* ! * Check the status of "artifacts" */ ! void do_cmd_check_artifacts(void) { int i, k, z, x, y; --- 2408,2416 ---- /* ! * Display known artifacts */ ! static void do_cmd_knowledge_artifacts(void) { int i, k, z, x, y; *************** *** 2517,2536 **** /* Real object */ if (z) { ! object_type forge; ! object_type *q_ptr; /* Get local object */ ! q_ptr = &forge; /* Create fake object */ ! object_prep(q_ptr, z); /* Make it an artifact */ ! q_ptr->name1 = k; /* Describe the artifact */ ! object_desc_store(base_name, q_ptr, FALSE, 0); } /* Hack -- Build the artifact name */ --- 2514,2533 ---- /* Real object */ if (z) { ! object_type *i_ptr; ! object_type object_type_body; /* Get local object */ ! i_ptr = &object_type_body; /* Create fake object */ ! object_prep(i_ptr, z); /* Make it an artifact */ ! i_ptr->name1 = k; /* Describe the artifact */ ! object_desc_store(base_name, i_ptr, FALSE, 0); } /* Hack -- Build the artifact name */ *************** *** 2541,2547 **** my_fclose(fff); /* Display the file contents */ ! show_file(file_name, "Artifacts Seen"); /* Remove the file */ fd_kill(file_name); --- 2538,2544 ---- my_fclose(fff); /* Display the file contents */ ! show_file(file_name, "Known artifacts", 0, 0); /* Remove the file */ fd_kill(file_name); *************** *** 2549,2559 **** /* ! * Check the status of "uniques" * * Note that the player ghosts are ignored. XXX XXX XXX */ ! void do_cmd_check_uniques(void) { int k; --- 2546,2556 ---- /* ! * Display known uniques * * Note that the player ghosts are ignored. XXX XXX XXX */ ! static void do_cmd_knowledge_uniques(void) { int k; *************** *** 2593,2599 **** my_fclose(fff); /* Display the file contents */ ! show_file(file_name, "Known Uniques"); /* Remove the file */ fd_kill(file_name); --- 2590,2596 ---- my_fclose(fff); /* Display the file contents */ ! show_file(file_name, "Known Uniques", 0, 0); /* Remove the file */ fd_kill(file_name); *************** *** 2600,2603 **** --- 2597,2740 ---- } + /* + * Display known objects + */ + static void do_cmd_knowledge_objects(void) + { + int k; + FILE *fff; + + char o_name[80]; + + char file_name[1024]; + + + /* Temporary file */ + if (path_temp(file_name, 1024)) return; + + /* Open a new file */ + fff = my_fopen(file_name, "w"); + + /* Scan the object kinds */ + for (k = 1; k < MAX_K_IDX; k++) + { + object_kind *k_ptr = &k_info[k]; + + /* Hack -- skip artifacts */ + if (k_ptr->flags3 & (TR3_INSTA_ART)) continue; + + /* List known flavored objects */ + if (k_ptr->has_flavor && k_ptr->aware) + { + object_type *i_ptr; + object_type object_type_body; + + /* Get local object */ + i_ptr = &object_type_body; + + /* Create fake object */ + object_prep(i_ptr, k); + + /* Describe the object */ + object_desc_store(o_name, i_ptr, FALSE, 0); + + /* Print a message */ + fprintf(fff, " %s\n", o_name); + } + } + + /* Close the file */ + my_fclose(fff); + + /* Display the file contents */ + show_file(file_name, "Known Objects", 0, 0); + + /* Remove the file */ + fd_kill(file_name); + } + + + /* + * Interact with "knowledge" + */ + void do_cmd_knowledge(void) + { + int i; + + + /* File type is "TEXT" */ + FILE_TYPE(FILE_TYPE_TEXT); + + + /* Enter "icky" mode */ + character_icky = TRUE; + + /* Save the screen */ + Term_save(); + + + /* Interact until done */ + while (1) + { + /* Clear screen */ + Term_clear(); + + /* Ask for a choice */ + prt("Display current knowledge", 2, 0); + + /* Give some choices */ + prt("(1) Display known artifacts", 4, 5); + prt("(2) Display known uniques", 5, 5); + prt("(3) Display known objects", 6, 5); + + /* Prompt */ + prt("Command: ", 8, 0); + + /* Prompt */ + i = inkey(); + + /* Done */ + if (i == ESCAPE) break; + + /* Artifacts */ + if (i == '1') + { + /* Spawn */ + do_cmd_knowledge_artifacts(); + } + + /* Uniques */ + else if (i == '2') + { + /* Spawn */ + do_cmd_knowledge_uniques(); + } + + /* Objects */ + else if (i == '3') + { + /* Spawn */ + do_cmd_knowledge_objects(); + } + + /* Unknown option */ + else + { + bell(); + } + + /* Flush messages */ + msg_print(NULL); + } + + + /* Restore the screen */ + Term_load(); + + /* Leave "icky" mode */ + character_icky = FALSE; + } + + Only in angband-281/src: cmd4.o diff -r -c -w src-281/cmd5.c angband-281/src/cmd5.c *** src-281/cmd5.c Mon Mar 3 22:19:23 1997 --- angband-281/src/cmd5.c Thu Apr 24 10:22:03 1997 *************** *** 229,235 **** --- 229,237 ---- object_type *o_ptr; + cptr q, s; + /* Warriors are illiterate */ if (!mp_ptr->spell_book) { *************** *** 258,269 **** /* Restrict choices to "useful" books */ item_tester_tval = mp_ptr->spell_book; ! /* Get an item (from inven or floor) */ ! if (!get_item(&item, "Browse which book? ", FALSE, TRUE, TRUE)) ! { ! if (item == -2) msg_print("You have no books that you can read."); ! return; ! } /* Get the item (in the pack) */ if (item >= 0) --- 260,269 ---- /* Restrict choices to "useful" books */ item_tester_tval = mp_ptr->spell_book; ! /* Get an item */ ! q = "Browse which book? "; ! s = "You have no books that you can read."; ! if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return; /* Get the item (in the pack) */ if (item >= 0) *************** *** 335,340 **** --- 335,342 ---- cptr p = ((mp_ptr->spell_book == TV_MAGIC_BOOK) ? "spell" : "prayer"); + cptr q, s; + object_type *o_ptr; *************** *** 366,377 **** /* Restrict choices to "useful" books */ item_tester_tval = mp_ptr->spell_book; ! /* Get an item (from inven or floor) */ ! if (!get_item(&item, "Study which book? ", FALSE, TRUE, TRUE)) ! { ! if (item == -2) msg_print("You have no books that you can read."); ! return; ! } /* Get the item (in the pack) */ if (item >= 0) --- 368,377 ---- /* Restrict choices to "useful" books */ item_tester_tval = mp_ptr->spell_book; ! /* Get an item */ ! q = "Study which book? "; ! s = "You have no books that you can read."; ! if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return; /* Get the item (in the pack) */ if (item >= 0) *************** *** 450,460 **** /* Learn the spell */ if (spell < 32) { ! spell_learned1 |= (1L << spell); } else { ! spell_learned2 |= (1L << (spell - 32)); } /* Find the next open entry in "spell_order[]" */ --- 450,460 ---- /* Learn the spell */ if (spell < 32) { ! p_ptr->spell_learned1 |= (1L << spell); } else { ! p_ptr->spell_learned2 |= (1L << (spell - 32)); } /* Find the next open entry in "spell_order[]" */ *************** *** 461,471 **** for (i = 0; i < 64; i++) { /* Stop at the first empty space */ ! if (spell_order[i] == 99) break; } /* Add the spell to the known list */ ! spell_order[i++] = spell; /* Mention the result */ msg_format("You have learned the %s of %s.", --- 461,471 ---- for (i = 0; i < 64; i++) { /* Stop at the first empty space */ ! if (p_ptr->spell_order[i] == 99) break; } /* Add the spell to the known list */ ! p_ptr->spell_order[i++] = spell; /* Mention the result */ msg_format("You have learned the %s of %s.", *************** *** 508,514 **** --- 508,516 ---- magic_type *s_ptr; + cptr q, s; + /* Require spell ability */ if (mp_ptr->spell_book != TV_MAGIC_BOOK) { *************** *** 534,545 **** /* Restrict choices to spell books */ item_tester_tval = mp_ptr->spell_book; ! /* Get an item (from inven or floor) */ ! if (!get_item(&item, "Use which book? ", FALSE, TRUE, TRUE)) ! { ! if (item == -2) msg_print("You have no spell books!"); ! return; ! } /* Get the item (in the pack) */ if (item >= 0) --- 536,545 ---- /* Restrict choices to spell books */ item_tester_tval = mp_ptr->spell_book; ! /* Get an item */ ! q = "Use which book? "; ! s = "You have no spell books!"; ! if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return; /* Get the item (in the pack) */ if (item >= 0) *************** *** 827,833 **** case 31: { ! destroy_area(py, px, 15, TRUE); break; } --- 827,833 ---- case 31: { ! destroy_area(p_ptr->py, p_ptr->px, 15, TRUE); break; } *************** *** 857,863 **** case 36: { ! earthquake(py, px, 10); break; } --- 857,863 ---- case 36: { ! earthquake(p_ptr->py, p_ptr->px, 10); break; } *************** *** 1032,1039 **** /* A spell was cast */ if (!((spell < 32) ? ! (spell_worked1 & (1L << spell)) : ! (spell_worked2 & (1L << (spell - 32))))) { int e = s_ptr->sexp; --- 1032,1039 ---- /* A spell was cast */ if (!((spell < 32) ? ! (p_ptr->spell_worked1 & (1L << spell)) : ! (p_ptr->spell_worked2 & (1L << (spell - 32))))) { int e = s_ptr->sexp; *************** *** 1040,1050 **** /* The spell worked */ if (spell < 32) { ! spell_worked1 |= (1L << spell); } else { ! spell_worked2 |= (1L << (spell - 32)); } /* Gain experience */ --- 1040,1050 ---- /* The spell worked */ if (spell < 32) { ! p_ptr->spell_worked1 |= (1L << spell); } else { ! p_ptr->spell_worked2 |= (1L << (spell - 32)); } /* Gain experience */ *************** *** 1156,1162 **** --- 1156,1164 ---- magic_type *s_ptr; + cptr q, s; + /* Must use prayer books */ if (mp_ptr->spell_book != TV_PRAYER_BOOK) { *************** *** 1182,1193 **** /* Restrict choices */ item_tester_tval = mp_ptr->spell_book; ! /* Get an item (from inven or floor) */ ! if (!get_item(&item, "Use which book? ", FALSE, TRUE, TRUE)) ! { ! if (item == -2) msg_print("You have no prayer books!"); ! return; ! } /* Get the item (in the pack) */ if (item >= 0) --- 1184,1193 ---- /* Restrict choices */ item_tester_tval = mp_ptr->spell_book; ! /* Get an item */ ! q = "Use which book? "; ! s = "You have no prayer books!"; ! if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return; /* Get the item (in the pack) */ if (item >= 0) *************** *** 1388,1394 **** case 21: { ! earthquake(py, px, 10); break; } --- 1388,1394 ---- case 21: { ! earthquake(p_ptr->py, p_ptr->px, 10); break; } *************** *** 1548,1554 **** case 44: { ! destroy_area(py, px, 15, TRUE); break; } --- 1548,1554 ---- case 44: { ! destroy_area(p_ptr->py, p_ptr->px, 15, TRUE); break; } *************** *** 1645,1652 **** /* A prayer was prayed */ if (!((spell < 32) ? ! (spell_worked1 & (1L << spell)) : ! (spell_worked2 & (1L << (spell - 32))))) { int e = s_ptr->sexp; --- 1645,1652 ---- /* A prayer was prayed */ if (!((spell < 32) ? ! (p_ptr->spell_worked1 & (1L << spell)) : ! (p_ptr->spell_worked2 & (1L << (spell - 32))))) { int e = s_ptr->sexp; *************** *** 1653,1663 **** /* The spell worked */ if (spell < 32) { ! spell_worked1 |= (1L << spell); } else { ! spell_worked2 |= (1L << (spell - 32)); } /* Gain experience */ --- 1653,1663 ---- /* The spell worked */ if (spell < 32) { ! p_ptr->spell_worked1 |= (1L << spell); } else { ! p_ptr->spell_worked2 |= (1L << (spell - 32)); } /* Gain experience */ Only in angband-281/src: cmd5.o diff -r -c -w src-281/cmd6.c angband-281/src/cmd6.c *** src-281/cmd6.c Mon Mar 3 22:19:52 1997 --- angband-281/src/cmd6.c Thu Apr 24 10:22:42 1997 *************** *** 68,83 **** object_type *o_ptr; /* Restrict choices to food */ item_tester_tval = TV_FOOD; ! /* Get an item (from inven or floor) */ ! if (!get_item(&item, "Eat which item? ", FALSE, TRUE, TRUE)) ! { ! if (item == -2) msg_print("You have nothing to eat."); ! return; ! } /* Get the item (in the pack) */ if (item >= 0) --- 68,83 ---- object_type *o_ptr; + cptr q, s; + /* Restrict choices to food */ item_tester_tval = TV_FOOD; ! /* Get an item */ ! q = "Eat which item? "; ! s = "You have nothing to eat."; ! if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return; /* Get the item (in the pack) */ if (item >= 0) *************** *** 146,152 **** case SV_FOOD_CONFUSION: { ! if (!p_ptr->resist_conf) { if (set_confused(p_ptr->confused + rand_int(10) + 10)) { --- 146,152 ---- case SV_FOOD_CONFUSION: { ! if (!p_ptr->resist_confu) { if (set_confused(p_ptr->confused + rand_int(10) + 10)) { *************** *** 361,376 **** object_type *o_ptr; /* Restrict choices to potions */ item_tester_tval = TV_POTION; ! /* Get an item (from inven or floor) */ ! if (!get_item(&item, "Quaff which potion? ", FALSE, TRUE, TRUE)) ! { ! if (item == -2) msg_print("You have no potions to quaff."); ! return; ! } /* Get the item (in the pack) */ if (item >= 0) --- 361,376 ---- object_type *o_ptr; + cptr q, s; + /* Restrict choices to potions */ item_tester_tval = TV_POTION; ! /* Get an item */ ! q = "Quaff which potion? "; ! s = "You have no potions to quaff."; ! if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return; /* Get the item (in the pack) */ if (item >= 0) *************** *** 452,458 **** case SV_POTION_CONFUSION: { ! if (!p_ptr->resist_conf) { if (set_confused(p_ptr->confused + rand_int(20) + 15)) { --- 452,458 ---- case SV_POTION_CONFUSION: { ! if (!p_ptr->resist_confu) { if (set_confused(p_ptr->confused + rand_int(20) + 15)) { *************** *** 1042,1048 **** --- 1042,1050 ---- object_type *o_ptr; + cptr q, s; + /* Check some conditions */ if (p_ptr->blind) { *************** *** 1064,1075 **** /* Restrict choices to scrolls */ item_tester_tval = TV_SCROLL; ! /* Get an item (from inven or floor) */ ! if (!get_item(&item, "Read which scroll? ", FALSE, TRUE, TRUE)) ! { ! if (item == -2) msg_print("You have no scrolls to read."); ! return; ! } /* Get the item (in the pack) */ if (item >= 0) --- 1066,1075 ---- /* Restrict choices to scrolls */ item_tester_tval = TV_SCROLL; ! /* Get an item */ ! q = "Read which scroll? "; ! s = "You have no scrolls to read."; ! if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return; /* Get the item (in the pack) */ if (item >= 0) *************** *** 1133,1139 **** { for (k = 0; k < randint(3); k++) { ! if (summon_specific(py, px, dun_level, 0)) { ident = TRUE; } --- 1133,1139 ---- { for (k = 0; k < randint(3); k++) { ! if (summon_specific(p_ptr->py, p_ptr->px, p_ptr->depth, 0)) { ident = TRUE; } *************** *** 1145,1151 **** { for (k = 0; k < randint(3); k++) { ! if (summon_specific(py, px, dun_level, SUMMON_UNDEAD)) { ident = TRUE; } --- 1145,1151 ---- { for (k = 0; k < randint(3); k++) { ! if (summon_specific(p_ptr->py, p_ptr->px, p_ptr->depth, SUMMON_UNDEAD)) { ident = TRUE; } *************** *** 1371,1377 **** case SV_SCROLL_STAR_DESTRUCTION: { ! destroy_area(py, px, 15, TRUE); ident = TRUE; break; } --- 1371,1377 ---- case SV_SCROLL_STAR_DESTRUCTION: { ! destroy_area(p_ptr->py, p_ptr->px, 15, TRUE); ident = TRUE; break; } *************** *** 1398,1404 **** case SV_SCROLL_ACQUIREMENT: { ! acquirement(py, px, 1, TRUE); ident = TRUE; break; } --- 1398,1404 ---- case SV_SCROLL_ACQUIREMENT: { ! acquirement(p_ptr->py, p_ptr->px, 1, TRUE); ident = TRUE; break; } *************** *** 1405,1411 **** case SV_SCROLL_STAR_ACQUIREMENT: { ! acquirement(py, px, randint(2) + 1, TRUE); ident = TRUE; break; } --- 1405,1411 ---- case SV_SCROLL_STAR_ACQUIREMENT: { ! acquirement(p_ptr->py, p_ptr->px, randint(2) + 1, TRUE); ident = TRUE; break; } *************** *** 1457,1463 **** /* ! * Use a staff. -RAK- * * One charge of one staff disappears. * --- 1457,1463 ---- /* ! * Use a staff * * One charge of one staff disappears. * *************** *** 1472,1487 **** /* Hack -- let staffs of identify get aborted */ bool use_charge = TRUE; /* Restrict choices to wands */ item_tester_tval = TV_STAFF; ! /* Get an item (from inven or floor) */ ! if (!get_item(&item, "Use which staff? ", FALSE, TRUE, TRUE)) ! { ! if (item == -2) msg_print("You have no staff to use."); ! return; ! } /* Get the item (in the pack) */ if (item >= 0) --- 1472,1487 ---- /* Hack -- let staffs of identify get aborted */ bool use_charge = TRUE; + cptr q, s; + /* Restrict choices to wands */ item_tester_tval = TV_STAFF; ! /* Get an item */ ! q = "Use which staff? "; ! s = "You have no staff to use."; ! if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return; /* Get the item (in the pack) */ if (item >= 0) *************** *** 1579,1585 **** { for (k = 0; k < randint(4); k++) { ! if (summon_specific(py, px, dun_level, 0)) { ident = TRUE; } --- 1579,1585 ---- { for (k = 0; k < randint(4); k++) { ! if (summon_specific(p_ptr->py, p_ptr->px, p_ptr->depth, 0)) { ident = TRUE; } *************** *** 1781,1787 **** case SV_STAFF_EARTHQUAKES: { ! earthquake(py, px, 10); ident = TRUE; break; } --- 1781,1787 ---- case SV_STAFF_EARTHQUAKES: { ! earthquake(p_ptr->py, p_ptr->px, 10); ident = TRUE; break; } *************** *** 1788,1794 **** case SV_STAFF_DESTRUCTION: { ! destroy_area(py, px, 15, TRUE); ident = TRUE; break; } --- 1788,1794 ---- case SV_STAFF_DESTRUCTION: { ! destroy_area(p_ptr->py, p_ptr->px, 15, TRUE); ident = TRUE; break; } *************** *** 1822,1838 **** /* XXX Hack -- unstack if necessary */ if ((item >= 0) && (o_ptr->number > 1)) { ! object_type forge; ! object_type *q_ptr; /* Get local object */ ! q_ptr = &forge; /* Obtain a local object */ ! object_copy(q_ptr, o_ptr); /* Modify quantity */ ! q_ptr->number = 1; /* Restore the charges */ o_ptr->pval++; --- 1822,1838 ---- /* XXX Hack -- unstack if necessary */ if ((item >= 0) && (o_ptr->number > 1)) { ! object_type *i_ptr; ! object_type object_type_body; /* Get local object */ ! i_ptr = &object_type_body; /* Obtain a local object */ ! object_copy(i_ptr, o_ptr); /* Modify quantity */ ! i_ptr->number = 1; /* Restore the charges */ o_ptr->pval++; *************** *** 1839,1846 **** /* Unstack the used item */ o_ptr->number--; ! total_weight -= q_ptr->weight; ! item = inven_carry(q_ptr, FALSE); /* Message */ msg_print("You unstack your staff."); --- 1839,1846 ---- /* Unstack the used item */ o_ptr->number--; ! total_weight -= i_ptr->weight; ! item = inven_carry(i_ptr); /* Message */ msg_print("You unstack your staff."); *************** *** 1886,1901 **** object_type *o_ptr; /* Restrict choices to wands */ item_tester_tval = TV_WAND; ! /* Get an item (from inven or floor) */ ! if (!get_item(&item, "Aim which wand? ", FALSE, TRUE, TRUE)) ! { ! if (item == -2) msg_print("You have no wand to aim."); ! return; ! } /* Get the item (in the pack) */ if (item >= 0) --- 1886,1901 ---- object_type *o_ptr; + cptr q, s; + /* Restrict choices to wands */ item_tester_tval = TV_WAND; ! /* Get an item */ ! q = "Aim which wand? "; ! s = "You have no wand to aim."; ! if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return; /* Get the item (in the pack) */ if (item >= 0) *************** *** 2223,2239 **** /* Hack -- unstack if necessary */ if ((item >= 0) && (o_ptr->number > 1)) { ! object_type forge; ! object_type *q_ptr; /* Get local object */ ! q_ptr = &forge; /* Obtain a local object */ ! object_copy(q_ptr, o_ptr); /* Modify quantity */ ! q_ptr->number = 1; /* Restore the charges */ o_ptr->pval++; --- 2223,2239 ---- /* Hack -- unstack if necessary */ if ((item >= 0) && (o_ptr->number > 1)) { ! object_type *i_ptr; ! object_type object_type_body; /* Get local object */ ! i_ptr = &object_type_body; /* Obtain a local object */ ! object_copy(i_ptr, o_ptr); /* Modify quantity */ ! i_ptr->number = 1; /* Restore the charges */ o_ptr->pval++; *************** *** 2240,2247 **** /* Unstack the used item */ o_ptr->number--; ! total_weight -= q_ptr->weight; ! item = inven_carry(q_ptr, FALSE); /* Message */ msg_print("You unstack your wand."); --- 2240,2247 ---- /* Unstack the used item */ o_ptr->number--; ! total_weight -= i_ptr->weight; ! item = inven_carry(i_ptr); /* Message */ msg_print("You unstack your wand."); *************** *** 2281,2296 **** /* Hack -- let perception get aborted */ bool use_charge = TRUE; /* Restrict choices to rods */ item_tester_tval = TV_ROD; ! /* Get an item (from inven or floor) */ ! if (!get_item(&item, "Zap which rod? ", FALSE, TRUE, TRUE)) ! { ! if (item == -2) msg_print("You have no rod to zap."); ! return; ! } /* Get the item (in the pack) */ if (item >= 0) --- 2281,2296 ---- /* Hack -- let perception get aborted */ bool use_charge = TRUE; + cptr q, s; + /* Restrict choices to rods */ item_tester_tval = TV_ROD; ! /* Get an item */ ! q = "Zap which rod? "; ! s = "You have no rod to zap."; ! if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return; /* Get the item (in the pack) */ if (item >= 0) *************** *** 2631,2647 **** /* XXX Hack -- unstack if necessary */ if ((item >= 0) && (o_ptr->number > 1)) { ! object_type forge; ! object_type *q_ptr; /* Get local object */ ! q_ptr = &forge; /* Obtain a local object */ ! object_copy(q_ptr, o_ptr); /* Modify quantity */ ! q_ptr->number = 1; /* Restore "charge" */ o_ptr->pval = 0; --- 2631,2647 ---- /* XXX Hack -- unstack if necessary */ if ((item >= 0) && (o_ptr->number > 1)) { ! object_type *i_ptr; ! object_type object_type_body; /* Get local object */ ! i_ptr = &object_type_body; /* Obtain a local object */ ! object_copy(i_ptr, o_ptr); /* Modify quantity */ ! i_ptr->number = 1; /* Restore "charge" */ o_ptr->pval = 0; *************** *** 2648,2655 **** /* Unstack the used item */ o_ptr->number--; ! total_weight -= q_ptr->weight; ! item = inven_carry(q_ptr, FALSE); /* Message */ msg_print("You unstack your rod."); --- 2648,2655 ---- /* Unstack the used item */ o_ptr->number--; ! total_weight -= i_ptr->weight; ! item = inven_carry(i_ptr); /* Message */ msg_print("You unstack your rod."); *************** *** 2812,2827 **** object_type *o_ptr; /* Prepare the hook */ item_tester_hook = item_tester_hook_activate; ! /* Get an item (from equip) */ ! if (!get_item(&item, "Activate which item? ", TRUE, FALSE, FALSE)) ! { ! if (item == -2) msg_print("You have nothing to activate."); ! return; ! } /* Get the item (in the pack) */ if (item >= 0) --- 2812,2827 ---- object_type *o_ptr; + cptr q, s; + /* Prepare the hook */ item_tester_hook = item_tester_hook_activate; ! /* Get an item */ ! q = "Activate which item? "; ! s = "You have nothing to activate."; ! if (!get_item(&item, q, s, (USE_EQUIP))) return; /* Get the item (in the pack) */ if (item >= 0) *************** *** 3510,3516 **** chance = rand_int(2); msg_format("You breathe %s.", ((chance == 1 ? "sound" : "shards"))); ! fire_ball((chance == 1 ? GF_SOUND : GF_SHARDS), dir, 230, 2); o_ptr->timeout = rand_int(300) + 300; break; --- 3510,3516 ---- chance = rand_int(2); msg_format("You breathe %s.", ((chance == 1 ? "sound" : "shards"))); ! fire_ball((chance == 1 ? GF_SOUND : GF_SHARD), dir, 230, 2); o_ptr->timeout = rand_int(300) + 300; break; *************** *** 3525,3531 **** ((chance == 3) ? "sound" : "shards")))); fire_ball(((chance == 1) ? GF_CHAOS : ((chance == 2) ? GF_DISENCHANT : ! ((chance == 3) ? GF_SOUND : GF_SHARDS))), dir, 250, 2); o_ptr->timeout = rand_int(300) + 300; break; --- 3525,3531 ---- ((chance == 3) ? "sound" : "shards")))); fire_ball(((chance == 1) ? GF_CHAOS : ((chance == 2) ? GF_DISENCHANT : ! ((chance == 3) ? GF_SOUND : GF_SHARD))), dir, 250, 2); o_ptr->timeout = rand_int(300) + 300; break; Only in angband-281/src: cmd6.o diff -r -c -w src-281/config.h angband-281/src/config.h *** src-281/config.h Mon Mar 3 22:19:58 1997 --- angband-281/src/config.h Thu Apr 24 10:22:49 1997 *************** *** 309,325 **** /* - * OPTION: Allow use of extended spell info -DRS- - */ - #define DRS_SHOW_SPELL_INFO - - /* - * OPTION: Allow use of the monster health bar -DRS- - */ - #define DRS_SHOW_HEALTH_BAR - - - /* * OPTION: Enable the "smart_learn" and "smart_cheat" options. * They let monsters make more "intelligent" choices about attacks * (including spell attacks) based on their observations of the --- 309,314 ---- diff -r -c -w src-281/defines.h angband-281/src/defines.h *** src-281/defines.h Mon Mar 3 22:20:22 1997 --- angband-281/src/defines.h Thu Apr 24 10:23:22 1997 *************** *** 391,397 **** - /*** Screen Locations ***/ /* --- 391,396 ---- *************** *** 474,481 **** ! /*** Terrain Feature Indexes (see "lib/edit/f_info.txt") ***/ /* Nothing */ #define FEAT_NONE 0x00 --- 473,598 ---- ! /*** General index values ***/ + + /* + * Hack -- special "xtra" object flags + */ + #define EGO_XTRA_SUSTAIN 1 + #define EGO_XTRA_RESIST 2 + #define EGO_XTRA_POWER 3 + + + /* + * Legal restrictions for "summon_specific()" + */ + #define SUMMON_ANT 11 + #define SUMMON_SPIDER 12 + #define SUMMON_HOUND 13 + #define SUMMON_HYDRA 14 + #define SUMMON_ANGEL 15 + #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 + + + /* + * Spell types used by project(), and related functions. + */ + #define GF_XXX1 1 + #define GF_ARROW 2 + #define GF_MISSILE 3 + #define GF_MANA 4 + #define GF_HOLY_ORB 5 + #define GF_LITE_WEAK 6 + #define GF_DARK_WEAK 7 + #define GF_WATER 8 + #define GF_PLASMA 9 + #define GF_METEOR 10 + #define GF_ICE 11 + #define GF_GRAVITY 12 + #define GF_INERTIA 13 + #define GF_FORCE 14 + #define GF_TIME 15 + #define GF_ACID 16 + #define GF_ELEC 17 + #define GF_FIRE 18 + #define GF_COLD 19 + #define GF_POIS 20 + #define GF_XXX2 21 + #define GF_LITE 22 + #define GF_DARK 23 + #define GF_XXX3 24 + #define GF_CONFUSION 25 + #define GF_SOUND 26 + #define GF_SHARD 27 + #define GF_NEXUS 28 + #define GF_NETHER 29 + #define GF_CHAOS 30 + #define GF_DISENCHANT 31 + #define GF_XXX4 32 + #define GF_KILL_WALL 33 + #define GF_KILL_DOOR 34 + #define GF_KILL_TRAP 35 + #define GF_MAKE_WALL 36 + #define GF_MAKE_DOOR 37 + #define GF_MAKE_TRAP 38 + #define GF_XXX5 39 + #define GF_XXX6 40 + #define GF_AWAY_UNDEAD 41 + #define GF_AWAY_EVIL 42 + #define GF_AWAY_ALL 43 + #define GF_TURN_UNDEAD 44 + #define GF_TURN_EVIL 45 + #define GF_TURN_ALL 46 + #define GF_DISP_UNDEAD 47 + #define GF_DISP_EVIL 48 + #define GF_DISP_ALL 49 + #define GF_XXX7 50 + #define GF_OLD_CLONE 51 + #define GF_OLD_POLY 52 + #define GF_OLD_HEAL 53 + #define GF_OLD_SPEED 54 + #define GF_OLD_SLOW 55 + #define GF_OLD_CONF 56 + #define GF_OLD_SLEEP 57 + #define GF_OLD_DRAIN 58 + #define GF_XXX8 59 + + + /* + * Some constants for the "learn" code + * + * 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 + #define DRS_RES_COLD 19 + #define DRS_RES_POIS 20 + #define DRS_RES_FEAR 21 + #define DRS_RES_LITE 22 + #define DRS_RES_DARK 23 + #define DRS_RES_BLIND 24 + #define DRS_RES_CONFU 25 + #define DRS_RES_SOUND 26 + #define DRS_RES_SHARD 27 + #define DRS_RES_NEXUS 28 + #define DRS_RES_NETHR 29 + #define DRS_RES_CHAOS 30 + #define DRS_RES_DISEN 31 + + + + /*** Feature Indexes (see "lib/edit/f_info.txt") ***/ + /* Nothing */ #define FEAT_NONE 0x00 *************** *** 523,528 **** --- 640,646 ---- #define FEAT_PERM_SOLID 0x3F + /*** Artifact indexes (see "lib/edit/a_info.txt") ***/ *************** *** 670,676 **** --- 788,802 ---- #define ART_CUBRAGOL 126 + /* + * Hack -- first "normal" artifact in the artifact list. All of + * the artifacts with indexes from 1 to 15 are "special" (lights, + * rings, amulets), and the ones from 16 to 127 are "normal". + */ + #define ART_MIN_NORMAL 16 + + /*** Ego-Item indexes (see "lib/edit/e_info.txt") ***/ *************** *** 806,816 **** /* Ammo */ #define EGO_HURT_ANIMAL 112 #define EGO_HURT_EVIL 113 ! /* xxx */ ! /* xxx */ ! /* xxx */ ! /* xxx */ ! /* xxx */ #define EGO_HURT_DRAGON 119 /* xxx */ /* xxx */ --- 932,942 ---- /* Ammo */ #define EGO_HURT_ANIMAL 112 #define EGO_HURT_EVIL 113 ! #define EGO_HURT_UNDEAD 114 ! #define EGO_HURT_DEMON 115 ! #define EGO_HURT_ORC 116 ! #define EGO_HURT_TROLL 117 ! #define EGO_HURT_GIANT 118 #define EGO_HURT_DRAGON 119 /* xxx */ /* xxx */ *************** *** 822,827 **** --- 948,954 ---- #define EGO_BLASTED 127 + /*** Object "tval" and "sval" codes ***/ *************** *** 1081,1088 **** #define SV_RING_POWER 37 - - /* The "sval" codes for TV_STAFF */ #define SV_STAFF_DARKNESS 0 #define SV_STAFF_SLOWNESS 1 --- 1208,1213 ---- *************** *** 1344,1366 **** ! /*** General flag values ***/ /* ! * 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_LITE 0x10 /* lite flag */ ! #define CAVE_VIEW 0x20 /* view flag */ ! #define CAVE_TEMP 0x40 /* temp flag */ ! #define CAVE_XTRA 0x80 /* misc flag */ /* * Bit flags for the "project()" function * --- 1469,1543 ---- ! /*** Monster blow constants ***/ /* ! * New monster blow methods */ ! #define RBM_HIT 1 ! #define RBM_TOUCH 2 ! #define RBM_PUNCH 3 ! #define RBM_KICK 4 ! #define RBM_CLAW 5 ! #define RBM_BITE 6 ! #define RBM_STING 7 ! #define RBM_XXX1 8 ! #define RBM_BUTT 9 ! #define RBM_CRUSH 10 ! #define RBM_ENGULF 11 ! #define RBM_XXX2 12 ! #define RBM_CRAWL 13 ! #define RBM_DROOL 14 ! #define RBM_SPIT 15 ! #define RBM_XXX3 16 ! #define RBM_GAZE 17 ! #define RBM_WAIL 18 ! #define RBM_SPORE 19 ! #define RBM_XXX4 20 ! #define RBM_BEG 21 ! #define RBM_INSULT 22 ! #define RBM_MOAN 23 ! #define RBM_XXX5 24 + /* + * New monster blow effects + */ + #define RBE_HURT 1 + #define RBE_POISON 2 + #define RBE_UN_BONUS 3 + #define RBE_UN_POWER 4 + #define RBE_EAT_GOLD 5 + #define RBE_EAT_ITEM 6 + #define RBE_EAT_FOOD 7 + #define RBE_EAT_LITE 8 + #define RBE_ACID 9 + #define RBE_ELEC 10 + #define RBE_FIRE 11 + #define RBE_COLD 12 + #define RBE_BLIND 13 + #define RBE_CONFUSE 14 + #define RBE_TERRIFY 15 + #define RBE_PARALYZE 16 + #define RBE_LOSE_STR 17 + #define RBE_LOSE_INT 18 + #define RBE_LOSE_WIS 19 + #define RBE_LOSE_DEX 20 + #define RBE_LOSE_CON 21 + #define RBE_LOSE_CHR 22 + #define RBE_LOSE_ALL 23 + #define RBE_SHATTER 24 + #define RBE_EXP_10 25 + #define RBE_EXP_20 26 + #define RBE_EXP_40 27 + #define RBE_EXP_80 28 + + + /*** Function flags ***/ + + /* * Bit flags for the "project()" function * *************** *** 1382,1387 **** --- 1559,1565 ---- #define PROJECT_KILL 0x40 #define PROJECT_HIDE 0x80 + /* * Bit flags for the "enchant()" function */ *************** *** 1389,1396 **** #define ENCH_TODAM 0x02 #define ENCH_TOAC 0x04 /* ! * Bit flags for the "target_set" function XXX XXX XXX * * KILL: Target monsters * LOOK: Describe grid fully --- 1567,1575 ---- #define ENCH_TODAM 0x02 #define ENCH_TOAC 0x04 + /* ! * Bit flags for the "target_set" function * * KILL: Target monsters * LOOK: Describe grid fully *************** *** 1404,1446 **** /* ! * Some bit-flags for the "smart" field */ ! #define SM_RES_ACID 0x00000001 ! #define SM_RES_ELEC 0x00000002 ! #define SM_RES_FIRE 0x00000004 ! #define SM_RES_COLD 0x00000008 ! #define SM_RES_POIS 0x00000010 ! #define SM_RES_NETH 0x00000020 ! #define SM_RES_LITE 0x00000040 ! #define SM_RES_DARK 0x00000080 ! #define SM_RES_FEAR 0x00000100 ! #define SM_RES_CONF 0x00000200 ! #define SM_RES_CHAOS 0x00000400 ! #define SM_RES_DISEN 0x00000800 ! #define SM_RES_BLIND 0x00001000 ! #define SM_RES_NEXUS 0x00002000 ! #define SM_RES_SOUND 0x00004000 ! #define SM_RES_SHARD 0x00008000 ! #define SM_OPP_ACID 0x00010000 ! #define SM_OPP_ELEC 0x00020000 ! #define SM_OPP_FIRE 0x00040000 ! #define SM_OPP_COLD 0x00080000 ! #define SM_OPP_POIS 0x00100000 ! #define SM_OPP_XXX1 0x00200000 ! #define SM_OPP_XXX2 0x00400000 ! #define SM_OPP_XXX3 0x00800000 ! #define SM_IMM_ACID 0x01000000 ! #define SM_IMM_ELEC 0x02000000 ! #define SM_IMM_FIRE 0x04000000 ! #define SM_IMM_COLD 0x08000000 ! #define SM_IMM_XXX5 0x10000000 ! #define SM_IMM_XXX6 0x20000000 ! #define SM_IMM_FREE 0x40000000 ! #define SM_IMM_MANA 0x80000000 /* * Bit flags for the "p_ptr->notice" variable */ --- 1583,1612 ---- /* ! * 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 */ + + + /*** Player flags ***/ + + /* * Bit flags for the "p_ptr->notice" variable */ *************** *** 1531,1665 **** ! /*** General index values ***/ /* ! * Legal restrictions for "summon_specific()" */ ! #define SUMMON_ANT 11 ! #define SUMMON_SPIDER 12 ! #define SUMMON_HOUND 13 ! #define SUMMON_HYDRA 14 ! #define SUMMON_ANGEL 15 ! #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 - /* - * Spell types used by project(), and related functions. - */ - #define GF_ELEC 1 - #define GF_POIS 2 - #define GF_ACID 3 - #define GF_COLD 4 - #define GF_FIRE 5 - #define GF_MISSILE 10 - #define GF_ARROW 11 - #define GF_PLASMA 12 - #define GF_HOLY_ORB 13 - #define GF_WATER 14 - #define GF_LITE 15 - #define GF_DARK 16 - #define GF_LITE_WEAK 17 - #define GF_DARK_WEAK 18 - #define GF_SHARDS 20 - #define GF_SOUND 21 - #define GF_CONFUSION 22 - #define GF_FORCE 23 - #define GF_INERTIA 24 - #define GF_MANA 26 - #define GF_METEOR 27 - #define GF_ICE 28 - #define GF_CHAOS 30 - #define GF_NETHER 31 - #define GF_DISENCHANT 32 - #define GF_NEXUS 33 - #define GF_TIME 34 - #define GF_GRAVITY 35 - #define GF_KILL_WALL 40 - #define GF_KILL_DOOR 41 - #define GF_KILL_TRAP 42 - #define GF_MAKE_WALL 45 - #define GF_MAKE_DOOR 46 - #define GF_MAKE_TRAP 47 - #define GF_OLD_CLONE 51 - #define GF_OLD_POLY 52 - #define GF_OLD_HEAL 53 - #define GF_OLD_SPEED 54 - #define GF_OLD_SLOW 55 - #define GF_OLD_CONF 56 - #define GF_OLD_SLEEP 57 - #define GF_OLD_DRAIN 58 - #define GF_AWAY_UNDEAD 61 - #define GF_AWAY_EVIL 62 - #define GF_AWAY_ALL 63 - #define GF_TURN_UNDEAD 64 - #define GF_TURN_EVIL 65 - #define GF_TURN_ALL 66 - #define GF_DISP_UNDEAD 67 - #define GF_DISP_EVIL 68 - #define GF_DISP_ALL 69 - /* - * Some things which induce learning - */ - #define DRS_ACID 1 - #define DRS_ELEC 2 - #define DRS_FIRE 3 - #define DRS_COLD 4 - #define DRS_POIS 5 - #define DRS_NETH 6 - #define DRS_LITE 7 - #define DRS_DARK 8 - #define DRS_FEAR 9 - #define DRS_CONF 10 - #define DRS_CHAOS 11 - #define DRS_DISEN 12 - #define DRS_BLIND 13 - #define DRS_NEXUS 14 - #define DRS_SOUND 15 - #define DRS_SHARD 16 - #define DRS_FREE 30 - #define DRS_MANA 31 - - /* - * Hack -- first "normal" artifact in the artifact list. All of - * the artifacts with indexes from 1 to 15 are "special" (lights, - * rings, amulets), and the ones from 16 to 127 are "normal". - */ - #define ART_MIN_NORMAL 16 - - - /* - * Hack -- special "xtra" object powers - */ - - /* Sustain one stat */ - #define EGO_XTRA_SUSTAIN 1 - - /* High resist */ - #define EGO_XTRA_POWER 2 - - /* Special ability */ - #define EGO_XTRA_ABILITY 3 - - - - - - /*** Object flag values ***/ - - - /* * Chest trap flags (see "tables.c") */ #define CHEST_LOSE_STR 0x01 --- 1697,1723 ---- ! /*** Cave flags ***/ /* ! * 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_LITE 0x10 /* lite flag */ ! #define CAVE_VIEW 0x20 /* view flag */ ! #define CAVE_TEMP 0x40 /* temp flag */ ! #define CAVE_XTRA 0x80 /* misc flag */ + /*** Object flags ***/ /* * Chest trap flags (see "tables.c") */ #define CHEST_LOSE_STR 0x01 *************** *** 1670,1676 **** #define CHEST_SUMMON 0x20 - /* * Special Object Flags */ --- 1728,1733 ---- *************** *** 1684,1722 **** #define IDENT_BROKEN 0x80 /* Item is permanently worthless */ - /* ! * Special Monster Flags (all temporary) */ ! #define MFLAG_VIEW 0x01 /* Monster is in line of sight */ ! /* xxx */ ! #define MFLAG_BORN 0x10 /* Monster is still being born */ ! #define MFLAG_NICE 0x20 /* Monster is still being nice */ ! #define MFLAG_SHOW 0x40 /* Monster is recently memorized */ ! #define MFLAG_MARK 0x80 /* Monster is currently memorized */ - /* * As of 2.7.8, the "object flags" are valid for all objects, and as ! * of 2.7.9, these flags are not actually stored with the object. * * Note that "flags1" contains all flags dependant on "pval" (including * stat bonuses, but NOT stat sustainers), plus all "extra attack damage" * flags (SLAY_XXX and BRAND_XXX). * ! * Note that "flags2" contains all "resistances" (including "Stat Sustainers", ! * actual immunities, and resistances). Note that "Hold Life" is really an ! * "immunity" to ExpLoss, and "Free Action" is "immunity to paralysis". * ! * Note that "flags3" contains everything else -- including the three "CURSED" ! * flags, and the "BLESSED" flag, several "item display" parameters, some new ! * flags for powerful Bows, and flags which affect the player in a "general" ! * way (LITE, TELEPATHY, SEE_INVIS, SLOW_DIGEST, REGEN, FEATHER), including ! * all the "general" curses (TELEPORT, AGGRAVATE, EXP_DRAIN). It also has ! * four new flags called "ITEM_IGNORE_XXX" which lets an item specify that ! * it can not be affected by various forms of destruction. This is NOT as ! * powerful as actually granting resistance/immunity to the wearer. */ #define TR1_STR 0x00000001L /* STR += "pval" */ --- 1741,1801 ---- #define IDENT_BROKEN 0x80 /* Item is permanently worthless */ /* ! * 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 ! #define SM_OPP_FIRE 0x00000004 ! #define SM_OPP_COLD 0x00000008 ! #define SM_OPP_POIS 0x00000010 ! #define SM_OPP_XXX1 0x00000020 ! #define SM_OPP_XXX2 0x00000040 ! #define SM_OPP_XXX3 0x00000080 ! #define SM_IMM_XXX5 0x00000100 ! #define SM_IMM_XXX6 0x00000200 ! #define SM_IMM_FREE 0x00000400 ! #define SM_IMM_MANA 0x00000800 ! #define SM_IMM_ACID 0x00001000 ! #define SM_IMM_ELEC 0x00002000 ! #define SM_IMM_FIRE 0x00004000 ! #define SM_IMM_COLD 0x00008000 ! #define SM_RES_ACID 0x00010000 ! #define SM_RES_ELEC 0x00020000 ! #define SM_RES_FIRE 0x00040000 ! #define SM_RES_COLD 0x00080000 ! #define SM_RES_POIS 0x00100000 ! #define SM_RES_FEAR 0x00200000 ! #define SM_RES_LITE 0x00400000 ! #define SM_RES_DARK 0x00800000 ! #define SM_RES_BLIND 0x01000000 ! #define SM_RES_CONFU 0x02000000 ! #define SM_RES_SOUND 0x04000000 ! #define SM_RES_SHARD 0x08000000 ! #define SM_RES_NEXUS 0x10000000 ! #define SM_RES_NETHR 0x20000000 ! #define SM_RES_CHAOS 0x40000000 ! #define SM_RES_DISEN 0x80000000 /* * As of 2.7.8, the "object flags" are valid for all objects, and as ! * of 2.7.9, these flags are not actually stored with the object, but ! * rather in the object_kind, ego_item, and artifact structures. * * Note that "flags1" contains all flags dependant on "pval" (including * stat bonuses, but NOT stat sustainers), plus all "extra attack damage" * flags (SLAY_XXX and BRAND_XXX). * ! * Note that "flags2" contains all "resistances" (including "sustain" flags, ! * immunity flags, and resistance flags). Note that "free action" and "hold ! * life" are no longer considered to be "immunities". * ! * Note that "flags3" contains everything else (including eight good flags, ! * seven unused flags, four bad flags, four damage ignoring flags, six weird ! * flags, and three cursed flags). */ #define TR1_STR 0x00000001L /* STR += "pval" */ *************** *** 1725,1732 **** #define TR1_DEX 0x00000008L /* DEX += "pval" */ #define TR1_CON 0x00000010L /* CON += "pval" */ #define TR1_CHR 0x00000020L /* CHR += "pval" */ ! #define TR1_XXX1 0x00000040L /* Later */ ! #define TR1_XXX2 0x00000080L /* Later */ #define TR1_STEALTH 0x00000100L /* Stealth += "pval" */ #define TR1_SEARCH 0x00000200L /* Search += "pval" */ #define TR1_INFRA 0x00000400L /* Infra += "pval" */ --- 1804,1811 ---- #define TR1_DEX 0x00000008L /* DEX += "pval" */ #define TR1_CON 0x00000010L /* CON += "pval" */ #define TR1_CHR 0x00000020L /* CHR += "pval" */ ! #define TR1_XXX1 0x00000040L /* (reserved) */ ! #define TR1_XXX2 0x00000080L /* (reserved) */ #define TR1_STEALTH 0x00000100L /* Stealth += "pval" */ #define TR1_SEARCH 0x00000200L /* Search += "pval" */ #define TR1_INFRA 0x00000400L /* Infra += "pval" */ *************** *** 1733,1825 **** #define TR1_TUNNEL 0x00000800L /* Tunnel += "pval" */ #define TR1_SPEED 0x00001000L /* Speed += "pval" */ #define TR1_BLOWS 0x00002000L /* Blows += "pval" */ ! #define TR1_XXX3 0x00004000L /* Later */ ! #define TR1_XXX4 0x00008000L /* Later */ ! #define TR1_SLAY_ANIMAL 0x00010000L ! #define TR1_SLAY_EVIL 0x00020000L ! #define TR1_SLAY_UNDEAD 0x00040000L ! #define TR1_SLAY_DEMON 0x00080000L ! #define TR1_SLAY_ORC 0x00100000L ! #define TR1_SLAY_TROLL 0x00200000L ! #define TR1_SLAY_GIANT 0x00400000L ! #define TR1_SLAY_DRAGON 0x00800000L ! #define TR1_KILL_DRAGON 0x01000000L /* Execute Dragon */ ! #define TR1_XXX5 0x02000000L /* Later */ ! #define TR1_IMPACT 0x04000000L /* Cause Earthquakes */ ! #define TR1_XXX6 0x08000000L /* Later */ ! #define TR1_BRAND_ACID 0x10000000L ! #define TR1_BRAND_ELEC 0x20000000L ! #define TR1_BRAND_FIRE 0x40000000L ! #define TR1_BRAND_COLD 0x80000000L ! #define TR2_SUST_STR 0x00000001L ! #define TR2_SUST_INT 0x00000002L ! #define TR2_SUST_WIS 0x00000004L ! #define TR2_SUST_DEX 0x00000008L ! #define TR2_SUST_CON 0x00000010L ! #define TR2_SUST_CHR 0x00000020L ! #define TR2_XXX1 0x00000040L /* Later */ ! #define TR2_XXX2 0x00000080L /* Later */ ! #define TR2_IM_ACID 0x00000100L ! #define TR2_IM_ELEC 0x00000200L ! #define TR2_IM_FIRE 0x00000400L ! #define TR2_IM_COLD 0x00000800L ! #define TR2_XXX3 0x00001000L /* Later */ ! #define TR2_XXX4 0x00002000L /* Later */ ! #define TR2_FREE_ACT 0x00004000L /* Free Action */ ! #define TR2_HOLD_LIFE 0x00008000L /* Hold Life */ ! #define TR2_RES_ACID 0x00010000L ! #define TR2_RES_ELEC 0x00020000L ! #define TR2_RES_FIRE 0x00040000L ! #define TR2_RES_COLD 0x00080000L ! #define TR2_RES_POIS 0x00100000L ! #define TR2_XXX5 0x00200000L /* Later */ ! #define TR2_RES_LITE 0x00400000L ! #define TR2_RES_DARK 0x00800000L ! #define TR2_RES_BLIND 0x01000000L ! #define TR2_RES_CONF 0x02000000L ! #define TR2_RES_SOUND 0x04000000L ! #define TR2_RES_SHARDS 0x08000000L ! #define TR2_RES_NETHER 0x10000000L ! #define TR2_RES_NEXUS 0x20000000L ! #define TR2_RES_CHAOS 0x40000000L ! #define TR2_RES_DISEN 0x80000000L - #define TR3_XXX1 0x00000001L /* Later */ - #define TR3_XXX2 0x00000002L /* Later */ - #define TR3_XXX3 0x00000004L /* Later */ - #define TR3_XXX4 0x00000008L /* Later */ - #define TR3_XXX5 0x00000010L /* Later */ - #define TR3_XXX6 0x00000020L /* Later */ - #define TR3_XXX7 0x00000040L /* Later */ - #define TR3_XXX8 0x00000080L /* Later */ - #define TR3_EASY_KNOW 0x00000100L /* Aware -> Known */ - #define TR3_HIDE_TYPE 0x00000200L /* Hide "pval" description */ - #define TR3_SHOW_MODS 0x00000400L /* Always show Tohit/Todam */ - #define TR3_INSTA_ART 0x00000800L /* Item must be an artifact */ - #define TR3_FEATHER 0x00001000L /* Feather Falling */ - #define TR3_LITE 0x00002000L /* Permanent Light */ - #define TR3_SEE_INVIS 0x00004000L /* See Invisible */ - #define TR3_TELEPATHY 0x00008000L /* Telepathy */ - #define TR3_SLOW_DIGEST 0x00010000L /* Item slows down digestion */ - #define TR3_REGEN 0x00020000L /* Item induces regeneration */ - #define TR3_XTRA_MIGHT 0x00040000L /* Bows get extra multiplier */ - #define TR3_XTRA_SHOTS 0x00080000L /* Bows get extra shots */ - #define TR3_IGNORE_ACID 0x00100000L /* Item ignores Acid Damage */ - #define TR3_IGNORE_ELEC 0x00200000L /* Item ignores Elec Damage */ - #define TR3_IGNORE_FIRE 0x00400000L /* Item ignores Fire Damage */ - #define TR3_IGNORE_COLD 0x00800000L /* Item ignores Cold Damage */ - #define TR3_ACTIVATE 0x01000000L /* Item can be activated */ - #define TR3_DRAIN_EXP 0x02000000L /* Item drains Experience */ - #define TR3_TELEPORT 0x04000000L /* Item teleports player */ - #define TR3_AGGRAVATE 0x08000000L /* Item aggravates monsters */ - #define TR3_BLESSED 0x10000000L /* Item is Blessed */ - #define TR3_CURSED 0x20000000L /* Item is Cursed */ - #define TR3_HEAVY_CURSE 0x40000000L /* Item is Heavily Cursed */ - #define TR3_PERMA_CURSE 0x80000000L /* Item is Perma Cursed */ - /* * Hack -- flag set 1 -- mask for "pval-dependant" flags. * Note that all "pval" dependant flags must be in "flags1". --- 1812,1903 ---- #define TR1_TUNNEL 0x00000800L /* Tunnel += "pval" */ #define TR1_SPEED 0x00001000L /* Speed += "pval" */ #define TR1_BLOWS 0x00002000L /* Blows += "pval" */ ! #define TR1_SHOTS 0x00004000L /* Shots += "pval" */ ! #define TR1_MIGHT 0x00008000L /* Might += "pval" */ ! #define TR1_SLAY_ANIMAL 0x00010000L /* Weapon slays animals */ ! #define TR1_SLAY_EVIL 0x00020000L /* Weapon slays evil */ ! #define TR1_SLAY_UNDEAD 0x00040000L /* Weapon slays undead */ ! #define TR1_SLAY_DEMON 0x00080000L /* Weapon slays demon */ ! #define TR1_SLAY_ORC 0x00100000L /* Weapon slays orc */ ! #define TR1_SLAY_TROLL 0x00200000L /* Weapon slays troll */ ! #define TR1_SLAY_GIANT 0x00400000L /* Weapon slays giant */ ! #define TR1_SLAY_DRAGON 0x00800000L /* Weapon slays dragon */ ! #define TR1_KILL_DRAGON 0x01000000L /* Weapon kills dragon */ ! #define TR1_XXX5 0x02000000L ! #define TR1_XXX6 0x04000000L ! #define TR1_XXX7 0x08000000L ! #define TR1_BRAND_ACID 0x10000000L /* Weapon has acid brand */ ! #define TR1_BRAND_ELEC 0x20000000L /* Weapon has elec brand */ ! #define TR1_BRAND_FIRE 0x40000000L /* Weapon has fire brand */ ! #define TR1_BRAND_COLD 0x80000000L /* Weapon has cold brand */ ! #define TR2_SUST_STR 0x00000001L /* Sustain STR */ ! #define TR2_SUST_INT 0x00000002L /* Sustain INT */ ! #define TR2_SUST_WIS 0x00000004L /* Sustain WIS */ ! #define TR2_SUST_DEX 0x00000008L /* Sustain DEX */ ! #define TR2_SUST_CON 0x00000010L /* Sustain CON */ ! #define TR2_SUST_CHR 0x00000020L /* Sustain CHR */ ! #define TR2_XXX1 0x00000040L /* (reserved) */ ! #define TR2_XXX2 0x00000080L /* (reserved) */ ! #define TR2_XXX3 0x00001000L /* (reserved) */ ! #define TR2_XXX4 0x00002000L /* (reserved) */ ! #define TR2_XXX5 0x00004000L /* (reserved) */ ! #define TR2_XXX6 0x00008000L /* (reserved) */ ! #define TR2_IM_ACID 0x00001000L /* Immunity to acid */ ! #define TR2_IM_ELEC 0x00002000L /* Immunity to elec */ ! #define TR2_IM_FIRE 0x00004000L /* Immunity to fire */ ! #define TR2_IM_COLD 0x00008000L /* Immunity to cold */ ! #define TR2_RES_ACID 0x00010000L /* Resist acid */ ! #define TR2_RES_ELEC 0x00020000L /* Resist elec */ ! #define TR2_RES_FIRE 0x00040000L /* Resist fire */ ! #define TR2_RES_COLD 0x00080000L /* Resist cold */ ! #define TR2_RES_POIS 0x00100000L /* Resist poison */ ! #define TR2_RES_FEAR 0x00200000L /* Resist fear */ ! #define TR2_RES_LITE 0x00400000L /* Resist lite */ ! #define TR2_RES_DARK 0x00800000L /* Resist dark */ ! #define TR2_RES_BLIND 0x01000000L /* Resist blind */ ! #define TR2_RES_CONFU 0x02000000L /* Resist confusion */ ! #define TR2_RES_SOUND 0x04000000L /* Resist sound */ ! #define TR2_RES_SHARD 0x08000000L /* Resist shards */ ! #define TR2_RES_NEXUS 0x10000000L /* Resist nexus */ ! #define TR2_RES_NETHR 0x20000000L /* Resist nether */ ! #define TR2_RES_CHAOS 0x40000000L /* Resist chaos */ ! #define TR2_RES_DISEN 0x80000000L /* Resist disenchant */ + #define TR3_SLOW_DIGEST 0x00000001L /* Slow digest */ + #define TR3_FEATHER 0x00000002L /* Feather Falling */ + #define TR3_LITE 0x00000004L /* Perma-Lite */ + #define TR3_REGEN 0x00000008L /* Regeneration */ + #define TR3_TELEPATHY 0x00000010L /* Telepathy */ + #define TR3_SEE_INVIS 0x00000020L /* See Invis */ + #define TR3_FREE_ACT 0x00000040L /* Free action */ + #define TR3_HOLD_LIFE 0x00000080L /* Hold life */ + #define TR3_XXX1 0x00000100L + #define TR3_XXX2 0x00000200L + #define TR3_XXX3 0x00000400L + #define TR3_XXX4 0x00000800L + #define TR3_IMPACT 0x00001000L /* Earthquake blows */ + #define TR3_TELEPORT 0x00002000L /* Random teleportation */ + #define TR3_AGGRAVATE 0x00004000L /* Aggravate monsters */ + #define TR3_DRAIN_EXP 0x00008000L /* Experience drain */ + #define TR3_IGNORE_ACID 0x00010000L /* Item ignores Acid Damage */ + #define TR3_IGNORE_ELEC 0x00020000L /* Item ignores Elec Damage */ + #define TR3_IGNORE_FIRE 0x00040000L /* Item ignores Fire Damage */ + #define TR3_IGNORE_COLD 0x00080000L /* Item ignores Cold Damage */ + #define TR3_XXX5 0x00100000L /* (reserved) */ + #define TR3_XXX6 0x00200000L /* (reserved) */ + #define TR3_BLESSED 0x00400000L /* Item has been blessed */ + #define TR3_ACTIVATE 0x00800000L /* Item can be activated */ + #define TR3_INSTA_ART 0x01000000L /* Item makes an artifact */ + #define TR3_EASY_KNOW 0x02000000L /* Item is known if aware */ + #define TR3_HIDE_TYPE 0x04000000L /* Item hides description */ + #define TR3_SHOW_MODS 0x08000000L /* Item shows Tohit/Todam */ + #define TR3_XXX7 0x10000000L /* (reserved) */ + #define TR3_LIGHT_CURSE 0x20000000L /* Item has Light Curse */ + #define TR3_HEAVY_CURSE 0x40000000L /* Item has Heavy Curse */ + #define TR3_PERMA_CURSE 0x80000000L /* Item has Perma Curse */ /* * Hack -- flag set 1 -- mask for "pval-dependant" flags. * Note that all "pval" dependant flags must be in "flags1". *************** *** 1828,1907 **** (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_XXX3 | TR1_XXX4) ! /*** Monster blow constants ***/ /* ! * New monster blow methods */ ! #define RBM_HIT 1 ! #define RBM_TOUCH 2 ! #define RBM_PUNCH 3 ! #define RBM_KICK 4 ! #define RBM_CLAW 5 ! #define RBM_BITE 6 ! #define RBM_STING 7 ! #define RBM_XXX1 8 ! #define RBM_BUTT 9 ! #define RBM_CRUSH 10 ! #define RBM_ENGULF 11 ! #define RBM_XXX2 12 ! #define RBM_CRAWL 13 ! #define RBM_DROOL 14 ! #define RBM_SPIT 15 ! #define RBM_XXX3 16 ! #define RBM_GAZE 17 ! #define RBM_WAIL 18 ! #define RBM_SPORE 19 ! #define RBM_XXX4 20 ! #define RBM_BEG 21 ! #define RBM_INSULT 22 ! #define RBM_MOAN 23 ! #define RBM_XXX5 24 /* - * New monster blow effects - */ - #define RBE_HURT 1 - #define RBE_POISON 2 - #define RBE_UN_BONUS 3 - #define RBE_UN_POWER 4 - #define RBE_EAT_GOLD 5 - #define RBE_EAT_ITEM 6 - #define RBE_EAT_FOOD 7 - #define RBE_EAT_LITE 8 - #define RBE_ACID 9 - #define RBE_ELEC 10 - #define RBE_FIRE 11 - #define RBE_COLD 12 - #define RBE_BLIND 13 - #define RBE_CONFUSE 14 - #define RBE_TERRIFY 15 - #define RBE_PARALYZE 16 - #define RBE_LOSE_STR 17 - #define RBE_LOSE_INT 18 - #define RBE_LOSE_WIS 19 - #define RBE_LOSE_DEX 20 - #define RBE_LOSE_CON 21 - #define RBE_LOSE_CHR 22 - #define RBE_LOSE_ALL 23 - #define RBE_SHATTER 24 - #define RBE_EXP_10 25 - #define RBE_EXP_20 26 - #define RBE_EXP_40 27 - #define RBE_EXP_80 28 - - - - /*** Monster flag values (hard-coded) ***/ - - - /* * New monster race bit flags */ #define RF1_UNIQUE 0x00000001 /* Unique Monster */ --- 1906,1930 ---- (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) ! /*** Monster flags ***/ /* ! * Special Monster Flags (all temporary) */ ! #define MFLAG_VIEW 0x01 /* Monster is in line of sight */ ! /* xxx */ ! #define MFLAG_BORN 0x10 /* Monster is still being born */ ! #define MFLAG_NICE 0x20 /* Monster is still being nice */ ! #define MFLAG_SHOW 0x40 /* Monster is recently memorized */ ! #define MFLAG_MARK 0x80 /* Monster is currently memorized */ /* * New monster race bit flags */ #define RF1_UNIQUE 0x00000001 /* Unique Monster */ *************** *** 2222,2242 **** /* ! * Determines if a map location is fully inside the outer walls */ #define in_bounds(Y,X) \ ! (((Y) > 0) && ((X) > 0) && ((Y) < cur_hgt-1) && ((X) < cur_wid-1)) /* ! * Determines if a map location is on or inside the outer walls */ ! #define in_bounds2(Y,X) \ ! (((Y) >= 0) && ((X) >= 0) && ((Y) < cur_hgt) && ((X) < cur_wid)) /* ! * Determines if a map location is currently "on screen" -RAK- ! * Note that "panel_contains(Y,X)" always implies "in_bounds2(Y,X)". */ #define panel_contains(Y,X) \ (((Y) >= panel_row_min) && ((Y) <= panel_row_max) && \ --- 2245,2270 ---- /* ! * Determines if a map location is defined ! * Note the hack involving casting the args to unsigned */ #define in_bounds(Y,X) \ ! (((unsigned)(Y) < (unsigned)(cur_hgt)) && \ ! ((unsigned)(X) < (unsigned)(cur_wid))) /* ! * Determines if a map location is fully inside the outer walls ! * This is more than twice as expensive as "in_bounds()", but ! * often we need to exclude the outer walls from calculations. */ ! #define in_bounds_fully(Y,X) \ ! (((Y) > 0) && ((Y) < cur_hgt-1) && \ ! ((X) > 0) && ((X) < cur_wid-1)) /* ! * Determines if a map location is currently "on screen" ! * Note that "panel_contains(Y,X)" always implies "in_bounds(Y,X)". */ #define panel_contains(Y,X) \ (((Y) >= panel_row_min) && ((Y) <= panel_row_max) && \ *************** *** 2276,2282 **** #define cave_empty_bold(Y,X) \ (cave_floor_bold(Y,X) && \ !(cave[Y][X].m_idx) && \ ! !(((Y) == py) && ((X) == px))) /* * Determine if a "legal" grid is an "naked" floor grid --- 2304,2310 ---- #define cave_empty_bold(Y,X) \ (cave_floor_bold(Y,X) && \ !(cave[Y][X].m_idx) && \ ! !(((Y) == p_ptr->py) && ((X) == p_ptr->px))) /* * Determine if a "legal" grid is an "naked" floor grid *************** *** 2290,2296 **** ((cave[Y][X].feat == FEAT_FLOOR) && \ !(cave[Y][X].o_idx) && \ !(cave[Y][X].m_idx) && \ ! !(((Y) == py) && ((X) == px))) /* --- 2318,2324 ---- ((cave[Y][X].feat == FEAT_FLOOR) && \ !(cave[Y][X].o_idx) && \ !(cave[Y][X].m_idx) && \ ! !(((Y) == p_ptr->py) && ((X) == p_ptr->px))) /* *************** *** 2328,2334 **** #define cave_empty_grid(C) \ (cave_floor_grid(C) && \ !((C)->m_idx) && \ ! !((C) == &cave[py][px])) /* * Grid based version of "cave_empty_bold()" --- 2356,2362 ---- #define cave_empty_grid(C) \ (cave_floor_grid(C) && \ !((C)->m_idx) && \ ! !((C) == &cave[p_ptr->py][p_ptr->px])) /* * Grid based version of "cave_empty_bold()" *************** *** 2337,2343 **** (((C)->feat == FEAT_FLOOR) && \ !((C)->o_idx) && \ !((C)->m_idx) && \ ! !((C) == &cave[py][px])) /* --- 2365,2371 ---- (((C)->feat == FEAT_FLOOR) && \ !((C)->o_idx) && \ !((C)->m_idx) && \ ! !((C) == &cave[p_ptr->py][p_ptr->px])) /* diff -r -c -w src-281/dungeon.c angband-281/src/dungeon.c *** src-281/dungeon.c Mon Mar 3 22:20:47 1997 --- angband-281/src/dungeon.c Thu Apr 24 10:23:45 1997 *************** *** 280,286 **** /* ! * Regenerate hit points -RAK- */ static void regenhp(int percent) { --- 280,286 ---- /* ! * Regenerate hit points */ static void regenhp(int percent) { *************** *** 327,333 **** /* ! * Regenerate mana points -RAK- */ static void regenmana(int percent) { --- 327,333 ---- /* ! * Regenerate mana points */ static void regenmana(int percent) { *************** *** 477,483 **** /*** Handle the "town" (stores and sunshine) ***/ /* While in town */ ! if (!dun_level) { /* Hack -- Daybreak/Nighfall in town */ if (!(turn % ((10L * TOWN_DAWN) / 2))) --- 477,483 ---- /*** Handle the "town" (stores and sunshine) ***/ /* While in town */ ! if (!p_ptr->depth) { /* Hack -- Daybreak/Nighfall in town */ if (!(turn % ((10L * TOWN_DAWN) / 2))) *************** *** 721,727 **** } /* Searching or Resting */ ! if (p_ptr->searching || resting) { regen_amount = regen_amount * 2; } --- 721,727 ---- } /* Searching or Resting */ ! if (p_ptr->searching || p_ptr->resting) { regen_amount = regen_amount * 2; } *************** *** 1059,1075 **** disturb(0, 0); /* Determine the level */ ! if (dun_level) { msg_print("You feel yourself yanked upwards!"); ! dun_level = 0; new_level_flag = TRUE; } else { msg_print("You feel yourself yanked downwards!"); ! dun_level = p_ptr->max_dlv; ! if (dun_level < 1) dun_level = 1; new_level_flag = TRUE; } --- 1059,1075 ---- disturb(0, 0); /* Determine the level */ ! if (p_ptr->depth) { msg_print("You feel yourself yanked upwards!"); ! p_ptr->depth = 0; new_level_flag = TRUE; } else { msg_print("You feel yourself yanked downwards!"); ! p_ptr->depth = p_ptr->max_depth; ! if (p_ptr->depth < 1) p_ptr->depth = 1; new_level_flag = TRUE; } *************** *** 1325,1331 **** } /* Hack -- toggle windows */ ! case KTRL('I'): { toggle_inven_equip(); break; --- 1325,1331 ---- } /* Hack -- toggle windows */ ! case KTRL('E'): { toggle_inven_equip(); break; *************** *** 1348,1364 **** break; } ! /* Move (usually pick up things) */ case ';': { ! do_cmd_walk(always_pickup); break; } ! /* Move (usually do not pick up) */ case '-': { ! do_cmd_walk(!always_pickup); break; } --- 1348,1364 ---- break; } ! /* Walk */ case ';': { ! do_cmd_walk(); break; } ! /* Jump */ case '-': { ! do_cmd_jump(); break; } *************** *** 1372,1388 **** break; } ! /* Stay still (usually pick things up) */ case ',': { ! do_cmd_stay(always_pickup); break; } ! /* Stay still (usually do not pick up) */ case 'g': { ! do_cmd_stay(!always_pickup); break; } --- 1372,1388 ---- break; } ! /* Hold still */ case ',': { ! do_cmd_hold(); break; } ! /* Stay still */ case 'g': { ! do_cmd_stay(); break; } *************** *** 1622,1628 **** /* Help */ case '?': { ! do_cmd_help("help.hlp"); break; } --- 1622,1628 ---- /* Help */ case '?': { ! do_cmd_help(); break; } *************** *** 1755,1771 **** break; } ! /* Check artifacts */ case '~': - { - do_cmd_check_artifacts(); - break; - } - - /* Check uniques */ case '|': { ! do_cmd_check_uniques(); break; } --- 1755,1765 ---- break; } ! /* Check knowledge */ case '~': case '|': { ! do_cmd_knowledge(); break; } *************** *** 1794,1800 **** --- 1788,1872 ---- + /* + * Hack -- helper function for "process_player()" + * + * Check for changes in the "monster memory" + */ + static void process_player_aux(void) + { + static int old_monster_race_idx = 0; + static u32b old_r_flags1 = 0L; + static u32b old_r_flags2 = 0L; + static u32b old_r_flags3 = 0L; + static u32b old_r_flags4 = 0L; + static u32b old_r_flags5 = 0L; + static u32b old_r_flags6 = 0L; + + static byte old_r_blows0 = 0; + static byte old_r_blows1 = 0; + static byte old_r_blows2 = 0; + static byte old_r_blows3 = 0; + + static byte old_r_cast_inate = 0; + static byte old_r_cast_spell = 0; + + + /* Tracking a monster */ + if (monster_race_idx) + { + monster_race *r_ptr; + + /* Acquire monster race */ + r_ptr = &r_info[monster_race_idx]; + + /* Check for change of any kind */ + if ((old_monster_race_idx != monster_race_idx) || + (old_r_flags1 != r_ptr->r_flags1) || + (old_r_flags2 != r_ptr->r_flags2) || + (old_r_flags3 != r_ptr->r_flags3) || + (old_r_flags4 != r_ptr->r_flags4) || + (old_r_flags5 != r_ptr->r_flags5) || + (old_r_flags6 != r_ptr->r_flags6) || + (old_r_blows0 != r_ptr->r_blows[0]) || + (old_r_blows1 != r_ptr->r_blows[1]) || + (old_r_blows2 != r_ptr->r_blows[2]) || + (old_r_blows3 != r_ptr->r_blows[3]) || + (old_r_cast_inate != r_ptr->r_cast_inate) || + (old_r_cast_spell != r_ptr->r_cast_spell)) + { + /* Memorize old race */ + old_monster_race_idx = monster_race_idx; + + /* Memorize flags */ + old_r_flags1 = r_ptr->r_flags1; + old_r_flags2 = r_ptr->r_flags2; + old_r_flags3 = r_ptr->r_flags3; + old_r_flags4 = r_ptr->r_flags4; + old_r_flags5 = r_ptr->r_flags5; + old_r_flags6 = r_ptr->r_flags6; + + /* Memorize blows */ + old_r_blows0 = r_ptr->r_blows[0]; + old_r_blows1 = r_ptr->r_blows[1]; + old_r_blows2 = r_ptr->r_blows[2]; + old_r_blows3 = r_ptr->r_blows[3]; + + /* Memorize castings */ + old_r_cast_inate = r_ptr->r_cast_inate; + old_r_cast_spell = r_ptr->r_cast_spell; + + /* Window stuff */ + p_ptr->window |= (PW_MONSTER); + + /* Window stuff */ + window_stuff(); + } + } + } + + /* * Process the player * *************** *** 1801,1806 **** --- 1873,1884 ---- * Notice the annoying code to handle "pack overflow", which * must come first just in case somebody manages to corrupt * the savefiles by clever use of menu commands or something. + * + * Notice the annoying code to handle "monster memory" changes, + * which allows us to avoid having to update the window flags + * every time we change any internal monster memory field, and + * also reduces the number of times that the recall window must + * be redrawn. */ static void process_player(void) { *************** *** 1819,1828 **** /*** Check for interupts ***/ /* Complete resting */ ! if (resting < 0) { /* Basic resting */ ! if (resting == -1) { /* Stop resting */ if ((p_ptr->chp == p_ptr->mhp) && --- 1897,1906 ---- /*** Check for interupts ***/ /* Complete resting */ ! if (p_ptr->resting < 0) { /* Basic resting */ ! if (p_ptr->resting == -1) { /* Stop resting */ if ((p_ptr->chp == p_ptr->mhp) && *************** *** 1833,1839 **** } /* Complete resting */ ! else if (resting == -2) { /* Stop resting */ if ((p_ptr->chp == p_ptr->mhp) && --- 1911,1917 ---- } /* Complete resting */ ! else if (p_ptr->resting == -2) { /* Stop resting */ if ((p_ptr->chp == p_ptr->mhp) && *************** *** 1853,1859 **** if (!avoid_abort) { /* Check for "player abort" (semi-efficiently for resting) */ ! if (running || command_rep || (resting && !(resting & 0x0F))) { /* Do not wait */ inkey_scan = TRUE; --- 1931,1937 ---- if (!avoid_abort) { /* Check for "player abort" (semi-efficiently for resting) */ ! if (p_ptr->running || command_rep || (p_ptr->resting && !(p_ptr->resting & 0x0F))) { /* Do not wait */ inkey_scan = TRUE; *************** *** 1893,1899 **** /* Place the cursor on the player */ ! move_cursor_relative(py, px); /* Refresh (optional) */ if (fresh_before) Term_fresh(); --- 1971,1977 ---- /* Place the cursor on the player */ ! move_cursor_relative(p_ptr->py, p_ptr->px); /* Refresh (optional) */ if (fresh_before) Term_fresh(); *************** *** 1924,1930 **** msg_format("You drop %s (%c).", o_name, index_to_label(item)); /* Drop it (carefully) near the player */ ! drop_near(o_ptr, 0, py, px); /* Modify, Describe, Optimize */ inven_item_increase(item, -255); --- 2002,2008 ---- msg_format("You drop %s (%c).", o_name, index_to_label(item)); /* Drop it (carefully) near the player */ ! drop_near(o_ptr, 0, p_ptr->py, p_ptr->px); /* Modify, Describe, Optimize */ inven_item_increase(item, -255); *************** *** 1940,1946 **** /* Redraw stuff (if needed) */ if (p_ptr->redraw) redraw_stuff(); ! /* Redraw stuff (if needed) */ if (p_ptr->window) window_stuff(); } --- 2018,2024 ---- /* Redraw stuff (if needed) */ if (p_ptr->redraw) redraw_stuff(); ! /* Window stuff (if needed) */ if (p_ptr->window) window_stuff(); } *************** *** 1961,1973 **** } /* Resting */ ! else if (resting) { /* Timed rest */ ! if (resting > 0) { /* Reduce rest count */ ! resting--; /* Redraw the state */ p_ptr->redraw |= (PR_STATE); --- 2039,2051 ---- } /* Resting */ ! else if (p_ptr->resting) { /* Timed rest */ ! if (p_ptr->resting > 0) { /* Reduce rest count */ ! p_ptr->resting--; /* Redraw the state */ p_ptr->redraw |= (PR_STATE); *************** *** 1978,1984 **** } /* Running */ ! else if (running) { /* Take a step */ run_step(0); --- 2056,2062 ---- } /* Running */ ! else if (p_ptr->running) { /* Take a step */ run_step(0); *************** *** 1994,2000 **** p_ptr->redraw |= (PR_STATE); /* Redraw stuff */ ! redraw_stuff(); /* Hack -- Assume messages were seen */ msg_flag = FALSE; --- 2072,2078 ---- p_ptr->redraw |= (PR_STATE); /* Redraw stuff */ ! /* redraw_stuff(); */ /* Hack -- Assume messages were seen */ msg_flag = FALSE; *************** *** 2009,2016 **** /* Normal command */ else { /* Place the cursor on the player */ ! move_cursor_relative(py, px); /* Get a command (normal) */ request_command(FALSE); --- 2087,2097 ---- /* Normal command */ else { + /* Check monster recall */ + process_player_aux(); + /* Place the cursor on the player */ ! move_cursor_relative(p_ptr->py, p_ptr->px); /* Get a command (normal) */ request_command(FALSE); *************** *** 2065,2078 **** } } ! ! /* Handle monster detection */ ! if (repair_monsters) { ! /* Reset the flag */ ! repair_monsters = FALSE; ! /* Rotate detection flags */ for (i = 1; i < m_max; i++) { monster_type *m_ptr; --- 2146,2158 ---- } } ! /* Repair "nice" flags */ ! if (repair_mflag_nice) { ! /* Clear flag */ ! repair_mflag_nice = FALSE; ! /* Process monsters */ for (i = 1; i < m_max; i++) { monster_type *m_ptr; *************** *** 2081,2127 **** m_ptr = &m_list[i]; /* Skip dead monsters */ ! if (!m_ptr->r_idx) continue; ! /* Nice monsters get mean */ ! if (m_ptr->mflag & (MFLAG_NICE)) ! { ! /* Nice monsters get mean */ m_ptr->mflag &= ~(MFLAG_NICE); } ! /* Handle memorized monsters */ if (m_ptr->mflag & (MFLAG_MARK)) { ! /* Maintain detection */ if (m_ptr->mflag & (MFLAG_SHOW)) { ! /* Forget flag */ ! m_ptr->mflag &= ~(MFLAG_SHOW); ! /* Still need repairs */ ! repair_monsters = TRUE; } - /* Remove detection */ - else - { /* Forget flag */ m_ptr->mflag &= ~(MFLAG_MARK); - /* Assume invisible */ - m_ptr->ml = FALSE; - /* Update the monster */ update_mon(i, FALSE); - - /* Redraw regardless */ - lite_spot(m_ptr->fy, m_ptr->fx); } } } } } /* Hack -- notice death or departure */ --- 2161,2234 ---- m_ptr = &m_list[i]; /* Skip dead monsters */ ! /* if (!m_ptr->r_idx) continue; */ ! /* Clear "nice" flag */ m_ptr->mflag &= ~(MFLAG_NICE); } + } ! /* Repair "mark" flags */ ! if (repair_mflag_mark) ! { ! /* Reset the flag */ ! repair_mflag_mark = FALSE; ! ! /* Process the monsters */ ! for (i = 1; i < m_max; i++) ! { ! monster_type *m_ptr; ! ! /* Access monster */ ! m_ptr = &m_list[i]; ! ! /* Skip dead monsters */ ! /* if (!m_ptr->r_idx) continue; */ ! ! /* Repair "mark" flag */ if (m_ptr->mflag & (MFLAG_MARK)) { ! /* Skip "show" monsters */ if (m_ptr->mflag & (MFLAG_SHOW)) { ! /* Repair "mark" flag */ ! repair_mflag_mark = TRUE; ! /* Skip */ ! continue; } /* Forget flag */ m_ptr->mflag &= ~(MFLAG_MARK); /* Update the monster */ update_mon(i, FALSE); } } } } + + /* Repair "show" flags */ + if (repair_mflag_show) + { + /* Reset the flag */ + repair_mflag_show = FALSE; + + /* Process the monsters */ + for (i = 1; i < m_max; i++) + { + monster_type *m_ptr; + + /* Access monster */ + m_ptr = &m_list[i]; + + /* Skip dead monsters */ + /* if (!m_ptr->r_idx) continue; */ + + /* Clear "show" flag */ + m_ptr->mflag &= ~(MFLAG_SHOW); } + } /* Hack -- notice death or departure */ *************** *** 2158,2193 **** health_track(0); ! /* Check visual effects */ shimmer_monsters = TRUE; shimmer_objects = TRUE; - repair_monsters = TRUE; - repair_objects = TRUE; /* Disturb */ disturb(1, 0); /* Track maximum player level */ ! if (p_ptr->max_plv < p_ptr->lev) { ! p_ptr->max_plv = p_ptr->lev; } /* Track maximum dungeon level */ ! if (p_ptr->max_dlv < dun_level) { ! p_ptr->max_dlv = dun_level; } /* Paranoia -- No stairs down from Quest */ ! if (is_quest(dun_level)) create_down_stair = FALSE; /* Paranoia -- no stairs from town */ ! if (!dun_level) create_down_stair = create_up_stair = FALSE; /* Option -- no connected stairs */ if (!dungeon_stair) create_down_stair = create_up_stair = FALSE; --- 2265,2304 ---- health_track(0); ! /* Reset shimmer flags */ shimmer_monsters = TRUE; shimmer_objects = TRUE; + /* Reset repair flags */ + repair_mflag_born = TRUE; + repair_mflag_nice = TRUE; + repair_mflag_show = TRUE; + repair_mflag_mark = TRUE; + /* Disturb */ disturb(1, 0); /* Track maximum player level */ ! if (p_ptr->max_lev < p_ptr->lev) { ! p_ptr->max_lev = p_ptr->lev; } /* Track maximum dungeon level */ ! if (p_ptr->max_depth < p_ptr->depth) { ! p_ptr->max_depth = p_ptr->depth; } /* Paranoia -- No stairs down from Quest */ ! if (is_quest(p_ptr->depth)) create_down_stair = FALSE; /* Paranoia -- no stairs from town */ ! if (!p_ptr->depth) create_down_stair = create_up_stair = FALSE; /* Option -- no connected stairs */ if (!dungeon_stair) create_down_stair = create_up_stair = FALSE; *************** *** 2196,2214 **** if (create_up_stair || create_down_stair) { /* Place a stairway */ ! if (cave_valid_bold(py, px)) { /* XXX XXX XXX */ ! delete_object(py, px); /* Make stairs */ if (create_down_stair) { ! cave_set_feat(py, px, FEAT_MORE); } else { ! cave_set_feat(py, px, FEAT_LESS); } } --- 2307,2325 ---- if (create_up_stair || create_down_stair) { /* Place a stairway */ ! if (cave_valid_bold(p_ptr->py, p_ptr->px)) { /* XXX XXX XXX */ ! delete_object(p_ptr->py, p_ptr->px); /* Make stairs */ if (create_down_stair) { ! cave_set_feat(p_ptr->py, p_ptr->px, FEAT_MORE); } else { ! cave_set_feat(p_ptr->py, p_ptr->px, FEAT_LESS); } } *************** *** 2218,2229 **** /* Choose a panel row */ ! panel_row = ((py - SCREEN_HGT / 4) / (SCREEN_HGT / 2)); if (panel_row > max_panel_rows) panel_row = max_panel_rows; else if (panel_row < 0) panel_row = 0; /* Choose a panel col */ ! panel_col = ((px - SCREEN_WID / 4) / (SCREEN_WID / 2)); if (panel_col > max_panel_cols) panel_col = max_panel_cols; else if (panel_col < 0) panel_col = 0; --- 2329,2340 ---- /* Choose a panel row */ ! panel_row = ((p_ptr->py - SCREEN_HGT / 4) / (SCREEN_HGT / 2)); if (panel_row > max_panel_rows) panel_row = max_panel_rows; else if (panel_row < 0) panel_row = 0; /* Choose a panel col */ ! panel_col = ((p_ptr->px - SCREEN_WID / 4) / (SCREEN_WID / 2)); if (panel_col > max_panel_cols) panel_col = max_panel_cols; else if (panel_col < 0) panel_col = 0; *************** *** 2303,2309 **** /* Announce (or repeat) the feeling */ ! if (dun_level) do_cmd_feeling(); /* Hack -- notice death or departure */ --- 2414,2420 ---- /* Announce (or repeat) the feeling */ ! if (p_ptr->depth) do_cmd_feeling(); /* Hack -- notice death or departure */ *************** *** 2313,2322 **** /*** Process this dungeon level ***/ /* Reset the monster generation level */ ! monster_level = dun_level; /* Reset the object generation level */ ! object_level = dun_level; /* Main loop */ while (TRUE) --- 2424,2433 ---- /*** Process this dungeon level ***/ /* Reset the monster generation level */ ! monster_level = p_ptr->depth; /* Reset the object generation level */ ! object_level = p_ptr->depth; /* Main loop */ while (TRUE) *************** *** 2351,2357 **** if (p_ptr->window) window_stuff(); /* Hack -- Hilite the player */ ! move_cursor_relative(py, px); /* Optional fresh */ if (fresh_after) Term_fresh(); --- 2462,2468 ---- if (p_ptr->window) window_stuff(); /* Hack -- Hilite the player */ ! move_cursor_relative(p_ptr->py, p_ptr->px); /* Optional fresh */ if (fresh_after) Term_fresh(); *************** *** 2376,2382 **** if (p_ptr->window) window_stuff(); /* Hack -- Hilite the player */ ! move_cursor_relative(py, px); /* Optional fresh */ if (fresh_after) Term_fresh(); --- 2487,2493 ---- if (p_ptr->window) window_stuff(); /* Hack -- Hilite the player */ ! move_cursor_relative(p_ptr->py, p_ptr->px); /* Optional fresh */ if (fresh_after) Term_fresh(); *************** *** 2401,2407 **** if (p_ptr->window) window_stuff(); /* Hack -- Hilite the player */ ! move_cursor_relative(py, px); /* Optional fresh */ if (fresh_after) Term_fresh(); --- 2512,2518 ---- if (p_ptr->window) window_stuff(); /* Hack -- Hilite the player */ ! move_cursor_relative(p_ptr->py, p_ptr->px); /* Optional fresh */ if (fresh_after) Term_fresh(); *************** *** 2417,2447 **** - /* ! * Load some "user pref files" */ ! static void load_all_pref_files(void) { ! char buf[1024]; ! /* Access the "race" pref file */ ! sprintf(buf, "%s.prf", rp_ptr->title); ! /* Process that file */ ! process_pref_file(buf); ! /* Access the "class" pref file */ ! sprintf(buf, "%s.prf", cp_ptr->title); ! ! /* Process that file */ ! process_pref_file(buf); ! ! /* Access the "character" pref file */ ! sprintf(buf, "%s.prf", player_base); ! ! /* Process that file */ ! process_pref_file(buf); } --- 2528,2548 ---- /* ! * 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" file */ ! sprintf(buf, "%s.prf", p_ptr->base_name); ! /* Process the "user.prf" file */ ! (void)process_pref_file(buf); } *************** *** 2451,2462 **** * 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. */ void play_game(bool new_game) { - int i; - - /* Hack -- Character is "icky" */ character_icky = TRUE; --- 2552,2565 ---- * 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) { /* Hack -- Character is "icky" */ character_icky = TRUE; *************** *** 2489,2495 **** process_player_name(FALSE); } ! /* Init the RNG */ if (Rand_quick) { u32b seed; --- 2592,2598 ---- process_player_name(FALSE); } ! /* Init RNG */ if (Rand_quick) { u32b seed; *************** *** 2511,2541 **** Rand_state_init(seed); } - /* Extract the options */ - for (i = 0; option_info[i].o_desc; i++) - { - int os = option_info[i].o_set; - int ob = option_info[i].o_bit; - - /* Set the "default" options */ - if (option_info[i].o_var) - { - /* Set */ - if (option_flag[os] & (1L << ob)) - { - /* Set */ - (*option_info[i].o_var) = TRUE; - } - - /* Clear */ - else - { - /* Clear */ - (*option_info[i].o_var) = FALSE; - } - } - } - /* Roll new character */ if (new_game) { --- 2614,2619 ---- *************** *** 2543,2549 **** character_dungeon = FALSE; /* Start in town */ ! dun_level = 0; /* Hack -- seed for flavors */ seed_flavor = rand_int(0x10000000); --- 2621,2627 ---- character_dungeon = FALSE; /* Start in town */ ! p_ptr->depth = 0; /* Hack -- seed for flavors */ seed_flavor = rand_int(0x10000000); *************** *** 2573,2580 **** /* Flavor the objects */ flavor_init(); ! /* Reset the visual mappings */ ! reset_visuals(); /* Window stuff */ --- 2651,2658 ---- /* Flavor the objects */ flavor_init(); ! /* Reset visuals */ ! reset_visuals(TRUE); /* Window stuff */ *************** *** 2587,2595 **** window_stuff(); ! /* Load the "pref" files */ ! load_all_pref_files(); /* Set or clear "rogue_like_commands" if requested */ if (arg_force_original) rogue_like_commands = FALSE; if (arg_force_roguelike) rogue_like_commands = TRUE; --- 2665,2674 ---- window_stuff(); ! /* Process some user pref files */ ! process_some_user_pref_files(); + /* Set or clear "rogue_like_commands" if requested */ if (arg_force_original) rogue_like_commands = FALSE; if (arg_force_roguelike) rogue_like_commands = TRUE; *************** *** 2717,2729 **** } /* Note cause of death XXX XXX XXX */ ! (void)strcpy(died_from, "Cheating death"); /* Teleport to town */ new_level_flag = TRUE; /* Go to town */ ! dun_level = 0; /* Do not die */ death = FALSE; --- 2796,2808 ---- } /* Note cause of death XXX XXX XXX */ ! (void)strcpy(p_ptr->died_from, "Cheating death"); /* Teleport to town */ new_level_flag = TRUE; /* Go to town */ ! p_ptr->depth = 0; /* Do not die */ death = FALSE; Only in angband-281/src: dungeon.o diff -r -c -w src-281/externs.h angband-281/src/externs.h *** src-281/externs.h Thu Mar 6 21:52:08 1997 --- angband-281/src/externs.h Thu Apr 24 10:23:56 1997 *************** *** 19,26 **** extern s16b ddx_ddd[9]; extern s16b ddy_ddd[9]; extern char hexsym[16]; - extern byte adj_val_min[]; - extern byte adj_val_max[]; extern byte adj_mag_study[]; extern byte adj_mag_mana[]; extern byte adj_mag_fail[]; --- 19,24 ---- *************** *** 93,113 **** extern s16b command_rep; extern s16b command_dir; extern s16b command_see; - extern s16b command_gap; extern s16b command_wrk; extern s16b command_new; extern s16b energy_use; - extern s16b choose_default; extern bool create_up_stair; extern bool create_down_stair; extern bool msg_flag; extern bool alive; extern bool death; - extern s16b running; - extern s16b resting; extern s16b cur_hgt; extern s16b cur_wid; - extern s16b dun_level; extern s16b num_repro; extern s16b object_level; extern s16b monster_level; --- 91,107 ---- extern s16b command_rep; extern s16b command_dir; extern s16b command_see; extern s16b command_wrk; + extern s16b command_gap; extern s16b command_new; extern s16b energy_use; extern bool create_up_stair; extern bool create_down_stair; extern bool msg_flag; extern bool alive; extern bool death; extern s16b cur_hgt; extern s16b cur_wid; extern s16b num_repro; extern s16b object_level; extern s16b monster_level; *************** *** 128,135 **** extern bool opening_chest; extern bool shimmer_monsters; extern bool shimmer_objects; ! extern bool repair_monsters; ! extern bool repair_objects; extern s16b total_weight; extern s16b inven_nxt; extern s16b inven_cnt; --- 122,131 ---- extern bool opening_chest; extern bool shimmer_monsters; extern bool shimmer_objects; ! extern bool repair_mflag_born; ! extern bool repair_mflag_nice; ! extern bool repair_mflag_show; ! extern bool repair_mflag_mark; extern s16b total_weight; extern s16b inven_nxt; extern s16b inven_cnt; *************** *** 138,204 **** extern s16b o_cnt; extern s16b m_max; extern s16b m_cnt; - extern s16b hack_m_idx; extern bool rogue_like_commands; extern bool quick_messages; extern bool other_query_flag; extern bool carry_query_flag; extern bool always_pickup; extern bool always_repeat; - extern bool use_old_target; extern bool depth_in_feet; ! extern bool use_color; ! extern bool compress_savefile; ! extern bool hilite_player; extern bool ring_bell; ! extern bool find_ignore_stairs; ! extern bool find_ignore_doors; ! extern bool find_cut; ! extern bool find_examine; ! extern bool disturb_near; extern bool disturb_move; extern bool disturb_panel; extern bool disturb_state; extern bool disturb_minor; extern bool disturb_other; extern bool avoid_abort; extern bool avoid_other; - extern bool flush_disturb; extern bool flush_failure; extern bool flush_command; extern bool fresh_before; extern bool fresh_after; extern bool fresh_message; ! extern bool alert_hitpoint; ! extern bool alert_failure; extern bool view_yellow_lite; extern bool view_bright_lite; extern bool view_granite_lite; extern bool view_special_lite; - extern bool view_perma_grids; - extern bool view_torch_grids; - extern bool flow_by_sound; - extern bool flow_by_smell; - extern bool track_follow; - extern bool track_target; - extern bool stack_allow_items; - extern bool stack_allow_wands; - extern bool stack_force_notes; - extern bool stack_force_costs; - extern bool view_reduce_lite; - extern bool view_reduce_view; - extern bool auto_haggle; - extern bool auto_scum; - extern bool expand_look; - extern bool expand_list; - extern bool dungeon_align; - extern bool dungeon_stair; - extern bool smart_learn; - extern bool smart_cheat; - extern bool show_labels; - extern bool show_weights; - extern bool show_choices; - extern bool show_details; extern bool testing_stack; extern bool testing_carry; extern bool cheat_peek; --- 134,199 ---- extern s16b o_cnt; extern s16b m_max; extern s16b m_cnt; extern bool rogue_like_commands; extern bool quick_messages; extern bool other_query_flag; extern bool carry_query_flag; + extern bool use_old_target; extern bool always_pickup; extern bool always_repeat; extern bool depth_in_feet; ! extern bool stack_force_notes; ! extern bool stack_force_costs; ! extern bool show_labels; ! extern bool show_weights; ! extern bool show_choices; ! extern bool show_details; extern bool ring_bell; ! extern bool inventory_colors; ! extern bool run_ignore_stairs; ! extern bool run_ignore_doors; ! extern bool run_cut_corners; ! extern bool run_use_corners; extern bool disturb_move; + extern bool disturb_near; extern bool disturb_panel; extern bool disturb_state; extern bool disturb_minor; extern bool disturb_other; + extern bool alert_hitpoint; + extern bool alert_failure; + extern bool auto_haggle; + extern bool auto_scum; + extern bool stack_allow_items; + extern bool stack_allow_wands; + extern bool expand_look; + extern bool expand_list; + extern bool view_perma_grids; + extern bool view_torch_grids; + extern bool dungeon_align; + extern bool dungeon_stair; + extern bool flow_by_sound; + extern bool flow_by_smell; + extern bool track_follow; + extern bool track_target; + extern bool smart_learn; + extern bool smart_cheat; + extern bool view_reduce_lite; + extern bool view_reduce_view; extern bool avoid_abort; extern bool avoid_other; extern bool flush_failure; + extern bool flush_disturb; extern bool flush_command; extern bool fresh_before; extern bool fresh_after; extern bool fresh_message; ! extern bool compress_savefile; ! extern bool hilite_player; extern bool view_yellow_lite; extern bool view_bright_lite; extern bool view_granite_lite; extern bool view_special_lite; extern bool testing_stack; extern bool testing_carry; extern bool cheat_peek; *************** *** 219,226 **** extern s16b panel_row_min, panel_row_max; extern s16b panel_col_min, panel_col_max; extern s16b panel_col_prt, panel_row_prt; - extern s16b py; - extern s16b px; extern s16b target_who; extern s16b target_col; extern s16b target_row; --- 214,219 ---- *************** *** 230,239 **** extern int player_uid; extern int player_euid; extern int player_egid; - extern char player_name[32]; - extern char player_base[32]; - extern char died_from[80]; - extern char history[4][60]; extern char savefile[1024]; extern s16b lite_n; extern byte lite_y[LITE_MAX]; --- 223,228 ---- *************** *** 278,284 **** extern byte misc_to_attr[128]; extern char misc_to_char[128]; extern byte tval_to_attr[128]; - extern char tval_to_char[128]; extern byte keymap_cmds[128]; extern byte keymap_dirs[128]; extern player_type *p_ptr; --- 267,272 ---- *************** *** 286,299 **** extern player_race *rp_ptr; extern player_class *cp_ptr; extern player_magic *mp_ptr; - extern u32b spell_learned1; - extern u32b spell_learned2; - extern u32b spell_worked1; - extern u32b spell_worked2; - extern u32b spell_forgotten1; - extern u32b spell_forgotten2; - extern byte spell_order[64]; - extern s16b player_hp[PY_MAX_LEVEL]; extern header *v_head; extern vault_type *v_info; extern char *v_name; --- 274,279 ---- *************** *** 332,338 **** extern cptr ANGBAND_DIR_XTRA; extern bool item_tester_full; extern byte item_tester_tval; ! extern bool (*item_tester_hook)(object_type *o_ptr); extern bool (*ang_sort_comp)(vptr u, vptr v, int a, int b); extern void (*ang_sort_swap)(vptr u, vptr v, int a, int b); extern bool (*get_mon_num_hook)(int r_idx); --- 312,318 ---- extern cptr ANGBAND_DIR_XTRA; extern bool item_tester_full; extern byte item_tester_tval; ! extern bool (*item_tester_hook)(object_type*); extern bool (*ang_sort_comp)(vptr u, vptr v, int a, int b); extern void (*ang_sort_swap)(vptr u, vptr v, int a, int b); extern bool (*get_mon_num_hook)(int r_idx); *************** *** 352,359 **** extern int distance(int y1, int x1, int y2, int x2); extern bool los(int y1, int x1, int y2, int x2); extern bool player_can_see_bold(int y, int x); - extern bool cave_valid_bold(int y, int x); extern bool no_lite(void); extern void map_info(int y, int x, byte *ap, char *cp); extern void move_cursor_relative(int row, int col); extern void print_rel(char c, byte a, int y, int x); --- 332,339 ---- extern int distance(int y1, int x1, int y2, int x2); extern bool los(int y1, int x1, int y2, int x2); extern bool player_can_see_bold(int y, int x); extern bool no_lite(void); + extern bool cave_valid_bold(int y, int x); extern void map_info(int y, int x, byte *ap, char *cp); extern void move_cursor_relative(int row, int col); extern void print_rel(char c, byte a, int y, int x); *************** *** 378,384 **** extern void health_track(int m_idx); extern void monster_race_track(int r_idx); extern void object_kind_track(int k_idx); ! extern void disturb(int stop_search, int flush_output); extern bool is_quest(int level); /* cmd1.c */ --- 358,364 ---- extern void health_track(int m_idx); extern void monster_race_track(int r_idx); extern void object_kind_track(int k_idx); ! extern void disturb(int stop_search, int unused_flag); extern bool is_quest(int level); /* cmd1.c */ *************** *** 388,394 **** extern s16b critical_norm(int weight, int plus, int dam); extern s16b tot_dam_aux(object_type *o_ptr, int tdam, monster_type *m_ptr); extern void search(void); ! extern void carry(int pickup); extern void py_attack(int y, int x); extern void move_player(int dir, int do_pickup); extern void run_step(int dir); --- 368,375 ---- extern s16b critical_norm(int weight, int plus, int dam); extern s16b tot_dam_aux(object_type *o_ptr, int tdam, monster_type *m_ptr); extern void search(void); ! 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); *************** *** 405,413 **** extern void do_cmd_bash(void); extern void do_cmd_alter(void); extern void do_cmd_spike(void); ! extern void do_cmd_walk(int pickup); ! extern void do_cmd_stay(int pickup); extern void do_cmd_run(void); extern void do_cmd_rest(void); extern void do_cmd_fire(void); extern void do_cmd_throw(void); --- 386,396 ---- extern void do_cmd_bash(void); extern void do_cmd_alter(void); extern void do_cmd_spike(void); ! extern void do_cmd_walk(void); ! extern void do_cmd_jump(void); extern void do_cmd_run(void); + extern void do_cmd_hold(void); + extern void do_cmd_stay(void); extern void do_cmd_rest(void); extern void do_cmd_fire(void); extern void do_cmd_throw(void); *************** *** 443,450 **** extern void do_cmd_feeling(void); extern void do_cmd_load_screen(void); extern void do_cmd_save_screen(void); ! extern void do_cmd_check_artifacts(void); ! extern void do_cmd_check_uniques(void); /* cmd5.c */ extern void do_cmd_browse(void); --- 426,432 ---- extern void do_cmd_feeling(void); extern void do_cmd_load_screen(void); extern void do_cmd_save_screen(void); ! extern void do_cmd_knowledge(void); /* cmd5.c */ extern void do_cmd_browse(void); *************** *** 456,463 **** extern void do_cmd_eat_food(void); extern void do_cmd_quaff_potion(void); extern void do_cmd_read_scroll(void); - extern void do_cmd_aim_wand(void); extern void do_cmd_use_staff(void); extern void do_cmd_zap_rod(void); extern void do_cmd_activate(void); --- 438,445 ---- extern void do_cmd_eat_food(void); extern void do_cmd_quaff_potion(void); extern void do_cmd_read_scroll(void); extern void do_cmd_use_staff(void); + extern void do_cmd_aim_wand(void); extern void do_cmd_zap_rod(void); extern void do_cmd_activate(void); *************** *** 468,484 **** extern void safe_setuid_drop(void); extern void safe_setuid_grab(void); extern s16b tokenize(char *buf, s16b num, char **tokens); - extern void display_player(int mode); - extern errr file_character(cptr name, bool full); extern errr process_pref_file_aux(char *buf); extern errr process_pref_file(cptr name); - extern errr check_time_init(void); - extern errr check_load_init(void); extern errr check_time(void); extern errr check_load(void); ! extern void read_times(void); ! extern errr show_file(cptr name, cptr what); ! extern void do_cmd_help(cptr name); extern void process_player_name(bool sf); extern void get_name(void); extern void do_cmd_suicide(void); --- 450,465 ---- extern void safe_setuid_drop(void); extern void safe_setuid_grab(void); extern s16b tokenize(char *buf, s16b num, char **tokens); extern errr process_pref_file_aux(char *buf); extern errr process_pref_file(cptr name); extern errr check_time(void); + extern errr check_time_init(void); extern errr check_load(void); ! extern errr check_load_init(void); ! extern void display_player(int mode); ! extern errr file_character(cptr name, bool full); ! extern bool show_file(cptr name, cptr what, int line, int mode); ! extern void do_cmd_help(void); extern void process_player_name(bool sf); extern void get_name(void); extern void do_cmd_suicide(void); *************** *** 494,500 **** /* generate.c */ extern void generate_cave(void); ! /* init-txt.c */ extern errr init_v_info_txt(FILE *fp, char *buf); extern errr init_f_info_txt(FILE *fp, char *buf); extern errr init_k_info_txt(FILE *fp, char *buf); --- 475,481 ---- /* generate.c */ extern void generate_cave(void); ! /* init1.c */ extern errr init_v_info_txt(FILE *fp, char *buf); extern errr init_f_info_txt(FILE *fp, char *buf); extern errr init_k_info_txt(FILE *fp, char *buf); *************** *** 502,508 **** extern errr init_e_info_txt(FILE *fp, char *buf); extern errr init_r_info_txt(FILE *fp, char *buf); ! /* init.c */ extern void init_file_paths(char *path); extern void init_angband(void); --- 483,489 ---- extern errr init_e_info_txt(FILE *fp, char *buf); extern errr init_r_info_txt(FILE *fp, char *buf); ! /* init2.c */ extern void init_file_paths(char *path); extern void init_angband(void); *************** *** 513,520 **** extern errr rd_savefile_new(void); /* melee1.c */ - /* melee2.c */ extern bool make_attack_normal(int m_idx); extern bool make_attack_spell(int m_idx); extern void process_monsters(void); --- 494,502 ---- extern errr rd_savefile_new(void); /* melee1.c */ extern bool make_attack_normal(int m_idx); + + /* melee2.c */ extern bool make_attack_spell(int m_idx); extern void process_monsters(void); *************** *** 535,555 **** extern void lore_treasure(int m_idx, int num_item, int num_gold); extern void update_mon(int m_idx, bool full); extern void update_monsters(bool full); extern bool place_monster_aux(int y, int x, int r_idx, bool slp, bool grp); extern bool place_monster(int y, int x, bool slp, bool grp); extern bool alloc_monster(int dis, int slp); extern bool summon_specific(int y1, int x1, int lev, int type); extern bool multiply_monster(int m_idx); extern void update_smart_learn(int m_idx, int what); /* object1.c */ - /* object2.c */ extern void flavor_init(void); ! extern void reset_visuals(void); extern void object_flags(object_type *o_ptr, u32b *f1, u32b *f2, u32b *f3); extern void object_flags_known(object_type *o_ptr, u32b *f1, u32b *f2, u32b *f3); extern void object_desc(char *buf, object_type *o_ptr, int pref, int mode); extern void object_desc_store(char *buf, object_type *o_ptr, int pref, int mode); extern bool identify_fully_aux(object_type *o_ptr); extern s16b index_to_label(int i); extern s16b label_to_inven(int c); --- 517,540 ---- extern void lore_treasure(int m_idx, int num_item, int num_gold); extern void update_mon(int m_idx, bool full); extern void update_monsters(bool full); + extern s16b monster_carry(int m_idx, object_type *j_ptr); + extern s16b monster_place(int y, int x, monster_type *n_ptr); extern bool place_monster_aux(int y, int x, int r_idx, bool slp, bool grp); extern bool place_monster(int y, int x, bool slp, bool grp); extern bool alloc_monster(int dis, int slp); extern bool summon_specific(int y1, int x1, int lev, int type); extern bool multiply_monster(int m_idx); + extern void message_pain(int m_idx, int dam); extern void update_smart_learn(int m_idx, int what); /* object1.c */ extern void flavor_init(void); ! extern void reset_visuals(bool prefs); extern void object_flags(object_type *o_ptr, u32b *f1, u32b *f2, u32b *f3); extern void object_flags_known(object_type *o_ptr, u32b *f1, u32b *f2, u32b *f3); extern void object_desc(char *buf, object_type *o_ptr, int pref, int mode); extern void object_desc_store(char *buf, object_type *o_ptr, int pref, int mode); + extern cptr item_activation(object_type *o_ptr); extern bool identify_fully_aux(object_type *o_ptr); extern s16b index_to_label(int i); extern s16b label_to_inven(int c); *************** *** 557,574 **** extern s16b wield_slot(object_type *o_ptr); extern cptr mention_use(int i); extern cptr describe_use(int i); - extern void inven_item_charges(int item); - extern void inven_item_describe(int item); - extern void inven_item_increase(int item, int num); - extern void inven_item_optimize(int item); - extern void floor_item_charges(int item); - extern void floor_item_describe(int item); - extern void floor_item_increase(int item, int num); - extern void floor_item_optimize(int item); - extern bool inven_carry_okay(object_type *o_ptr); - extern s16b inven_carry(object_type *o_ptr, bool final); - extern s16b inven_takeoff(int item, int amt); - extern void inven_drop(int item, int amt); extern bool item_tester_okay(object_type *o_ptr); extern void display_inven(void); extern void display_equip(void); --- 542,547 ---- *************** *** 575,581 **** extern void show_inven(void); extern void show_equip(void); extern void toggle_inven_equip(void); ! extern bool get_item(int *cp, cptr pmt, bool equip, bool inven, bool floor); extern void excise_object_idx(int o_idx); extern void delete_object_idx(int o_idx); extern void delete_object(int y, int x); --- 548,556 ---- extern void show_inven(void); extern void show_equip(void); extern void toggle_inven_equip(void); ! extern bool get_item(int *cp, cptr pmt, cptr str, int mode); ! ! /* object2.c */ extern void excise_object_idx(int o_idx); extern void delete_object_idx(int o_idx); extern void delete_object(int y, int x); *************** *** 592,612 **** extern void object_absorb(object_type *o_ptr, object_type *j_ptr); extern s16b lookup_kind(int tval, int sval); extern void object_wipe(object_type *o_ptr); - extern void object_prep(object_type *o_ptr, int k_idx); extern void object_copy(object_type *o_ptr, object_type *j_ptr); extern void apply_magic(object_type *o_ptr, int lev, bool okay, bool good, bool great); extern bool make_object(object_type *j_ptr, bool good, bool great); - extern void place_object(int y, int x, bool good, bool great); extern bool make_gold(object_type *j_ptr); ! extern void place_gold(int y, int x); ! extern void process_objects(void); ! extern s16b drop_near(object_type *o_ptr, int chance, int y, int x); extern void acquirement(int y1, int x1, int num, bool great); extern void pick_trap(int y, int x); extern void place_trap(int y, int x); ! extern cptr item_activation(object_type *o_ptr); extern void combine_pack(void); extern void reorder_pack(void); extern s16b spell_chance(int spell); extern bool spell_okay(int spell, bool known); extern void print_spells(byte *spells, int num, int y, int x); --- 567,599 ---- extern void object_absorb(object_type *o_ptr, object_type *j_ptr); extern s16b lookup_kind(int tval, int sval); extern void object_wipe(object_type *o_ptr); extern void object_copy(object_type *o_ptr, object_type *j_ptr); + extern void object_prep(object_type *o_ptr, int k_idx); extern void apply_magic(object_type *o_ptr, int lev, bool okay, bool good, bool great); extern bool make_object(object_type *j_ptr, bool good, bool great); extern bool make_gold(object_type *j_ptr); ! extern s16b floor_carry(int y, int x, object_type *j_ptr); ! extern void drop_near(object_type *j_ptr, int chance, int y, int x); extern void acquirement(int y1, int x1, int num, bool great); + extern void place_object(int y, int x, bool good, bool great); + 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 inven_item_charges(int item); ! extern void inven_item_describe(int item); ! extern void inven_item_increase(int item, int num); ! extern void inven_item_optimize(int item); ! extern void floor_item_charges(int item); ! extern void floor_item_describe(int item); ! extern void floor_item_increase(int item, int num); ! extern void floor_item_optimize(int item); ! extern bool inven_carry_okay(object_type *o_ptr); ! extern s16b inven_carry(object_type *o_ptr); ! extern s16b inven_takeoff(int item, int amt); ! extern void inven_drop(int item, int amt); extern void combine_pack(void); extern void reorder_pack(void); + extern void display_spell_list(void); extern s16b spell_chance(int spell); extern bool spell_okay(int spell, bool known); extern void print_spells(byte *spells, int num, int y, int x); *************** *** 622,628 **** extern void teleport_player(int dis); extern void teleport_player_to(int ny, int nx); extern void teleport_player_level(void); ! extern void take_hit(int damage, cptr kb_str); extern void acid_dam(int dam, cptr kb_str); extern void elec_dam(int dam, cptr kb_str); extern void fire_dam(int dam, cptr kb_str); --- 609,615 ---- extern void teleport_player(int dis); extern void teleport_player_to(int ny, int nx); extern void teleport_player_level(void); ! extern void take_hit(int dam, cptr kb_str); extern void acid_dam(int dam, cptr kb_str); extern void elec_dam(int dam, cptr kb_str); extern void fire_dam(int dam, cptr kb_str); *************** *** 640,646 **** extern bool do_res_stat(int stat); extern bool do_inc_stat(int stat); extern void identify_pack(void); - extern void message_pain(int m_idx, int dam); extern bool remove_curse(void); extern bool remove_all_curse(void); extern bool restore_level(void); --- 627,632 ---- *************** *** 666,680 **** extern bool speed_monsters(void); extern bool slow_monsters(void); extern bool sleep_monsters(void); extern void aggravate_monsters(int who); extern bool genocide(void); extern bool mass_genocide(void); extern bool probing(void); - extern bool banish_evil(int dist); - extern bool dispel_evil(int dam); - extern bool dispel_undead(int dam); - extern bool dispel_monsters(int dam); - extern bool turn_undead(void); extern void destroy_area(int y1, int x1, int r, bool full); extern void earthquake(int cy, int cx, int r); extern void lite_room(int y1, int x1); --- 652,666 ---- extern bool speed_monsters(void); extern bool slow_monsters(void); extern bool sleep_monsters(void); + extern bool banish_evil(int dist); + extern bool turn_undead(void); + extern bool dispel_undead(int dam); + extern bool dispel_evil(int dam); + extern bool dispel_monsters(int dam); extern void aggravate_monsters(int who); extern bool genocide(void); extern bool mass_genocide(void); extern bool probing(void); extern void destroy_area(int y1, int x1, int r, bool full); extern void earthquake(int cy, int cx, int r); extern void lite_room(int y1, int x1); *************** *** 695,703 **** extern bool slow_monster(int dir); extern bool sleep_monster(int dir); extern bool confuse_monster(int dir, int plev); - extern bool fear_monster(int dir, int plev); extern bool poly_monster(int dir); extern bool clone_monster(int dir); extern bool teleport_monster(int dir); extern bool door_creation(void); extern bool trap_creation(void); --- 681,689 ---- extern bool slow_monster(int dir); extern bool sleep_monster(int dir); extern bool confuse_monster(int dir, int plev); extern bool poly_monster(int dir); extern bool clone_monster(int dir); + extern bool fear_monster(int dir, int plev); extern bool teleport_monster(int dir); extern bool door_creation(void); extern bool trap_creation(void); *************** *** 715,723 **** extern errr path_temp(char *buf, int max); extern errr path_build(char *buf, int max, cptr path, cptr file); extern FILE *my_fopen(cptr file, cptr mode); extern errr my_fgets(FILE *fff, char *buf, huge n); extern errr my_fputs(FILE *fff, cptr buf, huge n); - extern errr my_fclose(FILE *fff); extern errr fd_kill(cptr file); extern errr fd_move(cptr file, cptr what); extern errr fd_copy(cptr file, cptr what); --- 701,709 ---- extern errr path_temp(char *buf, int max); extern errr path_build(char *buf, int max, cptr path, cptr file); extern FILE *my_fopen(cptr file, cptr mode); + extern errr my_fclose(FILE *fff); extern errr my_fgets(FILE *fff, char *buf, huge n); extern errr my_fputs(FILE *fff, cptr buf, huge n); extern errr fd_kill(cptr file); extern errr fd_move(cptr file, cptr what); extern errr fd_copy(cptr file, cptr what); *************** *** 729,748 **** extern errr fd_read(int fd, char *buf, huge n); extern errr fd_write(int fd, cptr buf, huge n); extern errr fd_close(int fd); - extern void flush(void); - extern void bell(void); - extern void sound(int num); extern void move_cursor(int row, int col); extern void text_to_ascii(char *buf, cptr str); extern void ascii_to_text(char *buf, cptr str); extern void keymap_init(void); extern void macro_add(cptr pat, cptr act, bool cmd_flag); extern char inkey(void); - extern cptr quark_str(s16b num); extern s16b quark_add(cptr str); extern s16b message_num(void); extern cptr message_str(s16b age); ! extern void message_add(cptr msg); extern void msg_print(cptr msg); extern void msg_format(cptr fmt, ...); extern void c_put_str(byte attr, cptr str, int row, int col); --- 715,734 ---- extern errr fd_read(int fd, char *buf, huge n); extern errr fd_write(int fd, cptr buf, huge n); extern errr fd_close(int fd); extern void move_cursor(int row, int col); extern void text_to_ascii(char *buf, cptr str); extern void ascii_to_text(char *buf, cptr str); extern void keymap_init(void); extern void macro_add(cptr pat, cptr act, bool cmd_flag); + extern void flush(void); + extern void bell(void); + extern void sound(int val); extern char inkey(void); extern s16b quark_add(cptr str); + extern cptr quark_str(s16b i); extern s16b message_num(void); extern cptr message_str(s16b age); ! extern void message_add(cptr str); extern void msg_print(cptr msg); extern void msg_format(cptr fmt, ...); extern void c_put_str(byte attr, cptr str, int row, int col); *************** *** 749,757 **** extern void put_str(cptr str, int row, int col); extern void c_prt(byte attr, cptr str, int row, int col); extern void prt(cptr str, int row, int col); ! extern void c_roff(byte attr, cptr str); extern void roff(cptr str); - extern void clear_screen(void); extern void clear_from(int row); extern bool askfor_aux(char *buf, int len); extern bool get_string(cptr prompt, char *buf, int len); --- 735,742 ---- extern void put_str(cptr str, int row, int col); extern void c_prt(byte attr, cptr str, int row, int col); extern void prt(cptr str, int row, int col); ! extern void c_roff(byte a, cptr str); extern void roff(cptr str); extern void clear_from(int row); extern bool askfor_aux(char *buf, int len); extern bool get_string(cptr prompt, char *buf, int len); *************** *** 811,816 **** --- 796,802 ---- extern bool target_set(int mode); extern bool get_aim_dir(int *dp); extern bool get_rep_dir(int *dp); + extern bool confuse_dir(int *dp); /* *************** *** 817,827 **** * Hack -- conditional (or "bizarre") externs */ - #ifdef SET_UID - /* util.c */ - extern void user_name(char *buf, int id); - #endif - #ifndef HAS_MEMSET /* util.c */ extern char *memset(char*, int, huge); --- 803,808 ---- *************** *** 837,842 **** --- 818,828 ---- extern int usleep(huge usecs); #endif + #ifdef SET_UID + /* util.c */ + extern void user_name(char *buf, int id); + #endif + #ifdef MACINTOSH /* main-mac.c */ /* extern void main(void); */ *************** *** 846,848 **** --- 832,838 ---- /* main-win.c */ /* extern int FAR PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, ...); */ #endif + + /* main.c */ + /* extern int main(int argc, char *argv[]); */ + diff -r -c -w src-281/files.c angband-281/src/files.c *** src-281/files.c Mon Mar 3 22:21:42 1997 --- angband-281/src/files.c Thu Apr 24 10:24:37 1997 *************** *** 202,210 **** * zero" will be used for the "stack" attr/char, and "feature zero" is * used for the "nothing" attr/char. * - * Parse another file recursively, see below for details - * %: - * * Specify the attr/char values for "monsters" by race index * R::: * --- 202,207 ---- *************** *** 217,224 **** * Specify the attr/char values for unaware "objects" by kind tval * U::: * ! * Specify the attr/char values for inventory "objects" by kind tval ! * E::: * * Define a macro action, given an encoded macro action * A: --- 214,221 ---- * 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: *************** *** 262,275 **** if (buf[1] != ':') return (1); - /* Process "%:" */ - if (buf[0] == '%') - { - /* Attempt to Process the given file */ - return (process_pref_file(buf + 2)); - } - - /* Process "R::/" -- attr/char for monster races */ if (buf[0] == 'R') { --- 259,264 ---- *************** *** 346,361 **** } ! /* Process "E::/" -- attr/char for equippy chars */ else if (buf[0] == 'E') { ! if (tokenize(buf+2, 3, zz) == 3) { j = (byte)strtol(zz[0], NULL, 0) % 128; n1 = strtol(zz[1], NULL, 0); - n2 = strtol(zz[2], NULL, 0); if (n1) tval_to_attr[j] = n1; - if (n2) tval_to_char[j] = n2; return (0); } } --- 335,348 ---- } ! /* Process "E::" -- attribute for inventory objects */ else if (buf[0] == 'E') { ! if (tokenize(buf+2, 2, zz) == 2) { j = (byte)strtol(zz[0], NULL, 0) % 128; n1 = strtol(zz[1], NULL, 0); if (n1) tval_to_attr[j] = n1; return (0); } } *************** *** 455,463 **** --- 442,657 ---- /* + * Helper function for "process_pref_file()" + * + * Input: + * v: output buffer array + * f: final character + * + * Output: + * result + */ + static cptr process_pref_file_expr(char **sp, char *fp) + { + cptr v; + + char *b; + char *s; + + char b1 = '['; + char b2 = ']'; + + char f = ' '; + + /* Initial */ + s = (*sp); + + /* Skip spaces */ + while (isspace(*s)) s++; + + /* Save start */ + b = s; + + /* Default */ + v = "?o?o?"; + + /* Analyze */ + if (*s == b1) + { + const char *p; + const char *t; + + /* Skip b1 */ + s++; + + /* First */ + t = process_pref_file_expr(&s, &f); + + /* Oops */ + if (!*t) + { + /* Nothing */ + } + + /* Function: IOR */ + else if (streq(t, "IOR")) + { + v = "0"; + while (*s && (f != b2)) + { + t = process_pref_file_expr(&s, &f); + if (*t && !streq(t, "0")) v = "1"; + } + } + + /* Function: AND */ + else if (streq(t, "AND")) + { + v = "1"; + while (*s && (f != b2)) + { + t = process_pref_file_expr(&s, &f); + if (*t && streq(t, "0")) v = "0"; + } + } + + /* Function: NOT */ + else if (streq(t, "NOT")) + { + v = "1"; + while (*s && (f != b2)) + { + t = process_pref_file_expr(&s, &f); + if (*t && streq(t, "0")) v = "0"; + } + } + + /* Function: EQU */ + else if (streq(t, "EQU")) + { + v = "1"; + if (*s && (f != b2)) + { + t = process_pref_file_expr(&s, &f); + } + while (*s && (f != b2)) + { + p = t; + t = process_pref_file_expr(&s, &f); + if (*t && !streq(p, t)) v = "0"; + } + } + + /* Function: LEQ */ + else if (streq(t, "LEQ")) + { + v = "1"; + if (*s && (f != b2)) + { + t = process_pref_file_expr(&s, &f); + } + while (*s && (f != b2)) + { + p = t; + t = process_pref_file_expr(&s, &f); + if (*t && (strcmp(p, t) >= 0)) v = "0"; + } + } + + /* Function: GEQ */ + else if (streq(t, "GEQ")) + { + v = "1"; + if (*s && (f != b2)) + { + t = process_pref_file_expr(&s, &f); + } + while (*s && (f != b2)) + { + p = t; + t = process_pref_file_expr(&s, &f); + if (*t && (strcmp(p, t) <= 0)) v = "0"; + } + } + + /* Oops */ + else + { + while (*s && (f != b2)) + { + t = process_pref_file_expr(&s, &f); + } + } + + /* Verify ending */ + if (f != b2) v = "?x?x?"; + + /* Extract final and Terminate */ + if ((f = *s) != '\0') *s++ = '\0'; + } + + /* Other */ + else + { + /* Scan (accept identifiers and dollar signs) */ + while (isalnum(*s) || (*s == '_') || (*s == '$')) s++; + + /* Extract final and Terminate */ + if ((f = *s) != '\0') *s++ = '\0'; + + /* Variable */ + if (*b == '$') + { + /* System */ + if (streq(b+1, "SYS")) + { + v = ANGBAND_SYS; + } + + /* Race */ + else if (streq(b+1, "RACE")) + { + v = rp_ptr->title; + } + + /* Class */ + else if (streq(b+1, "CLASS")) + { + v = cp_ptr->title; + } + + /* Player */ + else if (streq(b+1, "PLAYER")) + { + v = p_ptr->base_name; + } + } + + /* Constant */ + else + { + v = b; + } + } + + /* Save */ + (*fp) = f; + + /* Save */ + (*sp) = s; + + /* Result */ + return (v); + } + + + /* * Process the "user pref file" with the given name * * See the function above for a list of legal "commands". + * + * We also accept the special "?" and "%" directives, which + * allow conditional evaluation and filename inclusion. */ errr process_pref_file(cptr name) { *************** *** 465,471 **** --- 659,671 ---- char buf[1024]; + int num = -1; + errr err = 0; + + bool bypass = FALSE; + + /* Build the filename */ path_build(buf, 1024, ANGBAND_DIR_USER, name); *************** *** 472,496 **** /* Open the file */ fp = my_fopen(buf, "r"); ! /* Catch errors */ if (!fp) return (-1); /* Process the file */ while (0 == my_fgets(fp, buf, 1024)) { /* Process the line */ ! if (process_pref_file_aux(buf)) { /* Useful error message */ ! msg_format("Error in '%s' parsing '%s'.", buf, name); } - } /* Close the file */ my_fclose(fp); ! /* Success */ ! return (0); } --- 672,754 ---- /* Open the file */ fp = my_fopen(buf, "r"); ! /* No such file */ if (!fp) return (-1); + /* Process the file */ while (0 == my_fgets(fp, buf, 1024)) { + /* Count lines */ + num++; + + + /* Skip "empty" lines */ + if (!buf[0]) continue; + + /* Skip "blank" lines */ + if (isspace(buf[0])) continue; + + /* Skip comments */ + if (buf[0] == '#') continue; + + + /* Process "?:" */ + if ((buf[0] == '?') && (buf[1] == ':')) + { + char f; + cptr v; + char *s; + + /* Start */ + s = buf + 2; + + /* Parse the expr */ + v = process_pref_file_expr(&s, &f); + + /* Set flag */ + bypass = (streq(v, "0") ? TRUE : FALSE); + + /* Continue */ + continue; + } + + /* Apply conditionals */ + if (bypass) continue; + + + /* Process "%:" */ + if (buf[0] == '%') + { + /* Process that file if allowed */ + (void)process_pref_file(buf + 2); + + /* Continue */ + continue; + } + + /* Process the line */ ! err = process_pref_file_aux(buf); ! ! /* Oops */ ! if (err) break; ! } ! ! ! /* Error */ ! if (err) { /* Useful error message */ ! msg_format("Error %d in line %d of file '%s'.", err, num, name); ! msg_format("Parsing '%s'", buf); } /* Close the file */ my_fclose(fp); ! /* Result */ ! return (err); } *************** *** 1032,1038 **** if (p_ptr->prace == RACE_HOBBIT) (*f2) |= (TR2_SUST_DEX); /* Gnome */ ! if (p_ptr->prace == RACE_GNOME) (*f2) |= (TR2_FREE_ACT); /* Dwarf */ if (p_ptr->prace == RACE_DWARF) (*f2) |= (TR2_RES_BLIND); --- 1290,1296 ---- if (p_ptr->prace == RACE_HOBBIT) (*f2) |= (TR2_SUST_DEX); /* Gnome */ ! if (p_ptr->prace == RACE_GNOME) (*f3) |= (TR3_FREE_ACT); /* Dwarf */ if (p_ptr->prace == RACE_DWARF) (*f2) |= (TR2_RES_BLIND); *************** *** 1075,1086 **** if (!o_ptr->k_idx) continue; /* Get attr/char for display */ ! a = tval_to_attr[o_ptr->tval & 0x7F]; ! c = tval_to_char[o_ptr->tval & 0x7F]; - /* No color */ - if (!use_color) a = TERM_WHITE; - /* Dump */ Term_putch(x+i-INVEN_WIELD, y, a, c); } --- 1333,1341 ---- if (!o_ptr->k_idx) continue; /* Get attr/char for display */ ! a = object_attr(o_ptr); ! c = object_char(o_ptr); /* Dump */ Term_putch(x+i-INVEN_WIELD, y, a, c); } *************** *** 1088,1205 **** /* ! * Helper function, see below */ ! static void display_player_flag_aux(int row, int col, ! char *header, int n, u32b flag) { ! int i; ! u32b f[3]; ! /* Header */ ! c_put_str(TERM_WHITE, header, row, col); ! /* Advance */ ! col += strlen(header) + 1; - - /* Check equipment */ - 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 */ ! player_flags(&f[1], &f[2], &f[3]); ! /* Default */ ! c_put_str(TERM_SLATE, ".", row, col+n); ! /* Check flags */ ! if (f[set] & flag) c_put_str(TERM_WHITE, "+", row, col+n); ! /* Advance */ ! row++; ! } ! /* Footer */ ! c_put_str(TERM_WHITE, "abcdefghijkl@", row++, col+6); ! display_player_equippy(row++, col+6); } + } /* *************** *** 1215,1221 **** put_str("Race :", 4, 1); put_str("Class :", 5, 1); ! c_put_str(TERM_L_BLUE, player_name, 2, 13); c_put_str(TERM_L_BLUE, sp_ptr->title, 3, 13); c_put_str(TERM_L_BLUE, rp_ptr->title, 4, 13); c_put_str(TERM_L_BLUE, cp_ptr->title, 5, 13); --- 1520,1526 ---- put_str("Race :", 4, 1); put_str("Class :", 5, 1); ! c_put_str(TERM_L_BLUE, p_ptr->full_name, 2, 13); c_put_str(TERM_L_BLUE, sp_ptr->title, 3, 13); c_put_str(TERM_L_BLUE, rp_ptr->title, 4, 13); c_put_str(TERM_L_BLUE, cp_ptr->title, 5, 13); *************** *** 1247,1255 **** */ static void display_player_stat_info(void) { ! int i, e_adj; int stat_col, stat; - int row, col; object_type *o_ptr; u32b f1, f2, f3; --- 1552,1559 ---- */ static void display_player_stat_info(void) { ! int i, row, col; int stat_col, stat; object_type *o_ptr; u32b f1, f2, f3; *************** *** 1277,1317 **** /* Display the stats */ for (i = 0; i < 6; i++) { - /* Calculate equipment adjustment */ - e_adj = 0; - - /* Icky formula to deal with the 18 barrier */ - if ((p_ptr->stat_max[i]>18) && (p_ptr->stat_top[i]>18)) - e_adj = (p_ptr->stat_top[i] - p_ptr->stat_max[i])/10; - if ((p_ptr->stat_max[i]<=18) && (p_ptr->stat_top[i]<=18)) - e_adj = p_ptr->stat_top[i] - p_ptr->stat_max[i]; - if ((p_ptr->stat_max[i]<=18) && (p_ptr->stat_top[i]>18)) - e_adj = (p_ptr->stat_top[i] - 18)/10 - p_ptr->stat_max[i] + 18; - - /* Deduct class and race bonuses if in maximize */ - if (p_ptr->maximize) - { - e_adj -= rp_ptr->r_adj[i]; - e_adj -= cp_ptr->c_adj[i]; - } - /* Reduced name of stat */ c_put_str(TERM_WHITE, stat_names_reduced[i], row+i, stat_col); ! /* Internal "natural" max value. Maxes at 18/100 */ ! /* This is useful to see if you are maxed out */ cnv_stat(p_ptr->stat_max[i], buf); c_put_str(TERM_BLUE, buf, row+i, stat_col+5); /* Race, class, and equipment modifiers */ ! (void) sprintf(buf, "%3d", (int) rp_ptr->r_adj[i]); c_put_str(TERM_L_BLUE, buf, row+i, stat_col+12); ! (void) sprintf(buf, "%3d", (int) cp_ptr->c_adj[i]); c_put_str(TERM_L_BLUE, buf, row+i, stat_col+16); ! (void) sprintf(buf, "%3d", (int) e_adj); c_put_str(TERM_L_BLUE, buf, row+i, stat_col+20); ! /* Actual maximal modified value */ cnv_stat(p_ptr->stat_top[i], buf); c_put_str(TERM_L_GREEN, buf, row+i, stat_col+24); --- 1581,1602 ---- /* Display the stats */ for (i = 0; i < 6; i++) { /* Reduced name of stat */ c_put_str(TERM_WHITE, stat_names_reduced[i], row+i, stat_col); ! /* Internal "natural" maximum value */ cnv_stat(p_ptr->stat_max[i], buf); c_put_str(TERM_BLUE, buf, row+i, stat_col+5); /* Race, class, and equipment modifiers */ ! (void)sprintf(buf, "%3d", rp_ptr->r_adj[i]); c_put_str(TERM_L_BLUE, buf, row+i, stat_col+12); ! (void)sprintf(buf, "%3d", cp_ptr->c_adj[i]); c_put_str(TERM_L_BLUE, buf, row+i, stat_col+16); ! (void)sprintf(buf, "%3d", p_ptr->stat_add[i]); c_put_str(TERM_L_BLUE, buf, row+i, stat_col+20); ! /* Resulting "modified" maximum value */ cnv_stat(p_ptr->stat_top[i], buf); c_put_str(TERM_L_GREEN, buf, row+i, stat_col+24); *************** *** 1324,1334 **** } /* Column */ ! col = stat_col + 39; /* Header and Footer */ c_put_str(TERM_WHITE, "abcdefghijkl@", row-1, col); - c_put_str(TERM_L_GREEN, "Modifications", row+6, col); /* Process equipment */ for (i=INVEN_WIELD; i> 16); - b[2] |= (f2 & 0xFFFF); - b[3] |= (f2 >> 16); - b[4] |= (f3 & 0xFFFF); - b[5] |= (f3 >> 16); - } - - - /* Player flags */ - player_flags(&f1, &f2, &f3); - - /* Incorporate */ - b[0] |= (f1 & 0xFFFF); - b[1] |= (f1 >> 16); - b[2] |= (f2 & 0xFFFF); - b[3] |= (f2 >> 16); - b[4] |= (f3 & 0xFFFF); - b[5] |= (f3 >> 16); - - - /* Scan cols */ - for (x = 0; x < 6; x++) - { - /* Scan rows */ - for (y = 0; y < 16; y++) - { - byte a = TERM_SLATE; - char c = '.'; - - cptr name = object_flag_names[16*x+y]; - - /* No name */ - if (!name) continue; - - /* Dump name */ - Term_putstr(x * 13, y + 4, -1, TERM_WHITE, name); - - /* Dump colon */ - Term_putch(x * 13 + 10, y + 4, TERM_WHITE, ':'); - - /* Check flag */ - if (b[x] & (1<> 16); - b[n][2] = (f2 & 0xFFFF); - b[n][3] = (f2 >> 16); - b[n][4] = (f3 & 0xFFFF); - b[n][5] = (f3 >> 16); - } - - - /* Index */ - n = 12; - - /* Player flags */ - player_flags(&f1, &f2, &f3); - - /* Incorporate */ - b[n][0] = (f1 & 0xFFFF); - b[n][1] = (f1 >> 16); - b[n][2] = (f2 & 0xFFFF); - b[n][3] = (f2 >> 16); - b[n][4] = (f3 & 0xFFFF); - b[n][5] = (f3 >> 16); - - - /* Scan cols */ - for (x = 0; x < 3; x++) - { - /* Equippy */ - display_player_equippy(2, x * 26 + 11); - - /* Label */ - Term_putstr(x * 26 + 11, 3, -1, TERM_WHITE, "abcdefghijkl@"); - - /* Scan rows */ - for (y = 0; y < 16; y++) - { - cptr name = object_flag_names[48*mode+16*x+y]; - - /* No name */ - if (!name) continue; - - /* Dump name */ - Term_putstr(x * 26, y + 4, -1, TERM_WHITE, name); - - /* Dump colon */ - Term_putch(x * 26 + 10, y + 4, TERM_WHITE, ':'); - - /* Check flags */ - for (n = 0; n < 13; n++) - { - byte a = TERM_SLATE; - char c = '.'; - - /* Check flag */ - if (b[n][3*mode+x] & (1<title, 3, 15); c_put_str(TERM_L_BLUE, rp_ptr->title, 4, 15); c_put_str(TERM_L_BLUE, cp_ptr->title, 5, 15); --- 1732,1738 ---- put_str("Race :", 4, 1); put_str("Class :", 5, 1); ! c_put_str(TERM_L_BLUE, p_ptr->full_name, 2, 15); c_put_str(TERM_L_BLUE, sp_ptr->title, 3, 15); c_put_str(TERM_L_BLUE, rp_ptr->title, 4, 15); c_put_str(TERM_L_BLUE, cp_ptr->title, 5, 15); *************** *** 1812,1818 **** for (i = 0; i < 4; i++) { ! put_str(history[i], i + 16, 10); } } --- 1797,1803 ---- for (i = 0; i < 4; i++) { ! put_str(p_ptr->history[i], i + 16, 10); } } *************** *** 1835,1856 **** display_player_stat_info(); display_player_flag_info(); } - - /* Special */ - else if (mode == 3) - { - display_player_ben(); } - /* Special */ - else - { - display_player_ben_one(mode % 2); - } - } - /* * Hack -- Dump a character description file * --- 1820,1829 ---- *************** *** 2040,2050 **** /* ! * Recursive "help file" perusal. Return FALSE on "ESCAPE". * * XXX XXX XXX Consider using a temporary file. */ ! static bool do_cmd_help_aux(cptr name, cptr what, int line) { int i, k; --- 2013,2030 ---- /* ! * Recursive file perusal. * + * 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; *************** *** 2356,2362 **** strcpy(tmp, "help.hlp"); if (askfor_aux(tmp, 80)) { ! if (!do_cmd_help_aux(tmp, NULL, 0)) k = ESCAPE; } } --- 2336,2342 ---- strcpy(tmp, "help.hlp"); if (askfor_aux(tmp, 80)) { ! if (!show_file(tmp, NULL, 0, mode)) k = ESCAPE; } } *************** *** 2383,2389 **** if (menu && isdigit(k) && hook[k-'0'][0]) { /* Recurse on that file */ ! if (!do_cmd_help_aux(hook[k-'0'], NULL, 0)) k = ESCAPE; } /* Exit on escape */ --- 2363,2369 ---- if (menu && isdigit(k) && hook[k-'0'][0]) { /* Recurse on that file */ ! if (!show_file(hook[k-'0'], NULL, 0, mode)) k = ESCAPE; } /* Exit on escape */ *************** *** 2402,2414 **** /* ! * Peruse the On-Line-Help, starting at the given file. */ ! void do_cmd_help(cptr name) { - /* Hack -- default file */ - if (!name) name = "help.hlp"; - /* Enter "icky" mode */ character_icky = TRUE; --- 2382,2391 ---- /* ! * Peruse the On-Line-Help */ ! void do_cmd_help(void) { /* Enter "icky" mode */ character_icky = TRUE; *************** *** 2416,2422 **** Term_save(); /* Peruse the main help file */ ! (void)do_cmd_help_aux(name, NULL, 0); /* Restore the screen */ Term_load(); --- 2393,2399 ---- Term_save(); /* Peruse the main help file */ ! (void)show_file("help.hlp", NULL, 0, 0); /* Restore the screen */ Term_load(); *************** *** 2428,2463 **** /* - * Hack -- display the contents of a file on the screen - * - * XXX XXX XXX Use this function for commands such as the - * "examine object" command. - */ - errr show_file(cptr name, cptr what) - { - /* Enter "icky" mode */ - character_icky = TRUE; - - /* Save the screen */ - Term_save(); - - /* Peruse the requested file */ - (void)do_cmd_help_aux(name, what, 0); - - /* Restore the screen */ - Term_load(); - - /* Leave "icky" mode */ - character_icky = FALSE; - - /* Success */ - return (0); - } - - - - - /* * Process the player name. * Extract a clean "base name". * Build the savefile name if needed. --- 2405,2410 ---- *************** *** 2468,2487 **** /* Cannot be too long */ ! if (strlen(player_name) > 15) { /* Name too long */ ! quit_fmt("The name '%s' is too long!", player_name); } /* Cannot contain "icky" characters */ ! for (i = 0; player_name[i]; i++) { /* No control characters */ ! if (iscntrl(player_name[i])) { /* Illegal characters */ ! quit_fmt("The name '%s' contains control chars!", player_name); } } --- 2415,2434 ---- /* Cannot be too long */ ! if (strlen(p_ptr->full_name) > 15) { /* Name too long */ ! quit_fmt("The name '%s' is too long!", p_ptr->full_name); } /* Cannot contain "icky" characters */ ! for (i = 0; p_ptr->full_name[i]; i++) { /* No control characters */ ! if (iscntrl(p_ptr->full_name[i])) { /* Illegal characters */ ! quit_fmt("The name '%s' contains control chars!", p_ptr->full_name); } } *************** *** 2489,2517 **** #ifdef MACINTOSH /* Extract "useful" letters */ ! for (i = 0; player_name[i]; i++) { ! char c = player_name[i]; /* Convert "dot" to "underscore" */ if (c == '.') c = '_'; /* Accept all the letters */ ! player_base[k++] = c; } #else /* Extract "useful" letters */ ! for (i = 0; player_name[i]; i++) { ! char c = player_name[i]; /* Accept some letters */ ! if (isalpha(c) || isdigit(c)) player_base[k++] = c; /* Convert space, dot, and underscore to underscore */ ! else if (strchr(". _", c)) player_base[k++] = '_'; } #endif --- 2436,2464 ---- #ifdef MACINTOSH /* Extract "useful" letters */ ! for (i = 0; p_ptr->full_name[i]; i++) { ! char c = p_ptr->full_name[i]; /* Convert "dot" to "underscore" */ if (c == '.') c = '_'; /* Accept all the letters */ ! p_ptr->base_name[k++] = c; } #else /* Extract "useful" letters */ ! for (i = 0; p_ptr->full_name[i]; i++) { ! char c = p_ptr->full_name[i]; /* Accept some letters */ ! if (isalpha(c) || isdigit(c)) p_ptr->base_name[k++] = c; /* Convert space, dot, and underscore to underscore */ ! else if (strchr(". _", c)) p_ptr->base_name[k++] = '_'; } #endif *************** *** 2525,2534 **** #endif /* Terminate */ ! player_base[k] = '\0'; /* Require a "base" name */ ! if (!player_base[0]) strcpy(player_base, "PLAYER"); #ifdef SAVEFILE_MUTABLE --- 2472,2481 ---- #endif /* Terminate */ ! p_ptr->base_name[k] = '\0'; /* Require a "base" name */ ! if (!p_ptr->base_name[0]) strcpy(p_ptr->base_name, "PLAYER"); #ifdef SAVEFILE_MUTABLE *************** *** 2544,2559 **** char temp[128]; #ifdef SAVEFILE_USE_UID ! /* Rename the savefile, using the player_uid and player_base */ ! (void)sprintf(temp, "%d.%s", player_uid, player_base); #else ! /* Rename the savefile, using the player_base */ ! (void)sprintf(temp, "%s", player_base); #endif #ifdef VM /* Hack -- support "flat directory" usage on VM/ESA */ ! (void)sprintf(temp, "%s.sv", player_base); #endif /* VM */ /* Build the filename */ --- 2491,2506 ---- char temp[128]; #ifdef SAVEFILE_USE_UID ! /* Rename the savefile, using the player_uid and base_name */ ! (void)sprintf(temp, "%d.%s", player_uid, p_ptr->base_name); #else ! /* Rename the savefile, using the base name */ ! (void)sprintf(temp, "%s", p_ptr->base_name); #endif #ifdef VM /* Hack -- support "flat directory" usage on VM/ESA */ ! (void)sprintf(temp, "%s.sv", p_ptr->base_name); #endif /* VM */ /* Build the filename */ *************** *** 2589,2598 **** move_cursor(2, 15); /* Save the player name */ ! strcpy(tmp, player_name); /* Get an input, ignore "Escape" */ ! if (askfor_aux(tmp, 15)) strcpy(player_name, tmp); /* Process the player name */ process_player_name(FALSE); --- 2536,2545 ---- move_cursor(2, 15); /* Save the player name */ ! strcpy(tmp, p_ptr->full_name); /* Get an input, ignore "Escape" */ ! if (askfor_aux(tmp, 15)) strcpy(p_ptr->full_name, tmp); /* Process the player name */ process_player_name(FALSE); *************** *** 2602,2608 **** } /* Pad the name (to clear junk) */ ! sprintf(tmp, "%-15.15s", player_name); /* Re-Draw the name (in light blue) */ c_put_str(TERM_L_BLUE, tmp, 2, 15); --- 2549,2555 ---- } /* Pad the name (to clear junk) */ ! sprintf(tmp, "%-15.15s", p_ptr->full_name); /* Re-Draw the name (in light blue) */ c_put_str(TERM_L_BLUE, tmp, 2, 15); *************** *** 2651,2657 **** death = TRUE; /* Cause of death */ ! (void)strcpy(died_from, "Quitting"); } --- 2598,2604 ---- death = TRUE; /* Cause of death */ ! (void)strcpy(p_ptr->died_from, "Quitting"); } *************** *** 2677,2683 **** Term_fresh(); /* The player is not dead */ ! (void)strcpy(died_from, "(saved)"); /* Forbid suspend */ signals_ignore_tstp(); --- 2624,2630 ---- Term_fresh(); /* The player is not dead */ ! (void)strcpy(p_ptr->died_from, "(saved)"); /* Forbid suspend */ signals_ignore_tstp(); *************** *** 2701,2707 **** Term_fresh(); /* Note that the player is not dead */ ! (void)strcpy(died_from, "(alive and well)"); } --- 2648,2654 ---- Term_fresh(); /* Note that the player is not dead */ ! (void)strcpy(p_ptr->died_from, "(alive and well)"); } *************** *** 2711,2717 **** */ long total_points(void) { ! return (p_ptr->max_exp + (100 * p_ptr->max_dlv)); } --- 2658,2664 ---- */ long total_points(void) { ! return (p_ptr->max_exp + (100 * p_ptr->max_depth)); } *************** *** 2753,2764 **** if (!(noscore & 0x00FF)) { /* Ignore people who die in town */ ! if (dun_level) { char tmp[128]; /* XXX XXX XXX "Bones" name */ ! sprintf(tmp, "bone.%03d", dun_level); /* Build the filename */ path_build(str, 1024, ANGBAND_DIR_BONE, tmp); --- 2700,2711 ---- if (!(noscore & 0x00FF)) { /* Ignore people who die in town */ ! if (p_ptr->depth) { char tmp[128]; /* XXX XXX XXX "Bones" name */ ! sprintf(tmp, "bone.%03d", p_ptr->depth); /* Build the filename */ path_build(str, 1024, ANGBAND_DIR_BONE, tmp); *************** *** 2782,2788 **** if (!fp) return; /* Save the info */ ! fprintf(fp, "%s\n", player_name); fprintf(fp, "%d\n", p_ptr->mhp); fprintf(fp, "%d\n", p_ptr->prace); fprintf(fp, "%d\n", p_ptr->pclass); --- 2729,2735 ---- if (!fp) return; /* Save the info */ ! fprintf(fp, "%s\n", p_ptr->full_name); fprintf(fp, "%d\n", p_ptr->mhp); fprintf(fp, "%d\n", p_ptr->prace); fprintf(fp, "%d\n", p_ptr->pclass); *************** *** 2848,2854 **** p = player_title[p_ptr->pclass][(p_ptr->lev-1)/5]; } ! center_string(buf, player_name); put_str(buf, 6, 11); center_string(buf, "the"); --- 2795,2801 ---- p = player_title[p_ptr->pclass][(p_ptr->lev-1)/5]; } ! center_string(buf, p_ptr->full_name); put_str(buf, 6, 11); center_string(buf, "the"); *************** *** 2873,2883 **** center_string(buf, tmp); put_str(buf, 13, 11); ! (void)sprintf(tmp, "Killed on Level %d", dun_level); center_string(buf, tmp); put_str(buf, 14, 11); ! (void)sprintf(tmp, "by %s.", died_from); center_string(buf, tmp); put_str(buf, 15, 11); --- 2820,2830 ---- center_string(buf, tmp); put_str(buf, 13, 11); ! (void)sprintf(tmp, "Killed on Level %d", p_ptr->depth); center_string(buf, tmp); put_str(buf, 14, 11); ! (void)sprintf(tmp, "by %s.", p_ptr->died_from); center_string(buf, tmp); put_str(buf, 15, 11); *************** *** 3017,3022 **** --- 2964,2971 ---- /* Show 12 items */ for (j = 0; (j < 12) && (i < st_ptr->stock_num); j++, i++) { + byte attr; + char o_name[80]; char tmp_val[80]; *************** *** 3027,3035 **** sprintf(tmp_val, "%c) ", I2A(j)); prt(tmp_val, j+2, 4); ! /* Display object description */ object_desc(o_name, o_ptr, TRUE, 3); ! c_put_str(tval_to_attr[o_ptr->tval], o_name, j+2, 7); } /* Caption */ --- 2976,2992 ---- 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]; ! ! /* Disable inventory colors */ ! if (!inventory_colors) attr = TERM_WHITE; ! ! /* Display the object */ ! c_put_str(attr, o_name, j+2, 7); } /* Caption */ *************** *** 3046,3052 **** /* ! * Semi-Portable High Score List Entry (128 bytes) -- BEN * * All fields listed below are null terminated ascii strings. * --- 3003,3009 ---- /* ! * Semi-Portable High Score List Entry (128 bytes) * * All fields listed below are null terminated ascii strings. * *************** *** 3449,3455 **** #endif /* Interupted */ ! if (!total_winner && streq(died_from, "Interrupting")) { msg_print("Score not registered due to interruption."); msg_print(NULL); --- 3406,3412 ---- #endif /* Interupted */ ! if (!total_winner && streq(p_ptr->died_from, "Interrupting")) { msg_print("Score not registered due to interruption."); msg_print(NULL); *************** *** 3458,3464 **** } /* Quitter */ ! if (!total_winner && streq(died_from, "Quitting")) { msg_print("Score not registered due to quitting."); msg_print(NULL); --- 3415,3421 ---- } /* Quitter */ ! if (!total_winner && streq(p_ptr->died_from, "Quitting")) { msg_print("Score not registered due to quitting."); msg_print(NULL); *************** *** 3495,3501 **** #endif /* Save the player name (15 chars) */ ! sprintf(the_score.who, "%-.15s", player_name); /* Save the player info XXX XXX XXX */ sprintf(the_score.uid, "%7u", player_uid); --- 3452,3458 ---- #endif /* Save the player name (15 chars) */ ! sprintf(the_score.who, "%-.15s", p_ptr->full_name); /* Save the player info XXX XXX XXX */ sprintf(the_score.uid, "%7u", player_uid); *************** *** 3505,3516 **** /* Save the level and such */ sprintf(the_score.cur_lev, "%3d", p_ptr->lev); ! sprintf(the_score.cur_dun, "%3d", dun_level); ! sprintf(the_score.max_lev, "%3d", p_ptr->max_plv); ! sprintf(the_score.max_dun, "%3d", p_ptr->max_dlv); /* Save the cause of death (31 chars) */ ! sprintf(the_score.how, "%-.31s", died_from); /* Lock (for writing) the highscore file, or fail */ --- 3462,3473 ---- /* Save the level and such */ sprintf(the_score.cur_lev, "%3d", p_ptr->lev); ! sprintf(the_score.cur_dun, "%3d", p_ptr->depth); ! sprintf(the_score.max_lev, "%3d", p_ptr->max_lev); ! sprintf(the_score.max_dun, "%3d", p_ptr->max_depth); /* Save the cause of death (31 chars) */ ! sprintf(the_score.how, "%-.31s", p_ptr->died_from); /* Lock (for writing) the highscore file, or fail */ *************** *** 3578,3584 **** strcpy(the_score.day, "TODAY"); /* Save the player name (15 chars) */ ! sprintf(the_score.who, "%-.15s", player_name); /* Save the player info XXX XXX XXX */ sprintf(the_score.uid, "%7u", player_uid); --- 3535,3541 ---- strcpy(the_score.day, "TODAY"); /* Save the player name (15 chars) */ ! sprintf(the_score.who, "%-.15s", p_ptr->full_name); /* Save the player info XXX XXX XXX */ sprintf(the_score.uid, "%7u", player_uid); *************** *** 3588,3596 **** /* Save the level and such */ sprintf(the_score.cur_lev, "%3d", p_ptr->lev); ! sprintf(the_score.cur_dun, "%3d", dun_level); ! sprintf(the_score.max_lev, "%3d", p_ptr->max_plv); ! sprintf(the_score.max_dun, "%3d", p_ptr->max_dlv); /* Hack -- no cause of death */ strcpy(the_score.how, "nobody (yet!)"); --- 3545,3553 ---- /* Save the level and such */ sprintf(the_score.cur_lev, "%3d", p_ptr->lev); ! sprintf(the_score.cur_dun, "%3d", p_ptr->depth); ! sprintf(the_score.max_lev, "%3d", p_ptr->max_lev); ! sprintf(the_score.max_dun, "%3d", p_ptr->max_depth); /* Hack -- no cause of death */ strcpy(the_score.how, "nobody (yet!)"); *************** *** 3626,3646 **** /* ! * Change the player into a King! -RAK- */ static void kingly(void) { /* Hack -- retire in town */ ! dun_level = 0; /* Fake death */ ! (void)strcpy(died_from, "Ripe Old Age"); /* Restore the experience */ p_ptr->exp = p_ptr->max_exp; /* Restore the level */ ! p_ptr->lev = p_ptr->max_plv; /* Hack -- Instant Gold */ p_ptr->au += 10000000L; --- 3583,3603 ---- /* ! * Change the player into a Winner */ static void kingly(void) { /* Hack -- retire in town */ ! p_ptr->depth = 0; /* Fake death */ ! (void)strcpy(p_ptr->died_from, "Ripe Old Age"); /* Restore the experience */ p_ptr->exp = p_ptr->max_exp; /* Restore the level */ ! p_ptr->lev = p_ptr->max_lev; /* Hack -- Instant Gold */ p_ptr->au += 10000000L; *************** *** 3791,3797 **** signals_ignore_tstp(); /* Indicate panic save */ ! (void)strcpy(died_from, "(panic save)"); /* Panic save, or get worried */ if (!save_player()) quit("panic save failed!"); --- 3748,3754 ---- signals_ignore_tstp(); /* Indicate panic save */ ! (void)strcpy(p_ptr->died_from, "(panic save)"); /* Panic save, or get worried */ if (!save_player()) quit("panic save failed!"); *************** *** 3877,3883 **** if (death) { /* Mark the savefile */ ! (void)strcpy(died_from, "Abortion"); /* Close stuff */ close_game(); --- 3834,3840 ---- if (death) { /* Mark the savefile */ ! (void)strcpy(p_ptr->died_from, "Abortion"); /* Close stuff */ close_game(); *************** *** 3890,3896 **** else if (signal_count >= 5) { /* Cause of "death" */ ! (void)strcpy(died_from, "Interrupting"); /* Stop playing */ alive = FALSE; --- 3847,3853 ---- else if (signal_count >= 5) { /* Cause of "death" */ ! (void)strcpy(p_ptr->died_from, "Interrupting"); /* Stop playing */ alive = FALSE; *************** *** 3963,3969 **** panic_save = 1; /* Panic save */ ! (void)strcpy(died_from, "(panic save)"); /* Forbid suspend */ signals_ignore_tstp(); --- 3920,3926 ---- panic_save = 1; /* Panic save */ ! (void)strcpy(p_ptr->died_from, "(panic save)"); /* Forbid suspend */ signals_ignore_tstp(); Only in angband-281/src: files.o diff -r -c -w src-281/generate.c angband-281/src/generate.c *** src-281/generate.c Mon Mar 3 22:22:24 1997 --- angband-281/src/generate.c Thu Apr 24 10:25:11 1997 *************** *** 334,341 **** } /* Save the new player grid */ ! py = y; ! px = x; } --- 334,341 ---- } /* Save the new player grid */ ! p_ptr->py = y; ! p_ptr->px = x; } *************** *** 343,349 **** /* * Count the number of walls adjacent to the given grid. * ! * Note -- Assumes "in_bounds(y, x)" * * We count only granite walls and permanent walls. */ --- 343,349 ---- /* * Count the number of walls adjacent to the given grid. * ! * Note -- Assumes "in_bounds_fully(y, x)" * * We count only granite walls and permanent walls. */ *************** *** 410,420 **** if (!cave_clean_bold(y, x)) return; /* Choose a staircase */ ! if (!dun_level) { place_down_stairs(y, x); } ! else if (is_quest(dun_level) || (dun_level >= MAX_DEPTH-1)) { place_up_stairs(y, x); } --- 410,420 ---- if (!cave_clean_bold(y, x)) return; /* Choose a staircase */ ! if (!p_ptr->depth) { place_down_stairs(y, x); } ! else if (is_quest(p_ptr->depth) || (p_ptr->depth >= MAX_DEPTH-1)) { place_up_stairs(y, x); } *************** *** 543,549 **** c_ptr = &cave[y][x]; /* Town -- must go down */ ! if (!dun_level) { /* Clear previous contents, add down stairs */ c_ptr->feat = FEAT_MORE; --- 543,549 ---- c_ptr = &cave[y][x]; /* Town -- must go down */ ! if (!p_ptr->depth) { /* Clear previous contents, add down stairs */ c_ptr->feat = FEAT_MORE; *************** *** 550,556 **** } /* Quest -- must go up */ ! else if (is_quest(dun_level) || (dun_level >= MAX_DEPTH-1)) { /* Clear previous contents, add up stairs */ c_ptr->feat = FEAT_LESS; --- 550,556 ---- } /* Quest -- must go up */ ! else if (is_quest(p_ptr->depth) || (p_ptr->depth >= MAX_DEPTH-1)) { /* Clear previous contents, add up stairs */ c_ptr->feat = FEAT_LESS; *************** *** 678,684 **** { ty = rand_spread(y, d); tx = rand_spread(x, d); ! if (!in_bounds2(ty, tx)) continue; break; } --- 678,684 ---- { ty = rand_spread(y, d); tx = rand_spread(x, d); ! if (!in_bounds(ty, tx)) continue; break; } *************** *** 700,706 **** y += ddy[dir]; x += ddx[dir]; ! /* Quit before leaving the dungeon */ if (!in_bounds(y, x)) break; } } --- 700,706 ---- y += ddy[dir]; x += ddx[dir]; ! /* Stop at dungeon edge */ if (!in_bounds(y, x)) break; } } *************** *** 731,737 **** for (x = (x1 - 15); x <= (x1 + 15); x++) { /* Skip illegal grids */ ! if (!in_bounds(y, x)) continue; /* Extract the distance */ k = distance(y1, x1, y, x); --- 731,737 ---- for (x = (x1 - 15); x <= (x1 + 15); x++) { /* Skip illegal grids */ ! if (!in_bounds_fully(y, x)) continue; /* Extract the distance */ k = distance(y1, x1, y, x); *************** *** 907,915 **** if (!cave_empty_bold(y, x)) continue; /* Place the monster (allow groups) */ ! monster_level = dun_level + 2; (void)place_monster(y, x, TRUE, TRUE); ! monster_level = dun_level; } } } --- 907,915 ---- if (!cave_empty_bold(y, x)) continue; /* Place the monster (allow groups) */ ! monster_level = p_ptr->depth + 2; (void)place_monster(y, x, TRUE, TRUE); ! monster_level = p_ptr->depth; } } } *************** *** 946,952 **** /* Choose lite or dark */ ! light = (dun_level <= randint(25)); /* Pick a room size */ --- 946,952 ---- /* Choose lite or dark */ ! light = (p_ptr->depth <= randint(25)); /* Pick a room size */ *************** *** 1035,1041 **** /* Choose lite or dark */ ! light = (dun_level <= randint(25)); /* Determine extents of the first room */ --- 1035,1041 ---- /* Choose lite or dark */ ! light = (p_ptr->depth <= randint(25)); /* Determine extents of the first room */ *************** *** 1158,1164 **** /* Choose lite or dark */ ! light = (dun_level <= randint(25)); /* For now, always 3x3 */ --- 1158,1164 ---- /* Choose lite or dark */ ! light = (p_ptr->depth <= randint(25)); /* For now, always 3x3 */ *************** *** 1407,1413 **** /* Choose lite or dark */ ! light = (dun_level <= randint(25)); /* Large room */ --- 1407,1413 ---- /* Choose lite or dark */ ! light = (p_ptr->depth <= randint(25)); /* Large room */ *************** *** 1983,1989 **** /* Hack -- Choose a nest type */ ! tmp = randint(dun_level); /* Monster nest (jelly) */ if (tmp < 30) --- 1983,1989 ---- /* Hack -- Choose a nest type */ ! tmp = randint(p_ptr->depth); /* Monster nest (jelly) */ if (tmp < 30) *************** *** 2023,2029 **** for (i = 0; i < 64; i++) { /* Get a (hard) monster type */ ! what[i] = get_mon_num(dun_level + 10); /* Notice failure */ if (!what[i]) empty = TRUE; --- 2023,2029 ---- for (i = 0; i < 64; i++) { /* Get a (hard) monster type */ ! what[i] = get_mon_num(p_ptr->depth + 10); /* Notice failure */ if (!what[i]) empty = TRUE; *************** *** 2053,2059 **** rating += 10; /* (Sometimes) Cause a "special feeling" (for "Monster Nests") */ ! if ((dun_level <= 40) && (randint(dun_level*dun_level + 1) < 300)) { good_item_flag = TRUE; } --- 2053,2059 ---- rating += 10; /* (Sometimes) Cause a "special feeling" (for "Monster Nests") */ ! if ((p_ptr->depth <= 40) && (randint(p_ptr->depth*p_ptr->depth + 1) < 300)) { good_item_flag = TRUE; } *************** *** 2199,2205 **** /* Choose a pit type */ ! tmp = randint(dun_level); /* Orc pit */ if (tmp < 20) --- 2199,2205 ---- /* Choose a pit type */ ! tmp = randint(p_ptr->depth); /* Orc pit */ if (tmp < 20) *************** *** 2341,2347 **** for (i = 0; i < 16; i++) { /* Get a (hard) monster type */ ! what[i] = get_mon_num(dun_level + 10); /* Notice failure */ if (!what[i]) empty = TRUE; --- 2341,2347 ---- for (i = 0; i < 16; i++) { /* Get a (hard) monster type */ ! what[i] = get_mon_num(p_ptr->depth + 10); /* Notice failure */ if (!what[i]) empty = TRUE; *************** *** 2409,2415 **** rating += 10; /* (Sometimes) Cause a "special feeling" (for "Monster Pits") */ ! if ((dun_level <= 40) && (randint(dun_level*dun_level + 1) < 300)) { good_item_flag = TRUE; } --- 2409,2415 ---- rating += 10; /* (Sometimes) Cause a "special feeling" (for "Monster Pits") */ ! if ((p_ptr->depth <= 40) && (randint(p_ptr->depth*p_ptr->depth + 1) < 300)) { good_item_flag = TRUE; } *************** *** 2562,2570 **** /* Monster */ case '&': { ! monster_level = dun_level + 5; place_monster(y, x, TRUE, TRUE); ! monster_level = dun_level; break; } --- 2562,2570 ---- /* Monster */ case '&': { ! monster_level = p_ptr->depth + 5; place_monster(y, x, TRUE, TRUE); ! monster_level = p_ptr->depth; break; } *************** *** 2571,2579 **** /* Meaner monster */ case '@': { ! monster_level = dun_level + 11; place_monster(y, x, TRUE, TRUE); ! monster_level = dun_level; break; } --- 2571,2579 ---- /* Meaner monster */ case '@': { ! monster_level = p_ptr->depth + 11; place_monster(y, x, TRUE, TRUE); ! monster_level = p_ptr->depth; break; } *************** *** 2580,2591 **** /* Meaner monster, plus treasure */ case '9': { ! monster_level = dun_level + 9; place_monster(y, x, TRUE, TRUE); ! monster_level = dun_level; ! object_level = dun_level + 7; place_object(y, x, TRUE, FALSE); ! object_level = dun_level; break; } --- 2580,2591 ---- /* Meaner monster, plus treasure */ case '9': { ! monster_level = p_ptr->depth + 9; place_monster(y, x, TRUE, TRUE); ! monster_level = p_ptr->depth; ! object_level = p_ptr->depth + 7; place_object(y, x, TRUE, FALSE); ! object_level = p_ptr->depth; break; } *************** *** 2592,2603 **** /* Nasty monster and treasure */ case '8': { ! monster_level = dun_level + 40; place_monster(y, x, TRUE, TRUE); ! monster_level = dun_level; ! object_level = dun_level + 20; place_object(y, x, TRUE, TRUE); ! object_level = dun_level; break; } --- 2592,2603 ---- /* Nasty monster and treasure */ case '8': { ! monster_level = p_ptr->depth + 40; place_monster(y, x, TRUE, TRUE); ! monster_level = p_ptr->depth; ! object_level = p_ptr->depth + 20; place_object(y, x, TRUE, TRUE); ! object_level = p_ptr->depth; break; } *************** *** 2606,2620 **** { if (rand_int(100) < 50) { ! monster_level = dun_level + 3; place_monster(y, x, TRUE, TRUE); ! monster_level = dun_level; } if (rand_int(100) < 50) { ! object_level = dun_level + 7; place_object(y, x, FALSE, FALSE); ! object_level = dun_level; } break; } --- 2606,2620 ---- { if (rand_int(100) < 50) { ! monster_level = p_ptr->depth + 3; place_monster(y, x, TRUE, TRUE); ! monster_level = p_ptr->depth; } if (rand_int(100) < 50) { ! object_level = p_ptr->depth + 7; place_object(y, x, FALSE, FALSE); ! object_level = p_ptr->depth; } break; } *************** *** 2649,2656 **** rating += v_ptr->rat; /* (Sometimes) Cause a special feeling */ ! if ((dun_level <= 50) || ! (randint((dun_level-40) * (dun_level-40) + 1) < 400)) { good_item_flag = TRUE; } --- 2649,2656 ---- rating += v_ptr->rat; /* (Sometimes) Cause a special feeling */ ! if ((p_ptr->depth <= 50) || ! (randint((p_ptr->depth-40) * (p_ptr->depth-40) + 1) < 400)) { good_item_flag = TRUE; } *************** *** 2685,2692 **** rating += v_ptr->rat; /* (Sometimes) Cause a special feeling */ ! if ((dun_level <= 50) || ! (randint((dun_level-40) * (dun_level-40) + 1) < 400)) { good_item_flag = TRUE; } --- 2685,2692 ---- rating += v_ptr->rat; /* (Sometimes) Cause a special feeling */ ! if ((p_ptr->depth <= 50) || ! (randint((p_ptr->depth-40) * (p_ptr->depth-40) + 1) < 400)) { good_item_flag = TRUE; } *************** *** 2779,2786 **** tmp_col = col1 + col_dir; ! /* Extremely Important -- do not leave the dungeon */ ! while (!in_bounds(tmp_row, tmp_col)) { /* Acquire the correct direction */ correct_dir(&row_dir, &col_dir, row1, col1, row2, col2); --- 2779,2786 ---- tmp_col = col1 + col_dir; ! /* 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); *************** *** 2962,2972 **** /* * Count the number of "corridor" grids adjacent to the given grid. * ! * Note -- Assumes "in_bounds(y1, x1)" * ! * XXX XXX This routine currently only counts actual "empty floor" ! * grids which are not in rooms. We might want to also count stairs, ! * open doors, closed doors, etc. */ static int next_to_corr(int y1, int x1) { --- 2962,2972 ---- /* * Count the number of "corridor" grids adjacent to the given grid. * ! * Note -- Assumes "in_bounds_fully(y1, x1)" * ! * This routine currently only counts actual "empty floor" grids ! * which are not in rooms. We might want to also count stairs, ! * open doors, closed doors, etc. XXX XXX */ static int next_to_corr(int y1, int x1) { *************** *** 3006,3012 **** * Determine if the given location is "between" two walls, * and "next to" two corridor spaces. XXX XXX XXX * ! * Assumes "in_bounds(y,x)" */ static bool possible_doorway(int y, int x) { --- 3006,3012 ---- * Determine if the given location is "between" two walls, * and "next to" two corridor spaces. XXX XXX XXX * ! * Assumes "in_bounds_fully(y,x)" */ static bool possible_doorway(int y, int x) { *************** *** 3070,3076 **** /* Restrict level */ ! if (dun_level < room[typ].level) return (FALSE); /* Restrict "crowded" rooms */ if (dun->crowded && ((typ == 5) || (typ == 6))) return (FALSE); --- 3070,3076 ---- /* Restrict level */ ! if (p_ptr->depth < room[typ].level) return (FALSE); /* Restrict "crowded" rooms */ if (dun->crowded && ((typ == 5) || (typ == 6))) return (FALSE); *************** *** 3175,3184 **** /* Possible "destroyed" level */ ! if ((dun_level > 10) && (rand_int(DUN_DEST) == 0)) destroyed = TRUE; /* Hack -- No destroyed "quest" levels */ ! if (is_quest(dun_level)) destroyed = FALSE; /* Actual maximum number of rooms on this level */ --- 3175,3184 ---- /* Possible "destroyed" level */ ! if ((p_ptr->depth > 10) && (rand_int(DUN_DEST) == 0)) destroyed = TRUE; /* Hack -- No destroyed "quest" levels */ ! if (is_quest(p_ptr->depth)) destroyed = FALSE; /* Actual maximum number of rooms on this level */ *************** *** 3230,3242 **** } /* Attempt an "unusual" room */ ! if (rand_int(DUN_UNUSUAL) < dun_level) { /* Roll for room type */ k = rand_int(100); /* Attempt a very unusual room */ ! if (rand_int(DUN_UNUSUAL) < dun_level) { /* Type 8 -- Greater vault (10%) */ if ((k < 10) && room_build(y, x, 8)) continue; --- 3230,3242 ---- } /* Attempt an "unusual" room */ ! if (rand_int(DUN_UNUSUAL) < p_ptr->depth) { /* Roll for room type */ k = rand_int(100); /* Attempt a very unusual room */ ! if (rand_int(DUN_UNUSUAL) < p_ptr->depth) { /* Type 8 -- Greater vault (10%) */ if ((k < 10) && room_build(y, x, 8)) continue; *************** *** 3378,3384 **** /* Basic "amount" */ ! k = (dun_level / 3); if (k > 10) k = 10; if (k < 2) k = 2; --- 3378,3384 ---- /* Basic "amount" */ ! k = (p_ptr->depth / 3); if (k > 10) k = 10; if (k < 2) k = 2; *************** *** 3571,3578 **** c_ptr->info |= (CAVE_MARK); /* Hack -- the player starts on the stairs */ ! py = y; ! px = x; /* Hack -- use the "complex" RNG */ --- 3571,3578 ---- c_ptr->info |= (CAVE_MARK); /* Hack -- the player starts on the stairs */ ! p_ptr->py = y; ! p_ptr->px = x; /* Hack -- use the "complex" RNG */ *************** *** 3698,3704 **** /* ! * Generates a random dungeon level -RAK- * * Hack -- regenerate any "overflow" levels * --- 3698,3704 ---- /* ! * Generate a random dungeon level * * Hack -- regenerate any "overflow" levels * *************** *** 3735,3741 **** /* Mega-Hack -- no player yet */ ! px = py = 0; /* Mega-Hack -- no panel yet */ --- 3735,3741 ---- /* Mega-Hack -- no player yet */ ! p_ptr->px = p_ptr->py = 0; /* Mega-Hack -- no panel yet */ *************** *** 3746,3755 **** /* Reset the monster generation level */ ! monster_level = dun_level; /* Reset the object generation level */ ! object_level = dun_level; /* Nothing special here yet */ good_item_flag = FALSE; --- 3746,3755 ---- /* Reset the monster generation level */ ! monster_level = p_ptr->depth; /* Reset the object generation level */ ! object_level = p_ptr->depth; /* Nothing special here yet */ good_item_flag = FALSE; *************** *** 3759,3765 **** /* Build the town */ ! if (!dun_level) { /* Small town */ cur_hgt = SCREEN_HGT; --- 3759,3765 ---- /* Build the town */ ! if (!p_ptr->depth) { /* Small town */ cur_hgt = SCREEN_HGT; *************** *** 3815,3821 **** if ((turn - old_turn) < 1000) feeling = 0; /* Hack -- no feeling in the town */ ! if (!dun_level) feeling = 0; /* Prevent object over-flow */ --- 3815,3821 ---- if ((turn - old_turn) < 1000) feeling = 0; /* Hack -- no feeling in the town */ ! if (!p_ptr->depth) feeling = 0; /* Prevent object over-flow */ *************** *** 3843,3852 **** { /* Require "goodness" */ if ((feeling > 9) || ! ((dun_level >= 5) && (feeling > 8)) || ! ((dun_level >= 10) && (feeling > 7)) || ! ((dun_level >= 20) && (feeling > 6)) || ! ((dun_level >= 40) && (feeling > 5))) { /* Give message to cheaters */ if (cheat_room || cheat_hear || --- 3843,3852 ---- { /* Require "goodness" */ if ((feeling > 9) || ! ((p_ptr->depth >= 5) && (feeling > 8)) || ! ((p_ptr->depth >= 10) && (feeling > 7)) || ! ((p_ptr->depth >= 20) && (feeling > 6)) || ! ((p_ptr->depth >= 40) && (feeling > 5))) { /* Give message to cheaters */ if (cheat_room || cheat_hear || Only in angband-281/src: generate.o diff -r -c -w src-281/h-system.h angband-281/src/h-system.h *** src-281/h-system.h Mon Mar 3 22:22:40 1997 --- angband-281/src/h-system.h Thu Apr 24 10:25:29 1997 *************** *** 59,65 **** #endif #if !defined(MACINTOSH) && !defined(AMIGA) && \ ! !defined(ACORN) && !defined(VM) # if defined(__TURBOC__) || defined(__WATCOMC__) # include # else --- 59,65 ---- #endif #if !defined(MACINTOSH) && !defined(AMIGA) && \ ! !defined(ACORN) && !defined(VM) && !defined(__MWERKS__) # if defined(__TURBOC__) || defined(__WATCOMC__) # include # else diff -r -c -w src-281/h-type.h angband-281/src/h-type.h *** src-281/h-type.h Mon Mar 3 22:22:43 1997 --- angband-281/src/h-type.h Thu Apr 24 10:25:35 1997 *************** *** 10,17 **** * This improves readibility and standardizes the code. * * Likewise, all complex types are at least 4 letters. ! * Thus, almost every three letter word is a legal variable. ! * But beware of certain reserved words ('for' and 'if' and 'do'). * * Note that the type used in structures for bit flags should be uint. * As long as these bit flags are sequential, they will be space smart. --- 10,17 ---- * This improves readibility and standardizes the code. * * Likewise, all complex types are at least 4 letters. ! * Thus, almost every 1 to 3 letter word is a legal variable, ! * except for certain reserved words ('for' and 'if' and 'do'). * * Note that the type used in structures for bit flags should be uint. * As long as these bit flags are sequential, they will be space smart. *************** *** 18,41 **** * * Note that on some machines, apparently "signed char" is illegal. * ! * It must be true that char/byte takes exactly 1 byte ! * It must be true that sind/uind takes exactly 2 bytes ! * It must be true that sbig/ubig takes exactly 4 bytes * ! * On Sparc's, a sint takes 4 bytes (2 is legal) ! * On Sparc's, a uint takes 4 bytes (2 is legal) ! * On Sparc's, a long takes 4 bytes (8 is legal) ! * On Sparc's, a huge takes 4 bytes (8 is legal) ! * On Sparc's, a vptr takes 4 bytes (8 is legal) ! * On Sparc's, a real takes 8 bytes (4 is legal) * * Note that some files have already been included by "h-include.h" * These include and , which define some types ! * In particular, uint is defined so we do not have to define it * ! * Also, see for min/max values for sind, uind, long, huge ! * (SHRT_MIN, SHRT_MAX, USHRT_MAX, LONG_MIN, LONG_MAX, ULONG_MAX) ! * These limits should be verified and coded into "h-constant.h". */ --- 18,44 ---- * * Note that on some machines, apparently "signed char" is illegal. * ! * A char/byte takes exactly 1 byte ! * A s16b/u16b takes exactly 2 bytes ! * A s32b/u32b takes exactly 4 bytes * ! * A sint/uint takes at least 2 bytes ! * A long/huge takes at least 4 bytes * + * A real normally takes from 4 to 10 bytes + * A vptr normally takes 4 (rarely 8) bytes + * * Note that some files have already been included by "h-include.h" * These include and , which define some types ! * In particular, "bool", "byte", "uint", and "huge" may be defined ! * already, possibly using "typedefs" of various kinds, and possibly ! * being defined to something other than required by my code. So we ! * simply redefine them all using a stupid "_hack" suffix. * ! * Also, see for min/max values for sint, uint, long, huge ! * (INT_MIN, INT_MAX, 0, UINT_MAX, LONG_MIN, LONG_MAX, 0, ULONG_MAX). ! * These limits should be verified and coded into "h-constant.h", or ! * perhaps not, since those types have "unknown" length by definition. */ *************** *** 43,61 **** /*** Special 4 letter names for some standard types ***/ ! /* A standard pointer (to "void" because ANSI C says so) */ typedef void *vptr; ! /* A simple pointer (to unmodifiable strings) */ typedef const char *cptr; ! /* Since float's are silly, hard code real numbers as doubles */ typedef double real; ! /* Error codes for function return values */ ! /* Success = 0, Failure = -N, Problem = +N */ typedef int errr; --- 46,64 ---- /*** Special 4 letter names for some standard types ***/ ! /* A generic pointer */ typedef void *vptr; ! ! /* A string pointer */ typedef const char *cptr; ! /* A real number */ typedef double real; ! /* An error code */ typedef int errr; *************** *** 127,167 **** - - /*** Pointers to all the basic types defined above ***/ - - typedef real *real_ptr; - typedef errr *errr_ptr; - typedef char *char_ptr; - typedef byte *byte_ptr; - typedef bool *bool_ptr; - typedef sint *sint_ptr; - typedef uint *uint_ptr; - typedef long *long_ptr; - typedef huge *huge_ptr; - typedef s16b *s16b_ptr; - typedef u16b *u16b_ptr; - typedef s32b *s32b_ptr; - typedef u32b *u32b_ptr; - typedef vptr *vptr_ptr; - typedef cptr *cptr_ptr; - - - - /*** Pointers to Functions with simple return types and any args ***/ - - typedef void (*func_void)(); - typedef errr (*func_errr)(); - typedef char (*func_char)(); - typedef byte (*func_byte)(); - typedef bool (*func_bool)(); - typedef sint (*func_sint)(); - typedef uint (*func_uint)(); - typedef real (*func_real)(); - typedef vptr (*func_vptr)(); - typedef cptr (*func_cptr)(); - - /*** Pointers to Functions of special types (for various purposes) ***/ --- 130,135 ---- diff -r -c -w src-281/init1.c angband-281/src/init1.c *** src-281/init1.c Mon Mar 3 22:23:07 1997 --- angband-281/src/init1.c Thu Apr 24 10:25:54 1997 *************** *** 381,388 **** "TUNNEL", "SPEED", "BLOWS", ! "XXX3", ! "XXX4", "SLAY_ANIMAL", "SLAY_EVIL", "SLAY_UNDEAD", --- 381,388 ---- "TUNNEL", "SPEED", "BLOWS", ! "SHOTS", ! "MIGHT", "SLAY_ANIMAL", "SLAY_EVIL", "SLAY_UNDEAD", *************** *** 393,400 **** "SLAY_DRAGON", "KILL_DRAGON", "XXX5", - "IMPACT", "XXX6", "BRAND_ACID", "BRAND_ELEC", "BRAND_FIRE", --- 393,400 ---- "SLAY_DRAGON", "KILL_DRAGON", "XXX5", "XXX6", + "XXX7", "BRAND_ACID", "BRAND_ELEC", "BRAND_FIRE", *************** *** 414,441 **** "SUST_CHR", "XXX1", "XXX2", "IM_ACID", "IM_ELEC", "IM_FIRE", "IM_COLD", - "XXX3", - "XXX4", - "FREE_ACT", - "HOLD_LIFE", "RES_ACID", "RES_ELEC", "RES_FIRE", "RES_COLD", "RES_POIS", ! "XXX5", "RES_LITE", "RES_DARK", "RES_BLIND", ! "RES_CONF", "RES_SOUND", ! "RES_SHARDS", ! "RES_NETHER", "RES_NEXUS", "RES_CHAOS", "RES_DISEN" }; --- 414,441 ---- "SUST_CHR", "XXX1", "XXX2", + "XXX3", + "XXX4", + "XXX5", + "XXX6", "IM_ACID", "IM_ELEC", "IM_FIRE", "IM_COLD", "RES_ACID", "RES_ELEC", "RES_FIRE", "RES_COLD", "RES_POIS", ! "RES_FEAR", "RES_LITE", "RES_DARK", "RES_BLIND", ! "RES_CONFU", "RES_SOUND", ! "RES_SHARD", "RES_NEXUS", + "RES_NETHR", "RES_CHAOS", "RES_DISEN" }; *************** *** 445,480 **** */ static cptr k_info_flags3[] = { "XXX1", "XXX2", "XXX3", "XXX4", ! "XXX5", ! "XXX6", ! "XXX7", ! "XXX8", ! "EASY_KNOW", ! "HIDE_TYPE", ! "SHOW_MODS", ! "INSTA_ART", ! "FEATHER", ! "LITE", ! "SEE_INVIS", ! "TELEPATHY", ! "SLOW_DIGEST", ! "REGEN", ! "XTRA_MIGHT", ! "XTRA_SHOTS", "IGNORE_ACID", "IGNORE_ELEC", "IGNORE_FIRE", "IGNORE_COLD", ! "ACTIVATE", ! "DRAIN_EXP", ! "TELEPORT", ! "AGGRAVATE", "BLESSED", ! "CURSED", "HEAVY_CURSE", "PERMA_CURSE" }; --- 445,480 ---- */ static cptr k_info_flags3[] = { + "SLOW_DIGEST", + "FEATHER", + "LITE", + "REGEN", + "TELEPATHY", + "SEE_INVIS", + "FREE_ACT", + "HOLD_LIFE", "XXX1", "XXX2", "XXX3", "XXX4", ! "IMPACT", ! "TELEPORT", ! "AGGRAVATE", ! "DRAIN_EXP", "IGNORE_ACID", "IGNORE_ELEC", "IGNORE_FIRE", "IGNORE_COLD", ! "XXX5", ! "XXX6", "BLESSED", ! "ACTIVATE", ! "INSTA_ART", ! "EASY_KNOW", ! "HIDE_TYPE", ! "SHOW_MODS", ! "XXX7", ! "LIGHT_CURSE", "HEAVY_CURSE", "PERMA_CURSE" }; Only in angband-281/src: init1.o diff -r -c -w src-281/init2.c angband-281/src/init2.c *** src-281/init2.c Mon Mar 3 22:23:39 1997 --- angband-281/src/init2.c Thu Apr 24 10:26:25 1997 *************** *** 2152,2169 **** /* Accept */ option_mask[os] |= (1L << ob); ! /* Set */ if (option_info[i].o_norm) { ! /* Set */ option_flag[os] |= (1L << ob); - } ! /* Clear */ ! else ! { ! /* Clear */ ! option_flag[os] &= ~(1L << ob); } } } --- 2152,2165 ---- /* Accept */ option_mask[os] |= (1L << ob); ! /* Set by default */ if (option_info[i].o_norm) { ! /* Set the flag */ option_flag[os] |= (1L << ob); ! /* Set the variable */ ! (*option_info[i].o_var) = TRUE; } } } *************** *** 2615,2646 **** /*** Load default user pref files ***/ /* Initialize feature info */ ! note("[Initializing user pref files...]"); - /* Access the "basic" pref file */ - strcpy(buf, "pref.prf"); - /* Process that file */ ! process_pref_file(buf); - /* Access the "user" pref file */ - sprintf(buf, "user.prf"); - - /* Process that file */ - process_pref_file(buf); - - /* Access the "basic" system pref file */ - sprintf(buf, "pref-%s.prf", ANGBAND_SYS); - - /* Process that file */ - process_pref_file(buf); - - /* Access the "user" system pref file */ - sprintf(buf, "user-%s.prf", ANGBAND_SYS); - - /* Process that file */ - process_pref_file(buf); - /* Done */ note("[Initialization complete]"); } --- 2611,2621 ---- /*** Load default user pref files ***/ /* Initialize feature info */ ! note("[Loading basic user pref file...]"); /* Process that file */ ! (void)process_pref_file("pref.prf"); /* Done */ note("[Initialization complete]"); } Only in angband-281/src: init2.o diff -r -c -w src-281/load1.c angband-281/src/load1.c *** src-281/load1.c Mon Mar 3 22:24:09 1997 --- angband-281/src/load1.c Thu Apr 24 10:27:04 1997 *************** *** 503,509 **** /* * Convert old kinds into normal kinds * ! * XXX XXX XXX Note hard-coded use of object kind indexes. */ static s16b convert_old_kinds_normal[501] = { --- 503,509 ---- /* * Convert old kinds into normal kinds * ! * Note hard-coded use of object kind indexes XXX XXX XXX */ static s16b convert_old_kinds_normal[501] = { *************** *** 1110,1117 **** /* Paranoia */ ! if ((old_k_idx < 0) || (old_k_idx >= 513) || ! (old_names < 0) || (old_names >= 180)) { note("Illegal object!"); return (1); --- 1110,1116 ---- /* Paranoia */ ! if ((old_k_idx < 0) || (old_k_idx >= 513) || (old_names >= 180)) { note("Illegal object!"); return (1); *************** *** 1177,1183 **** if (k_ptr->cost <= 0) o_ptr->ident |= (IDENT_BROKEN); /* Hack -- assume "cursed" items */ ! if (k_ptr->flags3 & (TR3_CURSED)) o_ptr->ident |= (IDENT_CURSED); /*** Hack -- repair ego-item names ***/ --- 1176,1182 ---- if (k_ptr->cost <= 0) o_ptr->ident |= (IDENT_BROKEN); /* Hack -- assume "cursed" items */ ! if (k_ptr->flags3 & (TR3_LIGHT_CURSE)) o_ptr->ident |= (IDENT_CURSED); /*** Hack -- repair ego-item names ***/ *************** *** 1390,1396 **** o_ptr->weight = a_ptr->weight; /* Assume current "curse" */ ! if (a_ptr->flags3 & (TR3_CURSED)) o_ptr->ident |= (IDENT_CURSED); } /* Update ego-items */ --- 1389,1395 ---- o_ptr->weight = a_ptr->weight; /* Assume current "curse" */ ! if (a_ptr->flags3 & (TR3_LIGHT_CURSE)) o_ptr->ident |= (IDENT_CURSED); } /* Update ego-items */ *************** *** 1423,1429 **** } /* Assume current "curse" */ ! if (e_ptr->flags3 & (TR3_CURSED)) o_ptr->ident |= (IDENT_CURSED); } --- 1422,1428 ---- } /* Assume current "curse" */ ! if (e_ptr->flags3 & (TR3_LIGHT_CURSE)) o_ptr->ident |= (IDENT_CURSED); } *************** *** 1490,1512 **** /* Read the items */ for (j = 0; j < num; j++) { ! object_type forge; ! object_type *q_ptr; /* Strip the old "fixed cost" */ strip_bytes(4); /* Get local object */ ! q_ptr = &forge; /* Wipe the object */ ! object_wipe(q_ptr); /* Load the item */ ! rd_item_old(q_ptr); /* Forget the inscription */ ! q_ptr->note = 0; /* Save "valid" items */ if (st_ptr->stock_num < STORE_INVEN_MAX) --- 1489,1511 ---- /* Read the items */ for (j = 0; j < num; j++) { ! object_type *i_ptr; ! object_type object_type_body; /* Strip the old "fixed cost" */ strip_bytes(4); /* Get local object */ ! i_ptr = &object_type_body; /* Wipe the object */ ! object_wipe(i_ptr); /* Load the item */ ! rd_item_old(i_ptr); /* Forget the inscription */ ! i_ptr->note = 0; /* Save "valid" items */ if (st_ptr->stock_num < STORE_INVEN_MAX) *************** *** 1514,1520 **** int k = st_ptr->stock_num++; /* Add that item to the store */ ! object_copy(&st_ptr->stock[k], q_ptr); } } --- 1513,1519 ---- int k = st_ptr->stock_num++; /* Add that item to the store */ ! object_copy(&st_ptr->stock[k], i_ptr); } } *************** *** 1697,1703 **** int i; ! rd_string(player_name, 32); rd_byte(&p_ptr->psex); rd_s32b(&p_ptr->au); --- 1696,1702 ---- int i; ! rd_string(p_ptr->full_name, 32); rd_byte(&p_ptr->psex); rd_s32b(&p_ptr->au); *************** *** 1708,1714 **** rd_s16b(&p_ptr->ht); rd_s16b(&p_ptr->wt); rd_s16b(&p_ptr->lev); ! rd_s16b(&p_ptr->max_dlv); strip_bytes(8); rd_s16b(&p_ptr->msp); rd_s16b(&p_ptr->mhp); --- 1707,1713 ---- rd_s16b(&p_ptr->ht); rd_s16b(&p_ptr->wt); rd_s16b(&p_ptr->lev); ! rd_s16b(&p_ptr->max_depth); strip_bytes(8); rd_s16b(&p_ptr->msp); rd_s16b(&p_ptr->mhp); *************** *** 1724,1739 **** rd_s16b(&p_ptr->chp); rd_u16b(&p_ptr->chp_frac); ! /* Repair maximum player level XXX XXX XXX */ ! if (p_ptr->max_plv < p_ptr->lev) p_ptr->max_plv = p_ptr->lev; ! /* Repair maximum dungeon level */ ! if (p_ptr->max_dlv < 0) p_ptr->max_dlv = 1; /* Read the history */ for (i = 0; i < 4; i++) { ! rd_string(history[i], 60); } /* Read the "maximum" stats */ --- 1723,1738 ---- rd_s16b(&p_ptr->chp); rd_u16b(&p_ptr->chp_frac); ! /* Hack -- Repair maximum player level */ ! if (p_ptr->max_lev < p_ptr->lev) p_ptr->max_lev = p_ptr->lev; ! /* Hack -- Repair maximum dungeon level */ ! if (p_ptr->max_depth < 0) p_ptr->max_depth = 1; /* Read the history */ for (i = 0; i < 4; i++) { ! rd_string(p_ptr->history[i], 60); } /* Read the "maximum" stats */ *************** *** 1903,1913 **** * Where important, we attempt to recover lost information, or * at least to simulate the presence of such information. * ! * XXX XXX XXX Prevent old "terrain" objects in inventory. * ! * XXX XXX XXX Only 512 objects may appear in old savefiles. ! * ! * XXX XXX XXX Only 1024 monsters may appear in old savefiles. */ static errr rd_dungeon_old(void) { --- 1902,1910 ---- * Where important, we attempt to recover lost information, or * at least to simulate the presence of such information. * ! * Old savefiles may only contain 512 objects and 1024 monsters. * ! * Prevent old "terrain" objects in inventory XXX XXX */ static errr rd_dungeon_old(void) { *************** *** 1926,1935 **** /* Header info */ ! rd_s16b(&dun_level); ! rd_s16b(&py); ! rd_s16b(&px); ! rd_s16b(&num_repro); rd_s16b(&cur_hgt); rd_s16b(&cur_wid); rd_s16b(&max_panel_rows); --- 1923,1932 ---- /* Header info */ ! rd_s16b(&p_ptr->depth); ! rd_s16b(&p_ptr->py); ! rd_s16b(&p_ptr->px); ! rd_u16b(&tmp16u); rd_s16b(&cur_hgt); rd_s16b(&cur_wid); rd_s16b(&max_panel_rows); *************** *** 1937,1943 **** /* Paranoia */ ! if ((dun_level < 0) || (dun_level > MAX_DEPTH)) { note("Illegal dungeon level!"); return (1); --- 1934,1940 ---- /* Paranoia */ ! if ((p_ptr->depth < 0) || (p_ptr->depth > MAX_DEPTH)) { note("Illegal dungeon level!"); return (1); *************** *** 1958,1964 **** } /* Paranoia */ ! if ((px < 0) || (px >= cur_wid) || (py < 0) || (py >= cur_hgt)) { note("Illegal player location!"); return (1); --- 1955,1961 ---- } /* Paranoia */ ! if ((p_ptr->px < 0) || (p_ptr->px >= cur_wid) || (p_ptr->py < 0) || (p_ptr->py >= cur_hgt)) { note("Illegal player location!"); return (1); *************** *** 2114,2120 **** break; } ! /* Perma-wall (assume "solid") XXX XXX XXX */ case 15: { c_ptr->feat = FEAT_PERM_SOLID; --- 2111,2117 ---- break; } ! /* Perma-wall (assume "solid") XXX */ case 15: { c_ptr->feat = FEAT_PERM_SOLID; *************** *** 2121,2127 **** break; } ! /* Granite wall (assume "basic") XXX XXX XXX */ case 12: { c_ptr->feat = FEAT_WALL_EXTRA; --- 2118,2124 ---- break; } ! /* Granite wall (assume "basic") XXX */ case 12: { c_ptr->feat = FEAT_WALL_EXTRA; *************** *** 2172,2221 **** /* Read the dungeon items */ for (i = 1; i < limit; i++) { ! int o_idx; - object_type forge; - object_type *q_ptr; - object_type *o_ptr; - - /* Get local object */ ! q_ptr = &forge; /* Wipe the object */ ! object_wipe(q_ptr); /* Read the item */ ! rd_item_old(q_ptr); /* Skip dead objects */ ! if (!q_ptr->k_idx) continue; - /* Save the location */ - q_ptr->iy = iy[i]; - q_ptr->ix = ix[i]; - /* Invalid cave location */ ! if ((q_ptr->ix >= cur_wid) || (q_ptr->iy >= cur_hgt)) { note("Illegal object location!!!"); return (72); } /* Access grid */ ! c_ptr = &cave[q_ptr->iy][q_ptr->ix]; /* Hack -- convert old "dungeon" objects */ ! if ((q_ptr->k_idx >= 445) && (q_ptr->k_idx <= 479)) { int feat = 0; /* Analyze the "dungeon objects" */ ! switch (q_ptr->k_idx) { /* Rubble */ case 445: --- 2169,2215 ---- /* Read the dungeon items */ for (i = 1; i < limit; i++) { ! object_type *i_ptr; ! object_type object_type_body; /* Get local object */ ! i_ptr = &object_type_body; /* Wipe the object */ ! object_wipe(i_ptr); /* Read the item */ ! rd_item_old(i_ptr); + /* Save location */ + i_ptr->iy = iy[i]; + i_ptr->ix = ix[i]; + /* Skip dead objects */ ! if (!i_ptr->k_idx) continue; /* Invalid cave location */ ! if ((i_ptr->iy >= cur_hgt) || (i_ptr->ix >= cur_hgt)) { note("Illegal object location!!!"); return (72); } + /* Access grid */ ! c_ptr = &cave[i_ptr->iy][i_ptr->ix]; /* Hack -- convert old "dungeon" objects */ ! if ((i_ptr->k_idx >= 445) && (i_ptr->k_idx <= 479)) { int feat = 0; /* Analyze the "dungeon objects" */ ! switch (i_ptr->k_idx) { /* Rubble */ case 445: *************** *** 2332,2338 **** /* Hack -- treasure in walls */ ! if (q_ptr->tval == TV_GOLD) { /* Quartz or Magma with treasure */ if ((c_ptr->feat == FEAT_QUARTZ) || --- 2326,2332 ---- /* Hack -- treasure in walls */ ! if (i_ptr->tval == TV_GOLD) { /* Quartz or Magma with treasure */ if ((c_ptr->feat == FEAT_QUARTZ) || *************** *** 2347,2381 **** } ! /* Paranoia */ ! if (c_ptr->o_idx) { ! note("Multiple objects per grid!"); ! return (153); ! } ! ! ! /* Get a new record */ ! o_idx = o_pop(); ! ! /* Oops */ ! if (!o_idx) ! { ! note(format("Too many (%d) objects!", o_max)); return (152); } - - /* Acquire cave object */ - o_ptr = &o_list[o_idx]; - - /* Copy the item */ - object_copy(o_ptr, q_ptr); - - /* Build a stack */ - o_ptr->next_o_idx = c_ptr->o_idx; - - /* Place the object */ - c_ptr->o_idx = o_idx; } --- 2341,2352 ---- } ! /* Give the item to the floor */ ! if (!floor_carry(i_ptr->iy, i_ptr->ix, i_ptr)) { ! note(format("Cannot place object %d!", o_max)); return (152); } } *************** *** 2392,2430 **** /* Read the monsters (starting at 2) */ for (i = 2; i < limit; i++) { - int m_idx; - - monster_type forge; - monster_type *q_ptr; - - monster_type *m_ptr; monster_race *r_ptr; /* Get local monster */ ! q_ptr = &forge; /* Hack -- wipe */ ! WIPE(q_ptr, monster_type); /* Read the current hitpoints */ ! rd_s16b(&q_ptr->hp); /* Strip max hitpoints */ if (!older_than(2, 6, 0)) strip_bytes(2); /* Current sleep counter */ ! rd_s16b(&q_ptr->csleep); /* Strip speed */ strip_bytes(2); /* Read race */ ! rd_s16b(&q_ptr->r_idx); /* Read location */ ! rd_byte(&q_ptr->fy); ! rd_byte(&q_ptr->fx); /* Strip confusion, etc */ strip_bytes(4); --- 2363,2398 ---- /* Read the monsters (starting at 2) */ for (i = 2; i < limit; i++) { monster_race *r_ptr; + monster_type *n_ptr; + monster_type monster_type_body; + /* Get local monster */ ! n_ptr = &monster_type_body; /* Hack -- wipe */ ! WIPE(n_ptr, monster_type); /* Read the current hitpoints */ ! rd_s16b(&n_ptr->hp); /* Strip max hitpoints */ if (!older_than(2, 6, 0)) strip_bytes(2); /* Current sleep counter */ ! rd_s16b(&n_ptr->csleep); /* Strip speed */ strip_bytes(2); /* Read race */ ! rd_s16b(&n_ptr->r_idx); /* Read location */ ! rd_byte(&n_ptr->fy); ! rd_byte(&n_ptr->fx); /* Strip confusion, etc */ strip_bytes(4); *************** *** 2436,2443 **** if (arg_colour) strip_bytes(1); /* Invalid cave location */ ! if ((q_ptr->fx >= cur_wid) || (q_ptr->fy >= cur_hgt)) { note("Illegal monster location!!!"); return (71); --- 2404,2418 ---- if (arg_colour) strip_bytes(1); + /* Hack -- ignore "broken" monsters */ + if (n_ptr->r_idx <= 0) continue; + + /* Hack -- ignore "player ghosts" */ + if (n_ptr->r_idx >= MAX_R_IDX-1) continue; + + /* Invalid cave location */ ! if ((n_ptr->fx >= cur_wid) || (n_ptr->fy >= cur_hgt)) { note("Illegal monster location!!!"); return (71); *************** *** 2444,2496 **** } - /* Access grid */ - c_ptr = &cave[q_ptr->fy][q_ptr->fx]; - - /* Hack -- Ignore "double" monsters */ - if (c_ptr->m_idx) continue; - - /* Hack -- ignore "broken" monsters */ - if (q_ptr->r_idx <= 0) continue; - - /* Hack -- ignore "player ghosts" */ - if (q_ptr->r_idx >= MAX_R_IDX-1) continue; - - /* Access the race */ ! r_ptr = &r_info[q_ptr->r_idx]; /* Hack -- recalculate speed */ ! q_ptr->mspeed = r_ptr->speed; /* Hack -- fake energy */ ! q_ptr->energy = i % 100; /* Hack -- maximal hitpoints */ ! q_ptr->maxhp = r_ptr->hdice * r_ptr->hside; ! /* Get a new record */ ! m_idx = m_pop(); ! ! /* Oops */ ! if (!m_idx) { ! note(format("Too many (%d) monsters!", m_max)); return (162); } - - /* Acquire place */ - m_ptr = &m_list[m_idx]; - - /* Copy the monster */ - COPY(m_ptr, q_ptr, monster_type); - - /* Mark the location */ - c_ptr->m_idx = m_idx; - - /* Count racial occurances */ - r_ptr->cur_num++; } --- 2419,2443 ---- } /* Access the race */ ! r_ptr = &r_info[n_ptr->r_idx]; /* Hack -- recalculate speed */ ! n_ptr->mspeed = r_ptr->speed; /* Hack -- fake energy */ ! n_ptr->energy = i % 100; /* Hack -- maximal hitpoints */ ! n_ptr->maxhp = r_ptr->hdice * r_ptr->hside; ! /* Place monster in dungeon */ ! if (!monster_place(n_ptr->fy, n_ptr->fx, n_ptr)) { ! note(format("Cannot place monster %d!", i)); return (162); } } *************** *** 2551,2558 **** int slot = 0; s16b ictr; ! object_type forge; ! object_type *q_ptr; /* No weight */ total_weight = 0; --- 2498,2505 ---- int slot = 0; s16b ictr; ! object_type *i_ptr; ! object_type object_type_body; /* No weight */ total_weight = 0; *************** *** 2575,2599 **** for (i = 0; i < ictr; i++) { /* Get local object */ ! q_ptr = &forge; /* Wipe the object */ ! object_wipe(q_ptr); /* Read the item */ ! rd_item_old(q_ptr); /* Assume aware */ ! object_aware(q_ptr); /* Get the next slot */ n = slot++; /* Copy the object */ ! object_copy(&inventory[n], q_ptr); /* Add the weight */ ! total_weight += (q_ptr->number * q_ptr->weight); /* One more item */ inven_cnt++; --- 2522,2546 ---- for (i = 0; i < ictr; i++) { /* Get local object */ ! i_ptr = &object_type_body; /* Wipe the object */ ! object_wipe(i_ptr); /* Read the item */ ! rd_item_old(i_ptr); /* Assume aware */ ! object_aware(i_ptr); /* Get the next slot */ n = slot++; /* Copy the object */ ! object_copy(&inventory[n], i_ptr); /* Add the weight */ ! total_weight += (i_ptr->number * i_ptr->weight); /* One more item */ inven_cnt++; *************** *** 2603,2630 **** for (i = OLD_INVEN_WIELD; i < OLD_INVEN_AUX; i++) { /* Get local object */ ! q_ptr = &forge; /* Wipe the object */ ! object_wipe(q_ptr); /* Read the item */ ! rd_item_old(q_ptr); /* Assume aware */ ! object_aware(q_ptr); /* Skip "empty" slots */ ! if (!q_ptr->tval) continue; /* Hack -- convert old slot numbers */ n = convert_slot(i); /* Copy the object */ ! object_copy(&inventory[n], q_ptr); /* Add the weight */ ! total_weight += (q_ptr->number * q_ptr->weight); /* One more item */ equip_cnt++; --- 2550,2577 ---- for (i = OLD_INVEN_WIELD; i < OLD_INVEN_AUX; i++) { /* Get local object */ ! i_ptr = &object_type_body; /* Wipe the object */ ! object_wipe(i_ptr); /* Read the item */ ! rd_item_old(i_ptr); /* Assume aware */ ! object_aware(i_ptr); /* Skip "empty" slots */ ! if (!i_ptr->tval) continue; /* Hack -- convert old slot numbers */ n = convert_slot(i); /* Copy the object */ ! object_copy(&inventory[n], i_ptr); /* Add the weight */ ! total_weight += (i_ptr->number * i_ptr->weight); /* One more item */ equip_cnt++; *************** *** 2634,2661 **** for (i = OLD_INVEN_AUX; i <= OLD_INVEN_AUX; i++) { /* Get local object */ ! q_ptr = &forge; /* Wipe the object */ ! object_wipe(q_ptr); /* Read the item */ ! rd_item_old(q_ptr); /* Assume aware */ ! object_aware(q_ptr); /* Skip "empty" slots */ ! if (!q_ptr->tval) continue; /* Get the next slot */ n = slot++; /* Copy the object */ ! object_copy(&inventory[n], q_ptr); /* Add the weight */ ! total_weight += (q_ptr->number * q_ptr->weight); /* One more item */ inven_cnt++; --- 2581,2608 ---- for (i = OLD_INVEN_AUX; i <= OLD_INVEN_AUX; i++) { /* Get local object */ ! i_ptr = &object_type_body; /* Wipe the object */ ! object_wipe(i_ptr); /* Read the item */ ! rd_item_old(i_ptr); /* Assume aware */ ! object_aware(i_ptr); /* Skip "empty" slots */ ! if (!i_ptr->tval) continue; /* Get the next slot */ n = slot++; /* Copy the object */ ! object_copy(&inventory[n], i_ptr); /* Add the weight */ ! total_weight += (i_ptr->number * i_ptr->weight); /* One more item */ inven_cnt++; *************** *** 2688,2694 **** sf_major, sf_minor, sf_patch)); ! /* XXX XXX XXX */ if (older_than(2, 5, 2)) { /* Allow use of old MacAngband 1.0 and 2.0.3 savefiles */ --- 2635,2641 ---- sf_major, sf_minor, sf_patch)); ! /* Mega-Hack XXX XXX XXX */ if (older_than(2, 5, 2)) { /* Allow use of old MacAngband 1.0 and 2.0.3 savefiles */ *************** *** 2721,2727 **** xor_byte = sf_extra; ! /* XXX XXX Fake the system info (?) */ /* Read the artifacts */ --- 2668,2674 ---- xor_byte = sf_extra; ! /* Fake the system info XXX XXX */ /* Read the artifacts */ *************** *** 2821,2828 **** note("Loaded extra information"); - /* XXX XXX XXX Important!!! */ - /* Initialize the sex */ sp_ptr = &sex_info[p_ptr->psex]; --- 2768,2773 ---- *************** *** 2840,2846 **** object_kind *k_ptr = &k_info[i]; /* Hack -- learn about "obvious" items */ ! if (k_ptr->level < p_ptr->max_dlv) k_ptr->aware = TRUE; } --- 2785,2791 ---- object_kind *k_ptr = &k_info[i]; /* Hack -- learn about "obvious" items */ ! if (k_ptr->level < p_ptr->max_depth) k_ptr->aware = TRUE; } *************** *** 2849,2865 **** /* Read spell flags */ ! rd_u32b(&spell_learned1); ! rd_u32b(&spell_worked1); ! rd_u32b(&spell_forgotten1); ! rd_u32b(&spell_learned2); ! rd_u32b(&spell_worked2); ! rd_u32b(&spell_forgotten2); /* Read spell order */ for (i = 0; i < 64; i++) { ! rd_byte(&spell_order[i]); } note("Loaded spell information"); --- 2794,2810 ---- /* Read spell flags */ ! rd_u32b(&p_ptr->spell_learned1); ! rd_u32b(&p_ptr->spell_worked1); ! rd_u32b(&p_ptr->spell_forgotten1); ! rd_u32b(&p_ptr->spell_learned2); ! rd_u32b(&p_ptr->spell_worked2); ! rd_u32b(&p_ptr->spell_forgotten2); /* Read spell order */ for (i = 0; i < 64; i++) { ! rd_byte(&p_ptr->spell_order[i]); } note("Loaded spell information"); *************** *** 2881,2887 **** rd_u16b(&noscore); /* Read the player_hp array */ ! for (i = 0; i < 50; i++) rd_s16b(&player_hp[i]); /* Strip silly hitpoint information */ if (!older_than(2, 6, 2)) strip_bytes(98); --- 2826,2832 ---- rd_u16b(&noscore); /* Read the player_hp array */ ! for (i = 0; i < 50; i++) rd_s16b(&p_ptr->player_hp[i]); /* Strip silly hitpoint information */ if (!older_than(2, 6, 2)) strip_bytes(98); *************** *** 2904,2910 **** rd_u32b(&sf_when); /* Read the cause of death, if any */ ! rd_string(died_from, 80); note("Loaded all player info"); --- 2849,2855 ---- rd_u32b(&sf_when); /* Read the cause of death, if any */ ! rd_string(p_ptr->died_from, 80); note("Loaded all player info"); *************** *** 2926,2955 **** r_info[MAX_R_IDX-1].max_num = 0; ! /* Hack -- reset morgoth XXX XXX XXX */ r_info[MAX_R_IDX-2].max_num = 1; ! /* Hack -- reset sauron XXX XXX XXX */ r_info[MAX_R_IDX-3].max_num = 1; ! /* Hack -- reset morgoth XXX XXX XXX */ r_info[MAX_R_IDX-2].r_pkills = 0; ! /* Hack -- reset sauron XXX XXX XXX */ r_info[MAX_R_IDX-3].r_pkills = 0; ! /* Add first quest XXX XXX XXX */ q_list[0].level = 99; ! /* Add second quest XXX XXX XXX */ q_list[1].level = 100; ! /* Reset third quest XXX XXX XXX */ q_list[2].level = 0; ! /* Reset fourth quest XXX XXX XXX */ q_list[3].level = 0; --- 2871,2900 ---- r_info[MAX_R_IDX-1].max_num = 0; ! /* Hack -- reset morgoth XXX XXX */ r_info[MAX_R_IDX-2].max_num = 1; ! /* Hack -- reset sauron XXX XXX */ r_info[MAX_R_IDX-3].max_num = 1; ! /* Hack -- reset morgoth XXX XXX */ r_info[MAX_R_IDX-2].r_pkills = 0; ! /* Hack -- reset sauron XXX XXX */ r_info[MAX_R_IDX-3].r_pkills = 0; ! /* Add first quest XXX XXX */ q_list[0].level = 99; ! /* Add second quest XXX XXX */ q_list[1].level = 100; ! /* Reset third quest XXX XXX */ q_list[2].level = 0; ! /* Reset fourth quest XXX XXX */ q_list[3].level = 0; Only in angband-281/src: load1.o diff -r -c -w src-281/load2.c angband-281/src/load2.c *** src-281/load2.c Mon Mar 3 22:24:39 1997 --- angband-281/src/load2.c Thu Apr 24 10:27:29 1997 *************** *** 431,436 **** --- 431,437 ---- }; + /* * Read an object * *************** *** 783,789 **** if (older_than(2, 7, 9)) { /* Hack -- assume cursed */ ! if (a_ptr->flags3 & (TR3_CURSED)) o_ptr->ident |= (IDENT_CURSED); } } --- 784,790 ---- if (older_than(2, 7, 9)) { /* Hack -- assume cursed */ ! if (a_ptr->flags3 & (TR3_LIGHT_CURSE)) o_ptr->ident |= (IDENT_CURSED); } } *************** *** 809,817 **** if (older_than(2, 7, 9)) { /* Hack -- assume cursed */ ! if (e_ptr->flags3 & (TR3_CURSED)) o_ptr->ident |= (IDENT_CURSED); } } /* Hack -- assume "cursed" items */ --- 810,825 ---- if (older_than(2, 7, 9)) { /* Hack -- assume cursed */ ! if (e_ptr->flags3 & (TR3_LIGHT_CURSE)) o_ptr->ident |= (IDENT_CURSED); } + + /* Hack -- enforce legal pval */ + if (e_ptr->flags1 & (TR1_PVAL_MASK)) + { + /* Force a meaningful pval */ + if (!o_ptr->pval) o_ptr->pval = 1; } + } /* Hack -- assume "cursed" items */ *************** *** 818,824 **** if (older_than(2, 7, 9)) { /* Hack -- assume cursed */ ! if (k_ptr->flags3 & (TR3_CURSED)) o_ptr->ident |= (IDENT_CURSED); /* Hack -- apply "uncursed" incription */ if (streq(buf, "uncursed")) o_ptr->ident &= ~(IDENT_CURSED); --- 826,832 ---- if (older_than(2, 7, 9)) { /* Hack -- assume cursed */ ! if (k_ptr->flags3 & (TR3_LIGHT_CURSE)) o_ptr->ident |= (IDENT_CURSED); /* Hack -- apply "uncursed" incription */ if (streq(buf, "uncursed")) o_ptr->ident &= ~(IDENT_CURSED); *************** *** 993,1009 **** /* Read the items */ for (j = 0; j < num; j++) { ! object_type forge; ! object_type *q_ptr; /* Get local object */ ! q_ptr = &forge; /* Wipe the object */ ! object_wipe(q_ptr); /* Read the item */ ! rd_item(q_ptr); /* Acquire valid items */ if (st_ptr->stock_num < STORE_INVEN_MAX) --- 1001,1017 ---- /* Read the items */ for (j = 0; j < num; j++) { ! object_type *i_ptr; ! object_type object_type_body; /* Get local object */ ! i_ptr = &object_type_body; /* Wipe the object */ ! object_wipe(i_ptr); /* Read the item */ ! rd_item(i_ptr); /* Acquire valid items */ if (st_ptr->stock_num < STORE_INVEN_MAX) *************** *** 1011,1017 **** int k = st_ptr->stock_num++; /* Acquire the item */ ! object_copy(&st_ptr->stock[k], q_ptr); } } --- 1019,1025 ---- int k = st_ptr->stock_num++; /* Acquire the item */ ! object_copy(&st_ptr->stock[k], i_ptr); } } *************** *** 1148,1153 **** --- 1156,1189 ---- } + /*** Analyze the options ***/ + + /* Extract the options */ + for (i = 0; option_info[i].o_desc; i++) + { + int os = option_info[i].o_set; + int ob = option_info[i].o_bit; + + /* Set the "default" options */ + if (option_info[i].o_var) + { + /* Set */ + if (option_flag[os] & (1L << ob)) + { + /* Set */ + (*option_info[i].o_var) = TRUE; + } + + /* Clear */ + else + { + /* Clear */ + (*option_info[i].o_var) = FALSE; + } + } + } + + /*** Window Options ***/ /* Read the window flags */ *************** *** 1224,1242 **** /* * Read the "extra" information */ ! static void rd_extra(void) { int i; byte tmp8u; ! rd_string(player_name, 32); ! rd_string(died_from, 80); for (i = 0; i < 4; i++) { ! rd_string(history[i], 60); } /* Class/Race/Gender/Spells */ --- 1260,1279 ---- /* * Read the "extra" information */ ! static errr rd_extra(void) { int i; byte tmp8u; + u16b tmp16u; ! rd_string(p_ptr->full_name, 32); ! rd_string(p_ptr->died_from, 80); for (i = 0; i < 4; i++) { ! rd_string(p_ptr->history[i], 60); } /* Class/Race/Gender/Spells */ *************** *** 1245,1250 **** --- 1282,1290 ---- rd_byte(&p_ptr->psex); rd_byte(&tmp8u); /* oops */ + /* Repair psex (2.8.1 beta) */ + if (p_ptr->psex > MAX_SEXES - 1) p_ptr->psex = MAX_SEXES - 1; + /* Special Race/Class info */ rd_byte(&p_ptr->hitdie); rd_byte(&p_ptr->expfact); *************** *** 1276,1289 **** rd_s16b(&p_ptr->csp); rd_u16b(&p_ptr->csp_frac); ! rd_s16b(&p_ptr->max_plv); ! rd_s16b(&p_ptr->max_dlv); ! /* Repair maximum player level XXX XXX XXX */ ! if (p_ptr->max_plv < p_ptr->lev) p_ptr->max_plv = p_ptr->lev; ! /* Repair maximum dungeon level */ ! if (p_ptr->max_dlv < 0) p_ptr->max_dlv = 1; /* More info */ strip_bytes(8); --- 1316,1329 ---- rd_s16b(&p_ptr->csp); rd_u16b(&p_ptr->csp_frac); ! rd_s16b(&p_ptr->max_lev); ! rd_s16b(&p_ptr->max_depth); ! /* Hack -- Repair maximum player level */ ! if (p_ptr->max_lev < p_ptr->lev) p_ptr->max_lev = p_ptr->lev; ! /* Hack -- Repair maximum dungeon level */ ! if (p_ptr->max_depth < 0) p_ptr->max_depth = 1; /* More info */ strip_bytes(8); *************** *** 1367,1377 **** --- 1407,1450 ---- /* Current turn */ rd_s32b(&turn); + + + /* Read the player_hp array */ + rd_u16b(&tmp16u); + + /* Incompatible save files */ + if (tmp16u > PY_MAX_LEVEL) + { + note(format("Too many (%u) hitpoint entries!", tmp16u)); + return (25); } + /* Read the player_hp array */ + for (i = 0; i < tmp16u; i++) + { + rd_s16b(&p_ptr->player_hp[i]); + } + /* Read spell info */ + rd_u32b(&p_ptr->spell_learned1); + rd_u32b(&p_ptr->spell_learned2); + rd_u32b(&p_ptr->spell_worked1); + rd_u32b(&p_ptr->spell_worked2); + rd_u32b(&p_ptr->spell_forgotten1); + rd_u32b(&p_ptr->spell_forgotten2); + for (i = 0; i < 64; i++) + { + rd_byte(&p_ptr->spell_order[i]); + } + + return (0); + } + + + + /* * Read the player inventory * *************** *** 1387,1394 **** { int slot = 0; ! object_type forge; ! object_type *q_ptr; /* No weight */ total_weight = 0; --- 1460,1467 ---- { int slot = 0; ! object_type *i_ptr; ! object_type object_type_body; /* No weight */ total_weight = 0; *************** *** 1409,1424 **** if (n == 0xFFFF) break; /* Get local object */ ! q_ptr = &forge; /* Wipe the object */ ! object_wipe(q_ptr); /* Read the item */ ! rd_item(q_ptr); /* Hack -- verify item */ ! if (!q_ptr->k_idx) return (53); /* Hack -- convert old slot numbers */ if (older_than(2, 7, 4)) n = convert_slot(n); --- 1482,1497 ---- if (n == 0xFFFF) break; /* Get local object */ ! i_ptr = &object_type_body; /* Wipe the object */ ! object_wipe(i_ptr); /* Read the item */ ! rd_item(i_ptr); /* Hack -- verify item */ ! if (!i_ptr->k_idx) return (53); /* Hack -- convert old slot numbers */ if (older_than(2, 7, 4)) n = convert_slot(n); *************** *** 1427,1436 **** if (n >= INVEN_WIELD) { /* Copy object */ ! object_copy(&inventory[n], q_ptr); /* Add the weight */ ! total_weight += (q_ptr->number * q_ptr->weight); /* One more item */ equip_cnt++; --- 1500,1509 ---- if (n >= INVEN_WIELD) { /* Copy object */ ! object_copy(&inventory[n], i_ptr); /* Add the weight */ ! total_weight += (i_ptr->number * i_ptr->weight); /* One more item */ equip_cnt++; *************** *** 1453,1462 **** n = slot++; /* Copy object */ ! object_copy(&inventory[n], q_ptr); /* Add the weight */ ! total_weight += (q_ptr->number * q_ptr->weight); /* One more item */ inven_cnt++; --- 1526,1535 ---- n = slot++; /* Copy object */ ! object_copy(&inventory[n], i_ptr); /* Add the weight */ ! total_weight += (i_ptr->number * i_ptr->weight); /* One more item */ inven_cnt++; *************** *** 1541,1549 **** cave_type *c_ptr; - object_type *o_ptr; - /* Only read as necessary */ ymax = cur_hgt; xmax = cur_wid; --- 1614,1620 ---- *************** *** 1736,1766 **** /* Read the dungeon items */ for (i = 1; i < limit; i++) { ! int o_idx; - object_type forge; - object_type *q_ptr; - /* Get local object */ ! q_ptr = &forge; /* Wipe the object */ ! object_wipe(q_ptr); /* Read the item */ ! rd_item(q_ptr); /* Skip dead objects */ ! if (!q_ptr->k_idx) continue; ! /* Access the item location */ ! c_ptr = &cave[q_ptr->iy][q_ptr->ix]; /* Hack -- convert old "dungeon" objects */ ! if ((q_ptr->k_idx >= 445) && (q_ptr->k_idx <= 479)) { int k = 0; --- 1807,1836 ---- /* Read the dungeon items */ for (i = 1; i < limit; i++) { ! object_type *i_ptr; ! object_type object_type_body; /* Get local object */ ! i_ptr = &object_type_body; /* Wipe the object */ ! object_wipe(i_ptr); /* Read the item */ ! rd_item(i_ptr); + /* Skip dead objects */ ! if (!i_ptr->k_idx) continue; ! /* Access cave grid */ ! c_ptr = &cave[i_ptr->iy][i_ptr->ix]; /* Hack -- convert old "dungeon" objects */ ! if ((i_ptr->k_idx >= 445) && (i_ptr->k_idx <= 479)) { int k = 0; *************** *** 1767,1776 **** bool invis = FALSE; /* Hack -- catch "invisible traps" */ ! if (q_ptr->tval == 101) invis = TRUE; /* Analyze the "dungeon objects" */ ! switch (q_ptr->k_idx) { /* Rubble */ case 445: --- 1837,1846 ---- bool invis = FALSE; /* Hack -- catch "invisible traps" */ ! if (i_ptr->tval == 101) invis = TRUE; /* Analyze the "dungeon objects" */ ! switch (i_ptr->k_idx) { /* Rubble */ case 445: *************** *** 1783,1789 **** case 446: { /* Broken door */ ! if (q_ptr->pval) { k = FEAT_BROKEN; } --- 1853,1859 ---- case 446: { /* Broken door */ ! if (i_ptr->pval) { k = FEAT_BROKEN; } *************** *** 1801,1809 **** case 447: { /* Jammed door */ ! if (q_ptr->pval < 0) { ! k = (0 - q_ptr->pval) / 2; if (k > 7) k = 7; k = FEAT_DOOR_HEAD + 0x08 + k; } --- 1871,1879 ---- case 447: { /* Jammed door */ ! if (i_ptr->pval < 0) { ! k = (0 - i_ptr->pval) / 2; if (k > 7) k = 7; k = FEAT_DOOR_HEAD + 0x08 + k; } *************** *** 1811,1817 **** /* Locked door */ else { ! k = q_ptr->pval / 2; if (k > 7) k = 7; k = FEAT_DOOR_HEAD + k; } --- 1881,1887 ---- /* Locked door */ else { ! k = i_ptr->pval / 2; if (k > 7) k = 7; k = FEAT_DOOR_HEAD + k; } *************** *** 2042,2048 **** /* Hack -- treasure in walls */ ! if (q_ptr->tval == TV_GOLD) { /* Quartz + treasure */ if ((c_ptr->feat == FEAT_QUARTZ) || --- 2112,2118 ---- /* Hack -- treasure in walls */ ! if (i_ptr->tval == TV_GOLD) { /* Quartz + treasure */ if ((c_ptr->feat == FEAT_QUARTZ) || *************** *** 2057,2088 **** } ! /* Paranoia */ ! if (c_ptr->o_idx) { ! note("Multiple objects per grid!"); ! return (153); ! } ! ! ! /* Get a new record */ ! o_idx = o_pop(); ! ! /* Oops */ ! if (!o_idx) ! { ! note(format("Too many (%d) objects!", o_max)); return (152); } - - /* Acquire place */ - o_ptr = &o_list[o_idx]; - - /* Copy the item */ - object_copy(o_ptr, q_ptr); - - /* Place the object */ - c_ptr->o_idx = o_idx; } --- 2127,2138 ---- } ! /* Give the item to the floor */ ! if (!floor_carry(i_ptr->iy, i_ptr->ix, i_ptr)) { ! note(format("Cannot place object %d!", o_max)); return (152); } } *************** *** 2102,2161 **** /* Read the monsters */ for (i = start; i < limit; i++) { ! int m_idx; - monster_type forge; - monster_type *q_ptr; - monster_type *m_ptr; - monster_race *r_ptr; - - /* Get local monster */ ! q_ptr = &forge; /* Clear the monster */ ! WIPE(q_ptr, monster_type); /* Read the monster */ ! rd_monster(q_ptr); - /* Access grid */ - c_ptr = &cave[q_ptr->fy][q_ptr->fx]; - - /* Access race */ - r_ptr = &r_info[q_ptr->r_idx]; - - /* Hack -- ignore "broken" monsters */ ! if (q_ptr->r_idx <= 0) continue; /* Hack -- ignore "player ghosts" */ ! if (q_ptr->r_idx >= MAX_R_IDX-1) continue; ! /* Get a new record */ ! m_idx = m_pop(); ! ! /* Oops */ ! if (!m_idx) { ! note(format("Too many (%d) monsters!", m_max)); return (162); } - - /* Acquire place */ - m_ptr = &m_list[m_idx]; - - /* Copy the monster */ - COPY(m_ptr, q_ptr, monster_type); - - /* Mark the location */ - c_ptr->m_idx = m_idx; - - /* Count XXX XXX XXX */ - r_ptr->cur_num++; } --- 2152,2184 ---- /* Read the monsters */ for (i = start; i < limit; i++) { ! monster_type *n_ptr; ! monster_type monster_type_body; /* Get local monster */ ! n_ptr = &monster_type_body; /* Clear the monster */ ! WIPE(n_ptr, monster_type); /* Read the monster */ ! rd_monster(n_ptr); /* Hack -- ignore "broken" monsters */ ! if (n_ptr->r_idx <= 0) continue; /* Hack -- ignore "player ghosts" */ ! if (n_ptr->r_idx >= MAX_R_IDX-1) continue; ! /* Place monster in dungeon */ ! if (!monster_place(n_ptr->fy, n_ptr->fx, n_ptr)) { ! note(format("Cannot place monster %d!", i)); return (162); } } *************** *** 2195,2200 **** --- 2218,2224 ---- byte count; byte tmp8u; + u16b tmp16u; u16b limit; *************** *** 2204,2213 **** /*** Basic info ***/ /* Header info */ ! rd_s16b(&dun_level); ! rd_s16b(&num_repro); ! rd_s16b(&py); ! rd_s16b(&px); rd_s16b(&cur_hgt); rd_s16b(&cur_wid); rd_s16b(&max_panel_rows); --- 2228,2237 ---- /*** Basic info ***/ /* Header info */ ! rd_s16b(&p_ptr->depth); ! rd_u16b(&tmp16u); ! rd_s16b(&p_ptr->py); ! rd_s16b(&p_ptr->px); rd_s16b(&cur_hgt); rd_s16b(&cur_wid); rd_s16b(&max_panel_rows); *************** *** 2303,2361 **** /* Read the dungeon items */ for (i = 1; i < limit; i++) { ! int o_idx; - object_type *o_ptr; - - /* Get a new record */ - o_idx = o_pop(); - - /* Oops */ - if (i != o_idx) - { - note(format("Object allocation error (%d <> %d)", i, o_idx)); - return (152); - } - - /* Acquire place */ ! o_ptr = &o_list[o_idx]; /* Read the item */ ! rd_item(o_ptr); - /* XXX XXX XXX XXX XXX */ - /* Monster */ ! if (o_ptr->held_m_idx) { ! monster_type *m_ptr; ! ! /* Monster */ ! m_ptr = &m_list[o_ptr->held_m_idx]; ! ! /* Build a stack */ ! o_ptr->next_o_idx = m_ptr->hold_o_idx; ! ! /* Place the object */ ! m_ptr->hold_o_idx = o_idx; } /* Dungeon */ else { ! /* Access the item location */ ! c_ptr = &cave[o_ptr->iy][o_ptr->ix]; ! ! /* Build a stack */ ! o_ptr->next_o_idx = c_ptr->o_idx; ! ! /* Place the object */ ! c_ptr->o_idx = o_idx; } } /*** Monsters ***/ --- 2327,2368 ---- /* Read the dungeon items */ for (i = 1; i < limit; i++) { ! object_type *i_ptr; ! object_type object_type_body; /* Acquire place */ ! i_ptr = &object_type_body; + /* Wipe the object */ + object_wipe(i_ptr); + /* Read the item */ ! 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); } } + } /*** Monsters ***/ *************** *** 2373,2415 **** /* Read the monsters */ for (i = 1; i < limit; i++) { ! int m_idx; - monster_type *m_ptr; ! monster_race *r_ptr; ! /* Get a new record */ ! m_idx = m_pop(); ! /* Oops */ ! if (i != m_idx) { ! note(format("Monster allocation error (%d <> %d)", i, m_idx)); return (162); } - - - /* Acquire monster */ - m_ptr = &m_list[m_idx]; - - /* Read the monster */ - rd_monster(m_ptr); - - - /* Access grid */ - c_ptr = &cave[m_ptr->fy][m_ptr->fx]; - - /* Mark the location */ - c_ptr->m_idx = m_idx; - - - /* Access race */ - r_ptr = &r_info[m_ptr->r_idx]; - - /* Count XXX XXX XXX */ - r_ptr->cur_num++; } --- 2380,2405 ---- /* Read the monsters */ for (i = 1; i < limit; i++) { ! monster_type *n_ptr; ! monster_type monster_type_body; ! /* Get local monster */ ! n_ptr = &monster_type_body; + /* Clear the monster */ + WIPE(n_ptr, monster_type); ! /* Read the monster */ ! rd_monster(n_ptr); ! ! /* Place monster in dungeon */ ! if (!monster_place(n_ptr->fy, n_ptr->fx, n_ptr)) { ! note(format("Cannot place monster %d", i)); return (162); } } *************** *** 2619,2645 **** /* Read the extra stuff */ ! rd_extra(); if (arg_fiddle) note("Loaded extra information"); - /* Read the player_hp array */ - rd_u16b(&tmp16u); - - /* Incompatible save files */ - if (tmp16u > PY_MAX_LEVEL) - { - note(format("Too many (%u) hitpoint entries!", tmp16u)); - return (25); - } - - /* Read the player_hp array */ - for (i = 0; i < tmp16u; i++) - { - rd_s16b(&player_hp[i]); - } - - /* Important -- Initialize the sex */ sp_ptr = &sex_info[p_ptr->psex]; --- 2609,2618 ---- /* Read the extra stuff */ ! if (rd_extra()) return (25); if (arg_fiddle) note("Loaded extra information"); /* Important -- Initialize the sex */ sp_ptr = &sex_info[p_ptr->psex]; *************** *** 2651,2670 **** mp_ptr = &magic_info[p_ptr->pclass]; - /* Read spell info */ - rd_u32b(&spell_learned1); - rd_u32b(&spell_learned2); - rd_u32b(&spell_worked1); - rd_u32b(&spell_worked2); - rd_u32b(&spell_forgotten1); - rd_u32b(&spell_forgotten2); - - for (i = 0; i < 64; i++) - { - rd_byte(&spell_order[i]); - } - - /* Read the inventory */ if (rd_inventory()) { --- 2624,2629 ---- Only in angband-281/src: load2.o diff -r -c -w src-281/main-acn.c angband-281/src/main-acn.c *** src-281/main-acn.c Mon Mar 3 22:27:27 1997 --- angband-281/src/main-acn.c Thu Apr 24 10:28:02 1997 *************** *** 1804,1812 **** /* Catch nasty signals */ signals_init(); - /* No name (yet) */ - strcpy(player_name, ""); - /* Hack -- Use the "pref-acn.prf" file */ ANGBAND_SYS = "acn"; --- 1804,1809 ---- diff -r -c -w src-281/main-ami.c angband-281/src/main-ami.c *** src-281/main-ami.c Mon Mar 3 22:28:13 1997 --- angband-281/src/main-ami.c Thu Apr 24 10:28:38 1997 *************** *** 1953,1959 **** tomb_str( 3, " R.I.P." ); ! tomb_str( 5, player_name ); tomb_str( 6, "the" ); --- 1953,1959 ---- tomb_str( 3, " R.I.P." ); ! tomb_str( 5, p_ptr->full_name ); tomb_str( 6, "the" ); *************** *** 1970,1979 **** sprintf( tmp, "AU: %ld", (long)p_ptr->au ); tomb_str( 12, tmp ); ! sprintf( tmp, "Killed on Level %d", dun_level ); tomb_str( 13, tmp ); ! sprintf( tmp, "by %s", died_from ); tomb_str( 14, tmp ); sprintf( tmp, "%-.24s", ctime(&ct)); --- 1970,1979 ---- sprintf( tmp, "AU: %ld", (long)p_ptr->au ); tomb_str( 12, tmp ); ! sprintf( tmp, "Killed on Level %d", p_ptr->depth ); tomb_str( 13, tmp ); ! sprintf( tmp, "by %s", p_ptr->died_from ); tomb_str( 14, tmp ); sprintf( tmp, "%-.24s", ctime(&ct)); *************** *** 2230,2236 **** static void cursor_anim( void ) { term_data *td = term_curs; ! int x0, y0, x1, y1, i = px, j = py; byte tc,ta; if ( !term_curs ) return; --- 2230,2240 ---- static void cursor_anim( void ) { term_data *td = term_curs; ! int x0, y0, x1, y1; ! ! /* XXX XXX XXX */ ! int i = p_ptr->px, j = p_ptr->py; ! byte tc,ta; if ( !term_curs ) return; Only in angband-281/src: main-cap.o Only in angband-281/src: main-gcu.o diff -r -c -w src-281/main-mac.c angband-281/src/main-mac.c *** src-281/main-mac.c Mon Mar 3 22:29:40 1997 --- angband-281/src/main-mac.c Thu Apr 24 10:29:51 1997 *************** *** 424,430 **** while (1) { pb.ioDrDirID=pb.ioDrParID; ! err = PBGetCatInfo((CInfoPBPtr)&pb, FALSE); res[i] = ':'; i--; for (j=1; j<=name[0]; j++) { --- 424,430 ---- while (1) { pb.ioDrDirID=pb.ioDrParID; ! err = PBGetCatInfoSync((CInfoPBPtr)&pb); res[i] = ':'; i--; for (j=1; j<=name[0]; j++) { *************** *** 578,584 **** block.dirInfo.ioVRefNum = vRefNum; block.dirInfo.ioFDirIndex = -1; block.dirInfo.ioDrDirID = block.dirInfo.ioDrParID; ! err = PBGetCatInfo(&block, FALSE); pstrcat(directoryName, (StringPtr)"\p:"); pstrinsert(fullPathName, directoryName); if (block.dirInfo.ioDrDirID == 2) break; --- 578,584 ---- block.dirInfo.ioVRefNum = vRefNum; block.dirInfo.ioFDirIndex = -1; block.dirInfo.ioDrDirID = block.dirInfo.ioDrParID; ! err = PBGetCatInfoSync(&block); pstrcat(directoryName, (StringPtr)"\p:"); pstrinsert(fullPathName, directoryName); if (block.dirInfo.ioDrDirID == 2) break; *************** *** 1272,1278 **** term_data_resize(td); /* Reset visuals */ ! reset_visuals(); } #endif /* ANGBAND_LITE_MAC */ --- 1272,1278 ---- term_data_resize(td); /* Reset visuals */ ! reset_visuals(TRUE); } #endif /* ANGBAND_LITE_MAC */ *************** *** 1724,1730 **** fcbBlock.ioVRefNum = 0; fcbBlock.ioRefNum = CurResFile(); fcbBlock.ioFCBIndx = 0; ! err = PBGetFCBInfo(&fcbBlock, FALSE); if (err != noErr) { sprintf(errString, "Fatal PBGetFCBInfo Error #%d.\r Exiting.", err); --- 1724,1730 ---- fcbBlock.ioVRefNum = 0; fcbBlock.ioRefNum = CurResFile(); fcbBlock.ioFCBIndx = 0; ! err = PBGetFCBInfoSync(&fcbBlock); if (err != noErr) { sprintf(errString, "Fatal PBGetFCBInfo Error #%d.\r Exiting.", err); *************** *** 2199,2205 **** Rect r; /* Get the button */ ! GetDItem(dialog, i, &type, (Handle*)&control, &r); /* Blink button for 1/10 second */ HiliteControl(control, 1); --- 2199,2205 ---- Rect r; /* Get the button */ ! GetDialogItem(dialog, i, &type, (Handle*)&control, &r); /* Blink button for 1/10 second */ HiliteControl(control, 1); *************** *** 2270,2276 **** pb.ioFDirIndex = 0; /* Check for errors */ ! err = PBGetCatInfo((CInfoPBPtr)&pb, FALSE); /* Success */ if ((err == noErr) && (pb.ioFlAttrib & 0x10)) --- 2270,2276 ---- pb.ioFDirIndex = 0; /* Check for errors */ ! err = PBGetCatInfoSync((CInfoPBPtr)&pb); /* Success */ if ((err == noErr) && (pb.ioFlAttrib & 0x10)) *************** *** 2283,2289 **** pb.ioFDirIndex = 0; /* Check for errors */ ! err = PBGetCatInfo((CInfoPBPtr)&pb, FALSE); /* Success */ if ((err == noErr) && (pb.ioFlAttrib & 0x10)) --- 2283,2289 ---- pb.ioFDirIndex = 0; /* Check for errors */ ! err = PBGetCatInfoSync((CInfoPBPtr)&pb); /* Success */ if ((err == noErr) && (pb.ioFlAttrib & 0x10)) *************** *** 2404,2410 **** InsertMenu(m, 0); /* Add the DA's to the "apple" menu */ ! AddResMenu(m, 'DRVR'); /* Get the "File" menu */ --- 2404,2410 ---- InsertMenu(m, 0); /* Add the DA's to the "apple" menu */ ! AppendResMenu(m, 'DRVR'); /* Get the "File" menu */ *************** *** 2452,2458 **** TextSize(12); /* Add the fonts to the menu */ ! AddResMenu(m, 'FONT'); /* Size of menu */ n = CountMItems(m); --- 2452,2458 ---- TextSize(12); /* Add the fonts to the menu */ ! AppendResMenu(m, 'FONT'); /* Size of menu */ n = CountMItems(m); *************** *** 2464,2471 **** short fontNum; /* Acquire the font name */ ! /* GetMenuItemText(m, i, tmpName); */ ! GetItem(m, i, tmpName); /* Acquire the font index */ GetFNum(tmpName, &fontNum); --- 2464,2470 ---- short fontNum; /* Acquire the font name */ ! GetMenuItemText(m, i, tmpName); /* Acquire the font index */ GetFNum(tmpName, &fontNum); *************** *** 2476,2484 **** /* Remove non-mono-spaced fonts */ if ((CharWidth('i') != CharWidth('W')) || (CharWidth('W') == 0)) { ! /* Delete the menu item XXX XXX XXX */ ! /* DeleteMenuItem(m, i); */ ! DelMenuItem(m, i); } } --- 2475,2482 ---- /* Remove non-mono-spaced fonts */ if ((CharWidth('i') != CharWidth('W')) || (CharWidth('W') == 0)) { ! /* Delete the menu item */ ! DeleteMenuItem(m, i); } } *************** *** 2489,2495 **** AppendMenu(m, "\p-"); /* Add the fonts to the menu */ ! AddResMenu(m, 'FONT'); /* Make the "Size" menu */ --- 2487,2493 ---- AppendMenu(m, "\p-"); /* Add the fonts to the menu */ ! AppendResMenu(m, 'FONT'); /* Make the "Size" menu */ *************** *** 2622,2628 **** /* File menu */ ! m = GetMHandle(129); /* Get menu size */ n = CountMItems(m); --- 2620,2626 ---- /* File menu */ ! m = GetMenuHandle(129); /* Get menu size */ n = CountMItems(m); *************** *** 2664,2670 **** /* Edit menu */ ! m = GetMHandle(130); /* Get menu size */ n = CountMItems(m); --- 2662,2668 ---- /* Edit menu */ ! m = GetMenuHandle(130); /* Get menu size */ n = CountMItems(m); *************** *** 2689,2695 **** /* Font menu */ ! m = GetMHandle(131); /* Get menu size */ n = CountMItems(m); --- 2687,2693 ---- /* Font menu */ ! m = GetMenuHandle(131); /* Get menu size */ n = CountMItems(m); *************** *** 2730,2737 **** EnableItem(m, i); /* Analyze font */ ! /* GetMenuItemText(m,i,s); */ ! GetItem(m, i, s); GetFNum(s, &value); /* Check active font */ --- 2728,2734 ---- EnableItem(m, i); /* Analyze font */ ! GetMenuItemText(m,i,s); GetFNum(s, &value); /* Check active font */ *************** *** 2741,2747 **** /* Size menu */ ! m = GetMHandle(132); /* Get menu size */ n = CountMItems(m); --- 2738,2744 ---- /* Size menu */ ! m = GetMenuHandle(132); /* Get menu size */ n = CountMItems(m); *************** *** 2761,2768 **** for (i = 1; i <= n; i++) { /* Analyze size */ ! /* GetMenuItemText(m,i,s); */ ! GetItem(m, i, s); s[s[0]+1] = '\0'; value = atoi((char*)(s+1)); --- 2758,2764 ---- for (i = 1; i <= n; i++) { /* Analyze size */ ! GetMenuItemText(m,i,s); s[s[0]+1] = '\0'; value = atoi((char*)(s+1)); *************** *** 2776,2782 **** /* Windows menu */ ! m = GetMHandle(133); /* Get menu size */ n = CountMItems(m); --- 2772,2778 ---- /* Windows menu */ ! m = GetMenuHandle(133); /* Get menu size */ n = CountMItems(m); *************** *** 2790,2796 **** /* Special menu */ ! m = GetMHandle(134); /* Get menu size */ n = CountMItems(m); --- 2786,2792 ---- /* Special menu */ ! m = GetMenuHandle(134); /* Get menu size */ n = CountMItems(m); *************** *** 2824,2830 **** /* TileWidth menu */ ! m = GetMHandle(135); /* Get menu size */ n = CountMItems(m); --- 2820,2826 ---- /* TileWidth menu */ ! m = GetMenuHandle(135); /* Get menu size */ n = CountMItems(m); *************** *** 2844,2851 **** for (i = 1; i <= n; i++) { /* Analyze size */ ! /* GetMenuItemText(m,i,s); */ ! GetItem(m, i, s); s[s[0]+1] = '\0'; value = atoi((char*)(s+1)); --- 2840,2846 ---- for (i = 1; i <= n; i++) { /* Analyze size */ ! GetMenuItemText(m,i,s); s[s[0]+1] = '\0'; value = atoi((char*)(s+1)); *************** *** 2859,2865 **** /* TileHeight menu */ ! m = GetMHandle(136); /* Get menu size */ n = CountMItems(m); --- 2854,2860 ---- /* TileHeight menu */ ! m = GetMenuHandle(136); /* Get menu size */ n = CountMItems(m); *************** *** 2879,2886 **** for (i = 1; i <= n; i++) { /* Analyze size */ ! /* GetMenuItemText(m,i,s); */ ! GetItem(m, i, s); s[s[0]+1] = '\0'; value = atoi((char*)(s+1)); --- 2874,2880 ---- for (i = 1; i <= n; i++) { /* Analyze size */ ! GetMenuItemText(m,i,s); s[s[0]+1] = '\0'; value = atoi((char*)(s+1)); *************** *** 2951,2963 **** MoveWindow(dialog, r.left, r.top, 1); ShowWindow(dialog); ModalDialog(0, &item_hit); ! DisposDialog(dialog); break; } /* Desk accessory */ ! /* GetMenuItemText(GetMHandle(128),selection,s); */ ! GetItem(GetMHandle(128), selection, s); OpenDeskAcc(s); break; } --- 2945,2956 ---- MoveWindow(dialog, r.left, r.top, 1); ShowWindow(dialog); ModalDialog(0, &item_hit); ! DisposeDialog(dialog); break; } /* Desk accessory */ ! GetMenuItemText(GetMenuHandle(128), selection, s); OpenDeskAcc(s); break; } *************** *** 3135,3142 **** } /* Get a new font name */ ! /* GetMenuItemText(GetMHandle(131), selection, s); */ ! GetItem(GetMHandle(131), selection, s); GetFNum(s, &fid); /* Save the new font id */ --- 3128,3134 ---- } /* Get a new font name */ ! GetMenuItemText(GetMenuHandle(131), selection, s); GetFNum(s, &fid); /* Save the new font id */ *************** *** 3195,3202 **** /* Activate */ activate(td->w); ! /* GetMenuItemText(GetMHandle(132), selection, s); */ ! GetItem(GetMHandle(132), selection, s); s[s[0]+1]=0; td->font_size = atoi((char*)(s+1)); --- 3187,3193 ---- /* Activate */ activate(td->w); ! GetMenuItemText(GetMenuHandle(132), selection, s); s[s[0]+1]=0; td->font_size = atoi((char*)(s+1)); *************** *** 3298,3305 **** /* Activate */ activate(td->w); ! /* GetMenuItemText(GetMHandle(135), selection, s); */ ! GetItem(GetMHandle(135), selection, s); s[s[0]+1]=0; td->tile_wid = atoi((char*)(s+1)); --- 3289,3295 ---- /* Activate */ activate(td->w); ! GetMenuItemText(GetMenuHandle(135), selection, s); s[s[0]+1]=0; td->tile_wid = atoi((char*)(s+1)); *************** *** 3327,3334 **** /* Activate */ activate(td->w); ! /* GetMenuItemText(GetMHandle(136), selection, s); */ ! GetItem(GetMHandle(136), selection, s); s[s[0]+1]=0; td->tile_hgt = atoi((char*)(s+1)); --- 3317,3323 ---- /* Activate */ activate(td->w); ! GetMenuItemText(GetMenuHandle(136), selection, s); s[s[0]+1]=0; td->tile_hgt = atoi((char*)(s+1)); diff -r -c -w src-281/main-win.c angband-281/src/main-win.c *** src-281/main-win.c Mon Mar 3 22:30:25 1997 --- angband-281/src/main-win.c Thu Apr 24 10:30:47 1997 *************** *** 342,348 **** /* * Mega-Hack -- global "window creation" pointer */ ! static term_data *td_ptr; /* * Various boolean flags --- 342,348 ---- /* * Mega-Hack -- global "window creation" pointer */ ! static term_data *my_td; /* * Various boolean flags *************** *** 1476,1482 **** use_graphics = arg_graphics; /* Reset visuals */ ! reset_visuals(); /* Activate graphics */ if (use_graphics) --- 1476,1482 ---- use_graphics = arg_graphics; /* Reset visuals */ ! reset_visuals(TRUE); /* Activate graphics */ if (use_graphics) *************** *** 2123,2136 **** /* Screen window */ ! td_ptr = &data[0]; ! td_ptr->w = CreateWindowEx(td_ptr->dwExStyle, AppName, ! td_ptr->s, td_ptr->dwStyle, ! td_ptr->pos_x, td_ptr->pos_y, ! td_ptr->size_wid, td_ptr->size_hgt, HWND_DESKTOP, NULL, hInstance, NULL); ! if (!td_ptr->w) quit("Failed to create Angband window"); ! td_ptr = NULL; term_data_link(&data[0]); angband_term[0] = &data[0].t; --- 2123,2136 ---- /* Screen window */ ! my_td = &data[0]; ! my_td->w = CreateWindowEx(my_td->dwExStyle, AppName, ! my_td->s, my_td->dwStyle, ! my_td->pos_x, my_td->pos_y, ! my_td->size_wid, my_td->size_hgt, HWND_DESKTOP, NULL, hInstance, NULL); ! if (!my_td->w) quit("Failed to create Angband window"); ! my_td = NULL; term_data_link(&data[0]); angband_term[0] = &data[0].t; *************** *** 2137,2156 **** /* Windows */ for (i = 1; i < MAX_TERM_DATA; i++) { ! td_ptr = &data[i]; ! td_ptr->w = CreateWindowEx(td_ptr->dwExStyle, AngList, ! td_ptr->s, td_ptr->dwStyle, ! td_ptr->pos_x, td_ptr->pos_y, ! td_ptr->size_wid, td_ptr->size_hgt, HWND_DESKTOP, NULL, hInstance, NULL); ! if (!td_ptr->w) quit("Failed to create sub-window"); ! if (td_ptr->visible) { ! td_ptr->size_hack = TRUE; ! ShowWindow(td_ptr->w, SW_SHOW); ! td_ptr->size_hack = FALSE; } ! td_ptr = NULL; term_data_link(&data[i]); angband_term[i] = &data[i].t; } --- 2137,2156 ---- /* Windows */ for (i = 1; i < MAX_TERM_DATA; i++) { ! my_td = &data[i]; ! my_td->w = CreateWindowEx(my_td->dwExStyle, AngList, ! my_td->s, my_td->dwStyle, ! my_td->pos_x, my_td->pos_y, ! my_td->size_wid, my_td->size_hgt, HWND_DESKTOP, NULL, hInstance, NULL); ! if (!my_td->w) quit("Failed to create sub-window"); ! if (my_td->visible) { ! my_td->size_hack = TRUE; ! ShowWindow(my_td->w, SW_SHOW); ! my_td->size_hack = FALSE; } ! my_td = NULL; term_data_link(&data[i]); angband_term[i] = &data[i].t; } *************** *** 2572,2578 **** /* XXX XXX XXX */ case WM_NCCREATE: { ! SetWindowLong(hWnd, 0, (LONG)(td_ptr)); break; } --- 2572,2578 ---- /* XXX XXX XXX */ case WM_NCCREATE: { ! SetWindowLong(hWnd, 0, (LONG)(my_td)); break; } *************** *** 2821,2827 **** /* XXX XXX XXX */ case WM_NCCREATE: { ! SetWindowLong(hWnd, 0, (LONG)(td_ptr)); break; } --- 2821,2827 ---- /* XXX XXX XXX */ case WM_NCCREATE: { ! SetWindowLong(hWnd, 0, (LONG)(my_td)); break; } *************** *** 3024,3030 **** /* XXX XXX XXX */ case WM_NCCREATE: { ! SetWindowLong(hWnd, 0, (LONG)(td_ptr)); break; } --- 3024,3030 ---- /* XXX XXX XXX */ case WM_NCCREATE: { ! SetWindowLong(hWnd, 0, (LONG)(my_td)); break; } diff -r -c -w src-281/main-x11.c angband-281/src/main-x11.c *** src-281/main-x11.c Thu Mar 6 19:42:15 1997 --- angband-281/src/main-x11.c Thu Apr 24 10:31:08 1997 *************** *** 1,8 **** /* File: main-x11.c */ /* - * Purpose: One (awful) way to run Angband under X11 -BEN- - * * Most of this file provides a user interface package composed of * several pseudo-objects, including "metadpy" (a display), "infowin" * (a window), "infoclr" (a color), and "infofnt" (a font). Actually, --- 1,8 ---- /* File: main-x11.c */ + /* Purpose: One (awful) way to run Angband under X11 -BEN- */ + /* * Most of this file provides a user interface package composed of * several pseudo-objects, including "metadpy" (a display), "infowin" * (a window), "infoclr" (a color), and "infofnt" (a font). Actually, *************** *** 1806,1813 **** */ static errr Term_xtra_x11_react(void) { - term_data *td = (term_data*)(Term->data); - /* XXX XXX XXX */ /* Success */ --- 1806,1811 ---- Only in angband-281/src: main-x11.o Only in angband-281/src: main-xaw.o diff -r -c -w src-281/main.c angband-281/src/main.c *** src-281/main.c Mon Mar 10 21:08:25 1997 --- angband-281/src/main.c Thu Apr 24 10:31:44 1997 *************** *** 215,221 **** } /* Acquire the "user name" as a default player name */ ! user_name(player_name, player_uid); #endif --- 215,221 ---- } /* Acquire the "user name" as a default player name */ ! user_name(p_ptr->full_name, player_uid); #endif *************** *** 305,311 **** case 'U': { if (!argv[0][2]) goto usage; ! strcpy(player_name, &argv[0][2]); break; } --- 305,311 ---- case 'U': { if (!argv[0][2]) goto usage; ! strcpy(p_ptr->full_name, &argv[0][2]); break; } Only in angband-281/src: main.o diff -r -c -w src-281/melee1.c angband-281/src/melee1.c *** src-281/melee1.c Mon Mar 3 22:32:26 1997 --- angband-281/src/melee1.c Thu Apr 24 10:32:36 1997 *************** *** 1,6 **** ! /* File: melee1.c */ ! /* Purpose: Monster attacks */ /* * Copyright (c) 1989 James E. Wilson, Robert A. Koeneke --- 1,6 ---- ! /* File: melee2.c */ ! /* Purpose: Monster attacks and movement */ /* * Copyright (c) 1989 James E. Wilson, Robert A. Koeneke *************** *** 462,468 **** } /* Learn about the player */ ! update_smart_learn(m_idx, DRS_POIS); break; } --- 462,468 ---- } /* Learn about the player */ ! update_smart_learn(m_idx, DRS_RES_POIS); break; } *************** *** 480,486 **** } /* Learn about the player */ ! update_smart_learn(m_idx, DRS_DISEN); break; } --- 480,486 ---- } /* Learn about the player */ ! update_smart_learn(m_idx, DRS_RES_DISEN); break; } *************** *** 620,625 **** --- 620,628 ---- /* Find an item */ for (k = 0; k < 10; k++) { + object_type *i_ptr; + object_type object_type_body; + /* Pick an item */ i = rand_int(INVEN_PACK); *************** *** 640,681 **** ((o_ptr->number > 1) ? "One of y" : "Y"), o_name, index_to_label(i)); ! /* Option */ ! if (testing_carry) ! { ! s16b o_idx; ! /* Make an object */ ! o_idx = o_pop(); - /* Success */ - if (o_idx) - { - object_type *j_ptr; - - /* Get new object */ - j_ptr = &o_list[o_idx]; - - /* Copy object */ - object_copy(j_ptr, o_ptr); - /* Modify number */ ! j_ptr->number = 1; ! /* Forget mark */ ! j_ptr->marked = FALSE; - /* Memorize monster */ - j_ptr->held_m_idx = m_idx; - - /* Build stack */ - j_ptr->next_o_idx = m_ptr->hold_o_idx; - - /* Build stack */ - m_ptr->hold_o_idx = o_idx; - } - } - /* Steal the items */ inven_item_increase(i, -1); inven_item_optimize(i); --- 643,660 ---- ((o_ptr->number > 1) ? "One of y" : "Y"), o_name, index_to_label(i)); ! /* Get local object */ ! i_ptr = &object_type_body; ! /* Obtain local object */ ! object_copy(i_ptr, o_ptr); /* Modify number */ ! i_ptr->number = 1; ! /* Carry the object */ ! (void)monster_carry(m_idx, i_ptr); /* Steal the items */ inven_item_increase(i, -1); inven_item_optimize(i); *************** *** 776,782 **** acid_dam(damage, ddesc); /* Learn about the player */ ! update_smart_learn(m_idx, DRS_ACID); break; } --- 755,761 ---- acid_dam(damage, ddesc); /* Learn about the player */ ! update_smart_learn(m_idx, DRS_RES_ACID); break; } *************** *** 793,799 **** elec_dam(damage, ddesc); /* Learn about the player */ ! update_smart_learn(m_idx, DRS_ELEC); break; } --- 772,778 ---- elec_dam(damage, ddesc); /* Learn about the player */ ! update_smart_learn(m_idx, DRS_RES_ELEC); break; } *************** *** 810,816 **** fire_dam(damage, ddesc); /* Learn about the player */ ! update_smart_learn(m_idx, DRS_FIRE); break; } --- 789,795 ---- fire_dam(damage, ddesc); /* Learn about the player */ ! update_smart_learn(m_idx, DRS_RES_FIRE); break; } *************** *** 827,833 **** cold_dam(damage, ddesc); /* Learn about the player */ ! update_smart_learn(m_idx, DRS_COLD); break; } --- 806,812 ---- cold_dam(damage, ddesc); /* Learn about the player */ ! update_smart_learn(m_idx, DRS_RES_COLD); break; } *************** *** 847,853 **** } /* Learn about the player */ ! update_smart_learn(m_idx, DRS_BLIND); break; } --- 826,832 ---- } /* Learn about the player */ ! update_smart_learn(m_idx, DRS_RES_BLIND); break; } *************** *** 858,864 **** take_hit(damage, ddesc); /* Increase "confused" */ ! if (!p_ptr->resist_conf) { if (set_confused(p_ptr->confused + 3 + randint(rlev))) { --- 837,843 ---- take_hit(damage, ddesc); /* Increase "confused" */ ! if (!p_ptr->resist_confu) { if (set_confused(p_ptr->confused + 3 + randint(rlev))) { *************** *** 867,873 **** } /* Learn about the player */ ! update_smart_learn(m_idx, DRS_CONF); break; } --- 846,852 ---- } /* Learn about the player */ ! update_smart_learn(m_idx, DRS_RES_CONFU); break; } *************** *** 897,903 **** } /* Learn about the player */ ! update_smart_learn(m_idx, DRS_FEAR); break; } --- 876,882 ---- } /* Learn about the player */ ! update_smart_learn(m_idx, DRS_RES_FEAR); break; } Only in angband-281/src: melee1.o diff -r -c -w src-281/melee2.c angband-281/src/melee2.c *** src-281/melee2.c Mon Mar 3 22:33:01 1997 --- angband-281/src/melee2.c Thu Apr 24 10:33:03 1997 *************** *** 1,6 **** ! /* File: melee2.c */ ! /* Purpose: Monster spells and movement */ /* * Copyright (c) 1989 James E. Wilson, Robert A. Koeneke --- 1,6 ---- ! /* File: melee1.c */ ! /* Purpose: Monster spells */ /* * Copyright (c) 1989 James E. Wilson, Robert A. Koeneke *************** *** 21,26 **** --- 21,27 ---- * And now for Intelligent monster attacks (including spells). * * Original idea and code by "DRS" (David Reeves Sward). + * * Major modifications by "BEN" (Ben Harrison). * * Give monsters more intelligent attack/spell selection based on *************** *** 101,140 **** /* Cheat if requested */ if (smart_cheat) { ! /* Know basic info */ ! if (p_ptr->resist_acid) smart |= (SM_RES_ACID); ! if (p_ptr->oppose_acid) smart |= (SM_OPP_ACID); if (p_ptr->immune_acid) smart |= (SM_IMM_ACID); - if (p_ptr->resist_elec) smart |= (SM_RES_ELEC); - if (p_ptr->oppose_elec) smart |= (SM_OPP_ELEC); if (p_ptr->immune_elec) smart |= (SM_IMM_ELEC); - if (p_ptr->resist_fire) smart |= (SM_RES_FIRE); - if (p_ptr->oppose_fire) smart |= (SM_OPP_FIRE); if (p_ptr->immune_fire) smart |= (SM_IMM_FIRE); - if (p_ptr->resist_cold) smart |= (SM_RES_COLD); - if (p_ptr->oppose_cold) smart |= (SM_OPP_COLD); if (p_ptr->immune_cold) smart |= (SM_IMM_COLD); ! /* Know poison info */ ! if (p_ptr->resist_pois) smart |= (SM_RES_POIS); if (p_ptr->oppose_pois) smart |= (SM_OPP_POIS); ! /* Know special resistances */ ! if (p_ptr->resist_neth) smart |= (SM_RES_NETH); if (p_ptr->resist_lite) smart |= (SM_RES_LITE); if (p_ptr->resist_dark) smart |= (SM_RES_DARK); - if (p_ptr->resist_fear) smart |= (SM_RES_FEAR); - if (p_ptr->resist_conf) smart |= (SM_RES_CONF); - if (p_ptr->resist_chaos) smart |= (SM_RES_CHAOS); - if (p_ptr->resist_disen) smart |= (SM_RES_DISEN); if (p_ptr->resist_blind) smart |= (SM_RES_BLIND); ! if (p_ptr->resist_nexus) smart |= (SM_RES_NEXUS); if (p_ptr->resist_sound) smart |= (SM_RES_SOUND); if (p_ptr->resist_shard) smart |= (SM_RES_SHARD); ! ! /* Know bizarre "resistances" */ ! if (p_ptr->free_act) smart |= (SM_IMM_FREE); ! if (!p_ptr->msp) smart |= (SM_IMM_MANA); } --- 102,141 ---- /* Cheat if requested */ if (smart_cheat) { ! /* Know weirdness */ ! if (p_ptr->free_act) smart |= (SM_IMM_FREE); ! if (!p_ptr->msp) smart |= (SM_IMM_MANA); ! ! /* Know immunities */ if (p_ptr->immune_acid) smart |= (SM_IMM_ACID); if (p_ptr->immune_elec) smart |= (SM_IMM_ELEC); if (p_ptr->immune_fire) smart |= (SM_IMM_FIRE); if (p_ptr->immune_cold) smart |= (SM_IMM_COLD); ! /* Know oppositions */ ! if (p_ptr->oppose_acid) smart |= (SM_OPP_ACID); ! if (p_ptr->oppose_elec) smart |= (SM_OPP_ELEC); ! if (p_ptr->oppose_fire) smart |= (SM_OPP_FIRE); ! if (p_ptr->oppose_cold) smart |= (SM_OPP_COLD); if (p_ptr->oppose_pois) smart |= (SM_OPP_POIS); ! /* Know resistances */ ! if (p_ptr->resist_acid) smart |= (SM_RES_ACID); ! if (p_ptr->resist_elec) smart |= (SM_RES_ELEC); ! if (p_ptr->resist_fire) smart |= (SM_RES_FIRE); ! if (p_ptr->resist_cold) smart |= (SM_RES_COLD); ! if (p_ptr->resist_pois) smart |= (SM_RES_POIS); ! if (p_ptr->resist_fear) smart |= (SM_RES_FEAR); if (p_ptr->resist_lite) smart |= (SM_RES_LITE); if (p_ptr->resist_dark) smart |= (SM_RES_DARK); if (p_ptr->resist_blind) smart |= (SM_RES_BLIND); ! if (p_ptr->resist_confu) smart |= (SM_RES_CONFU); if (p_ptr->resist_sound) smart |= (SM_RES_SOUND); if (p_ptr->resist_shard) smart |= (SM_RES_SHARD); ! if (p_ptr->resist_nexus) smart |= (SM_RES_NEXUS); ! if (p_ptr->resist_nethr) smart |= (SM_RES_NETHR); ! if (p_ptr->resist_chaos) smart |= (SM_RES_CHAOS); ! if (p_ptr->resist_disen) smart |= (SM_RES_DISEN); } *************** *** 237,247 **** } ! if (smart & (SM_RES_NETH)) { ! if (int_outof(r_ptr, 50)) f4 &= ~(RF4_BR_NETH); ! if (int_outof(r_ptr, 50)) f5 &= ~(RF5_BA_NETH); ! if (int_outof(r_ptr, 50)) f5 &= ~(RF5_BO_NETH); } if (smart & (SM_RES_LITE)) --- 238,246 ---- } ! if (smart & (SM_RES_FEAR)) { ! if (int_outof(r_ptr, 100)) f5 &= ~(RF5_SCARE); } if (smart & (SM_RES_LITE)) *************** *** 255,288 **** if (int_outof(r_ptr, 50)) f5 &= ~(RF5_BA_DARK); } ! if (smart & (SM_RES_FEAR)) { ! if (int_outof(r_ptr, 100)) f5 &= ~(RF5_SCARE); } ! if (smart & (SM_RES_CONF)) { if (int_outof(r_ptr, 100)) f5 &= ~(RF5_CONF); if (int_outof(r_ptr, 50)) f4 &= ~(RF4_BR_CONF); } ! 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); } ! if (smart & (SM_RES_DISEN)) { ! if (int_outof(r_ptr, 100)) f4 &= ~(RF4_BR_DISE); } - if (smart & (SM_RES_BLIND)) - { - if (int_outof(r_ptr, 100)) f5 &= ~(RF5_BLIND); - } - if (smart & (SM_RES_NEXUS)) { if (int_outof(r_ptr, 50)) f4 &= ~(RF4_BR_NEXU); --- 254,280 ---- if (int_outof(r_ptr, 50)) f5 &= ~(RF5_BA_DARK); } ! if (smart & (SM_RES_BLIND)) { ! if (int_outof(r_ptr, 100)) f5 &= ~(RF5_BLIND); } ! if (smart & (SM_RES_CONFU)) { if (int_outof(r_ptr, 100)) f5 &= ~(RF5_CONF); if (int_outof(r_ptr, 50)) f4 &= ~(RF4_BR_CONF); } ! if (smart & (SM_RES_SOUND)) { ! if (int_outof(r_ptr, 50)) f4 &= ~(RF4_BR_SOUN); } ! if (smart & (SM_RES_SHARD)) { ! if (int_outof(r_ptr, 50)) f4 &= ~(RF4_BR_SHAR); } if (smart & (SM_RES_NEXUS)) { if (int_outof(r_ptr, 50)) f4 &= ~(RF4_BR_NEXU); *************** *** 289,305 **** if (int_outof(r_ptr, 50)) f6 &= ~(RF6_TELE_LEVEL); } ! if (smart & (SM_RES_SOUND)) { ! if (int_outof(r_ptr, 50)) f4 &= ~(RF4_BR_SOUN); } ! if (smart & (SM_RES_SHARD)) { ! if (int_outof(r_ptr, 50)) f4 &= ~(RF4_BR_SHAR); } if (smart & (SM_IMM_FREE)) { if (int_outof(r_ptr, 100)) f5 &= ~(RF5_HOLD); --- 281,306 ---- if (int_outof(r_ptr, 50)) f6 &= ~(RF6_TELE_LEVEL); } ! if (smart & (SM_RES_NETHR)) { ! if (int_outof(r_ptr, 50)) f4 &= ~(RF4_BR_NETH); ! if (int_outof(r_ptr, 50)) f5 &= ~(RF5_BA_NETH); ! if (int_outof(r_ptr, 50)) f5 &= ~(RF5_BO_NETH); } ! 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); } + if (smart & (SM_RES_DISEN)) + { + if (int_outof(r_ptr, 100)) f4 &= ~(RF4_BR_DISE); + } + if (smart & (SM_IMM_FREE)) { if (int_outof(r_ptr, 100)) f5 &= ~(RF5_HOLD); *************** *** 335,341 **** int flg = PROJECT_STOP | PROJECT_KILL; /* Target the player with a bolt attack */ ! (void)project(m_idx, 0, py, px, dam_hp, typ, flg); } --- 336,342 ---- int flg = PROJECT_STOP | PROJECT_KILL; /* Target the player with a bolt attack */ ! (void)project(m_idx, 0, p_ptr->py, p_ptr->px, dam_hp, typ, flg); } *************** *** 357,363 **** rad = (r_ptr->flags2 & (RF2_POWERFUL)) ? 3 : 2; /* Target the player with a ball attack */ ! (void)project(m_idx, rad, py, px, dam_hp, typ, flg); } --- 358,364 ---- rad = (r_ptr->flags2 & (RF2_POWERFUL)) ? 3 : 2; /* Target the player with a ball attack */ ! (void)project(m_idx, rad, p_ptr->py, p_ptr->px, dam_hp, typ, flg); } *************** *** 434,441 **** /* Target location */ ! int x = px; ! int y = py; /* Summon count */ int count = 0; --- 435,442 ---- /* Target location */ ! int x = p_ptr->px; ! int y = p_ptr->py; /* Summon count */ int count = 0; *************** *** 481,487 **** if (m_ptr->cdis > MAX_RANGE) return (FALSE); /* Check path */ ! if (!projectable(m_ptr->fy, m_ptr->fx, py, px)) return (FALSE); } --- 482,488 ---- if (m_ptr->cdis > MAX_RANGE) return (FALSE); /* Check path */ ! if (!projectable(m_ptr->fy, m_ptr->fx, p_ptr->py, p_ptr->px)) return (FALSE); } *************** *** 640,646 **** else msg_format("%^s breathes acid.", m_name); breath(m_idx, GF_ACID, ((m_ptr->hp / 3) > 1600 ? 1600 : (m_ptr->hp / 3))); ! update_smart_learn(m_idx, DRS_ACID); break; } --- 641,647 ---- else msg_format("%^s breathes acid.", m_name); breath(m_idx, GF_ACID, ((m_ptr->hp / 3) > 1600 ? 1600 : (m_ptr->hp / 3))); ! update_smart_learn(m_idx, DRS_RES_ACID); break; } *************** *** 652,658 **** else msg_format("%^s breathes lightning.", m_name); breath(m_idx, GF_ELEC, ((m_ptr->hp / 3) > 1600 ? 1600 : (m_ptr->hp / 3))); ! update_smart_learn(m_idx, DRS_ELEC); break; } --- 653,659 ---- else msg_format("%^s breathes lightning.", m_name); breath(m_idx, GF_ELEC, ((m_ptr->hp / 3) > 1600 ? 1600 : (m_ptr->hp / 3))); ! update_smart_learn(m_idx, DRS_RES_ELEC); break; } *************** *** 664,670 **** else msg_format("%^s breathes fire.", m_name); breath(m_idx, GF_FIRE, ((m_ptr->hp / 3) > 1600 ? 1600 : (m_ptr->hp / 3))); ! update_smart_learn(m_idx, DRS_FIRE); break; } --- 665,671 ---- else msg_format("%^s breathes fire.", m_name); breath(m_idx, GF_FIRE, ((m_ptr->hp / 3) > 1600 ? 1600 : (m_ptr->hp / 3))); ! update_smart_learn(m_idx, DRS_RES_FIRE); break; } *************** *** 676,682 **** else msg_format("%^s breathes frost.", m_name); breath(m_idx, GF_COLD, ((m_ptr->hp / 3) > 1600 ? 1600 : (m_ptr->hp / 3))); ! update_smart_learn(m_idx, DRS_COLD); break; } --- 677,683 ---- else msg_format("%^s breathes frost.", m_name); breath(m_idx, GF_COLD, ((m_ptr->hp / 3) > 1600 ? 1600 : (m_ptr->hp / 3))); ! update_smart_learn(m_idx, DRS_RES_COLD); break; } *************** *** 688,694 **** else msg_format("%^s breathes gas.", m_name); breath(m_idx, GF_POIS, ((m_ptr->hp / 3) > 800 ? 800 : (m_ptr->hp / 3))); ! update_smart_learn(m_idx, DRS_POIS); break; } --- 689,695 ---- else msg_format("%^s breathes gas.", m_name); breath(m_idx, GF_POIS, ((m_ptr->hp / 3) > 800 ? 800 : (m_ptr->hp / 3))); ! update_smart_learn(m_idx, DRS_RES_POIS); break; } *************** *** 700,706 **** else msg_format("%^s breathes nether.", m_name); breath(m_idx, GF_NETHER, ((m_ptr->hp / 6) > 550 ? 550 : (m_ptr->hp / 6))); ! update_smart_learn(m_idx, DRS_NETH); break; } --- 701,707 ---- else msg_format("%^s breathes nether.", m_name); breath(m_idx, GF_NETHER, ((m_ptr->hp / 6) > 550 ? 550 : (m_ptr->hp / 6))); ! update_smart_learn(m_idx, DRS_RES_NETHR); break; } *************** *** 712,718 **** else msg_format("%^s breathes light.", m_name); breath(m_idx, GF_LITE, ((m_ptr->hp / 6) > 400 ? 400 : (m_ptr->hp / 6))); ! update_smart_learn(m_idx, DRS_LITE); break; } --- 713,719 ---- else msg_format("%^s breathes light.", m_name); breath(m_idx, GF_LITE, ((m_ptr->hp / 6) > 400 ? 400 : (m_ptr->hp / 6))); ! update_smart_learn(m_idx, DRS_RES_LITE); break; } *************** *** 724,730 **** else msg_format("%^s breathes darkness.", m_name); breath(m_idx, GF_DARK, ((m_ptr->hp / 6) > 400 ? 400 : (m_ptr->hp / 6))); ! update_smart_learn(m_idx, DRS_DARK); break; } --- 725,731 ---- else msg_format("%^s breathes darkness.", m_name); breath(m_idx, GF_DARK, ((m_ptr->hp / 6) > 400 ? 400 : (m_ptr->hp / 6))); ! update_smart_learn(m_idx, DRS_RES_DARK); break; } *************** *** 736,742 **** else msg_format("%^s breathes confusion.", m_name); breath(m_idx, GF_CONFUSION, ((m_ptr->hp / 6) > 400 ? 400 : (m_ptr->hp / 6))); ! update_smart_learn(m_idx, DRS_CONF); break; } --- 737,743 ---- else msg_format("%^s breathes confusion.", m_name); breath(m_idx, GF_CONFUSION, ((m_ptr->hp / 6) > 400 ? 400 : (m_ptr->hp / 6))); ! update_smart_learn(m_idx, DRS_RES_CONFU); break; } *************** *** 748,754 **** else msg_format("%^s breathes sound.", m_name); breath(m_idx, GF_SOUND, ((m_ptr->hp / 6) > 400 ? 400 : (m_ptr->hp / 6))); ! update_smart_learn(m_idx, DRS_SOUND); break; } --- 749,755 ---- else msg_format("%^s breathes sound.", m_name); breath(m_idx, GF_SOUND, ((m_ptr->hp / 6) > 400 ? 400 : (m_ptr->hp / 6))); ! update_smart_learn(m_idx, DRS_RES_SOUND); break; } *************** *** 760,766 **** else msg_format("%^s breathes chaos.", m_name); breath(m_idx, GF_CHAOS, ((m_ptr->hp / 6) > 600 ? 600 : (m_ptr->hp / 6))); ! update_smart_learn(m_idx, DRS_CHAOS); break; } --- 761,767 ---- else msg_format("%^s breathes chaos.", m_name); breath(m_idx, GF_CHAOS, ((m_ptr->hp / 6) > 600 ? 600 : (m_ptr->hp / 6))); ! update_smart_learn(m_idx, DRS_RES_CHAOS); break; } *************** *** 772,778 **** else msg_format("%^s breathes disenchantment.", m_name); breath(m_idx, GF_DISENCHANT, ((m_ptr->hp / 6) > 500 ? 500 : (m_ptr->hp / 6))); ! update_smart_learn(m_idx, DRS_DISEN); break; } --- 773,779 ---- else msg_format("%^s breathes disenchantment.", m_name); breath(m_idx, GF_DISENCHANT, ((m_ptr->hp / 6) > 500 ? 500 : (m_ptr->hp / 6))); ! update_smart_learn(m_idx, DRS_RES_DISEN); break; } *************** *** 784,790 **** else msg_format("%^s breathes nexus.", m_name); breath(m_idx, GF_NEXUS, ((m_ptr->hp / 3) > 250 ? 250 : (m_ptr->hp / 3))); ! update_smart_learn(m_idx, DRS_NEXUS); break; } --- 785,791 ---- else msg_format("%^s breathes nexus.", m_name); breath(m_idx, GF_NEXUS, ((m_ptr->hp / 3) > 250 ? 250 : (m_ptr->hp / 3))); ! update_smart_learn(m_idx, DRS_RES_NEXUS); break; } *************** *** 827,835 **** disturb(1, 0); if (blind) msg_format("%^s breathes.", m_name); else msg_format("%^s breathes shards.", m_name); ! breath(m_idx, GF_SHARDS, ((m_ptr->hp / 6) > 400 ? 400 : (m_ptr->hp / 6))); ! update_smart_learn(m_idx, DRS_SHARD); break; } --- 828,836 ---- disturb(1, 0); if (blind) msg_format("%^s breathes.", m_name); else msg_format("%^s breathes shards.", m_name); ! breath(m_idx, GF_SHARD, ((m_ptr->hp / 6) > 400 ? 400 : (m_ptr->hp / 6))); ! update_smart_learn(m_idx, DRS_RES_SHARD); break; } *************** *** 896,902 **** else msg_format("%^s casts an acid ball.", m_name); breath(m_idx, GF_ACID, randint(rlev * 3) + 15); ! update_smart_learn(m_idx, DRS_ACID); break; } --- 897,903 ---- else msg_format("%^s casts an acid ball.", m_name); breath(m_idx, GF_ACID, randint(rlev * 3) + 15); ! update_smart_learn(m_idx, DRS_RES_ACID); break; } *************** *** 908,914 **** else msg_format("%^s casts a lightning ball.", m_name); breath(m_idx, GF_ELEC, randint(rlev * 3 / 2) + 8); ! update_smart_learn(m_idx, DRS_ELEC); break; } --- 909,915 ---- else msg_format("%^s casts a lightning ball.", m_name); breath(m_idx, GF_ELEC, randint(rlev * 3 / 2) + 8); ! update_smart_learn(m_idx, DRS_RES_ELEC); break; } *************** *** 920,926 **** else msg_format("%^s casts a fire ball.", m_name); breath(m_idx, GF_FIRE, randint(rlev * 7 / 2) + 10); ! update_smart_learn(m_idx, DRS_FIRE); break; } --- 921,927 ---- else msg_format("%^s casts a fire ball.", m_name); breath(m_idx, GF_FIRE, randint(rlev * 7 / 2) + 10); ! update_smart_learn(m_idx, DRS_RES_FIRE); break; } *************** *** 932,938 **** else msg_format("%^s casts a frost ball.", m_name); breath(m_idx, GF_COLD, randint(rlev * 3 / 2) + 10); ! update_smart_learn(m_idx, DRS_COLD); break; } --- 933,939 ---- else msg_format("%^s casts a frost ball.", m_name); breath(m_idx, GF_COLD, randint(rlev * 3 / 2) + 10); ! update_smart_learn(m_idx, DRS_RES_COLD); break; } *************** *** 944,950 **** else msg_format("%^s casts a stinking cloud.", m_name); breath(m_idx, GF_POIS, damroll(12, 2)); ! update_smart_learn(m_idx, DRS_POIS); break; } --- 945,951 ---- else msg_format("%^s casts a stinking cloud.", m_name); breath(m_idx, GF_POIS, damroll(12, 2)); ! update_smart_learn(m_idx, DRS_RES_POIS); break; } *************** *** 956,962 **** else msg_format("%^s casts a nether ball.", m_name); breath(m_idx, GF_NETHER, (50 + damroll(10, 10) + rlev)); ! update_smart_learn(m_idx, DRS_NETH); break; } --- 957,963 ---- else msg_format("%^s casts a nether ball.", m_name); breath(m_idx, GF_NETHER, (50 + damroll(10, 10) + rlev)); ! update_smart_learn(m_idx, DRS_RES_NETHR); break; } *************** *** 991,997 **** else msg_format("%^s invokes a darkness storm.", m_name); breath(m_idx, GF_DARK, (rlev * 5) + damroll(10, 10)); ! update_smart_learn(m_idx, DRS_DARK); break; } --- 992,998 ---- else msg_format("%^s invokes a darkness storm.", m_name); breath(m_idx, GF_DARK, (rlev * 5) + damroll(10, 10)); ! update_smart_learn(m_idx, DRS_RES_DARK); break; } *************** *** 1074,1080 **** else { msg_print("Your mind is blasted by psionic energy."); ! if (!p_ptr->resist_conf) { (void)set_confused(p_ptr->confused + rand_int(4) + 4); } --- 1075,1081 ---- else { msg_print("Your mind is blasted by psionic energy."); ! if (!p_ptr->resist_confu) { (void)set_confused(p_ptr->confused + rand_int(4) + 4); } *************** *** 1108,1114 **** { (void)set_blind(p_ptr->blind + 8 + rand_int(8)); } ! if (!p_ptr->resist_conf) { (void)set_confused(p_ptr->confused + rand_int(4) + 4); } --- 1109,1115 ---- { (void)set_blind(p_ptr->blind + 8 + rand_int(8)); } ! if (!p_ptr->resist_confu) { (void)set_confused(p_ptr->confused + rand_int(4) + 4); } *************** *** 1202,1208 **** else msg_format("%^s casts a acid bolt.", m_name); bolt(m_idx, GF_ACID, damroll(7, 8) + (rlev / 3)); ! update_smart_learn(m_idx, DRS_ACID); break; } --- 1203,1209 ---- else msg_format("%^s casts a acid bolt.", m_name); bolt(m_idx, GF_ACID, damroll(7, 8) + (rlev / 3)); ! update_smart_learn(m_idx, DRS_RES_ACID); break; } *************** *** 1214,1220 **** else msg_format("%^s casts a lightning bolt.", m_name); bolt(m_idx, GF_ELEC, damroll(4, 8) + (rlev / 3)); ! update_smart_learn(m_idx, DRS_ELEC); break; } --- 1215,1221 ---- else msg_format("%^s casts a lightning bolt.", m_name); bolt(m_idx, GF_ELEC, damroll(4, 8) + (rlev / 3)); ! update_smart_learn(m_idx, DRS_RES_ELEC); break; } *************** *** 1226,1232 **** else msg_format("%^s casts a fire bolt.", m_name); bolt(m_idx, GF_FIRE, damroll(9, 8) + (rlev / 3)); ! update_smart_learn(m_idx, DRS_FIRE); break; } --- 1227,1233 ---- else msg_format("%^s casts a fire bolt.", m_name); bolt(m_idx, GF_FIRE, damroll(9, 8) + (rlev / 3)); ! update_smart_learn(m_idx, DRS_RES_FIRE); break; } *************** *** 1238,1244 **** else msg_format("%^s casts a frost bolt.", m_name); bolt(m_idx, GF_COLD, damroll(6, 8) + (rlev / 3)); ! update_smart_learn(m_idx, DRS_COLD); break; } --- 1239,1245 ---- else msg_format("%^s casts a frost bolt.", m_name); bolt(m_idx, GF_COLD, damroll(6, 8) + (rlev / 3)); ! update_smart_learn(m_idx, DRS_RES_COLD); break; } *************** *** 1257,1263 **** else msg_format("%^s casts a nether bolt.", m_name); bolt(m_idx, GF_NETHER, 30 + damroll(5, 5) + (rlev * 3) / 2); ! update_smart_learn(m_idx, DRS_NETH); break; } --- 1258,1264 ---- else msg_format("%^s casts a nether bolt.", m_name); bolt(m_idx, GF_NETHER, 30 + damroll(5, 5) + (rlev * 3) / 2); ! update_smart_learn(m_idx, DRS_RES_NETHR); break; } *************** *** 1302,1308 **** else msg_format("%^s casts an ice bolt.", m_name); bolt(m_idx, GF_ICE, damroll(6, 6) + (rlev)); ! update_smart_learn(m_idx, DRS_COLD); break; } --- 1303,1309 ---- else msg_format("%^s casts an ice bolt.", m_name); bolt(m_idx, GF_ICE, damroll(6, 6) + (rlev)); ! update_smart_learn(m_idx, DRS_RES_COLD); break; } *************** *** 1336,1342 **** { (void)set_afraid(p_ptr->afraid + rand_int(4) + 4); } ! update_smart_learn(m_idx, DRS_FEAR); break; } --- 1337,1343 ---- { (void)set_afraid(p_ptr->afraid + rand_int(4) + 4); } ! update_smart_learn(m_idx, DRS_RES_FEAR); break; } *************** *** 1359,1365 **** { (void)set_blind(12 + rand_int(4)); } ! update_smart_learn(m_idx, DRS_BLIND); break; } --- 1360,1366 ---- { (void)set_blind(12 + rand_int(4)); } ! update_smart_learn(m_idx, DRS_RES_BLIND); break; } *************** *** 1370,1376 **** disturb(1, 0); if (blind) msg_format("%^s mumbles, and you hear puzzling noises.", m_name); else msg_format("%^s creates a mesmerising illusion.", m_name); ! if (p_ptr->resist_conf) { msg_print("You disbelieve the feeble spell."); } --- 1371,1377 ---- disturb(1, 0); if (blind) msg_format("%^s mumbles, and you hear puzzling noises.", m_name); else msg_format("%^s creates a mesmerising illusion.", m_name); ! if (p_ptr->resist_confu) { msg_print("You disbelieve the feeble spell."); } *************** *** 1382,1388 **** { (void)set_confused(p_ptr->confused + rand_int(4) + 4); } ! update_smart_learn(m_idx, DRS_CONF); break; } --- 1383,1389 ---- { (void)set_confused(p_ptr->confused + rand_int(4) + 4); } ! update_smart_learn(m_idx, DRS_RES_CONFU); break; } *************** *** 1609,1615 **** { teleport_player_level(); } ! update_smart_learn(m_idx, DRS_NEXUS); break; } --- 1610,1616 ---- { teleport_player_level(); } ! update_smart_learn(m_idx, DRS_RES_NEXUS); break; } *************** *** 1933,1938 **** --- 1934,1940 ---- } + /* * Returns whether a given monster will try to run from the player. * *************** *** 2054,2060 **** c_ptr = &cave[y1][x1]; /* The player is not currently near the monster grid */ ! if (c_ptr->when < cave[py][px].when) { /* The player has never been near the monster grid */ if (!c_ptr->when) return (FALSE); --- 2056,2062 ---- c_ptr = &cave[y1][x1]; /* The player is not currently near the monster grid */ ! if (c_ptr->when < cave[p_ptr->py][p_ptr->px].when) { /* The player has never been near the monster grid */ if (!c_ptr->when) return (FALSE); *************** *** 2091,2098 **** cost = cave[y][x].cost; /* Hack -- Save the "twiddled" location */ ! (*yp) = py + 16 * ddy_ddd[i]; ! (*xp) = px + 16 * ddx_ddd[i]; } /* No legal move (?) */ --- 2093,2100 ---- cost = cave[y][x].cost; /* Hack -- Save the "twiddled" location */ ! (*yp) = p_ptr->py + 16 * ddy_ddd[i]; ! (*xp) = p_ptr->px + 16 * ddx_ddd[i]; } /* No legal move (?) */ *************** *** 2107,2114 **** /* * Choose "logical" directions for monster movement */ ! static void get_moves(int m_idx, int *mm) { monster_type *m_ptr = &m_list[m_idx]; --- 2109,2118 ---- /* * Choose "logical" directions for monster movement + * + * We store the directions in a special "mm" array */ ! static void get_moves(int m_idx, int mm[5]) { monster_type *m_ptr = &m_list[m_idx]; *************** *** 2116,2123 **** int move_val = 0; ! int y2 = py; ! int x2 = px; #ifdef MONSTER_FLOW --- 2120,2127 ---- int move_val = 0; ! int y2 = p_ptr->py; ! int x2 = p_ptr->px; #ifdef MONSTER_FLOW *************** *** 2134,2144 **** x = m_ptr->fx - x2; ! /* Apply fear if possible and necessary */ if (mon_will_run(m_idx)) { ! /* XXX XXX Not very "smart" */ ! y = (-y), x = (-x); } --- 2138,2149 ---- 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); } *************** *** 2161,2170 **** move_val++; } ! /* Extract some directions */ switch (move_val) { case 0: mm[0] = 9; if (ay > ax) { --- 2166,2176 ---- move_val++; } ! /* Analyze */ switch (move_val) { case 0: + { mm[0] = 9; if (ay > ax) { *************** *** 2181,2188 **** --- 2187,2197 ---- mm[4] = 7; } break; + } + case 1: case 9: + { mm[0] = 6; if (y < 0) { *************** *** 2199,2206 **** --- 2208,2218 ---- mm[4] = 2; } break; + } + case 2: case 6: + { mm[0] = 8; if (x < 0) { *************** *** 2217,2223 **** --- 2229,2238 ---- mm[4] = 6; } break; + } + case 4: + { mm[0] = 7; if (ay > ax) { *************** *** 2234,2241 **** --- 2249,2259 ---- mm[4] = 9; } break; + } + case 5: case 13: + { mm[0] = 4; if (y < 0) { *************** *** 2252,2258 **** --- 2270,2279 ---- mm[4] = 2; } break; + } + case 8: + { mm[0] = 3; if (ay > ax) { *************** *** 2269,2276 **** --- 2290,2300 ---- mm[4] = 1; } break; + } + case 10: case 14: + { mm[0] = 2; if (x < 0) { *************** *** 2287,2293 **** mm[4] = 6; } break; ! case 12: mm[0] = 1; if (ay > ax) { --- 2311,2320 ---- mm[4] = 6; } break; ! } ! ! default: /* case 12: */ ! { mm[0] = 1; if (ay > ax) { *************** *** 2306,2325 **** break; } } /* ! * Hack -- local "player stealth" value (see below) */ ! static u32b noise = 0L; /* * Process a monster * - * The monster is known to be within 100 grids of the player - * * In several cases, we directly update the monster lore * * Note that a monster is only allowed to "reproduce" if there --- 2333,2375 ---- break; } } + } /* ! * Hack -- compare the "strength" of two monsters XXX XXX XXX */ ! static int compare_monsters(monster_type *m_ptr, monster_type *n_ptr) ! { ! monster_race *r_ptr; + u32b mexp1, mexp2; + /* Race 1 */ + r_ptr = &r_info[m_ptr->r_idx]; + + /* Extract mexp */ + mexp1 = r_ptr->mexp; + + /* Race 2 */ + r_ptr = &r_info[n_ptr->r_idx]; + + /* Extract mexp */ + mexp2 = r_ptr->mexp; + + /* Compare */ + if (mexp1 < mexp2) return (-1); + if (mexp1 > mexp2) return (1); + + /* Assume equal */ + return (0); + } + + /* * Process a monster * * In several cases, we directly update the monster lore * * Note that a monster is only allowed to "reproduce" if there *************** *** 2333,2345 **** * fixate on opening a door even if they cannot open it. Actually, * the same thing happens to normal monsters when they hit a door * ! * XXX XXX XXX In addition, monsters which *cannot* open or bash ! * down a door will still stand there trying to open it... * ! * XXX Technically, need to check for monster in the way ! * combined with that monster being in a wall (or door?) ! * ! * A "direction" of "5" means "pick a random direction". */ static void process_monster(int m_idx) { --- 2383,2393 ---- * fixate on opening a door even if they cannot open it. Actually, * the same thing happens to normal monsters when they hit a door * ! * In addition, monsters which *cannot* open or bash down a door ! * will still stand there trying to open it... XXX XXX XXX * ! * Technically, need to check for monster in the way combined ! * with that monster being in a wall (or door?) XXX */ static void process_monster(int m_idx) { *************** *** 2348,2359 **** int i, d, oy, ox, ny, nx; ! int mm[8]; cave_type *c_ptr; ! monster_type *y_ptr; bool do_turn; bool do_move; bool do_view; --- 2396,2409 ---- int i, d, oy, ox, ny, nx; ! int mm[5]; cave_type *c_ptr; ! monster_type *n_ptr; + bool stagger; + bool do_turn; bool do_move; bool do_view; *************** *** 2371,2393 **** /* Handle "sleep" */ if (m_ptr->csleep) { ! u32b notice = 0; ! /* Hack -- handle non-aggravation */ ! if (!p_ptr->aggravate) notice = rand_int(1024); /* Hack -- See if monster "notices" player */ ! if ((notice * notice * notice) <= noise) { - /* Hack -- amount of "waking" */ int d = 1; /* Wake up faster near the player */ if (m_ptr->cdis < 50) d = (100 / m_ptr->cdis); - /* Hack -- handle aggravation */ - if (p_ptr->aggravate) d = m_ptr->csleep; - /* Still asleep */ if (m_ptr->csleep > d) { --- 2421,2461 ---- /* Handle "sleep" */ if (m_ptr->csleep) { ! u32b notice; ! /* Aggravation */ ! if (p_ptr->aggravate) ! { ! /* Reset sleep counter */ ! m_ptr->csleep = 0; + /* Notice the "waking up" */ + if (m_ptr->ml) + { + 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 */ + return; + } + + /* Anti-stealth */ + notice = rand_int(1024); + /* Hack -- See if monster "notices" player */ ! if ((notice * notice * notice) <= p_ptr->noise) { int d = 1; /* Wake up faster near the player */ if (m_ptr->cdis < 50) d = (100 / m_ptr->cdis); /* Still asleep */ if (m_ptr->csleep > d) { *************** *** 2482,2488 **** /* Handle confusion */ if (m_ptr->confused) { - /* Amount of "boldness" */ int d = randint(r_ptr->level / 10 + 1); /* Still confused */ --- 2550,2555 ---- *************** *** 2591,2645 **** if (make_attack_spell(m_idx)) return; ! /* Hack -- Assume no movement */ ! mm[0] = mm[1] = mm[2] = mm[3] = 0; ! mm[4] = mm[5] = mm[6] = mm[7] = 0; ! ! /* Confused -- 100% random */ if (m_ptr->confused) { ! /* Try four "random" directions */ ! mm[0] = mm[1] = mm[2] = mm[3] = 5; } ! /* 75% random movement */ ! else if ((r_ptr->flags1 & (RF1_RAND_50)) && ! (r_ptr->flags1 & (RF1_RAND_25)) && ! (rand_int(100) < 75)) { /* Memorize flags */ - if (m_ptr->ml) r_ptr->r_flags1 |= (RF1_RAND_50); if (m_ptr->ml) r_ptr->r_flags1 |= (RF1_RAND_25); ! /* Try four "random" directions */ ! mm[0] = mm[1] = mm[2] = mm[3] = 5; } ! /* 50% random movement */ ! else if ((r_ptr->flags1 & (RF1_RAND_50)) && ! (rand_int(100) < 50)) { /* Memorize flags */ if (m_ptr->ml) r_ptr->r_flags1 |= (RF1_RAND_50); ! /* Try four "random" directions */ ! mm[0] = mm[1] = mm[2] = mm[3] = 5; } ! /* 25% random movement */ ! else if ((r_ptr->flags1 & (RF1_RAND_25)) && ! (rand_int(100) < 25)) { /* Memorize flags */ ! if (m_ptr->ml) r_ptr->r_flags1 |= (RF1_RAND_25); ! /* Try four "random" directions */ ! mm[0] = mm[1] = mm[2] = mm[3] = 5; } /* Normal movement */ ! else { /* Logical moves */ get_moves(m_idx, mm); --- 2658,2721 ---- if (make_attack_spell(m_idx)) return; ! /* Reset */ ! stagger = FALSE; ! /* Confused */ if (m_ptr->confused) { ! /* Stagger */ ! stagger = TRUE; } ! /* Random movement */ ! else if (r_ptr->flags1 & (RF1_RAND_50 | RF1_RAND_25)) { + /* Random movement (25%) */ + if (!(r_ptr->flags1 & (RF1_RAND_50))) + { + /* Random */ + if (rand_int(100) < 25) + { /* Memorize flags */ if (m_ptr->ml) r_ptr->r_flags1 |= (RF1_RAND_25); ! /* Stagger */ ! stagger = TRUE; } + } ! /* Random movement (50%) */ ! else if (!(r_ptr->flags1 & (RF1_RAND_25))) { + /* Random */ + if (rand_int(100) < 50) + { /* Memorize flags */ if (m_ptr->ml) r_ptr->r_flags1 |= (RF1_RAND_50); ! /* Stagger */ ! stagger = TRUE; } + } ! /* Random movement (75%) */ ! else { + /* Random */ + if (rand_int(100) < 75) + { /* Memorize flags */ ! if (m_ptr->ml) r_ptr->r_flags1 |= (RF1_RAND_50 | RF1_RAND_25); ! /* Stagger */ ! stagger = TRUE; } + } + } /* Normal movement */ ! if (!stagger) { /* Logical moves */ get_moves(m_idx, mm); *************** *** 2662,2676 **** did_kill_wall = FALSE; ! /* Take a zero-terminated array of "directions" */ ! for (i = 0; mm[i]; i++) { ! /* Get the direction */ ! d = mm[i]; - /* Hack -- allow "randomized" motion */ - if (d == 5) d = ddd[rand_int(8)]; - /* Get the destination */ ny = oy + ddy[d]; nx = ox + ddx[d]; --- 2738,2749 ---- did_kill_wall = FALSE; ! /* Process moves */ ! for (i = 0; i < 5; i++) { ! /* Get the direction (or stagger) */ ! d = (stagger ? ddd[rand_int(8)] : mm[i]); /* Get the destination */ ny = oy + ddy[d]; nx = ox + ddx[d]; *************** *** 2679,2685 **** c_ptr = &cave[ny][nx]; /* Access that cave grid's contents */ ! y_ptr = &m_list[c_ptr->m_idx]; /* Floor is open? */ --- 2752,2758 ---- c_ptr = &cave[ny][nx]; /* Access that cave grid's contents */ ! n_ptr = &m_list[c_ptr->m_idx]; /* Floor is open? */ *************** *** 2854,2860 **** } /* Some monsters never attack */ ! if (do_move && (ny == py) && (nx == px) && (r_ptr->flags1 & (RF1_NEVER_BLOW))) { /* Hack -- memorize lack of attacks */ --- 2927,2933 ---- } /* Some monsters never attack */ ! if (do_move && (ny == p_ptr->py) && (nx == p_ptr->px) && (r_ptr->flags1 & (RF1_NEVER_BLOW))) { /* Hack -- memorize lack of attacks */ *************** *** 2866,2872 **** /* The player is in the way. Attack him. */ ! if (do_move && (ny == py) && (nx == px)) { /* Do the attack */ (void)make_attack_normal(m_idx); --- 2939,2945 ---- /* The player is in the way. Attack him. */ ! if (do_move && (ny == p_ptr->py) && (nx == p_ptr->px)) { /* Do the attack */ (void)make_attack_normal(m_idx); *************** *** 2893,2906 **** /* A monster is in the way */ if (do_move && c_ptr->m_idx) { - monster_race *z_ptr = &r_info[y_ptr->r_idx]; - /* Assume no movement */ do_move = FALSE; /* Kill weaker monsters */ if ((r_ptr->flags2 & (RF2_KILL_BODY)) && ! (r_ptr->mexp > z_ptr->mexp)) { /* Allow movement */ do_move = TRUE; --- 2966,2977 ---- /* A monster is in the way */ if (do_move && c_ptr->m_idx) { /* Assume no movement */ do_move = FALSE; /* Kill weaker monsters */ if ((r_ptr->flags2 & (RF2_KILL_BODY)) && ! (compare_monsters(m_ptr, n_ptr) > 0)) { /* Allow movement */ do_move = TRUE; *************** *** 2908,2925 **** /* Monster ate another monster */ did_kill_body = TRUE; ! /* XXX XXX XXX Message */ /* Kill the monster */ delete_monster(ny, nx); ! /* Hack -- get the empty monster */ ! y_ptr = &m_list[c_ptr->m_idx]; } /* Push past weaker monsters (unless leaving a wall) */ if ((r_ptr->flags2 & (RF2_MOVE_BODY)) && ! (r_ptr->mexp > z_ptr->mexp) && (cave_floor_bold(m_ptr->fy, m_ptr->fx))) { /* Allow movement */ --- 2979,2996 ---- /* Monster ate another monster */ did_kill_body = TRUE; ! /* Message XXX XXX XXX */ /* Kill the monster */ delete_monster(ny, nx); ! /* Hack XXX XXX XXX */ ! n_ptr = &m_list[c_ptr->m_idx]; } /* Push past weaker monsters (unless leaving a wall) */ if ((r_ptr->flags2 & (RF2_MOVE_BODY)) && ! (compare_monsters(m_ptr, n_ptr) > 0) && (cave_floor_bold(m_ptr->fy, m_ptr->fx))) { /* Allow movement */ *************** *** 2948,2955 **** if (c_ptr->m_idx) { /* Move the old monster */ ! y_ptr->fy = oy; ! y_ptr->fx = ox; /* Update the old monster */ update_mon(c_ptr->m_idx, TRUE); --- 3019,3026 ---- if (c_ptr->m_idx) { /* Move the old monster */ ! n_ptr->fy = oy; ! n_ptr->fx = ox; /* Update the old monster */ update_mon(c_ptr->m_idx, TRUE); *************** *** 3049,3054 **** --- 3120,3128 ---- /* Pick up the item */ else if (r_ptr->flags2 & (RF2_TAKE_ITEM)) { + object_type *i_ptr; + object_type object_type_body; + /* Take note */ did_take_item = TRUE; *************** *** 3059,3093 **** msg_format("%^s picks up %s.", m_name, o_name); } ! /* Option */ ! if (testing_carry) ! { ! /* Excise the object */ ! excise_object_idx(this_o_idx); ! /* Forget mark */ ! o_ptr->marked = FALSE; - /* Forget location */ - o_ptr->iy = o_ptr->ix = 0; - - /* Memorize monster */ - o_ptr->held_m_idx = m_idx; - - /* Build a stack */ - o_ptr->next_o_idx = m_ptr->hold_o_idx; - - /* Carry object */ - m_ptr->hold_o_idx = this_o_idx; - } - - /* Nope */ - else - { /* Delete the object */ delete_object_idx(this_o_idx); } - } /* Destroy the item */ else --- 3133,3150 ---- msg_format("%^s picks up %s.", m_name, o_name); } ! /* Get local object */ ! i_ptr = &object_type_body; ! /* Obtain local object */ ! object_copy(i_ptr, o_ptr); /* Delete the object */ delete_object_idx(this_o_idx); + + /* Carry the object */ + (void)monster_carry(m_idx, i_ptr); } /* Destroy the item */ else *************** *** 3196,3212 **** * Most of the rest of the time is spent in "update_view()" and "lite_spot()", * especially when the player is running. * ! * Note the special "MFLAG_BORN" flag, which allows us to ignore "fresh" ! * monsters while they are still being "born". A monster is "fresh" only ! * during the turn in which it is created, and we use the "hack_m_idx" to ! * determine if the monster is yet to be processed during the current turn. * ! * Note the special "MFLAG_NICE" flag, which allows the player to get one ! * move before any "nasty" monsters get to use their spell attacks. ! * ! * Note that when the "knowledge" about the currently tracked monster ! * changes (flags, attacks, spells), we induce a redraw of the monster ! * recall window. */ void process_monsters(void) { --- 3253,3265 ---- * Most of the rest of the time is spent in "update_view()" and "lite_spot()", * especially when the player is running. * ! * Note the special "MFLAG_BORN" flag, which prevents monsters from doing ! * anything during the game turn in which they are created. This flag is ! * optimized via the "repair_mflag_born" flag. * ! * Note the special "MFLAG_NICE" flag, which prevents "nasty" monsters from ! * using any of their spell attacks until the player gets a turn. This flag ! * is optimized via the "repair_mflag_nice" flag. */ void process_monsters(void) { *************** *** 3213,3274 **** int i, e; int fx, fy; - bool test; - monster_type *m_ptr; monster_race *r_ptr; - int old_monster_race_idx; ! u32b old_r_flags1 = 0L; ! u32b old_r_flags2 = 0L; ! u32b old_r_flags3 = 0L; ! u32b old_r_flags4 = 0L; ! u32b old_r_flags5 = 0L; ! u32b old_r_flags6 = 0L; ! byte old_r_blows0 = 0; ! byte old_r_blows1 = 0; ! byte old_r_blows2 = 0; ! byte old_r_blows3 = 0; ! ! byte old_r_cast_inate = 0; ! byte old_r_cast_spell = 0; ! ! ! /* Memorize old race */ ! old_monster_race_idx = monster_race_idx; ! ! /* Acquire knowledge */ ! if (monster_race_idx) { ! /* Acquire current monster */ ! r_ptr = &r_info[monster_race_idx]; ! /* Memorize flags */ ! old_r_flags1 = r_ptr->r_flags1; ! old_r_flags2 = r_ptr->r_flags2; ! old_r_flags3 = r_ptr->r_flags3; ! old_r_flags4 = r_ptr->r_flags4; ! old_r_flags5 = r_ptr->r_flags5; ! old_r_flags6 = r_ptr->r_flags6; ! /* Memorize blows */ ! old_r_blows0 = r_ptr->r_blows[0]; ! old_r_blows1 = r_ptr->r_blows[1]; ! old_r_blows2 = r_ptr->r_blows[2]; ! old_r_blows3 = r_ptr->r_blows[3]; ! ! /* Memorize castings */ ! old_r_cast_inate = r_ptr->r_cast_inate; ! old_r_cast_spell = r_ptr->r_cast_spell; } - /* Hack -- calculate the "player noise" */ - noise = (1L << (30 - p_ptr->skill_stl)); - - /* Process the monsters (backwards) */ for (i = m_max - 1; i >= 1; i--) { --- 3266,3296 ---- int i, e; int fx, fy; monster_type *m_ptr; monster_race *r_ptr; ! /* Repair "born" flags */ ! if (repair_mflag_born) ! { ! /* Clear flag */ ! repair_mflag_born = FALSE; ! /* Process the monsters */ ! for (i = 1; i < m_max; i++) { ! /* Access the monster */ ! m_ptr = &m_list[i]; ! /* Ignore "dead" monsters */ ! /* if (!m_ptr->r_idx) continue; */ ! /* Clear "born" flag */ ! m_ptr->mflag &= ~(MFLAG_BORN); } + } /* Process the monsters (backwards) */ for (i = m_max - 1; i >= 1; i--) { *************** *** 3280,3296 **** if (!m_ptr->r_idx) continue; ! /* Handle "fresh" monsters */ ! if (m_ptr->mflag & (MFLAG_BORN)) ! { ! /* No longer "fresh" */ ! m_ptr->mflag &= ~(MFLAG_BORN); - /* Skip */ - continue; - } - /* Obtain the energy boost */ e = extract_energy[m_ptr->mspeed]; --- 3302,3311 ---- if (!m_ptr->r_idx) continue; ! /* Ignore "born" monsters XXX XXX */ ! if (m_ptr->mflag & (MFLAG_BORN)) continue; /* Obtain the energy boost */ e = extract_energy[m_ptr->mspeed]; *************** *** 3305,3312 **** m_ptr->energy -= 100; ! /* Hack -- Require proximity */ ! if (m_ptr->cdis >= 100) continue; /* Access the race */ --- 3320,3326 ---- m_ptr->energy -= 100; ! /* Heal monster? XXX XXX XXX */ /* Access the race */ *************** *** 3317,3339 **** fy = m_ptr->fy; - /* Assume no move */ - test = FALSE; - /* Handle "sensing radius" */ if (m_ptr->cdis <= r_ptr->aaf) { /* We can "sense" the player */ - test = TRUE; } ! /* Handle "sight" and "aggravation" */ ! else if ((m_ptr->cdis <= MAX_SIGHT) && ! (player_has_los_bold(fy, fx) || ! p_ptr->aggravate)) { ! /* We can "see" or "feel" the player */ ! test = TRUE; } #ifdef MONSTER_FLOW --- 3331,3346 ---- fy = m_ptr->fy; /* Handle "sensing radius" */ if (m_ptr->cdis <= r_ptr->aaf) { /* We can "sense" the player */ } ! /* Handle "sight" (backwards) XXX XXX */ ! else if (player_has_los_bold(fy, fx)) { ! /* We can "see" the player */ } #ifdef MONSTER_FLOW *************** *** 3340,3361 **** /* Hack -- Monsters can "smell" the player from far away */ /* Note that most monsters have "aaf" of "20" or so */ else if (flow_by_sound && ! (cave[py][px].when == cave[fy][fx].when) && (cave[fy][fx].cost < MONSTER_FLOW_DEPTH) && (cave[fy][fx].cost < r_ptr->aaf)) { /* We can "smell" the player */ - test = TRUE; } #endif - /* Do nothing */ ! if (!test) continue; - /* Save global index */ - hack_m_idx = i; - /* Process the monster */ process_monster(i); --- 3347,3367 ---- /* Hack -- Monsters can "smell" the player from far away */ /* Note that most monsters have "aaf" of "20" or so */ else if (flow_by_sound && ! (cave[p_ptr->py][p_ptr->px].when == cave[fy][fx].when) && (cave[fy][fx].cost < MONSTER_FLOW_DEPTH) && (cave[fy][fx].cost < r_ptr->aaf)) { /* We can "smell" the player */ } #endif /* Do nothing */ ! else ! { ! /* Continue */ ! continue; ! } /* Process the monster */ process_monster(i); *************** *** 3362,3397 **** /* Hack -- notice death or departure */ if (!alive || death || new_level_flag) break; } - - /* Reset global index */ - hack_m_idx = 0; - - - /* Tracking a monster race (the same one we were before) */ - if (monster_race_idx && (monster_race_idx == old_monster_race_idx)) - { - /* Acquire monster race */ - r_ptr = &r_info[monster_race_idx]; - - /* Check for knowledge change */ - if ((old_r_flags1 != r_ptr->r_flags1) || - (old_r_flags2 != r_ptr->r_flags2) || - (old_r_flags3 != r_ptr->r_flags3) || - (old_r_flags4 != r_ptr->r_flags4) || - (old_r_flags5 != r_ptr->r_flags5) || - (old_r_flags6 != r_ptr->r_flags6) || - (old_r_blows0 != r_ptr->r_blows[0]) || - (old_r_blows1 != r_ptr->r_blows[1]) || - (old_r_blows2 != r_ptr->r_blows[2]) || - (old_r_blows3 != r_ptr->r_blows[3]) || - (old_r_cast_inate != r_ptr->r_cast_inate) || - (old_r_cast_spell != r_ptr->r_cast_spell)) - { - /* Window stuff */ - p_ptr->window |= (PW_MONSTER); } - } - } --- 3368,3374 ---- Only in angband-281/src: melee2.o diff -r -c -w src-281/monster1.c angband-281/src/monster1.c *** src-281/monster1.c Mon Mar 3 22:33:17 1997 --- angband-281/src/monster1.c Thu Apr 24 10:33:19 1997 *************** *** 154,166 **** r_ptr = &r_info[r_idx]; ! /* Cheat -- Know everything */ if (cheat_know) { /* XXX XXX XXX */ ! /* Save the "old" memory */ ! save_mem = *r_ptr; /* Hack -- Maximal kills */ r_ptr->r_tkills = MAX_SHORT; --- 154,166 ---- r_ptr = &r_info[r_idx]; ! /* Cheat -- know everything */ if (cheat_know) { /* XXX XXX XXX */ ! /* Hack -- save memory */ ! COPY(&save_mem, r_ptr, monster_type); /* Hack -- Maximal kills */ r_ptr->r_tkills = MAX_SHORT; *************** *** 1348,1358 **** roff("\n"); ! /* Hack -- Restore monster memory */ if (cheat_know) { ! /* Restore memory */ ! *r_ptr = save_mem; } } --- 1348,1358 ---- roff("\n"); ! /* Cheat -- know everything */ if (cheat_know) { ! /* Hack -- restore memory */ ! COPY(r_ptr, &save_mem, monster_type); } } *************** *** 1379,1389 **** a1 = r_ptr->d_attr; a2 = r_ptr->x_attr; - /* Hack -- fake monochrome */ - if (!use_color) a1 = TERM_WHITE; - if (!use_color) a2 = TERM_WHITE; - /* Clear the top line */ Term_erase(0, 0, 255); --- 1379,1385 ---- Only in angband-281/src: monster1.o diff -r -c -w src-281/monster2.c angband-281/src/monster2.c *** src-281/monster2.c Mon Mar 3 22:33:44 1997 --- angband-281/src/monster2.c Thu Apr 24 10:33:43 1997 *************** *** 154,163 **** /* Hack -- Update the health bar */ if (health_who == i1) health_track(i2); ! /* Structure copy */ COPY(&m_list[i2], &m_list[i1], monster_type); ! /* Wipe the hole */ WIPE(&m_list[i1], monster_type); } --- 154,163 ---- /* Hack -- Update the health bar */ if (health_who == i1) health_track(i2); ! /* Hack -- move monster */ COPY(&m_list[i2], &m_list[i1], monster_type); ! /* Hack -- wipe hole */ WIPE(&m_list[i1], monster_type); } *************** *** 352,359 **** } - - /* * Apply a "monster restriction function" to the "monster allocation table" */ --- 352,357 ---- *************** *** 477,483 **** } /* Depth Monsters never appear out of depth */ ! if ((r_ptr->flags1 & (RF1_FORCE_DEPTH)) && (r_ptr->level > dun_level)) { continue; } --- 475,481 ---- } /* Depth Monsters never appear out of depth */ ! if ((r_ptr->flags1 & (RF1_FORCE_DEPTH)) && (r_ptr->level > p_ptr->depth)) { continue; } *************** *** 581,596 **** * * Reflexives are acquired by requesting Objective plus Possessive. * ! * If no m_ptr arg is given (?), the monster is assumed to be hidden, ! * unless the "Assume Visible" mode is requested. * ! * If no r_ptr arg is given, it is extracted from m_ptr and r_info ! * If neither m_ptr nor r_ptr is given, the monster is assumed to ! * be neuter, singular, and hidden (unless "Assume Visible" is set), ! * in which case you may be in trouble... :-) * ! * I am assuming that no monster name is more than 70 characters long, ! * so that "char desc[80];" is sufficiently large for any result. * * Mode Flags: * 0x01 --> Objective (or Reflexive) --- 579,596 ---- * * Reflexives are acquired by requesting Objective plus Possessive. * ! * I am assuming that no monster name is more than 65 characters long, ! * so that "char desc[80];" is sufficiently large for any result, even ! * when the "offscreen" notation is added. * ! * Note that the "possessive" for certain unique monsters will look ! * really silly, as in "Morgoth, King of Darkness's". We should ! * perhaps add a flag to "remove" any "descriptives" in the name. * ! * Note that "offscreen" monsters will get a special "(offscreen)" ! * notation in their name if they are visible but offscreen. This ! * may look silly with possessives, as in "the rat's (offscreen)". ! * Perhaps the "offscreen" descriptor should be abbreviated. * * Mode Flags: * 0x01 --> Objective (or Reflexive) *************** *** 621,631 **** bool seen, pron; ! /* Can we "see" it (exists + forced, or visible + not unforced) */ ! seen = (m_ptr && ((mode & 0x80) || (!(mode & 0x40) && m_ptr->ml))); ! /* Sexed Pronouns (seen and allowed, or unseen and allowed) */ ! pron = (m_ptr && ((seen && (mode & 0x20)) || (!seen && (mode & 0x10)))); /* First, try using pronouns, or describing hidden monsters */ --- 621,631 ---- bool seen, pron; ! /* Can we "see" it (forced, or not hidden + visible) */ ! seen = ((mode & (0x80)) || (!(mode & (0x40)) && m_ptr->ml)); ! /* Sexed Pronouns (seen and forced, or unseen and allowed) */ ! pron = ((seen && (mode & (0x20))) || (!seen && (mode & (0x10)))); /* First, try using pronouns, or describing hidden monsters */ *************** *** 730,737 **** --- 730,744 ---- /* Simply append "apostrophe" and "s" */ (void)strcat(desc, "'s"); } + + /* Mention "offscreen" monsters XXX XXX */ + if (!panel_contains(m_ptr->fy, m_ptr->fx)) + { + /* Append special notation */ + (void)strcat(desc, " (offscreen)"); } } + } *************** *** 799,829 **** /* * This function updates the monster record of the given monster * ! * This involves extracting the distance to the player, checking ! * for visibility (natural, infravision, see-invis, telepathy), ! * updating the monster visibility flag, redrawing or erasing the ! * monster when the visibility changes, and taking note of any ! * "visual" features of the monster (cold-blooded, invisible, etc). * * The only monster fields that are changed here are "cdis" (the ! * distance from the player), "los" (clearly visible to player), ! * and "ml" (visible to the player in any way). * ! * There are a few cases where the calling routine knows that the ! * distance from the player to the monster has not changed, and so ! * we have a special parameter "full" to request distance computation. ! * This lets many calls to this function run very quickly. * ! * Note that every time a monster moves, we must call this function ! * for that monster, and update distance. Note that every time the ! * player moves, we must call this function for every monster, and ! * update distance. Note that every time the player "state" changes ! * in certain ways (including "blindness", "infravision", "telepathy", ! * and "see invisible"), we must call this function for every monster. * ! * The routines that actually move the monsters call this routine ! * directly, and the ones that move the player, or notice changes ! * in the player state, call "update_monsters()". * * Routines that change the "illumination" of grids must also call * this function, since the "visibility" of some monsters may be --- 806,838 ---- /* * This function updates the monster record of the given monster * ! * This involves extracting the distance to the player (if needed), ! * and then checking for visibility (natural, infravision, see-invis, ! * telepathy), updating the monster visibility flag, redrawing (or ! * erasing) the monster when the visibility changes, and taking note ! * of any interesting monster flags (cold-blooded, invisible, etc). * + * Note the new "mflag" field which encodes several monster state + * flags, including "view" for "currently in line of sight" and + * "mark" for "currently visible via detection". + * * The only monster fields that are changed here are "cdis" (the ! * distance from the player), "ml" (visible to the player), and ! * "mflag" (to maintain the "MFLAG_VIEW" flag). * ! * Note the special "update_monsters()" function which can be used ! * to call this function for every monster. * ! * Note the "full" flag which requests that the "cdis" field be ! * updated, often, such an update is not needed. * ! * Every time a monster moves, we must call this function for that ! * monster, and update the distance, and the visibility. Every time ! * the player moves, we must call this function for every monster, and ! * update the distance, and the visibility. Whenever the player "state" ! * changes in certain ways ("blindness", "infravision", "telepathy", ! * and "see invisible"), we must call this function for every monster, ! * and update the visibility. * * Routines that change the "illumination" of grids must also call * this function, since the "visibility" of some monsters may be *************** *** 830,853 **** * based on the illumination of their grid. * * Note that this function is called once per monster every time the ! * player moves, so it is important to optimize it for monsters which ! * are far away. Note the optimization which skips monsters which ! * are far away and were completely invisible last turn. * * Note the optimized "inline" version of the "distance()" function. * ! * Note that only monsters on the current panel can be "visible", ! * and then only if they are (1) in line of sight and illuminated ! * by light or infravision, or (2) nearby and detected by telepathy. * * The player can choose to be disturbed by several things, including * "disturb_move" (monster which is viewable moves in some way), and * "disturb_near" (monster which is "easily" viewable moves in some * way). Note that "moves" includes "appears" and "disappears". - * - * Note the new "xtra" field which encodes several state flags such - * as "detected last turn", and "detected this turn", and "currently - * in line of sight", all of which are used for visibility testing. */ void update_mon(int m_idx, bool full) { --- 839,870 ---- * based on the illumination of their grid. * * Note that this function is called once per monster every time the ! * player moves. When the player is running, this function is one ! * of the primary bottlenecks, along with "update_view()" and the ! * "process_monsters()" code, so efficiency is important. * * Note the optimized "inline" version of the "distance()" function. * ! * Note the optimized "inline" version of the "player_can_see_bold()" ! * function, which has been so optimized that it no longer has the ! * same semantics, in particular, monsters in perma-lit walls can ! * be seen even from the wrong side of the wall. * + * A monster is "visible" to the player if (1) it has been detected + * by the player, (2) it is close to the player and the player has + * telepathy, or (3) it is close to the player, and in line of sight + * of the player, and it is "illuminated" by some combination of + * light, infravision, and/or see-invisible. + * + * Monsters which are not on the current panel may be "visible" to + * the player, and their descriptions will include an "offscreen" + * reference. Currently, offscreen monsters cannot be targetted + * or viewed directly, but old targets will remain set. XXX XXX + * * The player can choose to be disturbed by several things, including * "disturb_move" (monster which is viewable moves in some way), and * "disturb_near" (monster which is "easily" viewable moves in some * way). Note that "moves" includes "appears" and "disappears". */ void update_mon(int m_idx, bool full) { *************** *** 855,861 **** monster_race *r_ptr = &r_info[m_ptr->r_idx]; ! /* The current monster location */ int fy = m_ptr->fy; int fx = m_ptr->fx; --- 872,880 ---- monster_race *r_ptr = &r_info[m_ptr->r_idx]; ! int d; ! ! /* Current location */ int fy = m_ptr->fy; int fx = m_ptr->fx; *************** *** 865,963 **** /* Seen by vision */ bool easy = FALSE; - /* Seen by telepathy */ - bool hard = FALSE; ! /* Various extra flags */ ! bool do_empty_mind = FALSE; ! bool do_weird_mind = FALSE; ! bool do_invisible = FALSE; ! bool do_cold_blood = FALSE; ! ! ! /* Calculate distance */ if (full) { ! int d, dy, dx; /* Distance components */ ! dy = (py > fy) ? (py - fy) : (fy - py); ! dx = (px > fx) ? (px - fx) : (fx - px); /* Approximate distance */ d = (dy > dx) ? (dy + (dx>>1)) : (dx + (dy>>1)); ! /* Save the distance (in a byte) */ ! m_ptr->cdis = (d < 255) ? d : 255; } ! ! /* Process "distant" monsters */ ! if (m_ptr->cdis > MAX_SIGHT) { ! /* Ignore unseen monsters */ ! if (!m_ptr->ml) return; } ! /* Process "nearby" monsters on the current "panel" */ ! else if (panel_contains(fy, fx)) { cave_type *c_ptr = &cave[fy][fx]; ! /* Normal line of sight, and player is not blind */ ! if ((c_ptr->info & (CAVE_VIEW)) && (!p_ptr->blind)) { ! /* Use "infravision" */ ! if (m_ptr->cdis <= (byte)(p_ptr->see_infra)) { ! /* Infravision only works on "warm" creatures */ ! /* Below, we will need to know that infravision failed */ ! if (r_ptr->flags2 & (RF2_COLD_BLOOD)) do_cold_blood = TRUE; ! /* Infravision works */ ! if (!do_cold_blood) easy = flag = TRUE; } ! /* Use "illumination" */ ! if (c_ptr->info & (CAVE_LITE | CAVE_GLOW)) { ! /* Take note of invisibility */ ! if (r_ptr->flags2 & (RF2_INVISIBLE)) do_invisible = TRUE; ! /* Visible, or detectable, monsters get seen */ ! if (!do_invisible || p_ptr->see_inv) easy = flag = TRUE; } } ! /* Telepathy can see all "nearby" monsters with "minds" */ ! if (p_ptr->telepathy) { ! /* Empty mind, no telepathy */ ! if (r_ptr->flags2 & (RF2_EMPTY_MIND)) { ! do_empty_mind = TRUE; } ! /* Weird mind, occasional telepathy */ ! else if (r_ptr->flags2 & (RF2_WEIRD_MIND)) { ! do_weird_mind = TRUE; ! if (rand_int(100) < 10) hard = flag = TRUE; } ! /* Normal mind, allow telepathy */ else { ! hard = flag = TRUE; } } ! /* Apply "detection" spells */ ! if (m_ptr->mflag & (MFLAG_MARK)) flag = TRUE; ! ! /* Hack -- Wizards have "perfect telepathy" */ ! if (wizard) flag = TRUE; } /* The monster is now visible */ --- 884,1024 ---- /* Seen by vision */ bool easy = FALSE; ! /* Compute distance */ if (full) { ! int dy, dx; /* Distance components */ ! dy = (p_ptr->py > fy) ? (p_ptr->py - fy) : (fy - p_ptr->py); ! dx = (p_ptr->px > fx) ? (p_ptr->px - fx) : (fx - p_ptr->px); /* Approximate distance */ d = (dy > dx) ? (dy + (dx>>1)) : (dx + (dy>>1)); ! /* Restrict distance */ ! if (d > 255) d = 255; ! ! /* Save the distance */ ! m_ptr->cdis = d; } ! /* Extract distance */ ! else { ! /* Extract the distance */ ! d = m_ptr->cdis; } ! ! /* Detected */ ! if (m_ptr->mflag & (MFLAG_MARK)) flag = TRUE; ! ! ! /* Nearby */ ! if (d <= MAX_SIGHT) { cave_type *c_ptr = &cave[fy][fx]; ! /* Basic telepathy */ ! if (p_ptr->telepathy) { ! /* Empty mind, no telepathy */ ! if (r_ptr->flags2 & (RF2_EMPTY_MIND)) { ! /* Memorize flags */ ! r_ptr->r_flags2 |= (RF2_EMPTY_MIND); ! } ! /* Weird mind, occasional telepathy */ ! else if (r_ptr->flags2 & (RF2_WEIRD_MIND)) ! { ! /* One in ten individuals are detectable */ ! if ((m_idx % 10) == 5) ! { ! /* Detectable */ ! flag = TRUE; ! ! /* Memorize flags */ ! r_ptr->r_flags2 |= (RF2_WEIRD_MIND); ! ! /* Hack -- Memorize mental flags */ ! if (r_ptr->flags2 & (RF2_SMART)) r_ptr->r_flags2 |= (RF2_SMART); ! if (r_ptr->flags2 & (RF2_STUPID)) r_ptr->r_flags2 |= (RF2_STUPID); } + } ! /* Normal mind, allow telepathy */ ! else { ! /* Detectable */ ! flag = TRUE; ! /* Hack -- Memorize mental flags */ ! if (r_ptr->flags2 & (RF2_SMART)) r_ptr->r_flags2 |= (RF2_SMART); ! if (r_ptr->flags2 & (RF2_STUPID)) r_ptr->r_flags2 |= (RF2_STUPID); } } ! /* Normal line of sight, and not blind */ ! if ((c_ptr->info & (CAVE_VIEW)) && !p_ptr->blind) { ! bool do_invisible = FALSE; ! bool do_cold_blood = FALSE; ! ! /* Use "infravision" */ ! if (d <= p_ptr->see_infra) { ! /* Handle "cold blooded" monsters */ ! if (r_ptr->flags2 & (RF2_COLD_BLOOD)) ! { ! /* Take note */ ! do_cold_blood = TRUE; } ! /* Handle "warm blooded" monsters */ ! else { ! /* Easy to see */ ! easy = flag = TRUE; } + } ! /* Use "illumination" */ ! if (c_ptr->info & (CAVE_LITE | CAVE_GLOW)) ! { ! /* Handle "invisible" monsters */ ! if (r_ptr->flags2 & (RF2_INVISIBLE)) ! { ! /* Take note */ ! do_invisible = TRUE; ! ! /* See invisible */ ! if (p_ptr->see_inv) ! { ! /* Easy to see */ ! easy = flag = TRUE; ! } ! } ! ! /* Handle "normal" monsters */ else { ! /* Easy to see */ ! easy = flag = TRUE; } } ! /* Visible */ ! if (flag) ! { ! /* Memorize flags */ ! if (do_invisible) r_ptr->r_flags2 |= (RF2_INVISIBLE); ! if (do_cold_blood) r_ptr->r_flags2 |= (RF2_COLD_BLOOD); } + } + } /* The monster is now visible */ *************** *** 981,1002 **** /* Disturb on appearance */ if (disturb_move) disturb(1, 0); } - - /* Apply telepathy */ - if (hard) - { - /* Hack -- Memorize mental flags */ - if (r_ptr->flags2 & (RF2_SMART)) r_ptr->r_flags2 |= (RF2_SMART); - if (r_ptr->flags2 & (RF2_STUPID)) r_ptr->r_flags2 |= (RF2_STUPID); } - /* Memorize various observable flags */ - if (do_empty_mind) r_ptr->r_flags2 |= (RF2_EMPTY_MIND); - if (do_weird_mind) r_ptr->r_flags2 |= (RF2_WEIRD_MIND); - if (do_cold_blood) r_ptr->r_flags2 |= (RF2_COLD_BLOOD); - if (do_invisible) r_ptr->r_flags2 |= (RF2_INVISIBLE); - } - /* The monster is not visible */ else { --- 1042,1049 ---- *************** *** 1074,1079 **** --- 1121,1261 ---- /* + * Make a monster carry an object + */ + s16b monster_carry(int m_idx, object_type *j_ptr) + { + s16b o_idx; + + s16b this_o_idx, next_o_idx = 0; + + 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 */ + if (object_similar(o_ptr, j_ptr)) + { + /* Combine the items */ + object_absorb(o_ptr, j_ptr); + + /* Result */ + return (this_o_idx); + } + } + + + /* Make an object */ + o_idx = o_pop(); + + /* Success */ + if (o_idx) + { + object_type *o_ptr; + + /* Get new object */ + o_ptr = &o_list[o_idx]; + + /* Copy object */ + object_copy(o_ptr, j_ptr); + + /* Forget mark */ + o_ptr->marked = FALSE; + + /* 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; + } + + /* Result */ + return (o_idx); + } + + + /* + * Place a copy of a monster in the dungeon XXX XXX + */ + s16b monster_place(int y, int x, monster_type *n_ptr) + { + s16b m_idx; + + cave_type *c_ptr; + + monster_type *m_ptr; + monster_race *r_ptr; + + + /* Access grid */ + c_ptr = &cave[y][x]; + + /* Paranoia */ + if (c_ptr->m_idx) return (0); + + + /* Get a new record */ + m_idx = m_pop(); + + /* Oops */ + if (m_idx) + { + /* Make a new monster */ + c_ptr->m_idx = m_idx; + + /* Acquire new monster */ + m_ptr = &m_list[m_idx]; + + /* Acquire new race */ + r_ptr = &r_info[m_ptr->r_idx]; + + /* Copy the monster XXX */ + COPY(m_ptr, n_ptr, monster_type); + + /* Location */ + m_ptr->fy = y; + m_ptr->fx = x; + + /* Update the monster */ + update_mon(m_idx, TRUE); + + /* Hack -- Notice new multi-hued monsters */ + if (r_ptr->flags1 & (RF1_ATTR_MULTI)) shimmer_monsters = TRUE; + + /* Hack -- Count the number of "reproducers" */ + if (r_ptr->flags2 & (RF2_MULTIPLY)) num_repro++; + + /* Count racial occurances */ + r_ptr->cur_num++; + } + + /* Result */ + return (m_idx); + } + + + + /* * Attempt to place a monster of the given race at the given location. * * To give the player a sporting chance, any monster that appears in *************** *** 1096,1111 **** { int i; ! cave_type *c_ptr; ! monster_type *m_ptr; ! monster_race *r_ptr = &r_info[r_idx]; - cptr name = (r_name + r_ptr->name); ! ! /* Verify location */ if (!in_bounds(y, x)) return (FALSE); /* Require empty space */ --- 1278,1292 ---- { int i; ! monster_race *r_ptr; ! monster_type *n_ptr; ! monster_type monster_type_body; ! cptr name; ! /* Paranoia */ if (!in_bounds(y, x)) return (FALSE); /* Require empty space */ *************** *** 1118,1127 **** --- 1299,1314 ---- /* Paranoia */ if (!r_idx) return (FALSE); + /* Race */ + r_ptr = &r_info[r_idx]; + /* Paranoia */ if (!r_ptr->name) return (FALSE); + /* Name */ + name = (r_name + r_ptr->name); + /* Hack -- "unique" monsters must be "unique" */ if ((r_ptr->flags1 & (RF1_UNIQUE)) && (r_ptr->cur_num >= r_ptr->max_num)) { *************** *** 1131,1137 **** /* Depth monsters may NOT be created out of depth */ ! if ((r_ptr->flags1 & (RF1_FORCE_DEPTH)) && (dun_level < r_ptr->level)) { /* Cannot create */ return (FALSE); --- 1318,1324 ---- /* Depth monsters may NOT be created out of depth */ ! if ((r_ptr->flags1 & (RF1_FORCE_DEPTH)) && (p_ptr->depth < r_ptr->level)) { /* Cannot create */ return (FALSE); *************** *** 1139,1145 **** /* Powerful monster */ ! if (r_ptr->level > dun_level) { /* Unique monsters */ if (r_ptr->flags1 & (RF1_UNIQUE)) --- 1326,1332 ---- /* Powerful monster */ ! if (r_ptr->level > p_ptr->depth) { /* Unique monsters */ if (r_ptr->flags1 & (RF1_UNIQUE)) *************** *** 1148,1154 **** if (cheat_hear) msg_format("Deep Unique (%s).", name); /* Boost rating by twice delta-depth */ ! rating += (r_ptr->level - dun_level) * 2; } /* Normal monsters */ --- 1335,1341 ---- if (cheat_hear) msg_format("Deep Unique (%s).", name); /* Boost rating by twice delta-depth */ ! rating += (r_ptr->level - p_ptr->depth) * 2; } /* Normal monsters */ *************** *** 1158,1164 **** if (cheat_hear) msg_format("Deep Monster (%s).", name); /* Boost rating by delta-depth */ ! rating += (r_ptr->level - dun_level); } } --- 1345,1351 ---- if (cheat_hear) msg_format("Deep Monster (%s).", name); /* Boost rating by delta-depth */ ! rating += (r_ptr->level - p_ptr->depth); } } *************** *** 1170,1239 **** } ! /* Access the location */ ! c_ptr = &cave[y][x]; ! /* Make a new monster */ ! c_ptr->m_idx = m_pop(); - /* Mega-Hack -- catch "failure" */ - if (!c_ptr->m_idx) return (FALSE); - - /* Get a new monster record */ - m_ptr = &m_list[c_ptr->m_idx]; - /* Save the race */ ! m_ptr->r_idx = r_idx; - /* Place the monster at the location */ - m_ptr->fy = y; - m_ptr->fx = x; - - /* No "damage" yet */ - m_ptr->stunned = 0; - m_ptr->confused = 0; - m_ptr->monfear = 0; - - - /* Assume no sleeping */ - m_ptr->csleep = 0; - /* Enforce sleeping if needed */ if (slp && r_ptr->sleep) { int val = r_ptr->sleep; ! m_ptr->csleep = ((val * 2) + randint(val * 10)); } - /* Unknown distance */ - m_ptr->cdis = 0; - - /* No flags */ - m_ptr->mflag = 0; - - /* Not visible */ - m_ptr->ml = FALSE; - - /* Assign maximal hitpoints */ if (r_ptr->flags1 & (RF1_FORCE_MAXHP)) { ! m_ptr->maxhp = maxroll(r_ptr->hdice, r_ptr->hside); } else { ! m_ptr->maxhp = damroll(r_ptr->hdice, r_ptr->hside); } /* And start out fully healthy */ ! m_ptr->hp = m_ptr->maxhp; /* Extract the monster base speed */ ! m_ptr->mspeed = r_ptr->speed; /* Hack -- small racial variety */ if (!(r_ptr->flags1 & (RF1_UNIQUE))) --- 1357,1397 ---- } ! /* Get local monster */ ! n_ptr = &monster_type_body; ! /* Clean out the monster */ ! WIPE(n_ptr, monster_type); /* Save the race */ ! n_ptr->r_idx = r_idx; /* Enforce sleeping if needed */ if (slp && r_ptr->sleep) { int val = r_ptr->sleep; ! n_ptr->csleep = ((val * 2) + randint(val * 10)); } /* Assign maximal hitpoints */ if (r_ptr->flags1 & (RF1_FORCE_MAXHP)) { ! n_ptr->maxhp = maxroll(r_ptr->hdice, r_ptr->hside); } else { ! n_ptr->maxhp = damroll(r_ptr->hdice, r_ptr->hside); } /* And start out fully healthy */ ! n_ptr->hp = n_ptr->maxhp; /* Extract the monster base speed */ ! n_ptr->mspeed = r_ptr->speed; /* Hack -- small racial variety */ if (!(r_ptr->flags1 & (RF1_UNIQUE))) *************** *** 1240,1286 **** { /* Allow some small variation per monster */ i = extract_energy[r_ptr->speed] / 10; ! if (i) m_ptr->mspeed += rand_spread(0, i); } /* Give a random starting energy */ ! m_ptr->energy = rand_int(100); /* Force monster to wait for player */ if (r_ptr->flags1 & (RF1_FORCE_SLEEP)) { /* Monster is still being nice */ ! m_ptr->mflag |= (MFLAG_NICE); ! /* Must repair monsters */ ! repair_monsters = TRUE; } - /* Hack -- see "process_monsters()" */ - if (c_ptr->m_idx < hack_m_idx) - { /* Monster is still being born */ ! m_ptr->mflag |= (MFLAG_BORN); ! } - /* Update the monster */ - update_mon(c_ptr->m_idx, TRUE); - /* Hack -- Count the monsters on the level */ - r_ptr->cur_num++; - - - /* Hack -- Count the number of "reproducers" */ - if (r_ptr->flags2 & (RF2_MULTIPLY)) num_repro++; - - - /* Hack -- Notice new multi-hued monsters */ - if (r_ptr->flags1 & (RF1_ATTR_MULTI)) shimmer_monsters = TRUE; - - /* Success */ return (TRUE); } --- 1398,1430 ---- { /* Allow some small variation per monster */ i = extract_energy[r_ptr->speed] / 10; ! if (i) n_ptr->mspeed += rand_spread(0, i); } /* Give a random starting energy */ ! n_ptr->energy = rand_int(100); /* Force monster to wait for player */ if (r_ptr->flags1 & (RF1_FORCE_SLEEP)) { /* Monster is still being nice */ ! n_ptr->mflag |= (MFLAG_NICE); ! /* Optimize -- Repair flags */ ! repair_mflag_nice = TRUE; } /* Monster is still being born */ ! n_ptr->mflag |= (MFLAG_BORN); + /* Optimize -- Repair flags */ + repair_mflag_born = TRUE; + /* Place the monster in the dungeon */ + if (!monster_place(y, x, n_ptr)) return (FALSE); /* Success */ return (TRUE); } *************** *** 1312,1327 **** total = randint(13); /* Hard monsters, small groups */ ! if (r_ptr->level > dun_level) { ! extra = r_ptr->level - dun_level; extra = 0 - randint(extra); } /* Easy monsters, large groups */ ! else if (r_ptr->level < dun_level) { ! extra = dun_level - r_ptr->level; extra = randint(extra); } --- 1456,1471 ---- total = randint(13); /* Hard monsters, small groups */ ! if (r_ptr->level > p_ptr->depth) { ! extra = r_ptr->level - p_ptr->depth; extra = 0 - randint(extra); } /* Easy monsters, large groups */ ! else if (r_ptr->level < p_ptr->depth) { ! extra = p_ptr->depth - r_ptr->level; extra = randint(extra); } *************** *** 1616,1622 **** if (!cave_naked_bold(y, x)) continue; /* Accept far away grids */ ! if (distance(y, x, py, px) > dis) break; } /* Attempt to place the monster, allow groups */ --- 1760,1766 ---- if (!cave_naked_bold(y, x)) continue; /* Accept far away grids */ ! if (distance(y, x, p_ptr->py, p_ptr->px) > dis) break; } /* Attempt to place the monster, allow groups */ *************** *** 1805,1811 **** /* Pick a monster, using the level calculation */ ! r_idx = get_mon_num((dun_level + lev) / 2 + 5); /* Remove restriction */ --- 1949,1955 ---- /* Pick a monster, using the level calculation */ ! r_idx = get_mon_num((p_ptr->depth + lev) / 2 + 5); /* Remove restriction */ *************** *** 2008,2096 **** /* Analyze the knowledge */ switch (what) { ! case DRS_ACID: if (p_ptr->resist_acid) m_ptr->smart |= (SM_RES_ACID); if (p_ptr->oppose_acid) m_ptr->smart |= (SM_OPP_ACID); if (p_ptr->immune_acid) m_ptr->smart |= (SM_IMM_ACID); break; ! case DRS_ELEC: if (p_ptr->resist_elec) m_ptr->smart |= (SM_RES_ELEC); if (p_ptr->oppose_elec) m_ptr->smart |= (SM_OPP_ELEC); if (p_ptr->immune_elec) m_ptr->smart |= (SM_IMM_ELEC); break; ! case DRS_FIRE: if (p_ptr->resist_fire) m_ptr->smart |= (SM_RES_FIRE); if (p_ptr->oppose_fire) m_ptr->smart |= (SM_OPP_FIRE); if (p_ptr->immune_fire) m_ptr->smart |= (SM_IMM_FIRE); break; ! case DRS_COLD: if (p_ptr->resist_cold) m_ptr->smart |= (SM_RES_COLD); if (p_ptr->oppose_cold) m_ptr->smart |= (SM_OPP_COLD); if (p_ptr->immune_cold) m_ptr->smart |= (SM_IMM_COLD); break; ! case DRS_POIS: if (p_ptr->resist_pois) m_ptr->smart |= (SM_RES_POIS); if (p_ptr->oppose_pois) m_ptr->smart |= (SM_OPP_POIS); break; ! ! case DRS_NETH: ! if (p_ptr->resist_neth) m_ptr->smart |= (SM_RES_NETH); break; ! case DRS_LITE: if (p_ptr->resist_lite) m_ptr->smart |= (SM_RES_LITE); break; ! case DRS_DARK: if (p_ptr->resist_dark) m_ptr->smart |= (SM_RES_DARK); break; ! case DRS_FEAR: ! if (p_ptr->resist_fear) m_ptr->smart |= (SM_RES_FEAR); break; ! case DRS_CONF: ! if (p_ptr->resist_conf) m_ptr->smart |= (SM_RES_CONF); break; ! case DRS_CHAOS: ! if (p_ptr->resist_chaos) m_ptr->smart |= (SM_RES_CHAOS); break; ! case DRS_DISEN: ! if (p_ptr->resist_disen) m_ptr->smart |= (SM_RES_DISEN); break; ! case DRS_BLIND: ! if (p_ptr->resist_blind) m_ptr->smart |= (SM_RES_BLIND); ! break; ! ! case DRS_NEXUS: if (p_ptr->resist_nexus) m_ptr->smart |= (SM_RES_NEXUS); break; ! case DRS_SOUND: ! if (p_ptr->resist_sound) m_ptr->smart |= (SM_RES_SOUND); break; ! case DRS_SHARD: ! if (p_ptr->resist_shard) m_ptr->smart |= (SM_RES_SHARD); break; ! ! case DRS_FREE: ! if (p_ptr->free_act) m_ptr->smart |= (SM_IMM_FREE); break; - - case DRS_MANA: - if (!p_ptr->msp) m_ptr->smart |= (SM_IMM_MANA); - break; } #endif /* DRS_SMART_OPTIONS */ --- 2152,2274 ---- /* Analyze the knowledge */ switch (what) { ! case DRS_FREE: ! { ! if (p_ptr->free_act) m_ptr->smart |= (SM_IMM_FREE); ! break; ! } ! ! case DRS_MANA: ! { ! if (!p_ptr->msp) m_ptr->smart |= (SM_IMM_MANA); ! break; ! } ! ! case DRS_RES_ACID: ! { if (p_ptr->resist_acid) m_ptr->smart |= (SM_RES_ACID); if (p_ptr->oppose_acid) m_ptr->smart |= (SM_OPP_ACID); if (p_ptr->immune_acid) m_ptr->smart |= (SM_IMM_ACID); break; + } ! case DRS_RES_ELEC: ! { if (p_ptr->resist_elec) m_ptr->smart |= (SM_RES_ELEC); if (p_ptr->oppose_elec) m_ptr->smart |= (SM_OPP_ELEC); if (p_ptr->immune_elec) m_ptr->smart |= (SM_IMM_ELEC); break; + } ! case DRS_RES_FIRE: ! { if (p_ptr->resist_fire) m_ptr->smart |= (SM_RES_FIRE); if (p_ptr->oppose_fire) m_ptr->smart |= (SM_OPP_FIRE); if (p_ptr->immune_fire) m_ptr->smart |= (SM_IMM_FIRE); break; + } ! case DRS_RES_COLD: ! { if (p_ptr->resist_cold) m_ptr->smart |= (SM_RES_COLD); if (p_ptr->oppose_cold) m_ptr->smart |= (SM_OPP_COLD); if (p_ptr->immune_cold) m_ptr->smart |= (SM_IMM_COLD); break; + } ! case DRS_RES_POIS: ! { if (p_ptr->resist_pois) m_ptr->smart |= (SM_RES_POIS); if (p_ptr->oppose_pois) m_ptr->smart |= (SM_OPP_POIS); break; + } ! case DRS_RES_FEAR: ! { ! if (p_ptr->resist_fear) m_ptr->smart |= (SM_RES_FEAR); break; + } ! case DRS_RES_LITE: ! { if (p_ptr->resist_lite) m_ptr->smart |= (SM_RES_LITE); break; + } ! case DRS_RES_DARK: ! { if (p_ptr->resist_dark) m_ptr->smart |= (SM_RES_DARK); break; + } ! case DRS_RES_BLIND: ! { ! if (p_ptr->resist_blind) m_ptr->smart |= (SM_RES_BLIND); break; + } ! case DRS_RES_CONFU: ! { ! if (p_ptr->resist_confu) m_ptr->smart |= (SM_RES_CONFU); break; + } ! case DRS_RES_SOUND: ! { ! if (p_ptr->resist_sound) m_ptr->smart |= (SM_RES_SOUND); break; + } ! case DRS_RES_SHARD: ! { ! if (p_ptr->resist_shard) m_ptr->smart |= (SM_RES_SHARD); break; + } ! case DRS_RES_NEXUS: ! { if (p_ptr->resist_nexus) m_ptr->smart |= (SM_RES_NEXUS); break; + } ! case DRS_RES_NETHR: ! { ! if (p_ptr->resist_nethr) m_ptr->smart |= (SM_RES_NETHR); break; + } ! case DRS_RES_CHAOS: ! { ! if (p_ptr->resist_chaos) m_ptr->smart |= (SM_RES_CHAOS); break; + } ! case DRS_RES_DISEN: ! { ! if (p_ptr->resist_disen) m_ptr->smart |= (SM_RES_DISEN); break; } + } #endif /* DRS_SMART_OPTIONS */ Only in angband-281/src: monster2.o diff -r -c -w src-281/object1.c angband-281/src/object1.c *** src-281/object1.c Mon Mar 3 22:34:18 1997 --- angband-281/src/object1.c Thu Apr 24 10:34:21 1997 *************** *** 479,508 **** /* - * Hack -- prepare the default object char codes by tval - * - * XXX XXX XXX Off-load to "pref.prf" file (?) - */ - static byte default_tval_to_char(int tval) - { - int i; - - /* Hack -- Guess at "correct" values for tval_to_char[] */ - for (i = 1; i < MAX_K_IDX; i++) - { - object_kind *k_ptr = &k_info[i]; - - /* Use the first value we find */ - if (k_ptr->tval == tval) return (k_ptr->k_char); - } - - /* Default to space */ - return (' '); - } - - - - /* * Prepare the "variable" part of the "k_info" array. * * The "color"/"metal"/"type" of an item is its "flavor". --- 479,484 ---- *************** *** 794,810 **** /* * Reset the "visual" lists * ! * This involves resetting various things to their "default" ! * state, and then loading the appropriate "user pref file" ! * based on the "use_graphics" flag. * ! * This is useful for switching "graphics" on/off */ ! void reset_visuals(void) { int i; - char buf[1024]; /* Extract some info about terrain features */ for (i = 0; i < MAX_F_IDX; i++) --- 770,785 ---- /* * Reset the "visual" lists * ! * This involves resetting various things to their "default" state. * ! * If the "prefs" flag is TRUE, then we will also load the appropriate ! * "user pref file" based on the current setting of the "use_graphics" ! * flag. This is useful for switching "graphics" on/off. */ ! void reset_visuals(bool prefs) { int i; /* Extract some info about terrain features */ for (i = 0; i < MAX_F_IDX; i++) *************** *** 842,872 **** r_info[i].x_char = r_info[i].d_char; } /* Extract attr/chars for equippy items (by tval) */ for (i = 0; i < 128; i++) { /* Extract a default attr */ tval_to_attr[i] = default_tval_to_attr(i); - - /* Extract a default char */ - tval_to_char[i] = default_tval_to_char(i); } - /* Access the "font" or "graf" pref file, based on "use_graphics" */ - sprintf(buf, "%s-%s.prf", (use_graphics ? "graf" : "font"), ANGBAND_SYS); ! /* Process that file */ ! process_pref_file(buf); } - - - /* * Obtain the "flags" for an item */ --- 817,855 ---- r_info[i].x_char = r_info[i].d_char; } + + /* Default to white elsewhere? XXX XXX XXX */ /* Extract attr/chars for equippy items (by tval) */ for (i = 0; i < 128; i++) { /* Extract a default attr */ tval_to_attr[i] = default_tval_to_attr(i); } ! /* Process user pref files */ ! if (prefs) ! { ! /* Graphic symbols */ ! if (use_graphics) ! { ! /* Process "graf.prf" */ ! process_pref_file("graf.prf"); } + /* Normal symbols */ + else + { + /* Process "font.prf" */ + process_pref_file("font.prf"); + } + } + } /* * Obtain the "flags" for an item */ *************** *** 918,933 **** break; } ! case EGO_XTRA_POWER: { /* Choose a power */ switch (o_ptr->xtra2 % 9) { case 0: (*f2) |= (TR2_RES_BLIND); break; ! case 1: (*f2) |= (TR2_RES_CONF); break; case 2: (*f2) |= (TR2_RES_SOUND); break; ! case 3: (*f2) |= (TR2_RES_SHARDS); break; ! case 4: (*f2) |= (TR2_RES_NETHER); break; case 5: (*f2) |= (TR2_RES_NEXUS); break; case 6: (*f2) |= (TR2_RES_CHAOS); break; case 7: (*f2) |= (TR2_RES_DISEN); break; --- 901,916 ---- break; } ! case EGO_XTRA_RESIST: { /* Choose a power */ switch (o_ptr->xtra2 % 9) { case 0: (*f2) |= (TR2_RES_BLIND); break; ! case 1: (*f2) |= (TR2_RES_CONFU); break; case 2: (*f2) |= (TR2_RES_SOUND); break; ! case 3: (*f2) |= (TR2_RES_SHARD); break; ! case 4: (*f2) |= (TR2_RES_NETHR); break; case 5: (*f2) |= (TR2_RES_NEXUS); break; case 6: (*f2) |= (TR2_RES_CHAOS); break; case 7: (*f2) |= (TR2_RES_DISEN); break; *************** *** 937,943 **** break; } ! case EGO_XTRA_ABILITY: { /* Choose an ability */ switch (o_ptr->xtra2 % 8) --- 920,926 ---- break; } ! case EGO_XTRA_POWER: { /* Choose an ability */ switch (o_ptr->xtra2 % 8) *************** *** 948,955 **** case 3: (*f3) |= (TR3_TELEPATHY); break; case 4: (*f3) |= (TR3_SLOW_DIGEST); break; case 5: (*f3) |= (TR3_REGEN); break; ! case 6: (*f2) |= (TR2_FREE_ACT); break; ! case 7: (*f2) |= (TR2_HOLD_LIFE); break; } break; --- 931,938 ---- case 3: (*f3) |= (TR3_TELEPATHY); break; case 4: (*f3) |= (TR3_SLOW_DIGEST); break; case 5: (*f3) |= (TR3_REGEN); break; ! case 6: (*f3) |= (TR3_FREE_ACT); break; ! case 7: (*f3) |= (TR3_HOLD_LIFE); break; } break; *************** *** 979,984 **** --- 962,977 ---- (*f2) = k_ptr->flags2; (*f3) = k_ptr->flags3; + /* Ego-item */ + if (o_ptr->name2) + { + ego_item_type *e_ptr = &e_info[o_ptr->name2]; + + (*f1) |= e_ptr->flags1; + (*f2) |= e_ptr->flags2; + (*f3) |= e_ptr->flags3; + } + #ifdef SPOIL_ARTIFACTS /* Full knowledge for some artifacts */ if (artifact_p(o_ptr)) spoil = TRUE; *************** *** 1002,1017 **** (*f3) = a_ptr->flags3; } - /* Ego-item */ - if (o_ptr->name2) - { - ego_item_type *e_ptr = &e_info[o_ptr->name2]; - - (*f1) |= e_ptr->flags1; - (*f2) |= e_ptr->flags2; - (*f3) |= e_ptr->flags3; - } - /* Full knowledge for *identified* objects */ if (!(o_ptr->ident & IDENT_MENTAL)) return; --- 995,1000 ---- *************** *** 1034,1049 **** break; } ! case EGO_XTRA_POWER: { /* Choose a power */ switch (o_ptr->xtra2 % 9) { case 0: (*f2) |= (TR2_RES_BLIND); break; ! case 1: (*f2) |= (TR2_RES_CONF); break; case 2: (*f2) |= (TR2_RES_SOUND); break; ! case 3: (*f2) |= (TR2_RES_SHARDS); break; ! case 4: (*f2) |= (TR2_RES_NETHER); break; case 5: (*f2) |= (TR2_RES_NEXUS); break; case 6: (*f2) |= (TR2_RES_CHAOS); break; case 7: (*f2) |= (TR2_RES_DISEN); break; --- 1017,1032 ---- break; } ! case EGO_XTRA_RESIST: { /* Choose a power */ switch (o_ptr->xtra2 % 9) { case 0: (*f2) |= (TR2_RES_BLIND); break; ! case 1: (*f2) |= (TR2_RES_CONFU); break; case 2: (*f2) |= (TR2_RES_SOUND); break; ! case 3: (*f2) |= (TR2_RES_SHARD); break; ! case 4: (*f2) |= (TR2_RES_NETHR); break; case 5: (*f2) |= (TR2_RES_NEXUS); break; case 6: (*f2) |= (TR2_RES_CHAOS); break; case 7: (*f2) |= (TR2_RES_DISEN); break; *************** *** 1053,1059 **** break; } ! case EGO_XTRA_ABILITY: { /* Choose an ability */ switch (o_ptr->xtra2 % 8) --- 1036,1042 ---- break; } ! case EGO_XTRA_POWER: { /* Choose an ability */ switch (o_ptr->xtra2 % 8) *************** *** 1064,1071 **** case 3: (*f3) |= (TR3_TELEPATHY); break; case 4: (*f3) |= (TR3_SLOW_DIGEST); break; case 5: (*f3) |= (TR3_REGEN); break; ! case 6: (*f2) |= (TR2_FREE_ACT); break; ! case 7: (*f2) |= (TR2_HOLD_LIFE); break; } break; --- 1047,1054 ---- case 3: (*f3) |= (TR3_TELEPATHY); break; case 4: (*f3) |= (TR3_SLOW_DIGEST); break; case 5: (*f3) |= (TR3_REGEN); break; ! case 6: (*f3) |= (TR3_FREE_ACT); break; ! case 7: (*f3) |= (TR3_HOLD_LIFE); break; } break; *************** *** 1730,1744 **** /* Dump base weapon info */ switch (o_ptr->tval) { ! /* Missiles and Weapons */ case TV_SHOT: case TV_BOLT: case TV_ARROW: case TV_HAFTED: case TV_POLEARM: case TV_SWORD: case TV_DIGGING: ! /* Append a "damage" string */ t = object_desc_chr(t, ' '); t = object_desc_chr(t, p1); --- 1713,1732 ---- /* Dump base weapon info */ switch (o_ptr->tval) { ! /* Missiles */ case TV_SHOT: case TV_BOLT: case TV_ARROW: + { + /* Fall through */ + } + + /* Weapons */ case TV_HAFTED: case TV_POLEARM: case TV_SWORD: case TV_DIGGING: ! { /* Append a "damage" string */ t = object_desc_chr(t, ' '); t = object_desc_chr(t, p1); *************** *** 1749,1766 **** /* All done */ break; - /* Bows get a special "damage string" */ case TV_BOW: ! ! /* Mega-Hack -- Extract the "base power" */ power = (o_ptr->sval % 10); ! /* Apply the "Extra Might" flag */ ! if (f3 & (TR3_XTRA_MIGHT)) power++; ! ! /* Append a special "damage" string */ t = object_desc_chr(t, ' '); t = object_desc_chr(t, p1); t = object_desc_chr(t, 'x'); --- 1737,1751 ---- /* All done */ break; + } /* Bows get a special "damage string" */ case TV_BOW: ! { ! /* Hack -- Extract the "base power" */ power = (o_ptr->sval % 10); ! /* Append a "power" string */ t = object_desc_chr(t, ' '); t = object_desc_chr(t, p1); t = object_desc_chr(t, 'x'); *************** *** 1770,1775 **** --- 1755,1761 ---- /* All done */ break; } + } /* Add the weapon bonuses */ *************** *** 1891,1913 **** /* Nothing */ } - /* Speed */ - else if (f1 & (TR1_SPEED)) - { - /* Dump " to speed" */ - t = object_desc_str(t, " to speed"); - } - - /* Attack speed */ - else if (f1 & (TR1_BLOWS)) - { - /* Add " attack" */ - t = object_desc_str(t, " attack"); - - /* Add "attacks" */ - if (ABS(o_ptr->pval) != 1) t = object_desc_chr(t, 's'); - } - /* Stealth */ else if (f1 & (TR1_STEALTH)) { --- 1877,1882 ---- *************** *** 1915,1921 **** t = object_desc_str(t, " to stealth"); } ! /* Search */ else if (f1 & (TR1_SEARCH)) { /* Dump " to searching" */ --- 1884,1890 ---- t = object_desc_str(t, " to stealth"); } ! /* Searching */ else if (f1 & (TR1_SEARCH)) { /* Dump " to searching" */ *************** *** 1929,1940 **** --- 1898,1947 ---- t = object_desc_str(t, " to infravision"); } + #if 0 + /* Tunneling */ else if (f1 & (TR1_TUNNEL)) { + /* Dump " to digging" */ + t = object_desc_str(t, " to digging"); + } + + #endif + + /* Speed */ + else if (f1 & (TR1_SPEED)) + { + /* Dump " to speed" */ + t = object_desc_str(t, " to speed"); + } + + /* Blows */ + else if (f1 & (TR1_BLOWS)) + { + /* Add " attack" */ + t = object_desc_str(t, " attack"); + + /* Add "attacks" */ + if (ABS(o_ptr->pval) != 1) t = object_desc_chr(t, 's'); + } + + #if 0 + + /* Shots */ + else if (f1 & (TR1_SHOTS)) + { /* Nothing */ } + /* Might */ + else if (f1 & (TR1_MIGHT)) + { + /* Nothing */ + } + + #endif + /* Finish the display */ t = object_desc_chr(t, p2); } *************** *** 2435,2440 **** --- 2442,2455 ---- { info[i++] = "It affects your attack speed."; } + if (f1 & (TR1_SHOTS)) + { + info[i++] = "It affects your shooting speed."; + } + if (f1 & (TR1_MIGHT)) + { + info[i++] = "It affects your shooting power."; + } if (f1 & (TR1_BRAND_ACID)) { *************** *** 2453,2463 **** info[i++] = "It does extra damage from frost."; } - if (f1 & (TR1_IMPACT)) - { - info[i++] = "It can cause earthquakes."; - } - if (f1 & (TR1_KILL_DRAGON)) { info[i++] = "It is a great bane of dragons."; --- 2468,2473 ---- *************** *** 2524,2576 **** { info[i++] = "It provides immunity to acid."; } if (f2 & (TR2_IM_ELEC)) { info[i++] = "It provides immunity to electricity."; } ! if (f2 & (TR2_IM_FIRE)) { ! info[i++] = "It provides immunity to fire."; } - if (f2 & (TR2_IM_COLD)) - { - info[i++] = "It provides immunity to cold."; - } ! if (f2 & (TR2_FREE_ACT)) { ! info[i++] = "It provides immunity to paralysis."; } ! if (f2 & (TR2_HOLD_LIFE)) { ! info[i++] = "It provides resistance to life draining."; } ! if (f2 & (TR2_RES_ACID)) { ! info[i++] = "It provides resistance to acid."; } ! if (f2 & (TR2_RES_ELEC)) { - info[i++] = "It provides resistance to electricity."; - } - if (f2 & (TR2_RES_FIRE)) - { - info[i++] = "It provides resistance to fire."; - } - if (f2 & (TR2_RES_COLD)) - { info[i++] = "It provides resistance to cold."; } if (f2 & (TR2_RES_POIS)) { info[i++] = "It provides resistance to poison."; } if (f2 & (TR2_RES_LITE)) { info[i++] = "It provides resistance to light."; } if (f2 & (TR2_RES_DARK)) { info[i++] = "It provides resistance to dark."; --- 2534,2586 ---- { info[i++] = "It provides immunity to acid."; } + else if (f2 & (TR2_RES_ACID)) + { + info[i++] = "It provides resistance to acid."; + } + if (f2 & (TR2_IM_ELEC)) { info[i++] = "It provides immunity to electricity."; } ! else if (f2 & (TR2_RES_ELEC)) { ! info[i++] = "It provides resistance to electricity."; } ! if (f2 & (TR2_IM_FIRE)) { ! info[i++] = "It provides immunity to fire."; } ! else if (f2 & (TR2_RES_FIRE)) { ! info[i++] = "It provides resistance to fire."; } ! if (f2 & (TR2_IM_COLD)) { ! info[i++] = "It provides immunity to cold."; } ! else if (f2 & (TR2_RES_COLD)) { info[i++] = "It provides resistance to cold."; } + if (f2 & (TR2_RES_POIS)) { info[i++] = "It provides resistance to poison."; } + if (f2 & (TR2_RES_FEAR)) + { + info[i++] = "It provides resistance to fear."; + } + if (f2 & (TR2_RES_LITE)) { info[i++] = "It provides resistance to light."; } + if (f2 & (TR2_RES_DARK)) { info[i++] = "It provides resistance to dark."; *************** *** 2580,2662 **** { info[i++] = "It provides resistance to blindness."; } ! if (f2 & (TR2_RES_CONF)) { info[i++] = "It provides resistance to confusion."; } if (f2 & (TR2_RES_SOUND)) { info[i++] = "It provides resistance to sound."; } ! if (f2 & (TR2_RES_SHARDS)) { info[i++] = "It provides resistance to shards."; } - if (f2 & (TR2_RES_NETHER)) - { - info[i++] = "It provides resistance to nether."; - } if (f2 & (TR2_RES_NEXUS)) { info[i++] = "It provides resistance to nexus."; } if (f2 & (TR2_RES_CHAOS)) { info[i++] = "It provides resistance to chaos."; } if (f2 & (TR2_RES_DISEN)) { info[i++] = "It provides resistance to disenchantment."; } if (f3 & (TR3_FEATHER)) { info[i++] = "It induces feather falling."; } if (f3 & (TR3_LITE)) { info[i++] = "It provides permanent light."; } ! if (f3 & (TR3_SEE_INVIS)) { ! info[i++] = "It allows you to see invisible monsters."; } if (f3 & (TR3_TELEPATHY)) { info[i++] = "It gives telepathic powers."; } ! if (f3 & (TR3_SLOW_DIGEST)) { ! info[i++] = "It slows your metabolism."; } - if (f3 & (TR3_REGEN)) - { - info[i++] = "It speeds your regenerative powers."; - } ! if (f3 & (TR3_XTRA_MIGHT)) { ! info[i++] = "It fires missiles with extra might."; } - if (f3 & (TR3_XTRA_SHOTS)) - { - info[i++] = "It fires missiles excessively fast."; - } ! if (f3 & (TR3_DRAIN_EXP)) { ! info[i++] = "It drains experience."; } if (f3 & (TR3_TELEPORT)) { info[i++] = "It induces random teleportation."; } if (f3 & (TR3_AGGRAVATE)) { info[i++] = "It aggravates nearby creatures."; } if (f3 & (TR3_BLESSED)) { info[i++] = "It has been blessed by the gods."; --- 2590,2686 ---- { info[i++] = "It provides resistance to blindness."; } ! ! if (f2 & (TR2_RES_CONFU)) { info[i++] = "It provides resistance to confusion."; } + if (f2 & (TR2_RES_SOUND)) { info[i++] = "It provides resistance to sound."; } ! ! if (f2 & (TR2_RES_SHARD)) { info[i++] = "It provides resistance to shards."; } if (f2 & (TR2_RES_NEXUS)) { info[i++] = "It provides resistance to nexus."; } + + if (f2 & (TR2_RES_NETHR)) + { + info[i++] = "It provides resistance to nether."; + } + if (f2 & (TR2_RES_CHAOS)) { info[i++] = "It provides resistance to chaos."; } + if (f2 & (TR2_RES_DISEN)) { info[i++] = "It provides resistance to disenchantment."; } + if (f3 & (TR3_SLOW_DIGEST)) + { + info[i++] = "It slows your metabolism."; + } + if (f3 & (TR3_FEATHER)) { info[i++] = "It induces feather falling."; } + if (f3 & (TR3_LITE)) { info[i++] = "It provides permanent light."; } ! ! if (f3 & (TR3_REGEN)) { ! info[i++] = "It speeds your regenerative powers."; } + if (f3 & (TR3_TELEPATHY)) { info[i++] = "It gives telepathic powers."; } ! ! if (f3 & (TR3_SEE_INVIS)) { ! info[i++] = "It allows you to see invisible monsters."; } ! if (f3 & (TR3_FREE_ACT)) { ! info[i++] = "It provides immunity to paralysis."; } ! if (f3 & (TR3_HOLD_LIFE)) { ! info[i++] = "It provides resistance to life draining."; } + if (f3 & (TR3_TELEPORT)) { info[i++] = "It induces random teleportation."; } + if (f3 & (TR3_AGGRAVATE)) { info[i++] = "It aggravates nearby creatures."; } + if (f3 & (TR3_DRAIN_EXP)) + { + info[i++] = "It drains experience."; + } + if (f3 & (TR3_BLESSED)) { info[i++] = "It has been blessed by the gods."; *************** *** 2678,2684 **** } } - if (f3 & (TR3_IGNORE_ACID)) { info[i++] = "It cannot be harmed by acid."; --- 2702,2707 ---- *************** *** 3072,3082 **** /* Obtain the length of the description */ n = strlen(o_name); ! /* Get a color */ ! attr = tval_to_attr[o_ptr->tval % 128]; ! /* Hack -- fake monochrome */ ! if (!use_color) attr = TERM_WHITE; /* Display the entry itself */ Term_putstr(3, i, n, attr, o_name); --- 3095,3105 ---- /* Obtain the length of the description */ n = strlen(o_name); ! /* Acquire inventory color */ ! attr = tval_to_attr[o_ptr->tval & 0x7F]; ! /* Disable inventory colors */ ! if (!inventory_colors) attr = TERM_WHITE; /* Display the entry itself */ Term_putstr(3, i, n, attr, o_name); *************** *** 3145,3155 **** /* Obtain the length of the description */ n = strlen(o_name); ! /* Get the color */ ! attr = tval_to_attr[o_ptr->tval % 128]; ! /* Hack -- fake monochrome */ ! if (!use_color) attr = TERM_WHITE; /* Display the entry itself */ Term_putstr(3, i - INVEN_WIELD, n, attr, o_name); --- 3168,3178 ---- /* Obtain the length of the description */ n = strlen(o_name); ! /* Acquire inventory color */ ! attr = tval_to_attr[o_ptr->tval & 0x7F]; ! /* Disable inventory colors */ ! if (!inventory_colors) attr = TERM_WHITE; /* Display the entry itself */ Term_putstr(3, i - INVEN_WIELD, n, attr, o_name); *************** *** 3247,3255 **** /* Hack -- enforce max length */ o_name[lim] = '\0'; ! /* Save the object index, color, and description */ out_index[k] = i; ! out_color[k] = tval_to_attr[o_ptr->tval % 128]; (void)strcpy(out_desc[k], o_name); /* Find the predicted "line length" */ --- 3270,3285 ---- /* Hack -- enforce max length */ o_name[lim] = '\0'; ! /* Save the index */ out_index[k] = i; ! ! /* Acquire inventory color */ ! out_color[k] = tval_to_attr[o_ptr->tval & 0x7F]; ! ! /* Disable inventory colors */ ! if (!inventory_colors) out_color[k] = TERM_WHITE; ! ! /* Save the object description */ (void)strcpy(out_desc[k], o_name); /* Find the predicted "line length" */ *************** *** 3355,3363 **** /* Truncate the description */ o_name[lim] = 0; ! /* Save the color */ out_index[k] = i; ! out_color[k] = tval_to_attr[o_ptr->tval % 128]; (void)strcpy(out_desc[k], o_name); /* Extract the maximal length (see below) */ --- 3385,3400 ---- /* Truncate the description */ o_name[lim] = 0; ! /* Save the index */ out_index[k] = i; ! ! /* Acquire inventory color */ ! out_color[k] = tval_to_attr[o_ptr->tval & 0x7F]; ! ! /* Disable inventory colors */ ! if (!inventory_colors) out_color[k] = TERM_WHITE; ! ! /* Save the description */ (void)strcpy(out_desc[k], o_name); /* Extract the maximal length (see below) */ *************** *** 3639,3646 **** /* ! * Let the user select an item, return its "index" * * The selected item must satisfy the "item_tester_hook()" function, * if that hook is set, and the "item_tester_tval", if that value is set. * --- 3676,3685 ---- /* ! * Let the user select an item, save its "index" * + * Return TRUE only if an acceptable item was chosen by the user. + * * The selected item must satisfy the "item_tester_hook()" function, * if that hook is set, and the "item_tester_tval", if that value is set. * *************** *** 3648,3670 **** * * The user is allowed to choose acceptable items from the equipment, * inventory, or floor, respectively, if the proper flag was given, ! * and there are any acceptable items in that location. Note that ! * the equipment or inventory are displayed (even if no acceptable ! * items are in that location) if the proper flag was given. * * Note that the user must press "-" to specify the item on the floor, * and there is no way to "examine" the item on the floor, while the * use of "capital" letters will "examine" an inventory/equipment item, * and prompt for its use. * ! * If a legal item is selected, we save it in "cp" and return TRUE. ! * If this "legal" item is on the floor, we use a "cp" equal to zero ! * minus the dungeon index of the item on the floor. * ! * Otherwise, we return FALSE, and set "cp" to: ! * -1 for "User hit space/escape" ! * -2 for "No legal items to choose" * * Global "command_new" is used when viewing the inventory or equipment * to allow the user to enter a command while viewing those screens, and * also to induce "auto-enter" of stores, and other such stuff. --- 3687,3717 ---- * * The user is allowed to choose acceptable items from the equipment, * inventory, or floor, respectively, if the proper flag was given, ! * and there are any acceptable items in that location. * + * The equipment or inventory are displayed (even if no acceptable + * items are in that location) if the proper flag was given. XXX XXX + * + * If there are no acceptable items available anywhere, and "str" is + * not NULL, then it will be used as the text of a warning message + * before the function returns. + * * Note that the user must press "-" to specify the item on the floor, * and there is no way to "examine" the item on the floor, while the * use of "capital" letters will "examine" an inventory/equipment item, * and prompt for its use. * ! * If a legal item is selected from the inventory, we save it in "cp" ! * directly (0 to 35), and return TRUE. * ! * If a legal item is selected from the floor, we save it in "cp" as ! * a negative (-1 to -511), and return TRUE. * + * If no item is available, we do nothing to "cp", and we display a + * warning message, using "str" if available, and return FALSE. + * + * If no item is selected, we do nothing to "cp", and return FALSE. + * * Global "command_new" is used when viewing the inventory or equipment * to allow the user to enter a command while viewing those screens, and * also to induce "auto-enter" of stores, and other such stuff. *************** *** 3681,3693 **** * function with "command_see" being FALSE, or by pressing ESCAPE from * this function, or by hitting "escape" while viewing the inven/equip. * ! * We always erase the prompt when we are done. * * Note that "Term_save()" / "Term_load()" blocks must not overlap. */ ! bool get_item(int *cp, cptr pmt, bool equip, bool inven, bool floor) { ! cave_type *c_ptr = &cave[py][px]; s16b this_o_idx, next_o_idx = 0; --- 3728,3741 ---- * function with "command_see" being FALSE, or by pressing ESCAPE from * this function, or by hitting "escape" while viewing the inven/equip. * ! * 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 "Term_save()" / "Term_load()" blocks must not overlap. */ ! bool get_item(int *cp, cptr pmt, cptr str, int mode) { ! cave_type *c_ptr = &cave[p_ptr->py][p_ptr->px]; s16b this_o_idx, next_o_idx = 0; *************** *** 3697,3702 **** --- 3745,3756 ---- bool ver, done, item; + bool oops = FALSE; + + bool equip = FALSE; + bool inven = FALSE; + bool floor = FALSE; + bool allow_floor = FALSE; char tmp_val[160]; *************** *** 3703,3708 **** --- 3757,3768 ---- 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 */ msg_print(NULL); *************** *** 3713,3722 **** /* No item selected */ item = FALSE; - /* Default to "no item" (see above) */ - *cp = -1; - /* Full inventory */ i1 = 0; i2 = INVEN_PACK - 1; --- 3773,3779 ---- *************** *** 3767,3774 **** /* Cancel command_see */ command_see = FALSE; ! /* Hack -- Nothing to choose */ ! *cp = -2; /* Done */ done = TRUE; --- 3824,3831 ---- /* Cancel command_see */ command_see = FALSE; ! /* Oops */ ! oops = TRUE; /* Done */ done = TRUE; *************** *** 4155,4161 **** /* Clear the prompt line */ prt("", 0, 0); ! /* Return TRUE if something was picked */ return (item); } --- 4212,4221 ---- /* Clear the prompt line */ prt("", 0, 0); ! /* Warning if needed */ ! if (oops && str) msg_print(str); ! ! /* Result */ return (item); } Only in angband-281/src: object1.o diff -r -c -w src-281/object2.c angband-281/src/object2.c *** src-281/object2.c Mon Mar 3 22:34:58 1997 --- angband-281/src/object2.c Thu Apr 24 10:35:00 1997 *************** *** 60,70 **** /* Real previous */ else { /* Previous object */ ! o_ptr = &o_list[prev_o_idx]; /* Remove from list */ ! o_ptr->next_o_idx = next_o_idx; } /* Forget next pointer */ --- 60,72 ---- /* Real previous */ else { + object_type *i_ptr; + /* Previous object */ ! i_ptr = &o_list[prev_o_idx]; /* Remove from list */ ! i_ptr->next_o_idx = next_o_idx; } /* Forget next pointer */ *************** *** 114,124 **** /* Real previous */ else { /* Previous object */ ! o_ptr = &o_list[prev_o_idx]; /* Remove from list */ ! o_ptr->next_o_idx = next_o_idx; } /* Forget next pointer */ --- 116,128 ---- /* Real previous */ else { + object_type *i_ptr; + /* Previous object */ ! i_ptr = &o_list[prev_o_idx]; /* Remove from list */ ! i_ptr->next_o_idx = next_o_idx; } /* Forget next pointer */ *************** *** 181,187 **** s16b this_o_idx, next_o_idx = 0; ! /* Refuse "illegal" locations */ if (!in_bounds(y, x)) return; --- 185,191 ---- s16b this_o_idx, next_o_idx = 0; ! /* Paranoia */ if (!in_bounds(y, x)) return; *************** *** 290,299 **** } ! /* Structure copy */ ! o_list[i2] = o_list[i1]; ! /* Wipe the hole */ object_wipe(o_ptr); } --- 294,303 ---- } ! /* Hack -- move object */ ! COPY(&o_list[i2], &o_list[i1], object_type); ! /* Hack -- wipe hole */ object_wipe(o_ptr); } *************** *** 378,384 **** } /* Nearby objects start out "immune" */ ! if ((cur_dis > 0) && (distance(py, px, y, x) < cur_dis)) continue; /* Saving throw */ chance = 90; --- 382,388 ---- } /* Nearby objects start out "immune" */ ! if ((cur_dis > 0) && (distance(p_ptr->py, p_ptr->px, y, x) < cur_dis)) continue; /* Saving throw */ chance = 90; *************** *** 1416,1422 **** if (k_ptr->cost <= 0) o_ptr->ident |= (IDENT_BROKEN); /* Hack -- cursed items are always "cursed" */ ! if (k_ptr->flags3 & (TR3_CURSED)) o_ptr->ident |= (IDENT_CURSED); } --- 1420,1426 ---- if (k_ptr->cost <= 0) o_ptr->ident |= (IDENT_BROKEN); /* Hack -- cursed items are always "cursed" */ ! if (k_ptr->flags3 & (TR3_LIGHT_CURSE)) o_ptr->ident |= (IDENT_CURSED); } *************** *** 1555,1561 **** /* No artifacts in the town */ ! if (!dun_level) return (FALSE); /* Check the artifact list (just the "specials") */ for (i = 0; i < ART_MIN_NORMAL; i++) --- 1559,1565 ---- /* 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++) *************** *** 1569,1578 **** if (a_ptr->cur_num) continue; /* XXX XXX Enforce minimum "depth" (loosely) */ ! if (a_ptr->level > dun_level) { /* Acquire the "out-of-depth factor" */ ! int d = (a_ptr->level - dun_level) * 2; /* Roll for out-of-depth creation */ if (rand_int(d) != 0) continue; --- 1573,1582 ---- if (a_ptr->cur_num) continue; /* 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 */ if (rand_int(d) != 0) continue; *************** *** 1622,1628 **** /* No artifacts in the town */ ! if (!dun_level) return (FALSE); /* Paranoia -- no "plural" artifacts */ if (o_ptr->number != 1) return (FALSE); --- 1626,1632 ---- /* No artifacts in the town */ ! if (!p_ptr->depth) return (FALSE); /* Paranoia -- no "plural" artifacts */ if (o_ptr->number != 1) return (FALSE); *************** *** 1643,1652 **** if (a_ptr->sval != o_ptr->sval) continue; /* XXX XXX Enforce minimum "depth" (loosely) */ ! if (a_ptr->level > dun_level) { /* Acquire the "out-of-depth factor" */ ! int d = (a_ptr->level - dun_level) * 2; /* Roll for out-of-depth creation */ if (rand_int(d) != 0) continue; --- 1647,1656 ---- if (a_ptr->sval != o_ptr->sval) continue; /* 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 */ if (rand_int(d) != 0) continue; *************** *** 3113,3119 **** if (!a_ptr->cost) o_ptr->ident |= (IDENT_BROKEN); /* Hack -- extract the "cursed" flag */ ! if (a_ptr->flags3 & (TR3_CURSED)) o_ptr->ident |= (IDENT_CURSED); /* Mega-Hack -- increase the rating */ rating += 10; --- 3117,3123 ---- if (!a_ptr->cost) o_ptr->ident |= (IDENT_BROKEN); /* Hack -- extract the "cursed" flag */ ! if (a_ptr->flags3 & (TR3_LIGHT_CURSE)) o_ptr->ident |= (IDENT_CURSED); /* Mega-Hack -- increase the rating */ rating += 10; *************** *** 3203,3209 **** /* Weapon (Blessed) */ case EGO_BLESS_BLADE: { ! o_ptr->xtra1 = EGO_XTRA_ABILITY; break; } --- 3207,3213 ---- /* Weapon (Blessed) */ case EGO_BLESS_BLADE: { ! o_ptr->xtra1 = EGO_XTRA_POWER; break; } *************** *** 3210,3216 **** /* Robe of Permanance */ case EGO_PERMANENCE: { ! o_ptr->xtra1 = EGO_XTRA_POWER; break; } --- 3214,3220 ---- /* Robe of Permanance */ case EGO_PERMANENCE: { ! o_ptr->xtra1 = EGO_XTRA_RESIST; break; } *************** *** 3217,3223 **** /* Armor of Elvenkind */ case EGO_ELVENKIND: { ! o_ptr->xtra1 = EGO_XTRA_POWER; break; } --- 3221,3227 ---- /* Armor of Elvenkind */ case EGO_ELVENKIND: { ! o_ptr->xtra1 = EGO_XTRA_RESIST; break; } *************** *** 3224,3230 **** /* Crown of the Magi */ case EGO_MAGI: { ! o_ptr->xtra1 = EGO_XTRA_ABILITY; break; } --- 3228,3234 ---- /* Crown of the Magi */ case EGO_MAGI: { ! o_ptr->xtra1 = EGO_XTRA_POWER; break; } *************** *** 3231,3237 **** /* Cloak of Aman */ case EGO_AMAN: { ! o_ptr->xtra1 = EGO_XTRA_POWER; break; } } --- 3235,3241 ---- /* Cloak of Aman */ case EGO_AMAN: { ! o_ptr->xtra1 = EGO_XTRA_RESIST; break; } } *************** *** 3243,3249 **** if (!e_ptr->cost) o_ptr->ident |= (IDENT_BROKEN); /* Hack -- acquire "cursed" flag */ ! if (e_ptr->flags3 & (TR3_CURSED)) o_ptr->ident |= (IDENT_CURSED); /* Hack -- apply extra penalties if needed */ if (cursed_p(o_ptr) || broken_p(o_ptr)) --- 3247,3253 ---- if (!e_ptr->cost) o_ptr->ident |= (IDENT_BROKEN); /* Hack -- acquire "cursed" flag */ ! if (e_ptr->flags3 & (TR3_LIGHT_CURSE)) o_ptr->ident |= (IDENT_CURSED); /* Hack -- apply extra penalties if needed */ if (cursed_p(o_ptr) || broken_p(o_ptr)) *************** *** 3289,3295 **** if (!k_ptr->cost) o_ptr->ident |= (IDENT_BROKEN); /* Hack -- acquire "cursed" flag */ ! if (k_ptr->flags3 & (TR3_CURSED)) o_ptr->ident |= (IDENT_CURSED); } } --- 3293,3299 ---- if (!k_ptr->cost) o_ptr->ident |= (IDENT_BROKEN); /* Hack -- acquire "cursed" flag */ ! if (k_ptr->flags3 & (TR3_LIGHT_CURSE)) o_ptr->ident |= (IDENT_CURSED); } } *************** *** 3441,3450 **** /* Notice "okay" out-of-depth objects */ if (!cursed_p(j_ptr) && !broken_p(j_ptr) && ! (k_info[j_ptr->k_idx].level > dun_level)) { /* Rating increase */ ! rating += (k_info[j_ptr->k_idx].level - dun_level); /* Cheat -- peek at items */ if (cheat_peek) object_mention(j_ptr); --- 3445,3454 ---- /* Notice "okay" out-of-depth objects */ if (!cursed_p(j_ptr) && !broken_p(j_ptr) && ! (k_info[j_ptr->k_idx].level > p_ptr->depth)) { /* Rating increase */ ! rating += (k_info[j_ptr->k_idx].level - p_ptr->depth); /* Cheat -- peek at items */ if (cheat_peek) object_mention(j_ptr); *************** *** 3457,3537 **** /* - * Attempt to place an object (normal or good/great) at the given location. - * - * This routine plays nasty games to generate the "special artifacts". - * - * This routine uses "object_level" for the "generation level". - * - * This routine requires a clean floor grid destination. - */ - void place_object(int y, int x, bool good, bool great) - { - s16b o_idx; - - cave_type *c_ptr; - - object_type forge; - object_type *q_ptr; - - - /* Paranoia -- check bounds */ - if (!in_bounds(y, x)) return; - - /* Require clean floor space */ - if (!cave_clean_bold(y, x)) return; - - - /* Get local object */ - q_ptr = &forge; - - /* Wipe the object */ - object_wipe(q_ptr); - - /* Make an object (if possible) */ - if (!make_object(q_ptr, good, great)) return; - - - /* Make an object */ - o_idx = o_pop(); - - /* Success */ - if (o_idx) - { - object_type *o_ptr; - - /* Acquire object */ - o_ptr = &o_list[o_idx]; - - /* Structure Copy */ - object_copy(o_ptr, q_ptr); - - /* Location */ - o_ptr->iy = y; - o_ptr->ix = x; - - /* Acquire grid */ - c_ptr = &cave[y][x]; - - /* Build a stack */ - o_ptr->next_o_idx = c_ptr->o_idx; - - /* Place the object */ - c_ptr->o_idx = o_idx; - - /* Notice */ - note_spot(y, x); - - /* Redraw */ - lite_spot(y, x); - } - } - - - - - - /* * XXX XXX XXX Do not use these hard-coded values. */ #define OBJ_GOLD_LIST 480 /* First "gold" entry */ --- 3461,3466 ---- *************** *** 3578,3615 **** } /* ! * Places a treasure (Gold or Gems) at given location ! * ! * The location must be a legal, clean, floor grid. */ ! void place_gold(int y, int x) { s16b o_idx; cave_type *c_ptr; - object_type forge; - object_type *q_ptr; - /* Paranoia -- check bounds */ - if (!in_bounds(y, x)) return; ! /* Require clean floor space */ ! if (!cave_clean_bold(y, x)) return; ! /* Get local object */ ! q_ptr = &forge; ! /* Wipe the object */ ! object_wipe(q_ptr); ! /* Make some gold */ ! if (!make_gold(q_ptr)) return; /* Make an object */ o_idx = o_pop(); --- 3507,3561 ---- } + /* ! * Let the floor carry an object */ ! s16b floor_carry(int y, int x, object_type *j_ptr) { + int n = 0; + s16b o_idx; + s16b this_o_idx, next_o_idx = 0; + cave_type *c_ptr; + /* Cave grid */ + c_ptr = &cave[y][x]; ! /* Scan objects in that grid for combination */ ! for (this_o_idx = c_ptr->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 */ ! if (object_similar(o_ptr, j_ptr)) ! { ! /* Combine the items */ ! object_absorb(o_ptr, j_ptr); ! /* Result */ ! return (this_o_idx); ! } + /* Count objects */ + n++; + } + + /* Option -- allow stacking */ + if (n && !testing_stack) return (0); + + /* Make an object */ o_idx = o_pop(); *************** *** 3621,3635 **** /* Acquire object */ o_ptr = &o_list[o_idx]; ! /* Copy the object */ ! object_copy(o_ptr, q_ptr); ! /* Save location */ o_ptr->iy = y; o_ptr->ix = x; ! /* Acquire grid */ ! c_ptr = &cave[y][x]; /* Build a stack */ o_ptr->next_o_idx = c_ptr->o_idx; --- 3567,3581 ---- /* Acquire object */ o_ptr = &o_list[o_idx]; ! /* Structure Copy */ ! object_copy(o_ptr, j_ptr); ! /* Location */ o_ptr->iy = y; o_ptr->ix = x; ! /* Forget monster */ ! o_ptr->held_m_idx = 0; /* Build a stack */ o_ptr->next_o_idx = c_ptr->o_idx; *************** *** 3643,3648 **** --- 3589,3597 ---- /* Redraw */ lite_spot(y, x); } + + /* Result */ + return (o_idx); } *************** *** 3649,3655 **** /* * Let an object fall to the ground at or near a location. * ! * The initial location is assumed to be "in_bounds()". * * This function takes a parameter "chance". This is the percentage * chance that the item will "disappear" instead of drop. If the object --- 3598,3604 ---- /* * Let an object fall to the ground at or near a location. * ! * The initial location is assumed to be "in_bounds_fully()". * * This function takes a parameter "chance". This is the percentage * chance that the item will "disappear" instead of drop. If the object *************** *** 3662,3668 **** * the object can combine, stack, or be placed. Artifacts will try very * hard to be placed, including "teleporting" to a useful grid if needed. */ ! s16b drop_near(object_type *j_ptr, int chance, int y, int x) { int i, k, d, s; --- 3611,3617 ---- * the object can combine, stack, or be placed. Artifacts will try very * hard to be placed, including "teleporting" to a useful grid if needed. */ ! void drop_near(object_type *j_ptr, int chance, int y, int x) { int i, k, d, s; *************** *** 3671,3678 **** int dy, dx; int ty, tx; - s16b o_idx; - s16b this_o_idx, next_o_idx = 0; cave_type *c_ptr; --- 3620,3625 ---- *************** *** 3680,3686 **** char o_name[80]; bool flag = FALSE; - bool done = FALSE; bool plural = FALSE; --- 3627,3632 ---- *************** *** 3703,3709 **** if (wizard) msg_print("(breakage)"); /* Failure */ ! return (0); } --- 3649,3655 ---- if (wizard) msg_print("(breakage)"); /* Failure */ ! return; } *************** *** 3736,3742 **** tx = x + dx; /* Skip illegal grids */ ! if (!in_bounds(ty, tx)) continue; /* Require line of sight */ if (!los(y, x, ty, tx)) continue; --- 3682,3688 ---- tx = x + dx; /* Skip illegal grids */ ! if (!in_bounds_fully(ty, tx)) continue; /* Require line of sight */ if (!los(y, x, ty, tx)) continue; *************** *** 3771,3777 **** /* Add new object */ if (!comb) k++; ! /* No stacking (allow combining) */ if (!testing_stack && (k > 1)) continue; /* Paranoia */ --- 3717,3723 ---- /* Add new object */ if (!comb) k++; ! /* Option -- allow stacking */ if (!testing_stack && (k > 1)) continue; /* Paranoia */ *************** *** 3813,3819 **** if (wizard) msg_print("(no floor space)"); /* Failure */ ! return (0); } --- 3759,3765 ---- if (wizard) msg_print("(no floor space)"); /* Failure */ ! return; } *************** *** 3852,3891 **** } ! /* Grid */ ! c_ptr = &cave[by][bx]; ! ! /* Scan objects in that grid for combination */ ! for (this_o_idx = c_ptr->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 */ - if (object_similar(o_ptr, j_ptr)) - { - /* Combine the items */ - object_absorb(o_ptr, j_ptr); - - /* Success */ - done = TRUE; - - /* Done */ - break; - } - } - - /* Get new object */ - o_idx = o_pop(); - - /* Failure */ - if (!done && !o_idx) - { /* Message */ msg_format("The %s disappear%s.", o_name, (plural ? "" : "s")); --- 3798,3806 ---- } ! /* Give it to the floor */ ! if (!floor_carry(by, bx, j_ptr)) { /* Message */ msg_format("The %s disappear%s.", o_name, (plural ? "" : "s")); *************** *** 3894,3980 **** if (wizard) msg_print("(too many objects)"); /* Failure */ ! return (0); } - /* Stack */ - if (!done) - { - /* Structure copy */ - object_copy(&o_list[o_idx], j_ptr); - /* Access new object */ - j_ptr = &o_list[o_idx]; - - /* Locate */ - j_ptr->iy = by; - j_ptr->ix = bx; - - /* No monster */ - j_ptr->held_m_idx = 0; - - /* Build a stack */ - j_ptr->next_o_idx = c_ptr->o_idx; - - /* Place the object */ - c_ptr->o_idx = o_idx; - - /* Success */ - done = TRUE; - } - - /* Note the spot */ - note_spot(by, bx); - - /* Draw the spot */ - lite_spot(by, bx); - /* Sound */ sound(SOUND_DROP); /* Mega-Hack -- no message if "dropped" by player */ /* Message when an object falls under the player */ ! if (chance && (by == py) && (bx == px)) { msg_print("You feel something roll beneath your feet."); } - - /* XXX XXX XXX */ - - /* Result */ - return (o_idx); } - /* * Scatter some "great" objects near the player */ void acquirement(int y1, int x1, int num, bool great) { ! object_type forge; ! object_type *q_ptr; /* Acquirement */ while (num--) { /* Get local object */ ! q_ptr = &forge; /* Wipe the object */ ! object_wipe(q_ptr); /* Make a good (or great) object (if possible) */ ! if (!make_object(q_ptr, TRUE, great)) continue; /* Drop the object */ ! drop_near(q_ptr, -1, y1, x1); } } /* * Hack -- instantiate a trap * * XXX XXX XXX This routine should be redone to reflect trap "level". --- 3809,3916 ---- if (wizard) msg_print("(too many objects)"); /* Failure */ ! return; } /* Sound */ sound(SOUND_DROP); /* Mega-Hack -- no message if "dropped" by player */ /* Message when an object falls under the player */ ! if (chance && (by == p_ptr->py) && (bx == p_ptr->px)) { msg_print("You feel something roll beneath your feet."); } } /* * Scatter some "great" objects near the player */ void acquirement(int y1, int x1, int num, bool great) { ! object_type *i_ptr; ! object_type object_type_body; /* Acquirement */ while (num--) { /* Get local object */ ! i_ptr = &object_type_body; /* Wipe the object */ ! object_wipe(i_ptr); /* Make a good (or great) object (if possible) */ ! if (!make_object(i_ptr, TRUE, great)) continue; /* Drop the object */ ! drop_near(i_ptr, -1, y1, x1); } } + /* + * Attempt to place an object (normal or good/great) at the given location. + */ + void place_object(int y, int x, bool good, bool great) + { + object_type *i_ptr; + object_type object_type_body; + /* Paranoia */ + if (!in_bounds(y, x)) return; + + /* Hack -- clean floor space */ + if (!cave_clean_bold(y, x)) return; + + /* Get local object */ + i_ptr = &object_type_body; + + /* Wipe the object */ + object_wipe(i_ptr); + + /* Make an object (if possible) */ + if (make_object(i_ptr, good, great)) + { + /* Give it to the floor */ + (void)floor_carry(y, x, i_ptr); + } + } + + /* + * Places a treasure (Gold or Gems) at given location + */ + void place_gold(int y, int x) + { + object_type *i_ptr; + object_type object_type_body; + + /* Paranoia */ + if (!in_bounds(y, x)) return; + + /* Require clean floor space */ + if (!cave_clean_bold(y, x)) return; + + /* Get local object */ + i_ptr = &object_type_body; + + /* Wipe the object */ + object_wipe(i_ptr); + + /* Make some gold */ + if (make_gold(i_ptr)) + { + /* Give it to the floor */ + (void)floor_carry(y, x, i_ptr); + } + } + + + + /* * Hack -- instantiate a trap * * XXX XXX XXX This routine should be redone to reflect trap "level". *************** *** 3998,4007 **** feat = FEAT_TRAP_HEAD + rand_int(16); /* Hack -- no trap doors on quest levels */ ! if ((feat == FEAT_TRAP_HEAD + 0x00) && is_quest(dun_level)) continue; /* Hack -- no trap doors on the deepest level */ ! if ((feat == FEAT_TRAP_HEAD + 0x00) && (dun_level >= MAX_DEPTH-1)) continue; /* Done */ break; --- 3934,3943 ---- feat = FEAT_TRAP_HEAD + rand_int(16); /* Hack -- no trap doors on quest levels */ ! if ((feat == FEAT_TRAP_HEAD + 0x00) && is_quest(p_ptr->depth)) continue; /* Hack -- no trap doors on the deepest level */ ! if ((feat == FEAT_TRAP_HEAD + 0x00) && (p_ptr->depth >= MAX_DEPTH-1)) continue; /* Done */ break; *************** *** 4024,4030 **** */ void place_trap(int y, int x) { ! /* Paranoia -- verify location */ if (!in_bounds(y, x)) return; /* Require empty, clean, floor grid */ --- 3960,3966 ---- */ void place_trap(int y, int x) { ! /* Paranoia */ if (!in_bounds(y, x)) return; /* Require empty, clean, floor grid */ *************** *** 4147,4158 **** /* Slide everything down */ for (i = item; i < INVEN_PACK; i++) { ! /* Structure copy */ ! inventory[i] = inventory[i+1]; } ! /* Erase the "final" slot */ ! object_wipe(&inventory[i]); /* Window stuff */ p_ptr->window |= (PW_INVEN); --- 4083,4094 ---- /* Slide everything down */ for (i = item; i < INVEN_PACK; i++) { ! /* Hack -- slide object */ ! COPY(&inventory[i], &inventory[i+1], object_type); } ! /* Hack -- wipe hole */ ! WIPE(&inventory[i], object_type); /* Window stuff */ p_ptr->window |= (PW_INVEN); *************** *** 4306,4312 **** * Add an item to the players inventory, and return the slot used. * * If the new item can combine with an existing item in the inventory, ! * it will do so, using "object_similar()" and "object_absorb()", otherwise, * the item will be placed into the "proper" location in the inventory. * * This function can be used to "over-fill" the player's pack, but only --- 4242,4248 ---- * Add an item to the players inventory, and return the slot used. * * If the new item can combine with an existing item in the inventory, ! * it will do so, using "object_similar()" and "object_absorb()", else, * the item will be placed into the "proper" location in the inventory. * * This function can be used to "over-fill" the player's pack, but only *************** *** 4318,4328 **** * * Note that this code must remove any location/stack information * from the object once it is placed into the inventory. - * - * The "final" flag tells this function to bypass the "combine" - * and "reorder" code until later. */ ! s16b inven_carry(object_type *o_ptr, bool final) { int i, j, k; int n = -1; --- 4254,4261 ---- * * Note that this code must remove any location/stack information * from the object once it is placed into the inventory. */ ! s16b inven_carry(object_type *o_ptr) { int i, j, k; int n = -1; *************** *** 4330,4338 **** object_type *j_ptr; - /* Not final */ - if (!final) - { /* Check for combining */ for (j = 0; j < INVEN_PACK; j++) { --- 4263,4268 ---- *************** *** 4363,4369 **** return (j); } } - } /* Paranoia */ --- 4293,4298 ---- *************** *** 4383,4390 **** i = j; ! /* Hack -- pre-reorder the pack */ ! if (!final && (i < INVEN_PACK)) { s32b o_value, j_value; --- 4312,4319 ---- i = j; ! /* Reorder the pack */ ! if (i < INVEN_PACK) { s32b o_value, j_value; *************** *** 4444,4462 **** } ! /* Acquire a copy of the item */ object_copy(&inventory[i], o_ptr); /* Access new object */ ! o_ptr = &inventory[i]; ! /* Clean out unused fields */ ! o_ptr->iy = o_ptr->ix = 0; ! o_ptr->next_o_idx = 0; ! o_ptr->held_m_idx = 0; /* Increase the weight */ ! total_weight += (o_ptr->number * o_ptr->weight); /* Count the items */ inven_cnt++; --- 4373,4398 ---- } ! /* Copy the item */ object_copy(&inventory[i], o_ptr); /* Access new object */ ! j_ptr = &inventory[i]; ! /* Forget stack */ ! j_ptr->next_o_idx = 0; + /* Forget monster */ + j_ptr->held_m_idx = 0; + + /* Forget location */ + j_ptr->iy = j_ptr->ix = 0; + + /* No longer marked */ + j_ptr->marked = FALSE; + /* Increase the weight */ ! total_weight += (j_ptr->number * j_ptr->weight); /* Count the items */ inven_cnt++; *************** *** 4490,4500 **** { int slot; - object_type forge; - object_type *q_ptr; - object_type *o_ptr; cptr act; char o_name[80]; --- 4426,4436 ---- { int slot; object_type *o_ptr; + object_type *i_ptr; + object_type object_type_body; + cptr act; char o_name[80]; *************** *** 4510,4525 **** if (amt > o_ptr->number) amt = o_ptr->number; /* Get local object */ ! q_ptr = &forge; /* Obtain a local object */ ! object_copy(q_ptr, o_ptr); /* Modify quantity */ ! q_ptr->number = amt; /* Describe the object */ ! object_desc(o_name, q_ptr, TRUE, 3); /* Took off weapon */ if (item == INVEN_WIELD) --- 4446,4461 ---- if (amt > o_ptr->number) amt = o_ptr->number; /* Get local object */ ! i_ptr = &object_type_body; /* Obtain a local object */ ! object_copy(i_ptr, o_ptr); /* Modify quantity */ ! i_ptr->number = amt; /* Describe the object */ ! object_desc(o_name, i_ptr, TRUE, 3); /* Took off weapon */ if (item == INVEN_WIELD) *************** *** 4550,4556 **** inven_item_optimize(item); /* Carry the object */ ! slot = inven_carry(q_ptr, FALSE); /* Message */ msg_format("%s %s (%c).", act, o_name, index_to_label(slot)); --- 4486,4492 ---- inven_item_optimize(item); /* Carry the object */ ! slot = inven_carry(i_ptr); /* Message */ msg_format("%s %s (%c).", act, o_name, index_to_label(slot)); *************** *** 4569,4579 **** */ void inven_drop(int item, int amt) { - object_type forge; - object_type *q_ptr; - object_type *o_ptr; char o_name[80]; --- 4505,4515 ---- */ void inven_drop(int item, int amt) { object_type *o_ptr; + object_type *i_ptr; + object_type object_type_body; + char o_name[80]; *************** *** 4599,4620 **** /* Get local object */ ! q_ptr = &forge; /* Obtain local object */ ! object_copy(q_ptr, o_ptr); /* Modify quantity */ ! q_ptr->number = amt; /* Describe local object */ ! object_desc(o_name, q_ptr, TRUE, 3); /* Message */ msg_format("You drop %s (%c).", o_name, index_to_label(item)); /* Drop it near the player */ ! drop_near(q_ptr, 0, py, px); /* Modify, Describe, Optimize */ inven_item_increase(item, -amt); --- 4535,4556 ---- /* Get local object */ ! i_ptr = &object_type_body; /* Obtain local object */ ! object_copy(i_ptr, o_ptr); /* Modify quantity */ ! i_ptr->number = amt; /* Describe local object */ ! object_desc(o_name, i_ptr, TRUE, 3); /* Message */ msg_format("You drop %s (%c).", o_name, index_to_label(item)); /* Drop it near the player */ ! drop_near(i_ptr, 0, p_ptr->py, p_ptr->px); /* Modify, Describe, Optimize */ inven_item_increase(item, -amt); *************** *** 4672,4682 **** /* Slide everything down */ for (k = i; k < INVEN_PACK; k++) { ! /* Structure copy */ ! inventory[k] = inventory[k+1]; } ! /* Erase the "final" slot */ object_wipe(&inventory[k]); /* Window stuff */ --- 4608,4618 ---- /* Slide everything down */ for (k = i; k < INVEN_PACK; k++) { ! /* Hack -- slide object */ ! COPY(&inventory[k], &inventory[k+1], object_type); } ! /* Hack -- wipe hole */ object_wipe(&inventory[k]); /* Window stuff */ *************** *** 4705,4716 **** s32b o_value; s32b j_value; - object_type forge; - object_type *q_ptr; - - object_type *j_ptr; object_type *o_ptr; bool flag = FALSE; --- 4641,4652 ---- s32b o_value; s32b j_value; object_type *o_ptr; + object_type *j_ptr; + object_type *i_ptr; + object_type object_type_body; + bool flag = FALSE; *************** *** 4775,4784 **** flag = TRUE; /* Get local object */ ! q_ptr = &forge; /* Save a copy of the moving item */ ! object_copy(q_ptr, &inventory[i]); /* Slide the objects */ for (k = i; k > j; k--) --- 4711,4720 ---- flag = TRUE; /* Get local object */ ! i_ptr = &object_type_body; /* Save a copy of the moving item */ ! object_copy(i_ptr, &inventory[i]); /* Slide the objects */ for (k = i; k > j; k--) *************** *** 4788,4794 **** } /* Insert the moving item */ ! object_copy(&inventory[j], q_ptr); /* Window stuff */ p_ptr->window |= (PW_INVEN); --- 4724,4730 ---- } /* Insert the moving item */ ! object_copy(&inventory[j], i_ptr); /* Window stuff */ p_ptr->window |= (PW_INVEN); *************** *** 4875,4882 **** /* Forgotten */ else if ((i < 32) ? ! ((spell_forgotten1 & (1L << i))) : ! ((spell_forgotten2 & (1L << (i - 32))))) { /* Forgotten */ a = TERM_ORANGE; --- 4811,4818 ---- /* Forgotten */ else if ((i < 32) ? ! ((p_ptr->spell_forgotten1 & (1L << i))) : ! ((p_ptr->spell_forgotten2 & (1L << (i - 32))))) { /* Forgotten */ a = TERM_ORANGE; *************** *** 4884,4891 **** /* Unknown */ else if (!((i < 32) ? ! (spell_learned1 & (1L << i)) : ! (spell_learned2 & (1L << (i - 32))))) { /* Unknown */ a = TERM_RED; --- 4820,4827 ---- /* Unknown */ else if (!((i < 32) ? ! (p_ptr->spell_learned1 & (1L << i)) : ! (p_ptr->spell_learned2 & (1L << (i - 32))))) { /* Unknown */ a = TERM_RED; *************** *** 4893,4900 **** /* Untried */ else if (!((i < 32) ? ! (spell_worked1 & (1L << i)) : ! (spell_worked2 & (1L << (i - 32))))) { /* Untried */ a = TERM_YELLOW; --- 4829,4836 ---- /* Untried */ else if (!((i < 32) ? ! (p_ptr->spell_worked1 & (1L << i)) : ! (p_ptr->spell_worked2 & (1L << (i - 32))))) { /* Untried */ a = TERM_YELLOW; *************** *** 4920,4926 **** /* ! * Returns spell chance of failure for spell -RAK- */ s16b spell_chance(int spell) { --- 4856,4862 ---- /* ! * Returns chance of failure for a spell */ s16b spell_chance(int spell) { *************** *** 4995,5002 **** /* Spell is forgotten */ if ((spell < 32) ? ! (spell_forgotten1 & (1L << spell)) : ! (spell_forgotten2 & (1L << (spell - 32)))) { /* Never okay */ return (FALSE); --- 4931,4938 ---- /* Spell is forgotten */ if ((spell < 32) ? ! (p_ptr->spell_forgotten1 & (1L << spell)) : ! (p_ptr->spell_forgotten2 & (1L << (spell - 32)))) { /* Never okay */ return (FALSE); *************** *** 5004,5011 **** /* Spell is learned */ if ((spell < 32) ? ! (spell_learned1 & (1L << spell)) : ! (spell_learned2 & (1L << (spell - 32)))) { /* Okay to cast, not to study */ return (known); --- 4940,4947 ---- /* Spell is learned */ if ((spell < 32) ? ! (p_ptr->spell_learned1 & (1L << spell)) : ! (p_ptr->spell_learned2 & (1L << (spell - 32)))) { /* Okay to cast, not to study */ return (known); *************** *** 5030,5037 **** /* Default */ strcpy(p, ""); - #ifdef DRS_SHOW_SPELL_INFO - /* Mage spells */ if (mp_ptr->spell_book == TV_MAGIC_BOOK) { --- 4966,4971 ---- *************** *** 5108,5116 **** case 53: sprintf(p, " range %d", 8*plev); break; } } - - #endif - } --- 5042,5047 ---- *************** *** 5162,5181 **** /* Analyze the spell */ if ((spell < 32) ? ! ((spell_forgotten1 & (1L << spell))) : ! ((spell_forgotten2 & (1L << (spell - 32))))) { comment = " forgotten"; } else if (!((spell < 32) ? ! (spell_learned1 & (1L << spell)) : ! (spell_learned2 & (1L << (spell - 32))))) { comment = " unknown"; } else if (!((spell < 32) ? ! (spell_worked1 & (1L << spell)) : ! (spell_worked2 & (1L << (spell - 32))))) { comment = " untried"; } --- 5093,5112 ---- /* 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"; } *************** *** 5202,5209 **** { int y; ! object_type forge; ! object_type *q_ptr; char o_name[80]; --- 5133,5140 ---- { int y; ! object_type *i_ptr; ! object_type object_type_body; char o_name[80]; *************** *** 5220,5236 **** /* Get local object */ ! q_ptr = &forge; /* Prepare the object */ ! object_wipe(q_ptr); /* Prepare the object */ ! object_prep(q_ptr, k_idx); /* Describe */ ! object_desc_store(o_name, q_ptr, FALSE, 0); /* Mention the object name */ Term_putstr(0, 0, -1, TERM_WHITE, o_name); --- 5151,5167 ---- /* Get local object */ ! i_ptr = &object_type_body; /* Prepare the object */ ! object_wipe(i_ptr); /* Prepare the object */ ! object_prep(i_ptr, k_idx); /* Describe */ ! object_desc_store(o_name, i_ptr, FALSE, 0); /* Mention the object name */ Term_putstr(0, 0, -1, TERM_WHITE, o_name); *************** *** 5240,5246 **** if (!mp_ptr->spell_book) return; /* Display spells in readible books */ ! if (q_ptr->tval == mp_ptr->spell_book) { int sval; --- 5171,5177 ---- if (!mp_ptr->spell_book) return; /* Display spells in readible books */ ! if (i_ptr->tval == mp_ptr->spell_book) { int sval; *************** *** 5251,5257 **** /* Access the item's sval */ ! sval = q_ptr->sval; /* Extract spells */ for (spell = 0; spell < 64; spell++) --- 5182,5188 ---- /* Access the item's sval */ ! sval = i_ptr->sval; /* Extract spells */ for (spell = 0; spell < 64; spell++) Only in angband-281/src: object2.o diff -r -c -w src-281/save.c angband-281/src/save.c *** src-281/save.c Mon Mar 3 22:35:23 1997 --- angband-281/src/save.c Thu Apr 24 10:35:13 1997 *************** *** 990,1002 **** { int i; ! wr_string(player_name); ! wr_string(died_from); for (i = 0; i < 4; i++) { ! wr_string(history[i]); } /* Race/Class/Gender/Spells */ --- 990,1002 ---- { int i; ! wr_string(p_ptr->full_name); ! wr_string(p_ptr->died_from); for (i = 0; i < 4; i++) { ! wr_string(p_ptr->history[i]); } /* Race/Class/Gender/Spells */ *************** *** 1035,1042 **** wr_u16b(p_ptr->csp_frac); /* Max Player and Dungeon Levels */ ! wr_s16b(p_ptr->max_plv); ! wr_s16b(p_ptr->max_dlv); /* More info */ wr_s16b(0); /* oops */ --- 1035,1042 ---- wr_u16b(p_ptr->csp_frac); /* Max Player and Dungeon Levels */ ! wr_s16b(p_ptr->max_lev); ! wr_s16b(p_ptr->max_depth); /* More info */ wr_s16b(0); /* oops */ *************** *** 1139,1148 **** /*** Basic info ***/ /* Dungeon specific info follows */ ! wr_u16b(dun_level); ! wr_u16b(num_repro); ! wr_u16b(py); ! wr_u16b(px); wr_u16b(cur_hgt); wr_u16b(cur_wid); wr_u16b(max_panel_rows); --- 1139,1148 ---- /*** Basic info ***/ /* Dungeon specific info follows */ ! wr_u16b(p_ptr->depth); ! wr_u16b(0); ! wr_u16b(p_ptr->py); ! wr_u16b(p_ptr->px); wr_u16b(cur_hgt); wr_u16b(cur_wid); wr_u16b(max_panel_rows); *************** *** 1402,1423 **** wr_u16b(tmp16u); for (i = 0; i < tmp16u; i++) { ! wr_s16b(player_hp[i]); } /* Write spell data */ ! wr_u32b(spell_learned1); ! wr_u32b(spell_learned2); ! wr_u32b(spell_worked1); ! wr_u32b(spell_worked2); ! wr_u32b(spell_forgotten1); ! wr_u32b(spell_forgotten2); /* Dump the ordered spells */ for (i = 0; i < 64; i++) { ! wr_byte(spell_order[i]); } --- 1402,1423 ---- wr_u16b(tmp16u); for (i = 0; i < tmp16u; i++) { ! wr_s16b(p_ptr->player_hp[i]); } /* Write spell data */ ! wr_u32b(p_ptr->spell_learned1); ! wr_u32b(p_ptr->spell_learned2); ! wr_u32b(p_ptr->spell_worked1); ! wr_u32b(p_ptr->spell_worked2); ! wr_u32b(p_ptr->spell_forgotten1); ! wr_u32b(p_ptr->spell_forgotten2); /* Dump the ordered spells */ for (i = 0; i < 64; i++) { ! wr_byte(p_ptr->spell_order[i]); } *************** *** 1908,1914 **** if (p_ptr->chp >= 0) { /* Reset cause of death */ ! (void)strcpy(died_from, "(alive and well)"); } /* Success */ --- 1908,1914 ---- if (p_ptr->chp >= 0) { /* Reset cause of death */ ! (void)strcpy(p_ptr->died_from, "(alive and well)"); } /* Success */ Only in angband-281/src: save.o diff -r -c -w src-281/spells1.c angband-281/src/spells1.c *** src-281/spells1.c Mon Mar 3 22:36:00 1997 --- angband-281/src/spells1.c Thu Apr 24 10:35:46 1997 *************** *** 1,14 **** /* File: spells1.c */ ! /* Purpose: Spell code (part 1) */ - /* - * Copyright (c) 1989 James E. Wilson, Robert A. Koeneke - * - * This software may be copied and distributed for educational, research, and - * not for profit purposes provided that this copyright and statement are - * included in all such copies. - */ #include "angband.h" --- 1,7 ---- /* File: spells1.c */ ! /* Purpose: Spell code (part 1) -BEN- */ #include "angband.h" *************** *** 37,43 **** for (i = 0; i < 1000; i++) { /* Pick a new race, using a level calculation */ ! r = get_mon_num((dun_level + r_ptr->level) / 2 + 5); /* Handle failure */ if (!r) break; --- 30,36 ---- for (i = 0; i < 1000; i++) { /* Pick a new race, using a level calculation */ ! r = get_mon_num((p_ptr->depth + r_ptr->level) / 2 + 5); /* Handle failure */ if (!r) break; *************** *** 108,114 **** } /* Ignore illegal locations */ ! if (!in_bounds(ny, nx)) continue; /* Require "empty" floor space */ if (!cave_empty_bold(ny, nx)) continue; --- 101,107 ---- } /* Ignore illegal locations */ ! if (!in_bounds_fully(ny, nx)) continue; /* Require "empty" floor space */ if (!cave_empty_bold(ny, nx)) continue; *************** *** 165,171 **** */ void teleport_player(int dis) { ! int d, i, min, ox, oy, x = py, y = px; bool look = TRUE; --- 158,164 ---- */ void teleport_player(int dis) { ! int d, i, min, ox, oy, x = p_ptr->py, y = p_ptr->px; bool look = TRUE; *************** *** 184,197 **** /* Pick a (possibly illegal) location */ while (1) { ! y = rand_spread(py, dis); ! x = rand_spread(px, dis); ! d = distance(py, px, y, x); if ((d >= min) && (d <= dis)) break; } /* Ignore illegal locations */ ! if (!in_bounds(y, x)) continue; /* Require "naked" floor space */ if (!cave_naked_bold(y, x)) continue; --- 177,190 ---- /* Pick a (possibly illegal) location */ while (1) { ! y = rand_spread(p_ptr->py, dis); ! x = rand_spread(p_ptr->px, dis); ! d = distance(p_ptr->py, p_ptr->px, y, x); if ((d >= min) && (d <= dis)) break; } /* Ignore illegal locations */ ! if (!in_bounds_fully(y, x)) continue; /* Require "naked" floor space */ if (!cave_naked_bold(y, x)) continue; *************** *** 217,234 **** sound(SOUND_TELEPORT); /* Save the old location */ ! oy = py; ! ox = px; /* Move the player */ ! py = y; ! px = x; /* Redraw the old spot */ lite_spot(oy, ox); /* Redraw the new spot */ ! lite_spot(py, px); /* Check for new panel (redraw map) */ verify_panel(); --- 210,227 ---- sound(SOUND_TELEPORT); /* Save the old location */ ! oy = p_ptr->py; ! ox = p_ptr->px; /* Move the player */ ! p_ptr->py = y; ! p_ptr->px = x; /* Redraw the old spot */ lite_spot(oy, ox); /* Redraw the new spot */ ! lite_spot(p_ptr->py, p_ptr->px); /* Check for new panel (redraw map) */ verify_panel(); *************** *** 267,273 **** { y = rand_spread(ny, dis); x = rand_spread(nx, dis); ! if (in_bounds(y, x)) break; } /* Accept "naked" floor grids */ --- 260,266 ---- { y = rand_spread(ny, dis); x = rand_spread(nx, dis); ! if (in_bounds_fully(y, x)) break; } /* Accept "naked" floor grids */ *************** *** 285,302 **** sound(SOUND_TELEPORT); /* Save the old location */ ! oy = py; ! ox = px; /* Move the player */ ! py = y; ! px = x; /* Redraw the old spot */ lite_spot(oy, ox); /* Redraw the new spot */ ! lite_spot(py, px); /* Check for new panel (redraw map) */ verify_panel(); --- 278,295 ---- sound(SOUND_TELEPORT); /* Save the old location */ ! oy = p_ptr->py; ! ox = p_ptr->px; /* Move the player */ ! p_ptr->py = y; ! p_ptr->px = x; /* Redraw the old spot */ lite_spot(oy, ox); /* Redraw the new spot */ ! lite_spot(p_ptr->py, p_ptr->px); /* Check for new panel (redraw map) */ verify_panel(); *************** *** 321,348 **** */ void teleport_player_level(void) { ! if (!dun_level) { msg_print("You sink through the floor."); ! dun_level++; new_level_flag = TRUE; } ! else if (is_quest(dun_level) || (dun_level >= MAX_DEPTH-1)) { msg_print("You rise up through the ceiling."); ! dun_level--; new_level_flag = TRUE; } else if (rand_int(100) < 50) { msg_print("You rise up through the ceiling."); ! dun_level--; new_level_flag = TRUE; } else { msg_print("You sink through the floor."); ! dun_level++; new_level_flag = TRUE; } --- 314,341 ---- */ void teleport_player_level(void) { ! if (!p_ptr->depth) { msg_print("You sink through the floor."); ! p_ptr->depth++; new_level_flag = TRUE; } ! else if (is_quest(p_ptr->depth) || (p_ptr->depth >= MAX_DEPTH-1)) { msg_print("You rise up through the ceiling."); ! p_ptr->depth--; new_level_flag = TRUE; } else if (rand_int(100) < 50) { msg_print("You rise up through the ceiling."); ! p_ptr->depth--; new_level_flag = TRUE; } else { msg_print("You sink through the floor."); ! p_ptr->depth++; new_level_flag = TRUE; } *************** *** 382,394 **** */ static byte spell_color(int type) { - /* Hack -- fake monochrome */ - if (!use_color) return (TERM_WHITE); - /* Analyze */ switch (type) { ! case GF_MISSILE: return (mh_attr()); case GF_ACID: return (TERM_SLATE); case GF_ELEC: return (TERM_BLUE); case GF_FIRE: return (TERM_RED); --- 375,384 ---- */ static byte spell_color(int type) { /* Analyze */ switch (type) { ! case GF_MISSILE: return (TERM_VIOLET); case GF_ACID: return (TERM_SLATE); case GF_ELEC: return (TERM_BLUE); case GF_FIRE: return (TERM_RED); *************** *** 399,410 **** case GF_ARROW: return (TERM_WHITE); case GF_WATER: return (TERM_SLATE); case GF_NETHER: return (TERM_L_GREEN); ! case GF_CHAOS: return (mh_attr()); case GF_DISENCHANT: return (TERM_VIOLET); case GF_NEXUS: return (TERM_L_RED); case GF_CONFUSION: return (TERM_L_UMBER); case GF_SOUND: return (TERM_YELLOW); ! case GF_SHARDS: return (TERM_UMBER); case GF_FORCE: return (TERM_UMBER); case GF_INERTIA: return (TERM_L_WHITE); case GF_GRAVITY: return (TERM_L_WHITE); --- 389,400 ---- case GF_ARROW: return (TERM_WHITE); case GF_WATER: return (TERM_SLATE); case GF_NETHER: return (TERM_L_GREEN); ! case GF_CHAOS: return (TERM_VIOLET); case GF_DISENCHANT: return (TERM_VIOLET); case GF_NEXUS: return (TERM_L_RED); case GF_CONFUSION: return (TERM_L_UMBER); case GF_SOUND: return (TERM_YELLOW); ! case GF_SHARD: return (TERM_UMBER); case GF_FORCE: return (TERM_UMBER); case GF_INERTIA: return (TERM_L_WHITE); case GF_GRAVITY: return (TERM_L_WHITE); *************** *** 430,442 **** /* * Decreases players hit points and sets death flag if necessary * ! * XXX XXX XXX Invulnerability needs to be changed into a "shield" * ! * XXX XXX XXX Hack -- this function allows the user to save (or quit) ! * the game when he dies, since the "You die." message is shown before ! * setting the player to "dead". */ ! void take_hit(int damage, cptr hit_from) { int old_chp = p_ptr->chp; --- 420,432 ---- /* * Decreases players hit points and sets death flag if necessary * ! * Invulnerability needs to be changed into a "shield" XXX XXX XXX * ! * Hack -- this function allows the user to save (or quit) the game ! * when he dies, since the "You die." message is shown before setting ! * the player to "dead". XXX XXX XXX */ ! void take_hit(int dam, cptr kb_str) { int old_chp = p_ptr->chp; *************** *** 451,460 **** disturb(1, 0); /* Mega-Hack -- Apply "invulnerability" */ ! if (p_ptr->invuln && (damage < 9000)) return; /* Hurt the player */ ! p_ptr->chp -= damage; /* Display the hitpoints */ p_ptr->redraw |= (PR_HP); --- 441,450 ---- disturb(1, 0); /* Mega-Hack -- Apply "invulnerability" */ ! if (p_ptr->invuln && (dam < 9000)) return; /* Hurt the player */ ! p_ptr->chp -= dam; /* Display the hitpoints */ p_ptr->redraw |= (PR_HP); *************** *** 473,479 **** msg_print(NULL); /* Note cause of death */ ! (void)strcpy(died_from, hit_from); /* No longer a winner */ total_winner = FALSE; --- 463,469 ---- msg_print(NULL); /* Note cause of death */ ! (void)strcpy(p_ptr->died_from, kb_str); /* No longer a winner */ total_winner = FALSE; *************** *** 502,513 **** /* - * Note that amulets, rods, and high-level spell books are immune - * to "inventory damage" of any kind. Also sling ammo and shovels. - */ - - - /* * Does a given class of objects (usually) hate acid? * Note that acid can either melt or corrode something. */ --- 492,497 ---- *************** *** 945,954 **** /* ! * Increases a stat by one randomized level -RAK- * ! * Note that this function (used by stat potions) now restores ! * the stat BEFORE increasing it. */ bool inc_stat(int stat) { --- 929,939 ---- /* ! * Increase a stat by one randomized level * ! * Most code will "restore" a stat before calling this function, ! * in particular, stat potions will always restore the stat and ! * then increase the fully restored value. */ bool inc_stat(int stat) { *************** *** 1014,1022 **** /* * Decreases a stat by an amount indended to vary from 0 to 100 percent. * - * Amount could be a little higher in extreme cases to mangle very high - * stats from massive assaults. -CWS - * * Note that "permanent" means that the *given* amount is permanent, * not that the new value becomes permanent. This may not work exactly * as expected, due to "weirdness" in the algorithm, but in general, --- 999,1004 ---- *************** *** 1340,1348 **** * * We return "TRUE" if the effect of the projection is "obvious". * ! * XXX XXX XXX We also "see" grids which are "memorized", probably a hack * ! * XXX XXX XXX Perhaps we should affect doors? */ static bool project_f(int who, int r, int y, int x, int dam, int typ) { --- 1322,1330 ---- * * We return "TRUE" if the effect of the projection is "obvious". * ! * Hack -- We also "see" grids which are "memorized". * ! * Perhaps we should affect doors and/or walls. XXX XXX */ static bool project_f(int who, int r, int y, int x, int dam, int typ) { *************** *** 1369,1375 **** case GF_PLASMA: case GF_METEOR: case GF_ICE: ! case GF_SHARDS: case GF_FORCE: case GF_SOUND: case GF_MANA: --- 1351,1357 ---- case GF_PLASMA: case GF_METEOR: case GF_ICE: ! case GF_SHARD: case GF_FORCE: case GF_SOUND: case GF_MANA: *************** *** 1678,1684 **** * Note that we determine if the player can "see" anything that happens * by taking into account: blindness, line-of-sight, and illumination. * ! * XXX XXX XXX We also "see" grids which are "memorized", probably a hack * * We return "TRUE" if the effect of the projection is "obvious". */ --- 1660,1666 ---- * Note that we determine if the player can "see" anything that happens * by taking into account: blindness, line-of-sight, and illumination. * ! * Hack -- We also "see" objects which are "memorized". * * We return "TRUE" if the effect of the projection is "obvious". */ *************** *** 1820,1826 **** /* Hack -- break potions and such */ case GF_ICE: ! case GF_SHARDS: case GF_FORCE: case GF_SOUND: { --- 1802,1808 ---- /* Hack -- break potions and such */ case GF_ICE: ! case GF_SHARD: case GF_FORCE: case GF_SOUND: { *************** *** 2219,2225 **** } /* Shards -- Shard breathers resist */ ! case GF_SHARDS: { if (seen) obvious = TRUE; if (r_ptr->flags4 & (RF4_BR_SHAR)) --- 2201,2207 ---- } /* Shards -- Shard breathers resist */ ! case GF_SHARD: { if (seen) obvious = TRUE; if (r_ptr->flags4 & (RF4_BR_SHAR)) *************** *** 3211,3217 **** /* Player is not here */ ! if ((x != px) || (y != py)) return (FALSE); /* Player cannot hurt himself */ if (!who) return (FALSE); --- 3193,3199 ---- /* Player is not here */ ! if ((x != p_ptr->px) || (y != p_ptr->py)) return (FALSE); /* Player cannot hurt himself */ if (!who) return (FALSE); *************** *** 3330,3336 **** case GF_NETHER: { if (fuzzy) msg_print("You are hit by something strange!"); ! if (p_ptr->resist_neth) { dam *= 6; dam /= (randint(6) + 6); } --- 3312,3318 ---- case GF_NETHER: { if (fuzzy) msg_print("You are hit by something strange!"); ! if (p_ptr->resist_nethr) { dam *= 6; dam /= (randint(6) + 6); } *************** *** 3363,3369 **** { (void)set_stun(p_ptr->stun + randint(40)); } ! if (!p_ptr->resist_conf) { (void)set_confused(p_ptr->confused + randint(5) + 5); } --- 3345,3351 ---- { (void)set_stun(p_ptr->stun + randint(40)); } ! if (!p_ptr->resist_confu) { (void)set_confused(p_ptr->confused + randint(5) + 5); } *************** *** 3379,3385 **** { dam *= 6; dam /= (randint(6) + 6); } ! if (!p_ptr->resist_conf) { (void)set_confused(p_ptr->confused + rand_int(20) + 10); } --- 3361,3367 ---- { dam *= 6; dam /= (randint(6) + 6); } ! if (!p_ptr->resist_confu) { (void)set_confused(p_ptr->confused + rand_int(20) + 10); } *************** *** 3387,3393 **** { (void)set_image(p_ptr->image + randint(10)); } ! if (!p_ptr->resist_neth && !p_ptr->resist_chaos) { if (p_ptr->hold_life && (rand_int(100) < 75)) { --- 3369,3375 ---- { (void)set_image(p_ptr->image + randint(10)); } ! if (!p_ptr->resist_nethr && !p_ptr->resist_chaos) { if (p_ptr->hold_life && (rand_int(100) < 75)) { *************** *** 3409,3415 **** } /* Shards -- mostly cutting */ ! case GF_SHARDS: { if (fuzzy) msg_print("You are hit by something sharp!"); if (p_ptr->resist_shard) --- 3391,3397 ---- } /* Shards -- mostly cutting */ ! case GF_SHARD: { if (fuzzy) msg_print("You are hit by something sharp!"); if (p_ptr->resist_shard) *************** *** 3445,3455 **** case GF_CONFUSION: { if (fuzzy) msg_print("You are hit by something!"); ! if (p_ptr->resist_conf) { dam *= 5; dam /= (randint(6) + 6); } ! if (!p_ptr->resist_conf) { (void)set_confused(p_ptr->confused + randint(20) + 10); } --- 3427,3437 ---- case GF_CONFUSION: { if (fuzzy) msg_print("You are hit by something!"); ! if (p_ptr->resist_confu) { dam *= 5; dam /= (randint(6) + 6); } ! if (!p_ptr->resist_confu) { (void)set_confused(p_ptr->confused + randint(20) + 10); } *************** *** 3687,3693 **** /* ! * Generic "beam"/"bolt"/"ball" projection routine. -BEN- * * Input: * who: Index of "source" monster (or "zero" for "player") --- 3669,3675 ---- /* ! * Generic "beam"/"bolt"/"ball" projection routine. * * Input: * who: Index of "source" monster (or "zero" for "player") *************** *** 3857,3864 **** /* Location of player */ ! y0 = py; ! x0 = px; /* Hack -- Jump to target */ --- 3839,3846 ---- /* Location of player */ ! y0 = p_ptr->py; ! x0 = p_ptr->px; /* Hack -- Jump to target */ *************** *** 3871,3878 **** /* Hack -- Start at player */ else if (!who) { ! x1 = px; ! y1 = py; } /* Start at a monster */ --- 3853,3860 ---- /* Hack -- Start at player */ else if (!who) { ! x1 = p_ptr->px; ! y1 = p_ptr->py; } /* Start at a monster */ *************** *** 3961,3967 **** if (!blind && !(flg & (PROJECT_HIDE))) { /* Only do visuals if the player can "see" the bolt */ ! if (player_has_los_bold(y9, x9) && panel_contains(y9, x9)) { /* Visual effects -- Display, Highlight, Flush, Pause, Erase */ print_rel(bolt_char(y, x, y9, x9), spell_color(typ), y9, x9); --- 3943,3949 ---- if (!blind && !(flg & (PROJECT_HIDE))) { /* Only do visuals if the player can "see" the bolt */ ! if (panel_contains(y9, x9) && player_has_los_bold(y9, x9)) { /* Visual effects -- Display, Highlight, Flush, Pause, Erase */ print_rel(bolt_char(y, x, y9, x9), spell_color(typ), y9, x9); *************** *** 4012,4018 **** for (x = x2 - dist; x <= x2 + dist; x++) { /* Ignore "illegal" locations */ ! if (!in_bounds2(y, x)) continue; /* Enforce a "circular" explosion */ if (distance(y2, x2, y, x) != dist) continue; --- 3994,4000 ---- for (x = x2 - dist; x <= x2 + dist; x++) { /* Ignore "illegal" locations */ ! if (!in_bounds(y, x)) continue; /* Enforce a "circular" explosion */ if (distance(y2, x2, y, x) != dist) continue; *************** *** 4051,4058 **** x = gx[i]; /* The player can see it */ ! if (player_has_los_bold(y, x) && ! panel_contains(y, x)) { drawn = TRUE; print_rel('*', spell_color(typ), y, x); --- 4033,4039 ---- x = gx[i]; /* The player can see it */ ! if (panel_contains(y, x) && player_has_los_bold(y, x)) { drawn = TRUE; print_rel('*', spell_color(typ), y, x); *************** *** 4083,4090 **** x = gx[i]; /* Erase if needed */ ! if (player_has_los_bold(y, x) && ! panel_contains(y, x)) { lite_spot(y, x); } --- 4064,4070 ---- x = gx[i]; /* Erase if needed */ ! if (panel_contains(y, x) && player_has_los_bold(y, x)) { lite_spot(y, x); } Only in angband-281/src: spells1.o diff -r -c -w src-281/spells2.c angband-281/src/spells2.c *** src-281/spells2.c Mon Mar 3 22:36:47 1997 --- angband-281/src/spells2.c Thu Apr 24 22:08:28 1997 *************** *** 80,86 **** void warding_glyph(void) { /* XXX XXX XXX */ ! if (!cave_clean_bold(py, px)) { msg_print("The object resists the spell."); return; --- 80,86 ---- void warding_glyph(void) { /* XXX XXX XXX */ ! if (!cave_clean_bold(p_ptr->py, p_ptr->px)) { msg_print("The object resists the spell."); return; *************** *** 87,93 **** } /* Create a glyph */ ! cave_set_feat(py, px, FEAT_GLYPH); } --- 87,93 ---- } /* Create a glyph */ ! cave_set_feat(p_ptr->py, p_ptr->px, FEAT_GLYPH); } *************** *** 365,381 **** /* ! * self-knowledge... idea from nethack. Useful for determining powers and ! * resistences of items. It saves the screen, clears it, then starts listing ! * attributes, a screenful at a time. (There are a LOT of attributes to ! * list. It will probably take 2 or 3 screens for a powerful character whose ! * using several artifacts...) -CFT * ! * It is now a lot more efficient. -BEN- * * See also "identify_fully()". * ! * XXX XXX XXX Use the "show_file()" method, perhaps. */ void self_knowledge(void) { --- 365,379 ---- /* ! * Hack -- acquire self knowledge * ! * List various information about the player and/or his current equipment. * * See also "identify_fully()". * ! * Use the "roff()" routines, perhaps. XXX XXX ! * ! * Use the "show_file()" method, perhaps. XXX XXX */ void self_knowledge(void) { *************** *** 490,527 **** { info[i++] = "Your eyes are sensitive to infrared light."; } ! if (p_ptr->see_inv) { ! info[i++] = "You can see invisible creatures."; } if (p_ptr->ffall) { info[i++] = "You land gently."; } ! if (p_ptr->free_act) { ! info[i++] = "You have free action."; } if (p_ptr->regenerate) { info[i++] = "You regenerate quickly."; } - if (p_ptr->slow_digest) - { - info[i++] = "Your appetite is small."; - } if (p_ptr->telepathy) { info[i++] = "You have ESP."; } ! if (p_ptr->hold_life) { ! info[i++] = "You have a firm hold on your life force."; } ! if (p_ptr->lite) { ! info[i++] = "You are carrying a permanent light."; } if (p_ptr->immune_acid) { --- 488,526 ---- { info[i++] = "Your eyes are sensitive to infrared light."; } ! ! if (p_ptr->slow_digest) { ! info[i++] = "Your appetite is small."; } if (p_ptr->ffall) { info[i++] = "You land gently."; } ! if (p_ptr->lite) { ! info[i++] = "You are glowing with light."; } if (p_ptr->regenerate) { info[i++] = "You regenerate quickly."; } if (p_ptr->telepathy) { info[i++] = "You have ESP."; } ! if (p_ptr->see_inv) { ! info[i++] = "You can see invisible creatures."; } ! if (p_ptr->free_act) { ! info[i++] = "You have free action."; } + if (p_ptr->hold_life) + { + info[i++] = "You have a firm hold on your life force."; + } if (p_ptr->immune_acid) { *************** *** 584,589 **** --- 583,593 ---- info[i++] = "You are resistant to poison."; } + if (p_ptr->resist_fear) + { + info[i++] = "You are completely fearless."; + } + if (p_ptr->resist_lite) { info[i++] = "You are resistant to bright light."; *************** *** 592,599 **** { info[i++] = "You are resistant to darkness."; } ! if (p_ptr->resist_conf) { info[i++] = "You are resistant to confusion."; } if (p_ptr->resist_sound) --- 596,607 ---- { info[i++] = "You are resistant to darkness."; } ! if (p_ptr->resist_blind) { + info[i++] = "Your eyes are resistant to blindness."; + } + if (p_ptr->resist_confu) + { info[i++] = "You are resistant to confusion."; } if (p_ptr->resist_sound) *************** *** 600,613 **** { info[i++] = "You are resistant to sonic attacks."; } - if (p_ptr->resist_disen) - { - info[i++] = "You are resistant to disenchantment."; - } - if (p_ptr->resist_chaos) - { - info[i++] = "You are resistant to chaos."; - } if (p_ptr->resist_shard) { info[i++] = "You are resistant to blasts of shards."; --- 608,613 ---- *************** *** 616,632 **** { info[i++] = "You are resistant to nexus attacks."; } ! if (p_ptr->resist_neth) { info[i++] = "You are resistant to nether forces."; } ! if (p_ptr->resist_fear) { ! info[i++] = "You are completely fearless."; } ! if (p_ptr->resist_blind) { ! info[i++] = "Your eyes are resistant to blindness."; } if (p_ptr->sustain_str) --- 616,632 ---- { info[i++] = "You are resistant to nexus attacks."; } ! if (p_ptr->resist_nethr) { info[i++] = "You are resistant to nether forces."; } ! if (p_ptr->resist_chaos) { ! info[i++] = "You are resistant to chaos."; } ! if (p_ptr->resist_disen) { ! info[i++] = "You are resistant to disenchantment."; } if (p_ptr->sustain_str) *************** *** 703,708 **** --- 703,716 ---- { info[i++] = "Your attack speed is affected by your equipment."; } + if (f1 & (TR1_SHOTS)) + { + info[i++] = "Your shooting speed is affected by your equipment."; + } + if (f1 & (TR1_MIGHT)) + { + info[i++] = "Your shooting might is affected by your equipment."; + } /* Access the current weapon */ *************** *** 711,728 **** /* Analyze the weapon */ if (o_ptr->k_idx) { - /* Indicate Blessing */ - if (f3 & (TR3_BLESSED)) - { - info[i++] = "Your weapon has been blessed by the gods."; - } - - /* Hack */ - if (f1 & (TR1_IMPACT)) - { - info[i++] = "The impact of your weapon can cause earthquakes."; - } - /* Special "Attack Bonuses" */ if (f1 & (TR1_BRAND_ACID)) { --- 719,724 ---- *************** *** 780,788 **** --- 776,797 ---- { info[i++] = "Your weapon is a great bane of dragons."; } + + + /* Indicate Blessing */ + if (f3 & (TR3_BLESSED)) + { + info[i++] = "Your weapon has been blessed by the gods."; } + /* Hack */ + if (f3 & (TR3_IMPACT)) + { + info[i++] = "Your weapon can induce earthquakes."; + } + } + /* Save the screen */ Term_save(); *************** *** 1301,1318 **** /* Detect all non-invisible monsters */ if (!(r_ptr->flags2 & (RF2_INVISIBLE))) { ! /* Repair visibility later */ ! repair_monsters = TRUE; ! /* Hack -- Detect monster */ m_ptr->mflag |= (MFLAG_MARK | MFLAG_SHOW); ! /* Hack -- See monster */ ! m_ptr->ml = TRUE; - /* Redraw */ - lite_spot(y, x); - /* Detect */ flag = TRUE; } --- 1310,1324 ---- /* Detect all non-invisible monsters */ if (!(r_ptr->flags2 & (RF2_INVISIBLE))) { ! /* Optimize -- Repair flags */ ! repair_mflag_mark = repair_mflag_show = TRUE; ! /* Hack -- Detect the monster */ m_ptr->mflag |= (MFLAG_MARK | MFLAG_SHOW); ! /* Update the monster */ ! update_mon(i, FALSE); /* Detect */ flag = TRUE; } *************** *** 1369,1386 **** p_ptr->window |= (PW_MONSTER); } ! /* Repair visibility later */ ! repair_monsters = TRUE; ! /* Hack -- Detect monster */ m_ptr->mflag |= (MFLAG_MARK | MFLAG_SHOW); ! /* Hack -- See monster */ ! m_ptr->ml = TRUE; - /* Redraw */ - lite_spot(y, x); - /* Detect */ flag = TRUE; } --- 1375,1389 ---- p_ptr->window |= (PW_MONSTER); } ! /* Optimize -- Repair flags */ ! repair_mflag_mark = repair_mflag_show = TRUE; ! /* Hack -- Detect the monster */ m_ptr->mflag |= (MFLAG_MARK | MFLAG_SHOW); ! /* Update the monster */ ! update_mon(i, FALSE); /* Detect */ flag = TRUE; } *************** *** 1438,1455 **** p_ptr->window |= (PW_MONSTER); } ! /* Repair visibility later */ ! repair_monsters = TRUE; ! /* Hack -- Detect monster */ m_ptr->mflag |= (MFLAG_MARK | MFLAG_SHOW); ! /* Hack -- See monster */ ! m_ptr->ml = TRUE; - /* Redraw */ - lite_spot(y, x); - /* Detect */ flag = TRUE; } --- 1441,1455 ---- p_ptr->window |= (PW_MONSTER); } ! /* Optimize -- Repair flags */ ! repair_mflag_mark = repair_mflag_show = TRUE; ! /* Detect the monster */ m_ptr->mflag |= (MFLAG_MARK | MFLAG_SHOW); ! /* Update the monster */ ! update_mon(i, FALSE); /* Detect */ flag = TRUE; } *************** *** 1497,1503 **** void stair_creation(void) { /* XXX XXX XXX */ ! if (!cave_valid_bold(py, px)) { msg_print("The object resists the spell."); return; --- 1497,1503 ---- void stair_creation(void) { /* XXX XXX XXX */ ! if (!cave_valid_bold(p_ptr->py, p_ptr->px)) { msg_print("The object resists the spell."); return; *************** *** 1504,1527 **** } /* XXX XXX XXX */ ! delete_object(py, px); /* Create a staircase */ ! if (!dun_level) { ! cave_set_feat(py, px, FEAT_MORE); } ! else if (is_quest(dun_level) || (dun_level >= MAX_DEPTH-1)) { ! cave_set_feat(py, px, FEAT_LESS); } else if (rand_int(100) < 50) { ! cave_set_feat(py, px, FEAT_MORE); } else { ! cave_set_feat(py, px, FEAT_LESS); } } --- 1504,1527 ---- } /* XXX XXX XXX */ ! delete_object(p_ptr->py, p_ptr->px); /* Create a staircase */ ! if (!p_ptr->depth) { ! cave_set_feat(p_ptr->py, p_ptr->px, FEAT_MORE); } ! else if (is_quest(p_ptr->depth) || (p_ptr->depth >= MAX_DEPTH-1)) { ! cave_set_feat(p_ptr->py, p_ptr->px, FEAT_LESS); } else if (rand_int(100) < 50) { ! cave_set_feat(p_ptr->py, p_ptr->px, FEAT_MORE); } else { ! cave_set_feat(p_ptr->py, p_ptr->px, FEAT_LESS); } } *************** *** 1579,1585 **** /* ! * Enchants a plus onto an item. -RAK- * * Revamped! Now takes item pointer, number of times to try enchanting, * and a flag of what to try enchanting. Artifacts resist enchantment --- 1579,1585 ---- /* ! * Enchant an item * * Revamped! Now takes item pointer, number of times to try enchanting, * and a flag of what to try enchanting. Artifacts resist enchantment *************** *** 1732,1738 **** --- 1732,1740 ---- char o_name[80]; + cptr q, s; + /* Assume enchant weapon */ item_tester_hook = item_tester_hook_weapon; *************** *** 1739,1750 **** /* Enchant armor if requested */ if (num_ac) item_tester_hook = item_tester_hook_armour; ! /* Get an item (from equip or inven or floor) */ ! if (!get_item(&item, "Enchant which item? ", TRUE, TRUE, TRUE)) ! { ! if (item == -2) msg_print("You have nothing to enchant."); ! return (FALSE); ! } /* Get the item (in the pack) */ if (item >= 0) --- 1741,1750 ---- /* Enchant armor if requested */ if (num_ac) item_tester_hook = item_tester_hook_armour; ! /* Get an item */ ! q = "Enchant which item? "; ! s = "You have nothing to enchant."; ! if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return (FALSE); /* Get the item (in the pack) */ if (item >= 0) *************** *** 1800,1813 **** char o_name[80]; - /* Get an item (from equip or inven or floor) */ - if (!get_item(&item, "Identify which item? ", TRUE, TRUE, TRUE)) - { - if (item == -2) msg_print("You have nothing to identify."); - return (FALSE); - } /* Get the item (in the pack) */ if (item >= 0) { --- 1800,1813 ---- char o_name[80]; + cptr q, s; + /* Get an item */ + q = "Identify which item? "; + s = "You have nothing to identify."; + if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return (FALSE); + /* Get the item (in the pack) */ if (item >= 0) { *************** *** 1861,1867 **** /* ! * Fully "identify" an object in the inventory -BEN- * This routine returns TRUE if an item was identified. */ bool identify_fully(void) --- 1861,1868 ---- /* ! * Fully "identify" an object in the inventory ! * * This routine returns TRUE if an item was identified. */ bool identify_fully(void) *************** *** 1872,1885 **** char o_name[80]; - /* Get an item (from equip or inven or floor) */ - if (!get_item(&item, "Identify which item? ", TRUE, TRUE, TRUE)) - { - if (item == -2) msg_print("You have nothing to identify."); - return (FALSE); - } /* Get the item (in the pack) */ if (item >= 0) { --- 1873,1886 ---- char o_name[80]; + cptr q, s; + /* Get an item */ + q = "Identify which item? "; + s = "You have nothing to identify."; + if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return (FALSE); + /* Get the item (in the pack) */ if (item >= 0) { *************** *** 1994,2009 **** object_type *o_ptr; /* Only accept legal items */ item_tester_hook = item_tester_hook_recharge; ! /* Get an item (from inven or floor) */ ! if (!get_item(&item, "Recharge which item? ", FALSE, TRUE, TRUE)) ! { ! if (item == -2) msg_print("You have nothing to recharge."); ! return (FALSE); ! } /* Get the item (in the pack) */ if (item >= 0) --- 1995,2010 ---- object_type *o_ptr; + cptr q, s; + /* Only accept legal items */ item_tester_hook = item_tester_hook_recharge; ! /* Get an item */ ! q = "Recharge which item? "; ! s = "You have nothing to recharge."; ! if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return (FALSE); /* Get the item (in the pack) */ if (item >= 0) *************** *** 2327,2333 **** take_hit(randint(4), "the strain of casting Genocide"); /* Visual feedback */ ! move_cursor_relative(py, px); /* Redraw */ p_ptr->redraw |= (PR_HP); --- 2328,2334 ---- take_hit(randint(4), "the strain of casting Genocide"); /* Visual feedback */ ! move_cursor_relative(p_ptr->py, p_ptr->px); /* Redraw */ p_ptr->redraw |= (PR_HP); *************** *** 2384,2390 **** /* Hack -- visual feedback */ take_hit(randint(3), "the strain of casting Mass Genocide"); ! move_cursor_relative(py, px); /* Redraw */ p_ptr->redraw |= (PR_HP); --- 2385,2391 ---- /* Hack -- visual feedback */ take_hit(randint(3), "the strain of casting Mass Genocide"); ! move_cursor_relative(p_ptr->py, p_ptr->px); /* Redraw */ p_ptr->redraw |= (PR_HP); *************** *** 2491,2497 **** for (x = (x1 - r); x <= (x1 + r); x++) { /* Skip illegal grids */ ! if (!in_bounds(y, x)) continue; /* Extract the distance */ k = distance(y1, x1, y, x); --- 2492,2498 ---- for (x = (x1 - r); x <= (x1 + r); x++) { /* Skip illegal grids */ ! if (!in_bounds_fully(y, x)) continue; /* Extract the distance */ k = distance(y1, x1, y, x); *************** *** 2509,2515 **** c_ptr->info &= ~(CAVE_MARK | CAVE_GLOW); /* Hack -- Notice player affect */ ! if ((x == px) && (y == py)) { /* Hurt the player later */ flag = TRUE; --- 2510,2516 ---- c_ptr->info &= ~(CAVE_MARK | CAVE_GLOW); /* Hack -- Notice player affect */ ! if ((x == p_ptr->px) && (y == p_ptr->py)) { /* Hurt the player later */ flag = TRUE; *************** *** 2652,2658 **** xx = cx + dx; /* Skip illegal grids */ ! if (!in_bounds(yy, xx)) continue; /* Skip distant grids */ if (distance(cy, cx, yy, xx) > r) continue; --- 2653,2659 ---- xx = cx + dx; /* Skip illegal grids */ ! if (!in_bounds_fully(yy, xx)) continue; /* Skip distant grids */ if (distance(cy, cx, yy, xx) > r) continue; *************** *** 2676,2682 **** map[16+yy-cy][16+xx-cx] = TRUE; /* Hack -- Take note of player damage */ ! if ((yy == py) && (xx == px)) hurt = TRUE; } } --- 2677,2683 ---- map[16+yy-cy][16+xx-cx] = TRUE; /* Hack -- Take note of player damage */ ! if ((yy == p_ptr->py) && (xx == p_ptr->px)) hurt = TRUE; } } *************** *** 2687,2694 **** 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; --- 2688,2695 ---- for (i = 0; i < 8; i++) { /* Access the location */ ! y = p_ptr->py + ddy[i]; ! x = p_ptr->px + ddx[i]; /* Skip non-empty grids */ if (!cave_empty_bold(y, x)) continue; *************** *** 2763,2780 **** } /* Save the old location */ ! oy = py; ! ox = px; /* Move the player to the safe location */ ! py = sy; ! px = sx; /* Redraw the old spot */ lite_spot(oy, ox); /* Redraw the new spot */ ! lite_spot(py, px); /* Check for new panel */ verify_panel(); --- 2764,2781 ---- } /* Save the old location */ ! oy = p_ptr->py; ! ox = p_ptr->px; /* Move the player to the safe location */ ! p_ptr->py = sy; ! p_ptr->px = sx; /* Redraw the old spot */ lite_spot(oy, ox); /* Redraw the new spot */ ! lite_spot(p_ptr->py, p_ptr->px); /* Check for new panel */ verify_panel(); *************** *** 2781,2787 **** } /* Important -- no wall on player */ ! map[16+py-cy][16+px-cx] = FALSE; /* Take some damage */ if (damage) take_hit(damage, "an earthquake"); --- 2782,2788 ---- } /* Important -- no wall on player */ ! map[16+p_ptr->py-cy][16+p_ptr->px-cx] = FALSE; /* Take some damage */ if (damage) take_hit(damage, "an earthquake"); *************** *** 2922,2928 **** c_ptr = &cave[yy][xx]; /* Paranoia -- never affect player */ ! if ((yy == py) && (xx == px)) continue; /* Destroy location (if valid) */ if (cave_valid_bold(yy, xx)) --- 2923,2929 ---- c_ptr = &cave[yy][xx]; /* Paranoia -- never affect player */ ! if ((yy == p_ptr->py) && (xx == p_ptr->px)) continue; /* Destroy location (if valid) */ if (cave_valid_bold(yy, xx)) *************** *** 3248,3257 **** } /* Hook into the "project()" function */ ! (void)project(0, rad, py, px, dam, GF_LITE_WEAK, flg); /* Lite up the room */ ! lite_room(py, px); /* Assume seen */ return (TRUE); --- 3249,3258 ---- } /* Hook into the "project()" function */ ! (void)project(0, rad, p_ptr->py, p_ptr->px, dam, GF_LITE_WEAK, flg); /* Lite up the room */ ! lite_room(p_ptr->py, p_ptr->px); /* Assume seen */ return (TRUE); *************** *** 3273,3282 **** } /* Hook into the "project()" function */ ! (void)project(0, rad, py, px, dam, GF_DARK_WEAK, flg); /* Lite up the room */ ! unlite_room(py, px); /* Assume seen */ return (TRUE); --- 3274,3283 ---- } /* Hook into the "project()" function */ ! (void)project(0, rad, p_ptr->py, p_ptr->px, dam, GF_DARK_WEAK, flg); /* Lite up the room */ ! unlite_room(p_ptr->py, p_ptr->px); /* Assume seen */ return (TRUE); *************** *** 3297,3304 **** int flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL; /* Use the given direction */ ! tx = px + 99 * ddx[dir]; ! ty = py + 99 * ddy[dir]; /* Hack -- Use an actual "target" */ if ((dir == 5) && target_okay()) --- 3298,3305 ---- int flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL; /* Use the given direction */ ! tx = p_ptr->px + 99 * ddx[dir]; ! ty = p_ptr->py + 99 * ddy[dir]; /* Hack -- Use an actual "target" */ if ((dir == 5) && target_okay()) *************** *** 3324,3331 **** flg |= (PROJECT_THRU); /* Use the given direction */ ! tx = px + ddx[dir]; ! ty = py + ddy[dir]; /* Hack -- Use an actual "target" */ if ((dir == 5) && target_okay()) --- 3325,3332 ---- flg |= (PROJECT_THRU); /* Use the given direction */ ! tx = p_ptr->px + ddx[dir]; ! ty = p_ptr->py + ddy[dir]; /* Hack -- Use an actual "target" */ if ((dir == 5) && target_okay()) *************** *** 3474,3498 **** bool door_creation(void) { int flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE; ! return (project(0, 1, py, px, 0, GF_MAKE_DOOR, flg)); } bool trap_creation(void) { int flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE; ! return (project(0, 1, py, px, 0, GF_MAKE_TRAP, flg)); } bool destroy_doors_touch(void) { int flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE; ! return (project(0, 1, py, px, 0, GF_KILL_DOOR, flg)); } bool sleep_monsters_touch(void) { int flg = PROJECT_KILL | PROJECT_HIDE; ! return (project(0, 1, py, px, p_ptr->lev, GF_OLD_SLEEP, flg)); } --- 3475,3499 ---- bool door_creation(void) { int flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE; ! return (project(0, 1, p_ptr->py, p_ptr->px, 0, GF_MAKE_DOOR, flg)); } bool trap_creation(void) { int flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE; ! return (project(0, 1, p_ptr->py, p_ptr->px, 0, GF_MAKE_TRAP, flg)); } bool destroy_doors_touch(void) { int flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE; ! return (project(0, 1, p_ptr->py, p_ptr->px, 0, GF_KILL_DOOR, flg)); } bool sleep_monsters_touch(void) { int flg = PROJECT_KILL | PROJECT_HIDE; ! return (project(0, 1, p_ptr->py, p_ptr->px, p_ptr->lev, GF_OLD_SLEEP, flg)); } Only in angband-281/src: spells2.o diff -r -c -w src-281/store.c angband-281/src/store.c *** src-281/store.c Mon Mar 3 22:37:24 1997 --- angband-281/src/store.c Thu Apr 24 10:36:46 1997 *************** *** 187,193 **** /* ! * Kick 'da bum out. -RAK- */ static void say_comment_4(void) { --- 187,193 ---- /* ! * You must leave my store */ static void say_comment_4(void) { *************** *** 206,212 **** /* ! * That makes no sense. */ static void say_comment_6(void) { --- 206,212 ---- /* ! * You are making no sense. */ static void say_comment_6(void) { *************** *** 640,648 **** /* ! * Check to see if the shop will be carrying too many objects -RAK- * Note that the shop, just like a player, will not accept things ! * it cannot hold. Before, one could "nuke" potions this way. */ static bool store_check_num(object_type *o_ptr) { --- 640,650 ---- /* ! * Check to see if the shop will be carrying too many objects ! * * Note that the shop, just like a player, will not accept things ! * it cannot hold. Before, one could "nuke" objects this way, by ! * adding them to a pile which was already full. */ static bool store_check_num(object_type *o_ptr) { *************** *** 907,920 **** /* Slide the others up */ for (i = st_ptr->stock_num; i > slot; i--) { ! st_ptr->stock[i] = st_ptr->stock[i-1]; } /* More stuff now */ st_ptr->stock_num++; ! /* Insert the new item */ ! st_ptr->stock[slot] = *o_ptr; /* Return the location */ return (slot); --- 909,923 ---- /* Slide the others up */ for (i = st_ptr->stock_num; i > slot; i--) { ! /* Hack -- slide the objects */ ! object_copy(&st_ptr->stock[i], &st_ptr->stock[i-1]); } /* More stuff now */ st_ptr->stock_num++; ! /* Hack -- Insert the new item */ ! object_copy(&st_ptr->stock[slot], o_ptr); /* Return the location */ return (slot); *************** *** 996,1009 **** /* Slide the others up */ for (i = st_ptr->stock_num; i > slot; i--) { ! st_ptr->stock[i] = st_ptr->stock[i-1]; } /* More stuff now */ st_ptr->stock_num++; ! /* Insert the new item */ ! st_ptr->stock[slot] = *o_ptr; /* Return the location */ return (slot); --- 999,1013 ---- /* Slide the others up */ for (i = st_ptr->stock_num; i > slot; i--) { ! /* Hack -- slide the objects */ ! object_copy(&st_ptr->stock[i], &st_ptr->stock[i-1]); } /* More stuff now */ st_ptr->stock_num++; ! /* Hack -- Insert the new item */ ! object_copy(&st_ptr->stock[slot], o_ptr); /* Return the location */ return (slot); *************** *** 1140,1147 **** { int i, tries, level; ! object_type forge; ! object_type *q_ptr; /* Paranoia -- no room left */ --- 1144,1151 ---- { int i, tries, level; ! object_type *i_ptr; ! object_type object_type_body; /* Paranoia -- no room left */ *************** *** 1176,1214 **** /* Get local object */ ! q_ptr = &forge; /* Create a new object of the chosen kind */ ! object_prep(q_ptr, i); /* Apply some "low-level" magic (no artifacts) */ ! apply_magic(q_ptr, level, FALSE, FALSE, FALSE); /* Hack -- Charge lite's */ ! if (q_ptr->tval == TV_LITE) { ! if (q_ptr->sval == SV_LITE_TORCH) q_ptr->pval = FUEL_TORCH / 2; ! if (q_ptr->sval == SV_LITE_LANTERN) q_ptr->pval = FUEL_LAMP / 2; } /* The item is "known" */ ! object_known(q_ptr); /* Mega-Hack -- no chests in stores */ ! if (q_ptr->tval == TV_CHEST) continue; /* Prune the black market */ if (store_num == 6) { /* Hack -- No "crappy" items */ ! if (black_market_crap(q_ptr)) continue; /* Hack -- No "cheap" items */ ! if (object_value(q_ptr) < 10) continue; /* No "worthless" items */ ! /* if (object_value(q_ptr) <= 0) continue; */ } /* Prune normal stores */ --- 1180,1218 ---- /* Get local object */ ! i_ptr = &object_type_body; /* Create a new object of the chosen kind */ ! object_prep(i_ptr, i); /* Apply some "low-level" magic (no artifacts) */ ! apply_magic(i_ptr, level, FALSE, FALSE, FALSE); /* Hack -- Charge lite's */ ! if (i_ptr->tval == TV_LITE) { ! if (i_ptr->sval == SV_LITE_TORCH) i_ptr->pval = FUEL_TORCH / 2; ! if (i_ptr->sval == SV_LITE_LANTERN) i_ptr->pval = FUEL_LAMP / 2; } /* The item is "known" */ ! object_known(i_ptr); /* Mega-Hack -- no chests in stores */ ! 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; /* Hack -- No "cheap" items */ ! if (object_value(i_ptr) < 10) continue; /* No "worthless" items */ ! /* if (object_value(i_ptr) <= 0) continue; */ } /* Prune normal stores */ *************** *** 1215,1229 **** else { /* No "worthless" items */ ! if (object_value(q_ptr) <= 0) continue; } /* Mass produce and/or Apply discount */ ! mass_produce(q_ptr); /* Attempt to carry the (known) item */ ! (void)store_carry(q_ptr); /* Definitely done */ break; --- 1219,1233 ---- else { /* No "worthless" items */ ! if (object_value(i_ptr) <= 0) continue; } /* Mass produce and/or Apply discount */ ! mass_produce(i_ptr); /* Attempt to carry the (known) item */ ! (void)store_carry(i_ptr); /* Definitely done */ break; *************** *** 1316,1321 **** --- 1320,1327 ---- /* Describe an item in the home */ if (store_num == 7) { + byte attr; + maxwid = 75; /* Leave room for weights, if necessary -DRS- */ *************** *** 1324,1331 **** /* Describe the object */ object_desc(o_name, o_ptr, TRUE, 3); o_name[maxwid] = '\0'; - c_put_str(tval_to_attr[o_ptr->tval], o_name, i+6, 3); /* Show weights */ if (show_weights) { --- 1330,1345 ---- /* Describe the object */ object_desc(o_name, o_ptr, TRUE, 3); o_name[maxwid] = '\0'; + /* Acquire inventory color */ + attr = tval_to_attr[o_ptr->tval & 0x7F]; + + /* Disable inventory colors */ + if (!inventory_colors) attr = TERM_WHITE; + + /* Display the object */ + c_put_str(attr, o_name, i+6, 3); + /* Show weights */ if (show_weights) { *************** *** 1339,1344 **** --- 1353,1360 ---- /* Describe an item (fully) in a store */ else { + byte attr; + /* Must leave room for the "price" */ maxwid = 65; *************** *** 1348,1355 **** /* Describe the object (fully) */ object_desc_store(o_name, o_ptr, TRUE, 3); o_name[maxwid] = '\0'; - c_put_str(tval_to_attr[o_ptr->tval], o_name, i+6, 3); /* Show weights */ if (show_weights) { --- 1364,1379 ---- /* Describe the object (fully) */ object_desc_store(o_name, o_ptr, TRUE, 3); o_name[maxwid] = '\0'; + /* Acquire inventory color */ + attr = tval_to_attr[o_ptr->tval & 0x7F]; + + /* Disable inventory colors */ + if (!inventory_colors) attr = TERM_WHITE; + + /* Display the object */ + c_put_str(attr, o_name, i+6, 3); + /* Show weights */ if (show_weights) { *************** *** 1399,1406 **** /* ! * Displays a store's inventory -RAK- ! * All prices are listed as "per individual object". -BEN- */ static void display_inventory(void) { --- 1423,1431 ---- /* ! * Display a store's inventory ! * ! * All prices are listed as "per individual object" */ static void display_inventory(void) { *************** *** 1435,1441 **** /* ! * Displays players gold -RAK- */ static void store_prt_gold(void) { --- 1460,1466 ---- /* ! * Display players gold */ static void store_prt_gold(void) { *************** *** 1449,1455 **** /* ! * Displays store (after clearing screen) -RAK- */ static void display_store(void) { --- 1474,1480 ---- /* ! * Display store (after clearing screen) */ static void display_store(void) { *************** *** 1513,1521 **** /* ! * Get the ID of a store item and return its value -RAK- */ ! static int get_stock(int *com_val, cptr pmt, int i, int j) { char command; --- 1538,1548 ---- /* ! * Get the index of a store item ! * ! * Return TRUE if an item was selected */ ! static bool get_stock(int *com_val, cptr pmt, int i, int j) { char command; *************** *** 1567,1573 **** /* ! * Increase the insult counter and get angry if too many -RAK- */ static int increase_insults(void) { --- 1594,1600 ---- /* ! * Increase the insult counter and get angry if necessary */ static int increase_insults(void) { *************** *** 1598,1604 **** /* ! * Decrease insults -RAK- */ static void decrease_insults(void) { --- 1625,1631 ---- /* ! * Decrease the insult counter */ static void decrease_insults(void) { *************** *** 1608,1614 **** /* ! * Have insulted while haggling -RAK- */ static int haggle_insults(void) { --- 1635,1641 ---- /* ! * The shop-keeper has been insulted */ static int haggle_insults(void) { *************** *** 1781,1787 **** /* ! * Haggling routine -RAK- * * Return TRUE if purchase is NOT successful */ --- 1808,1814 ---- /* ! * Haggling routine XXX XXX * * Return TRUE if purchase is NOT successful */ *************** *** 1961,1967 **** /* ! * Haggling routine -RAK- * * Return TRUE if purchase is NOT successful */ --- 1988,1994 ---- /* ! * Haggling routine XXX XXX * * Return TRUE if purchase is NOT successful */ *************** *** 2161,2167 **** /* ! * Buy an item from a store -RAK- */ static void store_purchase(void) { --- 2188,2194 ---- /* ! * Buy an item from a store */ static void store_purchase(void) { *************** *** 2170,2180 **** s32b price, best; - object_type forge; - object_type *j_ptr; - object_type *o_ptr; char o_name[80]; char out_val[160]; --- 2197,2207 ---- s32b price, best; object_type *o_ptr; + object_type *i_ptr; + object_type object_type_body; + char o_name[80]; char out_val[160]; *************** *** 2218,2233 **** amt = 1; /* Get local object */ ! j_ptr = &forge; /* Get a copy of the object */ ! object_copy(j_ptr, o_ptr); /* Modify quantity */ ! j_ptr->number = amt; /* Hack -- require room in pack */ ! if (!inven_carry_okay(j_ptr)) { msg_print("You cannot carry that many different items."); return; --- 2245,2260 ---- amt = 1; /* Get local object */ ! i_ptr = &object_type_body; /* Get a copy of the object */ ! object_copy(i_ptr, o_ptr); /* Modify quantity */ ! i_ptr->number = amt; /* Hack -- require room in pack */ ! if (!inven_carry_okay(i_ptr)) { msg_print("You cannot carry that many different items."); return; *************** *** 2234,2240 **** } /* Determine the "best" price (per item) */ ! best = price_item(j_ptr, ot_ptr->min_inflate, FALSE); /* Find out how many the player wants */ if (o_ptr->number > 1) --- 2261,2267 ---- } /* Determine the "best" price (per item) */ ! best = price_item(i_ptr, ot_ptr->min_inflate, FALSE); /* Find out how many the player wants */ if (o_ptr->number > 1) *************** *** 2253,2268 **** } /* Get local object */ ! j_ptr = &forge; /* Get desired object */ ! object_copy(j_ptr, o_ptr); /* Modify quantity */ ! j_ptr->number = amt; /* Hack -- require room in pack */ ! if (!inven_carry_okay(j_ptr)) { msg_print("You cannot carry that many items."); return; --- 2280,2295 ---- } /* Get local object */ ! i_ptr = &object_type_body; /* Get desired object */ ! object_copy(i_ptr, o_ptr); /* Modify quantity */ ! i_ptr->number = amt; /* Hack -- require room in pack */ ! if (!inven_carry_okay(i_ptr)) { msg_print("You cannot carry that many items."); return; *************** *** 2278,2284 **** choice = 0; /* Go directly to the "best" deal */ ! price = (best * j_ptr->number); } /* Haggle for it */ --- 2305,2311 ---- choice = 0; /* Go directly to the "best" deal */ ! price = (best * i_ptr->number); } /* Haggle for it */ *************** *** 2285,2291 **** else { /* Describe the object (fully) */ ! object_desc_store(o_name, j_ptr, TRUE, 3); /* Message */ msg_format("Buying %s (%c).", o_name, I2A(item)); --- 2312,2318 ---- else { /* Describe the object (fully) */ ! object_desc_store(o_name, i_ptr, TRUE, 3); /* Message */ msg_format("Buying %s (%c).", o_name, I2A(item)); *************** *** 2292,2298 **** msg_print(NULL); /* Haggle for a final price */ ! choice = purchase_haggle(j_ptr, &price); /* Hack -- Got kicked out */ if (st_ptr->store_open >= turn) return; --- 2319,2325 ---- msg_print(NULL); /* Haggle for a final price */ ! choice = purchase_haggle(i_ptr, &price); /* Hack -- Got kicked out */ if (st_ptr->store_open >= turn) return; *************** *** 2303,2309 **** if (choice == 0) { /* Fix the item price (if "correctly" haggled) */ ! if (price == (best * j_ptr->number)) o_ptr->ident |= (IDENT_FIXED); /* Player can afford it */ if (p_ptr->au >= price) --- 2330,2336 ---- if (choice == 0) { /* Fix the item price (if "correctly" haggled) */ ! if (price == (best * i_ptr->number)) o_ptr->ident |= (IDENT_FIXED); /* Player can afford it */ if (p_ptr->au >= price) *************** *** 2321,2342 **** store_prt_gold(); /* Hack -- buying an item makes you aware of it */ ! object_aware(j_ptr); /* Hack -- clear the "fixed" flag from the item */ ! j_ptr->ident &= ~(IDENT_FIXED); /* Describe the transaction */ ! object_desc(o_name, j_ptr, TRUE, 3); /* Message */ msg_format("You bought %s for %ld gold.", o_name, (long)price); /* Erase the inscription */ ! j_ptr->note = 0; /* Give it to the player */ ! item_new = inven_carry(j_ptr, FALSE); /* Describe the final result */ object_desc(o_name, &inventory[item_new], TRUE, 3); --- 2348,2369 ---- store_prt_gold(); /* Hack -- buying an item makes you aware of it */ ! object_aware(i_ptr); /* Hack -- clear the "fixed" flag from the item */ ! i_ptr->ident &= ~(IDENT_FIXED); /* Describe the transaction */ ! object_desc(o_name, i_ptr, TRUE, 3); /* Message */ msg_format("You bought %s for %ld gold.", o_name, (long)price); /* Erase the inscription */ ! i_ptr->note = 0; /* Give it to the player */ ! item_new = inven_carry(i_ptr); /* Describe the final result */ object_desc(o_name, &inventory[item_new], TRUE, 3); *************** *** 2420,2426 **** else { /* Give it to the player */ ! item_new = inven_carry(j_ptr, FALSE); /* Describe just the result */ object_desc(o_name, &inventory[item_new], TRUE, 3); --- 2447,2453 ---- else { /* Give it to the player */ ! item_new = inven_carry(i_ptr); /* Describe just the result */ object_desc(o_name, &inventory[item_new], TRUE, 3); *************** *** 2475,2503 **** s32b price, value, dummy; - object_type forge; - object_type *q_ptr; - object_type *o_ptr; ! cptr pmt = "Sell which item? "; char o_name[80]; ! /* Prepare a prompt */ ! if (store_num == 7) pmt = "Drop which item? "; /* Only allow items the store will buy */ item_tester_hook = store_will_buy; - - /* Get an item (from equip or inven) */ - if (!get_item(&item, pmt, TRUE, TRUE, FALSE)) - { - if (item == -2) msg_print("You have nothing that I want."); - return; } /* Get the item (in the pack) */ if (item >= 0) { --- 2502,2534 ---- s32b price, value, dummy; object_type *o_ptr; ! object_type *i_ptr; ! object_type object_type_body; + cptr q, s; + char o_name[80]; ! /* Home */ ! q = "Drop which item? "; + /* Real store */ + if (store_num != 7) + { + /* New prompt */ + q = "Sell which item? "; + /* Only allow items the store will buy */ item_tester_hook = store_will_buy; } + /* Get an item */ + s = "You have nothing that I want."; + if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return; + /* Get the item (in the pack) */ if (item >= 0) { *************** *** 2536,2557 **** } /* Get local object */ ! q_ptr = &forge; /* Get a copy of the object */ ! object_copy(q_ptr, o_ptr); /* Modify quantity */ ! q_ptr->number = amt; /* Get a full description */ ! object_desc(o_name, q_ptr, TRUE, 3); /* Remove any inscription for stores */ ! if (store_num != 7) q_ptr->note = 0; /* Is there room in the store (or the home?) */ ! if (!store_check_num(q_ptr)) { if (store_num == 7) msg_print("Your home is full."); else msg_print("I have not the room in my store to keep it."); --- 2567,2588 ---- } /* Get local object */ ! i_ptr = &object_type_body; /* Get a copy of the object */ ! object_copy(i_ptr, o_ptr); /* Modify quantity */ ! i_ptr->number = amt; /* Get a full description */ ! 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."); else msg_print("I have not the room in my store to keep it."); *************** *** 2567,2573 **** msg_print(NULL); /* Haggle for it */ ! choice = sell_haggle(q_ptr, &price); /* Kicked out */ if (st_ptr->store_open >= turn) return; --- 2598,2604 ---- msg_print(NULL); /* Haggle for it */ ! choice = sell_haggle(i_ptr, &price); /* Kicked out */ if (st_ptr->store_open >= turn) return; *************** *** 2588,2594 **** store_prt_gold(); /* Get the "apparent" value */ ! dummy = object_value(q_ptr) * q_ptr->number; /* Identify original item */ object_aware(o_ptr); --- 2619,2625 ---- store_prt_gold(); /* Get the "apparent" value */ ! dummy = object_value(i_ptr) * i_ptr->number; /* Identify original item */ object_aware(o_ptr); *************** *** 2601,2619 **** p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER); /* Get local object */ ! q_ptr = &forge; /* Get a copy of the object */ ! object_copy(q_ptr, o_ptr); /* Modify quantity */ ! q_ptr->number = amt; /* Get the "actual" value */ ! value = object_value(q_ptr) * q_ptr->number; /* Get the description all over again */ ! object_desc(o_name, q_ptr, TRUE, 3); /* Describe the result (in message buffer) */ msg_format("You sold %s for %ld gold.", o_name, (long)price); --- 2632,2650 ---- p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER); /* Get local object */ ! i_ptr = &object_type_body; /* Get a copy of the object */ ! object_copy(i_ptr, o_ptr); /* Modify quantity */ ! i_ptr->number = amt; /* Get the "actual" value */ ! value = object_value(i_ptr) * i_ptr->number; /* Get the description all over again */ ! object_desc(o_name, i_ptr, TRUE, 3); /* Describe the result (in message buffer) */ msg_format("You sold %s for %ld gold.", o_name, (long)price); *************** *** 2630,2636 **** handle_stuff(); /* The store gets that (known) item */ ! item_pos = store_carry(q_ptr); /* Re-display if item is now in store */ if (item_pos >= 0) --- 2661,2667 ---- handle_stuff(); /* The store gets that (known) item */ ! item_pos = store_carry(i_ptr); /* Re-display if item is now in store */ if (item_pos >= 0) *************** *** 2656,2662 **** handle_stuff(); /* Let the home carry it */ ! item_pos = home_carry(q_ptr); /* Update store display */ if (item_pos >= 0) --- 2687,2693 ---- handle_stuff(); /* Let the home carry it */ ! item_pos = home_carry(i_ptr); /* Update store display */ if (item_pos >= 0) *************** *** 2800,2806 **** } /* Hack -- toggle windows */ ! case KTRL('I'): { toggle_inven_equip(); break; --- 2831,2837 ---- } /* Hack -- toggle windows */ ! case KTRL('E'): { toggle_inven_equip(); break; *************** *** 2838,2844 **** /* Help */ case '?': { ! do_cmd_help("help.hlp"); break; } --- 2869,2875 ---- /* Help */ case '?': { ! do_cmd_help(); break; } *************** *** 2939,2955 **** break; } ! /* Check artifacts */ case '~': - { - do_cmd_check_artifacts(); - break; - } - - /* Check uniques */ case '|': { ! do_cmd_check_uniques(); break; } --- 2970,2980 ---- break; } ! /* Check knowledge */ case '~': case '|': { ! do_cmd_knowledge(); break; } *************** *** 2998,3004 **** /* Access the player grid */ ! c_ptr = &cave[py][px]; /* Verify a store */ if (!((c_ptr->feat >= FEAT_SHOP_HEAD) && --- 3023,3029 ---- /* Access the player grid */ ! c_ptr = &cave[p_ptr->py][p_ptr->px]; /* Verify a store */ if (!((c_ptr->feat >= FEAT_SHOP_HEAD) && *************** *** 3142,3149 **** { int item_pos; ! object_type forge; ! object_type *q_ptr; char o_name[80]; --- 3167,3174 ---- { int item_pos; ! object_type *i_ptr; ! object_type object_type_body; char o_name[80]; *************** *** 3152,3164 **** msg_print("Your pack overflows!"); /* Get local object */ ! q_ptr = &forge; /* Grab a copy of the item */ ! object_copy(q_ptr, o_ptr); /* Describe it */ ! object_desc(o_name, q_ptr, TRUE, 3); /* Message */ msg_format("You drop %s (%c).", o_name, index_to_label(item)); --- 3177,3189 ---- msg_print("Your pack overflows!"); /* Get local object */ ! i_ptr = &object_type_body; /* Grab a copy of the item */ ! object_copy(i_ptr, o_ptr); /* Describe it */ ! object_desc(o_name, i_ptr, TRUE, 3); /* Message */ msg_format("You drop %s (%c).", o_name, index_to_label(item)); *************** *** 3172,3178 **** handle_stuff(); /* Let the home carry it */ ! item_pos = home_carry(q_ptr); /* Redraw the home */ if (item_pos >= 0) --- 3197,3203 ---- handle_stuff(); /* Let the home carry it */ ! item_pos = home_carry(i_ptr); /* Redraw the home */ if (item_pos >= 0) Only in angband-281/src: store.o diff -r -c -w src-281/tables.c angband-281/src/tables.c *** src-281/tables.c Thu Mar 6 21:47:06 1997 --- angband-281/src/tables.c Thu Apr 24 10:37:04 1997 *************** *** 2634,2656 **** { &ring_bell, TRUE, 1, 0, 14, "ring_bell", "Audible bell (on errors, etc)" }, ! { &use_color, TRUE, 1, 0, 15, ! "use_color", "Use color if possible (slow)" }, /*** Disturbance ***/ ! { &find_ignore_stairs, TRUE, 2, 0, 16, ! "find_ignore_stairs", "Run past stairs" }, ! { &find_ignore_doors, TRUE, 2, 0, 17, ! "find_ignore_doors", "Run through open doors" }, ! { &find_cut, TRUE, 2, 0, 18, ! "find_cut", "Run past known corners" }, ! { &find_examine, TRUE, 2, 0, 19, ! "find_examine", "Run into potential corners" }, { &disturb_move, TRUE, 2, 0, 20, "disturb_move", "Disturb whenever any monster moves" }, --- 2634,2656 ---- { &ring_bell, TRUE, 1, 0, 14, "ring_bell", "Audible bell (on errors, etc)" }, ! { &inventory_colors, TRUE, 1, 0, 15, ! "inventory_colors", "Use color for inventory listings" }, /*** Disturbance ***/ ! { &run_ignore_stairs, TRUE, 2, 0, 16, ! "run_ignore_stairs", "When running, ignore stairs" }, ! { &run_ignore_doors, TRUE, 2, 0, 17, ! "run_ignore_doors", "When running, ignore doors" }, ! { &run_cut_corners, TRUE, 2, 0, 18, ! "run_cut_corners", "When running, cut corners" }, ! { &run_use_corners, TRUE, 2, 0, 19, ! "run_use_corners", "When running, use corners" }, { &disturb_move, TRUE, 2, 0, 20, "disturb_move", "Disturb whenever any monster moves" }, Only in angband-281/src: tables.o diff -r -c -w src-281/types.h angband-281/src/types.h *** src-281/types.h Mon Mar 3 22:38:31 1997 --- angband-281/src/types.h Thu Apr 24 10:37:22 1997 *************** *** 890,903 **** * * This stucture gives us a large collection of player variables. * ! * This structure contains several "blocks" of information. ! * (1) the "permanent" info ! * (2) the "variable" info ! * (3) the "transient" info * ! * All of the "permanent" info, and most of the "variable" info, ! * is saved in the savefile. The "transient" info is recomputed ! * whenever anything important changes. */ typedef struct player_type player_type; --- 890,900 ---- * * This stucture gives us a large collection of player variables. * ! * This entire structure is wiped when a new character is born. * ! * This structure is more or less laid out so that the information ! * which must be saved in the savefile precedes all the information ! * which can be recomputed as needed. */ typedef struct player_type player_type; *************** *** 904,909 **** --- 901,914 ---- struct player_type { + char full_name[32]; /* Full name */ + char base_name[32]; /* Base name */ + char died_from[80]; /* Cause of death */ + char history[4][60]; /* Initial history */ + + s16b py; /* Player location */ + s16b px; /* Player location */ + byte psex; /* Sex index */ byte prace; /* Race index */ byte pclass; /* Class index */ *************** *** 920,934 **** s16b wt; /* Weight */ s16b sc; /* Social Class */ - s32b au; /* Current Gold */ s32b max_exp; /* Max experience */ s32b exp; /* Cur experience */ u16b exp_frac; /* Cur exp frac (times 2^16) */ - s16b lev; /* Level */ - s16b mhp; /* Max hit pts */ s16b chp; /* Cur hit pts */ u16b chp_frac; /* Cur hit frac (times 2^16) */ --- 925,942 ---- s16b wt; /* Weight */ s16b sc; /* Social Class */ s32b au; /* Current Gold */ + s16b max_depth; /* Max depth */ + s16b depth; /* Cur depth */ + + s16b max_lev; /* Max level */ + s16b lev; /* Cur level */ + s32b max_exp; /* Max experience */ s32b exp; /* Cur experience */ u16b exp_frac; /* Cur exp frac (times 2^16) */ s16b mhp; /* Max hit pts */ s16b chp; /* Cur hit pts */ u16b chp_frac; /* Cur hit frac (times 2^16) */ *************** *** 937,945 **** s16b csp; /* Cur mana pts */ u16b csp_frac; /* Cur mana frac (times 2^16) */ - s16b max_plv; /* Max Player Level */ - s16b max_dlv; /* Max level explored */ - s16b stat_max[6]; /* Current "maximal" stat values */ s16b stat_cur[6]; /* Current "natural" stat values */ --- 945,950 ---- *************** *** 978,983 **** --- 983,1004 ---- byte confusing; /* Glowing hands */ byte searching; /* Currently searching */ + u32b spell_learned1; /* Spell flags */ + u32b spell_learned2; /* Spell flags */ + u32b spell_worked1; /* Spell flags */ + u32b spell_worked2; /* Spell flags */ + u32b spell_forgotten1; /* Spell flags */ + u32b spell_forgotten2; /* Spell flags */ + + byte spell_order[64]; /* Spell order */ + + s16b player_hp[PY_MAX_LEVEL]; /* HP Array */ + + /*** Temporary fields ***/ + + s16b running; /* Running counter */ + s16b resting; /* Resting counter */ + s16b new_spells; /* Number of spells available */ s16b old_spells; *************** *** 993,999 **** s16b old_food_aux; /* Old value of food */ - bool cumber_armor; /* Mana draining armor */ bool cumber_glove; /* Mana draining gloves */ bool heavy_wield; /* Heavy weapon */ --- 1014,1019 ---- *************** *** 1002,1008 **** s16b cur_lite; /* Radius of lite (if any) */ - u32b notice; /* Special Updates (bit flags) */ u32b update; /* Pending Updates (bit flags) */ u32b redraw; /* Normal Redraws (bit flags) */ --- 1022,1027 ---- *************** *** 1011,1017 **** s16b stat_use[6]; /* Current modified stats */ s16b stat_top[6]; /* Maximal modified stats */ ! s16b stat_add[6]; /* Modifiers to stat values */ s16b stat_ind[6]; /* Indexes into stat tables */ bool immune_acid; /* Immunity to acid */ --- 1030,1038 ---- 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 */ *************** *** 1025,1041 **** bool resist_cold; /* Resist cold */ bool resist_pois; /* Resist poison */ ! bool resist_conf; /* Resist confusion */ ! bool resist_sound; /* Resist sound */ bool resist_lite; /* Resist light */ bool resist_dark; /* Resist darkness */ ! bool resist_chaos; /* Resist chaos */ ! bool resist_disen; /* Resist disenchant */ bool resist_shard; /* Resist shards */ bool resist_nexus; /* Resist nexus */ ! bool resist_blind; /* Resist blindness */ ! bool resist_neth; /* Resist nether */ ! bool resist_fear; /* Resist fear */ bool sustain_str; /* Keep strength */ bool sustain_int; /* Keep intelligence */ --- 1046,1062 ---- bool resist_cold; /* Resist cold */ bool resist_pois; /* Resist poison */ ! bool resist_fear; /* Resist fear */ bool resist_lite; /* Resist light */ bool resist_dark; /* Resist darkness */ ! bool resist_blind; /* Resist blindness */ ! bool resist_confu; /* Resist confusion */ ! bool resist_sound; /* Resist sound */ bool resist_shard; /* Resist shards */ bool resist_nexus; /* Resist nexus */ ! bool resist_nethr; /* Resist nether */ ! bool resist_chaos; /* Resist chaos */ ! bool resist_disen; /* Resist disenchant */ bool sustain_str; /* Keep strength */ bool sustain_int; /* Keep intelligence */ *************** *** 1044,1065 **** bool sustain_con; /* Keep constitution */ bool sustain_chr; /* Keep charisma */ bool aggravate; /* Aggravate monsters */ bool teleport; /* Random teleporting */ - bool exp_drain; /* Experience draining */ - bool ffall; /* No damage falling */ - bool lite; /* Permanent light */ - bool free_act; /* Never paralyzed */ - bool see_inv; /* Can see invisible */ - bool regenerate; /* Regenerate hit pts */ - bool hold_life; /* Resist life draining */ - bool telepathy; /* Telepathy */ - bool slow_digest; /* Slower digestion */ bool bless_blade; /* Blessed blade */ - bool xtra_might; /* Extra might bow */ - bool impact; /* Earthquake blows */ s16b dis_to_h; /* Known bonus to hit */ s16b dis_to_d; /* Known bonus to dam */ --- 1065,1085 ---- bool sustain_con; /* Keep constitution */ bool sustain_chr; /* Keep charisma */ + bool slow_digest; /* Slower digestion */ + bool ffall; /* Feather falling */ + bool lite; /* Permanent light */ + bool regenerate; /* Regeneration */ + bool telepathy; /* Telepathy */ + bool see_inv; /* See invisible */ + bool free_act; /* Free action */ + bool hold_life; /* Hold life */ + + bool impact; /* Earthquake blows */ bool aggravate; /* Aggravate monsters */ bool teleport; /* Random teleporting */ bool exp_drain; /* Experience draining */ bool bless_blade; /* Blessed blade */ s16b dis_to_h; /* Known bonus to hit */ s16b dis_to_d; /* Known bonus to dam */ *************** *** 1086,1097 **** s16b skill_tht; /* Skill: To hit (throwing) */ s16b skill_dig; /* Skill: Digging */ s16b num_blow; /* Number of blows */ s16b num_fire; /* Number of shots */ ! byte tval_xtra; /* Correct xtra tval */ ! byte tval_ammo; /* Correct ammo tval */ s16b pspeed; /* Current speed */ }; --- 1106,1119 ---- s16b skill_tht; /* Skill: To hit (throwing) */ s16b skill_dig; /* Skill: Digging */ + u32b noise; /* Derived from stealth */ + s16b num_blow; /* Number of blows */ s16b num_fire; /* Number of shots */ ! byte ammo_mult; /* Ammo multiplier */ ! byte ammo_tval; /* Ammo variety */ s16b pspeed; /* Current speed */ }; diff -r -c -w src-281/util.c angband-281/src/util.c *** src-281/util.c Fri Mar 7 15:31:14 1997 --- angband-281/src/util.c Thu Apr 24 10:37:50 1997 *************** *** 113,119 **** */ void user_name(char *buf, int id) { - #if 0 struct passwd *pw; /* Look up the user name */ --- 113,118 ---- *************** *** 129,135 **** return; } - #endif /* Oops. Hack -- default to "PLAYER" */ strcpy(buf, "PLAYER"); --- 128,133 ---- *************** *** 573,584 **** * This function should fail if the file already exists * * Note that we assume that the file should be "binary" - * - * XXX XXX XXX The horrible "BEN_HACK" code is for compiling under - * the CodeWarrior compiler, in which case, for some reason, none - * of the "O_*" flags are defined, and we must fake the definition - * of "O_RDONLY", "O_WRONLY", and "O_RDWR" in "A-win-h", and then - * we must simulate the effect of the proper "open()" call below. */ int fd_make(cptr file, int mode) { --- 571,576 ---- *************** *** 587,610 **** /* Hack -- Try to parse the path */ if (path_parse(buf, 1024, file)) return (-1); - #ifdef BEN_HACK - - /* Check for existance */ - /* if (fd_close(fd_open(file, O_RDONLY | O_BINARY))) return (1); */ - - /* Mega-Hack -- Create the file */ - (void)my_fclose(my_fopen(file, "wb")); - - /* Re-open the file for writing */ - return (open(buf, O_WRONLY | O_BINARY, mode)); - - #else /* BEN_HACK */ - /* Create the file, fail if exists, write-only, binary */ return (open(buf, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, mode)); - - #endif /* BEN_HACK */ - } --- 579,586 ---- *************** *** 2341,2349 **** { byte a = TERM_L_BLUE; - /* Hack -- fake monochrome */ - if (!use_color) a = TERM_WHITE; - /* Pause for response */ Term_putstr(x, 0, -1, a, "-more-"); --- 2317,2322 ---- *************** *** 2530,2542 **** */ void c_put_str(byte attr, cptr str, int row, int col) { - /* Hack -- fake monochrome */ - if (!use_color) attr = TERM_WHITE; - /* Position cursor, Dump the attr/text */ Term_putstr(col, row, -1, attr, str); } /* * As above, but in "white" */ --- 2503,2513 ---- */ void c_put_str(byte attr, cptr str, int row, int col) { /* Position cursor, Dump the attr/text */ Term_putstr(col, row, -1, attr, str); } + /* * As above, but in "white" */ *************** *** 2554,2562 **** */ void c_prt(byte attr, cptr str, int row, int col) { - /* Hack -- fake monochrome */ - if (!use_color) attr = TERM_WHITE; - /* Clear line, position cursor */ Term_erase(col, row, 255); --- 2525,2530 ---- *************** *** 2564,2569 **** --- 2532,2538 ---- Term_addstr(-1, attr, str); } + /* * As above, but in "white" */ *************** *** 2599,2608 **** cptr s; - /* Hack -- fake monochrome */ - if (!use_color) a = TERM_WHITE; - - /* Obtain the size */ (void)Term_get_size(&w, &h); --- 2568,2573 ---- *************** *** 2920,2938 **** /* ! * Request a "quantity" from the user * ! * Hack -- allow "command_arg" to specify a quantity */ s16b get_quantity(cptr prompt, int max) { ! int amt; - char tmp[80]; - - char buf[80]; - - /* Use "command_arg" */ if (command_arg) { --- 2885,2904 ---- /* ! * Obtain a "quantity" (from the user) * ! * The quantity will always be one, unless "command_arg" is set, ! * in which case the quantity will be the lesser of "command_arg" ! * and "max". ! * ! * The user is no longer asked to supply a quantity, so "prompt" ! * is not used, and the "repeat count" method must be used to act ! * on multiple items at once. XXX XXX XXX */ s16b get_quantity(cptr prompt, int max) { ! int amt = 1; /* Use "command_arg" */ if (command_arg) { *************** *** 2944,2988 **** /* Enforce the maximum */ if (amt > max) amt = max; - - /* Use it */ - return (amt); } ! ! /* Build a prompt if needed */ ! if (!prompt) ! { ! /* Build a prompt */ ! sprintf(tmp, "Quantity (1-%d): ", max); ! ! /* Use that prompt */ ! prompt = tmp; ! } ! ! ! /* Default to one */ ! amt = 1; ! ! /* Build the default */ ! sprintf(buf, "%d", amt); ! ! /* Ask for a quantity */ ! if (!get_string(prompt, buf, 6)) return (0); ! ! /* Extract a number */ ! amt = atoi(buf); ! ! /* A letter means "all" */ ! if (isalpha(buf[0])) amt = max; ! ! /* Enforce the maximum */ ! if (amt > max) amt = max; ! ! /* Enforce the minimum */ ! if (amt < 0) amt = 0; ! ! /* Return the result */ return (amt); } --- 2910,2918 ---- /* Enforce the maximum */ if (amt > max) amt = max; } ! /* Result */ return (amt); } Only in angband-281/src: util.o diff -r -c -w src-281/variable.c angband-281/src/variable.c *** src-281/variable.c Mon Mar 3 22:39:08 1997 --- angband-281/src/variable.c Thu Apr 24 10:38:02 1997 *************** *** 99,110 **** bool death; /* True if player has died */ - s16b running; /* Current counter for running, if any */ - s16b resting; /* Current counter for resting, if any */ - s16b cur_hgt; /* Current dungeon height */ s16b cur_wid; /* Current dungeon width */ - s16b dun_level; /* Current dungeon level */ s16b num_repro; /* Current reproducer count */ s16b object_level; /* Current object creation level */ s16b monster_level; /* Current monster creation level */ --- 99,106 ---- *************** *** 136,143 **** bool shimmer_monsters; /* Hack -- optimize multi-hued monsters */ bool shimmer_objects; /* Hack -- optimize multi-hued objects */ ! bool repair_monsters; /* Hack -- optimize detect monsters */ ! bool repair_objects; /* Hack -- optimize detect objects */ s16b total_weight; /* Total weight being carried */ --- 132,141 ---- bool shimmer_monsters; /* Hack -- optimize multi-hued monsters */ bool shimmer_objects; /* Hack -- optimize multi-hued objects */ ! bool repair_mflag_born; /* Hack -- repair monster flags (born) */ ! bool repair_mflag_nice; /* Hack -- repair monster flags (nice) */ ! bool repair_mflag_show; /* Hack -- repair monster flags (show) */ ! bool repair_mflag_mark; /* Hack -- repair monster flags (mark) */ s16b total_weight; /* Total weight being carried */ *************** *** 152,160 **** s16b m_max = 1; /* Number of allocated monsters */ s16b m_cnt = 0; /* Number of live monsters */ - s16b hack_m_idx = 0; /* Hack -- see "process_monsters()" */ - /* * Software options (set via the '=' command). See "tables.c" */ --- 150,156 ---- *************** *** 180,194 **** bool show_details; /* Show details in certain sub-windows */ bool ring_bell; /* Ring the bell (on errors, etc) */ ! bool use_color; /* Use color if possible (slow) */ /* Option Set 2 -- Disturbance */ ! bool find_ignore_stairs; /* Run past stairs */ ! bool find_ignore_doors; /* Run through open doors */ ! bool find_cut; /* Run past known corners */ ! bool find_examine; /* Run into potential corners */ bool disturb_move; /* Disturb whenever any monster moves */ bool disturb_near; /* Disturb whenever viewable monster moves */ --- 176,190 ---- bool show_details; /* Show details in certain sub-windows */ bool ring_bell; /* Ring the bell (on errors, etc) */ ! bool inventory_colors; /* Use color for inventory listings */ /* Option Set 2 -- Disturbance */ ! bool run_ignore_stairs; /* When running, ignore stairs */ ! bool run_ignore_doors; /* When running, ignore doors */ ! bool run_cut_corners; /* When running, cut corners */ ! bool run_use_corners; /* When running, use corners */ bool disturb_move; /* Disturb whenever any monster moves */ bool disturb_near; /* Disturb whenever viewable monster moves */ *************** *** 305,316 **** s16b panel_col_prt, panel_row_prt; /* - * Player location in dungeon - */ - s16b py; - s16b px; - - /* * Targetting variables */ s16b target_who; --- 301,306 ---- *************** *** 341,367 **** int player_euid; int player_egid; - /* - * Current player's character name - */ - char player_name[32]; /* - * Stripped version of "player_name" - */ - char player_base[32]; - - /* - * What killed the player - */ - char died_from[80]; - - /* - * Hack -- Textual "history" for the Player - */ - char history[4][60]; - - /* * Buffer to hold the current savefile name */ char savefile[1024]; --- 331,338 ---- *************** *** 614,624 **** /* ! * Specify attr/char pairs for inventory items (by tval) * Be sure to use "index & 0x7F" to avoid illegal access */ byte tval_to_attr[128]; - char tval_to_char[128]; /* * Simple keymap method, see "init.c" and "cmd6.c". --- 585,594 ---- /* ! * Specify color for inventory item text display (by tval) * Be sure to use "index & 0x7F" to avoid illegal access */ byte tval_to_attr[128]; /* * Simple keymap method, see "init.c" and "cmd6.c". *************** *** 632,645 **** /*** Player information ***/ /* ! * Static player info record */ ! static player_type p_body; /* * Pointer to the player info */ ! player_type *p_ptr = &p_body; /* * Pointer to the player tables --- 602,615 ---- /*** Player information ***/ /* ! * The player info record (static) */ ! static player_type player_type_body; /* * Pointer to the player info */ ! player_type *p_ptr = &player_type_body; /* * Pointer to the player tables *************** *** 651,677 **** player_magic *mp_ptr; - /* - * More spell info - */ - u32b spell_learned1; /* bit mask of spells learned */ - u32b spell_learned2; /* bit mask of spells learned */ - u32b spell_worked1; /* bit mask of spells tried and worked */ - u32b spell_worked2; /* bit mask of spells tried and worked */ - u32b spell_forgotten1; /* bit mask of spells learned but forgotten */ - u32b spell_forgotten2; /* bit mask of spells learned but forgotten */ - byte spell_order[64]; /* order spells learned/remembered/forgotten */ - - - /* - * Calculated base hp values for player at each level, - * store them so that drain life + restore life does not - * affect hit points. Also prevents shameless use of backup - * savefiles for hitpoint acquirement. - */ - s16b player_hp[PY_MAX_LEVEL]; - - /* * The vault generation arrays */ --- 621,626 ---- Only in angband-281/src: variable.o diff -r -c -w src-281/wizard1.c angband-281/src/wizard1.c *** src-281/wizard1.c Mon Mar 3 22:39:25 1997 --- angband-281/src/wizard1.c Thu Apr 24 10:38:20 1997 *************** *** 1,6 **** /* File: wizard1.c */ ! /* Purpose: Spoiler generation -BEN- */ #include "angband.h" --- 1,6 ---- /* File: wizard1.c */ ! /* Purpose: Spoiler file generation -BEN- */ #include "angband.h" *************** *** 124,152 **** */ static void kind_info(char *buf, char *dam, char *wgt, int *lev, s32b *val, int k) { - object_type forge; - object_type *q_ptr; - object_kind *k_ptr; /* Get local object */ ! q_ptr = &forge; /* Prepare a fake item */ ! object_prep(q_ptr, k); /* Obtain the "kind" info */ ! k_ptr = &k_info[q_ptr->k_idx]; /* It is known */ ! q_ptr->ident |= (IDENT_KNOWN); /* Cancel bonuses */ ! q_ptr->pval = 0; ! q_ptr->to_a = 0; ! q_ptr->to_h = 0; ! q_ptr->to_d = 0; /* Level */ --- 124,152 ---- */ static void kind_info(char *buf, char *dam, char *wgt, int *lev, s32b *val, int k) { object_kind *k_ptr; + object_type *i_ptr; + object_type object_type_body; + /* Get local object */ ! i_ptr = &object_type_body; /* Prepare a fake item */ ! object_prep(i_ptr, k); /* Obtain the "kind" info */ ! k_ptr = &k_info[i_ptr->k_idx]; /* It is known */ ! i_ptr->ident |= (IDENT_KNOWN); /* Cancel bonuses */ ! i_ptr->pval = 0; ! i_ptr->to_a = 0; ! i_ptr->to_h = 0; ! i_ptr->to_d = 0; /* Level */ *************** *** 153,159 **** (*lev) = k_ptr->level; /* Value */ ! (*val) = object_value(q_ptr); /* Hack */ --- 153,159 ---- (*lev) = k_ptr->level; /* Value */ ! (*val) = object_value(i_ptr); /* Hack */ *************** *** 161,167 **** /* Description (too brief) */ ! object_desc_store(buf, q_ptr, FALSE, 0); /* Misc info */ --- 161,167 ---- /* Description (too brief) */ ! object_desc_store(buf, i_ptr, FALSE, 0); /* Misc info */ *************** *** 168,174 **** strcpy(dam, ""); /* Damage */ ! switch (q_ptr->tval) { /* Bows */ case TV_BOW: --- 168,174 ---- strcpy(dam, ""); /* Damage */ ! switch (i_ptr->tval) { /* Bows */ case TV_BOW: *************** *** 181,187 **** case TV_BOLT: case TV_ARROW: { ! sprintf(dam, "%dd%d", q_ptr->dd, q_ptr->ds); break; } --- 181,187 ---- case TV_BOLT: case TV_ARROW: { ! sprintf(dam, "%dd%d", i_ptr->dd, i_ptr->ds); break; } *************** *** 191,197 **** case TV_SWORD: case TV_DIGGING: { ! sprintf(dam, "%dd%d", q_ptr->dd, q_ptr->ds); break; } --- 191,197 ---- case TV_SWORD: case TV_DIGGING: { ! sprintf(dam, "%dd%d", i_ptr->dd, i_ptr->ds); break; } *************** *** 206,212 **** case TV_HARD_ARMOR: case TV_DRAG_ARMOR: { ! sprintf(dam, "%d", q_ptr->ac); break; } } --- 206,212 ---- case TV_HARD_ARMOR: case TV_DRAG_ARMOR: { ! sprintf(dam, "%d", i_ptr->ac); break; } } *************** *** 213,219 **** /* Weight */ ! sprintf(wgt, "%3d.%d", q_ptr->weight / 10, q_ptr->weight % 10); } --- 213,219 ---- /* Weight */ ! sprintf(wgt, "%3d.%d", i_ptr->weight / 10, i_ptr->weight % 10); } *************** *** 452,459 **** { TR1_SEARCH, "Searching" }, { TR1_INFRA, "Infravision" }, { TR1_TUNNEL, "Tunneling" }, { TR1_BLOWS, "Attacks" }, ! { TR1_SPEED, "Speed" } }; /* --- 452,461 ---- { TR1_SEARCH, "Searching" }, { TR1_INFRA, "Infravision" }, { TR1_TUNNEL, "Tunneling" }, + { TR1_SPEED, "Speed" }, { TR1_BLOWS, "Attacks" }, ! { TR1_SHOTS, "Shots" }, ! { TR1_MIGHT, "Might" } }; /* *************** *** 475,485 **** /* * Elemental brands for weapons - * - * Clearly, TR1_IMPACT is a bit out of place here. To simplify - * coding, it has been included here along with the elemental - * brands. It does seem to fit in with the brands and slaying - * more than the miscellaneous section. */ static flag_desc brand_flags_desc[] = { --- 477,482 ---- *************** *** 487,498 **** { TR1_BRAND_ELEC, "Lightning Brand" }, { TR1_BRAND_FIRE, "Flame Tongue" }, { TR1_BRAND_COLD, "Frost Brand" }, - - { TR1_IMPACT, "Earthquake impact on hit" }, }; /* ! * The 15 resistables */ static const flag_desc resist_flags_desc[] = --- 484,493 ---- { TR1_BRAND_ELEC, "Lightning Brand" }, { TR1_BRAND_FIRE, "Flame Tongue" }, { TR1_BRAND_COLD, "Frost Brand" }, }; /* ! * The basic resistances */ static const flag_desc resist_flags_desc[] = *************** *** 502,515 **** { TR2_RES_FIRE, "Fire" }, { TR2_RES_COLD, "Cold" }, { TR2_RES_POIS, "Poison" }, { TR2_RES_LITE, "Light" }, { TR2_RES_DARK, "Dark" }, { TR2_RES_BLIND, "Blindness" }, ! { TR2_RES_CONF, "Confusion" }, { TR2_RES_SOUND, "Sound" }, ! { TR2_RES_SHARDS, "Shards" }, ! { TR2_RES_NETHER, "Nether" }, { TR2_RES_NEXUS, "Nexus" }, { TR2_RES_CHAOS, "Chaos" }, { TR2_RES_DISEN, "Disenchantment" }, }; --- 497,511 ---- { TR2_RES_FIRE, "Fire" }, { TR2_RES_COLD, "Cold" }, { TR2_RES_POIS, "Poison" }, + { TR2_RES_FEAR, "Fear" }, { TR2_RES_LITE, "Light" }, { TR2_RES_DARK, "Dark" }, { TR2_RES_BLIND, "Blindness" }, ! { TR2_RES_CONFU, "Confusion" }, { TR2_RES_SOUND, "Sound" }, ! { TR2_RES_SHARD, "Shards" }, { TR2_RES_NEXUS, "Nexus" }, + { TR2_RES_NETHR, "Nether" }, { TR2_RES_CHAOS, "Chaos" }, { TR2_RES_DISEN, "Disenchantment" }, }; *************** *** 541,556 **** }; /* - * Miscellaneous magic given by an object's "flags2" field - */ - - static const flag_desc misc_flags2_desc[] = - { - { TR2_FREE_ACT, "Free Action" }, - { TR2_HOLD_LIFE, "Hold Life" }, - }; - - /* * Miscellaneous magic given by an object's "flags3" field * * Note that cursed artifacts and objects with permanent light --- 537,542 ---- *************** *** 559,573 **** static const flag_desc misc_flags3_desc[] = { - { TR3_FEATHER, "Feather Falling" }, - { TR3_SEE_INVIS, "See Invisible" }, - { TR3_TELEPATHY, "ESP" }, { TR3_SLOW_DIGEST, "Slow Digestion" }, { TR3_REGEN, "Regeneration" }, ! { TR3_XTRA_SHOTS, "+1 Extra Shot" }, /* always +1? */ ! { TR3_DRAIN_EXP, "Drains Experience" }, ! { TR3_AGGRAVATE, "Aggravates" }, { TR3_BLESSED, "Blessed Blade" }, }; /* --- 545,562 ---- static const flag_desc misc_flags3_desc[] = { { TR3_SLOW_DIGEST, "Slow Digestion" }, + { TR3_FEATHER, "Feather Falling" }, + { TR3_LITE, "Permanent Light" }, { TR3_REGEN, "Regeneration" }, ! { TR3_TELEPATHY, "ESP" }, ! { TR3_SEE_INVIS, "See Invisible" }, ! { TR3_FREE_ACT, "Free Action" }, ! { TR3_HOLD_LIFE, "Hold Life" }, { TR3_BLESSED, "Blessed Blade" }, + { TR3_IMPACT, "Earthquake impact on hit" }, + { TR3_AGGRAVATE, "Aggravates" }, + { TR3_DRAIN_EXP, "Drains Experience" } }; /* *************** *** 633,639 **** cptr sustains[N_ELEMENTS(sustain_flags_desc) - 1 + 1]; /* A list of various magical qualities an object may have */ ! cptr misc_magic[N_ELEMENTS(misc_flags2_desc) + N_ELEMENTS(misc_flags3_desc) + 1 /* Permanent Light */ + 1 /* type of curse */ + 1]; /* sentinel NULL */ --- 622,628 ---- cptr sustains[N_ELEMENTS(sustain_flags_desc) - 1 + 1]; /* A list of various magical qualities an object may have */ ! cptr misc_magic[N_ELEMENTS(misc_flags3_desc) + 1 /* Permanent Light */ + 1 /* type of curse */ + 1]; /* sentinel NULL */ *************** *** 687,706 **** * The possibly updated description pointer is returned. */ ! static cptr *spoiler_flag_aux(const u32b art_flags, const flag_desc *flag_ptr, ! cptr *desc_ptr, const int n_elmnts) { int i; for (i = 0; i < n_elmnts; ++i) { ! if (art_flags & flag_ptr[i].flag) { ! *desc_ptr++ = flag_ptr[i].desc; } } ! return desc_ptr; } --- 676,695 ---- * The possibly updated description pointer is returned. */ ! static cptr *spoiler_flag_aux(const u32b art_flags, const flag_desc *flag_x_ptr, ! cptr *desc_x_ptr, const int n_elmnts) { int i; for (i = 0; i < n_elmnts; ++i) { ! if (art_flags & flag_x_ptr[i].flag) { ! *desc_x_ptr++ = flag_x_ptr[i].desc; } } ! return desc_x_ptr; } *************** *** 707,716 **** /* * Acquire a "basic" description "The Cloak of Death [1,+10]" */ ! static void analyze_general (object_type *o_ptr, char *desc_ptr) { /* Get a "useful" description of the object */ ! object_desc_store(desc_ptr, o_ptr, TRUE, 1); } /* --- 696,705 ---- /* * Acquire a "basic" description "The Cloak of Death [1,+10]" */ ! static void analyze_general (object_type *o_ptr, char *desc_x_ptr) { /* Get a "useful" description of the object */ ! object_desc_store(desc_x_ptr, o_ptr, TRUE, 1); } /* *************** *** 718,724 **** * speed, infravision, tunneling, stealth, searching, and extra attacks. */ ! static void analyze_pval (object_type *o_ptr, pval_info_type *p_ptr) { const u32b all_stats = (TR1_STR | TR1_INT | TR1_WIS | TR1_DEX | TR1_CON | TR1_CHR); --- 707,713 ---- * speed, infravision, tunneling, stealth, searching, and extra attacks. */ ! static void analyze_pval (object_type *o_ptr, pval_info_type *pval_x_ptr) { const u32b all_stats = (TR1_STR | TR1_INT | TR1_WIS | TR1_DEX | TR1_CON | TR1_CHR); *************** *** 731,737 **** if (!o_ptr->pval) { /* An "empty" pval description indicates that pval == 0 */ ! p_ptr->pval_desc[0] = '\0'; return; } --- 720,726 ---- if (!o_ptr->pval) { /* An "empty" pval description indicates that pval == 0 */ ! pval_x_ptr->pval_desc[0] = '\0'; return; } *************** *** 738,747 **** /* Extract the flags */ object_flags(o_ptr, &f1, &f2, &f3); ! affects_list = p_ptr->pval_affects; /* Create the "+N" string */ ! sprintf(p_ptr->pval_desc, "%s%d", POSITIZE(o_ptr->pval), o_ptr->pval); /* First, check to see if the pval affects all stats */ if ((f1 & all_stats) == all_stats) --- 727,736 ---- /* Extract the flags */ object_flags(o_ptr, &f1, &f2, &f3); ! affects_list = pval_x_ptr->pval_affects; /* Create the "+N" string */ ! sprintf(pval_x_ptr->pval_desc, "%s%d", POSITIZE(o_ptr->pval), o_ptr->pval); /* First, check to see if the pval affects all stats */ if ((f1 & all_stats) == all_stats) *************** *** 869,877 **** object_flags(o_ptr, &f1, &f2, &f3); ! misc_list = spoiler_flag_aux(f2, misc_flags2_desc, misc_list, ! N_ELEMENTS(misc_flags2_desc)); ! misc_list = spoiler_flag_aux(f3, misc_flags3_desc, misc_list, N_ELEMENTS(misc_flags3_desc)); --- 858,866 ---- object_flags(o_ptr, &f1, &f2, &f3); ! /* ! * Special flags ! */ misc_list = spoiler_flag_aux(f3, misc_flags3_desc, misc_list, N_ELEMENTS(misc_flags3_desc)); *************** *** 884,897 **** } /* - * Glowing artifacts -- small radius light. - */ - if (f3 & (TR3_LITE)) - { - *misc_list++ = "Permanent Light(1)"; - } - - /* * Handle cursed objects here to avoid redundancies such as noting * that a permanently cursed object is heavily cursed as well as * being "lightly cursed". --- 873,878 ---- *************** *** 938,964 **** * Fill in an object description structure for a given object */ ! static void object_analyze(object_type *o_ptr, obj_desc_list *desc_ptr) { ! analyze_general(o_ptr, desc_ptr->description); ! analyze_pval(o_ptr, &desc_ptr->pval_info); ! analyze_brand(o_ptr, desc_ptr->brands); ! analyze_slay(o_ptr, desc_ptr->slays); ! analyze_immune(o_ptr, desc_ptr->immunities); ! analyze_resist(o_ptr, desc_ptr->resistances); ! analyze_sustains(o_ptr, desc_ptr->sustains); ! analyze_misc_magic(o_ptr, desc_ptr->misc_magic); ! analyze_misc(o_ptr, desc_ptr->misc_desc); ! desc_ptr->activation = item_activation(o_ptr); } --- 919,945 ---- * Fill in an object description structure for a given object */ ! static void object_analyze(object_type *o_ptr, obj_desc_list *desc_x_ptr) { ! analyze_general(o_ptr, desc_x_ptr->description); ! analyze_pval(o_ptr, &desc_x_ptr->pval_info); ! analyze_brand(o_ptr, desc_x_ptr->brands); ! analyze_slay(o_ptr, desc_x_ptr->slays); ! analyze_immune(o_ptr, desc_x_ptr->immunities); ! analyze_resist(o_ptr, desc_x_ptr->resistances); ! analyze_sustains(o_ptr, desc_x_ptr->sustains); ! analyze_misc_magic(o_ptr, desc_x_ptr->misc_magic); ! analyze_misc(o_ptr, desc_x_ptr->misc_desc); ! desc_x_ptr->activation = item_activation(o_ptr); } *************** *** 1194,1201 **** { int i, j; ! object_type forge; ! object_type *q_ptr; obj_desc_list artifact; --- 1175,1182 ---- { int i, j; ! object_type *i_ptr; ! object_type object_type_body; obj_desc_list artifact; *************** *** 1241,1256 **** if (a_ptr->tval != group_artifact[i].tval) continue; /* Get local object */ ! q_ptr = &forge; /* Wipe the object */ ! object_wipe(q_ptr); /* Attempt to "forge" the artifact */ ! if (!make_fake_artifact(q_ptr, j)) continue; /* Analyze the artifact */ ! object_analyze(q_ptr, &artifact); /* Write out the artifact description to the spoiler file */ spoiler_print_art(&artifact); --- 1222,1237 ---- if (a_ptr->tval != group_artifact[i].tval) continue; /* Get local object */ ! i_ptr = &object_type_body; /* Wipe the object */ ! object_wipe(i_ptr); /* Attempt to "forge" the artifact */ ! if (!make_fake_artifact(i_ptr, j)) continue; /* Analyze the artifact */ ! object_analyze(i_ptr, &artifact); /* Write out the artifact description to the spoiler file */ spoiler_print_art(&artifact); *************** *** 1273,1279 **** /* ! * Create a spoiler file for monsters -BEN- */ static void spoil_mon_desc(cptr fname) { --- 1254,1260 ---- /* ! * Create a spoiler file for monsters */ static void spoil_mon_desc(cptr fname) { *************** *** 1414,1420 **** /* * Monster spoilers by: smchorse@ringer.cs.utsa.edu (Shawn McHorse) * ! * Primarily based on code already in mon-desc.c, mostly by -BEN- */ /* --- 1395,1401 ---- /* * Monster spoilers by: smchorse@ringer.cs.utsa.edu (Shawn McHorse) * ! * Adapted from the "monster_desc()" code in "monster1.c" */ /* *************** *** 2237,2243 **** extern void do_cmd_spoilers(void); /* ! * Create Spoiler files -BEN- */ void do_cmd_spoilers(void) { --- 2218,2224 ---- extern void do_cmd_spoilers(void); /* ! * Create Spoiler files */ void do_cmd_spoilers(void) { Only in angband-281/src: wizard1.o diff -r -c -w src-281/wizard2.c angband-281/src/wizard2.c *** src-281/wizard2.c Mon Mar 3 22:39:36 1997 --- angband-281/src/wizard2.c Thu Apr 24 10:38:33 1997 *************** *** 18,25 **** - - /* * Hack -- quick debugging hook */ --- 18,23 ---- *************** *** 125,131 **** /* ! * Aux function for "do_cmd_wiz_change()". -RAK- */ static void do_cmd_wiz_change_aux(void) { --- 123,129 ---- /* ! * Aux function for "do_cmd_wiz_change()" */ static void do_cmd_wiz_change_aux(void) { *************** *** 214,233 **** /* ! * Wizard routines for creating objects -RAK- ! * And for manipulating them! -Bernd- * * This has been rewritten to make the whole procedure * of debugging objects much easier and more comfortable. * - * The following functions are meant to play with objects: - * Create, modify, roll for them (for statistic purposes) and more. - * The original functions were by RAK. - * The function to show an item's debug information was written - * by David Reeve Sward . - * Bernd (wiebelt@mathematik.hu-berlin.de) - * * Here are the low-level functions * - wiz_display_item() * display an item's debug-info * - wiz_create_itemtype() --- 212,224 ---- /* ! * Wizard routines for creating objects and modifying them * * This has been rewritten to make the whole procedure * of debugging objects much easier and more comfortable. * * Here are the low-level functions + * * - wiz_display_item() * display an item's debug-info * - wiz_create_itemtype() *************** *** 269,278 **** * This "feature" may induce crashes or other nasty effects. */ /* ! * Just display an item's properties (debug-info) ! * Originally by David Reeve Sward ! * Verbose item flags by -Bernd- */ static void wiz_display_item(object_type *o_ptr) { --- 260,268 ---- * This "feature" may induce crashes or other nasty effects. */ + /* ! * Display an item's properties */ static void wiz_display_item(object_type *o_ptr) { *************** *** 425,435 **** /* ! * Specify tval and sval (type and subtype of object) originally ! * by RAK, heavily modified by -Bernd- * - * This function returns the k_idx of an object type, or zero if failed - * * List up to 50 choices in three columns */ static int wiz_create_itemtype(void) --- 415,422 ---- /* ! * Acquire an object kind for creation (or zero) * * List up to 50 choices in three columns */ static int wiz_create_itemtype(void) *************** *** 573,580 **** */ static void wiz_reroll_item(object_type *o_ptr) { ! object_type forge; ! object_type *q_ptr; char ch; --- 560,567 ---- */ static void wiz_reroll_item(object_type *o_ptr) { ! object_type *i_ptr; ! object_type object_type_body; char ch; *************** *** 586,595 **** /* Get local object */ ! q_ptr = &forge; /* Copy the object */ ! object_copy(q_ptr, o_ptr); /* Main loop. Ask for magification and artifactification */ --- 573,582 ---- /* Get local object */ ! i_ptr = &object_type_body; /* Copy the object */ ! object_copy(i_ptr, o_ptr); /* Main loop. Ask for magification and artifactification */ *************** *** 596,602 **** while (TRUE) { /* Display full item debug information */ ! wiz_display_item(q_ptr); /* Ask wizard what to do. */ if (!get_com("[a]ccept, [n]ormal, [g]ood, [e]xcellent? ", &ch)) --- 583,589 ---- while (TRUE) { /* Display full item debug information */ ! wiz_display_item(i_ptr); /* Ask wizard what to do. */ if (!get_com("[a]ccept, [n]ormal, [g]ood, [e]xcellent? ", &ch)) *************** *** 615,636 **** /* Apply normal magic, but first clear object */ else if (ch == 'n' || ch == 'N') { ! object_prep(q_ptr, o_ptr->k_idx); ! apply_magic(q_ptr, dun_level, FALSE, FALSE, FALSE); } /* Apply good magic, but first clear object */ else if (ch == 'g' || ch == 'g') { ! object_prep(q_ptr, o_ptr->k_idx); ! apply_magic(q_ptr, dun_level, FALSE, TRUE, FALSE); } /* Apply great magic, but first clear object */ else if (ch == 'e' || ch == 'e') { ! object_prep(q_ptr, o_ptr->k_idx); ! apply_magic(q_ptr, dun_level, FALSE, TRUE, TRUE); } } --- 602,623 ---- /* Apply normal magic, but first clear object */ else if (ch == 'n' || ch == 'N') { ! object_prep(i_ptr, o_ptr->k_idx); ! apply_magic(i_ptr, p_ptr->depth, FALSE, FALSE, FALSE); } /* Apply good magic, but first clear object */ else if (ch == 'g' || ch == 'g') { ! object_prep(i_ptr, o_ptr->k_idx); ! apply_magic(i_ptr, p_ptr->depth, FALSE, TRUE, FALSE); } /* Apply great magic, but first clear object */ else if (ch == 'e' || ch == 'e') { ! object_prep(i_ptr, o_ptr->k_idx); ! apply_magic(i_ptr, p_ptr->depth, FALSE, TRUE, TRUE); } } *************** *** 639,645 **** if (changed) { /* Apply changes */ ! object_copy(o_ptr, q_ptr); /* Recalculate bonuses */ p_ptr->update |= (PU_BONUS); --- 626,632 ---- if (changed) { /* Apply changes */ ! object_copy(o_ptr, i_ptr); /* Recalculate bonuses */ p_ptr->update |= (PU_BONUS); *************** *** 678,685 **** bool good, great; ! object_type forge; ! object_type *q_ptr; cptr q = "Rolls: %ld, Matches: %ld, Better: %ld, Worse: %ld, Other: %ld"; --- 665,672 ---- bool good, great; ! object_type *i_ptr; ! object_type object_type_body; cptr q = "Rolls: %ld, Matches: %ld, Better: %ld, Worse: %ld, Other: %ld"; *************** *** 726,732 **** /* Let us know what we are doing */ msg_format("Creating a lot of %s items. Base level = %d.", ! quality, dun_level); msg_print(NULL); /* Set counters to zero */ --- 713,719 ---- /* Let us know what we are doing */ msg_format("Creating a lot of %s items. Base level = %d.", ! quality, p_ptr->depth); msg_print(NULL); /* Set counters to zero */ *************** *** 758,803 **** /* Get local object */ ! q_ptr = &forge; /* Wipe the object */ ! object_wipe(q_ptr); /* Create an object */ ! make_object(q_ptr, good, great); /* XXX XXX XXX Mega-Hack -- allow multiple artifacts */ ! if (artifact_p(q_ptr)) a_info[q_ptr->name1].cur_num = 0; /* Test for the same tval and sval. */ ! if ((o_ptr->tval) != (q_ptr->tval)) continue; ! if ((o_ptr->sval) != (q_ptr->sval)) continue; /* Check for match */ ! if ((q_ptr->pval == o_ptr->pval) && ! (q_ptr->to_a == o_ptr->to_a) && ! (q_ptr->to_h == o_ptr->to_h) && ! (q_ptr->to_d == o_ptr->to_d)) { matches++; } /* Check for better */ ! else if ((q_ptr->pval >= o_ptr->pval) && ! (q_ptr->to_a >= o_ptr->to_a) && ! (q_ptr->to_h >= o_ptr->to_h) && ! (q_ptr->to_d >= o_ptr->to_d)) { better++; } /* Check for worse */ ! else if ((q_ptr->pval <= o_ptr->pval) && ! (q_ptr->to_a <= o_ptr->to_a) && ! (q_ptr->to_h <= o_ptr->to_h) && ! (q_ptr->to_d <= o_ptr->to_d)) { worse++; } --- 745,790 ---- /* Get local object */ ! i_ptr = &object_type_body; /* Wipe the object */ ! object_wipe(i_ptr); /* Create an object */ ! make_object(i_ptr, good, great); /* XXX XXX XXX Mega-Hack -- allow multiple artifacts */ ! if (artifact_p(i_ptr)) a_info[i_ptr->name1].cur_num = 0; /* Test for the same tval and sval. */ ! if ((o_ptr->tval) != (i_ptr->tval)) continue; ! if ((o_ptr->sval) != (i_ptr->sval)) continue; /* Check for match */ ! if ((i_ptr->pval == o_ptr->pval) && ! (i_ptr->to_a == o_ptr->to_a) && ! (i_ptr->to_h == o_ptr->to_h) && ! (i_ptr->to_d == o_ptr->to_d)) { matches++; } /* Check for better */ ! else if ((i_ptr->pval >= o_ptr->pval) && ! (i_ptr->to_a >= o_ptr->to_a) && ! (i_ptr->to_h >= o_ptr->to_h) && ! (i_ptr->to_d >= o_ptr->to_d)) { better++; } /* Check for worse */ ! else if ((i_ptr->pval <= o_ptr->pval) && ! (i_ptr->to_a <= o_ptr->to_a) && ! (i_ptr->to_h <= o_ptr->to_h) && ! (i_ptr->to_d <= o_ptr->to_d)) { worse++; } *************** *** 865,886 **** { int item; ! object_type forge; ! object_type *q_ptr; object_type *o_ptr; char ch; bool changed; ! /* Get an item (from equip or inven) */ ! if (!get_item(&item, "Play with which object? ", TRUE, TRUE, TRUE)) ! { ! if (item == -2) msg_print("You have nothing to play with."); ! return; ! } /* Get the item (in the pack) */ if (item >= 0) --- 852,873 ---- { int item; ! object_type *i_ptr; ! object_type object_type_body; object_type *o_ptr; char ch; + cptr q, s; + bool changed; ! /* Get an item */ ! q = "Play with which object? "; ! s = "You have nothing to play with."; ! if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return; /* Get the item (in the pack) */ if (item >= 0) *************** *** 907,916 **** /* Get local object */ ! q_ptr = &forge; /* Copy object */ ! object_copy(q_ptr, o_ptr); /* The main loop */ --- 894,903 ---- /* Get local object */ ! i_ptr = &object_type_body; /* Copy object */ ! object_copy(i_ptr, o_ptr); /* The main loop */ *************** *** 917,923 **** while (TRUE) { /* Display the item */ ! wiz_display_item(q_ptr); /* Get choice */ if (!get_com("[a]ccept [s]tatistics [r]eroll [t]weak [q]uantity? ", &ch)) --- 904,910 ---- while (TRUE) { /* Display the item */ ! wiz_display_item(i_ptr); /* Get choice */ if (!get_com("[a]ccept [s]tatistics [r]eroll [t]weak [q]uantity? ", &ch)) *************** *** 934,955 **** if (ch == 's' || ch == 'S') { ! wiz_statistics(q_ptr); } if (ch == 'r' || ch == 'r') { ! wiz_reroll_item(q_ptr); } if (ch == 't' || ch == 'T') { ! wiz_tweak_item(q_ptr); } if (ch == 'q' || ch == 'Q') { ! wiz_quantity_item(q_ptr); } } --- 921,942 ---- if (ch == 's' || ch == 'S') { ! wiz_statistics(i_ptr); } if (ch == 'r' || ch == 'r') { ! wiz_reroll_item(i_ptr); } if (ch == 't' || ch == 'T') { ! wiz_tweak_item(i_ptr); } if (ch == 'q' || ch == 'Q') { ! wiz_quantity_item(i_ptr); } } *************** *** 968,974 **** msg_print("Changes accepted."); /* Change */ ! object_copy(o_ptr, q_ptr); /* Recalculate bonuses */ p_ptr->update |= (PU_BONUS); --- 955,961 ---- msg_print("Changes accepted."); /* Change */ ! object_copy(o_ptr, i_ptr); /* Recalculate bonuses */ p_ptr->update |= (PU_BONUS); *************** *** 989,1006 **** /* ! * Wizard routine for creating objects -RAK- ! * Heavily modified to allow magification and artifactification -Bernd- * * Note that wizards cannot create objects on top of other objects. * * Hack -- this routine always makes a "dungeon object", and applies ! * magic to it, and attempts to decline cursed items. */ static void wiz_create_item(void) { ! object_type forge; ! object_type *q_ptr; int k_idx; --- 976,992 ---- /* ! * Wizard routine for creating objects * * Note that wizards cannot create objects on top of other objects. * * Hack -- this routine always makes a "dungeon object", and applies ! * magic to it, and attempts to decline cursed items. XXX XXX XXX */ static void wiz_create_item(void) { ! object_type *i_ptr; ! object_type object_type_body; int k_idx; *************** *** 1025,1040 **** if (!k_idx) return; /* Get local object */ ! q_ptr = &forge; /* Create the item */ ! object_prep(q_ptr, k_idx); /* Apply magic (no messages, no artifacts) */ ! apply_magic(q_ptr, dun_level, FALSE, FALSE, FALSE); /* Drop the object from heaven */ ! drop_near(q_ptr, -1, py, px); /* All done */ msg_print("Allocated."); --- 1011,1026 ---- if (!k_idx) return; /* Get local object */ ! i_ptr = &object_type_body; /* Create the item */ ! object_prep(i_ptr, k_idx); /* Apply magic (no messages, no artifacts) */ ! apply_magic(i_ptr, p_ptr->depth, FALSE, FALSE, FALSE); /* Drop the object from heaven */ ! drop_near(i_ptr, -1, p_ptr->py, p_ptr->px); /* All done */ msg_print("Allocated."); *************** *** 1103,1109 **** sprintf(ppp, "Jump to level (0-%d): ", MAX_DEPTH-1); /* Default */ ! sprintf(tmp_val, "%d", dun_level); /* Ask for a level */ if (!get_string(ppp, tmp_val, 10)) return; --- 1089,1095 ---- sprintf(ppp, "Jump to level (0-%d): ", MAX_DEPTH-1); /* Default */ ! sprintf(tmp_val, "%d", p_ptr->depth); /* Ask for a level */ if (!get_string(ppp, tmp_val, 10)) return; *************** *** 1122,1128 **** msg_format("You jump to dungeon level %d.", command_arg); /* Change level */ ! dun_level = command_arg; new_level_flag = TRUE; } --- 1108,1114 ---- msg_format("You jump to dungeon level %d.", command_arg); /* Change level */ ! p_ptr->depth = command_arg; new_level_flag = TRUE; } *************** *** 1134,1141 **** { int i; ! object_type forge; ! object_type *q_ptr; /* Scan every object */ for (i = 1; i < MAX_K_IDX; i++) --- 1120,1127 ---- { int i; ! object_type *i_ptr; ! object_type object_type_body; /* Scan every object */ for (i = 1; i < MAX_K_IDX; i++) *************** *** 1146,1158 **** if (k_ptr->level <= command_arg) { /* Get local object */ ! q_ptr = &forge; /* Prepare object */ ! object_prep(q_ptr, i); /* Awareness */ ! object_aware(q_ptr); } } } --- 1132,1144 ---- if (k_ptr->level <= command_arg) { /* Get local object */ ! i_ptr = &object_type_body; /* Prepare object */ ! object_prep(i_ptr, i); /* Awareness */ ! object_aware(i_ptr); } } } *************** *** 1171,1177 **** max_value = (PY_MAX_LEVEL * 5 * (p_ptr->hitdie - 1)) / 8; max_value += PY_MAX_LEVEL; ! player_hp[0] = p_ptr->hitdie; /* Rerate */ while (1) --- 1157,1163 ---- max_value = (PY_MAX_LEVEL * 5 * (p_ptr->hitdie - 1)) / 8; max_value += PY_MAX_LEVEL; ! p_ptr->player_hp[0] = p_ptr->hitdie; /* Rerate */ while (1) *************** *** 1179,1194 **** /* Collect values */ for (i = 1; i < PY_MAX_LEVEL; i++) { ! player_hp[i] = randint(p_ptr->hitdie); ! player_hp[i] += player_hp[i - 1]; } /* Legal values */ ! if ((player_hp[PY_MAX_LEVEL - 1] >= min_value) && ! (player_hp[PY_MAX_LEVEL - 1] <= max_value)) break; } ! percent = (int)(((long)player_hp[PY_MAX_LEVEL - 1] * 200L) / (p_ptr->hitdie + ((PY_MAX_LEVEL - 1) * p_ptr->hitdie))); /* Update and redraw hitpoints */ --- 1165,1180 ---- /* Collect values */ for (i = 1; i < PY_MAX_LEVEL; i++) { ! p_ptr->player_hp[i] = randint(p_ptr->hitdie); ! p_ptr->player_hp[i] += p_ptr->player_hp[i - 1]; } /* Legal values */ ! if ((p_ptr->player_hp[PY_MAX_LEVEL - 1] >= min_value) && ! (p_ptr->player_hp[PY_MAX_LEVEL - 1] <= max_value)) break; } ! percent = (int)(((long)p_ptr->player_hp[PY_MAX_LEVEL - 1] * 200L) / (p_ptr->hitdie + ((PY_MAX_LEVEL - 1) * p_ptr->hitdie))); /* Update and redraw hitpoints */ *************** *** 1215,1221 **** for (i = 0; i < num; i++) { ! (void)summon_specific(py, px, dun_level, 0); } } --- 1201,1207 ---- for (i = 0; i < num; i++) { ! (void)summon_specific(p_ptr->py, p_ptr->px, p_ptr->depth, 0); } } *************** *** 1241,1247 **** int d = 1; /* Pick a location */ ! scatter(&y, &x, py, px, d, 0); /* Require empty grids */ if (!cave_empty_bold(y, x)) continue; --- 1227,1233 ---- int d = 1; /* Pick a location */ ! scatter(&y, &x, p_ptr->py, p_ptr->px, d, 0); /* Require empty grids */ if (!cave_empty_bold(y, x)) continue; *************** *** 1256,1262 **** /* * Hack -- Delete all nearby monsters */ ! static void do_cmd_wiz_zap(void) { int i; --- 1242,1248 ---- /* * Hack -- Delete all nearby monsters */ ! static void do_cmd_wiz_zap(int d) { int i; *************** *** 1265,1280 **** { monster_type *m_ptr = &m_list[i]; ! /* Paranoia -- Skip dead monsters */ if (!m_ptr->r_idx) continue; ! /* Delete nearby monsters */ ! if (m_ptr->cdis <= MAX_SIGHT) delete_monster_idx(i); } } #ifdef ALLOW_SPOILERS /* --- 1251,1299 ---- { monster_type *m_ptr = &m_list[i]; ! /* Skip dead monsters */ if (!m_ptr->r_idx) continue; ! /* Skip distant monsters */ ! if (m_ptr->cdis > d) continue; ! ! /* Delete the monster */ ! delete_monster_idx(i); } } + /* + * Un-hide all monsters + */ + static void do_cmd_wiz_unhide(int d) + { + int i; + /* Process monsters */ + for (i = 1; i < m_max; i++) + { + monster_type *m_ptr = &m_list[i]; + + /* Skip dead monsters */ + if (!m_ptr->r_idx) continue; + + /* Skip distant monsters */ + if (m_ptr->cdis > d) continue; + + /* Optimize -- Repair flags */ + repair_mflag_mark = repair_mflag_show = TRUE; + + /* Detect the monster */ + m_ptr->mflag |= (MFLAG_MARK | MFLAG_SHOW); + + /* Update the monster */ + update_mon(i, FALSE); + } + } + + + #ifdef ALLOW_SPOILERS /* *************** *** 1313,1327 **** case ' ': case '\n': case '\r': break; - #ifdef ALLOW_SPOILERS /* Hack -- Generate Spoilers */ case '"': do_cmd_spoilers(); break; #endif --- 1332,1349 ---- case ' ': case '\n': case '\r': + { break; + } #ifdef ALLOW_SPOILERS /* Hack -- Generate Spoilers */ case '"': + { do_cmd_spoilers(); break; + } #endif *************** *** 1328,1441 **** /* Hack -- Help */ case '?': ! do_cmd_help("help.hlp"); break; - /* Cure all maladies */ case 'a': do_cmd_wiz_cure_all(); break; /* Teleport to target */ case 'b': do_cmd_wiz_bamf(); break; /* Create any object */ case 'c': wiz_create_item(); break; /* Detect everything */ case 'd': detect_all(); break; /* Edit character */ case 'e': do_cmd_wiz_change(); break; /* View item info */ case 'f': (void)identify_fully(); break; /* Good Objects */ case 'g': if (command_arg <= 0) command_arg = 1; ! acquirement(py, px, command_arg, FALSE); break; /* Hitpoint rerating */ case 'h': do_cmd_rerate(); break; /* Identify */ case 'i': (void)ident_spell(); break; /* Go up or down in the dungeon */ case 'j': do_cmd_wiz_jump(); break; /* Self-Knowledge */ case 'k': self_knowledge(); break; /* Learn about objects */ case 'l': do_cmd_wiz_learn(); break; /* Magic Mapping */ case 'm': map_area(); break; /* Summon Named Monster */ case 'n': do_cmd_wiz_named(command_arg, TRUE); break; /* Object playing routines */ case 'o': do_cmd_wiz_play(); break; /* Phase Door */ case 'p': teleport_player(10); break; /* Summon Random Monster(s) */ case 's': if (command_arg <= 0) command_arg = 1; do_cmd_wiz_summon(command_arg); break; /* Teleport */ case 't': teleport_player(100); break; /* Very Good Objects */ case 'v': if (command_arg <= 0) command_arg = 1; ! acquirement(py, px, command_arg, TRUE); break; /* Wizard Light the Level */ case 'w': wiz_lite(); break; /* Increase Experience */ case 'x': if (command_arg) { gain_exp(command_arg); --- 1350,1513 ---- /* Hack -- Help */ case '?': ! { ! do_cmd_help(); break; + } /* Cure all maladies */ case 'a': + { do_cmd_wiz_cure_all(); break; + } /* Teleport to target */ case 'b': + { do_cmd_wiz_bamf(); break; + } /* Create any object */ case 'c': + { wiz_create_item(); break; + } /* Detect everything */ case 'd': + { detect_all(); break; + } /* Edit character */ case 'e': + { do_cmd_wiz_change(); break; + } /* View item info */ case 'f': + { (void)identify_fully(); break; + } /* Good Objects */ case 'g': + { if (command_arg <= 0) command_arg = 1; ! acquirement(p_ptr->py, p_ptr->px, command_arg, FALSE); break; + } /* Hitpoint rerating */ case 'h': + { do_cmd_rerate(); break; + } /* Identify */ case 'i': + { (void)ident_spell(); break; + } /* Go up or down in the dungeon */ case 'j': + { do_cmd_wiz_jump(); break; + } /* Self-Knowledge */ case 'k': + { self_knowledge(); break; + } /* Learn about objects */ case 'l': + { do_cmd_wiz_learn(); break; + } /* Magic Mapping */ case 'm': + { map_area(); break; + } /* Summon Named Monster */ case 'n': + { do_cmd_wiz_named(command_arg, TRUE); break; + } /* Object playing routines */ case 'o': + { do_cmd_wiz_play(); break; + } /* Phase Door */ case 'p': + { teleport_player(10); break; + } /* Summon Random Monster(s) */ case 's': + { if (command_arg <= 0) command_arg = 1; do_cmd_wiz_summon(command_arg); break; + } /* Teleport */ case 't': + { teleport_player(100); break; + } + /* Un-hide all monsters */ + case 'u': + { + if (command_arg <= 0) command_arg = 255; + do_cmd_wiz_unhide(command_arg); + break; + } + /* Very Good Objects */ case 'v': + { if (command_arg <= 0) command_arg = 1; ! acquirement(p_ptr->py, p_ptr->px, command_arg, TRUE); break; + } /* Wizard Light the Level */ case 'w': + { wiz_lite(); break; + } /* Increase Experience */ case 'x': + { if (command_arg) { gain_exp(command_arg); *************** *** 1445,1467 **** gain_exp(p_ptr->exp + 1); } break; /* Zap Monsters (Genocide) */ case 'z': ! do_cmd_wiz_zap(); break; ! /* Hack -- whatever I desire */ case '_': do_cmd_wiz_hack_ben(); break; ! /* Not a Wizard Command */ default: msg_print("That is not a valid debug command."); break; } } #else --- 1517,1547 ---- gain_exp(p_ptr->exp + 1); } break; + } /* Zap Monsters (Genocide) */ case 'z': ! { ! if (command_arg <= 0) command_arg = MAX_SIGHT; ! do_cmd_wiz_zap(command_arg); break; + } ! /* Hack */ case '_': + { do_cmd_wiz_hack_ben(); break; + } ! /* Oops */ default: + { msg_print("That is not a valid debug command."); break; } } + } #else Only in angband-281/src: wizard2.o diff -r -c -w src-281/xtra1.c angband-281/src/xtra1.c *** src-281/xtra1.c Mon Mar 3 22:39:58 1997 --- angband-281/src/xtra1.c Thu Apr 24 10:39:02 1997 *************** *** 25,36 **** { int bonus = (val - 18); ! if (bonus >= 220) { - sprintf(out_val, "18/%3s", "***"); - } - else if (bonus >= 100) - { sprintf(out_val, "18/%03d", bonus); } else --- 25,32 ---- { int bonus = (val - 18); ! if (bonus >= 100) { sprintf(out_val, "18/%03d", bonus); } else *************** *** 184,190 **** sprintf(tmp, "%6d", p_ptr->lev); ! if (p_ptr->lev >= p_ptr->max_plv) { put_str("LEVEL ", ROW_LEVEL, 0); c_put_str(TERM_L_GREEN, tmp, ROW_LEVEL, COL_LEVEL + 6); --- 180,186 ---- sprintf(tmp, "%6d", p_ptr->lev); ! if (p_ptr->lev >= p_ptr->max_lev) { put_str("LEVEL ", ROW_LEVEL, 0); c_put_str(TERM_L_GREEN, tmp, ROW_LEVEL, COL_LEVEL + 6); *************** *** 335,351 **** { char depths[32]; ! if (!dun_level) { (void)strcpy(depths, "Town"); } else if (depth_in_feet) { ! (void)sprintf(depths, "%d ft", dun_level * 50); } else { ! (void)sprintf(depths, "Lev %d", dun_level); } /* Right-Adjust the "depth", and clear old values */ --- 331,347 ---- { char depths[32]; ! if (!p_ptr->depth) { (void)strcpy(depths, "Town"); } else if (depth_in_feet) { ! (void)sprintf(depths, "%d ft", p_ptr->depth * 50); } else { ! (void)sprintf(depths, "Lev %d", p_ptr->depth); } /* Right-Adjust the "depth", and clear old values */ *************** *** 483,499 **** } /* Resting */ ! else if (resting) { int i; /* Start with "Rest" */ strcpy(text, "Rest "); /* Extensive (timed) rest */ ! if (resting >= 1000) { ! i = resting / 100; text[9] = '0'; text[8] = '0'; text[7] = '0' + (i % 10); --- 479,496 ---- } /* Resting */ ! else if (p_ptr->resting) { int i; + int n = p_ptr->resting; /* Start with "Rest" */ strcpy(text, "Rest "); /* Extensive (timed) rest */ ! if (n >= 1000) { ! i = n / 100; text[9] = '0'; text[8] = '0'; text[7] = '0' + (i % 10); *************** *** 509,517 **** } /* Long (timed) rest */ ! else if (resting >= 100) { ! i = resting; text[9] = '0' + (i % 10); i = i / 10; text[8] = '0' + (i % 10); --- 506,514 ---- } /* Long (timed) rest */ ! else if (n >= 100) { ! i = n; text[9] = '0' + (i % 10); i = i / 10; text[8] = '0' + (i % 10); *************** *** 519,546 **** } /* Medium (timed) rest */ ! else if (resting >= 10) { ! i = resting; text[9] = '0' + (i % 10); text[8] = '0' + (i / 10); } /* Short (timed) rest */ ! else if (resting > 0) { ! i = resting; text[9] = '0' + (i); } /* Rest until healed */ ! else if (resting == -1) { text[5] = text[6] = text[7] = text[8] = text[9] = '*'; } /* Rest until done */ ! else if (resting == -2) { text[5] = text[6] = text[7] = text[8] = text[9] = '&'; } --- 516,543 ---- } /* Medium (timed) rest */ ! else if (n >= 10) { ! i = n; text[9] = '0' + (i % 10); text[8] = '0' + (i / 10); } /* Short (timed) rest */ ! else if (n > 0) { ! i = n; text[9] = '0' + (i); } /* Rest until healed */ ! else if (n == -1) { text[5] = text[6] = text[7] = text[8] = text[9] = '*'; } /* Rest until done */ ! else if (n == -2) { text[5] = text[6] = text[7] = text[8] = text[9] = '&'; } *************** *** 686,709 **** /* ! * Redraw the "monster health bar" -DRS- ! * Rather extensive modifications by -BEN- * * The "monster health bar" provides visual feedback on the "health" * of the monster currently being "tracked". There are several ways * to "track" a monster, including targetting it, attacking it, and ! * affecting it (and nobody else) with a ranged attack. ! * ! * Display the monster health bar (affectionately known as the ! * "health-o-meter"). Clear health bar if nothing is being tracked. ! * Auto-track current target monster when bored. Note that the ! * health-bar stops tracking any monster that "disappears". */ static void health_redraw(void) { - - #ifdef DRS_SHOW_HEALTH_BAR - /* Not tracking */ if (!health_who) { --- 683,699 ---- /* ! * Redraw the "monster health bar" * * The "monster health bar" provides visual feedback on the "health" * of the monster currently being "tracked". There are several ways * to "track" a monster, including targetting it, attacking it, and ! * affecting it (and nobody else) with a ranged attack. When nothing ! * is being tracked, we clear the health bar. If the monster being ! * tracked is not currently visible, a special health bar is shown. */ static void health_redraw(void) { /* Not tracking */ if (!health_who) { *************** *** 772,780 **** /* Dump the current "health" (use '*' symbols) */ Term_putstr(COL_INFO + 1, ROW_INFO, len, attr, "**********"); } - - #endif - } --- 762,767 ---- *************** *** 1186,1193 **** { /* Count known spells */ if ((j < 32) ? ! (spell_learned1 & (1L << j)) : ! (spell_learned2 & (1L << (j - 32)))) { num_known++; } --- 1173,1180 ---- { /* Count known spells */ if ((j < 32) ? ! (p_ptr->spell_learned1 & (1L << j)) : ! (p_ptr->spell_learned2 & (1L << (j - 32)))) { num_known++; } *************** *** 1202,1211 **** for (i = 63; i >= 0; i--) { /* Efficiency -- all done */ ! if (!spell_learned1 && !spell_learned2) break; /* Access the spell */ ! j = spell_order[i]; /* Skip non-spells */ if (j >= 99) continue; --- 1189,1198 ---- for (i = 63; i >= 0; i--) { /* 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 */ if (j >= 99) continue; *************** *** 1218,1244 **** /* Is it known? */ if ((j < 32) ? ! (spell_learned1 & (1L << j)) : ! (spell_learned2 & (1L << (j - 32)))) { /* Mark as forgotten */ if (j < 32) { ! spell_forgotten1 |= (1L << j); } else { ! spell_forgotten2 |= (1L << (j - 32)); } /* No longer known */ if (j < 32) { ! spell_learned1 &= ~(1L << j); } else { ! spell_learned2 &= ~(1L << (j - 32)); } /* Message */ --- 1205,1231 ---- /* Is it known? */ if ((j < 32) ? ! (p_ptr->spell_learned1 & (1L << j)) : ! (p_ptr->spell_learned2 & (1L << (j - 32)))) { /* Mark as forgotten */ if (j < 32) { ! p_ptr->spell_forgotten1 |= (1L << j); } else { ! p_ptr->spell_forgotten2 |= (1L << (j - 32)); } /* No longer known */ if (j < 32) { ! p_ptr->spell_learned1 &= ~(1L << j); } else { ! p_ptr->spell_learned2 &= ~(1L << (j - 32)); } /* Message */ *************** *** 1258,1267 **** if (p_ptr->new_spells >= 0) break; /* Efficiency -- all done */ ! if (!spell_learned1 && !spell_learned2) break; /* Get the (i+1)th spell learned */ ! j = spell_order[i]; /* Skip unknown spells */ if (j >= 99) continue; --- 1245,1254 ---- if (p_ptr->new_spells >= 0) break; /* Efficiency -- all done */ ! if (!p_ptr->spell_learned1 && !p_ptr->spell_learned2) break; /* Get the (i+1)th spell learned */ ! j = p_ptr->spell_order[i]; /* Skip unknown spells */ if (j >= 99) continue; *************** *** 1268,1294 **** /* Forget it (if learned) */ if ((j < 32) ? ! (spell_learned1 & (1L << j)) : ! (spell_learned2 & (1L << (j - 32)))) { /* Mark as forgotten */ if (j < 32) { ! spell_forgotten1 |= (1L << j); } else { ! spell_forgotten2 |= (1L << (j - 32)); } /* No longer known */ if (j < 32) { ! spell_learned1 &= ~(1L << j); } else { ! spell_learned2 &= ~(1L << (j - 32)); } /* Message */ --- 1255,1281 ---- /* Forget it (if learned) */ if ((j < 32) ? ! (p_ptr->spell_learned1 & (1L << j)) : ! (p_ptr->spell_learned2 & (1L << (j - 32)))) { /* Mark as forgotten */ if (j < 32) { ! p_ptr->spell_forgotten1 |= (1L << j); } else { ! p_ptr->spell_forgotten2 |= (1L << (j - 32)); } /* No longer known */ if (j < 32) { ! p_ptr->spell_learned1 &= ~(1L << j); } else { ! p_ptr->spell_learned2 &= ~(1L << (j - 32)); } /* Message */ *************** *** 1308,1317 **** if (p_ptr->new_spells <= 0) break; /* Efficiency -- all done */ ! if (!spell_forgotten1 && !spell_forgotten2) break; /* Get the next spell we learned */ ! j = spell_order[i]; /* Skip unknown spells */ if (j >= 99) break; --- 1295,1304 ---- if (p_ptr->new_spells <= 0) break; /* Efficiency -- all done */ ! if (!p_ptr->spell_forgotten1 && !p_ptr->spell_forgotten2) break; /* Get the next spell we learned */ ! j = p_ptr->spell_order[i]; /* Skip unknown spells */ if (j >= 99) break; *************** *** 1324,1350 **** /* First set of spells */ if ((j < 32) ? ! (spell_forgotten1 & (1L << j)) : ! (spell_forgotten2 & (1L << (j - 32)))) { /* No longer forgotten */ if (j < 32) { ! spell_forgotten1 &= ~(1L << j); } else { ! spell_forgotten2 &= ~(1L << (j - 32)); } /* Known once more */ if (j < 32) { ! spell_learned1 |= (1L << j); } else { ! spell_learned2 |= (1L << (j - 32)); } /* Message */ --- 1311,1337 ---- /* First set of spells */ if ((j < 32) ? ! (p_ptr->spell_forgotten1 & (1L << j)) : ! (p_ptr->spell_forgotten2 & (1L << (j - 32)))) { /* No longer forgotten */ if (j < 32) { ! p_ptr->spell_forgotten1 &= ~(1L << j); } else { ! p_ptr->spell_forgotten2 &= ~(1L << (j - 32)); } /* Known once more */ if (j < 32) { ! p_ptr->spell_learned1 |= (1L << j); } else { ! p_ptr->spell_learned2 |= (1L << (j - 32)); } /* Message */ *************** *** 1371,1378 **** /* Skip spells we already know */ if ((j < 32) ? ! (spell_learned1 & (1L << j)) : ! (spell_learned2 & (1L << (j - 32)))) { continue; } --- 1358,1365 ---- /* Skip spells we already know */ if ((j < 32) ? ! (p_ptr->spell_learned1 & (1L << j)) : ! (p_ptr->spell_learned2 & (1L << (j - 32)))) { continue; } *************** *** 1451,1457 **** /* Normal gloves hurt mage-type spells */ if (o_ptr->k_idx && ! !(f2 & (TR2_FREE_ACT)) && !((f1 & (TR1_DEX)) && (o_ptr->pval > 0))) { /* Encumbered */ --- 1438,1444 ---- /* Normal gloves hurt mage-type spells */ if (o_ptr->k_idx && ! !(f3 & (TR3_FREE_ACT)) && !((f1 & (TR1_DEX)) && (o_ptr->pval > 0))) { /* Encumbered */ *************** *** 1607,1613 **** bonus = ((int)(adj_con_mhp[p_ptr->stat_ind[A_CON]]) - 128); /* Calculate hitpoints */ ! mhp = player_hp[p_ptr->lev-1] + (bonus * p_ptr->lev / 2); /* Always have at least one hitpoint per level */ if (mhp < p_ptr->lev + 1) mhp = p_ptr->lev + 1; --- 1594,1600 ---- bonus = ((int)(adj_con_mhp[p_ptr->stat_ind[A_CON]]) - 128); /* Calculate hitpoints */ ! mhp = p_ptr->player_hp[p_ptr->lev-1] + (bonus * p_ptr->lev / 2); /* Always have at least one hitpoint per level */ if (mhp < p_ptr->lev + 1) mhp = p_ptr->lev + 1; *************** *** 1690,1696 **** } /* Reduce lite when running if requested */ ! if (running && view_reduce_lite) { /* Reduce the lite radius if needed */ if (p_ptr->cur_lite > 1) p_ptr->cur_lite = 1; --- 1677,1683 ---- } /* Reduce lite when running if requested */ ! if (p_ptr->running && view_reduce_lite) { /* Reduce the lite radius if needed */ if (p_ptr->cur_lite > 1) p_ptr->cur_lite = 1; *************** *** 1761,1772 **** --- 1748,1766 ---- int extra_blows; 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; u32b f1, f2, f3; + /*** Memorize ***/ + /* Save the old speed */ old_speed = p_ptr->pspeed; *************** *** 1778,1791 **** old_dis_ac = p_ptr->dis_ac; old_dis_to_a = p_ptr->dis_to_a; - /* Clear extra blows/shots */ - extra_blows = extra_shots = 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; --- 1772,1805 ---- old_dis_ac = p_ptr->dis_ac; 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]; + old_stat_ind[i] = p_ptr->stat_ind[i]; + } + /*** Reset ***/ + + /* Reset player speed */ + p_ptr->pspeed = 110; + + /* Reset "blow" info */ + p_ptr->num_blow = 1; + extra_blows = 0; + + /* Reset "fire" info */ + p_ptr->num_fire = 0; + p_ptr->ammo_mult = 0; + p_ptr->ammo_tval = 0; + extra_shots = 0; + 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; *************** *** 1794,1806 **** p_ptr->dis_to_d = p_ptr->to_d = 0; p_ptr->dis_to_a = p_ptr->to_a = 0; - /* Clear all the flags */ p_ptr->aggravate = FALSE; p_ptr->teleport = FALSE; p_ptr->exp_drain = FALSE; p_ptr->bless_blade = FALSE; - p_ptr->xtra_might = FALSE; p_ptr->impact = FALSE; p_ptr->see_inv = FALSE; p_ptr->free_act = FALSE; --- 1808,1818 ---- *************** *** 1821,1837 **** p_ptr->resist_fire = FALSE; p_ptr->resist_cold = FALSE; p_ptr->resist_pois = FALSE; ! p_ptr->resist_conf = FALSE; ! p_ptr->resist_sound = FALSE; p_ptr->resist_lite = FALSE; p_ptr->resist_dark = FALSE; p_ptr->resist_chaos = FALSE; p_ptr->resist_disen = FALSE; p_ptr->resist_shard = FALSE; p_ptr->resist_nexus = FALSE; ! p_ptr->resist_blind = FALSE; ! p_ptr->resist_neth = FALSE; ! p_ptr->resist_fear = FALSE; p_ptr->immune_acid = FALSE; p_ptr->immune_elec = FALSE; p_ptr->immune_fire = FALSE; --- 1833,1849 ---- p_ptr->resist_fire = FALSE; p_ptr->resist_cold = FALSE; p_ptr->resist_pois = FALSE; ! p_ptr->resist_fear = FALSE; p_ptr->resist_lite = FALSE; p_ptr->resist_dark = FALSE; + p_ptr->resist_blind = FALSE; + p_ptr->resist_confu = FALSE; + p_ptr->resist_sound = FALSE; p_ptr->resist_chaos = FALSE; p_ptr->resist_disen = FALSE; p_ptr->resist_shard = FALSE; p_ptr->resist_nexus = FALSE; ! p_ptr->resist_nethr = FALSE; p_ptr->immune_acid = FALSE; p_ptr->immune_elec = FALSE; p_ptr->immune_fire = FALSE; *************** *** 1838,1848 **** p_ptr->immune_cold = FALSE; /* Base infravision (purely racial) */ p_ptr->see_infra = rp_ptr->infra; - /* Base skill -- disarming */ p_ptr->skill_dis = rp_ptr->r_dis + cp_ptr->c_dis; --- 1850,1860 ---- p_ptr->immune_cold = FALSE; + /*** Extract race/class info ***/ /* Base infravision (purely racial) */ p_ptr->see_infra = rp_ptr->infra; /* Base skill -- disarming */ p_ptr->skill_dis = rp_ptr->r_dis + cp_ptr->c_dis; *************** *** 1873,1879 **** /* Base skill -- digging */ p_ptr->skill_dig = 0; - /* Elf */ if (p_ptr->prace == RACE_ELF) p_ptr->resist_lite = TRUE; --- 1885,1890 ---- *************** *** 1900,1934 **** if (p_ptr->prace == RACE_HIGH_ELF) p_ptr->see_inv = TRUE; ! /* Start with "normal" speed */ ! p_ptr->pspeed = 110; ! /* Start with a single blow per turn */ ! p_ptr->num_blow = 1; ! ! /* Start with a single shot per turn */ ! p_ptr->num_fire = 1; ! ! /* Reset the "xtra" tval */ ! p_ptr->tval_xtra = 0; ! ! /* Reset the "ammo" tval */ ! p_ptr->tval_ammo = 0; ! ! ! /* Hack -- apply racial/class stat maxes */ ! if (p_ptr->maximize) ! { ! /* Apply the racial modifiers */ ! for (i = 0; i < 6; i++) ! { ! /* Modify the stats for "race" */ ! p_ptr->stat_add[i] += (rp_ptr->r_adj[i] + cp_ptr->c_adj[i]); ! } ! } ! ! ! /* Scan the usable inventory */ for (i = INVEN_WIELD; i < INVEN_TOTAL; i++) { o_ptr = &inventory[i]; --- 1911,1919 ---- if (p_ptr->prace == RACE_HIGH_ELF) p_ptr->see_inv = TRUE; ! /*** Analyze equipment ***/ ! /* Scan the equipment */ for (i = INVEN_WIELD; i < INVEN_TOTAL; i++) { o_ptr = &inventory[i]; *************** *** 1968,1994 **** /* Affect blows */ if (f1 & (TR1_BLOWS)) extra_blows += o_ptr->pval; ! /* Hack -- cause earthquakes */ ! if (f1 & (TR1_IMPACT)) p_ptr->impact = TRUE; ! /* Boost shots */ ! if (f3 & (TR3_XTRA_SHOTS)) extra_shots++; ! /* Various flags */ ! if (f3 & (TR3_AGGRAVATE)) p_ptr->aggravate = TRUE; ! if (f3 & (TR3_TELEPORT)) p_ptr->teleport = TRUE; ! if (f3 & (TR3_DRAIN_EXP)) p_ptr->exp_drain = TRUE; ! if (f3 & (TR3_BLESSED)) p_ptr->bless_blade = TRUE; ! if (f3 & (TR3_XTRA_MIGHT)) p_ptr->xtra_might = TRUE; if (f3 & (TR3_SLOW_DIGEST)) p_ptr->slow_digest = TRUE; if (f3 & (TR3_REGEN)) p_ptr->regenerate = TRUE; if (f3 & (TR3_TELEPATHY)) p_ptr->telepathy = TRUE; - if (f3 & (TR3_LITE)) p_ptr->lite = TRUE; if (f3 & (TR3_SEE_INVIS)) p_ptr->see_inv = TRUE; ! if (f3 & (TR3_FEATHER)) p_ptr->ffall = TRUE; ! if (f2 & (TR2_FREE_ACT)) p_ptr->free_act = TRUE; ! if (f2 & (TR2_HOLD_LIFE)) p_ptr->hold_life = TRUE; /* Immunity flags */ if (f2 & (TR2_IM_FIRE)) p_ptr->immune_fire = TRUE; if (f2 & (TR2_IM_ACID)) p_ptr->immune_acid = TRUE; --- 1953,1983 ---- /* Affect blows */ if (f1 & (TR1_BLOWS)) extra_blows += o_ptr->pval; ! /* Affect shots */ ! if (f1 & (TR1_SHOTS)) extra_shots += o_ptr->pval; ! /* Affect Might */ ! if (f1 & (TR1_MIGHT)) extra_might += o_ptr->pval; ! /* Good flags */ if (f3 & (TR3_SLOW_DIGEST)) p_ptr->slow_digest = TRUE; + if (f3 & (TR3_FEATHER)) p_ptr->ffall = TRUE; + if (f3 & (TR3_LITE)) p_ptr->lite = TRUE; if (f3 & (TR3_REGEN)) p_ptr->regenerate = TRUE; if (f3 & (TR3_TELEPATHY)) p_ptr->telepathy = TRUE; if (f3 & (TR3_SEE_INVIS)) p_ptr->see_inv = TRUE; ! if (f3 & (TR3_FREE_ACT)) p_ptr->free_act = TRUE; ! if (f3 & (TR3_HOLD_LIFE)) p_ptr->hold_life = TRUE; + /* Weird flags */ + if (f3 & (TR3_BLESSED)) p_ptr->bless_blade = TRUE; + + /* Bad flags */ + if (f3 & (TR3_IMPACT)) p_ptr->impact = TRUE; + if (f3 & (TR3_AGGRAVATE)) p_ptr->aggravate = TRUE; + if (f3 & (TR3_TELEPORT)) p_ptr->teleport = TRUE; + if (f3 & (TR3_DRAIN_EXP)) p_ptr->exp_drain = TRUE; + /* Immunity flags */ if (f2 & (TR2_IM_FIRE)) p_ptr->immune_fire = TRUE; if (f2 & (TR2_IM_ACID)) p_ptr->immune_acid = TRUE; *************** *** 2001,2016 **** if (f2 & (TR2_RES_FIRE)) p_ptr->resist_fire = TRUE; if (f2 & (TR2_RES_COLD)) p_ptr->resist_cold = TRUE; if (f2 & (TR2_RES_POIS)) p_ptr->resist_pois = TRUE; ! if (f2 & (TR2_RES_CONF)) p_ptr->resist_conf = TRUE; ! if (f2 & (TR2_RES_SOUND)) p_ptr->resist_sound = TRUE; if (f2 & (TR2_RES_LITE)) p_ptr->resist_lite = TRUE; if (f2 & (TR2_RES_DARK)) p_ptr->resist_dark = TRUE; if (f2 & (TR2_RES_CHAOS)) p_ptr->resist_chaos = TRUE; if (f2 & (TR2_RES_DISEN)) p_ptr->resist_disen = TRUE; - if (f2 & (TR2_RES_SHARDS)) p_ptr->resist_shard = TRUE; - if (f2 & (TR2_RES_NEXUS)) p_ptr->resist_nexus = TRUE; - if (f2 & (TR2_RES_BLIND)) p_ptr->resist_blind = TRUE; - if (f2 & (TR2_RES_NETHER)) p_ptr->resist_neth = TRUE; /* Sustain flags */ if (f2 & (TR2_SUST_STR)) p_ptr->sustain_str = TRUE; --- 1990,2006 ---- if (f2 & (TR2_RES_FIRE)) p_ptr->resist_fire = TRUE; if (f2 & (TR2_RES_COLD)) p_ptr->resist_cold = TRUE; if (f2 & (TR2_RES_POIS)) p_ptr->resist_pois = TRUE; ! if (f2 & (TR2_RES_FEAR)) p_ptr->resist_fear = TRUE; if (f2 & (TR2_RES_LITE)) p_ptr->resist_lite = TRUE; if (f2 & (TR2_RES_DARK)) p_ptr->resist_dark = TRUE; + if (f2 & (TR2_RES_BLIND)) p_ptr->resist_blind = TRUE; + if (f2 & (TR2_RES_CONFU)) p_ptr->resist_confu = TRUE; + if (f2 & (TR2_RES_SOUND)) p_ptr->resist_sound = TRUE; + if (f2 & (TR2_RES_SHARD)) p_ptr->resist_shard = TRUE; + if (f2 & (TR2_RES_NEXUS)) p_ptr->resist_nexus = TRUE; + if (f2 & (TR2_RES_NETHR)) p_ptr->resist_nethr = TRUE; if (f2 & (TR2_RES_CHAOS)) p_ptr->resist_chaos = TRUE; if (f2 & (TR2_RES_DISEN)) p_ptr->resist_disen = TRUE; /* Sustain flags */ if (f2 & (TR2_SUST_STR)) p_ptr->sustain_str = TRUE; *************** *** 2048,2093 **** } /* Calculate stats */ for (i = 0; i < 6; i++) { ! int top, use, ind; ! /* Extract the new "stat_use" value for the stat */ ! top = modify_stat_value(p_ptr->stat_max[i], p_ptr->stat_add[i]); ! ! /* Notice changes */ ! if (p_ptr->stat_top[i] != top) { ! /* Save the new value */ ! p_ptr->stat_top[i] = top; ! ! /* Redisplay the stats later */ ! p_ptr->redraw |= (PR_STATS); ! ! /* Window stuff */ ! p_ptr->window |= (PW_PLAYER); } /* Extract the new "stat_use" value for the stat */ ! use = modify_stat_value(p_ptr->stat_cur[i], p_ptr->stat_add[i]); - /* Notice changes */ - if (p_ptr->stat_use[i] != use) - { /* Save the new value */ p_ptr->stat_use[i] = use; - /* Redisplay the stats later */ - p_ptr->redraw |= (PR_STATS); - - /* Window stuff */ - p_ptr->window |= (PW_PLAYER); - } - - /* Values: 3, 4, ..., 17 */ if (use <= 18) ind = (use - 3); --- 2038,2072 ---- } + /*** Handle stats ***/ + /* Calculate stats */ for (i = 0; i < 6; i++) { ! int add, top, use, ind; + /* Extract modifier */ + 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]); } + /* Extract the new "stat_top" value for the stat */ + top = modify_stat_value(p_ptr->stat_max[i], add); + /* Save the new value */ + p_ptr->stat_top[i] = top; + /* Extract the new "stat_use" value for the stat */ ! use = modify_stat_value(p_ptr->stat_cur[i], add); /* Save the new value */ p_ptr->stat_use[i] = use; /* Values: 3, 4, ..., 17 */ if (use <= 18) ind = (use - 3); *************** *** 2097,2138 **** /* Range: 18/220+ */ else ind = (37); - /* Notice changes */ - if (p_ptr->stat_ind[i] != ind) - { /* Save the new index */ p_ptr->stat_ind[i] = ind; - - /* Change in CON affects Hitpoints */ - if (i == A_CON) - { - p_ptr->update |= (PU_HP); } - /* Change in INT may affect Mana/Spells */ - else if (i == A_INT) - { - if (mp_ptr->spell_stat == A_INT) - { - p_ptr->update |= (PU_MANA | PU_SPELLS); - } - } ! /* Change in WIS may affect Mana/Spells */ ! else if (i == A_WIS) ! { ! if (mp_ptr->spell_stat == A_WIS) ! { ! p_ptr->update |= (PU_MANA | PU_SPELLS); ! } ! } - /* Window stuff */ - p_ptr->window |= (PW_PLAYER); - } - } - - /* Apply temporary "stun" */ if (p_ptr->stun > 50) { --- 2076,2088 ---- /* Range: 18/220+ */ else ind = (37); /* Save the new index */ p_ptr->stat_ind[i] = ind; } ! /*** Temporary flags ***/ /* Apply temporary "stun" */ if (p_ptr->stun > 50) { *************** *** 2149,2155 **** p_ptr->dis_to_d -= 5; } - /* Invulnerability */ if (p_ptr->invuln) { --- 2099,2104 ---- *************** *** 2214,2223 **** } ! /* Hack -- Res Chaos -> Res Conf */ if (p_ptr->resist_chaos) { ! p_ptr->resist_conf = TRUE; } /* Hack -- Hero/Shero -> Res fear */ --- 2163,2174 ---- } ! /*** Special flags ***/ ! ! /* Hack -- Res chaos -> Res confu */ if (p_ptr->resist_chaos) { ! p_ptr->resist_confu = TRUE; } /* Hack -- Hero/Shero -> Res fear */ *************** *** 2227,2245 **** } ! /* Hack -- Telepathy Change */ ! if (p_ptr->telepathy != old_telepathy) ! { ! p_ptr->update |= (PU_MONSTERS); ! } - /* Hack -- See Invis Change */ - if (p_ptr->see_inv != old_see_inv) - { - p_ptr->update |= (PU_MONSTERS); - } - - /* Extract the current weight (in tenth pounds) */ j = total_weight; --- 2178,2185 ---- } ! /*** Analyze weight ***/ /* Extract the current weight (in tenth pounds) */ j = total_weight; *************** *** 2255,2263 **** /* Searching slows the player down */ if (p_ptr->searching) p_ptr->pspeed -= 10; - /* Display the speed (if needed) */ - if (p_ptr->pspeed != old_speed) p_ptr->redraw |= (PR_SPEED); /* Actual Modifier Bonuses (Un-inflate stat bonuses) */ p_ptr->to_a += ((int)(adj_dex_ta[p_ptr->stat_ind[A_DEX]]) - 128); --- 2195,2202 ---- /* Searching slows the player down */ if (p_ptr->searching) p_ptr->pspeed -= 10; + /*** Apply modifier bonuses ***/ /* Actual Modifier Bonuses (Un-inflate stat bonuses) */ p_ptr->to_a += ((int)(adj_dex_ta[p_ptr->stat_ind[A_DEX]]) - 128); *************** *** 2272,2296 **** p_ptr->dis_to_h += ((int)(adj_str_th[p_ptr->stat_ind[A_STR]]) - 128); ! /* Redraw armor (if needed) */ ! if ((p_ptr->dis_ac != old_dis_ac) || (p_ptr->dis_to_a != old_dis_to_a)) ! { ! /* Redraw */ ! p_ptr->redraw |= (PR_ARMOR); ! /* Window stuff */ ! p_ptr->window |= (PW_PLAYER); ! } /* Obtain the "hold" value */ hold = adj_str_hold[p_ptr->stat_ind[A_STR]]; /* Examine the "current bow" */ o_ptr = &inventory[INVEN_BOW]; - /* Assume not heavy */ p_ptr->heavy_shoot = FALSE; --- 2211,2280 ---- p_ptr->dis_to_h += ((int)(adj_str_th[p_ptr->stat_ind[A_STR]]) - 128); ! /*** Modify skills ***/ ! /* Affect Skill -- stealth (bonus one) */ ! p_ptr->skill_stl += 1; + /* Affect Skill -- disarming (DEX and INT) */ + p_ptr->skill_dis += adj_dex_dis[p_ptr->stat_ind[A_DEX]]; + p_ptr->skill_dis += adj_int_dis[p_ptr->stat_ind[A_INT]]; + /* Affect Skill -- magic devices (INT) */ + p_ptr->skill_dev += adj_int_dev[p_ptr->stat_ind[A_INT]]; + + /* Affect Skill -- saving throw (WIS) */ + p_ptr->skill_sav += adj_wis_sav[p_ptr->stat_ind[A_WIS]]; + + /* Affect Skill -- digging (STR) */ + p_ptr->skill_dig += adj_str_dig[p_ptr->stat_ind[A_STR]]; + + /* Affect Skill -- disarming (Level, by Class) */ + p_ptr->skill_dis += (cp_ptr->x_dis * p_ptr->lev / 10); + + /* Affect Skill -- magic devices (Level, by Class) */ + p_ptr->skill_dev += (cp_ptr->x_dev * p_ptr->lev / 10); + + /* Affect Skill -- saving throw (Level, by Class) */ + p_ptr->skill_sav += (cp_ptr->x_sav * p_ptr->lev / 10); + + /* Affect Skill -- stealth (Level, by Class) */ + p_ptr->skill_stl += (cp_ptr->x_stl * p_ptr->lev / 10); + + /* Affect Skill -- search ability (Level, by Class) */ + p_ptr->skill_srh += (cp_ptr->x_srh * p_ptr->lev / 10); + + /* Affect Skill -- search frequency (Level, by Class) */ + p_ptr->skill_fos += (cp_ptr->x_fos * p_ptr->lev / 10); + + /* Affect Skill -- combat (normal) (Level, by Class) */ + p_ptr->skill_thn += (cp_ptr->x_thn * p_ptr->lev / 10); + + /* Affect Skill -- combat (shooting) (Level, by Class) */ + p_ptr->skill_thb += (cp_ptr->x_thb * p_ptr->lev / 10); + + /* Affect Skill -- combat (throwing) (Level, by Class) */ + p_ptr->skill_tht += (cp_ptr->x_thb * p_ptr->lev / 10); + + /* Limit Skill -- digging from 1 up */ + if (p_ptr->skill_dig < 1) p_ptr->skill_dig = 1; + + /* Limit Skill -- stealth from 0 to 30 */ + if (p_ptr->skill_stl > 30) p_ptr->skill_stl = 30; + if (p_ptr->skill_stl < 0) p_ptr->skill_stl = 0; + + /* Apply Skill -- Extract noise from stealth */ + p_ptr->noise = (1L << (30 - p_ptr->skill_stl)); + /* Obtain the "hold" value */ hold = adj_str_hold[p_ptr->stat_ind[A_STR]]; + /*** Analyze current bow ***/ + /* Examine the "current bow" */ o_ptr = &inventory[INVEN_BOW]; /* Assume not heavy */ p_ptr->heavy_shoot = FALSE; *************** *** 2305,2341 **** p_ptr->heavy_shoot = TRUE; } ! ! /* Compute "extra shots" if needed */ ! if (o_ptr->k_idx && !p_ptr->heavy_shoot) { ! /* Take note of required "tval" for missiles */ switch (o_ptr->sval) { case SV_SLING: { ! p_ptr->tval_ammo = TV_SHOT; break; } case SV_SHORT_BOW: case SV_LONG_BOW: { ! p_ptr->tval_ammo = TV_ARROW; break; } case SV_LIGHT_XBOW: case SV_HEAVY_XBOW: { ! p_ptr->tval_ammo = TV_BOLT; break; } } ! /* Hack -- Reward High Level Rangers using Bows */ ! if ((p_ptr->pclass == 4) && (p_ptr->tval_ammo == TV_ARROW)) { /* Extra shot at level 20 */ if (p_ptr->lev >= 20) p_ptr->num_fire++; --- 2289,2357 ---- p_ptr->heavy_shoot = TRUE; } ! /* Analyze launcher */ ! if (o_ptr->k_idx) { ! /* Get to shoot */ ! p_ptr->num_fire = 1; ! ! /* Analyze the launcher */ switch (o_ptr->sval) { + /* Sling and ammo */ case SV_SLING: { ! p_ptr->ammo_tval = TV_SHOT; ! p_ptr->ammo_mult = 2; break; } + /* Short Bow and Arrow */ case SV_SHORT_BOW: + { + p_ptr->ammo_tval = TV_ARROW; + p_ptr->ammo_mult = 2; + break; + } + + /* Long Bow and Arrow */ case SV_LONG_BOW: { ! p_ptr->ammo_tval = TV_ARROW; ! p_ptr->ammo_mult = 3; break; } + /* Light Crossbow and Bolt */ case SV_LIGHT_XBOW: + { + p_ptr->ammo_tval = TV_BOLT; + p_ptr->ammo_mult = 3; + break; + } + + /* Heavy Crossbow and Bolt */ case SV_HEAVY_XBOW: { ! p_ptr->ammo_tval = TV_BOLT; ! p_ptr->ammo_mult = 4; break; } } ! /* Apply special flags */ ! if (o_ptr->k_idx && !p_ptr->heavy_shoot) { + /* Extra shots */ + p_ptr->num_fire += extra_shots; + + /* Extra might */ + p_ptr->ammo_mult += extra_might; + + /* Hack -- Rangers love Bows */ + if ((p_ptr->pclass == CLASS_RANGER) && + (p_ptr->ammo_tval == TV_ARROW)) + { /* Extra shot at level 20 */ if (p_ptr->lev >= 20) p_ptr->num_fire++; *************** *** 2342,2361 **** /* Extra shot at level 40 */ if (p_ptr->lev >= 40) p_ptr->num_fire++; } - /* Add in the "bonus shots" */ - p_ptr->num_fire += extra_shots; - /* Require at least one shot */ if (p_ptr->num_fire < 1) p_ptr->num_fire = 1; } ! /* Examine the "main weapon" */ o_ptr = &inventory[INVEN_WIELD]; - /* Assume not heavy */ p_ptr->heavy_wield = FALSE; --- 2358,2375 ---- /* Extra shot at level 40 */ if (p_ptr->lev >= 40) p_ptr->num_fire++; } + } /* Require at least one shot */ if (p_ptr->num_fire < 1) p_ptr->num_fire = 1; } + /*** Analyze weapon ***/ ! /* Examine the "current weapon" */ o_ptr = &inventory[INVEN_WIELD]; /* Assume not heavy */ p_ptr->heavy_wield = FALSE; *************** *** 2370,2376 **** p_ptr->heavy_wield = TRUE; } - /* Normal weapons */ if (o_ptr->k_idx && !p_ptr->heavy_wield) { --- 2384,2389 ---- *************** *** 2431,2437 **** p_ptr->skill_dig += (o_ptr->weight / 10); } - /* Assume okay */ p_ptr->icky_wield = FALSE; --- 2444,2449 ---- *************** *** 2452,2510 **** } ! /* Affect Skill -- stealth (bonus one) */ ! p_ptr->skill_stl += 1; ! /* Affect Skill -- disarming (DEX and INT) */ ! p_ptr->skill_dis += adj_dex_dis[p_ptr->stat_ind[A_DEX]]; ! p_ptr->skill_dis += adj_int_dis[p_ptr->stat_ind[A_INT]]; ! /* Affect Skill -- magic devices (INT) */ ! p_ptr->skill_dev += adj_int_dev[p_ptr->stat_ind[A_INT]]; ! /* Affect Skill -- saving throw (WIS) */ ! p_ptr->skill_sav += adj_wis_sav[p_ptr->stat_ind[A_WIS]]; ! /* Affect Skill -- digging (STR) */ ! p_ptr->skill_dig += adj_str_dig[p_ptr->stat_ind[A_STR]]; ! /* Affect Skill -- disarming (Level, by Class) */ ! p_ptr->skill_dis += (cp_ptr->x_dis * p_ptr->lev / 10); ! /* Affect Skill -- magic devices (Level, by Class) */ ! p_ptr->skill_dev += (cp_ptr->x_dev * p_ptr->lev / 10); ! /* Affect Skill -- saving throw (Level, by Class) */ ! p_ptr->skill_sav += (cp_ptr->x_sav * p_ptr->lev / 10); ! /* Affect Skill -- stealth (Level, by Class) */ ! p_ptr->skill_stl += (cp_ptr->x_stl * p_ptr->lev / 10); ! /* Affect Skill -- search ability (Level, by Class) */ ! p_ptr->skill_srh += (cp_ptr->x_srh * p_ptr->lev / 10); ! /* Affect Skill -- search frequency (Level, by Class) */ ! p_ptr->skill_fos += (cp_ptr->x_fos * p_ptr->lev / 10); ! /* Affect Skill -- combat (normal) (Level, by Class) */ ! p_ptr->skill_thn += (cp_ptr->x_thn * p_ptr->lev / 10); - /* Affect Skill -- combat (shooting) (Level, by Class) */ - p_ptr->skill_thb += (cp_ptr->x_thb * p_ptr->lev / 10); - - /* Affect Skill -- combat (throwing) (Level, by Class) */ - p_ptr->skill_tht += (cp_ptr->x_thb * p_ptr->lev / 10); - - - /* Limit Skill -- stealth from 0 to 30 */ - if (p_ptr->skill_stl > 30) p_ptr->skill_stl = 30; - if (p_ptr->skill_stl < 0) p_ptr->skill_stl = 0; - - /* Limit Skill -- digging from 1 up */ - if (p_ptr->skill_dig < 1) p_ptr->skill_dig = 1; - - /* Hack -- handle "xtra" mode */ if (character_xtra) return; --- 2464,2554 ---- } ! /*** Notice changes ***/ ! /* Analyze stats */ ! for (i = 0; i < 6; i++) ! { ! /* Notice changes */ ! if (p_ptr->stat_top[i] != old_stat_top[i]) ! { ! /* Redisplay the stats later */ ! p_ptr->redraw |= (PR_STATS); ! /* Window stuff */ ! p_ptr->window |= (PW_PLAYER); ! } ! /* Notice changes */ ! if (p_ptr->stat_use[i] != old_stat_use[i]) ! { ! /* Redisplay the stats later */ ! p_ptr->redraw |= (PR_STATS); ! /* Window stuff */ ! p_ptr->window |= (PW_PLAYER); ! } + /* Notice changes */ + if (p_ptr->stat_ind[i] != old_stat_ind[i]) + { + /* Change in CON affects Hitpoints */ + if (i == A_CON) + { + p_ptr->update |= (PU_HP); + } ! /* Change in INT may affect Mana/Spells */ ! else if (i == A_INT) ! { ! if (mp_ptr->spell_stat == A_INT) ! { ! p_ptr->update |= (PU_MANA | PU_SPELLS); ! } ! } ! /* Change in WIS may affect Mana/Spells */ ! else if (i == A_WIS) ! { ! if (mp_ptr->spell_stat == A_WIS) ! { ! p_ptr->update |= (PU_MANA | PU_SPELLS); ! } ! } ! } ! } ! /* Hack -- Telepathy Change */ ! if (p_ptr->telepathy != old_telepathy) ! { ! /* Update monster visibility */ ! p_ptr->update |= (PU_MONSTERS); ! } ! /* Hack -- See Invis Change */ ! if (p_ptr->see_inv != old_see_inv) ! { ! /* Update monster visibility */ ! p_ptr->update |= (PU_MONSTERS); ! } ! /* Redraw speed (if needed) */ ! if (p_ptr->pspeed != old_speed) ! { ! /* Redraw speed */ ! p_ptr->redraw |= (PR_SPEED); ! } ! /* Redraw armor (if needed) */ ! if ((p_ptr->dis_ac != old_dis_ac) || (p_ptr->dis_to_a != old_dis_to_a)) ! { ! /* Redraw */ ! p_ptr->redraw |= (PR_ARMOR); ! /* Window stuff */ ! p_ptr->window |= (PW_PLAYER); ! } /* Hack -- handle "xtra" mode */ if (character_xtra) return; *************** *** 2529,2535 **** p_ptr->old_heavy_shoot = p_ptr->heavy_shoot; } - /* Take note when "heavy weapon" changes */ if (p_ptr->old_heavy_wield != p_ptr->heavy_wield) { --- 2573,2578 ---- *************** *** 2551,2557 **** p_ptr->old_heavy_wield = p_ptr->heavy_wield; } - /* Take note when "illegal weapon" changes */ if (p_ptr->old_icky_wield != p_ptr->icky_wield) { --- 2594,2599 ---- Only in angband-281/src: xtra1.o diff -r -c -w src-281/xtra2.c angband-281/src/xtra2.c *** src-281/xtra2.c Mon Mar 3 22:40:22 1997 --- angband-281/src/xtra2.c Thu Apr 24 22:07:59 1997 *************** *** 1678,1684 **** p_ptr->lev++; /* Save the highest level */ ! if (p_ptr->lev > p_ptr->max_plv) p_ptr->max_plv = p_ptr->lev; /* Sound */ sound(SOUND_LEVEL); --- 1678,1684 ---- p_ptr->lev++; /* Save the highest level */ ! if (p_ptr->lev > p_ptr->max_lev) p_ptr->max_lev = p_ptr->lev; /* Sound */ sound(SOUND_LEVEL); *************** *** 1812,1819 **** int force_coin = get_coin_type(r_ptr); ! object_type forge; ! object_type *q_ptr; /* Get the location */ --- 1812,1819 ---- int force_coin = get_coin_type(r_ptr); ! object_type *i_ptr; ! object_type object_type_body; /* Get the location */ *************** *** 1836,1851 **** o_ptr->held_m_idx = 0; /* Get local object */ ! q_ptr = &forge; /* Copy the object */ ! object_copy(q_ptr, o_ptr); /* Delete the object */ delete_object_idx(this_o_idx); /* Drop it */ ! drop_near(q_ptr, -1, y, x); } /* Forget objects */ --- 1836,1851 ---- o_ptr->held_m_idx = 0; /* Get local object */ ! i_ptr = &object_type_body; /* Copy the object */ ! object_copy(i_ptr, o_ptr); /* Delete the object */ delete_object_idx(this_o_idx); /* Drop it */ ! drop_near(i_ptr, -1, y, x); } /* Forget objects */ *************** *** 1856,1890 **** if (r_ptr->flags1 & (RF1_DROP_CHOSEN)) { /* Get local object */ ! q_ptr = &forge; /* Mega-Hack -- Prepare to make "Grond" */ ! object_prep(q_ptr, lookup_kind(TV_HAFTED, SV_GROND)); /* Mega-Hack -- Mark this item as "Grond" */ ! q_ptr->name1 = ART_GROND; /* Mega-Hack -- Actually create "Grond" */ ! apply_magic(q_ptr, -1, TRUE, TRUE, TRUE); /* Drop it in the dungeon */ ! drop_near(q_ptr, -1, y, x); /* Get local object */ ! q_ptr = &forge; /* Mega-Hack -- Prepare to make "Morgoth" */ ! object_prep(q_ptr, lookup_kind(TV_CROWN, SV_MORGOTH)); /* Mega-Hack -- Mark this item as "Morgoth" */ ! q_ptr->name1 = ART_MORGOTH; /* Mega-Hack -- Actually create "Morgoth" */ ! apply_magic(q_ptr, -1, TRUE, TRUE, TRUE); /* Drop it in the dungeon */ ! drop_near(q_ptr, -1, y, x); } --- 1856,1890 ---- if (r_ptr->flags1 & (RF1_DROP_CHOSEN)) { /* Get local object */ ! i_ptr = &object_type_body; /* Mega-Hack -- Prepare to make "Grond" */ ! object_prep(i_ptr, lookup_kind(TV_HAFTED, SV_GROND)); /* Mega-Hack -- Mark this item as "Grond" */ ! i_ptr->name1 = ART_GROND; /* Mega-Hack -- Actually create "Grond" */ ! apply_magic(i_ptr, -1, TRUE, TRUE, TRUE); /* Drop it in the dungeon */ ! drop_near(i_ptr, -1, y, x); /* Get local object */ ! i_ptr = &object_type_body; /* Mega-Hack -- Prepare to make "Morgoth" */ ! object_prep(i_ptr, lookup_kind(TV_CROWN, SV_MORGOTH)); /* Mega-Hack -- Mark this item as "Morgoth" */ ! i_ptr->name1 = ART_MORGOTH; /* Mega-Hack -- Actually create "Morgoth" */ ! apply_magic(i_ptr, -1, TRUE, TRUE, TRUE); /* Drop it in the dungeon */ ! drop_near(i_ptr, -1, y, x); } *************** *** 1900,1921 **** coin_type = force_coin; /* Average dungeon and monster levels */ ! object_level = (dun_level + r_ptr->level) / 2; /* Drop some objects */ for (j = 0; j < number; j++) { /* Get local object */ ! q_ptr = &forge; /* Wipe the object */ ! object_wipe(q_ptr); /* Make Gold */ if (do_gold && (!do_item || (rand_int(100) < 50))) { /* Make some gold */ ! if (!make_gold(q_ptr)) continue; /* XXX XXX XXX */ dump_gold++; --- 1900,1921 ---- coin_type = force_coin; /* Average dungeon and monster levels */ ! object_level = (p_ptr->depth + r_ptr->level) / 2; /* Drop some objects */ for (j = 0; j < number; j++) { /* Get local object */ ! i_ptr = &object_type_body; /* Wipe the object */ ! object_wipe(i_ptr); /* Make Gold */ if (do_gold && (!do_item || (rand_int(100) < 50))) { /* Make some gold */ ! if (!make_gold(i_ptr)) continue; /* XXX XXX XXX */ dump_gold++; *************** *** 1925,1931 **** else { /* Make an object */ ! if (!make_object(q_ptr, good, great)) continue; /* XXX XXX XXX */ dump_item++; --- 1925,1931 ---- else { /* Make an object */ ! if (!make_object(i_ptr, good, great)) continue; /* XXX XXX XXX */ dump_item++; *************** *** 1932,1942 **** } /* Drop it in the dungeon */ ! drop_near(q_ptr, -1, y, x); } /* Reset the object level */ ! object_level = dun_level; /* Reset "coin" type */ coin_type = 0; --- 1932,1942 ---- } /* Drop it in the dungeon */ ! drop_near(i_ptr, -1, y, x); } /* Reset the object level */ ! object_level = p_ptr->depth; /* Reset "coin" type */ coin_type = 0; *************** *** 2014,2020 **** /* ! * Decreases monsters hit points, handling monster death. * * We return TRUE if the monster has been killed (and deleted). * --- 2014,2020 ---- /* ! * Decrease a monster's hit points, handle monster death. * * We return TRUE if the monster has been killed (and deleted). * *************** *** 2026,2046 **** * various "specialized" messages. Note that "You have destroyed" * and "is destroyed" are synonyms for "You have slain" and "dies". * ! * Hack -- unseen monsters yield "You have killed it." message. * - * Added fear (DGK) and check whether to print fear messages -CWS - * - * Genericized name, sex, and capitilization -BEN- - * - * As always, the "ghost" processing is a total hack. - * * Hack -- we "delay" fear messages by passing around a "fear" flag. * ! * XXX XXX XXX Consider decreasing monster experience over time, say, ! * by using "(m_exp * m_lev * (m_lev)) / (p_lev * (m_lev + n_killed))" ! * instead of simply "(m_exp * m_lev) / (p_lev)", to make the first ! * monster worth more than subsequent monsters. This would also need ! * to induce changes in the monster recall code. */ bool mon_take_hit(int m_idx, int dam, bool *fear, cptr note) { --- 2026,2040 ---- * various "specialized" messages. Note that "You have destroyed" * and "is destroyed" are synonyms for "You have slain" and "dies". * ! * Invisible monsters induce a special "You have killed it." message. * * Hack -- we "delay" fear messages by passing around a "fear" flag. * ! * Consider decreasing monster experience over time, say, by using ! * "(m_exp * m_lev * (m_lev)) / (p_lev * (m_lev + n_killed))" instead ! * of simply "(m_exp * m_lev) / (p_lev)", to make the first monster ! * worth more than subsequent monsters. This would also need to ! * induce changes in the monster recall code. XXX XXX XXX */ bool mon_take_hit(int m_idx, int dam, bool *fear, cptr note) { *************** *** 2100,2106 **** } /* Maximum player level */ ! div = p_ptr->max_plv; /* Give some experience for the kill */ new_exp = ((long)r_ptr->mexp * r_ptr->level) / div; --- 2094,2100 ---- } /* Maximum player level */ ! div = p_ptr->max_lev; /* Give some experience for the kill */ new_exp = ((long)r_ptr->mexp * r_ptr->level) / div; *************** *** 2229,2245 **** /* ! * Given an row (y) and col (x), this routine detects when a move ! * off the screen has occurred and figures new borders. -RAK- * ! * "Update" forces a "full update" to take place. ! * ! * The map is reprinted if necessary, and "TRUE" is returned. */ void verify_panel(void) { ! int y = py; ! int x = px; int prow = panel_row; int pcol = panel_col; --- 2223,2239 ---- /* ! * Check for, and react to, the player leaving the panel * ! * When the player gets too close to the edge of a panel, the ! * map scrolls one panel (one half screen) so that the player ! * is no longer so close to the edge. This causes the panel ! * boundaries to be recalculated, and the map to be redrawn. */ void verify_panel(void) { ! int y = p_ptr->py; ! int x = p_ptr->px; int prow = panel_row; int pcol = panel_col; *************** *** 2429,2435 **** if (!m_ptr->ml) return (FALSE); /* Monster must be projectable */ ! if (!projectable(py, px, m_ptr->fy, m_ptr->fx)) return (FALSE); /* Hack -- no targeting hallucinations */ if (p_ptr->image) return (FALSE); --- 2423,2429 ---- if (!m_ptr->ml) return (FALSE); /* Monster must be projectable */ ! if (!projectable(p_ptr->py, p_ptr->px, m_ptr->fy, m_ptr->fx)) return (FALSE); /* Hack -- no targeting hallucinations */ if (p_ptr->image) return (FALSE); *************** *** 2490,2495 **** --- 2484,2492 ---- int da, db, kx, ky; + int py = p_ptr->py; + int px = p_ptr->px; + /* Absolute distance components */ kx = x[a]; kx -= px; kx = ABS(kx); ky = y[a]; ky -= py; ky = ABS(ky); *************** *** 2598,2604 **** /* Player grid is always interesting */ ! if ((y == py) && (x == px)) return (TRUE); /* Handle hallucination */ --- 2595,2601 ---- /* Player grid is always interesting */ ! if ((y == p_ptr->py) && (x == p_ptr->px)) return (TRUE); /* Handle hallucination */ *************** *** 2768,2774 **** s3 = ""; /* Hack -- under the player */ ! if ((y == py) && (x == px)) { /* Description */ s1 = "You are "; --- 2765,2771 ---- s3 = ""; /* Hack -- under the player */ ! if ((y == p_ptr->py) && (x == p_ptr->px)) { /* Description */ s1 = "You are "; *************** *** 3071,3076 **** --- 3068,3076 ---- { int i, d, m; + int py = p_ptr->py; + int px = p_ptr->px; + int y = py; int x = px; *************** *** 3326,3340 **** /* ! * Get an "aiming direction" from the user. * ! * The "dir" is loaded with 1,2,3,4,6,7,8,9 for "actual direction", and ! * "0" for "current target", and "-1" for "entry aborted". * * Note that "Force Target", if set, will pre-empt user interaction, * if there is a usable target already set. * ! * Note that confusion over-rides any (explicit?) user choice. */ bool get_aim_dir(int *dp) { --- 3326,3344 ---- /* ! * Get an "aiming direction" (1,2,3,4,6,7,8,9 or 5) from the user. * ! * Return TRUE if a direction was chosen, otherwise return FALSE. * + * The direction "5" is special, and means "use current target". + * + * This function tracks and uses the "global direction", and uses + * that as the "desired direction", if it is set. + * * Note that "Force Target", if set, will pre-empt user interaction, * if there is a usable target already set. * ! * Currently this function applies confusion directly. */ bool get_aim_dir(int *dp) { *************** *** 3436,3455 **** /* ! * Request a "movement" direction (1,2,3,4,6,7,8,9) from the user, ! * and place it into "command_dir", unless we already have one. * * This function should be used for all "repeatable" commands, such as * run, walk, open, close, bash, disarm, spike, tunnel, etc, as well * as all commands which must reference a grid adjacent to the player, ! * and which may not reference the grid under the player. Note that, ! * for example, it is no longer possible to "disarm" or "open" chests ! * in the same grid as the player. * ! * Direction "5" is illegal and will (cleanly) abort the command. * * This function tracks and uses the "global direction", and uses ! * that as the "desired direction", to which "confusion" is applied. */ bool get_rep_dir(int *dp) { --- 3440,3458 ---- /* ! * Request a "movement" direction (1,2,3,4,6,7,8,9) from the user. * + * Return TRUE if a direction was chosen, otherwise return FALSE. + * * This function should be used for all "repeatable" commands, such as * run, walk, open, close, bash, disarm, spike, tunnel, etc, as well * as all commands which must reference a grid adjacent to the player, ! * and which may not reference the grid under the player. * ! * Direction "5" (and "0") are illegal and will not be accepted. * * This function tracks and uses the "global direction", and uses ! * that as the "desired direction", if it is set. */ bool get_rep_dir(int *dp) { *************** *** 3473,3485 **** /* Look up the direction */ dir = keymap_dirs[ch & 0x7F]; /* Oops */ if (!dir) bell(); } - /* Prevent weirdness */ - if (dir == 5) dir = 0; - /* Aborted */ if (!dir) return (FALSE); --- 3476,3488 ---- /* Look up the direction */ dir = keymap_dirs[ch & 0x7F]; + /* Prevent weirdness */ + if (dir == 5) dir = 0; + /* Oops */ if (!dir) bell(); } /* Aborted */ if (!dir) return (FALSE); *************** *** 3486,3496 **** /* Save desired direction */ command_dir = dir; /* Apply "confusion" */ if (p_ptr->confused) { ! /* Standard confusion */ ! if (rand_int(100) < 75) { /* Random direction */ dir = ddd[rand_int(8)]; --- 3489,3519 ---- /* Save desired direction */ command_dir = dir; + /* Save direction */ + (*dp) = dir; + + /* Success */ + return (TRUE); + } + + + /* + * Apply confusion, if needed, to a direction + * + * Display a message and return TRUE if direction changes. + */ + bool confuse_dir(int *dp) + { + int dir; + + /* Default */ + dir = (*dp); + /* Apply "confusion" */ if (p_ptr->confused) { ! /* Apply confusion */ ! if ((dir == 5) || (rand_int(100) < 75)) { /* Random direction */ dir = ddd[rand_int(8)]; *************** *** 3498,3516 **** } /* Notice confusion */ ! if (command_dir != dir) { /* Warn the user */ msg_print("You are confused."); - } /* Save direction */ (*dp) = dir; ! /* Success */ return (TRUE); } ! ! --- 3521,3539 ---- } /* Notice confusion */ ! if ((*dp) != dir) { /* Warn the user */ msg_print("You are confused."); /* Save direction */ (*dp) = dir; ! /* Confused */ return (TRUE); } ! /* Not confused */ ! return (FALSE); ! } Only in angband-281/src: xtra2.o Only in angband-281/src: z-form.o Only in angband-281/src: z-rand.o diff -r -c -w src-281/z-term.c angband-281/src/z-term.c *** src-281/z-term.c Thu Mar 6 20:18:42 1997 --- angband-281/src/z-term.c Thu Apr 24 10:40:29 1997 *************** *** 1845,1850 **** --- 1845,1860 ---- int w = Term->wid; int h = Term->hgt; + /* Create */ + if (!Term->mem) + { + /* Allocate window */ + MAKE(Term->mem, term_win); + + /* Initialize window */ + term_win_init(Term->mem, w, h); + } + /* Grab */ term_win_copy(Term->mem, Term->scr, w, h); *************** *** 1865,1870 **** --- 1875,1890 ---- int w = Term->wid; int h = Term->hgt; + /* Create */ + if (!Term->mem) + { + /* Allocate window */ + MAKE(Term->mem, term_win); + + /* Initialize window */ + term_win_init(Term->mem, w, h); + } + /* Load */ term_win_copy(Term->scr, Term->mem, w, h); *************** *** 1885,1892 **** --- 1905,1958 ---- } + /* + * Exchange the "requested" screen with the "tmp" screen + * + * Export this function at some point XXX XXX XXX + */ + static errr Term_exchange(void) + { + int y; + int w = Term->wid; + int h = Term->hgt; + term_win *exchanger; + + + /* Create */ + if (!Term->tmp) + { + /* Allocate window */ + MAKE(Term->tmp, term_win); + + /* Initialize window */ + term_win_init(Term->tmp, w, h); + } + + /* Swap */ + exchanger = Term->scr; + Term->scr = Term->tmp; + Term->tmp = exchanger; + + /* Assume change */ + for (y = 0; y < h; y++) + { + /* Assume change */ + Term->x1[y] = 0; + Term->x2[y] = w - 1; + } + + /* Assume change */ + Term->y1 = 0; + Term->y2 = h - 1; + + /* Success */ + return (0); + } + + + /* * React to a new physical window size. */ *************** *** 1902,1915 **** term_win *hold_old; term_win *hold_scr; term_win *hold_mem; - - #if 0 - term_win *hold_tmp; - #endif - /* Ignore illegal changes */ if ((w < 1) || (h < 1)) return (1); --- 1968,1976 ---- *************** *** 1916,1928 **** /* Ignore non-changes */ if ((Term->wid == w) && (Term->hgt == h)) return (1); /* Minimum dimensions */ wid = MIN(Term->wid, w); hgt = MIN(Term->hgt, h); - - /*** Save ***/ - /* Save scanners */ hold_x1 = Term->x1; hold_x2 = Term->x2; --- 1977,1987 ---- /* Ignore non-changes */ if ((Term->wid == w) && (Term->hgt == h)) return (1); + /* Minimum dimensions */ wid = MIN(Term->wid, w); hgt = MIN(Term->hgt, h); /* Save scanners */ hold_x1 = Term->x1; hold_x2 = Term->x2; *************** *** 1936,1956 **** /* Save old window */ hold_mem = Term->mem; - #if 0 - /* Save old window */ hold_tmp = Term->tmp; - #endif - - - /*** Make new ***/ - /* Create new scanners */ C_MAKE(Term->x1, h, byte); C_MAKE(Term->x2, h, byte); - /* Create new window */ MAKE(Term->old, term_win); --- 1995,2007 ---- *************** *** 1960,1966 **** /* Save the contents */ term_win_copy(Term->old, hold_old, wid, hgt); - /* Create new window */ MAKE(Term->scr, term_win); --- 2011,2016 ---- *************** *** 1970,1976 **** /* Save the contents */ term_win_copy(Term->scr, hold_scr, wid, hgt); ! /* Create new window */ MAKE(Term->mem, term_win); --- 2020,2028 ---- /* Save the contents */ term_win_copy(Term->scr, hold_scr, wid, hgt); ! /* If needed */ ! if (hold_mem) ! { /* Create new window */ MAKE(Term->mem, term_win); *************** *** 1979,1988 **** /* Save the contents */ term_win_copy(Term->mem, hold_mem, wid, hgt); ! ! #if 0 ! /* Create new window */ MAKE(Term->tmp, term_win); --- 2031,2041 ---- /* Save the contents */ term_win_copy(Term->mem, hold_mem, wid, hgt); + } ! /* If needed */ ! if (hold_tmp) ! { /* Create new window */ MAKE(Term->tmp, term_win); *************** *** 1991,2007 **** /* Save the contents */ term_win_copy(Term->tmp, hold_tmp, wid, hgt); - #endif - - - /*** Kill old ***/ - /* Free some arrays */ C_KILL(hold_x1, Term->hgt, byte); C_KILL(hold_x2, Term->hgt, byte); - /* Nuke */ term_win_nuke(hold_old, Term->wid, Term->hgt); --- 2044,2055 ---- /* Save the contents */ term_win_copy(Term->tmp, hold_tmp, wid, hgt); + } /* Free some arrays */ C_KILL(hold_x1, Term->hgt, byte); C_KILL(hold_x2, Term->hgt, byte); /* Nuke */ term_win_nuke(hold_old, Term->wid, Term->hgt); *************** *** 2008,2013 **** --- 2056,2064 ---- /* Kill */ KILL(hold_old, term_win); + /* Illegal cursor */ + if (Term->old->cx >= w) Term->old->cu = 1; + if (Term->old->cy >= h) Term->old->cu = 1; /* Nuke */ term_win_nuke(hold_scr, Term->wid, Term->hgt); *************** *** 2015,2021 **** --- 2066,2078 ---- /* Kill */ KILL(hold_scr, term_win); + /* Illegal cursor */ + if (Term->scr->cx >= w) Term->scr->cu = 1; + if (Term->scr->cy >= h) Term->scr->cu = 1; + /* If needed */ + if (hold_mem) + { /* Nuke */ term_win_nuke(hold_mem, Term->wid, Term->hgt); *************** *** 2022,2030 **** /* Kill */ KILL(hold_mem, term_win); ! #if 0 ! /* Nuke */ term_win_nuke(hold_tmp, Term->wid, Term->hgt); --- 2079,2092 ---- /* Kill */ KILL(hold_mem, term_win); + /* Illegal cursor */ + if (Term->mem->cx >= w) Term->mem->cu = 1; + if (Term->mem->cy >= h) Term->mem->cu = 1; + } ! /* If needed */ ! if (hold_tmp) ! { /* Nuke */ term_win_nuke(hold_tmp, Term->wid, Term->hgt); *************** *** 2031,2067 **** /* Kill */ KILL(hold_tmp, term_win); - #endif - - - /*** Verify cursor ***/ - /* Illegal cursor */ - if (Term->old->cx >= w) Term->old->cu = 1; - if (Term->old->cy >= h) Term->old->cu = 1; - - /* Illegal cursor */ - if (Term->scr->cx >= w) Term->scr->cu = 1; - if (Term->scr->cy >= h) Term->scr->cu = 1; - - /* Illegal cursor */ - if (Term->mem->cx >= w) Term->mem->cu = 1; - if (Term->mem->cy >= h) Term->mem->cu = 1; - - #if 0 - - /* Illegal cursor */ if (Term->tmp->cx >= w) Term->tmp->cu = 1; if (Term->tmp->cy >= h) Term->tmp->cu = 1; - #endif - - /* Save new size */ Term->wid = w; Term->hgt = h; - /* Force "total erase" */ Term->total_erase = TRUE; --- 2093,2107 ---- /* Kill */ KILL(hold_tmp, term_win); /* Illegal cursor */ if (Term->tmp->cx >= w) Term->tmp->cu = 1; if (Term->tmp->cy >= h) Term->tmp->cu = 1; + } /* Save new size */ Term->wid = w; Term->hgt = h; /* Force "total erase" */ Term->total_erase = TRUE; *************** *** 2161,2183 **** /* Kill "requested" */ KILL(t->scr, term_win); /* Nuke "memorized" */ term_win_nuke(t->mem, w, h); /* Kill "memorized" */ KILL(t->mem, term_win); ! #if 0 ! /* Nuke "temporary" */ term_win_nuke(t->tmp, w, h); /* Kill "temporary" */ KILL(t->tmp, term_win); - #endif - - /* Free some arrays */ C_KILL(t->x1, h, byte); C_KILL(t->x2, h, byte); --- 2201,2226 ---- /* Kill "requested" */ KILL(t->scr, term_win); + /* If needed */ + if (t->mem) + { /* Nuke "memorized" */ term_win_nuke(t->mem, w, h); /* Kill "memorized" */ KILL(t->mem, term_win); + } ! /* If needed */ ! if (t->tmp) ! { /* Nuke "temporary" */ term_win_nuke(t->tmp, w, h); /* Kill "temporary" */ KILL(t->tmp, term_win); + } /* Free some arrays */ C_KILL(t->x1, h, byte); C_KILL(t->x2, h, byte); *************** *** 2238,2260 **** term_win_init(t->scr, w, h); - /* Allocate "memorized" */ - MAKE(t->mem, term_win); - - /* Initialize "memorized" */ - term_win_init(t->mem, w, h); - - - #if 0 - - /* Allocate "temporary" */ - MAKE(t->tmp, term_win); - - /* Initialize "temporary" */ - term_win_init(t->tmp, w, h); - - #endif - /* Assume change */ for (y = 0; y < h; y++) { --- 2281,2286 ---- Only in angband-281/src: z-term.o Only in angband-281/src: z-util.o Only in angband-281/src: z-virt.o