Add paranoid:swim to prevent typoing into water or lava

In the name of accessibility: Prevent moving into dangerous liquids.

Now with themed rooms, water and lava are more common, and it's
unreasonable to expect blind players to check every step for those.
With paranoid:swim, just prevent normal walking into those liquids,
unless you prefix the movement with 'm', or if the liquid would not
harm you.

Doesn't completely prevent an accidental dunking - for example
if the hero is impaired or couldn't see the liquid.

This comes from xNetHack by copperwater <aosdict@gmail.com>
with some changes to the code.
This commit is contained in:
Pasi Kallinen
2022-02-12 16:30:39 +02:00
parent c862f2a9ca
commit 03c715f179
9 changed files with 66 additions and 1 deletions

View File

@@ -150,6 +150,7 @@ struct context_info {
boolean botlx; /* print an entirely new bottom line */
boolean door_opened; /* set to true if door was opened during test_move */
boolean enhance_tip; /* player is informed about #enhance */
boolean swim_tip; /* player was informed about walking into water */
struct dig_info digging;
struct victual_info victual;
struct engrave_info engraving;

View File

@@ -78,6 +78,7 @@ struct flag {
#define PARANOID_BREAKWAND 0x0080
#define PARANOID_WERECHANGE 0x0100
#define PARANOID_EATING 0x0200
#define PARANOID_SWIM 0x0400
int pickup_burden; /* maximum burden before prompt */
int pile_limit; /* controls feedback when walking over objects */
char discosort; /* order of dodiscovery/doclassdisco output: o,s,c,a */
@@ -466,6 +467,8 @@ enum runmode_types {
/* continue eating: prompt given _after_first_bite_ when eating something
while satiated */
#define ParanoidEating ((flags.paranoia_bits & PARANOID_EATING) != 0)
/* Prevent going into lava or water without explicitly forcing it */
#define ParanoidSwim ((flags.paranoia_bits & PARANOID_SWIM) != 0)
/* command parsing, mainly dealing with number_pad handling;
not saved and restored */

View File

@@ -38,6 +38,7 @@
#define is_floater(ptr) ((ptr)->mlet == S_EYE || (ptr)->mlet == S_LIGHT)
/* clinger: piercers, mimics, wumpus -- generally don't fall down holes */
#define is_clinger(ptr) (((ptr)->mflags1 & M1_CLING) != 0L)
#define grounded(ptr) (!is_flyer(ptr) && !is_floater(ptr) && !is_clinger(ptr))
#define is_swimmer(ptr) (((ptr)->mflags1 & M1_SWIM) != 0L)
#define breathless(ptr) (((ptr)->mflags1 & M1_BREATHLESS) != 0L)
#define amphibious(ptr) \

View File

@@ -17,7 +17,7 @@
* Incrementing EDITLEVEL can be used to force invalidation of old bones
* and save files.
*/
#define EDITLEVEL 49
#define EDITLEVEL 50
/*
* Development status possibilities.