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 ----