Port the autounlock feature, hallucinatory trap names from UnNetHack
This adds a boolean option, autounlock, defaulting to true. When this is set to TRUE, messages stating that some door or container is locked are automatically followed by a prompt asking if you would like to unlock it, if you are carrying an unlocking tool (key, lock pick, or credit card). Architecturally, this extends the pick_lock function to take three additional arguments (door coordinates or a box on the ground you are autounlocking). The code that selects an unlocking tool will always look first for a skeleton key, then a lock pick, then a credit card. Since curses, rust, and other attributes don't really have an effect on the viability of the unlocking device, it didn't seem to warrant making a more complex function for that. Add hallucinatory trap names This adds many funny, realistic, and nonsensical traps to the game, to be shown when the player is hallucinating. Architecturally, the biggest change is merging the what_trap macro and the "defsyms[trap_to_defsym(ttyp)].explanation" pattern into a single function "trapname", which returns the name of the trap, handling the hallucination case. There is also a second parameter used for overriding hallucination in the occasional cases where the actual trap name should always be returned. In addition, the what_trap and random_trap macros are now obsolete and not used anywhere, so they are removed. reinstate anti-rng abuse bit on hallucination updates to hallucinatory trap names and fixes37.0 entry
This commit is contained in:
@@ -149,25 +149,21 @@
|
||||
/*
|
||||
* random_monster()
|
||||
* random_object()
|
||||
* random_trap()
|
||||
*
|
||||
* Respectively return a random monster, object, or trap number.
|
||||
* Respectively return a random monster or object.
|
||||
*/
|
||||
#define random_monster(rng) rng(NUMMONS)
|
||||
#define random_object(rng) (rng(NUM_OBJECTS - 1) + 1)
|
||||
#define random_trap(rng) (rng(TRAPNUM - 1) + 1)
|
||||
|
||||
/*
|
||||
* what_obj()
|
||||
* what_mon()
|
||||
* what_trap()
|
||||
*
|
||||
* If hallucinating, choose a random object/monster, otherwise, use the one
|
||||
* given. Use the given rng to handle hallucination.
|
||||
*/
|
||||
#define what_obj(obj, rng) (Hallucination ? random_object(rng) : obj)
|
||||
#define what_mon(mon, rng) (Hallucination ? random_monster(rng) : mon)
|
||||
#define what_trap(trp, rng) (Hallucination ? random_trap(rng) : trp)
|
||||
|
||||
/*
|
||||
* newsym_rn2
|
||||
@@ -339,7 +335,7 @@
|
||||
((((expltype) * MAXEXPCHARS) + ((idx) - S_explode1)) + GLYPH_EXPLODE_OFF)
|
||||
|
||||
#define trap_to_glyph(trap, rng) \
|
||||
cmap_to_glyph(trap_to_defsym(what_trap((trap)->ttyp, rng)))
|
||||
cmap_to_glyph(trap_to_defsym((trap)->ttyp))
|
||||
|
||||
/* Not affected by hallucination. Gives a generic body for CORPSE */
|
||||
/* MRKR: ...and the generic statue */
|
||||
|
||||
@@ -1117,7 +1117,7 @@ E boolean FDECL(picking_at, (int, int));
|
||||
E void FDECL(breakchestlock, (struct obj *, BOOLEAN_P));
|
||||
E void NDECL(reset_pick);
|
||||
E void FDECL(maybe_reset_pick, (struct obj *));
|
||||
E int FDECL(pick_lock, (struct obj *));
|
||||
E int FDECL(pick_lock, (struct obj *, xchar, xchar, struct obj *));
|
||||
E int NDECL(doforce);
|
||||
E boolean FDECL(boxlock, (struct obj *, struct obj *));
|
||||
E boolean FDECL(doorlock, (struct obj *, int, int));
|
||||
@@ -2653,6 +2653,7 @@ E boolean FDECL(uescaped_shaft, (struct trap *));
|
||||
E boolean NDECL(lava_effects);
|
||||
E void NDECL(sink_into_lava);
|
||||
E void NDECL(sokoban_guilt);
|
||||
E const char * FDECL(trapname, (int, BOOLEAN_P));
|
||||
|
||||
/* ### u_init.c ### */
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ struct flag {
|
||||
boolean autodig; /* MRKR: Automatically dig */
|
||||
boolean autoquiver; /* Automatically fill quiver */
|
||||
boolean autoopen; /* open doors by walking into them */
|
||||
boolean autounlock; /* automatically apply unlocking tools */
|
||||
boolean beginner;
|
||||
boolean biff; /* enable checking for mail */
|
||||
boolean bones; /* allow saving/loading bones */
|
||||
|
||||
Reference in New Issue
Block a user