void display_scent_map(void) { int y, x; byte a; int age; /* Redraw map */ prt_map(); /* Update map */ for (y = p_ptr->wy; y < p_ptr->wy + SCREEN_HGT; y++) { for (x = p_ptr->wx; x < p_ptr->wx + SCREEN_WID; x++) { age = get_scent(y, x); /* Must have scent */ if (age == -1) continue; /* Pretty colors by age */ if (age < 10) a = TERM_RED; else if (age < 20) a = TERM_L_RED; else if (age < 30) a = TERM_ORANGE; else if (age < 40) a = TERM_YELLOW; else if (age < 50) a = TERM_L_GREEN; else if (age < 60) a = TERM_GREEN; else if (age < 70) a = TERM_L_BLUE; else a = TERM_BLUE; /* Display player/floors/walls */ if ((y == p_ptr->py) && (x == p_ptr->px)) { // do nothing } // ignore closed doors else if (cave_any_closed_door_bold(y,x)) { // do nothing } // ignore visible monsters else if ((cave_m_idx[y][x] > 0) && (&mon_list[cave_m_idx[y][x]])->ml) { // do nothing } else { print_rel('0' + (age % 10), a, y, x); } } } }
/** * Debug scent trails and noise bursts. */ static void do_cmd_wiz_hack_ben(void) { struct keypress cmd; int py = p_ptr->py; int px = p_ptr->px; int i, y, x, y2, x2; /* Get a "debug command" */ if (!get_com("Press 'S' for scent, 'N' for noise info: ", &cmd)) return; /* Analyze the command */ switch (cmd.code) { case 'S': case 's': { /* Update map */ for (y = Term->offset_y; y <= Term->offset_y + SCREEN_HGT; y++) { for (x = Term->offset_x; x <= Term->offset_x + SCREEN_WID; x++) { byte a; int age = get_scent(y, x); /* Must have scent */ if (age == -1) continue; /* Pretty colors by age */ if (age > SMELL_STRENGTH) a = TERM_L_DARK; else if (age < 10) a = TERM_BLUE; else if (age < 20) a = TERM_L_BLUE; else if (age < 30) a = TERM_GREEN; else if (age < 40) a = TERM_L_GREEN; else if (age < 50) a = TERM_YELLOW; else if (age < 60) a = TERM_ORANGE; else if (age < 70) a = TERM_L_RED; else a = TERM_RED; /* Display player/floors/walls */ if ((y == py) && (x == px)) { print_rel('@', a, y, x); } else { print_rel('0' + (age % 10), a, y, x); } } } /* Prompt */ prt("Scent ages", 0, 0); /* Wait for a keypress */ (void) inkey(); /* Redraw map */ prt_map(); break; } case 'N': case 'n': { /* Get a "debug command" */ if (!get_com ("Press 'D' for direction of flow, 'C' for actual cost values: ", &cmd)) return; if ((cmd.code == 'D') || (cmd.code == 'd')) { /* Update map */ for (y = Term->offset_y; y <= Term->offset_y + SCREEN_HGT; y++) { for (x = Term->offset_x; x <= Term->offset_x + SCREEN_WID; x++) { int lowest_cost = cave_cost[y][x]; int dir = -1; int cost; if (lowest_cost == 0) continue; for (i = 0; i < 8; i++) { /* Get the location */ y2 = y + ddy_ddd[i]; x2 = x + ddx_ddd[i]; cost = cave_cost[y2][x2]; if (!cost) continue; /* If this grid's scent is younger, save it */ if (lowest_cost > cost) lowest_cost = cost; /* If it isn't, look elsewhere */ else continue; /* Save this direction */ dir = i; } /* If we didn't find any younger scent, print a '5' */ if (dir == -1) print_rel('5', TERM_YELLOW, y, x); /* Otherwise, convert to true direction and print */ else { i = ddd[dir]; print_rel('0' + i, TERM_L_BLUE, y, x); } } } /* Prompt */ prt("Directions given to advancing monsters using noise info", 0, 0); /* Wait for a keypress */ (void) inkey(); /* Redraw map */ prt_map(); } /* Actual cost values */ else { int j; struct keypress key; for (i = cost_at_center - 2; i <= 100 + NOISE_STRENGTH; ++i) { /* First show grids with no scent */ if (i == cost_at_center - 2) j = 0; /* Then show specially marked grids (bug-checking) */ else if (i == cost_at_center - 1) j = 255; /* Then show standard grids */ else j = i; /* Update map */ for (y = Term->offset_y; y <= Term->offset_y + SCREEN_HGT; y++) { for (x = Term->offset_x; x <= Term->offset_x + SCREEN_WID; x++) { byte a = TERM_YELLOW; feature_type *f_ptr = &f_info[cave_feat[y][x]]; /* Display proper cost */ if (cave_cost[y][x] != j) continue; /* Display player/floors/walls */ if ((y == py) && (x == px)) { print_rel('@', a, y, x); } else if (!tf_has(f_ptr->flags, TF_NO_SCENT)) { print_rel('*', a, y, x); } else { print_rel('#', a, y, x); } } } /* Prompt */ if (j == 0) { prt("Grids with no scent", 0, 0); } else if (j == 255) { prt("Specially marked grids", 0, 0); } else { prt(format("Depth %d: ", j), 0, 0); } /* Get key */ key = inkey(); if (key.code == ESCAPE) break; /* Redraw map */ prt_map(); } } break; } default: { break; } } /* Done */ prt("", 0, 0); /* Redraw map */ prt_map(); }