@@ -1506,6 +1506,7 @@ | ||
1506 | 1506 | #ifdef MENU_COLOR |
1507 | 1507 | E boolean FDECL(add_menu_coloring, (char *)); |
1508 | 1508 | #endif /* MENU_COLOR */ |
1509 | +E boolean FDECL(parse_monster_color, (char *)); | |
1509 | 1510 | |
1510 | 1511 | /* ### pager.c ### */ |
1511 | 1512 |
@@ -2020,6 +2020,8 @@ | ||
2020 | 2020 | #ifdef MENU_COLOR |
2021 | 2021 | (void) add_menu_coloring(bufp); |
2022 | 2022 | #endif |
2023 | + } else if (match_varname(buf, "MONSTERCOLOR", 12)) { | |
2024 | + return parse_monster_color(bufp); | |
2023 | 2025 | } else if (match_varname(buf, "GRAPHICS", 4)) { |
2024 | 2026 | len = get_uchars(fp, buf, bufp, translate, FALSE, |
2025 | 2027 | MAXPCHARS, "GRAPHICS"); |
@@ -1603,6 +1603,59 @@ | ||
1603 | 1603 | } |
1604 | 1604 | #endif /* MENU_COLOR */ |
1605 | 1605 | |
1606 | +/* parse '"monster name":color' and change monster info accordingly */ | |
1607 | +boolean | |
1608 | +parse_monster_color(str) | |
1609 | +char *str; | |
1610 | +{ | |
1611 | + int i, c = NO_COLOR; | |
1612 | + char *tmps, *cs = strchr(str, ':'); | |
1613 | + char buf[BUFSZ]; | |
1614 | + int monster; | |
1615 | + | |
1616 | + if (!str) return FALSE; | |
1617 | + | |
1618 | + strncpy(buf, str, BUFSZ); | |
1619 | + cs = strchr(buf, ':'); | |
1620 | + if (!cs) return FALSE; | |
1621 | + | |
1622 | + tmps = cs; | |
1623 | + tmps++; | |
1624 | + /* skip whitespace at start of string */ | |
1625 | + while (*tmps && isspace(*tmps)) tmps++; | |
1626 | + | |
1627 | + /* determine color */ | |
1628 | + for (i = 0; i < SIZE(colornames); i++) | |
1629 | + if (strstri(tmps, colornames[i].name) == tmps) { | |
1630 | + c = colornames[i].color; | |
1631 | + break; | |
1632 | + } | |
1633 | + if ((i == SIZE(colornames)) && (*tmps >= '0' && *tmps <='9')) | |
1634 | + c = atoi(tmps); | |
1635 | + | |
1636 | + if (c > 15) return FALSE; | |
1637 | + | |
1638 | + /* determine monster name */ | |
1639 | + *cs = '\0'; | |
1640 | + tmps = buf; | |
1641 | + if ((*tmps == '"') || (*tmps == '\'')) { | |
1642 | + cs--; | |
1643 | + while (isspace(*cs)) cs--; | |
1644 | + if (*cs == *tmps) { | |
1645 | + *cs = '\0'; | |
1646 | + tmps++; | |
1647 | + } | |
1648 | + } | |
1649 | + | |
1650 | + monster = name_to_mon(tmps); | |
1651 | + if (monster > -1) { | |
1652 | + mons[monster].mcolor = c; | |
1653 | + return TRUE; | |
1654 | + } else { | |
1655 | + return FALSE; | |
1656 | + } | |
1657 | +} | |
1658 | + | |
1606 | 1659 | void |
1607 | 1660 | common_prefix_options_parser(fullname, opts, negated) |
1608 | 1661 | const char *fullname; |
@@ -1,4 +1,8 @@ | ||
1 | -2010-XX-XX UnNetHack 3.5.3 | |
1 | +2011-XX-XX UnNetHack 3.5.4 | |
2 | + * changing color of monster with config line: | |
3 | + MONSTERCOLOR=acid blob:lightcyan | |
4 | + | |
5 | +2010-09-04 UnNetHack 3.5.3 | |
2 | 6 | * Conflict makes blackmarket shopkeeper angry |
3 | 7 | * Fully eroded armor gets destroyed |
4 | 8 | * Lowered the needed experience level for the quest |