Commit Graph

395 Commits

Author SHA1 Message Date
nethack.allison
94ff3505b4 more autopickup_exception
An optimization.

Split the patterns into two chains, one for things you want "always picked up", and one for things you want "never picked up".  That way, the
entire exception list isn't being checked twice, once for each type of
check.  The check for things to "always pick up" only checks the
chain at the AP_GRAB index, and the check for things to "never
pick up" only checks the chain at the AP_LEAVE index.

- Also modifies the toggle autopickup '@' message
appropriately for the AUTOPICKUP_EXCEPTIONS build.
(it just tacks on ", with some exceptions" if there are some)
2003-11-15 23:15:01 +00:00
nethack.rankin
e989ae0b96 resuming interrupted 'A' command
[ Caveat:  compiles ok on branch code but only play tested on trunk code;
  the do_wear.c diff is a lot different between the two variants and the
  trunk one includes some whitespace cleanup. ]

     <email deleted> reported that having a spellcasting monster
destroy some armor while you're in the midst of using 'A' to take that
armor off would result in a crash.  The problem was actually more
widespread than that:  having a nymph steal worn items (accessories as
well as armor), or a succubus remove them, or being interrupted by monster
activity and then reading a scroll of destroy armor prior to resuming 'A'
could all produce a similar crash.  'A' relied on stale context and could
attempt to manipulate an equipment slot which had become empty, ultimately
leading to an attempt to dereference a null pointer.

     The 'R' command didn't have this problem since any accessory gets
removed immediately.  The 'T' command already had handling for this:
there's only one item to deal with and multi-turn take off only applies
to some of the slots; the donning() check followed by cancel_don() took
care of those.  Only 'A' was vulnerable to the problem and it wouldn't
necessarily need to be interrupted and resumed; loss of the current
multi-turn item or any pending item would be enough--but I'm not sure
whether such item loss could occur without also interrupting the current
activity, so resumption of previous 'A' was probably a requirement for
triggering the crash.

     This makes shield and shirt handling be similar to other types of
armor instead of relying on the fact that none of them need to have any
attribute adjustments when put on or taken off.  However, there are
still assumptions (the `cancelled_don' stuff) that some slots don't have
any eligible items requiring more than a single turn to use; that should
probably be changed.
2003-11-15 10:25:09 +00:00
nethack.rankin
23d3a146d9 autopickup exceptions
External names longer than 31 characters trigger a compiler warning
for me about truncation, and that causes make to quit.  So shorten the
two long names.  Also, call the cleanup routine for the FREE_ALL_MEMORY
configuration.
2003-11-15 08:09:18 +00:00
nethack.allison
e9afb34423 autopickup_exceptions enhancement
An enhancement to the original to allow
two types of exceptions:
      always pickup
      never pickup

To specify "never pickup", begin the pattern string with '>'
which is NetHack's down direction symbol (for "leave it down")

To specify "always pickup", begin the pattern string with '<'
which is NetHack's up direction symbol.

For example, to pick up all arrows, regardless of the pickup_
types setting:
autopickup_exception = "<*arrows"
2003-11-15 02:49:07 +00:00
nethack.allison
c0349ec918 autopickup_exceptions build option
Add config.h experimental option AUTOPICKUP_EXCEPTIONS.

It's an interface-only change which allows you to add lines to your
config file to selectively avoid autopickup of items based on their
text description that is displayed when you pick them up. It does
it by matching a pattern against the xname singular return value.

For example:

autopickup_exception = "*corpse" will avoid picking up corpses, even if
food (%) is in your pickup_types.

autopickup_exception = "*brown*"
will avoid picking up any brown items (why, I do not know)

autopickup_exception = "*loadstone"
will NOT avoid picking up loadstones, unless they are already
identified, because the xname string will be "gray stone", so no
match there.

The matching has no knowledge of in-game objects, it is just
a text pattern match, thus it is an interface change, not a gameplay
change, and it is meant as a convenience for players.
2003-11-15 01:05:32 +00:00
nethack.allison
52490ee062 B01004 No mimic corpse effect on pet (trunk only)
Make a mimic effect that lasts only as long as the
pet is still consuming the corpse.
2003-11-12 03:28:26 +00:00
nethack.allison
7bab241f17 flag adjustments (trunk only)
Move all system or port specific flags to sysflags which is used only if
SYSFLAGS is defined, and leave everything else in flags unconditional.
2003-11-09 11:48:38 +00:00
nethack.allison
e3462e093e <Someone> wrote:
> The new ^V wizmode menu is nice, but it is rather misleading; most of
> the levels it lists are "you can't get there from here". Would it be
> possible either to make it only list levels that can be reached
> directly, or alternatively to allow you to reach the ones you
> ordinarily couldn't (maybe by forcefully changing u.uz.dnum to yoink
> you into the right branch, and even summarily issuing you with an
> Amulet if you ask to teleport to the endgame).[...]; being able to bamf
> quickly to Minetown from DL 1, for example, would be damn useful in > testing stuff.

Allow fairly free roaming of the dungeon via the wizard mode teleport menu.
2003-11-02 17:59:22 +00:00
nethack.allison
cdbe3b1d39 U719: grayswandir and exploding black lights
<email deleted> wrote:
> When wielding greyswander and a black light explodes, the
> message is still "You are freaked by a blast of kaleidoscopic
> light!" giving no indication that you are immune to
> hallucination. Maybe something like "You see a blast of color,
> but seem unaffected" would be more appropriate?

return the changed status back to the caller from
make_hallucinated().
2003-10-29 13:03:23 +00:00
nethack.allison
6c4e1227a4 ce fix (from <Someone>)
set interject() and interject_assistance() to NOP for Windows CE port.
2003-10-28 12:19:26 +00:00
nethack.allison
4c0d380e68 tin variety followup (trunk only) 2003-10-28 04:14:01 +00:00
nethack.allison
d08dcbc3fb tin variety (trunk only)
- store the variety of tin at tin creation time
  rather than at tin-opening time (as a negative
  value in spe just as homemade was; spinach
   is still spe 1)

Allow wishing for a particular variety of tin
from the tin variety list:
	"deep fried", "boiled","broiled","candied"
	"dried", "french fried", "homemade"
	"pickled", "pureed", "rotten", "sauteed"
	"smoked", "soup made from", "stir fried",
	"szechuan"
Example: "tin of soup made from orc"

non-debug player could randomly fail on the
variety specification 1 in 4 times
2003-10-28 03:45:49 +00:00
nethack.allison
211666434c more win32tty clean-up
This brings things much closer to correct operation (I hope).
- The shift to only moving the cursor on input (<Someone>'s
changes) had a lot of complications, among them was
that sometimes, there is no more input. When the program was
exiting, or bombing the cursor synch never got done, so the
final messages could end up strewn any place the cursor
happened to be dwelling.

- There were two competing output systems in use: the
wintty stuff for the game, and the msmsg and error stuff
used by the sys/share/pcsys, sys/share/pctty, and
sys/share/pcunix routines.  Those were meant to mimic
output to stdout, where stuff just got sent to a sequential
display.  Over time, there were calls mixed in that depended
on the cursor tracked stuff from the core game, so you
really couldn't be sure where things were going to display.
It wasn't as much of an issue before, because the cursor
really did get moved around as expected. Everything
now ends up in the same output system.

- I even found a use of the real putchar() because
sys/share/pcunix didn't #include wintty.h the same
as the other files, and the macro never got defined.
Who knows where that character was being put -
the game certainly couldn't track it.

While everything I knew to be wrong yesterday is
now working, there may be some other glitches
lurking that I haven't discovered yet.

Please: test, test, test.
2003-10-26 15:56:50 +00:00
nethack.rankin
ca476c0eb2 patchevel.h comment 2003-10-26 06:04:04 +00:00
nethack.allison
b4c2f74c22 class differentiation bit (trunk only)
Healers pick up on the fact that a wand of undead turning
revived a creature.
2003-10-25 22:20:24 +00:00
nethack.allison
2a9f2b1f36 patchlevel.h sync between branch and core 2003-10-25 15:20:04 +00:00
nethack.allison
58f322841d more win32tty fixes
There were still some significant startup message problems
with win32tty.

I've spent a lot of time in the debugger tracing through them all.
I think I've got them all worked out now, certainly the ones that
I was aware of.  There may be some I haven't discovered.
Testing welcomed of course!

This patch also attempts to diagnose the error where someone tries
to execute NetHack directly out of a zip file, and provide
them with a (hopefully) helpful message similar to what we
might end up telling them if they wrote in.  If you want
to test that part, you can comment out the line in the
Makefile that adds "dungeon" to nhdat, and delete the nhdat
in your binary and src directories, and "make install".
Then add the value of your TEMP environment variable as a
DATADIR statement in defaults.nh (here's mine):
	DATADIR=C:\DOCUME~1\ALLISO~1\LOCALS~1\Temp
The diagnostic code engages if the game fails to open
dungeon. It then checks to see if it the game dir is the
TEMP directory for your system, and if so it prints the
message.
2003-10-25 04:02:24 +00:00
nethack.allison
45dd5ffe9f win32tty: startup msg cleanup
the win32 cursor restriction stuff messed up any
messages displayed during abnormal start conditions
where the window system never got initialized properly.
among them:
- messages relating to lock files or games in progress
- dungeon errors
- early panic messages
2003-10-24 15:15:44 +00:00
nethack.allison
04174eda2a starting pet identification
Make it possible to identify your starting pet throughout the game
via is_starting_pet(mon) macro.
2003-10-24 11:52:49 +00:00
nethack.allison
da063bdc18 cvsfix
My cvs tree had the correct code. When I did a cvs update
it didn't pull anything down. When I deleted the include/extern.h
file from my cvs tree, and did an update with the "get the clean copy"
switch, it pulled down an extern.h that was indeed missing the
prototype.  In all cases my local cvs reported that it was 1.130.
I applied the prototype change to the cvs copy, did a cvs diff
to ensure nothing else was out of sync and re-committed.
2003-10-24 10:20:00 +00:00
cohrs
f4fbe1a13e buglist: cutting Shopkeeper the long worm
Cutting a shopkeeper poly'd as a long worm would generate strange messages
and could result in a crash.  cutworm didn't deal with all the intricacies
of duplicating a monster.   Fixed by changing cutworm() to use clone_mon()
to do most of its dirty work.  It seems to me that without this change,
cutting a tame long worm could also have similar bad effects.
Other side effects of this change:
- clone_mon now takes x,y coordinates, 0,0 results in previous behavior
- clone_mon no longer always makes cloned monsters tame/peaceful if player
  caused the clone, using the same formula previously in cutworm.  Someone
  else may wish to tweak this for gremlins.
- clone_mon will christen the new mon with the old shopkeeper's name, even
  though clones are never shopkeepers (game can't handle 2 for a shop)
- cutworm can now be called during conflict or pet combat, although I
  added no such calls (yet)
2003-10-23 02:30:46 +00:00
nethack.allison
9b9f13aa13 Half_physical_damage 07
It is not physical damage if:
1. it already qualifies for some other special type of damage
   for which a special resistance already exists in the game
   including: cold, fire, shock, and acid. Note that fire is
   extended to include all forms of burning, even boiling water
   since that is already dealt with by fire resistance, and in
   most or all cases is caused by fire.
2. it doesn't leave a mark. Marks include destruction of, or
   damage to, an internal organ (including the brain),
   lacerations, bruises, crushed body parts, bleeding.

Current exceptions to the rule (already existing):
- holy water burning chaotic ("it burns like acid") is physical damage.
- unholy water burning lawful is physical damage.
2003-10-22 23:05:24 +00:00
nethack.allison
47e1a6873a Half_physical_damage 2
Another batch of missing Half_physical_damage checks
from the list provided by <Someone>:
- Scrolls of fire (!confused)
- Broken wands
- Splattered burning oil from thrown potion
- Dipping a lit lamp into a potion of oil
- Scrolls of fire (confused, didn't bother with non-confused)
- Being caught in a fireball

Adds a macro Maybe_Half_Phys to assist.
2003-10-21 16:47:59 +00:00
cohrs
231b2b16f8 U453 and buglist item - travel command updates
I wrote to the devteam early last week:
> Given my understanding of travel, it's supposed to be somewhat intelligent,
> and "convenient", and should, therefore avoid walking into water, lava,
> traps, or other things that distant movement would avoid, even if you're
> right next it.  Unless...  the travel destination is the "bad" location
> next to you when the travel starts.
To that end...
- add a context (iflags in 3.4.3 to maintain savefile compat) flag to
differenciate the first travel step from later steps, to allow the
detection of the final sentence, above.
- several changes to set/reset the travel1 flag as needed
- add code to findtravelpath to treat the first step specially if it's
the only step, allowing forced travel into a "bad" location
- correct the "don't travel over traps" code, which was getting confused
because hero's starting location was being avoided
- add code to avoid traveling into water and lava, duplicating
checks used for non-travel running
- fix some strange "guess" travel behavior: avoid zigzag paths when there's
a more direct path (even though the number of moves is the same)
- trunk change adds a new DISP_ALL tmp_at type, and uses it in some debug
code for travel, debug changes not added to the 3.4.3 branch
2003-10-21 02:27:43 +00:00
nethack.allison
db2620d481 crystal balls and '~'
<Someone> wrote:
- You currently appear to be able to specify '~' and have it try
  to detect monsters (though it won't detect any long worms)

Show the entire worm when specifying either '~' or 'w' now.
2003-10-19 19:07:33 +00:00
cohrs
b2ffe64968 breaking migrated objects
Allow migrated objects to break on arrival.  Added code to obj_delivery to
cause this, along with a flag to keep breakage from occurring.  The new
flag isn't used yet, because all the current object migration involve
objects that were moving/dropping.  To help make this change, rloco now
returns whether the object was placed or not, so caller can know if an obj
pointer is still valid or not.

Making the breakage messages for MIGR_NEAR_PLAYER objects show up after the
new level is displayed required some effort (rather than while the old level
was still displayed, which was confusing), due to the needs of goto_level.
- obj_delivery now has 2 passes, one for before player arrives, another after,
allowing the two cases to be treated differently
- goto_level calls obj_delivery twice (run_timers is not called twice,
since the run required before the level is displayed will have already run
any timers on migrating object)
- kill_genocided_monsters now kills eggs on the migrating_objs list too
2003-10-18 22:55:42 +00:00
nethack.allison
716b2e81f4 from <Someone>'s list: destroy wand of digging
20000922    Water should flow into pits from broken WoD, or DoE.

This addresses the Wand of Digging part, but does not
do anything about Drum of Earthquake.
2003-10-16 02:36:26 +00:00
nethack.allison
84f667c5a4 ice Warning (trunk only) 2003-10-13 23:54:41 +00:00
nethack.allison
6712fc1b04 melting ice (trunk only)
add a new melt_ice_away timer for ice created via zapping
a wand/spell of cold.

Some follow-up adjustments to the length of time before
the ice melts may be necessary. Ideally, I'd like to
have it so that the shorter the length of time since
the ice was created, the lesser the chance that it will
melt out from under you.  Likewise, the longer it has
been, the more risky it will be to venture onto it.

At the moment, however, each spot of ice is just
getting a somewhat random time always greater
than 50, which is less than ideal.
2003-10-12 04:21:27 +00:00
kmhugo
dc5a2cf1d4 Deafness tidbit
Fix a typo
2003-10-12 02:39:31 +00:00
cohrs
8ee1ecd2ea hiding under a cockatrice corpse
Reported a while back, a (stonable) hiding monster will hide at a location
containing only a cockatrice corpse.  While it would be interesting to
allow monsters to try, and stone themselves as a result, I chose the
simpler fix which is to not have monsters hide in such situations.  I found
the hiding code was duplicated in several places, so I moved it into a new
hideunder() function that works for both the hero and monsters.
2003-10-10 23:01:42 +00:00
nethack.allison
27749e572e more context (trunk only)
- reading spellbooks
- taking off
2003-10-08 03:31:06 +00:00
nethack.allison
4775dd3cbf headings in option menus
There was a great deal of inconsistency in
different menus on how headings were displayed.
This allows the user to select what they like best.
I was motivated to do this, because I wasn't satisfied
with the appearance of ATR_INVERSE in the menus
on win32tty, and several of them specified it.
2003-10-05 19:56:22 +00:00
nethack.allison
f6f6c1f0d5 saving message history (trunk only)
On September 11, 2003 "<Someone>" wrote:
> When we're going to have a different save file format, could
> the last messages in the message history be saved as well, so
> ^P would work the same before and after saving (possibly
> including a few less messages to make room for the startup
> messages?).

This seemed like a reasonable request. This patch:
- adds the core support required.
- adds the tty supporting routines.
2003-10-05 13:43:16 +00:00
cohrs
a5c8b517d2 X11 dynamic map mode selection
Prompted by a question from Pat a long time back, this change finally allows
tiles or text map mode to be chosen dynamically at runtime (using the
"tiled_map" option) rather than having to pick it via an X resource and
keep your selection until you exit. This brings map mode selection up to a
level similar to most other graphical window ports.
In addition, the map mode automatically switches to text on the Rogue
level, also like other graphical window ports.
The default mode for the X11 binary is now tiles, once again, like most (all?)
other graphical window ports.
The patch also removes some dead X11 code that is unlikely to be useful again.
2003-10-03 02:09:27 +00:00
cohrs
1e2d502ac6 potion-from-sink and the corpsenm field
Change the code involved to use a new #define for the field, like other
overloaded uses of corpsenm.  Also remove one check for this field from
potion.c: there are no blessed potions from sinks.
2003-09-30 18:55:02 +00:00
nethack.allison
1bdf37ec00 SAFERHANGUP win32gui (from <Someone>) 2003-09-30 03:42:01 +00:00
nethack.allison
4349f52899 SAFERHANGUP win ce (from <Someone>) 2003-09-30 03:41:02 +00:00
cohrs
559be58c21 conflicting delayed killers
Introduce a new set of functions to manage delayed killers in the trunk, used
in addressing the various reports of delayed killer confusion.  Since existing
delayed killers are related to player properties, the delayed killers are
keyed by uprop indexes.  I did this to avoid adding yet another set of
similar identifiers.
- the new delayed_killer() is used for stoning, sliming, sickness, and
delayed self-genocide while polymorphed.  Some other timed events don't
use it (and didn't use the old delayed_killer variable) because they
use a fixed message when the timeout occurs.
- A new data structure, struct kinfo, is used to track both delayed and
immediate killers.  This encapsulates all the info involved with
identifying a killer.  The structure contains a buffer, which subsumes the
old killer_buf and several other buffers that didn't/couldn't use killer_buf.
- the killer list is saved and restored as part of the game state.
- the special case of usick_cause was removed and a delayed killer list
entry is now used in its place
- common code dealing with (un)sliming is moved to a new make_slimed function
- attempted to update all make dependencies for new end.c -> lev.h
dependency, sorry if I messed any up
2003-09-29 19:24:20 +00:00
kmhugo
e1f5ddd820 sound cleanup
+ Separate the two uses of flags.soundok.
+ Player-settable option is now called "acoustics".
+ Deafness is now handled as a full-fledged attribute.
+ Check for deafness in You_hear(), rather than caller.
+ Check for deafness in caller, rather than verbalize(),
  because gods can speak to characters in spite of deafness.
+ Since changes are being made to prop.h, reorder it to the
  same order as youprop.h and enlightenment.

There are still some extraneous checks and missing checks
for deafness, which will be followed up in a future patch.

Because of the size of this patch and its savefile incompatibilities,
it is only being applied to the trunk code.  Portions of this patch
were written by Michael Allison.
2003-09-28 03:42:50 +00:00
cohrs
929f9ce2c7 various tests of flaming monsters
This change adds a new flaming() macro and uses it in several places
where the list of flaming monsters was tested.  on_fire() didn't list
salamanders as already being on fire, but should have.  A couple other
cases were not updated to include flaming sphere.
2003-09-26 00:37:24 +00:00
cohrs
afea61ef57 U659 - "destroy" manes
Nethack's manes are based on AD&D manes which are in turn based on the
manes of Roman legend.  They are supposed to be spirits of the dead.
To that end, added them to the nonliving() macro.  The biggest behavioral
change is that death spells no longer effect them, which does technically
make them a bit tougher but also makes sense.  Also, they're so wimpy, it's
hard to believe anyone would use a death/disintegration on them anyway.
2003-09-24 01:29:54 +00:00
nethack.allison
92d59e2fe6 fix cvs macro 2003-09-21 13:34:52 +00:00
nethack.allison
dc9dee3e0d commit new file context.h 2003-09-21 13:32:36 +00:00
nethack.allison
74b834c774 trunk only: preserving context (include files)
Pat Rankin wrote:
> collect them all into some new struct and
> save that separately rather than jamming more non-option stuff
> into struct flags.

This patch:
- collects all context/tracking related fields from flags
  into a new structure called "context."
It also adds the following to the new structure:
- stethoscope turn support
- victual support
- tin support
2003-09-21 11:46:53 +00:00
nethack.allison
018123c007 SAFERHANGUP support for win32tty
win32gui support still needs to be developed.
2003-09-19 11:22:00 +00:00
cohrs
22fe9838f3 SAFERHANGUP support for win/Qt.
Now all the current Unix window-ports support it.
2003-09-19 04:08:37 +00:00
cohrs
d66bd647e6 more SAFERHANGUP
make "done_hup" volatile on platforms where this matters, since hangup()
now returns when it didn't used to.
2003-09-19 03:55:33 +00:00
cohrs
40b5b12673 SAFERHANGUP
This is an initial round of SAFERHANGUP hangup changes.  It introduces
SAFERHANGUP, provides the core framework, and enables it for UNIX.

Window-port changes are provided for win/tty, win/X11 and win/gnome.  Qt
changes should be forthcoming after having Warwick look at them.
window.doc is updated so windowport maintainers have an clue what needs to
be done to support SAFERHANGUP.
2003-09-19 03:15:49 +00:00
cohrs
5e443536d8 "your" artifacts
This patch introduces a change to yname() and Yname2() that avoids the
possessive "your" for the hero's normal, fully identified artifacts.
Quest artifacts still get the possessive, as do all other objects and all
objects not in the hero's possession.  shk_your()/Shk_Your() are used in
many places with a specific, generalized name for the object, so I didn't
introduce the artifact behavior there, although I did change them to append
a space, which simplified some other code.  Through added use of yname(),
there may be some places that used to just say "corpse" that will now be more
descriptive via yname()'s use of cxname().  I'm sure <Someone> will point
out any such places that are too onerous, although nothing obviously is.

I took the opportunity to inspect many uses of "your" and even Your().  Two
new functions are also introduced, yobjnam() and Yobjnam2(), which work
like aobjnam() and yname() combined, because I found that many uses of
aobjnam() were preceeded by "your" and I couldn't generally provide the
desired behavior for artifacts (or future artifacts) without a combined
function.  In some cases, this change allowed better sharing of code.

rust_dmg() still takes a string as input which is sometimes initialized
from xname() and often prepends "your" to it.  Currently, this isn't a
problem since there currently are no normal, armor artifacts.  If/when any
are introduced, rust_dmg() will need to be addressed.

The patch is for the trunk only.  A lot of research was required and I
didn't feel the upside was there for repeating it in the 3.4.3 branch.
2003-09-18 02:52:40 +00:00