OSDN Git Service

branch-nothere-terrainflags、゙。シ・ク.
authornothere <nothere@0568b783-4c39-0410-ac80-bf13821ea2a2>
Sat, 22 Nov 2003 19:55:10 +0000 (19:55 +0000)
committernothere <nothere@0568b783-4c39-0410-ac80-bf13821ea2a2>
Sat, 22 Nov 2003 19:55:10 +0000 (19:55 +0000)
55 files changed:
lib/edit/d_info.txt
lib/edit/f_info.txt
lib/help/joption.txt
lib/help/option.txt
lib/pref/font-ibm.prf
lib/pref/font-mon.prf
lib/pref/font-win.prf
lib/pref/graf-ami.prf
lib/pref/graf-gcu.prf
lib/pref/graf-ibm.prf
lib/pref/graf-new.prf
lib/pref/graf-xxx.prf
lib/pref/pref-opt.prf
src/bldg.c
src/cave.c
src/cmd1.c
src/cmd2.c
src/cmd4.c
src/cmd5.c
src/cmd6.c
src/defines.h
src/dungeon.c
src/externs.h
src/files.c
src/floors.c
src/generate.c
src/grid.c
src/grid.h
src/hissatsu.c
src/init.h
src/init1.c
src/init2.c
src/load.c
src/melee2.c
src/mind.c
src/monster1.c
src/monster2.c
src/mspells1.c
src/mutation.c
src/object1.c
src/object2.c
src/rooms.c
src/save.c
src/spells1.c
src/spells2.c
src/spells3.c
src/store.c
src/streams.c
src/tables.c
src/types.h
src/variable.c
src/wild.c
src/wizard2.c
src/xtra1.c
src/xtra2.c

index ae0f2ae..98412b4 100644 (file)
@@ -45,8 +45,8 @@ D:
 D:$wilderness
 P:0:0
 W:0:0:0:0:14:160:75:20:0x0000:0x0000
-L:1:100:1:0:1:0:50
-A:56:100:56:0:56:0:57:58:50:51
+L:FLOOR:100:FLOOR:0:FLOOR:0:50
+A:GRANITE:100:GRANITE:0:GRANITE:0:GRANITE:GRANITE:MAGMA_VEIN:QUARTZ_VEIN
 F:MONSTER_DIV_64
 
 
@@ -58,8 +58,8 @@ D:$the entrance to the Dungeon of Angband
 D:Å´¹ö¤Ø¤ÎÆþ¤ê¸ý
 P:40:57
 W:1:127:30:0:14:160:75:20:0xffff:0xffff
-L:1:100:1:0:1:0:50
-A:56:100:56:0:56:0:57:58:50:51
+L:FLOOR:100:FLOOR:0:FLOOR:0:50
+A:GRANITE:100:GRANITE:0:GRANITE:0:GRANITE_OUTER:GRANITE_INNER:MAGMA_VEIN:QUARTZ_VEIN
 F:CAVERN | WATER_RIVER | LAVA_RIVER | ARENA | DESTROY
 F:LAKE_WATER | LAKE_LAVA | LAKE_RUBBLE | LAKE_TREE
 F:MONSTER_DIV_64
@@ -70,8 +70,8 @@ D:$the entrance to the cave leading to the Yeek's den
 D:¥¤¡¼¥¯¤Î½»¤ß¤«¤Ø¤È³¤¯¾®¤µ¤Êƶ·ê
 P:48:5
 W:1:13:1:0:14:240:75:20:0x0000:0x0000
-L:1:100:1:0:1:0:8
-A:56:100:56:0:56:0:57:58:50:51
+L:FLOOR:100:FLOOR:0:FLOOR:0:8
+A:GRANITE:100:GRANITE:0:GRANITE:0:GRANITE_OUTER:GRANITE_INNER:MAGMA_VEIN:QUARTZ_VEIN
 F:FINAL_GUARDIAN_237 | FINAL_OBJECT_426
 F:NO_VAULT | BEGINNER
 F:MONSTER_DIV_0
@@ -82,8 +82,8 @@ D:$a dark tunnel leading to an Orc Cave
 D:¥ª¡¼¥¯¤Îƶ·¢¤Ø³¤¯Çö°Å¤¤¥È¥ó¥Í¥ë
 P:45:30
 W:10:23:5:3:18:200:75:20:0x0031:0x006d
-L:88:70:89:30:1:0:14
-A:56:70:97:30:1:0:57:58:50:51
+L:DIRT:70:GRASS:30:FLOOR:0:14
+A:GRANITE:70:MOUNTAIN:30:FLOOR:0:GRANITE_OUTER:GRANITE_INNER:MAGMA_VEIN:QUARTZ_VEIN
 F:FINAL_GUARDIAN_373 | FINAL_OBJECT_148 | CAVE | WATER_RIVER | CAVERN
 F:LAKE_TREE | DESTROY | BIG
 F:MONSTER_DIV_32
@@ -95,8 +95,8 @@ D:$the frightening entrance to the Labyrinth
 D:¶²¤ë¤Ù¤­´ñ̯¤Ê̵Ü
 P:57:31
 W:10:18:1:0:80:160:75:20:0x0000:0x0000
-L:1:100:1:0:1:0:100
-A:56:98:48:2:56:0:57:58:50:51
+L:FLOOR:100:FLOOR:0:FLOOR:0:100
+A:GRANITE:98:SECRET_DOOR:2:GRANITE:0:GRANITE_OUTER:GRANITE_INNER:MAGMA_VEIN:QUARTZ_VEIN
 F:MAZE | SMALLEST | FORGET
 F:MONSTER_DIV_64 | FINAL_GUARDIAN_1034 | FINAL_OBJECT_354
 
@@ -106,8 +106,8 @@ D:$a big tunnel leading to a Dragon's Lair
 D:ε¤Î½»¤ß¤«¤Ø³¤¯Â礭¤¯¡¢Çö°Å¤¤¶²¤ë¤Ù¤­¥È¥ó¥Í¥ë
 P:28:74
 W:60:72:25:3:20:140:75:20:0x00a6:0x00c1
-L:88:100:1:0:1:0:0
-A:56:90:87:10:56:0:57:58:50:87
+L:DIRT:100:FLOOR:0:FLOOR:0:0
+A:GRANITE:90:DARK_PIT:10:GRANITE:0:GRANITE_OUTER:GRANITE_INNER:MAGMA_VEIN:DARK_PIT
 F:BIG | LAVA_RIVER | CAVERN | DESTROY
 F:MONSTER_DIV_10
 F:CAVE | LAKE_LAVA | LAKE_TREE | LAKE_RUBBLE
@@ -120,8 +120,8 @@ D:$a hole to the Graveyard underground
 D:ÊèÃϤÎÃϲ¼¤Ø¤Î·ê
 P:19:85
 W:40:70:18:3:14:160:75:20:0x0128:0x027b
-L:1:85:84:15:1:0:30
-A:56:75:87:25:56:0:57:58:84:83
+L:FLOOR:85:SHALLOW_WATER:15:FLOOR:0:30
+A:GRANITE:75:DARK_PIT:25:GRANITE:0:GRANITE_OUTER:GRANITE_INNER:SHALLOW_WATER:DEEP_WATER
 F:MONSTER_DIV_4 | FINAL_GUARDIAN_804 | FINAL_ARTIFACT_89
 F:WATER_RIVER | DESTROY | ARENA | LAKE_WATER | LAKE_RUBBLE | DESTROY
 M:UNDEAD | NONLIVING
@@ -132,8 +132,8 @@ D:$a path leading to a Forest
 D:¿¹¤Ø³¤¯Áð¤ÎÆ»
 P:53:63
 W:15:32:5:3:14:160:75:20:0x0001:0x0052
-L:89:85:93:5:84:10:15
-A:96:90:56:10:56:0:94:96:56:94
+L:GRASS:85:FLOWER:5:SHALLOW_WATER:10:15
+A:TREE:90:GRANITE:10:GRANITE:0:BRAKE:TREE:GRANITE:BRAKE
 F:NO_DOORS | WATER_RIVER | MONSTER_DIV_15
 F:FINAL_GUARDIAN_481 | FINAL_OBJECT_592
 M:ANIMAL | R_CHAR_SJZ# | WILD_WOOD
@@ -144,8 +144,8 @@ D:$a hole to the center of the Volcano
 D:²Ð»³¤ÎÃæ¿´¤Ø¤Î·ê
 P:53:13
 W:50:60:18:3:14:160:80:30:0x01bf:0x02fd
-L:88:40:86:40:85:20:0
-A:56:90:87:10:56:0:57:58:87:51
+L:DIRT:40:SHALLOW_LAVA:40:DEEP_LAVA:20:0
+A:GRANITE:90:DARK_PIT:10:GRANITE:0:GRANITE_OUTER:GRANITE_INNER:DARK_PIT:QUARTZ_VEIN
 F:CAVE | MONSTER_DIV_0 | CAVERN | LAKE_LAVA | LAVA_RIVER | DESTROY
 F:FINAL_GUARDIAN_972 | FINAL_OBJECT_629
 M:IM_FIRE | CAN_FLY | WILD_VOLCANO
@@ -156,8 +156,8 @@ D:$the stairway to the Hell
 D:ÃϹö¤Ø¤Î³¬ÃÊ
 P:62:94
 W:666:696:50:1:14:160:90:77:0x0188:0x0280
-L:86:80:85:20:1:0:0
-A:85:80:87:20:87:0:57:85:0:0
+L:SHALLOW_LAVA:80:DEEP_LAVA:20:FLOOR:0:0
+A:DEEP_LAVA:80:DARK_PIT:20:DARK_PIT:0:GRANITE_OUTER:DEEP_LAVA:NONE:NONE
 F:CAVERN | MONSTER_DIV_0 | LAKE_LAVA | LAVA_RIVER | WINNER
 F:BIG
 M:IM_FIRE | EVIL
@@ -168,8 +168,8 @@ D:$the way to the heaven
 D:Å·³¦¤Ø¤ÈÄ̤¸¤ëÆ»
 P:2:94
 W:555:585:50:1:18:160:85:35:0x0040:0x0104
-L:1:100:1:0:1:0:1000
-A:60:100:56:0:56:0:60:58:0:0
+L:FLOOR:100:FLOOR:0:FLOOR:0:1000
+A:PERMANENT:100:GRANITE:0:GRANITE:0:PERMANENT:GRANITE_INNER:NONE:NONE
 F:MONSTER_DIV_0 | WATER_RIVER | WINNER | BIG
 M:GOOD
 
@@ -180,8 +180,8 @@ D:$a submerged way to the lost land of Numenor
 D:¼º¤ï¤ì¤¿Ãϥ̥á¥Î¡¼¥ë¤Ø¤Î¿åËפ·¤¿Æ»
 P:27:30
 W:55:75:30:3:14:160:80:30:0x0000:0x0000
-L:1:80:84:20:1:0:100
-A:83:80:84:10:56:10:57:83:0:0
+L:FLOOR:80:SHALLOW_WATER:20:FLOOR:0:100
+A:DEEP_WATER:80:SHALLOW_WATER:10:GRANITE:10:GRANITE_OUTER:DEEP_WATER:NONE:NONE
 F:MONSTER_DIV_0 | LAKE_WATER | WATER_RIVER | DESTROY
 F:FINAL_GUARDIAN_854 | FINAL_ARTIFACT_107
 M:CAN_SWIM | CAN_FLY | AQUATIC | WILD_OCEAN
@@ -192,8 +192,8 @@ D:$the entrance to the Castle
 D:¾ë
 P:34:88
 W:20:65:30:3:14:160:75:20:0x037f:0x033f
-L:1:100:1:0:1:0:100
-A:56:100:56:0:56:0:57:58:0:0
+L:FLOOR:100:FLOOR:0:FLOOR:0:100
+A:GRANITE:100:GRANITE:0:GRANITE:0:GRANITE:GRANITE:NONE:NONE
 F:MONSTER_DIV_16 | ARENA | NO_CAVE | FINAL_GUARDIAN_882
 M:DEMON | R_CHAR_phHg
 
@@ -204,8 +204,8 @@ D:$a way to R'lyeh
 D:¥ë¥ë¥¤¥¨
 P:3:40
 W:80:96:45:3:14:160:75:20:0x01a8:0x023f
-L:1:50:84:30:83:20:100
-A:56:100:56:0:56:0:57:58:84:83
+L:FLOOR:50:SHALLOW_WATER:30:DEEP_WATER:20:100
+A:GRANITE:100:GRANITE:0:GRANITE:0:GRANITE_OUTER:GRANITE_INNER:SHALLOW_WATER:DEEP_WATER
 F:MONSTER_DIV_16 | ARENA | WATER_RIVER | LAKE_WATER |
 F:FINAL_GUARDIAN_857 | FINAL_ARTIFACT_129
 M:DEMON | ELDRITCH_HORROR
@@ -216,8 +216,8 @@ D:$a way leading to the mountain
 D:»³
 P:46:76
 W:25:50:20:3:14:160:75:20:0x00b7:0x00df
-L:89:100:89:0:89:0:0
-A:97:100:56:0:56:0:97:56:0:0
+L:GRASS:100:GRASS:0:GRASS:0:0
+A:MOUNTAIN:100:GRANITE:0:GRANITE:0:MOUNTAIN:GRANITE:NONE:NONE
 F:FINAL_GUARDIAN_468 | FINAL_OBJECT_239 |
 F:MONSTER_DIV_16 | WATER_RIVER | CAVE | CAVERN | NO_DOORS | BIG
 M:TROLL | GIANT | CAN_FLY | ANIMAL | WILD_MOUNTAIN | R_CHAR_OYH
@@ -228,8 +228,8 @@ D:$the entrance to the Mine
 D:¶â¹Û
 P:23:49
 W:75:80:50:3:18:80:80:25:0x0000:0x0010
-L:1:100:1:0:1:0:0
-A:56:60:54:20:55:20:57:58:50:51
+L:FLOOR:100:FLOOR:0:FLOOR:0:0
+A:GRANITE:60:MAGMA_TREASURE:20:QUARTZ_TREASURE:20:GRANITE_OUTER:GRANITE_INNER:MAGMA_VEIN:QUARTZ_VEIN
 F:MONSTER_DIV_1 | WATER_RIVER | CAVE | CAVERN | SMALLEST
 F:LAVA_RIVER | DESTROY
 M:R_CHAR_$
@@ -240,8 +240,8 @@ D:$the entrance to the cave filled with anti-magic cloud
 D:È¿ËâË¡¤Îƶ·¢
 P:6:84
 W:40:50:30:0:14:160:75:20:0x01ff:0x01ed
-L:1:100:1:0:1:0:50
-A:56:100:56:0:56:0:57:58:50:51
+L:FLOOR:100:FLOOR:0:FLOOR:0:50
+A:GRANITE:100:GRANITE:0:GRANITE:0:GRANITE:GRANITE:MAGMA_VEIN:QUARTZ_VEIN
 F:CAVERN | WATER_RIVER | LAVA_RIVER | ARENA | DESTROY
 F:LAKE_WATER | LAKE_LAVA | LAKE_RUBBLE | LAKE_TREE
 F:MONSTER_DIV_0 | NO_MAGIC
@@ -252,8 +252,8 @@ D:$the entrance to the cave filled with restricting magical field
 D:È¿¹¶·â¤Îƶ·¢
 P:45:47
 W:40:50:30:0:14:160:75:20:0x01ff:0x01ed
-L:1:100:1:0:1:0:50
-A:56:100:56:0:56:0:57:58:50:51
+L:FLOOR:100:FLOOR:0:FLOOR:0:50
+A:GRANITE:100:GRANITE:0:GRANITE:0:GRANITE:GRANITE:MAGMA_VEIN:QUARTZ_VEIN
 F:CAVERN | WATER_RIVER | LAVA_RIVER | ARENA | DESTROY
 F:LAKE_WATER | LAKE_LAVA | LAKE_RUBBLE | LAKE_TREE
 F:MONSTER_DIV_0 | NO_MELEE
@@ -264,8 +264,8 @@ D:$the entrance to the chameleon's den
 D:¥«¥á¥ì¥ª¥ó¤À¤±¤¬À³Â©¤¹¤ëƶ·¢
 P:52:94
 W:30:45:30:3:30:160:75:20:0x0000:0x0000
-L:1:100:1:0:1:0:50
-A:56:100:56:0:56:0:57:58:50:51
+L:FLOOR:100:FLOOR:0:FLOOR:0:50
+A:GRANITE:100:GRANITE:0:GRANITE:0:GRANITE:GRANITE:MAGMA_VEIN:QUARTZ_VEIN
 F:CAVERN | WATER_RIVER | LAVA_RIVER | ARENA | DESTROY
 F:LAKE_WATER | LAKE_LAVA | LAKE_RUBBLE | LAKE_TREE | CHAMELEON
 F:MONSTER_DIV_0 | FINAL_GUARDIAN_1041 | FINAL_OBJECT_617
@@ -277,8 +277,8 @@ D:$the dark entrance to the cave filled with magical darkness
 D:°Å°Ç¤Îƶ·¢
 P:12:57
 W:55:72:30:0:14:160:80:30:0xffff:0xffff
-L:1:100:1:0:1:0:50
-A:56:100:56:0:56:0:57:58:50:51
+L:FLOOR:100:FLOOR:0:FLOOR:0:50
+A:GRANITE:100:GRANITE:0:GRANITE:0:GRANITE:GRANITE:MAGMA_VEIN:QUARTZ_VEIN
 F:CAVERN | WATER_RIVER | LAVA_RIVER | ARENA | DESTROY
 F:LAKE_WATER | LAKE_LAVA | LAKE_RUBBLE | LAKE_TREE
 F:MONSTER_DIV_64 | DARKNESS | FINAL_GUARDIAN_803
index eeac31c..8ba497f 100644 (file)
@@ -42,717 +42,1398 @@ V:2.8.1
 
 # 0x00 --> nothing
 
-N:0:̤ÃΤÎÃÏ·Á
+N:0:NONE
+J:̤ÃΤÎÃÏ·Á
 E:unknown grid
 G: :w
+W:1
 
 
 # 0x01 --> open floor
 
-N:1:¾²
+N:1:FLOOR
+J:¾²
 E:open floor
-G:.:w
+G:.:w:LIT
+W:2
+F:LOS | PROJECT | MOVE | PLACE | DROP | FLOOR | CAN_FLY | TELEPORTABLE
 
-# 0x02 --> invisible trap (drawn as open floor)
+# 0x02 --> invisible trap (drawn as open floor, obsoleted)
 
-N:2:±£¤ì¤¿¥È¥é¥Ã¥×
+N:2:INVIS
+J:±£¤ì¤¿¥È¥é¥Ã¥×
 E:invisible trap
-G:.:w
-M:1
+G:.:w:LIT
+M:FLOOR
+W:2
+K:DESTROYED:FLOOR
+K:SECRET:INVIS
+F:LOS | PROJECT | MOVE | PLACE | SECRET | TRAP | HIT_TRAP | CAN_FLY | HURT_DISI
 
 # 0x03 --> glyph of warding
 
-N:3:²óÈò¤ÎĦÁü
+N:3:GLYPH
+J:²óÈò¤ÎĦÁü
 E:glyph of warding
-G:;:y
+G:;:y:LIT
+W:16
+K:DESTROYED:FLOOR
+F:LOS | PROJECT | MOVE | PLACE | NOTICE | REMEMBER | GLYPH | CAN_FLY |
+F:HURT_DISI
 
 # 0x04 --> open door
 
-N:4:³«¤¤¤¿¥É¥¢
+N:4:OPEN_DOOR
+J:³«¤¤¤¿¥É¥¢
 E:open door
 G:':U
+W:10
+K:DESTROYED:FLOOR
+K:CLOSE:CLOSED_DOOR
+F:LOS | PROJECT | MOVE | PLACE | NOTICE | REMEMBER | CLOSE | DOOR | CAN_FLY |
+F:HURT_DISI | TELEPORTABLE
 
 # 0x05 --> broken door
 
-N:5:²õ¤ì¤¿¥É¥¢
+N:5:BROKEN_DOOR
+J:²õ¤ì¤¿¥É¥¢
 E:broken door
 G:':u
+W:10
+K:DESTROYED:FLOOR
+K:CLOSE:BROKEN_DOOR
+F:LOS | PROJECT | MOVE | PLACE | NOTICE | REMEMBER | CLOSE | DOOR | CAN_FLY |
+F:HURT_DISI | TELEPORTABLE
 
 # 0x06 --> up stairs (perm)
 
-N:6:¾å¤ê³¬ÃÊ
+N:6:UP_STAIR
+J:¾å¤ê³¬ÃÊ
 E:up staircase
-G:<:w
+G:<:w:LIT
+W:35
+K:SHAFT:SHAFT_UP
+F:LOS | PROJECT | MOVE | PLACE | NOTICE | REMEMBER | STAIRS | LESS |
+F:PERMANENT | CAN_FLY | TELEPORTABLE
 
 # 0x07 --> down stairs (perm)
 
-N:7:²¼¤ê³¬ÃÊ
+N:7:DOWN_STAIR
+J:²¼¤ê³¬ÃÊ
 E:down staircase
-G:>:w
-
-N:8:¥¯¥¨¥¹¥ÈÆþ¸ý
+G:>:w:LIT
+W:35
+K:SHAFT:SHAFT_DOWN
+F:LOS | PROJECT | MOVE | PLACE | NOTICE | REMEMBER | STAIRS | MORE |
+F:PERMANENT | CAN_FLY | TELEPORTABLE
+
+N:8:QUEST_ENTER
+J:¥¯¥¨¥¹¥ÈÆþ¸ý
 E:quest entrance
 G:>:y
+W:35
+F:LOS | PROJECT | MOVE | PLACE | NOTICE | REMEMBER | STAIRS | MORE |
+F:PERMANENT | CAN_FLY | SPECIAL | QUEST_ENTER | TELEPORTABLE
 
-N:9:¥¯¥¨¥¹¥È½Ð¸ý
+N:9:QUEST_EXIT
+J:¥¯¥¨¥¹¥È½Ð¸ý
 E:quest exit
 G:<:y
+W:35
+F:LOS | PROJECT | MOVE | PLACE | NOTICE | REMEMBER | STAIRS | LESS |
+F:PERMANENT | CAN_FLY | SPECIAL | QUEST_EXIT | TELEPORTABLE
 
-N:10:¥¯¥¨¥¹¥È²¼¤ê³¬ÃÊ
+N:10:QUEST_DOWN
+J:¥¯¥¨¥¹¥È²¼¤ê³¬ÃÊ
 E:quest down level
 G:>:r
+W:35
+F:LOS | PROJECT | MOVE | PLACE | NOTICE | REMEMBER | STAIRS | MORE |
+F:PERMANENT | CAN_FLY | SPECIAL | QUEST | TELEPORTABLE
 
-N:11:¥¯¥¨¥¹¥È¾å¤¬¤ê³¬ÃÊ
+N:11:QUEST_UP
+J:¥¯¥¨¥¹¥È¾å¤¬¤ê³¬ÃÊ
 E:quest up level
 G:<:r
+W:35
+F:LOS | PROJECT | MOVE | PLACE | NOTICE | REMEMBER | STAIRS | LESS |
+F:PERMANENT | CAN_FLY | SPECIAL | QUEST | TELEPORTABLE
 
-N:12:³¹¤Î½Ð¸ý
+N:12:TOWN_EXIT
+J:³¹¤Î½Ð¸ý
 E:town exit
 G:>:g
+W:35
+F:LOS | PROJECT | MOVE | PLACE | NOTICE | REMEMBER | STAIRS | MORE |
+F:PERMANENT | CAN_FLY | TELEPORTABLE
 
 # 0x0C --> up stairs (perm)
 
-N:13:¾å¤ê¹£Æ»
+N:13:SHAFT_UP
+J:¾å¤ê¹£Æ»
 E:shaft up
-G:<:U
+G:<:U:LIT
+W:35
+F:LOS | PROJECT | MOVE | PLACE | NOTICE | REMEMBER | STAIRS | LESS |
+F:PERMANENT | CAN_FLY | SHAFT | TELEPORTABLE
 
 # 0x0D --> down stairs (perm)
 
-N:14:²¼¤ê¹£Æ»
+N:14:SHAFT_DOWN
+J:²¼¤ê¹£Æ»
 E:shaft down
-G:>:U
+G:>:U:LIT
+W:35
+F:LOS | PROJECT | MOVE | PLACE | NOTICE | REMEMBER | STAIRS | MORE |
+F:PERMANENT | CAN_FLY | SHAFT | TELEPORTABLE
 
 # 0x10 --> visible trap -- trap door
 
-N:16:¥È¥é¥Ã¥×¡¦¥É¥¢
+N:16:TRAP_TRAPDOOR
+J:¥È¥é¥Ã¥×¡¦¥É¥¢
 E:trap door
-G:^:w
+G:^:w:LIT
+W:2
+K:DESTROYED:FLOOR
+K:HIT_TRAP:TRAP_TRAPDOOR
+F:POWER_5 | LOS | PROJECT | MOVE | PLACE | NOTICE | REMEMBER | DISARM | TRAP |
+F:MORE | HIT_TRAP | CAN_FLY | HURT_DISI
 
 # 0x11 --> visible trap -- open pit
 
-N:17:Íî¤È¤··ê
+N:17:TRAP_PIT
+J:Íî¤È¤··ê
 E:pit
-G:^:s
+G:^:s:LIT
+W:2
+K:DESTROYED:FLOOR
+K:HIT_TRAP:TRAP_PIT
+F:POWER_5 | LOS | PROJECT | MOVE | PLACE | NOTICE | REMEMBER | DISARM | TRAP |
+F:HIT_TRAP | CAN_FLY | HURT_DISI
 
 # 0x12 --> visible trap -- spiked pit
 
-N:18:Íî¤È¤··ê
+N:18:TRAP_SPIKED_PIT
+J:Íî¤È¤··ê
 E:pit
-G:^:s
-M:17
+G:^:s:LIT
+M:TRAP_PIT
+W:2
+K:DESTROYED:FLOOR
+K:HIT_TRAP:TRAP_SPIKED_PIT
+F:POWER_5 | LOS | PROJECT | MOVE | PLACE | NOTICE | REMEMBER | DISARM | TRAP |
+F:HIT_TRAP | CAN_FLY | HURT_DISI
 
 # 0x13 --> visible trap -- poison pit
 
-N:19:Íî¤È¤··ê
+N:19:TRAP_POISON_PIT
+J:Íî¤È¤··ê
 E:pit
-G:^:s
-M:17
+G:^:s:LIT
+M:TRAP_PIT
+W:2
+K:DESTROYED:FLOOR
+K:HIT_TRAP:TRAP_POISON_PIT
+F:POWER_5 | LOS | PROJECT | MOVE | PLACE | NOTICE | REMEMBER | DISARM | TRAP |
+F:HIT_TRAP | CAN_FLY | HURT_DISI
 
 # 0x14 --> visible trap -- rune -- summon
 
-N:20:¼Ù°­¤Ê¥ë¡¼¥ó
+N:20:TRAP_TY_CURSE
+J:¼Ù°­¤Ê¥ë¡¼¥ó
 E:evil rune
-G:^:G
+G:^:G:LIT
+W:2
+K:DESTROYED:FLOOR
+K:HIT_TRAP:FLOOR
+F:POWER_5 | LOS | PROJECT | MOVE | PLACE | NOTICE | REMEMBER | DISARM | TRAP |
+F:HIT_TRAP | CAN_FLY | HURT_DISI
 
 # 0x15 --> visible trap -- rune -- teleport
 
-N:21:´ñ̯¤Ê¥ë¡¼¥ó
+N:21:TRAP_TELEPORT
+J:´ñ̯¤Ê¥ë¡¼¥ó
 E:strange rune
-G:^:o
+G:^:o:LIT
+W:2
+K:DESTROYED:FLOOR
+K:HIT_TRAP:TRAP_TELEPORT
+F:POWER_5 | LOS | PROJECT | MOVE | PLACE | NOTICE | REMEMBER | DISARM | TRAP |
+F:HIT_TRAP | CAN_FLY | HURT_DISI
 
 # 0x16 --> visible trap -- spot -- fire
 
-N:22:¾Ç¤²¤¿¾ì½ê
+N:22:TRAP_FIRE
+J:¾Ç¤²¤¿¾ì½ê
 E:discolored spot
-G:^:u
+G:^:u:LIT
+W:2
+K:DESTROYED:FLOOR
+K:HIT_TRAP:TRAP_FIRE
+F:POWER_5 | LOS | PROJECT | MOVE | PLACE | NOTICE | REMEMBER | DISARM | TRAP |
+F:HIT_TRAP | CAN_FLY | HURT_DISI
 
 # 0x17 --> visible trap -- spot -- acid
 
-N:23:¾Ç¤²¤¿¾ì½ê
+N:23:TRAP_ACID
+J:¾Ç¤²¤¿¾ì½ê
 E:discolored spot
-G:^:u
-M:22
+G:^:u:LIT
+M:TRAP_FIRE
+W:2
+K:DESTROYED:FLOOR
+K:HIT_TRAP:TRAP_ACID
+F:POWER_5 | LOS | PROJECT | MOVE | PLACE | NOTICE | REMEMBER | DISARM | TRAP |
+F:HIT_TRAP | CAN_FLY | HURT_DISI
 
 # 0x18 --> visible trap -- dart -- slow
 
-N:24:¥À¡¼¥Ä¡¦¥È¥é¥Ã¥×
+N:24:TRAP_SLOW
+J:¥À¡¼¥Ä¡¦¥È¥é¥Ã¥×
 E:dart trap
-G:^:r
+G:^:r:LIT
+W:2
+K:DESTROYED:FLOOR
+K:HIT_TRAP:TRAP_SLOW
+F:POWER_5 | LOS | PROJECT | MOVE | PLACE | NOTICE | REMEMBER | DISARM | TRAP |
+F:HIT_TRAP | CAN_FLY | HURT_DISI
 
 # 0x19 --> visible trap -- dart -- lose str
 
-N:25:¥À¡¼¥Ä¡¦¥È¥é¥Ã¥×
+N:25:TRAP_LOSE_STR
+J:¥À¡¼¥Ä¡¦¥È¥é¥Ã¥×
 E:dart trap
-G:^:r
-M:24
+G:^:r:LIT
+M:TRAP_SLOW
+W:2
+K:DESTROYED:FLOOR
+K:HIT_TRAP:TRAP_LOSE_STR
+F:POWER_5 | LOS | PROJECT | MOVE | PLACE | NOTICE | REMEMBER | DISARM | TRAP |
+F:HIT_TRAP | CAN_FLY | HURT_DISI
 
 # 0x1A --> visible trap -- dart -- lose dex
 
-N:26:¥À¡¼¥Ä¡¦¥È¥é¥Ã¥×
+N:26:TRAP_LOSE_DEX
+J:¥À¡¼¥Ä¡¦¥È¥é¥Ã¥×
 E:dart trap
-G:^:r
-M:24
+G:^:r:LIT
+M:TRAP_SLOW
+W:2
+K:DESTROYED:FLOOR
+K:HIT_TRAP:TRAP_LOSE_DEX
+F:POWER_5 | LOS | PROJECT | MOVE | PLACE | NOTICE | REMEMBER | DISARM | TRAP |
+F:HIT_TRAP | CAN_FLY | HURT_DISI
 
 # 0x1B --> visible trap -- dart -- lose con
 
-N:27:¥À¡¼¥Ä¡¦¥È¥é¥Ã¥×
+N:27:TRAP_LOSE_CON
+J:¥À¡¼¥Ä¡¦¥È¥é¥Ã¥×
 E:dart trap
-G:^:r
-M:24
+G:^:r:LIT
+M:TRAP_SLOW
+W:2
+K:DESTROYED:FLOOR
+K:HIT_TRAP:TRAP_LOSE_CON
+F:POWER_5 | LOS | PROJECT | MOVE | PLACE | NOTICE | REMEMBER | DISARM | TRAP |
+F:HIT_TRAP | CAN_FLY | HURT_DISI
 
 # 0x1C --> visible trap -- gas -- blind
 
-N:28:¥¬¥¹¡¦¥È¥é¥Ã¥×
+N:28:TRAP_BLIND
+J:¥¬¥¹¡¦¥È¥é¥Ã¥×
 E:gas trap
-G:^:g
+G:^:g:LIT
+W:2
+K:DESTROYED:FLOOR
+K:HIT_TRAP:TRAP_BLIND
+F:POWER_5 | LOS | PROJECT | MOVE | PLACE | NOTICE | REMEMBER | DISARM | TRAP |
+F:HIT_TRAP | CAN_FLY | HURT_DISI
 
 # 0x1D --> visible trap -- gas -- confuse
 
-N:29:¥¬¥¹¡¦¥È¥é¥Ã¥×
+N:29:TRAP_CONFUSE
+J:¥¬¥¹¡¦¥È¥é¥Ã¥×
 E:gas trap
-G:^:g
-M:28
+G:^:g:LIT
+M:TRAP_BLIND
+W:2
+K:DESTROYED:FLOOR
+K:HIT_TRAP:TRAP_CONFUSE
+F:POWER_5 | LOS | PROJECT | MOVE | PLACE | NOTICE | REMEMBER | DISARM | TRAP |
+F:HIT_TRAP | CAN_FLY | HURT_DISI
 
 # 0x1E --> visible trap -- gas -- poison
 
-N:30:¥¬¥¹¡¦¥È¥é¥Ã¥×
+N:30:TRAP_POISON
+J:¥¬¥¹¡¦¥È¥é¥Ã¥×
 E:gas trap
-G:^:g
-M:28
+G:^:g:LIT
+M:TRAP_BLIND
+W:2
+K:DESTROYED:FLOOR
+K:HIT_TRAP:TRAP_POISON
+F:POWER_5 | LOS | PROJECT | MOVE | PLACE | NOTICE | REMEMBER | DISARM | TRAP |
+F:HIT_TRAP | CAN_FLY | HURT_DISI
 
 # 0x1F --> visible trap -- gas -- sleep
 
-N:31:¥¬¥¹¡¦¥È¥é¥Ã¥×
+N:31:TRAP_SLEEP
+J:¥¬¥¹¡¦¥È¥é¥Ã¥×
 E:gas trap
-G:^:g
-M:28
+G:^:g:LIT
+M:TRAP_BLIND
+W:2
+K:DESTROYED:FLOOR
+K:HIT_TRAP:TRAP_SLEEP
+F:POWER_5 | LOS | PROJECT | MOVE | PLACE | NOTICE | REMEMBER | DISARM | TRAP |
+F:HIT_TRAP | CAN_FLY | HURT_DISI
 
 # 0x2x --> locked door (power 0)
 
-N:32:¥É¥¢
+N:32:CLOSED_DOOR
+J:¥É¥¢
 E:door
 G:+:U
+W:10
+K:DESTROYED:FLOOR
+K:OPEN:OPEN_DOOR
+K:BASH:BROKEN_DOOR
+K:SPIKE:JAMMED_DOOR_1
+F:POWER_0 | NOTICE | REMEMBER | OPEN | BASH | SPIKE | TUNNEL | DOOR |
+F:HURT_ROCK | CAN_PASS | HURT_DISI
 
 # 0x2x --> locked door (power 1)
 
-N:33:¸°¤Î¤«¤«¤Ã¤¿¥É¥¢
+N:33:LOCKED_DOOR_1
+J:¸°¤Î¤«¤«¤Ã¤¿¥É¥¢
 E:locked door
 G:+:U
-M:32
+M:CLOSED_DOOR
+W:10
+K:DESTROYED:FLOOR
+K:OPEN:OPEN_DOOR
+K:BASH:BROKEN_DOOR
+K:SPIKE:JAMMED_DOOR_2
+K:DISARM:CLOSED_DOOR
+F:POWER_1 | NOTICE | REMEMBER | OPEN | BASH | SPIKE | TUNNEL | DOOR |
+F:HURT_ROCK | CAN_PASS | HURT_DISI
 
 # 0x2x --> locked door (power 2)
 
-N:34:¸°¤Î¤«¤«¤Ã¤¿¥É¥¢
+N:34:LOCKED_DOOR_2
+J:¸°¤Î¤«¤«¤Ã¤¿¥É¥¢
 E:locked door
 G:+:U
-M:32
+M:CLOSED_DOOR
+W:10
+K:DESTROYED:FLOOR
+K:OPEN:OPEN_DOOR
+K:BASH:BROKEN_DOOR
+K:SPIKE:JAMMED_DOOR_3
+K:DISARM:CLOSED_DOOR
+F:POWER_2 | NOTICE | REMEMBER | OPEN | BASH | SPIKE | TUNNEL | DOOR |
+F:HURT_ROCK | CAN_PASS | HURT_DISI
 
 # 0x2x --> locked door (power 3)
 
-N:35:¸°¤Î¤«¤«¤Ã¤¿¥É¥¢
+N:35:LOCKED_DOOR_3
+J:¸°¤Î¤«¤«¤Ã¤¿¥É¥¢
 E:locked door
 G:+:U
-M:32
+M:CLOSED_DOOR
+W:10
+K:DESTROYED:FLOOR
+K:OPEN:OPEN_DOOR
+K:BASH:BROKEN_DOOR
+K:SPIKE:JAMMED_DOOR_4
+K:DISARM:CLOSED_DOOR
+F:POWER_3 | NOTICE | REMEMBER | OPEN | BASH | SPIKE | TUNNEL | DOOR |
+F:HURT_ROCK | CAN_PASS | HURT_DISI
 
 # 0x2x --> locked door (power 4)
 
-N:36:¸°¤Î¤«¤«¤Ã¤¿¥É¥¢
+N:36:LOCKED_DOOR_4
+J:¸°¤Î¤«¤«¤Ã¤¿¥É¥¢
 E:locked door
 G:+:U
-M:32
+M:CLOSED_DOOR
+W:10
+K:DESTROYED:FLOOR
+K:OPEN:OPEN_DOOR
+K:BASH:BROKEN_DOOR
+K:SPIKE:JAMMED_DOOR_5
+K:DISARM:CLOSED_DOOR
+F:POWER_4 | NOTICE | REMEMBER | OPEN | BASH | SPIKE | TUNNEL | DOOR |
+F:HURT_ROCK | CAN_PASS | HURT_DISI
 
 # 0x2x --> locked door (power 5)
 
-N:37:¸°¤Î¤«¤«¤Ã¤¿¥É¥¢
+N:37:LOCKED_DOOR_5
+J:¸°¤Î¤«¤«¤Ã¤¿¥É¥¢
 E:locked door
 G:+:U
-M:32
+M:CLOSED_DOOR
+W:10
+K:DESTROYED:FLOOR
+K:OPEN:OPEN_DOOR
+K:BASH:BROKEN_DOOR
+K:SPIKE:JAMMED_DOOR_6
+K:DISARM:CLOSED_DOOR
+F:POWER_5 | NOTICE | REMEMBER | OPEN | BASH | SPIKE | TUNNEL | DOOR |
+F:HURT_ROCK | CAN_PASS | HURT_DISI
 
 # 0x2x --> locked door (power 6)
 
-N:38:¸°¤Î¤«¤«¤Ã¤¿¥É¥¢
+N:38:LOCKED_DOOR_6
+J:¸°¤Î¤«¤«¤Ã¤¿¥É¥¢
 E:locked door
 G:+:U
-M:32
+M:CLOSED_DOOR
+W:10
+K:DESTROYED:FLOOR
+K:OPEN:OPEN_DOOR
+K:BASH:BROKEN_DOOR
+K:SPIKE:JAMMED_DOOR_7
+K:DISARM:CLOSED_DOOR
+F:POWER_6 | NOTICE | REMEMBER | OPEN | BASH | SPIKE | TUNNEL | DOOR |
+F:HURT_ROCK | CAN_PASS | HURT_DISI
 
 # 0x2x --> locked door (power 7)
 
-N:39:¸°¤Î¤«¤«¤Ã¤¿¥É¥¢
+N:39:LOCKED_DOOR_7
+J:¸°¤Î¤«¤«¤Ã¤¿¥É¥¢
 E:locked door
 G:+:U
-M:32
+M:CLOSED_DOOR
+W:10
+K:DESTROYED:FLOOR
+K:OPEN:OPEN_DOOR
+K:BASH:BROKEN_DOOR
+K:SPIKE:JAMMED_DOOR_7
+K:DISARM:CLOSED_DOOR
+F:POWER_7 | NOTICE | REMEMBER | OPEN | BASH | SPIKE | TUNNEL | DOOR |
+F:HURT_ROCK | CAN_PASS | HURT_DISI
 
 # 0x2x --> jammed door (power 0)
 
-N:40:¤¯¤µ¤Ó¤¬ÂǤ¿¤ì¤¿¥É¥¢
+N:40:JAMMED_DOOR_0
+J:¤¯¤µ¤Ó¤¬ÂǤ¿¤ì¤¿¥É¥¢
 E:jammed door
 G:+:U
-M:32
+M:CLOSED_DOOR
+W:10
+K:DESTROYED:FLOOR
+K:BASH:BROKEN_DOOR
+K:SPIKE:JAMMED_DOOR_1
+F:POWER_0 | NOTICE | REMEMBER | BASH | SPIKE | TUNNEL | DOOR | HURT_ROCK |
+F:CAN_PASS | HURT_DISI
 
 # 0x2x --> jammed door (power 1)
 
-N:41:¤¯¤µ¤Ó¤¬ÂǤ¿¤ì¤¿¥É¥¢
+N:41:JAMMED_DOOR_1
+J:¤¯¤µ¤Ó¤¬ÂǤ¿¤ì¤¿¥É¥¢
 E:jammed door
 G:+:U
-M:32
+M:CLOSED_DOOR
+W:10
+K:DESTROYED:FLOOR
+K:BASH:BROKEN_DOOR
+K:SPIKE:JAMMED_DOOR_2
+F:POWER_1 | NOTICE | REMEMBER | BASH | SPIKE | TUNNEL | DOOR | HURT_ROCK |
+F:CAN_PASS | HURT_DISI
 
 # 0x2x --> jammed door (power 2)
 
-N:42:¤¯¤µ¤Ó¤¬ÂǤ¿¤ì¤¿¥É¥¢
+N:42:JAMMED_DOOR_2
+J:¤¯¤µ¤Ó¤¬ÂǤ¿¤ì¤¿¥É¥¢
 E:jammed door
 G:+:U
-M:32
+M:CLOSED_DOOR
+W:10
+K:DESTROYED:FLOOR
+K:BASH:BROKEN_DOOR
+K:SPIKE:JAMMED_DOOR_3
+F:POWER_2 | NOTICE | REMEMBER | BASH | SPIKE | TUNNEL | DOOR | HURT_ROCK |
+F:CAN_PASS | HURT_DISI
 
 # 0x2x --> jammed door (power 3)
 
-N:43:¤¯¤µ¤Ó¤¬ÂǤ¿¤ì¤¿¥É¥¢
+N:43:JAMMED_DOOR_3
+J:¤¯¤µ¤Ó¤¬ÂǤ¿¤ì¤¿¥É¥¢
 E:jammed door
 G:+:U
-M:32
+M:CLOSED_DOOR
+W:10
+K:DESTROYED:FLOOR
+K:BASH:BROKEN_DOOR
+K:SPIKE:JAMMED_DOOR_4
+F:POWER_3 | NOTICE | REMEMBER | BASH | SPIKE | TUNNEL | DOOR | HURT_ROCK |
+F:CAN_PASS | HURT_DISI
 
 # 0x2x --> jammed door (power 4)
 
-N:44:¤¯¤µ¤Ó¤¬ÂǤ¿¤ì¤¿¥É¥¢
+N:44:JAMMED_DOOR_4
+J:¤¯¤µ¤Ó¤¬ÂǤ¿¤ì¤¿¥É¥¢
 E:jammed door
 G:+:U
-M:32
+M:CLOSED_DOOR
+W:10
+K:DESTROYED:FLOOR
+K:BASH:BROKEN_DOOR
+K:SPIKE:JAMMED_DOOR_5
+F:POWER_4 | NOTICE | REMEMBER | BASH | SPIKE | TUNNEL | DOOR | HURT_ROCK |
+F:CAN_PASS | HURT_DISI
 
 # 0x2x --> jammed door (power 5)
 
-N:45:¤¯¤µ¤Ó¤¬ÂǤ¿¤ì¤¿¥É¥¢
+N:45:JAMMED_DOOR_5
+J:¤¯¤µ¤Ó¤¬ÂǤ¿¤ì¤¿¥É¥¢
 E:jammed door
 G:+:U
-M:32
+M:CLOSED_DOOR
+W:10
+K:DESTROYED:FLOOR
+K:BASH:BROKEN_DOOR
+K:SPIKE:JAMMED_DOOR_6
+F:POWER_5 | NOTICE | REMEMBER | BASH | SPIKE | TUNNEL | DOOR | HURT_ROCK |
+F:CAN_PASS | HURT_DISI
 
 # 0x2x --> jammed door (power 6)
 
-N:46:¤¯¤µ¤Ó¤¬ÂǤ¿¤ì¤¿¥É¥¢
+N:46:JAMMED_DOOR_6
+J:¤¯¤µ¤Ó¤¬ÂǤ¿¤ì¤¿¥É¥¢
 E:jammed door
 G:+:U
-M:32
+M:CLOSED_DOOR
+W:10
+K:DESTROYED:FLOOR
+K:BASH:BROKEN_DOOR
+K:SPIKE:JAMMED_DOOR_7
+F:POWER_6 | NOTICE | REMEMBER | BASH | SPIKE | TUNNEL | DOOR | HURT_ROCK |
+F:CAN_PASS | HURT_DISI
 
 # 0x2x --> jammed door (power 7)
 
-N:47:¤¯¤µ¤Ó¤¬ÂǤ¿¤ì¤¿¥É¥¢
+N:47:JAMMED_DOOR_7
+J:¤¯¤µ¤Ó¤¬ÂǤ¿¤ì¤¿¥É¥¢
 E:jammed door
 G:+:U
-M:32
+M:CLOSED_DOOR
+W:10
+K:DESTROYED:FLOOR
+K:BASH:BROKEN_DOOR
+K:SPIKE:JAMMED_DOOR_7
+F:POWER_7 | NOTICE | REMEMBER | BASH | SPIKE | TUNNEL | DOOR | HURT_ROCK |
+F:CAN_PASS | HURT_DISI
 
 # 0x30 --> secret door
 
-N:48:±£¤·¥É¥¢
+N:48:SECRET_DOOR
+J:±£¤·¥É¥¢
 E:secret door
 G:#:w
-M:56
+M:GRANITE
+W:10
+K:DESTROYED:FLOOR
+K:SECRET:CLOSED_DOOR
+K:OPEN:OPEN_DOOR
+K:BASH:BROKEN_DOOR
+F:SECRET | NOTICE | REMEMBER | OPEN | BASH | TUNNEL | DOOR | HURT_ROCK |
+F:CAN_PASS | HURT_DISI
 
 # 0x31 --> rubble
 
-N:49:´äÀÐ
+N:49:RUBBLE
+J:´äÀÐ
 E:pile of rubble
-G:::w
+G:::w:LIT
+W:2
+K:DESTROYED:FLOOR
+F:POWER_10 | REMEMBER | TUNNEL | HAS_ITEM | HURT_ROCK | CAN_PASS | CAN_DIG |
+F:HURT_DISI
 
 # 0x32 --> magma vein
 
-N:50:ÍÏ´ä¤Î¹ÛÌ®
+N:50:MAGMA_VEIN
+J:ÍÏ´ä¤Î¹ÛÌ®
 E:magma vein
-G:%:s
+G:%:s:LIT
+W:2
+K:DESTROYED:FLOOR
+K:MAY_HAVE_GOLD:MAGMA_TREASURE
+F:POWER_10 | REMEMBER | TUNNEL | MAY_HAVE_GOLD | WALL | HURT_ROCK | CAN_PASS |
+F:HURT_DISI
 
 # 0x33 --> quartz vein
 
-N:51:ÀбѤιÛÌ®
+N:51:QUARTZ_VEIN
+J:ÀбѤιÛÌ®
 E:quartz vein
-G:%:w
+G:%:w:LIT
+W:2
+K:DESTROYED:FLOOR
+K:MAY_HAVE_GOLD:QUARTZ_TREASURE
+F:POWER_20 | REMEMBER | TUNNEL | MAY_HAVE_GOLD | WALL | HURT_ROCK | CAN_PASS |
+F:HURT_DISI
 
 # 0x34 --> magma vein + treasure
 
-N:52:ÍÏ´ä¤Î¹ÛÌ®(±£¤µ¤ì¤¿ºâÊõ¤ò´ÞÍ­)
+N:52:MAGMA_HIDDEN
+J:ÍÏ´ä¤Î¹ÛÌ®(±£¤µ¤ì¤¿ºâÊõ¤ò´ÞÍ­)
 E:magma vein with hidden treasure
-G:%:s
-M:50
+G:%:s:LIT
+M:MAGMA_VEIN
+W:2
+K:DESTROYED:FLOOR
+K:SECRET:MAGMA_TREASURE
+F:POWER_10 | SECRET | REMEMBER | TUNNEL | HAS_GOLD | WALL | HURT_ROCK |
+F:CAN_PASS | HURT_DISI
 
 # 0x35 --> quartz vein + treasure
 
-N:53:ÀбѤιÛÌ®(±£¤µ¤ì¤¿ºâÊõ¤ò´ÞÍ­)
+N:53:QUARTZ_HIDDEN
+J:ÀбѤιÛÌ®(±£¤µ¤ì¤¿ºâÊõ¤ò´ÞÍ­)
 E:quartz vein hidden treasure
-G:%:w
-M:51
+G:%:w:LIT
+M:QUARTZ_VEIN
+W:2
+K:DESTROYED:FLOOR
+K:SECRET:QUARTZ_TREASURE
+F:POWER_20 | SECRET | REMEMBER | TUNNEL | HAS_GOLD | WALL | HURT_ROCK |
+F:CAN_PASS | HURT_DISI
 
 # 0x36 --> magma vein + known treasure
 
-N:54:ºâÊõ¤ò´ÞÍ­¤·¤¿ÍÏ´ä¤Î¹ÛÌ®
+N:54:MAGMA_TREASURE
+J:ºâÊõ¤ò´ÞÍ­¤·¤¿ÍÏ´ä¤Î¹ÛÌ®
 E:magma vein with treasure
-G:*:o
+G:*:o:LIT
+W:2
+K:DESTROYED:FLOOR
+K:ENSECRET:MAGMA_HIDDEN
+F:POWER_20 | REMEMBER | TUNNEL | HAS_GOLD | WALL | HURT_ROCK | CAN_PASS |
+F:HURT_DISI
 
 # 0x37 --> quartz vein + known treasure
 
-N:55:ºâÊõ¤ò´ÞÍ­¤·¤¿ÀбѤιÛÌ®
+N:55:QUARTZ_TREASURE
+J:ºâÊõ¤ò´ÞÍ­¤·¤¿ÀбѤιÛÌ®
 E:quartz vein with treasure
-G:*:o
+G:*:o:LIT
+W:2
+K:DESTROYED:FLOOR
+K:ENSECRET:QUARTZ_HIDDEN
+F:POWER_20 | REMEMBER | TUNNEL | HAS_GOLD | WALL | HURT_ROCK | CAN_PASS |
+F:HURT_DISI
 
 # 0x38 --> granite wall -- basic
 
-N:56:²ÖÖ¾´ä¤ÎÊÉ
+N:56:GRANITE
+J:²ÖÖ¾´ä¤ÎÊÉ
 E:granite wall
-G:#:w
+G:#:w:LIT
+W:2
+K:DESTROYED:FLOOR
+F:POWER_40 | REMEMBER | TUNNEL | WALL | HURT_ROCK | CAN_PASS | HURT_DISI
 
 # 0x39 --> granite wall -- inner
 
-N:57:²ÖÖ¾´ä¤ÎÊÉ
+N:57:GRANITE_INNER
+J:²ÖÖ¾´ä¤ÎÊÉ
 E:granite wall
-G:#:w
-M:56
+G:#:w:LIT
+M:GRANITE
+W:2
+K:DESTROYED:FLOOR
+F:POWER_40 | REMEMBER | TUNNEL | WALL | INNER | HURT_ROCK | CAN_PASS |
+F:HURT_DISI
 
 # 0x3A --> granite wall -- outer
 
-N:58:²ÖÖ¾´ä¤ÎÊÉ
+N:58:GRANITE_OUTER
+J:²ÖÖ¾´ä¤ÎÊÉ
 E:granite wall
-G:#:w
-M:56
+G:#:w:LIT
+M:GRANITE
+W:2
+K:DESTROYED:FLOOR
+F:POWER_40 | REMEMBER | TUNNEL | WALL | OUTER | HURT_ROCK | CAN_PASS |
+F:HURT_DISI
 
 # 0x3B --> granite wall -- solid
 
-N:59:²ÖÖ¾´ä¤ÎÊÉ
+N:59:GRANITE_SOLID
+J:²ÖÖ¾´ä¤ÎÊÉ
 E:granite wall
-G:#:w
-M:56
+G:#:w:LIT
+M:GRANITE
+W:2
+K:DESTROYED:FLOOR
+F:POWER_40 | REMEMBER | TUNNEL | WALL | SOLID | HURT_ROCK | CAN_PASS |
+F:HURT_DISI
 
 # 0x3C --> permanent wall -- basic (perm)
 
-N:60:±Êµ×´ä¤ÎÊÉ
+N:60:PERMANENT
+J:±Êµ×´ä¤ÎÊÉ
 E:permanent wall
-G:#:U
+G:#:U:LIT
+W:5
+K:UNPERM:GRANITE
+F:REMEMBER | TUNNEL | WALL | PERMANENT
 
 # 0x3D --> permanent wall -- inner (perm)
 
-N:61:±Êµ×´ä¤ÎÊÉ
+N:61:PERMANENT_INNER
+J:±Êµ×´ä¤ÎÊÉ
 E:permanent wall
-G:#:U
-M:60
+G:#:U:LIT
+M:PERMANENT
+W:5
+K:UNPERM:GRANITE_INNER
+F:REMEMBER | TUNNEL | WALL | PERMANENT | INNER
 
 # 0x3E --> permanent wall -- outer (perm)
 
-N:62:±Êµ×´ä¤ÎÊÉ
+N:62:PERMANENT_OUTER
+J:±Êµ×´ä¤ÎÊÉ
 E:permanent wall
-G:#:U
-M:60
+G:#:U:LIT
+M:PERMANENT
+W:5
+K:UNPERM:GRANITE_OUTER
+F:REMEMBER | TUNNEL | WALL | PERMANENT | OUTER
 
 # 0x3F --> permanent wall -- solid (perm)
 
-N:63:±Êµ×´ä¤ÎÊÉ
+N:63:PERMANENT_SOLID
+J:±Êµ×´ä¤ÎÊÉ
 E:permanent wall
-G:#:U
-M:60
-
-N:64:Çúȯ¥ë¡¼¥ó
+G:#:U:LIT
+M:PERMANENT
+W:5
+K:UNPERM:GRANITE_SOLID
+F:REMEMBER | TUNNEL | WALL | PERMANENT | SOLID
+
+N:64:EXPLOSIVE_RUNE
+J:Çúȯ¥ë¡¼¥ó
 E:explosive rune
-G:;:R
-
-N:65:¥Ñ¥¿¡¼¥ó½ÐȯÅÀ
+G:;:R:LIT
+W:16
+K:DESTROYED:FLOOR
+F:LOS | PROJECT | MOVE | PLACE | NOTICE | REMEMBER | CAN_FLY | MINOR_GLYPH |
+F:HURT_DISI
+
+N:65:PATTERN_START
+J:¥Ñ¥¿¡¼¥ó½ÐȯÅÀ
 E:Pattern startpoint
 G:*:w
+W:16
+K:HURT_DISI:FLOOR
+F:POWER_0 | LOS | PROJECT | MOVE | NOTICE | REMEMBER | PERMANENT | CAN_FLY |
+F:PATTERN
 
-N:66:¥Ñ¥¿¡¼¥ó¤Î°ìÉô
+N:66:PATTERN_1
+J:¥Ñ¥¿¡¼¥ó¤Î°ìÉô
 E:section of the Pattern
 G:*:B
+W:16
+K:HURT_DISI:FLOOR
+F:POWER_1 | LOS | PROJECT | MOVE | NOTICE | REMEMBER | PERMANENT | CAN_FLY |
+F:PATTERN
 
-N:67:¥Ñ¥¿¡¼¥ó¤Î°ìÉô
+N:67:PATTERN_2
+J:¥Ñ¥¿¡¼¥ó¤Î°ìÉô
 E:section of the Pattern
 G:*:b
+W:16
+K:HURT_DISI:FLOOR
+F:POWER_2 | LOS | PROJECT | MOVE | NOTICE | REMEMBER | PERMANENT | CAN_FLY |
+F:PATTERN
 
-N:68:¥Ñ¥¿¡¼¥ó¤Î°ìÉô
+N:68:PATTERN_3
+J:¥Ñ¥¿¡¼¥ó¤Î°ìÉô
 E:section of the Pattern
 G:*:B
+W:16
+K:HURT_DISI:FLOOR
+F:POWER_3 | LOS | PROJECT | MOVE | NOTICE | REMEMBER | PERMANENT | CAN_FLY |
+F:PATTERN
 
-N:69:¥Ñ¥¿¡¼¥ó¤Î°ìÉô
+N:69:PATTERN_4
+J:¥Ñ¥¿¡¼¥ó¤Î°ìÉô
 E:section of the Pattern
 G:*:b
+W:16
+K:HURT_DISI:FLOOR
+F:POWER_4 | LOS | PROJECT | MOVE | NOTICE | REMEMBER | PERMANENT | CAN_FLY |
+F:PATTERN
 
-N:70:¥Ñ¥¿¡¼¥ó¤Î°ìÉô
+N:70:PATTERN_END
+J:¥Ñ¥¿¡¼¥ó¤Î°ìÉô
 E:section of the Pattern
 G:*:W
+W:16
+K:HURT_DISI:FLOOR
+F:POWER_5 | LOS | PROJECT | MOVE | NOTICE | REMEMBER | PERMANENT | CAN_FLY |
+F:PATTERN
 
-N:71:¥Ñ¥¿¡¼¥ó¤Î°ìÉô(discharged)
+N:71:PATTERN_OLD
+J:¥Ñ¥¿¡¼¥ó¤Î°ìÉô(discharged)
 E:section of the Pattern (discharged)
 G:*:W
+W:16
+K:HURT_DISI:FLOOR
+F:POWER_6 | LOS | PROJECT | MOVE | NOTICE | REMEMBER | PERMANENT | CAN_FLY |
+F:PATTERN
 
-N:72:¥Ñ¥¿¡¼¥ó½Ð¸ý
+N:72:PATTERN_EXIT
+J:¥Ñ¥¿¡¼¥ó½Ð¸ý
 E:Pattern exit
 G:*:w
+W:16
+K:HURT_DISI:FLOOR
+F:POWER_7 | LOS | PROJECT | MOVE | NOTICE | REMEMBER | PERMANENT | CAN_FLY |
+F:PATTERN
 
-N:73:²õ¤ì¤¿¥Ñ¥¿¡¼¥ó¤Î°ìÉô
+N:73:PATTERN_CORRUPTED
+J:²õ¤ì¤¿¥Ñ¥¿¡¼¥ó¤Î°ìÉô
 E:corrupted section of the Pattern
 G:*:D
+W:16
+K:HURT_DISI:FLOOR
+F:POWER_8 | LOS | PROJECT | MOVE | NOTICE | REMEMBER | PERMANENT | CAN_FLY |
+F:PATTERN
 
 # 0x4A --> shop -- general store (perm)
 
-N:74:»¨²ß²°
+N:74:GENERAL_STORE
+J:»¨²ß²°
 E:General Store
 G:1:U
+W:10
+F:POWER_0 | LOS | PROJECT | MOVE | NOTICE | REMEMBER | STORE | DOOR |
+F:PERMANENT | GLOW
 
 # 0x4B --> shop -- armoury (perm)
 
-N:75:Ëɶñ²°
+N:75:ARMOURY
+J:Ëɶñ²°
 E:Armoury
 G:2:s
+W:10
+F:POWER_1 | LOS | PROJECT | MOVE | NOTICE | REMEMBER | STORE | DOOR |
+F:PERMANENT | GLOW
 
 # 0x4C --> shop -- weapon shop (perm)
 
-N:76:Éð´ïÀìÌçŹ
+N:76:WEAPON_SMITHS
+J:Éð´ïÀìÌçŹ
 E:Weapon Smiths
 G:3:w
+W:10
+F:POWER_2 | LOS | PROJECT | MOVE | NOTICE | REMEMBER | STORE | DOOR |
+F:PERMANENT | GLOW
 
 # 0x4D --> shop -- temple (perm)
 
-N:77:»û±¡
+N:77:TEMPLE
+J:»û±¡
 E:Temple
 G:4:g
+W:10
+F:POWER_3 | LOS | PROJECT | MOVE | NOTICE | REMEMBER | STORE | DOOR |
+F:PERMANENT | GLOW
 
 # 0x4E --> shop -- alchemist (perm)
 
-N:78:Ï£¶â½Ñ¤ÎŹ
+N:78:ALCHEMY_SHOP
+J:Ï£¶â½Ñ¤ÎŹ
 E:Alchemy Shop
 G:5:b
+W:10
+F:POWER_4 | LOS | PROJECT | MOVE | NOTICE | REMEMBER | STORE | DOOR |
+F:PERMANENT | GLOW
 
 # 0x4F --> shop -- magic shop (perm)
 
-N:79:ËâË¡¤ÎŹ
+N:79:MAGIC_SHOP
+J:ËâË¡¤ÎŹ
 E:Magic Shop
 G:6:r
+W:10
+F:POWER_5 | LOS | PROJECT | MOVE | NOTICE | REMEMBER | STORE | DOOR |
+F:PERMANENT | GLOW
 
 # 0x50 --> shop -- black market (perm)
 
-N:80:¥Ö¥é¥Ã¥¯¡¦¥Þ¡¼¥±¥Ã¥È
+N:80:BLACK_MARKET
+J:¥Ö¥é¥Ã¥¯¡¦¥Þ¡¼¥±¥Ã¥È
 E:Black Market
 G:7:D
+W:10
+F:POWER_6 | LOS | PROJECT | MOVE | NOTICE | REMEMBER | STORE | DOOR |
+F:PERMANENT | GLOW
 
 # 0x51 --> shop -- home (perm)
 
-N:81:²æ¤¬²È
+N:81:HOME
+J:²æ¤¬²È
 E:Home
 G:8:y
+W:10
+F:POWER_7 | LOS | PROJECT | MOVE | NOTICE | REMEMBER | STORE | DOOR |
+F:PERMANENT | GLOW
 
 # 0x52 --> shop -- bookstore (perm)
 
-N:82:½ñŹ
+N:82:BOOKSTORE
+J:½ñŹ
 E:Bookstore
 G:9:o
+W:10
+F:POWER_8 | LOS | PROJECT | MOVE | NOTICE | REMEMBER | STORE | DOOR |
+F:PERMANENT | GLOW
 
 # 0x53 --> terrain -- deep water
 
-N:83:¿¼¤¤¿å
+N:83:DEEP_WATER
+J:¿¼¤¤¿å
 E:pool of deep water
-G:~:b
+G:~:b:LIT
+W:2
+F:LOS | PROJECT | MOVE | PLACE | REMEMBER | WATER | DEEP | CAN_FLY | CAN_SWIM |
+F:TELEPORTABLE
 
-N:84:Àõ¤¤¿å¤Îή¤ì
+N:84:SHALLOW_WATER
+J:Àõ¤¤¿å¤Îή¤ì
 E:stream of shallow water
-G:~:B
+G:~:B:LIT
+W:2
+F:LOS | PROJECT | MOVE | PLACE | DROP | REMEMBER | WATER | SHALLOW | CAN_FLY |
+F:CAN_SWIM | TELEPORTABLE
 
-N:85:¿¼¤¤ÍÏ´äί¤ê
+N:85:DEEP_LAVA
+J:¿¼¤¤ÍÏ´äί¤ê
 E:pool of deep lava
-G:~:r
+G:~:r:LIT
+W:2
+F:LOS | PROJECT | MOVE | PLACE | REMEMBER | GLOW | LAVA | DEEP | CAN_FLY |
+F:TELEPORTABLE
 
-N:86:Àõ¤¤ÍÏ´ä¤Îή¤ì
+N:86:SHALLOW_LAVA
+J:Àõ¤¤ÍÏ´ä¤Îή¤ì
 E:stream of shallow lava
-G:~:U
+G:~:U:LIT
+W:2
+F:LOS | PROJECT | MOVE | PLACE | DROP | REMEMBER | LAVA | SHALLOW | CAN_FLY |
+F:TELEPORTABLE
 
-N:87:°Å¤¤·ê
+N:87:DARK_PIT
+J:°Å¤¤·ê
 E:dark pit
-G:#:D
+G:#:D:LIT
+W:1
+F:LOS | PROJECT | MOVE | PLACE | REMEMBER | MUST_FLY | CAN_FLY | TELEPORTABLE
 
-N:88:º½ÃÏ
+N:88:DIRT
+J:º½ÃÏ
 E:dirt
-G:.:u
+G:.:u:LIT
+W:2
+F:LOS | PROJECT | MOVE | PLACE | DROP | FLOOR | CAN_FLY | TELEPORTABLE
 
-N:89:ÁðÃÏ
+N:89:GRASS
+J:ÁðÃÏ
 E:patch of grass
-G:.:g
+G:.:g:LIT
+W:2
+F:LOS | PROJECT | MOVE | PLACE | DROP | FLOOR | CAN_FLY | PLANT | TELEPORTABLE
 
-N:90:¥³¥ó¥Ñ¥¯¥È¥ë¡¼¥ó
+N:90:TRAP_TRAPS
+J:¥³¥ó¥Ñ¥¯¥È¥ë¡¼¥ó
 E:compact rune
-G:^:D
-
-N:91:·ÙÊóÁõÃÖ
+G:^:D:LIT
+W:2
+K:DESTROYED:FLOOR
+K:HIT_TRAP:FLOOR
+F:POWER_5 | LOS | PROJECT | MOVE | PLACE | NOTICE | REMEMBER | DISARM | TRAP |
+F:HIT_TRAP | CAN_FLY | HURT_DISI
+
+N:91:TRAP_ALARM
+J:·ÙÊóÁõÃÖ
 E:alarm
-G:^:R
-
-N:92:³«Ì祹¥¤¥Ã¥Á
+G:^:R:LIT
+W:2
+K:DESTROYED:FLOOR
+K:HIT_TRAP:TRAP_ALARM
+F:POWER_5 | LOS | PROJECT | MOVE | PLACE | NOTICE | REMEMBER | DISARM | TRAP |
+F:HIT_TRAP | CAN_FLY | HURT_DISI
+
+N:92:TRAP_OPEN
+J:³«Ì祹¥¤¥Ã¥Á
 E:wall opeing trap
-G:^:w
-
-N:93:²Ö
+G:^:w:LIT
+W:10
+K:DESTROYED:FLOOR
+K:HIT_TRAP:TRAP_OPEN
+F:POWER_100 | LOS | PROJECT | MOVE | PLACE | NOTICE | REMEMBER | DISARM |
+F:TRAP | HIT_TRAP | CAN_FLY | HURT_DISI
+
+N:93:FLOWER
+J:²Ö
 E:flower
-G:::G
-
-N:94:Áð¤à¤é
+G:::G:LIT
+W:2
+K:DESTROYED:GRASS
+F:LOS | PROJECT | MOVE | PLACE | DROP | REMEMBER | CAN_FLY | PLANT |
+F:HURT_DISI | TELEPORTABLE
+
+N:94:BRAKE
+J:Áð¤à¤é
 E:brake
-G:::g
-
-N:95:Çîʪ´Û
+G:::g:LIT
+W:2
+K:DESTROYED:GRASS
+F:LOS | PROJECT | MOVE | PLACE | DROP | REMEMBER | CAN_FLY | PLANT |
+F:HURT_DISI | TELEPORTABLE
+
+N:95:MUSEUM
+J:Çîʪ´Û
 E:Museum
 G:0:v
+W:10
+F:POWER_9 | LOS | PROJECT | MOVE | NOTICE | REMEMBER | STORE | DOOR |
+F:PERMANENT | GLOW
 
-N:96:ÌÚ
+N:96:TREE
+J:ÌÚ
 E:tree
-G:#:G
-
-N:97:»³Ì®
+G:#:G:LIT
+W:2
+K:DESTROYED:GRASS
+F:POWER_10 | MOVE | PLACE | DROP | REMEMBER | TUNNEL | AVOID_RUN | CAN_FLY |
+F:TREE | PLANT | HURT_DISI | TELEPORTABLE
+
+N:97:MOUNTAIN
+J:»³Ì®
 E:mountain chain
-G:^:o
+G:^:o:LIT
+W:5
+K:HURT_DISI:DIRT
+F:REMEMBER | AVOID_RUN | WALL | PERMANENT | MOUNTAIN | TELEPORTABLE
 
-N:128:·úʪ
+N:128:BUILDING_0
+J:·úʪ
 E:Building
 G:+:U
+W:10
+F:POWER_0 | LOS | PROJECT | MOVE | NOTICE | REMEMBER | DOOR | PERMANENT |
+F:GLOW | BLDG
 
-N:129:·úʪ
+N:129:BUILDING_1
+J:·úʪ
 E:Building
 G:+:U
+W:10
+F:POWER_1 | LOS | PROJECT | MOVE | NOTICE | REMEMBER | DOOR | PERMANENT |
+F:GLOW | BLDG
 
-N:130:·úʪ
+N:130:BUILDING_2
+J:·úʪ
 E:Building
 G:+:v
+W:10
+F:POWER_2 | LOS | PROJECT | MOVE | NOTICE | REMEMBER | DOOR | PERMANENT |
+F:GLOW | BLDG
 
-N:131:·úʪ
+N:131:BUILDING_3
+J:·úʪ
 E:Building
 G:+:U
+W:10
+F:POWER_3 | LOS | PROJECT | MOVE | NOTICE | REMEMBER | DOOR | PERMANENT |
+F:GLOW | BLDG
 
-N:132:·úʪ
+N:132:BUILDING_4
+J:·úʪ
 E:Building
 G:+:U
+W:10
+F:POWER_4 | LOS | PROJECT | MOVE | NOTICE | REMEMBER | DOOR | PERMANENT |
+F:GLOW | BLDG
 
-N:133:·úʪ
+N:133:BUILDING_5
+J:·úʪ
 E:Building
 G:+:U
+W:10
+F:POWER_5 | LOS | PROJECT | MOVE | NOTICE | REMEMBER | DOOR | PERMANENT |
+F:GLOW | BLDG
 
-N:134:·úʪ
+N:134:BUILDING_6
+J:·úʪ
 E:Building
 G:+:U
+W:10
+F:POWER_6 | LOS | PROJECT | MOVE | NOTICE | REMEMBER | DOOR | PERMANENT |
+F:GLOW | BLDG
 
-N:135:·úʪ
+N:135:BUILDING_7
+J:·úʪ
 E:Building
 G:+:o
+W:10
+F:POWER_7 | LOS | PROJECT | MOVE | NOTICE | REMEMBER | DOOR | PERMANENT |
+F:GLOW | BLDG
 
-N:136:·úʪ
+N:136:BUILDING_8
+J:·úʪ
 E:Building
 G:+:R
+W:10
+F:POWER_8 | LOS | PROJECT | MOVE | NOTICE | REMEMBER | DOOR | PERMANENT |
+F:GLOW | BLDG
 
-N:137:·úʪ
+N:137:BUILDING_9
+J:·úʪ
 E:Building
 G:+:G
+W:10
+F:POWER_9 | LOS | PROJECT | MOVE | NOTICE | REMEMBER | DOOR | PERMANENT |
+F:GLOW | BLDG
 
-N:138:·úʪ
+N:138:BUILDING_10
+J:·úʪ
 E:Building
 G:+:v
+W:10
+F:POWER_10 | LOS | PROJECT | MOVE | NOTICE | REMEMBER | DOOR | PERMANENT |
+F:GLOW | BLDG
 
-N:139:·úʪ
+N:139:BUILDING_11
+J:·úʪ
 E:Building
 G:+:u
+W:10
+F:POWER_11 | LOS | PROJECT | MOVE | NOTICE | REMEMBER | DOOR | PERMANENT |
+F:GLOW | BLDG
 
-N:140:·úʪ
+N:140:BUILDING_12
+J:·úʪ
 E:Building
 G:+:w
+W:10
+F:POWER_12 | LOS | PROJECT | MOVE | NOTICE | REMEMBER | DOOR | PERMANENT |
+F:GLOW | BLDG
 
-N:141:·úʪ
+N:141:BUILDING_13
+J:·úʪ
 E:Building
 G:+:B
+W:10
+F:POWER_13 | LOS | PROJECT | MOVE | NOTICE | REMEMBER | DOOR | PERMANENT |
+F:GLOW | BLDG
 
-N:142:·úʪ
+N:142:BUILDING_14
+J:·úʪ
 E:Building
 G:+:B
+W:10
+F:POWER_14 | LOS | PROJECT | MOVE | NOTICE | REMEMBER | DOOR | PERMANENT |
+F:GLOW | BLDG
 
-N:143:·úʪ
+N:143:BUILDING_15
+J:·úʪ
 E:Building
 G:+:B
+W:10
+F:POWER_15 | LOS | PROJECT | MOVE | NOTICE | REMEMBER | DOOR | PERMANENT |
+F:GLOW | BLDG
 
-N:144:·úʪ
+N:144:BUILDING_16
+J:·úʪ
 E:Building
 G:+:B
+W:10
+F:POWER_16 | LOS | PROJECT | MOVE | NOTICE | REMEMBER | DOOR | PERMANENT |
+F:GLOW | BLDG
 
-N:145:·úʪ
+N:145:BUILDING_17
+J:·úʪ
 E:Building
 G:+:B
+W:10
+F:POWER_17 | LOS | PROJECT | MOVE | NOTICE | REMEMBER | DOOR | PERMANENT |
+F:GLOW | BLDG
 
-N:146:·úʪ
+N:146:BUILDING_18
+J:·úʪ
 E:Building
 G:+:B
+W:10
+F:POWER_18 | LOS | PROJECT | MOVE | NOTICE | REMEMBER | DOOR | PERMANENT |
+F:GLOW | BLDG
 
-N:147:·úʪ
+N:147:BUILDING_19
+J:·úʪ
 E:Building
 G:+:B
+W:10
+F:POWER_19 | LOS | PROJECT | MOVE | NOTICE | REMEMBER | DOOR | PERMANENT |
+F:GLOW | BLDG
 
-N:148:·úʪ
+N:148:BUILDING_20
+J:·úʪ
 E:Building
 G:+:B
+W:10
+F:POWER_20 | LOS | PROJECT | MOVE | NOTICE | REMEMBER | DOOR | PERMANENT |
+F:GLOW | BLDG
 
-N:149:·úʪ
+N:149:BUILDING_21
+J:·úʪ
 E:Building
 G:+:B
+W:10
+F:POWER_21 | LOS | PROJECT | MOVE | NOTICE | REMEMBER | DOOR | PERMANENT |
+F:GLOW | BLDG
 
-N:150:·úʪ
+N:150:BUILDING_22
+J:·úʪ
 E:Building
 G:+:B
+W:10
+F:POWER_22 | LOS | PROJECT | MOVE | NOTICE | REMEMBER | DOOR | PERMANENT |
+F:GLOW | BLDG
 
-N:151:·úʪ
+N:151:BUILDING_23
+J:·úʪ
 E:Building
 G:+:B
+W:10
+F:POWER_23 | LOS | PROJECT | MOVE | NOTICE | REMEMBER | DOOR | PERMANENT |
+F:GLOW | BLDG
 
-N:152:·úʪ
+N:152:BUILDING_24
+J:·úʪ
 E:Building
 G:+:B
+W:10
+F:POWER_24 | LOS | PROJECT | MOVE | NOTICE | REMEMBER | DOOR | PERMANENT |
+F:GLOW | BLDG
 
-N:153:·úʪ
+N:153:BUILDING_25
+J:·úʪ
 E:Building
 G:+:B
+W:10
+F:POWER_25 | LOS | PROJECT | MOVE | NOTICE | REMEMBER | DOOR | PERMANENT |
+F:GLOW | BLDG
 
-N:154:·úʪ
+N:154:BUILDING_26
+J:·úʪ
 E:Building
 G:+:B
+W:10
+F:POWER_26 | LOS | PROJECT | MOVE | NOTICE | REMEMBER | DOOR | PERMANENT |
+F:GLOW | BLDG
 
-N:155:·úʪ
+N:155:BUILDING_27
+J:·úʪ
 E:Building
 G:+:B
+W:10
+F:POWER_27 | LOS | PROJECT | MOVE | NOTICE | REMEMBER | DOOR | PERMANENT |
+F:GLOW | BLDG
 
-N:156:·úʪ
+N:156:BUILDING_28
+J:·úʪ
 E:Building
 G:+:B
+W:10
+F:POWER_28 | LOS | PROJECT | MOVE | NOTICE | REMEMBER | DOOR | PERMANENT |
+F:GLOW | BLDG
 
-N:157:·úʪ
+N:157:BUILDING_29
+J:·úʪ
 E:Building
 G:+:B
+W:10
+F:POWER_29 | LOS | PROJECT | MOVE | NOTICE | REMEMBER | DOOR | PERMANENT |
+F:GLOW | BLDG
 
-N:158:·úʪ
+N:158:BUILDING_30
+J:·úʪ
 E:Building
 G:+:B
+W:10
+F:POWER_30 | LOS | PROJECT | MOVE | NOTICE | REMEMBER | DOOR | PERMANENT |
+F:GLOW | BLDG
 
-N:159:·úʪ
+N:159:BUILDING_31
+J:·úʪ
 E:Building
 G:+:B
+W:10
+F:POWER_31 | LOS | PROJECT | MOVE | NOTICE | REMEMBER | DOOR | PERMANENT |
+F:GLOW | BLDG
 
-N:192:³¹
+N:192:TOWN
+J:³¹
 E:Town
 G:*:W
+W:35
+F:LOS | PROJECT | MOVE | PLACE | NOTICE | REMEMBER | PERMANENT | CAN_FLY |
+F:SPECIAL | TOWN | TELEPORTABLE
 
-N:193:¥À¥ó¥¸¥ç¥ó¤Ø¤ÎÆþ¸ý
+N:193:ENTRANCE
+J:¥À¥ó¥¸¥ç¥ó¤Ø¤ÎÆþ¸ý
 E:entrance to dungeon
 G:>:v
+W:35
+F:LOS | PROJECT | MOVE | PLACE | NOTICE | REMEMBER | STAIRS | MORE |
+F:PERMANENT | CAN_FLY | SPECIAL | ENTRANCE | TELEPORTABLE
 
-N:194:¾ÂÃÏ
+N:194:SWAMP
+J:¾ÂÃÏ
 E:swamp
-G:.:B
+G:.:B:LIT
+W:2
+F:LOS | PROJECT | MOVE | PLACE | DROP | REMEMBER | WATER | SHALLOW | CAN_FLY |
+F:CAN_SWIM | TELEPORTABLE
 
-N:195:¶À
+N:195:MIRROR
+J:¶À
 E:mirror
-G:*:v
+G:*:v:LIT
+W:16
+F:LOS | PROJECT | MOVE | PLACE | NOTICE | REMEMBER | CAN_FLY | HURT_DISI |
+F:MIRROR
 
 # Used by view_unsafe_grids option
-N:196:̤ÃΤÎÃÏ·Á (̤´¶ÃÎ)
+N:196:UNDETECTED
+J:̤ÃΤÎÃÏ·Á (̤´¶ÃÎ)
 E:unknown grid (not detected)
 G:x:D
+W:1
 
-N:197:¥Ï¥ë¥Þ¥²¥É¥ó¡¦¥È¥é¥Ã¥×
+N:197:TRAP_ARMAGEDDON
+J:¥Ï¥ë¥Þ¥²¥É¥ó¡¦¥È¥é¥Ã¥×
 E:Armageddon trap
-G:^:v
-
-N:198:¥Ô¥é¥Ë¥¢¡¦¥È¥é¥Ã¥×
+G:^:v:LIT
+W:10
+K:DESTROYED:FLOOR
+K:HIT_TRAP:FLOOR
+F:POWER_100 | LOS | PROJECT | MOVE | PLACE | NOTICE | REMEMBER | DISARM |
+F:TRAP | HIT_TRAP | CAN_FLY | HURT_DISI
+
+N:198:TRAP_PIRANHA
+J:¥Ô¥é¥Ë¥¢¡¦¥È¥é¥Ã¥×
 E:Piranha trap
-G:^:b
-
+G:^:b:LIT
+W:10
+K:DESTROYED:FLOOR
+K:HIT_TRAP:FLOOR
+F:POWER_100 | LOS | PROJECT | MOVE | PLACE | NOTICE | REMEMBER | DISARM |
+F:TRAP | HIT_TRAP | CAN_FLY | HURT_DISI
index 799e6a0..f68a471 100644 (file)
@@ -276,11 +276,6 @@ MP
     ¤Ê¤¤¾²¤Ï¥°¥ì¡¼¡¢¤½¤ì°Ê³°¤ÏÄ̾￧¤Ç¤¢¤ëÇò¿§¤Ç¤½¤ì¤¾¤ìɽ¼¨¤µ¤ì¤Þ¤¹¡£
     ¤³¤Î¥ª¥×¥·¥ç¥ó¤òOFF¤Ë¤¹¤ë¤È¤ª¤½¤é¤¯¥²¡¼¥à¤Î¼Â¹Ô¤¬¹â®²½¤µ¤ì¤Þ¤¹¡£
 
-***** <new_ascii_graphics>
-ÃÏ·Á¤ÎÌÀ°Å¤ò¤Ï¤Ã¤­¤ê¤Èɽ¼¨¤¹¤ë  [new_ascii_graphics]
-    view_bright_lite ¤ä view_granite_lite ¤È¶¦¤Ë»È¤¦»ö¤Ë¤è¤ê¡¢¾²¤äÄ̾ï
-    ¤ÎÊɰʳ°¤Î¿§¤â»ë³¦³°¤È»ë³¦Æâ¤Æ°Û¤Ã¤¿¿§¤Çɽ¼¨¤µ¤ì¤ë¤è¤¦¤Ë¤Ê¤ê¤Þ¤¹¡£
-
 ***** <display_path>
 ËâË¡¤äÌð¤Îµ°Àפòɽ¼¨¤¹¤ë  [display_path]
     ¥¿¡¼¥²¥Ã¥È¤ÎÁªÂòÃæ¤Ë¸½ºß¤Î¥«¡¼¥½¥ë¤Î°ÌÃÖ¤ØËâË¡¤äÌ𤬤ɤÎÍͤʵ°ÀפÇ
index 80b2714..bdc3944 100644 (file)
@@ -245,12 +245,6 @@ Use special colors for floor grids (slow)    [view_special_lite]
     speed of the game.  This option may not work well if the attr/char
     codes for walls/veins have been changed
 
-***** <new_ascii_graphics>
-Show a clear contrast between light and dark    [new_ascii_graphics]
-    This option activates a special color scheme for all grids other
-    than normal white color, when used with view_bright_lite and/or
-    view_granite_lite.
-
 ***** <display_path>
 Display actual path before shooting    [display_path]
     When this option is set, the targeting mode will show path from
index bcc36e5..41b53f3 100644 (file)
 # Floors (white / centered dot)
 #
 
-F:1:1/-7
+F:1:1/-7:LIT
 
 #
 # Invis traps (white / centered dot)
 #
 
-F:2:1/-7
+F:2:1/-7:LIT
 
 
 #
 # Magma (slate / special solid block)
 #
 
-F:50:2/-80
-F:52:2/-80
+F:50:2/-80:LIT
+F:52:2/-80:LIT
 
 
 #
 # Quartz (light slate / special solid block)
 #
 
-F:51:9/-80
-F:53:9/-80
+F:51:9/-80:LIT
+F:53:9/-80:LIT
 
 
 #
@@ -50,17 +50,17 @@ F:48:1/-79
 # Granite walls (white / solid block)
 #
 
-F:56:1/-79
-F:57:1/-79
-F:58:1/-79
-F:59:1/-79
+F:56:1/-79:LIT
+F:57:1/-79:LIT
+F:58:1/-79:LIT
+F:59:1/-79:LIT
 
 #
 # Permanent rock (white / solid block)
 #
 
-F:60:1/-79
-F:61:1/-79
-F:62:1/-79
-F:63:1/-79
+F:60:1/-79:LIT
+F:61:1/-79:LIT
+F:62:1/-79:LIT
+F:63:1/-79:LIT
 
index 96f31ee..763d846 100644 (file)
 
 
 # pool of deep water
-F:83:6:37
+F:83:6:37:LIT
 
 # stream of shallow water
-F:84:14:37
+F:84:14:37:LIT
 
 # pool of deep lava
-F:85:4:37
+F:85:4:37:LIT
 
 # stream of shallow lava
-F:86:12:37
+F:86:12:37:LIT
 
 # dark pit
-F:87:8:37
+F:87:8:37:LIT
 
 # tree
-F:96:5:37
+F:96:5:37:LIT
 
index e085110..138c97f 100644 (file)
 
 # Floors (white / centered dot)
 
-#F:1:1/31
+#F:1:1/31:LIT
 
 # Invis traps (white / centered dot)
 
-#F:2:1/31
+#F:2:1/31:LIT
 
 
 # Magma (slate / solid block)
 
-F:50:2/127
-F:52:2/127
+F:50:2/127:LIT
+F:52:2/127:LIT
 
 
 # Quartz (light slate / solid block)
 
-F:51:9/127
-F:53:9/127
+F:51:9/127:LIT
+F:53:9/127:LIT
 
 
 # Secret door (white / solid block)
@@ -42,13 +42,13 @@ F:48:1/127
 
 # Granite walls & permanent rock (white / solid block)
 
-F:56:1/127
-F:57:1/127
-F:58:1/127
-F:59:1/127
-F:60:15/127
-F:61:15/127
-F:62:15/127
-F:63:15/127
+F:56:1/127:LIT
+F:57:1/127:LIT
+F:58:1/127:LIT
+F:59:1/127:LIT
+F:60:15/127:LIT
+F:61:15/127:LIT
+F:62:15/127:LIT
+F:63:15/127:LIT
 
 
index 9af1b29..9a1c9fa 100644 (file)
@@ -10,8 +10,8 @@
 ?:[EQU $GRAF old]
 %:graf-xxx.prf
 F:0:0x01/0x20
-F:1:0x81/0x8E
-F:2:0x81/0x8E
+F:1:0x81/0x8E:LIT
+F:2:0x81/0x8E:LIT
 
 # New tiles (16x16)
 ?:[EQU $GRAF new]
index 57e784c..0d50a75 100644 (file)
@@ -16,37 +16,37 @@ F:48:1/0xA3
 # Magma
 #
 
-F:50:2/0xA5
-F:52:2/0xA5
+F:50:2/0xA5:LIT
+F:52:2/0xA5:LIT
 
 #
 # Quartz
 #
 
-F:51:9/0xA5
-F:53:9/0xA5
+F:51:9/0xA5:LIT
+F:53:9/0xA5:LIT
 
 #
 # Treasure veins
 #
 
-#F:54:3/0xA3
-#F:55:3/0xA3
+#F:54:3/0xA3:LIT
+#F:55:3/0xA3:LIT
 
 #
 # Granite walls
 #
 
-F:56:1/0xA3
-F:57:1/0xA3
-F:58:1/0xA3
-F:59:1/0xA3
+F:56:1/0xA3:LIT
+F:57:1/0xA3:LIT
+F:58:1/0xA3:LIT
+F:59:1/0xA3:LIT
 
 #
 # Permanent walls
 #
 
-F:60:1/0xA3
-F:61:1/0xA3
-F:62:1/0xA3
-F:63:1/0xA3
+F:60:1/0xA3:LIT
+F:61:1/0xA3:LIT
+F:62:1/0xA3:LIT
+F:63:1/0xA3:LIT
index a6cf247..69d68ef 100644 (file)
@@ -3219,13 +3219,13 @@ U:80:0x8A/0x05
 F:0:0x01:0x20
 
 # open floor
-F:1:0x01:0x2E
+F:1:0x01:0x2E:LIT
 
 # invisible trap
-F:2:0x01:0x2E
+F:2:0x01:0x2E:LIT
 
 # glyph of warding
-F:3:0x0E:0xCB
+F:3:0x0E:0xCB:LIT
 
 # open door
 F:4:0x0F:0xC6
@@ -3234,10 +3234,10 @@ F:4:0x0F:0xC6
 F:5:0x02:0xC6
 
 # up staircase
-F:6:0x01:0x93
+F:6:0x01:0x93:LIT
 
 # down staircase
-F:7:0x01:0x94
+F:7:0x01:0x94:LIT
 
 # General Store
 F:8:0x05:0xAB
@@ -3264,52 +3264,52 @@ F:14:0x08:0xAE
 F:15:0x07:0xC5
 
 # trap door
-F:16:0x01:0x97
+F:16:0x01:0x97:LIT
 
 # pit
-F:17:0x07:0x97
+F:17:0x07:0x97:LIT
 
 # pit
-F:18:0x07:0x97
+F:18:0x07:0x97:LIT
 
 # pit
-F:19:0x07:0x97
+F:19:0x07:0x97:LIT
 
 # strange rune
-F:20:0x0B:0x97
+F:20:0x0B:0x97:LIT
 
 # strange rune
-F:21:0x0B:0x97
+F:21:0x0B:0x97:LIT
 
 # discolored spot
-F:22:0x02:0x97
+F:22:0x02:0x97:LIT
 
 # discolored spot
-F:23:0x02:0x97
+F:23:0x02:0x97:LIT
 
 # dart trap
-F:24:0x04:0x97
+F:24:0x04:0x97:LIT
 
 # dart trap
-F:25:0x04:0x97
+F:25:0x04:0x97:LIT
 
 # dart trap
-F:26:0x04:0x97
+F:26:0x04:0x97:LIT
 
 # dart trap
-F:27:0x04:0x97
+F:27:0x04:0x97:LIT
 
 # gas trap
-F:28:0x05:0x97
+F:28:0x05:0x97:LIT
 
 # gas trap
-F:29:0x05:0x97
+F:29:0x05:0x97:LIT
 
 # gas trap
-F:30:0x05:0x97
+F:30:0x05:0x97:LIT
 
 # gas trap
-F:31:0x05:0x97
+F:31:0x05:0x97:LIT
 
 # door
 F:32:0x0F:0xC5
@@ -3363,51 +3363,51 @@ F:47:0x07:0xC5
 F:48:0x02:0xB1
 
 # rubble
-F:49:0x07:0x98
+F:49:0x07:0x98:LIT
 
 # magma vein
-F:50:0x01:0xB1
+F:50:0x01:0xB1:LIT
 
 # quartz vein
-F:51:0x09:0xB1
+F:51:0x09:0xB1:LIT
 
 # magma vein
-F:52:0x01:0xB1
+F:52:0x01:0xB1:LIT
 
 # quartz vein
-F:53:0x09:0xB1
+F:53:0x09:0xB1:LIT
 
 # magma vein with treasure
-F:54:0x03:0xBA
+F:54:0x03:0xBA:LIT
 
 # quartz vein with treasure
-F:55:0x0B:0xBA
+F:55:0x0B:0xBA:LIT
 
 # granite wall
-F:56:0x02:0xB1
+F:56:0x02:0xB1:LIT
 
 # granite wall
-F:57:0x02:0xB1
+F:57:0x02:0xB1:LIT
 
 # granite wall
-F:58:0x02:0xB1
+F:58:0x02:0xB1:LIT
 
 # granite wall
-F:59:0x02:0xB1
+F:59:0x02:0xB1:LIT
 
 # permanent wall
-F:60:0x02:0xB1
+F:60:0x02:0xB1:LIT
 
 # permanent wall
-F:61:0x02:0xB1
+F:61:0x02:0xB1:LIT
 
 # permanent wall
-F:62:0x02:0xB1
+F:62:0x02:0xB1:LIT
 
 # permanent wall
-F:63:0x02:0xB1
+F:63:0x02:0xB1:LIT
 
 # explosive rune
-F:64:0x0C:0xCB
+F:64:0x0C:0xCB:LIT
 
 
index 54c0dba..5a9bcb2 100644 (file)
@@ -309,10 +309,10 @@ S:0xFF:0x85/0x9E
 
 
 # open floor
-F:1:0x80/0x81
+F:1:0x80/0x81:LIT
 
 # glyph of warding
-F:3:0x8D/0x95
+F:3:0x8D/0x95:LIT
 
 # open door
 F:4:0x82/0x84
@@ -321,10 +321,10 @@ F:4:0x82/0x84
 F:5:0x82/0x85
 
 # up staircase
-F:6:0x80/0x96
+F:6:0x80/0x96:LIT
 
 # down staircase
-F:7:0x80/0x99
+F:7:0x80/0x99:LIT
 
 # quest entrance
 F:8:0x0B/0x3E
@@ -342,58 +342,58 @@ F:11:0x04/0x3C
 F:12:0x05/0x3E
 
 # shaft up
-F:13:0x0F/0x3C
+F:13:0x0F/0x3C:LIT
 
 # shaft down
-F:14:0x0F/0x3E
+F:14:0x0F/0x3E:LIT
 
 # trap door
-F:16:0x81/0x8C
+F:16:0x81/0x8C:LIT
 
 # pit
-F:17:0x81/0x89
+F:17:0x81/0x89:LIT
 
 # evil rune
-F:20:0x81/0x8F
+F:20:0x81/0x8F:LIT
 
 # strange rune
-F:21:0x81/0x92
+F:21:0x81/0x92:LIT
 
 # discolored spot
-F:22:0x81/0x86
+F:22:0x81/0x86:LIT
 
 # dart trap
-F:24:0x81/0x80
+F:24:0x81/0x80:LIT
 
 # gas trap
-F:28:0x81/0x83
+F:28:0x81/0x83:LIT
 
 # door
 F:32:0x82/0x83
 
 # pile of rubble
-F:49:0x80/0x9C
+F:49:0x80/0x9C:LIT
 
 # magma vein
-F:50:0x80/0x8D
+F:50:0x80/0x8D:LIT
 
 # quartz vein
-F:51:0x80/0x87
+F:51:0x80/0x87:LIT
 
 # magma vein with treasure
-F:54:0x80/0x90
+F:54:0x80/0x90:LIT
 
 # quartz vein with treasure
-F:55:0x80/0x8A
+F:55:0x80/0x8A:LIT
 
 # granite wall
-F:56:0x80/0x84
+F:56:0x80/0x84:LIT
 
 # permanent wall
-F:60:0x80/0x93
+F:60:0x80/0x93:LIT
 
 # explosive rune
-F:64:0xB6/0xBC
+F:64:0xB6/0xBC:LIT
 
 # Pattern startpoint
 F:65:0x81/0x95
@@ -450,49 +450,49 @@ F:81:0x82/0x8E
 F:82:0x82/0x8F
 
 # pool of deep water
-F:83:0x83/0x80
+F:83:0x83/0x80:LIT
 
 # stream of shallow water
-F:84:0x83/0x83
+F:84:0x83/0x83:LIT
 
 # pool of deep lava
-F:85:0xB6/0x9D
+F:85:0xB6/0x9D:LIT
 
 # stream of shallow lava
-F:86:0xB6/0x9A
+F:86:0xB6/0x9A:LIT
 
 # dark pit
-F:87:0x08/0x23
+F:87:0x08/0x23:LIT
 
 # dirt
-F:88:0xBB/0x9D
+F:88:0xBB/0x9D:LIT
 
 # patch of grass
-F:89:0xBB/0x8E
+F:89:0xBB/0x8E:LIT
 
 # compact rune
-F:90:0x08/0x5E
+F:90:0x08/0x5E:LIT
 
 # alarm
-F:91:0x0C/0x5E
+F:91:0x0C/0x5E:LIT
 
 # wall opeing trap
-F:92:0x01/0x5E
+F:92:0x01/0x5E:LIT
 
 # flower
-F:93:0xBE/0x86
+F:93:0xBE/0x86:LIT
 
 # brake
-F:94:0xBB/0x91
+F:94:0xBB/0x91:LIT
 
 # Museum
 F:95:0x87/0xAD
 
 # tree
-F:96:0x82/0x9A
+F:96:0x82/0x9A:LIT
 
 # mountain chain
-F:97:0x8D/0x98
+F:97:0x8D/0x98:LIT
 
 # Building
 F:128:0x0F/0x2B
@@ -597,19 +597,19 @@ F:192:0xB3/0xB5
 F:193:0x80/0x99
 
 # swamp
-F:194:0xBB/0x9A
+F:194:0xBB/0x9A:LIT
 
 # mirror
-F:195:0x81/0x95
+F:195:0x81/0x95:LIT
 
 # unknown grid (not detected)
 F:196:0x08/0x78
 
 # Armageddon trap
-F:197:0x0A/0x5E
+F:197:0x0A/0x5E:LIT
 
 # Piranha trap
-F:198:0x06/0x5E
+F:198:0x06/0x5E:LIT
 
 
 ##### Object attr/char definitions #####
index 1527da8..f8d3291 100644 (file)
@@ -3504,10 +3504,10 @@ R:1069:0x03:0x70
 # Feature attr/char definitions
 
 # open floor
-F:1:0xD9:0x80
+F:1:0xD9:0x80:LIT
 
 # glyph of warding
-F:3:0xD9:0x83
+F:3:0xD9:0x83:LIT
 
 # open door
 F:4:0x81:0x87
@@ -3516,10 +3516,10 @@ F:4:0x81:0x87
 F:5:0x81:0x87
 
 # up staircase
-F:6:0xD9:0x86
+F:6:0xD9:0x86:LIT
 
 # down staircase
-F:7:0xD9:0x89
+F:7:0xD9:0x89:LIT
 
 # quest entrance
 F:8:0x82:0x8E
@@ -3537,10 +3537,10 @@ F:11:0x82:0x8C
 F:12:0x82:0x91
 
 # shaft up
-F:13:0xD9:0x8C
+F:13:0xD9:0x8C:LIT
 
 # shaft down
-F:14:0xD9:0x8F
+F:14:0xD9:0x8F:LIT
 
 # trap door
 F:16:0xA2:0x97
@@ -3567,28 +3567,28 @@ F:28:0xA2:0x8E
 F:32:0x81:0x8B
 
 # pile of rubble
-F:49:0xD9:0x95
+F:49:0xD9:0x95:LIT
 
 # magma vein
-F:50:0xD9:0x98
+F:50:0xD9:0x98:LIT
 
 # quartz vein
-F:51:0xD9:0x9B
+F:51:0xD9:0x9B:LIT
 
 # magma vein with treasure
-F:54:0xDA:0x80
+F:54:0xDA:0x80:LIT
 
 # quartz vein with treasure
-F:55:0xDA:0x80
+F:55:0xDA:0x80:LIT
 
 # granite wall
-F:56:0xD9:0x92
+F:56:0xD9:0x92:LIT
 
 # permanent wall
-F:60:0xDA:0x83
+F:60:0xDA:0x83:LIT
 
 # explosive rune
-F:64:0xDA:0x86
+F:64:0xDA:0x86:LIT
 
 # Pattern startpoint
 F:65:0xA3:0x9D
@@ -3645,25 +3645,25 @@ F:81:0x81:0x98
 F:82:0xCB:0x90
 
 # pool of deep water
-F:83:0xDA:0x89
+F:83:0xDA:0x89:LIT
 
 # stream of shallow water
-F:84:0xDA:0x8C
+F:84:0xDA:0x8C:LIT
 
 # pool of deep lava
-F:85:0xDA:0x8F
+F:85:0xDA:0x8F:LIT
 
 # stream of shallow lava
-F:86:0xDA:0x92
+F:86:0xDA:0x92:LIT
 
 # dark pit
-F:87:0xDA:0x95
+F:87:0xDA:0x95:LIT
 
 # dirt
-F:88:0xDA:0x98
+F:88:0xDA:0x98:LIT
 
 # patch of grass
-F:89:0xDA:0x9B
+F:89:0xDA:0x9B:LIT
 
 # compact rune
 F:90:0xA2:0x92
@@ -3675,19 +3675,19 @@ F:91:0xA2:0x8A
 F:92:0xA2:0x92
 
 # flower
-F:93:0xDB:0x80
+F:93:0xDB:0x80:LIT
 
 # brake
-F:94:0xDB:0x83
+F:94:0xDB:0x83:LIT
 
 # Museum
 F:95:0xD3:0x98
 
 # tree
-F:96:0xDB:0x86
+F:96:0xDB:0x86:LIT
 
 # mountain chain
-F:97:0xDB:0x89
+F:97:0xDB:0x89:LIT
 
 # Building
 F:128:0xD5:0x82
@@ -3792,10 +3792,10 @@ F:192:0xD0:0x94
 F:193:0x81:0x9E
 
 # swamp
-F:194:0xCF:0x92
+F:194:0xCF:0x92:LIT
 
 # mirror
-F:195:0xDB:0x8C
+F:195:0xDB:0x8C:LIT
 
 # unknown grid (not detected)
 F:196:0xD9:0x81
index f8aa2fc..09c2df1 100644 (file)
@@ -48,7 +48,6 @@ Y:view_yellow_lite
 Y:view_bright_lite
 Y:view_granite_lite
 Y:view_special_lite
-X:new_ascii_graphics
 X:display_path
 Y:always_show_list
 X:abbrev_extra
index db88706..04fb175 100644 (file)
@@ -4848,7 +4848,7 @@ void do_cmd_quest(void)
 {
        energy_use = 100;
 
-       if (cave[py][px].feat != FEAT_QUEST_ENTER)
+       if (!have_flag(f_flags_bold(py, px), FF_QUEST_ENTER))
        {
 #ifdef JP
 msg_print("¤³¤³¤Ë¤Ï¥¯¥¨¥¹¥È¤ÎÆþ¸ý¤Ï¤Ê¤¤¡£");
@@ -4897,11 +4897,10 @@ void do_cmd_bldg(void)
 
        energy_use = 100;
 
-       if (!((cave[py][px].feat >= FEAT_BLDG_HEAD) &&
-                 (cave[py][px].feat <= FEAT_BLDG_TAIL)))
+       if (!have_flag(f_flags_bold(py, px), FF_BLDG))
        {
 #ifdef JP
-msg_print("¤³¤³¤Ë¤Ï·úʪ¤Ï¤Ê¤¤¡£");
+               msg_print("¤³¤³¤Ë¤Ï·úʪ¤Ï¤Ê¤¤¡£");
 #else
                msg_print("You see no building here.");
 #endif
@@ -4909,7 +4908,7 @@ msg_print("
                return;
        }
 
-       which = (cave[py][px].feat - FEAT_BLDG_HEAD);
+       which = f_info[cave[py][px].feat].power;
 
        bldg = &building[which];
 
index 803f916..d0b1662 100644 (file)
@@ -64,39 +64,7 @@ int distance (int y1, int x1, int y2, int x2)
  */
 bool is_trap(int feat)
 {
-       switch (feat)
-       {
-               case FEAT_TRAP_TRAPDOOR:
-               case FEAT_TRAP_PIT:
-               case FEAT_TRAP_SPIKED_PIT:
-               case FEAT_TRAP_POISON_PIT:
-               case FEAT_TRAP_TY_CURSE:
-               case FEAT_TRAP_TELEPORT:
-               case FEAT_TRAP_FIRE:
-               case FEAT_TRAP_ACID:
-               case FEAT_TRAP_SLOW:
-               case FEAT_TRAP_LOSE_STR:
-               case FEAT_TRAP_LOSE_DEX:
-               case FEAT_TRAP_LOSE_CON:
-               case FEAT_TRAP_BLIND:
-               case FEAT_TRAP_CONFUSE:
-               case FEAT_TRAP_POISON:
-               case FEAT_TRAP_SLEEP:
-               case FEAT_TRAP_TRAPS:
-               case FEAT_TRAP_ALARM:
-               case FEAT_TRAP_OPEN:
-               case FEAT_TRAP_ARMAGEDDON:
-               case FEAT_TRAP_PIRANHA:
-               {
-                       /* A trap */
-                       return (TRUE);
-               }
-               default:
-               {
-                       /* Not a trap */
-                       return (FALSE);
-               }
-       }
+       return have_flag(f_info[feat].flags, FF_TRAP);
 }
 
 
@@ -105,8 +73,10 @@ bool is_trap(int feat)
  */
 bool is_known_trap(cave_type *c_ptr)
 {
-       if (!c_ptr->mimic && is_trap(c_ptr->feat)) return TRUE;
-       else return FALSE;
+       if (!c_ptr->mimic && !have_flag(f_flags_grid(c_ptr), FF_SECRET) &&
+           is_trap(c_ptr->feat)) return TRUE;
+       else
+               return FALSE;
 }
 
 
@@ -115,7 +85,10 @@ bool is_known_trap(cave_type *c_ptr)
  */
 bool is_closed_door(int feat)
 {
-       return (feat >= FEAT_DOOR_HEAD && feat <= FEAT_DOOR_TAIL);
+       feature_type *f_ptr = &f_info[feat];
+
+       return (have_flag(f_ptr->flags, FF_OPEN) || have_flag(f_ptr->flags, FF_BASH)) &&
+              !have_flag(f_ptr->flags, FF_MOVE);
 }
 
 
@@ -124,10 +97,10 @@ bool is_closed_door(int feat)
  */
 bool is_hidden_door(cave_type *c_ptr)
 {
-       if (c_ptr->mimic &&
+       if ((c_ptr->mimic || have_flag(f_flags_grid(c_ptr), FF_SECRET)) &&
            is_closed_door(c_ptr->feat))
                return TRUE;
-       else 
+       else
                return FALSE;
 }
 
@@ -635,61 +608,6 @@ static void image_random(byte *ap, char *cp)
 }
 
 /*
- * Not using graphical tiles for this feature?
- */
-#define is_ascii_graphics(A) (!((A) & 0x80))
-
-/*
- * The 16x16 tile of the terrain supports lighting
- */
-static bool feat_supports_lighting(byte feat)
-{
-       if (is_trap(feat)) return streq(ANGBAND_GRAF, "new");
-
-       switch (feat)
-       {
-       case FEAT_FLOOR:
-       case FEAT_INVIS:
-       case FEAT_GLYPH:
-       case FEAT_LESS:
-       case FEAT_MORE:
-       case FEAT_LESS_LESS:
-       case FEAT_MORE_MORE:
-       case FEAT_RUBBLE:
-       case FEAT_MAGMA:
-       case FEAT_QUARTZ:
-       case FEAT_MAGMA_H:
-       case FEAT_QUARTZ_H:
-       case FEAT_MAGMA_K:
-       case FEAT_QUARTZ_K:
-       case FEAT_WALL_EXTRA:
-       case FEAT_WALL_INNER:
-       case FEAT_WALL_OUTER:
-       case FEAT_WALL_SOLID:
-       case FEAT_PERM_EXTRA:
-       case FEAT_PERM_INNER:
-       case FEAT_PERM_OUTER:
-       case FEAT_PERM_SOLID:
-       case FEAT_MINOR_GLYPH:
-       case FEAT_DEEP_WATER:
-       case FEAT_SHAL_WATER:
-       case FEAT_DEEP_LAVA:
-       case FEAT_SHAL_LAVA:
-       case FEAT_DARK_PIT:
-       case FEAT_DIRT:
-       case FEAT_GRASS:
-       case FEAT_FLOWER:
-       case FEAT_DEEP_GRASS:
-       case FEAT_TREES:
-       case FEAT_MOUNTAIN:
-       case FEAT_MIRROR:
-               return TRUE;
-       default:
-               return FALSE;
-       }
-}
-
-/*
  * This array lists the effects of "brightness" on various "base" colours.
  *
  * This is used to do dynamic lighting effects in ascii :-)
@@ -698,7 +616,7 @@ static bool feat_supports_lighting(byte feat)
  * The layout of the array is [x][0] = light and [x][1] = dark.
  */
 
-static byte lighting_colours[16][2] =
+byte lighting_colours[16][2] =
 {
        /* TERM_DARK */
        {TERM_L_DARK, TERM_DARK},
@@ -757,7 +675,7 @@ static byte lighting_colours[16][2] =
  */
 #define darkened_grid_hack() \
 { \
-       if (feat_floor(feat)) \
+       if (feat_supports_los(feat)) \
        { \
                /* Unsafe cave grid -- idea borrowed from Unangband */ \
                if (view_unsafe_grids && (c_ptr->info & CAVE_UNSAFE)) \
@@ -768,22 +686,22 @@ static byte lighting_colours[16][2] =
                        f_ptr = &f_info[feat]; \
 \
                        /* Char and attr of unsafe grid */ \
-                       c = f_ptr->x_char; \
-                       a = f_ptr->x_attr; \
+                       c = f_ptr->x_char[F_LIT_STANDARD]; \
+                       a = f_ptr->x_attr[F_LIT_STANDARD]; \
                } \
                else \
                { \
                        /* For feat_priority control */ \
                        feat = FEAT_NONE; \
 \
+                       /* Access darkness */ \
+                       f_ptr = &f_info[feat]; \
+\
                        if (use_graphics) \
                        { \
-                               /* Access darkness */ \
-                               f_ptr = &f_info[feat]; \
-\
                                /* Char and attr of darkness */ \
-                               c = f_ptr->x_char; \
-                               a = f_ptr->x_attr; \
+                               c = f_ptr->x_char[F_LIT_STANDARD]; \
+                               a = f_ptr->x_attr[F_LIT_STANDARD]; \
                        } \
                        else \
                        { \
@@ -792,22 +710,21 @@ static byte lighting_colours[16][2] =
                        } \
                } \
        } \
-       else \
+       else if (view_granite_lite && view_yellow_lite) \
        { \
-               if (is_ascii_graphics(a)) \
-               { \
-                       /* Use darkened colour */ \
-                       a = !new_ascii_graphics ? TERM_L_DARK : lighting_colours[a][1]; \
-               } \
-               else if (feat_supports_lighting(feat)) \
-               { \
-                       /* Use a dark tile */ \
-                       c++; \
-               } \
+               /* Use a darkly darkened colour/tile */ \
+               a = f_ptr->x_attr[F_LIT_DARKDARK]; \
+               c = f_ptr->x_char[F_LIT_DARKDARK]; \
        } \
 } ;
 
 
+/* Is this grid "darkened" by monster? */
+#define darkened_grid(C) \
+       ((((C)->info & (CAVE_VIEW | CAVE_LITE | CAVE_MNLT | CAVE_MNDK)) == (CAVE_VIEW | CAVE_MNDK)) && \
+       !p_ptr->see_nocto && !p_ptr->blind)
+
+
 /*
  * Extract the attr/char to display at the given (legal) map location
  *
@@ -931,22 +848,19 @@ void map_info(int y, int x, byte *ap, char *cp, byte *tap, char *tcp)
        /* Get the cave */
        cave_type *c_ptr = &cave[y][x];
 
-       feature_type *f_ptr;
-
        s16b this_o_idx, next_o_idx = 0;
 
        /* Feature code (applying "mimic" field) */
-       byte feat = get_feat_mimic(c_ptr);
+       s16b feat = get_feat_mimic(c_ptr);
+
+       /* Access floor */
+       feature_type *f_ptr = &f_info[feat];
 
        byte a;
        byte c;
 
-       /* Is this grid "darkened" by monster? */
-       bool darkened_grid = ((c_ptr->info & (CAVE_VIEW | CAVE_LITE | CAVE_MNLT | CAVE_MNDK)) == (CAVE_VIEW | CAVE_MNDK)) &&
-                                                       !p_ptr->see_nocto && !p_ptr->blind;
-
-       /* Floors (etc) */
-       if ((feat <= FEAT_INVIS) || (feat == FEAT_DIRT) || (feat == FEAT_GRASS))
+       /* Boring grids (floors, etc) */
+       if (!have_flag(f_ptr->flags, FF_REMEMBER))
        {
                /* Memorized (or visible) floor */
                if ((c_ptr->info & CAVE_MARK) ||
@@ -955,109 +869,70 @@ void map_info(int y, int x, byte *ap, char *cp, byte *tap, char *tcp)
                  (((c_ptr->info & (CAVE_GLOW | CAVE_MNDK)) == CAVE_GLOW) || p_ptr->see_nocto))) &&
                   !p_ptr->blind))
                {
-                       /* Access floor */
-                       f_ptr = &f_info[feat];
-
                        /* Normal char */
-                       c = f_ptr->x_char;
+                       c = f_ptr->x_char[F_LIT_STANDARD];
 
                        /* Normal attr */
-                       a = f_ptr->x_attr;
+                       a = f_ptr->x_attr[F_LIT_STANDARD];
 
-                       /* Mega-Hack -- Handle "in-sight" and "darkened" grids first */
-                       if (darkened_grid)
+                       if (p_ptr->wild_mode)
+                       {
+                               /* Special lighting effects */
+                               /* Handle "blind" */
+                               if (view_special_lite && p_ptr->blind)
+                               {
+                                       /* Use a darkly darkened colour/tile */
+                                       a = f_ptr->x_attr[F_LIT_DARKDARK];
+                                       c = f_ptr->x_char[F_LIT_DARKDARK];
+                               }
+                       }
+
+                       /* Mega-Hack -- Handle "in-sight" and "darkened" grids */
+                       else if (darkened_grid(c_ptr))
                        {
                                darkened_grid_hack();
                        }
 
                        /* Special lighting effects */
-                       else if (view_special_lite && (!p_ptr->wild_mode) && ((a == TERM_WHITE) || use_graphics))
+                       else if (view_special_lite)
                        {
                                /* Handle "blind" */
                                if (p_ptr->blind)
                                {
-                                       if (is_ascii_graphics(a))
-                                       {
-                                               /* Use "dark gray" */
-                                               a = TERM_L_DARK;
-                                       }
-                                       else
-                                       {
-                                               /*
-                                                * feat_supports_lighting(feat)
-                                                * is always TRUE here
-                                                */
-
-                                               /* Use a dark tile */
-                                               c++;
-                                       }
+                                       /* Use a darkly darkened colour/tile */
+                                       a = f_ptr->x_attr[F_LIT_DARKDARK];
+                                       c = f_ptr->x_char[F_LIT_DARKDARK];
                                }
 
                                /* Handle "torch-lit" grids */
                                else if (c_ptr->info & (CAVE_LITE | CAVE_MNLT))
                                {
                                        /* Torch lite */
-                                       if (view_yellow_lite && !p_ptr->wild_mode)
+                                       if (view_yellow_lite)
                                        {
-                                               if (is_ascii_graphics(a))
-                                               {
-                                                       /* Use "yellow" */
-                                                       a = TERM_YELLOW;
-                                               }
-                                               else
-                                               {
-                                                       /*
-                                                        * feat_supports_lighting(feat)
-                                                        * is always TRUE here
-                                                        */
-
-                                                       /* Use a brightly lit tile */
-                                                       c += 2;
-                                               }
+                                               /* Use a brightly lit colour/tile */
+                                               a = f_ptr->x_attr[F_LIT_LITE];
+                                               c = f_ptr->x_char[F_LIT_LITE];
                                        }
                                }
 
                                /* Handle "dark" grids */
                                else if ((c_ptr->info & (CAVE_GLOW | CAVE_MNDK)) != CAVE_GLOW)
                                {
-                                       if (is_ascii_graphics(a))
-                                       {
-                                               /* Use "dark gray" */
-                                               a = TERM_L_DARK;
-                                       }
-                                       else
-                                       {
-                                               /*
-                                                * feat_supports_lighting(feat)
-                                                * is always TRUE here
-                                                */
-
-                                               /* Use a dark tile */
-                                               c++;
-                                       }
+                                       /* Use a darkly darkened colour/tile */
+                                       a = f_ptr->x_attr[F_LIT_DARKDARK];
+                                       c = f_ptr->x_char[F_LIT_DARKDARK];
                                }
 
                                /* Handle "out-of-sight" grids */
                                else if (!(c_ptr->info & CAVE_VIEW))
                                {
                                        /* Special flag */
-                                       if (view_bright_lite && !p_ptr->wild_mode)
+                                       if (view_bright_lite)
                                        {
-                                               if (is_ascii_graphics(a))
-                                               {
-                                                       /* Use "gray" */
-                                                       a = TERM_SLATE;
-                                               }
-                                               else
-                                               {
-                                                       /*
-                                                        * feat_supports_lighting(feat)
-                                                        * is always TRUE here
-                                                        */
-
-                                                       /* Use a dark tile */
-                                                       c++;
-                                               }
+                                               /* Use a darkened colour/tile */
+                                               a = f_ptr->x_attr[F_LIT_DARK];
+                                               c = f_ptr->x_char[F_LIT_DARK];
                                        }
                                }
                        }
@@ -1076,169 +951,83 @@ void map_info(int y, int x, byte *ap, char *cp, byte *tap, char *tcp)
                        f_ptr = &f_info[feat];
 
                        /* Normal attr */
-                       a = f_ptr->x_attr;
+                       a = f_ptr->x_attr[F_LIT_STANDARD];
 
                        /* Normal char */
-                       c = f_ptr->x_char;
+                       c = f_ptr->x_char[F_LIT_STANDARD];
                }
        }
 
-       /* Non floors */
+       /* Interesting grids (non-floors) */
        else
        {
                /* Memorized grids */
-               if ((c_ptr->info & CAVE_MARK) && (view_granite_lite || new_ascii_graphics))
+               if (c_ptr->info & CAVE_MARK)
                {
-                       /* Access feature */
-                       f_ptr = &f_info[feat];
-
                        /* Normal char */
-                       c = f_ptr->x_char;
+                       c = f_ptr->x_char[F_LIT_STANDARD];
 
                        /* Normal attr */
-                       a = f_ptr->x_attr;
-
-                       /* Mega-Hack -- Handle "in-sight" and "darkened" grids first */
-                       if (darkened_grid)
-                       {
-                               darkened_grid_hack();
-                       }
+                       a = f_ptr->x_attr[F_LIT_STANDARD];
 
-                       else if (new_ascii_graphics)
+                       if (p_ptr->wild_mode)
                        {
+                               /* Special lighting effects */
                                /* Handle "blind" */
-                               if (p_ptr->blind)
+                               if (view_granite_lite && p_ptr->blind)
                                {
-                                       if (is_ascii_graphics(a))
-                                       {
-                                               /* Use darkened colour */
-                                               a = lighting_colours[a][1];
-                                       }
-                                       else if (feat_supports_lighting(feat))
-                                       {
-                                               /* Use a dark tile */
-                                               c++;
-                                       }
+                                       /* Use a darkened colour/tile */
+                                       a = f_ptr->x_attr[F_LIT_DARK];
+                                       c = f_ptr->x_char[F_LIT_DARK];
                                }
+                       }
 
-                               /* Handle "torch-lit" grids */
-                               else if (c_ptr->info & (CAVE_LITE | CAVE_MNLT))
-                               {
-                                       /* Torch lite */
-                                       if (view_yellow_lite && !p_ptr->wild_mode && (feat_supports_lighting(feat) || is_ascii_graphics(a)))
-                                       {
-                                               if (is_ascii_graphics(a))
-                                               {
-                                                       /* Use lightened colour */
-                                                       a = lighting_colours[a][0];
-                                               }
-                                               else if (feat_supports_lighting(feat))
-                                               {
-                                                       /* Use a brightly lit tile */
-                                                       c += 2;
-                                               }
-                                       }
-                               }
-
-                               /* Handle "view_bright_lite" */
-                               else if (view_bright_lite && !p_ptr->wild_mode && (feat_supports_lighting(feat) || is_ascii_graphics(a)))
-                               {
-                                       /* Not viewable */
-                                       if (!(c_ptr->info & CAVE_VIEW))
-                                       {
-                                               if (is_ascii_graphics(a))
-                                               {
-                                                       /* Use darkened colour */
-                                                       a = lighting_colours[a][1];
-                                               }
-                                               else if (feat_supports_lighting(feat))
-                                               {
-                                                       /* Use a dark tile */
-                                                       c++;
-                                               }
-                                       }
-
-                                       /* Not glowing */
-                                       else if ((c_ptr->info & (CAVE_GLOW | CAVE_MNDK)) != CAVE_GLOW)
-                                       {
-                                               if (is_ascii_graphics(a))
-                                               {
-                                                       /* Use darkened colour */
-                                                       a = lighting_colours[a][1];
-                                               }
-                                       }
-                               }
+                       /* Mega-Hack -- Handle "in-sight" and "darkened" grids */
+                       else if (darkened_grid(c_ptr))
+                       {
+                               darkened_grid_hack();
                        }
 
                        /* Special lighting effects */
-                       else if (view_granite_lite && !p_ptr->wild_mode &&
-                          (((a == TERM_WHITE) && !use_graphics) ||
-                          (use_graphics && feat_supports_lighting(feat))))
+                       else if (view_granite_lite)
                        {
                                /* Handle "blind" */
                                if (p_ptr->blind)
                                {
-                                       if (is_ascii_graphics(a))
-                                       {
-                                               /* Use "dark gray" */
-                                               a = TERM_L_DARK;
-                                       }
-                                       else
-                                       {
-                                               /* Use a dark tile */
-                                               c++;
-                                       }
+                                       /* Use a darkened colour/tile */
+                                       a = f_ptr->x_attr[F_LIT_DARK];
+                                       c = f_ptr->x_char[F_LIT_DARK];
                                }
 
                                /* Handle "torch-lit" grids */
                                else if (c_ptr->info & (CAVE_LITE | CAVE_MNLT))
                                {
                                        /* Torch lite */
-                                       if (view_yellow_lite && !p_ptr->wild_mode)
+                                       if (view_yellow_lite)
                                        {
-                                               if (is_ascii_graphics(a))
-                                               {
-                                                       /* Use "yellow" */
-                                                       a = TERM_YELLOW;
-                                               }
-                                               else
-                                               {
-                                                       /* Use a brightly lit tile */
-                                                       c += 2;
-                                               }
+                                               /* Use a brightly lit colour/tile */
+                                               a = f_ptr->x_attr[F_LIT_LITE];
+                                               c = f_ptr->x_char[F_LIT_LITE];
                                        }
                                }
 
                                /* Handle "view_bright_lite" */
-                               else if (view_bright_lite && !p_ptr->wild_mode)
+                               else if (view_bright_lite)
                                {
                                        /* Not viewable */
                                        if (!(c_ptr->info & CAVE_VIEW))
                                        {
-                                               if (is_ascii_graphics(a))
-                                               {
-                                                       /* Use "gray" */
-                                                       a = TERM_SLATE;
-                                               }
-                                               else
-                                               {
-                                                       /* Use a dark tile */
-                                                       c++;
-                                               }
+                                               /* Use a darkened colour/tile */
+                                               a = f_ptr->x_attr[F_LIT_DARK];
+                                               c = f_ptr->x_char[F_LIT_DARK];
                                        }
 
                                        /* Not glowing */
                                        else if ((c_ptr->info & (CAVE_GLOW | CAVE_MNDK)) != CAVE_GLOW)
                                        {
-                                               if (is_ascii_graphics(a))
-                                               {
-                                                       /* Use "gray" */
-                                                       a = TERM_SLATE;
-                                               }
-                                               else
-                                               {
-                                                       /* Use a lit tile */
-                                               }
+                                               /* Use a darkened colour/tile */
+                                               a = f_ptr->x_attr[F_LIT_DARK];
+                                               c = f_ptr->x_char[F_LIT_DARK];
                                        }
 
                                        /* Not glowing correctly */
@@ -1253,155 +1042,36 @@ void map_info(int y, int x, byte *ap, char *cp, byte *tap, char *tcp)
                                                /* Check for "local" illumination */
                                                if ((cave[yy][xx].info & (CAVE_GLOW | CAVE_MNDK)) != CAVE_GLOW)
                                                {
-                                                       if (is_ascii_graphics(a))
-                                                       {
-                                                               /* Use "gray" */
-                                                               a = TERM_SLATE;
-                                                       }
-                                                       else
-                                                       {
-                                                               /* Use a lit tile */
-                                                       }
+                                                       /* Use a darkened colour/tile */
+                                                       a = f_ptr->x_attr[F_LIT_DARK];
+                                                       c = f_ptr->x_char[F_LIT_DARK];
                                                }
                                        }
                                }
                        }
                }
 
-               /* "Simple Lighting" */
+               /* Unknown */
                else
                {
-                       /* Handle "blind" */
-                       if (!(c_ptr->info & CAVE_MARK))
-                       {
-                               /* Unsafe cave grid -- idea borrowed from Unangband */
-                               if (view_unsafe_grids && (c_ptr->info & (CAVE_UNSAFE)))
-                                       feat = FEAT_UNDETECTED;
-                               else
-                                       feat = FEAT_NONE;
-                       }
+                       /* Unsafe cave grid -- idea borrowed from Unangband */
+                       if (view_unsafe_grids && (c_ptr->info & (CAVE_UNSAFE)))
+                               feat = FEAT_UNDETECTED;
+                       else
+                               feat = FEAT_NONE;
 
                        /* Access feature */
                        f_ptr = &f_info[feat];
 
                        /* Normal attr */
-                       a = f_ptr->x_attr;
+                       a = f_ptr->x_attr[F_LIT_STANDARD];
 
                        /* Normal char */
-                       c = f_ptr->x_char;
-
-                       /* Mega-Hack -- Handle "in-sight" and "darkened" grids */
-                       if (darkened_grid)
-                       {
-                               darkened_grid_hack();
-                       }
+                       c = f_ptr->x_char[F_LIT_STANDARD];
                }
        }
 
-       if (feat_priority == -1)
-       {
-               switch (feat)
-               {
-               case FEAT_NONE:
-               case FEAT_UNDETECTED:
-               case FEAT_DARK_PIT:
-                       feat_priority = 1;
-                       break;
-
-               case FEAT_FLOOR:
-               case FEAT_INVIS:
-               case FEAT_TRAP_TRAPDOOR:
-               case FEAT_TRAP_PIT:
-               case FEAT_TRAP_SPIKED_PIT:
-               case FEAT_TRAP_POISON_PIT:
-               case FEAT_TRAP_TY_CURSE:
-               case FEAT_TRAP_TELEPORT:
-               case FEAT_TRAP_FIRE:
-               case FEAT_TRAP_ACID:
-               case FEAT_TRAP_SLOW:
-               case FEAT_TRAP_LOSE_STR:
-               case FEAT_TRAP_LOSE_DEX:
-               case FEAT_TRAP_LOSE_CON:
-               case FEAT_TRAP_BLIND:
-               case FEAT_TRAP_CONFUSE:
-               case FEAT_TRAP_POISON:
-               case FEAT_TRAP_SLEEP:
-               case FEAT_TRAP_TRAPS:
-               case FEAT_TRAP_ALARM:
-               case FEAT_DIRT:
-               case FEAT_GRASS:
-               case FEAT_FLOWER:
-               case FEAT_DEEP_GRASS:
-               case FEAT_SWAMP:
-               case FEAT_TREES:
-               case FEAT_RUBBLE:
-               case FEAT_MAGMA:
-               case FEAT_QUARTZ:
-               case FEAT_MAGMA_H:
-               case FEAT_QUARTZ_H:
-               case FEAT_WALL_EXTRA:
-               case FEAT_WALL_INNER:
-               case FEAT_WALL_OUTER:
-               case FEAT_WALL_SOLID:
-               case FEAT_DEEP_WATER:
-               case FEAT_SHAL_WATER:
-               case FEAT_DEEP_LAVA:
-               case FEAT_SHAL_LAVA:
-                       feat_priority = 2;
-                       break;
-
-               case FEAT_MAGMA_K:
-               case FEAT_QUARTZ_K:
-                       /* Now a days treasere grid is too many */
-                       feat_priority = 2;
-                       break;
-
-               case FEAT_MOUNTAIN:
-               case FEAT_PERM_EXTRA:
-               case FEAT_PERM_INNER:
-               case FEAT_PERM_OUTER:
-               case FEAT_PERM_SOLID:
-                       feat_priority = 5;
-                       break;
-
-                       /* default is feat_priority = 20; (doors and stores) */ 
-
-               case FEAT_GLYPH:
-               case FEAT_MINOR_GLYPH:
-               case FEAT_MIRROR:
-               case FEAT_PATTERN_START:
-               case FEAT_PATTERN_1:
-               case FEAT_PATTERN_2:
-               case FEAT_PATTERN_3:
-               case FEAT_PATTERN_4:
-               case FEAT_PATTERN_END:
-               case FEAT_PATTERN_OLD:
-               case FEAT_PATTERN_XTRA1:
-               case FEAT_PATTERN_XTRA2:
-                       feat_priority = 16;
-                       break;
-
-                       /* objects have feat_priority = 20 */ 
-                       /* monsters have feat_priority = 30 */ 
-
-               case FEAT_LESS:
-               case FEAT_MORE:
-               case FEAT_QUEST_ENTER:
-               case FEAT_QUEST_EXIT:
-               case FEAT_QUEST_DOWN:
-               case FEAT_QUEST_UP:
-               case FEAT_LESS_LESS:
-               case FEAT_MORE_MORE:
-               case FEAT_TOWN:
-               case FEAT_ENTRANCE:
-                       feat_priority = 35;
-                       break;
-
-               default:
-                       feat_priority = 10;
-                       break;
-               }
-       }
+       if (feat_priority == -1) feat_priority = f_ptr->priority;
 
        /* Save the terrain info for the transparency effects */
        (*tap) = a;
@@ -1412,10 +1082,17 @@ void map_info(int y, int x, byte *ap, char *cp, byte *tap, char *tcp)
        (*cp) = c;
 
        /* Hack -- rare random hallucination, except on outer dungeon walls */
-       if (p_ptr->image && (feat < FEAT_PERM_SOLID) && one_in_(256))
+       if (p_ptr->image)
        {
-               /* Hallucinate */
-               image_random(ap, cp);
+               /* Access real feature */
+               feature_type *rf_ptr = &f_info[c_ptr->feat];
+
+               if (!(have_flag(rf_ptr->flags, FF_SOLID) && have_flag(rf_ptr->flags, FF_PERMANENT)) &&
+                       one_in_(256))
+               {
+                       /* Hallucinate */
+                       image_random(ap, cp);
+               }
        }
 
        /* Objects */
@@ -1733,11 +1410,8 @@ void note_spot(int y, int x)
        /* Hack -- memorize grids */
        if (!(c_ptr->info & (CAVE_MARK)))
        {
-               /* Feature code (applying "mimic" field) */
-               byte feat = get_feat_mimic(c_ptr);
-
-               /* Handle floor grids first */
-               if ((feat <= FEAT_INVIS) || (feat == FEAT_DIRT) || (feat == FEAT_GRASS))
+               /* Memorize some "boring" grids */
+               if (!have_flag(f_info[get_feat_mimic(c_ptr)].flags, FF_REMEMBER))
                {
                        /* Option -- memorize all torch-lit floors */
                        if (view_torch_grids &&
@@ -1834,10 +1508,10 @@ void display_dungeon(void)
                                feature_type *f_ptr = &f_info[FEAT_NONE];
 
                                /* Normal attr */
-                               a = f_ptr->x_attr;
+                               a = f_ptr->x_attr[F_LIT_STANDARD];
 
                                /* Normal char */
-                               c = f_ptr->x_char;
+                               c = f_ptr->x_char[F_LIT_STANDARD];
 
                                /* Hack -- Queue it */
                                Term_queue_char(x - px + Term->wid / 2 - 1, y - py + Term->hgt / 2 - 1, a, c, ta, tc);
@@ -4427,7 +4101,7 @@ void update_flow(void)
                        if (c_ptr->dist != 0 && c_ptr->dist <= n && c_ptr->cost <= m) continue;
 
                        /* Ignore "walls" and "rubble" */
-                       if ((c_ptr->feat >= FEAT_RUBBLE) && (c_ptr->feat != FEAT_TREES) && !cave_floor_grid(c_ptr)) continue;
+                       if (!have_flag(f_flags_grid(c_ptr), FF_MOVE) && !is_closed_door(c_ptr->feat)) continue;
 
                        /* Save the flow cost */
                        if (c_ptr->cost == 0 || c_ptr->cost > m) c_ptr->cost = m;
@@ -4518,7 +4192,7 @@ void update_smell(void)
                        c_ptr = &cave[y][x];
 
                        /* Walls, water, and lava cannot hold scent. */
-                       if ((c_ptr->feat >= FEAT_RUBBLE) && (c_ptr->feat != FEAT_TREES) && !cave_floor_grid(c_ptr)) continue;
+                       if (!have_flag(f_flags_grid(c_ptr), FF_MOVE) && !is_closed_door(c_ptr->feat)) continue;
 
                        /* Grid must not be blocked by walls from the character */
                        if (!player_has_los_bold(y, x)) continue;
@@ -4539,10 +4213,9 @@ void update_smell(void)
 void map_area(int range)
 {
        int             i, x, y;
-
        cave_type       *c_ptr;
-
-       byte feat;
+       s16b            feat;
+       feature_type    *f_ptr;
 
        if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range /= 3;
 
@@ -4557,16 +4230,13 @@ void map_area(int range)
 
                        /* Feature code (applying "mimic" field) */
                        feat = get_feat_mimic(c_ptr);
+                       f_ptr = &f_info[feat];
 
                        /* All non-walls are "checked" */
-                       if ((feat <= FEAT_DOOR_TAIL) ||
-                           (feat == FEAT_RUBBLE) ||
-                          ((feat >= FEAT_MINOR_GLYPH) &&
-                           (feat <= FEAT_TREES)) ||
-                           (feat >= FEAT_TOWN))
+                       if (!have_flag(f_ptr->flags, FF_WALL))
                        {
                                /* Memorize normal features */
-                               if ((feat > FEAT_INVIS) && (feat != FEAT_DIRT) && (feat != FEAT_GRASS))
+                               if (have_flag(f_ptr->flags, FF_REMEMBER))
                                {
                                        /* Memorize the object */
                                        c_ptr->info |= (CAVE_MARK);
@@ -4579,9 +4249,10 @@ void map_area(int range)
 
                                        /* Feature code (applying "mimic" field) */
                                        feat = get_feat_mimic(c_ptr);
+                                       f_ptr = &f_info[feat];
 
                                        /* Memorize walls (etc) */
-                                       if ((feat >= FEAT_RUBBLE) && (feat != FEAT_DIRT) && (feat != FEAT_GRASS))
+                                       if (have_flag(f_ptr->flags, FF_REMEMBER))
                                        {
                                                /* Memorize the walls */
                                                c_ptr->info |= (CAVE_MARK);
@@ -4619,7 +4290,8 @@ void map_area(int range)
 void wiz_lite(bool ninja)
 {
        int i, y, x;
-       byte feat;
+       s16b feat;
+       feature_type *f_ptr;
 
        /* Memorize objects */
        for (i = 1; i < o_max; i++)
@@ -4646,9 +4318,10 @@ void wiz_lite(bool ninja)
 
                        /* Feature code (applying "mimic" field) */
                        feat = get_feat_mimic(c_ptr);
+                       f_ptr = &f_info[feat];
 
                        /* Process all non-walls */
-                       if (cave_floor_bold(y, x) || (feat == FEAT_RUBBLE) || (feat == FEAT_TREES) || (feat == FEAT_MOUNTAIN))
+                       if (!have_flag(f_ptr->flags, FF_WALL))
                        {
                                /* Scan all neighbors */
                                for (i = 0; i < 9; i++)
@@ -4660,7 +4333,7 @@ void wiz_lite(bool ninja)
                                        c_ptr = &cave[yy][xx];
 
                                        /* Feature code (applying "mimic" field) */
-                                       feat = get_feat_mimic(c_ptr);
+                                       f_ptr = &f_info[get_feat_mimic(c_ptr)];
 
                                        /* Perma-lite the grid */
                                        if (!(d_info[dungeon_type].flags1 & DF1_DARKNESS) && !ninja)
@@ -4669,7 +4342,7 @@ void wiz_lite(bool ninja)
                                        }
 
                                        /* Memorize normal features */
-                                       if ((feat > FEAT_INVIS) && (feat != FEAT_DIRT) && (feat != FEAT_GRASS))
+                                       if (have_flag(f_ptr->flags, FF_REMEMBER))
                                        {
                                                /* Memorize the grid */
                                                c_ptr->info |= (CAVE_MARK);
@@ -4777,6 +4450,7 @@ void wiz_dark(void)
 void cave_set_feat(int y, int x, int feat)
 {
        cave_type *c_ptr = &cave[y][x];
+       feature_type *f_ptr = &f_info[feat];
 
        /* Clear mimic type */
        c_ptr->mimic = 0;
@@ -4787,8 +4461,14 @@ void cave_set_feat(int y, int x, int feat)
        /* Change the feature */
        c_ptr->feat = feat;
 
+       /* Check for change to boring grid */
+       if (!have_flag(f_ptr->flags, FF_REMEMBER)) c_ptr->info &= ~(CAVE_MARK);
+
+       /* Check for change to out of sight grid */
+       else if (!player_can_see_bold(y, x)) c_ptr->info &= ~(CAVE_MARK);
+
        /* Hack -- glow the deep lava */
-       if ((feat == FEAT_DEEP_LAVA) && !(d_info[dungeon_type].flags1 & DF1_DARKNESS))
+       if (have_flag(f_ptr->flags, FF_GLOW) && !(d_info[dungeon_type].flags1 & DF1_DARKNESS))
        {
                int i, yy, xx;
 
@@ -4816,6 +4496,88 @@ void cave_set_feat(int y, int x, int feat)
        lite_spot(y, x);
 }
 
+
+/*
+ * Take a feature, determine what that feature becomes
+ * through applying the given action.
+ */
+int feat_state(int feat, int action)
+{
+       feature_type *f_ptr = &f_info[feat];
+       int newfeat, i;
+
+       /* Get the new feature */
+       for (i = 0; i < MAX_FEAT_STATES; i++)
+       {
+               if (f_ptr->state[i].action == action)
+               {
+                       newfeat = f_ptr->state[i].result;
+                       return (newfeat == FEAT_FLOOR) ? floor_type[randint0(100)] : newfeat;
+               }
+       }
+
+       if (have_flag(f_ptr->flags, FF_PERMANENT)) return feat;
+
+       if (feature_action_flags[action] & FAF_DESTROY)
+       {
+               newfeat = f_ptr->destroyed;
+               return (newfeat == FEAT_FLOOR) ? floor_type[randint0(100)] : newfeat;
+       }
+       else return feat;
+}
+
+/*
+ * Takes a location and action and changes the feature at that 
+ * location through applying the given action.
+ */
+void cave_alter_feat(int y, int x, int action)
+{
+       /* Set old feature */
+       int oldfeat = cave[y][x].feat;
+
+       /* Get the new feat */
+       int newfeat = feat_state(oldfeat, action);
+
+       /* No change */
+       if (newfeat == oldfeat) return;
+
+       /* Set the new feature */
+       cave_set_feat(y, x, newfeat);
+
+       if (!(feature_action_flags[action] & FAF_NO_DROP))
+       {
+               feature_type *old_f_ptr = &f_info[oldfeat];
+               feature_type *f_ptr = &f_info[newfeat];
+               bool found = FALSE;
+
+               /* Handle gold */
+               if (have_flag(old_f_ptr->flags, FF_HAS_GOLD) && !have_flag(f_ptr->flags, FF_HAS_GOLD))
+               {
+                       /* Place some gold */
+                       place_gold(y, x);
+                       found = TRUE;
+               }
+
+               /* Handle item */
+               if (have_flag(old_f_ptr->flags, FF_HAS_ITEM) && !have_flag(f_ptr->flags, FF_HAS_ITEM) && (randint0(100) < (15 - dun_level / 2)))
+               {
+                       /* Place object */
+                       place_object(y, x, 0L);
+                       found = TRUE;
+               }
+
+               if (found && character_dungeon && player_can_see_bold(y, x))
+               {
+#ifdef JP
+                       msg_print("²¿¤«¤òȯ¸«¤·¤¿¡ª");
+#else
+                       msg_print("You have found something!");
+#endif
+               }
+       }
+}
+
+
 /* Remove a mirror */
 void remove_mirror(int y, int x)
 {
@@ -4841,7 +4603,7 @@ void remove_mirror(int y, int x)
  */
 bool is_mirror_grid(cave_type *c_ptr)
 {
-       if ((c_ptr->info & CAVE_OBJECT) && c_ptr->mimic == FEAT_MIRROR)
+       if ((c_ptr->info & CAVE_OBJECT) && have_flag(f_info[c_ptr->mimic].flags, FF_MIRROR))
                return TRUE;
        else
                return FALSE;
@@ -4853,7 +4615,7 @@ bool is_mirror_grid(cave_type *c_ptr)
  */
 bool is_glyph_grid(cave_type *c_ptr)
 {
-       if ((c_ptr->info & CAVE_OBJECT) && c_ptr->mimic == FEAT_GLYPH)
+       if ((c_ptr->info & CAVE_OBJECT) && have_flag(f_info[c_ptr->mimic].flags, FF_GLYPH))
                return TRUE;
        else
                return FALSE;
@@ -4865,7 +4627,7 @@ bool is_glyph_grid(cave_type *c_ptr)
  */
 bool is_explosive_rune_grid(cave_type *c_ptr)
 {
-       if ((c_ptr->info & CAVE_OBJECT) && c_ptr->mimic == FEAT_MINOR_GLYPH)
+       if ((c_ptr->info & CAVE_OBJECT) && have_flag(f_info[c_ptr->mimic].flags, FF_MINOR_GLYPH))
                return TRUE;
        else
                return FALSE;
@@ -5109,7 +4871,6 @@ void glow_deep_lava_and_bldg(void)
 {
        int y, x, i, yy, xx;
        cave_type *c_ptr;
-       byte feat;
 
        /* Not in the darkness dungeon */
        if (d_info[dungeon_type].flags1 & DF1_DARKNESS) return;
@@ -5121,14 +4882,8 @@ void glow_deep_lava_and_bldg(void)
                        c_ptr = &cave[y][x];
 
                        /* Feature code (applying "mimic" field) */
-                       feat = get_feat_mimic(c_ptr);
 
-                       if ((feat == FEAT_DEEP_LAVA) ||
-                          ((feat >= FEAT_SHOP_HEAD) &&
-                           (feat <= FEAT_SHOP_TAIL)) ||
-                           (feat == FEAT_MUSEUM) ||
-                          ((feat >= FEAT_BLDG_HEAD) &&
-                           (feat <= FEAT_BLDG_TAIL)))
+                       if (have_flag(f_info[get_feat_mimic(c_ptr)].flags, FF_GLOW))
                        {
                                for (i = 0; i < 9; i++)
                                {
index dd1bd1d..031b387 100644 (file)
@@ -695,7 +695,6 @@ void search(void)
                                        msg_print("You have found a trap.");
 #endif
 
-
                                        /* Disturb */
                                        disturb(0, 0);
                                }
@@ -744,7 +743,6 @@ void search(void)
                                                msg_print("You have discovered a trap on the chest!");
 #endif
 
-
                                                /* Know the trap */
                                                object_known(o_ptr);
 
@@ -1075,24 +1073,24 @@ static void hit_trap(bool break_trap)
        int i, num, dam;
        int x = px, y = py;
 
-       cave_type *c_ptr;
+       /* Get the cave grid */
+       cave_type *c_ptr = &cave[y][x];
+
+       int trap_feat = c_ptr->feat;
 
 #ifdef JP
-       cptr            name = "¥È¥é¥Ã¥×";
+       cptr name = "¥È¥é¥Ã¥×";
 #else
        cptr name = "a trap";
 #endif
 
-
-
        /* Disturb the player */
        disturb(0, 0);
 
-       /* Get the cave grid */
-       c_ptr = &cave[y][x];
+       cave_alter_feat(y, x, FF_HIT_TRAP);
 
        /* Analyze XXX XXX XXX */
-       switch (c_ptr->feat)
+       switch (trap_feat)
        {
                case FEAT_TRAP_TRAPDOOR:
                {
@@ -1310,8 +1308,6 @@ static void hit_trap(bool break_trap)
                        msg_print("There is a flash of shimmering light!");
 #endif
 
-                       c_ptr->info &= ~(CAVE_MARK);
-                       cave_set_feat(y, x, floor_type[randint0(100)]);
                        num = 2 + randint1(3);
                        for (i = 0; i < num; i++)
                        {
@@ -1592,10 +1588,6 @@ msg_print("
                        msg_print("There is a bright flash of light!");
 #endif
 
-
-                       /* Destroy this trap */
-                       cave_set_feat(y, x, floor_type[randint0(100)]);
-
                        /* Make some new traps */
                        project(0, 1, y, x, 0, GF_MAKE_TRAP, PROJECT_HIDE | PROJECT_JUMP | PROJECT_GRID, -1);
 
@@ -1642,9 +1634,6 @@ msg_print("
                        msg_print("Suddenly, you are surrounded by immotal beings!");
 #endif
 
-                       /* Destroy this trap */
-                       cave_set_feat(y, x, floor_type[randint0(100)]);
-
                        /* Summon Demons and Angels */
                        for (lev = dun_level; lev >= 20; lev -= 1 + lev/16)
                        {
@@ -1691,9 +1680,6 @@ msg_print("
                        msg_print("Suddenly, the room is filled with water with piranhas!");
 #endif
 
-                       /* Destroy this trap */
-                       cave_set_feat(y, x, floor_type[randint0(100)]);
-
                        /* Water fills room */
                        fire_ball_hide(GF_WATER_FLOW, 0, 1, 10);
 
@@ -1706,9 +1692,10 @@ msg_print("
                        break;
                }
        }
+
        if (break_trap && is_trap(c_ptr->feat))
        {
-               cave_set_feat(y, x, floor_type[randint0(100)]);
+               cave_alter_feat(y, x, FF_DISARM);
 #ifdef JP
                msg_print("¥È¥é¥Ã¥×¤òÊ´ºÕ¤·¤¿¡£");
 #else
@@ -3278,22 +3265,28 @@ bool py_attack(int y, int x, int mode)
 }
 
 
-static bool pattern_seq(int c_y, int c_x, int n_y, int n_x)
+bool pattern_seq(int c_y, int c_x, int n_y, int n_x)
 {
-       if (!pattern_tile(c_y, c_x) && !pattern_tile(n_y, n_x))
-               return TRUE;
+       feature_type *cur_f_ptr = &f_info[cave[c_y][c_x].feat];
+       feature_type *new_f_ptr = &f_info[cave[n_y][n_x].feat];
+       bool is_pattern_tile_cur = have_flag(cur_f_ptr->flags, FF_PATTERN);
+       bool is_pattern_tile_new = have_flag(new_f_ptr->flags, FF_PATTERN);
+       int pattern_type_cur, pattern_type_new;
 
-       if (cave[n_y][n_x].feat == FEAT_PATTERN_START)
+       if (!is_pattern_tile_cur && !is_pattern_tile_new) return TRUE;
+
+       pattern_type_cur = is_pattern_tile_cur ? cur_f_ptr->power : NOT_PATTERN_TILE;
+       pattern_type_new = is_pattern_tile_new ? new_f_ptr->power : NOT_PATTERN_TILE;
+
+       if (pattern_type_new == PATTERN_TILE_START)
        {
-               if (!pattern_tile(c_y, c_x) &&
-                   !p_ptr->confused && !p_ptr->stun && !p_ptr->image)
+               if (!is_pattern_tile_cur && !p_ptr->confused && !p_ptr->stun && !p_ptr->image)
                {
 #ifdef JP
                        if (get_check("¥Ñ¥¿¡¼¥ó¤Î¾å¤òÊ⤭»Ï¤á¤ë¤È¡¢Á´¤Æ¤òÊ⤫¤Ê¤±¤ì¤Ð¤Ê¤ê¤Þ¤»¤ó¡£¤¤¤¤¤Ç¤¹¤«¡©"))
 #else
                        if (get_check("If you start walking the Pattern, you must walk the whole way. Ok? "))
 #endif
-
                                return TRUE;
                        else
                                return FALSE;
@@ -3301,11 +3294,11 @@ static bool pattern_seq(int c_y, int c_x, int n_y, int n_x)
                else
                        return TRUE;
        }
-       else if ((cave[n_y][n_x].feat == FEAT_PATTERN_OLD) ||
-                (cave[n_y][n_x].feat == FEAT_PATTERN_END) ||
-                (cave[n_y][n_x].feat == FEAT_PATTERN_XTRA2))
+       else if ((pattern_type_new == PATTERN_TILE_OLD) ||
+                (pattern_type_new == PATTERN_TILE_END) ||
+                (pattern_type_new == PATTERN_TILE_WRECKED))
        {
-               if (pattern_tile(c_y, c_x))
+               if (is_pattern_tile_cur)
                {
                        return TRUE;
                }
@@ -3320,14 +3313,14 @@ static bool pattern_seq(int c_y, int c_x, int n_y, int n_x)
                        return FALSE;
                }
        }
-       else if ((cave[n_y][n_x].feat == FEAT_PATTERN_XTRA1) ||
-                (cave[c_y][c_x].feat == FEAT_PATTERN_XTRA1))
+       else if ((pattern_type_new == PATTERN_TILE_TELEPORT) ||
+                (pattern_type_cur == PATTERN_TILE_TELEPORT))
        {
                return TRUE;
        }
-       else if (cave[c_y][c_x].feat == FEAT_PATTERN_START)
+       else if (pattern_type_cur == PATTERN_TILE_START)
        {
-               if (pattern_tile(n_y, n_x))
+               if (is_pattern_tile_new)
                        return TRUE;
                else
                {
@@ -3340,11 +3333,11 @@ static bool pattern_seq(int c_y, int c_x, int n_y, int n_x)
                        return FALSE;
                }
        }
-       else if ((cave[c_y][c_x].feat == FEAT_PATTERN_OLD) ||
-                (cave[c_y][c_x].feat == FEAT_PATTERN_END) ||
-                (cave[c_y][c_x].feat == FEAT_PATTERN_XTRA2))
+       else if ((pattern_type_cur == PATTERN_TILE_OLD) ||
+                (pattern_type_cur == PATTERN_TILE_END) ||
+                (pattern_type_cur == PATTERN_TILE_WRECKED))
        {
-               if (!pattern_tile(n_y, n_x))
+               if (!is_pattern_tile_new)
                {
 #ifdef JP
                        msg_print("¥Ñ¥¿¡¼¥ó¤òƧ¤ß³°¤·¤Æ¤Ï¤¤¤±¤Þ¤»¤ó¡£");
@@ -3361,7 +3354,7 @@ static bool pattern_seq(int c_y, int c_x, int n_y, int n_x)
        }
        else
        {
-               if (!pattern_tile(c_y, c_x))
+               if (!is_pattern_tile_cur)
                {
 #ifdef JP
                        msg_print("¥Ñ¥¿¡¼¥ó¤Î¾å¤òÊ⤯¤Ë¤Ï¥¹¥¿¡¼¥ÈÃÏÅÀ¤«¤éÊ⤭»Ï¤á¤Ê¤¯¤Æ¤Ï¤Ê¤ê¤Þ¤»¤ó¡£");
@@ -3373,44 +3366,43 @@ static bool pattern_seq(int c_y, int c_x, int n_y, int n_x)
                }
                else
                {
-                       byte ok_move = FEAT_PATTERN_START;
-                       switch (cave[c_y][c_x].feat)
+                       byte ok_move = PATTERN_TILE_START;
+                       switch (pattern_type_cur)
                        {
-                               case FEAT_PATTERN_1:
-                                       ok_move = FEAT_PATTERN_2;
+                               case PATTERN_TILE_1:
+                                       ok_move = PATTERN_TILE_2;
                                        break;
-                               case FEAT_PATTERN_2:
-                                       ok_move = FEAT_PATTERN_3;
+                               case PATTERN_TILE_2:
+                                       ok_move = PATTERN_TILE_3;
                                        break;
-                               case FEAT_PATTERN_3:
-                                       ok_move = FEAT_PATTERN_4;
+                               case PATTERN_TILE_3:
+                                       ok_move = PATTERN_TILE_4;
                                        break;
-                               case FEAT_PATTERN_4:
-                                       ok_move = FEAT_PATTERN_1;
+                               case PATTERN_TILE_4:
+                                       ok_move = PATTERN_TILE_1;
                                        break;
                                default:
                                        if (p_ptr->wizard)
 #ifdef JP
-                                               msg_format("¤ª¤«¤·¤Ê¥Ñ¥¿¡¼¥óÊâ¹Ô¡¢%d¡£", cave[c_y][c_x].feat);
+                                               msg_format("¤ª¤«¤·¤Ê¥Ñ¥¿¡¼¥óÊâ¹Ô¡¢%d¡£", pattern_type_cur);
 #else
-                                               msg_format("Funny Pattern walking, %d.", cave[c_y][c_x].feat);
+                                               msg_format("Funny Pattern walking, %d.", pattern_type_cur);
 #endif
 
                                        return TRUE; /* Goof-up */
                        }
 
-                       if ((cave[n_y][n_x].feat == ok_move) ||
-                           (cave[n_y][n_x].feat == cave[c_y][c_x].feat))
+                       if ((pattern_type_new == ok_move) ||
+                           (pattern_type_new == pattern_type_cur))
                                return TRUE;
                        else
                        {
-                               if (!pattern_tile(n_y, n_x))
+                               if (!is_pattern_tile_new)
 #ifdef JP
                                        msg_print("¥Ñ¥¿¡¼¥ó¤òƧ¤ß³°¤·¤Æ¤Ï¤¤¤±¤Þ¤»¤ó¡£");
 #else
                                        msg_print("You may not step off from the Pattern.");
 #endif
-
                                else
 #ifdef JP
                                        msg_print("¥Ñ¥¿¡¼¥ó¤Î¾å¤ÏÀµ¤·¤¤½ç½ø¤ÇÊ⤫¤Í¤Ð¤Ê¤ê¤Þ¤»¤ó¡£");
@@ -3418,7 +3410,6 @@ static bool pattern_seq(int c_y, int c_x, int n_y, int n_x)
                                        msg_print("You must walk the Pattern in correct order.");
 #endif
 
-
                                return FALSE;
                        }
                }
@@ -3426,86 +3417,38 @@ static bool pattern_seq(int c_y, int c_x, int n_y, int n_x)
 }
 
 
-
-bool player_can_enter(byte feature)
+bool player_can_enter(s16b feature, u16b mode)
 {
-       switch (feature)
-       {
-       case FEAT_DOOR_HEAD: /* Nasty hack -- Doors */
-       case FEAT_DOOR_HEAD + 0x01:
-       case FEAT_DOOR_HEAD + 0x02:
-       case FEAT_DOOR_HEAD + 0x03:
-       case FEAT_DOOR_HEAD + 0x04:
-       case FEAT_DOOR_HEAD + 0x05:
-       case FEAT_DOOR_HEAD + 0x06:
-       case FEAT_DOOR_HEAD + 0x07:
-       case FEAT_DOOR_HEAD + 0x08:
-       case FEAT_DOOR_HEAD + 0x09:
-       case FEAT_DOOR_HEAD + 0x0a:
-       case FEAT_DOOR_HEAD + 0x0b:
-       case FEAT_DOOR_HEAD + 0x0c:
-       case FEAT_DOOR_HEAD + 0x0d:
-       case FEAT_DOOR_HEAD + 0x0e:
-       case FEAT_DOOR_TAIL: /* Equals FEAT_DOOR_HEAD + 0x0f */
-       case FEAT_SECRET:
-       case FEAT_RUBBLE:
-       case FEAT_MAGMA:
-       case FEAT_QUARTZ:
-       case FEAT_MAGMA_H:
-       case FEAT_QUARTZ_H:
-       case FEAT_MAGMA_K:
-       case FEAT_QUARTZ_K:
-       case FEAT_WALL_EXTRA:
-       case FEAT_WALL_INNER:
-       case FEAT_WALL_OUTER:
-       case FEAT_WALL_SOLID:
-               /* Player can not walk through "walls" unless in Shadow Form */
-               return p_ptr->wraith_form || p_ptr->pass_wall || p_ptr->kabenuke;
-
-       case FEAT_PERM_EXTRA:
-       case FEAT_PERM_INNER:
-       case FEAT_PERM_OUTER:
-       case FEAT_PERM_SOLID:
-       case FEAT_PATTERN_START:
-       case FEAT_PATTERN_1:
-       case FEAT_PATTERN_2:
-       case FEAT_PATTERN_3:
-       case FEAT_PATTERN_4:
-       case FEAT_PATTERN_END:
-       case FEAT_PATTERN_OLD:
-       case FEAT_PATTERN_XTRA1:
-       case FEAT_PATTERN_XTRA2:
-               return FALSE;
+       feature_type *f_ptr = &f_info[feature];
 
-       case FEAT_DARK_PIT:
-               return p_ptr->ffall;
+       if (p_ptr->riding) return monster_can_cross_terrain(feature, &r_info[m_list[p_ptr->riding].r_idx], mode | CEM_RIDING);
 
-       case FEAT_MOUNTAIN:
-               return !dun_level && p_ptr->ffall;
+       /* Pattern */
+       if (have_flag(f_ptr->flags, FF_PATTERN))
+       {
+               if (!(mode & CEM_P_CAN_ENTER_PATTERN)) return FALSE;
        }
 
-       /* Assume okay */
-       return TRUE;
-}
-
+       /* "CAN" flags */
+       if (have_flag(f_ptr->flags, FF_CAN_FLY) && p_ptr->ffall) return TRUE;
+       if (have_flag(f_ptr->flags, FF_CAN_SWIM) && p_ptr->can_swim) return TRUE;
+       if (have_flag(f_ptr->flags, FF_CAN_PASS) && p_ptr->pass_wall) return TRUE;
 
-/*
- * Get feature string which blocks your way
- */
-static cptr blocking_feat_name(byte feat)
-{
-       switch (feat)
+       if (!have_flag(f_ptr->flags, FF_MOVE))
        {
-#ifdef JP
-       case FEAT_TREES: return "ÌÚ";
-       case FEAT_MOUNTAIN: return "»³";
-       default: return "ÊÉ";
-#else
-       case FEAT_TREES: return "tree";
-       case FEAT_MOUNTAIN: return "mountain";
-       default: return "wall";
-#endif
+               /* Can fly over mountain on the surface */
+               if (have_flag(f_ptr->flags, FF_MOUNTAIN) && !dun_level)
+               {
+                       if (p_ptr->ffall) return TRUE;
+               }
+
+               /* Cannot enter */
+               return FALSE;
        }
+
+       if (have_flag(f_ptr->flags, FF_MUST_FLY) && !p_ptr->ffall) return FALSE;
+
+       return TRUE;
 }
 
 
@@ -3520,9 +3463,15 @@ static cptr blocking_feat_name(byte feat)
  */
 void move_player(int dir, int do_pickup, bool break_trap)
 {
-       int y, x;
+       /* Find the result of moving */
+       int y = py + ddy[dir];
+       int x = px + ddx[dir];
+
+       /* Examine the destination */
+       cave_type *c_ptr = &cave[y][x];
+
+       feature_type *f_ptr = &f_info[c_ptr->feat];
 
-       cave_type *c_ptr;
        monster_type *m_ptr;
 
        monster_type *riding_m_ptr = &m_list[p_ptr->riding];
@@ -3530,26 +3479,20 @@ void move_player(int dir, int do_pickup, bool break_trap)
 
        char m_name[80];
 
-       bool p_can_pass_walls = FALSE;
+       bool p_can_enter = player_can_enter(c_ptr->feat, CEM_P_CAN_ENTER_PATTERN);
+       bool p_can_kill_walls = FALSE;
        bool stormbringer = FALSE;
 
        bool oktomove = TRUE;
        bool do_past = FALSE;
 
-       /* Find the result of moving */
-       y = py + ddy[dir];
-       x = px + ddx[dir];
-
-       /* Examine the destination */
-       c_ptr = &cave[y][x];
-
        /* Exit the area */
        if (!dun_level && !p_ptr->wild_mode &&
                ((x == 0) || (x == MAX_WID - 1) ||
                 (y == 0) || (y == MAX_HGT - 1)))
        {
                /* Can the player enter the grid? */
-               if (c_ptr->mimic && player_can_enter(c_ptr->mimic))
+               if (c_ptr->mimic && player_can_enter(c_ptr->mimic, 0))
                {
                        /* Hack: move to new area */
                        if ((y == 0) && (x == 0))
@@ -3628,6 +3571,7 @@ void move_player(int dir, int do_pickup, bool break_trap)
 
                /* "Blocked" message appears later */
                /* oktomove = FALSE; */
+               p_can_enter = FALSE;
        }
 
        /* Get the monster */
@@ -3639,15 +3583,11 @@ void move_player(int dir, int do_pickup, bool break_trap)
 
        /* Player can not walk through "walls"... */
        /* unless in Shadow Form */
-       if (p_ptr->wraith_form || p_ptr->pass_wall || p_ptr->kabenuke)
-               p_can_pass_walls = TRUE;
-       if ((c_ptr->feat >= FEAT_PERM_EXTRA) && (c_ptr->feat <= FEAT_PERM_SOLID))
-       {
-               p_can_pass_walls = FALSE;
-       }
+       p_can_kill_walls = p_ptr->kill_wall && have_flag(f_ptr->flags, FF_TUNNEL) &&
+               !cave_floor_grid(c_ptr) && cave_valid_bold(y, x);
 
        /* Hack -- attack monsters */
-       if (c_ptr->m_idx && (m_ptr->ml || cave_floor_bold(y, x) || p_can_pass_walls))
+       if (c_ptr->m_idx && (m_ptr->ml || p_can_enter || p_can_kill_walls))
        {
                monster_race *r_ptr = &r_info[m_ptr->r_idx];
 
@@ -3655,8 +3595,7 @@ void move_player(int dir, int do_pickup, bool break_trap)
                if (!is_hostile(m_ptr) &&
                    !(p_ptr->confused || p_ptr->image || !m_ptr->ml || p_ptr->stun ||
                    ((p_ptr->muta2 & MUT2_BERS_RAGE) && p_ptr->shero)) &&
-                   (pattern_seq(py, px, y, x)) &&
-                   ((cave_floor_bold(y, x)) || (c_ptr->feat == FEAT_TREES) || (p_can_pass_walls)))
+                   pattern_seq(py, px, y, x) && (p_can_enter || p_can_kill_walls))
                {
                        m_ptr->csleep = 0;
                        if (r_ptr->flags7 & RF7_HAS_LD_MASK) p_ptr->update |= (PU_MON_LITE);
@@ -3664,11 +3603,14 @@ void move_player(int dir, int do_pickup, bool break_trap)
                        /* Extract monster name (or "it") */
                        monster_desc(m_name, m_ptr, 0);
 
-                       /* Auto-Recall if possible and visible */
-                       if (m_ptr->ml) monster_race_track(m_ptr->ap_r_idx);
+                       if (m_ptr->ml)
+                       {
+                               /* Auto-Recall if possible and visible */
+                               monster_race_track(m_ptr->ap_r_idx);
 
-                       /* Track a new monster */
-                       if (m_ptr->ml) health_track(c_ptr->m_idx);
+                               /* Track a new monster */
+                               health_track(c_ptr->m_idx);
+                       }
 
                        /* displace? */
                        if ((stormbringer && (randint1(1000) > 666)) || (p_ptr->pclass == CLASS_BERSERKER))
@@ -3676,9 +3618,7 @@ void move_player(int dir, int do_pickup, bool break_trap)
                                py_attack(y, x, 0);
                                oktomove = FALSE;
                        }
-                       else if (monster_can_cross_terrain(cave[py][px].feat, r_ptr) &&
-                                (cave_floor_bold(py, px) || cave[py][px].feat == FEAT_TREES ||
-                                 (r_ptr->flags2 & RF2_PASS_WALL)))
+                       else if (monster_can_cross_terrain(cave[py][px].feat, r_ptr, 0))
                        {
                                do_past = TRUE;
                        }
@@ -3703,16 +3643,108 @@ void move_player(int dir, int do_pickup, bool break_trap)
                }
        }
 
+       if (oktomove && p_ptr->riding)
+       {
+               if (riding_r_ptr->flags1 & RF1_NEVER_MOVE)
+               {
+#ifdef JP
+                       msg_print("Æ°¤±¤Ê¤¤¡ª");
+#else
+                       msg_print("Can't move!");
+#endif
+                       energy_use = 0;
+                       oktomove = FALSE;
+                       disturb(0, 0);
+               }
+               else if (riding_m_ptr->monfear)
+               {
+                       char m_name[80];
+
+                       /* Acquire the monster name */
+                       monster_desc(m_name, riding_m_ptr, 0);
+
+                       /* Dump a message */
+#ifdef JP
+                       msg_format("%s¤¬¶²Éݤ·¤Æ¤¤¤ÆÀ©¸æ¤Ç¤­¤Ê¤¤¡£", m_name);
+#else
+                       msg_format("%^s is too scared to control.", m_name);
+#endif
+                       oktomove = FALSE;
+                       disturb(0, 0);
+               }
+               else if (p_ptr->riding_ryoute)
+               {
+                       oktomove = FALSE;
+                       disturb(0, 0);
+               }
+               else if (have_flag(f_ptr->flags, FF_CAN_FLY) && (riding_r_ptr->flags7 & RF7_CAN_FLY))
+               {
+                       /* Allow moving */
+               }
+               else if (have_flag(f_ptr->flags, FF_CAN_SWIM) && (riding_r_ptr->flags7 & RF7_CAN_SWIM))
+               {
+                       /* Allow moving */
+               }
+               else if (have_flag(f_ptr->flags, FF_WATER) &&
+                       !(riding_r_ptr->flags7 & RF7_AQUATIC) &&
+                       (have_flag(f_ptr->flags, FF_DEEP) || (riding_r_ptr->flags2 & RF2_AURA_FIRE)))
+               {
+#ifdef JP
+                       msg_format("%s¤Î¾å¤Ë¹Ô¤±¤Ê¤¤¡£", f_name + f_ptr->name);
+#else
+                       msg_print("Can't swim.");
+#endif
+                       energy_use = 0;
+                       oktomove = FALSE;
+                       disturb(0, 0);
+               }
+               else if (!have_flag(f_ptr->flags, FF_WATER) && (riding_r_ptr->flags7 & RF7_AQUATIC))
+               {
+#ifdef JP
+                       msg_format("%s¤«¤é¾å¤¬¤ì¤Ê¤¤¡£", f_name + f_info[cave[py][px].feat].name);
+#else
+                       msg_print("Can't land.");
+#endif
+                       energy_use = 0;
+                       oktomove = FALSE;
+                       disturb(0, 0);
+               }
+               else if (have_flag(f_ptr->flags, FF_LAVA) && !(riding_r_ptr->flagsr & RFR_EFF_IM_FIRE_MASK))
+               {
+#ifdef JP
+                       msg_format("%s¤Î¾å¤Ë¹Ô¤±¤Ê¤¤¡£", f_name + f_ptr->name);
+#else
+                       msg_print("Too hot to go through.");
+#endif
+                       energy_use = 0;
+                       oktomove = FALSE;
+                       disturb(0, 0);
+               }
+
+               if (oktomove && riding_m_ptr->stunned && one_in_(2))
+               {
+                       char m_name[80];
+                       monster_desc(m_name, riding_m_ptr, 0);
+#ifdef JP
+                       msg_format("%s¤¬Û¯Û°¤È¤·¤Æ¤¤¤Æ¤¦¤Þ¤¯Æ°¤±¤Ê¤¤¡ª",m_name);
+#else
+                       msg_format("You cannot control stunned %s!",m_name);
+#endif
+                       oktomove = FALSE;
+                       disturb(0, 0);
+               }
+       }
+
        if (!oktomove)
        {
        }
 
-       else if ((c_ptr->feat == FEAT_DARK_PIT) && !p_ptr->ffall)
+       else if (have_flag(f_ptr->flags, FF_MUST_FLY) && !p_ptr->ffall)
        {
 #ifdef JP
-               msg_print("Îö¤±Ìܤò²£Àڤ뤳¤È¤Ï¤Ç¤­¤Þ¤»¤ó¡£");
+               msg_format("%s¤ò²£Àڤ뤳¤È¤Ï¤Ç¤­¤Þ¤»¤ó¡£", f_name + f_ptr->name);
 #else
-               msg_print("You can't cross the chasm.");
+               msg_format("You can't cross the %s.", f_name + f_ptr->name);
 #endif
 
                energy_use = 0;
@@ -3720,42 +3752,32 @@ void move_player(int dir, int do_pickup, bool break_trap)
                oktomove = FALSE;
        }
 
-       else if (c_ptr->feat == FEAT_MOUNTAIN)
+       else if (have_flag(f_ptr->flags, FF_MOUNTAIN) && (dun_level || !p_ptr->ffall))
        {
-               if (dun_level || !p_ptr->ffall)
-               {
 #ifdef JP
-                       msg_print("»³¤Ë¤ÏÅФì¤Þ¤»¤ó¡ª");
+               msg_print("»³¤Ë¤ÏÅФì¤Þ¤»¤ó¡ª");
 #else
-                       msg_print("You can't climb the mountains!");
+               msg_print("You can't climb the mountains!");
 #endif
 
-                       running = 0;
-                       energy_use = 0;
-                       oktomove = FALSE;
-               }
+               running = 0;
+               energy_use = 0;
+               oktomove = FALSE;
        }
        /*
         * Player can move through trees and
         * has effective -10 speed
         * Rangers can move without penality
         */
-       else if (c_ptr->feat == FEAT_TREES)
+       else if (have_flag(f_ptr->flags, FF_TREE) && !p_can_kill_walls)
        {
-               oktomove = TRUE;
                if ((p_ptr->pclass != CLASS_RANGER) && !p_ptr->ffall) energy_use *= 2;
        }
 
-       else if ((c_ptr->feat >= FEAT_QUEST_ENTER) &&
-               (c_ptr->feat <= FEAT_QUEST_EXIT))
-       {
-               oktomove = TRUE;
-       }
-
 #ifdef ALLOW_EASY_DISARM /* TNB */
 
        /* Disarm a visible trap */
-       else if ((do_pickup != easy_disarm) && is_known_trap(c_ptr))
+       else if ((do_pickup != easy_disarm) && have_flag(f_ptr->flags, FF_DISARM) && !c_ptr->mimic)
        {
                bool ignore = FALSE;
                switch (c_ptr->feat)
@@ -3797,108 +3819,13 @@ void move_player(int dir, int do_pickup, bool break_trap)
        }
 
 #endif /* ALLOW_EASY_DISARM -- TNB */
-       else if (p_ptr->riding && (riding_r_ptr->flags1 & RF1_NEVER_MOVE))
-       {
-#ifdef JP
-               msg_print("Æ°¤±¤Ê¤¤¡ª");
-#else
-               msg_print("Can't move!");
-#endif
-               energy_use = 0;
-               oktomove = FALSE;
-               disturb(0, 0);
-       }
-
-       else if (p_ptr->riding && riding_m_ptr->monfear)
-       {
-               char m_name[80];
-
-               /* Acquire the monster name */
-               monster_desc(m_name, riding_m_ptr, 0);
-
-               /* Dump a message */
-#ifdef JP
-               msg_format("%s¤¬¶²Éݤ·¤Æ¤¤¤ÆÀ©¸æ¤Ç¤­¤Ê¤¤¡£", m_name);
-#else
-               msg_format("%^s is too scared to control.", m_name);
-#endif
-               oktomove = FALSE;
-               disturb(0, 0);
-       }
-
-       else if (p_ptr->riding && p_ptr->riding_ryoute)
-       {
-               oktomove = FALSE;
-               disturb(0, 0);
-       }
-
-       else if ((p_ptr->riding && (riding_r_ptr->flags7 & RF7_AQUATIC)) && (c_ptr->feat != FEAT_SHAL_WATER) && (c_ptr->feat != FEAT_DEEP_WATER))
-       {
-#ifdef JP
-               msg_print("Φ¾å¤Ë¾å¤¬¤ì¤Ê¤¤¡£");
-#else
-               msg_print("Can't land.");
-#endif
-               energy_use = 0;
-               oktomove = FALSE;
-               disturb(0, 0);
-       }
-
-       else if ((p_ptr->riding && !(riding_r_ptr->flags7 & (RF7_AQUATIC | RF7_CAN_SWIM | RF7_CAN_FLY))) && (c_ptr->feat == FEAT_DEEP_WATER))
-       {
-#ifdef JP
-               msg_print("¿å¾å¤Ë¹Ô¤±¤Ê¤¤¡£");
-#else
-               msg_print("Can't swim.");
-#endif
-               energy_use = 0;
-               oktomove = FALSE;
-               disturb(0, 0);
-       }
-
-       else if ((p_ptr->riding && (riding_r_ptr->flags2 & RF2_AURA_FIRE) && !(riding_r_ptr->flags7 & RF7_CAN_FLY)) && (c_ptr->feat == FEAT_SHAL_WATER))
-       {
-#ifdef JP
-               msg_print("¿å¾å¤Ë¹Ô¤±¤Ê¤¤¡£");
-#else
-               msg_print("Can't swim.");
-#endif
-               energy_use = 0;
-               oktomove = FALSE;
-               disturb(0, 0);
-       }
-
-       else if ((p_ptr->riding && !(riding_r_ptr->flags7 & RF7_CAN_FLY) && !(riding_r_ptr->flagsr & RFR_EFF_IM_FIRE_MASK)) && ((c_ptr->feat == FEAT_SHAL_LAVA) || (c_ptr->feat == FEAT_DEEP_LAVA)))
-       {
-#ifdef JP
-               msg_print("ÍÏ´ä¤Î¾å¤Ë¹Ô¤±¤Ê¤¤¡£");
-#else
-               msg_print("Too hot to go through.");
-#endif
-               energy_use = 0;
-               oktomove = FALSE;
-               disturb(0, 0);
-       }
-
-       else if (p_ptr->riding && riding_m_ptr->stunned && one_in_(2))
-       {
-               char m_name[80];
-               monster_desc(m_name, riding_m_ptr, 0);
-#ifdef JP
-               msg_format("%s¤¬Û¯Û°¤È¤·¤Æ¤¤¤Æ¤¦¤Þ¤¯Æ°¤±¤Ê¤¤¡ª",m_name);
-#else
-               msg_format("You cannot control stunned %s!",m_name);
-#endif
-               oktomove = FALSE;
-               disturb(0, 0);
-       }
 
        /* Player can not walk through "walls" unless in wraith form...*/
-       else if ((!cave_floor_bold(y, x)) &&
-               (!p_can_pass_walls))
+       else if (!p_can_enter && !p_can_kill_walls)
        {
                /* Feature code (applying "mimic" field) */
-               byte feat = get_feat_mimic(c_ptr);
+               s16b feat = get_feat_mimic(c_ptr);
+               cptr name = f_name + f_info[feat].name;
 
                oktomove = FALSE;
 
@@ -3909,34 +3836,8 @@ void move_player(int dir, int do_pickup, bool break_trap)
                if ((!(c_ptr->info & (CAVE_MARK))) &&
                    (p_ptr->blind || !(c_ptr->info & (CAVE_LITE))))
                {
-                       /* Rubble */
-                       if (feat == FEAT_RUBBLE)
-                       {
-#ifdef JP
-                               msg_print("´äÀФ¬¹Ô¤¯¼ê¤ò¤Ï¤Ð¤ó¤Ç¤¤¤ë¤è¤¦¤À¡£");
-#else
-                               msg_print("You feel some rubble blocking your way.");
-#endif
-
-                               c_ptr->info |= (CAVE_MARK);
-                               lite_spot(y, x);
-                       }
-
-                       /* Closed door */
-                       else if (is_closed_door(feat))
-                       {
-#ifdef JP
-                               msg_print("¥É¥¢¤¬¹Ô¤¯¼ê¤ò¤Ï¤Ð¤ó¤Ç¤¤¤ë¤è¤¦¤À¡£");
-#else
-                               msg_print("You feel a closed door blocking your way.");
-#endif
-
-                               c_ptr->info |= (CAVE_MARK);
-                               lite_spot(y, x);
-                       }
-
                        /* Boundary floor mimic */
-                       else if (boundary_floor_grid(c_ptr))
+                       if (boundary_floor_grid(c_ptr))
                        {
 #ifdef JP
                                msg_print("¤½¤ì°Ê¾åÀè¤Ë¤Ï¿Ê¤á¤Ê¤¤¤è¤¦¤À¡£");
@@ -3949,9 +3850,10 @@ void move_player(int dir, int do_pickup, bool break_trap)
                        else
                        {
 #ifdef JP
-                               msg_format("%s¤¬¹Ô¤¯¼ê¤ò¤Ï¤Ð¤ó¤Ç¤¤¤ë¤è¤¦¤À¡£", blocking_feat_name(feat));
+                               msg_format("%s¤¬¹Ô¤¯¼ê¤ò¤Ï¤Ð¤ó¤Ç¤¤¤ë¤è¤¦¤À¡£", name);
 #else
-                               msg_format("You feel a %s blocking your way.", blocking_feat_name(feat));
+                               msg_format("You feel %s %s blocking your way.",
+                                       is_a_vowel(name[0]) ? "an" : "a", name);
 #endif
 
                                c_ptr->info |= (CAVE_MARK);
@@ -3962,45 +3864,8 @@ void move_player(int dir, int do_pickup, bool break_trap)
                /* Notice things */
                else
                {
-                       /* Rubble */
-                       if (feat == FEAT_RUBBLE)
-                       {
-#ifdef JP
-                               msg_print("´äÀФ¬¹Ô¤¯¼ê¤ò¤Ï¤Ð¤ó¤Ç¤¤¤ë¡£");
-#else
-                               msg_print("There is rubble blocking your way.");
-#endif
-
-                               if (!(p_ptr->confused || p_ptr->stun || p_ptr->image))
-                                       energy_use = 0;
-
-                               /*
-                                * Well, it makes sense that you lose time bumping into
-                                * a wall _if_ you are confused, stunned or blind; but
-                                * typing mistakes should not cost you a turn...
-                                */
-                       }
-                       /* Closed doors */
-                       else if (is_closed_door(feat))
-                       {
-#ifdef ALLOW_EASY_OPEN
-
-                               if (easy_open && easy_open_door(y, x)) return;
-
-#endif /* ALLOW_EASY_OPEN */
-
-#ifdef JP
-                               msg_print("¥É¥¢¤¬¹Ô¤¯¼ê¤ò¤Ï¤Ð¤ó¤Ç¤¤¤ë¡£");
-#else
-                               msg_print("There is a closed door blocking your way.");
-#endif
-
-                               if (!(p_ptr->confused || p_ptr->stun || p_ptr->image))
-                                       energy_use = 0;
-                       }
-
                        /* Boundary floor mimic */
-                       else if (boundary_floor_grid(c_ptr))
+                       if (boundary_floor_grid(c_ptr))
                        {
 #ifdef JP
                                msg_print("¤½¤ì°Ê¾åÀè¤Ë¤Ï¿Ê¤á¤Ê¤¤¡£");
@@ -4015,12 +3880,23 @@ void move_player(int dir, int do_pickup, bool break_trap)
                        /* Wall (or secret door) */
                        else
                        {
+#ifdef ALLOW_EASY_OPEN
+                               /* Closed doors */
+                               if (easy_open && is_closed_door(feat) && easy_open_door(y, x)) return;
+#endif /* ALLOW_EASY_OPEN */
+
 #ifdef JP
-                               msg_format("%s¤¬¹Ô¤¯¼ê¤ò¤Ï¤Ð¤ó¤Ç¤¤¤ë¡£", blocking_feat_name(feat));
+                               msg_format("%s¤¬¹Ô¤¯¼ê¤ò¤Ï¤Ð¤ó¤Ç¤¤¤ë¡£", name);
 #else
-                               msg_format("There is a %s blocking your way.", blocking_feat_name(feat));
+                               msg_format("There is %s %s blocking your way.",
+                                       is_a_vowel(name[0]) ? "an" : "a", name);
 #endif
 
+                               /*
+                                * Well, it makes sense that you lose time bumping into
+                                * a wall _if_ you are confused, stunned or blind; but
+                                * typing mistakes should not cost you a turn...
+                                */
                                if (!(p_ptr->confused || p_ptr->stun || p_ptr->image))
                                        energy_use = 0;
                        }
@@ -4031,7 +3907,7 @@ void move_player(int dir, int do_pickup, bool break_trap)
        }
 
        /* Normal movement */
-       if (!pattern_seq(py, px, y, x))
+       if (oktomove && !pattern_seq(py, px, y, x))
        {
                if (!(p_ptr->confused || p_ptr->stun || p_ptr->image))
                {
@@ -4099,22 +3975,9 @@ void move_player(int dir, int do_pickup, bool break_trap)
                        project(0, 0, py, px,
                                (60 + p_ptr->lev), GF_DISINTEGRATE, PROJECT_KILL | PROJECT_ITEM, -1);
                }
-               else if (p_ptr->kill_wall || (p_ptr->riding && (riding_r_ptr->flags2 & RF2_KILL_WALL)))
+               else if (p_can_kill_walls)
                {
-                       if (!cave_floor_bold(py, px) && cave_valid_bold(py, px) &&
-                               (cave[py][px].feat < FEAT_PATTERN_START ||
-                                cave[py][px].feat > FEAT_PATTERN_XTRA2) &&
-                               (cave[py][px].feat < FEAT_DEEP_WATER ||
-                                cave[py][px].feat > FEAT_GRASS))
-                       {
-                               /* Forget the wall */
-                               cave[py][px].info &= ~(CAVE_MARK);
-
-                               if (cave[py][px].feat == FEAT_TREES)
-                                       cave_set_feat(py, px, FEAT_GRASS);
-                               else
-                                       cave_set_feat(py, px, floor_type[randint0(100)]);
-                       }
+                       cave_alter_feat(py, px, FF_HURT_DISI);
 
                        /* Update some things -- similar to GF_KILL_WALL */
                        p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MONSTERS | PU_MON_LITE);
@@ -4199,9 +4062,7 @@ void move_player(int dir, int do_pickup, bool break_trap)
 #endif /* ALLOW_EASY_DISARM -- TNB */
 
                /* Handle "store doors" */
-               if (((c_ptr->feat >= FEAT_SHOP_HEAD) &&
-                   (c_ptr->feat <= FEAT_SHOP_TAIL)) ||
-                   (c_ptr->feat == FEAT_MUSEUM))
+               if (have_flag(f_ptr->flags, FF_STORE))
                {
                        /* Disturb */
                        disturb(0, 0);
@@ -4212,8 +4073,7 @@ void move_player(int dir, int do_pickup, bool break_trap)
                }
 
                /* Handle "building doors" -KMW- */
-               else if ((c_ptr->feat >= FEAT_BLDG_HEAD) &&
-                   (c_ptr->feat <= FEAT_BLDG_TAIL))
+               else if (have_flag(f_ptr->flags, FF_BLDG))
                {
                        /* Disturb */
                        disturb(0, 0);
@@ -4224,7 +4084,7 @@ void move_player(int dir, int do_pickup, bool break_trap)
                }
 
                /* Handle quest areas -KMW- */
-               else if (c_ptr->feat == FEAT_QUEST_ENTER)
+               else if (have_flag(f_ptr->flags, FF_QUEST_ENTER))
                {
                        /* Disturb */
                        disturb(0, 0);
@@ -4234,7 +4094,7 @@ void move_player(int dir, int do_pickup, bool break_trap)
                        command_new = SPECIAL_KEY_QUEST;
                }
 
-               else if (c_ptr->feat == FEAT_QUEST_EXIT)
+               else if (have_flag(f_ptr->flags, FF_QUEST_EXIT))
                {
                        if (quest[p_ptr->inside_quest].type == QUEST_TYPE_FIND_EXIT)
                        {
@@ -4261,7 +4121,7 @@ void move_player(int dir, int do_pickup, bool break_trap)
                }
 
                /* Set off a trap */
-               else if (is_trap(c_ptr->feat))
+               else if (have_flag(f_ptr->flags, FF_HIT_TRAP))
                {
                        /* Disturb */
                        disturb(0, 0);
@@ -4313,6 +4173,8 @@ void move_player(int dir, int do_pickup, bool break_trap)
 }
 
 
+static bool use_avoid_run;
+
 /*
  * Hack -- Check for a "known wall" (see below)
  */
@@ -4334,16 +4196,17 @@ static int see_wall(int dir, int y, int x)
        if (c_ptr->info & (CAVE_MARK))
        {
                /* Feature code (applying "mimic" field) */
-               byte feat = get_feat_mimic(c_ptr);
+               s16b         feat = get_feat_mimic(c_ptr);
+               feature_type *f_ptr;
+
+               /* Wall grids are known walls */
+               if (!player_can_enter(feat, 0)) return TRUE;
 
-               /* Rubble, Magma, Quartz, Wall, Perm wall */
-               if (feat >= FEAT_RUBBLE && feat <= FEAT_PERM_SOLID) return TRUE;
+               f_ptr = &f_info[feat];
 
-               /* Tree */
-               if (feat == FEAT_TREES) return TRUE;
+               if (use_avoid_run && have_flag(f_ptr->flags, FF_AVOID_RUN)) return TRUE;
 
-               /* Mountain */
-               if (feat == FEAT_MOUNTAIN) return TRUE;
+               else if (!have_flag(f_ptr->flags, FF_MOVE) && !have_flag(f_ptr->flags, FF_AVOID_RUN)) return TRUE;
        }
 
        return FALSE;
@@ -4365,9 +4228,6 @@ static int see_nothing(int dir, int y, int x)
        /* Memorized grids are always known */
        if (cave[y][x].info & (CAVE_MARK)) return (FALSE);
 
-       /* Non-floor grids are unknown */
-       if (!cave_floor_bold(y, x)) return (TRUE);
-
        /* Viewable door/wall grids are known */
        if (player_can_see_bold(y, x)) return (FALSE);
 
@@ -4589,6 +4449,8 @@ static void run_init(int dir)
        row = py + ddy[dir];
        col = px + ddx[dir];
 
+       use_avoid_run = !have_flag(f_flags_bold(row, col), FF_AVOID_RUN);
+
        /* Extract cycle index */
        i = chome[dir];
 
@@ -4663,7 +4525,8 @@ static bool run_test(void)
        int         i, max, inv;
        int         option = 0, option2 = 0;
        cave_type   *c_ptr;
-       byte feat;
+       s16b        feat;
+       feature_type *f_ptr;
 
        /* Where we came from */
        prev_dir = find_prevdir;
@@ -4704,7 +4567,6 @@ static bool run_test(void)
        {
                s16b this_o_idx, next_o_idx = 0;
 
-
                /* New direction */
                new_dir = cycle[chome[prev_dir] + i];
 
@@ -4717,6 +4579,7 @@ static bool run_test(void)
 
                /* Feature code (applying "mimic" field) */
                feat = get_feat_mimic(c_ptr);
+               f_ptr = &f_info[feat];
 
                /* Visible monsters abort running */
                if (c_ptr->m_idx)
@@ -4742,116 +4605,44 @@ static bool run_test(void)
                        if (o_ptr->marked) return (TRUE);
                }
 
-
                /* Assume unknown */
                inv = TRUE;
 
                /* Check memorized grids */
                if (c_ptr->info & (CAVE_MARK))
                {
-                       bool notice = TRUE;
-
-                       /* Examine the terrain */
-                       switch (feat)
-                       {
-                               /* Floors */
-                               case FEAT_FLOOR:
-
-                               /* Invis traps */
-                               case FEAT_INVIS:
-
-                               /* Normal veins */
-                               case FEAT_MAGMA:
-                               case FEAT_QUARTZ:
-
-                               /* Hidden treasure */
-                               case FEAT_MAGMA_H:
-                               case FEAT_QUARTZ_H:
-
-                               /* Known treasure (almost uninteresting) */
-                               case FEAT_MAGMA_K:
-                               case FEAT_QUARTZ_K:
-
-                               /* Walls */
-                               case FEAT_RUBBLE:
-                               case FEAT_WALL_EXTRA:
-                               case FEAT_WALL_INNER:
-                               case FEAT_WALL_OUTER:
-                               case FEAT_WALL_SOLID:
-                               case FEAT_PERM_EXTRA:
-                               case FEAT_PERM_INNER:
-                               case FEAT_PERM_OUTER:
-                               case FEAT_PERM_SOLID:
-                               /* dirt, grass, trees, ... */
-                               case FEAT_SHAL_WATER:
-                               case FEAT_DIRT:
-                               case FEAT_GRASS:
-                               case FEAT_DEEP_GRASS:
-                               case FEAT_FLOWER:
-                               case FEAT_DARK_PIT:
-                               case FEAT_TREES:
-                               case FEAT_MOUNTAIN:
+                       bool notice = have_flag(f_ptr->flags, FF_NOTICE);
+
+                       if (notice && have_flag(f_ptr->flags, FF_MOVE))
+                       {
+                               /* Open doors */
+                               if (find_ignore_doors && have_flag(f_ptr->flags, FF_DOOR) && have_flag(f_ptr->flags, FF_CLOSE))
                                {
-                                       /* Ignore */
+                                       /* Option -- ignore */
                                        notice = FALSE;
-
-                                       /* Done */
-                                       break;
                                }
 
-                               /* quest features */
-                               case FEAT_QUEST_ENTER:
-                               case FEAT_QUEST_EXIT:
+                               /* Stairs */
+                               else if (find_ignore_stairs && have_flag(f_ptr->flags, FF_STAIRS))
                                {
-                                       /* Notice */
-                                       notice = TRUE;
-
-                                       /* Done */
-                                       break;
+                                       /* Option -- ignore */
+                                       notice = FALSE;
                                }
 
-                               case FEAT_DEEP_LAVA:
-                               case FEAT_SHAL_LAVA:
+                               /* Lava */
+                               else if (have_flag(f_ptr->flags, FF_LAVA) && (p_ptr->immune_fire || IS_INVULN()))
                                {
                                        /* Ignore */
-                                       if (IS_INVULN() || p_ptr->immune_fire) notice = FALSE;
-
-                                       /* Done */
-                                       break;
+                                       notice = FALSE;
                                }
 
-                               case FEAT_DEEP_WATER:
+                               /* Deep water */
+                               else if (have_flag(f_ptr->flags, FF_WATER) && have_flag(f_ptr->flags, FF_DEEP) &&
+                                        (p_ptr->ffall || p_ptr->can_swim ||
+                                         p_ptr->total_weight <= (((u32b)adj_str_wgt[p_ptr->stat_ind[A_STR]]*(p_ptr->pclass == CLASS_BERSERKER ? 150 : 100)) / 2)))
                                {
                                        /* Ignore */
-                                       if (p_ptr->ffall || p_ptr->total_weight<= (((u32b)adj_str_wgt[p_ptr->stat_ind[A_STR]]*(p_ptr->pclass == CLASS_BERSERKER ? 150 : 100))/2)) notice = FALSE;
-
-                                       /* Done */
-                                       break;
-                               }
-
-                               /* Open doors */
-                               case FEAT_OPEN:
-                               case FEAT_BROKEN:
-                               {
-                                       /* Option -- ignore */
-                                       if (find_ignore_doors) notice = FALSE;
-
-                                       /* Done */
-                                       break;
-                               }
-
-                               /* Stairs */
-                               case FEAT_LESS:
-                               case FEAT_MORE:
-                               case FEAT_LESS_LESS:
-                               case FEAT_MORE_MORE:
-                               case FEAT_ENTRANCE:
-                               {
-                                       /* Option -- ignore */
-                                       if (find_ignore_stairs) notice = FALSE;
-
-                                       /* Done */
-                                       break;
+                                       notice = FALSE;
                                }
                        }
 
@@ -4863,7 +4654,7 @@ static bool run_test(void)
                }
 
                /* Analyze unknown grids and floors considering mimic */
-               if (inv || feat_floor(feat))
+               if (inv || !see_wall(0, row, col))
                {
                        /* Looking for open area */
                        if (find_openarea)
@@ -4925,32 +4716,14 @@ static bool run_test(void)
                }
        }
 
-
        /* Looking for open area */
        if (find_openarea)
        {
                /* Hack -- look again */
                for (i = -max; i < 0; i++)
                {
-                       new_dir = cycle[chome[prev_dir] + i];
-
-                       row = py + ddy[new_dir];
-                       col = px + ddx[new_dir];
-
-                       /* Access grid */
-                       c_ptr = &cave[row][col];
-
-                       /* Feature code (applying "mimic" field) */
-                       feat = get_feat_mimic(c_ptr);
-
                        /* Unknown grid or non-wall XXX XXX XXX cave_floor_grid(c_ptr)) */
-                       if (!(c_ptr->info & (CAVE_MARK)) ||
-                           ((feat <= FEAT_DOOR_TAIL) ||
-                            (feat == FEAT_FLOWER) ||
-                            (feat == FEAT_DEEP_GRASS) ||
-                            ((feat >= FEAT_DEEP_WATER) &&
-                             (feat <= FEAT_GRASS))))
-
+                       if (!see_wall(cycle[chome[prev_dir] + i], py, px))
                        {
                                /* Looking to break right */
                                if (find_breakright)
@@ -4973,25 +4746,8 @@ static bool run_test(void)
                /* Hack -- look again */
                for (i = max; i > 0; i--)
                {
-                       new_dir = cycle[chome[prev_dir] + i];
-
-                       row = py + ddy[new_dir];
-                       col = px + ddx[new_dir];
-
-                       /* Access grid */
-                       c_ptr = &cave[row][col];
-
-                       /* Feature code (applying "mimic" field) */
-                       feat = get_feat_mimic(c_ptr);
-
                        /* Unknown grid or non-wall XXX XXX XXX cave_floor_grid(c_ptr)) */
-                       if (!(c_ptr->info & (CAVE_MARK)) ||
-                           ((feat <= FEAT_DOOR_TAIL) ||
-                            (feat == FEAT_FLOWER) ||
-                            (feat == FEAT_DEEP_GRASS) ||
-                            ((feat >= FEAT_DEEP_WATER) &&
-                             (feat <= FEAT_GRASS))))
-
+                       if (!see_wall(cycle[chome[prev_dir] + i], py, px))
                        {
                                /* Looking to break left */
                                if (find_breakleft)
@@ -5012,7 +4768,6 @@ static bool run_test(void)
                }
        }
 
-
        /* Not looking for open area */
        else
        {
@@ -5087,14 +4842,12 @@ static bool run_test(void)
                }
        }
 
-
        /* About to hit a known wall, stop */
        if (see_wall(find_current, py, px))
        {
                return (TRUE);
        }
 
-
        /* Failure */
        return (FALSE);
 }
@@ -5109,24 +4862,18 @@ void run_step(int dir)
        /* Start running */
        if (dir)
        {
-               /* Access grid */
-               cave_type *c_ptr = &cave[py+ddy[dir]][px+ddx[dir]];
-
-               /* Feature code (applying "mimic" field) */
-               byte feat = get_feat_mimic(c_ptr);
+               use_avoid_run = FALSE;
 
                /* Hack -- do not start silly run */
-               if (see_wall(dir, py, px) &&
-                  (feat != FEAT_TREES))
+               if (see_wall(dir, py, px))
                {
                        /* Message */
 #ifdef JP
-                       msg_print("¤½¤ÎÊý¸þ¤Ë¤Ï¹Ô¤±¤Þ¤»¤ó¡£");
+                       msg_print("¤½¤ÎÊý¸þ¤Ë¤ÏÁö¤ì¤Þ¤»¤ó¡£");
 #else
                        msg_print("You cannot run in that direction.");
 #endif
 
-
                        /* Disturb */
                        disturb(0, 0);
 
index 1181dc0..b77a592 100644 (file)
 void do_cmd_go_up(void)
 {
        bool go_up = FALSE;
-       cave_type *c_ptr;
+
+       /* Player grid */
+       cave_type *c_ptr = &cave[py][px];
+       feature_type *f_ptr = &f_info[c_ptr->feat];
+
        int up_num = 0;
 
        if (p_ptr->special_defense & KATA_MUSOU)
@@ -27,11 +31,20 @@ void do_cmd_go_up(void)
                set_action(ACTION_NONE);
        }
 
-       /* Player grid */
-       c_ptr = &cave[py][px];
+       /* Verify stairs */
+       if (!have_flag(f_ptr->flags, FF_LESS))
+       {
+#ifdef JP
+               msg_print("¤³¤³¤Ë¤Ï¾å¤ê³¬Ãʤ¬¸«Åö¤¿¤é¤Ê¤¤¡£");
+#else
+               msg_print("I see no up staircase here.");
+#endif
+
+               return;
+       }
 
        /* Quest up stairs */
-       if (c_ptr->feat == FEAT_QUEST_UP)
+       if (have_flag(f_ptr->flags, FF_QUEST))
        {
                /* Success */
 #ifdef JP
@@ -69,18 +82,6 @@ void do_cmd_go_up(void)
                return;
        }
 
-       /* Normal up stairs? */
-       if (c_ptr->feat != FEAT_LESS && c_ptr->feat != FEAT_LESS_LESS)
-       {
-#ifdef JP
-               msg_print("¤³¤³¤Ë¤Ï¾å¤ê³¬Ãʤ¬¸«Åö¤¿¤é¤Ê¤¤¡£");
-#else
-               msg_print("I see no up staircase here.");
-#endif
-
-               return;
-       }
-
        if (!dun_level)
        {
                go_up = TRUE;
@@ -141,7 +142,7 @@ void do_cmd_go_up(void)
        else
        {
                /* New depth */
-               if (c_ptr->feat == FEAT_LESS_LESS)
+               if (have_flag(f_ptr->flags, FF_SHAFT))
                {
                        /* Create a way back */
                        prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_UP | CFM_SHAFT);
@@ -192,7 +193,10 @@ void do_cmd_go_up(void)
  */
 void do_cmd_go_down(void)
 {
-       cave_type *c_ptr;
+       /* Player grid */
+       cave_type *c_ptr = &cave[py][px];
+       feature_type *f_ptr = &f_info[c_ptr->feat];
+
        bool fall_trap = FALSE;
        int down_num = 0;
 
@@ -201,13 +205,28 @@ void do_cmd_go_down(void)
                set_action(ACTION_NONE);
        }
 
-       /* Player grid */
-       c_ptr = &cave[py][px];
+       /* Verify stairs */
+       if (!have_flag(f_ptr->flags, FF_MORE))
+       {
+#ifdef JP
+               msg_print("¤³¤³¤Ë¤Ï²¼¤ê³¬Ãʤ¬¸«Åö¤¿¤é¤Ê¤¤¡£");
+#else
+               msg_print("I see no down staircase here.");
+#endif
 
-       if (c_ptr->feat == (FEAT_TRAP_TRAPDOOR)) fall_trap = TRUE;
+               return;
+       }
+
+       if (have_flag(f_ptr->flags, FF_TRAP)) fall_trap = TRUE;
+
+       /* Quest entrance */
+       if (have_flag(f_ptr->flags, FF_QUEST_ENTER))
+       {
+               do_cmd_quest();
+       }
 
        /* Quest down stairs */
-       if (c_ptr->feat == FEAT_QUEST_DOWN)
+       else if (have_flag(f_ptr->flags, FF_QUEST))
        {
 #ifdef JP
                if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON))
@@ -241,24 +260,14 @@ void do_cmd_go_down(void)
                p_ptr->oldpx = 0;
                p_ptr->oldpy = 0;
        }
-       /* Verify stairs */
-       else if ((c_ptr->feat != FEAT_MORE) && (c_ptr->feat != FEAT_MORE_MORE) && (c_ptr->feat != FEAT_ENTRANCE) && !fall_trap)
-       {
-#ifdef JP
-               msg_print("¤³¤³¤Ë¤Ï²¼¤ê³¬Ãʤ¬¸«Åö¤¿¤é¤Ê¤¤¡£");
-#else
-               msg_print("I see no down staircase here.");
-#endif
 
-               return;
-       }
        else
        {
                int target_dungeon = 0;
 
                if (!dun_level)
                {
-                       target_dungeon = (c_ptr->feat == FEAT_ENTRANCE) ? c_ptr->special : DUNGEON_ANGBAND;
+                       target_dungeon = have_flag(f_ptr->flags, FF_ENTRANCE) ? c_ptr->special : DUNGEON_ANGBAND;
 
                        if (ironman_downward && (target_dungeon != DUNGEON_ANGBAND))
                        {
@@ -298,7 +307,7 @@ void do_cmd_go_down(void)
                if (autosave_l) do_cmd_save_game(TRUE);
 
                /* Go down */
-               if (c_ptr->feat == FEAT_MORE_MORE) down_num += 2;
+               if (have_flag(f_ptr->flags, FF_SHAFT)) down_num += 2;
                else down_num += 1;
 
                if (!dun_level)
@@ -361,7 +370,7 @@ void do_cmd_go_down(void)
                }
                else
                {
-                       if (c_ptr->feat == FEAT_MORE_MORE)
+                       if (have_flag(f_ptr->flags, FF_SHAFT))
                        {
                                /* Create a way back */
                                prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_DOWN | CFM_SHAFT);
@@ -926,7 +935,7 @@ static bool do_cmd_open_chest(int y, int x, s16b o_idx)
  */
 static bool is_open(int feat)
 {
-       return (feat == FEAT_OPEN);
+       return have_flag(f_info[feat].flags, FF_CLOSE) && (feat != feat_state(feat, FF_CLOSE));
 }
 
 
@@ -945,7 +954,7 @@ static int count_dt(int *y, int *x, bool (*test)(int feat), bool under)
        for (d = 0; d < 9; d++)
        {
                cave_type *c_ptr;
-               byte feat;
+               s16b feat;
 
                /* if not searching under player continue */
                if ((d == 8) && !under) continue;
@@ -1058,7 +1067,10 @@ static bool do_cmd_open_aux(int y, int x)
 {
        int i, j;
 
-       cave_type *c_ptr;
+       /* Get requested grid */
+       cave_type *c_ptr = &cave[y][x];
+
+       feature_type *f_ptr = &f_info[c_ptr->feat];
 
        bool more = FALSE;
 
@@ -1066,13 +1078,10 @@ static bool do_cmd_open_aux(int y, int x)
        /* Take a turn */
        energy_use = 100;
 
-       /* Get requested grid */
-       c_ptr = &cave[y][x];
-
        /* Seeing true feature code (ignore mimic) */
-               
+
        /* Jammed door */
-       if (c_ptr->feat >= FEAT_DOOR_HEAD + 0x08)
+       if (!have_flag(f_ptr->flags, FF_OPEN))
        {
                /* Stuck */
 #ifdef JP
@@ -1084,7 +1093,7 @@ static bool do_cmd_open_aux(int y, int x)
        }
 
        /* Locked door */
-       else if (c_ptr->feat >= FEAT_DOOR_HEAD + 0x01)
+       else if (f_ptr->power)
        {
                /* Disarm factor */
                i = p_ptr->skill_dis;
@@ -1094,7 +1103,7 @@ static bool do_cmd_open_aux(int y, int x)
                if (p_ptr->confused || p_ptr->image) i = i / 10;
 
                /* Extract the lock power */
-               j = c_ptr->feat - FEAT_DOOR_HEAD;
+               j = f_ptr->power;
 
                /* Extract the difficulty XXX XXX XXX */
                j = i - (j * 4);
@@ -1112,9 +1121,8 @@ static bool do_cmd_open_aux(int y, int x)
                        msg_print("You have picked the lock.");
 #endif
 
-
                        /* Open the door */
-                       cave_set_feat(y, x, FEAT_OPEN);
+                       cave_alter_feat(y, x, FF_OPEN);
 
                        /* Update some things */
                        p_ptr->update |= (PU_VIEW | PU_LITE | PU_MONSTERS | PU_MON_LITE);
@@ -1146,10 +1154,10 @@ static bool do_cmd_open_aux(int y, int x)
        }
 
        /* Closed door */
-       else if (c_ptr->feat == FEAT_DOOR_HEAD)
+       else
        {
                /* Open the door */
-               cave_set_feat(y, x, FEAT_OPEN);
+               cave_alter_feat(y, x, FF_OPEN);
 
                /* Update some things */
                p_ptr->update |= (PU_VIEW | PU_LITE | PU_MONSTERS | PU_MON_LITE);
@@ -1222,7 +1230,7 @@ void do_cmd_open(void)
        /* Get a "repeated" direction */
        if (get_rep_dir(&dir, TRUE))
        {
-               byte feat;
+               s16b feat;
                cave_type *c_ptr;
 
                /* Get requested location */
@@ -1300,40 +1308,40 @@ void do_cmd_open(void)
  */
 static bool do_cmd_close_aux(int y, int x)
 {
-       cave_type       *c_ptr;
-       bool            more = FALSE;
+       /* Get grid and contents */
+       cave_type *c_ptr = &cave[y][x];
+       s16b      old_feat = c_ptr->feat;
+       bool      more = FALSE;
 
        /* Take a turn */
        energy_use = 100;
 
-       /* Get grid and contents */
-       c_ptr = &cave[y][x];
-
        /* Seeing true feature code (ignore mimic) */
 
-       /* Broken door */
-       if (c_ptr->feat == FEAT_BROKEN)
-       {
-               /* Message */
-#ifdef JP
-               msg_print("¥É¥¢¤Ï²õ¤ì¤Æ¤·¤Þ¤Ã¤Æ¤¤¤ë¡£");
-#else
-               msg_print("The door appears to be broken.");
-#endif
-
-       }
-
        /* Open door */
-       else if (c_ptr->feat == FEAT_OPEN)
+       if (have_flag(f_info[old_feat].flags, FF_CLOSE))
        {
                /* Close the door */
-               cave_set_feat(y, x, FEAT_DOOR_HEAD + 0x00);
+               cave_alter_feat(y, x, FF_CLOSE);
 
-               /* Update some things */
-               p_ptr->update |= (PU_VIEW | PU_LITE | PU_MONSTERS | PU_MON_LITE);
+               /* Broken door */
+               if (old_feat == c_ptr->feat)
+               {
+                       /* Message */
+#ifdef JP
+                       msg_print("¥É¥¢¤Ï²õ¤ì¤Æ¤·¤Þ¤Ã¤Æ¤¤¤ë¡£");
+#else
+                       msg_print("The door appears to be broken.");
+#endif
+               }
+               else
+               {
+                       /* Update some things */
+                       p_ptr->update |= (PU_VIEW | PU_LITE | PU_MONSTERS | PU_MON_LITE);
 
-               /* Sound */
-               sound(SOUND_SHUTDOOR);
+                       /* Sound */
+                       sound(SOUND_SHUTDOOR);
+               }
        }
 
        /* Result */
@@ -1386,7 +1394,7 @@ void do_cmd_close(void)
        if (get_rep_dir(&dir,FALSE))
        {
                cave_type *c_ptr;
-               byte feat;
+               s16b feat;
 
                /* Get requested location */
                y = py + ddy[dir];
@@ -1399,7 +1407,7 @@ void do_cmd_close(void)
                feat = get_feat_mimic(c_ptr);
 
                /* Require open/broken door */
-               if ((feat != FEAT_OPEN) && (feat != FEAT_BROKEN))
+               if (!have_flag(f_info[feat].flags, FF_CLOSE))
                {
                        /* Message */
 #ifdef JP
@@ -1407,7 +1415,6 @@ void do_cmd_close(void)
 #else
                        msg_print("You see nothing there to close.");
 #endif
-
                }
 
                /* Monster in the way */
@@ -1418,12 +1425,11 @@ void do_cmd_close(void)
 
                        /* Message */
 #ifdef JP
-               msg_print("¥â¥ó¥¹¥¿¡¼¤¬Î©¤Á¤Õ¤µ¤¬¤Ã¤Æ¤¤¤ë¡ª");
+                       msg_print("¥â¥ó¥¹¥¿¡¼¤¬Î©¤Á¤Õ¤µ¤¬¤Ã¤Æ¤¤¤ë¡ª");
 #else
                        msg_print("There is a monster in the way!");
 #endif
 
-
                        /* Attack */
                        py_attack(y, x, 0);
                }
@@ -1446,8 +1452,10 @@ void do_cmd_close(void)
  */
 static bool do_cmd_tunnel_test(int y, int x)
 {
+       cave_type *c_ptr = &cave[y][x];
+
        /* Must have knowledge */
-       if (!(cave[y][x].info & (CAVE_MARK)))
+       if (!(c_ptr->info & CAVE_MARK))
        {
                /* Message */
 #ifdef JP
@@ -1456,13 +1464,12 @@ static bool do_cmd_tunnel_test(int y, int x)
                msg_print("You see nothing there.");
 #endif
 
-
                /* Nope */
                return (FALSE);
        }
 
        /* Must be a wall/door/etc */
-       if (cave_floor_bold(y, x))
+       if (!have_flag(f_flags_grid(c_ptr), FF_TUNNEL))
        {
                /* Message */
 #ifdef JP
@@ -1471,7 +1478,6 @@ static bool do_cmd_tunnel_test(int y, int x)
                msg_print("You see nothing there to tunnel.");
 #endif
 
-
                /* Nope */
                return (FALSE);
        }
@@ -1481,53 +1487,22 @@ static bool do_cmd_tunnel_test(int y, int x)
 }
 
 
-
-/*
- * Tunnel through wall.  Assumes valid location.
- *
- * 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, byte feat)
-{
-       cave_type       *c_ptr = &cave[y][x];
-
-       /* Paranoia -- Require a wall or door or some such */
-       if (cave_floor_bold(y, x)) return (FALSE);
-
-       /* Forget the wall */
-       c_ptr->info &= ~(CAVE_MARK);
-
-       /* Remove the feature */
-       cave_set_feat(y, x, feat);
-
-       /* Update some things */
-       p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MONSTERS | PU_MON_LITE);
-
-       /* Result */
-       return (TRUE);
-}
-
-
-
 /*
  * 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
  *
+ * Do not use twall anymore
+ *
  * Returns TRUE if repeated commands may continue
  */
 static bool do_cmd_tunnel_aux(int y, int x)
 {
        cave_type *c_ptr;
-       byte feat;
-
+       s16b mimic_feat;
+       feature_type *f_ptr, *mimic_f_ptr;
+       int power;
+       cptr name;
        bool more = FALSE;
 
        /* Verify legality */
@@ -1538,255 +1513,121 @@ static bool do_cmd_tunnel_aux(int y, int x)
 
        /* Get grid */
        c_ptr = &cave[y][x];
+       f_ptr = &f_info[c_ptr->feat];
+       power = f_ptr->power;
 
        /* Feature code (applying "mimic" field) */
-       feat = get_feat_mimic(c_ptr);
+       mimic_feat = get_feat_mimic(c_ptr);
+       mimic_f_ptr = &f_info[mimic_feat];
+
+       name = f_name + mimic_f_ptr->name;
 
        /* Sound */
        sound(SOUND_DIG);
 
-       /* Titanium */
-       if ((feat >= FEAT_PERM_EXTRA) &&
-           (feat <= FEAT_PERM_SOLID))
-       {
-#ifdef JP
-               msg_print("¤³¤Î´ä¤Ï¹Å¤¹¤®¤Æ·¡¤ì¤Ê¤¤¤è¤¦¤À¡£");
-#else
-               msg_print("This seems to be permanent rock.");
-#endif
-
-       }
-
-       /* Map border (mimiccing Permanent wall) */
-       else if ((c_ptr->feat >= FEAT_PERM_EXTRA &&
-                 c_ptr->feat <= FEAT_PERM_SOLID) ||
-                c_ptr->feat == FEAT_MOUNTAIN)
-       {
-#ifdef JP
-               msg_print("¤½¤³¤Ï·¡¤ì¤Ê¤¤!");
-#else
-               msg_print("You can't tunnel through that!");
-#endif
-
-       }
-
-       else if (feat == FEAT_TREES) /* -KMW- */
+       if (have_flag(f_ptr->flags, FF_PERMANENT))
        {
-               /* Chop Down */
-               if ((p_ptr->skill_dig > 10 + randint0(400)) && twall(y, x, FEAT_GRASS))
+               /* Titanium */
+               if (!mimic_feat || have_flag(mimic_f_ptr->flags, FF_PERMANENT))
                {
 #ifdef JP
-                       msg_print("ÌÚ¤òÀÚ¤êʧ¤Ã¤¿¡£");
+                       msg_print("¤³¤Î´ä¤Ï¹Å¤¹¤®¤Æ·¡¤ì¤Ê¤¤¤è¤¦¤À¡£");
 #else
-                       msg_print("You have cleared away the trees.");
+                       msg_print("This seems to be permanent rock.");
 #endif
-                       chg_virtue(V_DILIGENCE, 1);
-                       chg_virtue(V_NATURE, -1);
                }
 
-               /* Keep trying */
+               /* Map border (mimiccing Permanent wall) */
                else
                {
-                       /* We may continue chopping */
 #ifdef JP
-                       msg_print("ÌÚ¤òÀڤäƤ¤¤ë¡£");
+                       msg_print("¤½¤³¤Ï·¡¤ì¤Ê¤¤!");
 #else
-                       msg_print("You chop away at the tree.");
+                       msg_print("You can't tunnel through that!");
 #endif
-
-                       more = TRUE;
-
-                       /* Occasional Search XXX XXX */
-                       if (randint0(100) < 25) search();
                }
        }
 
-
-       /* Granite */
-       else if ((feat >= FEAT_WALL_EXTRA) &&
-                (feat <= FEAT_WALL_SOLID))
+       /* Dig or tunnel */
+       else if (have_flag(f_ptr->flags, FF_CAN_DIG))
        {
-               /* Tunnel */
-               if ((p_ptr->skill_dig > 40 + randint0(1600)) && twall(y, x, floor_type[randint0(100)]))
+               /* Dig */
+               if (p_ptr->skill_dig > randint0(20 * power))
                {
+                       /* Message */
 #ifdef JP
-                       msg_print("·ê¤ò·¡¤ê½ª¤¨¤¿¡£");
+                       msg_format("%s¤ò¤¯¤º¤·¤¿¡£", name);
 #else
-                       msg_print("You have finished the tunnel.");
+                       msg_format("You have removed the %s.", name);
 #endif
-                       chg_virtue(V_DILIGENCE, 1);
-                       chg_virtue(V_NATURE, -1);
-               }
 
-               /* Keep trying */
+                       /* Remove the feature */
+                       cave_alter_feat(y, x, FF_TUNNEL);
+
+                       /* Update some things */
+                       p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MONSTERS | PU_MON_LITE);
+               }
                else
                {
-                       /* We may continue tunelling */
+                       /* Message, keep digging */
 #ifdef JP
-                       msg_print("²ÖÖ¾´ä¤ÎÊɤ˷ê¤ò·¡¤Ã¤Æ¤¤¤ë¡£");
+                       msg_format("%s¤ò¤¯¤º¤·¤Æ¤¤¤ë¡£", name);
 #else
-                       msg_print("You tunnel into the granite wall.");
+                       msg_format("You dig into the %s.", name);
 #endif
 
                        more = TRUE;
                }
        }
 
-
-       /* Quartz / Magma */
-       else if ((feat >= FEAT_MAGMA) &&
-           (feat <= FEAT_QUARTZ_K))
+       else
        {
-               bool okay = FALSE;
-               bool gold = FALSE;
-               bool hard = FALSE;
+               bool tree = have_flag(mimic_f_ptr->flags, FF_TREE);
 
-               /* Found gold (ignore mimic; maybe a hidden treasure) */
-               if (c_ptr->feat >= FEAT_MAGMA_H &&
-                   c_ptr->feat <= FEAT_QUARTZ_K) gold = TRUE;
-
-               /* Extract "quartz" flag XXX XXX XXX */
-               if ((feat - FEAT_MAGMA) & 0x01) hard = TRUE;
-
-               /* Quartz */
-               if (hard)
-               {
-                       okay = (p_ptr->skill_dig > 20 + randint0(800));
-               }
-
-               /* Magma */
-               else
-               {
-                       okay = (p_ptr->skill_dig > 10 + randint0(400));
-               }
-
-               /* Success */
-               if (okay && twall(y, x, floor_type[randint0(100)]))
+               /* Tunnel */
+               if (p_ptr->skill_dig > power + randint0(40 * power))
                {
-                       /* Found treasure */
-                       if (gold)
-                       {
-                               /* Place some gold */
-                               place_gold(y, x);
-
-                               /* Message */
 #ifdef JP
-                               msg_print("²¿¤«¤òȯ¸«¤·¤¿¡ª");
+                       if (tree) msg_format("%s¤òÀÚ¤êʧ¤Ã¤¿¡£", name);
+                       else msg_print("·ê¤ò·¡¤ê½ª¤¨¤¿¡£");
 #else
-                               msg_print("You have found something!");
+                       if (tree) msg_format("You have cleared away the %s.", name);
+                       else msg_print("You have finished the tunnel.");
 #endif
 
-                       }
-
-                       /* Found nothing */
-                       else
-                       {
-                               /* Message */
-#ifdef JP
-                               msg_print("·ê¤ò·¡¤ê½ª¤¨¤¿¡£");
-#else
-                               msg_print("You have finished the tunnel.");
-#endif
-                               chg_virtue(V_DILIGENCE, 1);
-                               chg_virtue(V_NATURE, -1);
-                       }
-               }
+                       /* Remove the feature */
+                       cave_alter_feat(y, x, FF_TUNNEL);
 
-               /* Failure (quartz) */
-               else if (hard)
-               {
-                       /* Message, continue digging */
-#ifdef JP
-                       msg_print("ÀбѤιÛÌ®¤Ë·ê¤ò·¡¤Ã¤Æ¤¤¤ë¡£");
-#else
-                       msg_print("You tunnel into the quartz vein.");
-#endif
+                       /* Update some things */
+                       p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MONSTERS | PU_MON_LITE);
 
-                       more = TRUE;
+                       chg_virtue(V_DILIGENCE, 1);
+                       chg_virtue(V_NATURE, -1);
                }
 
-               /* Failure (magma) */
+               /* Keep trying */
                else
                {
-                       /* Message, continue digging */
-#ifdef JP
-                       msg_print("ÍÏ´ä¤Î¹ÛÌ®¤Ë·ê¤ò·¡¤Ã¤Æ¤¤¤ë¡£");
-#else
-                       msg_print("You tunnel into the magma vein.");
-#endif
-
-                       more = TRUE;
-               }
-       }
-
-       /* Rubble */
-       else if (feat == FEAT_RUBBLE)
-       {
-               /* Remove the rubble */
-               if ((p_ptr->skill_dig > randint0(200)) && twall(y, x, floor_type[randint0(100)]))
-               {
-                       /* Message */
-#ifdef JP
-                       msg_print("´äÀФò¤¯¤º¤·¤¿¡£");
-#else
-                       msg_print("You have removed the rubble.");
-#endif
-
-                       /* Hack -- place an object */
-                       if (randint0(100) < (15 - dun_level/2))
+                       if (tree)
                        {
-                               /* Create a simple object */
-                               place_object(y, x, 0L);
-
-                               /* Observe new object */
-                               if (player_can_see_bold(y, x))
-                               {
+                               /* We may continue chopping */
 #ifdef JP
-                                       msg_print("²¿¤«¤òȯ¸«¤·¤¿¡ª");
+                               msg_format("%s¤òÀڤäƤ¤¤ë¡£", name);
 #else
-                                       msg_print("You have found something!");
+                               msg_format("You chop away at the %s.", name);
 #endif
-
-                               }
+                               /* Occasional Search XXX XXX */
+                               if (randint0(100) < 25) search();
                        }
-               }
-
-               else
-               {
-                       /* Message, keep digging */
-#ifdef JP
-                       msg_print("´äÀФò¤¯¤º¤·¤Æ¤¤¤ë¡£");
-#else
-                       msg_print("You dig in the rubble.");
-#endif
-
-                       more = TRUE;
-               }
-       }
-
-       /* Doors */
-       else
-       {
-               /* Tunnel */
-               if ((p_ptr->skill_dig > 30 + randint0(1200)) && twall(y, x, floor_type[randint1(100)]))
-               {
-#ifdef JP
-                       msg_print("·ê¤ò·¡¤ê½ª¤¨¤¿¡£");
-#else
-                       msg_print("You have finished the tunnel.");
-#endif
-
-               }
-
-               /* Keep trying */
-               else
-               {
-                       /* We may continue tunelling */
+                       else
+                       {
+                               /* We may continue tunelling */
 #ifdef JP
-                       msg_print("¥É¥¢¤Ë·ê¤ò³«¤±¤Æ¤¤¤ë¡£");
+                               msg_format("%s¤Ë·ê¤ò·¡¤Ã¤Æ¤¤¤ë¡£", name);
 #else
-                       msg_print("You tunnel into the door.");
+                               msg_format("You tunnel into the %s.", name);
 #endif
+                       }
 
                        more = TRUE;
                }
@@ -1799,7 +1640,7 @@ static bool do_cmd_tunnel_aux(int y, int x)
        }
 
        /* Result */
-       return (more);
+       return more;
 }
 
 
@@ -1817,7 +1658,7 @@ void do_cmd_tunnel(void)
        int                     y, x, dir;
 
        cave_type       *c_ptr;
-       byte feat;
+       s16b feat;
 
        bool            more = FALSE;
 
@@ -1854,10 +1695,7 @@ void do_cmd_tunnel(void)
                feat = get_feat_mimic(c_ptr);
 
                /* No tunnelling through doors */
-               if (((feat >= FEAT_DOOR_HEAD) && (feat <= FEAT_DOOR_TAIL)) ||
-                   ((feat >= FEAT_BLDG_HEAD) && (feat <= FEAT_BLDG_TAIL)) ||
-                   ((feat >= FEAT_SHOP_HEAD) && (feat <= FEAT_SHOP_TAIL)) ||
-                   (feat == FEAT_MUSEUM))
+               if (have_flag(f_info[feat].flags, FF_DOOR))
                {
                        /* Message */
 #ifdef JP
@@ -1865,31 +1703,16 @@ void do_cmd_tunnel(void)
 #else
                        msg_print("You cannot tunnel through doors.");
 #endif
-
-               }
-
-               /* No tunnelling through air */
-               else if (cave_floor_grid(c_ptr) || ((feat >= FEAT_MINOR_GLYPH) &&
-                   (feat <= FEAT_PATTERN_XTRA2)))
-               {
-                       /* Message */
-#ifdef JP
-                       msg_print("¶õµ¤¤Ï·¡¤ì¤Ê¤¤¡£");
-#else
-                       msg_print("You cannot tunnel through air.");
-#endif
-
                }
 
-               /* No tunnelling through mountains */
-               else if (feat == FEAT_MOUNTAIN)
+               /* No tunnelling through most features */
+               else if (!have_flag(f_info[feat].flags, FF_TUNNEL))
                {
 #ifdef JP
                        msg_print("¤½¤³¤Ï·¡¤ì¤Ê¤¤¡£");
 #else
-                       msg_print("You can't tunnel through that!");
+                       msg_print("You can't tunnel through that.");
 #endif
-
                }
 
                /* A monster is in the way */
@@ -1900,12 +1723,11 @@ void do_cmd_tunnel(void)
 
                        /* Message */
 #ifdef JP
-               msg_print("¥â¥ó¥¹¥¿¡¼¤¬Î©¤Á¤Õ¤µ¤¬¤Ã¤Æ¤¤¤ë¡ª");
+                       msg_print("¥â¥ó¥¹¥¿¡¼¤¬Î©¤Á¤Õ¤µ¤¬¤Ã¤Æ¤¤¤ë¡ª");
 #else
                        msg_print("There is a monster in the way!");
 #endif
 
-
                        /* Attack */
                        py_attack(y, x, 0);
                }
@@ -1940,17 +1762,17 @@ bool easy_open_door(int y, int x)
        int i, j;
 
        cave_type *c_ptr = &cave[y][x];
+       feature_type *f_ptr = &f_info[c_ptr->feat];
 
        /* Must be a closed door */
-       if (!((c_ptr->feat >= FEAT_DOOR_HEAD) &&
-             (c_ptr->feat <= FEAT_DOOR_TAIL)))
+       if (!is_closed_door(c_ptr->feat))
        {
                /* Nope */
                return (FALSE);
        }
 
        /* Jammed door */
-       if (c_ptr->feat >= FEAT_DOOR_HEAD + 0x08)
+       if (!have_flag(f_ptr->flags, FF_OPEN))
        {
                /* Stuck */
 #ifdef JP
@@ -1962,7 +1784,7 @@ bool easy_open_door(int y, int x)
        }
 
        /* Locked door */
-       else if (c_ptr->feat >= FEAT_DOOR_HEAD + 0x01)
+       else if (f_ptr->power)
        {
                /* Disarm factor */
                i = p_ptr->skill_dis;
@@ -1972,7 +1794,7 @@ bool easy_open_door(int y, int x)
                if (p_ptr->confused || p_ptr->image) i = i / 10;
 
                /* Extract the lock power */
-               j = c_ptr->feat - FEAT_DOOR_HEAD;
+               j = f_ptr->power;
 
                /* Extract the difficulty XXX XXX XXX */
                j = i - (j * 4);
@@ -1992,7 +1814,7 @@ bool easy_open_door(int y, int x)
 
 
                        /* Open the door */
-                       cave_set_feat(y, x, FEAT_OPEN);
+                       cave_alter_feat(y, x, FF_OPEN);
 
                        /* Update some things */
                        p_ptr->update |= (PU_VIEW | PU_LITE | PU_MONSTERS | PU_MON_LITE);
@@ -2024,7 +1846,7 @@ bool easy_open_door(int y, int x)
        else
        {
                /* Open the door */
-               cave_set_feat(y, x, FEAT_OPEN);
+               cave_alter_feat(y, x, FF_OPEN);
 
                /* Update some things */
                p_ptr->update |= (PU_VIEW | PU_LITE | PU_MONSTERS | PU_MON_LITE);
@@ -2171,47 +1993,32 @@ static bool do_cmd_disarm_aux(int y, int x, int dir)
 
 #endif /* ALLOW_EASY_DISARM -- TNB */
 {
-       int i, j, power;
+       /* Get grid and contents */
+       cave_type *c_ptr = &cave[y][x];
 
-       cave_type *c_ptr;
+       /* Get feature */
+       feature_type *f_ptr = &f_info[c_ptr->feat];
 
-       cptr name;
+       /* Access trap name */
+       cptr name = (f_name + f_ptr->name);
+
+       /* Extract trap "power" */
+       int power = f_ptr->power;
 
        bool more = FALSE;
 
+       /* Get the "disarm" factor */
+       int i = p_ptr->skill_dis;
+
+       int j;
 
        /* Take a turn */
        energy_use = 100;
 
-       /* Get grid and contents */
-       c_ptr = &cave[y][x];
-
-       /* Access trap name */
-       name = (f_name + f_info[c_ptr->feat].name);
-
-       /* 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;
 
-       /* Variable power! */
-
-       /* Extract trap "power" */
-       switch (c_ptr->feat)
-       {
-       case FEAT_TRAP_OPEN:
-       case FEAT_TRAP_ARMAGEDDON:
-       case FEAT_TRAP_PIRANHA:
-               /* Special traps are very difficult to disarm */
-               power = 100;
-               break;
-       default:
-               power = 5;
-               break;
-       }
-
        /* Extract the difficulty */
        j = i - power;
 
@@ -2228,15 +2035,11 @@ static bool do_cmd_disarm_aux(int y, int x, int dir)
                msg_format("You have disarmed the %s.", name);
 #endif
 
-
                /* Reward */
                gain_exp(power);
 
-               /* Forget the trap */
-               c_ptr->info &= ~(CAVE_MARK);
-
                /* Remove the trap */
-               cave_set_feat(y, x, floor_type[randint0(100)]);
+               cave_alter_feat(y, x, FF_DISARM);
 
 #ifdef ALLOW_EASY_DISARM /* TNB */
 
@@ -2264,7 +2067,6 @@ static bool do_cmd_disarm_aux(int y, int x, int dir)
                msg_format("You failed to disarm the %s.", name);
 #endif
 
-
                /* We may keep trying */
                more = TRUE;
        }
@@ -2279,7 +2081,6 @@ static bool do_cmd_disarm_aux(int y, int x, int dir)
                msg_format("You set off the %s!", name);
 #endif
 
-
 #ifdef ALLOW_EASY_DISARM /* TNB */
 
                /* Move the player onto the trap */
@@ -2355,7 +2156,7 @@ void do_cmd_disarm(void)
        if (get_rep_dir(&dir,TRUE))
        {
                cave_type *c_ptr;
-               byte feat;
+               s16b feat;
 
                /* Get location */
                y = py + ddy[dir];
@@ -2387,7 +2188,7 @@ void do_cmd_disarm(void)
                {
                        /* Message */
 #ifdef JP
-               msg_print("¥â¥ó¥¹¥¿¡¼¤¬Î©¤Á¤Õ¤µ¤¬¤Ã¤Æ¤¤¤ë¡ª");
+                       msg_print("¥â¥ó¥¹¥¿¡¼¤¬Î©¤Á¤Õ¤µ¤¬¤Ã¤Æ¤¤¤ë¡ª");
 #else
                        msg_print("There is a monster in the way!");
 #endif
@@ -2428,19 +2229,22 @@ void do_cmd_disarm(void)
  */
 static bool do_cmd_bash_aux(int y, int x, int dir)
 {
-       int                     bash, temp;
+       /* Get grid */
+       cave_type       *c_ptr = &cave[y][x];
+       feature_type *f_ptr = &f_info[c_ptr->feat];
 
-       cave_type       *c_ptr;
+       /* Hack -- Bash power based on strength */
+       /* (Ranges from 3 to 20 to 100 to 200) */
+       int bash = adj_str_blow[p_ptr->stat_ind[A_STR]];
 
-       bool            more = FALSE;
+       /* Extract door power */
+       int temp = f_ptr->power;
 
+       bool            more = FALSE;
 
        /* Take a turn */
        energy_use = 100;
 
-       /* Get grid */
-       c_ptr = &cave[y][x];
-
        /* Message */
 #ifdef JP
        msg_print("¥É¥¢¤ËÂÎÅö¤¿¤ê¤ò¤·¤¿¡ª");
@@ -2448,14 +2252,6 @@ static bool do_cmd_bash_aux(int y, int x, int dir)
        msg_print("You smash into the door!");
 #endif
 
-
-       /* Hack -- Bash power based on strength */
-       /* (Ranges from 3 to 20 to 100 to 200) */
-       bash = adj_str_blow[p_ptr->stat_ind[A_STR]];
-
-       /* Extract door power */
-       temp = ((c_ptr->feat - FEAT_DOOR_HEAD) & 0x07);
-
        /* Compare bash power to door power XXX XXX XXX */
        temp = (bash - (temp * 10));
 
@@ -2478,13 +2274,13 @@ static bool do_cmd_bash_aux(int y, int x, int dir)
                /* Break down the door */
                if (randint0(100) < 50)
                {
-                       cave_set_feat(y, x, FEAT_BROKEN);
+                       cave_alter_feat(y, x, FF_BASH);
                }
 
                /* Open the door */
                else
                {
-                       cave_set_feat(y, x, FEAT_OPEN);
+                       cave_alter_feat(y, x, FF_OPEN);
                }
 
                /* Sound */
@@ -2578,7 +2374,7 @@ void do_cmd_bash(void)
        /* Get a "repeated" direction */
        if (get_rep_dir(&dir,FALSE))
        {
-               byte feat;
+               s16b feat;
 
                /* Bash location */
                y = py + ddy[dir];
@@ -2591,12 +2387,11 @@ void do_cmd_bash(void)
                feat = get_feat_mimic(c_ptr);
 
                /* Nothing useful */
-               if (!((feat >= FEAT_DOOR_HEAD) &&
-                     (feat <= FEAT_DOOR_TAIL)))
+               if (!have_flag(f_info[feat].flags, FF_BASH))
                {
                        /* Message */
 #ifdef JP
-               msg_print("¤½¤³¤Ë¤ÏÂÎÅö¤¿¤ê¤¹¤ë¤â¤Î¤¬¸«Åö¤¿¤é¤Ê¤¤¡£");
+                       msg_print("¤½¤³¤Ë¤ÏÂÎÅö¤¿¤ê¤¹¤ë¤â¤Î¤¬¸«Åö¤¿¤é¤Ê¤¤¡£");
 #else
                        msg_print("You see nothing there to bash.");
 #endif
@@ -2611,7 +2406,7 @@ void do_cmd_bash(void)
 
                        /* Message */
 #ifdef JP
-               msg_print("¥â¥ó¥¹¥¿¡¼¤¬Î©¤Á¤Õ¤µ¤¬¤Ã¤Æ¤¤¤ë¡ª");
+                       msg_print("¥â¥ó¥¹¥¿¡¼¤¬Î©¤Á¤Õ¤µ¤¬¤Ã¤Æ¤¤¤ë¡ª");
 #else
                        msg_print("There is a monster in the way!");
 #endif
@@ -2674,7 +2469,8 @@ void do_cmd_alter(void)
        /* Get a direction */
        if (get_rep_dir(&dir,TRUE))
        {
-               byte feat;
+               s16b feat;
+               feature_type *f_ptr;
 
                /* Get location */
                y = py + ddy[dir];
@@ -2685,6 +2481,7 @@ void do_cmd_alter(void)
 
                /* Feature code (applying "mimic" field) */
                feat = get_feat_mimic(c_ptr);
+               f_ptr = &f_info[feat];
 
                /* Take a turn */
                energy_use = 100;
@@ -2696,39 +2493,32 @@ void do_cmd_alter(void)
                        py_attack(y, x, 0);
                }
 
-               /* Tunnel through walls */
-               else if (((feat >= FEAT_RUBBLE) &&
-                         (feat < FEAT_MINOR_GLYPH)) ||
-                        ((feat == FEAT_TREES) ||
-                         (feat == FEAT_MOUNTAIN)))
+               /* Locked doors */
+               else if (have_flag(f_ptr->flags, FF_OPEN))
                {
-                       more = do_cmd_tunnel_aux(y, x);
+                       more = do_cmd_open_aux(y, x);
                }
 
-               else if (is_closed_door(feat))
+               /* Bash jammed doors */
+               else if (have_flag(f_ptr->flags, FF_BASH))
                {
-                       /* Bash jammed doors */
-                       if (feat >= FEAT_DOOR_HEAD + 0x08)
-                       {
-                               more = do_cmd_bash_aux(y, x, dir);
-                       }
+                       more = do_cmd_bash_aux(y, x, dir);
+               }
 
-                       /* Locked doors */
-                       else
-                       {
-                               more = do_cmd_open_aux(y, x);
-                       }
+               /* Tunnel through walls */
+               else if (have_flag(f_ptr->flags, FF_TUNNEL))
+               {
+                       more = do_cmd_tunnel_aux(y, x);
                }
 
                /* Close open doors */
-               else if ((feat == FEAT_OPEN) ||
-                        (feat == FEAT_BROKEN))
+               else if (have_flag(f_ptr->flags, FF_CLOSE))
                {
                        more = do_cmd_close_aux(y, x);
                }
 
                /* Disarm traps */
-               else if (is_trap(feat))
+               else if (have_flag(f_ptr->flags, FF_DISARM))
                {
                        more = do_cmd_disarm_aux(y, x, dir);
                }
@@ -2803,7 +2593,7 @@ void do_cmd_spike(void)
        {
                int y, x, item;
                cave_type *c_ptr;
-               byte feat;
+               s16b feat;
 
                /* Get location */
                y = py + ddy[dir];
@@ -2816,12 +2606,11 @@ void do_cmd_spike(void)
                feat = get_feat_mimic(c_ptr);
 
                /* Require closed door */
-               if (!((feat >= FEAT_DOOR_HEAD) &&
-                     (feat <= FEAT_DOOR_TAIL)))
+               if (!have_flag(f_info[feat].flags, FF_SPIKE))
                {
                        /* Message */
 #ifdef JP
-               msg_print("¤½¤³¤Ë¤Ï¤¯¤µ¤Ó¤òÂǤƤë¤â¤Î¤¬¸«Åö¤¿¤é¤Ê¤¤¡£");
+                       msg_print("¤½¤³¤Ë¤Ï¤¯¤µ¤Ó¤òÂǤƤë¤â¤Î¤¬¸«Åö¤¿¤é¤Ê¤¤¡£");
 #else
                        msg_print("You see nothing there to spike.");
 #endif
@@ -2833,11 +2622,10 @@ void do_cmd_spike(void)
                {
                        /* Message */
 #ifdef JP
-               msg_print("¤¯¤µ¤Ó¤ò»ý¤Ã¤Æ¤¤¤Ê¤¤¡ª");
+                       msg_print("¤¯¤µ¤Ó¤ò»ý¤Ã¤Æ¤¤¤Ê¤¤¡ª");
 #else
                        msg_print("You have no spikes!");
 #endif
-
                }
 
                /* Is a monster in the way? */
@@ -2848,12 +2636,11 @@ void do_cmd_spike(void)
 
                        /* Message */
 #ifdef JP
-               msg_print("¥â¥ó¥¹¥¿¡¼¤¬Î©¤Á¤Õ¤µ¤¬¤Ã¤Æ¤¤¤ë¡ª");
+                       msg_print("¥â¥ó¥¹¥¿¡¼¤¬Î©¤Á¤Õ¤µ¤¬¤Ã¤Æ¤¤¤ë¡ª");
 #else
                        msg_print("There is a monster in the way!");
 #endif
 
-
                        /* Attack */
                        py_attack(y, x, 0);
                }
@@ -2866,17 +2653,12 @@ void do_cmd_spike(void)
 
                        /* Successful jamming */
 #ifdef JP
-               msg_print("¥É¥¢¤Ë¤¯¤µ¤Ó¤òÂǤÁ¹þ¤ó¤À¡£");
+                       msg_print("¥É¥¢¤Ë¤¯¤µ¤Ó¤òÂǤÁ¹þ¤ó¤À¡£");
 #else
                        msg_print("You jam the door with a spike.");
 #endif
 
-
-                       /* Convert "locked" to "stuck" XXX XXX XXX */
-                       if (c_ptr->feat < FEAT_DOOR_HEAD + 0x08) c_ptr->feat += 0x08;
-
-                       /* Add one spike to the door */
-                       if (c_ptr->feat < FEAT_DOOR_TAIL) c_ptr->feat++;
+                       cave_alter_feat(y, x, FF_SPIKE);
 
                        /* Use up, and describe, a single spike, from the bottom */
                        inven_item_increase(item, -1);
@@ -2934,7 +2716,7 @@ void do_cmd_walk(int pickup)
        }
 
        /* Hack again -- Is there a special encounter ??? */
-       if(p_ptr->wild_mode && (cave[py][px].feat != FEAT_TOWN))
+       if (p_ptr->wild_mode && !have_flag(f_flags_bold(py, px), FF_TOWN))
        {
                int tmp = 120 + p_ptr->lev*10 - wilderness[py][px].level + 5;
                if (tmp < 1) 
@@ -3011,7 +2793,7 @@ void do_cmd_run(void)
 void do_cmd_stay(int pickup)
 {
        cave_type *c_ptr = &cave[py][px];
-
+       feature_type *f_ptr = &f_info[c_ptr->feat];
 
        /* Allow repeated command */
        if (command_arg)
@@ -3049,9 +2831,7 @@ void do_cmd_stay(int pickup)
 
 
        /* Hack -- enter a store if we are on one */
-       if (((c_ptr->feat >= FEAT_SHOP_HEAD) &&
-           (c_ptr->feat <= FEAT_SHOP_TAIL)) ||
-           (c_ptr->feat == FEAT_MUSEUM))
+       if (have_flag(f_ptr->flags, FF_STORE))
        {
                /* Disturb */
                disturb(0, 0);
@@ -3062,8 +2842,7 @@ void do_cmd_stay(int pickup)
        }
 
        /* Hack -- enter a building if we are on one -KMW- */
-       else if ((c_ptr->feat >= FEAT_BLDG_HEAD) &&
-           (c_ptr->feat <= FEAT_BLDG_TAIL))
+       else if (have_flag(f_ptr->flags, FF_BLDG))
        {
                /* Disturb */
                disturb(0, 0);
@@ -3074,7 +2853,7 @@ void do_cmd_stay(int pickup)
        }
 
        /* Exit a quest if reach the quest exit */
-       else if (c_ptr->feat == FEAT_QUEST_EXIT)
+       else if (have_flag(f_ptr->flags, FF_QUEST_EXIT))
        {
                int q_index = p_ptr->inside_quest;
 
index c9885a0..97a8bbf 100644 (file)
@@ -3553,6 +3553,22 @@ void do_cmd_macros(void)
 }
 
 
+static cptr lighting_level_str[F_LIT_MAX] =
+{
+#ifdef JP
+       "ɸ½à¿§",
+       "ÌÀ¿§",
+       "°Å¿§",
+       "°Å°Å¿§",
+#else
+       "standard",
+       "brightly lit",
+       "darkened",
+       "darkly darkened",
+#endif
+};
+
+
 static void cmd_visuals_aux(int i, int *num, int max)
 {
        if (iscntrl(i))
@@ -3654,7 +3670,7 @@ void do_cmd_visuals(void)
 
                /* Prompt */
 #ifdef JP
-               prt("¥³¥Þ¥ó¥É:", 18, 0);
+               prt("¥³¥Þ¥ó¥É:", 15, 0);
 #else
                prt("Command: ", 15, 0);
 #endif
@@ -3679,7 +3695,7 @@ void do_cmd_visuals(void)
 
                        /* Prompt */
 #ifdef JP
-                       prt("¥Õ¥¡¥¤¥ë: ", 18, 0);
+                       prt("¥Õ¥¡¥¤¥ë: ", 17, 0);
 #else
                        prt("File: ", 17, 0);
 #endif
@@ -3895,8 +3911,11 @@ void do_cmd_visuals(void)
                                auto_dump_printf("# %s\n", (f_name + f_ptr->name));
 
                                /* Dump the feature attr/char info */
-                               auto_dump_printf("F:%d:0x%02X/0x%02X\n\n", i,
-                                       (byte)(f_ptr->x_attr), (byte)(f_ptr->x_char));
+                               auto_dump_printf("F:%d:0x%02X/0x%02X:0x%02X/0x%02X:0x%02X/0x%02X:0x%02X/0x%02X\n\n", i,
+                                       (byte)(f_ptr->x_attr[F_LIT_STANDARD]), (byte)(f_ptr->x_char[F_LIT_STANDARD]),
+                                       (byte)(f_ptr->x_attr[F_LIT_LITE]), (byte)(f_ptr->x_char[F_LIT_LITE]),
+                                       (byte)(f_ptr->x_attr[F_LIT_DARK]), (byte)(f_ptr->x_char[F_LIT_DARK]),
+                                       (byte)(f_ptr->x_attr[F_LIT_DARKDARK]), (byte)(f_ptr->x_char[F_LIT_DARKDARK]));
                        }
 
                        /* Close */
@@ -4113,6 +4132,7 @@ void do_cmd_visuals(void)
                else if (i == '8')
                {
                        static int f = 0;
+                       static int lighting_level = F_LIT_STANDARD;
 
                        /* Prompt */
 #ifdef JP
@@ -4129,20 +4149,21 @@ void do_cmd_visuals(void)
                                char c;
                                int t;
 
-                               byte da = (byte)f_ptr->d_attr;
-                               byte dc = (byte)f_ptr->d_char;
-                               byte ca = (byte)f_ptr->x_attr;
-                               byte cc = (byte)f_ptr->x_char;
+                               byte da = (byte)f_ptr->d_attr[lighting_level];
+                               byte dc = (byte)f_ptr->d_char[lighting_level];
+                               byte ca = (byte)f_ptr->x_attr[lighting_level];
+                               byte cc = (byte)f_ptr->x_char[lighting_level];
 
                                /* Label the object */
+                               prt("", 17, 5);
 #ifdef JP
                                Term_putstr(5, 17, -1, TERM_WHITE,
-                                           format("ÃÏ·Á = %d, Ì¾Á° = %-40.40s",
-                                                  f, (f_name + f_ptr->name)));
+                                           format("ÃÏ·Á = %d, Ì¾Á° = %s, ÌÀÅÙ = %s",
+                                                  f, (f_name + f_ptr->name), lighting_level_str[lighting_level]));
 #else
                                Term_putstr(5, 17, -1, TERM_WHITE,
-                                           format("Terrain = %d, Name = %-40.40s",
-                                                  f, (f_name + f_ptr->name)));
+                                           format("Terrain = %d, Name = %s, Lighting = %s",
+                                                  f, (f_name + f_ptr->name), lighting_level_str[lighting_level]));
 #endif
 
 
@@ -4175,10 +4196,10 @@ void do_cmd_visuals(void)
                                /* Prompt */
 #ifdef JP
                                Term_putstr(0, 22, -1, TERM_WHITE,
-                                           "¥³¥Þ¥ó¥É (n/N/^N/a/A/^A/c/C/^C): ");
+                                           "¥³¥Þ¥ó¥É (n/N/^N/a/A/^A/c/C/^C/l/L/^L): ");
 #else
                                Term_putstr(0, 22, -1, TERM_WHITE,
-                                           "Command (n/N/^N/a/A/^A/c/C/^C): ");
+                                           "Command (n/N/^N/a/A/^A/c/C/^C/l/L/^L): ");
 #endif
 
                                /* Get a command */
@@ -4197,14 +4218,17 @@ void do_cmd_visuals(void)
                                        cmd_visuals_aux(i, &f, max_f_idx);
                                        break;
                                case 'a':
-                                       t = (int)f_info[f].x_attr;
+                                       t = (int)f_info[f].x_attr[lighting_level];
                                        cmd_visuals_aux(i, &t, 256);
-                                       f_info[f].x_attr = (byte)t;
+                                       f_info[f].x_attr[lighting_level] = (byte)t;
                                        break;
                                case 'c':
-                                       t = (int)f_info[f].x_char;
+                                       t = (int)f_info[f].x_char[lighting_level];
                                        cmd_visuals_aux(i, &t, 256);
-                                       f_info[f].x_char = (byte)t;
+                                       f_info[f].x_char[lighting_level] = (byte)t;
+                                       break;
+                               case 'l':
+                                       cmd_visuals_aux(i, &lighting_level, F_LIT_MAX);
                                        break;
                                }
                        }
@@ -7309,13 +7333,17 @@ static void place_visual_list_cursor(int col, int row, byte a, byte c, byte attr
 static byte attr_idx = 0;
 static byte char_idx = 0;
 
+/* Hack -- for feature lighting */
+static byte attr_idx_feat[F_LIT_MAX] = {0, 0, 0, 0};
+static byte char_idx_feat[F_LIT_MAX] = {0, 0, 0, 0};
+
 /*
  *  Do visual mode command -- Change symbols
  */
 static bool visual_mode_command(char ch, bool *visual_list_ptr, 
-                               int height, int width, 
-                               byte *attr_top_ptr, byte *char_left_ptr, 
-                               byte *cur_attr_ptr, byte *cur_char_ptr)
+                               int height, int width,
+                               byte *attr_top_ptr, byte *char_left_ptr,
+                               byte *cur_attr_ptr, byte *cur_char_ptr, bool *need_redraw)
 {
        static byte attr_old = 0, char_old = 0;
 
@@ -7340,6 +7368,7 @@ static bool visual_mode_command(char ch, bool *visual_list_ptr,
                {
                        /* Accept change */
                        *visual_list_ptr = FALSE;
+                       *need_redraw = TRUE;
 
                        return TRUE;
                }
@@ -7363,19 +7392,30 @@ static bool visual_mode_command(char ch, bool *visual_list_ptr,
 
        case 'C':
        case 'c':
-               /* Set the visual */
-               attr_idx = *cur_attr_ptr;
-               char_idx = *cur_char_ptr;
+               {
+                       int i;
+
+                       /* Set the visual */
+                       attr_idx = *cur_attr_ptr;
+                       char_idx = *cur_char_ptr;
 
+                       /* Hack -- for feature lighting */
+                       for (i = 0; i < F_LIT_MAX; i++)
+                       {
+                               attr_idx_feat[i] = 0;
+                               char_idx_feat[i] = 0;
+                       }
+               }
                return TRUE;
 
        case 'P':
        case 'p':
-               if (attr_idx)
+               if (attr_idx || (!(char_idx & 0x80) && char_idx)) /* Allow ATTR_DARK text */
                {
                        /* Set the char */
                        *cur_attr_ptr = attr_idx;
                        *attr_top_ptr = MAX(0, (*cur_attr_ptr & 0x7f) - 5);
+                       if (!*visual_list_ptr) *need_redraw = TRUE;
                }
 
                if (char_idx)
@@ -7383,6 +7423,7 @@ static bool visual_mode_command(char ch, bool *visual_list_ptr,
                        /* Set the char */
                        *cur_char_ptr = char_idx;
                        *char_left_ptr = MAX(0, *cur_char_ptr - 10);
+                       if (!*visual_list_ptr) *need_redraw = TRUE;
                }
 
                return TRUE;
@@ -7397,7 +7438,7 @@ static bool visual_mode_command(char ch, bool *visual_list_ptr,
 
                        if (use_bigtile) eff_width = width / 2;
                        else eff_width = width;
-                                       
+
                        /* Restrict direction */
                        if ((a == 0) && (ddy[d] < 0)) d = 0;
                        if ((c == 0) && (ddx[d] < 0)) d = 0;
@@ -7492,7 +7533,7 @@ static void display_monster_list(int col, int row, int per_page, s16b mon_idx[],
 /*
  * Display known monsters.
  */
-static void do_cmd_knowledge_monsters(void)
+static void do_cmd_knowledge_monsters(bool *need_redraw)
 {
        int i, len, max;
        int grp_cur, grp_top, old_grp_cur;
@@ -7500,7 +7541,7 @@ static void do_cmd_knowledge_monsters(void)
        int grp_cnt, grp_idx[100];
        int mon_cnt;
        s16b *mon_idx;
-       
+
        int column = 0;
        bool flag;
        bool redraw;
@@ -7651,11 +7692,11 @@ static void do_cmd_knowledge_monsters(void)
                {
                        Term_gotoxy(max + 3, 6 + (mon_cur - mon_top));
                }
-       
+
                ch = inkey();
 
                /* Do visual mode command if needed */
-               if (visual_mode_command(ch, &visual_list, browser_rows-1, wid - (max + 3), &attr_top, &char_left, &r_ptr->x_attr, &r_ptr->x_char)) continue;
+               if (visual_mode_command(ch, &visual_list, browser_rows-1, wid - (max + 3), &attr_top, &char_left, &r_ptr->x_attr, &r_ptr->x_char, need_redraw)) continue;
 
                switch (ch)
                {
@@ -7803,7 +7844,7 @@ static void desc_obj_fake(int k_idx)
 /*
  * Display known objects
  */
-static void do_cmd_knowledge_objects(void)
+static void do_cmd_knowledge_objects(bool *need_redraw)
 {
        int i, len, max;
        int grp_cur, grp_top, old_grp_cur;
@@ -7943,7 +7984,7 @@ static void do_cmd_knowledge_objects(void)
 
                /* Prompt */
 #ifdef JP
-               prt(format("<Êý¸þ>, 'r'¤Ç»×¤¤½Ð¤ò¸«¤ë%s%s, ESC", k_ptr->flavor ? "" : visual_list ? ", ENTER¤Ç·èÄê" : ", 'v'¤Ç¥·¥ó¥Ü¥ëÊѹ¹", (attr_idx||char_idx) ? ", 'c', 'p'¤Ç¥Ú¡¼¥¹¥È" : ", 'c'¤Ç¥³¥Ô¡¼"), hgt - 1, 0);
+               prt(format("<Êý¸þ>, 'r'¤Ç¾ÜºÙ¤ò¸«¤ë%s%s, ESC", k_ptr->flavor ? "" : visual_list ? ", ENTER¤Ç·èÄê" : ", 'v'¤Ç¥·¥ó¥Ü¥ëÊѹ¹", (attr_idx||char_idx) ? ", 'c', 'p'¤Ç¥Ú¡¼¥¹¥È" : ", 'c'¤Ç¥³¥Ô¡¼"), hgt - 1, 0);
 #else
                prt(format("<dir>, 'r' to recall%s%s, ESC", k_ptr->flavor ? "" : visual_list ? ", ENTER to accept" : ", 'v' for visuals", (attr_idx||char_idx) ? ", 'c', 'p' to paste" : ", 'c' to copy"), hgt - 1, 0);
 #endif
@@ -7970,12 +8011,12 @@ static void do_cmd_knowledge_objects(void)
                {
                        Term_gotoxy(max + 3, 6 + (object_cur - object_top));
                }
-       
+
                ch = inkey();
 
                /* Do visual mode command if needed */
                /* Symbol of objects with flavor cannot be changed */
-               if (!k_ptr->flavor && visual_mode_command(ch, &visual_list, browser_rows-1, wid - (max + 3), &attr_top, &char_left, &k_ptr->x_attr, &k_ptr->x_char)) continue;
+               if (!k_ptr->flavor && visual_mode_command(ch, &visual_list, browser_rows-1, wid - (max + 3), &attr_top, &char_left, &k_ptr->x_attr, &k_ptr->x_char, need_redraw)) continue;
 
                switch (ch)
                {
@@ -8010,14 +8051,22 @@ static void do_cmd_knowledge_objects(void)
 }
 
 
-
 /*
  * Display the features in a group.
  */
 static void display_feature_list(int col, int row, int per_page, int *feat_idx,
-       int feat_cur, int feat_top)
+       int feat_cur, int feat_top, int lighting_level)
 {
        int i;
+       int col2 = 67;
+       int col3 = 69;
+       int col4 = 71;
+
+       /* Correct columns 1 and 4 */
+       if (use_bigtile)
+       {
+               col2++; col3 += 2; col4 += 3;
+       }
 
        /* Display lines until done */
        for (i = 0; i < per_page && feat_idx[feat_top + i]; i++)
@@ -8039,11 +8088,30 @@ static void display_feature_list(int col, int row, int per_page, int *feat_idx,
                /* Hack -- visual_list mode */
                if (per_page == 1)
                {
-                       c_prt(attr, format("%02x/%02x", f_ptr->x_attr, f_ptr->x_char), row + i, 60);
+                       /* Display lighting level */
+                       c_prt(attr, format("(%s)", lighting_level_str[lighting_level]), row + i, col + 1 + strlen(f_name + f_ptr->name));
+
+                       c_prt(attr, format("%02x/%02x", f_ptr->x_attr[lighting_level], f_ptr->x_char[lighting_level]), row + i, 56);
                }
 
                /* Display symbol */
-               Term_queue_bigchar(68, row + i, f_ptr->x_attr, f_ptr->x_char, 0, 0);
+               Term_queue_bigchar(65, row + i, f_ptr->x_attr[F_LIT_STANDARD], f_ptr->x_char[F_LIT_STANDARD], 0, 0);
+
+               Term_putch(col2, row + i, TERM_SLATE, '(');
+               Term_putch(col3, row + i, TERM_SLATE, '/');
+               Term_putch(col4, row + i, TERM_SLATE, '/');
+               Term_putch(col4 + (use_bigtile ? 3 : 2), row + i, TERM_SLATE, ')');
+
+               /* Mega-hack */
+
+               /* Use lightened colour */
+               Term_queue_bigchar(col2 + 1, row + i, f_ptr->x_attr[F_LIT_LITE], f_ptr->x_char[F_LIT_LITE], 0, 0);
+
+               /* Use darkened colour */
+               Term_queue_bigchar(col3 + 1, row + i, f_ptr->x_attr[F_LIT_DARK], f_ptr->x_char[F_LIT_DARK], 0, 0);
+
+               /* Use darkly darkened colour */
+               Term_queue_bigchar(col4 + 1, row + i, f_ptr->x_attr[F_LIT_DARKDARK], f_ptr->x_char[F_LIT_DARKDARK], 0, 0);
        }
 
        /* Clear remaining lines */
@@ -8057,7 +8125,7 @@ static void display_feature_list(int col, int row, int per_page, int *feat_idx,
 /*
  * Interact with feature visuals.
  */
-static void do_cmd_knowledge_features(void)
+static void do_cmd_knowledge_features(bool *need_redraw)
 {
        int i, len, max;
        int grp_cur, grp_top, old_grp_cur;
@@ -8065,7 +8133,7 @@ static void do_cmd_knowledge_features(void)
        int grp_cnt, grp_idx[100];
        int feat_cnt;
        int *feat_idx;
-       
+
        int column = 0;
        bool flag;
        bool redraw;
@@ -8076,6 +8144,11 @@ static void do_cmd_knowledge_features(void)
        int browser_rows;
        int wid, hgt;
 
+       byte attr_old[F_LIT_MAX] = {0, 0, 0, 0};
+       byte char_old[F_LIT_MAX] = {0, 0, 0, 0};
+       byte *cur_attr_ptr, *cur_char_ptr;
+       int lighting_level = F_LIT_STANDARD;
+
        /* Get size */
        Term_get_size(&wid, &hgt);
 
@@ -8123,11 +8196,20 @@ static void do_cmd_knowledge_features(void)
                if (redraw)
                {
                        clear_from(0);
-               
+
+#ifdef JP
+                       prt("ɽ¼¨ - ÃÏ·Á", 2, 0);
+                       prt("¥°¥ë¡¼¥×", 4, 0);
+                       prt("̾Á°", 4, max + 3);
+                       if (use_bigtile) prt("ʸ»ú ( l/ d/ D)", 4, 63);
+                       else prt("ʸ»ú (l/d/D)", 4, 62);
+#else
                        prt("Visuals - features", 2, 0);
                        prt("Group", 4, 0);
                        prt("Name", 4, max + 3);
-                       prt("Sym", 4, 67);
+                       if (use_bigtile) prt("Sym ( l/ d/ D)", 4, 64);
+                       else prt("Sym (l/d/D)", 4, 63);
+#endif
 
                        for (i = 0; i < 78; i++)
                        {
@@ -8166,14 +8248,14 @@ static void do_cmd_knowledge_features(void)
                if (!visual_list)
                {
                        /* Display a list of features in the current group */
-                       display_feature_list(max + 3, 6, browser_rows, feat_idx, feat_cur, feat_top);
+                       display_feature_list(max + 3, 6, browser_rows, feat_idx, feat_cur, feat_top, F_LIT_STANDARD);
                }
                else
                {
                        feat_top = feat_cur;
 
                        /* Display a list of features in the current group */
-                       display_feature_list(max + 3, 6, 1, feat_idx, feat_cur, feat_top);
+                       display_feature_list(max + 3, 6, 1, feat_idx, feat_cur, feat_top, lighting_level);
 
                        /* Display visual list below first object */
                        display_visual_list(max + 3, 7, browser_rows-1, wid - (max + 3), attr_top, char_left);
@@ -8181,17 +8263,19 @@ static void do_cmd_knowledge_features(void)
 
                /* Prompt */
 #ifdef JP
-               prt(format("<Êý¸þ>%s%s, ESC", visual_list ? ", ENTER¤Ç·èÄê" : ", 'v'¤Ç¥·¥ó¥Ü¥ëÊѹ¹", (attr_idx||char_idx) ? ", 'c', 'p'¤Ç¥Ú¡¼¥¹¥È" : ", 'c'¤Ç¥³¥Ô¡¼"), hgt - 1, 0);
+               prt(format("<Êý¸þ>%s%s, ESC", visual_list ? ", ENTER¤Ç·èÄê, 'a'¤ÇÂоÝÌÀÅÙÊѹ¹" : ", 'v'¤Ç¥·¥ó¥Ü¥ëÊѹ¹", (attr_idx||char_idx) ? ", 'c', 'p'¤Ç¥Ú¡¼¥¹¥È" : ", 'c'¤Ç¥³¥Ô¡¼"), hgt - 1, 0);
 #else
-               prt(format("<dir>%s%s, ESC", visual_list ? ", ENTER to accept" : ", 'v' for visuals", (attr_idx||char_idx) ? ", 'c', 'p' to paste" : ", 'c' to copy"), hgt - 1, 0);
+               prt(format("<dir>%s%s, ESC", visual_list ? ", ENTER to accept, 'a' for lighting level" : ", 'v' for visuals", (attr_idx||char_idx) ? ", 'c', 'p' to paste" : ", 'c' to copy"), hgt - 1, 0);
 #endif
 
                /* Get the current feature */
                f_ptr = &f_info[feat_idx[feat_cur]];
+               cur_attr_ptr = &f_ptr->x_attr[lighting_level];
+               cur_char_ptr = &f_ptr->x_char[lighting_level];
 
                if (visual_list)
                {
-                       place_visual_list_cursor(max + 3, 7, f_ptr->x_attr, f_ptr->x_char, attr_top, char_left);
+                       place_visual_list_cursor(max + 3, 7, *cur_attr_ptr, *cur_char_ptr, attr_top, char_left);
                }
                else if (!column)
                {
@@ -8201,11 +8285,85 @@ static void do_cmd_knowledge_features(void)
                {
                        Term_gotoxy(max + 3, 6 + (feat_cur - feat_top));
                }
-       
+
                ch = inkey();
 
+               if ((ch == 'A') && visual_list)
+               {
+                       if (lighting_level <= F_LIT_STANDARD) lighting_level = F_LIT_DARKDARK;
+                       else lighting_level--;
+                       attr_top = MAX(0, (f_ptr->x_attr[lighting_level] & 0x7f) - 5);
+                       char_left = MAX(0, f_ptr->x_char[lighting_level] - 10);
+                       continue;
+               }
+
+               else if ((ch == 'a') && visual_list)
+               {
+                       if (lighting_level >= F_LIT_DARKDARK) lighting_level = F_LIT_STANDARD;
+                       else lighting_level++;
+                       attr_top = MAX(0, (f_ptr->x_attr[lighting_level] & 0x7f) - 5);
+                       char_left = MAX(0, f_ptr->x_char[lighting_level] - 10);
+                       continue;
+               }
+
                /* Do visual mode command if needed */
-               if (visual_mode_command(ch, &visual_list, browser_rows-1, wid - (max + 3), &attr_top, &char_left, &f_ptr->x_attr, &f_ptr->x_char)) continue;
+               else if (visual_mode_command(ch, &visual_list, browser_rows-1, wid - (max + 3), &attr_top, &char_left, cur_attr_ptr, cur_char_ptr, need_redraw))
+               {
+                       switch (ch)
+                       {
+                       /* Restore previous visual settings */
+                       case ESCAPE:
+                               for (i = 0; i < F_LIT_MAX; i++)
+                               {
+                                       f_ptr->x_attr[i] = attr_old[i];
+                                       f_ptr->x_char[i] = char_old[i];
+                               }
+
+                               /* Fall through */
+
+                       case '\n':
+                       case '\r':
+                               lighting_level = F_LIT_STANDARD;
+                               break;
+
+                       /* Preserve current visual settings */
+                       case 'V':
+                       case 'v':
+                               for (i = 0; i < F_LIT_MAX; i++)
+                               {
+                                       attr_old[i] = f_ptr->x_attr[i];
+                                       char_old[i] = f_ptr->x_char[i];
+                               }
+                               lighting_level = F_LIT_STANDARD;
+                               break;
+
+                       case 'C':
+                       case 'c':
+                               if (!visual_list)
+                               {
+                                       for (i = 0; i < F_LIT_MAX; i++)
+                                       {
+                                               attr_idx_feat[i] = f_ptr->x_attr[i];
+                                               char_idx_feat[i] = f_ptr->x_char[i];
+                                       }
+                               }
+                               break;
+
+                       case 'P':
+                       case 'p':
+                               if (!visual_list)
+                               {
+                                       /* Allow ATTR_DARK text */
+                                       for (i = F_LIT_NS_BEGIN; i < F_LIT_MAX; i++)
+                                       {
+                                               if (attr_idx_feat[i] || (!(char_idx_feat[i] & 0x80) && char_idx_feat[i])) f_ptr->x_attr[i] = attr_idx_feat[i];
+                                               if (char_idx_feat[i]) f_ptr->x_char[i] = char_idx_feat[i];
+                                       }
+                               }
+                               break;
+                       }
+                       continue;
+               }
 
                switch (ch)
                {
@@ -9169,16 +9327,21 @@ static void do_cmd_knowledge_autopick(void)
  */
 void do_cmd_knowledge(void)
 {
-       int i,p=0;
+       int i, p = 0;
+       bool need_redraw = FALSE;
+
        /* File type is "TEXT" */
        FILE_TYPE(FILE_TYPE_TEXT);
+
        /* Save the screen */
        screen_save();
+
        /* Interact until done */
        while (1)
        {
                /* Clear screen */
                Term_clear();
+
                /* Ask for a choice */
 #ifdef JP
                prt(format("%d/2 ¥Ú¡¼¥¸", (p+1)), 2, 65);
@@ -9190,7 +9353,8 @@ void do_cmd_knowledge(void)
 
                /* Give some choices */
 #ifdef JP
-               if (p == 0) {
+               if (p == 0)
+               {
                        prt("(1) ´ûÃΤÎÅÁÀâ¤Î¥¢¥¤¥Æ¥à                 ¤Î°ìÍ÷", 6, 5);
                        prt("(2) ´ûÃΤΥ¢¥¤¥Æ¥à                       ¤Î°ìÍ÷", 7, 5);
                        prt("(3) ´ûÃΤÎÀ¸¤­¤Æ¤¤¤ë¥æ¥Ë¡¼¥¯¡¦¥â¥ó¥¹¥¿¡¼ ¤Î°ìÍ÷", 8, 5);
@@ -9201,7 +9365,9 @@ void do_cmd_knowledge(void)
                        prt("(8) ²æ¤¬²È¤Î¥¢¥¤¥Æ¥à                     ¤Î°ìÍ÷", 13, 5);
                        prt("(9) *´ÕÄê*ºÑ¤ßÁõÈ÷¤ÎÂÑÀ­                 ¤Î°ìÍ÷", 14, 5);
                        prt("(0) ÃÏ·Á¤Îɽ¼¨Ê¸»ú/¥¿¥¤¥ë                ¤Î°ìÍ÷", 15, 5);
-               } else {
+               }
+               else
+               {
                        prt("(a) ¼«Ê¬¤Ë´Ø¤¹¤ë¾ðÊó                     ¤Î°ìÍ÷", 6, 5);
                        prt("(b) ÆÍÁ³ÊÑ°Û                             ¤Î°ìÍ÷", 7, 5);
                        prt("(c) Éð´ï¤Î·Ð¸³ÃÍ                         ¤Î°ìÍ÷", 8, 5);
@@ -9213,7 +9379,8 @@ void do_cmd_knowledge(void)
                        prt("(i) ¸½ºß¤Î¼«Æ°½¦¤¤/Ç˲õÀßÄê              ¤Î°ìÍ÷", 14, 5);
                }
 #else
-               if (p == 0) {
+               if (p == 0)
+               {
                        prt("(1) Display known artifacts", 6, 5);
                        prt("(2) Display known objects", 7, 5);
                        prt("(3) Display remaining uniques", 8, 5);
@@ -9224,7 +9391,9 @@ void do_cmd_knowledge(void)
                        prt("(8) Display home inventory", 13, 5);
                        prt("(9) Display *identified* equip.", 14, 5);
                        prt("(0) Display terrain symbols.", 15, 5);
-               } else {
+               }
+               else
+               {
                        prt("(a) Display about yourself", 6, 5);
                        prt("(b) Display mutations", 7, 5);
                        prt("(c) Display weapon proficiency", 8, 5);
@@ -9253,6 +9422,7 @@ void do_cmd_knowledge(void)
 
                /* Prompt */
                i = inkey();
+
                /* Done */
                if (i == ESCAPE) break;
                switch (i)
@@ -9265,13 +9435,13 @@ void do_cmd_knowledge(void)
                        do_cmd_knowledge_artifacts();
                        break;
                case '2': /* Objects */
-                       do_cmd_knowledge_objects();
+                       do_cmd_knowledge_objects(&need_redraw);
                        break;
                case '3': /* Uniques */
                        do_cmd_knowledge_uniques();
                        break;
                case '4': /* Monsters */
-                       do_cmd_knowledge_monsters();
+                       do_cmd_knowledge_monsters(&need_redraw);
                        break;
                case '5': /* Kill count  */
                        do_cmd_knowledge_kill_count();
@@ -9289,7 +9459,7 @@ void do_cmd_knowledge(void)
                        do_cmd_knowledge_inven();
                        break;
                case '0': /* Feature list */
-                       do_cmd_knowledge_features();
+                       do_cmd_knowledge_features(&need_redraw);
                        break;
                /* Next page */
                case 'a': /* Max stat */
@@ -9322,11 +9492,15 @@ void do_cmd_knowledge(void)
                default: /* Unknown option */
                        bell();
                }
+
                /* Flush messages */
                msg_print(NULL);
        }
+
        /* Restore the screen */
        screen_load();
+
+       if (need_redraw) do_cmd_redraw();
 }
 
 
index 22ffd2d..d6d239c 100644 (file)
@@ -1813,7 +1813,7 @@ msg_print("
                                        x = px - 8 + randint0(17);
                                        y = py - 8 + randint0(17);
 
-                                       if (!in_bounds(y,x) || (!cave_floor_bold(y,x) && (cave[y][x].feat != FEAT_TREES)) || !player_has_los_bold(y, x)) continue;
+                                       if (!in_bounds(y, x) || !have_flag(f_flags_bold(y, x), FF_MOVE) || !player_has_los_bold(y, x)) continue;
 
                                        dx = (px > x) ? (px - x) : (x - px);
                                        dy = (py > y) ? (py - y) : (y - py);
@@ -3106,7 +3106,7 @@ msg_print("
                                                x = px - 8 + randint0(17);
                                                y = py - 8 + randint0(17);
 
-                                               if (!in_bounds(y,x) || (!cave_floor_bold(y,x) && (cave[y][x].feat != FEAT_TREES)) || !player_has_los_bold(y, x)) continue;
+                                               if (!in_bounds(y, x) || !have_flag(f_flags_bold(y, x), FF_MOVE) || !player_has_los_bold(y, x)) continue;
 
                                                dx = (px > x) ? (px - x) : (x - px);
                                                dy = (py > y) ? (py - y) : (y - py);
@@ -5585,7 +5585,7 @@ bool do_riding(bool force)
                if (!cave_empty_bold2(y, x))
                {
 #ifdef JP
-msg_print("¤½¤Á¤é¤Ë¤Ï¹ß¤ê¤é¤ì¤Þ¤»¤ó¡£");
+                       msg_print("¤½¤Á¤é¤Ë¤Ï¹ß¤ê¤é¤ì¤Þ¤»¤ó¡£");
 #else
                        msg_print("You cannot go to that direction.");
 #endif
@@ -5600,29 +5600,29 @@ msg_print("
                if (p_ptr->confused)
                {
 #ifdef JP
-msg_print("º®Í𤷤Ƥ¤¤Æ¾è¤ì¤Ê¤¤¡ª");
+                       msg_print("º®Í𤷤Ƥ¤¤Æ¾è¤ì¤Ê¤¤¡ª");
 #else
                        msg_print("You are too confused!");
 #endif
                        return FALSE;
                }
-               if (!(c_ptr->m_idx))
+
+               m_ptr = &m_list[c_ptr->m_idx];
+
+               if (!c_ptr->m_idx || !m_ptr->ml)
                {
 #ifdef JP
-msg_print("¤½¤Î¾ì½ê¤Ë¤Ï¥â¥ó¥¹¥¿¡¼¤Ï¤¤¤Þ¤»¤ó¡£");
+                       msg_print("¤½¤Î¾ì½ê¤Ë¤Ï¥â¥ó¥¹¥¿¡¼¤Ï¤¤¤Þ¤»¤ó¡£");
 #else
-                       msg_print("Here is no pet.");
+                       msg_print("Here is no monster.");
 #endif
 
                        return FALSE;
                }
-
-               m_ptr = &m_list[c_ptr->m_idx];
-
                if (!is_pet(m_ptr) && !force)
                {
 #ifdef JP
-msg_print("¤½¤Î¥â¥ó¥¹¥¿¡¼¤Ï¥Ú¥Ã¥È¤Ç¤Ï¤¢¤ê¤Þ¤»¤ó¡£");
+                       msg_print("¤½¤Î¥â¥ó¥¹¥¿¡¼¤Ï¥Ú¥Ã¥È¤Ç¤Ï¤¢¤ê¤Þ¤»¤ó¡£");
 #else
                        msg_print("That monster is not a pet.");
 #endif
@@ -5632,39 +5632,31 @@ msg_print("
                if (!(r_info[m_ptr->r_idx].flags7 & RF7_RIDING))
                {
 #ifdef JP
-msg_print("¤½¤Î¥â¥ó¥¹¥¿¡¼¤Ë¤Ï¾è¤ì¤Ê¤µ¤½¤¦¤À¡£");
+                       msg_print("¤½¤Î¥â¥ó¥¹¥¿¡¼¤Ë¤Ï¾è¤ì¤Ê¤µ¤½¤¦¤À¡£");
 #else
                        msg_print("This monster doesn't seem suitable for riding.");
 #endif
 
                        return FALSE;
                }
-               if (!(p_ptr->pass_wall) && (c_ptr->feat >= FEAT_RUBBLE) && (c_ptr->feat <= FEAT_PERM_SOLID))
-               {
-#ifdef JP
-msg_print("¤½¤Î¥â¥ó¥¹¥¿¡¼¤ÏÊɤÎÃæ¤Ë¤¤¤ë¡£");
-#else
-                       msg_print("This monster is in the wall.");
-#endif
-
-                       return FALSE;
-               }
-               if ((cave[py][px].feat >= FEAT_PATTERN_START) && (cave[py][px].feat <= FEAT_PATTERN_XTRA2) && ((cave[y][x].feat < FEAT_PATTERN_START) || (cave[y][x].feat > FEAT_PATTERN_XTRA2)))
+               if (!pattern_seq(py, px, y, x))
                {
-#ifdef JP
-msg_print("¥Ñ¥¿¡¼¥ó¤Î¾å¤«¤é¤Ï¾è¤ì¤Þ¤»¤ó¡£");
-#else
-                       msg_print("You cannot ride from on Pattern.");
-#endif
-
                        return FALSE;
                }
-               if (!m_ptr->ml)
+               if (!player_can_enter(c_ptr->feat, CEM_P_CAN_ENTER_PATTERN))
                {
+                       feature_type *f_ptr = &f_info[c_ptr->feat];
 #ifdef JP
-msg_print("¤½¤Î¾ì½ê¤Ë¤Ï¥â¥ó¥¹¥¿¡¼¤Ï¤¤¤Þ¤»¤ó¡£");
+                       msg_format("¤½¤Î¥â¥ó¥¹¥¿¡¼¤Ï%s¤Î%s¤Ë¤¤¤ë¡£", f_name + f_ptr->name,
+                                  (!have_flag(f_ptr->flags, FF_MOVE) ||
+                                  (!have_flag(f_ptr->flags, FF_LOS) &&
+                                   !have_flag(f_ptr->flags, FF_TREE))) ? "Ãæ" : "¾å");
 #else
-                       msg_print("Here is no monster.");
+                       msg_format("This monster is %s the %s.",
+                                  (!have_flag(f_ptr->flags, FF_MOVE) ||
+                                  (!have_flag(f_ptr->flags, FF_LOS) &&
+                                   !have_flag(f_ptr->flags, FF_TREE))) ? "in" : "on",
+                                  f_name + f_ptr->name);
 #endif
 
                        return FALSE;
@@ -5672,7 +5664,7 @@ msg_print("
                if (r_info[m_ptr->r_idx].level > randint1((p_ptr->skill_exp[GINOU_RIDING] / 50 + p_ptr->lev / 2 + 20)))
                {
 #ifdef JP
-msg_print("¤¦¤Þ¤¯¾è¤ì¤Ê¤«¤Ã¤¿¡£");
+                       msg_print("¤¦¤Þ¤¯¾è¤ì¤Ê¤«¤Ã¤¿¡£");
 #else
                        msg_print("You failed to ride.");
 #endif
@@ -5681,13 +5673,14 @@ msg_print("
 
                        return FALSE;
                }
+
                if (m_ptr->csleep)
                {
                        char m_name[80];
                        monster_desc(m_name, m_ptr, 0);
                        m_ptr->csleep = 0;
 #ifdef JP
-msg_format("%s¤òµ¯¤³¤·¤¿¡£", m_name);
+                       msg_format("%s¤òµ¯¤³¤·¤¿¡£", m_name);
 #else
                        msg_format("You have waked %s up.", m_name);
 #endif
index 08c98d6..08c98c5 100644 (file)
@@ -5407,10 +5407,10 @@ msg_print("
                                y = py+ddy[dir];
                                x = px+ddx[dir];
                                tsuri_dir = dir;
-                               if (!(cave[y][x].feat == FEAT_DEEP_WATER) && !(cave[y][x].feat == FEAT_SHAL_WATER))
+                               if (!have_flag(f_flags_bold(y, x), FF_WATER))
                                {
 #ifdef JP
-                                       msg_print("¤½¤³¤ÏΦÃϤÀ¡£");
+                                       msg_print("¤½¤³¤Ï¿åÊդǤϤʤ¤¡£");
 #else
                                        msg_print("There is no fishing place.");
 #endif
index b1ebd12..437dac7 100644 (file)
@@ -76,7 +76,7 @@
 #define H_VER_MAJOR 1
 #define H_VER_MINOR 7
 #define H_VER_PATCH 0
-#define H_VER_EXTRA 1
+#define H_VER_EXTRA 2
 
 
 #define ANGBAND_2_8_1
  */
 #define FAKE_NAME_SIZE  40 * 1024L
 #define FAKE_TEXT_SIZE 150 * 1024L
+#define FAKE_TAG_SIZE   10 * 1024L
 
 
 /*
 #define MAX_COL_STATBAR         (-26)
 
 
+/*
+ * Number of feats we change to (Excluding default). Used in f_info.txt.
+ */
+#define MAX_FEAT_STATES         8
+
+
 /*** Terrain Feature Indexes (see "lib/edit/f_info.txt") ***/
 
 /* Nothing */
 #define MAX_WILDERNESS          12 /* Maximum wilderness index */
 
 
+/*
+ * Feature flags - should be used instead of feature indexes unless generating.
+ * Originally from UnAngband, and modified into TR-like style in Hengband
+ */
+
+
+#define FF_LOS           0
+#define FF_PROJECT       1
+#define FF_MOVE          2
+#define FF_PLACE         3
+#define FF_DROP          4
+#define FF_SECRET        5
+#define FF_NOTICE        6
+#define FF_REMEMBER      7
+#define FF_OPEN          8
+#define FF_CLOSE         9
+#define FF_BASH          10
+#define FF_SPIKE         11
+#define FF_DISARM        12
+#define FF_STORE         13
+#define FF_TUNNEL        14
+#define FF_MAY_HAVE_GOLD 15
+#define FF_HAS_GOLD      16
+#define FF_HAS_ITEM      17
+#define FF_DOOR          18
+#define FF_TRAP          19
+#define FF_STAIRS        20
+#define FF_GLYPH         21
+#define FF_LESS          22
+#define FF_MORE          23
+#define FF_AVOID_RUN     24
+#define FF_FLOOR         25
+#define FF_WALL          26
+#define FF_PERMANENT     27
+#define FF_INNER         28
+#define FF_OUTER         29
+#define FF_SOLID         30
+#define FF_HIT_TRAP      31
+
+/* #define FF_BRIDGE        32 */
+/* #define FF_RIVER         33 */
+/* #define FF_LAKE          34 */
+/* #define FF_BRIDGED       35 */
+/* #define FF_COVERED       36 */
+#define FF_GLOW          37
+#define FF_ENSECRET      38
+#define FF_WATER         39
+#define FF_LAVA          40
+#define FF_SHALLOW       41
+#define FF_DEEP          42
+/* #define FF_FILLED        43 */
+#define FF_HURT_ROCK     44
+/* #define FF_HURT_FIRE     45 */
+/* #define FF_HURT_COLD     46 */
+/* #define FF_HURT_ACID     47 */
+/* #define FF_ICE           48 */
+/* #define FF_ACID          49 */
+/* #define FF_OIL           50 */
+#define FF_MUST_FLY      51
+/* #define FF_CAN_CLIMB     52 */
+#define FF_CAN_FLY       53
+#define FF_CAN_SWIM      54
+#define FF_CAN_PASS      55
+/* #define FF_CAN_OOZE      56 */
+#define FF_CAN_DIG       57
+/* #define FF_HIDE_ITEM     58 */
+/* #define FF_HIDE_SNEAK    59 */
+/* #define FF_HIDE_SWIM     60 */
+/* #define FF_HIDE_DIG      61 */
+/* #define FF_KILL_HUGE     62 */
+/* #define FF_KILL_MOVE     63 */
+
+/* #define FF_PICK_TRAP     64 */
+/* #define FF_PICK_DOOR     65 */
+/* #define FF_ALLOC         66 */
+/* #define FF_CHEST         67 */
+/* #define FF_DROP_1D2      68 */
+/* #define FF_DROP_2D2      69 */
+/* #define FF_DROP_GOOD     70 */
+/* #define FF_DROP_GREAT    71 */
+/* #define FF_HURT_POIS     72 */
+/* #define FF_HURT_ELEC     73 */
+/* #define FF_HURT_WATER    74 */
+/* #define FF_HURT_BWATER   75 */
+/* #define FF_USE_FEAT      76 */
+/* #define FF_GET_FEAT      77 */
+/* #define FF_GROUND        78 */
+/* #define FF_OUTSIDE       79 */
+/* #define FF_EASY_HIDE     80 */
+/* #define FF_EASY_CLIMB    81 */
+/* #define FF_MUST_CLIMB    82 */
+#define FF_TREE          83
+/* #define FF_NEED_TREE     84 */
+/* #define FF_BLOOD         85 */
+/* #define FF_DUST          86 */
+/* #define FF_SLIME         87 */
+#define FF_PLANT         88
+/* #define FF_XXX2          89 */
+/* #define FF_INSTANT       90 */
+/* #define FF_EXPLODE       91 */
+/* #define FF_TIMED         92 */
+/* #define FF_ERUPT         93 */
+/* #define FF_STRIKE        94 */
+/* #define FF_SPREAD        95 */
+
+#define FF_SPECIAL       96
+#define FF_HURT_DISI     97
+#define FF_QUEST_ENTER   98
+#define FF_QUEST_EXIT    99
+#define FF_QUEST         100
+#define FF_SHAFT         101
+#define FF_MOUNTAIN      102
+#define FF_BLDG          103
+#define FF_MINOR_GLYPH   104
+#define FF_PATTERN       105
+#define FF_TOWN          106
+#define FF_ENTRANCE      107
+#define FF_MIRROR        108
+#define FF_UNPERM        109
+#define FF_TELEPORTABLE  110
+
+#define FF_FLAG_MAX      111
+#define FF_FLAG_SIZE     (1 + ((FF_FLAG_MAX - 1) / 32))
+
+/* Which features are dynamic */
+#define have_dynamic_flags(ARRAY) \
+       (!!((ARRAY)[(FF_INSTANT / 32)] & \
+           ((1UL << (FF_INSTANT % 32)) | \
+            (1UL << (FF_EXPLODE % 32)) | \
+            (1UL << (FF_TIMED % 32)) | \
+            (1UL << (FF_ERUPT % 32)) | \
+            (1UL << (FF_STRIKE % 32)) | \
+            (1UL << (FF_SPREAD % 32)))))
+
+
+/*
+ * Feature action flags
+ */
+#define FAF_DESTROY 0x01
+#define FAF_NO_DROP 0x02
+
+
+/*
+ * Player teleportation flags
+ */
+#define TELEPORT_ALLOW_DEEP      0x0001
+#define TELEPORT_ALLOW_OBJECT    0x0002
+#define TELEPORT_REQUIRE_PROJECT 0x0004
+
+
+/* Type of pattern tiles */
+#define NOT_PATTERN_TILE      -1
+#define PATTERN_TILE_START    0
+#define PATTERN_TILE_1        1
+#define PATTERN_TILE_2        2
+#define PATTERN_TILE_3        3
+#define PATTERN_TILE_4        4
+#define PATTERN_TILE_END      5
+#define PATTERN_TILE_OLD      6
+#define PATTERN_TILE_TELEPORT 7
+#define PATTERN_TILE_WRECKED  8
+
+
+/*
+ * Bit flags for the *_can_enter() and monster_can_cross_terrain()
+ */
+#define CEM_RIDING              0x0001
+#define CEM_P_CAN_ENTER_PATTERN 0x0002
+
+
+/* Lighting levels of features' attr and char */
+
+#define F_LIT_STANDARD 0 /* Standard */
+#define F_LIT_LITE     1 /* Brightly lit */
+#define F_LIT_DARK     2 /* Darkened */
+#define F_LIT_DARKDARK 3 /* Darkly darkened */
+
+#define F_LIT_NS_BEGIN 1 /* Nonstandard */
+#define F_LIT_MAX      4
+
 
 /*** Artifact indexes (see "lib/edit/a_info.txt") ***/
 
        ((C) == &cave[py][px])
 
 
+#define f_flags_bold(Y,X) \
+       (f_info[cave[(Y)][(X)].feat].flags)
+
+
+#define f_flags_grid(C) \
+       (f_info[(C)->feat].flags)
+
+
 /*
  * Determine if a "feature" is a "floor"
  */
-#define feat_floor(F) \
-       (!((F) & 0x20))
+#define feat_supports_los(F) \
+       (have_flag(f_info[(F)].flags, FF_LOS))
 
 
 /*
  * -KMW-
  */
 #define cave_floor_bold(Y,X) \
-       (feat_floor(cave[(Y)][(X)].feat))
+       (feat_supports_los(cave[(Y)][(X)].feat))
 
 
 /*
  * Determine if a "legal" grid is a "clean" floor grid
  *
- * Line 1 -- forbid non-floors
- * Line 2 -- forbid deep water -KMW-
- * Line 3 -- forbid deep lava -KMW-
+ * Line 1 -- forbid non-drops
+ * Line 2 -- forbid permanents
+ * Line 3 -- forbid object terrains
  * Line 4 -- forbid normal objects
  */
 #define cave_clean_bold(Y,X) \
-       (((cave[Y][X].feat == FEAT_FLOOR) || \
-         (cave[Y][X].feat == FEAT_SHAL_WATER) || \
-         (cave[Y][X].feat == FEAT_SHAL_LAVA) || \
-         (cave[Y][X].feat == FEAT_DEEP_GRASS) || \
-         (cave[Y][X].feat == FEAT_FLOWER) || \
-         (cave[Y][X].feat == FEAT_GRASS) || \
-         (cave[Y][X].feat == FEAT_DIRT)) && \
-         !(cave[Y][X].info & CAVE_OBJECT) && \
+       (have_flag(f_flags_bold((Y), (X)), FF_DROP) && \
+        !have_flag(f_flags_bold((Y), (X)), FF_PERMANENT) && \
+        !(cave[Y][X].info & CAVE_OBJECT) && \
          (cave[Y][X].o_idx == 0))
 
 
 /*
  * Determine if a "legal" grid is an "empty" floor grid
  *
- * Line 1 -- forbid doors, rubble, seams, walls
+ * Line 1 -- forbid non-placement grids
  * Line 2 -- forbid normal monsters
  * Line 3 -- forbid the player
  */
 #define cave_empty_bold(Y,X) \
-    (cave_floor_bold(Y,X) && \
-     !(cave[Y][X].m_idx) && \
-     !player_bold(Y,X))
+       (have_flag(f_flags_bold((Y), (X)), FF_PLACE) && \
+        !(cave[Y][X].m_idx) && \
+        !player_bold(Y,X))
 
 
 /*
  * Determine if a "legal" grid is an "empty" floor grid
  *
- * Line 1 -- forbid doors, rubble, seams, walls
- * Line 2 -- forbid normal monsters
- * Line 3 -- forbid the player
+ * Line 1 -- forbid non-placement grids
+ * Line 2 -- forbid chasms
+ * Line 3 -- allow trees while player is in dungeon
+ * Line 4 -- forbid normal monsters
+ * Line 5 -- forbid the player
  */
 #define cave_empty_bold2(Y,X) \
-    (((cave_floor_bold(Y,X) && (cave[Y][X].feat != FEAT_DARK_PIT)) || (character_dungeon && (cave[Y][X].feat == FEAT_TREES)))&& \
-     !(cave[Y][X].m_idx) && \
-     !player_bold(Y,X))
+       (((have_flag(f_flags_bold((Y), (X)), FF_PLACE) && \
+          !have_flag(f_flags_bold((Y), (X)), FF_MUST_FLY)) || \
+         (character_dungeon && have_flag(f_flags_bold((Y), (X)), FF_TREE))) && \
+        !(cave[Y][X].m_idx) && \
+        !player_bold(Y,X))
 
 
 /*
  * Determine if a "legal" grid is an "naked" floor grid
  *
- * Line 1 -- forbid non-floors, non-shallow water & lava -KMW-
- * Line 4 -- forbid normal objects
- * Line 5 -- forbid player/monsters
+ * Line 1 -- forbid non-placers
+ * Line 2 -- forbid non-droppers
+ * Line 3 -- forbid permanent
+ * Line 4 -- forbid object terrains
+ * Line 5 -- forbid normal objects
+ * Line 6 -- forbid monsters
+ * Line 7 -- forbid the player
  */
 #define cave_naked_bold(Y,X) \
-       (((cave[Y][X].feat == FEAT_FLOOR) || \
-         (cave[Y][X].feat == FEAT_SHAL_WATER) || \
-         (cave[Y][X].feat == FEAT_SHAL_LAVA) || \
-         (cave[Y][X].feat == FEAT_GRASS) || \
-         (cave[Y][X].feat == FEAT_DEEP_GRASS) || \
-         (cave[Y][X].feat == FEAT_FLOWER) || \
-         (cave[Y][X].feat == FEAT_DIRT)) && \
-         !(cave[Y][X].info & CAVE_OBJECT) && \
-         (cave[Y][X].o_idx == 0) && \
-         (cave[Y][X].m_idx == 0))
-
+       (have_flag(f_flags_bold((Y), (X)), FF_PLACE) && \
+        have_flag(f_flags_bold((Y), (X)), FF_DROP) && \
+        !have_flag(f_flags_bold((Y), (X)), FF_PERMANENT) && \
+        !(cave[Y][X].info & CAVE_OBJECT) && \
+        !(cave[Y][X].o_idx) && \
+        !(cave[Y][X].m_idx) && \
+        !player_bold(Y,X))
 
 
 /*
  * Determine if a "legal" grid is "permanent"
  *
- * Line 1   -- perma-walls
- * Line 2-3 -- stairs
- * Line 4-5 -- building doors -KMW-
- * Line 6-7 -- shop doors
+ * Line 1 -- permanent flag
  */
 #define cave_perma_bold(Y,X) \
-       (((cave[Y][X].feat >= FEAT_PERM_EXTRA) && \
-         (cave[Y][X].feat <= FEAT_PERM_SOLID)) || \
-        (cave[Y][X].feat == FEAT_LESS) || \
-        (cave[Y][X].feat == FEAT_MORE) || \
-        (cave[Y][X].feat == FEAT_ENTRANCE) || \
-        (cave[Y][X].feat == FEAT_LESS_LESS) || \
-        (cave[Y][X].feat == FEAT_MORE_MORE) || \
-        (cave[Y][X].feat == FEAT_MOUNTAIN) || \
-        ((cave[Y][X].feat >= FEAT_QUEST_ENTER) && \
-         (cave[Y][X].feat <= FEAT_QUEST_UP)) || \
-        ((cave[Y][X].feat >= FEAT_PATTERN_START) && \
-         (cave[Y][X].feat <= FEAT_PATTERN_XTRA2)) || \
-        ((cave[Y][X].feat >= FEAT_SHOP_HEAD) && \
-         (cave[Y][X].feat <= FEAT_SHOP_TAIL)) || \
-        (cave[Y][X].feat == FEAT_MUSEUM) || \
-        ((cave[Y][X].feat >= FEAT_BLDG_HEAD) && \
-         (cave[Y][X].feat <= FEAT_BLDG_TAIL)))
+       (have_flag(f_flags_bold((Y), (X)), FF_PERMANENT))
 
 
 /*
  * Grid based version of "cave_floor_bold()"
  */
 #define cave_floor_grid(C) \
-       (feat_floor((C)->feat))
+       (feat_supports_los((C)->feat))
 
 
 /*
- * Grid based version of "cave_clean_bold()"
- */
-#define cave_clean_grid(C) \
-    (((C)->feat == FEAT_FLOOR) && \
-     (!(C)->o_idx))
-
-/*
  * Grid based version of "cave_empty_bold()"
  */
 #define cave_empty_grid(C) \
-    (cave_floor_grid(C) && \
-     !((C)->m_idx) && \
-     !player_grid(C))
+       (have_flag(f_flags_grid(C), FF_PLACE) && \
+        !((C)->m_idx) && \
+        !player_grid(C))
 
-/*
- * Grid based version of "cave_empty_bold()"
- */
-#define cave_empty_grid2(C) \
-    ((cave_floor_grid(C) || ((C)->feat == FEAT_TREES)) && \
-     !((C)->m_idx) && \
-     !player_grid(C))
 
 /*
  * Grid based version of "cave_empty_bold()"
  */
-#define cave_naked_grid(C) \
-    (((C)->feat == FEAT_FLOOR) && \
-     !((C)->o_idx) && \
-     !((C)->m_idx) && \
-     !player_grid(C))
+#define cave_empty_grid2(C) \
+       ((have_flag(f_flags_grid(C), FF_PLACE) || \
+         have_flag(f_flags_grid(C), FF_TREE)) && \
+        !((C)->m_idx) && \
+        !player_grid(C))
 
 
 /*
  * Grid based version of "cave_perma_bold()"
  */
 #define cave_perma_grid(C) \
-       ((((C)->feat >= FEAT_PERM_EXTRA) && \
-         ((C)->feat <= FEAT_PERM_SOLID)) || \
-        ((C)->feat == FEAT_LESS) || \
-        ((C)->feat == FEAT_MORE) || \
-        ((C)->feat == FEAT_ENTRANCE) || \
-        ((C)->feat == FEAT_LESS_LESS) || \
-        ((C)->feat == FEAT_MORE_MORE) || \
-        ((C)->feat == FEAT_MOUNTAIN) || \
-        (((C)->feat >= FEAT_QUEST_ENTER) && \
-         ((C)->feat <= FEAT_QUEST_UP)) || \
-        (((C)->feat >= FEAT_PATTERN_START) && \
-         ((C)->feat <= FEAT_PATTERN_XTRA2)) || \
-        (((C)->feat >= FEAT_SHOP_HEAD) && \
-         ((C)->feat <= FEAT_SHOP_TAIL)) || \
-        ((C)->feat == FEAT_MUSEUM) || \
-        (((C)->feat >= FEAT_BLDG_HEAD) && \
-         ((C)->feat <= FEAT_BLDG_TAIL)))
+       (have_flag(f_flags_grid(C), FF_PERMANENT))
 
 
 #define pattern_tile(Y,X) \
-     ((cave[Y][X].feat <= FEAT_PATTERN_XTRA2) && (cave[Y][X].feat >= FEAT_PATTERN_START))
+       (have_flag(f_flags_bold((Y), (X)), FF_PATTERN))
 
 /*
  * Does the grid stop disintegration?
  */
 #define cave_stop_disintegration(Y,X) \
-       (((cave[Y][X].feat >= FEAT_PERM_EXTRA) && \
-         (cave[Y][X].feat <= FEAT_PERM_SOLID)) || \
-         (cave[Y][X].feat == FEAT_MOUNTAIN) || \
-        ((cave[Y][X].feat >= FEAT_SHOP_HEAD) && \
-         (cave[Y][X].feat <= FEAT_SHOP_TAIL)) || \
-        ((cave[Y][X].feat >= FEAT_BLDG_HEAD) && \
-         (cave[Y][X].feat <= FEAT_BLDG_TAIL)) || \
-         (cave[Y][X].feat == FEAT_MUSEUM))
+       (!have_flag(f_flags_bold((Y), (X)), FF_PROJECT) && \
+        have_flag(f_flags_bold((Y), (X)), FF_PERMANENT))
 
 
 /*
  * Determine if a "boundary" grid is "floor mimic"
  */
 #define boundary_floor_bold(Y,X) \
-       ((cave[(Y)][(X)].feat == FEAT_PERM_SOLID) && \
-         cave[(Y)][(X)].mimic && feat_floor(cave[(Y)][(X)].mimic))
+       (have_flag(f_flags_bold((Y), (X)), FF_WALL) && \
+        have_flag(f_flags_bold((Y), (X)), FF_PERMANENT) && \
+        cave[(Y)][(X)].mimic && feat_supports_los(cave[(Y)][(X)].mimic))
 
 #define boundary_floor_grid(C) \
-       (((C)->feat == FEAT_PERM_SOLID) && \
-         (C)->mimic && feat_floor((C)->mimic))
+       (have_flag(f_flags_grid(C), FF_WALL) && \
+        have_flag(f_flags_grid(C), FF_PERMANENT) && \
+        (C)->mimic && feat_supports_los((C)->mimic))
 
 /*
  * Get feature mimic from f_info[] (applying "mimic" field)
@@ -4382,6 +4523,12 @@ extern int PlayerUID;
 #define TERM_L_UMBER            15  /* 'U' */   /* 3,2,1 */
 
 
+/*
+ * Not using graphical tiles for this feature?
+ */
+#define is_ascii_graphics(A) (!((A) & 0x80))
+
+
 /*** Sound constants ***/
 
 
index 9fe36cc..9cc460d 100644 (file)
@@ -590,7 +590,7 @@ static void pattern_teleport(void)
 
        /* Ask for level */
 #ifdef JP
-if (get_check("¾¤Î³¬¤Ë¥Æ¥ì¥Ý¡¼¥È¤·¤Þ¤¹¤«¡©"))
+       if (get_check("¾¤Î³¬¤Ë¥Æ¥ì¥Ý¡¼¥È¤·¤Þ¤¹¤«¡©"))
 #else
        if (get_check("Teleport level? "))
 #endif
@@ -619,7 +619,7 @@ if (get_check("¾
 
                /* Prompt */
 #ifdef JP
-sprintf(ppp, "¥Æ¥ì¥Ý¡¼¥ÈÀè:(%d-%d)", min_level, max_level);
+               sprintf(ppp, "¥Æ¥ì¥Ý¡¼¥ÈÀè:(%d-%d)", min_level, max_level);
 #else
                sprintf(ppp, "Teleport to level (%d-%d): ", min_level, max_level);
 #endif
@@ -635,7 +635,7 @@ sprintf(ppp, "
                command_arg = atoi(tmp_val);
        }
 #ifdef JP
-else if (get_check("Ä̾ï¥Æ¥ì¥Ý¡¼¥È¡©"))
+       else if (get_check("Ä̾ï¥Æ¥ì¥Ý¡¼¥È¡©"))
 #else
        else if (get_check("Normal teleport? "))
 #endif
@@ -657,7 +657,7 @@ else if (get_check("
 
        /* Accept request */
 #ifdef JP
-msg_format("%d ³¬¤Ë¥Æ¥ì¥Ý¡¼¥È¤·¤Þ¤·¤¿¡£", command_arg);
+       msg_format("%d ³¬¤Ë¥Æ¥ì¥Ý¡¼¥È¤·¤Þ¤·¤¿¡£", command_arg);
 #else
        msg_format("You teleport to dungeon level %d.", command_arg);
 #endif
@@ -689,22 +689,22 @@ msg_format("%d 
 static void wreck_the_pattern(void)
 {
        int to_ruin = 0, r_y, r_x;
+       int pattern_type = f_info[cave[py][px].feat].power;
 
-       if (cave[py][px].feat == FEAT_PATTERN_XTRA2)
+       if (pattern_type == PATTERN_TILE_WRECKED)
        {
                /* Ruined already */
                return;
        }
 
 #ifdef JP
-msg_print("¥Ñ¥¿¡¼¥ó¤ò·ì¤Ç±ø¤·¤Æ¤·¤Þ¤Ã¤¿¡ª");
-msg_print("²¿¤«¶²¤í¤·¤¤»ö¤¬µ¯¤³¤Ã¤¿¡ª");
+       msg_print("¥Ñ¥¿¡¼¥ó¤ò·ì¤Ç±ø¤·¤Æ¤·¤Þ¤Ã¤¿¡ª");
+       msg_print("²¿¤«¶²¤í¤·¤¤»ö¤¬µ¯¤³¤Ã¤¿¡ª");
 #else
        msg_print("You bleed on the Pattern!");
        msg_print("Something terrible happens!");
 #endif
 
-
        if (!IS_INVULN())
 #ifdef JP
                take_hit(DAMAGE_NOESCAPE, damroll(10, 8), "¥Ñ¥¿¡¼¥ó»²õ", -1);
@@ -712,15 +712,14 @@ msg_print("
                take_hit(DAMAGE_NOESCAPE, damroll(10, 8), "corrupting the Pattern", -1);
 #endif
 
-
        to_ruin = randint1(45) + 35;
 
        while (to_ruin--)
        {
                scatter(&r_y, &r_x, py, px, 4, 0);
 
-               if ((cave[r_y][r_x].feat >= FEAT_PATTERN_START) &&
-                   (cave[r_y][r_x].feat < FEAT_PATTERN_XTRA2))
+               if (pattern_tile(r_y, r_x) &&
+                   (f_info[cave[r_y][r_x].feat].power != PATTERN_TILE_WRECKED))
                {
                        cave_set_feat(r_y, r_x, FEAT_PATTERN_XTRA2);
                }
@@ -733,9 +732,9 @@ msg_print("
 /* Returns TRUE if we are on the Pattern... */
 static bool pattern_effect(void)
 {
-       if ((cave[py][px].feat < FEAT_PATTERN_START) ||
-           (cave[py][px].feat > FEAT_PATTERN_XTRA2))
-               return FALSE;
+       int pattern_type;
+
+       if (!pattern_tile(py, px)) return FALSE;
 
        if ((prace_is_(RACE_AMBERITE)) &&
            (p_ptr->cut > 0) && one_in_(10))
@@ -743,8 +742,11 @@ static bool pattern_effect(void)
                wreck_the_pattern();
        }
 
-       if (cave[py][px].feat == FEAT_PATTERN_END)
+       pattern_type = f_info[cave[py][px].feat].power;
+
+       switch (pattern_type)
        {
+       case PATTERN_TILE_END:
                (void)set_poisoned(0);
                (void)set_image(0);
                (void)set_stun(0);
@@ -759,44 +761,42 @@ static bool pattern_effect(void)
                (void)do_res_stat(A_CHR);
                (void)restore_level();
                (void)hp_player(1000);
+
                cave_set_feat(py, px, FEAT_PATTERN_OLD);
+
 #ifdef JP
-msg_print("¡Ö¥Ñ¥¿¡¼¥ó¡×¤Î¤³¤ÎÉôʬ¤Ï¾¤ÎÉôʬ¤è¤ê¶¯ÎϤǤʤ¤¤è¤¦¤À¡£");
+               msg_print("¡Ö¥Ñ¥¿¡¼¥ó¡×¤Î¤³¤ÎÉôʬ¤Ï¾¤ÎÉôʬ¤è¤ê¶¯ÎϤǤʤ¤¤è¤¦¤À¡£");
 #else
                msg_print("This section of the Pattern looks less powerful.");
 #endif
 
-       }
-
-
-       /*
-        * We could make the healing effect of the
-        * Pattern center one-time only to avoid various kinds
-        * of abuse, like luring the win monster into fighting you
-        * in the middle of the pattern...
-        */
+               /*
+                * We could make the healing effect of the
+                * Pattern center one-time only to avoid various kinds
+                * of abuse, like luring the win monster into fighting you
+                * in the middle of the pattern...
+                */
+               break;
 
-       else if (cave[py][px].feat == FEAT_PATTERN_OLD)
-       {
+       case PATTERN_TILE_OLD:
                /* No effect */
-       }
-       else if (cave[py][px].feat == FEAT_PATTERN_XTRA1)
-       {
+               break;
+
+       case PATTERN_TILE_TELEPORT:
                pattern_teleport();
-       }
-       else if (cave[py][px].feat == FEAT_PATTERN_XTRA2)
-       {
+               break;
+
+       case PATTERN_TILE_WRECKED:
                if (!IS_INVULN())
 #ifdef JP
                        take_hit(DAMAGE_NOESCAPE, 200, "²õ¤ì¤¿¡Ö¥Ñ¥¿¡¼¥ó¡×¤òÊ⤤¤¿¥À¥á¡¼¥¸", -1);
 #else
                        take_hit(DAMAGE_NOESCAPE, 200, "walking the corrupted Pattern", -1);
 #endif
+               break;
 
-       }
-       else
-       {
-               if ((prace_is_(RACE_AMBERITE)) && !one_in_(2))
+       default:
+               if (prace_is_(RACE_AMBERITE) && !one_in_(2))
                        return TRUE;
                else if (!IS_INVULN())
 #ifdef JP
@@ -804,7 +804,7 @@ msg_print("
 #else
                        take_hit(DAMAGE_NOESCAPE, damroll(1, 3), "walking the Pattern", -1);
 #endif
-
+               break;
        }
 
        return TRUE;
@@ -1891,6 +1891,7 @@ static void process_world(void)
        bool cave_no_regen = FALSE;
        int upkeep_factor = 0;
        cave_type *c_ptr;
+       feature_type *f_ptr;
        object_type *o_ptr;
        int temp;
        object_kind *k_ptr;
@@ -1925,7 +1926,6 @@ static void process_world(void)
 
        if (p_ptr->inside_battle && !p_ptr->leaving)
        {
-
                int i2, j2;
                int win_m_idx = 0;
                int number_mon = 0;
@@ -1933,16 +1933,20 @@ static void process_world(void)
                /* Count all hostile monsters */
                for (i2 = 0; i2 < cur_wid; ++i2)
                        for (j2 = 0; j2 < cur_hgt; j2++)
-                               if ((cave[j2][i2].m_idx > 0) && (cave[j2][i2].m_idx != p_ptr->riding))
+                       {
+                               c_ptr = &cave[j2][i2];
+
+                               if ((c_ptr->m_idx > 0) && (c_ptr->m_idx != p_ptr->riding))
                                {
                                        number_mon++;
-                                       win_m_idx = cave[j2][i2].m_idx;
+                                       win_m_idx = c_ptr->m_idx;
                                }
+                       }
 
                if (number_mon == 0)
                {
 #ifdef JP
-msg_print("ÁêÂǤÁ¤Ë½ª¤ï¤ê¤Þ¤·¤¿¡£");
+                       msg_print("ÁêÂǤÁ¤Ë½ª¤ï¤ê¤Þ¤·¤¿¡£");
 #else
                        msg_print("They have kill each other at the same time.");
 #endif
@@ -1959,7 +1963,7 @@ msg_print("
 
                        monster_desc(m_name, wm_ptr, 0);
 #ifdef JP
-msg_format("%s¤¬¾¡Íø¤·¤¿¡ª", m_name);
+                       msg_format("%s¤¬¾¡Íø¤·¤¿¡ª", m_name);
 #else
                        msg_format("%s is winner!", m_name);
 #endif
@@ -1968,21 +1972,21 @@ msg_format("%s
                        if (win_m_idx == (sel_monster+1))
                        {
 #ifdef JP
-msg_print("¤ª¤á¤Ç¤È¤¦¤´¤¶¤¤¤Þ¤¹¡£");
+                               msg_print("¤ª¤á¤Ç¤È¤¦¤´¤¶¤¤¤Þ¤¹¡£");
 #else
                                msg_print("Congratulations.");
 #endif
 #ifdef JP
-msg_format("%d¡ð¤ò¼õ¤±¼è¤Ã¤¿¡£", battle_odds);
+                               msg_format("%d¡ð¤ò¼õ¤±¼è¤Ã¤¿¡£", battle_odds);
 #else
                                msg_format("You received %d gold.", battle_odds);
 #endif
-                       p_ptr->au += battle_odds;
+                               p_ptr->au += battle_odds;
                        }
                        else
                        {
 #ifdef JP
-msg_print("»ÄÇ°¤Ç¤·¤¿¡£");
+                               msg_print("»ÄÇ°¤Ç¤·¤¿¡£");
 #else
                                msg_print("You lost gold.");
 #endif
@@ -1994,7 +1998,7 @@ msg_print("
                else if(turn - old_turn == 150*TURNS_PER_TICK)
                {
 #ifdef JP
-msg_print("¿½¤·Ê¬¤±¤¢¤ê¤Þ¤»¤ó¤¬¡¢¤³¤Î¾¡Éé¤Ï°ú¤­Ê¬¤±¤È¤µ¤»¤Æ¤¤¤¿¤À¤­¤Þ¤¹¡£");
+                       msg_print("¿½¤·Ê¬¤±¤¢¤ê¤Þ¤»¤ó¤¬¡¢¤³¤Î¾¡Éé¤Ï°ú¤­Ê¬¤±¤È¤µ¤»¤Æ¤¤¤¿¤À¤­¤Þ¤¹¡£");
 #else
                        msg_format("This battle have ended in a draw.");
 #endif
@@ -2117,8 +2121,6 @@ msg_print("
                        /* Night falls */
                        else
                        {
-                               byte feat;
-
                                /* Message */
 #ifdef JP
                                msg_print("Æü¤¬ÄÀ¤ó¤À¡£");
@@ -2135,14 +2137,15 @@ msg_print("
                                                c_ptr = &cave[y][x];
 
                                                /* Feature code (applying "mimic" field) */
-                                               feat = get_feat_mimic(c_ptr);
+                                               f_ptr = &f_info[get_feat_mimic(c_ptr)];
 
-                                               if (!is_mirror_grid(c_ptr) && (feat != FEAT_QUEST_ENTER) && (feat != FEAT_ENTRANCE))
+                                               if (!is_mirror_grid(c_ptr) && !have_flag(f_ptr->flags, FF_QUEST_ENTER) &&
+                                                   !have_flag(f_ptr->flags, FF_ENTRANCE))
                                                {
                                                        /* Assume dark */
                                                        c_ptr->info &= ~(CAVE_GLOW);
 
-                                                       if ((feat <= FEAT_INVIS) || (feat == FEAT_DIRT) || (feat == FEAT_GRASS))
+                                                       if (!have_flag(f_ptr->flags, FF_REMEMBER))
                                                        {
                                                                /* Forget the normal floor grid */
                                                                c_ptr->info &= ~(CAVE_MARK);
@@ -2182,22 +2185,41 @@ msg_print("
                        {
                                int n;
 
-                               /* Pick a random shop (except home) */
+                               /* Pick a random shop (except home and museum) */
                                do
                                {
                                        n = randint0(MAX_STORES);
                                }
                                while ((n == STORE_HOME) || (n == STORE_MUSEUM));
 
-                               /* Message */
+                               /* Check every feature */
+                               for (i = 1; i < max_f_idx; i++)
+                               {
+                                       /* Access the index */
+                                       f_ptr = &f_info[i];
+
+                                       /* Skip empty index */
+                                       if (!f_ptr->name) continue;
+
+                                       /* Skip non-store features */
+                                       if (!have_flag(f_ptr->flags, FF_STORE)) continue;
+
+                                       /* Verify store type */
+                                       if (f_ptr->power == n)
+                                       {
+                                               /* Message */
 #ifdef JP
-                               if (cheat_xtra) msg_format("%s¤ÎŹ¼ç¤ò¥·¥ã¥Ã¥Õ¥ë¤·¤Þ¤¹¡£", f_name + f_info[FEAT_SHOP_HEAD + n].name);
+                                               if (cheat_xtra) msg_format("%s¤ÎŹ¼ç¤ò¥·¥ã¥Ã¥Õ¥ë¤·¤Þ¤¹¡£", f_name + f_ptr->name);
 #else
-                               if (cheat_xtra) msg_format("Shuffle a Shopkeeper of %s.", f_name + f_info[FEAT_SHOP_HEAD + n].name);
+                                               if (cheat_xtra) msg_format("Shuffle a Shopkeeper of %s.", f_name + f_ptr->name);
 #endif
 
-                               /* Shuffle it */
-                               store_shuffle(n);
+                                               /* Shuffle it */
+                                               store_shuffle(n);
+
+                                               break;
+                                       }
+                               }
                        }
                }
        }
@@ -2288,86 +2310,64 @@ sprintf(ouch, "%s
                }
        }
 
-       if ((cave[py][px].feat == FEAT_SHAL_LAVA) &&
-               !IS_INVULN() && !p_ptr->immune_fire && !p_ptr->ffall)
-       {
-               int damage = 3000 + randint0(2000);
+       f_ptr = &f_info[cave[py][px].feat];
 
-               if (prace_is_(RACE_ENT)) damage += damage/3;
-               if (p_ptr->resist_fire) damage = damage / 3;
-               if (IS_OPPOSE_FIRE()) damage = damage / 3;
-               damage = damage / 100 + (randint0(100) < (damage % 100));
+       if (have_flag(f_ptr->flags, FF_LAVA) && !IS_INVULN() && !p_ptr->immune_fire)
+       {
+               int damage = 0;
 
-               if (damage)
+               if (have_flag(f_ptr->flags, FF_DEEP))
                {
-                       /* Take damage */
-#ifdef JP
-msg_print("ÍÏ´ä¤Ç²Ð½ý¤·¤¿¡ª");
-take_hit(DAMAGE_NOESCAPE, damage, "Àõ¤¤ÍÏ´äή", -1);
-#else
-                       msg_print("The lava burns you!");
-                       take_hit(DAMAGE_NOESCAPE, damage, "shallow lava", -1);
-#endif
-
-                       cave_no_regen = TRUE;
+                       damage = 6000 + randint0(4000);
+               }
+               else if (!p_ptr->ffall)
+               {
+                       damage = 3000 + randint0(2000);
                }
-       }
-
-       else if ((cave[py][px].feat == FEAT_DEEP_LAVA) &&
-               !IS_INVULN() && !p_ptr->immune_fire)
-       {
-               int damage = 6000 + randint0(4000);
 
-               cptr message;
-               cptr hit_from;
+               if (damage)
+               {
+                       if (prace_is_(RACE_ENT)) damage += damage / 3;
+                       if (p_ptr->resist_fire) damage = damage / 3;
+                       if (IS_OPPOSE_FIRE()) damage = damage / 3;
 
-               if (p_ptr->resist_fire) damage = damage / 3;
-               if (IS_OPPOSE_FIRE()) damage = damage / 3;
+                       if (p_ptr->ffall) damage = damage / 5;
 
-               if (p_ptr->ffall)
-               {
-                       damage = damage / 5;
+                       damage = damage / 100 + (randint0(100) < (damage % 100));
 
+                       if (p_ptr->ffall)
+                       {
 #ifdef JP
-message = "Ç®¤Ç²Ð½ý¤·¤¿¡ª";
-hit_from = "¿¼¤¤ÍÏ´äή¤Î¾å¤ËÉâÍ·¤·¤¿¥À¥á¡¼¥¸";
+                               msg_print("Ç®¤Ç²Ð½ý¤·¤¿¡ª");
+                               take_hit(DAMAGE_NOESCAPE, damage, format("%s¤Î¾å¤ËÉâÍ·¤·¤¿¥À¥á¡¼¥¸", f_name + f_ptr->name), -1);
 #else
-                       message = "The heat burns you!";
-                       hit_from = "flying over deep lava";
+                               msg_print("The heat burns you!");
+                               take_hit(DAMAGE_NOESCAPE, damage, format("flying over %s", f_name + f_ptr->name), -1);
 #endif
-
-               }
-               else
-               {
+                       }
+                       else
+                       {
 #ifdef JP
-message = "ÍÏ´ä¤Ç²Ð½ý¤·¤¿¡ª";
-hit_from = "¿¼¤¤ÍÏ´äή";
+                               msg_format("%s¤Ç²Ð½ý¤·¤¿¡ª", f_name + f_ptr->name);
 #else
-                       message = "The lava burns you!";
-                       hit_from = "deep lava";
+                               msg_format("The %s burns you!", f_name + f_ptr->name);
 #endif
-
-               }
-
-               damage = damage / 100 + (randint0(100) < (damage % 100));
-               if (damage)
-               {
-                       /* Take damage */
-                       msg_print(message);
-                       take_hit(DAMAGE_NOESCAPE, damage, hit_from, -1);
+                               take_hit(DAMAGE_NOESCAPE, damage, f_name + f_ptr->name, -1);
+                       }
 
                        cave_no_regen = TRUE;
                }
        }
 
-       else if ((cave[py][px].feat == FEAT_DEEP_WATER) && !p_ptr->ffall && !p_ptr->can_swim)
+       if (have_flag(f_ptr->flags, FF_WATER) && have_flag(f_ptr->flags, FF_DEEP) &&
+           !p_ptr->ffall && !p_ptr->can_swim)
        {
                if (p_ptr->total_weight > (((u32b)adj_str_wgt[p_ptr->stat_ind[A_STR]] * (p_ptr->pclass == CLASS_BERSERKER ? 150 : 100)) / 2))
                {
                        /* Take damage */
 #ifdef JP
-msg_print("Å®¤ì¤Æ¤¤¤ë¡ª");
-take_hit(DAMAGE_NOESCAPE, randint1(p_ptr->lev), "Å®¤ì", -1);
+                       msg_print("Å®¤ì¤Æ¤¤¤ë¡ª");
+                       take_hit(DAMAGE_NOESCAPE, randint1(p_ptr->lev), "Å®¤ì", -1);
 #else
                        msg_print("You are drowning!");
                        take_hit(DAMAGE_NOESCAPE, randint1(p_ptr->lev), "drowning", -1);
@@ -2430,10 +2430,10 @@ take_hit(DAMAGE_NOESCAPE, damage, "
         * reduced below 0 hp by being inside a stone wall; others
         * WILL BE!
         */
-       if (!cave_floor_bold(py, px))
+       if (!have_flag(f_ptr->flags, FF_MOVE))
        {
                /* Player can walk through trees */
-               if ((cave[py][px].feat == FEAT_TREES) || ((cave[py][px].feat == FEAT_MOUNTAIN) && !dun_level && p_ptr->ffall))
+               if (have_flag(f_ptr->flags, FF_MOUNTAIN) && !dun_level && p_ptr->ffall)
                {
                        /* Do nothing */
                }
@@ -2447,24 +2447,22 @@ take_hit(DAMAGE_NOESCAPE, damage, "
                        if (p_ptr->pass_wall)
                        {
 #ifdef JP
-msg_print("ÂΤÎʬ»Ò¤¬Ê¬²ò¤·¤¿µ¤¤¬¤¹¤ë¡ª");
-dam_desc = "Ì©ÅÙ";
+                               msg_print("ÂΤÎʬ»Ò¤¬Ê¬²ò¤·¤¿µ¤¤¬¤¹¤ë¡ª");
+                               dam_desc = "Ì©ÅÙ";
 #else
                                msg_print("Your molecules feel disrupted!");
                                dam_desc = "density";
 #endif
-
                        }
                        else
                        {
 #ifdef JP
-msg_print("Êø¤ì¤¿´ä¤Ë²¡¤·ÄÙ¤µ¤ì¤¿¡ª");
-dam_desc = "¹Å¤¤´ä";
+                               msg_print("Êø¤ì¤¿´ä¤Ë²¡¤·ÄÙ¤µ¤ì¤¿¡ª");
+                               dam_desc = "¹Å¤¤´ä";
 #else
                                msg_print("You are being crushed!");
                                dam_desc = "solid rock";
 #endif
-
                        }
 
                        take_hit(DAMAGE_NOESCAPE, 1 + (p_ptr->lev / 5), dam_desc, -1);
@@ -2799,8 +2797,9 @@ msg_print("
        /* Regenerate Hit Points if needed */
        if ((p_ptr->chp < p_ptr->mhp) && !cave_no_regen)
        {
-               if ((cave[py][px].feat < FEAT_PATTERN_END) &&
-                   (cave[py][px].feat >= FEAT_PATTERN_START))
+               f_ptr = &f_info[cave[py][px].feat];
+
+               if (have_flag(f_ptr->flags, FF_PATTERN) && (f_ptr->power <= PATTERN_TILE_4))
                {
                        regenhp(regen_amount / 5); /* Hmmm. this should never happen? */
                }
index 693c068..6b7e9c4 100644 (file)
@@ -108,7 +108,7 @@ extern cptr game_inscriptions[];
 extern kamae kamae_shurui[MAX_KAMAE];
 extern kamae kata_shurui[MAX_KATA];
 extern cptr exp_level_str[5];
-extern byte conv_terrain2feat[MAX_WILDERNESS];
+extern s16b conv_terrain2feat[MAX_WILDERNESS];
 extern cptr silly_attacks[MAX_SILLY_ATTACK];
 #ifdef JP
 extern cptr silly_attacks2[MAX_SILLY_ATTACK];
@@ -117,6 +117,7 @@ extern monster_power monster_powers[MAX_MONSPELLS];
 extern cptr monster_powers_short[MAX_MONSPELLS];
 extern cptr ident_info[];
 extern mbe_info_type mbe_info[];
+extern byte feature_action_flags[FF_FLAG_MAX];
 
 /* variable.c */
 extern cptr copyright[5];
@@ -254,7 +255,6 @@ extern bool view_yellow_lite;   /* Use special colors for torch-lit grids */
 extern bool view_bright_lite;   /* Use special colors for 'viewable' grids */
 extern bool view_granite_lite;   /* Use special colors for wall grids (slow) */
 extern bool view_special_lite;   /* Use special colors for floor grids (slow) */
-extern bool new_ascii_graphics;   /* Show a clear contrast between light and dark */
 extern bool display_path;   /* Display actual path before shooting */
 extern bool always_show_list;   /* Always show list at first when select items */
 extern bool abbrev_extra;   /* Describe obj's extra resistances by abbreviation */
@@ -467,6 +467,7 @@ extern skill_table *s_info;
 extern player_magic *m_info;
 extern feature_type *f_info;
 extern char *f_name;
+extern char *f_tag;
 extern object_kind *k_info;
 extern char *k_name;
 extern char *k_text;
@@ -573,10 +574,10 @@ extern bool generate_encounter;
 extern cptr screen_dump;
 extern byte dungeon_type;
 extern s16b *max_dlv;
-extern byte feat_wall_outer;
-extern byte feat_wall_inner;
-extern byte feat_wall_solid;
-extern byte floor_type[100], fill_type[100];
+extern s16b feat_wall_outer;
+extern s16b feat_wall_inner;
+extern s16b feat_wall_solid;
+extern s16b floor_type[100], fill_type[100];
 extern bool now_damaged;
 extern s16b now_message;
 extern bool use_menu;
@@ -612,6 +613,7 @@ extern bool player_can_see_bold(int y, int x);
 extern bool cave_valid_bold(int y, int x);
 extern bool cave_valid_grid(cave_type *c_ptr);
 extern bool no_lite(void);
+extern byte lighting_colours[16][2];
 extern void map_info(int y, int x, byte *ap, char *cp, byte *tap, char *tcp);
 extern void move_cursor_relative(int row, int col);
 extern void print_rel(char c, byte a, int y, int x);
@@ -636,6 +638,8 @@ extern void map_area(int range);
 extern void wiz_lite(bool ninja);
 extern void wiz_dark(void);
 extern void cave_set_feat(int y, int x, int feat);
+extern int feat_state(int feat, int action);
+extern void cave_alter_feat(int y, int x, int action);
 extern void remove_mirror(int y, int x);
 extern bool is_mirror_grid(cave_type *c_ptr);
 extern bool is_glyph_grid(cave_type *c_ptr);
@@ -659,7 +663,8 @@ extern void search(void);
 extern void py_pickup_aux(int o_idx);
 extern void carry(int pickup);
 extern bool py_attack(int y, int x, int mode);
-extern bool player_can_enter(byte feature);
+extern bool pattern_seq(int c_y, int c_x, int n_y, int n_x);
+extern bool player_can_enter(s16b feature, u16b mode);
 extern void move_player(int dir, int do_pickup, bool break_trap);
 extern void run_step(int dir);
 
@@ -875,8 +880,8 @@ extern void set_friendly(monster_type *m_ptr);
 extern void set_pet(monster_type *m_ptr);
 extern void set_hostile(monster_type *m_ptr);
 extern void anger_monster(monster_type *m_ptr);
-extern bool monster_can_cross_terrain(byte feat, monster_race *r_ptr);
-extern bool monster_can_enter(int y, int x, monster_race *r_ptr);
+extern bool monster_can_cross_terrain(s16b feat, monster_race *r_ptr, u16b mode);
+extern bool monster_can_enter(int y, int x, monster_race *r_ptr, u16b mode);
 extern bool are_enemies(monster_type *m_ptr1, monster_type *m_ptr2);
 extern bool monster_has_hostile_align(monster_type *m_ptr, int pa_good, int pa_evil, monster_race *r_ptr);
 extern bool monster_living(monster_race *r_ptr);
@@ -970,7 +975,7 @@ extern bool make_gold(object_type *j_ptr);
 extern void place_gold(int y, int x);
 extern s16b drop_near(object_type *o_ptr, int chance, int y, int x);
 extern void acquirement(int y1, int x1, int num, bool great, bool known);
-extern byte choose_random_trap(void);
+extern s16b choose_random_trap(void);
 extern void disclose_grid(int y, int x);
 extern void place_trap(int y, int x);
 extern void inven_item_charges(int item);
@@ -1126,6 +1131,7 @@ extern void remove_all_mirrors(bool explode);
 /* spells3.c */
 extern bool teleport_away(int m_idx, int dis, bool dec_valour);
 extern void teleport_monster_to(int m_idx, int ty, int tx, int power);
+extern bool cave_teleportable_bold(int y, int x, u16b mode);
 extern void teleport_player(int dis);
 extern void teleport_player_to(int ny, int nx, bool no_tele);
 extern void teleport_level(int m_idx);
index ab1333d..a2d45eb 100644 (file)
@@ -433,7 +433,7 @@ errr process_pref_file_command(char *buf)
                        n2 = strtol(zz[2], NULL, 0);
                        if (i >= max_r_idx) return 1;
                        r_ptr = &r_info[i];
-                       if (n1) r_ptr->x_attr = n1;
+                       if (n1 || (!(n2 & 0x80) && n2)) r_ptr->x_attr = n1; /* Allow ATTR_DARK text */
                        if (n2) r_ptr->x_char = n2;
                        return 0;
                }
@@ -449,27 +449,75 @@ errr process_pref_file_command(char *buf)
                        n2 = strtol(zz[2], NULL, 0);
                        if (i >= max_k_idx) return 1;
                        k_ptr = &k_info[i];
-                       if (n1) k_ptr->x_attr = n1;
+                       if (n1 || (!(n2 & 0x80) && n2)) k_ptr->x_attr = n1; /* Allow ATTR_DARK text */
                        if (n2) k_ptr->x_char = n2;
                        return 0;
                }
                break;
 
        /* Process "F:<num>:<a>/<c>" -- attr/char for terrain features */
+       /* "F:<num>:<a>/<c>" */
+       /* "F:<num>:<a>/<c>:LIT" */
+       /* "F:<num>:<a>/<c>:<la>/<lc>:<da>/<dc>:<Da>/<Dc>" */
        case 'F':
-               if (tokenize(buf+2, 3, zz, TOKENIZE_CHECKQUOTE) == 3)
                {
                        feature_type *f_ptr;
+                       int num = tokenize(buf + 2, 9, zz, TOKENIZE_CHECKQUOTE);
+
+                       if ((num != 3) && (num != 4) && (num != 9)) return 1;
+                       else if ((num == 4) && !streq(zz[3], "LIT")) return 1;
+
                        i = (huge)strtol(zz[0], NULL, 0);
-                       n1 = strtol(zz[1], NULL, 0);
-                       n2 = strtol(zz[2], NULL, 0);
                        if (i >= max_f_idx) return 1;
                        f_ptr = &f_info[i];
-                       if (n1) f_ptr->x_attr = n1;
-                       if (n2) f_ptr->x_char = n2;
-                       return 0;
+
+                       n1 = strtol(zz[1], NULL, 0);
+                       n2 = strtol(zz[2], NULL, 0);
+                       if (n1 || (!(n2 & 0x80) && n2)) /* Allow ATTR_DARK text */
+                       {
+                               for (j = 0; j < F_LIT_MAX; j++) f_ptr->x_attr[j] = n1;
+                       }
+                       if (n2)
+                       {
+                               for (j = 0; j < F_LIT_MAX; j++) f_ptr->x_char[j] = n2;
+                       }
+
+                       /* Mega-hack -- feat supports lighting */
+                       switch (num)
+                       {
+                       /* No lighting support */
+                       case 3:
+                               break;
+
+                       /* Use default lighting */
+                       case 4:
+                               if (is_ascii_graphics(f_ptr->x_attr[F_LIT_STANDARD]))
+                               {
+                                       f_ptr->x_attr[F_LIT_LITE] = lighting_colours[f_ptr->x_attr[F_LIT_STANDARD]][0];
+                                       f_ptr->x_attr[F_LIT_DARK] = lighting_colours[f_ptr->x_attr[F_LIT_STANDARD]][1];
+                                       f_ptr->x_attr[F_LIT_DARKDARK] = lighting_colours[lighting_colours[f_ptr->x_attr[F_LIT_STANDARD]][1]][1];
+                               }
+                               else
+                               {
+                                       f_ptr->x_char[F_LIT_LITE] += 2;
+                                       f_ptr->x_char[F_LIT_DARK]++;
+                                       f_ptr->x_char[F_LIT_DARKDARK]++;
+                               }
+                               break;
+
+                       /* Use desired lighting */
+                       case 9:
+                               for (j = F_LIT_NS_BEGIN; j < F_LIT_MAX; j++)
+                               {
+                                       n1 = strtol(zz[j * 2 + 1], NULL, 0);
+                                       n2 = strtol(zz[j * 2 + 2], NULL, 0);
+                                       if (n1 || (!(n2 & 0x80) && n2)) f_ptr->x_attr[j] = n1; /* Allow ATTR_DARK text */
+                                       if (n2) f_ptr->x_char[j] = n2;
+                               }
+                               break;
+                       }
                }
-               break;
+               return 0;
 
        /* Process "S:<num>:<a>/<c>" -- attr/char for special things */
        case 'S':
index f63711e..d032415 100644 (file)
@@ -524,7 +524,7 @@ static void place_pet(void)
                                for (j = 1000; j > 0; j--)
                                {
                                        scatter(&cy, &cx, py, px, d, 0);
-                                       if ((cave_floor_bold(cy, cx) || (cave[cy][cx].feat == FEAT_TREES)) && !cave[cy][cx].m_idx && !player_bold(cy, cx)) break;
+                                       if (have_flag(f_flags_bold(cy, cx), FF_MOVE) && !cave[cy][cx].m_idx && !player_bold(cy, cx)) break;
                                }
                                if (j) break;
                        }
@@ -701,8 +701,7 @@ static void get_out_monster(void)
                if (is_explosive_rune_grid(&cave[ny][nx])) continue;
 
                /* ...nor onto the Pattern */
-               if ((cave[ny][nx].feat >= FEAT_PATTERN_START) &&
-                   (cave[ny][nx].feat <= FEAT_PATTERN_XTRA2)) continue;
+               if (pattern_tile(ny, nx)) continue;
 
                /*** It's a good place ***/
 
@@ -729,21 +728,7 @@ static void get_out_monster(void)
 /*
  * Is this feature has special meaning (except floor_id) with c_ptr->special?
  */
-static bool feat_uses_special(byte feat)
-{
-       switch (feat)
-       {
-       case FEAT_QUEST_ENTER:
-       case FEAT_QUEST_EXIT:
-       case FEAT_QUEST_DOWN:
-       case FEAT_QUEST_UP:
-       case FEAT_TOWN:
-       case FEAT_ENTRANCE:
-               return TRUE;
-       }
-
-       return FALSE;
-}
+#define feat_uses_special(F) (have_flag(f_info[(F)].flags, FF_SPECIAL))
 
 
 /*
@@ -768,12 +753,13 @@ static void locate_connected_stairs(saved_floor_type *sf_ptr)
                for (x = 0; x < cur_wid; x++)
                {
                        cave_type *c_ptr = &cave[y][x];
+                       feature_type *f_ptr = &f_info[c_ptr->feat];
                        bool ok = FALSE;
 
                        if (change_floor_mode & CFM_UP)
                        {
-                               if (c_ptr->feat == FEAT_LESS ||
-                                   c_ptr->feat == FEAT_LESS_LESS)
+                               if (have_flag(f_ptr->flags, FF_LESS) && have_flag(f_ptr->flags, FF_STAIRS) &&
+                                   !have_flag(f_ptr->flags, FF_SPECIAL))
                                {
                                        ok = TRUE;
 
@@ -789,8 +775,8 @@ static void locate_connected_stairs(saved_floor_type *sf_ptr)
 
                        else if (change_floor_mode & CFM_DOWN)
                        {
-                               if (c_ptr->feat == FEAT_MORE ||
-                                   c_ptr->feat == FEAT_MORE_MORE)
+                               if (have_flag(f_ptr->flags, FF_MORE) && have_flag(f_ptr->flags, FF_STAIRS) &&
+                                   !have_flag(f_ptr->flags, FF_SPECIAL))
                                {
                                        ok = TRUE;
 
@@ -806,14 +792,13 @@ static void locate_connected_stairs(saved_floor_type *sf_ptr)
 
                        else
                        {
-                               if (FEAT_BLDG_HEAD <= c_ptr->feat &&
-                                   c_ptr->feat <= FEAT_BLDG_TAIL)
+                               if (have_flag(f_ptr->flags, FF_BLDG))
                                {
                                        ok = TRUE;
                                }
                        }
 
-                       if (ok && num < 20)
+                       if (ok && (num < 20))
                        {
                                x_table[num] = x;
                                y_table[num] = y;
@@ -854,6 +839,7 @@ static void locate_connected_stairs(saved_floor_type *sf_ptr)
 void leave_floor(void)
 {
        cave_type *c_ptr = NULL;
+       feature_type *f_ptr;
        saved_floor_type *sf_ptr;
        int quest_r_idx = 0;
        int i;
@@ -946,6 +932,7 @@ void leave_floor(void)
        {
                /* Extract stair position */
                c_ptr = &cave[py][px];
+               f_ptr = &f_info[c_ptr->feat];
 
                /* Get back to old saved floor? */
                if (c_ptr->special && !feat_uses_special(c_ptr->feat) && get_sf_ptr(c_ptr->special))
@@ -955,8 +942,7 @@ void leave_floor(void)
                }
 
                /* Mark shaft up/down */
-               if (c_ptr->feat == FEAT_LESS_LESS ||
-                   c_ptr->feat == FEAT_MORE_MORE)
+               if (have_flag(f_ptr->flags, FF_STAIRS) && have_flag(f_ptr->flags, FF_SHAFT))
                {
                        prepare_change_floor_mode(CFM_SHAFT);
                }
index 61b6d5d..b0ca44d 100644 (file)
@@ -122,11 +122,13 @@ dun_data *dun;
  */
 static bool alloc_stairs(int feat, int num, int walls)
 {
-       int         y, x, i, j, flag;
-       int         more_num = 0;
-       cave_type   *c_ptr;
+       int          y, x, i, j, flag;
+       int          more_num = 0;
+       cave_type    *c_ptr;
 
-       if (feat == FEAT_LESS)
+       feature_type *f_ptr = &f_info[feat];
+
+       if (have_flag(f_ptr->flags, FF_LESS))
        {
                /* No up stairs in town or in ironman mode */
                if (ironman_downward || !dun_level) return TRUE;
@@ -134,7 +136,7 @@ static bool alloc_stairs(int feat, int num, int walls)
                if (dun_level > d_info[dungeon_type].mindepth)
                        more_num = (randint1(num+1))/2;
        }
-       else if (feat == FEAT_MORE)
+       else if (have_flag(f_ptr->flags, FF_MORE))
        {
                int q_idx = quest_number(dun_level);
 
@@ -155,6 +157,9 @@ static bool alloc_stairs(int feat, int num, int walls)
                        more_num = (randint1(num)+1)/2;
        }
 
+       /* Paranoia */
+       else return FALSE;
+
        /* Place "num" stairs */
        for (i = 0; i < num; i++)
        {
@@ -181,8 +186,7 @@ static bool alloc_stairs(int feat, int num, int walls)
                                c_ptr->mimic = 0;
 
                                /* Clear previous contents, add stairs */
-                               if (i < more_num) c_ptr->feat = feat+0x07;
-                               else c_ptr->feat = feat;
+                               c_ptr->feat = (i < more_num) ? feat_state(feat, FF_SHAFT) : feat;
 
                                /* All done */
                                flag = TRUE;
@@ -348,15 +352,15 @@ static bool possible_doorway(int y, int x)
        if (next_to_corr(y, x) >= 2)
        {
                /* Check Vertical */
-               if ((cave[y-1][x].feat >= FEAT_MAGMA) &&
-                   (cave[y+1][x].feat >= FEAT_MAGMA))
+               if (have_flag(f_flags_bold(y - 1, x), FF_WALL) &&
+                   have_flag(f_flags_bold(y + 1, x), FF_WALL))
                {
                        return (TRUE);
                }
 
                /* Check Horizontal */
-               if ((cave[y][x-1].feat >= FEAT_MAGMA) &&
-                   (cave[y][x+1].feat >= FEAT_MAGMA))
+               if (have_flag(f_flags_bold(y, x - 1), FF_WALL) &&
+                   have_flag(f_flags_bold(y, x + 1), FF_WALL))
                {
                        return (TRUE);
                }
@@ -479,9 +483,12 @@ static void set_bound_perm_wall(cave_type *c_ptr)
        }
        else
        {
+               feature_type *f_ptr = &f_info[c_ptr->feat];
+
                /* Hack -- Decline boundary walls with known treasure  */
-               if ((c_ptr->feat == FEAT_MAGMA_K) || (c_ptr->feat == FEAT_QUARTZ_K))
-                       c_ptr->feat -= (FEAT_MAGMA_K - FEAT_MAGMA);
+               if ((have_flag(f_ptr->flags, FF_HAS_GOLD) || have_flag(f_ptr->flags, FF_HAS_ITEM)) &&
+                   !have_flag(f_ptr->flags, FF_SECRET))
+                       c_ptr->feat = feat_state(c_ptr->feat, FF_ENSECRET);
 
                /* Set boundary mimic */
                c_ptr->mimic = c_ptr->feat;
@@ -752,13 +759,17 @@ static bool cave_gen(void)
                        }
                        else feat1 = 0;
 
-
-                       /* Only add river if matches lake type or if have no lake at all */
-                       if ((((dun->laketype == LAKE_T_LAVA) && (feat1 == FEAT_DEEP_LAVA)) ||
-                            ((dun->laketype == LAKE_T_WATER) && (feat1 == FEAT_DEEP_WATER)) ||
-                             !dun->laketype) && feat1)
+                       if (feat1)
                        {
-                               add_river(feat1, feat2);
+                               feature_type *f_ptr = &f_info[feat1];
+
+                               /* Only add river if matches lake type or if have no lake at all */
+                               if (((dun->laketype == LAKE_T_LAVA) && have_flag(f_ptr->flags, FF_LAVA)) ||
+                                   ((dun->laketype == LAKE_T_WATER) && have_flag(f_ptr->flags, FF_WATER)) ||
+                                    !dun->laketype)
+                               {
+                                       add_river(feat1, feat2);
+                               }
                        }
                }
 
@@ -808,6 +819,7 @@ static bool cave_gen(void)
                        for (j = 0; j < dun->tunn_n; j++)
                        {
                                cave_type *c_ptr;
+                               feature_type *f_ptr;
 
                                /* Access the grid */
                                y = dun->tunn[j].y;
@@ -815,10 +827,10 @@ static bool cave_gen(void)
 
                                /* Access the grid */
                                c_ptr = &cave[y][x];
+                               f_ptr = &f_info[c_ptr->feat];
 
                                /* Clear previous contents (if not a lake), add a floor */
-                               if ((c_ptr->feat < FEAT_DEEP_WATER) ||
-                                   (c_ptr->feat > FEAT_SHAL_LAVA))
+                               if (!have_flag(f_ptr->flags, FF_MOVE) || (!have_flag(f_ptr->flags, FF_WATER) && !have_flag(f_ptr->flags, FF_LAVA)))
                                {
                                        /* Clear mimic type */
                                        c_ptr->mimic = 0;
@@ -1472,7 +1484,9 @@ void generate_cave(void)
                /* Clear and empty the cave */
                clear_cave();
 
-               if ((d_info[dungeon_type].fill_type1 == FEAT_MAGMA_K) || (d_info[dungeon_type].fill_type2 == FEAT_MAGMA_K) || (d_info[dungeon_type].fill_type3 == FEAT_MAGMA_K)) rating += 40;
+               if (have_flag(f_info[d_info[dungeon_type].fill_type1].flags, FF_HAS_GOLD) ||
+                   have_flag(f_info[d_info[dungeon_type].fill_type2].flags, FF_HAS_GOLD) ||
+                   have_flag(f_info[d_info[dungeon_type].fill_type3].flags, FF_HAS_GOLD)) rating += 40;
 
                /* Build the arena -KMW- */
                if (p_ptr->inside_arena)
index 84dfb64..fb4894b 100644 (file)
@@ -148,7 +148,7 @@ void place_random_door(int y, int x, bool room)
                c_ptr->mimic = room ? feat_wall_outer : fill_type[randint0(100)];
 
                /* Floor type terrain cannot hide a door */
-               if (feat_floor(c_ptr->mimic))
+               if (feat_supports_los(c_ptr->mimic))
                {
                        c_ptr->feat = c_ptr->mimic;
                        c_ptr->mimic = 0;
@@ -543,6 +543,7 @@ void build_tunnel(int row1, int col1, int row2, int col2)
        bool door_flag = FALSE;
 
        cave_type *c_ptr;
+       feature_type *f_ptr;
 
        /* Save the starting location */
        start_row = row1;
@@ -595,13 +596,16 @@ void build_tunnel(int row1, int col1, int row2, int col2)
 
                /* Access the location */
                c_ptr = &cave[tmp_row][tmp_col];
+               f_ptr = &f_info[c_ptr->feat];
 
+               if (have_flag(f_ptr->flags, FF_WALL) && have_flag(f_ptr->flags, FF_PERMANENT))
+               {
+                       /* Avoid the edge of the dungeon */
+                       if (have_flag(f_ptr->flags, FF_SOLID)) continue;
 
-               /* Avoid the edge of the dungeon */
-               if (c_ptr->feat == FEAT_PERM_SOLID) continue;
-
-               /* Avoid the edge of vaults */
-               if (c_ptr->feat == FEAT_PERM_OUTER) continue;
+                       /* Avoid the edge of vaults */
+                       if (have_flag(f_ptr->flags, FF_OUTER)) continue;
+               }
 
                /* Avoid "solid" granite walls */
                if (is_solid_grid(c_ptr)) continue;
@@ -609,13 +613,20 @@ void build_tunnel(int row1, int col1, int row2, int col2)
                /* Pierce "outer" walls of rooms */
                if (is_outer_grid(c_ptr))
                {
+                       feature_type *ff_ptr;
+
                        /* Acquire the "next" location */
                        y = tmp_row + row_dir;
                        x = tmp_col + col_dir;
 
+                       ff_ptr = &f_info[cave[y][x].feat];
+
                        /* Hack -- Avoid outer/solid permanent walls */
-                       if (cave[y][x].feat == FEAT_PERM_SOLID) continue;
-                       if (cave[y][x].feat == FEAT_PERM_OUTER) continue;
+                       if (have_flag(ff_ptr->flags, FF_WALL) && have_flag(ff_ptr->flags, FF_PERMANENT))
+                       {
+                               if (have_flag(ff_ptr->flags, FF_SOLID)) continue;
+                               if (have_flag(ff_ptr->flags, FF_OUTER)) continue;
+                       }
 
                        /* Hack -- Avoid outer/solid granite walls */
                        if (is_outer_bold(y, x)) continue;
@@ -732,19 +743,26 @@ static bool set_tunnel(int *x, int *y, bool affectwall)
        int feat, i, j, dx, dy;
 
        cave_type *c_ptr = &cave[*y][*x];
+       feature_type *f_ptr;
 
        if (!in_bounds(*y, *x)) return TRUE;
 
        feat = c_ptr->feat;
+       f_ptr = &f_info[feat];
 
-       if ((feat == FEAT_PERM_OUTER) ||
-           (feat == FEAT_PERM_INNER) ||
-           is_inner_grid(c_ptr))
+       if (have_flag(f_ptr->flags, FF_WALL) && have_flag(f_ptr->flags, FF_PERMANENT))
        {
                /*
                 * Ignore permanent walls - sometimes cannot tunnel around them anyway
                 * so don't try - it just complicates things unnecessarily.
                 */
+
+               if (have_flag(f_ptr->flags, FF_OUTER)) return TRUE;
+               if (have_flag(f_ptr->flags, FF_INNER)) return TRUE;
+       }
+
+       if (is_inner_grid(c_ptr))
+       {
                return TRUE;
        }
 
@@ -753,9 +771,9 @@ static bool set_tunnel(int *x, int *y, bool affectwall)
                /* Save the tunnel location */
                if (dun->tunn_n < TUNN_MAX)
                {
-                               dun->tunn[dun->tunn_n].y = *y;
-                               dun->tunn[dun->tunn_n].x = *x;
-                               dun->tunn_n++;
+                       dun->tunn[dun->tunn_n].y = *y;
+                       dun->tunn[dun->tunn_n].x = *x;
+                       dun->tunn_n++;
                }
 
                return TRUE;
index dc56087..965016a 100644 (file)
 
 #define place_floor_bold(Y, X) \
 { \
-  set_cave_feat(Y,X,floor_type[randint0(100)]); \
-  cave[Y][X].info &= ~(CAVE_MASK); \
-  add_cave_info(Y,X,CAVE_FLOOR); \
+       set_cave_feat(Y,X,floor_type[randint0(100)]); \
+       cave[Y][X].info &= ~(CAVE_MASK); \
+       add_cave_info(Y,X,CAVE_FLOOR); \
 }
 
 #define place_floor_grid(C) \
 { \
-  (C)->feat = floor_type[randint0(100)]; \
-  (C)->info &= ~(CAVE_MASK); \
-  (C)->info |= CAVE_FLOOR; \
+       (C)->feat = floor_type[randint0(100)]; \
+       (C)->info &= ~(CAVE_MASK); \
+       (C)->info |= CAVE_FLOOR; \
 }
 
 #define place_extra_bold(Y, X) \
 { \
-  set_cave_feat(Y,X,fill_type[randint0(100)]); \
-  cave[Y][X].info &= ~(CAVE_MASK); \
-  add_cave_info(Y,X,CAVE_EXTRA); \
+       set_cave_feat(Y,X,fill_type[randint0(100)]); \
+       cave[Y][X].info &= ~(CAVE_MASK); \
+       add_cave_info(Y,X,CAVE_EXTRA); \
 }
 
 #define place_extra_grid(C) \
 { \
-  (C)->feat = fill_type[randint0(100)]; \
-  (C)->info &= ~(CAVE_MASK); \
-  (C)->info |= CAVE_EXTRA; \
+       (C)->feat = fill_type[randint0(100)]; \
+       (C)->info &= ~(CAVE_MASK); \
+       (C)->info |= CAVE_EXTRA; \
 }
 
 #define place_extra_noperm_bold(Y, X) \
 { \
-  set_cave_feat(Y,X,fill_type[randint0(100)]); \
-  if ((cave[Y][X].feat >= FEAT_PERM_EXTRA) && (cave[Y][X].feat <= FEAT_PERM_SOLID)) cave[Y][X].feat -= 0x04; \
-  else if (cave[Y][X].feat == FEAT_MOUNTAIN) cave[Y][X].feat = feat_wall_inner; \
-  cave[Y][X].info &= ~(CAVE_MASK); \
-  add_cave_info(Y,X,CAVE_EXTRA); \
+       feature_type *_f_ptr; \
+       set_cave_feat(Y,X,fill_type[randint0(100)]); \
+       _f_ptr = &f_info[cave[Y][X].feat]; \
+       if (have_flag(_f_ptr->flags, FF_MOUNTAIN)) cave[Y][X].feat = feat_wall_inner; \
+       else if (have_flag(_f_ptr->flags, FF_WALL) && have_flag(_f_ptr->flags, FF_PERMANENT)) \
+               cave[Y][X].feat = feat_state(cave[Y][X].feat, FF_UNPERM); \
+       cave[Y][X].info &= ~(CAVE_MASK); \
+       add_cave_info(Y,X,CAVE_EXTRA); \
 }
 
 #define place_inner_bold(Y, X) \
 { \
-  set_cave_feat(Y,X,feat_wall_inner); \
-  cave[Y][X].info &= ~(CAVE_MASK); \
-  add_cave_info(Y,X,CAVE_INNER); \
+       set_cave_feat(Y,X,feat_wall_inner); \
+       cave[Y][X].info &= ~(CAVE_MASK); \
+       add_cave_info(Y,X,CAVE_INNER); \
 }
 
 #define place_inner_grid(C) \
 { \
-  (C)->feat = feat_wall_inner; \
-  (C)->info &= ~(CAVE_MASK); \
-  (C)->info |= CAVE_INNER; \
+       (C)->feat = feat_wall_inner; \
+       (C)->info &= ~(CAVE_MASK); \
+       (C)->info |= CAVE_INNER; \
 }
 
 #define place_outer_bold(Y, X) \
 { \
-  set_cave_feat(Y,X,feat_wall_outer); \
-  cave[Y][X].info &= ~(CAVE_MASK); \
-  add_cave_info(Y,X,CAVE_OUTER); \
+       set_cave_feat(Y,X,feat_wall_outer); \
+       cave[Y][X].info &= ~(CAVE_MASK); \
+       add_cave_info(Y,X,CAVE_OUTER); \
 }
 
 #define place_outer_grid(C) \
 { \
-  (C)->feat = feat_wall_outer; \
-  (C)->info &= ~(CAVE_MASK); \
-  (C)->info |= CAVE_OUTER; \
+       (C)->feat = feat_wall_outer; \
+       (C)->info &= ~(CAVE_MASK); \
+       (C)->info |= CAVE_OUTER; \
 }
 
 #define place_outer_noperm_bold(Y, X) \
 { \
-  if ((feat_wall_outer >= FEAT_PERM_EXTRA) && (feat_wall_outer <= FEAT_PERM_SOLID)) set_cave_feat(Y, X, feat_wall_outer-0x04); \
-  else if (feat_wall_outer == FEAT_MOUNTAIN) cave[Y][X].feat = feat_wall_inner; \
-  else set_cave_feat(Y,X,feat_wall_outer); \
-  cave[Y][X].info &= ~(CAVE_MASK); \
-  add_cave_info(Y,X,(CAVE_OUTER | CAVE_VAULT)); \
+       feature_type *_f_ptr = &f_info[feat_wall_outer]; \
+       if (have_flag(_f_ptr->flags, FF_MOUNTAIN)) cave[Y][X].feat = feat_wall_inner; \
+       else if (have_flag(_f_ptr->flags, FF_WALL) && have_flag(_f_ptr->flags, FF_PERMANENT)) \
+               set_cave_feat(Y, X, feat_state(feat_wall_outer, FF_UNPERM)); \
+       else set_cave_feat(Y,X,feat_wall_outer); \
+       cave[Y][X].info &= ~(CAVE_MASK); \
+       add_cave_info(Y,X,(CAVE_OUTER | CAVE_VAULT)); \
 }
 
 #define place_outer_noperm_grid(C) \
 { \
-  if ((feat_wall_outer >= FEAT_PERM_EXTRA) && (feat_wall_outer <= FEAT_PERM_SOLID)) (C)->feat = feat_wall_outer-0x04; \
-  else if (feat_wall_outer == FEAT_MOUNTAIN) (C)->feat = feat_wall_inner; \
-  else (C)->feat = feat_wall_outer; \
-  (C)->info &= ~(CAVE_MASK); \
-  (C)->info |= (CAVE_OUTER | CAVE_VAULT); \
+       feature_type *_f_ptr = &f_info[feat_wall_outer]; \
+       if (have_flag(_f_ptr->flags, FF_MOUNTAIN)) (C)->feat = feat_wall_inner; \
+       else if (have_flag(_f_ptr->flags, FF_WALL) && have_flag(_f_ptr->flags, FF_PERMANENT)) \
+               (C)->feat = feat_state(feat_wall_outer, FF_UNPERM); \
+       else (C)->feat = feat_wall_outer; \
+       (C)->info &= ~(CAVE_MASK); \
+       (C)->info |= (CAVE_OUTER | CAVE_VAULT); \
 }
 
 #define place_solid_bold(Y, X) \
 { \
-  set_cave_feat(Y,X,feat_wall_solid); \
-  cave[Y][X].info &= ~(CAVE_MASK); \
-  add_cave_info(Y,X,CAVE_SOLID); \
+       set_cave_feat(Y,X,feat_wall_solid); \
+       cave[Y][X].info &= ~(CAVE_MASK); \
+       add_cave_info(Y,X,CAVE_SOLID); \
 }
 
 #define place_solid_grid(C) \
 { \
-  (C)->feat = feat_wall_solid; \
-  (C)->info &= ~(CAVE_MASK); \
-  (C)->info |= CAVE_SOLID; \
+       (C)->feat = feat_wall_solid; \
+       (C)->info &= ~(CAVE_MASK); \
+       (C)->info |= CAVE_SOLID; \
 }
 
 #define place_solid_noperm_bold(Y, X) \
 { \
-  if ((cave[Y][X].info & CAVE_VAULT) && (feat_wall_solid >= FEAT_PERM_EXTRA) && (feat_wall_solid <= FEAT_PERM_SOLID)) set_cave_feat(Y, X, feat_wall_solid-0x04); \
-  else set_cave_feat(Y,X,feat_wall_solid); \
-  cave[Y][X].info &= ~(CAVE_MASK); \
-  add_cave_info(Y,X,CAVE_SOLID); \
+       feature_type *_f_ptr = &f_info[feat_wall_solid]; \
+       if ((cave[Y][X].info & CAVE_VAULT) && have_flag(_f_ptr->flags, FF_WALL) && have_flag(_f_ptr->flags, FF_PERMANENT)) \
+               set_cave_feat(Y, X, feat_state(feat_wall_solid, FF_UNPERM)); \
+       else set_cave_feat(Y,X,feat_wall_solid); \
+       cave[Y][X].info &= ~(CAVE_MASK); \
+       add_cave_info(Y,X,CAVE_SOLID); \
 }
 
 #define place_solid_noperm_grid(C) \
 { \
-  if ((c_ptr->info & CAVE_VAULT) && (feat_wall_solid >= FEAT_PERM_EXTRA) && (feat_wall_solid <= FEAT_PERM_SOLID)) (C)->feat = feat_wall_solid-0x04; \
-  else (C)->feat = feat_wall_solid; \
-  (C)->info &= ~(CAVE_MASK); \
-  (C)->info |= CAVE_SOLID; \
+       feature_type *_f_ptr = &f_info[feat_wall_solid]; \
+       if (((C)->info & CAVE_VAULT) && have_flag(_f_ptr->flags, FF_WALL) && have_flag(_f_ptr->flags, FF_PERMANENT)) \
+               (C)->feat = feat_state(feat_wall_solid, FF_UNPERM); \
+       else (C)->feat = feat_wall_solid; \
+       (C)->info &= ~(CAVE_MASK); \
+       (C)->info |= CAVE_SOLID; \
 }
 
 
index 2e358ef..984d9a3 100644 (file)
@@ -493,13 +493,13 @@ static bool cast_hissatsu_spell(int spell)
 
                py_attack(y, x, 0);
 
-               if (!player_can_enter(cave[y][x].feat) || is_trap(cave[y][x].feat))
+               if (!player_can_enter(cave[y][x].feat, 0) || is_trap(cave[y][x].feat))
                        break;
 
                y += ddy[dir];
                x += ddx[dir];
 
-               if (player_can_enter(cave[y][x].feat) && !is_trap(cave[y][x].feat) && !cave[y][x].m_idx)
+               if (player_can_enter(cave[y][x].feat, 0) && !is_trap(cave[y][x].feat) && !cave[y][x].m_idx)
                {
                        int oy, ox;
 
@@ -662,19 +662,10 @@ static bool cast_hissatsu_spell(int spell)
                if (cave[y][x].m_idx)
                        py_attack(y, x, HISSATSU_HAGAN);
 
-               /* Non-walls (etc) */
-               if (cave_floor_bold(y, x)) break;
-
-               /* Permanent walls */
-               if (cave[y][x].feat >= FEAT_PERM_EXTRA) break;
-
-               if (cave[y][x].feat < FEAT_DOOR_HEAD) break;
-
-               /* Forget the wall */
-               cave[y][x].info &= ~(CAVE_MARK);
+               if (!have_flag(f_flags_bold(y, x), FF_HURT_ROCK)) break;
 
                /* Destroy the feature */
-               cave_set_feat(y, x, floor_type[randint0(100)]);
+               cave_alter_feat(y, x, FF_HURT_ROCK);
 
                /* Update some things */
                p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MONSTERS | PU_MON_LITE);
@@ -924,7 +915,7 @@ static bool cast_hissatsu_spell(int spell)
                        m_ptr = &m_list[m_idx];
 
                        /* Monster cannot move back? */
-                       if (!monster_can_enter(ny, nx, &r_info[m_ptr->r_idx])) continue;
+                       if (!monster_can_enter(ny, nx, &r_info[m_ptr->r_idx], 0)) continue;
 
                        cave[y][x].m_idx = 0;
                        cave[ny][nx].m_idx = m_idx;
@@ -934,7 +925,7 @@ static bool cast_hissatsu_spell(int spell)
                        update_mon(m_idx, TRUE);
 
                        /* Player can move forward? */
-                       if (player_can_enter(cave[y][x].feat))
+                       if (player_can_enter(cave[y][x].feat, 0))
                        {
                                /* Save the old location */
                                oy = py;
@@ -1054,8 +1045,9 @@ static bool cast_hissatsu_spell(int spell)
        case 27:
        {
                if (!tgt_pt(&x, &y)) return FALSE;
-               if (!cave_empty_bold(y, x) || (cave[y][x].info & CAVE_ICKY) ||
-                       (distance(y, x, py, px) > MAX_SIGHT / 2) ||
+               if (!cave_teleportable_bold(y, x, TELEPORT_ALLOW_DEEP | TELEPORT_ALLOW_OBJECT | TELEPORT_REQUIRE_PROJECT) ||
+                   (cave[y][x].info & CAVE_ICKY) ||
+                   (distance(y, x, py, px) > MAX_SIGHT / 2) ||
                    !projectable(py, px, y, x))
                {
 #ifdef JP
@@ -1068,7 +1060,7 @@ static bool cast_hissatsu_spell(int spell)
                if (p_ptr->anti_tele)
                {
 #ifdef JP
-msg_print("ÉԻ׵ĤÊÎϤ¬¥Æ¥ì¥Ý¡¼¥È¤òËɤ¤¤À¡ª");
+                       msg_print("ÉԻ׵ĤÊÎϤ¬¥Æ¥ì¥Ý¡¼¥È¤òËɤ¤¤À¡ª");
 #else
                        msg_print("A mysterious force prevents you from teleporting!");
 #endif
index 4028321..2514b25 100644 (file)
@@ -89,11 +89,16 @@ struct header
 
        u32b text_size;         /* Size of the "text" array in bytes */
 
+       u32b tag_size;          /* Size of the "tag" array in bytes */
+
        void *info_ptr;
        char *name_ptr;
        char *text_ptr;
+       char *tag_ptr;
 
        parse_info_txt_func parse_info_txt;
+
+       void (*retouch)(header *head);
 };
 
 extern errr init_info_txt(FILE *fp, char *buf, header *head,
@@ -103,6 +108,8 @@ extern errr init_info_txt(FILE *fp, char *buf, header *head,
 extern errr parse_z_info(char *buf, header *head);
 extern errr parse_v_info(char *buf, header *head);
 extern errr parse_f_info(char *buf, header *head);
+extern s16b f_tag_to_index(cptr str);
+extern void retouch_f_info(header *head);
 extern errr parse_k_info(char *buf, header *head);
 extern errr parse_a_info(char *buf, header *head);
 extern errr parse_e_info(char *buf, header *head);
index 6ff32c7..8153dc8 100644 (file)
@@ -128,6 +128,128 @@ static cptr r_info_blow_effect[] =
 
 
 /*
+ * Feature info flags
+ */
+static cptr f_info_flags[] =
+{
+       "LOS",
+       "PROJECT",
+       "MOVE",
+       "PLACE",
+       "DROP",
+       "SECRET",
+       "NOTICE",
+       "REMEMBER",
+       "OPEN",
+       "CLOSE",
+       "BASH",
+       "SPIKE",
+       "DISARM",
+       "STORE",
+       "TUNNEL",
+       "MAY_HAVE_GOLD",
+       "HAS_GOLD",
+       "HAS_ITEM",
+       "DOOR",
+       "TRAP",
+       "STAIRS",
+       "GLYPH",
+       "LESS",
+       "MORE",
+       "AVOID_RUN",
+       "FLOOR",
+       "WALL",
+       "PERMANENT",
+       "INNER",
+       "OUTER",
+       "SOLID",
+       "HIT_TRAP",
+
+       "BRIDGE",
+       "RIVER",
+       "LAKE",
+       "BRIDGED",
+       "COVERED",
+       "GLOW",
+       "ENSECRET",
+       "WATER",
+       "LAVA",
+       "SHALLOW",
+       "DEEP",
+       "FILLED",
+       "HURT_ROCK",
+       "HURT_FIRE",
+       "HURT_COLD",
+       "HURT_ACID",
+       "ICE",
+       "ACID",
+       "OIL",
+       "MUST_FLY",
+       "CAN_CLIMB",
+       "CAN_FLY",
+       "CAN_SWIM",
+       "CAN_PASS",
+       "CAN_OOZE",
+       "CAN_DIG",
+       "HIDE_ITEM",
+       "HIDE_SNEAK",
+       "HIDE_SWIM",
+       "HIDE_DIG",
+       "KILL_HUGE",
+       "KILL_MOVE",
+
+       "PICK_TRAP",
+       "PICK_DOOR",
+       "ALLOC",
+       "CHEST",
+       "DROP_1D2",
+       "DROP_2D2",
+       "DROP_GOOD",
+       "DROP_GREAT",
+       "HURT_POIS",
+       "HURT_ELEC",
+       "HURT_WATER",
+       "HURT_BWATER",
+       "USE_FEAT",
+       "GET_FEAT",
+       "GROUND",
+       "OUTSIDE",
+       "EASY_HIDE",
+       "EASY_CLIMB",
+       "MUST_CLIMB",
+       "TREE",
+       "NEED_TREE",
+       "BLOOD",
+       "DUST",
+       "SLIME",
+       "PLANT",
+       "XXX2",
+       "INSTANT",
+       "EXPLODE",
+       "TIMED",
+       "ERUPT",
+       "STRIKE",
+       "SPREAD",
+
+       "SPECIAL",
+       "HURT_DISI",
+       "QUEST_ENTER",
+       "QUEST_EXIT",
+       "QUEST",
+       "SHAFT",
+       "MOUNTAIN",
+       "BLDG",
+       "MINOR_GLYPH",
+       "PATTERN",
+       "TOWN",
+       "ENTRANCE",
+       "MIRROR",
+       "UNPERM",
+       "TELEPORTABLE",
+};
+
+
+/*
  * Monster race flags
  */
 static cptr r_info_flags1[] =
@@ -788,6 +910,48 @@ static bool add_name(u32b *offset, header *head, cptr buf)
 
 
 /*
+ * Add a tag to the tag-storage and return an offset to it.
+ *
+ * Returns FALSE when there isn't enough space available to store
+ * the name.
+ */
+static bool add_tag(s16b *offset, header *head, cptr buf)
+{
+       u32b i;
+
+       /* Search for an existing (fake) tag */
+       for (i = 1; i < head->tag_size; i += strlen(&head->tag_ptr[i]) + 1)
+       {
+               /* Found it */
+               if (streq(&head->tag_ptr[i], buf)) break;
+       }
+
+       /* There was no existing tag */
+       if (i >= head->tag_size)
+       {
+               /* Hack -- Verify space */
+               if (head->tag_size + strlen(buf) + 8 > FAKE_TAG_SIZE)
+                       return FALSE;
+
+               /* Append chars to the tags */
+               strcpy(head->tag_ptr + head->tag_size, buf);
+
+               /* Point the new tag */
+               i = head->tag_size;
+
+               /* Advance the index */
+               head->tag_size += strlen(buf) + 1;
+       }
+
+       /* Return offset of the tag */
+       *offset = (s16b)i;
+
+       /* Success */
+       return TRUE;
+}
+
+
+/*
  * Convert a "color letter" into an "actual" color
  * The colors are: dwsorgbuDWvyRGBU, as shown below
  */
@@ -840,6 +1004,7 @@ errr init_info_txt(FILE *fp, char *buf, header *head,
        /* Prepare the "fake" stuff */
        head->name_size = 0;
        head->text_size = 0;
+       head->tag_size = 1;
 
        /* Parse */
        while (0 == my_fgets(fp, buf, 1024))
@@ -1180,13 +1345,92 @@ errr parse_m_info(char *buf, header *head)
 
 
 /*
+ * Grab one flag from a textual string
+ */
+static errr grab_one_flag(u32b *flags, cptr names[], cptr what)
+{
+       int i;
+
+       /* Check flags */
+       for (i = 0; i < 32; i++)
+       {
+               if (streq(what, names[i]))
+               {
+                       *flags |= (1L << i);
+                       return 0;
+               }
+       }
+
+       return -1;
+}
+
+
+/*
+ * Grab one flag in an feature_type from a textual string
+ */
+static errr grab_one_feat_flag(feature_type *f_ptr, cptr what)
+{
+       int i;
+
+       /* Check flags */
+       for (i = 0; i < FF_FLAG_MAX; i++)
+       {
+               if (streq(what, f_info_flags[i]))
+               {
+                       add_flag(f_ptr->flags, i);
+                       return 0;
+               }
+       }
+
+       /* Oops */
+#ifdef JP
+       msg_format("̤ÃΤÎÃÏ·Á¥Õ¥é¥° '%s'¡£", what);
+#else
+       msg_format("Unknown feature flag '%s'.", what);
+#endif
+
+       /* Error */
+       return PARSE_ERROR_GENERIC;
+}
+
+
+/*
+ * Grab an action in an feature_type from a textual string
+ */
+static errr grab_one_feat_action(feature_type *f_ptr, cptr what, int count)
+{
+       int i;
+
+       /* Check flags */
+       for (i = 0; i < FF_FLAG_MAX; i++)
+       {
+               if (streq(what, f_info_flags[i]))
+               {
+                       f_ptr->state[count].action = i;
+                       return 0;
+               }
+       }
+
+       /* Oops */
+#ifdef JP
+       msg_format("̤ÃΤÎÃÏ·Á¥¢¥¯¥·¥ç¥ó '%s'¡£", what);
+#else
+       msg_format("Unknown feature action '%s'.", what);
+#endif
+
+       /* Error */
+       return PARSE_ERROR_GENERIC;
+}
+
+
+/*
  * Initialize the "f_info" array, by parsing an ascii "template" file
  */
 errr parse_f_info(char *buf, header *head)
 {
        int i;
 
-       char *s;
+       char *s, *t;
 
        /* Current entry */
        static feature_type *f_ptr = NULL;
@@ -1198,16 +1442,11 @@ errr parse_f_info(char *buf, header *head)
                /* Find the colon before the name */
                s = my_strchr(buf+2, ':');
 
-                       /* Verify that colon */
-               if (!s) return (1);
-
-               /* Nuke the colon, advance to the name */
-               *s++ = '\0';
-
-#ifdef JP
-               /* Paranoia -- require a name */
-               if (!*s) return (1);
-#endif
+               if (s)
+               {
+                       /* Nuke the colon, advance to the name */
+                       *s++ = '\0';
+               }
 
                /* Get the index */
                i = atoi(buf+2);
@@ -1224,25 +1463,43 @@ errr parse_f_info(char *buf, header *head)
                /* Point at the "info" */
                f_ptr = &f_info[i];
 
-#ifdef JP
-               /* Store the name */
-               if (!add_name(&f_ptr->name, head, s)) return (7);
-#endif
+               /* Tag name is given */
+               if (s)
+               {
+                       /* Store the tag */
+                       if (!add_tag(&f_ptr->tag, head, s)) return (7);
+               }
+
                /* Default "mimic" */
                f_ptr->mimic = i;
+
+               /* Default "destroyed state" -- if not specified */
+               f_ptr->destroyed = i;
+
+               /* Default "states" */
+               for (i = 0; i < MAX_FEAT_STATES; i++) f_ptr->state[i].action = FF_FLAG_MAX;
        }
 
        /* There better be a current f_ptr */
        else if (!f_ptr) return (3);
 
 #ifdef JP
-       /* ±Ñ¸ì̾¤òÆɤà¥ë¡¼¥Á¥ó¤òÄɲà*/
-       /* 'E' ¤«¤é»Ï¤Þ¤ë¹Ô¤Ï±Ñ¸ì̾¤È¤·¤Æ¤¤¤ë */
+       else if (buf[0] == 'J')
+       {
+               /* Store the name */
+               if (!add_name(&f_ptr->name, head, buf+2)) return (7);
+       }
+
        else if (buf[0] == 'E')
        {
-               /* nothing to do */
+               /* Ignore english name */
        }
 #else
+       else if (buf[0] == 'J')
+       {
+               /* Ignore Japanese name */
+       }
+
        else if (buf[0] == 'E')
        {
                /* Acquire the Text */
@@ -1257,38 +1514,183 @@ errr parse_f_info(char *buf, header *head)
        /* Process 'M' for "Mimic" (one line only) */
        else if (buf[0] == 'M')
        {
-               int mimic;
+               s16b offset;
 
-               /* Scan for the values */
-               if (1 != sscanf(buf+2, "%d",
-                               &mimic)) return (1);
-
-               /* Save the values */
-               f_ptr->mimic = mimic;
+               if (!add_tag(&offset, head, buf + 2)) return PARSE_ERROR_OUT_OF_MEMORY;
 
+               /* Record a fake tag index */
+               f_ptr->mimic = -offset;
        }
 
 
        /* Process 'G' for "Graphics" (one line only) */
        else if (buf[0] == 'G')
        {
-               byte tmp;
+               int j;
+               byte def_attr[F_LIT_MAX];
+               char char_tmp[F_LIT_MAX];
 
                /* Paranoia */
+               if (buf[1] != ':') return (1);
                if (!buf[2]) return (1);
-               if (!buf[3]) return (1);
+               if (buf[3] != ':') return (1);
                if (!buf[4]) return (1);
 
+               /* Extract the char */
+               char_tmp[F_LIT_STANDARD] = buf[2];
+
                /* Extract the color */
-               tmp = color_char_to_attr(buf[4]);
+               def_attr[F_LIT_STANDARD] = color_char_to_attr(buf[4]);
 
                /* Paranoia */
-               if (tmp > 127) return (1);
+               if (def_attr[F_LIT_STANDARD] > 127) return (1);
 
-               /* Save the values */
-               f_ptr->d_attr = tmp;
-               f_ptr->d_char = buf[2];
+               /* Save the default values for lighting */
+               for (j = 0; j < F_LIT_MAX; j++)
+               {
+                       f_ptr->d_attr[j] = def_attr[F_LIT_STANDARD];
+                       f_ptr->d_char[j] = char_tmp[F_LIT_STANDARD];
+               }
+
+               /* Is this feature supports lighting? */
+               if (buf[5] == ':')
+               {
+                       def_attr[F_LIT_LITE] = lighting_colours[def_attr[F_LIT_STANDARD]][0];
+                       def_attr[F_LIT_DARK] = lighting_colours[def_attr[F_LIT_STANDARD]][1];
+                       def_attr[F_LIT_DARKDARK] = lighting_colours[lighting_colours[def_attr[F_LIT_STANDARD]][1]][1];
+
+                       /* G:c:a:LIT (default) */
+                       if (streq(buf + 6, "LIT"))
+                       {
+                               for (j = F_LIT_NS_BEGIN; j < F_LIT_MAX; j++)
+                               {
+                                       f_ptr->d_attr[j] = def_attr[j];
+                               }
+                       }
+
+                       /* G:c:a:lc:la:dc:da:Dc:Da */
+                       else
+                       {
+                               char attr_lite_tmp[F_LIT_MAX - F_LIT_NS_BEGIN];
 
+                               if ((F_LIT_MAX - F_LIT_NS_BEGIN) * 2 != sscanf(buf + 6, "%c:%c:%c:%c:%c:%c",
+                                       &char_tmp[F_LIT_LITE], &attr_lite_tmp[F_LIT_LITE - F_LIT_NS_BEGIN],
+                                       &char_tmp[F_LIT_DARK], &attr_lite_tmp[F_LIT_DARK - F_LIT_NS_BEGIN],
+                                       &char_tmp[F_LIT_DARKDARK], &attr_lite_tmp[F_LIT_DARKDARK - F_LIT_NS_BEGIN])) return 1;
+                               if (buf[F_LIT_MAX * 4 + 1]) return 1;
+
+                               for (j = F_LIT_NS_BEGIN; j < F_LIT_MAX; j++)
+                               {
+                                       switch (attr_lite_tmp[j - F_LIT_NS_BEGIN])
+                                       {
+                                       case '*':
+                                               /* Use default lighting */
+                                               f_ptr->d_attr[j] = def_attr[j];
+                                               break;
+                                       case '-':
+                                               /* No lighting support */
+                                               f_ptr->d_attr[j] = def_attr[F_LIT_STANDARD];
+                                               break;
+                                       default:
+                                               /* Extract the color */
+                                               f_ptr->d_attr[j] = color_char_to_attr(attr_lite_tmp[j - F_LIT_NS_BEGIN]);
+                                               if (f_ptr->d_attr[j] > 127) return 1;
+                                               break;
+                                       }
+                                       f_ptr->d_char[j] = char_tmp[j];
+                               }
+                       }
+               }
+               else if (buf[5]) return 1;
+       }
+
+       /* Hack -- Process 'F' for flags */
+       else if (buf[0] == 'F')
+       {
+               /* Parse every entry textually */
+               for (s = buf + 2; *s; )
+               {
+                       /* Find the end of this entry */
+                       for (t = s; *t && (*t != ' ') && (*t != '|'); ++t) /* loop */;
+
+                       /* Nuke and skip any dividers */
+                       if (*t)
+                       {
+                               *t++ = '\0';
+                               while (*t == ' ' || *t == '|') t++;
+                       }
+
+                       /* XXX XXX XXX Hack -- Read feature power */
+                       if (1 == sscanf(s, "POWER_%d", &i))
+                       {
+                               /* Extract a "power" */
+                               f_ptr->power =  i;
+
+                               /* Start at next entry */
+                               s = t;
+
+                               /* Continue */
+                               continue;
+                       }
+
+                       /* Parse this entry */
+                       if (0 != grab_one_feat_flag(f_ptr, s)) return (PARSE_ERROR_INVALID_FLAG);
+
+                       /* Start the next entry */
+                       s = t;
+               }
+       }
+
+       /* Process 'W' for "More Info" (one line only) */
+       else if (buf[0] == 'W')
+       {
+               int priority;
+
+               /* Scan for the value */
+               if (1 != sscanf(buf+2, "%d", &priority)) return (PARSE_ERROR_GENERIC);
+
+               /* Save the value */
+               f_ptr->priority = priority;
+       }
+
+       /* Process 'K' for "States" (up to four lines + default (which cannot be last)) */
+       else if (buf[0] == 'K')
+       {
+               s16b offset;
+
+               /* Find the next empty state slot (if any) */
+               for (i = 0; i < MAX_FEAT_STATES; i++) if (f_ptr->state[i].action == FF_FLAG_MAX) break;
+
+               /* Oops, no more slots */
+               if (i == MAX_FEAT_STATES) return PARSE_ERROR_GENERIC;
+
+               /* Analyze the first field */
+               for (s = t = buf+2; *t && (*t != ':'); t++) /* loop */;
+
+               /* Terminate the field (if necessary) */
+               if (*t == ':') *t++ = '\0';
+
+               /* Is this default entry? */
+               if (streq(s, "DESTROYED"))
+               {
+                       if (!add_tag(&offset, head, t)) return PARSE_ERROR_OUT_OF_MEMORY;
+
+                       /* Record a fake tag index */
+                       f_ptr->destroyed = -offset;
+               }
+               else
+               {
+                       /* Reset */
+                       f_ptr->state[i].action = 0;
+
+                       /* Parse this entry */
+                       if (0 != grab_one_feat_action(f_ptr, s, i)) return PARSE_ERROR_INVALID_FLAG;
+
+                       if (!add_tag(&offset, head, t)) return PARSE_ERROR_OUT_OF_MEMORY;
+
+                       /* Record a fake tag index */
+                       f_ptr->state[i].result = -offset;
+               }
        }
 
        /* Oops */
@@ -1300,6 +1702,80 @@ errr parse_f_info(char *buf, header *head)
 
 
 /*
+ * Convert a fake tag to a real feat index
+ */
+s16b f_tag_to_index(cptr str)
+{
+       u16b i;
+
+       /* Search for real index corresponding to this fake tag */
+       for (i = 0; i < f_head.info_num; i++)
+       {
+               if (streq(f_tag + f_info[i].tag, str))
+               {
+                       /* Return the index */
+                       return (s16b)i;
+               }
+       }
+
+       /* Not found */
+       return 0;
+}
+
+
+/*
+ * Search for real index corresponding to this fake tag
+ */
+static void search_real_feat(s16b *feat)
+{
+       int i;
+
+       /* Don't convert non-fake tag */
+       if (*feat >= 0) return;
+
+       /* Search for real index corresponding to this fake tag */
+       for (i = 0; i < f_head.info_num; i++)
+       {
+               if ((-(*feat)) == f_info[i].tag)
+               {
+                       /* Record real index */
+                       *feat = (s16b)i;
+                       return;
+               }
+       }
+
+       /* Undefined tag */
+#ifdef JP
+       msg_format("̤ÄêµÁ¤Î¥¿¥° '%s'¡£", f_tag + (-(*feat)));
+#else
+       msg_format("%s is undefined.", f_tag + (-(*feat)));
+#endif
+}
+
+
+/*
+ * Retouch fake tags of f_info
+ */
+void retouch_f_info(header *head)
+{
+       int i;
+
+       /* Convert fake tags to real feat indices */
+       for (i = 0; i < head->info_num; i++)
+       {
+               feature_type *f_ptr = &f_info[i];
+               int j;
+
+               search_real_feat(&f_ptr->mimic);
+
+               search_real_feat(&f_ptr->destroyed);
+
+               for (j = 0; j < MAX_FEAT_STATES; j++) search_real_feat(&f_ptr->state[j].result);
+       }
+}
+
+
+/*
  * Grab one flag in an object_kind from a textual string
  */
 static errr grab_one_kind_flag(object_kind *k_ptr, cptr what)
@@ -1316,15 +1792,8 @@ static errr grab_one_kind_flag(object_kind *k_ptr, cptr what)
                }
        }
 
-       /* Check gen_flags */
-       for (i = 0; i < 32; i++)
-       {
-               if (streq(what, k_info_gen_flags[i]))
-               {
-                       k_ptr->gen_flags |= (1L << i);
-                       return (0);
-               }
-       }
+       if (grab_one_flag(&k_ptr->gen_flags, k_info_gen_flags, what) == 0)
+               return 0;
 
        /* Oops */
 #ifdef JP
@@ -1437,8 +1906,9 @@ errr parse_k_info(char *buf, header *head)
                byte tmp;
 
                /* Paranoia */
+               if (buf[1] != ':') return (1);
                if (!buf[2]) return (1);
-               if (!buf[3]) return (1);
+               if (buf[3] != ':') return (1);
                if (!buf[4]) return (1);
 
                /* Extract the char */
@@ -1584,15 +2054,8 @@ static errr grab_one_artifact_flag(artifact_type *a_ptr, cptr what)
                }
        }
 
-       /* Check gen_flags */
-       for (i = 0; i < 32; i++)
-       {
-               if (streq(what, k_info_gen_flags[i]))
-               {
-                       a_ptr->gen_flags |= (1L << i);
-                       return (0);
-               }
-       }
+       if (grab_one_flag(&a_ptr->gen_flags, k_info_gen_flags, what) == 0)
+               return 0;
 
        /* Oops */
 #ifdef JP
@@ -1804,18 +2267,11 @@ static bool grab_one_ego_item_flag(ego_item_type *e_ptr, cptr what)
                        return (0);
                }
        }
-       
-       /* Check gen_flags */
-       for (i = 0; i < 32; i++)
-       {
-               if (streq(what, k_info_gen_flags[i]))
-               {
-                       e_ptr->gen_flags |= (1L << i);
-                       return (0);
-               }
-       }
 
-/* Oops */
+       if (grab_one_flag(&e_ptr->gen_flags, k_info_gen_flags, what) == 0)
+               return 0;
+
+       /* Oops */
 #ifdef JP
        msg_format("̤ÃΤÎ̾¤Î¤¢¤ë¥¢¥¤¥Æ¥à¡¦¥Õ¥é¥° '%s'¡£", what);
 #else
@@ -2003,77 +2459,26 @@ errr parse_e_info(char *buf, header *head)
  */
 static errr grab_one_basic_flag(monster_race *r_ptr, cptr what)
 {
-       int i;
-
-       /* Scan flags1 */
-       for (i = 0; i < 32; i++)
-       {
-               if (streq(what, r_info_flags1[i]))
-               {
-                       r_ptr->flags1 |= (1L << i);
-                       return (0);
-               }
-       }
+       if (grab_one_flag(&r_ptr->flags1, r_info_flags1, what) == 0)
+               return 0;
 
-       /* Scan flags2 */
-       for (i = 0; i < 32; i++)
-       {
-               if (streq(what, r_info_flags2[i]))
-               {
-                       r_ptr->flags2 |= (1L << i);
-                       return (0);
-               }
-       }
+       if (grab_one_flag(&r_ptr->flags2, r_info_flags2, what) == 0)
+               return 0;
 
-       /* Scan flags3 */
-       for (i = 0; i < 32; i++)
-       {
-               if (streq(what, r_info_flags3[i]))
-               {
-                       r_ptr->flags3 |= (1L << i);
-                       return (0);
-               }
-       }
+       if (grab_one_flag(&r_ptr->flags3, r_info_flags3, what) == 0)
+               return 0;
 
-       /* Scan flags7 */
-       for (i = 0; i < 32; i++)
-       {
-               if (streq(what, r_info_flags7[i]))
-               {
-                       r_ptr->flags7 |= (1L << i);
-                       return (0);
-               }
-       }
+       if (grab_one_flag(&r_ptr->flags7, r_info_flags7, what) == 0)
+               return 0;
 
-       /* Scan flags8 */
-       for (i = 0; i < 32; i++)
-       {
-               if (streq(what, r_info_flags8[i]))
-               {
-                       r_ptr->flags8 |= (1L << i);
-                       return (0);
-               }
-       }
+       if (grab_one_flag(&r_ptr->flags8, r_info_flags8, what) == 0)
+               return 0;
 
-       /* Scan flags9 */
-       for (i = 0; i < 32; i++)
-       {
-               if (streq(what, r_info_flags9[i]))
-               {
-                       r_ptr->flags9 |= (1L << i);
-                       return (0);
-               }
-       }
+       if (grab_one_flag(&r_ptr->flags9, r_info_flags9, what) == 0)
+               return 0;
 
-       /* Scan flagsr (resistance) */
-       for (i = 0; i < 32; i++)
-       {
-               if (streq(what, r_info_flagsr[i]))
-               {
-                       r_ptr->flagsr |= (1L << i);
-                       return (0);
-               }
-       }
+       if (grab_one_flag(&r_ptr->flagsr, r_info_flagsr, what) == 0)
+               return 0;
 
        /* Oops */
 #ifdef JP
@@ -2093,37 +2498,14 @@ static errr grab_one_basic_flag(monster_race *r_ptr, cptr what)
  */
 static errr grab_one_spell_flag(monster_race *r_ptr, cptr what)
 {
-       int i;
-
-       /* Scan flags4 */
-       for (i = 0; i < 32; i++)
-       {
-               if (streq(what, r_info_flags4[i]))
-               {
-                       r_ptr->flags4 |= (1L << i);
-                       return (0);
-               }
-       }
+       if (grab_one_flag(&r_ptr->flags4, r_info_flags4, what) == 0)
+               return 0;
 
-       /* Scan flags5 */
-       for (i = 0; i < 32; i++)
-       {
-               if (streq(what, r_info_flags5[i]))
-               {
-                       r_ptr->flags5 |= (1L << i);
-                       return (0);
-               }
-       }
+       if (grab_one_flag(&r_ptr->flags5, r_info_flags5, what) == 0)
+               return 0;
 
-       /* Scan flags6 */
-       for (i = 0; i < 32; i++)
-       {
-               if (streq(what, r_info_flags6[i]))
-               {
-                       r_ptr->flags6 |= (1L << i);
-                       return (0);
-               }
-       }
+       if (grab_one_flag(&r_ptr->flags6, r_info_flags6, what) == 0)
+               return 0;
 
        /* Oops */
 #ifdef JP
@@ -2239,8 +2621,9 @@ errr parse_r_info(char *buf, header *head)
                byte tmp;
 
                /* Paranoia */
+               if (buf[1] != ':') return (1);
                if (!buf[2]) return (1);
-               if (!buf[3]) return (1);
+               if (buf[3] != ':') return (1);
                if (!buf[4]) return (1);
 
                /* Extract the char */
@@ -2429,17 +2812,8 @@ errr parse_r_info(char *buf, header *head)
  */
 static errr grab_one_dungeon_flag(dungeon_info_type *d_ptr, cptr what)
 {
-       int i;
-
-       /* Scan flags1 */
-       for (i = 0; i < 32; i++)
-       {
-               if (streq(what, d_info_flags1[i]))
-               {
-                       d_ptr->flags1 |= (1L << i);
-                       return (0);
-               }
-       }
+       if (grab_one_flag(&d_ptr->flags1, d_info_flags1, what) == 0)
+               return 0;
 
        /* Oops */
 #ifdef JP
@@ -2457,77 +2831,26 @@ static errr grab_one_dungeon_flag(dungeon_info_type *d_ptr, cptr what)
  */
 static errr grab_one_basic_monster_flag(dungeon_info_type *d_ptr, cptr what)
 {
-       int i;
-
-       /* Scan flags1 */
-       for (i = 0; i < 32; i++)
-       {
-               if (streq(what, r_info_flags1[i]))
-               {
-                       d_ptr->mflags1 |= (1L << i);
-                       return (0);
-               }
-       }
+       if (grab_one_flag(&d_ptr->mflags1, r_info_flags1, what) == 0)
+               return 0;
 
-       /* Scan flags2 */
-       for (i = 0; i < 32; i++)
-       {
-               if (streq(what, r_info_flags2[i]))
-               {
-                       d_ptr->mflags2 |= (1L << i);
-                       return (0);
-               }
-       }
+       if (grab_one_flag(&d_ptr->mflags2, r_info_flags2, what) == 0)
+               return 0;
 
-       /* Scan flags3 */
-       for (i = 0; i < 32; i++)
-       {
-               if (streq(what, r_info_flags3[i]))
-               {
-                       d_ptr->mflags3 |= (1L << i);
-                       return (0);
-               }
-       }
+       if (grab_one_flag(&d_ptr->mflags3, r_info_flags3, what) == 0)
+               return 0;
 
-       /* Scan flags7 */
-       for (i = 0; i < 32; i++)
-       {
-               if (streq(what, r_info_flags7[i]))
-               {
-                       d_ptr->mflags7 |= (1L << i);
-                       return (0);
-               }
-       }
+       if (grab_one_flag(&d_ptr->mflags7, r_info_flags7, what) == 0)
+               return 0;
 
-       /* Scan flags8 */
-       for (i = 0; i < 32; i++)
-       {
-               if (streq(what, r_info_flags8[i]))
-               {
-                       d_ptr->mflags8 |= (1L << i);
-                       return (0);
-               }
-       }
+       if (grab_one_flag(&d_ptr->mflags8, r_info_flags8, what) == 0)
+               return 0;
 
-       /* Scan flags9 */
-       for (i = 0; i < 32; i++)
-       {
-               if (streq(what, r_info_flags9[i]))
-               {
-                       d_ptr->mflags9 |= (1L << i);
-                       return (0);
-               }
-       }
+       if (grab_one_flag(&d_ptr->mflags9, r_info_flags9, what) == 0)
+               return 0;
 
-       /* Scan flagsr (resistance) */
-       for (i = 0; i < 32; i++)
-       {
-               if (streq(what, r_info_flagsr[i]))
-               {
-                       d_ptr->mflagsr |= (1L << i);
-                       return (0);
-               }
-       }
+       if (grab_one_flag(&d_ptr->mflagsr, r_info_flagsr, what) == 0)
+               return 0;
 
        /* Oops */
 #ifdef JP
@@ -2545,37 +2868,14 @@ static errr grab_one_basic_monster_flag(dungeon_info_type *d_ptr, cptr what)
  */
 static errr grab_one_spell_monster_flag(dungeon_info_type *d_ptr, cptr what)
 {
-       int i;
-
-       /* Scan flags4 */
-       for (i = 0; i < 32; i++)
-       {
-               if (streq(what, r_info_flags4[i]))
-               {
-                       d_ptr->mflags4 |= (1L << i);
-                       return (0);
-               }
-       }
+       if (grab_one_flag(&d_ptr->mflags4, r_info_flags4, what) == 0)
+               return 0;
 
-       /* Scan flags5 */
-       for (i = 0; i < 32; i++)
-       {
-               if (streq(what, r_info_flags5[i]))
-               {
-                       d_ptr->mflags5 |= (1L << i);
-                       return (0);
-               }
-       }
+       if (grab_one_flag(&d_ptr->mflags5, r_info_flags5, what) == 0)
+               return 0;
 
-       /* Scan flags6 */
-       for (i = 0; i < 32; i++)
-       {
-               if (streq(what, r_info_flags6[i]))
-               {
-                       d_ptr->mflags6 |= (1L << i);
-                       return (0);
-               }
-       }
+       if (grab_one_flag(&d_ptr->mflags6, r_info_flags6, what) == 0)
+               return 0;
 
        /* Oops */
 #ifdef JP
@@ -2710,45 +3010,40 @@ errr parse_d_info(char *buf, header *head)
        /* Process 'L' for "fLoor type" (one line only) */
        else if (buf[0] == 'L')
        {
-               int f1, f2, f3;
-               int p1, p2, p3;
-               int tunnel;
+               char *zz[16];
 
                /* Scan for the values */
-               if (7 != sscanf(buf+2, "%d:%d:%d:%d:%d:%d:%d",
-                               &f1, &p1, &f2, &p2, &f3, &p3, &tunnel)) return (1);
+               if (tokenize(buf+2, 7, zz, 0) != 7) return (1);
 
                /* Save the values */
-               d_ptr->floor1 = f1;
-               d_ptr->floor_percent1 = p1;
-               d_ptr->floor2 = f2;
-               d_ptr->floor_percent2 = p2;
-               d_ptr->floor3 = f3;
-               d_ptr->floor_percent3 = p3;
-               d_ptr->tunnel_percent = tunnel;
+               d_ptr->floor1 = f_tag_to_index(zz[0]);
+               d_ptr->floor_percent1 = atoi(zz[1]);
+               d_ptr->floor2 = f_tag_to_index(zz[2]);
+               d_ptr->floor_percent2 = atoi(zz[3]);
+               d_ptr->floor3 = f_tag_to_index(zz[4]);
+               d_ptr->floor_percent3 = atoi(zz[5]);
+               d_ptr->tunnel_percent = atoi(zz[6]);
        }
 
        /* Process 'A' for "wAll type" (one line only) */
        else if (buf[0] == 'A')
        {
-               int w1, w2, w3, outer, inner, stream1, stream2;
-               int p1, p2, p3;
+               char *zz[16];
 
                /* Scan for the values */
-               if (10 != sscanf(buf+2, "%d:%d:%d:%d:%d:%d:%d:%d:%d:%d",
-                                &w1, &p1, &w2, &p2, &w3, &p3, &outer, &inner, &stream1, &stream2)) return (1);
+               if (tokenize(buf+2, 10, zz, 0) != 10) return (1);
 
                /* Save the values */
-               d_ptr->fill_type1 = w1;
-               d_ptr->fill_percent1 = p1;
-               d_ptr->fill_type2 = w2;
-               d_ptr->fill_percent2 = p2;
-               d_ptr->fill_type3 = w3;
-               d_ptr->fill_percent3 = p3;
-               d_ptr->outer_wall = outer;
-               d_ptr->inner_wall = inner;
-               d_ptr->stream1 = stream1;
-               d_ptr->stream2 = stream2;
+               d_ptr->fill_type1 = f_tag_to_index(zz[0]);
+               d_ptr->fill_percent1 = atoi(zz[1]);
+               d_ptr->fill_type2 = f_tag_to_index(zz[2]);
+               d_ptr->fill_percent2 = atoi(zz[3]);
+               d_ptr->fill_type3 = f_tag_to_index(zz[4]);
+               d_ptr->fill_percent3 = atoi(zz[5]);
+               d_ptr->outer_wall = f_tag_to_index(zz[6]);
+               d_ptr->inner_wall = f_tag_to_index(zz[7]);
+               d_ptr->stream1 = f_tag_to_index(zz[8]);
+               d_ptr->stream2 = f_tag_to_index(zz[9]);
        }
 
        /* Process 'F' for "Dungeon Flags" (multiple lines) */
index 0d050a3..0756585 100644 (file)
@@ -392,6 +392,17 @@ static errr init_info_raw(int fd, header *head)
                fd_read(fd, head->text_ptr, head->text_size);
        }
 
+
+       if (head->tag_size)
+       {
+               /* Allocate the "*_tag" array */
+               C_MAKE(head->tag_ptr, head->tag_size, char);
+
+               /* Read the "*_tag" array */
+               fd_read(fd, head->tag_ptr, head->tag_size);
+       }
+
+
        /* Success */
        return (0);
 }
@@ -426,7 +437,7 @@ static void init_header(header *head, int num, int len)
  * even if the string happens to be empty (everyone has a unique '\0').
  */
 static errr init_info(cptr filename, header *head,
-                       void **info, char **name, char **text)
+                     void **info, char **name, char **text, char **tag)
 {
        int fd;
 
@@ -484,10 +495,12 @@ static errr init_info(cptr filename, header *head,
                /* Hack -- make "fake" arrays */
                if (name) C_MAKE(head->name_ptr, FAKE_NAME_SIZE, char);
                if (text) C_MAKE(head->text_ptr, FAKE_TEXT_SIZE, char);
+               if (tag)  C_MAKE(head->tag_ptr, FAKE_TAG_SIZE, char);
 
                if (info) (*info) = head->info_ptr;
                if (name) (*name) = head->name_ptr;
                if (text) (*text) = head->text_ptr;
+               if (tag)  (*tag)  = head->tag_ptr;
 
                /*** Load the ascii template file ***/
 
@@ -546,6 +559,14 @@ static errr init_info(cptr filename, header *head,
                }
 
 
+               /*** Make final retouch on fake tags ***/
+
+               if (head->retouch)
+               {
+                       (*head->retouch)(head);
+               }
+
+
                /*** Dump the binary image file ***/
 
                /* File type is "DATA" */
@@ -586,6 +607,9 @@ static errr init_info(cptr filename, header *head,
                        /* Dump the "*_text" array */
                        fd_write(fd, head->text_ptr, head->text_size);
 
+                       /* Dump the "*_tag" array */
+                       fd_write(fd, head->tag_ptr, head->tag_size);
+
                        /* Close */
                        (void)fd_close(fd);
                }
@@ -599,6 +623,7 @@ static errr init_info(cptr filename, header *head,
                /* Hack -- Free the "fake" arrays */
                if (name) C_KILL(head->name_ptr, FAKE_NAME_SIZE, char);
                if (text) C_KILL(head->text_ptr, FAKE_TEXT_SIZE, char);
+               if (tag)  C_KILL(head->tag_ptr, FAKE_TAG_SIZE, char);
 
 #endif /* ALLOW_TEMPLATES */
 
@@ -644,6 +669,7 @@ static errr init_info(cptr filename, header *head,
        if (info) (*info) = head->info_ptr;
        if (name) (*name) = head->name_ptr;
        if (text) (*text) = head->text_ptr;
+       if (tag)  (*tag)  = head->tag_ptr;
 
        /* Success */
        return (0);
@@ -663,10 +689,13 @@ static errr init_f_info(void)
        /* Save a pointer to the parsing function */
        f_head.parse_info_txt = parse_f_info;
 
+       /* Save a pointer to the retouch fake tags */
+       f_head.retouch = retouch_f_info;
+
 #endif /* ALLOW_TEMPLATES */
 
        return init_info("f_info", &f_head,
-                        (void*)&f_info, (void*)&f_name, NULL);
+                        (void*)&f_info, &f_name, NULL, &f_tag);
 }
 
 
@@ -686,7 +715,7 @@ static errr init_k_info(void)
 #endif /* ALLOW_TEMPLATES */
 
        return init_info("k_info", &k_head,
-                        (void*)&k_info, (void*)&k_name, (void*)&k_text);
+                        (void*)&k_info, &k_name, &k_text, NULL);
 }
 
 
@@ -707,7 +736,7 @@ static errr init_a_info(void)
 #endif /* ALLOW_TEMPLATES */
 
        return init_info("a_info", &a_head,
-                        (void*)&a_info, (void*)&a_name, (void*)&a_text);
+                        (void*)&a_info, &a_name, &a_text, NULL);
 }
 
 
@@ -728,7 +757,7 @@ static errr init_e_info(void)
 #endif /* ALLOW_TEMPLATES */
 
        return init_info("e_info", &e_head,
-                        (void*)&e_info, (void*)&e_name, (void*)&e_text);
+                        (void*)&e_info, &e_name, &e_text, NULL);
 }
 
 
@@ -749,7 +778,7 @@ static errr init_r_info(void)
 #endif /* ALLOW_TEMPLATES */
 
        return init_info("r_info", &r_head,
-                        (void*)&r_info, (void*)&r_name, (void*)&r_text);
+                        (void*)&r_info, &r_name, &r_text, NULL);
 }
 
 
@@ -770,7 +799,7 @@ static errr init_d_info(void)
 #endif /* ALLOW_TEMPLATES */
 
        return init_info("d_info", &d_head,
-                        (void*)&d_info, (void*)&d_name, (void*)&d_text);
+                        (void*)&d_info, &d_name, &d_text, NULL);
 }
 
 
@@ -793,7 +822,7 @@ errr init_v_info(void)
 #endif /* ALLOW_TEMPLATES */
 
        return init_info("v_info", &v_head,
-                        (void*)&v_info, (void*)&v_name, (void*)&v_text);
+                        (void*)&v_info, &v_name, &v_text, NULL);
 }
 
 
@@ -813,7 +842,7 @@ static errr init_s_info(void)
 #endif /* ALLOW_TEMPLATES */
 
        return init_info("s_info", &s_head,
-                        (void*)&s_info, NULL, NULL);
+                        (void*)&s_info, NULL, NULL, NULL);
 }
 
 
@@ -833,7 +862,7 @@ static errr init_m_info(void)
 #endif /* ALLOW_TEMPLATES */
 
        return init_info("m_info", &m_head,
-                        (void*)&m_info, NULL, NULL);
+                        (void*)&m_info, NULL, NULL, NULL);
 }
 
 
index 475d83e..d67cc25 100644 (file)
@@ -2307,7 +2307,7 @@ static errr rd_dungeon_old(void)
                        c_ptr = &cave[y][x];
 
                        /* Extract "feat" */
-                       c_ptr->feat = tmp8u;
+                       c_ptr->feat = (s16b)tmp8u;
 
                        /* Advance/Wrap */
                        if (++x >= xmax)
@@ -2336,8 +2336,8 @@ static errr rd_dungeon_old(void)
                        /* Access the cave */
                        c_ptr = &cave[y][x];
 
-                       /* Extract "feat" */
-                       c_ptr->mimic = tmp8u;
+                       /* Extract "mimic" */
+                       c_ptr->mimic = (s16b)tmp8u;
 
                        /* Advance/Wrap */
                        if (++x >= xmax)
@@ -2404,7 +2404,7 @@ static errr rd_dungeon_old(void)
                                c_ptr->feat = FEAT_FLOOR;
                                c_ptr->info |= CAVE_TRAP;
                        }
-               
+
                        /* Older than 1.1.1 */
                        if (c_ptr->feat == FEAT_MIRROR)
                        {
@@ -2704,8 +2704,18 @@ static errr rd_saved_floor(saved_floor_type *sf_ptr)
 
                /* Read it */
                rd_u16b(&ct_ptr->info);
-               rd_byte(&ct_ptr->feat);
-               rd_byte(&ct_ptr->mimic);
+               if (h_older_than(1, 7, 0, 2))
+               {
+                       rd_byte(&tmp8u);
+                       ct_ptr->feat = (s16b)tmp8u;
+                       rd_byte(&tmp8u);
+                       ct_ptr->mimic = (s16b)tmp8u;
+               }
+               else
+               {
+                       rd_s16b(&ct_ptr->feat);
+                       rd_s16b(&ct_ptr->mimic);
+               }
                rd_s16b(&ct_ptr->special);
        }
 
@@ -2936,7 +2946,7 @@ static errr rd_dungeon(void)
                {
                        saved_floor_type *sf_ptr = &saved_floors[i];
                        byte tmp8u;
-               
+
                        /* Unused element */
                        if (!sf_ptr->floor_id) continue;
 
@@ -2946,7 +2956,7 @@ static errr rd_dungeon(void)
 
                        /* Read from the save file */
                        err = rd_saved_floor(sf_ptr);
-                       
+
                        /* Error? */
                        if (err) break;
 
index c2261ab..a1740a6 100644 (file)
@@ -97,7 +97,7 @@ static bool get_enemy_dir(int m_idx, int *mm)
                        /* Monster must be 'an enemy' */
                        if (!are_enemies(m_ptr, t_ptr)) continue;
 
-                       can_pass_wall = (((r_ptr->flags2 & RF2_PASS_WALL) && ((m_idx != p_ptr->riding) || (p_ptr->pass_wall))) || ((r_ptr->flags2 & RF2_KILL_WALL) && (m_idx != p_ptr->riding)));
+                       can_pass_wall = (((r_ptr->flags2 & RF2_PASS_WALL) && ((m_idx != p_ptr->riding) || p_ptr->pass_wall)) || ((r_ptr->flags2 & RF2_KILL_WALL) && (m_idx != p_ptr->riding)));
 
                        /* Monster must be projectable if we can't pass through walls */
                        if (!can_pass_wall &&
@@ -549,7 +549,7 @@ static bool get_moves_aux2(int m_idx, int *yp, int *xp)
                cost = c_ptr->cost;
 
                /* Monster cannot kill or pass walls */
-               if (!(((r_ptr->flags2 & RF2_PASS_WALL) && ((m_idx != p_ptr->riding) || p_ptr->pass_wall)) || (r_ptr->flags2 & RF2_KILL_WALL)))
+               if (!(((r_ptr->flags2 & RF2_PASS_WALL) && ((m_idx != p_ptr->riding) || p_ptr->pass_wall)) || ((r_ptr->flags2 & RF2_KILL_WALL) && (m_idx != p_ptr->riding))))
                {
                        if (cost == 0) continue;
                        if (!can_open_door && is_closed_door(c_ptr->feat)) continue;
@@ -623,9 +623,8 @@ static bool get_moves_aux(int m_idx, int *yp, int *xp, bool no_flow)
        if (no_flow) return (FALSE);
 
        /* Monster can go through rocks */
-       if ((r_ptr->flags2 & RF2_PASS_WALL) && ((m_idx != p_ptr->riding) || (p_ptr->pass_wall))) return (FALSE);
-       if (r_ptr->flags2 & RF2_KILL_WALL) return (FALSE);
-       if (!cave_floor_bold(py, px) && (cave[py][px].feat != FEAT_TREES)) return (FALSE);
+       if ((r_ptr->flags2 & RF2_PASS_WALL) && ((m_idx != p_ptr->riding) || p_ptr->pass_wall)) return (FALSE);
+       if ((r_ptr->flags2 & RF2_KILL_WALL) && (m_idx != p_ptr->riding)) return (FALSE);
 
        /* Monster location */
        y1 = m_ptr->fy;
@@ -1100,7 +1099,7 @@ static bool get_moves(int m_idx, int *mm)
        bool         will_run = mon_will_run(m_idx);
        cave_type    *c_ptr;
        bool         no_flow = ((m_ptr->mflag2 & MFLAG2_NOFLOW) && (cave[m_ptr->fy][m_ptr->fx].cost > 2));
-       bool         can_pass_wall = ((r_ptr->flags2 & RF2_PASS_WALL) && ((m_idx != p_ptr->riding) || (p_ptr->pass_wall)));
+       bool         can_pass_wall = ((r_ptr->flags2 & RF2_PASS_WALL) && ((m_idx != p_ptr->riding) || p_ptr->pass_wall));
 
        /* Counter attack to an enemy monster */
        if (!will_run && m_ptr->target_y)
@@ -1144,8 +1143,7 @@ static bool get_moves(int m_idx, int *mm)
                                c_ptr = &cave[yy][xx];
 
                                /* Check grid */
-                               if (((cave_floor_grid(c_ptr)) || ((c_ptr->feat & 0x60) == 0x60)) &&
-                                        monster_can_cross_terrain(c_ptr->feat, r_ptr))
+                               if (monster_can_cross_terrain(c_ptr->feat, r_ptr, 0))
                                {
                                        /* One more room grid */
                                        room++;
@@ -2267,6 +2265,7 @@ static void process_monster(int m_idx)
        int             mm[8];
 
        cave_type       *c_ptr;
+       feature_type    *f_ptr;
 
        monster_type    *y_ptr;
 
@@ -2282,12 +2281,14 @@ static void process_monster(int m_idx)
        bool            did_pass_wall;
        bool            did_kill_wall;
        bool            gets_angry = FALSE;
-       bool            can_pass_wall;
+       bool            can_cross;
        bool            aware = TRUE;
 
        bool            fear;
 
-       if ((m_idx == p_ptr->riding) && !(r_ptr->flags7 & RF7_RIDING))
+       bool            is_riding_mon = (m_idx == p_ptr->riding);
+
+       if (is_riding_mon && !(r_ptr->flags7 & RF7_RIDING))
        {
                if (rakuba(0, TRUE))
                {
@@ -2409,7 +2410,7 @@ msg_print("
                        char m_name[80];
                        monster_desc(m_name, m_ptr, 0);
 
-                       if (m_idx == p_ptr->riding && riding_pinch < 2)
+                       if (is_riding_mon && riding_pinch < 2)
                        {
 #ifdef JP
                                msg_format("%s¤Ï½ý¤ÎÄˤµ¤Î;¤ê¤¢¤Ê¤¿¤Î«Çû¤«¤éƨ¤ì¤è¤¦¤È¤·¤Æ¤¤¤ë¡£", m_name);
@@ -2421,7 +2422,7 @@ msg_print("
                        }
                        else
                        {
-                               if (m_idx == p_ptr->riding)
+                               if (is_riding_mon)
                                {
 #ifdef JP
                                        msg_format("%s¤Ï¤¢¤Ê¤¿¤Î«Çû¤«¤éæ½Ð¤·¤¿¡£", m_name);
@@ -2457,7 +2458,7 @@ msg_print("
 #endif
                                }
 
-                               if (m_idx == p_ptr->riding && rakuba(-1, FALSE))
+                               if (is_riding_mon && rakuba(-1, FALSE))
                                {
 #ifdef JP
                                        msg_print("ÃÏÌ̤ËÍî¤È¤µ¤ì¤¿¡£");
@@ -2477,7 +2478,7 @@ msg_print("
                else
                {
                        /* Reset the counter */
-                       if (m_idx == p_ptr->riding) riding_pinch = 0;
+                       if (is_riding_mon) riding_pinch = 0;
                }
        }
 
@@ -2511,7 +2512,7 @@ msg_print("
 
                        /* Redraw the health bar */
                        if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
-                       if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
+                       if (is_riding_mon) p_ptr->redraw |= (PR_UHEALTH);
 
                        /* Hack -- Count the wakings */
                        if (r_ptr->r_wake < MAX_UCHAR)
@@ -2528,7 +2529,7 @@ msg_print("
                if (one_in_(2)) return;
        }
 
-       if (p_ptr->riding == m_idx)
+       if (is_riding_mon)
        {
                p_ptr->update |= (PU_BONUS);
        }
@@ -2749,8 +2750,6 @@ msg_format("%^s%s", m_name, monmessage);
                }
        }
 
-       can_pass_wall = ((r_ptr->flags2 & RF2_PASS_WALL) && ((m_idx != p_ptr->riding) || (p_ptr->pass_wall)));
-
        /* Hack -- Assume no movement */
        mm[0] = mm[1] = mm[2] = mm[3] = 0;
        mm[4] = mm[5] = mm[6] = mm[7] = 0;
@@ -2897,19 +2896,14 @@ msg_format("%^s%s", m_name, monmessage);
 
                /* Access that cave grid */
                c_ptr = &cave[ny][nx];
+               f_ptr = &f_info[c_ptr->feat];
+               can_cross = monster_can_cross_terrain(c_ptr->feat, r_ptr, is_riding_mon ? CEM_RIDING : 0);
 
                /* Access that cave grid's contents */
                y_ptr = &m_list[c_ptr->m_idx];
 
-               /* Floor is open? */
-               if (cave_floor_grid(c_ptr))
-               {
-                       /* Go ahead and move */
-                       do_move = TRUE;
-               }
-
                /* Hack -- player 'in' wall */
-               else if (player_bold(ny, nx))
+               if (player_bold(ny, nx))
                {
                        do_move = TRUE;
                }
@@ -2920,79 +2914,54 @@ msg_format("%^s%s", m_name, monmessage);
                        do_move = TRUE;
                }
 
-               /* Permanent wall */
-               else if ((c_ptr->feat >= FEAT_PERM_EXTRA) &&
-                       (c_ptr->feat <= FEAT_PERM_SOLID))
-               {
-                       do_move = FALSE;
-               }
-
-               /* Hack -- semi-transparent terrains are no obstacle */
-               else if (c_ptr->feat == FEAT_TREES)
-               {
-                       do_move = TRUE;
-               }
-
-               /* Hack -- semi-transparent terrains are no obstacle */
-               else if ((c_ptr->feat == FEAT_MOUNTAIN) && ((r_ptr->flags2 & RF2_KILL_WALL) || (!dun_level && ((r_ptr->flags7 & RF7_CAN_FLY) || (r_ptr->flags8 & RF8_WILD_MOUNTAIN)))))
+               /* Floor is open? */
+               else if (can_cross)
                {
+                       /* Go ahead and move */
                        do_move = TRUE;
-               }
 
+                       /* Monster moves through walls (and doors) */
+                       if ((r_ptr->flags2 & RF2_PASS_WALL) && (!is_riding_mon || p_ptr->pass_wall) &&
+                           !have_flag(f_ptr->flags, FF_MOVE))
+                       {
+                               /* Monster went through a wall */
+                               did_pass_wall = TRUE;
+                       }
 
-               /* Monster moves through walls (and doors) */
-               else if (can_pass_wall)
-               {
-                       /* Pass through walls/doors/rubble */
-                       do_move = TRUE;
-
-                       /* Monster went through a wall */
-                       did_pass_wall = TRUE;
+                       if ((r_ptr->flags2 & RF2_KILL_WALL) && have_flag(f_ptr->flags, FF_TUNNEL) &&
+                           !have_flag(f_ptr->flags, FF_LOS) && !have_flag(f_ptr->flags, FF_PERMANENT))
+                       {
+                               /* Monster destroyed a wall (later) */
+                               did_kill_wall = TRUE;
+                       }
                }
 
                /* Monster destroys walls (and doors) */
-               else if ((r_ptr->flags2 & RF2_KILL_WALL) && (m_idx != p_ptr->riding))
+               else if ((r_ptr->flags2 & RF2_KILL_WALL) && !is_riding_mon &&
+                        have_flag(f_ptr->flags, FF_TUNNEL) && !have_flag(f_ptr->flags, FF_PERMANENT))
                {
                        /* Eat through walls/doors/rubble */
                        do_move = TRUE;
 
-                       /* Monster destroyed a wall */
+                       /* Monster destroyed a wall (later) */
                        did_kill_wall = TRUE;
-
-                       if (one_in_(GRINDNOISE))
-                       {
-#ifdef JP
-msg_print("¥®¥·¥®¥·¤¤¤¦²»¤¬Ê¹¤³¤¨¤ë¡£");
-#else
-                               msg_print("There is a grinding sound.");
-#endif
-
-                       }
-
-                       /* Forget the wall */
-                       c_ptr->info &= ~(CAVE_MARK);
-
-                       /* Notice */
-                       cave_set_feat(ny, nx, floor_type[randint0(100)]);
-
-                       /* Note changes to viewable region */
-                       if (player_has_los_bold(ny, nx)) do_view = TRUE;
                }
 
                /* Handle doors and secret doors */
                else if (is_closed_door(c_ptr->feat))
                {
                        bool may_bash = TRUE;
+                       feature_type *f_ptr = &f_info[c_ptr->feat];
 
                        /* Assume no move allowed */
                        do_move = FALSE;
 
                        /* Creature can open doors. */
-                       if ((r_ptr->flags2 & RF2_OPEN_DOOR) &&
+                       if ((r_ptr->flags2 & RF2_OPEN_DOOR) && have_flag(f_ptr->flags, FF_OPEN) &&
                                 (!is_pet(m_ptr) || (p_ptr->pet_extra_flags & PF_OPEN_DOORS)))
                        {
                                /* Closed doors */
-                               if (c_ptr->feat == FEAT_DOOR_HEAD)
+                               if (!f_ptr->power)
                                {
                                        /* The door is open */
                                        did_open_door = TRUE;
@@ -3005,18 +2974,13 @@ msg_print("
                                }
 
                                /* Locked doors (not jammed) */
-                               else if (c_ptr->feat < FEAT_DOOR_HEAD + 0x08)
+                               else
                                {
-                                       int k;
-
-                                       /* Door power */
-                                       k = ((c_ptr->feat - FEAT_DOOR_HEAD) & 0x07);
-
                                        /* Try to unlock it XXX XXX XXX */
-                                       if (randint0(m_ptr->hp / 10) > k)
+                                       if (randint0(m_ptr->hp / 10) > f_ptr->power)
                                        {
                                                /* Unlock the door */
-                                               cave_set_feat(ny, nx, FEAT_DOOR_HEAD + 0x00);
+                                               cave_alter_feat(ny, nx, FF_OPEN);
 
                                                /* Do not bash the door */
                                                may_bash = FALSE;
@@ -3025,25 +2989,19 @@ msg_print("
                        }
 
                        /* Stuck doors -- attempt to bash them down if allowed */
-                       if (may_bash && (r_ptr->flags2 & RF2_BASH_DOOR) &&
+                       if (may_bash && (r_ptr->flags2 & RF2_BASH_DOOR) && have_flag(f_ptr->flags, FF_BASH) &&
                                (!is_pet(m_ptr) || (p_ptr->pet_extra_flags & PF_OPEN_DOORS)))
                        {
-                               int k;
-
-                               /* Door power */
-                               k = ((c_ptr->feat - FEAT_DOOR_HEAD) & 0x07);
-
                                /* Attempt to Bash XXX XXX XXX */
-                               if (randint0(m_ptr->hp / 10) > k)
+                               if (randint0(m_ptr->hp / 10) > f_ptr->power)
                                {
                                        /* Message */
 #ifdef JP
-msg_print("¥É¥¢¤ò᤭³«¤±¤ë²»¤¬¤·¤¿¡ª");
+                                       msg_print("¥É¥¢¤ò᤭³«¤±¤ë²»¤¬¤·¤¿¡ª");
 #else
                                        msg_print("You hear a door burst open!");
 #endif
 
-
                                        /* Disturb (sometimes) */
                                        if (disturb_minor) disturb(0, 0);
 
@@ -3062,13 +3020,13 @@ msg_print("
                                /* Break down the door */
                                if (did_bash_door && (randint0(100) < 50))
                                {
-                                       cave_set_feat(ny, nx, FEAT_BROKEN);
+                                       cave_alter_feat(ny, nx, FF_BASH);
                                }
 
                                /* Open the door */
                                else
                                {
-                                       cave_set_feat(ny, nx, FEAT_OPEN);
+                                       cave_alter_feat(ny, nx, FF_OPEN);
                                }
 
                                /* Handle viewable doors */
@@ -3090,11 +3048,10 @@ msg_print("
                                if (c_ptr->info & CAVE_MARK)
                                {
 #ifdef JP
-msg_print("¼é¤ê¤Î¥ë¡¼¥ó¤¬²õ¤ì¤¿¡ª");
+                                       msg_print("¼é¤ê¤Î¥ë¡¼¥ó¤¬²õ¤ì¤¿¡ª");
 #else
                                        msg_print("The rune of protection is broken!");
 #endif
-
                                }
 
                                /* Forget the rune */
@@ -3127,7 +3084,7 @@ msg_print("
                                        if (c_ptr->info & CAVE_MARK)
                                        {
 #ifdef JP
-msg_print("¥ë¡¼¥ó¤¬Çúȯ¤·¤¿¡ª");
+                                               msg_print("¥ë¡¼¥ó¤¬Çúȯ¤·¤¿¡ª");
 #else
                                                msg_print("The rune explodes!");
 #endif
@@ -3138,7 +3095,7 @@ msg_print("
                                else
                                {
 #ifdef JP
-msg_print("Çúȯ¤Î¥ë¡¼¥ó¤Ï²ò½ü¤µ¤ì¤¿¡£");
+                                       msg_print("Çúȯ¤Î¥ë¡¼¥ó¤Ï²ò½ü¤µ¤ì¤¿¡£");
 #else
                                        msg_print("An explosive rune was disarmed.");
 #endif
@@ -3201,13 +3158,6 @@ msg_print("
                                        do_turn = TRUE;
                                }
                        }
-
-                       if ((c_ptr->feat >= FEAT_PATTERN_START) &&
-                               (c_ptr->feat <= FEAT_PATTERN_XTRA2) &&
-                               !do_turn && !(r_ptr->flags7 & RF7_CAN_FLY))
-                       {
-                               do_move = FALSE;
-                       }
                }
 
                /* A monster is in the way */
@@ -3221,12 +3171,9 @@ msg_print("
                        /* Attack 'enemies' */
                        if (((r_ptr->flags2 & RF2_KILL_BODY) && !(r_ptr->flags1 & RF1_NEVER_BLOW) &&
                                 (r_ptr->mexp * r_ptr->level > z_ptr->mexp * z_ptr->level) &&
-                                cave_floor_grid(c_ptr) &&
-                                (c_ptr->m_idx != p_ptr->riding)) ||
+                                can_cross && (c_ptr->m_idx != p_ptr->riding)) ||
                                are_enemies(m_ptr, y_ptr) || m_ptr->confused)
                        {
-                               do_move = FALSE;
-
                                if (!(r_ptr->flags1 & RF1_NEVER_BLOW))
                                {
                                        if (r_ptr->flags2 & RF2_KILL_BODY)
@@ -3255,9 +3202,9 @@ msg_print("
 
                        /* Push past weaker monsters (unless leaving a wall) */
                        else if ((r_ptr->flags2 & RF2_MOVE_BODY) &&
-                               (r_ptr->mexp > z_ptr->mexp) && cave_floor_grid(c_ptr) &&
-                               (cave_floor_grid(&cave[m_ptr->fy][m_ptr->fx])) &&
-                                (c_ptr->m_idx != p_ptr->riding))
+                               (r_ptr->mexp > z_ptr->mexp) &&
+                               can_cross && (c_ptr->m_idx != p_ptr->riding) &&
+                               monster_can_cross_terrain(cave[m_ptr->fy][m_ptr->fx].feat, z_ptr, 0))
                        {
                                /* Allow movement */
                                do_move = TRUE;
@@ -3275,7 +3222,7 @@ msg_print("
                 * to allow monsters to attack an enemy,
                 * even if it can't enter the terrain.
                 */
-               if (do_move && !monster_can_cross_terrain(c_ptr->feat, r_ptr))
+               if (do_move && !can_cross && !did_kill_wall)
                {
                        /* Assume no move allowed */
                        do_move = FALSE;
@@ -3291,7 +3238,7 @@ msg_print("
                        do_move = FALSE;
                }
 
-               if (m_idx == p_ptr->riding)
+               if (is_riding_mon)
                {
                        if (!p_ptr->riding_ryoute && !(m_list[p_ptr->riding].monfear)) do_move = FALSE;
                }
@@ -3307,14 +3254,25 @@ msg_print("
                        /* Hack -- Update the old location */
                        cave[oy][ox].m_idx = c_ptr->m_idx;
 
-                       if (c_ptr->feat == FEAT_TREES)
+                       if (did_kill_wall)
                        {
-                               if (r_ptr->flags2 & RF2_KILL_WALL)
+                               if (one_in_(GRINDNOISE))
                                {
-                                       cave_set_feat(ny, nx, FEAT_GRASS);
-
+#ifdef JP
+                                       msg_print("¥®¥·¥®¥·¤¤¤¦²»¤¬Ê¹¤³¤¨¤ë¡£");
+#else
+                                       msg_print("There is a grinding sound.");
+#endif
                                }
-                               if (!(r_ptr->flags7 & RF7_CAN_FLY) && !(r_ptr->flags8 & RF8_WILD_WOOD))
+
+                               cave_alter_feat(ny, nx, FF_HURT_DISI);
+
+                               /* Note changes to viewable region */
+                               if (player_has_los_bold(ny, nx)) do_view = TRUE;
+                       }
+                       else if (have_flag(f_ptr->flags, FF_TREE))
+                       {
+                               if (!(r_ptr->flags7 & RF7_CAN_FLY) && (!is_riding_mon || !p_ptr->ffall) && !(r_ptr->flags8 & RF8_WILD_WOOD))
                                {
                                        m_ptr->energy_need += ENERGY_NEED();
                                }
@@ -3347,7 +3305,7 @@ msg_print("
                        /* Update the monster */
                        update_mon(m_idx, TRUE);
 
-                       if (p_ptr->riding == m_idx)
+                       if (is_riding_mon)
                        {
                                py = ny;
                                px = nx;
@@ -3359,7 +3317,7 @@ msg_print("
                        /* Redraw the new grid */
                        lite_spot(ny, nx);
 
-                       if (p_ptr->riding == m_idx)
+                       if (is_riding_mon)
                        {
                                verify_panel();
 
@@ -3462,9 +3420,9 @@ msg_print("
                                                        {
                                                                /* Dump a message */
 #ifdef JP
-msg_format("%^s¤Ï%s¤ò½¦¤ª¤¦¤È¤·¤¿¤¬¡¢¤À¤á¤À¤Ã¤¿¡£", m_name, o_name);
+                                                               msg_format("%^s¤Ï%s¤ò½¦¤ª¤¦¤È¤·¤¿¤¬¡¢¤À¤á¤À¤Ã¤¿¡£", m_name, o_name);
 #else
-msg_format("%^s tries to pick up %s, but fails.", m_name, o_name);
+                                                               msg_format("%^s tries to pick up %s, but fails.", m_name, o_name);
 #endif
                                                        }
                                                }
@@ -3481,11 +3439,10 @@ msg_format("%^s tries to pick up %s, but fails.", m_name, o_name);
                                                {
                                                        /* Dump a message */
 #ifdef JP
-msg_format("%^s¤¬%s¤ò½¦¤Ã¤¿¡£", m_name, o_name);
+                                                       msg_format("%^s¤¬%s¤ò½¦¤Ã¤¿¡£", m_name, o_name);
 #else
                                                        msg_format("%^s picks up %s.", m_name, o_name);
 #endif
-
                                                }
 
                                                /* Excise the object */
@@ -3518,11 +3475,10 @@ msg_format("%^s
                                                {
                                                        /* Dump a message */
 #ifdef JP
-msg_format("%^s¤¬%s¤òÇ˲õ¤·¤¿¡£", m_name, o_name);
+                                                       msg_format("%^s¤¬%s¤òÇ˲õ¤·¤¿¡£", m_name, o_name);
 #else
                                                        msg_format("%^s destroys %s.", m_name, o_name);
 #endif
-
                                                }
 
                                                /* Delete the object */
@@ -3544,7 +3500,7 @@ msg_format("%^s
                m_ptr->mflag2 &= ~MFLAG2_NOFLOW;
 
        /* If we haven't done anything, try casting a spell again */
-       if (!do_turn && !do_move && !m_ptr->monfear && !(p_ptr->riding == m_idx) && aware)
+       if (!do_turn && !do_move && !m_ptr->monfear && !is_riding_mon && aware)
        {
                /* Try to cast spell again */
                if (r_ptr->freq_spell && randint1(100) <= r_ptr->freq_spell)
@@ -3784,7 +3740,7 @@ void process_monsters(void)
                /* Hack -- Monsters can "smell" the player from far away */
                /* Note that most monsters have "aaf" of "20" or so */
                else if (!(m_ptr->mflag2 & MFLAG2_NOFLOW) &&
-                       (cave_floor_bold(py, px) || (cave[py][px].feat == FEAT_TREES)) &&
+                       have_flag(f_flags_bold(py, px), FF_MOVE) &&
                        (cave[py][px].when == cave[fy][fx].when) &&
                        (cave[fy][fx].dist < MONSTER_FLOW_DEPTH) &&
                        (cave[fy][fx].dist < r_ptr->aaf))
index c7438ed..d6e2aa8 100644 (file)
@@ -1485,13 +1485,13 @@ static bool cast_berserk_spell(int spell)
 
                py_attack(y, x, 0);
 
-               if (!player_can_enter(cave[y][x].feat) || is_trap(cave[y][x].feat))
+               if (!player_can_enter(cave[y][x].feat, 0) || is_trap(cave[y][x].feat))
                        break;
 
                y += ddy[dir];
                x += ddx[dir];
 
-               if (player_can_enter(cave[y][x].feat) && !is_trap(cave[y][x].feat) && !cave[y][x].m_idx)
+               if (player_can_enter(cave[y][x].feat, 0) && !is_trap(cave[y][x].feat) && !cave[y][x].m_idx)
                {
                        int oy, ox;
 
@@ -1751,8 +1751,7 @@ msg_print("
 
                        if (in_bounds(ny, nx) && cave_empty_bold(ny, nx) &&
                            !(c_ptr->info & CAVE_OBJECT) &&
-                           !(c_ptr->feat >= FEAT_PATTERN_START &&
-                             c_ptr->feat <= FEAT_PATTERN_XTRA2))
+                               !pattern_tile(ny, nx))
                        {
                                ty = ny;
                                tx = nx;
index e81d57f..7f25709 100644 (file)
@@ -3331,19 +3331,33 @@ monster_hook_type get_monster_hook(void)
 
 monster_hook_type get_monster_hook2(int y, int x)
 {
+       feature_type *f_ptr = &f_info[cave[y][x].feat];
+
        /* Set the monster list */
-       switch (cave[y][x].feat)
-       {
-       case FEAT_SHAL_WATER:
-               return (monster_hook_type)mon_hook_shallow_water;
-       case FEAT_DEEP_WATER:
-               return (monster_hook_type)mon_hook_deep_water;
-       case FEAT_DEEP_LAVA:
-       case FEAT_SHAL_LAVA:
+
+       /* Water */
+       if (have_flag(f_ptr->flags, FF_WATER))
+       {
+               /* Deep water */
+               if (have_flag(f_ptr->flags, FF_DEEP))
+               {
+                       return (monster_hook_type)mon_hook_deep_water;
+               }
+
+               /* Shallow water */
+               else
+               {
+                       return (monster_hook_type)mon_hook_shallow_water;
+               }
+       }
+
+       /* Lava */
+       else if (have_flag(f_ptr->flags, FF_LAVA))
+       {
                return (monster_hook_type)mon_hook_lava;
-       default:
-               return (monster_hook_type)mon_hook_floor;
        }
+
+       else return (monster_hook_type)mon_hook_floor;
 }
 
 
@@ -3403,52 +3417,66 @@ msg_format("%^s
 /*
  * Check if monster can cross terrain
  */
-bool monster_can_cross_terrain(byte feat, monster_race *r_ptr)
+bool monster_can_cross_terrain(s16b feat, monster_race *r_ptr, u16b mode)
 {
-       /* Pit */
-       if (feat == FEAT_DARK_PIT)
+       feature_type *f_ptr = &f_info[feat];
+
+       /* Pattern */
+       if (have_flag(f_ptr->flags, FF_PATTERN))
        {
-               if (r_ptr->flags7 & RF7_CAN_FLY)
-                       return TRUE;
+               if (!(mode & CEM_RIDING))
+               {
+                       if (!(r_ptr->flags7 & RF7_CAN_FLY)) return FALSE;
+               }
                else
-                       return FALSE;
+               {
+                       if (!(mode & CEM_P_CAN_ENTER_PATTERN)) return FALSE;
+               }
        }
-       /* Deep water */
-       if (feat == FEAT_DEEP_WATER)
+
+       /* "CAN" flags */
+       if (have_flag(f_ptr->flags, FF_CAN_FLY) && (r_ptr->flags7 & RF7_CAN_FLY)) return TRUE;
+       if (have_flag(f_ptr->flags, FF_CAN_SWIM) && (r_ptr->flags7 & RF7_CAN_SWIM)) return TRUE;
+       if (have_flag(f_ptr->flags, FF_CAN_PASS))
        {
-               if ((r_ptr->flags7 & RF7_AQUATIC) ||
-                   (r_ptr->flags7 & RF7_CAN_FLY) ||
-                   (r_ptr->flags7 & RF7_CAN_SWIM))
-                       return TRUE;
-               else
-                       return FALSE;
+               if ((r_ptr->flags2 & RF2_PASS_WALL) && (!(mode & CEM_RIDING) || p_ptr->pass_wall)) return TRUE;
        }
-       /* Shallow water */
-       else if (feat == FEAT_SHAL_WATER)
+
+       if (!have_flag(f_ptr->flags, FF_MOVE))
        {
-               if (!(r_ptr->flags2 & RF2_AURA_FIRE) ||
-                   (r_ptr->flags7 & RF7_AQUATIC) ||
-                   (r_ptr->flags7 & RF7_CAN_FLY) ||
-                   (r_ptr->flags7 & RF7_CAN_SWIM))
-                       return TRUE;
-               else
-                       return FALSE;
+               /* Can fly over mountain on the surface */
+               if (have_flag(f_ptr->flags, FF_MOUNTAIN) && !dun_level)
+               {
+                       if ((r_ptr->flags7 & RF7_CAN_FLY) || (r_ptr->flags8 & RF8_WILD_MOUNTAIN))
+                               return TRUE;
+               }
+
+               /* Cannot enter */
+               return FALSE;
        }
-       /* Aquatic monster */
-       else if ((r_ptr->flags7 & RF7_AQUATIC) &&
-                   !(r_ptr->flags7 & RF7_CAN_FLY))
+
+       if (have_flag(f_ptr->flags, FF_MUST_FLY) && !(r_ptr->flags7 & RF7_CAN_FLY)) return FALSE;
+
+       /* Water */
+       if (have_flag(f_ptr->flags, FF_WATER))
        {
-               return FALSE;
+               if (!(r_ptr->flags7 & RF7_AQUATIC))
+               {
+                       /* Deep water */
+                       if (have_flag(f_ptr->flags, FF_DEEP)) return FALSE;
+
+                       /* Shallow water */
+                       else if (r_ptr->flags2 & RF2_AURA_FIRE) return FALSE;
+               }
        }
+
+       /* Aquatic monster into non-water? */
+       else if (r_ptr->flags7 & RF7_AQUATIC) return FALSE;
+
        /* Lava */
-       else if ((feat == FEAT_SHAL_LAVA) ||
-           (feat == FEAT_DEEP_LAVA))
+       if (have_flag(f_ptr->flags, FF_LAVA))
        {
-               if ((r_ptr->flagsr & RFR_EFF_IM_FIRE_MASK) ||
-                   (r_ptr->flags7 & RF7_CAN_FLY))
-                       return TRUE;
-               else
-                       return FALSE;
+               if (!(r_ptr->flagsr & RFR_EFF_IM_FIRE_MASK)) return FALSE;
        }
 
        return TRUE;
@@ -3458,92 +3486,15 @@ bool monster_can_cross_terrain(byte feat, monster_race *r_ptr)
 /*
  * Strictly check if monster can enter the grid
  */
-bool monster_can_enter(int y, int x, monster_race *r_ptr)
+bool monster_can_enter(int y, int x, monster_race *r_ptr, u16b mode)
 {
        cave_type *c_ptr = &cave[y][x];
-       byte feat = c_ptr->feat;
 
        /* Player or other monster */
        if (player_bold(y, x)) return FALSE;
        if (c_ptr->m_idx) return FALSE;
 
-       /* Permanent wall */
-       if ((c_ptr->feat >= FEAT_PERM_EXTRA) &&
-           (c_ptr->feat <= FEAT_PERM_SOLID))
-               return FALSE;
-
-       /* Can fly over the Pattern */
-       if ((c_ptr->feat >= FEAT_PATTERN_START) &&
-           (c_ptr->feat <= FEAT_PATTERN_XTRA2))
-       {
-           if (!(r_ptr->flags7 & RF7_CAN_FLY))
-                   return FALSE;
-           else
-                   return TRUE;
-       }
-
-       /* Can fly over mountain on the surface */
-       if (feat == FEAT_MOUNTAIN)
-       {
-           if (!dun_level && 
-               ((r_ptr->flags7 & RF7_CAN_FLY) ||
-                (r_ptr->flags8 & RF8_WILD_MOUNTAIN)))
-                   return TRUE;
-           else
-                   return FALSE;
-       }
-
-       /* Cannot enter wall without pass wall ability */
-       if (!cave_floor_grid(c_ptr) && !(r_ptr->flags2 & RF2_PASS_WALL))
-               return FALSE;
-
-       /* Pit */
-       if (feat == FEAT_DARK_PIT)
-       {
-               if (r_ptr->flags7 & RF7_CAN_FLY)
-                       return TRUE;
-               else
-                       return FALSE;
-       }
-       /* Deep water */
-       if (feat == FEAT_DEEP_WATER)
-       {
-               if ((r_ptr->flags7 & RF7_AQUATIC) ||
-                   (r_ptr->flags7 & RF7_CAN_FLY) ||
-                   (r_ptr->flags7 & RF7_CAN_SWIM))
-                       return TRUE;
-               else
-                       return FALSE;
-       }
-       /* Shallow water */
-       else if (feat == FEAT_SHAL_WATER)
-       {
-               if (!(r_ptr->flags2 & RF2_AURA_FIRE) ||
-                   (r_ptr->flags7 & RF7_AQUATIC) ||
-                   (r_ptr->flags7 & RF7_CAN_FLY) ||
-                   (r_ptr->flags7 & RF7_CAN_SWIM))
-                       return TRUE;
-               else
-                       return FALSE;
-       }
-       /* Aquatic monster */
-       else if ((r_ptr->flags7 & RF7_AQUATIC) &&
-                   !(r_ptr->flags7 & RF7_CAN_FLY))
-       {
-               return FALSE;
-       }
-       /* Lava */
-       else if ((feat == FEAT_SHAL_LAVA) ||
-           (feat == FEAT_DEEP_LAVA))
-       {
-               if ((r_ptr->flagsr & RFR_EFF_IM_FIRE_MASK) ||
-                   (r_ptr->flags7 & RF7_CAN_FLY))
-                       return TRUE;
-               else
-                       return FALSE;
-       }
-
-       return TRUE;
+       return monster_can_cross_terrain(c_ptr->feat, r_ptr, mode);
 }
 
 
index 46a725b..3902d23 100644 (file)
@@ -2686,7 +2686,7 @@ static bool monster_hook_chameleon_lord(int r_idx)
        if ((r_ptr->blow[0].method == RBM_EXPLODE) || (r_ptr->blow[1].method == RBM_EXPLODE) || (r_ptr->blow[2].method == RBM_EXPLODE) || (r_ptr->blow[3].method == RBM_EXPLODE))
                return FALSE;
 
-       if (!monster_can_cross_terrain(cave[m_ptr->fy][m_ptr->fx].feat, r_ptr)) return FALSE;
+       if (!monster_can_cross_terrain(cave[m_ptr->fy][m_ptr->fx].feat, r_ptr, 0)) return FALSE;
 
        /* Not born */
        if (!(old_r_ptr->flags7 & RF7_CHAMELEON))
@@ -2716,7 +2716,7 @@ static bool monster_hook_chameleon(int r_idx)
        if ((r_ptr->blow[0].method == RBM_EXPLODE) || (r_ptr->blow[1].method == RBM_EXPLODE) || (r_ptr->blow[2].method == RBM_EXPLODE) || (r_ptr->blow[3].method == RBM_EXPLODE))
                return FALSE;
 
-       if (!monster_can_cross_terrain(cave[m_ptr->fy][m_ptr->fx].feat, r_ptr)) return FALSE;
+       if (!monster_can_cross_terrain(cave[m_ptr->fy][m_ptr->fx].feat, r_ptr, 0)) return FALSE;
 
        /* Not born */
        if (!(old_r_ptr->flags7 & RF7_CHAMELEON))
@@ -2927,33 +2927,24 @@ static bool place_monster_one(int who, int y, int x, int r_idx, u32b mode)
        cptr            name = (r_name + r_ptr->name);
 
        /* DO NOT PLACE A MONSTER IN THE SMALL SCALE WILDERNESS !!! */
-       if(p_ptr->wild_mode) return FALSE;
+       if (p_ptr->wild_mode) return FALSE;
 
        /* Verify location */
        if (!in_bounds(y, x)) return (FALSE);
 
-       /* Require empty space (if not ghostly) */
-       if (!(!dun_level && (c_ptr->feat == FEAT_MOUNTAIN) && ((r_ptr->flags8 & RF8_WILD_MOUNTAIN) || (r_ptr->flags7 & RF7_CAN_FLY))) &&
-           !(cave_empty_bold2(y, x) || (mode & PM_IGNORE_TERRAIN)) &&
-           !((r_ptr->flags2 & RF2_PASS_WALL) &&
-             !(cave_perma_bold(y, x) || c_ptr->m_idx ||
-           player_bold(y, x)))) return (FALSE);
-
        /* Paranoia */
        if (!r_idx) return (FALSE);
 
        /* Paranoia */
        if (!r_ptr->name) return (FALSE);
 
-       /* Nor on the Pattern */
-       if ((c_ptr->feat >= FEAT_PATTERN_START)
-        && (c_ptr->feat <= FEAT_PATTERN_XTRA2))
-               return (FALSE);
-
-       if (!(mode & PM_IGNORE_TERRAIN) &&
-           !monster_can_cross_terrain(c_ptr->feat, r_ptr))
+       if (!(mode & PM_IGNORE_TERRAIN))
        {
-               return FALSE;
+               /* Not on the Pattern */
+               if (pattern_tile(y, x)) return FALSE;
+
+               /* Require empty space (if not ghostly) */
+               if (!monster_can_enter(y, x, r_ptr, 0)) return FALSE;
        }
 
        if (!p_ptr->inside_battle)
@@ -3422,9 +3413,7 @@ static bool mon_scatter(int *yp, int *xp, int y, int x, int max_dist)
                        if (!cave_empty_bold2(ny, nx)) continue;
 
                        /* ... nor on the Pattern */
-                       if ((cave[ny][nx].feat >= FEAT_PATTERN_START) &&
-                           (cave[ny][nx].feat <= FEAT_PATTERN_XTRA2))
-                               continue;
+                       if (pattern_tile(ny, nx)) continue;
 
                        i = distance(y, x, ny, nx);
 
@@ -3794,7 +3783,7 @@ bool alloc_guardian(void)
                        ox = randint1(cur_wid - 4) + 2;
 
                        /* Is it a good spot ? */
-                       if (cave_empty_bold2(oy, ox) && monster_can_cross_terrain(cave[oy][ox].feat, &r_info[guardian]))
+                       if (cave_empty_bold2(oy, ox) && monster_can_cross_terrain(cave[oy][ox].feat, &r_info[guardian], 0))
                        {
                                /* Place the guardian */
                                if (place_monster_aux(0, oy, ox, guardian, (PM_ALLOW_GROUP | PM_NO_KAGE | PM_NO_PET))) return TRUE;
@@ -3840,7 +3829,7 @@ bool alloc_monster(int dis, u32b mode)
                }
                else
                {
-                       if (!cave_empty_bold2(y, x) && (cave[y][x].feat != FEAT_MOUNTAIN)) continue;
+                       if (!cave_empty_bold2(y, x) && !have_flag(f_flags_bold(y, x), FF_MOUNTAIN)) continue;
                }
 
                /* Accept far away grids */
index fa6365a..dd04f8c 100644 (file)
@@ -370,11 +370,10 @@ bool summon_possible(int y1, int x1)
                        if (distance(y1, x1, y, x)>2) continue;
 
                        /* ...nor on the Pattern */
-                       if ((cave[y][x].feat >= FEAT_PATTERN_START)
-                               && (cave[y][x].feat <= FEAT_PATTERN_XTRA2)) continue;
+                       if (pattern_tile(y, x)) continue;
 
                        /* Require empty floor grid in line of sight */
-                       if ((cave_empty_bold(y, x) || (cave[y][x].feat == FEAT_TREES)) && los(y1, x1, y, x) && los(y, x, y1, x1)) return (TRUE);
+                       if (cave_empty_bold(y, x) && los(y1, x1, y, x) && los(y, x, y1, x1)) return (TRUE);
                }
        }
 
@@ -1361,14 +1360,8 @@ bool make_attack_spell(int m_idx)
                                /* Access the next grid */
                                c_ptr = &cave[next_y][next_x];
 
-                               /* Skip door, rubble, wall */
-                               if ((c_ptr->feat >= FEAT_DOOR_HEAD) && (c_ptr->feat <= FEAT_PERM_SOLID)) continue;
-
-                               /* Skip tree */
-                               if (c_ptr->feat == FEAT_TREES) continue;
-
-                               /* Skip mountain */
-                               if (c_ptr->feat == FEAT_MOUNTAIN) continue;
+                               /* Skip door, rubble, wall, tree, mountain, etc. */
+                               if (!have_flag(f_flags_grid(c_ptr), FF_PROJECT)) continue;
 
                                if (projectable(m_ptr->fy, m_ptr->fx, next_y, next_x))
                                {
index 866be03..f2afa5c 100644 (file)
@@ -3459,11 +3459,14 @@ bool mutation_power_aux(u32b power)
                        {
                                int x, y, ox, oy;
                                cave_type *c_ptr;
+                               feature_type *f_ptr;
 
                                if (!get_rep_dir2(&dir)) return FALSE;
                                y = py + ddy[dir];
                                x = px + ddx[dir];
                                c_ptr = &cave[y][x];
+                               f_ptr = &f_info[c_ptr->feat];
+
                                if (cave_floor_bold(y, x) || boundary_floor_grid(c_ptr))
                                {
 #ifdef JP
@@ -3474,14 +3477,12 @@ bool mutation_power_aux(u32b power)
 
                                        break;
                                }
-                               else if (((c_ptr->feat >= FEAT_PERM_EXTRA) &&
-                                       (c_ptr->feat <= FEAT_PERM_SOLID)) ||
-                                       (c_ptr->feat == FEAT_MOUNTAIN))
+                               else if (have_flag(f_ptr->flags, FF_PERMANENT))
                                {
 #ifdef JP
-                                       msg_format("¤¤¤Æ¤Ã¡ª¤³¤Î%s¤Ï¤¢¤Ê¤¿¤Î»õ¤è¤ê¹Å¤¤¡ª", (c_ptr->mimic == FEAT_TREES) ? "ÌÚ" : "ÊÉ");
+                                       msg_format("¤¤¤Æ¤Ã¡ª¤³¤Î%s¤Ï¤¢¤Ê¤¿¤Î»õ¤è¤ê¹Å¤¤¡ª", f_name + f_info[get_feat_mimic(c_ptr)].name);
 #else
-                                       msg_format("Ouch!  This %s is harder than your teeth!", (c_ptr->mimic == FEAT_TREES) ? "tree" : "wall");
+                                       msg_format("Ouch!  This %s is harder than your teeth!", f_name + f_info[get_feat_mimic(c_ptr)].name);
 #endif
 
                                        break;
@@ -3496,7 +3497,7 @@ bool mutation_power_aux(u32b power)
 
                                        break;
                                }
-                               else if (c_ptr->feat == FEAT_TREES)
+                               else if (have_flag(f_ptr->flags, FF_TREE))
                                {
 #ifdef JP
                                        msg_print("ÌڤϤ¢¤Þ¤êÈþÌ£¤·¤¯¤Ê¤¤¡ª");
index 0dfd1f3..0c8884c 100644 (file)
@@ -33,7 +33,7 @@
  */
 void reset_visuals(void)
 {
-       int i;
+       int i, j;
 
        /* Extract some info about terrain features */
        for (i = 0; i < max_f_idx; i++)
@@ -41,8 +41,11 @@ void reset_visuals(void)
                feature_type *f_ptr = &f_info[i];
 
                /* Assume we will use the underlying values */
-               f_ptr->x_attr = f_ptr->d_attr;
-               f_ptr->x_char = f_ptr->d_char;
+               for (j = 0; j < F_LIT_MAX; j++)
+               {
+                       f_ptr->x_attr[j] = f_ptr->d_attr[j];
+                       f_ptr->x_char[j] = f_ptr->d_char[j];
+               }
        }
 
        /* Extract default attr/char code for objects */
index 7aab6cd..547d4ff 100644 (file)
@@ -4984,15 +4984,10 @@ s16b drop_near(object_type *j_ptr, int chance, int y, int x)
                        /* Obtain grid */
                        c_ptr = &cave[ty][tx];
 
+                       /* Require drop space */
+                       if (!have_flag(f_flags_grid(c_ptr), FF_DROP)) continue;
+
                        /* Require floor space */
-                       if ((c_ptr->feat != FEAT_FLOOR) &&
-                           (c_ptr->feat != FEAT_SHAL_WATER) &&
-                           (c_ptr->feat != FEAT_GRASS) &&
-                           (c_ptr->feat != FEAT_DIRT) &&
-                           (c_ptr->feat != FEAT_FLOWER) &&
-                           (c_ptr->feat != FEAT_DEEP_GRASS) &&
-                           (c_ptr->feat != FEAT_SHAL_LAVA) &&
-                           (c_ptr->feat != FEAT_TREES)) continue;
                        if (c_ptr->info & (CAVE_OBJECT)) continue;
 
                        /* No objects */
@@ -5089,16 +5084,6 @@ s16b drop_near(object_type *j_ptr, int chance, int y, int x)
                        tx = randint0(cur_wid);
                }
 
-               /* Grid */
-               c_ptr = &cave[ty][tx];
-
-               /* Require floor space (or shallow terrain) -KMW- */
-               if ((c_ptr->feat != FEAT_FLOOR) &&
-                   (c_ptr->feat != FEAT_SHAL_WATER) &&
-                   (c_ptr->feat != FEAT_GRASS) &&
-                   (c_ptr->feat != FEAT_DIRT) &&
-                   (c_ptr->feat != FEAT_SHAL_LAVA)) continue;
-
                /* Bounce to that location */
                by = ty;
                bx = tx;
@@ -5292,9 +5277,9 @@ static int trap_num[MAX_TRAPS] =
  * Actually, it is not this routine, but the "trap instantiation"
  * code, which should also check for "trap doors" on quest levels.
  */
-byte choose_random_trap(void)
+s16b choose_random_trap(void)
 {
-       byte feat;
+       s16b feat;
 
        /* Pick a trap */
        while (1)
@@ -5303,7 +5288,7 @@ byte choose_random_trap(void)
                feat = trap_num[randint0(MAX_TRAPS)];
 
                /* Accept non-trapdoors */
-               if (feat != FEAT_TRAP_TRAPDOOR) break;
+               if (!have_flag(f_info[feat].flags, FF_MORE)) break;
 
                /* Hack -- no trap doors on special levels */
                if (p_ptr->inside_arena || quest_number(dun_level)) continue;
@@ -5324,17 +5309,22 @@ void disclose_grid(int y, int x)
 {
        cave_type *c_ptr = &cave[y][x];
 
-       /* Paranoia */
-       if (!c_ptr->mimic) return;
-
-       /* No longer hidden */
-       c_ptr->mimic = 0;
+       if (have_flag(f_flags_grid(c_ptr), FF_SECRET))
+       {
+               /* No longer hidden */
+               cave_alter_feat(y, x, FF_SECRET);
+       }
+       else if (c_ptr->mimic)
+       {
+               /* No longer hidden */
+               c_ptr->mimic = 0;
 
-       /* Notice */
-       note_spot(y, x);
+               /* Notice */
+               note_spot(y, x);
 
-       /* Redraw */
-       lite_spot(y, x);
+               /* Redraw */
+               lite_spot(y, x);
+       }
 }
 
 
@@ -5355,7 +5345,7 @@ void place_trap(int y, int x)
        if (!in_bounds(y, x)) return;
 
        /* Require empty, clean, floor grid */
-       if (!cave_naked_bold(y, x)) return;
+       if (!cave_clean_bold(y, x)) return;
 
        /* Place an invisible trap */
        c_ptr->mimic = c_ptr->feat;
@@ -6827,7 +6817,7 @@ bool process_warning(int xx, int yy)
        else old_damage = old_damage / 2;
 
        c_ptr = &cave[yy][xx];
-       if (((!easy_disarm && (is_trap(c_ptr->feat) || c_ptr->feat == FEAT_INVIS))
+       if (((!easy_disarm && is_trap(c_ptr->feat))
            || (c_ptr->mimic && is_trap(c_ptr->feat))) && !one_in_(13))
        {
                object_type *o_ptr = choose_warning_item();
index c9e7a37..7214bf1 100644 (file)
@@ -103,7 +103,7 @@ static void place_secret_door(int y, int x)
                c_ptr->mimic = feat_wall_inner;
 
                /* Floor type terrain cannot hide a door */
-               if (feat_floor(c_ptr->mimic))
+               if (feat_supports_los(c_ptr->mimic))
                {
                        c_ptr->feat = c_ptr->mimic;
                        c_ptr->mimic = 0;
@@ -3184,10 +3184,10 @@ static void generate_hmap(int y0, int x0, int xsiz, int ysiz, int grd, int roug,
        fill_data.ymin = y0 - yhsize;
        fill_data.xmax = x0 + xhsize;
        fill_data.ymax = y0 + yhsize;
-       
+
        /* Store cutoff in global for quick access */
        fill_data.c1 = cutoff;
-       
+
        /*
        * Scale factor for middle points:
        * About sqrt(2) * 256 - correct for a square lattice
@@ -3203,8 +3203,8 @@ static void generate_hmap(int y0, int x0, int xsiz, int ysiz, int grd, int roug,
        {
                for (j = 0; j <= ysize; j++)
                {
-                       /* 255 is a flag for "not done yet" */
-                       cave[(int)(fill_data.ymin + j)][(int)(fill_data.xmin + i)].feat = 255;
+                       /* -1 is a flag for "not done yet" */
+                       cave[(int)(fill_data.ymin + j)][(int)(fill_data.xmin + i)].feat = -1;
                        /* Clear icky flag because may be redoing the cave */
                        cave[(int)(fill_data.ymin + j)][(int)(fill_data.xmin + i)].info &= ~(CAVE_ICKY);
                }
@@ -3236,11 +3236,11 @@ static void generate_hmap(int y0, int x0, int xsiz, int ysiz, int grd, int roug,
                xhstep /= 2;
                ystep = yhstep;
                yhstep /= 2;
-               
+
                /* cache well used values */
                xstep2 = xstep / 256;
                ystep2 = ystep / 256;
-               
+
                xhstep2 = xhstep / 256;
                yhstep2 = yhstep / 256;
 
@@ -3252,10 +3252,10 @@ static void generate_hmap(int y0, int x0, int xsiz, int ysiz, int grd, int roug,
                                /* cache often used values */
                                ii = i / 256 + fill_data.xmin;
                                jj = j / 256 + fill_data.ymin;
-                               
+
                                /* Test square */
-                               if (cave[jj][ii].feat == 255)
-                               {                               
+                               if (cave[jj][ii].feat == -1)
+                               {
                                        if (xhstep2 > grd)
                                        {
                                                /* If greater than 'grid' level then is random */
@@ -3282,9 +3282,9 @@ static void generate_hmap(int y0, int x0, int xsiz, int ysiz, int grd, int roug,
                                /* cache often used values */
                                ii = i / 256 + fill_data.xmin;
                                jj = j / 256 + fill_data.ymin;
-                               
+
                                /* Test square */
-                               if (cave[jj][ii].feat == 255)
+                               if (cave[jj][ii].feat == -1)
                                {
                                        if (xhstep2 > grd)
                                        {
@@ -3311,10 +3311,10 @@ static void generate_hmap(int y0, int x0, int xsiz, int ysiz, int grd, int roug,
                                /* cache often used values */
                                ii = i / 256 + fill_data.xmin;
                                jj = j / 256 + fill_data.ymin;
-                               
+
                                /* Test square */
-                               if (cave[jj][ii].feat == 255)
-                               {                               
+                               if (cave[jj][ii].feat == -1)
+                               {
                                        if (xhstep2 > grd)
                                        {
                                                /* If greater than 'grid' level then is random */
@@ -3326,12 +3326,12 @@ static void generate_hmap(int y0, int x0, int xsiz, int ysiz, int grd, int roug,
                                                xm = fill_data.xmin + (i - xhstep) / 256;
                                                xp = fill_data.xmin + (i + xhstep) / 256;
                                                ym = fill_data.ymin + (j - yhstep) / 256;
-                                               yp = fill_data.ymin + (j + yhstep) / 256;                                       
-                                       
+                                               yp = fill_data.ymin + (j + yhstep) / 256;
+
                                                /* 
                                                 * Average over all four corners + scale by diagsize to
                                                 * reduce the effect of the square grid on the shape of the fractal
-                                                */                             
+                                                */
                                                store_height(ii, jj,
                                                        (cave[ym][xm].feat + cave[yp][xm].feat
                                                        + cave[ym][xp].feat + cave[yp][xp].feat) / 4
@@ -3504,7 +3504,6 @@ static void cave_fill(byte y, byte x)
 static bool generate_fracave(int y0, int x0, int xsize, int ysize, int cutoff, bool light, bool room)
 {
        int x, y, i, xhsize, yhsize;
-       
 
        /* offsets to middle from corner */
        xhsize = xsize / 2;
@@ -3905,9 +3904,8 @@ static bool generate_lake(int y0, int x0, int xsize, int ysize, int c1, int c2,
                        /* turn off icky flag (no longer needed.) */
                        cave[y0 + y - yhsize][x0 + x - xhsize].info &= ~(CAVE_ICKY | CAVE_ROOM);
 
-                       /* Light lava and trees */
-                       if ((cave[y0 + y - yhsize][x0 + x - xhsize].feat == FEAT_DEEP_LAVA) ||
-                               (cave[y0 + y - yhsize][x0 + x - xhsize].feat == FEAT_SHAL_LAVA))
+                       /* Light lava */
+                       if (have_flag(f_flags_bold(y0 + y - yhsize, x0 + x - xhsize), FF_LAVA))
                        {
                                if (!(d_info[dungeon_type].flags1 & DF1_DARKNESS)) cave[y0 + y - yhsize][x0 + x - xhsize].info |= CAVE_GLOW;
                        }
@@ -4053,8 +4051,7 @@ static void fill_treasure(int x1, int x2, int y1, int y2, int difficulty)
 
                         /* if floor, shallow water and lava */
                        if (is_floor_bold(y, x) ||
-                           (cave[y][x].feat == FEAT_SHAL_WATER) ||
-                           (cave[y][x].feat == FEAT_SHAL_LAVA))
+                           (have_flag(f_flags_bold(y, x), FF_PLACE) && have_flag(f_flags_bold(y, x), FF_DROP)))
                        {
                                /* The smaller 'value' is, the better the stuff */
                                if (value < 0)
@@ -5029,16 +5026,22 @@ static void build_castle_vault(int x0, int y0, int xsize, int ysize)
 static void add_outer_wall(int x, int y, int light,
                                                                        int x1, int y1, int x2, int y2)
 {
+       cave_type *c_ptr;
+       feature_type *f_ptr;
        int i, j;
 
        if (!in_bounds(y, x)) return;
 
+       c_ptr = &cave[y][x];
+
        /* hack- check to see if square has been visited before
        * if so, then exit (use room flag to do this) */
-       if (cave[y][x].info & CAVE_ROOM) return;
+       if (c_ptr->info & CAVE_ROOM) return;
 
        /* set room flag */
-       cave[y][x].info |= CAVE_ROOM;
+       c_ptr->info |= CAVE_ROOM;
+
+       f_ptr = &f_info[c_ptr->feat];
 
        if (is_floor_bold(y, x))
        {
@@ -5050,7 +5053,7 @@ static void add_outer_wall(int x, int y, int light,
                                         (y + j >= y1) && (y + j <= y2))
                                {
                                        add_outer_wall(x + i, y + j, light, x1, y1, x2, y2);
-                                       if (light) cave[y][x].info |= CAVE_GLOW;
+                                       if (light) c_ptr->info |= CAVE_GLOW;
                                }
                        }
                }
@@ -5059,12 +5062,12 @@ static void add_outer_wall(int x, int y, int light,
        {
                /* Set bounding walls */
                place_outer_bold(y, x);
-               if (light) cave[y][x].info |= CAVE_GLOW;
+               if (light) c_ptr->info |= CAVE_GLOW;
        }
-       else if (cave[y][x].feat == FEAT_PERM_OUTER)
+       else if (have_flag(f_ptr->flags, FF_WALL) && have_flag(f_ptr->flags, FF_PERMANENT) && have_flag(f_ptr->flags, FF_OUTER))
        {
                /* Set bounding walls */
-               if (light) cave[y][x].info |= CAVE_GLOW;
+               if (light) c_ptr->info |= CAVE_GLOW;
        }
 }
 
@@ -5839,7 +5842,7 @@ static bool build_type14(void)
        bool light;
 
        cave_type *c_ptr;
-       byte trap;
+       s16b trap;
 
        /* Pick a room size */
        y1 = randint1(4);
index 7798bea..344ae35 100644 (file)
@@ -955,8 +955,8 @@ static void wr_saved_floor(saved_floor_type *sf_ptr)
 
                /* Dump it */
                wr_u16b(ct_ptr->info);
-               wr_byte(ct_ptr->feat);
-               wr_byte(ct_ptr->mimic);
+               wr_s16b(ct_ptr->feat);
+               wr_s16b(ct_ptr->mimic);
                wr_s16b(ct_ptr->special);
        }
 
index 3813296..fcf29a2 100644 (file)
 #define HURT_CHANCE 16
 
 
-/*
- * Does the grid stop disintegration?
- */
-#define cave_stop_disintegration(Y,X) \
-       (((cave[Y][X].feat >= FEAT_PERM_EXTRA) && \
-         (cave[Y][X].feat <= FEAT_PERM_SOLID)) || \
-         (cave[Y][X].feat == FEAT_MOUNTAIN) || \
-        ((cave[Y][X].feat >= FEAT_SHOP_HEAD) && \
-         (cave[Y][X].feat <= FEAT_SHOP_TAIL)) || \
-        ((cave[Y][X].feat >= FEAT_BLDG_HEAD) && \
-         (cave[Y][X].feat <= FEAT_BLDG_TAIL)) || \
-         (cave[Y][X].feat == FEAT_MUSEUM))
-
 static int rakubadam_m;
 static int rakubadam_p;
 
@@ -384,7 +371,7 @@ sint project_path(u16b *gp, int range, int y1, int x1, int y2, int x2, int flg)
                        else if (!(flg & (PROJECT_PATH)))
                        {
                                /* Always stop at non-initial wall grids */
-                               if ((n > 0) && !cave_floor_bold(y, x)) break;
+                               if ((n > 0) && !have_flag(f_flags_bold(y, x), FF_PROJECT)) break;
                        }
 
                        /* Sometimes stop at non-initial monsters/players */
@@ -469,7 +456,7 @@ sint project_path(u16b *gp, int range, int y1, int x1, int y2, int x2, int flg)
                        else if (!(flg & (PROJECT_PATH)))
                        {
                                /* Always stop at non-initial wall grids */
-                               if ((n > 0) && !cave_floor_bold(y, x)) break;
+                               if ((n > 0) && !have_flag(f_flags_bold(y, x), FF_PROJECT)) break;
                        }
 
                        /* Sometimes stop at non-initial monsters/players */
@@ -536,7 +523,7 @@ sint project_path(u16b *gp, int range, int y1, int x1, int y2, int x2, int flg)
                        else if (!(flg & (PROJECT_PATH)))
                        {
                                /* Always stop at non-initial wall grids */
-                               if ((n > 0) && !cave_floor_bold(y, x)) break;
+                               if ((n > 0) && !have_flag(f_flags_bold(y, x), FF_PROJECT)) break;
                        }
 
                        /* Sometimes stop at non-initial monsters/players */
@@ -593,6 +580,7 @@ static s16b monster_target_y;
 static bool project_f(int who, int r, int y, int x, int dam, int typ)
 {
        cave_type       *c_ptr = &cave[y][x];
+       feature_type    *f_ptr = &f_info[c_ptr->feat];
 
        bool obvious = FALSE;
        bool known = player_has_los_bold(y, x);
@@ -605,7 +593,7 @@ static bool project_f(int who, int r, int y, int x, int dam, int typ)
        dam = (dam + r) / (r + 1);
 
 
-       if (c_ptr->feat == FEAT_TREES)
+       if (have_flag(f_ptr->flags, FF_TREE))
        {
                cptr message;
                switch (typ)
@@ -743,7 +731,7 @@ static bool project_f(int who, int r, int y, int x, int dam, int typ)
                                if (known)
                                {
 #ifdef JP
-msg_print("¤Þ¤Ð¤æ¤¤Á®¸÷¤¬Áö¤Ã¤¿¡ª");
+                                       msg_print("¤Þ¤Ð¤æ¤¤Á®¸÷¤¬Áö¤Ã¤¿¡ª");
 #else
                                        msg_print("There is a bright flash of light!");
 #endif
@@ -751,25 +739,23 @@ msg_print("
                                        obvious = TRUE;
                                }
 
-                               /* Forget the trap */
-                               c_ptr->info &= ~(CAVE_MARK);
-
                                /* Destroy the trap */
-                               cave_set_feat(y, x, floor_type[randint0(100)]);
+                               cave_alter_feat(y, x, FF_DISARM);
                        }
 
                        /* Locked doors are unlocked */
-                       else if ((c_ptr->feat >= FEAT_DOOR_HEAD + 0x01) &&
-                                                (c_ptr->feat <= FEAT_DOOR_HEAD + 0x07))
+                       if (is_closed_door(c_ptr->feat) && f_ptr->power && have_flag(f_ptr->flags, FF_OPEN))
                        {
+                               s16b old_feat = c_ptr->feat;
+
                                /* Unlock the door */
-                               cave_set_feat(y, x, FEAT_DOOR_HEAD + 0x00);
+                               cave_alter_feat(y, x, FF_DISARM);
 
                                /* Check line of sound */
-                               if (known)
+                               if (known && (old_feat != c_ptr->feat))
                                {
 #ifdef JP
-msg_print("¥«¥Á¥Ã¤È²»¤¬¤·¤¿¡ª");
+                                       msg_print("¥«¥Á¥Ã¤È²»¤¬¤·¤¿¡ª");
 #else
                                        msg_print("Click!");
 #endif
@@ -796,18 +782,14 @@ msg_print("
                case GF_KILL_DOOR:
                {
                        /* Destroy all doors and traps */
-                       if ((c_ptr->feat == FEAT_OPEN) ||
-                           (c_ptr->feat == FEAT_BROKEN) ||
-                           is_trap(c_ptr->feat) ||
-                           ((c_ptr->feat >= FEAT_DOOR_HEAD) &&
-                            (c_ptr->feat <= FEAT_DOOR_TAIL)))
+                       if (is_trap(c_ptr->feat) || have_flag(f_ptr->flags, FF_DOOR))
                        {
                                /* Check line of sight */
                                if (known)
                                {
                                        /* Message */
 #ifdef JP
-msg_print("¤Þ¤Ð¤æ¤¤Á®¸÷¤¬Áö¤Ã¤¿¡ª");
+                                       msg_print("¤Þ¤Ð¤æ¤¤Á®¸÷¤¬Áö¤Ã¤¿¡ª");
 #else
                                        msg_print("There is a bright flash of light!");
 #endif
@@ -816,23 +798,16 @@ msg_print("
                                }
 
                                /* Visibility change */
-                               if ((c_ptr->feat >= FEAT_DOOR_HEAD) &&
-                                        (c_ptr->feat <= FEAT_DOOR_TAIL))
+                               if (have_flag(f_ptr->flags, FF_DOOR))
                                {
                                        /* Update some things */
                                        p_ptr->update |= (PU_VIEW | PU_LITE | PU_MONSTERS | PU_MON_LITE);
                                }
 
-                               /* Forget the door */
-                               c_ptr->info &= ~(CAVE_MARK);
-
                                /* Destroy the feature */
-                               cave_set_feat(y, x, floor_type[randint0(100)]);
+                               cave_alter_feat(y, x, FF_TUNNEL);
                        }
 
-                       /* Notice */
-                       note_spot(y, x);
-
                        /* Remove "unsafe" flag if player is not blind */
                        if (!p_ptr->blind && player_has_los_bold(y, x))
                        {
@@ -849,23 +824,28 @@ msg_print("
 
                case GF_JAM_DOOR: /* Jams a door (as if with a spike) */
                {
-                       if ((c_ptr->feat >= FEAT_DOOR_HEAD) &&
-                                (c_ptr->feat <= FEAT_DOOR_TAIL))
+                       if (have_flag(f_ptr->flags, FF_SPIKE))
                        {
-                               /* Convert "locked" to "stuck" XXX XXX XXX */
-                               if (c_ptr->feat < FEAT_DOOR_HEAD + 0x08) c_ptr->feat += 0x08;
+                               s16b old_mimic = c_ptr->mimic;
+
+                               cave_alter_feat(y, x, FF_SPIKE);
+
+                               c_ptr->mimic = old_mimic;
+
+                               /* Notice */
+                               note_spot(y, x);
 
-                               /* Add one spike to the door */
-                               if (c_ptr->feat < FEAT_DOOR_TAIL) c_ptr->feat++;
+                               /* Redraw */
+                               lite_spot(y, x);
 
                                /* Check line of sight */
-                               if (known)
+                               if (known && !c_ptr->mimic)
                                {
                                        /* Message */
 #ifdef JP
-msg_print("²¿¤«¤¬¤Ä¤Ã¤«¤¨¤Æ¥É¥¢¤¬³«¤«¤Ê¤¤¡£");
+                                       msg_format("%s¤Ë²¿¤«¤¬¤Ä¤Ã¤«¤¨¤Æ³«¤«¤Ê¤¯¤Ê¤Ã¤¿¡£", f_name + f_ptr->name);
 #else
-                                       msg_print("The door seems stuck.");
+                                       msg_format("The %s seems stuck.", f_name + f_ptr->name);
 #endif
 
                                        obvious = TRUE;
@@ -877,152 +857,29 @@ msg_print("
                /* Destroy walls (and doors) */
                case GF_KILL_WALL:
                {
-                       /* Non-walls (etc) */
-                       if (cave_floor_bold(y, x)) break;
-
-                       /* Permanent walls */
-                       if (c_ptr->feat >= FEAT_PERM_EXTRA) break;
-
-                       /* Granite */
-                       if (c_ptr->feat >= FEAT_WALL_EXTRA)
+                       if (have_flag(f_ptr->flags, FF_HURT_ROCK))
                        {
-                               /* Message */
-                               if (known && (c_ptr->info & (CAVE_MARK)))
-                               {
-#ifdef JP
-msg_print("Êɤ¬ÍϤ±¤ÆÅ¥¤Ë¤Ê¤Ã¤¿¡ª");
-#else
-                                       msg_print("The wall turns into mud!");
-#endif
+                               cptr name = f_name + f_ptr->name;
 
-                                       obvious = TRUE;
-                               }
-
-                               /* Forget the wall */
-                               c_ptr->info &= ~(CAVE_MARK);
-
-                               /* Destroy the wall */
-                               cave_set_feat(y, x, floor_type[randint0(100)]);
-                       }
-
-                       /* Quartz / Magma with treasure */
-                       else if (c_ptr->feat >= FEAT_MAGMA_H)
-                       {
                                /* Message */
                                if (known && (c_ptr->info & (CAVE_MARK)))
                                {
 #ifdef JP
-msg_print("¹ÛÌ®¤¬ÍϤ±¤ÆÅ¥¤Ë¤Ê¤Ã¤¿¡ª");
-msg_print("²¿¤«¤òȯ¸«¤·¤¿¡ª");
+                                       msg_format("%s¤¬ÍϤ±¤ÆÅ¥¤Ë¤Ê¤Ã¤¿¡ª", name);
 #else
-                                       msg_print("The vein turns into mud!");
-                                       msg_print("You have found something!");
+                                       msg_format("The %s turns into mud!", name);
 #endif
 
                                        obvious = TRUE;
                                }
 
-                               /* Forget the wall */
-                               c_ptr->info &= ~(CAVE_MARK);
-
                                /* Destroy the wall */
-                               cave_set_feat(y, x, floor_type[randint0(100)]);
-
-                               /* Place some gold */
-                               place_gold(y, x);
-                       }
-
-                       /* Quartz / Magma */
-                       else if (c_ptr->feat >= FEAT_MAGMA)
-                       {
-                               /* Message */
-                               if (known && (c_ptr->info & (CAVE_MARK)))
-                               {
-#ifdef JP
-msg_print("¹ÛÌ®¤¬ÍϤ±¤ÆÅ¥¤Ë¤Ê¤Ã¤¿¡ª");
-#else
-                                       msg_print("The vein turns into mud!");
-#endif
-
-                                       obvious = TRUE;
-                               }
-
-                               /* Forget the wall */
-                               c_ptr->info &= ~(CAVE_MARK);
-
-                               /* Destroy the wall */
-                               cave_set_feat(y, x, floor_type[randint0(100)]);
-                       }
-
-                       /* Rubble */
-                       else if (c_ptr->feat == FEAT_RUBBLE)
-                       {
-                               /* Message */
-                               if (known && (c_ptr->info & (CAVE_MARK)))
-                               {
-#ifdef JP
-msg_print("´äÀФ¬ÍϤ±¤ÆÅ¥¤Ë¤Ê¤Ã¤¿¡ª");
-#else
-                                       msg_print("The rubble turns into mud!");
-#endif
-
-                                       obvious = TRUE;
-                               }
-
-                               /* Forget the wall */
-                               c_ptr->info &= ~(CAVE_MARK);
-
-                               /* Destroy the rubble */
-                               cave_set_feat(y, x, floor_type[randint0(100)]);
-
-                               /* Hack -- place an object */
-                               if (randint0(100) < 10)
-                               {
-                                       /* Found something */
-                                       if (player_can_see_bold(y, x))
-                                       {
-#ifdef JP
-msg_print("´äÀФβ¼¤Ë²¿¤«±£¤µ¤ì¤Æ¤¤¤¿¡ª");
-#else
-                                               msg_print("There was something buried in the rubble!");
-#endif
+                               cave_alter_feat(y, x, FF_HURT_ROCK);
 
-                                               obvious = TRUE;
-                                       }
-
-                                       /* Place object */
-                                       place_object(y, x, 0L);
-                               }
+                               /* Update some things */
+                               p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MONSTERS | PU_MON_LITE);
                        }
 
-                       /* Destroy doors (and secret doors) */
-                       else /* if (c_ptr->feat >= FEAT_DOOR_HEAD) */
-                       {
-                               /* Hack -- special message */
-                               if (known && (c_ptr->info & (CAVE_MARK)))
-                               {
-#ifdef JP
-msg_print("¥É¥¢¤¬ÍϤ±¤ÆÅ¥¤Ë¤Ê¤Ã¤¿¡ª");
-#else
-                                       msg_print("The door turns into mud!");
-#endif
-
-                                       obvious = TRUE;
-                               }
-
-                               /* Forget the wall */
-                               c_ptr->info &= ~(CAVE_MARK);
-
-                               /* Destroy the feature */
-                               cave_set_feat(y, x, floor_type[randint0(100)]);
-                       }
-
-                       /* Notice */
-                       note_spot(y, x);
-
-                       /* Update some things */
-                       p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MONSTERS | PU_MON_LITE);
-
                        break;
                }
 
@@ -1051,13 +908,9 @@ msg_print("
                case GF_MAKE_TRAP:
                {
                        /* Require a "naked" floor grid */
-                       if (((cave[y][x].feat != FEAT_FLOOR) &&
-                            (cave[y][x].feat != FEAT_GRASS) &&
-                            (cave[y][x].feat != FEAT_DIRT) &&
-                            (cave[y][x].o_idx == 0) &&
-                            (cave[y][x].m_idx == 0))
-                           || is_mirror_grid(&cave[y][x]) )
-                                break;
+                       if (!have_flag(f_ptr->flags, FF_FLOOR) || is_mirror_grid(c_ptr))
+                               break;
+
                        /* Place a trap */
                        place_trap(y, x);
 
@@ -1091,12 +944,12 @@ msg_print("
                        if (!cave_naked_bold(y, x)) break;
 
                        /* Create a glyph */
-                       cave[y][x].info |= CAVE_OBJECT;
-                       cave[y][x].mimic = FEAT_GLYPH;
+                       c_ptr->info |= CAVE_OBJECT;
+                       c_ptr->mimic = FEAT_GLYPH;
 
                        /* Notice */
                        note_spot(y, x);
-       
+
                        /* Redraw */
                        lite_spot(y, x);
 
@@ -1206,16 +1059,19 @@ msg_print("
                                if (player_can_see_bold(y, x)) obvious = TRUE;
 
                                /* Turn off the light. */
-                               if (!is_mirror_grid(c_ptr)) c_ptr->info &= ~(CAVE_GLOW);
-
-                               /* Hack -- Forget "boring" grids */
-                               if ((c_ptr->feat <= FEAT_INVIS) || (c_ptr->feat == FEAT_DIRT) || (c_ptr->feat == FEAT_GRASS))
+                               if (!is_mirror_grid(c_ptr))
                                {
-                                       /* Forget */
-                                       c_ptr->info &= ~(CAVE_MARK);
+                                       c_ptr->info &= ~(CAVE_GLOW);
+
+                                       /* Hack -- Forget "boring" grids */
+                                       if (!have_flag(f_ptr->flags, FF_REMEMBER))
+                                       {
+                                               /* Forget */
+                                               c_ptr->info &= ~(CAVE_MARK);
 
-                                       /* Notice */
-                                       note_spot(y, x);
+                                               /* Notice */
+                                               note_spot(y, x);
+                                       }
                                }
 
                                /* Redraw */
@@ -1232,28 +1088,29 @@ msg_print("
                case GF_SHARDS:
                case GF_ROCKET:
                {
-                       if (is_mirror_grid(&cave[y][x]))
+                       if (is_mirror_grid(c_ptr))
                        {
 #ifdef JP
                                msg_print("¶À¤¬³ä¤ì¤¿¡ª");
 #else
-                               msg_print("The mirror was chashed!");
-#endif                         
-                               remove_mirror(y,x);
-                           project(0,2,y,x, p_ptr->lev /2 +5 ,GF_SHARDS,(PROJECT_GRID|PROJECT_ITEM|PROJECT_KILL|PROJECT_JUMP|PROJECT_NO_HANGEKI),-1);
+                               msg_print("The mirror was crashed!");
+#endif
+                               remove_mirror(y, x);
+                               project(0, 2, y, x, p_ptr->lev / 2 + 5, GF_SHARDS, (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
                        }
                        break;
                }
                case GF_SOUND:
                {
-                       if (is_mirror_grid(&cave[y][x]) && p_ptr->lev < 40 )
+                       if (is_mirror_grid(c_ptr) && p_ptr->lev < 40)
                        {
 #ifdef JP
                                msg_print("¶À¤¬³ä¤ì¤¿¡ª");
 #else
-                               msg_print("The mirror was chashed!");
-#endif                         
-                               cave_set_feat(y,x, FEAT_FLOOR);
+                               msg_print("The mirror was crashed!");
+#endif
+                               remove_mirror(y, x);
+                               project(0, 2, y, x, p_ptr->lev / 2 + 5, GF_SHARDS, (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
                        }
                        break;
                }
@@ -8113,31 +7970,27 @@ bool in_disintegration_range(int y1, int x1, int y2, int x2)
  */
 static bool do_disintegration(int by, int bx, int y, int x)
 {
-       byte feat;
+       feature_type *f_ptr;
 
        /* Disintegration balls explosions are stopped by perma-walls */
        if (!in_disintegration_range(by, bx, y, x)) return FALSE;
-                                               
+
        /* Permanent walls and artifacts don't get effect */
        /* But not protect monsters and other objects */
        if (!cave_valid_bold(y, x)) return TRUE;
 
        /* Destroy mirror/glyph */
-       remove_mirror(y,x);
+       remove_mirror(y, x);
 
-       feat = cave[y][x].feat;
+       f_ptr = &f_info[cave[y][x].feat];
 
-       if ((feat < FEAT_PATTERN_START || feat > FEAT_PATTERN_XTRA2) &&
-           (feat < FEAT_DEEP_WATER || feat > FEAT_GRASS))
+       if (have_flag(f_ptr->flags, FF_HURT_DISI))
        {
-               if (feat == FEAT_TREES || feat == FEAT_FLOWER || feat == FEAT_DEEP_GRASS)
-                       cave_set_feat(y, x, FEAT_GRASS);
-               else
-                       cave_set_feat(y, x, floor_type[randint0(100)]);
-       }
+               cave_alter_feat(y, x, FF_HURT_DISI);
 
-       /* Update some things -- similar to GF_KILL_WALL */
-       p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MONSTERS | PU_MON_LITE);
+               /* Update some things -- similar to GF_KILL_WALL */
+               p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MONSTERS | PU_MON_LITE);
+       }
 
        return TRUE;
 }
@@ -8746,11 +8599,7 @@ bool project(int who, int rad, int y, int x, int dam, int typ, int flg, int mons
                                }
                        }
                        if(project_o(0,0,y,x,dam,GF_SUPER_RAY) )notice=TRUE;
-                       if( cave[y][x].feat == FEAT_RUBBLE ||
-                           cave[y][x].feat == FEAT_DOOR_HEAD ||
-                           cave[y][x].feat == FEAT_DOOR_TAIL ||
-                           (cave[y][x].feat >= FEAT_WALL_EXTRA &&
-                            cave[y][x].feat <= FEAT_PERM_SOLID ))
+                       if (!have_flag(f_flags_bold(y, x), FF_PROJECT))
                        {
                                if( second_step )continue;
                                break;
@@ -8819,7 +8668,7 @@ bool project(int who, int rad, int y, int x, int dam, int typ, int flg, int mons
                else
                {
                        /* Hack -- Balls explode before reaching walls */
-                       if (!cave_floor_bold(ny, nx) && (rad > 0)) break;
+                       if (!have_flag(f_flags_bold(ny, nx), FF_PROJECT) && (rad > 0)) break;
                }
 
                /* Advance */
index c1184bd..90ac369 100644 (file)
@@ -3500,15 +3500,11 @@ prt("[
 }
 
 
-/*
- * Detect all traps on current panel
- */
-bool detect_traps(int range, bool known)
+static bool detect_feat_flag(int range, int flag, bool known)
 {
-       int             x, y;
-       bool            detect = FALSE;
-       cave_type       *c_ptr;
-
+       int       x, y;
+       bool      detect = FALSE;
+       cave_type *c_ptr;
 
        if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range /= 3;
 
@@ -3523,34 +3519,32 @@ bool detect_traps(int range, bool known)
                        /* Access the grid */
                        c_ptr = &cave[y][x];
 
-                       /* Mark as detected */
-                       if (dist <= range && known)
+                       /* Hack -- Safe */
+                       if (flag == FF_TRAP)
                        {
-                               if (dist <= range - 1)
-                                       c_ptr->info |= (CAVE_IN_DETECT);
+                               /* Mark as detected */
+                               if (dist <= range && known)
+                               {
+                                       if (dist <= range - 1) c_ptr->info |= (CAVE_IN_DETECT);
 
-                               c_ptr->info &= ~(CAVE_UNSAFE);
+                                       c_ptr->info &= ~(CAVE_UNSAFE);
 
-                               /* Redraw */
-                               lite_spot(y, x);
+                                       /* Redraw */
+                                       lite_spot(y, x);
+                               }
                        }
 
-                       /* Detect traps */
-                       if (is_trap(c_ptr->feat))
+                       /* Detect flags */
+                       if (have_flag(f_flags_grid(c_ptr), flag))
                        {
+                               /* Detect secrets */
+                               disclose_grid(y, x);
+
                                /* Hack -- Memorize */
                                c_ptr->info |= (CAVE_MARK);
 
-                               if (c_ptr->mimic)
-                               {
-                                       /* Disclose a hidden trap */
-                                       disclose_grid(y, x);
-                               }
-                               else
-                               {
-                                       /* Redraw */
-                                       lite_spot(y, x);
-                               }
+                               /* Redraw */
+                               lite_spot(y, x);
 
                                /* Obvious */
                                detect = TRUE;
@@ -3558,6 +3552,18 @@ bool detect_traps(int range, bool known)
                }
        }
 
+       /* Result */
+       return detect;
+}
+
+
+/*
+ * Detect all traps on current panel
+ */
+bool detect_traps(int range, bool known)
+{
+       bool detect = detect_feat_flag(range, FF_TRAP, known);
+
        if (known) p_ptr->dtrap = TRUE;
 
        if ((p_ptr->pclass == CLASS_BARD) && (p_ptr->magic_num1[0] > MUSIC_DETECT)) detect = FALSE;
@@ -3566,65 +3572,23 @@ bool detect_traps(int range, bool known)
        if (detect)
        {
 #ifdef JP
-msg_print("¥È¥é¥Ã¥×¤Î¸ºß¤ò´¶¤¸¤È¤Ã¤¿¡ª");
+               msg_print("¥È¥é¥Ã¥×¤Î¸ºß¤ò´¶¤¸¤È¤Ã¤¿¡ª");
 #else
                msg_print("You sense the presence of traps!");
 #endif
-
        }
 
        /* Result */
-       return (detect);
+       return detect;
 }
 
 
-
 /*
  * Detect all doors on current panel
  */
 bool detect_doors(int range)
 {
-       int y, x;
-
-       bool detect = FALSE;
-
-       cave_type *c_ptr;
-
-       if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range /= 3;
-
-       /* Scan the panel */
-       for (y = 1; y < cur_hgt - 1; y++)
-       {
-               for (x = 1; x < cur_wid - 1; x++)
-               {
-                       if (distance(py, px, y, x) > range) continue;
-
-                       c_ptr = &cave[y][x];
-
-                       /* Detect secret doors */
-                       if (is_hidden_door(c_ptr))
-                       {
-                               /* Pick a door */
-                               disclose_grid(y, x);
-                       }
-
-                       /* Detect doors */
-                       if (((c_ptr->feat >= FEAT_DOOR_HEAD) &&
-                            (c_ptr->feat <= FEAT_DOOR_TAIL)) ||
-                           ((c_ptr->feat == FEAT_OPEN) ||
-                            (c_ptr->feat == FEAT_BROKEN)))
-                       {
-                               /* Hack -- Memorize */
-                               c_ptr->info |= (CAVE_MARK);
-
-                               /* Redraw */
-                               lite_spot(y, x);
-
-                               /* Obvious */
-                               detect = TRUE;
-                       }
-               }
-       }
+       bool detect = detect_feat_flag(range, FF_DOOR, TRUE);
 
        if ((p_ptr->pclass == CLASS_BARD) && (p_ptr->magic_num1[0] > MUSIC_DETECT)) detect = FALSE;
 
@@ -3632,15 +3596,14 @@ bool detect_doors(int range)
        if (detect)
        {
 #ifdef JP
-msg_print("¥É¥¢¤Î¸ºß¤ò´¶¤¸¤È¤Ã¤¿¡ª");
+               msg_print("¥É¥¢¤Î¸ºß¤ò´¶¤¸¤È¤Ã¤¿¡ª");
 #else
                msg_print("You sense the presence of doors!");
 #endif
-
        }
 
        /* Result */
-       return (detect);
+       return detect;
 }
 
 
@@ -3649,41 +3612,7 @@ msg_print("
  */
 bool detect_stairs(int range)
 {
-       int y, x;
-
-       bool detect = FALSE;
-
-       cave_type *c_ptr;
-
-       if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range /= 3;
-
-       /* Scan the panel */
-       for (y = 1; y < cur_hgt - 1; y++)
-       {
-               for (x = 1; x < cur_wid - 1; x++)
-               {
-                       if (distance(py, px, y, x) > range) continue;
-
-                       c_ptr = &cave[y][x];
-
-                       /* Detect stairs */
-                       if ((c_ptr->feat == FEAT_LESS) ||
-                           (c_ptr->feat == FEAT_LESS_LESS) ||
-                           (c_ptr->feat == FEAT_MORE) ||
-                           (c_ptr->feat == FEAT_MORE_MORE) ||
-                           (c_ptr->feat == FEAT_ENTRANCE))
-                       {
-                               /* Hack -- Memorize */
-                               c_ptr->info |= (CAVE_MARK);
-
-                               /* Redraw */
-                               lite_spot(y, x);
-
-                               /* Obvious */
-                               detect = TRUE;
-                       }
-               }
-       }
+       bool detect = detect_feat_flag(range, FF_STAIRS, TRUE);
 
        if ((p_ptr->pclass == CLASS_BARD) && (p_ptr->magic_num1[0] > MUSIC_DETECT)) detect = FALSE;
 
@@ -3691,15 +3620,14 @@ bool detect_stairs(int range)
        if (detect)
        {
 #ifdef JP
-msg_print("³¬Ãʤθºß¤ò´¶¤¸¤È¤Ã¤¿¡ª");
+               msg_print("³¬Ãʤθºß¤ò´¶¤¸¤È¤Ã¤¿¡ª");
 #else
                msg_print("You sense the presence of stairs!");
 #endif
-
        }
 
        /* Result */
-       return (detect);
+       return detect;
 }
 
 
@@ -3708,46 +3636,7 @@ msg_print("
  */
 bool detect_treasure(int range)
 {
-       int y, x;
-
-       bool detect = FALSE;
-
-       cave_type *c_ptr;
-
-       if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range /= 3;
-
-       /* Scan the current panel */
-       for (y = 1; y < cur_hgt; y++)
-       {
-               for (x = 1; x < cur_wid; x++)
-               {
-                       if (distance(py, px, y, x) > range) continue;
-
-                       c_ptr = &cave[y][x];
-
-                       /* Notice embedded gold */
-                       if ((c_ptr->feat == FEAT_MAGMA_H) ||
-                           (c_ptr->feat == FEAT_QUARTZ_H))
-                       {
-                               /* Expose the gold */
-                               c_ptr->feat += 0x02;
-                       }
-
-                       /* Magma/Quartz + Known Gold */
-                       if ((c_ptr->feat == FEAT_MAGMA_K) ||
-                           (c_ptr->feat == FEAT_QUARTZ_K))
-                       {
-                               /* Hack -- Memorize */
-                               c_ptr->info |= (CAVE_MARK);
-
-                               /* Redraw */
-                               lite_spot(y, x);
-
-                               /* Detect */
-                               detect = TRUE;
-                       }
-               }
-       }
+       bool detect = detect_feat_flag(range, FF_HAS_GOLD, TRUE);
 
        if ((p_ptr->pclass == CLASS_BARD) && (p_ptr->magic_num1[0] > MUSIC_DETECT+6)) detect = FALSE;
 
@@ -3755,20 +3644,17 @@ bool detect_treasure(int range)
        if (detect)
        {
 #ifdef JP
-msg_print("Ë䢤µ¤ì¤¿ºâÊõ¤Î¸ºß¤ò´¶¤¸¤È¤Ã¤¿¡ª");
+               msg_print("Ë䢤µ¤ì¤¿ºâÊõ¤Î¸ºß¤ò´¶¤¸¤È¤Ã¤¿¡ª");
 #else
                msg_print("You sense the presence of buried treasure!");
 #endif
-
        }
 
-
        /* Result */
-       return (detect);
+       return detect;
 }
 
 
-
 /*
  * Detect all "gold" objects on the current panel
  */
@@ -5656,7 +5542,7 @@ bool earthquake(int cy, int cx, int r)
        }
 
        /* First, affect the player (if necessary) */
-       if (hurt && !prace_is_(RACE_SPECTRE) && !p_ptr->wraith_form && !p_ptr->kabenuke)
+       if (hurt && !p_ptr->pass_wall && !p_ptr->kill_wall)
        {
                /* Check around the player */
                for (i = 0; i < 8; i++)
@@ -5873,9 +5759,7 @@ if (damage) take_hit(DAMAGE_ATTACK, damage, "
                                                        if (is_explosive_rune_grid(&cave[y][x])) continue;
 
                                                        /* ... nor on the Pattern */
-                                                       if ((cave[y][x].feat <= FEAT_PATTERN_XTRA2) &&
-                                                           (cave[y][x].feat >= FEAT_PATTERN_START))
-                                                               continue;
+                                                       if (pattern_tile(y, x)) continue;
 
                                                        /* Important -- Skip "quake" grids */
                                                        if (map[16+y-cy][16+x-cx]) continue;
@@ -6237,27 +6121,30 @@ static void cave_temp_room_unlite(void)
                c_ptr->info &= ~(CAVE_TEMP);
 
                /* Darken the grid */
-               if (!is_mirror_grid(c_ptr)) c_ptr->info &= ~(CAVE_GLOW);
-
-               /* Hack -- Forget "boring" grids */
-               if ((c_ptr->feat <= FEAT_INVIS) || (c_ptr->feat == FEAT_DIRT) || (c_ptr->feat == FEAT_GRASS))
+               if (!is_mirror_grid(c_ptr))
                {
-                       /* Forget the grid */
-                       if (!view_torch_grids) c_ptr->info &= ~(CAVE_MARK);
+                       c_ptr->info &= ~(CAVE_GLOW);
 
-                       /* Notice */
-                       note_spot(y, x);
-               }
+                       /* Hack -- Forget "boring" grids */
+                       if (!have_flag(f_info[get_feat_mimic(c_ptr)].flags, FF_REMEMBER))
+                       {
+                               /* Forget the grid */
+                               if (!view_torch_grids) c_ptr->info &= ~(CAVE_MARK);
 
-               /* Process affected monsters */
-               if (c_ptr->m_idx)
-               {
-                       /* Update the monster */
-                       update_mon(c_ptr->m_idx, FALSE);
-               }
+                               /* Notice */
+                               note_spot(y, x);
+                       }
 
-               /* Redraw */
-               lite_spot(y, x);
+                       /* Process affected monsters */
+                       if (c_ptr->m_idx)
+                       {
+                               /* Update the monster */
+                               update_mon(c_ptr->m_idx, FALSE);
+                       }
+
+                       /* Redraw */
+                       lite_spot(y, x);
+               }
        }
 
        /* None left */
@@ -7692,7 +7579,7 @@ bool rush_attack(bool *mdeath)
                ny = GRID_Y(path_g[i]);
                nx = GRID_X(path_g[i]);
 
-               if (!cave_empty_bold(ny, nx) || !player_can_enter(cave[ny][nx].feat))
+               if (!cave_empty_bold(ny, nx) || !player_can_enter(cave[ny][nx].feat, 0))
                {
                        if (cave[ny][nx].m_idx)
                        {
index 355de7f..41e399c 100644 (file)
@@ -85,8 +85,7 @@ bool teleport_away(int m_idx, int dis, bool dec_valour)
                        if (is_explosive_rune_grid(&cave[ny][nx])) continue;
 
                        /* ...nor onto the Pattern */
-                       if ((cave[ny][nx].feat >= FEAT_PATTERN_START) &&
-                           (cave[ny][nx].feat <= FEAT_PATTERN_XTRA2)) continue;
+                       if (pattern_tile(ny, nx)) continue;
 
                        /* No teleporting into vaults and such */
                        if (!(p_ptr->inside_quest || p_ptr->inside_arena))
@@ -204,8 +203,7 @@ void teleport_monster_to(int m_idx, int ty, int tx, int power)
                        if (is_explosive_rune_grid(c_ptr)) continue;
 
                        /* ...nor onto the Pattern */
-                       if ((c_ptr->feat >= FEAT_PATTERN_START) &&
-                           (c_ptr->feat <= FEAT_PATTERN_XTRA2)) continue;
+                       if (pattern_tile(ny, nx)) continue;
 
                        /* No teleporting into vaults and such */
                        /* if (c_ptr->info & (CAVE_ICKY)) continue; */
@@ -253,6 +251,39 @@ void teleport_monster_to(int m_idx, int ty, int tx, int power)
 }
 
 
+bool cave_teleportable_bold(int y, int x, u16b mode)
+{
+       cave_type    *c_ptr = &cave[y][x];
+       feature_type *f_ptr = &f_info[c_ptr->feat];
+
+       /* Require "teleportable" space */
+       if (!have_flag(f_ptr->flags, FF_TELEPORTABLE)) return FALSE;
+
+       if (!(mode & TELEPORT_ALLOW_OBJECT) && (c_ptr->info & CAVE_OBJECT)) return FALSE;
+
+       if (c_ptr->m_idx) return FALSE;
+       if (player_bold(y, x)) return FALSE;
+
+       if (!player_can_enter(c_ptr->feat, 0)) return FALSE;
+
+       if ((mode & TELEPORT_REQUIRE_PROJECT) && !have_flag(f_ptr->flags, FF_PROJECT)) return FALSE;
+
+       if (!(mode & TELEPORT_ALLOW_DEEP))
+       {
+               if (have_flag(f_ptr->flags, FF_WATER) && have_flag(f_ptr->flags, FF_DEEP))
+               {
+                       if (!p_ptr->ffall && !p_ptr->can_swim) return FALSE;
+               }
+               if (have_flag(f_ptr->flags, FF_LAVA) && !p_ptr->immune_fire && !IS_INVULN())
+               {
+                       if (have_flag(f_ptr->flags, FF_DEEP) || !p_ptr->ffall) return FALSE;
+               }
+       }
+
+       return TRUE;
+}
+
+
 /*
  * Teleport the player to a location up to "dis" grids away.
  *
@@ -320,13 +351,11 @@ msg_print("
                        /* Ignore illegal locations */
                        if (!in_bounds(y, x)) continue;
 
-                       /* Require "naked" floor space or trees */
-                       if (!(cave_naked_bold(y, x) ||
-                           (cave[y][x].feat == FEAT_TREES))) continue;
-
                        /* No teleporting into vaults and such */
                        if (cave[y][x].info & CAVE_ICKY) continue;
 
+                       if (!cave_teleportable_bold(y, x, 0)) continue;
+
                        /* This grid looks good */
                        look = FALSE;
 
@@ -434,7 +463,7 @@ void teleport_player_to(int ny, int nx, bool no_tele)
        if (p_ptr->anti_tele && no_tele)
        {
 #ifdef JP
-msg_print("ÉԻ׵ĤÊÎϤ¬¥Æ¥ì¥Ý¡¼¥È¤òËɤ¤¤À¡ª");
+               msg_print("ÉԻ׵ĤÊÎϤ¬¥Æ¥ì¥Ý¡¼¥È¤òËɤ¤¤À¡ª");
 #else
                msg_print("A mysterious force prevents you from teleporting!");
 #endif
@@ -454,11 +483,8 @@ msg_print("
                }
 
                /* Accept "naked" floor grids */
-               if (no_tele)
-               {
-                       if (cave_naked_bold(y, x) || (((cave[y][x].feat == FEAT_DEEP_LAVA) || (cave[y][x].feat == FEAT_DEEP_WATER)) && !cave[y][x].m_idx)) break;
-               }
-               else if (cave_empty_bold(y, x) || player_bold(y, x)) break;
+               if (!no_tele && player_bold(y, x)) break;
+               if (cave_teleportable_bold(y, x, TELEPORT_ALLOW_DEEP | (no_tele ? 0 : TELEPORT_ALLOW_OBJECT))) break;
 
                /* Occasionally advance the distance */
                if (++ctr > (4 * dis * dis + 4 * dis + 1))
@@ -1507,8 +1533,8 @@ msg_print("°
  * Non-permanent walls, trees, mountains, or doors
  */
 #define vanishable_feat(F) \
-       ((!feat_floor(F) && (((F) < FEAT_PERM_EXTRA) || ((F) > FEAT_PERM_SOLID))) || \
-        ((F) == FEAT_OPEN) || ((F) == FEAT_BROKEN))
+       (have_flag((F)->flags, FF_HURT_DISI) || have_flag((F)->flags, FF_MOUNTAIN) || \
+        have_flag((F)->flags, FF_PATTERN))
 
 /*
  * Vanish all walls in this floor
@@ -1517,9 +1543,9 @@ static bool vanish_dungeon(void)
 {
        int          y, x;
        cave_type    *c_ptr;
+       feature_type *f_ptr;
        monster_type *m_ptr;
        char         m_name[80];
-       byte         feat;
 
        /* Prevent vasishing of quest levels and town */
        if ((p_ptr->inside_quest && is_fixed_quest_idx(p_ptr->inside_quest)) || !dun_level)
@@ -1535,7 +1561,7 @@ static bool vanish_dungeon(void)
                        c_ptr = &cave[y][x];
 
                        /* Seeing true feature code (ignore mimic) */
-                       feat = c_ptr->feat;
+                       f_ptr = &f_info[c_ptr->feat];
 
                        /* Lose room and vault */
                        c_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY);
@@ -1570,11 +1596,7 @@ static bool vanish_dungeon(void)
                        }
 
                        /* Process all walls, doors and patterns */
-                       if (vanishable_feat(feat) || pattern_tile(y, x))
-                       {
-                               /* Create floor */
-                               cave_set_feat(y, x, floor_type[randint0(100)]);
-                       }
+                       if (vanishable_feat(f_ptr)) cave_alter_feat(y, x, FF_HURT_DISI);
                }
        }
 
@@ -1582,40 +1604,68 @@ static bool vanish_dungeon(void)
        for (x = 0; x < cur_wid; x++)
        {
                c_ptr = &cave[0][x];
+               f_ptr = &f_info[c_ptr->mimic];
 
                /* Lose room and vault */
                c_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY);
 
                /* Set boundary mimic if needed */
-               if (c_ptr->mimic && vanishable_feat(c_ptr->mimic)) c_ptr->mimic = floor_type[randint0(100)];
+               if (c_ptr->mimic && vanishable_feat(f_ptr))
+               {
+                       c_ptr->mimic = feat_state(c_ptr->mimic, FF_HURT_DISI);
+
+                       /* Check for change to boring grid */
+                       if (!have_flag(f_info[c_ptr->mimic].flags, FF_REMEMBER)) c_ptr->info &= ~(CAVE_MARK);
+               }
 
                c_ptr = &cave[cur_hgt - 1][x];
+               f_ptr = &f_info[c_ptr->mimic];
 
                /* Lose room and vault */
                c_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY);
 
                /* Set boundary mimic if needed */
-               if (c_ptr->mimic && vanishable_feat(c_ptr->mimic)) c_ptr->mimic = floor_type[randint0(100)];
+               if (c_ptr->mimic && vanishable_feat(f_ptr))
+               {
+                       c_ptr->mimic = feat_state(c_ptr->mimic, FF_HURT_DISI);
+
+                       /* Check for change to boring grid */
+                       if (!have_flag(f_info[c_ptr->mimic].flags, FF_REMEMBER)) c_ptr->info &= ~(CAVE_MARK);
+               }
        }
 
        /* Special boundary walls -- Left and right */
        for (y = 1; y < (cur_hgt - 1); y++)
        {
                c_ptr = &cave[y][0];
+               f_ptr = &f_info[c_ptr->mimic];
 
                /* Lose room and vault */
                c_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY);
 
                /* Set boundary mimic if needed */
-               if (c_ptr->mimic && vanishable_feat(c_ptr->mimic)) c_ptr->mimic = floor_type[randint0(100)];
+               if (c_ptr->mimic && vanishable_feat(f_ptr))
+               {
+                       c_ptr->mimic = feat_state(c_ptr->mimic, FF_HURT_DISI);
+
+                       /* Check for change to boring grid */
+                       if (!have_flag(f_info[c_ptr->mimic].flags, FF_REMEMBER)) c_ptr->info &= ~(CAVE_MARK);
+               }
 
                c_ptr = &cave[y][cur_wid - 1];
+               f_ptr = &f_info[c_ptr->mimic];
 
                /* Lose room and vault */
                c_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY);
 
                /* Set boundary mimic if needed */
-               if (c_ptr->mimic && vanishable_feat(c_ptr->mimic)) c_ptr->mimic = floor_type[randint0(100)];
+               if (c_ptr->mimic && vanishable_feat(f_ptr))
+               {
+                       c_ptr->mimic = feat_state(c_ptr->mimic, FF_HURT_DISI);
+
+                       /* Check for change to boring grid */
+                       if (!have_flag(f_info[c_ptr->mimic].flags, FF_REMEMBER)) c_ptr->info &= ~(CAVE_MARK);
+               }
        }
 
        /* Mega-Hack -- Forget the view and lite */
@@ -1923,7 +1973,7 @@ msg_print("
 
        /* Notice */
        note_spot(py, px);
-       
+
        /* Redraw */
        lite_spot(py, px);
 
@@ -5838,11 +5888,13 @@ bool dimension_door(void)
 
        p_ptr->energy_need += (s16b)((s32b)(60 - plev) * ENERGY_NEED() / 100L);
 
-       if (!cave_empty_bold(y, x) || (cave[y][x].info & CAVE_ICKY) ||
-               (distance(y, x, py, px) > plev / 2 + 10) ||
-               (!randint0(plev / 10 + 10)))
+       if (!cave_teleportable_bold(y, x, TELEPORT_ALLOW_DEEP | TELEPORT_ALLOW_OBJECT | TELEPORT_REQUIRE_PROJECT) ||
+           (cave[y][x].info & CAVE_ICKY) ||
+           (distance(y, x, py, px) > plev / 2 + 10) ||
+           (!randint0(plev / 10 + 10)))
        {
-               if( p_ptr->pclass != CLASS_MIRROR_MASTER ){
+               if (p_ptr->pclass != CLASS_MIRROR_MASTER)
+               {
 #ifdef JP
                        msg_print("ÀºÎ¤«¤éʪ¼Á³¦¤ËÌá¤ë»þ¤¦¤Þ¤¯¤¤¤«¤Ê¤«¤Ã¤¿¡ª");
 #else
index 1ae4132..430bf2d 100644 (file)
@@ -641,6 +641,11 @@ static store_type *st_ptr = NULL;
 static owner_type *ot_ptr = NULL;
 #endif
 
+/*
+ * We store the current "store feat" here so everyone can access it
+ */
+static int cur_store_feat;
+
 
 
 
@@ -2329,7 +2334,7 @@ static void display_store(void)
        /* Normal stores */
        else
        {
-               cptr store_name = (f_name + f_info[FEAT_SHOP_HEAD + cur_store_num].name);
+               cptr store_name = (f_name + f_info[cur_store_feat].name);
                cptr owner_name = (ot_ptr->owner_name);
                cptr race_name = race_info[ot_ptr->owner_race].title;
 
@@ -3486,7 +3491,7 @@ msg_format("%s
                                                        ot_ptr->owner_name, race_info[ot_ptr->owner_race].title);
                                                put_str(buf, 3, 10);
                                                sprintf(buf, "%s (%ld)",
-                                                       (f_name + f_info[FEAT_SHOP_HEAD + cur_store_num].name), (long)(ot_ptr->max_cost));
+                                                       (f_name + f_info[cur_store_feat].name), (long)(ot_ptr->max_cost));
                                                prt(buf, 3, 50);
                                        }
 
@@ -4499,9 +4504,7 @@ void do_cmd_store(void)
        c_ptr = &cave[py][px];
 
        /* Verify a store */
-       if (!((c_ptr->feat >= FEAT_SHOP_HEAD) &&
-                 (c_ptr->feat <= FEAT_SHOP_TAIL)) &&
-           (c_ptr->feat != FEAT_MUSEUM))
+       if (!have_flag(f_flags_grid(c_ptr), FF_STORE))
        {
 #ifdef JP
                msg_print("¤³¤³¤Ë¤ÏŹ¤¬¤¢¤ê¤Þ¤»¤ó¡£");
@@ -4513,8 +4516,7 @@ void do_cmd_store(void)
        }
 
        /* Extract the store code */
-       if (c_ptr->feat == FEAT_MUSEUM) which = STORE_MUSEUM;
-       else which = (c_ptr->feat - FEAT_SHOP_HEAD);
+       which = f_info[c_ptr->feat].power;
 
        old_town_num = p_ptr->town_num;
        if ((which == STORE_HOME) || (which == STORE_MUSEUM)) p_ptr->town_num = 1;
@@ -4575,6 +4577,9 @@ void do_cmd_store(void)
        /* Save the store number */
        cur_store_num = which;
 
+       /* Hack -- save the store feature */
+       cur_store_feat = c_ptr->feat;
+
        /* Save the store and owner pointers */
        st_ptr = &town[p_ptr->town_num].store[cur_store_num];
        ot_ptr = &owners[cur_store_num][st_ptr->owner];
index f00ab01..6ee0245 100644 (file)
@@ -105,7 +105,7 @@ static void recursive_river(int x1, int y1, int x2, int y2, int feat1, int feat2
                                                if (distance(ty, tx, y, x) > rand_spread(width, 1)) continue;
 
                                                /* Do not convert permanent features */
-                                               if (cave_perma_grid(c_ptr) && (c_ptr->feat != FEAT_MOUNTAIN)) continue;
+                                               if (cave_perma_grid(c_ptr) && !have_flag(f_flags_grid(c_ptr), FF_MOUNTAIN)) continue;
 
                                                /*
                                                 * Clear previous contents, add feature
@@ -120,7 +120,7 @@ static void recursive_river(int x1, int y1, int x2, int y2, int feat1, int feat2
                                                c_ptr->mimic = 0;
 
                                                /* Lava terrain glows */
-                                               if ((feat1 == FEAT_DEEP_LAVA) ||  (feat1 == FEAT_SHAL_LAVA))
+                                               if (have_flag(f_info[feat1].flags, FF_LAVA))
                                                {
                                                        if (!(d_info[dungeon_type].flags1 & DF1_DARKNESS)) c_ptr->info |= CAVE_GLOW;
                                                }
@@ -210,9 +210,13 @@ void build_streamer(int feat, int chance)
        int             i, tx, ty;
        int             y, x, dir;
        int dummy = 0;
-       bool treasure = FALSE;
 
        cave_type *c_ptr;
+       feature_type *f_ptr;
+
+       feature_type *streamer_ptr = &f_info[feat];
+       bool streamer_is_wall = have_flag(streamer_ptr->flags, FF_WALL) && !have_flag(streamer_ptr->flags, FF_PERMANENT);
+       bool streamer_may_have_gold = have_flag(streamer_ptr->flags, FF_MAY_HAVE_GOLD);
 
        /* Hack -- Choose starting point */
        y = rand_spread(cur_hgt / 2, cur_hgt / 6);
@@ -242,20 +246,17 @@ void build_streamer(int feat, int chance)
 
                        /* Access the grid */
                        c_ptr = &cave[ty][tx];
+                       f_ptr = &f_info[c_ptr->feat];
 
-                       if ((c_ptr->feat >= FEAT_DEEP_WATER) && (c_ptr->feat <= FEAT_SHAL_LAVA)) continue;
-                       if ((c_ptr->feat >= FEAT_PERM_EXTRA) && (c_ptr->feat <= FEAT_PERM_SOLID)) continue;
+                       if (have_flag(f_ptr->flags, FF_MOVE) && (have_flag(f_ptr->flags, FF_WATER) || have_flag(f_ptr->flags, FF_LAVA)))
+                               continue;
+                       if (cave_perma_grid(c_ptr) && !have_flag(f_ptr->flags, FF_MOUNTAIN)) continue;
 
                        /* Only convert "granite" walls */
-                       if ((feat >= FEAT_MAGMA) && (feat <= FEAT_WALL_SOLID))
+                       if (streamer_is_wall)
                        {
                                if (!is_extra_grid(c_ptr) && !is_inner_grid(c_ptr) && !is_outer_grid(c_ptr) && !is_solid_grid(c_ptr)) continue;
                                if (is_closed_door(c_ptr->feat)) continue;
-                               if ((feat == FEAT_MAGMA) || (feat == FEAT_QUARTZ)) treasure = TRUE;
-                       }
-                       else
-                       {
-                               if (cave_perma_grid(c_ptr) && (c_ptr->feat != FEAT_MOUNTAIN)) continue;
                        }
 
                        /* Clear previous contents, add proper vein type */
@@ -264,13 +265,21 @@ void build_streamer(int feat, int chance)
                        /* Paranoia: Clear mimic field */
                        c_ptr->mimic = 0;
 
-                       /* Hack -- Add some known treasure */
-                       if (treasure && one_in_(chance))
-                               c_ptr->feat += (FEAT_MAGMA_K - FEAT_MAGMA);
+                       if (streamer_may_have_gold)
+                       {
+                               /* Hack -- Add some known treasure */
+                               if (one_in_(chance))
+                               {
+                                       cave_alter_feat(ty, tx, FF_MAY_HAVE_GOLD);
+                               }
 
-                       /* Hack -- Add some hidden treasure */
-                       else if (treasure && one_in_(chance/4))
-                               c_ptr->feat += (FEAT_MAGMA_H - FEAT_MAGMA);
+                               /* Hack -- Add some hidden treasure */
+                               else if (one_in_(chance / 4))
+                               {
+                                       cave_alter_feat(ty, tx, FF_MAY_HAVE_GOLD);
+                                       cave_alter_feat(ty, tx, FF_ENSECRET);
+                               }
+                       }
                }
 
                if (dummy >= SAFE_MAX_ATTEMPTS)
index 08b9146..acefd88 100644 (file)
@@ -6719,14 +6719,6 @@ option_type option_info[] =
 #endif
 
 #ifdef JP
-       { &new_ascii_graphics,          FALSE, OPT_PAGE_OUTPUT, 2, 4,
-       "new_ascii_graphics",           "ÃÏ·Á¤ÎÌÀ°Å¤ò¤Ï¤Ã¤­¤ê¤Èɽ¼¨¤¹¤ë" },
-#else
-       { &new_ascii_graphics,          FALSE, OPT_PAGE_OUTPUT, 2, 4,
-       "new_ascii_graphics",           "Show a clear contrast between light and dark" },
-#endif
-
-#ifdef JP
        { &display_path,                FALSE, OPT_PAGE_OUTPUT, 2, 8,
        "display_path",                 "ËâË¡¤äÌð¤Îµ°Àפòɽ¼¨¤¹¤ë" },
 #else
@@ -7759,7 +7751,7 @@ cptr exp_level_str[5]=
 {"[Unskilled]", "[Beginner]", "[Skilled]", "[Expert]", "[Master]"};
 #endif
 
-byte conv_terrain2feat[MAX_WILDERNESS] =
+s16b conv_terrain2feat[MAX_WILDERNESS] =
 {
   FEAT_PERM_EXTRA,
   FEAT_TOWN,
@@ -8152,3 +8144,123 @@ mbe_info_type mbe_info[] =
        {  5, GF_MANA,       }, /* DR_MANA   */
        { 60, GF_MISSILE,    }, /* SUPERHURT */
 };
+
+
+/*
+ * The table of features' actions
+ */
+byte feature_action_flags[FF_FLAG_MAX] =
+{
+       0, /* LOS */
+       0, /* PROJECT */
+       0, /* MOVE */
+       0, /* PLACE */
+       0, /* DROP */
+       0, /* SECRET */
+       0, /* NOTICE */
+       0, /* REMEMBER */
+       0, /* OPEN */
+       0, /* CLOSE */
+       0, /* BASH */
+       0, /* SPIKE */
+       FAF_DESTROY, /* DISARM */
+       0, /* STORE */
+       FAF_DESTROY, /* TUNNEL */
+       0, /* MAY_HAVE_GOLD */
+       0, /* HAS_GOLD */
+       0, /* HAS_ITEM */
+       0, /* DOOR */
+       0, /* TRAP */
+       0, /* STAIRS */
+       0, /* GLYPH */
+       0, /* LESS */
+       0, /* MORE */
+       0, /* RUN */
+       0, /* FLOOR */
+       0, /* WALL */
+       0, /* PERMANENT */
+       0, /* INNER */
+       0, /* OUTER */
+       0, /* SOLID */
+       0, /* HIT_TRAP */
+
+       0, /* BRIDGE */
+       0, /* RIVER */
+       0, /* LAKE */
+       0, /* BRIDGED */
+       0, /* COVERED */
+       0, /* GLOW */
+       0, /* ENSECRET */
+       0, /* WATER */
+       0, /* LAVA */
+       0, /* SHALLOW */
+       0, /* DEEP */
+       0, /* FILLED */
+       FAF_DESTROY, /* HURT_ROCK */
+       0, /* HURT_FIRE */
+       0, /* HURT_COLD */
+       0, /* HURT_ACID */
+       0, /* ICE */
+       0, /* ACID */
+       0, /* OIL */
+       0, /* MUST_FLY */
+       0, /* CAN_CLIMB */
+       0, /* CAN_FLY */
+       0, /* CAN_SWIM */
+       0, /* CAN_PASS */
+       0, /* CAN_OOZE */
+       0, /* CAN_DIG */
+       0, /* HIDE_ITEM */
+       0, /* HIDE_SNEAK */
+       0, /* HIDE_SWIM */
+       0, /* HIDE_DIG */
+       0, /* KILL_HUGE */
+       0, /* KILL_MOVE */
+
+       0, /* PICK_TRAP */
+       0, /* PICK_DOOR */
+       0, /* ALLOC */
+       0, /* CHEST */
+       0, /* DROP_1D2 */
+       0, /* DROP_2D2 */
+       0, /* DROP_GOOD */
+       0, /* DROP_GREAT */
+       0, /* HURT_POIS */
+       0, /* HURT_ELEC */
+       0, /* HURT_WATER */
+       0, /* HURT_BWATER */
+       0, /* USE_FEAT */
+       0, /* GET_FEAT */
+       0, /* GROUND */
+       0, /* OUTSIDE */
+       0, /* EASY_HIDE */
+       0, /* EASY_CLIMB */
+       0, /* MUST_CLIMB */
+       0, /* TREE */
+       0, /* NEED_TREE */
+       0, /* BLOOD */
+       0, /* DUST */
+       0, /* SLIME */
+       0, /* PLANT */
+       0, /* XXX2 */
+       0, /* INSTANT */
+       0, /* EXPLODE */
+       0, /* TIMED */
+       0, /* ERUPT */
+       0, /* STRIKE */
+       0, /* SPREAD */
+
+       0, /* SPECIAL */
+       FAF_DESTROY | FAF_NO_DROP, /* HURT_DISI */
+       0, /* QUEST_ENTER */
+       0, /* QUEST_EXIT */
+       0, /* QUEST */
+       0, /* SHAFT */
+       0, /* MOUNTAIN */
+       0, /* BLDG */
+       0, /* MINOR_GLYPH */
+       0, /* PATTERN */
+       0, /* TOWN */
+       0, /* ENTRANCE */
+       0, /* MIRROR */
+};
index 595a680..53cf672 100644 (file)
 
 
 /*
+ * Feature state structure
+ *
+ * - Action (FF_*)
+ * - Result (FEAT_*)
+ */
+typedef struct feature_state feature_state;
+
+struct feature_state
+{
+       byte action;
+       s16b result;
+};
+
+
+/*
  * Information about terrain "features"
  */
 
@@ -56,21 +71,26 @@ typedef struct feature_type feature_type;
 
 struct feature_type
 {
-       u32b name;                      /* Name (offset) */
-       u32b text;                      /* Text (offset) */
+       u32b name;                /* Name (offset) */
+       u32b text;                /* Text (offset) */
+       s16b tag;                 /* Tag (offset) */
+
+       s16b mimic;               /* Feature to mimic */
 
-       byte mimic;                     /* Feature to mimic */
+       u32b flags[FF_FLAG_SIZE]; /* Flags */
 
-       byte extra;                     /* Extra byte (unused) */
+       u16b priority;            /* Map priority */
+       s16b destroyed;           /* Default destroyed state */
 
-       s16b unused;            /* Extra bytes (unused) */
+       feature_state state[MAX_FEAT_STATES];
 
-       byte d_attr;            /* Default feature attribute */
-       byte d_char;            /* Default feature character */
+       byte power;
 
+       byte d_attr[F_LIT_MAX];   /* Default feature attribute */
+       byte d_char[F_LIT_MAX];   /* Default feature character */
 
-       byte x_attr;            /* Desired feature attribute */
-       byte x_char;            /* Desired feature character */
+       byte x_attr[F_LIT_MAX];   /* Desired feature attribute */
+       byte x_char[F_LIT_MAX];   /* Desired feature character */
 };
 
 
@@ -422,7 +442,7 @@ struct cave_type
 {
        u16b info;              /* Hack -- cave flags */
 
-       byte feat;              /* Hack -- feature type */
+       s16b feat;              /* Hack -- feature type */
 
        s16b o_idx;             /* Object in this grid */
 
@@ -430,7 +450,7 @@ struct cave_type
 
        s16b special;   /* Special cave info */
 
-       byte mimic;             /* Feature to mimic */
+       s16b mimic;             /* Feature to mimic */
 
        byte cost;              /* Hack -- cost of flowing */
        byte dist;              /* Hack -- distance from player */
@@ -1454,14 +1474,14 @@ struct building_type
 typedef struct border_type border_type;
 struct border_type
 {
-       byte    north[MAX_WID];
-       byte    south[MAX_WID];
-       byte    east[MAX_HGT];
-       byte    west[MAX_HGT];
-       byte    north_west;
-       byte    north_east;
-       byte    south_west;
-       byte    south_east;
+       s16b north[MAX_WID];
+       s16b south[MAX_WID];
+       s16b east[MAX_HGT];
+       s16b west[MAX_HGT];
+       s16b north_west;
+       s16b north_east;
+       s16b south_west;
+       s16b south_east;
 };
 
 
@@ -1575,21 +1595,21 @@ struct dungeon_info_type {
        byte dy;
        byte dx;
 
-       byte floor1;            /* Floor tile 1 */
+       s16b floor1;            /* Floor tile 1 */
        byte floor_percent1;    /* Chance of type 1 */
-       byte floor2;            /* Floor tile 2 */
+       s16b floor2;            /* Floor tile 2 */
        byte floor_percent2;    /* Chance of type 2 */
-       byte floor3;            /* Floor tile 3 */
+       s16b floor3;            /* Floor tile 3 */
        byte floor_percent3;    /* Chance of type 3 */
-       byte outer_wall;        /* Outer wall tile */
-       byte inner_wall;        /* Inner wall tile */
+       s16b outer_wall;        /* Outer wall tile */
+       s16b inner_wall;        /* Inner wall tile */
        s16b stream1;           /* stream tile */
        s16b stream2;           /* stream tile */
-       byte fill_type1;        /* Cave tile 1 */
+       s16b fill_type1;        /* Cave tile 1 */
        byte fill_percent1;     /* Chance of type 1 */
-       byte fill_type2;        /* Cave tile 2 */
+       s16b fill_type2;        /* Cave tile 2 */
        byte fill_percent2;     /* Chance of type 2 */
-       byte fill_type3;        /* Cave tile 3 */
+       s16b fill_type3;        /* Cave tile 3 */
        byte fill_percent3;     /* Chance of type 3 */
        s16b mindepth;          /* Minimal depth */
        s16b maxdepth;          /* Maximal depth */
@@ -1660,8 +1680,8 @@ typedef struct
 typedef struct
 {
        u16b info;
-       byte feat;
-       byte mimic;
+       s16b feat;
+       s16b mimic;
        s16b special;
        u16b occurrence;
 } cave_template_type;
index f9f9848..6335fb7 100644 (file)
@@ -224,7 +224,6 @@ bool view_yellow_lite;   /* Use special colors for torch-lit grids */
 bool view_bright_lite;   /* Use special colors for 'viewable' grids */
 bool view_granite_lite;   /* Use special colors for wall grids (slow) */
 bool view_special_lite;   /* Use special colors for floor grids (slow) */
-bool new_ascii_graphics;   /* Show a clear contrast between light and dark */
 bool display_path;   /* Display actual path before shooting */
 bool always_show_list;   /* Always show list at first when select items */
 bool abbrev_extra;   /* Describe obj's extra resistances by abbreviation */
@@ -807,6 +806,7 @@ player_magic *m_info;
  */
 feature_type *f_info;
 char *f_name;
+char *f_tag;
 
 /*
  * The object kind arrays
@@ -1212,10 +1212,10 @@ cptr screen_dump = NULL;
 byte dungeon_type;
 s16b *max_dlv;
 
-byte feat_wall_outer;
-byte feat_wall_inner;
-byte feat_wall_solid;
-byte floor_type[100], fill_type[100];
+s16b feat_wall_outer;
+s16b feat_wall_inner;
+s16b feat_wall_solid;
+s16b floor_type[100], fill_type[100];
 
 bool now_damaged;
 s16b now_message;
index 948a029..a593140 100644 (file)
@@ -518,10 +518,10 @@ static void generate_wilderness_area(int terrain, u32b seed, bool border, bool c
         * ToDo: calculate the medium height of the adjacent
         * terrains for every corner.
         */
-       cave[1][1].feat = (byte)randint0(table_size);
-       cave[MAX_HGT-2][1].feat = (byte)randint0(table_size);
-       cave[1][MAX_WID-2].feat = (byte)randint0(table_size);
-       cave[MAX_HGT-2][MAX_WID-2].feat = (byte)randint0(table_size);
+       cave[1][1].feat = randint0(table_size);
+       cave[MAX_HGT-2][1].feat = randint0(table_size);
+       cave[1][MAX_WID-2].feat = randint0(table_size);
+       cave[MAX_HGT-2][MAX_WID-2].feat = randint0(table_size);
 
        if (!corner)
        {
@@ -663,7 +663,7 @@ static void generate_area(int y, int x, bool border, bool corner)
                dx = rand_range(6, cur_wid - 6);
 
                cave[dy][dx].feat = FEAT_ENTRANCE;
-               cave[dy][dx].special = (byte)wilderness[y][x].entrance;
+               cave[dy][dx].special = wilderness[y][x].entrance;
 
                /* Use the complex RNG */
                Rand_quick = FALSE;
@@ -684,6 +684,7 @@ void wilderness_gen(void)
 {
        int i, y, x, lim;
        cave_type *c_ptr;
+       feature_type *f_ptr;
 
        /* Big town */
        cur_hgt = MAX_HGT;
@@ -815,24 +816,22 @@ void wilderness_gen(void)
                        else
                        {
                                /* Feature code (applying "mimic" field) */
-                               byte feat = get_feat_mimic(c_ptr);
+                               f_ptr = &f_info[get_feat_mimic(c_ptr)];
 
-                               if (!is_mirror_grid(c_ptr) && (feat != FEAT_QUEST_ENTER) && (feat != FEAT_ENTRANCE))
+                               if (!is_mirror_grid(c_ptr) && !have_flag(f_ptr->flags, FF_QUEST_ENTER) &&
+                                   !have_flag(f_ptr->flags, FF_ENTRANCE))
                                {
                                        /* Assume dark */
                                        c_ptr->info &= ~(CAVE_GLOW);
 
                                        /* Darken "boring" features */
-                                       if ((feat <= FEAT_INVIS) ||
-                                          ((feat >= FEAT_DEEP_WATER) &&
-                                           (feat <= FEAT_MOUNTAIN) &&
-                                           (feat != FEAT_MUSEUM)))
+                                       if (!have_flag(f_ptr->flags, FF_REMEMBER))
                                        {
                                                /* Forget the grid */
                                                c_ptr->info &= ~(CAVE_MARK);
                                        }
                                }
-                               else if (feat == FEAT_ENTRANCE)
+                               else if (have_flag(f_ptr->flags, FF_ENTRANCE))
                                {
                                        /* Assume lit */
                                        c_ptr->info |= (CAVE_GLOW);
@@ -850,11 +849,20 @@ void wilderness_gen(void)
                {
                        for (x = 0; x < cur_wid; x++)
                        {
-                               if (((cave[y][x].feat - FEAT_BLDG_HEAD) == 4) || ((p_ptr->town_num == 1) && ((cave[y][x].feat - FEAT_BLDG_HEAD) == 0)))
+                               /* Get the cave grid */
+                               c_ptr = &cave[y][x];
+
+                               /* Seeing true feature code (ignore mimic) */
+                               f_ptr = &f_info[c_ptr->feat];
+
+                               if (have_flag(f_ptr->flags, FF_BLDG))
                                {
-                                       if (cave[y][x].m_idx) delete_monster_idx(cave[y][x].m_idx);
-                                       p_ptr->oldpy = y;
-                                       p_ptr->oldpx = x;
+                                       if ((f_ptr->power == 4) || ((p_ptr->town_num == 1) && (f_ptr->power == 0)))
+                                       {
+                                               if (c_ptr->m_idx) delete_monster_idx(c_ptr->m_idx);
+                                               p_ptr->oldpy = y;
+                                               p_ptr->oldpx = x;
+                                       }
                                }
                        }
                }
@@ -867,9 +875,12 @@ void wilderness_gen(void)
                {
                        for (x = 0; x < cur_wid; x++)
                        {
-                               if (cave[y][x].feat == FEAT_ENTRANCE)
+                               /* Get the cave grid */
+                               c_ptr = &cave[y][x];
+
+                               if (have_flag(f_flags_grid(c_ptr), FF_ENTRANCE))
                                {
-                                       if (cave[y][x].m_idx) delete_monster_idx(cave[y][x].m_idx);
+                                       if (c_ptr->m_idx) delete_monster_idx(c_ptr->m_idx);
                                        p_ptr->oldpy = y;
                                        p_ptr->oldpx = x;
                                }
index 6fe6d8d..22f0400 100644 (file)
@@ -108,7 +108,7 @@ static bool wiz_dimension_door(void)
 
        if (!tgt_pt(&x, &y)) return FALSE;
 
-       if (!cave_empty_bold(y, x))
+       if (!cave_teleportable_bold(y, x, TELEPORT_ALLOW_DEEP | TELEPORT_ALLOW_OBJECT))
        {
 #ifdef JP
 msg_print("ÀºÎ¤«¤éʪ¼Á³¦¤ËÌá¤ë»þ¤¦¤Þ¤¯¤¤¤«¤Ê¤«¤Ã¤¿¡ª");
index 896b017..1f0f21f 100644 (file)
@@ -2953,6 +2953,7 @@ void calc_bonuses(void)
 #endif
        bool            have_sw = FALSE, have_kabe = FALSE;
        bool            easy_2weapon = FALSE;
+       bool            riding_ffall = FALSE;
        s16b this_o_idx, next_o_idx = 0;
        player_race *tmp_rp_ptr;
 
@@ -3594,16 +3595,10 @@ void calc_bonuses(void)
                        new_speed += (p_ptr->lev) / 10 + 5;
        }
 
-       if (p_ptr->riding)
+       if (music_singing(MUSIC_WALL))
        {
-               if (!(r_info[m_list[p_ptr->riding].r_idx].flags2 & RF2_PASS_WALL))
-                       p_ptr->pass_wall = FALSE;
-               if (r_info[m_list[p_ptr->riding].r_idx].flags2 & RF2_KILL_WALL)
-                       p_ptr->pass_wall = TRUE;
+               p_ptr->kill_wall = TRUE;
        }
-       if (music_singing(MUSIC_WALL)) p_ptr->kill_wall = TRUE;
-
-       if (p_ptr->kill_wall) p_ptr->pass_wall = TRUE;
 
        /* Hack -- apply racial/class stat maxes */
        /* Apply the racial modifiers */
@@ -4307,10 +4302,16 @@ void calc_bonuses(void)
                p_ptr->dis_to_d[1] -= 5;
        }
 
-       /* wraith_form */
+       /* Wraith form */
        if (p_ptr->wraith_form)
        {
                p_ptr->reflect = TRUE;
+               p_ptr->pass_wall = TRUE;
+       }
+
+       if (p_ptr->kabenuke)
+       {
+               p_ptr->pass_wall = TRUE;
        }
 
        /* Temporary blessing */
@@ -4533,8 +4534,11 @@ void calc_bonuses(void)
 
        if (p_ptr->riding)
        {
-               int speed = m_list[p_ptr->riding].mspeed;
-               if (m_list[p_ptr->riding].mspeed > 110)
+               monster_type *riding_m_ptr = &m_list[p_ptr->riding];
+               monster_race *riding_r_ptr = &r_info[riding_m_ptr->r_idx];
+               int speed = riding_m_ptr->mspeed;
+
+               if (riding_m_ptr->mspeed > 110)
                {
                        new_speed = 110 + (s16b)((speed - 110) * (p_ptr->skill_exp[GINOU_RIDING] * 3 + p_ptr->lev * 160L - 10000L) / (22000L));
                        if (new_speed < 110) new_speed = 110;
@@ -4543,16 +4547,18 @@ void calc_bonuses(void)
                {
                        new_speed = speed;
                }
-               new_speed 
-               += (p_ptr->skill_exp[GINOU_RIDING] + p_ptr->lev *160L)/3200;
-               if (m_list[p_ptr->riding].fast) new_speed += 10;
-               if (m_list[p_ptr->riding].slow) new_speed -= 10;
-               if (r_info[m_list[p_ptr->riding].r_idx].flags7 & RF7_CAN_FLY) p_ptr->ffall = TRUE;
-               if (r_info[m_list[p_ptr->riding].r_idx].flags7 & (RF7_CAN_SWIM | RF7_AQUATIC)) p_ptr->can_swim = TRUE;
+               new_speed += (p_ptr->skill_exp[GINOU_RIDING] + p_ptr->lev *160L)/3200;
+               if (riding_m_ptr->fast) new_speed += 10;
+               if (riding_m_ptr->slow) new_speed -= 10;
+               riding_ffall = (riding_r_ptr->flags7 & RF7_CAN_FLY) ? TRUE : FALSE;
+               if (riding_r_ptr->flags7 & (RF7_CAN_SWIM | RF7_AQUATIC)) p_ptr->can_swim = TRUE;
+
+               if (!(riding_r_ptr->flags2 & RF2_PASS_WALL)) p_ptr->pass_wall = FALSE;
+               if (riding_r_ptr->flags2 & RF2_KILL_WALL) p_ptr->kill_wall = TRUE;
 
                if (p_ptr->skill_exp[GINOU_RIDING] < RIDING_EXP_SKILLED) j += (p_ptr->wt * 3 * (RIDING_EXP_SKILLED - p_ptr->skill_exp[GINOU_RIDING])) / RIDING_EXP_SKILLED;
 
-               i = 3000 + r_info[m_list[p_ptr->riding].r_idx].level * 50;
+               i = 3000 + riding_r_ptr->level * 50;
        }
 
        /* XXX XXX XXX Apply "encumbrance" from weight */
@@ -5059,6 +5065,8 @@ void calc_bonuses(void)
                p_ptr->num_blow[0] += 1+extra_blows[0];
        }
 
+       if (p_ptr->riding) p_ptr->ffall = riding_ffall;
+
        monk_armour_aux = FALSE;
 
        if (heavy_armor())
@@ -5493,7 +5501,7 @@ msg_print("
                if ((o_ptr->tval == TV_ENCHANT_BOOK) && (o_ptr->sval == 2)) have_kabe = TRUE;
        }
 
-       if ((p_ptr->pass_wall && !p_ptr->kill_wall) || p_ptr->kabenuke || p_ptr->wraith_form) p_ptr->no_flowed = TRUE;
+       if (p_ptr->pass_wall && !p_ptr->kill_wall) p_ptr->no_flowed = TRUE;
 #if 0
        if (have_dd_s && ((p_ptr->realm1 == REALM_SORCERY) || (p_ptr->realm2 == REALM_SORCERY) || (p_ptr->pclass == CLASS_SORCERER)))
        {
index bf55c7e..a7c2c5a 100644 (file)
@@ -2919,62 +2919,11 @@ static bool target_set_accept(int y, int x)
        /* Interesting memorized features */
        if (c_ptr->info & (CAVE_MARK))
        {
-               /* Feature code (applying "mimic" field) */
-               byte feat = get_feat_mimic(c_ptr);
-
-               /* Notice glyphs */
+               /* Notice object features */
                if (c_ptr->info & CAVE_OBJECT) return (TRUE);
 
-               /* Notice the Pattern */
-               if ((feat <= FEAT_PATTERN_XTRA2) &&
-                   (feat >= FEAT_PATTERN_START))
-                       return (TRUE);
-
-               /* Notice doors */
-               if (feat == FEAT_OPEN) return (TRUE);
-               if (feat == FEAT_BROKEN) return (TRUE);
-
-               /* Notice stairs */
-               if (feat == FEAT_LESS) return (TRUE);
-               if (feat == FEAT_MORE) return (TRUE);
-               if (feat == FEAT_LESS_LESS) return (TRUE);
-               if (feat == FEAT_MORE_MORE) return (TRUE);
-
-               /* Notice shops */
-               if ((feat >= FEAT_SHOP_HEAD) &&
-                   (feat <= FEAT_SHOP_TAIL)) return (TRUE);
-
-               if (feat == FEAT_MUSEUM) return (TRUE);
-
-               /* Notice buildings -KMW- */
-               if ((feat >= FEAT_BLDG_HEAD) &&
-                   (feat <= FEAT_BLDG_TAIL)) return (TRUE);
-
-               /* Notice traps */
-               if (is_trap(feat)) return (TRUE);
-
-               /* Notice doors */
-               if ((feat >= FEAT_DOOR_HEAD) &&
-                   (feat <= FEAT_DOOR_TAIL)) return (TRUE);
-
-#if 0
-               /* Notice rubble */
-               /* I think FEAT_RUBBLEs should not be "interesting" */
-               if (feat == FEAT_RUBBLE) return (TRUE);
-
-               /* Notice veins with treasure */
-               /* Now veins with treasure are too many */
-               if (feat == FEAT_MAGMA_K) return (TRUE);
-               if (feat == FEAT_QUARTZ_K) return (TRUE);
-#endif
-
-               /* Notice quest features */
-               if (feat == FEAT_QUEST_ENTER) return (TRUE);
-               if (feat == FEAT_QUEST_EXIT) return (TRUE);
-               if (feat == FEAT_QUEST_DOWN) return (TRUE);
-               if (feat == FEAT_QUEST_UP) return (TRUE);
-               if (feat == FEAT_TOWN) return (TRUE);
-               if (feat == FEAT_ENTRANCE) return (TRUE);
+               /* Feature code (applying "mimic" field) */
+               if (have_flag(f_info[get_feat_mimic(c_ptr)].flags, FF_NOTICE)) return TRUE;
        }
 
        /* Nope */
@@ -3127,7 +3076,8 @@ static int target_set_aux(int y, int x, int mode, cptr info)
        s16b this_o_idx, next_o_idx = 0;
        cptr s1 = "", s2 = "", s3 = "", x_info = "";
        bool boring = TRUE;
-       byte feat;
+       s16b feat;
+       feature_type *f_ptr;
        int query = '\001';
        char out_val[MAX_NLEN+80];
 
@@ -3578,17 +3528,19 @@ static int target_set_aux(int y, int x, int mode, cptr info)
                feat = FEAT_NONE;
        }
 
+       f_ptr = &f_info[feat];
+
        /* Terrain feature if needed */
        if (boring || (feat > FEAT_INVIS))
        {
                cptr name;
 
                /* Hack -- special handling for building doors */
-               if ((feat >= FEAT_BLDG_HEAD) && (feat <= FEAT_BLDG_TAIL))
+               if (have_flag(f_ptr->flags, FF_BLDG))
                {
-                       name = building[feat - FEAT_BLDG_HEAD].name;
+                       name = building[f_ptr->power].name;
                }
-               else if (feat == FEAT_ENTRANCE)
+               else if (have_flag(f_ptr->flags, FF_ENTRANCE))
                {
 #ifdef JP
                        name = format("%s(%d³¬ÁêÅö)", d_text + d_info[c_ptr->special].text, d_info[c_ptr->special].mindepth);
@@ -3596,7 +3548,7 @@ static int target_set_aux(int y, int x, int mode, cptr info)
                        name = format("%s(level %d)", d_text + d_info[c_ptr->special].text, d_info[c_ptr->special].mindepth);
 #endif
                }
-               else if (feat == FEAT_TOWN)
+               else if (have_flag(f_ptr->flags, FF_TOWN))
                {
                        name = town[c_ptr->special].name;
                }
@@ -3610,80 +3562,59 @@ static int target_set_aux(int y, int x, int mode, cptr info)
                }
                else
                {
-                       name = f_name + f_info[feat].name;
+                       name = f_name + f_ptr->name;
                }
 
 
                /* Pick a prefix */
-               if (*s2 && ((feat >= FEAT_MINOR_GLYPH) &&
-                           (feat <= FEAT_PATTERN_XTRA2)))
-               {
-#ifdef JP
-                       s2 = "¤Î¾å";
-#else
-                       s2 = "on ";
-#endif
-
-               }
-               else if (*s2 && ((feat >= FEAT_DOOR_HEAD) &&
-                                (feat <= FEAT_PERM_SOLID)))
+               if (*s2 &&
+                   (!have_flag(f_ptr->flags, FF_MOVE) ||
+                   (!have_flag(f_ptr->flags, FF_LOS) &&
+                    !have_flag(f_ptr->flags, FF_TREE)) ||
+                    have_flag(f_ptr->flags, FF_TOWN)))
                {
 #ifdef JP
                        s2 = "¤ÎÃæ";
 #else
                        s2 = "in ";
 #endif
-
-               }
-               else if (*s2 && (feat == FEAT_TOWN))
-               {
-#ifdef JP
-                       s2 = "¤ÎÃæ";
-#else
-                       s2 = "in ";
-#endif
-
                }
 
                /* Hack -- special introduction for store & building doors -KMW- */
-               if (((feat >= FEAT_SHOP_HEAD) && (feat <= FEAT_SHOP_TAIL)) ||
-                   ((feat >= FEAT_BLDG_HEAD) && (feat <= FEAT_BLDG_TAIL)) ||
-                   (feat == FEAT_MUSEUM) ||
-                   (feat == FEAT_ENTRANCE))
+               if (have_flag(f_ptr->flags, FF_STORE) ||
+                   have_flag(f_ptr->flags, FF_BLDG) ||
+                   have_flag(f_ptr->flags, FF_ENTRANCE))
                {
 #ifdef JP
                        s2 = "¤ÎÆþ¸ý";
 #else
                        s3 = "";
 #endif
-
                }
-               else if ((feat == FEAT_TOWN) || (feat == FEAT_FLOOR) || (feat == FEAT_DIRT) || (feat == FEAT_FLOWER))
-               {
 #ifndef JP
+               else if (have_flag(f_ptr->flags, FF_FLOOR) || have_flag(f_ptr->flags, FF_TOWN))
+               {
                        s3 ="";
-#endif
                }
                else
                {
                        /* Pick proper indefinite article */
-#ifndef JP
                        s3 = (is_a_vowel(name[0])) ? "an " : "a ";
-#endif
                }
+#endif
 
                /* Display a message */
                if (p_ptr->wizard)
 #ifdef JP
                        sprintf(out_val, "%s%s%s%s[%s] %x %d %d %d %d (%d,%d)", s1, name, s2, s3, info, c_ptr->info, c_ptr->feat, c_ptr->dist, c_ptr->cost, c_ptr->when, x, y);
 #else
-               sprintf(out_val, "%s%s%s%s [%s] %x %d %d %d %d (%d,%d)", s1, s2, s3, name, info, c_ptr->info, c_ptr->feat, c_ptr->dist, c_ptr->cost, c_ptr->when, x, y);
+                       sprintf(out_val, "%s%s%s%s [%s] %x %d %d %d %d (%d,%d)", s1, s2, s3, name, info, c_ptr->info, c_ptr->feat, c_ptr->dist, c_ptr->cost, c_ptr->when, x, y);
 #endif
                else
 #ifdef JP
                        sprintf(out_val, "%s%s%s%s[%s]", s1, name, s2, s3, info);
 #else
-               sprintf(out_val, "%s%s%s%s [%s]", s1, s2, s3, name, info);
+                       sprintf(out_val, "%s%s%s%s [%s]", s1, s2, s3, name, info);
 #endif
 
                prt(out_val, 0, 0);