mon interaction with terrain was postponed

Fix #576

Reported initially by @copperwater for polymorphed monsters:
"observe how the [polymorphed-monster] hovers placidly above the water for
several turns like Wile E. Coyote before it gets a move, realizes it's
above water, and drowns. Ditto for lava."

A comment in the GitHub issue thread by @Tomsod pointed out that a
revived corpse could do the same.

This should set things up for other terrain fallout if discovered or
implemented in the future.
   - consume an additional bit in enum mon_terrain_effects (hack.h)
   - include the additional bit in TERRAIN_FALLOUT_MASK (monst.h)
   - add detection to maybe_set_terrain_effects (mon.c)
   - add action to terrain_effects (mon.c)

Implemented by stealing some upper unused mstate bits to avoid
invalidating existing save and bones.
This commit is contained in:
nhmall
2026-08-23 18:51:13 -04:00
parent f913cb3704
commit 9b4a8dfb05
13 changed files with 114 additions and 16 deletions
+17 -11
View File
@@ -55,17 +55,23 @@ enum m_ap_types {
M_AP_MONSTER = 3 /* a monster; mostly used for cloned Wizard */
};
#define MON_FLOOR 0x0000
#define MON_OFFMAP 0x0001
#define MON_DETACH 0x0002
#define MON_MIGRATING 0x0004
#define MON_LIMBO 0x0008
#define MON_BUBBLEMOVE 0x0010
#define MON_ENDGAME_FREE 0x0020
#define MON_ENDGAME_MIGR 0x0040
#define MON_OBLITERATE 0x0080
#define MON_STILL_ARRIVING 0x0100
#define MON_PARKED 0x0200
#define MON_FLOOR 0x00000000
#define MON_OFFMAP 0x00000001
#define MON_DETACH 0x00000002
#define MON_MIGRATING 0x00000004
#define MON_LIMBO 0x00000008
#define MON_BUBBLEMOVE 0x00000010
#define MON_ENDGAME_FREE 0x00000020
#define MON_ENDGAME_MIGR 0x00000040
#define MON_OBLITERATE 0x00000080
#define MON_STILL_ARRIVING 0x00000100
#define MON_PARKED 0x00000200
/* 0x10000000 through 0x40000000 match enum pending_terrain_effects */
/* 0x10000000 */ /* nonflyer_vs_liquid */
/* 0x20000000 */ /* candrown_vs_liquid */
/* 0x40000000 */
#define TERRAIN_FALLOUT_MASK 0x70000000
#define M_AP_TYPMASK 0x7
#define M_AP_F_DKNOWN 0x8