static void display_resistance_panel(const struct player_flag_record *rec, size_t size, const region *bounds) { size_t i; int j; int col = bounds->col; int row = bounds->row; int res_cols = 5 + 2 + player->body.count; Term_putstr(col, row++, res_cols, COLOUR_WHITE, " abcdefghijkl@"); for (i = 0; i < size - 3; i++, row++) { byte name_attr = COLOUR_WHITE; Term_gotoxy(col + 6, row); /* Repeated extraction of flags is inefficient but more natural */ for (j = 0; j <= player->body.count; j++) { bitflag f[OF_SIZE]; byte attr = COLOUR_WHITE | (j % 2) * 8; /* alternating columns */ char sym = '.'; bool res = false, imm = false, vul = false, rune = false; bool timed = false; bool known = false; /* Object or player info? */ if (j < player->body.count) { int index = 0; struct object *obj = slot_object(player, j); struct curse_data *curse = obj ? obj->curses : NULL; while (obj) { /* Wipe flagset */ of_wipe(f); /* Get known properties */ object_flags_known(obj, f); if (rec[i].element != -1) { known = object_element_is_known(obj, rec[i].element); } else if (rec[i].flag != -1) { known = object_flag_is_known(obj, rec[i].flag); } else { known = true; } /* Get resistance, immunity and vulnerability info */ if (rec[i].mod != -1) { if (obj->modifiers[rec[i].mod] != 0) { res = true; } rune = (player->obj_k->modifiers[rec[i].mod] == 1); } else if (rec[i].flag != -1) { if (of_has(f, rec[i].flag)) { res = true; } rune = of_has(player->obj_k->flags, rec[i].flag); } else if (rec[i].element != -1) { if (known) { if (obj->el_info[rec[i].element].res_level == 3) { imm = true; } if (obj->el_info[rec[i].element].res_level == 1) { res = true; } if (obj->el_info[rec[i].element].res_level == -1) { vul = true; } } rune = (player->obj_k->el_info[rec[i].element].res_level == 1); } /* Move to any unprocessed curse object */ if (curse) { index++; obj = NULL; while (index < z_info->curse_max) { if (curse[index].power) { obj = curses[index].obj; break; } else { index++; } } } else { obj = NULL; } } } else { player_flags(player, f); known = true; /* Timed flags only in the player column */ if (rec[i].tmd_flag >= 0) { timed = player->timed[rec[i].tmd_flag] ? true : false; /* There has to be one special case... */ if ((rec[i].tmd_flag == TMD_AFRAID) && (player->timed[TMD_TERROR])) timed = true; } /* Set which (if any) symbol and color are used */ if (rec[i].mod != -1) { int k; /* Shape modifiers */ for (k = 0; k < OBJ_MOD_MAX; k++) { res = (player->shape->modifiers[i] > 0); vul = (player->shape->modifiers[i] > 0); } /* Messy special cases */ if (rec[i].mod == OBJ_MOD_INFRA) res |= (player->race->infra > 0); if (rec[i].mod == OBJ_MOD_TUNNEL) res |= (player->race->r_skills[SKILL_DIGGING] > 0); } else if (rec[i].flag != -1) { res = of_has(f, rec[i].flag); res |= (of_has(player->shape->flags, rec[i].flag) && of_has(player->obj_k->flags, rec[i].flag)); } else if (rec[i].element != -1) { int el = rec[i].element; imm = (player->race->el_info[el].res_level == 3) || ((player->shape->el_info[el].res_level == 3) && (player->obj_k->el_info[el].res_level)); res = (player->race->el_info[el].res_level == 1) || ((player->shape->el_info[el].res_level == 1) && (player->obj_k->el_info[el].res_level)); vul = (player->race->el_info[el].res_level == -1) || ((player->shape->el_info[el].res_level == -1) && (player->obj_k->el_info[el].res_level)); } } /* Colour the name appropriately */ if (imm) { name_attr = COLOUR_GREEN; } else if (res && (name_attr != COLOUR_GREEN)) { name_attr = COLOUR_L_BLUE; } else if (vul && (name_attr != COLOUR_GREEN)) { name_attr = COLOUR_RED; } /* Set the symbols and print them */ if (vul) { sym = '-'; } else if (imm) { sym = '*'; } else if (res) { sym = '+'; } else if (timed) { sym = '!'; attr = COLOUR_L_GREEN; } else if ((j < player->body.count) && slot_object(player, j) && !known && !rune) { sym = '?'; } Term_addch(attr, sym); } /* Check if the rune is known */ if (((rec[i].mod >= 0) && (player->obj_k->modifiers[rec[i].mod] == 0)) || ((rec[i].flag >= 0) && !of_has(player->obj_k->flags, rec[i].flag)) || ((rec[i].element >= 0) && (player->obj_k->el_info[rec[i].element].res_level == 0))) { name_attr = COLOUR_SLATE; } Term_putstr(col, row, 6, name_attr, format("%5s:", rec[i].name)); } Term_putstr(col, row++, res_cols, COLOUR_WHITE, " abcdefghijkl@"); /* Equippy */ display_player_equippy(row++, col + 6); }
/** * Special display, part 2c * * How to print out the modifications and sustains. * Positive mods with no sustain will be light green. * Positive mods with a sustain will be dark green. * Sustains (with no modification) will be a dark green 's'. * Negative mods (from a curse) will be red. * Huge mods (>9), like from MICoMorgoth, will be a '*' * No mod, no sustain, will be a slate '.' */ static void display_player_sust_info(void) { int i, row, col, stat; struct object *obj; bitflag f[OF_SIZE]; byte a; char c; /* Row */ row = 2; /* Column */ col = 26; /* Header */ c_put_str(COLOUR_WHITE, "abcdefghijkl@", row-1, col); /* Process equipment */ for (i = 0; i < player->body.count; ++i) { /* Get the object */ obj = slot_object(player, i); if (!obj) { col++; continue; } /* Get the "known" flags */ object_flags_known(obj, f); /* Initialize color based on sign of modifier. */ for (stat = OBJ_MOD_MIN_STAT; stat < OBJ_MOD_MIN_STAT + STAT_MAX; stat++) { /* Default */ a = COLOUR_SLATE; c = '.'; /* Boosted or reduced */ if (obj->modifiers[stat] > 0) { /* Good */ a = COLOUR_L_GREEN; /* Label boost */ if (obj->modifiers[stat] < 10) c = I2D(obj->modifiers[stat]); } else if (obj->modifiers[stat] < 0) { /* Bad */ a = COLOUR_RED; /* Label boost */ if (obj->modifiers[stat] > -10) c = I2D(-(obj->modifiers[stat])); } /* Sustain */ if (of_has(f, sustain_flag(stat))) { /* Dark green */ a = COLOUR_GREEN; /* Convert '.' to 's' */ if (c == '.') c = 's'; } if ((c == '.') && obj && !object_flag_is_known(obj, sustain_flag(stat))) c = '?'; /* Dump proper character */ Term_putch(col, row+stat, a, c); } /* Advance */ col++; } /* Player flags */ player_flags(player, f); /* Check stats */ for (stat = 0; stat < STAT_MAX; ++stat) { /* Default */ a = COLOUR_SLATE; c = '.'; /* Sustain */ if (of_has(f, sustain_flag(stat))) { /* Dark green "s" */ a = COLOUR_GREEN; c = 's'; } /* Dump */ Term_putch(col, row+stat, a, c); } /* Column */ col = 26; /* Footer */ c_put_str(COLOUR_WHITE, "abcdefghijkl@", row+6, col); /* Equippy */ display_player_equippy(row+7, col); }
static void display_resistance_panel(const struct player_flag_record *rec, size_t size, const region *bounds) { size_t i; int j; int col = bounds->col; int row = bounds->row; int res_cols = 5 + 2 + player->body.count; Term_putstr(col, row++, res_cols, COLOUR_WHITE, " abcdefghijkl@"); for (i = 0; i < size - 3; i++, row++) { byte name_attr = COLOUR_WHITE; Term_gotoxy(col + 6, row); /* Repeated extraction of flags is inefficient but more natural */ for (j = 0; j <= player->body.count; j++) { struct object *obj; bitflag f[OF_SIZE]; byte attr = COLOUR_WHITE | (j % 2) * 8; /* alternating columns */ char sym = '.'; bool res = false, imm = false, vul = false, rune = false; bool timed = false; bool known = false; /* Wipe flagset */ of_wipe(f); /* Get the object or player info */ obj = j < player->body.count ? slot_object(player, j) : NULL; if (j < player->body.count && obj) { /* Get known properties */ object_flags_known(obj, f); if (rec[i].element != -1) known = object_element_is_known(obj, rec[i].element); else if (rec[i].flag != -1) known = object_flag_is_known(obj, rec[i].flag); else known = true; } else if (j == player->body.count) { player_flags(player, f); known = true; /* Timed flags only in the player column */ if (rec[i].tmd_flag >= 0) { timed = player->timed[rec[i].tmd_flag] ? true : false; /* There has to be one special case... */ if ((rec[i].tmd_flag == TMD_AFRAID) && (player->timed[TMD_TERROR])) timed = true; } } /* Set which (if any) symbol and color are used */ if (rec[i].mod != -1) { if (j != player->body.count) res = (obj && (obj->modifiers[rec[i].mod] != 0)); else { /* Messy special cases */ if (rec[i].mod == OBJ_MOD_INFRA) res = (player->race->infra > 0); if (rec[i].mod == OBJ_MOD_TUNNEL) res = (player->race->r_skills[SKILL_DIGGING] > 0); } rune = (player->obj_k->modifiers[rec[i].mod] == 1); } else if (rec[i].flag != -1) { res = of_has(f, rec[i].flag); rune = of_has(player->obj_k->flags, rec[i].flag); } else if (rec[i].element != -1) { if (j != player->body.count) { imm = obj && known && (obj->el_info[rec[i].element].res_level == 3); res = obj && known && (obj->el_info[rec[i].element].res_level == 1); vul = obj && known && (obj->el_info[rec[i].element].res_level == -1); } else { imm = player->race->el_info[rec[i].element].res_level == 3; res = player->race->el_info[rec[i].element].res_level == 1; vul = player->race->el_info[rec[i].element].res_level == -1; } rune = (player->obj_k->el_info[rec[i].element].res_level == 1); } /* Set the symbols and print them */ if (imm) name_attr = COLOUR_GREEN; else if (!rune) name_attr = COLOUR_SLATE; else if (res && (name_attr != COLOUR_GREEN)) name_attr = COLOUR_L_BLUE; if (vul) sym = '-'; else if (imm) sym = '*'; else if (res) sym = '+'; else if (timed) { sym = '!'; attr = COLOUR_L_GREEN; } else if ((j < player->body.count) && obj && !known && !rune) sym = '?'; Term_addch(attr, sym); } Term_putstr(col, row, 6, name_attr, format("%5s:", rec[i].name)); } Term_putstr(col, row++, res_cols, COLOUR_WHITE, " abcdefghijkl@"); /* Equippy */ display_player_equippy(row++, col + 6); }
/* * Special display, part 2c * * How to print out the modifications and sustains. * Positive mods with no sustain will be light green. * Positive mods with a sustain will be dark green. * Sustains (with no modification) will be a dark green 's'. * Negative mods (from a curse) will be red. * Huge mods (>9), like from MICoMorgoth, will be a '*' * No mod, no sustain, will be a slate '.' */ static void display_player_sust_info(void) { int i, j, row, col, stat; object_type *o_ptr; bitflag f[OF_SIZE]; int stat_flags[A_MAX]; int sustain_flags[A_MAX]; byte a; char c; /* Row */ row = 2; /* Column */ col = 26; /* Build the stat flags tables */ stat_flags[A_STR] = OF_STR; stat_flags[A_INT] = OF_INT; stat_flags[A_WIS] = OF_WIS; stat_flags[A_DEX] = OF_DEX; stat_flags[A_CON] = OF_CON; sustain_flags[A_STR] = OF_SUST_STR; sustain_flags[A_INT] = OF_SUST_INT; sustain_flags[A_WIS] = OF_SUST_WIS; sustain_flags[A_DEX] = OF_SUST_DEX; sustain_flags[A_CON] = OF_SUST_CON; /* Header */ c_put_str(TERM_WHITE, "abcdefghijkl@", row-1, col); /* Process equipment */ for (i = INVEN_WIELD; i < INVEN_TOTAL; ++i) { /* Get the object */ o_ptr = &p_ptr->inventory[i]; if (!o_ptr->kind) { col++; continue; } /* Get the "known" flags */ object_flags_known(o_ptr, f); /* Initialize color based of sign of pval. */ for (stat = 0; stat < A_MAX; stat++) { /* Default */ a = TERM_SLATE; c = '.'; /* Boost */ if (of_has(f, stat_flags[stat])) { /* Default */ c = '*'; /* Work out which pval we're talking about */ j = which_pval(o_ptr, stat_flags[stat]); /* Good */ if (o_ptr->pval[j] > 0) { /* Good */ a = TERM_L_GREEN; /* Label boost */ if (o_ptr->pval[j] < 10) c = I2D(o_ptr->pval[j]); } /* Bad */ if (o_ptr->pval[j] < 0) { /* Bad */ a = TERM_RED; /* Label boost */ if (o_ptr->pval[j] > -10) c = I2D(-(o_ptr->pval[j])); } } /* Sustain */ if (of_has(f, sustain_flags[stat])) { /* Dark green */ a = TERM_GREEN; /* Convert '.' to 's' */ if (c == '.') c = 's'; } if ((c == '.') && o_ptr->kind && !object_flag_is_known(o_ptr, sustain_flags[stat])) c = '?'; /* Dump proper character */ Term_putch(col, row+stat, a, c); } /* Advance */ col++; } /* Player flags */ player_flags(f); /* Check stats */ for (stat = 0; stat < A_MAX; ++stat) { /* Default */ a = TERM_SLATE; c = '.'; /* Sustain */ if (of_has(f, sustain_flags[stat])) { /* Dark green "s" */ a = TERM_GREEN; c = 's'; } /* Dump */ Term_putch(col, row+stat, a, c); } /* Column */ col = 26; /* Footer */ c_put_str(TERM_WHITE, "abcdefghijkl@", row+6, col); /* Equippy */ display_player_equippy(row+7, col); }
static void display_resistance_panel(const struct player_flag_record *resists, size_t size, const region *bounds) { size_t i, j; int col = bounds->col; int row = bounds->row; Term_putstr(col, row++, RES_COLS, TERM_WHITE, " abcdefghijkl@"); for (i = 0; i < size-3; i++, row++) { byte name_attr = TERM_WHITE; Term_gotoxy(col+6, row); /* repeated extraction of flags is inefficient but more natural */ for (j = INVEN_WIELD; j <= INVEN_TOTAL; j++) { object_type *o_ptr = &p_ptr->inventory[j]; bitflag f[OF_SIZE]; byte attr = TERM_WHITE | (j % 2) * 8; /* alternating columns */ char sym = '.'; bool res, imm, vuln; /* Wipe flagset */ of_wipe(f); if (j < INVEN_TOTAL && o_ptr->kind) { object_flags_known(o_ptr, f); } else if (j == INVEN_TOTAL) { player_flags(f); /* If the race has innate infravision/digging, force the corresponding flag here. If we set it in player_flags(), then all callers of that function will think the infravision is caused by equipment. */ if (p_ptr->race->infra > 0) of_on(f, OF_INFRA); if (p_ptr->race->r_skills[SKILL_DIGGING] > 0) of_on(f, OF_TUNNEL); } res = of_has(f, resists[i].res_flag); imm = of_has(f, resists[i].im_flag); vuln = of_has(f, resists[i].vuln_flag); if (imm) name_attr = TERM_GREEN; else if (res && name_attr == TERM_WHITE) name_attr = TERM_L_BLUE; if (vuln) sym = '-'; else if (imm) sym = '*'; else if (res) sym = '+'; else if ((j < INVEN_TOTAL) && o_ptr->kind && !object_flag_is_known(o_ptr, resists[i].res_flag)) sym = '?'; Term_addch(attr, sym); } Term_putstr(col, row, 6, name_attr, format("%5s:", resists[i].name)); } Term_putstr(col, row++, RES_COLS, TERM_WHITE, " abcdefghijkl@"); /* Equippy */ display_player_equippy(row++, col+6); }
/* * Special display, part 2c * * How to print out the modifications and sustains. * Positive mods with no sustain will be light green. * Positive mods with a sustain will be dark green. * Sustains (with no modification) will be a dark green 's'. * Negative mods (from a curse) will be red. * Huge mods (>9), like from MICoMorgoth, will be a '*' * No mod, no sustain, will be a slate '.' */ static void display_player_sust_info(void) { int i, row, col, stat; object_type *o_ptr; bitflag f[OF_SIZE]; int stat_flags[A_MAX]; int sustain_flags[A_MAX]; byte a; char c; /* Row */ row = 2; /* Column */ col = 26; /* Build the stat flags tables */ stat_flags[A_STR] = OF_STR; stat_flags[A_INT] = OF_INT; stat_flags[A_WIS] = OF_WIS; stat_flags[A_DEX] = OF_DEX; stat_flags[A_CON] = OF_CON; stat_flags[A_CHR] = OF_CHR; sustain_flags[A_STR] = OF_SUST_STR; sustain_flags[A_INT] = OF_SUST_INT; sustain_flags[A_WIS] = OF_SUST_WIS; sustain_flags[A_DEX] = OF_SUST_DEX; sustain_flags[A_CON] = OF_SUST_CON; sustain_flags[A_CHR] = OF_SUST_CHR; /* Header */ c_put_str(TERM_WHITE, "@abcdefghijklmnopqrstuvwxyz{|}", row-1, col); /* Process equipment */ for (i = INVEN_WIELD - 1; i < INVEN_TOTAL; ++i) { if (((i >= INVEN_WIELD) && (i < INVEN_WIELD + rp_ptr->melee_slots)) || ((i >= INVEN_BOW) && (i < INVEN_BOW + rp_ptr->range_slots)) || ((i >= INVEN_FINGER) && (i < INVEN_FINGER + rp_ptr->ring_slots)) || ((i >= INVEN_NECK) && (i < INVEN_NECK + rp_ptr->amulet_slots)) || ((i >= INVEN_LIGHT) && (i < INVEN_LIGHT + rp_ptr->light_slots)) || ((i >= INVEN_BODY) && (i < INVEN_BODY + rp_ptr->body_slots)) || ((i >= INVEN_OUTER) && (i < INVEN_OUTER + rp_ptr->cloak_slots)) || ((i >= INVEN_ARM) && (i < INVEN_ARM + rp_ptr->shield_slots)) || ((i >= INVEN_HEAD) && (i < INVEN_HEAD + rp_ptr->helm_slots)) || ((i >= INVEN_HANDS) && (i < INVEN_HANDS + rp_ptr->glove_slots)) || ((i >= INVEN_FEET) && (i < INVEN_FEET + rp_ptr->boot_slots)) || (i == INVEN_WIELD - 1)) { /* Player flags */ if (i < INVEN_WIELD) { player_flags(f); o_ptr = NULL; } else { /* Get the object */ o_ptr = &p_ptr->inventory[i]; /* Get the "known" flags */ object_flags_known(o_ptr, f); } /* Initialize color based of sign of pval. */ for (stat = 0; stat < A_MAX; stat++) { /* Default */ a = TERM_SLATE; c = '.'; /* Boost */ if (of_has(f, stat_flags[stat]) && (o_ptr != NULL)) { /* Default */ c = '*'; /* Good */ if (o_ptr->pval > 0) { /* Good */ a = TERM_L_GREEN; /* Label boost */ if (o_ptr->pval < 10) c = I2D(o_ptr->pval); } /* Bad */ if (o_ptr->pval < 0) { /* Bad */ a = TERM_RED; /* Label boost */ if (o_ptr->pval > -10) c = I2D(-(o_ptr->pval)); } } /* Sustain */ if (of_has(f, sustain_flags[stat])) { /* Dark green */ a = TERM_GREEN; /* Convert '.' to 's' */ if (c == '.') c = 's'; } if ((c == '.') && (o_ptr != NULL) && o_ptr->k_idx && !object_flag_is_known(o_ptr, sustain_flags[stat])) c = '?'; /* Dump proper character */ Term_putch(col, row+stat, a, c); } /* Advance */ col++; } } /* Check stats */ for (stat = 0; stat < A_MAX; ++stat) { /* Default */ a = TERM_SLATE; c = '.'; /* Sustain */ if (of_has(f, sustain_flags[stat])) { /* Dark green "s" */ a = TERM_GREEN; c = 's'; } /* Dump */ Term_putch(col, row+stat, a, c); } /* Column */ col = 26; /* Footer */ c_put_str(TERM_WHITE, "@abcdefghijklmnopqrstuvwxyz{|}", row+6, col); /* Equippy */ display_player_equippy(row+7, col+1); }
static void display_resistance_panel(const struct player_flag_record *resists, size_t size, const region *bounds) { size_t i; int j; int col = bounds->col; int row = bounds->row; Term_putstr(col, row++, RES_COLS, TERM_WHITE, " @abcdefghijklmnopqrstuvwxyz{|}"); for (i = 0; i < size-3; i++, row++) { byte name_attr = TERM_WHITE; Term_gotoxy(col+6, row); /* repeated extraction of flags is inefficient but more natural */ for (j = INVEN_WIELD - 1; j < INVEN_TOTAL; j++) { if (((j >= INVEN_WIELD) && (j < INVEN_WIELD + rp_ptr->melee_slots)) || ((j >= INVEN_BOW) && (j < INVEN_BOW + rp_ptr->range_slots)) || ((j >= INVEN_FINGER) && (j < INVEN_FINGER + rp_ptr->ring_slots)) || ((j >= INVEN_NECK) && (j < INVEN_NECK + rp_ptr->amulet_slots)) || ((j >= INVEN_LIGHT) && (j < INVEN_LIGHT + rp_ptr->light_slots)) || ((j >= INVEN_BODY) && (j < INVEN_BODY + rp_ptr->body_slots)) || ((j >= INVEN_OUTER) && (j < INVEN_OUTER + rp_ptr->cloak_slots)) || ((j >= INVEN_ARM) && (j < INVEN_ARM + rp_ptr->shield_slots)) || ((j >= INVEN_HEAD) && (j < INVEN_HEAD + rp_ptr->helm_slots)) || ((j >= INVEN_HANDS) && (j < INVEN_HANDS + rp_ptr->glove_slots)) || ((j >= INVEN_FEET) && (j < INVEN_FEET + rp_ptr->boot_slots)) || (j == INVEN_WIELD - 1)) { object_type *o_ptr = &p_ptr->inventory[j]; bitflag f[OF_SIZE]; byte attr = TERM_WHITE | (j % 2) * 8; /* alternating columns */ char sym = '.'; bool res, imm, vuln; /* Wipe flagset */ of_wipe(f); if (j < INVEN_WIELD) { player_flags(f); /* If the race has innate infravision/digging, force the corresponding flag here. If we set it in player_flags(), then all callers of that function will think the infravision is caused by equipment. */ if (rp_ptr->infra > 0) of_on(f, OF_INFRA); if (rp_ptr->r_skills[SKILL_DIGGING] > 0) of_on(f, OF_TUNNEL); } else if (j < INVEN_TOTAL && o_ptr->k_idx) { object_flags_known(o_ptr, f); } res = of_has(f, resists[i].res_flag); imm = of_has(f, resists[i].im_flag); vuln = of_has(f, resists[i].vuln_flag); if (imm) name_attr = TERM_GREEN; else if (res && name_attr == TERM_WHITE) name_attr = TERM_L_BLUE; if (vuln) sym = '-'; else if (imm) sym = '*'; else if (res) sym = '+'; else if ((j < INVEN_TOTAL) && o_ptr->k_idx && !object_flag_is_known(o_ptr, resists[i].res_flag)) sym = '?'; Term_addch(attr, sym); } } Term_putstr(col, row, 6, name_attr, format("%5s:", resists[i].name)); } Term_putstr(col, row++, RES_COLS, TERM_WHITE, " @abcdefghijklmnopqrstuvwxyz{|}"); /* Equippy */ display_player_equippy(row++, col+7); }