示例#1
0
static void _class_help(FILE *fff, int idx)
{
    class_t *class_ptr = get_class_t_aux(idx, 0);
    
    fprintf(fff, "***** <%s>\n", class_ptr->name);
    fprintf(fff, "[[[[r|  %s\n\n", class_ptr->name);
    _wrap_text(fff, class_ptr->desc, 2, 80);
    fprintf(fff, "\n\n");
}
示例#2
0
/*
 * Display the scores in a given range.
 * Assumes the high score list is already open.
 * Only five entries per line, too much info.
 *
 * Mega-Hack -- allow "fake" entry at the given position.
 */
void display_scores_aux(int from, int to, int note, high_score *score)
{
    int        i, j, k, n, place;
    byte attr;

    high_score    the_score;

    char    out_val[256];
    char    tmp_val[160];

    int wid, hgt, per_screen;

    Term_get_size(&wid, &hgt);
    per_screen = (hgt - 4) / 4;

    /* Paranoia -- it may not have opened */
    if (highscore_fd < 0) return;


    /* Assume we will show the first 10 */
    if (from < 0) from = 0;
    if (to < 0) to = 10;
    if (to > MAX_HISCORES) to = MAX_HISCORES;


    /* Seek to the beginning */
    if (highscore_seek(0)) return;

    /* Hack -- Count the high scores */
    for (i = 0; i < MAX_HISCORES; i++)
    {
        if (highscore_read(&the_score)) break;
    }

    /* Hack -- allow "fake" entry to be last */
    if ((note == i) && score) i++;

    /* Forget about the last entries */
    if (i > to) i = to;


    /* Show per_screen per page, until "done" */
    for (k = from, place = k+1; k < i; k += per_screen)
    {
        /* Clear screen */
        Term_clear();

        /* Title */
        put_str("                PosChengband Hall of Fame", 0, 0);


        /* Indicate non-top scores */
        if (k > 0)
        {
            sprintf(tmp_val, "(from position %d)", k + 1);

            put_str(tmp_val, 0, 40);
        }

        /* Dump per_screen entries */
        for (j = k, n = 0; j < i && n < per_screen; place++, j++, n++)
        {
            int pr, pc, pa, clev, mlev, cdun, mdun;

            cptr user, gold, when, aged;


            /* Hack -- indicate death in yellow */
            attr = (j == note) ? TERM_YELLOW : TERM_WHITE;


            /* Mega-Hack -- insert a "fake" record */
            if ((note == j) && score)
            {
                the_score = (*score);
                attr = TERM_L_GREEN;
                score = NULL;
                note = -1;
                j--;
            }

            /* Read a normal record */
            else
            {
                /* Read the proper record */
                if (highscore_seek(j)) break;
                if (highscore_read(&the_score)) break;
            }

            /* Extract the race/class */
            pr = atoi(the_score.p_r);
            pc = atoi(the_score.p_c);
            pa = atoi(the_score.p_a);

            /* Extract the level info */
            clev = atoi(the_score.cur_lev);
            mlev = atoi(the_score.max_lev);
            cdun = atoi(the_score.cur_dun);
            mdun = atoi(the_score.max_dun);

            /* Hack -- extract the gold and such */
            for (user = the_score.uid; isspace(*user); user++) /* loop */;
            for (when = the_score.day; isspace(*when); when++) /* loop */;
            for (gold = the_score.gold; isspace(*gold); gold++) /* loop */;
            for (aged = the_score.turns; isspace(*aged); aged++) /* loop */;

            /* Clean up standard encoded form of "when" */
            if ((*when == '@') && strlen(when) == 9)
            {
                sprintf(tmp_val, "%.4s-%.2s-%.2s",
                    when + 1, when + 5, when + 7);
                when = tmp_val;
            }

            /* Dump some info */
            sprintf(out_val, "%3d.%9s  %s %s the %s %s, Level %d",
                place, the_score.pts,
                seikaku_info[pa].title,
                the_score.who, get_race_t_aux(pr, 0)->name, get_class_t_aux(pc, 0)->name,
                clev);


            /* Append a "maximum level" */
            if (mlev > clev) strcat(out_val, format(" (Max %d)", mlev));


            /* Dump the first line */
            c_put_str(attr, out_val, n*4 + 2, 0);

            /* Another line of info */
            /* Some people die outside of the dungeon */
            if (!cdun)
                sprintf(out_val, 
                    "               Killed by %s on the surface",
                    the_score.how);
            else
                sprintf(out_val, 
                    "               Killed by %s on %s %d",
                    the_score.how, "Dungeon Level", cdun);

            /* Append a "maximum level" */
            if (mdun > cdun) strcat(out_val, format(" (Max %d)", mdun));

            /* Dump the info */
            c_put_str(attr, out_val, n*4 + 3, 0);

            /* And still another line of info */
            sprintf(out_val,
                "               (User %s, Date %s, Gold %s, Turn %s).",
                user, when, gold, aged);

            c_put_str(attr, out_val, n*4 + 4, 0);
        }


        /* Wait for response */
        prt("[Press ESC to quit, any other key to continue.]", hgt - 1, 17);

        j = inkey();
        prt("", hgt - 1, 0);

        /* Hack -- notice Escape */
        if (j == ESCAPE) break;
    }
}
示例#3
0
static void _classes_help(FILE* fff)
{
    int i, j, r;

    fprintf(fff, "[[[[B|  The Classes\n\n");
    for (i = 0; i < MAX_CLASS; i++)
    {
        if (i == CLASS_MONSTER) continue;
        _class_help(fff, i);
    }

    fprintf(fff, "***** <Tables>\n");
    fprintf(fff, "[[[[y|  Table 1 - Class Statistic Bonus Table ---\n\n");

    for (i = 0, r = 0; i < MAX_CLASS; i++)
    {
        class_t     *class_ptr = get_class_t_aux(i, 0);
        caster_info *caster_ptr = 0;
        char         line[255];
        char         tmp[255];

        if (class_ptr->caster_info)
            caster_ptr = class_ptr->caster_info();

        if (i == CLASS_MONSTER) continue;

        if (r % 20 == 0)
            fprintf(fff, "[[[[r|                 STR  INT  WIS  DEX  CON  CHR  Life  BHP  Exp\n");    
        r++;

        sprintf(line, "  %-14s", class_ptr->name);
        for (j = 0; j < 6; j++)
        {
            if (caster_ptr && j == caster_ptr->which_stat && i != CLASS_PSION)
                sprintf(tmp, "[[[[G| %+3d |", class_ptr->stats[j]);
            else
                sprintf(tmp, " %+3d ", class_ptr->stats[j]);
            strcat(line, tmp);
        }
        sprintf(tmp, " %3d%%  %+3d  %3d%%", class_ptr->life, class_ptr->base_hp, class_ptr->exp);
        strcat(line, tmp);
        fprintf(fff, "%s\n", line);
    }
    fprintf(fff, "\n\n");

    fprintf(fff, "[[[[y|  Table 2 - Class Skill Bonus Table\n\n");
    for (i = 0, r = 0; i < MAX_CLASS; i++)
    {
        class_t *class_ptr = get_class_t_aux(i, 0);

        if (i == CLASS_BERSERKER) continue;
        if (i == CLASS_MONSTER) continue;

        if (r % 20 == 0)
            fprintf(fff, "[[[[r|                 Dsrm   Dvce   Save   Stlh  Srch  Prcp  Melee  Bows\n");
        r++;

        fprintf(fff, "  %-14s %2d+%-2d  %2d+%-2d  %2d+%-2d  %4d  %4d  %4d  %2d+%-2d  %2d+%-2d\n", 
            class_ptr->name,
            class_ptr->base_skills.dis, class_ptr->extra_skills.dis, 
            class_ptr->base_skills.dev, class_ptr->extra_skills.dev, 
            class_ptr->base_skills.sav, class_ptr->extra_skills.sav,
            class_ptr->base_skills.stl, 
            class_ptr->base_skills.srh, 
            class_ptr->base_skills.fos,
            class_ptr->base_skills.thn, class_ptr->extra_skills.thn, 
            class_ptr->base_skills.thb, class_ptr->extra_skills.thb
        );
    }
    fprintf(fff, "\n\n");
}
示例#4
0
class_t *get_class_t(void)
{
	return get_class_t_aux(p_ptr->pclass, p_ptr->psubclass);
}