# This file is shared by classic16.cfg and classic32.cfg

# Standard 16 colors
set color {255 0 250 17 217 196 199 101 129 247 30 5 35 185 180 52}

###
### NOTE: Order of attribute creation is assumed in other places
###

# Create 16 ascii attributes (for monsters)
set attr(monster) [icon ascii count]
foreach paletteIndex $color {
	icon ascii create $paletteIndex 222
}

# Create 16 ascii attributes (for objects)
set attr(object) [icon ascii count]
foreach paletteIndex $color {
	icon ascii create $paletteIndex 232
}

# Create 1 ascii attribute (for character)
set attr(character) [icon ascii create 5 252]

# Create 1 ascii attribute (for floor stack)
set attr(stack) [icon ascii create 225 232]

# Create 1 ascii attribute (for multi-hued monster)
set attr(multi) [icon ascii create 0 222]
icon ascii configure $attr(multi) -mode attr_multi

# Create 1 ascii attribute (for shapechanging monster)
set attr(shape) [icon ascii create 0 222]
icon ascii configure $attr(shape) -mode shapechanger

# Attribute characters used by monsters and objects
set attrStr "dwsorgbuDWvyRGBU"

# Objects
set max_k_idx [angband k_info max]
for {set k_idx 1} {$k_idx < $max_k_idx} {incr k_idx} {
	angband k_info info $k_idx attrib
	set index [icon ascii index ascii $attrib(d_char) \
		[expr [string first $attrib(d_attr) $attrStr] + $attr(object)]]
	icon assign -to object -toindex $k_idx -type ascii -index $index
}

# Hack -- Staffs use different icon type
foreach k_idx [angband k_info find -tval TV_STAFF] {
	angband k_info info $k_idx attrib
	set index [icon ascii index staff $attrib(d_char) \
		[expr [string first $attrib(d_attr) $attrStr] + $attr(object)]]
	icon assign -to object -toindex $k_idx -type staff -index $index
}

# Monsters
set max_r_idx [angband r_info max]
for {set r_idx 1} {$r_idx < $max_r_idx} {incr r_idx} {
	angband r_info info $r_idx attrib
	set index [icon ascii index ascii $attrib(d_char) \
		[expr [string first $attrib(d_attr) $attrStr] + $attr(monster)]]
	icon assign -to monster -toindex $r_idx -type ascii -index $index
}

# Hack -- Some monsters are never seen
# These "none 0" assignments are never overridden
foreach r_idx [angband r_info find -flag CHAR_CLEAR -flag ATTR_CLEAR] {
	icon assign -to monster -toindex $r_idx -type none -index 0
}

# Hack -- Some monsters should look like objects
foreach r_idx [angband r_info find -d_char "!?=|$,(+"] {
	angband r_info info $r_idx attrib
	set index [icon ascii index ascii $attrib(d_char) \
		[expr [string first $attrib(d_attr) $attrStr] + $attr(object)]]
	icon assign -to monster -toindex $r_idx -type ascii -index $index
}

# Hack -- Some monsters are multi-hued
foreach r_idx [angband r_info find -flag ATTR_MULTI] {
	angband r_info info $r_idx attrib
	set index [icon ascii index ascii $attrib(d_char) $attr(multi)]
	icon assign -to monster -toindex $r_idx -type ascii -index $index
}

# Hack -- Some monsters are shapechangers
foreach r_idx [angband r_info find -flag SHAPECHANGER] {
	angband r_info info $r_idx attrib
	set index [icon ascii index ascii $attrib(d_char) $attr(shape)]
	icon assign -to monster -toindex $r_idx -type ascii -index $index
}

# Object 0 icon used for floor stack, when "easy_floor" option is on
set index [icon ascii index ascii * $attr(stack)]
icon assign -to object -toindex 0 -type ascii -index $index

# "Space monster" is all black
set r_idx [angband r_info find -name "Space monster"]
icon assign -to monster -toindex $r_idx -type blank -index 0

unset attr
